From: David Miller Subject: Re: [PATCH net] bpf: enforce correct alignment for instructions Date: Fri, 22 Jun 2018 07:10:10 +0900 (KST) Message-ID: <20180622.071010.933545844318467100.davem@davemloft.net> References: <20180621.124639.2276956745930721354.davem@davemloft.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: eric.dumazet@gmail.com, edumazet@google.com, netdev@vger.kernel.org, kafai@fb.com, ast@kernel.org To: daniel@iogearbox.net Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:38510 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933478AbeFUWKQ (ORCPT ); Thu, 21 Jun 2018 18:10:16 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: From: Daniel Borkmann Date: Thu, 21 Jun 2018 23:03:09 +0200 > On 06/21/2018 06:08 AM, Eric Dumazet wrote: >> On 06/20/2018 08:46 PM, David Miller wrote: >>> From: Eric Dumazet >>> Date: Wed, 20 Jun 2018 17:24:09 -0700 >>> >>>> After commit 9facc336876f ("bpf: reject any prog that failed read-only lock") >>>> offsetof(struct bpf_binary_header, image) became 3 instead of 4, >>>> breaking powerpc BPF badly, since instructions need to be word aligned. >>>> >>>> Fixes: 9facc336876f ("bpf: reject any prog that failed read-only lock") >>>> Signed-off-by: Eric Dumazet >>> >>> I'll apply this directly, thanks Eric. >> >> Thanks David :) > > Sigh, sorry for the breakage, looks like I got fooled by x86 gcc. > > struct bpf_binary_header { > u16 pages; /* 0 2 */ > u16 locked:1; /* 2:15 2 */ Note that you can also just make locked a plan u16 for now until you need more flag bits, the code generated will be more efficient especially on non-x86.