Re: [PATCH v3 7/7] selftests/exec: Add READ_IMPLIES_EXEC tests

From: shuah
Date: Tue Feb 11 2020 - 13:11:24 EST


On 2/10/20 12:30 PM, Kees Cook wrote:
In order to check the matrix of possible states for handling
READ_IMPLIES_EXEC across native, compat, and the state of PT_GNU_STACK,
add tests for these execution conditions.

Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>

No issues for this to go through tip.

A few problems to fix first. This fails to compile when 32-bit libraries
aren't installed. It should fail the 32-bit part and run other checks.

make kselftest TARGETS=exec
make --no-builtin-rules ARCH=x86 -C ../../.. headers_install
make[2]: Entering directory '/lkml/linux_5.6'
INSTALL ./usr/include
make[2]: Leaving directory '/lkml/linux_5.6'
make[2]: Entering directory '/lkml/linux_5.6/tools/testing/selftests/exec'
gcc -m32 -Wall -Wno-nonnull -D_GNU_SOURCE -Wl,-z,noexecstack -o /lkml/linux_5.6/tools/testing/selftests/exec/rie-compat-nx-gnu-stack.new read_implies_exec.c
readelf -Wl /lkml/linux_5.6/tools/testing/selftests/exec/rie-compat-nx-gnu-stack.new | grep GNU_STACK | grep -q 'RW ' && \
mv /lkml/linux_5.6/tools/testing/selftests/exec/rie-compat-nx-gnu-stack.new /lkml/linux_5.6/tools/testing/selftests/exec/rie-compat-nx-gnu-stack
In file included from /usr/lib/gcc/x86_64-linux-gnu/9/include/stdint.h:9,
from read_implies_exec.c:6:
/usr/include/stdint.h:26:10: fatal error: bits/libc-header-start.h: No such file or directory
26 | #include <bits/libc-header-start.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
readelf: Error: '/lkml/linux_5.6/tools/testing/selftests/exec/rie-compat-nx-gnu-stack.new': No such file
make[2]: *** [Makefile:58: /lkml/linux_5.6/tools/testing/selftests/exec/rie-compat-nx-gnu-stack] Error 1
make[2]: Leaving directory '/lkml/linux_5.6/tools/testing/selftests/exec'
make[1]: *** [Makefile:150: all] Error 2
make: *** [Makefile:1217: kselftest] Error 2

thanks,
-- Shuah