add alignment check of virtual address to exec()
This commit is contained in:
parent
a7c03bd914
commit
67a7f9597e
2
exec.c
2
exec.c
|
@ -46,6 +46,8 @@ exec(char *path, char **argv)
|
||||||
goto bad;
|
goto bad;
|
||||||
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
|
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
if(ph.vaddr % PGSIZE != 0)
|
||||||
|
goto bad;
|
||||||
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
|
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue