Re: [PATCH] selftests/x86/fsgsbase: Fix some test case bugs

From: Bae, Chang Seok
Date: Tue Jul 02 2019 - 20:30:03 EST



> On Jul 2, 2019, at 14:38, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>
> @@ -494,16 +489,24 @@ static void test_ptrace_write_gsbase(void)
> * selector value is changed or not by the GSBASE write in
> * a ptracer.
> */
> - if (gs != 0x7) {
> + if (gs != *shared_scratch) {
> nerrs++;
> printf("[FAIL]\tGS changed to %lx\n", gs);

There is one more point to be fixed like this.
So, this diff also needs to be applied:

diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c
index de8c80a..c9da4c5 100644
--- a/tools/testing/selftests/x86/fsgsbase.c
+++ b/tools/testing/selftests/x86/fsgsbase.c
@@ -472,7 +472,7 @@ static void test_ptrace_write_gsbase(void)

gs = ptrace(PTRACE_PEEKUSER, child, gs_offset, NULL);

- if (gs != 0x7) {
+ if (gs != *shared_scratch) {
nerrs++;
printf("[FAIL]\tGS is not prepared with nonzero\n");
goto END;

Thanks for the cleanup & the fix!