Re: [PATCH] bpf: handle 32-bit zext during constant blinding

2019-08-21 Thread Jiong Wang
el Ellerman > Signed-off-by: Naveen N. Rao Thanks for the fix. Reviewed-by: Jiong Wang Just two other comments during review in case I am wrong on somewhere. - Use verifier_zext instead of bpf_jit_needs_zext() seems better, even though the latter could avoid extending function arg

Re: Regression fix for bpf in v5.3 (was Re: [RFC PATCH] bpf: handle 32-bit zext during constant blinding)

2019-08-21 Thread Jiong Wang
Michael Ellerman writes: > "Naveen N. Rao" writes: >> Since BPF constant blinding is performed after the verifier pass, there >> are certain ALU32 instructions inserted which don't have a corresponding >> zext instruction inserted after. This is causing a kernel oops on >> powerpc and can be

Re: [RFC PATCH] bpf: handle 32-bit zext during constant blinding

2019-08-21 Thread Jiong Wang
Naveen N. Rao writes: > Naveen N. Rao wrote: >> Since BPF constant blinding is performed after the verifier pass, there >> are certain ALU32 instructions inserted which don't have a corresponding >> zext instruction inserted after. This is causing a kernel oops on >> powerpc and can be

Re: [PATCH bpf-next] Enable zext optimization for more RV64G ALU ops

2019-07-05 Thread Jiong Wang
f-next, the zext optimization can > be enabled for the fixed operations. LGTM, thanks. Acked-by: Jiong Wang > > Cc: Song Liu > Cc: Jiong Wang > Cc: Xi Wang > Signed-off-by: Luke Nelson > --- > arch/riscv/net/bpf_jit_comp.c | 16 > 1 file changed

Re: [PATCH v2 bpf-next] RV32G eBPF JIT

2019-06-27 Thread Jiong Wang
Luke Nelson writes: > + > +static int emit_insn(const struct bpf_insn *insn, > + struct rv_jit_context *ctx, > + bool extra_pass) > +{ > + int rvoff, i = insn - ctx->prog->insnsi; > + u8 code = insn->code; > + s16 off = insn->off; > + s32 imm =

Re: ebpf: BPF_ALU32 | BPF_ARSH on BE arches

2019-06-25 Thread Jiong Wang
Yauheni Kaliuta writes: > Hi! > > Looks like the code: > >ALU_ARSH_X: >DST = (u64) (u32) ((*(s32 *) ) >> SRC); >CONT; >ALU_ARSH_K: >DST = (u64) (u32) ((*(s32 *) ) >> IMM); >CONT; > > works incorrectly on BE arches

Re: [RFC PATCH bpf-next] RV32G eBPF JIT

2019-06-24 Thread Jiong Wang
Luke Nelson writes: > From: Luke Nelson > > This is an eBPF JIT for RV32G, adapted from the JIT for RV64G. > Any feedback would be greatly appreciated. > > It passes 359 out of 378 tests in test_bpf.ko. The failing tests are > features that are not supported right now: > - ALU64 DIV/MOD: >

Re: [PATCH 1/2] bpf, riscv: fix bugs in JIT for 32-bit ALU operations

2019-05-31 Thread Jiong Wang
Song Liu writes: > On Thu, May 30, 2019 at 3:34 PM Luke Nelson wrote: >> >> On Thu, May 30, 2019 at 1:53 PM Song Liu wrote: >> > >> > This is a little messy. How about we introduce some helper function >> > like: >> > >> > /* please find a better name... */ >> > emit_32_or_64(bool is64, const

Re: [PATCH 2/2] bpf: test_bpf: add tests for upper bits of 32-bit operations

2019-05-30 Thread Jiong Wang
Luke Nelson writes: > This commit introduces tests that validate the upper 32 bits > of the result of 32-bit BPF ALU operations. > > The existing tests for 32-bit operations do not check the upper 32 > bits of results because the exit instruction truncates the result. > These tests perform a

Re: [PATCH 00/11] ARMv8.3 pointer authentication userspace support

2017-07-25 Thread Jiong Wang
> > * Should the kernel remove PACs when unwinding user stacks? > > > > This is simple to do, but it's arguably placing a policy in the kernel as > > to > > what we expect user stacks to look like. Regardless, userspace will have > > to > > perform this when unwinding with DWARF. >> >> Not

Re: [PATCH 00/11] ARMv8.3 pointer authentication userspace support

2017-07-25 Thread Jiong Wang
> > * Should the kernel remove PACs when unwinding user stacks? > > > > This is simple to do, but it's arguably placing a policy in the kernel as > > to > > what we expect user stacks to look like. Regardless, userspace will have > > to > > perform this when unwinding with DWARF. >> >> Not