Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753712AbbLDTKW (ORCPT ); Fri, 4 Dec 2015 14:10:22 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35638 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbbLDTKU (ORCPT ); Fri, 4 Dec 2015 14:10:20 -0500 Date: Fri, 4 Dec 2015 11:10:15 -0800 From: Alexei Starovoitov To: Dmitry Vyukov Cc: 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: <20151204191013.GB45508@ast-mbp.thefacebook.com> References: <20151204184333.GA42737@ast-mbp.thefacebook.com> 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: 1266 Lines: 29 On Fri, Dec 04, 2015 at 08:03:47PM +0100, Dmitry Vyukov wrote: > > is it with some random seccomp program? > > If normal libseccomp generates such programs than it needs to be fixed. > > Yes, it is with completely random seccomp program. > > >> Such shifts have undefined behavior according to C standard and behave > >> differently on different archs. I guess we don't want to rely on any > >> kind of undefined behavior in bpf/seccomp. And generally want to > >> completely define results of all operations in bpf. > > > > bpf is an engine and we're not going to slow down each shift operation > > by extra run-time checks or masks. > > In other words bpf shift instruction == shift in C. Both undefined > > with for large operands. > > If seccomp is relying on undefined behavior, it should be fixed. > > But note that it is not that result of such operation is undefined, it > is overall kernel behavior that becomes undefined. not true. just don't generate random bpf programs with such shifts. kernel is fine. -- 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/