mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Stephane Eranian <eranian@hpl.hp.com>,
	perfmon@napali.hpl.hp.com
Subject: Re: [PATCH 13/22] 2.6.22-rc3 perfmon2 : common core functions
Date: Mon, 4 Jun 2007 04:56:48 -0700	[thread overview]
Message-ID: <20070604115648.GB8614@frankl.hpl.hp.com> (raw)
In-Reply-To: <p73ira9ca0d.fsf@bingen.suse.de>

Andi,

On Thu, May 31, 2007 at 05:01:38PM +0200, Andi Kleen wrote:
> > +   * pmu_desc: subdir containing the PMU register mapping information
> > +
> > +   * reset_stats(W): echo 0 > reset_stats resets the statistics collected by perfmon2.
> > +   		stats are available per-cpu in /sys/devices/system/cpu/cpu*/perfmon
> > +   	
> > +   * smpl_buffer_mem_cur(RO): reports the amount of memory currently dedicated to sampling
> > +   		buffers by the kernel.
> > +
> > +   * smpl_buffer_mem_max(RW): maximum amount of memory usable for sampling buffers.
> > +   		-1 means all that is available.
> 
> -1 seems dangerous. 
> 
> > +
> > +   * sys_group(RW): which users group is allowed to create a system-wide contexts.
> > +   		-1 means any group
> 
> Wouldn't this better be a capability bit? Then it could be just set
> in the normal pam configuration files.
> 
> > +
> > +   * sys_sessions_count(RO): number of loaded system-wide contexts
> > +
> > +   * task_group(RW): which users group is allowed to create per-thread contexts.
> > +   		-1 means any group
> 

I spent quite some time looking at the kernel code for capabilities and also how to
control them from userland. I agree with you that it would be nicer to use capabilities
to control which users can create system-wide or per-thread perfmon sessions. We could
simply create two new capabilities: CAP_PERFMON_SYS and CAP_PERFMON_THREAD. Then,
I can envision a setup where a sysadmin would grant the capabilities to users when they login
via PAM.

There are two problems with this at the moment:

	- the 32bit for capabilities have been exhausted (kernel_cap_t is u32). We would
	  need to increase to u64. That would impact __user_cap_data_struct which is used
	  by the captset()/capget() syscalls.

	- I have not been able to find how one could grant/deny capabilities via PAM and
	  especially for login. Libcap does not seem to be used. There was a pam_cap at
	  some point, it seems abandonned by now.  I am not a linux security
	  expert, so there may be newer ways of setting capabilities for processes.

Any comments?

-- 
-Stephane

  parent reply	other threads:[~2007-06-04 11:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-29 13:48 Stephane Eranian
2007-05-31 15:01 ` Andi Kleen
2007-05-31 17:16   ` Stephane Eranian
2007-05-31 17:28     ` Andi Kleen
2007-05-31 18:29       ` Christoph Hellwig
2007-05-31 18:43         ` Andi Kleen
2007-05-31 18:53           ` Christoph Hellwig
2007-05-31 19:02             ` Andi Kleen
2007-05-31 20:44       ` Stephane Eranian
2007-06-04 11:56   ` Stephane Eranian [this message]
     [not found]   ` <20070601101648.GD24898@frankl.hpl.hp.com>
     [not found]     ` <20070601105753.GE7217@one.firstfloor.org>
2007-06-12 12:32       ` problem with NMI MSR reserve routines Stephane Eranian

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=20070604115648.GB8614@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perfmon@napali.hpl.hp.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

all inboxes | Powered by JetHome®