From patchwork Wed Nov 15 17:36:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gerst X-Patchwork-Id: 165528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2700669vqg; Wed, 15 Nov 2023 09:39:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBBu9cPw8Hm/pFvhCgRs96jxqYyPMQYDA5MZpc0f/MrTVzI19HKhYNK+9BcTbcRbdlTyuK X-Received: by 2002:a05:6808:f02:b0:3ae:3bd:d3d2 with SMTP id m2-20020a0568080f0200b003ae03bdd3d2mr18842230oiw.10.1700069949563; Wed, 15 Nov 2023 09:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700069949; cv=none; d=google.com; s=arc-20160816; b=j/coAj+jbivlBL+wzZkyRTp0qdz5f20NH+1MhIM0vWVP7OeUQfQKbguKWr8A7DQuPl ObNiwMW3EoSbcfwQdKoiwJu7w4JPqJ5jUjDHekwXu5whjKI1A4oxUCSqnN2Ik8oN4FEr h/g2GRna2052dDDnAudgD9rAE4Y+A80txbsSWKd4mDalqaflTkBbS1DMnkODzIE1esyZ eWaxl9PawC6cryVcfXSqZTA9p0Q8pbQnpmeOiSsrFeYGoUbLGgecRfnoRgvFu7i8TQTp IIz6rcIe6scV56PFSaWft+6ItQhlIGuxJ6DKUsxtKb+y0GZVnbpEG6f3FvJtWHrzwbee rxxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zo9KuMlI56r1OXsGbX0xxREbBs5j59brj7SQCaFRmtQ=; fh=O55jSVrVODK5Pp/8HguUJuz95L5ieTggTCPnkrmwi7I=; b=ok+o/+AcLR+xlk8NOiJYB44h7qCi/5IFA6GPymZBSgLhzslKlBZpx4OAOELcZMZZ2a tZWTeeJo+CLrfn3WUQmL+VZsk8Xkn189H9e13TAj0O5rZra8VgK92aANCPCtbkpJXNmK Dlt5r4AGFDSM6IZTjqZT/74nNYeWhAWqtglalL+8bGgRKi9fL3mFQ+AUfSxEarnPgWPr icttl8sy6M4LRokOBJ2P9aW7iUz3MhuOfcMgJOLXWwyiQP7PrShLJe4ZIa5FH9S9Cwzb 1/GjTqrcXSQ8/QNSDi3A8Eenxuv9oxQm7L5iflWDSjDsCs3p0um39tbK7Ym/Z1hoeEMX dcLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YlSAaIis; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j184-20020a638bc1000000b005b7fb04f1f9si10989783pge.734.2023.11.15.09.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 09:39:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YlSAaIis; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DD09880A990F; Wed, 15 Nov 2023 09:37:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbjKORhp (ORCPT + 29 others); Wed, 15 Nov 2023 12:37:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjKORhg (ORCPT ); Wed, 15 Nov 2023 12:37:36 -0500 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49BC1D40 for ; Wed, 15 Nov 2023 09:37:33 -0800 (PST) Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-778a47bc09aso456269685a.3 for ; Wed, 15 Nov 2023 09:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700069851; x=1700674651; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Zo9KuMlI56r1OXsGbX0xxREbBs5j59brj7SQCaFRmtQ=; b=YlSAaIisc2+Kwg/Dp7A1rbRAgvDK9SSM+xxXe3z603lkeapq1kA6CcUrsjwnonDDSC gl/I58gNoaQJy/tKlOsMgYKCycA4ZOVE19j0HruzQ/f13cDH1s7Bda1euCYhitcsAnyx WnelsdQKFAk7j0RbEiaxjJ60Jd+J6Nz8FzprbW89iH2iVnlly9kpU06I84xekpcPYXV6 5dw9FTtTgzkb69HHWFNdV8YDb6jOnwPuKKNLH1UDWcfYpmImfRgrS92qaXxopiD5bIxn W9L9qOX/+aCeZ/rs8J7a/H96WNLPqzG88Fz+5Zyvp726WUjWtTh6TCnBYNiR0VEUrJnS 0jaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700069851; x=1700674651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zo9KuMlI56r1OXsGbX0xxREbBs5j59brj7SQCaFRmtQ=; b=vzgbJCVCYIJhutiodfKRPjIT62k31/rP9KODNbWxfmwoTJTHM8LfCkzLDxOaZiPnMH VetF9S6KLwqTEll5tA7ky7bHZhVKpApZoNIgGxyHL3ilu2sADkmhrmilmPJPPqmapoRr cvLyzA+R5tdc0l0jda7nXQQkPLjbwhYu6BsKTmgvebeasKuwbRc6eGHi2Uc+BQlg+OLH lRZeB1PEQx9XloGLU9CgpFkh5b9Qh1u/hFCsX+4T/UrMVAEWbt1iq5ZoGWYYs+kiEzI8 AD6SA4J9ZnaLwgm+RgcqickBFoatw9DWV65iBoqaLitizYibgK7kaCljCL5l5tiPs9a7 rjjA== X-Gm-Message-State: AOJu0Yy0sbCpzCP/nt3wyH2tcBlHXyP6AHa28y7VaIGBcyR9xSVtuPbK bJZ9wrYBoPneDbDK+Rq175mYx7lfow== X-Received: by 2002:a05:620a:8703:b0:777:ac06:ed91 with SMTP id px3-20020a05620a870300b00777ac06ed91mr5580042qkn.23.1700069851190; Wed, 15 Nov 2023 09:37:31 -0800 (PST) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id x20-20020a05620a0b5400b0077bda014d8esm3260099qkg.87.2023.11.15.09.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 09:37:30 -0800 (PST) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Peter Zijlstra , Uros Bizjak , David.Laight@aculab.com, Brian Gerst Subject: [PATCH v3 05/14] x86/relocs: Handle R_X86_64_REX_GOTPCRELX relocations Date: Wed, 15 Nov 2023 12:36:59 -0500 Message-ID: <20231115173708.108316-6-brgerst@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115173708.108316-1-brgerst@gmail.com> References: <20231115173708.108316-1-brgerst@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 09:37:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782652547836784810 X-GMAIL-MSGID: 1782652547836784810 Clang may produce R_X86_64_REX_GOTPCRELX relocations when redefining the stack protector location. Treat them as another type of PC-relative relocation. Signed-off-by: Brian Gerst --- arch/x86/tools/relocs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c index d30949e25ebd..24ad10c62840 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c @@ -31,6 +31,11 @@ static struct relocs relocs32; static struct relocs relocs32neg; static struct relocs relocs64; #define FMT PRIu64 + +#ifndef R_X86_64_REX_GOTPCRELX +#define R_X86_64_REX_GOTPCRELX 42 +#endif + #else #define FMT PRIu32 #endif @@ -224,6 +229,7 @@ static const char *rel_type(unsigned type) REL_TYPE(R_X86_64_PC16), REL_TYPE(R_X86_64_8), REL_TYPE(R_X86_64_PC8), + REL_TYPE(R_X86_64_REX_GOTPCRELX), #else REL_TYPE(R_386_NONE), REL_TYPE(R_386_32), @@ -848,6 +854,7 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, case R_X86_64_PC32: case R_X86_64_PLT32: + case R_X86_64_REX_GOTPCRELX: /* * PC relative relocations don't need to be adjusted unless * referencing a percpu symbol.