mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Fix crash when calling openat with sandbox enabled #25440
The seccomp rule for the openat syscall checks for the AT_FDCWD constant. Because this constant is usually a negative value, a cast to unsigned int is necessary to make sure it does not get converted to uint64_t used by seccomp. More info on: https://github.com/seccomp/libseccomp/issues/69#issuecomment-273805980
This commit is contained in:
committed by
Nick Mathewson
parent
42c6ebda16
commit
a350f216b3
@@ -469,7 +469,7 @@ allow_file_open(scmp_filter_ctx ctx, int use_openat, const char *file)
|
||||
{
|
||||
if (use_openat) {
|
||||
return seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat),
|
||||
SCMP_CMP_STR(0, SCMP_CMP_EQ, AT_FDCWD),
|
||||
SCMP_CMP(0, SCMP_CMP_EQ, (unsigned int)AT_FDCWD),
|
||||
SCMP_CMP_STR(1, SCMP_CMP_EQ, file));
|
||||
} else {
|
||||
return seccomp_rule_add_1(ctx, SCMP_ACT_ALLOW, SCMP_SYS(open),
|
||||
|
||||
Reference in New Issue
Block a user