[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] [RFC][patch] Fix crash in _ULx86_64_tdep_trace whe

From: Paul Pluzhnikov
Subject: Re: [Libunwind-devel] [RFC][patch] Fix crash in _ULx86_64_tdep_trace when sigaltstack is too far away
Date: Fri, 11 Nov 2011 13:13:24 -0800

On Fri, Nov 11, 2011 at 12:10 PM, Lassi Tuura <address@hidden> wrote:
> Hi,
>> Ah, I see. But we could record delta here as well; just use 62 bits for it.
> Actually if I understand correctly how the altstack works, you won't need
> even the 62-bit offset. I think the sigcontext sits on the altstack, right,
> and it's the restored RBP/RSP value deltas that are the real problem?
> If so I think you can just record into cfa_reg_offset the delta to the
> sigcontext_addr as the code does now, but leave {rsp,rbp}_cfa_offset 0.

But the problem is that we only have 30 bits there, and I know of no reason
to believe that alternate stack can't be further away from regular stack
than that.

In my actual crash the cfa_reg_offset in fact did not overflow, only the
{rsp,rbp}_cfa_offset did, so maybe there is a reason why cfa_reg_offset
can't overflow 30 bits?

> Then we change the registers to be restored using UC_MCONTEXT_REGS_*,
> as you did, not using the delta expressions.

That's effectively my patch (changed to record delta). In essense we then
use 62 bits for cfa_reg_offset (that is now called cfa_sigcontext_offset).

> Effectively, we'll use the DWARF info for CFA expression, but assume that
> registers actually do come from the ucontext_t. For extra security we can
> verify the DWARF locations match what we expect tdep_stash_frame(), maybe
> under UNW_DEBUG.
> How does that sound to you?


I'll send updated patch shortly.

Paul Pluzhnikov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]