Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3631163img; Mon, 25 Mar 2019 14:24:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAQ9Q5CowR+7WA0e8cUg1gUdiDOKtEQHhF+m3TkZA4n9jBPzI0yczC0G1jEj6cLGeg7+1Q X-Received: by 2002:a63:8142:: with SMTP id t63mr20426541pgd.63.1553549079795; Mon, 25 Mar 2019 14:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553549079; cv=none; d=google.com; s=arc-20160816; b=RS0ZpVZ/V2IupUNQ8J0SaQhwxNbgW1966mlQo/d8P6YcHEDIM8K3w+a6NbBh2NMrja rJSaaaYt6z5BQaXKVFnjSm4zIfwE1FCsdzIo4gK8qSMQ/IdMYMgliu4HDZl6KYJhS+cU VvEI42AVokJdw4rHczKCeoLruEaUaaitl1Y+jMK2oyvGgNyptsXUcTiVjfrBfnyNBdtH 5QcoTFicYv9d3ppepnuvD8hfNjoUSvVmiV05a7LS1IoxsCgC9uCe2xGNabcm5UvvSv+C TlUAFKjSOxoiXli9PEwFnH3/DurZ3YwXUKLN2XbvA9OHR/oM7U4ZFmCODZSaa1TuHuoK Zp0g== 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; bh=kObUzFEHZyuDkMz8DoHU2pZLet/WfRzfSHMQadPbRew=; b=nj8NGwgkg9zWGc3yHKivbY/QHm+ccRbyqiPUwIQpbN9q98x430ABPS2yVHTubpG4j2 v2mxRHLBnMhb/K15kpfd3UTw42CQ2NqMwHrERjDDJ/Z2AABylJilQcjDen82dcbM/EOt nMZR8sXcYhlDnzq2pf3aJLR8MOgPwJFr4N8VotJHgIpe4sg4BfkmKTay7DY1+ripk2oA BVJYvCmYRfO1VKuOy4v2L6lDhm0sa0Erhd8jknrLXus8yQqfm+nbcTvB+Vp7tup0rMKa 2gzLG+eRu/mPT+MgXHucxWIyfqo31bRNaXwzWzIoCw3OsMOEyUe/E0xVgGpbmJm68WKI d7hQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d33si15279575pla.315.2019.03.25.14.24.24; Mon, 25 Mar 2019 14:24:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730260AbfCYVXh (ORCPT + 99 others); Mon, 25 Mar 2019 17:23:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:54002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729714AbfCYVXh (ORCPT ); Mon, 25 Mar 2019 17:23:37 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 20AF020848; Mon, 25 Mar 2019 21:23:36 +0000 (UTC) Date: Mon, 25 Mar 2019 17:23:34 -0400 From: Steven Rostedt To: Masami Hiramatsu Cc: Ingo Molnar , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi Subject: Re: [PATCH -tip v3 04/10] x86/kprobes: Prohibit probing on IRQ handlers directly Message-ID: <20190325172334.559f8c5b@gandalf.local.home> In-Reply-To: <154998796400.31052.8406236614820687840.stgit@devbox> References: <154998785011.31052.1475728497912659748.stgit@devbox> <154998796400.31052.8406236614820687840.stgit@devbox> X-Mailer: Claws Mail 3.16.0 (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 On Wed, 13 Feb 2019 01:12:44 +0900 Masami Hiramatsu wrote: > 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 Hmm, this breaks one of my tests (which I probe on do_IRQ). It's been working for years. > # 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 I'm not able to reproduce this (by removing this commit). I'm thinking something else may have changed, as I've been tracing interrupt entries for years, and interrupting userspace while doing this. I've even added probes where ftrace isn't (where it uses an int3) and still haven't hit a problem. I think this patch is swatting a symptom of a bug and not addressing the bug itself. Can you send me the config that triggers this? -- Steve > ---[ end Kernel panic - not syncing: Machine halted. ]--- > > Signed-off-by: Masami Hiramatsu > --- > 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); > }