Patch "s390/cpcmd: fix inline assembly register clobbering" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390/cpcmd: fix inline assembly register clobbering

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-cpcmd-fix-inline-assembly-register-clobbering.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 41728420e02b9b843269721fdbe35abd71e5548d
Author: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
Date:   Mon Mar 29 18:35:07 2021 +0200

    s390/cpcmd: fix inline assembly register clobbering
    
    [ Upstream commit 7a2f91441b2c1d81b77c1cd816a4659f4abc9cbe ]
    
    Register variables initialized using arithmetic. That leads to
    kasan instrumentaton code corrupting the registers contents.
    Follow GCC guidlines and use temporary variables for assigning
    init values to register variables.
    
    Fixes: 94c12cc7d196 ("[S390] Inline assembly cleanup.")
    Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
    Acked-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
    Link: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.html
    Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index 7f768914fb4f..c15546c6fb66 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen)
 
 static int diag8_response(int cmdlen, char *response, int *rlen)
 {
+	unsigned long _cmdlen = cmdlen | 0x40000000L;
+	unsigned long _rlen = *rlen;
 	register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
 	register unsigned long reg3 asm ("3") = (addr_t) response;
-	register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L;
-	register unsigned long reg5 asm ("5") = *rlen;
+	register unsigned long reg4 asm ("4") = _cmdlen;
+	register unsigned long reg5 asm ("5") = _rlen;
 
 	asm volatile(
 		"	sam31\n"



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux