LKML Archive mirror
 help / color / mirror / Atom feed
* selftests: memfd/memfd_test.c: does not compile under AlmaLinux 8.7
@ 2023-05-22 14:43 Mirsad Todorovac
  0 siblings, 0 replies; only message in thread
From: Mirsad Todorovac @ 2023-05-22 14:43 UTC (permalink / raw
  To: Shuah Khan, Jeff Xu, Andrew Morton, Daniel Verkamp, Kees Cook,
	linux-kselftest, linux-kernel

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(-)

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 | \


Hope this helps.

Best regards,
Mirsad

-- 
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu

System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-22 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22 14:43 selftests: memfd/memfd_test.c: does not compile under AlmaLinux 8.7 Mirsad Todorovac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).