summaryrefslogtreecommitdiff
path: root/arch/s390/net
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2022-02-27 21:32:54 +0100
committerVasily Gorbik <gor@linux.ibm.com>2022-03-08 00:33:00 +0100
commit7fc8c362e782042bf36ceeb9343f8217d3d7dbb9 (patch)
tree02b644077481adefa73e39cf622defb460884706 /arch/s390/net
parent484a8ed8b7d145ff38889e4598a4804e9d7e8ca6 (diff)
s390/bpf: encode register within extable entry
Instead of decoding the instruction that faulted to get the register which needs to be zeroed, simply encode its number into the extable entries during code generation. This allows to get rid of a bit of code, and is also what other architectures are doing. Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/net')
-rw-r--r--arch/s390/net/bpf_jit_comp.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index a1a3a10c514c..e1e57a30ac66 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -624,16 +624,8 @@ static int get_probe_mem_regno(const u8 *insn)
bool ex_handler_bpf(const struct exception_table_entry *x, struct pt_regs *regs)
{
- int regno;
- u8 *insn;
-
regs->psw.addr = extable_fixup(x);
- insn = (u8 *)__rewind_psw(regs->psw, regs->int_code >> 16);
- regno = get_probe_mem_regno(insn);
- if (WARN_ON_ONCE(regno < 0))
- /* JIT bug - unexpected instruction. */
- return false;
- regs->gprs[regno] = 0;
+ regs->gprs[x->data] = 0;
return true;
}
@@ -641,16 +633,17 @@ static int bpf_jit_probe_mem(struct bpf_jit *jit, struct bpf_prog *fp,
int probe_prg, int nop_prg)
{
struct exception_table_entry *ex;
+ int reg, prg;
s64 delta;
u8 *insn;
- int prg;
int i;
if (!fp->aux->extable)
/* Do nothing during early JIT passes. */
return 0;
insn = jit->prg_buf + probe_prg;
- if (WARN_ON_ONCE(get_probe_mem_regno(insn) < 0))
+ reg = get_probe_mem_regno(insn);
+ if (WARN_ON_ONCE(reg < 0))
/* JIT bug - unexpected probe instruction. */
return -1;
if (WARN_ON_ONCE(probe_prg + insn_length(*insn) != nop_prg))
@@ -678,6 +671,7 @@ static int bpf_jit_probe_mem(struct bpf_jit *jit, struct bpf_prog *fp,
return -1;
ex->fixup = delta;
ex->type = EX_TYPE_BPF;
+ ex->data = reg;
jit->excnt++;
}
return 0;