public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Anton Blanchard <anton@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] kernel/uprobes: Warn if unable to install breakpoint
Date: Fri, 15 Sep 2017 17:53:09 +0200	[thread overview]
Message-ID: <20170915155309.GA590@redhat.com> (raw)
In-Reply-To: <2b69563b023789443ef80a9f5bfe0629807fc51e.1505333828.git.naveen.n.rao@linux.vnet.ibm.com>

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.

  reply	other threads:[~2017-09-15 15:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 20:27 [PATCH v2 0/3] A few uprobe fixes Naveen N. Rao
2017-09-13 20:28 ` [PATCH v2 1/3] kernel/uprobes: Warn if unable to install breakpoint Naveen N. Rao
2017-09-15 15:53   ` Oleg Nesterov [this message]
2017-09-16 11:46     ` Naveen N. Rao
2017-09-13 20:28 ` [PATCH v2 2/3] kernel/uprobes: Ratelimit messages Naveen N. Rao
2017-09-13 20:28 ` [PATCH v2 3/3] kernel/uprobes: Fix check for active uprobe Naveen N. Rao
2017-09-15 15:38   ` Oleg Nesterov
2017-09-16 11:33     ` Naveen N. Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170915155309.GA590@redhat.com \
    --to=oleg@redhat.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=srikar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox