s390/bpf: Support address space cast instruction
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 1 Jul 2024 23:40:25 +0000 (01:40 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 2 Jul 2024 16:31:52 +0000 (18:31 +0200)
commit555469cc9be4a7f52c0ad07a4a237d63e8c5c5f4
treee13409b04a90a49a0e60fac91da2ede79ec54952
parent4d3a453b434fd2f389960890ae6d767f8d50c403
s390/bpf: Support address space cast instruction

The new address cast instruction translates arena offsets to userspace
addresses. NULL pointers must not be translated.

The common code sets up the mappings in such a way that it's enough to
replace the higher 32 bits to achieve the desired result. s390x has
just an instruction for this: INSERT IMMEDIATE.

Implement the sequence using 3 instruction: LOAD AND TEST, BRANCH
RELATIVE ON CONDITION and INSERT IMMEDIATE.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20240701234304.14336-8-iii@linux.ibm.com
arch/s390/net/bpf_jit_comp.c