From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by sourceware.org (Postfix) with ESMTPS id 4B53C3858C2A; Thu, 21 Dec 2023 16:08:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B53C3858C2A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B53C3858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703174937; cv=none; b=ms/wo76RQMBX9QexD+9QQO7u9UtGaLNGBrJEozEbf2P+i1v2saCXYx0jsWBHrH0+GoN5w+wWf3IrgTxfjJhlHpNcHpMYUxXR6Or4hzXXo2JXma1kKbXDSRd9WG2O7v9xVuAu9o7mUIay+Wq4WD4AilZtTwBskdSfC/EoxNaMS5U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703174937; c=relaxed/simple; bh=HjNZvo9mk5JUqQQUi3V2mE5S+gcLziy3U/uWferX7GQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=WN6kFUjY8dTIjF+qD7RPSq/qjT+TwNBiHwD7WPJpslHlhvDQQE7GbiXIyGOmQiXiPzydT775Y0VMmvU+8zCOtn5B2smukcZ/smphk1Ozp4RyifFGaVG+AQtVvXAEEEtRo+XeV0lfrm8s/B6r63zLzkLy77o6TNZHUUUjmrg8IIw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-dbd5b96b12eso944675276.2; Thu, 21 Dec 2023 08:08:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703174935; x=1703779735; darn=sourceware.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1LMuBh6pQnIP9D+AsXMxPM1EW9k1jSVmcugS+Bjuvyc=; b=fwUFXjFLfs4cRghtITYziWLdT9vH3B4NEsFu1Wf92ENGtKX45BgOrqoJzfx2oWIULe zdzF5I3z4SUlYSCL5f5w0GsA1snTQBIhHu3ZEXjpkIRj7GBsdINwE3AcjbOkctHedFQ8 XUOniAH+T8xR/lFN7xAZpEPIegCoWKfNbgvNu13LY/HbcBxtKwFko+UyIB7uJ05l9yyu BuI0BtvdlH9K6kLUEfsMD4qvFJWbq5fNMXfcnfSinaQFTAiiuVZw8ZJUtHk/Ybf2z8XF 59jemliH5JLxbhFfe+UfUnxOyJoGU8OhDBpC0mwSlVnsvkIsmfhlMLnd9AnB2ptp0A2H +3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703174935; x=1703779735; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1LMuBh6pQnIP9D+AsXMxPM1EW9k1jSVmcugS+Bjuvyc=; b=EdtxUVBnAuoJv14cYWr/qhWidji57CcmAedaZDzAT0xuiC9AaUp7A4TtyulQHLk1UW NrAkvnazZOT+7OL5wPWNwTJ5qaqyLvEaXBik71hWX4Ro6HDPhKo5SETIV6Crqe84eLIq CuaWbFCmuFMMpzsKOwzk8QbluC4UULvvEE57MiVf3+//sl/uDjTWbKMw/P6n/8IsG5eO 9VmMgxHjp6avZU21o5SFVtjZFpI0FkSzZwJ9BIl2tylqWLidQNbY8ji/itbSS0ebk3IJ lZamK0dudFouqffRpgcTaNBbRWZfFSqgbo4otyIvTAHLyVKmLYC/HBXK7FAAjEZwIMcE ywfQ== X-Gm-Message-State: AOJu0Yz6RY0vAYrcni16WxHJYLWmCyN3toauwDTqMpMSRruTD11sceSA lh3/c/VqT7RStt/mq1pd501wc7A0DTWNN80IcfIL6U3u X-Google-Smtp-Source: AGHT+IERJHpYv3dG0s4mg+mvuFI/7/DnZb0SjmarzrodKOwDwVlAqa8glXHDhqQWgEK3fsiIVGPrlIx8+2L8JrDqgcc= X-Received: by 2002:a25:c54b:0:b0:dbd:a9b6:b01e with SMTP id v72-20020a25c54b000000b00dbda9b6b01emr1409531ybe.36.1703174935376; Thu, 21 Dec 2023 08:08:55 -0800 (PST) MIME-Version: 1.0 References: <20231221003143.2289327-1-hjl.tools@gmail.com> In-Reply-To: <20231221003143.2289327-1-hjl.tools@gmail.com> From: "H.J. Lu" Date: Thu, 21 Dec 2023 08:08:19 -0800 Message-ID: Subject: Re: [PATCH] x86-64: Fix the dtv field load for x32 [BZ #31184] To: libc-alpha@sourceware.org, Libc-stable Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3021.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Dec 20, 2023 at 4:31=E2=80=AFPM H.J. Lu wrote= : > > On x32, I got > > FAIL: elf/tst-tlsgap > > $ gdb elf/tst-tlsgap > ... > open tst-tlsgap-mod1.so > > Thread 2 "tst-tlsgap" received signal SIGSEGV, Segmentation fault. > [Switching to LWP 2268754] > _dl_tlsdesc_dynamic () at ../sysdeps/x86_64/dl-tlsdesc.S:108 > 108 movq (%rsi), %rax > (gdb) p/x $rsi > $4 =3D 0xf7dbf9005655fb18 > (gdb) > > This is caused by > > _dl_tlsdesc_dynamic: > _CET_ENDBR > /* Preserve call-clobbered registers that we modify. > We need two scratch regs anyway. */ > movq %rsi, -16(%rsp) > movq %fs:DTV_OFFSET, %rsi > > Since the dtv field in TCB is a pointer, %fs:DTV_OFFSET is a 32-bit > location, not 64-bit. Load the dtv field to RSI_LP instead of rsi. > This fixes BZ #31184. > --- > sysdeps/x86_64/dl-tlsdesc.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/x86_64/dl-tlsdesc.S b/sysdeps/x86_64/dl-tlsdesc.S > index 5593897e29..c4823547d7 100644 > --- a/sysdeps/x86_64/dl-tlsdesc.S > +++ b/sysdeps/x86_64/dl-tlsdesc.S > @@ -102,7 +102,7 @@ _dl_tlsdesc_dynamic: > /* Preserve call-clobbered registers that we modify. > We need two scratch regs anyway. */ > movq %rsi, -16(%rsp) > - movq %fs:DTV_OFFSET, %rsi > + mov %fs:DTV_OFFSET, %RSI_LP > movq %rdi, -8(%rsp) > movq TLSDESC_ARG(%rax), %rdi > movq (%rsi), %rax > -- > 2.43.0 > I will check it in tomorrow and back it to release branches later. Thanks. --=20 H.J.