public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
@ 2021-11-03 11:15 schwab@linux-m68k.org
  2021-11-03 11:59 ` [Bug libc/28531] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2021-11-03 11:15 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 28531
           Summary: [x86] Cancelable syscall stubs fail to preserve
                    16-byte stack alignment
           Product: glibc
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: schwab@linux-m68k.org
                CC: drepper.fsp at gmail dot com, hjl.tools at gmail dot com
  Target Milestone: ---
              Host: i?86-*-linux*

On function entry, stack alignment is 4 mod 16, and there are function calls
without realigning the stack.

00000000 <__GI___nanosleep>:
   0:   65 83 3d 0c 00 00 00    cmpl   $0x0,%gs:0xc
   7:   00 
   8:   75 20                   jne    2a <__nanosleep_nocancel+0x20>

0000000a <__nanosleep_nocancel>:
   a:   89 da                   mov    %ebx,%edx
   c:   8b 4c 24 08             mov    0x8(%esp),%ecx
  10:   8b 5c 24 04             mov    0x4(%esp),%ebx
  14:   b8 a2 00 00 00          mov    $0xa2,%eax
  19:   65 ff 15 10 00 00 00    call   *%gs:0x10
  20:   89 d3                   mov    %edx,%ebx
  22:   3d 01 f0 ff ff          cmp    $0xfffff001,%eax
  27:   73 30                   jae    59 <__nanosleep_nocancel+0x4f>
  29:   c3                      ret    
  2a:   e8 fc ff ff ff          call   2b <__nanosleep_nocancel+0x21>
                        2b: R_386_PC32  __libc_enable_asynccancel

This is dormant on master, since there are no longer any cancelable syscalls
that are implemented using the stubs.

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
@ 2021-11-03 11:59 ` rguenth at gcc dot gnu.org
  2021-11-03 12:33 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-03 11:59 UTC (permalink / raw)
  To: glibc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
  2021-11-03 11:59 ` [Bug libc/28531] " rguenth at gcc dot gnu.org
@ 2021-11-03 12:33 ` hjl.tools at gmail dot com
  2021-11-03 13:03 ` schwab@linux-m68k.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-03 12:33 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Andreas Schwab from comment #0)
> 
> This is dormant on master, since there are no longer any cancelable syscalls
> that are implemented using the stubs.

What do you mean by dormant on master? Under what conditions, will it
come back?

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
  2021-11-03 11:59 ` [Bug libc/28531] " rguenth at gcc dot gnu.org
  2021-11-03 12:33 ` hjl.tools at gmail dot com
@ 2021-11-03 13:03 ` schwab@linux-m68k.org
  2021-11-03 13:06 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2021-11-03 13:03 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
Whenever a cancelable syscall is implemented using this stub.

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
                   ` (2 preceding siblings ...)
  2021-11-03 13:03 ` schwab@linux-m68k.org
@ 2021-11-03 13:06 ` hjl.tools at gmail dot com
  2021-11-03 13:16 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-03 13:06 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Andreas Schwab from comment #2)
> Whenever a cancelable syscall is implemented using this stub.

Where is this stub defined on master branch?

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
                   ` (3 preceding siblings ...)
  2021-11-03 13:06 ` hjl.tools at gmail dot com
@ 2021-11-03 13:16 ` hjl.tools at gmail dot com
  2021-11-03 13:56 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-03 13:16 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Do you have a testcase? I tried

diff --git a/nptl/cancellation.c b/nptl/cancellation.c
index 2bd31686fd..ca0b14abc3 100644
--- a/nptl/cancellation.c
+++ b/nptl/cancellation.c
@@ -22,6 +22,14 @@
 #include <futex-internal.h>


+static void
+check (void)
+{
+  char *sp = CURRENT_STACK_FRAME;
+  if ((((uintptr_t) sp) + sizeof (char *)) & (sizeof (char *) - 1))
+    asm ("hlt");
+}
+
 /* The next two functions are similar to pthread_setcanceltype() but
    more specialized for the use in the cancelable functions like write().
    They do not need to check parameters etc.  */
@@ -29,6 +37,7 @@ int
 attribute_hidden
 __pthread_enable_asynccancel (void)
 {
+  check ();
   struct pthread *self = THREAD_SELF;
   int oldval = THREAD_GETMEM (self, cancelhandling);

on release/2.22/master branch.  "hlt" was never triggered.

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
                   ` (4 preceding siblings ...)
  2021-11-03 13:16 ` hjl.tools at gmail dot com
@ 2021-11-03 13:56 ` schwab@linux-m68k.org
  2021-11-03 14:19 ` adhemerval.zanella at linaro dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2021-11-03 13:56 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
Sorry, I missed that the arch-dependent <sysdep-cancel.h> no longer exists on
master.

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
                   ` (5 preceding siblings ...)
  2021-11-03 13:56 ` schwab@linux-m68k.org
@ 2021-11-03 14:19 ` adhemerval.zanella at linaro dot org
  2021-11-03 14:35 ` schwab@linux-m68k.org
  2021-11-03 14:40 ` schwab@linux-m68k.org
  8 siblings, 0 replies; 10+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-11-03 14:19 UTC (permalink / raw)
  To: glibc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #6 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Andreas Schwab from comment #5)
> Sorry, I missed that the arch-dependent <sysdep-cancel.h> no longer exists
> on master.

Cancellable entrypoints are implemented solely with C from now on.  Is this
really an issue?

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
                   ` (6 preceding siblings ...)
  2021-11-03 14:19 ` adhemerval.zanella at linaro dot org
@ 2021-11-03 14:35 ` schwab@linux-m68k.org
  2021-11-03 14:40 ` schwab@linux-m68k.org
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2021-11-03 14:35 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #7 from Andreas Schwab <schwab@linux-m68k.org> ---
Yes, this issue has ceased to exist in 2.27.

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

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

* [Bug libc/28531] [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment
  2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
                   ` (7 preceding siblings ...)
  2021-11-03 14:35 ` schwab@linux-m68k.org
@ 2021-11-03 14:40 ` schwab@linux-m68k.org
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2021-11-03 14:40 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |OBSOLETE
             Status|WAITING                     |RESOLVED

--- Comment #8 from Andreas Schwab <schwab@linux-m68k.org> ---
This problem only exists prior to 2.27, which is no longer maintained.

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

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

end of thread, other threads:[~2021-11-03 14:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 11:15 [Bug libc/28531] New: [x86] Cancelable syscall stubs fail to preserve 16-byte stack alignment schwab@linux-m68k.org
2021-11-03 11:59 ` [Bug libc/28531] " rguenth at gcc dot gnu.org
2021-11-03 12:33 ` hjl.tools at gmail dot com
2021-11-03 13:03 ` schwab@linux-m68k.org
2021-11-03 13:06 ` hjl.tools at gmail dot com
2021-11-03 13:16 ` hjl.tools at gmail dot com
2021-11-03 13:56 ` schwab@linux-m68k.org
2021-11-03 14:19 ` adhemerval.zanella at linaro dot org
2021-11-03 14:35 ` schwab@linux-m68k.org
2021-11-03 14:40 ` schwab@linux-m68k.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).