Bixuan Cui
93937596e0
bpf: Add oversize check before call kvcalloc()
[ Upstream commit 0e6491b559 ]
Commit 7661809d49 ("mm: don't allow oversized kvmalloc() calls") add the
oversize check. When the allocation is larger than what kmalloc() supports,
the following warning triggered:
WARNING: CPU: 0 PID: 8408 at mm/util.c:597 kvmalloc_node+0x108/0x110 mm/util.c:597
Modules linked in:
CPU: 0 PID: 8408 Comm: syz-executor221 Not tainted 5.14.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:kvmalloc_node+0x108/0x110 mm/util.c:597
Call Trace:
kvmalloc include/linux/mm.h:806 [inline]
kvmalloc_array include/linux/mm.h:824 [inline]
kvcalloc include/linux/mm.h:829 [inline]
check_btf_line kernel/bpf/verifier.c:9925 [inline]
check_btf_info kernel/bpf/verifier.c:10049 [inline]
bpf_check+0xd634/0x150d0 kernel/bpf/verifier.c:13759
bpf_prog_load kernel/bpf/syscall.c:2301 [inline]
__sys_bpf+0x11181/0x126e0 kernel/bpf/syscall.c:4587
__do_sys_bpf kernel/bpf/syscall.c:4691 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4689 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4689
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
Reported-by: syzbot+f3e749d4c662818ae439@syzkaller.appspotmail.com
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210911005557.45518-1-cuibixuan@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-30 10:09:25 +02:00
..
2021-09-30 10:09:25 +02:00
2021-09-15 09:47:32 +02:00
2021-03-04 10:26:10 +01:00
2021-09-22 12:26:24 +02:00
2021-09-22 12:26:41 +02:00
2021-04-14 08:24:10 +02:00
2021-09-15 09:47:29 +02:00
2019-08-19 13:03:37 +02:00
2021-09-15 09:47:25 +02:00
2021-09-15 09:47:33 +02:00
2021-03-04 10:26:50 +01:00
2021-09-15 09:47:26 +02:00
2021-09-15 09:47:28 +02:00
2021-09-16 12:56:13 +02:00
2021-09-30 10:09:24 +02:00
2021-05-11 14:04:16 +02:00
2021-09-03 10:08:16 +02:00
2020-10-01 13:17:32 +02:00
2020-06-22 09:30:59 +02:00
2020-06-22 09:30:59 +02:00
2020-06-22 09:30:59 +02:00
2019-06-19 17:09:55 +02:00
2019-07-30 18:34:15 +02:00
2020-06-22 09:31:22 +02:00
2021-07-19 08:53:15 +02:00
2019-06-19 17:09:06 +02:00
2020-01-17 19:48:42 +01:00
2020-11-18 19:20:31 +01:00
2019-08-21 22:23:48 +10:00
2020-11-24 13:29:18 +01:00
2021-09-22 12:26:37 +02:00
2019-10-06 09:11:37 -06:00
2021-06-30 08:47:55 -04:00
2020-09-03 11:27:10 +02:00
2019-07-12 11:05:40 -07:00
2019-08-29 15:10:10 +01:00
2020-07-16 08:16:44 +02:00
2021-01-09 13:44:55 +01:00
2019-07-22 18:05:11 +02:00
2021-02-03 23:25:56 +01:00
2019-09-06 23:58:44 +02:00
2021-05-19 10:08:28 +02:00
2019-08-19 21:54:15 -07:00
2020-04-17 10:50:22 +02:00
2021-02-13 13:52:54 +01:00
2021-09-12 08:56:39 +02:00
2021-05-11 14:04:16 +02:00
2021-04-07 14:47:38 +02:00
2021-04-07 14:47:38 +02:00
2021-06-30 08:47:42 -04:00
2020-10-01 13:17:23 +02:00
2020-06-17 16:40:22 +02:00
2019-10-07 15:47:19 -07:00
2019-08-19 21:54:16 -07:00
2021-09-22 12:26:37 +02:00
2019-07-16 19:23:24 -07:00
2021-09-26 14:07:09 +02:00
2021-05-26 12:05:15 +02:00
2020-11-18 19:20:30 +01:00
2020-08-26 10:40:51 +02:00
2020-06-24 17:50:35 +02:00
2021-03-04 10:26:45 +01:00
2020-11-10 12:37:24 +01:00
2021-05-14 09:44:33 +02:00
2021-02-07 15:35:49 +01:00
2019-07-08 11:01:13 -07:00
2019-11-04 21:19:25 +01:00
2019-10-17 12:47:12 +02:00
2019-06-21 01:54:53 +02:00
2021-09-26 14:07:08 +02:00
2020-10-01 13:17:10 +02:00
2021-03-17 17:03:45 +01:00
2020-01-09 10:19:54 +01:00
2019-08-01 14:30:22 -07:00
2021-07-14 16:53:08 +02:00
2019-07-18 17:08:07 -07:00
2020-10-14 10:32:58 +02:00
2021-05-14 09:44:33 +02:00
2019-07-08 19:36:47 -07:00
2019-07-08 19:36:47 -07:00
2020-02-24 08:36:52 +01:00
2021-09-22 12:26:30 +02:00