Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2027175pxb; Mon, 23 Aug 2021 10:15:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhFKyIbsnf72/Ye8aTt7GBQaLSbsfNFSnhZUko5k5JnhqFRFb+xfz2mS67k4208B+HtA2r X-Received: by 2002:a92:d647:: with SMTP id x7mr22788456ilp.123.1629738912114; Mon, 23 Aug 2021 10:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629738912; cv=none; d=google.com; s=arc-20160816; b=R9Jdgr2D5cb62f/DMUxMCGd05DsIDXhsr1bBUuUMTKstQ84RdaGmjlVo+D13FoBf9k saHi9xPgAWMbd2LhTvyB6rZXZfSp/cV3Eli1JdjrNdChl/pk1Ft6d45OmIinZCuQG0wp 6SGfKWFaOfR2RHtZIvj+wfeH3oBS+PuR0rAkuWdc2M/tztyfqdrfWLzyvMtPPIMTMZGi 41+wJvgGa7iSz0OGE8Ql65Xg3ev6V+m4+rI65hc19FteYkiSq1tmDyIG2rAx8Hig9rbd duXrarqZbxU2bu0ukvH7eF8A9ktdNmSO0NkFMhZbSjfH00IngW/9U0IPp2XcNvu3HyDm 0hsw== 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=vRXS84bbJsUYBdo6NrPKOtGxl8FaD7rd6BPrYrnkXmM=; b=SMi7paQ9215hDsCmKrFBRPA/Za5U4IMoIrTnYPJFYRFKGfT7X1FDCbbrnH4xjUL4/x Uaju2JvyNGp5JO138mgXOkbvJERrSnLnkny5058a/EoXCrtgItnpsxv65x5F2h5pM3jH 5TinTXaamlkmtHagZZEaDAwA848nQlR5EbUKbUMt3EHAuXPpd+GxqIXyU5yYPhwvykmE PL1P+QWayb63jDxGNWQlItQUbm8Dggs/tcqJw+0c+JkJYemQQjeG4DoQxqJJnmd6wHDT kStFK1NouN95lFFe3Od6XZJOpOrkzIS0kzPcJOxvezIC+dagNSMINBWc9DDP+ldn1H1m lf9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bIfEQab0; 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 s8si15215213ilv.57.2021.08.23.10.14.59; Mon, 23 Aug 2021 10:15:12 -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=bIfEQab0; 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 S231698AbhHWROh (ORCPT + 99 others); Mon, 23 Aug 2021 13:14:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231689AbhHWRO2 (ORCPT ); Mon, 23 Aug 2021 13:14:28 -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 8A756C061760 for ; Mon, 23 Aug 2021 10:13:45 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id w200-20020a25c7d10000b02905585436b530so17032931ybe.21 for ; Mon, 23 Aug 2021 10:13:45 -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=vRXS84bbJsUYBdo6NrPKOtGxl8FaD7rd6BPrYrnkXmM=; b=bIfEQab0ztkAIlL/xRfn6eVYhJL2L+v0DkKAC8N8G3UMfmdGyNTZYuZTCInyENzt1h HQGcVJs2tfEjOA8KETf0IlsWZwd0kWg1SOECL5mxpeJQD4Y7+X3nzE57BjzOj8fEMSUM mmF3qFDK4e9lIEXkiiHpg1ZFjI7/cjU7hkuKI7vehXhlq67DGHreEZ+ghgTmyMqUXNGf fmKC4OWXelFPk6v8hAtJhSE2QnCts7WompYRJfoAU1BRx6J4VJlXDBBFFKdpai1Szyvc 1XlVAo3pc6wfat6tbEQk/sz9L+sUtpRFxpOB+zYCv88sDJ9O/WXmyM2oiWjh0/HUewH4 j6hg== 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=vRXS84bbJsUYBdo6NrPKOtGxl8FaD7rd6BPrYrnkXmM=; b=eRr6EfhOg2eMn1dibDeNcR0Funhqbbogr73MS3WFtbCr9+uXkkch5baV5xiAx7CdD3 Vwvx367WVYWQwsNfkLZbKfU3t6GSKMwb7W2VyECz+szm6vTvGdWR/qtOLAhEzrC8/K87 0WfUY+hdbVBp0IiTx3jse0tOo/et3zhgQJU96BklP4Y4e/B4EXebfRcN6qqp0kl3pSyr JUQCWpHyiJ2fG+fEFaUslJGjxKHBlUvc+nqd3QpNNtYf75FYpUX9CM1EbdEocgpsDHMN HxU38uk7L/i7pwPfqY+A7LfW3LyygyYlos6Kikvc5pvG7evHuGkjP3/gNJJshZkBooZQ cSbg== X-Gm-Message-State: AOAM532XGc3GZD20ogV9HR019PzBgLfUtJC+DD/oJheJdhdwrueUgo/g CWJJKmOh6eT0PeOXGXD9tFCSgOyFx5VZSvsXUXk= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:cc48:aa6a:f4ec:7d19]) (user=samitolvanen job=sendgmr) by 2002:a25:9a84:: with SMTP id s4mr45327262ybo.416.1629738824799; Mon, 23 Aug 2021 10:13:44 -0700 (PDT) Date: Mon, 23 Aug 2021 10:13:14 -0700 In-Reply-To: <20210823171318.2801096-1-samitolvanen@google.com> Message-Id: <20210823171318.2801096-11-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 10/14] x86, relocs: 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 From: Kees Cook The __typeid__* symbols aren't actually relocations, so they can be ignored during relocation generation. Signed-off-by: Kees Cook Signed-off-by: Sami Tolvanen --- 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 9ba700dc47de..fbc57cc00914 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c @@ -48,6 +48,7 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = { "^(xen_irq_disable_direct_reloc$|" "xen_save_fl_direct_reloc$|" "VDSO|" + "__typeid__|" "__crc_)", /* @@ -808,6 +809,12 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym, symname); break; + case R_X86_64_8: + if (!shn_abs || !is_reloc(S_ABS, symname)) + die("Non-whitelisted %s relocation: %s\n", + rel_type(r_type), symname); + break; + case R_X86_64_32: case R_X86_64_32S: case R_X86_64_64: -- 2.33.0.rc2.250.ged5fa647cd-goog