linux-stable/arch
Jarkko Sakkinen aa5c3aa3f1 x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd
commit 133e049a3f upstream.

Unsanitized pages trigger WARN_ON() unconditionally, which can panic the
whole computer, if /proc/sys/kernel/panic_on_warn is set.

In sgx_init(), if misc_register() fails or misc_register() succeeds but
neither sgx_drv_init() nor sgx_vepc_init() succeeds, then ksgxd will be
prematurely stopped. This may leave unsanitized pages, which will result a
false warning.

Refine __sgx_sanitize_pages() to return:

1. Zero when the sanitization process is complete or ksgxd has been
   requested to stop.
2. The number of unsanitized pages otherwise.

Fixes: 51ab30eb2a ("x86/sgx: Replace section->init_laundry_list with sgx_dirty_page_list")
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/linux-sgx/20220825051827.246698-1-jarkko@kernel.org/T/#u
Link: https://lkml.kernel.org/r/20220906000221.34286-2-jarkko@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-05 10:39:37 +02:00
..
alpha tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:25:32 +02:00
arc
arm ARM: dts: at91: sama7g5ek: specify proper regulator output ranges 2022-09-20 12:39:42 +02:00
arm64 arm64: dts: rockchip: Remove 'enable-active-low' from rk3399-puma 2022-09-28 11:11:46 +02:00
csky csky/kprobe: reclaim insn_slot on kprobe unregistration 2022-08-25 11:40:38 +02:00
h8300
hexagon
ia64 ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr() 2022-08-17 14:22:57 +02:00
m68k m68k: coldfire/device.c: protect FLEXCAN blocks 2022-08-25 11:40:05 +02:00
microblaze
mips MIPS: Loongson32: Fix PHY-mode being left unspecified 2022-09-28 11:11:48 +02:00
nds32
nios2 nios2: add force_successful_syscall_return() 2022-08-25 11:40:19 +02:00
openrisc openrisc: io: Define iounmap argument as volatile 2022-08-25 11:40:38 +02:00
parisc parisc: Allow CONFIG_64BIT with ARCH=parisc 2022-09-23 14:15:48 +02:00
powerpc powerpc: align syscall table for ppc32 2022-09-08 12:28:03 +02:00
riscv riscv: fix a nasty sigreturn bug... 2022-09-28 11:11:43 +02:00
s390 s390/boot: fix absolute zero lowcore corruption on boot 2022-09-15 11:30:07 +02:00
sh sh: convert nommu io{re,un}map() to static inline functions 2022-07-21 21:24:14 +02:00
sparc
um um: fix default console kernel parameter 2022-09-28 11:11:49 +02:00
x86 x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd 2022-10-05 10:39:37 +02:00
xtensa xtensa: iss: fix handling error cases in iss_net_configure() 2022-08-17 14:23:52 +02:00
.gitignore
Kconfig arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 14:23:00 +02:00