From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751435AbdIAFJf (ORCPT ); Fri, 1 Sep 2017 01:09:35 -0400 Received: from ozlabs.org ([103.22.144.67]:43947 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbdIAFJd (ORCPT ); Fri, 1 Sep 2017 01:09:33 -0400 From: Michael Ellerman To: "Naveen N. Rao" , Ingo Molnar Cc: Anton Blanchard , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Oleg Nesterov , Srikar Dronamraju Subject: Re: [PATCH] uprobe: Warn if unable to install breakpoint In-Reply-To: <20170831183215.4306-1-naveen.n.rao@linux.vnet.ibm.com> References: <20170831183215.4306-1-naveen.n.rao@linux.vnet.ibm.com> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Fri, 01 Sep 2017 15:09:29 +1000 Message-ID: <87r2vr57jq.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Naveen N. Rao" writes: > When we try to install a uprobe breakpoint in uprobe_mmap(), we ignore > all errors encountered in the process per this comment at the top of > the function: > /* > * Called from mmap_region/vma_adjust with mm->mmap_sem acquired. > * > * Currently we ignore all errors and always return 0, the callers > * can't handle the failure anyway. > */ > > However, this is very confusing for users since no probe hits are > recorded nor is an error logged in dmesg. > > Fix this by logging an error in dmesg so that users can discover that > there was an issue with the uprobe. To facilitate use of uprobe_warn(), > we move that function to the top of the file. > > With this patch, we see a message similar to this in dmesg: > [ 201.449213] uprobe: uprobe_t:9740 failed to setup probe at 0x95c (-524) > > Reported-by: Anton Blanchard > Signed-off-by: Naveen N. Rao > --- > kernel/events/uprobes.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c > index 0e137f98a50c..587c591a535c 100644 > --- a/kernel/events/uprobes.c > +++ b/kernel/events/uprobes.c > @@ -112,6 +112,12 @@ struct xol_area { > unsigned long vaddr; /* Page(s) of instruction slots */ > }; > > +static void uprobe_warn(struct task_struct *t, const char *msg) > +{ > + pr_warn("uprobe: %s:%d failed to %s\n", > + current->comm, current->pid, msg); That should probably be ratelimited no? cheers