android_kernel_motorola_sm6225/tools
Jiong Wang 79aba0ac3d bpf: correct slot_type marking logic to allow more stack slot sharing
commit 0bae2d4d62d523f06ff1a8e88ce38b45400acd28 upstream.

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 <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
[OP: adjusted context for 4.19]
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-22 11:47:58 +02:00
..
accounting tools/accounting/getdelays.c: fix netlink attribute length 2020-04-13 10:45:10 +02:00
arch ia64: tools: remove duplicate definition of ia64_mf() on ia64 2021-04-28 13:16:53 +02:00
bpf bpftool: Check malloc return value in mount_bpffs_for_pin 2021-07-28 11:13:48 +02:00
build tools build: Check if gettid() is available before providing helper 2021-03-24 11:07:32 +01:00
cgroup
firewire
gpio tools: gpio-hammer: Avoid potential overflow in main 2020-10-01 13:14:39 +02:00
hv Tools: hv: kvp: eliminate 'may be used uninitialized' warning 2019-09-10 10:33:50 +01:00
iio iio: iio-utils: Fix possible incorrect mask calculation 2019-07-31 07:27:02 +02:00
include tools headers UAPI: Sync linux/in.h copy with the kernel sources 2021-06-30 08:48:26 -04:00
kvm/kvm_stat tools/kvm_stat: Fix kvm_exit filter name 2020-02-11 04:34:08 -08:00
laptop
leds
lib bpf: Add BPF_F_ANY_ALIGNMENT. 2021-06-10 13:24:08 +02:00
memory-model
nfsd
objtool objtool: Don't fail on missing symbol table 2021-02-07 14:48:38 +01:00
pci tools: PCI: Fix broken pcitest compilation 2019-11-24 08:21:08 +01:00
pcmcia
perf Revert "perf map: Fix dso->nsinfo refcounting" 2021-08-04 12:23:47 +02:00
power tools: Factor HOSTCC, HOSTLD, HOSTAR definitions 2021-01-30 13:32:13 +01:00
scripts tools: Factor HOSTCC, HOSTLD, HOSTAR definitions 2021-01-30 13:32:13 +01:00
spi
testing bpf: correct slot_type marking logic to allow more stack slot sharing 2021-09-22 11:47:58 +02:00
thermal/tmon
time
usb usbip: tools: fix build error for multiple definition 2021-03-11 14:04:59 +01:00
virtio virtio: fix test build after uio.h change 2019-01-13 09:51:03 +01:00
vm tools/vm: fix cross-compile build 2020-04-29 16:31:28 +02:00
wmi
Makefile