Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755912AbbLDUf3 (ORCPT ); Fri, 4 Dec 2015 15:35:29 -0500 Received: from mail-pf0-f171.google.com ([209.85.192.171]:36323 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754564AbbLDUf1 (ORCPT ); Fri, 4 Dec 2015 15:35:27 -0500 X-Greylist: delayed 6706 seconds by postgrey-1.27 at vger.kernel.org; Fri, 04 Dec 2015 15:35:27 EST Date: Fri, 4 Dec 2015 12:35:23 -0800 From: Alexei Starovoitov To: Dmitry Vyukov Cc: David Miller , Alexei Starovoitov , netdev , LKML , syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin , Eric Dumazet , Andrey Ryabinin Subject: Re: bpf: undefined shift in __bpf_prog_run Message-ID: <20151204203522.GB64517@ast-mbp.thefacebook.com> References: <20151204184333.GA42737@ast-mbp.thefacebook.com> <20151204191013.GB45508@ast-mbp.thefacebook.com> <20151204.142651.968075964630586979.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 818 Lines: 18 On Fri, Dec 04, 2015 at 08:48:57PM +0100, Dmitry Vyukov wrote: > > For example, a compiler can assume that result of left shift is larger > or equal to first operand, which in turn can allow it to elide some > bounds check in code, which in turn can lead to an exploit. I am not > saying that this particular pattern is present in the code, what I > want to say is that such undefined behaviors can lead to very > unpredictable and unexpected consequences. Within bpf it cannot. shift is not used in any memory or bounds operations. so reg <<= 1234 cannot be exploited. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/