Kuniyuki Iwashima
ea6ce93327
nfs: Handle error of rpc_proc_register() in nfs_net_init().
...
[ Upstream commit 24457f1be29f1e7042e50a7749f5c2dde8c433c8 ]
syzkaller reported a warning [0] triggered while destroying immature
netns.
rpc_proc_register() was called in init_nfs_fs(), but its error
has been ignored since at least the initial commit 1da177e4c3f4
("Linux-2.6.12-rc2").
Recently, commit d47151b79e32 ("nfs: expose /proc/net/sunrpc/nfs
in net namespaces") converted the procfs to per-netns and made
the problem more visible.
Even when rpc_proc_register() fails, nfs_net_init() could succeed,
and thus nfs_net_exit() will be called while destroying the netns.
Then, remove_proc_entry() will be called for non-existing proc
directory and trigger the warning below.
Let's handle the error of rpc_proc_register() properly in nfs_net_init().
[0]:
name 'nfs'
WARNING: CPU: 1 PID: 1710 at fs/proc/generic.c:711 remove_proc_entry+0x1bb/0x2d0 fs/proc/generic.c:711
Modules linked in:
CPU: 1 PID: 1710 Comm: syz-executor.2 Not tainted 6.8.0-12822-gcd51db110a7e #12
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
RIP: 0010:remove_proc_entry+0x1bb/0x2d0 fs/proc/generic.c:711
Code: 41 5d 41 5e c3 e8 85 09 b5 ff 48 c7 c7 88 58 64 86 e8 09 0e 71 02 e8 74 09 b5 ff 4c 89 e6 48 c7 c7 de 1b 80 84 e8 c5 ad 97 ff <0f> 0b eb b1 e8 5c 09 b5 ff 48 c7 c7 88 58 64 86 e8 e0 0d 71 02 eb
RSP: 0018:ffffc9000c6d7ce0 EFLAGS: 00010286
RAX: 0000000000000000 RBX: ffff8880422b8b00 RCX: ffffffff8110503c
RDX: ffff888030652f00 RSI: ffffffff81105045 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: ffffffff81bb62cb R12: ffffffff84807ffc
R13: ffff88804ad6fcc0 R14: ffffffff84807ffc R15: ffffffff85741ff8
FS: 00007f30cfba8640(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff51afe8000 CR3: 000000005a60a005 CR4: 0000000000770ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
rpc_proc_unregister+0x64/0x70 net/sunrpc/stats.c:310
nfs_net_exit+0x1c/0x30 fs/nfs/inode.c:2438
ops_exit_list+0x62/0xb0 net/core/net_namespace.c:170
setup_net+0x46c/0x660 net/core/net_namespace.c:372
copy_net_ns+0x244/0x590 net/core/net_namespace.c:505
create_new_namespaces+0x2ed/0x770 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xae/0x160 kernel/nsproxy.c:228
ksys_unshare+0x342/0x760 kernel/fork.c:3322
__do_sys_unshare kernel/fork.c:3393 [inline]
__se_sys_unshare kernel/fork.c:3391 [inline]
__x64_sys_unshare+0x1f/0x30 kernel/fork.c:3391
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x46/0x4e
RIP: 0033:0x7f30d0febe5d
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 9f 1b 00 f7 d8 64 89 01 48
RSP: 002b:00007f30cfba7cc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000110
RAX: ffffffffffffffda RBX: 00000000004bbf80 RCX: 00007f30d0febe5d
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000006c020600
RBP: 00000000004bbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
R13: 000000000000000b R14: 00007f30d104c530 R15: 0000000000000000
</TASK>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-17 11:50:46 +02:00
..
2023-11-28 16:56:19 +00:00
2023-02-01 08:27:06 +01:00
2024-03-26 18:21:34 -04:00
2023-09-23 11:09:54 +02:00
2024-05-02 16:24:48 +02:00
2024-03-06 14:38:50 +00:00
2024-02-23 08:55:09 +01:00
2024-05-02 16:24:43 +02:00
2023-03-10 09:39:50 +01:00
2022-12-31 13:14:15 +01:00
2022-11-10 18:15:37 +01:00
2024-01-25 14:52:27 -08:00
2022-02-01 17:27:01 +01:00
2023-09-19 12:22:52 +02:00
2024-02-23 08:54:40 +01:00
2024-01-25 14:52:33 -08:00
2024-03-15 10:48:15 -04:00
2024-03-01 13:21:56 +01:00
2024-04-10 16:19:21 +02:00
2023-09-23 11:09:57 +02:00
2024-04-13 13:01:45 +02:00
2024-03-26 18:21:33 -04:00
2024-04-10 16:18:35 +02:00
2021-10-04 22:13:12 +01:00
2024-04-10 16:18:38 +02:00
2024-01-25 14:52:35 -08:00
2023-03-10 09:39:57 +01:00
2023-05-24 17:36:43 +01:00
2024-03-06 14:38:50 +00:00
2023-12-08 08:48:05 +01:00
2024-04-13 13:01:44 +02:00
2024-01-25 14:52:29 -08:00
2023-07-23 13:47:34 +02:00
2024-02-23 08:54:39 +01:00
2024-02-23 08:54:51 +01:00
2024-05-17 11:50:44 +02:00
2024-04-27 17:05:23 +02:00
2022-04-13 20:59:10 +02:00
2021-12-29 12:28:59 +01:00
2024-05-17 11:50:46 +02:00
2021-10-04 22:02:17 +01:00
2024-04-27 17:05:23 +02:00
2024-04-27 17:05:29 +02:00
2023-09-19 12:22:27 +02:00
2024-04-10 16:19:19 +02:00
2022-11-26 09:24:52 +01:00
2024-03-01 13:21:47 +01:00
2023-09-19 12:22:34 +02:00
2022-12-31 13:14:44 +01:00
2023-11-28 16:56:29 +00:00
2024-03-15 10:48:22 -04:00
2024-04-13 13:01:43 +02:00
2021-09-21 08:36:48 -07:00
2024-03-26 18:21:27 -04:00
2023-07-23 13:47:33 +02:00
2023-09-19 12:22:30 +02:00
2021-12-14 10:57:12 +01:00
2023-02-22 12:57:07 +01:00
2024-04-27 17:05:28 +02:00
2024-04-13 13:01:44 +02:00
2023-09-23 11:10:02 +02:00
2024-04-10 16:18:35 +02:00
2023-09-19 12:22:53 +02:00
2024-04-10 16:19:38 +02:00
2023-09-19 12:22:52 +02:00
2024-02-23 08:54:32 +01:00
2024-03-01 13:21:43 +01:00
2024-04-10 16:18:46 +02:00
2023-09-23 11:10:01 +02:00
2021-09-05 10:15:05 -07:00
2023-10-06 13:18:24 +02:00
2022-11-03 23:59:12 +09:00
2022-06-09 10:22:26 +02:00
2022-12-31 13:14:39 +01:00
2022-11-26 09:24:51 +01:00
2022-12-31 13:14:30 +01:00
2022-04-08 14:24:18 +02:00
2022-09-28 11:11:56 +02:00
2024-02-23 08:54:46 +01:00
2023-09-19 12:22:30 +02:00
2023-06-21 15:59:14 +02:00
2024-04-10 16:19:31 +02:00
2024-03-26 18:21:14 -04:00
2022-10-26 12:34:58 +02:00
2023-08-11 15:13:58 +02:00
2023-07-23 13:47:34 +02:00
2021-09-07 16:07:47 -04:00
2023-11-20 11:08:13 +01:00
2023-12-08 08:48:04 +01:00
2023-08-30 16:18:19 +02:00
2024-02-23 08:54:25 +01:00
2024-04-10 16:19:01 +02:00
2021-10-18 20:22:03 -10:00
2022-12-31 13:14:03 +01:00
2024-04-10 16:19:23 +02:00
2022-12-14 11:37:31 +01:00
2023-01-12 11:59:20 +01:00
2024-02-23 08:54:26 +01:00
2024-01-25 14:52:35 -08:00
2024-04-10 16:19:05 +02:00
2024-04-10 16:19:42 +02:00
2023-01-12 11:58:47 +01:00
2022-07-02 16:41:17 +02:00
2022-07-02 16:41:14 +02:00
2022-12-19 12:36:39 +01:00
2022-07-21 21:24:14 +02:00
2024-03-26 18:21:15 -04:00
2022-07-12 16:35:08 +02:00
2021-12-14 10:57:15 +01:00
2022-10-26 12:34:17 +02:00
2022-04-27 14:38:57 +02:00
2023-05-24 17:36:54 +01:00
2023-08-11 15:13:58 +02:00
2022-04-27 14:38:50 +02:00
2022-10-26 12:34:36 +02:00
2022-12-31 13:14:01 +01:00