Patch "s390: workaround invalid gcc-11 out of bounds read warning" has been added to the 6.1-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: workaround invalid gcc-11 out of bounds read warning

to the 6.1-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-workaround-invalid-gcc-11-out-of-bounds-read-wa.patch
and it can be found in the queue-6.1 subdirectory.

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



commit dbddfb7479d5f400288fe93e8c7669ba06d7f40e
Author: Heiko Carstens <hca@xxxxxxxxxxxxx>
Date:   Tue Jan 17 19:00:59 2023 +0100

    s390: workaround invalid gcc-11 out of bounds read warning
    
    [ Upstream commit 41e1992665a2701fa025a8b76970c43b4148446f ]
    
    GCC 11.1.0 and 11.2.0 generate a wrong warning when compiling the
    kernel e.g. with allmodconfig:
    
    arch/s390/kernel/setup.c: In function ‘setup_lowcore_dat_on’:
    ./include/linux/fortify-string.h:57:33: error: ‘__builtin_memcpy’ reading 128 bytes from a region of size 0 [-Werror=stringop-overread]
    ...
    arch/s390/kernel/setup.c:526:9: note: in expansion of macro ‘memcpy’
      526 |         memcpy(abs_lc->cregs_save_area, S390_lowcore.cregs_save_area,
          |         ^~~~~~
    
    This could be addressed by using absolute_pointer() with the
    S390_lowcore macro, but this is not a good idea since this generates
    worse code for performance critical paths.
    
    Therefore simply use a for loop to copy the array in question and get
    rid of the warning.
    
    Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
    Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index ab19ddb09d65..2ec5f1e0312f 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -507,6 +507,7 @@ static void __init setup_lowcore_dat_on(void)
 {
 	struct lowcore *abs_lc;
 	unsigned long flags;
+	int i;
 
 	__ctl_clear_bit(0, 28);
 	S390_lowcore.external_new_psw.mask |= PSW_MASK_DAT;
@@ -521,8 +522,8 @@ static void __init setup_lowcore_dat_on(void)
 	abs_lc = get_abs_lowcore(&flags);
 	abs_lc->restart_flags = RESTART_FLAG_CTLREGS;
 	abs_lc->program_new_psw = S390_lowcore.program_new_psw;
-	memcpy(abs_lc->cregs_save_area, S390_lowcore.cregs_save_area,
-	       sizeof(abs_lc->cregs_save_area));
+	for (i = 0; i < 16; i++)
+		abs_lc->cregs_save_area[i] = S390_lowcore.cregs_save_area[i];
 	put_abs_lowcore(abs_lc, flags);
 }
 



[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