add alignment check of virtual address to exec()

This commit is contained in:
MikeCAT 2015-12-19 23:43:56 +09:00 committed by Frans Kaashoek
parent a7c03bd914
commit 67a7f9597e

2
exec.c
View file

@ -46,6 +46,8 @@ exec(char *path, char **argv)
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
if(ph.vaddr % PGSIZE != 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}