From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH bpf-next] bpf: correct slot_type marking logic to allow more stack slot sharing Date: Tue, 18 Dec 2018 14:48:15 -0800 Message-ID: <20181218224814.vjvxsob25xb5ko3f@ast-mbp> References: <1544862880-23291-1-git-send-email-jiong.wang@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, oss-drivers@netronome.com To: Jiong Wang Return-path: Received: from mail-pl1-f193.google.com ([209.85.214.193]:43916 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbeLRWsS (ORCPT ); Tue, 18 Dec 2018 17:48:18 -0500 Received: by mail-pl1-f193.google.com with SMTP id gn14so8492356plb.10 for ; Tue, 18 Dec 2018 14:48:18 -0800 (PST) Content-Disposition: inline In-Reply-To: <1544862880-23291-1-git-send-email-jiong.wang@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: On Sat, Dec 15, 2018 at 03:34:40AM -0500, Jiong Wang wrote: > Verifier is supposed to support sharing stack slot allocated to ptr with > SCALAR_VALUE for privileged program. However this doesn't happen for some > cases. > > The reason is verifier is not clearing slot_type STACK_SPILL for all bytes, > it only clears part of them, while verifier is using: > > slot_type[0] == STACK_SPILL > > as a convention to check one slot is ptr type. > > So, the consequence of partial clearing slot_type is verifier could treat a > partially overridden ptr slot, which should now be a SCALAR_VALUE slot, > still as ptr slot, and rejects some valid programs. > > Before this patch, test_xdp_noinline.o under bpf selftests, bpf_lxc.o and > bpf_netdev.o under Cilium bpf repo, when built with -mattr=+alu32 are > rejected due to this issue. After this patch, they all accepted. > > There is no processed insn number change before and after this patch on > Cilium bpf programs. > > Reviewed-by: Jakub Kicinski > Signed-off-by: Jiong Wang Applied, Thanks