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]
Message-ID: <20081216173059.GD11683@elte.hu>
Date:	Tue, 16 Dec 2008 18:30:59 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Markus Metzger <markus.t.metzger@...el.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	linux-kernel@...r.kernel.org, tglx@...utronix.de, hpa@...or.com,
	markus.t.metzger@...il.com, roland@...hat.com,
	eranian@...glemail.com
Subject: Re: [rfc] x86, ptrace: memory accounting for branch tracing


* Markus Metzger <markus.t.metzger@...el.com> wrote:

> Account memory allocated for the BTS buffer to the traced task's 
> total_vm and locked_vm.

Andrew, is this the right (and preferred) way to attach BTS buffer 
allocation overhead to the RLIMIT_MEMLOCK bucket:

> +static int ptrace_bts_allocate_buffer(struct task_struct *child, size_t size)
> +{
> +	unsigned long rlim, vm, pgsz;
> +	int error = -ENOMEM;
> +
> +	pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
> +
> +	down_write(&child->mm->mmap_sem);
> +
> +	rlim = child->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
> +	vm   = child->mm->total_vm + pgsz;
> +	if (rlim < vm)
> +		goto out;
> +
> +	rlim = child->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
> +	vm   = child->mm->locked_vm + pgsz;
> +	if (rlim < vm)
> +		goto out;
> +
> +	child->bts_buffer = kzalloc(size, GFP_KERNEL);
> +	if (!child->bts_buffer)
> +		goto out;
> +
> +	child->bts_size = size;
> +
> +	child->mm->total_vm  += pgsz;
> +	child->mm->locked_vm += pgsz;
> +
> +	error = 0;
> + out:
> +	up_write(&child->mm->mmap_sem);
> +	return error;

?

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