Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756609AbbLDVh5 (ORCPT ); Fri, 4 Dec 2015 16:37:57 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:44488 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754854AbbLDVhz (ORCPT ); Fri, 4 Dec 2015 16:37:55 -0500 Date: Fri, 04 Dec 2015 16:37:53 -0500 (EST) Message-Id: <20151204.163753.594151588498690658.davem@davemloft.net> To: alexei.starovoitov@gmail.com Cc: dvyukov@google.com, ast@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, kcc@google.com, glider@google.com, sasha.levin@oracle.com, edumazet@google.com, ryabinin.a.a@gmail.com Subject: Re: bpf: undefined shift in __bpf_prog_run From: David Miller In-Reply-To: <20151204203522.GB64517@ast-mbp.thefacebook.com> References: <20151204.142651.968075964630586979.davem@davemloft.net> <20151204203522.GB64517@ast-mbp.thefacebook.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 04 Dec 2015 13:37:55 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 932 Lines: 22 From: Alexei Starovoitov Date: Fri, 4 Dec 2015 12:35:23 -0800 > 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. +1 -- 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/