Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/
Date: Sun, 20 Sep 2015 08:15:45
Message-Id: 1442734816.c17c4b85ca9e9af75bc16c9e49b6bf0b3ee6b4c8.vapier@gentoo
1 commit: c17c4b85ca9e9af75bc16c9e49b6bf0b3ee6b4c8
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 20 07:40:16 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 20 07:40:16 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=c17c4b85
7
8 libsandbox: work around process_vm_readv EFAULTs
9
10 Some people are seeing this call fail, but it's not clear why. Include
11 more debugging output so as to improve the reports, and let the code fall
12 back to the existing ptrace logic since that seems to work. This will at
13 least unblock people's builds.
14
15 URL: https://bugs.gentoo.org/560396
16 Reported-by: Jeroen Roovers <jer <AT> gentoo.org>
17 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
18
19 libsandbox/trace.c | 17 +++++++++++++++--
20 1 file changed, 15 insertions(+), 2 deletions(-)
21
22 diff --git a/libsandbox/trace.c b/libsandbox/trace.c
23 index 1d40392..ed05c4d 100644
24 --- a/libsandbox/trace.c
25 +++ b/libsandbox/trace.c
26 @@ -104,10 +104,23 @@ static char *do_peekstr(unsigned long lptr)
27
28 while (1) {
29 if (process_vm_readv(trace_pid, &liov, 1, &riov, 1, 0) == -1) {
30 - if (errno == ENOSYS)
31 + int e = errno;
32 + if (e == ENOSYS)
33 break;
34 + sb_eqawarn("process_vm_readv(%i, %p{%p, %zu}, 1, %p{%p, %zu}, 1, 0) failed: %s\n",
35 + trace_pid,
36 + &liov, liov.iov_base, liov.iov_len,
37 + &riov, riov.iov_base, riov.iov_len,
38 + strerror(e));
39 + if (e == EFAULT) {
40 + /* This sometimes happens, but it's not clear why.
41 + * Throw some extended debugging info before falling
42 + * back to the ptrace code. #560396
43 + */
44 + break;
45 + }
46 sb_ebort("ISE:do_peekstr: process_vm_readv() hates us: %s\n",
47 - strerror(errno));
48 + strerror(e));
49 }
50
51 for (i = 0; i < liov.iov_len; ++i)