Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2027693pxb; Mon, 23 Aug 2021 10:15:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweiCgGsR5xRp9sxA4KBvPjw+pikcCfrthMlCx8KFDn0eAr5P6oK05XWNpxJh61qkC5SkcR X-Received: by 2002:a92:7f0f:: with SMTP id a15mr23429055ild.245.1629738951238; Mon, 23 Aug 2021 10:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629738951; cv=none; d=google.com; s=arc-20160816; b=Pel62I/mSRL0fbYH4t8qcF84o4mo1MxGXzcKMGhscVo4f5JAFBGY5X56mL8XEjE4X4 19KGWKRyuTKTu1yTIUdk9JL3kkbSW8nrJAgaI4ovL+A7o+XkQ2z5sbyaXj9AqeqbeoV4 S3qbmv/qgquwxLIyq+iONh/V5Ya2zh9XXkFqS8PPTkiIiBTPpT4hGWkfv8o2YVvZC9V0 XRwxFeRRqGzcSGKImvMGi1JpRxOYsY2G6SyziSlZrSP+XbD1qxPYGmZDZhb7oy6mv5BA oEeFayPTkasG44w4j2V7UCfI9fv1GkmXUKxfqpTul4nG06Bof+xhdjCGFHQMGQ/KQuOJ PeKQ== 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=waqY876EwA/wk10n7+SSCq5/Bx3gIEi3wIv2LvfyQCY=; b=z0Zqgj1eqqHx7y0CSTFR7sW+CyCXqR2Wcp+03+cZiMtzRZavgpXQ2JEJoy6gFlhh5T GO85Wn9Yw6En1JGGsMIDmGRY/Uzuq5PkvHEJh0PMrvj3c35X7+BjMyHDPiDkZm7njvLf xhm1Zb02vrNEU2jZYR18ezClYxYHSy2D5VCr8zqJxiXDc5wWChCOQvZm9+idtlDoeMXn 5IpsC/g1dUN2Obo3nxrX/E+WrCPUkwAFSbRRwUTKVjU/lsKJWA0Kskdu7JuplwYAxNmr 92q7vO4V8tsHkCfrzF08e00iCAuQibWuhTmwIU+N5TM+eIUiDPwafJvJgX3Qc+AaHCzC v8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Jp/LpTkJ"; 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 p31si17629377jac.95.2021.08.23.10.15.37; Mon, 23 Aug 2021 10:15:51 -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=20161025 header.b="Jp/LpTkJ"; 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 S232124AbhHWROt (ORCPT + 99 others); Mon, 23 Aug 2021 13:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbhHWROb (ORCPT ); Mon, 23 Aug 2021 13:14:31 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22DADC061796 for ; Mon, 23 Aug 2021 10:13:48 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id g73-20020a379d4c000000b003d3ed03ca28so12291966qke.23 for ; Mon, 23 Aug 2021 10:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=waqY876EwA/wk10n7+SSCq5/Bx3gIEi3wIv2LvfyQCY=; b=Jp/LpTkJvrx/sDMDUbafviqe/BIpw0Q0Iw9S012k1J5qr5lLEsQ7CcLwEjilPsyAK/ t4JdvEUg8hjrAfWV3ou7LKIZ1Bv6g5i7L9aToNYYK9I/X4GdNTEHdvsww5MnFcga8Flb GXsy2CaLfwKBUYk9Mkcv8gwiGNcu8EE1uaeHIHYyWmMlHkeKv4SaJ245C/ZY0JN8Xhxo /fY9AkfD7Lc5YoLVMwJLOIBXyvE9nIjdduEp+vp0N/wbmyo4dkF1XR868WBU3LModhZL HCS41r0u5bDPK5jET/CSXmWxTkQnn8Yaiy/66VJrExxs9JRmHD3Ow3y6VPYeVvQmQc7/ xAPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=waqY876EwA/wk10n7+SSCq5/Bx3gIEi3wIv2LvfyQCY=; b=ifGmC3HAfdJcqWIsUxnDdcYMa7nN0qdgueKd+BayQTp+PHKu15xpkLMoQUSO4nJVVi PlvrBtngvwF5XLJHfbJv5vnmmKdSibcsXGEgIb7CnSFn54OthuouK2TmQjCipGHLqpcR MyNExfkzQOOv0MxJk8lXC2A/6QzEBuWP1S8dRtDU2L9U75cFfDKhS6QyFAgDRNOqUnWW 2btFvkWyib7Y+rXRe8Tx7e/Ezq6Ck/zvoqikcSyflYxVblKn0ceBDlxU1TcwavH1QE0Y Quvzbd7m56EAkYTQZc44wivjSXcoXdCr4Fj5esEcUNjBuEa+8xS8FKtM1q+VehsGMaAy eQuw== X-Gm-Message-State: AOAM533TKZ80OTQE2ZporEjuSwtgCNrMIXhtOsaGTFoBcvW7c/sgDZs/ 1MZXv5KJVdmZ8IFXtLYvmPtDMZAJoGbqNmRbRJU= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:cc48:aa6a:f4ec:7d19]) (user=samitolvanen job=sendgmr) by 2002:a0c:e887:: with SMTP id b7mr14559706qvo.54.1629738827298; Mon, 23 Aug 2021 10:13:47 -0700 (PDT) Date: Mon, 23 Aug 2021 10:13:15 -0700 In-Reply-To: <20210823171318.2801096-1-samitolvanen@google.com> Message-Id: <20210823171318.2801096-12-samitolvanen@google.com> Mime-Version: 1.0 References: <20210823171318.2801096-1-samitolvanen@google.com> X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog Subject: [PATCH v2 11/14] 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 , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ignore the __typeid__ relocations generated with CONFIG_CFI_CLANG when loading modules. Signed-off-by: Sami Tolvanen --- 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.rc2.250.ged5fa647cd-goog