[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170915155309.GA590@redhat.com>
Date: Fri, 15 Sep 2017 17:53:09 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...nel.org>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Anton Blanchard <anton@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] kernel/uprobes: Warn if unable to install
breakpoint
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, ...) ?
Oleg.
Powered by blists - more mailing lists