Matteo Croce
2e021b7197
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>
2020-11-18 19:18:52 +01:00
..
2020-10-01 13:14:52 +02:00
2020-08-19 08:14:47 +02:00
2018-06-15 07:15:28 +09:00
2020-11-05 11:08:41 +01:00
2020-11-18 19:18:51 +01:00
2020-11-18 19:18:52 +01:00
2020-09-17 13:45:31 +02:00
2020-11-18 19:18:41 +01:00
2019-10-07 18:57:10 +02:00
2020-09-03 11:24:21 +02:00
2020-10-30 10:38:28 +01:00
2020-10-01 13:14:45 +02:00
2020-02-11 04:33:55 -08:00
2020-10-30 10:38:25 +01:00
2020-11-18 19:18:52 +01:00
2020-11-10 12:35:58 +01:00
2019-05-31 06:46:05 -07:00
2018-02-06 18:32:44 -08:00
2018-05-18 14:58:22 +02:00
2019-12-13 08:51:11 +01:00
2020-10-01 13:14:33 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:05:13 +02:00
2019-12-01 09:17:17 +01:00
2018-11-13 11:08:47 -08:00
2020-01-23 08:21:29 +01:00
2020-06-22 09:04:58 +02:00
2020-06-22 09:05:28 +02:00
2020-06-22 09:05:14 +02:00
2018-08-22 10:52:47 -07:00
2020-01-09 10:19:00 +01:00
2018-04-27 14:34:51 +02:00
2018-05-16 07:23:35 +02:00
2019-10-11 18:21:23 +02:00
2018-05-16 07:23:35 +02:00
2020-11-18 19:18:50 +01:00
2018-02-21 16:54:06 +01:00
2018-06-21 12:33:19 +02:00
2020-11-10 12:36:00 +01:00
2018-08-06 12:35:20 +02:00
2020-11-18 19:18:49 +01:00
2017-12-14 16:00:49 -08:00
2019-04-20 09:16:02 +02:00
2018-05-15 23:08:33 -07:00
2019-05-31 06:46:19 -07:00
2019-06-04 08:02:34 +02:00
2020-07-16 08:17:26 +02:00
2017-11-02 11:10:55 +01:00
2018-08-02 08:06:54 +09:00
2019-02-12 19:47:20 +01:00
2019-11-24 08:20:29 +01:00
2018-06-12 16:19:22 -07:00
2017-11-02 11:10:55 +01:00
2018-07-16 12:31:57 -07:00
2020-04-17 10:48:52 +02:00
2020-10-01 13:14:54 +02:00
2017-07-12 16:25:59 -07:00
2020-11-10 12:35:58 +01:00
2019-12-01 09:17:38 +01:00
2020-01-29 16:43:27 +01:00
2018-07-02 11:36:17 +02:00
2018-07-02 11:36:17 +02:00
2020-08-21 11:05:34 +02:00
2020-03-25 08:06:13 +01:00
2020-05-27 17:37:36 +02:00
2019-12-01 09:17:10 +01:00
2018-04-11 10:28:37 -07:00
2019-07-26 09:14:01 +02:00
2019-01-13 09:51:06 +01:00
2020-01-23 08:21:29 +01:00
2017-11-02 11:10:55 +01:00
2020-11-18 19:18:52 +01:00
2020-08-26 10:30:59 +02:00
2019-09-16 08:22:20 +02:00
2018-07-10 22:18:52 +02:00
2020-01-23 08:21:29 +01:00
2020-11-10 12:35:53 +01:00
2019-02-12 19:47:25 +01:00
2018-07-03 09:20:44 +02:00
2017-11-02 11:10:55 +01:00
2018-08-03 15:52:10 +02:00
2018-08-13 11:25:07 -07:00
2018-06-10 10:17:09 -07:00
2020-10-01 13:14:29 +02:00
2018-04-16 11:26:49 +02:00
2020-01-04 19:13:17 +01:00
2017-12-17 13:57:15 +01:00
2020-01-09 10:18:59 +01:00
2018-06-21 12:33:05 +02:00
2018-06-25 11:30:10 -07:00
2018-10-17 15:35:29 -04:00
2018-04-05 21:36:27 -07:00
2018-04-02 20:15:59 +02:00
2018-04-02 20:15:30 +02:00
2020-10-14 10:31:21 +02:00
2017-08-29 15:14:38 +02:00
2018-11-13 11:09:00 -08:00
2018-08-22 10:52:47 -07:00
2018-08-11 02:05:53 -05:00
2018-04-11 10:28:35 -07:00
2018-08-30 12:56:40 +02:00
2020-02-24 08:34:49 +01:00
2018-05-18 08:47:13 -07:00
2020-03-18 07:14:20 +01:00