[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57060ECE.9020300@iogearbox.net>
Date: Thu, 07 Apr 2016 09:39:58 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Alexei Starovoitov <ast@...com>
CC: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] bpf: simplify verifier register state assignments
On 04/07/2016 04:39 AM, Alexei Starovoitov wrote:
> verifier is using the following structure to track the state of registers:
> struct reg_state {
> enum bpf_reg_type type;
> union {
> int imm;
> struct bpf_map *map_ptr;
> };
> };
> and later on in states_equal() does memcmp(&old->regs[i], &cur->regs[i],..)
> to find equivalent states.
> Throughout the code of verifier there are assignements to 'imm' and 'map_ptr'
> fields and it's not obvious that most of the assignments into 'imm' don't
> need to clear extra 4 bytes (like mark_reg_unknown_value() does) to make sure
> that memcmp doesn't go over junk left from 'map_ptr' assignment.
>
> Simplify the code by converting 'int' into 'long'
>
> Suggested-by: Daniel Borkmann <daniel@...earbox.net>
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
Acked-by: Daniel Borkmann <daniel@...earbox.net>
Powered by blists - more mailing lists