[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a4523e67-ba1a-32ed-f5ac-fd8f9b712693@iogearbox.net>
Date: Fri, 5 Oct 2018 19:47:58 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Jann Horn <jannh@...gle.com>, Alexei Starovoitov <ast@...nel.org>,
netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf: 32-bit RSH verification must truncate input before
the ALU op
On 10/05/2018 06:17 PM, Jann Horn wrote:
> When I wrote commit 468f6eafa6c4 ("bpf: fix 32-bit ALU op verification"), I
> assumed that, in order to emulate 64-bit arithmetic with 32-bit logic, it
> is sufficient to just truncate the output to 32 bits; and so I just moved
> the register size coercion that used to be at the start of the function to
> the end of the function.
>
> That assumption is true for almost every op, but not for 32-bit right
> shifts, because those can propagate information towards the least
> significant bit. Fix it by always truncating inputs for 32-bit ops to 32
> bits.
>
> Also get rid of the coerce_reg_to_size() after the ALU op, since that has
> no effect.
>
> Fixes: 468f6eafa6c4 ("bpf: fix 32-bit ALU op verification")
> Acked-by: Daniel Borkmann <daniel@...earbox.net>
> Signed-off-by: Jann Horn <jannh@...gle.com>
Applied to bpf, thanks Jann!
Powered by blists - more mailing lists