diff mbox series

selftests: memfd/memfd_test.c: does not compile under AlmaLinux 8.7

Message ID 0ed660e3-1261-7c97-8fa7-7145743c4650@alu.unizg.hr (mailing list archive)
State New
Headers show
Series selftests: memfd/memfd_test.c: does not compile under AlmaLinux 8.7 | expand

Commit Message

Mirsad Todorovac May 22, 2023, 2:43 p.m. UTC
Hi,

On AlmaLinux 8.7, make kselftest-all fails at memfd/memfd_test.c:

make[2]: Entering directory '/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/memfd'
gcc -D_FILE_OFFSET_BITS=64 -isystem /home/marvin/linux/kernel/linux_torvalds/usr/include     memfd_test.c common.c  -o 
/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/memfd/memfd_test
memfd_test.c: In function ‘test_seal_future_write’:
memfd_test.c:916:27: error: ‘F_SEAL_FUTURE_WRITE’ undeclared (first use in this function); did you mean ‘F_SEAL_WRITE’?
   mfd_assert_add_seals(fd, F_SEAL_FUTURE_WRITE);
                            ^~~~~~~~~~~~~~~~~~~
                            F_SEAL_WRITE
memfd_test.c:916:27: note: each undeclared identifier is reported only once for each function it appears in
memfd_test.c: In function ‘test_exec_seal’:
memfd_test.c:36:7: error: ‘F_SEAL_FUTURE_WRITE’ undeclared (first use in this function); did you mean ‘F_SEAL_WRITE’?
        F_SEAL_FUTURE_WRITE | \
        ^~~~~~~~~~~~~~~~~~~
memfd_test.c:1058:27: note: in expansion of macro ‘F_WX_SEALS’
   mfd_assert_has_seals(fd, F_WX_SEALS);
                            ^~~~~~~~~~
make[2]: *** [../lib.mk:147: /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/memfd/memfd_test] Error 1
make[2]: Leaving directory '/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/memfd'

Apparently, the include file include/uapi/linux/fcntl.h defines this
F_SEAL_FUTURE_WRITE as 0x0010:

include/uapi/linux/fcntl.h:45:#define F_SEAL_FUTURE_WRITE	0x0010  /* prevent future writes while mapped */

This patch fixed the issue:

---
  tools/testing/selftests/memfd/memfd_test.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)



Hope this helps.

Best regards,
Mirsad
diff mbox series

Patch

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index dba0e8ba002f..868f17c02e32 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -28,7 +28,13 @@ 
  #define MFD_DEF_SIZE 8192
  #define STACK_SIZE 65536

-#define F_SEAL_EXEC    0x0020
+#ifndef F_SEAL_FUTURE_WRITE
+#define F_SEAL_FUTURE_WRITE    0x0010
+#endif
+
+#ifndef F_SEAL_EXEC
+#define F_SEAL_EXEC            0x0020
+#endif

  #define F_WX_SEALS (F_SEAL_SHRINK | \
                     F_SEAL_GROW | \