Patrick Wang
70ea5e7b38
mm: kmemleak: take a full lowmem check in kmemleak_*_phys()
...
commit 23c2d497de21f25898fbea70aeb292ab8acc8c94 upstream.
The kmemleak_*_phys() apis do not check the address for lowmem's min
boundary, while the caller may pass an address below lowmem, which will
trigger an oops:
# echo scan > /sys/kernel/debug/kmemleak
Unable to handle kernel paging request at virtual address ff5fffffffe00000
Oops [#1 ]
Modules linked in:
CPU: 2 PID: 134 Comm: bash Not tainted 5.18.0-rc1-next-20220407 #33
Hardware name: riscv-virtio,qemu (DT)
epc : scan_block+0x74/0x15c
ra : scan_block+0x72/0x15c
epc : ffffffff801e5806 ra : ffffffff801e5804 sp : ff200000104abc30
gp : ffffffff815cd4e8 tp : ff60000004cfa340 t0 : 0000000000000200
t1 : 00aaaaaac23954cc t2 : 00000000000003ff s0 : ff200000104abc90
s1 : ffffffff81b0ff28 a0 : 0000000000000000 a1 : ff5fffffffe01000
a2 : ffffffff81b0ff28 a3 : 0000000000000002 a4 : 0000000000000001
a5 : 0000000000000000 a6 : ff200000104abd7c a7 : 0000000000000005
s2 : ff5fffffffe00ff9 s3 : ffffffff815cd998 s4 : ffffffff815d0e90
s5 : ffffffff81b0ff28 s6 : 0000000000000020 s7 : ffffffff815d0eb0
s8 : ffffffffffffffff s9 : ff5fffffffe00000 s10: ff5fffffffe01000
s11: 0000000000000022 t3 : 00ffffffaa17db4c t4 : 000000000000000f
t5 : 0000000000000001 t6 : 0000000000000000
status: 0000000000000100 badaddr: ff5fffffffe00000 cause: 000000000000000d
scan_gray_list+0x12e/0x1a6
kmemleak_scan+0x2aa/0x57e
kmemleak_write+0x32a/0x40c
full_proxy_write+0x56/0x82
vfs_write+0xa6/0x2a6
ksys_write+0x6c/0xe2
sys_write+0x22/0x2a
ret_from_syscall+0x0/0x2
The callers may not quite know the actual address they pass(e.g. from
devicetree). So the kmemleak_*_phys() apis should guarantee the address
they finally use is in lowmem range, so check the address for lowmem's
min boundary.
Link: https://lkml.kernel.org/r/20220413122925.33856-1-patrick.wang.shcn@gmail.com
Signed-off-by: Patrick Wang <patrick.wang.shcn@gmail.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20 09:34:18 +02:00
..
2022-01-05 12:42:39 +01:00
2022-03-08 19:12:38 +01:00
2022-04-13 20:59:00 +02:00
2021-12-14 10:57:11 +01:00
2021-05-07 00:26:35 -07:00
2021-09-03 09:58:14 -07:00
2021-05-05 11:27:21 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-09-08 12:55:35 -07:00
2022-02-08 18:34:05 +01:00
2021-09-24 16:13:35 -07:00
2021-06-29 10:53:52 -07:00
2021-09-08 11:50:24 -07:00
2022-03-02 11:47:47 +01:00
2021-05-05 11:27:27 -07:00
2021-05-05 11:27:26 -07:00
2021-05-05 11:27:26 -07:00
2022-02-05 12:38:57 +01:00
2022-04-13 20:59:21 +02:00
2022-01-27 11:05:43 +01:00
2021-10-28 17:18:55 -07:00
2021-05-05 11:27:22 -07:00
2021-06-30 20:47:26 -07:00
2021-06-30 20:47:25 -07:00
2021-11-25 09:49:07 +01:00
2021-09-03 09:58:15 -07:00
2021-07-08 11:48:21 -07:00
2021-09-03 09:58:16 -07:00
2021-04-30 11:20:38 -07:00
2021-04-30 11:20:39 -07:00
2021-09-08 11:50:24 -07:00
2021-11-25 09:48:43 +01:00
2020-12-15 12:13:46 -08:00
2021-10-28 17:18:55 -07:00
2022-04-20 09:34:18 +02:00
2021-09-13 10:18:28 -07:00
2021-05-05 11:27:23 -07:00
2021-08-20 11:39:25 +01:00
2022-04-08 14:22:56 +02:00
2021-09-08 11:50:24 -07:00
2021-07-01 11:06:02 -07:00
2022-03-02 11:48:10 +01:00
2022-04-08 14:24:13 +02:00
2022-03-08 19:12:48 +01:00
2021-09-08 12:55:35 -07:00
2021-12-29 12:28:58 +01:00
2022-04-13 20:59:27 +02:00
2022-04-13 20:59:22 +02:00
2021-06-04 19:32:21 +01:00
2021-09-08 11:50:23 -07:00
2021-10-18 20:22:03 -10:00
2021-01-24 14:27:16 +01:00
2022-04-08 14:22:52 +02:00
2021-04-30 11:20:42 -07:00
2021-07-23 17:43:28 -07:00
2022-04-08 14:24:13 +02:00
2021-04-16 16:10:36 -07:00
2021-03-25 09:22:55 -07:00
2020-12-15 14:48:04 -08:00
2022-02-23 12:03:03 +01:00
2022-04-13 20:59:22 +02:00
2021-04-30 11:20:37 -07:00
2021-09-04 11:35:47 -07:00
2021-11-18 19:17:16 +01:00
2022-04-20 09:34:18 +02:00
2021-04-30 11:20:38 -07:00
2021-10-18 20:22:02 -10:00
2021-09-08 11:50:24 -07:00
2022-04-20 09:34:18 +02:00
2021-09-08 12:55:35 -07:00
2021-09-08 11:50:22 -07:00
2021-04-30 11:20:36 -07:00
2021-06-29 10:53:47 -07:00
2021-06-29 10:53:47 -07:00
2021-07-01 11:06:03 -07:00
2021-09-03 10:08:28 -07:00
2021-06-29 10:53:49 -07:00
2021-07-01 17:17:24 -07:00
2021-07-04 18:30:17 +00:00
2021-06-05 20:43:15 +00:00
2021-07-04 18:30:17 +00:00
2021-09-08 12:55:35 -07:00
2021-05-07 00:26:35 -07:00
2021-06-16 09:24:42 -07:00
2021-05-05 11:27:27 -07:00
2021-04-16 16:10:37 -07:00
2021-07-13 13:14:27 +02:00
2022-04-13 20:59:14 +02:00
2022-04-20 09:34:18 +02:00
2022-01-27 11:03:01 +01:00
2021-04-16 16:10:36 -07:00
2021-05-22 15:09:07 -10:00
2021-09-04 01:12:23 +02:00
2022-04-08 14:22:46 +02:00
2021-11-25 09:48:42 +01:00
2021-03-08 14:18:46 -08:00
2021-12-14 10:57:11 +01:00
2021-06-30 20:47:26 -07:00
2021-09-03 09:58:15 -07:00
2021-08-28 01:46:17 +02:00
2022-03-23 09:16:41 +01:00
2021-09-24 16:13:35 -07:00
2021-09-03 09:58:12 -07:00
2021-09-03 10:08:28 -07:00
2022-04-08 14:24:14 +02:00
2021-09-03 09:58:16 -07:00
2022-03-08 19:12:44 +01:00
2022-03-08 19:12:38 +01:00
2021-09-03 09:58:17 -07:00
2021-09-08 18:45:53 -07:00
2021-09-08 15:32:34 -07:00
2021-09-23 10:09:13 -07:00
2021-07-01 11:06:03 -07:00
2021-07-01 11:06:03 -07:00
2021-05-07 00:26:35 -07:00
2021-11-18 19:17:10 +01:00
2021-06-30 20:47:31 -07:00