On 10/07/2023 14:26, Beata Michalska wrote:
Hi,
Merged into next. Thanks!
Thanks.
Accepted upstream as well: https://lore.kernel.org/ltp/20230717090539.371142-1-zachary.leaf@arm.com/T/#...
BR B.
On Thu, Jun 22, 2023 at 05:12:12PM +0100, Zachary Leaf wrote:
Currently the log size for bpf_prog01 + bpf_prog02 is set to BUFSIZ which is defined by the libc in stdio.h. In glibc, this is set to the constant 8192. In other libc's this value can vary, e.g. in Musl this is set to 1024. For bpf_prog02 this is not large enough to store the verifier log resulting in the following test breakage:
[...] bpf_common.c:123: TBROK: Failed verification: ENOSPC (28)
This error is returned from kernel/bpf/verifier.c when the verifier log exceeds the user supplied buffer.
Align bpf_prog01 + bpf_prog02 with other bpf tests and set the buffer size explicitly to 8192 in bpf_common.h.
Signed-off-by: Zachary Leaf zachary.leaf@arm.com
v2:
- #define for all tests in bpf_common.h instead of duplicating
Note: this fix is not dependent on any Morello kernel bpf syscall changes, so has been split out from those. Can be merged/reviewed independently of those.
Looks to be upstreamable.
Branch at: https://git.morello-project.org/zdleaf/morello-linux-test-project/-/tree/rev...
testcases/kernel/syscalls/bpf/bpf_common.h | 1 + testcases/kernel/syscalls/bpf/bpf_prog01.c | 2 +- testcases/kernel/syscalls/bpf/bpf_prog02.c | 4 ++-- testcases/kernel/syscalls/bpf/bpf_prog04.c | 1 - testcases/kernel/syscalls/bpf/bpf_prog05.c | 2 -- testcases/kernel/syscalls/bpf/bpf_prog06.c | 2 -- testcases/kernel/syscalls/bpf/bpf_prog07.c | 2 -- 7 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/testcases/kernel/syscalls/bpf/bpf_common.h b/testcases/kernel/syscalls/bpf/bpf_common.h index 39764ba1f..a0800d19b 100644 --- a/testcases/kernel/syscalls/bpf/bpf_common.h +++ b/testcases/kernel/syscalls/bpf/bpf_common.h @@ -13,6 +13,7 @@ #include "lapi/socket.h"
#define BPF_MEMLOCK_ADD (2*1024*1024) +#define BUFSIZE 8192
/* map[array_indx] = reg_to_save
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog01.c b/testcases/kernel/syscalls/bpf/bpf_prog01.c index e2fc80a9f..de4f68cef 100644 --- a/testcases/kernel/syscalls/bpf/bpf_prog01.c +++ b/testcases/kernel/syscalls/bpf/bpf_prog01.c @@ -63,7 +63,7 @@ int load_prog(int fd) BPF_EXIT_INSN(), /* return r0 */ };
- bpf_init_prog_attr(attr, PROG, sizeof(PROG), log, BUFSIZ);
- bpf_init_prog_attr(attr, PROG, sizeof(PROG), log, BUFSIZE); return bpf_load_prog(attr, log);
}
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog02.c b/testcases/kernel/syscalls/bpf/bpf_prog02.c index b40ea0f1d..fd3e535c1 100644 --- a/testcases/kernel/syscalls/bpf/bpf_prog02.c +++ b/testcases/kernel/syscalls/bpf/bpf_prog02.c @@ -64,7 +64,7 @@ static int load_prog(int fd) BPF_EXIT_INSN(), /* 26: return r0 */ };
- bpf_init_prog_attr(attr, insn, sizeof(insn), log, BUFSIZ);
- bpf_init_prog_attr(attr, insn, sizeof(insn), log, BUFSIZE); return bpf_load_prog(attr, log);
}
@@ -117,7 +117,7 @@ static struct tst_test test = { .bufs = (struct tst_buffers []) { {&key, .size = sizeof(*key)}, {&val, .size = sizeof(*val)},
{&log, .size = BUFSIZ},
{&attr, .size = sizeof(*attr)}, {&msg, .size = sizeof(MSG)}, {},{&log, .size = BUFSIZE},
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog04.c b/testcases/kernel/syscalls/bpf/bpf_prog04.c index ebee26cbc..cf3bb1254 100644 --- a/testcases/kernel/syscalls/bpf/bpf_prog04.c +++ b/testcases/kernel/syscalls/bpf/bpf_prog04.c @@ -28,7 +28,6 @@ #include "tst_capability.h" #include "bpf_common.h"
-#define BUFSIZE 8192 #define CHECK_BPF_RET(x) ((x) >= 0 || ((x) == -1 && errno != EACCES))
static const char MSG[] = "Ahoj!"; diff --git a/testcases/kernel/syscalls/bpf/bpf_prog05.c b/testcases/kernel/syscalls/bpf/bpf_prog05.c index 2be5a2cc9..742beab0b 100644 --- a/testcases/kernel/syscalls/bpf/bpf_prog05.c +++ b/testcases/kernel/syscalls/bpf/bpf_prog05.c @@ -52,8 +52,6 @@ #include "tst_capability.h" #include "bpf_common.h"
-#define BUFSIZE 8192
static const char MSG[] = "Ahoj!"; static char *msg;
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog06.c b/testcases/kernel/syscalls/bpf/bpf_prog06.c index c38dd8239..cee9616cf 100644 --- a/testcases/kernel/syscalls/bpf/bpf_prog06.c +++ b/testcases/kernel/syscalls/bpf/bpf_prog06.c @@ -46,8 +46,6 @@ #include "lapi/bpf.h" #include "bpf_common.h"
-#define BUFSIZE 8192
static const char MSG[] = "Ahoj!"; static char *msg;
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog07.c b/testcases/kernel/syscalls/bpf/bpf_prog07.c index 50ff6eed0..dab5bb8ad 100644 --- a/testcases/kernel/syscalls/bpf/bpf_prog07.c +++ b/testcases/kernel/syscalls/bpf/bpf_prog07.c @@ -46,8 +46,6 @@ #include "lapi/bpf.h" #include "bpf_common.h"
-#define BUFSIZE 8192
static const char MSG[] = "Ahoj!"; static char *msg;
-- 2.34.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org