bpf: do not blindly change rlimit in reuseport net selftest
Subsystems (3)
PATCH 1/1 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 941ff6f11c02 ("bpf: fix rlimit in reuseport net selftest")
Signed-off-by John Sperbeck <[email protected]>
Signed-off-by Eric Dumazet <[email protected]>
Cc Daniel Borkmann <[email protected]>
--- tools/testing/selftests/net/reuseport_bpf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/testing/selftests/net/reuseport_bpf.c +9 -4
@@ -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 )
Signature · 1 line
2.19.0.605.g01d371f741-goog
Quoted 7 lines · Eric Dumazet
If the current process has unlimited
RLIMIT_MEMLOCK, we should should leave it as is.Fixes 941ff6f11c02 ("bpf: fix rlimit in reuseport net selftest")Signed-off-by John Sperbeck <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Cc Daniel Borkmann <[email protected]>
Acked-by Daniel Borkmann <[email protected]>
Daniel Borkmann
AppliedQuoted 7 lines · Eric Dumazet
If the current process has unlimited
RLIMIT_MEMLOCK, we should should leave it as is.Fixes 941ff6f11c02 ("bpf: fix rlimit in reuseport net selftest")Signed-off-by John Sperbeck <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Cc Daniel Borkmann <[email protected]>
Applied to bpf, thanks Eric!