From patchwork Thu May 5 21:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1627263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Sdy9b0Ic; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KvR3p5WXxz9sCq for ; Fri, 6 May 2022 07:02:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BBA7385801E for ; Thu, 5 May 2022 21:02:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BBA7385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651784563; bh=CcSWhqdPOisjyf2iiaoOc6HrO/F8/HyJZR+ugj6KIf4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Sdy9b0IcPWNOZ5jYHSGEyPGOeUoF3gXKm+ufydVQ3tuvD61DSUCJcPJGkzAm5YBFo 5wjwzm4wsZEj4VFv+km+45zBdPCvfpnHlPw6ONheeeVZ4XzQyFCBZJR+fLN9QjiOdp edPVedZbdwl4B8Qic+KdB77Va6mArYoCF6KFPf4I= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id D3EB53858D3C for ; Thu, 5 May 2022 21:02:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D3EB53858D3C Received: by mail-pl1-x635.google.com with SMTP id k1so5519116pll.4 for ; Thu, 05 May 2022 14:02:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=CcSWhqdPOisjyf2iiaoOc6HrO/F8/HyJZR+ugj6KIf4=; b=GrGkpDb4zz9Yvie6zVSCXdWO/b7dGFiQ1BVLQmF7D4Fq4PuBxvjCdbc5GTl0Ty6hfy 9l/RDKNpgALP4SoDJva2OKF5Ngu8PCyXkjhUS0KcHgZfOaoq+0wY+KnzAU4qKc3r4ivz XMBUwdR3Pil5tAEr0+AfgetXiyAYjYTj0M/IESShreIQvRYJ9ox6hQeVZC2lLcDb5TaW 8Kcgzp9VdIfZcz79pq2hzuUQ3LKcx5BrHfmkjfsWPkpRXjWXjKOftWR+3FEabNPFUvlr u04zxg2QKh+7Z2gbVP4yCX4jIwEMRMeyx4we2X7FInYnUGlAxLyK6/Q0aT6hRH9N4TuU UTtA== X-Gm-Message-State: AOAM532zrFhCxT2Sa6U9+YS5QFnPXhA4Mwwxm+ldZyceIxJfOwDf+4zD zlOozM7z3oqgntmtpCZ95M6jHyHGTAo= X-Google-Smtp-Source: ABdhPJwmMAso2hMmh630VddqA2kjl72gGRttS7VGWLGOVDvA2GP8VFTwGsnFAxINL7FyjkXF0TtYJw== X-Received: by 2002:a17:90b:4b12:b0:1d2:8bda:ef7 with SMTP id lx18-20020a17090b4b1200b001d28bda0ef7mr8451377pjb.174.1651784520539; Thu, 05 May 2022 14:02:00 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.88.122]) by smtp.gmail.com with ESMTPSA id c3-20020a056a00248300b0050dc762818fsm1869999pfv.105.2022.05.05.14.02.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 14:02:00 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 2B1AAC0114 for ; Thu, 5 May 2022 14:01:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libsanitizer: cherry-pick commit b226894d475b from upstream Date: Thu, 5 May 2022 14:01:59 -0700 Message-Id: <20220505210159.522782-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3028.4 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Gcc-patches" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" cherry-pick: b226894d475b [sanitizer] [sanitizer] Correct GetTls for x32 --- libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp index d966d857a76..620267cdd02 100644 --- a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp +++ b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp @@ -462,7 +462,11 @@ static void GetTls(uptr *addr, uptr *size) { #elif SANITIZER_GLIBC && defined(__x86_64__) // For aarch64 and x86-64, use an O(1) approach which requires relatively // precise ThreadDescriptorSize. g_tls_size was initialized in InitTlsSize. +# if SANITIZER_X32 + asm("mov %%fs:8,%0" : "=r"(*addr)); +# else asm("mov %%fs:16,%0" : "=r"(*addr)); +# endif *size = g_tls_size; *addr -= *size; *addr += ThreadDescriptorSize();