Changeset 343f2b7e in mainline


Ignore:
Timestamp:
2010-09-04T09:06:24Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
76e1121f
Parents:
0c39b96
Message:

Add extra bound checks into mips32 stack tracer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/debug/stacktrace.c

    r0c39b96 r343f2b7e  
    9696extern char ktext_end;
    9797
     98static bool bounds_check(uintptr_t pc)
     99{
     100        return (pc >= (uintptr_t) &ktext_start) &&
     101            (pc < (uintptr_t) &ktext_end);
     102}
     103
    98104static bool
    99105scan(stack_trace_context_t *ctx, uintptr_t *prev_fp, uintptr_t *prev_ra)
     
    106112        do {
    107113                inst--;
     114                if (!bounds_check((uintptr_t) inst))
     115                        return false;
    108116#if 0
    109117                /*
     
    207215{
    208216        return !((ctx->fp == 0) || ((ctx->fp % 8) != 0) ||
    209             (ctx->pc % 4 != 0) || (ctx->pc < (uintptr_t) &ktext_start) ||
    210             (ctx->pc >= (uintptr_t) &ktext_end));
     217            (ctx->pc % 4 != 0) || !bounds_check(ctx->pc));
    211218}
    212219
Note: See TracChangeset for help on using the changeset viewer.