From patchwork Sat Jul 10 14:55:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12368673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBC10C07E95 for ; Sat, 10 Jul 2021 14:55:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC86E61356 for ; Sat, 10 Jul 2021 14:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231536AbhGJO6f (ORCPT ); Sat, 10 Jul 2021 10:58:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:58162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbhGJO6f (ORCPT ); Sat, 10 Jul 2021 10:58:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 49E916135D; Sat, 10 Jul 2021 14:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625928950; bh=GqW0l+mkoucVPyOJw1b+uyY3Gwoy/RAaHXL0PdUYGns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IpqapYBLlQE5IlFLYyjlYNSCCqBBXpUpUOLzC/FixL8KBxsPpcRYfalwdOn1rGV4p xekZQ70ImhMTwBcnTmJnlc62GBozhLiUTjHRvebNB6Z7nYp8qqpAtedvO7QuVAkp0d 1++fQK1wX/2GSqQ02yvfANsbSnMsmhTvxezXMF7YCOOKkY4K8wC5aWoDdlsx2Ii8Nd AUo7Pfuehd445UN0dlRsGAEH5NDBJVs33m3OxTmvjtnG89qgOn9aymU8QNlK7EAFnU 5kpyl3rCN9XmreI7YCjyu6uJIaS/DjQJ9itN7kMd9z+b1naT6gP7LIeC2zRNMzlwQa fzXOA8XqFUA5A== From: Masami Hiramatsu To: X86 ML , Ingo Molnar Cc: Steven Rostedt , Josh Poimboeuf , Masami Hiramatsu , Daniel Xu , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kuba@kernel.org, mingo@redhat.com, ast@kernel.org, Thomas Gleixner , Borislav Petkov , Peter Zijlstra , kernel-team@fb.com, yhs@fb.com, linux-ia64@vger.kernel.org, Abhishek Sagar , Andrii Nakryiko Subject: [PATCH -tip 3/6] kprobes: Use IS_ENABLED() instead of kprobes_built_in() Date: Sat, 10 Jul 2021 23:55:46 +0900 Message-Id: <162592894661.1158485.13236889081287453022.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <162592891873.1158485.768824457210707916.stgit@devnote2> References: <162592891873.1158485.768824457210707916.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Use IS_ENABLED(CONFIG_KPROBES) instead of kprobes_built_in(). This inline function is introduced only for avoiding #ifdef. But since now we have IS_ENABLED(), it is no longer needed. Signed-off-by: Masami Hiramatsu --- include/linux/kprobes.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 28c04f1f2b73..3d02917c837b 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -180,14 +180,6 @@ struct kprobe_blacklist_entry { DECLARE_PER_CPU(struct kprobe *, current_kprobe); DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); -/* - * For #ifdef avoidance: - */ -static inline int kprobes_built_in(void) -{ - return 1; -} - extern void kprobe_busy_begin(void); extern void kprobe_busy_end(void); @@ -414,10 +406,6 @@ int arch_kprobe_get_kallsym(unsigned int *symnum, unsigned long *value, char *type, char *sym); #else /* !CONFIG_KPROBES: */ -static inline int kprobes_built_in(void) -{ - return 0; -} static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) { return 0; @@ -511,7 +499,7 @@ static inline bool is_kprobe_optinsn_slot(unsigned long addr) static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, unsigned int trap) { - if (!kprobes_built_in()) + if (!IS_ENABLED(CONFIG_KPROBES)) return false; if (user_mode(regs)) return false;