Kernel: apply x86 copy overflow check to ARM
Apply the x86 overflow check from git-d09f72c to ARM code as well. Not just stack traces, but also system services can trigger this case, possibly as a result of being handed bad pointers by userland, ending in a kernel panic. Change-Id: Ib817e8b682fafec8edb486a094319ad11eda7081
This commit is contained in:
parent
f12160c14d
commit
59f1f7ecdd
@ -193,9 +193,13 @@ static int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
/* Set up 1MB ranges. */
|
||||
srcptr = createpde(srcproc, srclinaddr, &chunk, 0, &changed);
|
||||
dstptr = createpde(dstproc, dstlinaddr, &chunk, 1, &changed);
|
||||
if(changed) {
|
||||
if(changed)
|
||||
reload_ttbr0();
|
||||
}
|
||||
|
||||
/* Check for overflow. */
|
||||
if (srcptr + chunk < srcptr) return EFAULT_SRC;
|
||||
if (dstptr + chunk < dstptr) return EFAULT_DST;
|
||||
|
||||
/* Copy pages. */
|
||||
PHYS_COPY_CATCH(srcptr, dstptr, chunk, addr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user