Fix BlockSyscallsWithErrno

PiperOrigin-RevId: 429982218
Change-Id: I42b187e678542b295542ca44882945c7695178e1
This commit is contained in:
Wiktor Garbacz 2022-02-21 00:46:16 -08:00 committed by Copybara-Service
parent e9c041f0c2
commit a2daa0a275
2 changed files with 2 additions and 5 deletions

View File

@ -75,6 +75,7 @@ std::unique_ptr<Policy> BufferTestcasePolicy() {
.AllowWrite() .AllowWrite()
.AllowMmap() .AllowMmap()
.AllowStat() .AllowStat()
.AllowOpen()
.AllowSyscalls({ .AllowSyscalls({
__NR_dup, __NR_dup,
__NR_futex, __NR_futex,
@ -88,10 +89,6 @@ std::unique_ptr<Policy> BufferTestcasePolicy() {
}) })
.BlockSyscallsWithErrno( .BlockSyscallsWithErrno(
{ {
#ifdef __NR_open
__NR_open,
#endif
__NR_openat,
#ifdef __NR_access #ifdef __NR_access
// On Debian, even static binaries check existence of // On Debian, even static binaries check existence of
// /etc/ld.so.nohwcap. // /etc/ld.so.nohwcap.

View File

@ -91,7 +91,7 @@ PolicyBuilder& PolicyBuilder::AllowSyscalls(absl::Span<const uint32_t> nums) {
PolicyBuilder& PolicyBuilder::BlockSyscallsWithErrno( PolicyBuilder& PolicyBuilder::BlockSyscallsWithErrno(
absl::Span<const uint32_t> nums, int error) { absl::Span<const uint32_t> nums, int error) {
for (auto num : nums) { for (auto num : nums) {
AllowSyscall(num); BlockSyscallWithErrno(num, error);
} }
return *this; return *this;
} }