From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2670B3858C2D; Mon, 12 Feb 2024 12:32:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2670B3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707741166; bh=1G2CDz/SSDzD6p6c0CnHo2c+vCLUwrOuceYXg7sFRnU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RZ6nS5da/jBPpLkc+XNvapyMPGd+dJkIP6htAAO2G5yolfVaxJjWlbNc0w5hPUR+p 0oNZzAo8Z4ITnUJqGit9yX9rzv1YpVDdFG51D1jwpeq820cRcCUn+zo36KG7wB5OVp 31FTtqUhruy2yLNMVaQy27BHHrCMXqugLXCLnNH8= From: "fw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113874] GNU2 TLS descriptor calls do not follow psABI on x86_64-linux-gnu Date: Mon, 12 Feb 2024 12:32:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: fw at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113874 --- Comment #20 from Florian Weimer --- (In reply to H.J. Lu from comment #19) > (In reply to Florian Weimer from comment #9) > > (In reply to H.J. Lu from comment #7) > > > > The __tls_get_addr call with the default approach potentially needs= to solve > > > > the same problem, doesn't it? > > >=20 > > > Isn't __tls_get_addr called via the PLT entry? > >=20 > > I'm not sure if that matters? Even if the lazy binding trampoline is ac= tive, > > it won't protect the actual call. >=20 > Non-GNU2 TLS has >=20 > 0000000000004000 0000000100000007 R_X86_64_JUMP_SLOT 0000000000000000 > __tls_get_addr + 1010 >=20 > which calls _dl_runtime_resolve with lazy binding. _dl_runtime_resolve > preserves all caller-saved registers. The dynamic linker preserves register contents during lazy binding and rest= ores them before calling __tls_get_addr, so it doesn't help with __tls_get_addr register usage itself. And lazy binding happens only once per process and object, while we need to protect the first call on every thread.=