Song Liu
9e2ad638ae
bpf: Extend BTF_ID_LIST_GLOBAL with parameter for number of IDs
syzbot reported the following BUG w/o CONFIG_DEBUG_INFO_BTF
BUG: KASAN: global-out-of-bounds in task_iter_init+0x212/0x2e7 kernel/bpf/task_iter.c:661
Read of size 4 at addr ffffffff90297404 by task swapper/0/1
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.0-syzkaller #0
Hardware name: ... Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xf/0x309 mm/kasan/report.c:256
__kasan_report mm/kasan/report.c:442 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
task_iter_init+0x212/0x2e7 kernel/bpf/task_iter.c:661
do_one_initcall+0x103/0x650 init/main.c:1295
do_initcall_level init/main.c:1368 [inline]
do_initcalls init/main.c:1384 [inline]
do_basic_setup init/main.c:1403 [inline]
kernel_init_freeable+0x6b1/0x73a init/main.c:1606
kernel_init+0x1a/0x1d0 init/main.c:1497
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>
This is caused by hard-coded name[1] in BTF_ID_LIST_GLOBAL (w/o
CONFIG_DEBUG_INFO_BTF). Fix this by adding a parameter n to
BTF_ID_LIST_GLOBAL. This avoids ifdef CONFIG_DEBUG_INFO_BTF in btf.c and
filter.c.
Fixes: 7c7e3d31e7 ("bpf: Introduce helper bpf_find_vma")
Reported-by: syzbot+e0d81ec552a21d9071aa@syzkaller.appspotmail.com
Reported-by: Eric Dumazet <edumazet@google.com>
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211112150243.1270987-2-songliubraving@fb.com
2021-11-12 10:19:09 -08:00
..
2021-08-13 14:09:19 -07:00
2021-11-01 22:26:08 -07:00
2021-09-30 13:29:09 +01:00
2021-11-01 13:26:07 +00:00
2021-10-28 10:43:58 -07:00
2021-11-01 13:26:07 +00:00
2021-08-05 13:27:50 +01:00
2021-08-05 13:27:50 +01:00
2019-10-04 11:10:56 -07:00
2021-07-20 06:00:38 -07:00
2021-11-12 10:19:09 -08:00
2021-11-01 20:05:14 -07:00
2021-08-19 13:19:30 +01:00
2021-10-18 12:54:41 +01:00
2021-10-21 12:47:56 +01:00
2020-11-25 11:28:12 -08:00
2021-08-11 14:43:16 -07:00
2020-12-07 11:53:40 -08:00
2021-08-30 01:51:36 +02:00
2021-10-07 13:39:51 +01:00
2021-10-14 19:16:21 -07:00
2021-09-19 12:43:04 +01:00
2021-10-13 17:24:38 -07:00
2021-10-28 10:43:58 -07:00
2020-02-26 20:07:25 -08:00
2021-05-14 15:26:03 -07:00
2021-09-13 16:35:58 -07:00
2021-03-28 17:56:56 -07:00
2021-07-02 12:43:40 -07:00
2021-09-13 16:35:58 -07:00
2021-10-07 13:39:51 +01:00
2021-10-15 10:54:20 +01:00
2021-09-03 11:48:28 +01:00
2021-08-17 00:45:07 +02:00
2019-10-13 10:13:08 -07:00
2021-10-24 13:59:44 +01:00
2021-07-20 06:00:38 -07:00
2020-05-08 15:32:17 +10:00
2021-10-24 13:59:44 +01:00
2021-11-01 22:26:08 -07:00
2021-11-01 19:59:46 -07:00
2021-10-22 12:35:51 -07:00
2020-09-30 11:50:35 -07:00
2021-08-16 18:43:39 -07:00
2021-06-23 12:56:08 -07:00
2021-10-08 16:21:53 +01:00
2021-10-16 09:06:09 +01:00
2021-10-22 17:23:53 -07:00
2019-12-25 19:51:33 -08:00
2020-06-18 20:46:23 -07:00
2020-01-24 20:54:30 +01:00
2021-10-27 18:13:57 -07:00