public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/31185] Incorrect thread point access in _dl_tlsdesc_undefweak and _dl_tlsdesc_dynamic
Date: Sat, 23 Dec 2023 17:36:58 +0000	[thread overview]
Message-ID: <bug-31185-131-ts9mAt2yO8@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31185-131@http.sourceware.org/bugzilla/>

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

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The release/2.35/master branch has been updated by H.J. Lu
<hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5d1fe26b49a9ac373dabba217df9bd7179b267d2

commit 5d1fe26b49a9ac373dabba217df9bd7179b267d2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Dec 20 19:42:12 2023 -0800

    x86-64: Fix the tcb field load for x32 [BZ #31185]

    _dl_tlsdesc_undefweak and _dl_tlsdesc_dynamic access the thread pointer
    via the tcb field in TCB:

    _dl_tlsdesc_undefweak:
            _CET_ENDBR
            movq    8(%rax), %rax
            subq    %fs:0, %rax
            ret

    _dl_tlsdesc_dynamic:
            ...
            subq    %fs:0, %rax
            movq    -8(%rsp), %rdi
            ret

    Since the tcb field in TCB is a pointer, %fs:0 is a 32-bit location,
    not 64-bit. It should use "sub %fs:0, %RAX_LP" instead.  Since
    _dl_tlsdesc_undefweak returns ptrdiff_t and _dl_make_tlsdesc_dynamic
    returns void *, RAX_LP is appropriate here for x32 and x86-64.  This
    fixes BZ #31185.

    (cherry picked from commit 81be2a61dafc168327c1639e97b6dae128c7ccf3)

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

  parent reply	other threads:[~2023-12-23 17:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21  3:29 [Bug dynamic-link/31185] New: " hjl.tools at gmail dot com
2023-12-22 13:37 ` [Bug dynamic-link/31185] " cvs-commit at gcc dot gnu.org
2023-12-22 14:44 ` sam at gentoo dot org
2023-12-23 15:08 ` cvs-commit at gcc dot gnu.org
2023-12-23 17:00 ` cvs-commit at gcc dot gnu.org
2023-12-23 17:35 ` cvs-commit at gcc dot gnu.org
2023-12-23 17:36 ` cvs-commit at gcc dot gnu.org [this message]
2023-12-23 17:38 ` cvs-commit at gcc dot gnu.org
2023-12-23 17:40 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31185-131-ts9mAt2yO8@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).