On 2022/09/01 17:15, Tao Liu wrote:
>> When kernel enabled CONFIG_VMAP_STACK, stack can be allocated
to
>> vmalloced area. Currently crash didn't handle the case, as a result,
>> kmem will not print the task context as expected. This patch fix the
>> bug by checking if the address is a vmalloced stack first.
>>
>> Before:
>> crash> kmem ffffb7efce9bbe28
>> VMAP_AREA VM_STRUCT ADDRESS RANGE
SIZE
>> ffff94eb9102c640 ffff94eb9102b140 ffffb7efce9b8000 - ffffb7efce9bd000
20480
>>
>> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>> ffffdd28220dc000 1883700000 0 0 1 50000000000000
>>
>> After:
>> crash> kmem ffffb7efce9bbe28
>> PID: 847
>> COMMAND: "khungtaskd"
>> TASK: ffff94f8038f4000 [THREAD_INFO: ffff94f8038f4000]
>> CPU: 72
>> STATE: TASK_RUNNING (PANIC)
>>
>> VMAP_AREA VM_STRUCT ADDRESS RANGE
SIZE
>> ffff94eb9102c640 ffff94eb9102b140 ffffb7efce9b8000 - ffffb7efce9bd000
20480
>>
>
> I have one question: If the given physical address falls in the vmalloc area, it
won't print the task context, is that expected? For example:
>
Thanks for pointing it out. Hmm... I didn't consider the physical
address case as vtop does. I will improve the patch and send v3.
For physical address, a context is not shown also without CONFIG_VMAP_STACK.
crash> kmem ffff9288bc977f00
PID: 1
COMMAND: "systemd"
TASK: ffff9288bc978000 [THREAD_INFO: ffff9288bc974000]
CPU: 10
STATE: TASK_INTERRUPTIBLE
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffd91fc1f25dc0 7c977000 0 0 0 1fffff00000000
crash> kmem 7c977f00
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffd91fc1f25dc0 7c977000 0 0 0 1fffff00000000
Some information for virtual address is not shown with physical address,
it's kind of expected. And we have the ptov command, personally I don't
think it needs to do.
but if you change this behavior, it might be good in a separate patch.
Thanks,
Kazu