lkml.org 
[lkml]   [1996]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Resource limit test in binfmt_elf
Michael Meskes wrote:
> +
> + /* MM: Check if we extend resource limits */
> + /* Check proposed by Richard Henderson <rth@tamu.edu> */
> + rlim = current->rlim[RLIMIT_DATA].rlim_cur;
> + if (rlim >= RLIM_INFINITY)
> + rlim = ~0;
> + elf_ppnt = elf_phdata;
> + datasize = 0;
> + for(i=0;i < elf_ex.e_phnum; i++){
> + if(elf_ppnt->p_flags & PF_W) {

It doesn't seem like a really good idea to try and distinguish between
the various parts of an ELF file. The settings in the phdrs are only
advisory initial conditions: it would be easy to make a program which
had a large array in the "read-only" text section, which it makes
writable with mprotect(). The distinction between different parts of
a process address space are arbitary and have no real meaning except
by convention; there's no way to make hard and fast policy descisions
on that basis (that is, the distinction between "text usage" and "data
usage" is meaningless; there's only memory usage).

On the other hand, it should be OK as an early heuristic. However,
do_wp_page() should check the memory limit when it adds a new page
to the process address space.

J



\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.033 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site