public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect
@ 2021-11-03 14:07 msc at linux dot ibm.com
  2021-11-03 14:07 ` [Bug libc/28532] " msc at linux dot ibm.com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: msc at linux dot ibm.com @ 2021-11-03 14:07 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 28532
           Summary: powerpc64[le]: CFI for assembly templated syscalls is
                    incorrect
           Product: glibc
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: msc at linux dot ibm.com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Syscalls based on the ASM templates have missing CFI for r31 and info for LR is
innacurate. Example for kill:


$ readelf -wF libc.so.6 | grep 0004b9d4.. -A 7 && objdump --disassemble=kill
libc.so.6 
00004a48 000000000000001c 00004a4c FDE cie=00000000
pc=000000000004b9d4..000000000004ba3c
   LOC           CFA      ra    
000000000004b9d4 r1+0     u         <------ Missing information for r31
000000000004b9e8 r1+48    u         <------ Wrong LOC
000000000004b9fc r1+48    c+16      <------ Wrong offset, should be c-32
000000000004ba08 r1+48    
000000000004ba1c r1+0     

00004a68 000000000000001c 00004a6c FDE cie=00000000
pc=000000000004ba80..000000000004bb10
   LOC           CFA      ra    

libc.so.6:     file format elf64-powerpcle


Disassembly of section .text:

000000000004b9d4 <kill>:
   4b9d4:       1f 00 4c 3c     addis   r2,r12,31
   4b9d8:       2c c3 42 38     addi    r2,r2,-15572
   4b9dc:       25 00 00 38     li      r0,37
   4b9e0:       d1 ff 21 f8     stdu    r1,-48(r1)
   4b9e4:       20 00 e1 fb     std     r31,32(r1)
   4b9e8:       98 8f ed eb     ld      r31,-28776(r13)
   4b9ec:       10 00 ff 77     andis.  r31,r31,16
   4b9f0:       1c 00 82 41     beq     4ba0c <kill+0x38>
   4b9f4:       a6 02 28 7d     mflr    r9
   4b9f8:       10 00 21 f9     std     r9,16(r1)
   4b9fc:       01 00 00 44     scv     0
   4ba00:       10 00 21 e9     ld      r9,16(r1)
   4ba04:       a6 03 28 7d     mtlr    r9
   4ba08:       08 00 00 48     b       4ba10 <kill+0x3c>
   4ba0c:       02 00 00 44     sc
   4ba10:       00 00 bf 2e     cmpdi   cr5,r31,0
   4ba14:       20 00 e1 eb     ld      r31,32(r1)
   4ba18:       30 00 21 38     addi    r1,r1,48
   4ba1c:       18 00 96 41     beq     cr5,4ba34 <kill+0x60>
   4ba20:       01 f0 20 39     li      r9,-4095
   4ba24:       40 48 23 7c     cmpld   r3,r9
   4ba28:       20 00 e0 4d     bltlr+
   4ba2c:       d0 00 63 7c     neg     r3,r3
   4ba30:       08 00 00 48     b       4ba38 <kill+0x64>
   4ba34:       20 00 e3 4c     bnslr+
   4ba38:       c8 32 fe 4b     b       2ed00 <__syscall_error>
        ...
   4ba44:       40 20 0c 00     .long 0xc2040
   4ba48:       68 00 00 00     .long 0x68
   4ba4c:       06 00 5f 5f     rlwnm   r31,r26,r0,0,3
   4ba50:       6b 69 6c 6c     xoris   r12,r3,26987

Disassembly of section __libc_freeres_fn:

-- 
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/28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
  2021-11-03 14:07 [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect msc at linux dot ibm.com
@ 2021-11-03 14:07 ` msc at linux dot ibm.com
  2021-11-23 17:38 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: msc at linux dot ibm.com @ 2021-11-03 14:07 UTC (permalink / raw)
  To: glibc-bugs

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

Matheus Castanho <msc at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |msc at linux dot ibm.com

