]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/facility: Disable compile time optimization for decompressor code
authorHeiko Carstens <hca@linux.ibm.com>
Wed, 4 Sep 2024 09:39:24 +0000 (11:39 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Sat, 7 Sep 2024 15:12:42 +0000 (17:12 +0200)
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>
arch/s390/include/asm/facility.h

index b7d234838a3667bd7fb15f097e0480fa3dc0c82d..65ebf86506cdea11519fd33cc5251925b0760bbf 100644 (file)
@@ -59,8 +59,10 @@ static inline int test_facility(unsigned long nr)
        unsigned long facilities_als[] = { FACILITIES_ALS };
 
        if (__builtin_constant_p(nr) && nr < sizeof(facilities_als) * 8) {
-               if (__test_facility(nr, &facilities_als))
-                       return 1;
+               if (__test_facility(nr, &facilities_als)) {
+                       if (!__is_defined(__DECOMPRESSOR))
+                               return 1;
+               }
        }
        return __test_facility(nr, &stfle_fac_list);
 }