]> git.dujemihanovic.xyz Git - linux.git/commit
bpf: Determine buf_info inside check_buffer_access()
authorShung-Hsi Yu <shung-hsi.yu@suse.com>
Mon, 7 Mar 2022 05:29:18 +0000 (13:29 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 8 Mar 2022 14:36:45 +0000 (15:36 +0100)
commit44e9a741cad824f45112b79c21d88c201d5aec13
tree03e6959f89fc523b68b0fc98f19a81cdaa6cfafd
parente878ae2d1df5de4ea36e6d96c7d3ebe789aab9a5
bpf: Determine buf_info inside check_buffer_access()

Instead of determining buf_info string in the caller of check_buffer_access(),
we can determine whether the register type is read-only through
type_is_rdonly_mem() helper inside check_buffer_access() and construct
buf_info, making the code slightly cleaner.

Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/YiWYLnAkEZXBP/gH@syu-laptop
kernel/bpf/verifier.c