-- 
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/28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
  2021-11-03 14:07 [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect msc at linux dot ibm.com
  2021-11-03 14:07 ` [Bug libc/28532] " msc at linux dot ibm.com
@ 2021-11-23 17:38 ` schwab@linux-m68k.org
  2021-11-30 18:28 ` msc at linux dot ibm.com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2021-11-23 17:38 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Shouldn't lr always be saved in the caller's frame?

-- 
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/28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
  2021-11-03 14:07 [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect msc at linux dot ibm.com
  2021-11-03 14:07 ` [Bug libc/28532] " msc at linux dot ibm.com
  2021-11-23 17:38 ` schwab@linux-m68k.org
@ 2021-11-30 18:28 ` msc at linux dot ibm.com
  2021-12-01 19:14 ` msc at linux dot ibm.com
  2021-12-17 20:24 ` msc at linux dot ibm.com
  4 siblings, 0 replies; 6+ messages in thread
From: msc at linux dot ibm.com @ 2021-11-30 18:28 UTC (permalink / raw)
  To: glibc-bugs

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

Matheus Castanho <msc at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |2.35
         Resolution|---                         |FIXED

--- Comment #2 from Matheus Castanho <msc at linux dot ibm.com> ---
> Shouldn't lr always be saved in the caller's frame?

Yes, this and CFI info have been fixed by
d120fb9941be1fb1934f0b50c6ad64e4c5e404fb

-- 
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/28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
  2021-11-03 14:07 [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect msc at linux dot ibm.com
                   ` (2 preceding siblings ...)
  2021-11-30 18:28 ` msc at linux dot ibm.com
@ 2021-12-01 19:14 ` msc at linux dot ibm.com
  2021-12-17 20:24 ` msc at linux dot ibm.com
  4 siblings, 0 replies; 6+ messages in thread
From: msc at linux dot ibm.com @ 2021-12-01 19:14 UTC (permalink / raw)
  To: glibc-bugs

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

Matheus Castanho <msc at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #3 from Matheus Castanho <msc at linux dot ibm.com> ---
Unfortunately the fix caused some tests to fail only on powerpc64 (BE)

FAIL: nptl/tst-mutexpi9
FAIL: nptl/tst-mutexpi5
FAIL: nptl/tst-mutexpi5a
FAIL: io/tst-statx

I'm investigating it.

-- 
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/28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
  2021-11-03 14:07 [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect msc at linux dot ibm.com
                   ` (3 preceding siblings ...)
  2021-12-01 19:14 ` msc at linux dot ibm.com
@ 2021-12-17 20:24 ` msc at linux dot ibm.com
  4 siblings, 0 replies; 6+ messages in thread
From: msc at linux dot ibm.com @ 2021-12-17 20:24 UTC (permalink / raw)
  To: glibc-bugs

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

Matheus Castanho <msc at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #4 from Matheus Castanho <msc at linux dot ibm.com> ---
New failing tests are now fixed by:

commit ae91d3df24a4a1b1f264d101a71a298bff310d14
Author: Matheus Castanho <msc@linux.ibm.com>
Date:   Wed Dec 1 11:14:40 2021 -0300

    powerpc64[le]: Allocate extra stack frame on syscall.S

    The syscall function does not allocate the extra stack frame for scv like
other
    assembly syscalls using DO_CALL_SCV. So after commit d120fb9941 changed the
    offset that is used to save LR, syscall ended up using an invalid offset,
    causing regressions on powerpc64. So make sure the extra stack frame is
    allocated in syscall.S as well to make it consistent with other uses of
    DO_CALL_SCV and avoid similar issues in the future.

    Tested on powerpc, powerpc64, and powerpc64le (with and without scv)

    Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>

-- 
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:[~2021-12-17 20:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 14:07 [Bug libc/28532] New: powerpc64[le]: CFI for assembly templated syscalls is incorrect msc at linux dot ibm.com
2021-11-03 14:07 ` [Bug libc/28532] " msc at linux dot ibm.com
2021-11-23 17:38 ` schwab@linux-m68k.org
2021-11-30 18:28 ` msc at linux dot ibm.com
2021-12-01 19:14 ` msc at linux dot ibm.com
2021-12-17 20:24 ` msc at linux dot ibm.com

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