public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason
@ 2024-02-16 18:46 sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
  2024-02-16 18:52 ` [Bug libc/31394] " sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de @ 2024-02-16 18:46 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 31394
           Summary: clone on sparc might fail with -EFAULT for no valid
                    reason
           Product: glibc
           Version: 2.38
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 15373
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15373&action=edit
issue reproducing program.

There seems to be a bug in the sparc and sparc64 linux kernel that results in
spurious -EFAULT errors from clone if %sp is referring to a stack address that
is not (yet) part of the program stack, as the stack is laziliy allocated.

I wrote a reproducer program to demonstrate the the presence of the issue, see
the attached file "more_clone_attack.c". As the reproducing script assumes the
stack bias of 0x7ff, it likely won't work as is on 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

* [Bug libc/31394] clone on sparc might fail with -EFAULT for no valid reason
  2024-02-16 18:46 [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
@ 2024-02-16 18:52 ` sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
  2024-02-16 18:52 ` sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de @ 2024-02-16 18:52 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Michael Karcher <sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de> ---
Created attachment 15374
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15374&action=edit
patch to mitigate the kernel issue

The issue has been obversed on a very wide range of kernel and glibc versions,
e.g. on Debian wheezy (Linux 3.2.0 / glibc 2.13), but also on current gentoo
machines (Linux 6.1 / glibc 2.38-r9).

I developed a patch that causes the stack to be in a state that makes the
system call clone work reliably, by first invoking flushw from userspace before
entering the kernel. I believe the underlying issue is the way the kernel
handles page faults during flushw ("The user stack is bolixed"), so I chose
this way of pre-faulting the required pages.

-- 
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/31394] clone on sparc might fail with -EFAULT for no valid reason
  2024-02-16 18:46 [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
  2024-02-16 18:52 ` [Bug libc/31394] " sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
@ 2024-02-16 18:52 ` sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
  2024-02-16 20:14 ` glaubitz at physik dot fu-berlin.de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de @ 2024-02-16 18:52 UTC (permalink / raw)
  To: glibc-bugs

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

Michael Karcher <sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de> changed:

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

-- 
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/31394] clone on sparc might fail with -EFAULT for no valid reason
  2024-02-16 18:46 [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
  2024-02-16 18:52 ` [Bug libc/31394] " sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
  2024-02-16 18:52 ` sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
@ 2024-02-16 20:14 ` glaubitz at physik dot fu-berlin.de
  2024-02-23 11:54 ` adhemerval.zanella at linaro dot org
  2024-02-23 12:03 ` glaubitz at physik dot fu-berlin.de
  4 siblings, 0 replies; 6+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2024-02-16 20:14 UTC (permalink / raw)
  To: glibc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg,
                   |                            |jose.marchesi at oracle dot com,
                   |                            |jrtc27 at jrtc27 dot com,
                   |                            |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/31394] clone on sparc might fail with -EFAULT for no valid reason
  2024-02-16 18:46 [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
                   ` (2 preceding siblings ...)
  2024-02-16 20:14 ` glaubitz at physik dot fu-berlin.de
@ 2024-02-23 11:54 ` adhemerval.zanella at linaro dot org
  2024-02-23 12:03 ` glaubitz at physik dot fu-berlin.de
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-02-23 11:54 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
The explanation sounds reasonable, but I would like to get some confirmation
from kernel developers that this is the issue before applying this workaround
on glibc.

-- 
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/31394] clone on sparc might fail with -EFAULT for no valid reason
  2024-02-16 18:46 [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
                   ` (3 preceding siblings ...)
  2024-02-23 11:54 ` adhemerval.zanella at linaro dot org
@ 2024-02-23 12:03 ` glaubitz at physik dot fu-berlin.de
  4 siblings, 0 replies; 6+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2024-02-23 12:03 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> ---
(In reply to Adhemerval Zanella from comment #2)
> The explanation sounds reasonable, but I would like to get some confirmation
> from kernel developers that this is the issue before applying this
> workaround on glibc.

I have tried to get feedback from David Miller and developers from Oracle, but
so far without any success.

-- 
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-23 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 18:46 [Bug libc/31394] New: clone on sparc might fail with -EFAULT for no valid reason sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
2024-02-16 18:52 ` [Bug libc/31394] " sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
2024-02-16 18:52 ` sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
2024-02-16 20:14 ` glaubitz at physik dot fu-berlin.de
2024-02-23 11:54 ` adhemerval.zanella at linaro dot org
2024-02-23 12:03 ` glaubitz at physik dot fu-berlin.de

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).