linux/kernel/bpf
Deepanshu Kartikey 9df5fad801 bpf: Reject BPF_MAP_TYPE_INSN_ARRAY in check_reg_const_str()
BPF_MAP_TYPE_INSN_ARRAY maps store instruction pointers in their
ips array, not string data. The map_direct_value_addr callback for
this map type returns the address of the ips array, which is not
suitable for use as a constant string argument.

When a BPF program passes a pointer to an insn_array map value as
ARG_PTR_TO_CONST_STR (e.g., to bpf_snprintf), the verifier's
null-termination check in check_reg_const_str() operates on the
wrong memory region, and at runtime bpf_bprintf_prepare() can read
out of bounds searching for a null terminator.

Reject BPF_MAP_TYPE_INSN_ARRAY in check_reg_const_str() since this
map type is not designed to hold string data.

Reported-by: syzbot+2c29addf92581b410079@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2c29addf92581b410079
Tested-by: syzbot+2c29addf92581b410079@syzkaller.appspotmail.com
Fixes: 493d9e0d60 ("bpf, x86: add support for indirect jumps")
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
Acked-by: Anton Protopopov <a.s.protopopov@gmail.com>
Link: https://lore.kernel.org/r/20260107021037.289644-1-kartikey406@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-01-07 19:03:46 -08:00
..
preload
Kconfig
Makefile
arena.c mm: consistently use current->mm in mm_get_unmapped_area() 2025-11-16 17:27:57 -08:00
arraymap.c
bloom_filter.c
bpf_cgrp_storage.c
bpf_inode_storage.c
bpf_insn_array.c bpf: force BPF_F_RDONLY_PROG on insn array creation 2025-11-28 15:15:43 -08:00
bpf_iter.c bpf: convert bpf_iter_new_fd() to FD_PREPARE() 2025-11-28 12:42:33 +01:00
bpf_local_storage.c bpf: Replace bpf memory allocator with kmalloc_nolock() in local storage 2025-11-18 16:20:25 -08:00
bpf_lru_list.c
bpf_lru_list.h
bpf_lsm.c bpf: Disable file_alloc_security hook 2025-11-28 15:18:28 -08:00
bpf_struct_ops.c
bpf_task_storage.c
btf.c
btf_iter.c
btf_relocate.c
cgroup.c
cgroup_iter.c
core.c bpf: Add bpf_has_frame_pointer() 2025-12-09 23:29:42 -08:00
cpumap.c
cpumask.c
crypto.c
devmap.c
disasm.c
disasm.h
dispatcher.c
dmabuf_iter.c bpf: Fix truncated dmabuf iterator reads 2025-12-09 23:48:34 -08:00
hashtab.c
helpers.c Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
inode.c convert bpf 2025-11-16 01:35:03 -05:00
kmem_cache_iter.c
link_iter.c
liveness.c bpf: correct stack liveness for tail calls 2025-11-21 17:45:30 -08:00
local_storage.c
log.c
lpm_trie.c
map_in_map.c
map_in_map.h
map_iter.c
memalloc.c
mmap_unlock_work.h
mprog.c
net_namespace.c
offload.c
percpu_freelist.c
percpu_freelist.h
prog_iter.c
queue_stack_maps.c
range_tree.c
range_tree.h
relo_core.c
reuseport_array.c
ringbuf.c
rqspinlock.c rqspinlock: Precede non-head waiter queueing with AA check 2025-11-29 09:35:36 -08:00
rqspinlock.h
stackmap.c bpf-next-6.19 2025-12-03 16:54:54 -08:00
stream.c
syscall.c Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
sysfs_btf.c
task_iter.c
tcx.c
tnum.c
token.c bpf: convert bpf_token_create() to FD_PREPARE() 2025-11-28 12:42:33 +01:00
trampoline.c bpf: implement "jmp" mode for trampoline 2025-11-24 09:47:04 -08:00
verifier.c bpf: Reject BPF_MAP_TYPE_INSN_ARRAY in check_reg_const_str() 2026-01-07 19:03:46 -08:00