* [PATCH net-next] tools/bpf: adjust rlimit RLIMIT_MEMLOCK for test_verifier_log
@ 2017-11-30 16:52 Yonghong Song
2017-11-30 19:02 ` Daniel Borkmann
0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Song @ 2017-11-30 16:52 UTC (permalink / raw)
To: ast, daniel, netdev; +Cc: kernel-team
The default rlimit RLIMIT_MEMLOCK is 64KB. In certain cases,
e.g. in a test machine mimicking our production system, this test may
fail due to unable to charge the required memory for prog load:
# ./test_verifier_log
Test log_level 0...
ERROR: Program load returned: ret:-1/errno:1, expected ret:-1/errno:22
Changing the default rlimit RLIMIT_MEMLOCK to unlimited makes
the test always pass.
Signed-off-by: Yonghong Song <yhs@fb.com>
---
tools/testing/selftests/bpf/test_verifier_log.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_verifier_log.c b/tools/testing/selftests/bpf/test_verifier_log.c
index 3cc0b56..e9626cf 100644
--- a/tools/testing/selftests/bpf/test_verifier_log.c
+++ b/tools/testing/selftests/bpf/test_verifier_log.c
@@ -3,6 +3,8 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <linux/bpf.h>
#include <linux/filter.h>
@@ -131,11 +133,16 @@ static void test_log_bad(char *log, size_t log_len, int log_level)
int main(int argc, char **argv)
{
+ struct rlimit limit = { RLIM_INFINITY, RLIM_INFINITY };
char full_log[LOG_SIZE];
char log[LOG_SIZE];
size_t want_len;
int i;
+ /* allow unlimited locked memory to have more consistent error code */
+ if (setrlimit(RLIMIT_MEMLOCK, &limit) < 0)
+ perror("Unable to lift memlock rlimit");
+
memset(log, 1, LOG_SIZE);
/* Test incorrect attr */
--
2.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] tools/bpf: adjust rlimit RLIMIT_MEMLOCK for test_verifier_log
2017-11-30 16:52 [PATCH net-next] tools/bpf: adjust rlimit RLIMIT_MEMLOCK for test_verifier_log Yonghong Song
@ 2017-11-30 19:02 ` Daniel Borkmann
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2017-11-30 19:02 UTC (permalink / raw)
To: Yonghong Song, ast, netdev; +Cc: kernel-team
On 11/30/2017 05:52 PM, Yonghong Song wrote:
> The default rlimit RLIMIT_MEMLOCK is 64KB. In certain cases,
> e.g. in a test machine mimicking our production system, this test may
> fail due to unable to charge the required memory for prog load:
> # ./test_verifier_log
> Test log_level 0...
> ERROR: Program load returned: ret:-1/errno:1, expected ret:-1/errno:22
>
> Changing the default rlimit RLIMIT_MEMLOCK to unlimited makes
> the test always pass.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
Given this is a fix, I've applied this to bpf tree, thanks Yonghong!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-30 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-30 16:52 [PATCH net-next] tools/bpf: adjust rlimit RLIMIT_MEMLOCK for test_verifier_log Yonghong Song
2017-11-30 19:02 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox