[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170519.163957.1950740987459934279.davem@davemloft.net>
Date: Fri, 19 May 2017 16:39:57 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: ecree@...arflare.com
Cc: ast@...com, daniel@...earbox.net, alexei.starovoitov@...il.com,
netdev@...r.kernel.org
Subject: Re: Alignment in BPF verifier
From: Edward Cree <ecree@...arflare.com>
Date: Fri, 19 May 2017 21:00:13 +0100
> Well, I've managed to get somewhat confused by reg->id.
> In particular, I'm unsure which bpf_reg_types can have an id, and what
> exactly it means. There seems to be some code that checks around map value
> pointers, which seems strange as maps have fixed sizes (and the comments in
> enum bpf_reg_type make it seem like id is a PTR_TO_PACKET thing) - is this
> maybe because of map-of-maps support, can the contained maps have differing
> element sizes? Or do we allow *(map_value + var + imm), if map_value + var
> was appropriately bounds-checked?
>
> Does the 'id' identify the variable that was added to an object pointer, or
> the object itself? Or does it blur these and identify (what the comment in
> enum bpf_reg_type calls) "skb->data + (u16) var"?
The reg->id value changes any time a variable gets added to a packet
pointer.
You will also notice right now that only packet pointers have their
alignment tracked.
I have changes pending that will do that for MAP pointers too, but
it needs more work.
Powered by blists - more mailing lists