Re: [PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-16 Thread David Miller
From: Daniel Borkmann Date: Mon, 15 May 2017 23:55:47 +0200 > I'm actually wondering about the min_align/aux_off/aux_off_align and > given this is not really related to varlen_map_access and we currently > just skip this. > > We should make sure that when env->strict_alignment is false that we >

Re: [PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-15 Thread Daniel Borkmann
On 05/15/2017 05:34 PM, David Miller wrote: From: Daniel Borkmann Date: Mon, 15 May 2017 15:10:02 +0200 What are the semantics of using id here? In ptr_to_pkt, we have it, so that eventually, in find_good_pkt_pointers() we can match on id and update the range for all such regs with the same id

[PATCH v2 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-15 Thread David Miller
Just like packet pointers, track the known alignment of MAP pointers. In order to facilitate the state tracking, move the register offset field into where there is an unused 32-bit padding slot on 64-bit. The check logic is the same as for packet pointers, except we do not apply NET_IP_ALIGN to

Re: [PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-15 Thread David Miller
From: Daniel Borkmann Date: Mon, 15 May 2017 15:10:02 +0200 >>> What are the semantics of using id here? In ptr_to_pkt, we have it, >>> so that eventually, in find_good_pkt_pointers() we can match on id >>> and update the range for all such regs with the same id. I'm just >>> wondering as the sid

Re: [PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-15 Thread Daniel Borkmann
On 05/15/2017 03:00 AM, David Miller wrote: From: Daniel Borkmann Date: Sun, 14 May 2017 16:31:10 +0200 On 05/13/2017 04:28 AM, David Miller wrote: @@ -823,10 +825,27 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg, } static int check_val_ptr_alignment(const struc

Re: [PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-14 Thread David Miller
From: Daniel Borkmann Date: Sun, 14 May 2017 16:31:10 +0200 > On 05/13/2017 04:28 AM, David Miller wrote: >> @@ -823,10 +825,27 @@ static int check_pkt_ptr_alignment(const struct >> bpf_reg_state *reg, >> } >> >> static int check_val_ptr_alignment(const struct bpf_reg_state *reg, >> -

Re: [PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-14 Thread Daniel Borkmann
On 05/13/2017 04:28 AM, David Miller wrote: Just like packet pointers, track the known alignment of MAP pointers. In order to facilitate the state tracking, move the register offset field into where there is an unused 32-bit padding slot on 64-bit. The check logic is the same as for packet

[PATCH 2/3] bpf: Track alignment of MAP pointers in verifier.

2017-05-12 Thread David Miller
Just like packet pointers, track the known alignment of MAP pointers. In order to facilitate the state tracking, move the register offset field into where there is an unused 32-bit padding slot on 64-bit. The check logic is the same as for packet pointers, except we do not apply NET_IP_ALIGN to

alignment of MAP pointers

2017-05-12 Thread David Miller
Daniel, this continues our discussion from yesterday where you rightly pointed out that map pointers don't have their state adjusted like packet pointers do currently. I'm working on a patch sketched below to deal with this. My understanding is that packet pointers are validated using the accumu