commit:     124f3e448e7a0c4680fbff2306a3e2c9354bde77
Author:     Aliaksei Urbanski <aliaksei.urbanski <AT> gmail <DOT> com>
AuthorDate: Wed Nov  8 01:58:52 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 23 13:31:19 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=124f3e44

Fix fuzz-dumpelf test

Not sure why, but the dumpelf.fuzz fuzzer fails when it's calling
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, ...) at security_init.
So I suggest disabling seccomp for fuzzy testing.

Also, in order to not run indefinitely,
the fuzzer must be executed with some reasonable options.
https://releases.llvm.org/14.0.0/docs/LibFuzzer.html#options

Signed-off-by: Aliaksei Urbanski <aliaksei.urbanski <AT> gmail.com>
Closes: https://github.com/gentoo/pax-utils/pull/13
Signed-off-by: Sam James <sam <AT> gentoo.org>

 meson.build | 8 +++++++-
 security.c  | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 0cb9a0e..255107b 100644
--- a/meson.build
+++ b/meson.build
@@ -166,6 +166,12 @@ if do_tests and get_option('use_fuzzing')
       link_args : fuzz_flags,
       install : false
     )
-    test('fuzz-dumpelf', dumpelf_fuzzer)
+    test('fuzz-dumpelf', dumpelf_fuzzer,
+      args : [
+        '-close_fd_mask=3',
+        '-max_total_time=10',
+        '-print_final_stats',
+      ]
+    )
   endif
 endif

diff --git a/security.c b/security.c
index 19bf78f..7122a7f 100644
--- a/security.c
+++ b/security.c
@@ -46,6 +46,10 @@
 # undef WANT_SECCOMP
 #endif
 
+#if PAX_UTILS_LIBFUZZ
+# undef WANT_SECCOMP
+#endif
+
 static int ns_unshare(int flags)
 {
        int flag, ret = 0;

Reply via email to