The dtrace_user_stacktrace() functions for x86_64 and sparc64 were
not handling the specified limit (st->limit correctly if the buffer
for PC values (st->pcs) was NULL. This commit ensures that we
decrement the limit whenever we encounter a PC, whether it gets
stored or not.
Orabug:
25949692
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
flush_user_windows();
st->depth = 1;
- if (pcs) {
+ if (pcs)
*pcs++ = (uint64_t)instruction_pointer(regs);
- limit--;
- }
+ limit--;
if (!limit)
goto out;
addr = ((struct reg_window32 *)(&t->reg_window[window]))->ins[7];
}
- if (pcs) {
+ if (pcs)
*pcs++ = addr;
- limit--;
- }
+ limit--;
st->depth++;
if (!limit)
if (ret)
break;
- if (pcs) {
+ if (pcs)
*pcs++ = addr;
- limit--;
- }
+ limit--;
st->depth++;
pagefault_disable();
bos = current->dtrace_psinfo->ustack;
st->depth = 1;
- if (pcs) {
+ if (pcs)
*pcs++ = (uint64_t)instruction_pointer(regs);
- limit--;
- }
+ limit--;
if (!limit)
goto out;
if (ret)
break;
- if (dtrace_user_addr_is_exec(pc) && pcs) {
- *pcs++ = pc;
+ if (dtrace_user_addr_is_exec(pc)) {
+ if (pcs)
+ *pcs++ = pc;
limit--;
+ st->depth++;
}
- st->depth++;
sp++;
}