Skip to contentSkip to conversation

ptrace: Fix build problems with glibc-2.18

PATCH Superseded Markos Chandras 2 participants 3 messages Nov 22, 2013 – Nov 25, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ptrace: Fix build problems with glibc-2.18

Since glibc-2.18, the struct ptrace_peeksiginfo_args is also defined in sys/ptrace.h and conflicts with the definition from the Linux kernel in linux/ptrace.h. We fix this by not including the linux/ptrace.h header if the sys/ptrace.h header defines the said struct. Fixes
https://github.com/linux-test-project/ltp/issues/6

---
Build tested on glibc-2.17 and glibc-2.18 systems

---
 configure.ac                              | 4 ++++
 include/config.h.default                  | 3 +++
 testcases/kernel/syscalls/ptrace/ptrace.h | 4 +++-
 3 files changed, 10 insertions(+), 1 deletion(-)
configure.ac +4 -0
index 4846afd..d427276 100644
@@ -48,6 +48,10 @@ AC_CHECK_HEADERS([ \
     sys/prctl.h \
 ])
 
+# glibc-2.18 defines ptrace_peeksiginfo_args in sys/ptrace.h which
+# conflicts with the one from linux kernel in linux/ptrace.h
+AC_CHECK_TYPES([struct ptrace_peeksiginfo_args],,,[#include <sys/ptrace.h>])
+
 # Tools knobs
 
 # Expect
include/config.h.default +3 -0
index 96e25c4..f226333 100644
@@ -167,6 +167,9 @@
 /* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */
 #undef HAVE_STRUCT_MODIFY_LDT_LDT_S
 
+/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */
+#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARG
+
 /* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */
 #undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
 
testcases/kernel/syscalls/ptrace/ptrace.h +3 -1
index f0767d7..4a43f01 100644
@@ -19,7 +19,9 @@
 # include <asm/ptrace.h>
 #endif
 #ifdef HAVE_LINUX_PTRACE_H
-# include <linux/ptrace.h>
+# ifndef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  include <linux/ptrace.h>
+# endif
 #endif
 #undef FU_ia64_fpreg
 #undef FU_pt_all_user_regs
Signature · 14 lines
1.8.4.3



------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 21 lines · Markos Chandras

Since glibc-2.18, the struct ptrace_peeksiginfo_args is also defined in sys/ptrace.h and conflicts with the definition from the Linux kernel in linux/ptrace.h. We fix this by not including the linux/ptrace.h header if the sys/ptrace.h header defines the said struct. Fixes
https://github.com/linux-test-project/ltp/issues/6

---
Build tested on glibc-2.17 and glibc-2.18 systems

---
 configure.ac                              | 4 ++++
 include/config.h.default                  | 3 +++
 testcases/kernel/syscalls/ptrace/ptrace.h | 4 +++-
 3 files changed, 10 insertions(+), 1 deletion(-)
configure.ac +0 -0
index 4846afd..d427276 100644

configure.ac AC_CHECK_HEADERS([ \ · line 53

Quoted 6 lines
configure.ac +3 -0
@@ -48,6 +48,10 @@ AC_CHECK_HEADERS([ \
     sys/prctl.h \
 ])
 
+# glibc-2.18 defines ptrace_peeksiginfo_args in sys/ptrace.h which
+# conflicts with the one from linux kernel in linux/ptrace.h
+AC_CHECK_TYPES([struct ptrace_peeksiginfo_args],,,[#include <sys/ptrace.h>])

We generally place this like checks to m4/*.

Quoted 9 lines
configure.ac +1 -0
+
 # Tools knobs
 
 # Expect
include/config.h.default +0 -0
index 96e25c4..f226333 100644

include/config.h.default line 171

Quoted 5 lines
include/config.h.default +2 -0
@@ -167,6 +167,9 @@
 /* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */
 #undef HAVE_STRUCT_MODIFY_LDT_LDT_S
 
+/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */
+#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARG

Missed an "S" here?

Thanks,
Wanlong Gao

Quoted 10 lines
include/config.h.default +1 -0
+
 /* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */
 #undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
 
testcases/kernel/syscalls/ptrace/ptrace.h +0 -0
index f0767d7..4a43f01 100644

testcases/kernel/syscalls/ptrace/ptrace.h line 27

Quoted 10 lines
testcases/kernel/syscalls/ptrace/ptrace.h +3 -1
@@ -19,7 +19,9 @@
 # include <asm/ptrace.h>
 #endif
 #ifdef HAVE_LINUX_PTRACE_H
-# include <linux/ptrace.h>
+# ifndef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  include <linux/ptrace.h>
+# endif
 #endif
 #undef FU_ia64_fpreg
 #undef FU_pt_all_user_regs

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 55 lines · Wanlong Gao
Quoted 21 lines · Markos Chandras

Since glibc-2.18, the struct ptrace_peeksiginfo_args is also defined in sys/ptrace.h and conflicts with the definition from the Linux kernel in linux/ptrace.h. We fix this by not including the linux/ptrace.h header if the sys/ptrace.h header defines the said struct. Fixes
https://github.com/linux-test-project/ltp/issues/6

---
Build tested on glibc-2.17 and glibc-2.18 systems

---
  configure.ac                              | 4 ++++
  include/config.h.default                  | 3 +++
  testcases/kernel/syscalls/ptrace/ptrace.h | 4 +++-
  3 files changed, 10 insertions(+), 1 deletion(-)
configure.ac +0 -0
index 4846afd..d427276 100644

configure.ac AC_CHECK_HEADERS([ \ · line 53

Quoted 6 lines
configure.ac +3 -0
@@ -48,6 +48,10 @@ AC_CHECK_HEADERS([ \
      sys/prctl.h \
  ])
 
+# glibc-2.18 defines ptrace_peeksiginfo_args in sys/ptrace.h which
+# conflicts with the one from linux kernel in linux/ptrace.h
+AC_CHECK_TYPES([struct ptrace_peeksiginfo_args],,,[#include <sys/ptrace.h>])

We generally place this like checks to m4/*.

Quoted 9 lines
configure.ac +1 -0
+
  # Tools knobs
 
  # Expect
include/config.h.default +0 -0
index 96e25c4..f226333 100644

include/config.h.default line 171

Quoted 5 lines
include/config.h.default +2 -0
@@ -167,6 +167,9 @@
  /* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */
  #undef HAVE_STRUCT_MODIFY_LDT_LDT_S
 
+/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */
+#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARG

Missed an "S" here?

Thanks,
Wanlong Gao

Quoted 4 lines
include/config.h.default +1 -0
+
  /* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */
  #undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
 
Quoted 17 lines
Quoted 6 lines
testcases/kernel/syscalls/ptrace/ptrace.h +0 -0
index f0767d7..4a43f01 100644

testcases/kernel/syscalls/ptrace/ptrace.h line 27

Quoted 10 lines
testcases/kernel/syscalls/ptrace/ptrace.h +3 -1
@@ -19,7 +19,9 @@
  # include <asm/ptrace.h>
  #endif
  #ifdef HAVE_LINUX_PTRACE_H
-# include <linux/ptrace.h>
+# ifndef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
+#  include <linux/ptrace.h>
+# endif
  #endif
  #undef FU_ia64_fpreg
  #undef FU_pt_all_user_regs

Thanks for the review. I will send a v2 soon

Signature · 13 lines
markos


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list