From patchwork Mon Jul 6 05:03:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Anand X-Patchwork-Id: 6719871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31458C05AC for ; Mon, 6 Jul 2015 05:06:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 52A3C2063B for ; Mon, 6 Jul 2015 05:06:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79DAB2061C for ; Mon, 6 Jul 2015 05:06:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZByZo-0000q9-3c; Mon, 06 Jul 2015 05:04:20 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZByZf-0000nk-8D for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 05:04:11 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 1A56A8F29C; Mon, 6 Jul 2015 05:03:53 +0000 (UTC) Received: from localhost (unused [10.10.51.110] (may be forged)) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6653o4X012656; Mon, 6 Jul 2015 01:03:52 -0400 From: Pratyush Anand To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH 2/2] arm64: Make all entry code as non-kprobe-able Date: Mon, 6 Jul 2015 10:33:22 +0530 Message-Id: <683f80cef9b2b778be868e77b01a245585448a86.1436158027.git.panand@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150705_220411_323762_2F4C5AD2 X-CRM114-Status: GOOD ( 13.05 ) X-Spam-Score: -7.5 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pratyush Anand , steve.capper@linaro.org, linux-kernel@vger.kernel.org, dave.long@linaro.org, masami.hiramatsu.pt@hitachi.com, wcohen@redhat.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Entry symbols are not kprobe safe. So blacklist them for kprobing. Signed-off-by: Pratyush Anand Reviewed-by: Masami Hiramatsu --- arch/arm64/kernel/entry.S | 3 +++ arch/arm64/kernel/kprobes.c | 9 +++++++++ arch/arm64/kernel/vmlinux.lds.S | 1 + 3 files changed, 13 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index a7691a378668..2ea24f6bc06b 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -202,6 +202,7 @@ tsk .req x28 // current thread_info * Exception vectors. */ + .section ".entry.text", "ax" .align 11 ENTRY(vectors) ventry el1_sync_invalid // Synchronous EL1t @@ -737,3 +738,5 @@ ENTRY(sys_rt_sigreturn_wrapper) mov x0, sp b sys_rt_sigreturn ENDPROC(sys_rt_sigreturn_wrapper) + + .section ".text", "ax" diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c index 6c9f8b5f04ce..9bc02c151f7f 100644 --- a/arch/arm64/kernel/kprobes.c +++ b/arch/arm64/kernel/kprobes.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "kprobes.h" #include "kprobes-arm64.h" @@ -661,6 +662,14 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p) return 0; } +bool arch_within_kprobe_blacklist(unsigned long addr) +{ + return (addr >= (unsigned long)__kprobes_text_start && + addr < (unsigned long)__kprobes_text_end) || + (addr >= (unsigned long)__entry_text_start && + addr < (unsigned long)__entry_text_end); +} + int __init arch_init_kprobes(void) { return 0; diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 1fa6adc7aa83..11fb2b0117d0 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -97,6 +97,7 @@ SECTIONS *(.exception.text) __exception_text_end = .; IRQENTRY_TEXT + ENTRY_TEXT TEXT_TEXT SCHED_TEXT LOCK_TEXT