Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/facility: Disable compile time optimization for decompressor code

Disable compile time optimizations of test_facility() for the
decompressor. The decompressor should not contain any optimized code
depending on the architecture level set the kernel image is compiled
for to avoid unexpected operation exceptions.

Add a __DECOMPRESSOR check to test_facility() to enforce that
facilities are always checked during runtime for the decompressor.

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+4 -2
+4 -2
arch/s390/include/asm/facility.h
··· 59 59 unsigned long facilities_als[] = { FACILITIES_ALS }; 60 60 61 61 if (__builtin_constant_p(nr) && nr < sizeof(facilities_als) * 8) { 62 - if (__test_facility(nr, &facilities_als)) 63 - return 1; 62 + if (__test_facility(nr, &facilities_als)) { 63 + if (!__is_defined(__DECOMPRESSOR)) 64 + return 1; 65 + } 64 66 } 65 67 return __test_facility(nr, &stfle_fac_list); 66 68 }