Re: [PATCH v4 bpf-next] selftests/bpf: Use the last page in test_snprintf_btf on s390
From: Heiko Carstens <hca@linux.ibm.com>
Date: 2021-02-28 08:08:51
On Sat, Feb 27, 2021 at 06:17:26AM +0100, Ilya Leoshkevich wrote:
test_snprintf_btf fails on s390, because NULL points to a readable
struct lowcore there. Fix by using the last page instead.
Error message example:
printing fffffffffffff000 should generate error, got (361)
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
v1: https://lore.kernel.org/bpf/20210226135923.114211-1-iii@linux.ibm.com/ (local)
v1 -> v2: Yonghong suggested to add the pointer value to the error
message.
I've noticed that I've been passing BADPTR as flags, therefore
the fix worked only by accident. Put it into p.ptr where it
belongs.
v2: https://lore.kernel.org/bpf/20210226182014.115347-1-iii@linux.ibm.com/ (local)
v2 -> v3: Heiko mentioned that using _REGION1_SIZE is not future-proof.
We had a private discussion and came to the conclusion that
the the last page is good enough.
v3: https://lore.kernel.org/bpf/20210226190908.115706-1-iii@linux.ibm.com/ (local)
v3 -> v4: Yonghong suggested to print the non-hashed pointer value.
.../testing/selftests/bpf/progs/netif_receive_skb.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)Just in case, also for v4: Acked-by: Heiko Carstens <hca@linux.ibm.com>