diff options
| author | Alexander Kabaev <kan@FreeBSD.org> | 2002-10-23 01:57:39 +0000 |
|---|---|---|
| committer | Alexander Kabaev <kan@FreeBSD.org> | 2002-10-23 01:57:39 +0000 |
| commit | 96725dd01a58578b51a1551fa51b49dfc6e14308 (patch) | |
| tree | 8d3cc46063e6c1a396e499979e51829edef0b1a5 | |
| parent | 1d5e8e35b5d8d5b5c56ec46bfe55cc97cf70f885 (diff) | |
Notes
| -rw-r--r-- | sys/kern/imgact_elf.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 78b78a86932a..6f42df61b897 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -760,20 +760,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) data_addr = seg_addr; } total_size += seg_size; - - /* - * Check limits. It should be safe to check the - * limits after loading the segment since we do - * not actually fault in all the segment's pages. - */ - if (data_size > - imgp->proc->p_rlimit[RLIMIT_DATA].rlim_cur || - text_size > maxtsiz || - total_size > - imgp->proc->p_rlimit[RLIMIT_VMEM].rlim_cur) { - error = ENOMEM; - goto fail; - } break; case PT_PHDR: /* Program header table info */ proghdr = phdr[i].p_vaddr; @@ -782,6 +768,25 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) break; } } + + if (data_addr == 0 && data_size == 0) { + data_addr = text_addr; + data_size = text_size; + } + + /* + * Check limits. It should be safe to check the + * limits after loading the segments since we do + * not actually fault in all the segments pages. + */ + if (data_size > + imgp->proc->p_rlimit[RLIMIT_DATA].rlim_cur || + text_size > maxtsiz || + total_size > + imgp->proc->p_rlimit[RLIMIT_VMEM].rlim_cur) { + error = ENOMEM; + goto fail; + } vmspace->vm_tsize = text_size >> PAGE_SHIFT; vmspace->vm_taddr = (caddr_t)(uintptr_t)text_addr; |
