usertest for exec() out of memory recovery
and fix a few exec() bugs
This commit is contained in:
parent
d4d487731a
commit
5860dcd07d
3 changed files with 42 additions and 4 deletions
|
@ -67,8 +67,10 @@ exec(char *path, char **argv)
|
|||
// Allocate two pages at the next page boundary.
|
||||
// Use the second as the user stack.
|
||||
sz = PGROUNDUP(sz);
|
||||
if((sz = uvmalloc(pagetable, sz, sz + 2*PGSIZE)) == 0)
|
||||
uint64 sz1;
|
||||
if((sz1 = uvmalloc(pagetable, sz, sz + 2*PGSIZE)) == 0)
|
||||
goto bad;
|
||||
sz = sz1;
|
||||
uvmclear(pagetable, sz-2*PGSIZE);
|
||||
sp = sz;
|
||||
stackbase = sp - PGSIZE;
|
||||
|
|
|
@ -436,10 +436,9 @@ sys_exec(void)
|
|||
}
|
||||
argv[i] = kalloc();
|
||||
if(argv[i] == 0)
|
||||
panic("sys_exec kalloc");
|
||||
if(fetchstr(uarg, argv[i], PGSIZE) < 0){
|
||||
goto bad;
|
||||
}
|
||||
if(fetchstr(uarg, argv[i], PGSIZE) < 0)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
int ret = exec(path, argv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue