Kernel: improve stacktrace printing

- corrupt stack traces could trigger a kernel panic;
- output consistency and spelling.

Change-Id: I04c9ac7db77593d6e837a28c83f1734adc8d9da7
This commit is contained in:
David van Moolenbroek 2015-09-03 03:12:33 +02:00
parent 1d9856e713
commit d09f72c453
2 changed files with 6 additions and 2 deletions

View file

@ -314,7 +314,7 @@ static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc
}
printf("0x%lx ", (unsigned long) v_pc);
if(v_hbp != 0 && v_hbp <= v_bp) {
printf("(hbp %lx ?)", v_hbp);
printf("(hbp 0x%lx ?)", v_hbp);
break;
}
v_bp = v_hbp;
@ -335,7 +335,7 @@ void proc_stacktrace(struct proc *whichproc)
u32_t use_bp;
if(whichproc->p_seg.p_kern_trap_style == KTS_NONE) {
printf("WARNING: stacktrace of running proecss\n");
printf("WARNING: stacktrace of running process\n");
}
switch(whichproc->p_seg.p_kern_trap_style) {

View file

@ -192,6 +192,10 @@ static int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
if(changed)
reload_cr3();
/* 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);