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, 10 Jul 2007 14:12:19 -0500
From:	Dave McCracken <dave.mccracken@...cle.com>
To:	Hugh Dickins <hugh@...itas.com>
Cc:	herbert.van.den.bergh@...cle.com, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] include private data mappings in RLIMIT_DATA limit

On Tuesday 10 July 2007, Hugh Dickins wrote:
> On Tue, 10 Jul 2007, Dave McCracken wrote:
> > Given that RLIMIT_DATA is pretty much meaningless in current kernels, I
> > would put forward the argument that this change is extremely unlikely to
> > break anything because no one is currently setting it to anything other
> > than unlimited.  Adding this feature would give administrators another
> > tool, a way to control the private data size of a process without
> > restricting its ability to attach to large shared mappings.
>
> That may be a good argument (though "extremely unlikely to break"s
> have a nasty habit of biting).  I'd still say that the contribution
> to Committed_AS is more appropriate and more useful here.

You may be right... I suppose everything will bite someone somewhere with a 
sufficiently large user base.

As for whether Committed_AS is more appropriate, I'll have to defer to Herbert 
on this one.  He stated that RLIMIT_DATA no longer does what it was intended 
to do, and offered a fix for it, and I agreed with him.  I do believe his 
patch does a reasonable approximation of the original intent of RLIMIT_DATA, 
but I didn't delve into the actual intended use of it once it's fixed.

> > > That change to /proc/PID/status VmData:
> > > -	data = mm->total_vm - mm->shared_vm - mm->stack_vm;
> > > +	data = mm->total_vm - mm->shared_vm - mm->stack_vm - mm->exec_vm;
> > > looks plausible, but isn't exec_vm already counted as shared_vm,
> > > so now being doubly subtracted?  Besides which, we wouldn't want
> > > to change those numbers again without consulting Albert.
> >
> > As I recall, this was added after Herbert discovered that exec_vm is not
> > counted as shared_vm.  It's actually mapped as private/readonly.
>
> Mapped private readonly yes, but vm_stat_account() says
> 	if (file) {
> 		mm->shared_vm += pages;
> 		if ((flags & (VM_EXEC|VM_WRITE)) == VM_EXEC)
> 			mm->exec_vm += pages;

In that code shared_vm includes everything that's mmap()ed, including private 
mappings.  But if you look at Herbert's patch he has the following change:

        if (file) {
-               mm->shared_vm += pages;
+               if (flags & VM_SHARED)
+                       mm->shared_vm += pages;
                if ((flags & (VM_EXEC|VM_WRITE)) == VM_EXEC)
                        mm->exec_vm += pages;

This means that shared_vm now is truly only memory that's mapped VM_SHARED and 
does not include VM_EXEC memory.  That necessitates the separate subtraction 
of exec_vm in the data calculations.

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