]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Reject writes for PTR_TO_MAP_KEY in check_helper_mem_access
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sat, 19 Mar 2022 08:08:25 +0000 (13:38 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 6 Apr 2022 17:32:12 +0000 (10:32 -0700)
commit62418621cbff666b6eaa3137e37281bca452fd36
treeb5ff18cf6a04b88de924fde3f31e7551380af4f9
parent3f2a9ceb6892e64e2563dec2c486ce0d8975e051
bpf: Reject writes for PTR_TO_MAP_KEY in check_helper_mem_access

It is not permitted to write to PTR_TO_MAP_KEY, but the current code in
check_helper_mem_access would allow for it, reject this case as well, as
helpers taking ARG_PTR_TO_UNINIT_MEM also take PTR_TO_MAP_KEY.

Fixes: 359bfbf9bf1e ("bpf: Add bpf_for_each_map_elem() helper")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220319080827.73251-4-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c