linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] kernel-shark: Do not save the settings when running as Root
Date: Fri, 18 Oct 2019 10:32:38 -0400	[thread overview]
Message-ID: <20191018103238.3b3877cb@gandalf.local.home> (raw)
In-Reply-To: <20191018074722.6976-2-y.karadz@gmail.com>

On Fri, 18 Oct 2019 10:47:21 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> Do not save the settings if KernelShark is running with Root privileges.
> Otherwise the configuration file will be owned by Root and later the
> normal user will have no access to it.

Perhaps we should have the settings saved in the root home directory?

Reason being, I run kernelshark as root all the time (on my test boxes,
where I only log in as root).

And I would still like to have the settings saved. Maybe check if the
settings path is the same as $HOME variable?

-- Steve

> 
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
>  kernel-shark/src/KsMainWindow.cpp | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
> index 3402764..6da8670 100644
> --- a/kernel-shark/src/KsMainWindow.cpp
> +++ b/kernel-shark/src/KsMainWindow.cpp
> @@ -152,9 +152,15 @@ KsMainWindow::~KsMainWindow()
>  					_session.getConfDocPtr());
>  	}
>  
> -	_settings.setValue("dataPath", _lastDataFilePath);
> -	_settings.setValue("confPath", _lastConfFilePath);
> -	_settings.setValue("pluginPath", _lastPluginFilePath);
> +	/*
> +	 * Do not save the settings if KernelShark is running with Root
> +	 * privileges. Otherwise the configuration file will be owned by Root.
> +	 */
> +	if (geteuid() != 0) {
> +		_settings.setValue("dataPath", _lastDataFilePath);
> +		_settings.setValue("confPath", _lastConfFilePath);
> +		_settings.setValue("pluginPath", _lastPluginFilePath);
> +	}
>  
>  	_data.clear();
>  


  reply	other threads:[~2019-10-18 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  7:47 [PATCH 1/3] kernel-shark: Fix simple typo in the "File" menu Yordan Karadzhov (VMware)
2019-10-18  7:47 ` [PATCH 2/3] kernel-shark: Do not save the settings when running as Root Yordan Karadzhov (VMware)
2019-10-18 14:32   ` Steven Rostedt [this message]
2019-10-23 10:49     ` Yordan Karadzhov (VMware)
2019-10-23 11:59       ` Steven Rostedt
2019-10-18  7:47 ` [PATCH 3/3] kernel-shark: Fix potential memory leak in libkshark-collection Yordan Karadzhov (VMware)

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=20191018103238.3b3877cb@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=y.karadz@gmail.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;
as well as URLs for NNTP newsgroup(s).