Marco Elver
52d0b8b187
x86/fpu/signal: Initialize sw_bytes in save_xstate_epilog()
save_sw_bytes() did not fully initialize sw_bytes, which caused KMSAN
to report an infoleak (see below).
Initialize sw_bytes explicitly to avoid this.
KMSAN report follows:
=====================================================
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user ./include/linux/instrumented.h:121
BUG: KMSAN: kernel-infoleak in __copy_to_user ./include/linux/uaccess.h:154
BUG: KMSAN: kernel-infoleak in save_xstate_epilog+0x2df/0x510 arch/x86/kernel/fpu/signal.c:127
instrument_copy_to_user ./include/linux/instrumented.h:121
__copy_to_user ./include/linux/uaccess.h:154
save_xstate_epilog+0x2df/0x510 arch/x86/kernel/fpu/signal.c:127
copy_fpstate_to_sigframe+0x861/0xb60 arch/x86/kernel/fpu/signal.c:245
get_sigframe+0x656/0x7e0 arch/x86/kernel/signal.c:296
__setup_rt_frame+0x14d/0x2a60 arch/x86/kernel/signal.c:471
setup_rt_frame arch/x86/kernel/signal.c:781
handle_signal arch/x86/kernel/signal.c:825
arch_do_signal_or_restart+0x417/0xdd0 arch/x86/kernel/signal.c:870
handle_signal_work kernel/entry/common.c:149
exit_to_user_mode_loop+0x1f6/0x490 kernel/entry/common.c:173
exit_to_user_mode_prepare kernel/entry/common.c:208
__syscall_exit_to_user_mode_work kernel/entry/common.c:290
syscall_exit_to_user_mode+0x7e/0xc0 kernel/entry/common.c:302
do_syscall_64+0x60/0xd0 arch/x86/entry/common.c:88
entry_SYSCALL_64_after_hwframe+0x44/0xae ??:?
Local variable sw_bytes created at:
save_xstate_epilog+0x80/0x510 arch/x86/kernel/fpu/signal.c:121
copy_fpstate_to_sigframe+0x861/0xb60 arch/x86/kernel/fpu/signal.c:245
Bytes 20-47 of 48 are uninitialized
Memory access of size 48 starts at ffff8880801d3a18
Data copied to user address 00007ffd90e2ef50
=====================================================
Link: https://lore.kernel.org/all/CAG_fn=V9T6OKPonSjsi9PmWB0hMHFC=yawozdft8i1-MSxrv=w@mail.gmail.com/
Fixes: 53599b4d54 ("x86/fpu/signal: Prepare for variable sigframe length")
Reported-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Tested-by: Alexander Potapenko <glider@google.com>
Link: https://lkml.kernel.org/r/20211126124746.761278-1-glider@google.com
2021-11-30 15:13:47 -08:00
..
2021-10-01 20:44:31 +02:00
2021-10-29 10:02:17 +02:00
2021-11-21 11:25:19 -08:00
2021-11-30 15:13:47 -08:00
2021-10-27 11:21:49 -04:00
2021-10-28 23:25:28 +02:00
2021-08-09 17:13:06 +02:00
2021-08-27 13:54:58 -07:00
2021-11-09 10:02:48 -08:00
2021-03-21 23:50:28 +01:00
2021-03-08 13:19:05 +01:00
2021-02-10 12:32:07 +01:00
2021-03-11 19:58:54 +01:00
2021-10-01 16:52:48 -04:00
2021-10-04 11:46:20 +02:00
2020-11-24 16:47:49 +01:00
2020-11-24 14:42:09 +01:00
2021-10-04 11:46:58 +02:00
2021-06-07 12:14:45 +02:00
2021-11-02 22:22:13 -07:00
2021-10-20 13:09:43 -05:00
2021-09-21 13:57:43 +02:00
2021-07-08 11:48:22 -07:00
2021-04-26 15:10:25 -07:00
2021-10-01 13:38:13 +02:00
2021-10-20 23:44:43 -04:00
2021-10-20 23:44:43 -04:00
2021-10-04 11:47:24 +02:00
2021-07-19 11:57:48 +02:00
2021-05-12 10:49:13 +02:00
2021-10-01 13:38:13 +02:00
2021-02-05 20:13:12 +01:00
2021-08-10 23:31:43 +02:00
2021-06-29 12:36:59 -07:00
2021-09-27 12:28:32 +02:00
2021-02-10 23:34:17 +01:00
2021-10-22 12:45:35 -04:00
2021-09-17 13:14:44 +02:00
2020-08-06 16:13:09 +02:00
2021-10-05 15:51:59 +02:00
2020-08-06 16:13:13 +02:00
2021-07-13 06:32:05 +02:00
2021-03-08 12:06:29 -07:00
2021-03-18 15:31:53 +01:00
2021-11-11 11:03:05 -05:00
2021-10-04 11:46:58 +02:00
2021-09-03 09:58:13 -07:00
2021-05-21 12:36:45 +02:00
2021-10-04 11:46:58 +02:00
2021-10-04 11:46:20 +02:00
2021-05-10 07:51:38 +02:00
2021-10-28 23:25:27 +02:00
2021-08-10 23:31:43 +02:00
2021-01-27 19:06:47 +01:00
2021-05-10 07:40:27 +02:00
2021-03-11 19:51:49 +01:00
2021-11-11 07:40:26 -05:00
2020-10-06 07:07:05 +02:00
2021-01-15 08:23:10 +01:00
2021-10-04 11:46:46 +02:00
2020-12-14 13:45:26 -08:00
2021-10-18 09:20:15 -05:00
2021-10-20 15:27:27 +02:00
2021-10-20 15:27:27 +02:00
2021-11-19 10:14:57 -08:00
2021-10-20 15:27:29 +02:00
2021-03-18 15:31:53 +01:00
2020-10-06 11:18:04 +02:00
2021-08-12 12:06:58 +02:00
2021-03-21 23:50:28 +01:00
2021-10-04 11:46:46 +02:00
2021-11-06 13:30:41 -07:00
2021-11-24 12:20:24 +01:00
2020-10-29 18:06:52 +01:00
2021-11-01 15:52:26 -07:00
2021-11-02 07:56:47 -07:00
2021-07-23 13:15:31 -05:00
2021-10-26 10:18:09 +02:00
2021-03-21 23:50:28 +01:00
2021-11-11 13:09:32 +01:00
2021-03-10 15:52:31 +01:00
2021-11-11 13:09:31 +01:00
2021-02-06 00:21:42 +01:00
2020-08-20 13:12:58 +02:00
2021-01-05 19:07:42 +01:00
2021-03-23 00:16:13 +01:00
2021-03-08 13:19:05 +01:00
2020-07-27 14:31:07 -04:00
2021-03-18 15:31:53 +01:00
2021-10-25 23:02:36 -04:00
2021-11-02 07:56:47 -07:00
2020-08-15 10:38:03 -07:00
2021-03-21 23:50:28 +01:00
2021-06-22 16:53:16 +02:00
2021-09-25 13:23:28 +02:00
2021-09-30 21:24:07 -04:00
2021-09-30 21:24:07 -04:00
2021-11-09 10:11:53 -08:00
2021-03-15 12:05:03 +01:00
2021-11-19 09:15:58 -06:00
2021-10-28 23:25:25 +02:00
2020-10-28 20:26:29 +01:00