gaoxiang17
09d227c59d
pid: Add a judgment for ns null in pid_nr_ns
[ Upstream commit 006568ab4c5ca2309ceb36fa553e390b4aa9c0c7 ]
__task_pid_nr_ns
ns = task_active_pid_ns(current);
pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
if (pid && ns->level <= pid->level) {
Sometimes null is returned for task_active_pid_ns. Then it will trigger kernel panic in pid_nr_ns.
For example:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058
Mem abort info:
ESR = 0x0000000096000007
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x07: level 3 translation fault
Data abort info:
ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 39-bit VAs, pgdp=00000002175aa000
[0000000000000058] pgd=08000002175ab003, p4d=08000002175ab003, pud=08000002175ab003, pmd=08000002175be003, pte=0000000000000000
pstate: 834000c5 (Nzcv daIF +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : __task_pid_nr_ns+0x74/0xd0
lr : __task_pid_nr_ns+0x24/0xd0
sp : ffffffc08001bd10
x29: ffffffc08001bd10 x28: ffffffd4422b2000 x27: 0000000000000001
x26: ffffffd442821168 x25: ffffffd442821000 x24: 00000f89492eab31
x23: 00000000000000c0 x22: ffffff806f5693c0 x21: ffffff806f5693c0
x20: 0000000000000001 x19: 0000000000000000 x18: 0000000000000000
x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 00000000023a1adc
x14: 0000000000000003 x13: 00000000007ef6d8 x12: 001167c391c78800
x11: 00ffffffffffffff x10: 0000000000000000 x9 : 0000000000000001
x8 : ffffff80816fa3c0 x7 : 0000000000000000 x6 : 49534d702d535449
x5 : ffffffc080c4c2c0 x4 : ffffffd43ee128c8 x3 : ffffffd43ee124dc
x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffffff806f5693c0
Call trace:
__task_pid_nr_ns+0x74/0xd0
...
__handle_irq_event_percpu+0xd4/0x284
handle_irq_event+0x48/0xb0
handle_fasteoi_irq+0x160/0x2d8
generic_handle_domain_irq+0x44/0x60
gic_handle_irq+0x4c/0x114
call_on_irq_stack+0x3c/0x74
do_interrupt_handler+0x4c/0x84
el1_interrupt+0x34/0x58
el1h_64_irq_handler+0x18/0x24
el1h_64_irq+0x68/0x6c
account_kernel_stack+0x60/0x144
exit_task_stack_account+0x1c/0x80
do_exit+0x7e4/0xaf8
...
get_signal+0x7bc/0x8d8
do_notify_resume+0x128/0x828
el0_svc+0x6c/0x70
el0t_64_sync_handler+0x68/0xbc
el0t_64_sync+0x1a8/0x1ac
Code: 35fffe54 911a02a8 f9400108 b4000128 (b9405a69)
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Oops: Fatal exception in interrupt
Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
Link: https://lore.kernel.org/20250802022123.3536934-1-gxxa03070307@gmail.com
Reviewed-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-10-19 16:31:01 +02:00
..
2025-10-19 16:30:45 +02:00
2025-09-25 11:00:05 +02:00
2023-09-05 11:01:47 -07:00
2024-08-03 08:54:34 +02:00
2025-09-04 15:30:27 +02:00
2024-04-03 15:28:50 +02:00
2025-08-15 12:09:05 +02:00
2025-10-02 13:42:52 +02:00
2024-06-27 13:49:13 +02:00
2025-02-08 09:51:48 +01:00
2025-08-15 12:08:49 +02:00
2023-11-20 11:59:25 +01:00
2025-04-25 10:45:29 +02:00
2025-08-28 16:28:28 +02:00
2025-08-28 16:28:17 +02:00
2025-06-04 14:42:00 +02:00
2025-09-19 16:32:03 +02:00
2025-10-19 16:30:52 +02:00
2025-09-19 16:32:07 +02:00
2025-10-19 16:30:58 +02:00
2025-02-27 04:10:52 -08:00
2024-01-31 16:18:49 -08:00
2022-08-22 18:50:06 -04:00
2022-04-25 14:37:28 +02:00
2023-11-28 17:19:56 +00:00
2024-02-05 20:14:14 +00:00
2025-08-15 12:08:39 +02:00
2024-07-11 12:49:18 +02:00
2025-08-15 12:08:39 +02:00
2024-05-02 16:32:50 +02:00
2023-08-08 16:48:47 -04:00
2022-09-26 10:13:13 -07:00
2023-03-14 19:32:38 -07:00
2023-06-05 09:57:20 +02:00
2023-01-13 11:48:15 +01:00
2025-01-23 17:21:17 +01:00
2024-05-02 16:32:47 +02:00
2023-12-20 17:01:51 +01:00
2023-04-18 16:39:34 -07:00
2025-06-27 11:09:03 +01:00
2022-07-05 13:32:59 -07:00
2023-02-08 13:36:22 +01:00
2025-10-19 16:30:48 +02:00
2025-08-15 12:09:07 +02:00
2025-01-23 17:21:13 +01:00
2022-07-15 18:21:49 +00:00
2023-04-08 13:45:37 -07:00
2023-08-21 13:37:28 -07:00
2023-03-24 11:01:29 +01:00
2024-10-10 11:57:13 +02:00
2022-11-12 18:47:36 -08:00
2023-08-29 17:32:32 -07:00
2022-11-15 00:42:02 -08:00
2023-08-25 15:00:36 -07:00
2024-01-05 15:19:41 +01:00
2021-08-17 17:50:51 +02:00
2022-03-31 10:36:55 +02:00
2025-01-09 13:32:07 +01:00
2024-01-31 16:18:56 -08:00
2025-04-10 14:37:34 +02:00
2024-09-12 11:11:27 +02:00
2022-09-11 21:55:06 -07:00
2023-11-28 17:19:40 +00:00
2023-03-24 20:10:59 -07:00
2024-08-14 13:58:51 +02:00
2023-06-08 12:27:20 -07:00
2023-08-24 16:25:14 -07:00
2024-10-17 15:24:37 +02:00
2022-09-11 21:55:12 -07:00
2024-06-12 11:11:50 +02:00
2023-04-08 13:45:38 -07:00
2023-08-21 11:29:12 -07:00
2024-06-12 11:11:50 +02:00
2025-06-04 14:42:19 +02:00
2025-05-02 07:50:55 +02:00
2025-05-18 08:24:08 +02:00
2024-06-21 14:38:50 +02:00
2023-08-21 13:37:59 -07:00
2025-10-19 16:31:01 +02:00
2024-08-14 13:58:47 +02:00
2023-04-16 14:23:07 +02:00
2023-11-28 17:20:04 +00:00
2023-08-18 10:18:55 -07:00
2025-08-01 09:47:31 +01:00
2025-10-19 16:30:59 +02:00
2023-07-14 15:02:57 -07:00
2022-11-09 18:06:35 +00:00
2025-10-15 11:57:48 +02:00
2024-12-09 10:33:11 +01:00
2025-10-15 11:57:53 +02:00
2024-06-12 11:12:52 +02:00
2025-06-04 14:41:55 +02:00
2023-04-20 11:36:35 +02:00
2022-02-25 09:36:06 +01:00
2024-12-19 18:11:36 +01:00
2022-04-05 09:59:38 +02:00
2022-05-24 11:11:13 -07:00
2024-07-05 09:34:04 +02:00
2025-10-19 16:30:50 +02:00
2022-09-08 16:56:45 -07:00
2023-06-28 16:05:21 -07:00
2024-11-01 01:58:34 +01:00
2022-08-29 12:47:15 +01:00
2023-11-28 17:20:08 +00:00
2023-02-18 14:34:36 -05:00
2022-04-29 14:38:03 -07:00
2025-08-15 12:08:57 +02:00
2023-06-29 15:19:43 -07:00
2023-02-02 22:50:04 -08:00
2022-11-30 20:16:49 -04:00
2022-05-19 23:25:47 -04:00
2023-04-13 11:49:35 -07:00
2025-10-02 13:42:51 +02:00
2025-04-10 14:37:25 +02:00
2023-06-19 16:25:28 -07:00
2024-08-03 08:54:29 +02:00
2025-06-27 11:08:49 +01:00
2023-08-07 15:57:22 -10:00
2025-01-17 13:36:25 +01:00