ULIMIT: limiting user virtual address space (stack inluded)

Greg KH greg at kroah.com
Thu May 2 10:24:19 EDT 2019


On Thu, May 02, 2019 at 09:06:09AM -0400, Karaoui mohamed lamine wrote:
> Hi all,
> 
> According to the man page of "ulimit", it is possible to limit the virtual
> address space of a user process: https://ss64.com/bash/ulimit.html
> To limit the virtual address space to 2 GB:
> $ ulimit -SH -v 1048576
> 
> However, it seems that "stack" allocation ignores this limit (I tried with
> both kernel 4.4 and 4.15).
> 
> I found this article (patch) that seems to fix the problem:
> https://lwn.net/Articles/373701/
> 
> My questions are:
> - Why is the stack allocation not placed within the "ulimit" limit? (is it
> a bug?)
> - Is there a way, in user space, to force the stack to be allocated at a
> certain address?
> - Will the patch above (or similar) ever be integrated into the Linux
> kernel?

The patch above was integrated into the 2.6.33 kernel, and backported to
2.6.32.9 and fixed in 2.6.32.10.  All of those kernels were released in
2010, quite a long time ago.

Are you sure you are hitting the same "problem"?

thanks,

greg k-h



More information about the Kernelnewbies mailing list