Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3713099pxb; Wed, 13 Oct 2021 11:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb5AlKk7YBAZau5aH4qmBecE9O7ySCZHjOM7K1q72BN24ucOnOtgAGfRE9cDHhGJCwuYMp X-Received: by 2002:a05:6402:40d2:: with SMTP id z18mr1343224edb.362.1634149248003; Wed, 13 Oct 2021 11:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634149247; cv=none; d=google.com; s=arc-20160816; b=re31I/OJqIWJwuMFnaymHBLz9MrmNbbfNP8vXWwfiULTsvtiju5YxB2AhcTI1HZJzY z5Ygxv5NeGvrV66NepGLr0cSbP9o4azFLvJEXYuQZXZaaNMQoDOFtjwD3tgbCDnuJOUf ROuF+9PP8fNDyM3qZ4wVt2cFv5tkC0NzQ/e1Y8KRXcGUKAU39XEJUtQuuTxKoLKwEPg/ 5azl7KZxsZEp/UyQOcuDFDVKsCSvsgQE/Hg2O7jxfI8qJswzh5R8dAwe8yjWFgwcDGUf sshjFybksqR7dOIg/omURqGCtshhfbZhpGQjpV5pc+8V3L0K+RhjPGZ9iek+fdIEv3Ow EOng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=FUM1v4YB6XOXHq0iVVCQLmH4e/+1fH3L4oj9Aiz71+c=; b=R/ymCRtlB0AoUM4LJ6mlQduOl/+TK5HTMK5sFDvoUh1T9Y92SY3eM2DUhSy8BhQ24N E11YWN5OXv772q4yj4vRdkkGT586CTmWbi1J5FjgQdDAPI1PJ+u2geixq8bGpg//rdCq eeUDOUWE7Iz+7yLAken1Keq1P+5X34wkr3hefmFimPyfk5I+wA4UXIq54xDUwlfMIa0z kvVdZNy+Sr0eQbijGteVD6k388/dIsNA4T5dgBxXafAfOX2YIo+yIzn03VFkId1QRpo2 choG39EF0VNcPa80lAX8yEnnJGoC9qB5eMBYHPbJPrZXq8qYf5EdyYI+Qm9bJ6PJyI9/ DH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cJ1RW4v4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm9si238346edb.491.2021.10.13.11.20.24; Wed, 13 Oct 2021 11:20:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cJ1RW4v4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238959AbhJMSTx (ORCPT + 99 others); Wed, 13 Oct 2021 14:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238623AbhJMSTe (ORCPT ); Wed, 13 Oct 2021 14:19:34 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EBF6C061760 for ; Wed, 13 Oct 2021 11:17:30 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id b126-20020a251b84000000b005bd8aca71a2so4115691ybb.4 for ; Wed, 13 Oct 2021 11:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=FUM1v4YB6XOXHq0iVVCQLmH4e/+1fH3L4oj9Aiz71+c=; b=cJ1RW4v4aCr+KHTpjNE9nFrgs4HfHet0ukJeIU7uGGP5p9ejwQrOEsliCMYF9FKBIs RciOUaBAZ9CtvoGSa2YuBuvl0bfAbmM0uLrYQVCivLHH1SzaoWyVsNGXEIiHk6hkogY1 nXctVqDcoegt4qKvEegPTWrk28NhZ+lq2OskyVVPMK/ftAMV5VwkzrbIWFt+iQjEgyTe WvbZO+asrN6dpO49mQaalvWHsCWOmuTkYbcTbDmKaPlOltFN5SSfkIeQFrZDe5MazJc8 32dULY5NTK5IykULt4XohX/ptg+q+LZ+8IRtXytJLex7ZVaGGinB9W6CbsD9sANzVpwN NOng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=FUM1v4YB6XOXHq0iVVCQLmH4e/+1fH3L4oj9Aiz71+c=; b=j7Nd+exe8Amep5dQx4L4q2bNo4vmiVv2al3N4KtOPhZXgfd4OG0LulxlD8PEllX4rG m5hyypliBz3ViqMyrwpedPRwfmoJHPOuvGYJmAkPLuNUMkb6XOS2gmJTcYLnuH2vnaap qY1Pv16l3an3tTnsQA+ZOZBgPoXaGTwaJX40LmmxBju/k8Y4mzAyj9MgsRbWkKdcL+Ey HqQDX3/XhxTJZnkO7vW99kDnWuzsWrCo2HG+f9Gfh6vIptZIsC+wzVp5t8dXTmSt7XmW kJ0zGNev1EbKRRsUQIsjCyv8ADW78wUH0//WMaqs+jA9Uc23+IwyuE3aqF4FAyH8oLgX LKJg== X-Gm-Message-State: AOAM531ERVO260qvfNe+AJR1sYhqL540428ClDNUPAWcm92ObHGlAQt0 iUnYAIIyq6Ho+Wq4E0eUPiQXJfhTW2cEbtd2wVE= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:9ea6:6c27:1876:926c]) (user=samitolvanen job=sendgmr) by 2002:a25:5044:: with SMTP id e65mr914919ybb.57.1634149049705; Wed, 13 Oct 2021 11:17:29 -0700 (PDT) Date: Wed, 13 Oct 2021 11:16:55 -0700 In-Reply-To: <20211013181658.1020262-1-samitolvanen@google.com> Message-Id: <20211013181658.1020262-13-samitolvanen@google.com> Mime-Version: 1.0 References: <20211013181658.1020262-1-samitolvanen@google.com> X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=979; h=from:subject; bh=dUwvm3Vd/5iEIjZYz+BmaUIzxp/ot2yfAHfQNEA+kUM=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBhZyKaIwdgCVuE1IB6wwvqmWNbh+vVqAlev/QJV73m c6jvmMGJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCYWcimgAKCRBMtfaEi7xW7msKC/ 9Bl6p6NCMyrV45qX2+L/0+XGMXCRfdOX68muhe1EoKDv1+fByHvxCtLgerfyCudZ7URTfLBME/ZnTD zl6u0n+N8gANWaDZleltiMEz1hQHPk0VlMZA+dmD+e8q9NFj8yTOX+gdEcDw0UiNmw8CNL6HUUSyG5 b2gREsgfpxcD1AELTfurUXi96HkTeXXvl/eyWXucGMh87gHRkDMOkAz9QN823Gg6kfR0wGjDckyss8 dXQrVqJ6XJuwRgr26EXZbLQBe7HJWHq+gXME4PqET7xqp02joqE0j96xPZq6wVHJxQDsHEMRF8RBBz /HQ0r3SEHdSxYW51OoKzO19aswKqAb2Pz9op1ZdSY+u/PFOTIK1fYcMtHT+EQoI6GIuZ9Q1ZK76KTc rebN6zRrpGYSyU0vcA8+SSkVOZBD3K33QrHj1tGQUhaHAuO4Y+YS8rwQuXyrXKTaq2uUCasy/JeuVM htEWYPcnOHQ00htlg7Rfdn9f4tQ1OQiJOevLNaVwDokLA= X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH v5 12/15] x86, module: Ignore __typeid__ relocations From: Sami Tolvanen To: x86@kernel.org Cc: Kees Cook , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The R_X86_64_8 __typeid__* relocations are for constants the compiler generates for indirect call type checking with CONFIG_CFI_CLANG. Ignore them when loading modules. Signed-off-by: Sami Tolvanen Tested-by: Nick Desaulniers Tested-by: Sedat Dilek --- arch/x86/kernel/module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 5e9a34b5bd74..c4aeba237eef 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c @@ -197,6 +197,10 @@ static int __apply_relocate_add(Elf64_Shdr *sechdrs, val -= (u64)loc; write(loc, &val, 8); break; + case R_X86_64_8: + if (!strncmp(strtab + sym->st_name, "__typeid__", 10)) + break; + fallthrough; default: pr_err("%s: Unknown rela relocation: %llu\n", me->name, ELF64_R_TYPE(rel[i].r_info)); -- 2.33.0.1079.g6e70778dc9-goog