On 16.11.2026 11:32, Jan Beulich wrote:
> On 10.11.2026 14:15, Andrew Cooper wrote:
>> On 09/11/2026 1:09 pm, Jan Beulich wrote:
>>> +        for ( n = 0; (unsigned long)ptr & (PAGE_SIZE - sizeof(*ptr)); ++n )
>>> +        {
>>> +            unsigned long val = *ptr;
>>> +
>>> +            if ( is_active_kernel_text(val) || in_stub(val) )
>>> +            {
>>> +                /* Normal return address entry.  */
>>> +                printk("   [<%p>] C %pS\n", _p(val), _p(val));
>>> +                ++ptr;
>>> +            }
>>> +            else if ( !((val ^ (unsigned long)ptr) >>
>>> +                        (PAGE_SHIFT + STACK_ORDER)) )
>>> +            {
>>> +                if ( val & (sizeof(val) - 1) )
>>> +                {
>>> +                    /* Most likely a supervisor token. */
>>> +                    break;
>>> +                }
>>> +
>>> +                /*
>>> +                 * Ought to be a hypervisor interruption frame.  But don't
>>> +                 * (re)log the current frame's %rip.
>>> +                 */
>>> +                if ( n || ptr[1] != regs->rip )
>>> +                    printk("   [<%p>] E %pS\n", _p(ptr[1]), _p(ptr[1]));
>>
>> Ah - this n is the thing covering the fact that you didn't move to the
>> outer context originally.  Please do that and drop this.
> 
> Why would I duplicate the move-to-outer-context code (just below)? We may
> need to move between contexts more than once, after all.
> 
>> If we're going to start using E here, we should make the FRAME_POINTER
>> side match.
> 
> Perhaps, but not in this patch.
> 
>>   When printing something we've identified as a stub, we
>> ought to say "in stub" rather than leaving it as a raw number.
> 
> Can do, albeit like you said for the use of E above this then likely wants
> mirroring to normal frames as well, again not in this patch though. (At
> which point the #ifdef you complained about above would simply go away.)
> Will you be okay with
> 
>             if ( is_active_kernel_text(val) )
>             {
>                 /* Normal return address entry.  */
>                 printk("   [<%p>] C %pS\n", _p(val), _p(val));
>                 ++ptr;
>             }
>             else if ( in_stub(val) )
>             {
>                 /* Stub return address entry.  */
>                 printk("   [<%p>] C <stub>\n", _p(val));
>                 ++ptr;
>             }
>             else if ( ... )
> 
> ?

Hmm, something similar would then be needed for the E case as well. (In
fact the above should be extremely unlikely to take effect, as in the
middle of a stub there shouldn't normally occur anything other than
exceptions.)

Jan

Reply via email to