[PATCH v2] bpf: verifier: MOV64 don't mark dst reg unbounded

2018-07-31 Thread Arthur Fabre
value is not allowed" check_alu_op() now uses check_reg_arg(DST_OP_NO_MARK), and MOVs that need to mark the dst register (MOVIMM, MOV32) do so. Added a test case for MOV64 dst == src, and dst != src. Signed-off-by: Arthur Fabre --- v2: Add mov64 tests, always use DST_OP_NO_MARK

Re: [PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst

2018-07-30 Thread Arthur Fabre
On Mon, Jul 30, 2018 at 10:10 AM, Daniel Borkmann wrote: > On 07/30/2018 09:44 AM, Arthur Fabre wrote: >> On Sun, Jul 29, 2018 at 4:59 PM, Alexei Starovoitov >> wrote: >>> On Thu, Jul 26, 2018 at 1:08 AM, Arthur Fabre wrote: >>>> When check_alu_op() han

Re: [PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst

2018-07-30 Thread Arthur Fabre
On Sun, Jul 29, 2018 at 4:59 PM, Alexei Starovoitov wrote: > On Thu, Jul 26, 2018 at 1:08 AM, Arthur Fabre wrote: >> When check_alu_op() handles a BPF_MOV between two registers, >> it calls check_reg_arg() on the dst register, marking it as unbounded. >> If the src and dst

Re: [PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst

2018-07-30 Thread Arthur Fabre
On Fri, Jul 27, 2018 at 12:21 AM, Y Song wrote: > The SMIN/UMIN still should be 0 since there is no negative here due to > smaller width? Yes that makes sense. > We can do better than unbounded for dst register of mov32, which is > the code already > doing? coerce_reg_to_size() will preserve

Re: [PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst

2018-07-26 Thread Arthur Fabre
07/26/2018 12:08 AM, Arthur Fabre wrote: > > When check_alu_op() handles a BPF_MOV between two registers, > > it calls check_reg_arg() on the dst register, marking it as unbounded. > > If the src and dst register are the same, this marks the src as > > unbounded, which can l

[PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst

2018-07-25 Thread Arthur Fabre
. check_alu_op() now only marks the dst register as unbounded if it different from the src register. Signed-off-by: Arthur Fabre --- kernel/bpf/verifier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 63aaac52a265..ddfe3c544a80