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>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] kernel-shark: Do not save the settings when running as Root
Date: Wed, 23 Oct 2019 13:49:25 +0300	[thread overview]
Message-ID: <05ece807-fb3f-fda5-e1f7-e04a63a1d0aa@gmail.com> (raw)
In-Reply-To: <20191018103238.3b3877cb@gandalf.local.home>



On 18.10.19 г. 17:32 ч., Steven Rostedt wrote:
> 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?
> 

OK I think I have a solution that does a better job. Do you prefer to 
resend all 3 patches or just this one?

Thanks!
Yordan


> -- 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-23 10:49 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
2019-10-23 10:49     ` Yordan Karadzhov (VMware) [this message]
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=05ece807-fb3f-fda5-e1f7-e04a63a1d0aa@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).