[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <dcc04b34a67f93e1baf5f8522510be111e472134.1506061547.git.naveen.n.rao@linux.vnet.ibm.com>
Date: Fri, 22 Sep 2017 14:43:37 +0530
From: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Oleg Nesterov <oleg@...hat.com>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
Anton Blanchard <anton@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 2/3] kernel/uprobes: Warn if unable to install breakpoint
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.
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 <anton@...ba.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
---
kernel/events/uprobes.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 18bd6127d00e..8da6570b4467 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1092,7 +1092,10 @@ int uprobe_mmap(struct vm_area_struct *vma)
if (!fatal_signal_pending(current) &&
filter_chain(uprobe, UPROBE_FILTER_MMAP, vma->vm_mm)) {
unsigned long vaddr = offset_to_vaddr(vma, uprobe->offset);
- install_breakpoint(uprobe, vma->vm_mm, vma, vaddr);
+ int ret = install_breakpoint(uprobe, vma->vm_mm, vma, vaddr);
+ if (ret)
+ pr_warn_ratelimited("failed to setup probe at 0x%llx (%d)",
+ uprobe->offset, ret);
}
put_uprobe(uprobe);
}
--
2.14.1
Powered by blists - more mailing lists