Skip to contentSkip to conversation

Query: Crash is coming during /prod/PID/stat and do_exit of same task

DISCUSSION Alexey Dobriyan 2 participants 4 messages Jan 10, 2018 – Jan 16, 2018 Arm Qualcomm mailing list

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

We are seeing crash in do_task_stat while accessing stack pointer, It seems same task has already completed do_exit call.
So it seems a race between them:

Please, post exact kernel version and struct task_struct::usage if you still have that kernel core (or even full task_struct)

#1 lore raw
Quoted 5 lines · Alexey Dobriyan
Quoted 3 lines

We are seeing crash in do_task_stat while accessing stack pointer, It seems same task has already completed do_exit call.
So it seems a race between them:

Please, post exact kernel version and struct task_struct::usage if you still have that kernel core (or even full task_struct)

Hi Alexey,

We are working on 4.9.65 and Please find below usage value and other task_struct value, please let me know if some other data required as well.

crash_64> struct task_struct.usage -x  0xFFFFFFE80D8C2280

  usage = {

    counter = 0x4

  }

struct task_struct.flags -x 0xFFFFFFE80D8C2280

  flags = 0x40870c

crash_64> struct task_struct.exit_code -x 0xFFFFFFE80D8C2280

  exit_code = 0x6

 struct task_struct.state -x 0xFFFFFFE80D8C2280

  state = 0x40

Please find below crash stack:

-000|user_stack_pointer(inline)

-000|do_task_stat(

    |    m = 0xFFFFFFE7A5CD7380,

    |    ns = 0xFFFFFF8E7C43C748,

    |  ?,

    |    task = 0xFFFFFFE80D8C2280,

    |  ?)

    |  tty_pgrp = 0

    |  ppid = 2084696064

    |  sid = 0

    |  mm = 0xFFFFFFE7B4424140

    |  tcomm = (84, 9, 71, 122, 142, 255, 255, 255, 48, 253, 240, 165, 231, 255, 255, 255)

    |  flags = 18446743969119403392

-001|proc_tgid_stat(

    |    m = 0xFFFFFFE7A5CD7380,

    |  ?,

    |  ?,

    |  ?)

-002|atomic_sub_return(inline)

Regards
Gaurav

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
#2 lore raw
Quoted 5 lines · Gaurav
Quoted 3 lines · Alexey Dobriyan
Quoted 3 lines

We are seeing crash in do_task_stat while accessing stack pointer, It seems same task has already completed do_exit call.
So it seems a race between them:

Quoted 7 lines
Quoted 2 lines

Please, post exact kernel version and struct task_struct::usage if you still have that kernel core (or even full task_struct)

Hi Alexey,

We are working on 4.9.65 and Please find below usage value and other task_struct value, please let me know if some other data required as well.

Kernel stacks live their own lives nowadays, the code needs try_get_task_stack().

#3 lore raw
Quoted 6 lines · Alexey Dobriyan
Quoted 5 lines · Gaurav
Quoted 3 lines · Alexey Dobriyan
Quoted 3 lines

We are seeing crash in do_task_stat while accessing stack pointer, It seems same task has already completed do_exit call.
So it seems a race between them:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Please, post exact kernel version and struct task_struct::usage if you still have that kernel core (or even full task_struct)

Hi Alexey,

We are working on 4.9.65 and Please find below usage value and other task_struct value, please let me know if some other data required as well.

Kernel stacks live their own lives nowadays, the code needs try_get_task_stack().

Hi Alexey,

Yes , agree we have to put some check like below

  if (permitted && (task->flags & PF_DUMPCORE) && try_get_task_stack(task)) {

                        eip = KSTK_EIP(task);

                        esp = KSTK_ESP(task);

                }

Or instead of this also , can't we check whether task is in exiting path or not by checking some flags like PF_EXITING.

Regards

Gaurav

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.