lkml.org 
[lkml]   [2017]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] kernel/uprobes: Warn if unable to install breakpoint
On 2017/09/15 05:53PM, Oleg Nesterov wrote:
> On 09/14, Naveen N. Rao wrote:
> >
> > +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);
> > +}
> > +
> > /*
> > * valid_vma: Verify if the specified vma is an executable vma
> > * Relax restrictions while unregistering: vm_flags might have
> > @@ -1087,7 +1093,14 @@ 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) {
> > + char msg[64];
> > + snprintf(msg, sizeof(msg),
> > + "setup probe at 0x%llx (%d)",
> > + uprobe->offset, ret);
> > + uprobe_warn(current, (const char *)msg);
>
> Agreed, but... this is cosmetic, but I don't really like this snprintf().
>
> I won't insist too much, but wouldn't it better to turn uprobe_warn() into
> uprobe_warn(struct task_struct *t, char *fmt, ...) ?

Good point. In fact, I think we can just use pr_fmt().

Thanks,
Naveen

\
 
 \ /
  Last update: 2017-09-16 13:47    [W:0.039 / U:2.580 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site