Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp505388pxa; Fri, 21 Aug 2020 12:57:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6HsW/3lLKuzm6FdXMuOslEkEX14VxVQC8P8ZfaRwqV7E9vK1xfEodGhk/2XFVjwi5u+AK X-Received: by 2002:a17:906:7b83:: with SMTP id s3mr4513585ejo.2.1598039840507; Fri, 21 Aug 2020 12:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598039840; cv=none; d=google.com; s=arc-20160816; b=YkdelnXKJ9Pv7NWKKYxBs/NoNlDxK5EyFr+lHPfYxm2jQA7KIpP64x2ZwOIDTtJJYO dmav9lGAxhy16ZaSh1CcJToCdVg6AHlFkrtRZ55BA7JDYjPAw7n5R7nqfINjYmiIm6HC rclS7oJMJleDvju8bh12GCbHPUIoIYuMelz8jz05qfokrPHlkc8PIKiEgTXe2l2gSrFV e7VxPHRsan/mdZS7VGkL7IXDA+RnF6novjBB7QnrXoDQ5kpQejCYtQ6SMkv6yfJGTpNf 5699kE6fikdqZBlAYyeLXvltVLqbzhN+4X4xfUzf6MqEkzpyrq3KeUuBX1Y7rP14i7/K dEXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PeNFh808sp94203AedRRDxtBogHXBjPfBsBbm9/bM3w=; b=IQLS7xigGzYwhqAm7LyazP/lgslW2WCZNeQhKNEXpbC6BaecJaYWxWmHUfzTicPeRV hMLKnkL60TxbjEsSkOQskDgQ8UJQ9B7On0oynZL62sF2EaWH4wHtCqpxlvVJnnL3WT8V F71EG1QR8dJEZWL+O446kPz3p5/L8mAlRpMS0tZzC6XrLMenBRKzzJ+yNBqllwodSVSw GQnyiAWkflq0sBNHrCjmqaf7VbCDLpagSFHxX7BEZ1hk39QPsbAlJJ38L0LhD3Lwy3B8 hpEngOMTxkhuvBDMv4aNWG/0JL5R5TEQEp6tVdPqlBi5TfKQiuOWFHK+UYgbSyj57LVM spCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KCpWIGu2; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si2193790edn.57.2020.08.21.12.56.57; Fri, 21 Aug 2020 12:57:20 -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=@chromium.org header.s=google header.b=KCpWIGu2; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726737AbgHUTzM (ORCPT + 99 others); Fri, 21 Aug 2020 15:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbgHUTyF (ORCPT ); Fri, 21 Aug 2020 15:54:05 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1975AC06179E for ; Fri, 21 Aug 2020 12:54:03 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 128so1485371pgd.5 for ; Fri, 21 Aug 2020 12:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PeNFh808sp94203AedRRDxtBogHXBjPfBsBbm9/bM3w=; b=KCpWIGu2/MoubKQjEEdpSZyLun4iQCojW3eL8PjI2Ey8IgO2OcGgVhrFyHJn60Oux1 fAkef240dPlqqfWatRfeUzI0UXYkuVBgt7cQxaJhM6IEUsH+zU6+dsXGqqDYhsj3l+/E d+7ZofSbpYqxDUrDxEuyZZyHy5U/1ElZSYieo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PeNFh808sp94203AedRRDxtBogHXBjPfBsBbm9/bM3w=; b=k9UN7HHGq4tdcOKpNKIoJVvF0w6twVcyV1Hph2Tyrx4kt7hSXq6HBW5VWdwAkY8h/b fNodwhNTU/ENDg/iUJYPgurj0bbVfwXOw4Zm4AE14vVvicU4sXpo14BqoMjPmMJJylxs o32c/KNWL5AnV8/YLmvkPBK6C7xjI9UArJm7PngZbC710oLges5/tmB2gC322XzrPcgv a+sRzZhX+dOzINy6Tjz57MOFcHWW+DnO11QJWYqilA/1Gas9FEbimFjBTkfNVKvwUu4S 3/NgRVMt9s92Wxk6bRD96MFLHYO09SJFGFyqO4If4iH8kxndTaMsfqlHLFuhThxoIm6R dlqw== X-Gm-Message-State: AOAM530wCAEiTZJhKjK8+MnTYuQAEy9Kjn5RP8A1aPvzRpYibE+SWWND uEHlcMsV7swxvvsoKyRrK3ITJg== X-Received: by 2002:aa7:8bd2:: with SMTP id s18mr3553849pfd.284.1598039642687; Fri, 21 Aug 2020 12:54:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x11sm2748233pgl.65.2020.08.21.12.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 12:53:59 -0700 (PDT) From: Kees Cook To: Ingo Molnar Cc: Kees Cook , Catalin Marinas , Mark Rutland , Ard Biesheuvel , Peter Collingbourne , James Morse , Borislav Petkov , Ingo Molnar , Russell King , Masahiro Yamada , Arvind Sankar , Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , x86@kernel.org, clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 22/29] x86/asm: Avoid generating unused kprobe sections Date: Fri, 21 Aug 2020 12:43:03 -0700 Message-Id: <20200821194310.3089815-23-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821194310.3089815-1-keescook@chromium.org> References: <20200821194310.3089815-1-keescook@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When !CONFIG_KPROBES, do not generate kprobe sections. This makes sure there are no unexpected sections encountered by the linker scripts. Signed-off-by: Kees Cook --- arch/x86/include/asm/asm.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 5c15f95b1ba7..4712206c4325 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -138,11 +138,15 @@ # define _ASM_EXTABLE_FAULT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) -# define _ASM_NOKPROBE(entry) \ +# ifdef CONFIG_KPROBES +# define _ASM_NOKPROBE(entry) \ .pushsection "_kprobe_blacklist","aw" ; \ _ASM_ALIGN ; \ _ASM_PTR (entry); \ .popsection +# else +# define _ASM_NOKPROBE(entry) +# endif #else /* ! __ASSEMBLY__ */ # define _EXPAND_EXTABLE_HANDLE(x) #x -- 2.25.1