guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: gnu: elfutils: Work around PTRACE_ATTACH-induced test failures.


From: Ludovic Courtès
Subject: 01/02: gnu: elfutils: Work around PTRACE_ATTACH-induced test failures.
Date: Sat, 11 Apr 2015 15:08:43 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit cc1e1b38c9410d2e5cf8e5259dafc3215c579533
Author: Ludovic Courtès <address@hidden>
Date:   Sat Apr 11 17:02:30 2015 +0200

    gnu: elfutils: Work around PTRACE_ATTACH-induced test failures.
    
    * gnu/packages/patches/elfutils-tests-ptrace.patch: New file.
    * gnu-system.am (dist_patch_DATA): Add it.
    * gnu/packages/elf.scm (elfutils)[source]: Use it.
---
 gnu-system.am                                    |    1 +
 gnu/packages/elf.scm                             |    6 ++-
 gnu/packages/patches/elfutils-tests-ptrace.patch |   64 ++++++++++++++++++++++
 3 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/gnu-system.am b/gnu-system.am
index 0f9da34..8ad58d0 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -408,6 +408,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/doxygen-tmake.patch                     \
   gnu/packages/patches/duplicity-piped-password.patch          \
   gnu/packages/patches/duplicity-test_selection-tmp.patch      \
+  gnu/packages/patches/elfutils-tests-ptrace.patch             \
   gnu/packages/patches/eudev-rules-directory.patch             \
   gnu/packages/patches/findutils-absolute-paths.patch          \
   gnu/packages/patches/flashrom-use-libftdi1.patch             \
diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index 540478c..7f9ac8a 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2014, 2015 Mark H Weaver <address@hidden>
 ;;; Copyright © 2015 Andreas Enge <address@hidden>
 ;;;
@@ -38,7 +38,9 @@
                     version "/elfutils-" version ".tar.bz2"))
               (sha256
                (base32
-                "0w50szymyqvx8g0vkwrvnv17grqxva6x1z9dm9m3i99zg2hr232p"))))
+                "0w50szymyqvx8g0vkwrvnv17grqxva6x1z9dm9m3i99zg2hr232p"))
+              (patches
+               (list (search-patch "elfutils-tests-ptrace.patch")))))
     (build-system gnu-build-system)
 
     ;; Separate programs because that's usually not what elfutils users want,
diff --git a/gnu/packages/patches/elfutils-tests-ptrace.patch 
b/gnu/packages/patches/elfutils-tests-ptrace.patch
new file mode 100644
index 0000000..cd46999
--- /dev/null
+++ b/gnu/packages/patches/elfutils-tests-ptrace.patch
@@ -0,0 +1,64 @@
+This patch allows us to skip tests that require PTRACE_ATTACH in situations
+where PTRACE_ATTACH is only allowed when CAP_SYS_PTRACE is held (i.e., for
+root, by default.)
+
+Reported at <https://bugzilla.redhat.com/show_bug.cgi?id=1210966>.
+
+--- elfutils-0.161/tests/run-deleted.sh        2015-04-11 16:38:33.028556235 
+0200
++++ elfutils-0.161/tests/run-deleted.sh        2015-04-11 16:46:15.012442185 
+0200
+@@ -17,6 +17,15 @@
+ 
+ . $srcdir/backtrace-subr.sh
+ 
++# Check whether the Yama policy allows us to use PTRACE_ATTACH.
++if [ -f /proc/sys/kernel/yama/ptrace_scope ]
++then
++    if [ `cat /proc/sys/kernel/yama/ptrace_scope` -ne 0 ]
++    then
++      exit 77
++    fi
++fi
++
+ tempfiles deleted deleted-lib.so
+ cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
+ 
+--- elfutils-0.161/tests/vdsosyms.c    2015-04-11 16:40:20.633461110 +0200
++++ elfutils-0.161/tests/vdsosyms.c    2015-04-11 16:45:06.611866677 +0200
+@@ -23,6 +23,8 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include <unistd.h>
+ #include ELFUTILS_HEADER(dwfl)
+ 
+@@ -68,6 +70,7 @@ module_callback (Dwfl_Module *mod, void
+ int
+ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
+ {
++  static const char ptrace_scope_file[] = 
"/proc/sys/kernel/yama/ptrace_scope";
+   static char *debuginfo_path;
+   static const Dwfl_Callbacks proc_callbacks =
+     {
+@@ -76,6 +79,20 @@ main (int argc __attribute__ ((unused)),
+ 
+       .find_elf = dwfl_linux_proc_find_elf,
+     };
++
++  /* Check whether the Yama policy allows us to use PTRACE_ATTACH.  */
++  int ptrace_scope = open (ptrace_scope_file, O_RDONLY);
++  if (ptrace_scope >= 0)
++    {
++      char buf[10];
++      int count = read (ptrace_scope, buf, sizeof buf);
++      assert (count > 0);
++      if (buf[0] != '0')
++      /* We're not allowed, so skip this test.  */
++      return 77;
++      close (ptrace_scope);
++    }
++
+   Dwfl *dwfl = dwfl_begin (&proc_callbacks);
+   if (dwfl == NULL)
+     error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]