Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp97662img; Wed, 27 Mar 2019 17:52:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyofLkD224OCunzZd3HFkj4jjHHsZQcfYZ4F8+54V3dCDPaowHCVQZ97f8nIwReJO6XXaZv X-Received: by 2002:a63:30c5:: with SMTP id w188mr13210735pgw.76.1553734343715; Wed, 27 Mar 2019 17:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553734343; cv=none; d=google.com; s=arc-20160816; b=fTzKhMQ41sXYh9NFM2PRaRdE/Yx5hKcbEWzZ6wFCBjVzzG7o85hn1fd1FJmP4zdshX zvvdPRjmKX6slqaakt/q4utWiuvdXyr1MZ1+PziQM/C5ee8r5p3bGTTgjS9j8fOisBmr FZy2NA1NruO2f2fHUnu6t1GEeMznOspuaeRJ6DnzSrGtbMH+m31e+9xLCIoOttSw+MtT 8MUjWJP6ELraTRNKcKbJjQ0eP4bKR7J1yQ05/ushKW2w5SsZaS58w+bv5h+R3CchwPEx u6i9IqXNuR1SuW5U3tscqfPXcZjG/ugDVs0wu/+eg6Ov+P/+lQ3DJXRPQs1C811Dfu8w yfhQ== 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:subject:cc:to:from:date :dkim-signature; bh=XgIlLyTAoYe9M2kViKVlRVJQuZXqr8pWu00kIUXSMAw=; b=IpZ70KQiSrNT6+5jjZA6z/32k5yeYKHB5C6tV7cxapOW7tMCz2JoiOKn7GIQWa2t8o k7qfd8qZlKLTVUqq3MAIYKuJUwsgBLiPFKFlyun8BbP/ktDaTkkdYZM1N7qRbREKREVz cEcVD1S0pcV36sQMaFeUpsFZlIeUpQ4i1N3dVIeQCl/qI9ikvbH7m39NXuyuC3HOzQyE rkmYTcj0gsYEMTt7r3aSa3/7+IR/P9ZQMAFUrwJluatLyYKd1BJh/cYIAkJ8F2Hj73Fr usyD62Emaw6M/gQ/tKMfYnndQ1BTF7Lxs4sjxp2hihHe8BZQh059QAQzzU0pNnxsREJJ e5zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QIRXX+7H; 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 a1si18642053pgq.38.2019.03.27.17.52.07; Wed, 27 Mar 2019 17:52:23 -0700 (PDT) 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=QIRXX+7H; 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 S1727658AbfC1Av0 (ORCPT + 99 others); Wed, 27 Mar 2019 20:51:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:38332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727442AbfC1Av0 (ORCPT ); Wed, 27 Mar 2019 20:51:26 -0400 Received: from devnote2 (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 7AB8C20645; Thu, 28 Mar 2019 00:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553734285; bh=epK8h7HLXNUXFuG+q8AFXcueNSWV8oi3N3xggwXV9UI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QIRXX+7HiYuj5edkV1h3Clh9oar7ZhboP+2Uzp9rZqq0VKffTVS9o7TGeornO1oc6 WDHF9aNCUYGiXgkcDPrW7ix79I3oE62L8MokeGB/mqiMADOJ88gAN4YX1Ol9c6AL+7 sDOdMg+aguKD9txWE1fx6nyuPL16vvcCcDVtG0x8= Date: Thu, 28 Mar 2019 09:51:19 +0900 From: Masami Hiramatsu To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Masami Hiramatsu , Alexander Shishkin , Andrea Righi , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Mathieu Desnoyers , Peter Zijlstra , Steven Rostedt , Thomas Gleixner , Ingo Molnar Subject: Re: [PATCH AUTOSEL 5.0 152/262] x86/kprobes: Prohibit probing on IRQ handlers directly Message-Id: <20190328095119.e78ffbf9db138a24fbe18c69@kernel.org> In-Reply-To: <20190327180158.10245-152-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> <20190327180158.10245-152-sashal@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sasha, Could you drop this? This prevents probing too much functions, and we will drop it from upstream. Anyway, commit a50480cb6d61 ("kprobes/x86: Blacklist non-attachable interrupt functions") fixes same issue. So please pick it instead of this. Thank you, On Wed, 27 Mar 2019 14:00:07 -0400 Sasha Levin wrote: > From: Masami Hiramatsu > > [ Upstream commit 0eae81dc9f026d899c70f3931bf3bca6d7aa6938 ] > > Prohibit probing on IRQ handlers in irqentry_text because > if it interrupts user mode, at that point we haven't changed > to kernel space yet and which eventually leads a double fault. > E.g. > > # echo p apic_timer_interrupt > kprobe_events > # echo 1 > events/kprobes/enable > PANIC: double fault, error_code: 0x0 > CPU: 1 PID: 814 Comm: less Not tainted 4.20.0-rc3+ #30 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) > RIP: 0010:error_entry+0x12/0xf0 > [snip] > Call Trace: > > ? native_iret+0x7/0x7 > ? async_page_fault+0x8/0x30 > ? trace_hardirqs_on_thunk+0x1c/0x1c > ? error_entry+0x7c/0xf0 > ? async_page_fault+0x8/0x30 > ? native_iret+0x7/0x7 > ? int3+0xa/0x20 > ? trace_hardirqs_on_thunk+0x1c/0x1c > ? error_entry+0x7c/0xf0 > ? int3+0xa/0x20 > ? apic_timer_interrupt+0x1/0x20 > > Kernel panic - not syncing: Machine halted. > Kernel Offset: disabled > ---[ end Kernel panic - not syncing: Machine halted. ]--- > > Signed-off-by: Masami Hiramatsu > Cc: Alexander Shishkin > Cc: Andrea Righi > Cc: Arnaldo Carvalho de Melo > Cc: Jiri Olsa > Cc: Linus Torvalds > Cc: Mathieu Desnoyers > Cc: Peter Zijlstra > Cc: Steven Rostedt > Cc: Thomas Gleixner > Link: http://lkml.kernel.org/r/154998796400.31052.8406236614820687840.stgit@devbox > Signed-off-by: Ingo Molnar > Signed-off-by: Sasha Levin > --- > arch/x86/kernel/kprobes/core.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c > index 4ba75afba527..a034cb808e7e 100644 > --- a/arch/x86/kernel/kprobes/core.c > +++ b/arch/x86/kernel/kprobes/core.c > @@ -1028,6 +1028,13 @@ NOKPROBE_SYMBOL(kprobe_fault_handler); > > int __init arch_populate_kprobe_blacklist(void) > { > + int ret; > + > + ret = kprobe_add_area_blacklist((unsigned long)__irqentry_text_start, > + (unsigned long)__irqentry_text_end); > + if (ret) > + return ret; > + > return kprobe_add_area_blacklist((unsigned long)__entry_text_start, > (unsigned long)__entry_text_end); > } > -- > 2.19.1 > -- Masami Hiramatsu