Patrick Wang
23c2d497de
mm: kmemleak: take a full lowmem check in kmemleak_*_phys()
...
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>
2022-04-15 14:49:56 -07:00
..
2022-04-01 11:46:09 -07:00
2022-04-15 14:49:55 -07:00
2022-04-15 14:49:55 -07:00
2022-03-22 15:57:01 -07:00
2022-03-28 16:52:57 -04:00
2022-01-06 12:27:03 +01:00
2021-05-05 11:27:21 -07:00
2021-05-05 11:27:24 -07:00
2022-03-22 15:57:09 -07:00
2022-03-22 15:57:09 -07:00
2022-04-15 14:49:55 -07:00
2022-02-04 09:25:04 -08:00
2022-03-24 19:06:45 -07:00
2022-01-15 16:30:28 +02:00
2022-03-22 15:57:11 -07:00
2022-03-22 15:57:01 -07:00
2022-04-15 14:49:54 -07:00
2022-03-21 13:01:35 -04:00
2022-01-22 08:33:38 +02:00
2021-05-05 11:27:26 -07:00
2021-05-05 11:27:26 -07:00
2022-04-01 11:46:09 -07:00
2022-04-08 14:20:36 -10:00
2022-03-22 15:57:12 -07:00
2022-04-07 09:43:41 -04:00
2022-01-15 16:30:29 +02:00
2022-03-22 15:57:08 -07:00
2021-06-30 20:47:25 -07:00
2022-04-15 14:49:55 -07:00
2022-03-22 15:57:07 -07:00
2022-02-14 19:51:47 +01:00
2022-04-01 11:46:09 -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
2022-03-24 19:06:51 -07:00
2022-01-15 16:30:28 +02:00
2022-03-24 19:06:51 -07:00
2022-04-15 14:49:56 -07:00
2022-03-22 17:03:12 -07:00
2022-04-08 14:20:36 -10:00
2022-03-23 18:03:08 -07:00
2022-04-01 11:46:09 -07:00
2022-03-03 12:47:33 -05:00
2022-01-15 16:30:27 +02:00
2022-03-27 13:36:06 -07:00
2022-03-28 17:29:53 -07:00
2022-03-05 11:08:32 -08:00
2022-03-22 17:03:12 -07:00
2022-03-22 17:03:12 -07:00
2022-04-01 11:46:09 -07:00
2022-04-08 14:31:41 -10:00
2021-10-18 06:17:01 -06:00
2022-03-24 19:06:45 -07:00
2022-03-21 13:01:35 -04:00
2022-04-08 14:20:36 -10:00
2022-04-01 11:46:09 -07:00
2021-04-30 11:20:42 -07:00
2021-07-23 17:43:28 -07:00
2022-03-22 17:03:12 -07:00
2022-01-15 16:30:27 +02:00
2022-03-22 17:03:12 -07:00
2022-03-22 15:57:09 -07:00
2022-04-08 14:20:36 -10:00
2021-04-30 11:20:37 -07:00
2021-11-06 14:08:17 -07:00
2022-03-22 17:03:12 -07:00
2022-04-15 14:49:55 -07:00
2022-01-15 16:30:27 +02:00
2022-01-15 16:30:31 +02:00
2022-03-21 13:01:35 -04:00
2022-04-15 14:49:55 -07:00
2022-02-04 09:25:04 -08:00
2022-03-24 19:06:44 -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
2022-03-22 15:57:11 -07:00
2022-04-07 10:11:20 -04:00
2022-03-24 19:06:51 -07:00
2021-06-29 10:53:49 -07:00
2022-01-15 16:30:31 +02:00
2021-07-04 18:30:17 +00:00
2022-03-08 09:30:46 -05:00
2021-07-04 18:30:17 +00:00
2022-01-23 06:20:44 +02:00
2021-05-07 00:26:35 -07:00
2022-01-15 16:30:27 +02:00
2021-05-05 11:27:27 -07:00
2022-03-22 15:57:08 -07:00
2022-04-01 14:40:42 -04:00
2022-04-01 11:46:09 -07:00
2022-04-15 14:49:54 -07:00
2022-04-15 14:49:54 -07:00
2021-04-16 16:10:36 -07:00
2021-05-22 15:09:07 -10:00
2022-04-15 14:49:55 -07:00
2022-04-15 14:49:55 -07:00
2022-04-15 14:49:55 -07:00
2022-04-15 14:49:55 -07:00
2022-04-15 14:49:55 -07:00
2022-03-22 15:57:08 -07:00
2022-03-22 15:57:05 -07:00
2022-03-08 09:30:46 -05:00
2021-12-03 10:58:13 -08:00
2022-03-22 18:26:56 -07:00
2022-04-01 11:46:09 -07:00
2022-03-24 19:06:51 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 16:11:53 -07:00
2022-03-22 17:03:12 -07:00
2022-03-24 11:58:57 -07:00
2022-04-15 14:49:56 -07:00
2021-11-06 13:30:40 -07:00
2022-03-22 17:03:12 -07:00
2022-03-22 15:57:11 -07:00
2022-03-22 17:03:12 -07:00
2021-07-01 11:06:03 -07:00
2021-07-01 11:06:03 -07:00
2022-01-15 16:30:31 +02:00
2022-01-22 08:33:37 +02:00
2022-03-22 15:57:11 -07:00