Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4414937imu; Mon, 14 Jan 2019 22:49:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN58WklxhE2nB4GKlnu1/MlUe/QwoohKH+2TKCl2L9xMRsvYvq2shqTmSlRhpP9wt3sHm17I X-Received: by 2002:a63:8149:: with SMTP id t70mr2490488pgd.172.1547534977652; Mon, 14 Jan 2019 22:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547534977; cv=none; d=google.com; s=arc-20160816; b=o3TNx3ivaAoPVoYI3jCvR/w3YfFi0laRdRZwTYWk9dPd/1b3fGmlZR9O+YOBGwxjwi LcPPbdQALeZG0pB8sgtCaFlgnPyE+O4PGiPGSsApVRoM+qG9jh6aApTAJzK5tD81htP6 vdcDv2n0qKgDmO7YR87by8pKsCppJfvBF+XUyBQyH/YRRzv5Mrsb5fjWYzs4a8zg5fNb zRFf8b0oPbgEEPfB0KCyYOcvfmHLM45gELmMfPi/kO3ixdh8ZohZ5lD1sLbWWyy2ieBe 4O3uUgxkF2qbGu0dqtc9kTaR37p5QfMJmeBiKr0FzXpjm1w606xZt9Vb/wZWKxdSExhP ZQDQ== 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=wNc9srEGtWSCp/wUFxMEosV62gXC21R3gXQfyRhADf8=; b=cjAhJbzQzhNhWpvoeP9U40r2dSx0Zzaxe5GlxzOOonmBQnW2SIWny+/kukdK6wN4Ci db6Hu1omQyC4hBCgxHx3sKFcan0uggrVyMh7erlJDrfwo+3xSy57/p80am6v4Xi+maIC I3JukTUnsmjMuXS7eH7K8WXR7r/pOF5k+i1wER2PUZAxmdDK31lquY+CqTFwVI6c9vZt TkmQ8wZ1zycwBGmtLTCWVVQkOf+1gRDtK1FGKxribwQQbKcm6s2jzSckrLYgbVSs+meI wVvI60AiJLlFreVpXLFqYDEbUeQapny6jteZXBGAHaHNQzNp7GdF8pJV4Gy5AkwsUAbS 0p2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L0d+QhrA; 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 h19si2558178pgg.274.2019.01.14.22.49.22; Mon, 14 Jan 2019 22:49:37 -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=L0d+QhrA; 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 S1728223AbfAOGYc (ORCPT + 99 others); Tue, 15 Jan 2019 01:24:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:41412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727526AbfAOGYc (ORCPT ); Tue, 15 Jan 2019 01:24:32 -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 20C9A20651; Tue, 15 Jan 2019 06:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547533471; bh=JMPzgJxn71Oh3CSPLMfjWsZVP7P3WH3Nj9DBNFncCNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0d+QhrAA1raIo2uM8j525TaubAY8kIQauQJKDLhiGMRqVv7wWbq6kWjXGfmxsoX9 NjbiDm+VqVFOQBA/Se3Wa+5BmE7KTsDD9dVaH/aQqtk8TKSR5vxfNesLDdvR8F+PSC IxwCzpAMu2a6FILbySzAk35WBJrHPMaoiYx+jvqM= 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 1/4] arm64: kprobes: Move extable address check into arch_prepare_kprobe() Date: Tue, 15 Jan 2019 15:24:08 +0900 Message-Id: <154753344814.31541.1870614689774287684.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 Move extable address check into arch_prepare_kprobe() from arch_within_kprobe_blacklist(). The blacklist is exposed via debugfs as a list of symbols. The extable entries are smaller, so must be filtered out by arch_prepare_kprobe(). Signed-off-by: Masami Hiramatsu Reviewed-by: James Morse --- Update in v2: - Update commit message. - Add Reviewed-by from James. --- arch/arm64/kernel/probes/kprobes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 2a5b338b2542..b2d4b7428ebc 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -102,6 +102,10 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) if (in_exception_text(probe_addr)) return -EINVAL; + + if (search_exception_tables(probe_addr)) + return -EINVAL; + if (probe_addr >= (unsigned long) __start_rodata && probe_addr <= (unsigned long) __end_rodata) return -EINVAL; @@ -477,8 +481,7 @@ bool arch_within_kprobe_blacklist(unsigned long addr) (addr >= (unsigned long)__entry_text_start && addr < (unsigned long)__entry_text_end) || (addr >= (unsigned long)__idmap_text_start && - addr < (unsigned long)__idmap_text_end) || - !!search_exception_tables(addr)) + addr < (unsigned long)__idmap_text_end)) return true; if (!is_kernel_in_hyp_mode()) {