summary refs log tree commit diff
path: root/seccomp
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2018-10-29 12:41:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-31 12:42:43 -0700
commit5656c124af2bb956dba19e409a269ca588c685e3 (patch)
tree1c2a6d89191ef2e013c8fced395d01444089e86e /seccomp
parenteeebe63c43482ee6a52b9ff480724f2ae60db821 (diff)
downloadcrosvm-5656c124af2bb956dba19e409a269ca588c685e3.tar
crosvm-5656c124af2bb956dba19e409a269ca588c685e3.tar.gz
crosvm-5656c124af2bb956dba19e409a269ca588c685e3.tar.bz2
crosvm-5656c124af2bb956dba19e409a269ca588c685e3.tar.lz
crosvm-5656c124af2bb956dba19e409a269ca588c685e3.tar.xz
crosvm-5656c124af2bb956dba19e409a269ca588c685e3.tar.zst
crosvm-5656c124af2bb956dba19e409a269ca588c685e3.zip
devices: block: fix seccomp failures from free()
It looks like free() will sometimes try to open
/proc/sys/vm/overcommit_memory in order to decide whether to return
freed heap memory to the kernel; change the seccomp filter to fail the
open syscalls with an error code (ENOENT) rather than killing the
process.

Also allow madvise to free memory for the same free() codepath.

BUG=chromium:888212
TEST=Run fio loop test on kevin

Change-Id: I1c27b265b822771f76b7d9572d9759476770000e
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1305756
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'seccomp')
-rw-r--r--seccomp/arm/block_device.policy4
-rw-r--r--seccomp/x86_64/block_device.policy6
2 files changed, 8 insertions, 2 deletions
diff --git a/seccomp/arm/block_device.policy b/seccomp/arm/block_device.policy
index 6b1e415..44ee9c3 100644
--- a/seccomp/arm/block_device.policy
+++ b/seccomp/arm/block_device.policy
@@ -18,6 +18,7 @@ _llseek: 1
 # negation, thus the manually negated mask constant.
 mmap2: arg2 in 0xfffffffb
 mprotect: arg2 in 0xfffffffb
+madvise: arg2 == MADV_DONTDUMP || arg2 == MADV_DONTNEED
 mremap: 1
 munmap: 1
 read: 1
@@ -41,3 +42,6 @@ epoll_wait: 1
 timerfd_create: 1
 timerfd_gettime: 1
 timerfd_settime: 1
+# libc free() attempts to open /proc/sys/vm/overcommit_memory
+open: return ENOENT
+openat: return ENOENT
diff --git a/seccomp/x86_64/block_device.policy b/seccomp/x86_64/block_device.policy
index c660b3b..871a64e 100644
--- a/seccomp/x86_64/block_device.policy
+++ b/seccomp/x86_64/block_device.policy
@@ -17,8 +17,7 @@ lseek: 1
 # negation, thus the manually negated mask constant.
 mmap: arg2 in 0xfffffffb
 mprotect: arg2 in 0xfffffffb
-# Allow MADV_DONTDUMP only.
-madvise: arg2 == 0x00000010
+madvise: arg2 == MADV_DONTDUMP || arg2 == MADV_DONTNEED
 mremap: 1
 munmap: 1
 read: 1
@@ -42,3 +41,6 @@ epoll_wait: 1
 timerfd_create: 1
 timerfd_gettime: 1
 timerfd_settime: 1
+# libc free() attempts to open /proc/sys/vm/overcommit_memory
+open: return ENOENT
+openat: return ENOENT