mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Change the sandbox behavior on all failed opens() to EACCES
Previously, most disallowed open(O_RDONLY) attempts would EACCES, but others would fail with a crash.
This commit is contained in:
parent
7a74b3663f
commit
9a06282546
6
changes/bug16106
Normal file
6
changes/bug16106
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
o Minor bugfixes (linux seccomp2 sandbox):
|
||||||
|
- Cause a wider variety of unpermitted open() calls to fail with the
|
||||||
|
EACCES error when the sandbox is running. This won't enable any
|
||||||
|
previously non-working functionality, but it should turn several cases
|
||||||
|
from crashes into sandbox warnings. Fixes bug 16106; bugfix on
|
||||||
|
0.2.5.1-alpha.
|
@ -481,18 +481,14 @@ sb_open(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = seccomp_rule_add_1(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(open),
|
rc = seccomp_rule_add_0(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(open));
|
||||||
SCMP_CMP_MASKED(1, O_CLOEXEC|O_NONBLOCK|O_NOCTTY|O_NOFOLLOW,
|
|
||||||
O_RDONLY));
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
log_err(LD_BUG,"(Sandbox) failed to add open syscall, received libseccomp "
|
log_err(LD_BUG,"(Sandbox) failed to add open syscall, received libseccomp "
|
||||||
"error %d", rc);
|
"error %d", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = seccomp_rule_add_1(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(openat),
|
rc = seccomp_rule_add_0(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(openat));
|
||||||
SCMP_CMP_MASKED(2, O_CLOEXEC|O_NONBLOCK|O_NOCTTY|O_NOFOLLOW,
|
|
||||||
O_RDONLY));
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
log_err(LD_BUG,"(Sandbox) failed to add openat syscall, received "
|
log_err(LD_BUG,"(Sandbox) failed to add openat syscall, received "
|
||||||
"libseccomp error %d", rc);
|
"libseccomp error %d", rc);
|
||||||
|
Loading…
Reference in New Issue
Block a user