Matteo Croce
5b83116b95
reboot: fix overflow parsing reboot cpu number
commit df5b0ab3e0 upstream.
Limit the CPU number to num_possible_cpus(), because setting it to a
value lower than INT_MAX but higher than NR_CPUS produces the following
error on reboot and shutdown:
BUG: unable to handle page fault for address: ffffffff90ab1bb0
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 1c09067 P4D 1c09067 PUD 1c0a063 PMD 0
Oops: 0000 [#1] SMP
CPU: 1 PID: 1 Comm: systemd-shutdow Not tainted 5.9.0-rc8-kvm #110
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
RIP: 0010:migrate_to_reboot_cpu+0xe/0x60
Code: ea ea 00 48 89 fa 48 c7 c7 30 57 f1 81 e9 fa ef ff ff 66 2e 0f 1f 84 00 00 00 00 00 53 8b 1d d5 ea ea 00 e8 14 33 fe ff 89 da <48> 0f a3 15 ea fc bd 00 48 89 d0 73 29 89 c2 c1 e8 06 65 48 8b 3c
RSP: 0018:ffffc90000013e08 EFLAGS: 00010246
RAX: ffff88801f0a0000 RBX: 0000000077359400 RCX: 0000000000000000
RDX: 0000000077359400 RSI: 0000000000000002 RDI: ffffffff81c199e0
RBP: ffffffff81c1e3c0 R08: ffff88801f41f000 R09: ffffffff81c1e348
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 00007f32bedf8830 R14: 00000000fee1dead R15: 0000000000000000
FS: 00007f32bedf8980(0000) GS:ffff88801f480000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff90ab1bb0 CR3: 000000001d057000 CR4: 00000000000006a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__do_sys_reboot.cold+0x34/0x5b
do_syscall_64+0x2d/0x40
Fixes: 1b3a5d02ee ("reboot: move arch/x86 reboot= handling to generic kernel")
Signed-off-by: Matteo Croce <mcroce@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Fabian Frederick <fabf@skynet.be>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Robin Holt <robinmholt@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20201103214025.116799-3-mcroce@linux.microsoft.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[sudip: use reboot_mode instead of mode]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-16 09:48:13 +09:00
..
2023-05-16 09:15:40 +09:00
2017-10-03 17:19:26 +00:00
2023-05-16 09:44:43 +09:00
2023-05-16 09:48:10 +09:00
2023-05-16 09:13:10 +09:00
2023-05-16 09:46:54 +09:00
2016-08-26 14:42:08 +02:00
2023-05-16 08:56:59 +09:00
2023-05-16 09:39:46 +09:00
2023-05-16 09:16:27 +09:00
2023-05-15 13:36:07 +09:00
2023-05-16 08:31:08 +09:00
2023-05-16 09:47:50 +09:00
2023-05-16 09:46:48 +09:00
2015-10-21 15:18:35 +01:00
2018-01-10 09:29:51 +01:00
2018-02-17 13:21:18 +01:00
2016-01-22 18:04:28 -05:00
2016-04-04 09:46:47 -04:00
2023-05-16 09:15:30 +09:00
2023-05-15 17:23:39 +09:00
2016-07-29 17:54:17 -07:00
2023-05-15 17:01:41 +09:00
2023-05-15 15:18:40 +09:00
2023-05-15 09:22:43 +09:00
2017-01-06 10:40:13 +01:00
2018-05-01 16:49:34 +00:00
2015-12-03 10:24:08 -05:00
2023-05-15 16:16:25 +09:00
2023-05-16 08:45:33 +09:00
2019-05-06 21:14:10 +08:00
2015-11-24 09:56:43 +01:00
2023-05-15 17:34:36 +09:00
2023-05-15 17:14:41 +09:00
2017-10-12 22:31:24 +02:00
2023-05-15 16:30:24 +09:00
2016-01-14 16:00:49 -08:00
2023-05-15 14:48:01 +09:00
2015-04-12 21:03:31 +02:00
2023-05-16 09:47:39 +09:00
2017-07-21 07:42:21 +02:00
2023-05-16 09:46:17 +09:00
2016-07-28 16:07:41 -07:00
2016-01-20 17:09:18 -08:00
2023-05-15 17:11:11 +09:00
2018-01-10 09:29:52 +01:00
2023-05-15 12:23:14 +09:00
2015-11-23 09:44:58 +01:00
2017-12-14 09:28:24 +01:00
2023-04-21 13:52:34 +09:00
2016-01-20 17:09:18 -08:00
2015-05-12 09:46:00 +02:00
2023-05-12 16:39:07 +09:00
2018-06-05 10:28:57 +02:00
2016-09-01 17:52:01 -07:00
2016-01-20 17:09:18 -08:00
2016-08-02 19:35:27 -04:00
2023-05-16 09:24:03 +09:00
2023-05-16 09:17:05 +09:00
2016-08-02 19:35:30 -04:00
2023-05-16 09:46:04 +09:00
2016-02-09 11:54:23 +01:00
2023-05-15 13:48:54 +09:00
2017-03-12 06:41:45 +01:00
2023-05-15 10:54:41 +09:00
2016-04-11 22:43:43 +01:00
2023-05-15 16:17:28 +09:00
2023-05-15 17:11:06 +09:00
2016-02-16 13:04:58 -05:00
2023-05-15 17:28:50 +09:00
2023-05-15 14:48:19 +09:00
2015-11-09 15:53:39 -08:00
2023-05-15 13:59:49 +09:00
2018-04-13 19:47:53 +02:00
2016-07-15 10:41:42 +02:00
2023-05-15 13:57:11 +09:00
2015-01-17 10:02:23 +13:00
2023-05-16 09:48:13 +09:00
2023-05-16 08:54:40 +09:00
2018-04-24 09:34:09 +02:00
2018-05-22 16:58:02 +02:00
2023-05-15 17:14:27 +09:00
2023-05-12 16:55:46 +09:00
2016-10-11 15:06:33 -07:00
2016-03-01 20:36:56 +01:00
2023-05-12 16:46:40 +09:00
2017-02-14 15:25:42 -08:00
2023-05-12 16:43:35 +09:00
2016-09-13 14:41:36 +02:00
2023-05-16 09:15:12 +09:00
2016-05-20 17:58:30 -07:00
2023-05-16 08:29:07 +09:00
2016-08-02 19:35:02 -04:00
2023-05-15 16:30:15 +09:00
2016-08-22 10:01:49 -07:00
2018-05-09 09:50:20 +02:00
2016-02-29 09:53:09 +01:00
2017-06-17 06:41:51 +02:00
2018-01-10 09:29:52 +01:00
2016-09-05 13:52:39 +02:00
2023-05-12 17:24:22 +09:00
2018-04-03 11:15:30 -07:00
2023-05-12 17:24:20 +09:00
2016-09-22 20:00:36 -05:00
2018-05-09 19:39:28 -07:00
2018-05-09 19:39:28 -07:00
2017-11-15 15:53:17 +01:00
2023-05-15 17:09:24 +09:00