WSL2-Linux-Kernel/include
Benjamin Tissoires 95f2f26f3c bpf: split btf_check_subprog_arg_match in two
btf_check_subprog_arg_match() was used twice in verifier.c:
- when checking for the type mismatches between a (sub)prog declaration
  and BTF
- when checking the call of a subprog to see if the provided arguments
  are correct and valid

This is problematic when we check if the first argument of a program
(pointer to ctx) is correctly accessed:
To be able to ensure we access a valid memory in the ctx, the verifier
assumes the pointer to context is not null.
This has the side effect of marking the program accessing the entire
context, even if the context is never dereferenced.

For example, by checking the context access with the current code, the
following eBPF program would fail with -EINVAL if the ctx is set to null
from the userspace:

```
SEC("syscall")
int prog(struct my_ctx *args) {
  return 0;
}
```

In that particular case, we do not want to actually check that the memory
is correct while checking for the BTF validity, but we just want to
ensure that the (sub)prog definition matches the BTF we have.

So split btf_check_subprog_arg_match() in two so we can actually check
for the memory used when in a call, and ignore that part when not.

Note that a further patch is in preparation to disentangled
btf_check_func_arg_match() from these two purposes, and so right now we
just add a new hack around that by adding a boolean to this function.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220906151303.2780789-3-benjamin.tissoires@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2022-09-07 10:57:28 -07:00
..
acpi
asm-generic Seventeen hotfixes. Mostly memory management things. Ten patches are 2022-08-28 14:49:59 -07:00
clocksource
crypto
drm
dt-bindings
keys
kunit
kvm
linux bpf: split btf_check_subprog_arg_match in two 2022-09-07 10:57:28 -07:00
math-emu
media
memory
misc
net Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2022-09-06 23:21:18 +02:00
pcmcia
ras
rdma
rv
scsi SCSI misc on 20220813 2022-08-13 13:41:48 -07:00
soc soc: fsl: qbman: Add CGR update function 2022-09-05 14:27:39 +01:00
sound
target
trace
uapi bpf: Update descriptions for helpers bpf_get_func_arg[_cnt]() 2022-09-06 19:51:14 -07:00
ufs
vdso
video
xen