diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-10-10 14:22:09 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-10-10 14:22:09 +0200 |
| commit | adedaf77a18f3d03d695723c86fc083c3551ff5b (patch) | |
| tree | 667c3377dd59fc5e23d95d0978282fd4eb4831af /pkg/csource/generated.go | |
| parent | 1b410967ce37d5548e4115cbf0b7704c48e8db8e (diff) | |
executor: tune memcg container logic
The current memcg container seems to lead to lots of hangs/stalls.
Presumably the problem is with oom_score_adj and KASAN.
Executor process tree eats all memory and then the leaf process is killed
but the memory is not returned to memcg due to KASAN quarantine;
and the parent processes are protected from killing with oom_score_adj=-1000.
As the result the kernel locks up.
1. Don't use oom_score_adj=-1000. Instead bump leaf process score to 1000 (kill always).
2. Increase size of memcg to be larger than expected KASAN quarantine size.
Diffstat (limited to 'pkg/csource/generated.go')
| -rw-r--r-- | pkg/csource/generated.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 7a12f14b3..9f780d219 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -2978,9 +2978,6 @@ static void setup_cgroups() if (chmod("/syzcgroup/net", 0777)) { debug("chmod(/syzcgroup/net) failed: %d\n", errno); } - if (!write_file("/proc/self/oom_score_adj", "-1000")) { - debug("write(oom_score_adj) failed: %d\n", errno); - } } static void setup_binfmt_misc() { @@ -3035,9 +3032,9 @@ static void sandbox_common() #endif struct rlimit rlim; - rlim.rlim_cur = rlim.rlim_max = 160 << 20; + rlim.rlim_cur = rlim.rlim_max = 200 << 20; setrlimit(RLIMIT_AS, &rlim); - rlim.rlim_cur = rlim.rlim_max = 8 << 20; + rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); @@ -3589,20 +3586,17 @@ static void setup_loop() debug("write(%s) failed: %d\n", file, errno); } snprintf(file, sizeof(file), "%s/memory.low", cgroupdir); - if (!write_file(file, "%d", 198 << 20)) { + if (!write_file(file, "%d", 298 << 20)) { debug("write(%s) failed: %d\n", file, errno); } snprintf(file, sizeof(file), "%s/memory.high", cgroupdir); - if (!write_file(file, "%d", 199 << 20)) { + if (!write_file(file, "%d", 299 << 20)) { debug("write(%s) failed: %d\n", file, errno); } snprintf(file, sizeof(file), "%s/memory.max", cgroupdir); - if (!write_file(file, "%d", 200 << 20)) { + if (!write_file(file, "%d", 300 << 20)) { debug("write(%s) failed: %d\n", file, errno); } - if (!write_file("/proc/self/oom_score_adj", "-1000")) { - debug("write(oom_score_adj) failed: %d\n", errno); - } snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); if (!write_file(file, "%d", pid)) { debug("write(%s) failed: %d\n", file, errno); @@ -3671,7 +3665,7 @@ static void setup_test() if (symlink(cgroupdir, "./cgroup.net")) { debug("symlink(%s, ./cgroup.net) failed: %d\n", cgroupdir, errno); } - if (!write_file("/proc/self/oom_score_adj", "0")) { + if (!write_file("/proc/self/oom_score_adj", "1000")) { debug("write(oom_score_adj) failed: %d\n", errno); } #endif |
