summaryrefslogtreecommitdiff
path: root/src/lib/sandbox
AgeCommit message (Collapse)Author
2022-06-15Enable IP_BIND_ADDRESS_NO_PORT if supportedAlex Xu (Hello71)
2022-05-09Merge branch 'maint-0.4.7'Alexander Færøy
2022-05-09Merge branch 'maint-0.4.6' into maint-0.4.7Alexander Færøy
2022-05-09Merge branch 'maint-0.4.5' into maint-0.4.6Alexander Færøy
2022-05-09sandbox: Permit rseq syscall as wellpmu-ipf
This was found to be necessary in conjunction with glibc 2.35 on Linux. Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-05-04sandbox: replace SCMP_CMP_NEG with masked equality checksPierre Bourdon
For some syscalls the kernel ABI uses 32 bit signed integers. Whether these 32 bit integer values are sign extended or zero extended to the native 64 bit register sizes is undefined and dependent on the {arch, compiler, libc} being used. Instead of trying to detect which cases zero-extend and which cases sign-extend, this commit uses a masked equality check on the lower 32 bits of the value.
2022-04-30sandbox: filter {chown,chmod,rename} via their *at variant on Aarch64Pierre Bourdon
The chown/chmod/rename syscalls have never existed on AArch64, and libc implements the POSIX functions via the fchownat/fchmodat/renameat syscalls instead. Add new filter functions for fchownat/fchmodat/renameat, not made architecture specific since the syscalls exists everywhere else too. However, in order to limit seccomp filter space usage, we only insert rules for one of {chown, chown32, fchownat} depending on the architecture (resp. {chmod, fchmodat}, {rename, renameat}).
2022-04-30sandbox: fix openat filtering on AArch64Pierre Bourdon
New glibc versions not sign-extending 32 bit negative constants seems to not be a thing on AArch64. I suspect that this might not be the only architecture where the sign-extensions is happening, and the correct fix might be instead to use a proper 32 bit comparison for the first openat parameter. For now, band-aid fix this so the sandbox can work again on AArch64.
2022-03-28Merge branch 'maint-0.4.6'David Goulet
2022-03-28Merge branch 'maint-0.4.5' into maint-0.4.6David Goulet
2022-03-28Merge branch 'tor-gitlab/mr/556' into maint-0.4.5David Goulet
2022-03-27Sandbox: Permit the clone3 system callNick Mathewson
Apparently glibc-2.34 uses clone3, when previously it just used clone. Closes ticket #40590.
2021-11-05sandbox: Allow "statx" syscall on i386 for glibc 2.33Simon South
glibc versions 2.33 and newer use the modern "statx" system call in their implementations of stat() and opendir() for Linux on i386. Prevent failures in the sandbox unit tests by modifying the sandbox to allow this system call without restriction on i386 when it is available, and update the test suite to skip the "sandbox/stat_filename" test in this case as it is certain to fail.
2021-11-05sandbox: Allow "clock_gettime64" syscall where definedSimon South
On 32-bit architectures where Linux provides the "clock_gettime64" system call, including i386, glibc uses it in place of "clock_gettime". Modify the sandbox implementation to match, to prevent Tor's monotonic-time functions (in src/lib/time/compat_time.c) failing when the sandbox is active.
2021-11-05sandbox: Filter "chown32" syscall on i386Simon South
On i386 glibc uses the "chown32" system call instead of "chown". Prevent attempts to filter calls to chown() on this architecture from failing by modifying the sandbox implementation to match.
2021-10-14Merge remote-tracking branch 'tor-gitlab/mr/433' into mainAlexander Færøy
2021-09-28sandbox: Allow use with fragile hardeningSimon South
When building with --enable-fragile-hardening, add or relax Linux seccomp rules to allow AddressSanitizer to execute normally if the process terminates with the sandbox active. Further resolves issue 11477.
2021-09-09Fix compilation error when __NR_time is not defined. #40465Daniel Pinto
2021-05-07Merge branch 'maint-0.4.5' into maint-0.4.6Nick Mathewson
2021-05-07Merge branch 'maint-0.4.6'Nick Mathewson
2021-05-07Add a sandbox workaround for Glibc 2.33Nick Mathewson
This change permits the newfstatat() system call, and fixes issues 40382 (and 40381). This isn't a free change. From the commit: // Libc 2.33 uses this syscall to implement both fstat() and stat(). // // The trouble is that to implement fstat(fd, &st), it calls: // newfstatat(fs, "", &st, AT_EMPTY_PATH) // We can't detect this usage in particular, because "" is a pointer // we don't control. And we can't just look for AT_EMPTY_PATH, since // AT_EMPTY_PATH only has effect when the path string is empty. // // So our only solution seems to be allowing all fstatat calls, which // means that an attacker can stat() anything on the filesystem. That's // not a great solution, but I can't find a better one.
2021-03-12Run "make autostyle" in advance of new series.Nick Mathewson
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2020-12-08Fix a couple of documentation comments related to #40094Nick Mathewson
2020-11-12When handling includes, detect missing interned strings earlier.Nick Mathewson
There were three separate places where we were hitting a sandbox Bug warning before we actually exited. Fixes #40094; bugfix on 0.3.1.1-alpha when %includes were introduced.
2020-08-12Merge remote-tracking branch 'tor-gitlab/mr/62'Nick Mathewson
2020-07-29Merge branch 'maint-0.4.4'Nick Mathewson
2020-07-29Merge remote-tracking branch 'tor-gitlab/mr/68' into maint-0.4.4Nick Mathewson
2020-07-29Fix startup crash with seccomp sandbox enabled #40072Daniel Pinto
Fix crash introduced in #40020. On startup, tor calls check_private_dir on the data and key directories. This function uses open instead of opendir on the received directory. Data and key directoryes are only opened here, so the seccomp rule added should be for open instead of opendir, despite the fact that they are directories.
2020-07-21Merge branch 'maint-0.4.4'Nick Mathewson
2020-07-21Merge remote-tracking branch 'tor-gitlab/mr/68' into maint-0.4.4Nick Mathewson
2020-07-21Merge branch 'maint-0.4.4'Nick Mathewson
2020-07-21Merge remote-tracking branch 'tor-gitlab/mr/67' into maint-0.4.4Nick Mathewson
2020-07-20Fix seccomp sandbox rules for openat #27315Daniel Pinto
The need for casting negative syscall arguments depends on the glibc version. This affects the rules for the openat syscall which uses the constant AT_FDCWD that is defined as a negative number. This commit adds logic to only apply the cast when necessary, on glibc versions from 2.27 onwards.
2020-07-20Fix seccomp sandbox rules for opening directories #40020Daniel Pinto
Different versions of glibc use either open or openat for the opendir function. This commit adds logic to use the correct rule for each glibc version, namely: - Until 2.14 open is used - From 2.15 to to 2.21 openat is used - From 2.22 to 2.26 open is used - From 2.27 onwards openat is used
2020-07-20Fix seccomp sandbox rules for openat #27315Daniel Pinto
The need for casting negative syscall arguments depends on the glibc version. This affects the rules for the openat syscall which uses the constant AT_FDCWD that is defined as a negative number. This commit adds logic to only apply the cast when necessary, on glibc versions from 2.27 onwards.
2020-07-15Add support for patterns on %include #25140Daniel Pinto
Also adds generic tor_glob function to expand globs.
2020-07-14Rename blacklist and whitelist wordingDavid Goulet
Closes #40033 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-01Merge branch 'maint-0.4.3' into maint-0.4.4George Kadianakis
2020-07-01Merge branch 'maint-0.4.4'George Kadianakis
2020-07-01Merge branch 'maint-0.4.2' into maint-0.4.3George Kadianakis
2020-07-01Merge branch 'maint-0.3.5' into maint-0.4.2George Kadianakis
2020-06-30Merge branch 'tor-github/pr/1887' into maint-0.4.3Alexander Færøy
2020-06-04sandbox: Do not require M_SYSCALL.Nick Mathewson
M_SYSCALL is used to report information about a sandbox violation, but when we don't have a definition for it, it still makes sense to compile. Closes ticket 34382.
2020-05-12Merge branch 'bug34130_035'Nick Mathewson
2020-05-12Fix crash when tor is compiled with NSS and seccomp sandbox is enabledDaniel Pinto
Adds seccomp rules for socket and getpeername used by NSS
2020-04-09Add fsync to list of syscalls permitted by sandboxNick Mathewson
(Our fix for 33087 requires this, I believe.)
2020-02-26Allow unlinkat() in the seccomp2 sandboxNick Mathewson
Closes ticket 33346.
2020-01-30Merge branch 'maint-0.4.1' into maint-0.4.2teor
2020-01-30Merge branch 'maint-0.4.0' into maint-0.4.1teor