From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: eBPF verifier thoughts (Re: [PATCH v15 net-next 00/11] eBPF syscall, verifier, testsuite) Date: Fri, 26 Sep 2014 15:41:56 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Alexei Starovoitov Cc: David Miller , Ingo Molnar , Linus Torvalds , Daniel Borkmann , Hannes Frederic Sowa , Chema Gonzalez , Eric Dumazet , Peter Zijlstra , Pablo Neira Ayuso , "H. Peter Anvin" , Andrew Morton , Kees Cook , Linux API , Network Development , "linux-kernel@vger.kernel.org" List-Id: linux-api@vger.kernel.org On Fri, Sep 26, 2014 at 3:26 PM, Alexei Starovoitov wrote: > On Fri, Sep 26, 2014 at 3:07 PM, Andy Lutomirski wrote: >> On Fri, Sep 26, 2014 at 3:03 PM, Alexei Starovoitov wrote: >>> On Fri, Sep 26, 2014 at 2:47 PM, Andy Lutomirski wrote: >>>> >>>> Can't you just disallow the 1-byte write to the stack? >>> >>> of course not. >>> That would be extremely limiting to users. >>> Can you actually see yourself living with stack that only >>> allows 8-byte writes/reads? >>> The stack usage will increase a lot, since all char/short >>> stack variables will become 8-byte... >> >> How about requiring that sub-8-byte stack accesses only be to integer slots? > > you mean to reject the sub-8-byte write early if it's going > into space where pointers were stored? > That will limit stack reuse. > gcc/llvm generate code where the same stack location > is used by different variables during life of the function. > So if I reject the write early, it will break otherwise valid > programs. I think that a sub-8-byte write to an integer slot should leave it as an integer and a sub-8-byte write to a non-integer slot should turn that slot into an integer (if conversions to integer are permitted) or be rejected otherwise. gcc/llvm could emit an 8-byte write first, as needed, to make this valid. Alternatively, an integer stack slot could have a bitmask indicating which bytes are valid. --Andy -- Andy Lutomirski AMA Capital Management, LLC