From: David van Moolenbroek Date: Thu, 3 Sep 2015 01:12:33 +0000 (+0200) Subject: Kernel: improve stacktrace printing X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F3073%2F1;p=minix.git Kernel: improve stacktrace printing - corrupt stack traces could trigger a kernel panic; - output consistency and spelling. Change-Id: I04c9ac7db77593d6e837a28c83f1734adc8d9da7 --- diff --git a/minix/kernel/arch/i386/exception.c b/minix/kernel/arch/i386/exception.c index 08e73e419..3317ebbbd 100644 --- a/minix/kernel/arch/i386/exception.c +++ b/minix/kernel/arch/i386/exception.c @@ -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) { diff --git a/minix/kernel/arch/i386/memory.c b/minix/kernel/arch/i386/memory.c index 17a97dd84..b07d685f4 100644 --- a/minix/kernel/arch/i386/memory.c +++ b/minix/kernel/arch/i386/memory.c @@ -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);