lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Dec 2011 13:58:40 +0200
From:	Avi Kivity <avi@...hat.com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Robert Richter <robert.richter@....com>,
	Benjamin Block <bebl@...eta.org>,
	Hans Rosenfeld <hans.rosenfeld@....com>, hpa@...or.com,
	tglx@...utronix.de, suresh.b.siddha@...el.com, eranian@...gle.com,
	brgerst@...il.com, Andreas.Herrmann3@....com, x86@...nel.org,
	linux-kernel@...r.kernel.org,
	Benjamin Block <benjamin.block@....com>
Subject: Re: [RFC 4/5] x86, perf: implements lwp-perf-integration (rc1)

On 12/19/2011 01:40 PM, Ingo Molnar wrote:
>
> 2) the proper solution: creating a 'user-space vmalloc()' that 
>    is per mm and that gets inherited transparently, across 
>    fork() and exec(), and which lies outside the regular vma
>    spaces. On 64-bit this should be straightforward.

That probably has uses outside perf too, but I can see mm nacks piling up.

>    These vmas are not actually 'known' to user-space normally -
>    the kernel PMU code knows about it and does what we do with
>    PEBS: flushes it when necessary and puts it into the
>    regular perf event channels.
>
>    This solves the inherited perf record workflow immediately:
>    the parent task just creates the buffer, which gets inherited 
>    across exec() and fork(), into every portion of the workload.

The buffer still needs to be managed.  While you may be able to juggle
different threads on the same cpu using different events, threads on
other cpus need to use separate LWP contexts and buffers.

>
>    System-wide profiling is a small additional variant of this: 
>    creating such a user-vmalloc() area for all tasks in the
>    system so that the PMU code has them ready in the 
>    context-switch code.

What about security?  Do we want to allow any userspace process to mess
up the buffers?  It can even reprogram the LWP block, so you're counting
different things, or at higher frequencies, or into other processes
ordinary vmas?

You could rebuild the LWP block on every context switch I guess, but you
need to prevent access to other cpus' LWP blocks (since they may be
running other processes).  I think this calls for per-cpu cr3, even for
threads in the same process.

> Solution #2 has the additional advantage that we could migrate 
> PEBS to it and could allow interested user-space access to the 
> 'raw' PEBS buffer as well. (currently the PEBS buffer is only 
> visible to kernel-space.)

That's probably useful for jits.

> I'd suggest the easy hack first, to get things going - we can 
> then help out with the proper solution.

I think you're underestimating the complexity there.  LWP wasn't
designed for this.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