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:	Tue, 07 Apr 2009 10:29:21 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	"Metzger, Markus T" <markus.t.metzger@...el.com>
Cc:	"mingo@...e.hu" <mingo@...e.hu>,
	"tglx@...utronix.de" <tglx@...utronix.de>,
	"hpa@...or.com" <hpa@...or.com>,
	"markus.t.metzger@...il.com" <markus.t.metzger@...il.com>,
	"roland@...hat.com" <roland@...hat.com>,
	"eranian@...glemail.com" <eranian@...glemail.com>,
	"oleg@...hat.com" <oleg@...hat.com>,
	"Villacis, Juan" <juan.villacis@...el.com>,
	"ak@...ux.jf.intel.com" <ak@...ux.jf.intel.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: RE: [patch 03/20] x86, ptrace, bts: defer branch trace stopping

On Tue, 2009-04-07 at 09:12 +0100, Metzger, Markus T wrote:
> >-----Original Message-----
> >From: Peter Zijlstra [mailto:a.p.zijlstra@...llo.nl]
> >Sent: Saturday, April 04, 2009 1:13 PM
> >To: Metzger, Markus T
> >Cc: mingo@...e.hu; tglx@...utronix.de; hpa@...or.com; markus.t.metzger@...il.com; roland@...hat.com;
> >eranian@...glemail.com; oleg@...hat.com; Villacis, Juan; ak@...ux.jf.intel..com; linux-
> >kernel@...r.kernel.org; Andrew Morton
> >Subject: RE: [patch 03/20] x86, ptrace, bts: defer branch trace stopping
> >
> >On Sat, 2009-04-04 at 08:17 +0100, Metzger, Markus T wrote:
> >> >-----Original Message-----
> >> >From: Peter Zijlstra [mailto:a.p.zijlstra@...llo.nl]
> >> >Sent: Friday, April 03, 2009 5:01 PM
> >> >To: Metzger, Markus T
> >>
> >>
> >> >Also, I can't say I like the name, what about something like:
> >> >
> >> >void account_locked_buffer(struct mm_struct *mm, long pages)
> >> >{
> >> >	down_write(&mm->mmap_sem);
> >> >
> >> >	mm->total_vm += pages;
> >> >	mm->locked_vm += pages;
> >> >
> >> >	up_write(&mm->mmap_sem);
> >> >}
> >> >
> >> >but looking more closely at that alloc_locked_buffer() stuff, I really
> >> >hate it, who in his right mind does a multi-page kmalloc() -- that's
> >> >crazy.
> >>
> >> I need a non-pageable chunk of memory to give to the cpu to store branch
> >> trace data in. Kmalloc() is easy to use and gives me what I need.
> >>
> >> How would I do this correctly?
> >
> >Well, how large should this buffer be and must it be physically
> >contiguous?
> 
> The size is set by the user. It is limited by (locked memory) RLIMIT.
> 
> The buffer need not be physically contiguous, but it must not be paged out
> and should be marked accessed and dirty.
> (see ยง18.7.8.2 in vol. 3b, Software Developer's Manual).

The Intel one I presume?

Ok, if you must mark the pages accessed and dirty you should get whole
pages, otherwise you cannot make that promise on the ptes, right?

> >Apparently its large enough to account in pages, that would suggest you
> >should use the page allocator to get memory.
> 
> Wouldn't kmalloc forward the request to the page allocator for large memory?

It may, but doesn't need to.

> >Furthermore, if it needs to be physically contiguous and its more than
> >say 8 pages worth, you're basically up shit creek.
> 
> If not enough memory is available, I would expect users to request smaller
> buffers until the request can be satisfied.

Sounds like a very bad interface, esp since you don't need physically
contiguous memory.

So what you need to do is allocate pages, order-0, grab a reference,
then vmap them into a linear piece, poke at the ptes to set the young
and dirty bits and provide that to your hardware.



--
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