public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression
@ 2023-11-15  9:32 ludwig.rydberg at gaisler dot com
  2023-11-15  9:34 ` [Bug libc/31068] " sam at gentoo dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ludwig.rydberg at gaisler dot com @ 2023-11-15  9:32 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31068

            Bug ID: 31068
           Summary: sysdeps: sparc: invalid data access in memset due to
                    regression
           Product: glibc
           Version: 2.36
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: ludwig.rydberg at gaisler dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Description:
When testing the glibc-master (2023-11-13) on sparc32 (leon) a memset
regression was observed.

The issue was introduced by commit a61933fe27df ("sparc: Remove bzero
optimization"). 

How to reproduce:
It can be reproduced running the "string/test-memset" test on sparc32.
Fail rate: 100%

Test output:
string/test-memset.test-result:
FAIL: string/test-memset
original exit status 1

string/test-memset.out:
Didn't expect signal from child: got `Segmentation fault'

Root cause:
The reason for the issue was that when moving the bzero routine to the end of
the memset, the branch jump in the end made a jump back to wrong label causing
the invalid data access.

A fix has been implemented and will be submitted.

--
glibc version: master d1dcb565a1fb (2023-11-13)
  - The issue was first observed in glibc-2.36.
gcc version 10.2.0 (LEON Linux 5.10 Toolchain 1.4-87-gcd8128e)
  - sparc-gaisler-linux5.10
GNU ld (GNU Binutils) 2.34

glibc configure options:
--prefix=/usr --enable-bind-now --host=sparc-gaisler-linux5.10
--with-headers=$USER/git/linux-toolchain/build-gcc-linux64//opt/sparc-gaisler-linux5.10/sysroot/usr/include
--with-binutils=$USER/git/linux-toolchain/build-gcc-linux64/binutils/binutils
--disable-default-pie libc_cv_forced_unwind=yes libc_cv_ssp=no

Target: Linux buildroot 5.10.175-leon1.4
Host: Ubuntu 22.04 6.2.0-36-generic

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/31068] sysdeps: sparc: invalid data access in memset due to regression
  2023-11-15  9:32 [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression ludwig.rydberg at gaisler dot com
@ 2023-11-15  9:34 ` sam at gentoo dot org
  2023-11-16 14:11 ` adhemerval.zanella at linaro dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sam at gentoo dot org @ 2023-11-15  9:34 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31068

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/31068] sysdeps: sparc: invalid data access in memset due to regression
  2023-11-15  9:32 [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression ludwig.rydberg at gaisler dot com
  2023-11-15  9:34 ` [Bug libc/31068] " sam at gentoo dot org
@ 2023-11-16 14:11 ` adhemerval.zanella at linaro dot org
  2024-02-01 20:06 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-11-16 14:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31068

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.39
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
           Assignee|unassigned at sourceware dot org   |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.39.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/31068] sysdeps: sparc: invalid data access in memset due to regression
  2023-11-15  9:32 [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression ludwig.rydberg at gaisler dot com
  2023-11-15  9:34 ` [Bug libc/31068] " sam at gentoo dot org
  2023-11-16 14:11 ` adhemerval.zanella at linaro dot org
@ 2024-02-01 20:06 ` pinskia at gcc dot gnu.org
  2024-02-01 20:14 ` glaubitz at physik dot fu-berlin.de
  2024-02-01 20:51 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-01 20:06 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31068

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Just FYI the commit that fixed this was:
https://sourceware.org/git/?p=glibc.git;a=commit;h=578190b7e43305141512dee777e4a3b3e8159393

And it was broken for the following releases:
glibc-2.36
glibc-2.37
glibc-2.38

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/31068] sysdeps: sparc: invalid data access in memset due to regression
  2023-11-15  9:32 [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression ludwig.rydberg at gaisler dot com
                   ` (2 preceding siblings ...)
  2024-02-01 20:06 ` pinskia at gcc dot gnu.org
@ 2024-02-01 20:14 ` glaubitz at physik dot fu-berlin.de
  2024-02-01 20:51 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2024-02-01 20:14 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31068

John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glaubitz at physik dot fu-berlin.d
                   |                            |e

--- Comment #3 from John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> ---
(In reply to Adhemerval Zanella from comment #1)
> Fixed on 2.39.

Does this by any chance need to be fixed on sparc64 as well?

This bug could be the reason for the posix_spawn() bug we're seeing on sparc64.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/31068] sysdeps: sparc: invalid data access in memset due to regression
  2023-11-15  9:32 [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression ludwig.rydberg at gaisler dot com
                   ` (3 preceding siblings ...)
  2024-02-01 20:14 ` glaubitz at physik dot fu-berlin.de
@ 2024-02-01 20:51 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-02-01 20:51 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31068

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to John Paul Adrian Glaubitz from comment #3)
> (In reply to Adhemerval Zanella from comment #1)
> > Fixed on 2.39.
> 
> Does this by any chance need to be fixed on sparc64 as well?
> 
> This bug could be the reason for the posix_spawn() bug we're seeing on
> sparc64.

The sparc64 changes were less intrusive and I could not see any change that
might trigger it.  The niagara4 changes slight the alignment of the 'clr'
instruction:

diff --git a/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S
b/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S
index 1ccf24e516..d6fbd83009 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S
@@ -39,10 +39,6 @@ ENTRY(__memset_niagara4)
        sllx            %o2, 32, %g1
        ba,pt           %icc, 1f
         or             %g1, %o2, %o4
-END(__memset_niagara4)
-
-       .align          32
-ENTRY(__bzero_niagara4)
        clr             %o4
 1:     cmp             %o1, 16
        ble             %icc, .Ltiny
@@ -118,6 +114,6 @@ ENTRY(__bzero_niagara4)
        bne,pt          %icc, 1b
         add            %o0, 0x30, %o0
        ba,a,pt         %icc, .Lpostloop
-END(__bzero_niagara4)
+END(__memset_niagara4)

 #endif

But afaiu this should not change the correctness of the code. 

Also, unless you are building with --disable-multi-arch; sparc64 string tests
will check for every string implementation currently supported by the CPU. So I
would expect that a failure in memset would trigger at least one regression as
for sparc32.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-01 20:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15  9:32 [Bug libc/31068] New: sysdeps: sparc: invalid data access in memset due to regression ludwig.rydberg at gaisler dot com
2023-11-15  9:34 ` [Bug libc/31068] " sam at gentoo dot org
2023-11-16 14:11 ` adhemerval.zanella at linaro dot org
2024-02-01 20:06 ` pinskia at gcc dot gnu.org
2024-02-01 20:14 ` glaubitz at physik dot fu-berlin.de
2024-02-01 20:51 ` adhemerval.zanella at linaro dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).