]> granicus.if.org Git - strace/commitdiff
Fix build for no-MMU targets
authorBaruch Siach <baruch@tkos.co.il>
Tue, 8 Jan 2019 16:36:20 +0000 (18:36 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 8 Jan 2019 02:27:18 +0000 (02:27 +0000)
Commit 7488ce9e23f1 "Check whether PTRACE_GET_SYSCALL_INFO is supported
by the kernel" added a fork() call in test_ptrace_get_syscall_info()
which is included in the main strace executable code.  Although the
test_ptrace_get_syscall_info() routine is not called on no-MMU targets,
the compiler can't optimize it out because it is a global symbol.
So build for no-MMU targets currently fails:

strace-ptrace_syscall_info.o: In function `test_ptrace_get_syscall_info':
ptrace_syscall_info.c:(.text+0x1c): undefined reference to `fork'

* ptrace_syscall_info.c (test_ptrace_get_syscall_info): Make
the definition depend on HAVE_FORK.
* strace.c (init): Call test_ptrace_get_syscall_info unconditionally.
* NEWS: Mention this fix.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.26~50 "Check whether PTRACE_GET_SYSCALL_INFO is supported by the kernel"
NEWS
ptrace_syscall_info.c
strace.c

diff --git a/NEWS b/NEWS
index 151b2cfd36fa43e26e8d49ab9e6573f17312d762..8df5926f69338a9631a67abd0cedf713b483d530 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Noteworthy changes in release ?.?? (????-??-??)
 
 * Bug fixes
   * Fixed strace-k test on alpha.
+  * Fixed build on NOMMU architectures.
 
 Noteworthy changes in release 4.26 (2018-12-26)
 ===============================================
index 55eafddf7f71587b30c816e754cd0c9ba5900959..7af5eb2730db075f6185c1e1a6ee3252ae049ccf 100644 (file)
@@ -43,6 +43,11 @@ static const unsigned int expected_seccomp_size =
 bool
 test_ptrace_get_syscall_info(void)
 {
+       /*
+        * NOMMU provides no forks necessary for PTRACE_GET_SYSCALL_INFO test,
+        * leave the default unchanged.
+        */
+#ifdef HAVE_FORK
        static const unsigned long args[][7] = {
                /* a sequence of architecture-agnostic syscalls */
                {
@@ -252,6 +257,7 @@ done:
                debug_msg("PTRACE_GET_SYSCALL_INFO works");
        else
                debug_msg("PTRACE_GET_SYSCALL_INFO does not work");
+#endif /* HAVE_FORK */
 
        return ptrace_get_syscall_info_supported;
 }
index 06e2796a9a21fd01400a54e6eef98259147e8e7c..cdaafa87f6815ad92d6439ebf5aa8fb72cb49ce4 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1800,13 +1800,7 @@ init(int argc, char *argv[])
                                     PTRACE_O_TRACEVFORK;
        debug_msg("ptrace_setoptions = %#x", ptrace_setoptions);
        test_ptrace_seize();
-
-       /*
-        * NOMMU provides no forks necessary for PTRACE_GET_SYSCALL_INFO test,
-        * leave the default unchanged.
-        */
-       if (!NOMMU_SYSTEM)
-               test_ptrace_get_syscall_info();
+       test_ptrace_get_syscall_info();
 
        /*
         * Is something weird with our stdin and/or stdout -