]> Zhao Yanbai Git Server - minix.git/commitdiff
Kernel: improve stacktrace printing 73/3073/1
authorDavid van Moolenbroek <david@minix3.org>
Thu, 3 Sep 2015 01:12:33 +0000 (03:12 +0200)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 7 Sep 2015 22:56:00 +0000 (22:56 +0000)
- corrupt stack traces could trigger a kernel panic;
- output consistency and spelling.

Change-Id: I04c9ac7db77593d6e837a28c83f1734adc8d9da7

minix/kernel/arch/i386/exception.c
minix/kernel/arch/i386/memory.c

index 08e73e419c41f3cae097b233ea39c68f2cad27df..3317ebbbd4510bf79eb222ee2c837ec6e93cfd1d 100644 (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) {
index 17a97dd84ccd7857e213c4ef856be4d97a0f115e..b07d685f403dea60aa1bac9630376f976fcdee46 100644 (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);