Re: [PATCH 0/5] Minor selftests improvements

From: Ingo Molnar
Date: Tue Nov 07 2017 - 05:13:35 EST



* Andy Lutomirski <luto@xxxxxxxxxx> wrote:

> This improves and robustifies the ldt_gdt test and fixes compiler warnings
> in the protection_keys test.
>
> Andy Lutomirski (5):
> selftests/x86/protection_keys: Fix syscall NR redefinition warnings
> selftests/x86/ldt_gdt: Robustify against set_thread_area() and LAR
> oddities
> selftests/x86/ldt_gdt: Add infrastructure to test set_thread_area()
> selftests/x86/ldt_gdt: Run most existing LDT test cases against the
> GDT as well
> selftests/x86/ldt_get: Add a few additional tests for limits
>
> tools/testing/selftests/x86/ldt_gdt.c | 88 +++++++++++++++++++++------
> tools/testing/selftests/x86/protection_keys.c | 24 ++++++--
> 2 files changed, 88 insertions(+), 24 deletions(-)

I'm still getting this build failure when typing 'make' in tools/testing/selftests/x86:

gcc -m32 -o /home/mingo/tip/tools/testing/selftests/x86/protection_keys_32 -O2 -g -std=gnu99 -pthread -Wall -no-pie protection_keys.c -lrt -ldl -lm
In file included from /usr/include/signal.h:57:0,
from protection_keys.c:33:
protection_keys.c: In function âsignal_handlerâ:
protection_keys.c:253:6: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â.â token
u64 si_pkey;
^
protection_keys.c:253:6: error: expected expression before â.â token

...
Makefile:47: recipe for target '/home/mingo/tip/tools/testing/selftests/x86/protection_keys_32' failed

Plus I'm also getting these warnings even with all your fixes applied:

gcc -m32 -o /home/mingo/tip/tools/testing/selftests/x86/mpx-mini-test_32 -O2 -g -std=gnu99 -pthread -Wall -no-pie mpx-mini-test.c -lrt -ldl -lm
mpx-mini-test.c: In function âinsn_test_failedâ:
mpx-mini-test.c:1406:3: warning: array subscript is above array bounds [-Warray-bounds]
printf("bte[1]: %lx\n", bte->contents[1]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpx-mini-test.c:1407:3: warning: array subscript is above array bounds [-Warray-bounds]
printf("bte[2]: %lx\n", bte->contents[2]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpx-mini-test.c:1408:3: warning: array subscript is above array bounds [-Warray-bounds]
printf("bte[3]: %lx\n", bte->contents[3]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks,

Ingo