Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/
Date: Fri, 02 Apr 2021 11:22:52
Message-Id: 1617362386.b393720bc6e87d16c5013839553c894f2b163961.slyfox@gentoo
1 commit: b393720bc6e87d16c5013839553c894f2b163961
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 2 11:19:46 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 2 11:19:46 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=b393720b
7
8 libsandbox: fix error handling of absolute_path() in check_syscall()
9
10 The failure is initially observed as a test failure on script/5 test
11 (getcwd against infinite recursion). On the test sandbox was ICEing as:
12 * libsandbox.c:check_syscall():984: failure (Bad address):
13 * ISE: rmdir('confdir3')
14 abs_path: (null)
15 res_path: /confdir3
16 errno=14: Bad address
17
18 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
19
20 libsandbox/libsandbox.c | 5 ++++-
21 1 file changed, 4 insertions(+), 1 deletion(-)
22
23 diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
24 index 166516c..3d55dd7 100644
25 --- a/libsandbox/libsandbox.c
26 +++ b/libsandbox/libsandbox.c
27 @@ -895,6 +895,9 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func,
28 bool access, debug, verbose, set;
29
30 absolute_path = resolve_path(file, 0);
31 + if (!absolute_path)
32 + goto error;
33 +
34 /* Do not bother dereferencing symlinks when we are using a function that
35 * itself does not dereference. This speeds things up and avoids updating
36 * the atime implicitly. #415475
37 @@ -980,7 +983,7 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func,
38 }
39
40 /* If we get here, something bad happened */
41 - sb_ebort("ISE: %s(%s)\n"
42 + sb_ebort("ISE: %s('%s')\n"
43 "\tabs_path: %s\n"
44 "\tres_path: %s\n"
45 "\terrno=%i: %s\n",