Re: [PATCH] ARM : unwinder : Prevent data abort due to stack overflow

From: Dave Martin
Date: Mon Dec 09 2013 - 09:23:01 EST


On Sat, Dec 07, 2013 at 01:43:21PM +0530, Anurag Aggarwal wrote:
> >>
> >> + /* we are just starting, initialize last register set as 0 */
> >> + ctrl.last_register_set = 0;
> >> +
> >> while (ctrl.entries > 0) {
> >> - int urc = unwind_exec_insn(&ctrl);
> >> + int urc;
> >> + if ((ctrl.sp_high - ctrl.vrs[SP]) < TOTAL_REGISTERS)
> >> + ctrl.last_register_set = 1;
> >
> >If this is done once per unwind_exec_insn(), I think it would be better
> >to put the check at the start of unwind_exec_insn() instead of outside.
>
> I think it is better to do the above check here only because this check
> is strictly not a part of decoder and execution cycle.
>
> I think uniwnd_exec_insn(), should only be used for decoding and
> execution of instruction, as you have suggested earlier. So, it makes
> sense to keep it in unwind_frame only().

It's debatable, since the stack checking is an intrinsic part of insn
execution. But since there is only one call site for unwind_exec_insn
and it is unlikely than another will appear in the future, I am happy
for it to remain in your current form.

Cheers
---Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/