linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH] kernel-shark: Suppress "Root privileges are required" if already root
Date: Wed, 24 Jul 2019 13:37:16 +0300	[thread overview]
Message-ID: <ca2fce2f-8d04-ef94-f367-0ccc9739ef22@gmail.com> (raw)
In-Reply-To: <20190723165935.300f58e8@gandalf.local.home>


On 23.07.19 г. 23:59 ч., Steven Rostedt wrote:
> 
> From: Steven Rostedt (VMware) <rostedt@goodmis.org>
> 
> If the tracefs directory is configured into the kernel, and
> kshark-record  fails to find the tracing directory, it should test if
> it already has root privileges (geteuid() returns zero), before posting
> a message "Root privileges are required" as that can confuse users.
> 

Yes, the message can be misleading without this check. Thanks!

> Reported-by: howaboutsynergy@pm.me
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> diff --git a/kernel-shark/src/KsCaptureDialog.cpp b/kernel-shark/src/KsCaptureDialog.cpp
> index 2e6e8f9c..dbf73302 100644
> --- a/kernel-shark/src/KsCaptureDialog.cpp
> +++ b/kernel-shark/src/KsCaptureDialog.cpp
> @@ -18,6 +18,12 @@
>   #include "KsCmakeDef.hpp"
>   #include "KsCaptureDialog.hpp"
>   
> +extern "C" {
> +  // To get access to geteuid()
> +  #include <unistd.h>
> +  #include <sys/types.h>
> +}
> +
>   static inline tep_handle *local_events()
>   {
>   	return tracecmd_local_events(tracecmd_get_tracing_dir());
> @@ -65,7 +71,9 @@ KsCaptureControl::KsCaptureControl(QWidget *parent)
>   
>   		if (!_localTEP)
>   			message += "Cannot find or mount tracing directory.\n";
> -		if (!pluginList.count())
> +
> +		// geteuid() returns 0 if running as effective id of root
> +		if (!pluginList.count() && geteuid())
>   			message += "Root privileges are required.\n";
>   
>   		QLabel *errorLabel = new QLabel(message);
> 

Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>

      reply	other threads:[~2019-07-24 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 20:59 [PATCH] kernel-shark: Suppress "Root privileges are required" if already root Steven Rostedt
2019-07-24 10:37 ` Yordan Karadzhov (VMware) [this message]

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=ca2fce2f-8d04-ef94-f367-0ccc9739ef22@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).