Messages in this thread |  | | Date | Sat, 15 Jun 1996 18:43:21 +1000 | From | Jeremy Fitzhardinge <> | Subject | Re: 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
|  |