82 switch (validate_addr(*sp, generic_arg)){
83 case UNW_ADDR_CONFIRMED:
84 TMSG(TROLL,
"found a confirmed valid return address %p at sp = %p", \
86 *ra_pos = (uintptr_t)sp - (uintptr_t)start_sp;
89 case UNW_ADDR_PROBABLE_INDIRECT:
90 TMSG(TROLL,
"found a likely (from indirect call) valid return address %p at sp = %p", \
92 *ra_pos = (uintptr_t)sp - (uintptr_t)start_sp;
95 case UNW_ADDR_PROBABLE_TAIL:
96 TMSG(TROLL,
"found a likely (from tail call) valid return address %p at sp = %p", \
98 *ra_pos = (uintptr_t)sp - (uintptr_t)start_sp;
101 case UNW_ADDR_PROBABLE:
102 TMSG(TROLL,
"found a likely valid return address %p at sp = %p", \
104 *ra_pos = (uintptr_t)sp - (uintptr_t)start_sp;
108 TMSG(TROLL_CHK,
"infinite loop detected with return address %p at sp = %p", \
113 TMSG(TROLL_CHK,
"provably invalid return address %p at sp = %p", \
118 EMSG(
"UNKNOWN return code from validate_addr in Trolling code %p at sp = %p",
125 TMSG(TROLL,
"(sp=%p): failed using limit %d", start_sp, TROLL_LIMIT);
static const int TROLL_LIMIT
validation_status(* validate_addr_fn_t)(void *addr, void *generic_arg)
troll_status stack_troll(void **start_sp, uint *ra_pos, validate_addr_fn_t validate_addr, void *generic_arg)