KVM: selftests: Make rseq compatible with versions prior to glibc-2.30
PATCH 1/1 KVM: selftests: Make rseq compatible with versions prior to glibc-2.30
The fix for commit e923b0537d28 ("KVM: selftests: Fix target thread to be migrated in rseq_test") added a call to gettid() which was only added to glibc-2.30 and fails to
compile with older glibc versions.
rseq_test.c: In function 'main':
rseq_test.c:230:33: warning: implicit declaration of function 'gettid'; did you mean 'getgid'? [-Wimplicit-function-declaration]
(void *)(unsigned long)gettid());
^~~~~~
getgidSwitch the call to syscall(SYS_gettid) which was the original advice in the gettid(2) NOTES section and which works with both new and older glibc versions.
---
Verified with glibc-2.28 and glibc-2.34 and ensured test case from e923b0537d28 still passes.
tools/testing/selftests/kvm/rseq_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/rseq_test.c +1 -1
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])ucall_init (vm,NULL );pthread_create (&migration_thread,NULL , migration_worker, - (void *)(unsigned long )gettid ()); + (void *)(unsigned long )syscall (SYS_gettid));for (i =0 ; !done; i++) {vcpu_run (vcpu);
Signature · 1 line
2.31.1
Sean Christopherson
reviewerQuoted 28 lines · Liam Merwick
The fix for commit
e923b0537d28("KVM: selftests: Fix target thread to be migrated inrseq_test") added a call togettid()which was only added to glibc-2.30 and fails to
compile with older glibc versions.
rseq_test.c: In function 'main':
rseq_test.c:230:33: warning: implicit declaration of function 'gettid'; did you mean 'getgid'? [-Wimplicit-function-declaration](void *)(unsigned long)gettid()); ^~~~~~ getgidSwitch the call to
syscall(SYS_gettid)which was the original advice in the gettid(2) NOTES section and which works with both new and older glibc versions.Fixes e923b0537d28 ("KVM: selftests: Fix target thread to be migrated in rseq_test")Cc [email protected] # v5.15Signed-off-by Liam Merwick <[email protected]>---
Verified with glibc-2.28 and glibc-2.34 and ensured test case from
e923b0537d28still passes.tools/testing/selftests/kvm/rseq_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/kvm/rseq_test.c +0
-0
tools/testing/selftests/kvm/rseq_test.c int main(int argc, char *argv[]) · line 230
Quoted 5 lines
tools/testing/selftests/kvm/rseq_test.c +1
-1@@ -227,7 +227,7 @@ int main(int argc, char *argv[])ucall_init (vm,NULL );pthread_create (&migration_thread,NULL , migration_worker, - (void *)(unsigned long )gettid ()); + (void *)(unsigned long )syscall (SYS_gettid));
This exact fix was already posted[*], but we rat-holed a bit on coming up with an elegant solution and the patch never got applied. I'll poke that thread to see if Paolo wants to take it for 6.0.