]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390: Mark psw in __load_psw_mask() as __unitialized
authorSven Schnelle <svens@linux.ibm.com>
Tue, 30 Apr 2024 14:30:01 +0000 (16:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Jul 2024 09:40:54 +0000 (11:40 +0200)
[ Upstream commit 7278a8fb8d032dfdc03d9b5d17e0bc451cdc1492 ]

Without __unitialized, the following code is generated when
INIT_STACK_ALL_ZERO is enabled:

86: d7 0f f0 a0 f0 a0     xc      160(16,%r15), 160(%r15)
8c: e3 40 f0 a0 00 24     stg     %r4, 160(%r15)
92: c0 10 00 00 00 08     larl    %r1, 0xa2
98: e3 10 f0 a8 00 24     stg     %r1, 168(%r15)
9e: b2 b2 f0 a0           lpswe   160(%r15)

The xc is not adding any security because psw is fully initialized
with the following instructions. Add __unitialized to the psw
definitiation to avoid the superfluous clearing of psw.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/include/asm/processor.h

index 48d6ccdef5f77d2ecbda19ccbc0461e02cee376c..00bb2d287f740e231de92a617dadb86107d56f10 100644 (file)
@@ -256,8 +256,8 @@ static inline void __load_psw(psw_t psw)
  */
 static __always_inline void __load_psw_mask(unsigned long mask)
 {
+       psw_t psw __uninitialized;
        unsigned long addr;
-       psw_t psw;
 
        psw.mask = mask;