public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>
Subject: Re: Build regressions/improvements in v6.2-rc4
Date: Mon, 16 Jan 2023 17:40:00 +0100	[thread overview]
Message-ID: <Y8V94PKtaWO3yRS4@osiris> (raw)
In-Reply-To: <46ba7912-3df6-dff9-792-49f4eaadefec@linux-m68k.org>

On Mon, Jan 16, 2023 at 01:36:34PM +0100, Geert Uytterhoeven wrote:
> On Mon, 16 Jan 2023, Geert Uytterhoeven wrote:
> > JFYI, when comparing v6.2-rc4[1] to v6.2-rc3-8-g1fe4fd6f5cad346e[3], the summaries are:
> >  - build errors: +1/-5
> 
>   + /kisskb/src/include/linux/fortify-string.h: error: '__builtin_memcpy' reading 128 bytes from a region of size 0 [-Werror=stringop-overread]:  => 57:33
> 
> s390x-gcc11/s390-allmodconfig
> 
> /kisskb/src/arch/s390/kernel/setup.c: In function 'setup_lowcore_dat_on':
> /kisskb/src/include/linux/fortify-string.h:57:33: error: '__builtin_memcpy' reading 128 bytes from a region of size 0 [-Werror=stringop-overread]
>    57 | #define __underlying_memcpy     __builtin_memcpy
>       |                                 ^
> /kisskb/src/include/linux/fortify-string.h:578:9: note: in expansion of macro '__underlying_memcpy'
>   578 |         __underlying_##op(p, q, __fortify_size);                        \
>       |         ^~~~~~~~~~~~~
> /kisskb/src/include/linux/fortify-string.h:623:26: note: in expansion of macro '__fortify_memcpy_chk'
>   623 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
>       |                          ^~~~~~~~~~~~~~~~~~~~
> /kisskb/src/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,
>       |         ^~~~~~
> 
> Looks like this was "'__builtin_memcpy' offset [0, 127] is out of the bounds
> [0, 0]" before.

Thanks for reporting. Of course this doesn't happen with gcc-12, and
this code will be rewritten with the next merge window anyway.
But to workaround this with gcc-11, we could go with the below:

diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 2b6091349daa..696c9e007a36 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -508,6 +508,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;
@@ -523,8 +524,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);
 }
 

  reply	other threads:[~2023-01-16 16:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 15:29 Linux 6.2-rc4 Linus Torvalds
2023-01-16 12:29 ` Build regressions/improvements in v6.2-rc4 Geert Uytterhoeven
2023-01-16 12:36   ` Geert Uytterhoeven
2023-01-16 16:40     ` Heiko Carstens [this message]
2023-01-16 18:41       ` Guenter Roeck
2023-01-17  8:57         ` Heiko Carstens
2023-01-17  9:03           ` Guenter Roeck
2023-01-16 18:50   ` Guenter Roeck
2023-01-16 18:52 ` Linux 6.2-rc4 Guenter Roeck
2023-01-16 18:57   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8V94PKtaWO3yRS4@osiris \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=geert@linux-m68k.org \
    --cc=gor@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox