Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-26 Thread Edward Cree
On 26/09/17 02:33, Alexei Starovoitov wrote: > On Mon, Sep 25, 2017 at 11:44:02PM +0200, Daniel Borkmann wrote: >> But above cast to be16 also doesn't seem quite C-like in terms >> of what we're actually doing... 3rd option would be my personal >> preference even if it doesn't look C-like, but

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-25 Thread Alexei Starovoitov
On Mon, Sep 25, 2017 at 11:44:02PM +0200, Daniel Borkmann wrote: > On 09/24/2017 07:50 AM, Alexei Starovoitov wrote: > > On Fri, Sep 22, 2017 at 09:49:10PM -0700, Y Song wrote: > > > On Fri, Sep 22, 2017 at 9:23 AM, Edward Cree wrote: > > > > On 22/09/17 16:16, Alexei

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-25 Thread Daniel Borkmann
On 09/24/2017 07:50 AM, Alexei Starovoitov wrote: On Fri, Sep 22, 2017 at 09:49:10PM -0700, Y Song wrote: On Fri, Sep 22, 2017 at 9:23 AM, Edward Cree wrote: On 22/09/17 16:16, Alexei Starovoitov wrote: looks like we're converging on "be16/be32/be64/le16/le32/le64

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-23 Thread Alexei Starovoitov
On Fri, Sep 22, 2017 at 09:49:10PM -0700, Y Song wrote: > On Fri, Sep 22, 2017 at 9:23 AM, Edward Cree wrote: > > On 22/09/17 16:16, Alexei Starovoitov wrote: > >> looks like we're converging on > >> "be16/be32/be64/le16/le32/le64 #register" for BPF_END. > >> I guess it can

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-22 Thread Y Song
On Fri, Sep 22, 2017 at 9:23 AM, Edward Cree wrote: > On 22/09/17 16:16, Alexei Starovoitov wrote: >> looks like we're converging on >> "be16/be32/be64/le16/le32/le64 #register" for BPF_END. >> I guess it can live with that. I would prefer more C like syntax >> to match the

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-22 Thread Edward Cree
On 22/09/17 16:16, Alexei Starovoitov wrote: > looks like we're converging on > "be16/be32/be64/le16/le32/le64 #register" for BPF_END. > I guess it can live with that. I would prefer more C like syntax > to match the rest, but llvm parsing point is a strong one. Yep, agreed. I'll post a v2 once

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-22 Thread Alexei Starovoitov
On Fri, Sep 22, 2017 at 07:27:29AM -0700, Y Song wrote: > On Fri, Sep 22, 2017 at 7:11 AM, Y Song wrote: > > On Fri, Sep 22, 2017 at 6:46 AM, Edward Cree wrote: > >> On 22/09/17 00:11, Y Song wrote: > >>> On Thu, Sep 21, 2017 at 12:58 PM, Edward Cree

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-22 Thread Y Song
On Fri, Sep 22, 2017 at 7:11 AM, Y Song wrote: > On Fri, Sep 22, 2017 at 6:46 AM, Edward Cree wrote: >> On 22/09/17 00:11, Y Song wrote: >>> On Thu, Sep 21, 2017 at 12:58 PM, Edward Cree wrote: On 21/09/17 20:44, Alexei

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-22 Thread Y Song
On Fri, Sep 22, 2017 at 6:46 AM, Edward Cree wrote: > On 22/09/17 00:11, Y Song wrote: >> On Thu, Sep 21, 2017 at 12:58 PM, Edward Cree wrote: >>> On 21/09/17 20:44, Alexei Starovoitov wrote: On Thu, Sep 21, 2017 at 09:29:33PM +0200, Daniel

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-22 Thread Edward Cree
On 22/09/17 00:11, Y Song wrote: > On Thu, Sep 21, 2017 at 12:58 PM, Edward Cree wrote: >> On 21/09/17 20:44, Alexei Starovoitov wrote: >>> On Thu, Sep 21, 2017 at 09:29:33PM +0200, Daniel Borkmann wrote: More intuitive, but agree on the from_be/le. Maybe we should

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Y Song
On Thu, Sep 21, 2017 at 12:58 PM, Edward Cree wrote: > On 21/09/17 20:44, Alexei Starovoitov wrote: >> On Thu, Sep 21, 2017 at 09:29:33PM +0200, Daniel Borkmann wrote: >>> More intuitive, but agree on the from_be/le. Maybe we should >>> just drop the "to_" prefix altogether,

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Edward Cree
On 21/09/17 20:44, Alexei Starovoitov wrote: > On Thu, Sep 21, 2017 at 09:29:33PM +0200, Daniel Borkmann wrote: >> More intuitive, but agree on the from_be/le. Maybe we should >> just drop the "to_" prefix altogether, and leave the rest as is since >> it's not surrounded by braces, it's also not a

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Alexei Starovoitov
On Thu, Sep 21, 2017 at 09:29:33PM +0200, Daniel Borkmann wrote: > On 09/21/2017 06:58 PM, Edward Cree wrote: > > On 21/09/17 17:40, Y Song wrote: > > > On Thu, Sep 21, 2017 at 9:24 AM, Edward Cree wrote: > > > > On 21/09/17 16:52, Alexei Starovoitov wrote: > > > > > imo > >

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Daniel Borkmann
On 09/21/2017 06:58 PM, Edward Cree wrote: On 21/09/17 17:40, Y Song wrote: On Thu, Sep 21, 2017 at 9:24 AM, Edward Cree wrote: On 21/09/17 16:52, Alexei Starovoitov wrote: imo (u16) r4 endian be isn't intuitive. Can we come up with some better syntax? Like bswap16be r4

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Edward Cree
On 21/09/17 17:40, Y Song wrote: > On Thu, Sep 21, 2017 at 9:24 AM, Edward Cree wrote: >> On 21/09/17 16:52, Alexei Starovoitov wrote: >>> imo >>> (u16) r4 endian be >>> isn't intuitive. >>> Can we come up with some better syntax? >>> Like >>> bswap16be r4 >>> bswap32le r4

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Y Song
On Thu, Sep 21, 2017 at 9:24 AM, Edward Cree wrote: > On 21/09/17 16:52, Alexei Starovoitov wrote: >> On Thu, Sep 21, 2017 at 04:09:34PM +0100, Edward Cree wrote: >>> print_bpf_insn() was treating all BPF_ALU[64] the same, but BPF_END has a >>> different structure: it has a

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Alexei Starovoitov
On Thu, Sep 21, 2017 at 05:24:10PM +0100, Edward Cree wrote: > On 21/09/17 16:52, Alexei Starovoitov wrote: > > On Thu, Sep 21, 2017 at 04:09:34PM +0100, Edward Cree wrote: > >> print_bpf_insn() was treating all BPF_ALU[64] the same, but BPF_END has a > >> different structure: it has a size in

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Y Song
On Thu, Sep 21, 2017 at 8:52 AM, Alexei Starovoitov wrote: > On Thu, Sep 21, 2017 at 04:09:34PM +0100, Edward Cree wrote: >> print_bpf_insn() was treating all BPF_ALU[64] the same, but BPF_END has a >> different structure: it has a size in insn->imm (even if it's

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Edward Cree
On 21/09/17 16:52, Alexei Starovoitov wrote: > On Thu, Sep 21, 2017 at 04:09:34PM +0100, Edward Cree wrote: >> print_bpf_insn() was treating all BPF_ALU[64] the same, but BPF_END has a >> different structure: it has a size in insn->imm (even if it's BPF_X) and >> uses the BPF_SRC (X or K) to

Re: [PATCH net-next] bpf/verifier: improve disassembly of BPF_END instructions

2017-09-21 Thread Alexei Starovoitov
On Thu, Sep 21, 2017 at 04:09:34PM +0100, Edward Cree wrote: > print_bpf_insn() was treating all BPF_ALU[64] the same, but BPF_END has a > different structure: it has a size in insn->imm (even if it's BPF_X) and > uses the BPF_SRC (X or K) to indicate which endianness to use. So it > needs