1 |
commit: 4e871a5e2f25deb65f0e7416178500439f5f761a |
2 |
Author: Felix Janda <felix.janda <AT> posteo <DOT> de> |
3 |
AuthorDate: Sat Feb 22 21:56:18 2014 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 22 21:25:56 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=4e871a5e |
7 |
|
8 |
dev-util/strace: move to tree |
9 |
|
10 |
--- |
11 |
dev-util/strace/files/strace-4.8-musl.patch | 168 ++++++++++++++++++++++++++++ |
12 |
dev-util/strace/metadata.xml | 10 ++ |
13 |
dev-util/strace/strace-4.8-r99.ebuild | 49 ++++++++ |
14 |
3 files changed, 227 insertions(+) |
15 |
|
16 |
diff --git a/dev-util/strace/files/strace-4.8-musl.patch b/dev-util/strace/files/strace-4.8-musl.patch |
17 |
new file mode 100644 |
18 |
index 0000000..ac9cf56 |
19 |
--- /dev/null |
20 |
+++ b/dev-util/strace/files/strace-4.8-musl.patch |
21 |
@@ -0,0 +1,168 @@ |
22 |
+taken from sabotage linux |
23 |
+diff -ru strace-4.8.orig/defs.h strace-4.8/defs.h |
24 |
+--- strace-4.8.orig/defs.h 2013-05-14 14:10:42.000000000 +0000 |
25 |
++++ strace-4.8/defs.h 2013-09-20 14:30:38.785856744 +0000 |
26 |
+@@ -155,7 +155,7 @@ |
27 |
+ || defined(METAG) \ |
28 |
+ || defined(TILE) \ |
29 |
+ || defined(XTENSA) \ |
30 |
+- ) && defined(__GLIBC__) |
31 |
++ ) && defined(__linux__) |
32 |
+ # include <sys/ptrace.h> |
33 |
+ #else |
34 |
+ /* Work around awkward prototype in ptrace.h. */ |
35 |
+@@ -222,7 +222,7 @@ |
36 |
+ # define PTRACE_EVENT_EXIT 6 |
37 |
+ #endif |
38 |
+ |
39 |
+-#if !defined(__GLIBC__) |
40 |
++#if !defined(__GLIBC__) && !defined(PTRACE_PEEKUSER) |
41 |
+ # define PTRACE_PEEKUSER PTRACE_PEEKUSR |
42 |
+ # define PTRACE_POKEUSER PTRACE_POKEUSR |
43 |
+ #endif |
44 |
+diff -ru strace-4.8.orig/desc.c strace-4.8/desc.c |
45 |
+--- strace-4.8.orig/desc.c 2013-05-01 22:39:10.000000000 +0000 |
46 |
++++ strace-4.8/desc.c 2013-09-20 14:30:38.795856744 +0000 |
47 |
+@@ -299,7 +299,7 @@ |
48 |
+ #ifdef X32 |
49 |
+ tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len); |
50 |
+ #else |
51 |
+- tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len); |
52 |
++ tprintf(", start=%ld, len=%ld", (long) fl.l_start, (long) fl.l_len); |
53 |
+ #endif |
54 |
+ if (getlk) |
55 |
+ tprintf(", pid=%lu}", (unsigned long) fl.l_pid); |
56 |
+diff -ru strace-4.8.orig/file.c strace-4.8/file.c |
57 |
+--- strace-4.8.orig/file.c 2013-05-06 18:23:01.000000000 +0000 |
58 |
++++ strace-4.8/file.c 2013-09-20 14:30:38.795856744 +0000 |
59 |
+@@ -632,7 +632,7 @@ |
60 |
+ return 0; |
61 |
+ } |
62 |
+ |
63 |
+-#if _LFS64_LARGEFILE |
64 |
++#if defined _LFS64_LARGEFILE || defined HAVE_LONG_LONG_OFF_T |
65 |
+ int |
66 |
+ sys_truncate64(struct tcb *tcp) |
67 |
+ { |
68 |
+@@ -654,7 +654,7 @@ |
69 |
+ return 0; |
70 |
+ } |
71 |
+ |
72 |
+-#if _LFS64_LARGEFILE |
73 |
++#if defined _LFS64_LARGEFILE || defined HAVE_LONG_LONG_OFF_T |
74 |
+ int |
75 |
+ sys_ftruncate64(struct tcb *tcp) |
76 |
+ { |
77 |
+@@ -2322,7 +2322,7 @@ |
78 |
+ return 0; |
79 |
+ } |
80 |
+ |
81 |
+-#if _LFS64_LARGEFILE |
82 |
++#if defined _LFS64_LARGEFILE || defined HAVE_LONG_LONG_OFF_T |
83 |
+ int |
84 |
+ sys_getdents64(struct tcb *tcp) |
85 |
+ { |
86 |
+diff -ru strace-4.8.orig/net.c strace-4.8/net.c |
87 |
+--- strace-4.8.orig/net.c 2013-05-17 22:20:02.000000000 +0000 |
88 |
++++ strace-4.8/net.c 2013-09-20 14:30:38.805856744 +0000 |
89 |
+@@ -95,12 +95,14 @@ |
90 |
+ #endif |
91 |
+ |
92 |
+ /* Under Linux these are enums so we can't test for them with ifdef. */ |
93 |
++#if !defined(IPPROTO_MAX) |
94 |
+ #define IPPROTO_EGP IPPROTO_EGP |
95 |
+ #define IPPROTO_PUP IPPROTO_PUP |
96 |
+ #define IPPROTO_IDP IPPROTO_IDP |
97 |
+ #define IPPROTO_IGMP IPPROTO_IGMP |
98 |
+ #define IPPROTO_RAW IPPROTO_RAW |
99 |
+ #define IPPROTO_MAX IPPROTO_MAX |
100 |
++#endif |
101 |
+ |
102 |
+ static const struct xlat domains[] = { |
103 |
+ #ifdef PF_UNSPEC |
104 |
+diff -ru strace-4.8.orig/process.c strace-4.8/process.c |
105 |
+--- strace-4.8.orig/process.c 2013-05-17 22:22:19.000000000 +0000 |
106 |
++++ strace-4.8/process.c 2013-09-20 14:30:38.805856744 +0000 |
107 |
+@@ -2857,7 +2857,7 @@ |
108 |
+ if (umove(tcp, tcp->u_arg[2], &p) < 0) |
109 |
+ tprintf(", %#lx", tcp->u_arg[2]); |
110 |
+ else |
111 |
+- tprintf(", { %d }", p.__sched_priority); |
112 |
++ tprintf(", { %d }", p.sched_priority); |
113 |
+ } |
114 |
+ return 0; |
115 |
+ } |
116 |
+@@ -2872,7 +2872,7 @@ |
117 |
+ if (umove(tcp, tcp->u_arg[1], &p) < 0) |
118 |
+ tprintf("%#lx", tcp->u_arg[1]); |
119 |
+ else |
120 |
+- tprintf("{ %d }", p.__sched_priority); |
121 |
++ tprintf("{ %d }", p.sched_priority); |
122 |
+ } |
123 |
+ return 0; |
124 |
+ } |
125 |
+@@ -2885,7 +2885,7 @@ |
126 |
+ if (umove(tcp, tcp->u_arg[1], &p) < 0) |
127 |
+ tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]); |
128 |
+ else |
129 |
+- tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority); |
130 |
++ tprintf("%d, { %d }", (int) tcp->u_arg[0], p.sched_priority); |
131 |
+ } |
132 |
+ return 0; |
133 |
+ } |
134 |
+diff -ru strace-4.8.orig/signal.c strace-4.8/signal.c |
135 |
+--- strace-4.8.orig/signal.c 2013-05-23 13:41:23.000000000 +0000 |
136 |
++++ strace-4.8/signal.c 2013-09-20 14:30:38.815856744 +0000 |
137 |
+@@ -59,6 +59,7 @@ |
138 |
+ #ifdef IA64 |
139 |
+ # include <asm/ptrace_offsets.h> |
140 |
+ #endif |
141 |
++#include <asm/ptrace.h> |
142 |
+ |
143 |
+ #if defined(SPARC) || defined(SPARC64) || defined(MIPS) |
144 |
+ typedef struct { |
145 |
+diff -ru strace-4.8.orig/strace.c strace-4.8/strace.c |
146 |
+--- strace-4.8.orig/strace.c 2013-05-28 21:49:16.000000000 +0000 |
147 |
++++ strace-4.8/strace.c 2013-09-20 14:30:38.815856744 +0000 |
148 |
+@@ -506,7 +506,7 @@ |
149 |
+ perror_msg_and_die("dup2"); |
150 |
+ close(fds[0]); |
151 |
+ } |
152 |
+- execl(_PATH_BSHELL, "sh", "-c", command, NULL); |
153 |
++ execl(_PATH_BSHELL, "sh", "-c", command, (void*) 0); |
154 |
+ perror_msg_and_die("Can't execute '%s'", _PATH_BSHELL); |
155 |
+ } |
156 |
+ |
157 |
+diff -ru strace-4.8.orig/syscall.c strace-4.8/syscall.c |
158 |
+--- strace-4.8.orig/syscall.c 2013-05-14 14:10:42.000000000 +0000 |
159 |
++++ strace-4.8/syscall.c 2013-09-20 14:30:38.825856744 +0000 |
160 |
+@@ -72,13 +72,7 @@ |
161 |
+ # include <elf.h> |
162 |
+ #endif |
163 |
+ |
164 |
+-#if defined(AARCH64) |
165 |
+-# include <asm/ptrace.h> |
166 |
+-#endif |
167 |
+- |
168 |
+-#if defined(XTENSA) |
169 |
+-# include <asm/ptrace.h> |
170 |
+-#endif |
171 |
++#include <asm/ptrace.h> |
172 |
+ |
173 |
+ #ifndef ERESTARTSYS |
174 |
+ # define ERESTARTSYS 512 |
175 |
+diff -ru strace-4.8.orig/time.c strace-4.8/time.c |
176 |
+--- strace-4.8.orig/time.c 2012-05-01 21:17:51.000000000 +0000 |
177 |
++++ strace-4.8/time.c 2013-09-20 14:32:49.165856719 +0000 |
178 |
+@@ -774,7 +774,11 @@ |
179 |
+ /* _pad[0] is the _tid field which might not be |
180 |
+ present in the userlevel definition of the |
181 |
+ struct. */ |
182 |
++#if defined(__GLIBC__) |
183 |
+ tprintf("{%d}", sev._sigev_un._pad[0]); |
184 |
++#else |
185 |
++ tprintf("{%d}", (int) sev.__pad[0]); |
186 |
++#endif |
187 |
+ else if (sev.sigev_notify == SIGEV_THREAD) |
188 |
+ tprintf("{%p, %p}", sev.sigev_notify_function, |
189 |
+ sev.sigev_notify_attributes); |
190 |
|
191 |
diff --git a/dev-util/strace/metadata.xml b/dev-util/strace/metadata.xml |
192 |
new file mode 100644 |
193 |
index 0000000..3134acb |
194 |
--- /dev/null |
195 |
+++ b/dev-util/strace/metadata.xml |
196 |
@@ -0,0 +1,10 @@ |
197 |
+<?xml version="1.0" encoding="UTF-8"?> |
198 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
199 |
+<pkgmetadata> |
200 |
+ <herd>base-system</herd> |
201 |
+ <use> |
202 |
+ <flag name="aio"> |
203 |
+ Enable <pkg>dev-libs/libaio</pkg> support for tracing Asynchronous I/O operations |
204 |
+ </flag> |
205 |
+ </use> |
206 |
+</pkgmetadata> |
207 |
|
208 |
diff --git a/dev-util/strace/strace-4.8-r99.ebuild b/dev-util/strace/strace-4.8-r99.ebuild |
209 |
new file mode 100644 |
210 |
index 0000000..e9fd721 |
211 |
--- /dev/null |
212 |
+++ b/dev-util/strace/strace-4.8-r99.ebuild |
213 |
@@ -0,0 +1,49 @@ |
214 |
+# Copyright 1999-2014 Gentoo Foundation |
215 |
+# Distributed under the terms of the GNU General Public License v2 |
216 |
+# $Header: /var/cvsroot/gentoo-x86/dev-util/strace/strace-4.8.ebuild,v 1.5 2014/02/20 13:36:59 jer Exp $ |
217 |
+ |
218 |
+EAPI="4" |
219 |
+ |
220 |
+inherit flag-o-matic eutils |
221 |
+ |
222 |
+if [[ ${PV} == "9999" ]] ; then |
223 |
+ EGIT_REPO_URI="git://strace.git.sourceforge.net/gitroot/strace/strace" |
224 |
+ inherit git-2 autotools |
225 |
+else |
226 |
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz" |
227 |
+ KEYWORDS="~alpha ~amd64 ~arm arm64 hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux" |
228 |
+fi |
229 |
+ |
230 |
+DESCRIPTION="A useful diagnostic, instructional, and debugging tool" |
231 |
+HOMEPAGE="http://sourceforge.net/projects/strace/" |
232 |
+ |
233 |
+LICENSE="BSD" |
234 |
+SLOT="0" |
235 |
+IUSE="aio +perl static" |
236 |
+ |
237 |
+# strace only uses the header from libaio to decode structs |
238 |
+DEPEND="aio? ( >=dev-libs/libaio-0.3.106 ) |
239 |
+ sys-kernel/linux-headers" |
240 |
+RDEPEND="" |
241 |
+ |
242 |
+src_prepare() { |
243 |
+ if epatch_user || [[ ! -e configure ]] ; then |
244 |
+ # git generation |
245 |
+ eautoreconf |
246 |
+ [[ ! -e CREDITS ]] && cp CREDITS{.in,} |
247 |
+ fi |
248 |
+ |
249 |
+ epatch ${FILESDIR}/${P}-musl.patch |
250 |
+ export ac_cv_have_long_long_off_t=yes |
251 |
+ |
252 |
+ filter-lfs-flags # configure handles this sanely |
253 |
+ use static && append-ldflags -static |
254 |
+ |
255 |
+ export ac_cv_header_libaio_h=$(usex aio) |
256 |
+} |
257 |
+ |
258 |
+src_install() { |
259 |
+ default |
260 |
+ use perl || rm "${ED}"/usr/bin/strace-graph |
261 |
+ dodoc CREDITS |
262 |
+} |