From: Alexei Starovoitov <ast@fb.com>
To: David Miller <davem@davemloft.net>, <daniel@iogearbox.net>
Cc: <alexei.starovoitov@gmail.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/7] bpf: Track alignment of register values in the verifier.
Date: Thu, 11 May 2017 15:53:06 -0700 [thread overview]
Message-ID: <06d46f08-2c62-d167-1fe5-a49284c614bb@fb.com> (raw)
In-Reply-To: <20170511.120516.2089919860112370473.davem@davemloft.net>
On 5/11/17 9:05 AM, David Miller wrote:
> + had_id = (dst_reg->id != 0);
> +
> /* dst_reg stays as pkt_ptr type and since some positive
> * integer value was added to the pointer, increment its 'id'
> */
> dst_reg->id = ++env->id_gen;
>
> - /* something was added to pkt_ptr, set range and off to zero */
> + /* something was added to pkt_ptr, set range to zero */
> + dst_reg->aux_off = dst_reg->off;
what about 2nd addition of a variable to pkt_ptr ?
aux_off sort-of remembers already accumulated offset in pkt_ptr, but
above line will hard assign it which doesn't seem right for the 2nd
addition.
Ex:
before first add, reg->off == 14
after first add, aux_off = 14, off = 0
then imm4 added, now we have reg->off=4, aux_off=14
now we do 2nd add of variable and
reg->aux_off becomes 4
and if we later do u64 load from the packet it will be rejected
due to (net_ip_align + 4) whereas it should have been ok
due to (net_ip_align + 14 + 4).
> dst_reg->off = 0;
> dst_reg->range = 0;
> + if (had_id)
> + dst_reg->aux_off_align = min(dst_reg->aux_off_align,
> + src_reg->min_align);
> + else
> + dst_reg->aux_off_align = src_reg->min_align;
all aux_off_align logic here and in other places looks fine to me,
since it's conservative.
next prev parent reply other threads:[~2017-05-11 22:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-11 16:05 [PATCH v2 1/7] bpf: Track alignment of register values in the verifier David Miller
2017-05-11 22:53 ` Alexei Starovoitov [this message]
2017-05-12 1:14 ` David Miller
2017-05-12 2:31 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06d46f08-2c62-d167-1fe5-a49284c614bb@fb.com \
--to=ast@fb.com \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox