diff options
author | Robert Morris <rtm@csail.mit.edu> | 2020-08-19 12:35:14 -0400 |
---|---|---|
committer | Frans Kaashoek <kaashoek@mit.edu> | 2020-08-21 11:00:45 -0400 |
commit | 5860dcd07d9a9cba5c7ebf7488636d131015316d (patch) | |
tree | 6e6581500c59d692267bdc1980dcd21f123ee6fb /kernel/exec.c | |
parent | d4d487731ad760376999130fc2ad520c3dd6166c (diff) | |
download | xv6-labs-5860dcd07d9a9cba5c7ebf7488636d131015316d.tar.gz xv6-labs-5860dcd07d9a9cba5c7ebf7488636d131015316d.tar.bz2 xv6-labs-5860dcd07d9a9cba5c7ebf7488636d131015316d.zip |
usertest for exec() out of memory recovery
and fix a few exec() bugs
Diffstat (limited to 'kernel/exec.c')
-rw-r--r-- | kernel/exec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/exec.c b/kernel/exec.c index 8a2d1dc..0e8762f 100644 --- a/kernel/exec.c +++ b/kernel/exec.c @@ -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; |