public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Michal Privoznik <mprivozn@redhat.com>
Cc: trenn@suse.de, rafael.j.wysocki@intel.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpupower: Correctly detect if running as root
Date: Sun, 14 Dec 2014 22:29:24 +0100	[thread overview]
Message-ID: <1660884.y6rjWabQcf@vostro.rjw.lan> (raw)
In-Reply-To: <b03faaf6b63a9175da0ce7ab8e0fc3da0cba4a86.1418560562.git.mprivozn@redhat.com>

On Sunday, December 14, 2014 01:36:52 PM Michal Privoznik wrote:
> Some operations, like frequency-set, need root privileges. However,
> the way that this is detected is not correct. The getuid() is called,
> while in fact geteuid() should be. This way we can allow
> distributions or users to set SETUID flags on the cpupower binary if
> they want to and let regular users change the cpu frequency governor.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

An ACK from Thomas is needed.

> ---
>  tools/power/cpupower/utils/cpupower.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/power/cpupower/utils/cpupower.c b/tools/power/cpupower/utils/cpupower.c
> index 7cdcf88..9ea9143 100644
> --- a/tools/power/cpupower/utils/cpupower.c
> +++ b/tools/power/cpupower/utils/cpupower.c
> @@ -199,7 +199,7 @@ int main(int argc, const char *argv[])
>  	}
>  
>  	get_cpu_info(0, &cpupower_cpu_info);
> -	run_as_root = !getuid();
> +	run_as_root = !geteuid();
>  	if (run_as_root) {
>  		ret = uname(&uts);
>  		if (!ret && !strcmp(uts.machine, "x86_64") &&
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2014-12-14 21:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14 12:36 [PATCH] cpupower: Correctly detect if running as root Michal Privoznik
2014-12-14 21:29 ` Rafael J. Wysocki [this message]
2014-12-17 16:22   ` Thomas Renninger
  -- strict thread matches above, loose matches on Subject: below --
2014-12-24 11:08 Michal Privoznik

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=1660884.y6rjWabQcf@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mprivozn@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=trenn@suse.de \
    /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