This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/18822] Internal functions are called via PLT


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

--- Comment #77 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  8beba15d536aa5c89e9e55e4c497c0bcd10cb67c (commit)
       via  80eb52e3a93a9f611a415a3565d17536cf023f8a (commit)
      from  567d8c1f6852c5d5aad4d46da34b6276e400d5dd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8beba15d536aa5c89e9e55e4c497c0bcd10cb67c

commit 8beba15d536aa5c89e9e55e4c497c0bcd10cb67c
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue Nov 21 08:45:28 2017 +0100

    S390: Add cfi information for start routines in order to stop unwinding.

    GDB failed to detect the outermost frame while showing the backtrace
    within a thread:
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)

    Before this patch, the start routines like thread_start had no cfi
information.
    GDB is then using the prologue unwinder if no cfi information is available.
    This unwinder tries to unwind r15 and stops e.g. if r15 was updated or
    on some jump-instructions.

    On older glibc-versions (before commit "Remove cached PID/TID in clone"
    c579f48edba88380635ab98cb612030e3ed8691e), the thread_start function used
    such a jump-instruction and GDB did not fail with an error.

    This patch adds cfi information for _start, thread_start and
__makecontext_ret
    and marks r14 as undefined which marks the frame as outermost frame and GDB
    stops the backtrace. Also tested different gcc versions in order to test
    _Unwind_Backtrace() in libgcc as this is used by backtrace() in glibc.

    ChangeLog:

        * sysdeps/s390/s390-64/start.S (_start): Add cfi information for r14.
        * sysdeps/s390/s390-32/start.S: (_start): Likewise
        * sysdeps/unix/sysv/linux/s390/s390-64/clone.S
        (thread_start): Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-32/clone.S
        (thread_start): Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
        (__makecontext_ret): Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
        (__makecontext_ret): Likewise.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=80eb52e3a93a9f611a415a3565d17536cf023f8a

commit 80eb52e3a93a9f611a415a3565d17536cf023f8a
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue Nov 21 08:39:53 2017 +0100

    Remove attribute_hidden for wchar ifunc symbols.

    On s390 (31bit) various debug/tst-*chk* testcases are failing as the tests
    are ending with a segmentation fault.

    One test is e.g. calling wcsnrtombs in debug/tst-chk1.c:1549.
    The function wcsnrtombs itself calls __wcsnlen. This function is called via
    PLT! The PLT-stub itself loads the address from GOT (r12 is assumed to be
    the GOT-pointer). In this case the loaded address is zero and the following
    branch leads to the segmentation fault.

    Due to the attribute_hidden in commit
44af8a32c341672b5160fdc2839767e9a837ad26
    "Mark internal wchar functions with attribute_hidden [BZ #18822]"
    for e.g. the __wcsnlen function, r12 is not loaded with the GOT-pointer
    in wcsnrtombs.

    On s390x (64bit), this __wcsnlen call is also using the PLT-stub. But it is
    not failing as the GOT-pointer is setup with larl-instruction by the
PLT-stub
    itself.
    Note: On s390x/s390, __wcsnlen is an IFUNC symbol.

    On x86_64, __wcsnlen is also an IFUNC symbol and is called via PLT, too.

    Further IFUNC symbols on s390 which were marked as hidden by the mentioned
    commit are: __wcscat, __wcsncpy, __wcpncpy, __wcschrnul.

    This patch removes the attribute_hidden in wchar.h.
    Then the compiler setups e.g. r12 on s390 in order to call __wcsnlen via
PLT.

    ChangeLog:

        * include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
        __wcschrnul): Remove attribute_hidden.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   18 ++++++++++++++++++
 include/wchar.h                                    |   12 +++++-------
 sysdeps/s390/s390-32/start.S                       |    7 +++++++
 sysdeps/s390/s390-64/start.S                       |    7 +++++++
 .../sysv/linux/s390/s390-32/__makecontext_ret.S    |   10 ++--------
 sysdeps/unix/sysv/linux/s390/s390-32/clone.S       |    4 ++++
 .../sysv/linux/s390/s390-64/__makecontext_ret.S    |   10 ++--------
 sysdeps/unix/sysv/linux/s390/s390-64/clone.S       |    4 ++++
 8 files changed, 49 insertions(+), 23 deletions(-)

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]