Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4446019imu; Mon, 14 Jan 2019 23:32:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN622jT8fVPa60vDzrmWpMOSPJfhDYsVLRfVdIqdcvlkEPMkQz4QFeljBWt0X/2D1Do1KrtW X-Received: by 2002:a62:1b50:: with SMTP id b77mr2642942pfb.36.1547537525756; Mon, 14 Jan 2019 23:32:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547537525; cv=none; d=google.com; s=arc-20160816; b=yLqD57PC30Ta56TPYp/aWVq1ITeKN5XQ+TkJwcl2IHO3CzaCQMJsQwZLlga2SsWg2K bQSRDm/Qc3bFxsE2It1hzPrVir5R1tK0QxI+UcvSH1F46dgXfHUhg+NaqEfflN96TJdn HXf5s3rINOVuJXtQn6dJsu4f7RtmenEQMGUi7m8KwQoVDphoK8Di4JuH/GsUrCW6lNtJ IuTNir+2oMeAE6KAVUMTv8wfgX4g1Li2OzMu424svyOUegUYlisvZxZQzqTFP7FJ/BcG myc6d1LOMA5kN1dyBN1nLEvfXMJyeE+qoOajcDMpwY4IxArWRAfqxDR/HGRHKodKirm2 KOig== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xwfSnyy0vv4sFMQhqGozEk31PWQOesphN35mw93nspg=; b=P7s4Rn58l4m8mpf8HyxYD47eaBWty4AIwkrCFxOGNMP+oLtUVladlu3ADkxa366jLi oPIvzm0qheIR6I8i8G5R7V572v4MHjfzhWyOMk3WMlxB15bo8Sf4cmVXTA4rE1aBVSKN 9YZ0O5+Zd5E16+ykB0OEqPHKnJyUuYadfZBliBDBaSgrb0IUk+3hiwWpa6n/LN9vEKK6 Vtg7rbO5VFTXwjCBwaragopqISlFvxGUaAkuxt+Kes5E5PQ0rQ0knFkFaPmFE5Bsg6TH g4r+ArJD7dePO6Sgm8Xd8pYS3qFVMEYLIPq647Cmk1lYlXne/1BFPpM24LQ7v157JSag 5KKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jiGtl9ju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si2474040plk.296.2019.01.14.23.31.50; Mon, 14 Jan 2019 23:32:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jiGtl9ju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728378AbfAOGZ5 (ORCPT + 99 others); Tue, 15 Jan 2019 01:25:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:42340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbfAOGZ5 (ORCPT ); Tue, 15 Jan 2019 01:25:57 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A105220651; Tue, 15 Jan 2019 06:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547533556; bh=c3cvMz1HCpmGl/imOyH/ipMAfTvysPlZuDxCV5MItjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jiGtl9juScFfW2sBrGxgUaVX/ak2eqEJp8+NKHvesiTC9yjB2ELFuuKgqG4lsoYTh cGr30LDQpxgCucetQyrsnaDUnv5BZ/AUv90BUwc9lmNJpne7BcQxTPUbisWM8GQfID rjaxLB8UaByVvSqLzsMv1A518K6PF1sT6KunuTfc= From: Masami Hiramatsu To: Catalin Marinas , Will Deacon Cc: Masami Hiramatsu , Pratyush Anand , "David A . Long" , linux-arm-kernel@lists.infradead.org, linux-kernel , James Morse Subject: [PATCH v2 4/4] arm64: kprobes: Use arch_populate_kprobe_blacklist() Date: Tue, 15 Jan 2019 15:25:33 +0900 Message-Id: <154753353370.31541.14485875717131836689.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <154753341900.31541.8135985235882849464.stgit@devbox> References: <154753341900.31541.8135985235882849464.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use arch_populate_kprobe_blacklist() instead of arch_within_kprobe_blacklist() so that we can see the full blacklisted symbols under the debugfs. Signed-off-by: Masami Hiramatsu --- arch/arm64/kernel/probes/kprobes.c | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index b9e9758b6534..6c066c34c8a4 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -465,26 +465,30 @@ kprobe_breakpoint_handler(struct pt_regs *regs, unsigned int esr) return DBG_HOOK_HANDLED; } -bool arch_within_kprobe_blacklist(unsigned long addr) +int __init arch_populate_kprobe_blacklist(void) { - if ((addr >= (unsigned long)__kprobes_text_start && - addr < (unsigned long)__kprobes_text_end) || - (addr >= (unsigned long)__entry_text_start && - addr < (unsigned long)__entry_text_end) || - (addr >= (unsigned long)__idmap_text_start && - addr < (unsigned long)__idmap_text_end) || - in_exception_text(addr)) - return true; - - if (!is_kernel_in_hyp_mode()) { - if ((addr >= (unsigned long)__hyp_text_start && - addr < (unsigned long)__hyp_text_end) || - (addr >= (unsigned long)__hyp_idmap_text_start && - addr < (unsigned long)__hyp_idmap_text_end)) - return true; - } - - return false; + int ret; + + ret = kprobe_add_area_blacklist((unsigned long)__kprobes_text_start, + (unsigned long)__kprobes_text_end); + if (ret) + return ret; + ret = kprobe_add_area_blacklist((unsigned long)__entry_text_start, + (unsigned long)__entry_text_end); + if (ret) + return ret; + ret = kprobe_add_area_blacklist((unsigned long)__idmap_text_start, + (unsigned long)__idmap_text_end); + if (ret || is_kernel_in_hyp_mode()) + return ret; + + ret = kprobe_add_area_blacklist((unsigned long)__hyp_text_start, + (unsigned long)__hyp_text_end); + if (ret) + return ret; + ret = kprobe_add_area_blacklist((unsigned long)__hyp_idmap_text_start, + (unsigned long)__hyp_idmap_text_end); + return ret; } void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs)