提交 262f9d81 编写于 作者: E Eric Dumazet 提交者: Daniel Borkmann

bpf: do not blindly change rlimit in reuseport net selftest

If the current process has unlimited RLIMIT_MEMLOCK,
we should should leave it as is.

Fixes: 941ff6f1 ("bpf: fix rlimit in reuseport net selftest")
Signed-off-by: NJohn Sperbeck <jsperbeck@google.com>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 e2a322a0
......@@ -437,14 +437,19 @@ void enable_fastopen(void)
}
}
static struct rlimit rlim_old, rlim_new;
static struct rlimit rlim_old;
static __attribute__((constructor)) void main_ctor(void)
{
getrlimit(RLIMIT_MEMLOCK, &rlim_old);
rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20);
rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20);
setrlimit(RLIMIT_MEMLOCK, &rlim_new);
if (rlim_old.rlim_cur != RLIM_INFINITY) {
struct rlimit rlim_new;
rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20);
rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20);
setrlimit(RLIMIT_MEMLOCK, &rlim_new);
}
}
static __attribute__((destructor)) void main_dtor(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册