Matteo Croce
df5b0ab3e0
reboot: fix overflow parsing reboot cpu number
...
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: 1b3a5d02ee07 ("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>
2020-11-14 11:26:03 -08:00
..
2020-11-06 13:15:21 -08:00
2020-10-16 11:11:19 -07:00
2020-04-07 10:43:42 -07:00
2020-10-01 14:44:08 +01:00
2020-11-02 10:10:39 -05:00
2020-11-04 18:06:14 +01:00
2020-11-07 13:07:26 +01:00
2020-09-11 09:33:54 -07:00
2020-11-08 09:52:57 -08:00
2020-10-16 11:11:19 -07:00
2020-10-16 11:11:19 -07:00
2020-11-01 11:08:17 -08:00
2020-10-27 19:11:44 +01:00
2020-10-30 16:57:42 -05:00
2020-11-13 09:23:10 -08:00
2020-11-10 18:31:17 +01:00
2020-10-26 11:48:11 +01:00
2020-11-02 15:58:32 -05:00
2020-10-16 11:11:19 -07:00
2020-07-16 12:35:15 -07:00
2020-07-27 23:25:50 +02:00
2020-08-06 19:29:51 -07:00
2020-07-27 23:25:50 +02:00
2020-08-26 09:10:39 -04:00
2020-08-17 20:26:58 -04:00
2020-08-23 17:36:59 -05:00
2020-08-04 14:20:26 -07:00
2020-07-30 11:15:58 -07:00
2020-10-13 09:17:34 -07:00
2020-08-23 17:36:59 -05:00
2020-06-11 15:14:36 +02:00
2020-09-01 09:58:03 +02:00
2020-06-03 13:06:42 -07:00
2020-08-12 10:58:01 -07:00
2020-04-15 11:21:54 +02:00
2020-05-20 14:44:21 -05:00
2020-10-28 16:39:49 -04:00
2020-04-07 10:43:42 -07:00
2020-11-08 11:18:39 -08:00
2020-11-07 22:07:04 +01:00
2020-06-06 23:42:01 +09:00
2020-10-13 09:17:34 -07:00
2020-11-02 12:14:19 -08:00
2020-05-28 10:54:15 +02:00
2020-10-16 11:11:19 -07:00
2020-10-25 14:51:49 -07:00
2020-08-12 10:58:02 -07:00
2020-10-16 11:11:19 -07:00
2020-10-16 11:11:18 -07:00
2020-10-05 13:37:03 +02:00
2020-08-12 10:58:01 -07:00
2020-11-04 09:46:06 -05:00
2020-11-02 12:14:19 -08:00
2020-04-27 02:07:40 -04:00
2020-10-22 13:13:57 -07:00
2020-10-22 13:08:57 -07:00
2020-09-01 09:58:03 +02:00
2020-07-08 11:14:22 +02:00
2020-09-04 17:51:55 +10:00
2020-10-16 11:11:22 -07:00
2020-10-29 17:22:59 -05:00
2020-10-16 11:11:19 -07:00
2020-10-18 09:27:10 -07:00
2020-10-16 11:11:19 -07:00
2020-11-14 11:26:03 -08:00
2020-07-27 14:31:12 -04:00
2020-10-16 11:11:22 -07:00
2020-10-16 11:11:18 -07:00
2020-08-24 18:38:38 -07:00
2020-08-07 11:33:25 -07:00
2020-10-08 13:17:47 -07:00
2020-11-02 12:14:19 -08:00
2020-10-18 14:34:50 -07:00
2020-09-16 15:18:56 +02:00
2020-09-19 13:13:39 -07:00
2020-09-18 14:24:16 +01:00
2020-10-02 21:18:25 +02:00
2020-10-26 12:12:27 +01:00
2020-10-18 09:27:10 -07:00
2020-10-25 11:44:16 -07:00
2020-09-17 10:26:41 -07:00
2020-10-17 15:05:30 -06:00
2020-10-02 19:11:12 -07:00
2020-06-29 12:01:45 -07:00
2020-10-29 17:22:59 -05:00
2020-04-07 21:51:27 +02:00
2020-10-06 10:31:52 -07:00
2020-10-16 11:11:19 -07:00
2020-06-04 19:06:24 -07:00
2020-07-07 11:58:59 -05:00
2020-04-27 02:07:40 -04:00
2020-05-09 13:57:12 +02:00
2020-08-17 09:39:18 -07:00
2020-06-08 11:05:56 -07:00
2020-10-16 07:28:20 +02:00