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

From: Kohli, Gaurav
Date: Tue Jan 09 2018 - 08:33:16 EST


HI ,

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:

Below is the crash trace:
49750.534377] Kernel BUG at ffffff8e7a4c53a8 [verbose debug info unavailable]
[49750.534394] task: ffffffe7b4475580 task.stack: ffffffe7a5f0c000
[49750.534400] PC is at do_task_stat+0x740/0x908
[49750.534402] LR is at do_task_stat+0xa4/0x908
[49750.534403] pc : [<ffffff8e7a4c53a8>] lr : [<ffffff8e7a4c4d0c>] pstate: 80400145
[49750.534404] sp : ffffffe7a5f0fbd0

and here is stack trace on that core:

-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,
ÂÂÂ |Â ?,

Below are task stats which shows , process completed the do_exit call:
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

In our build both patches are there ,
fs/proc: report eip/esp in /prod/PID/stat for coredumping

and also task.state has already set PF_DUMPCORE as it got the sigabrt signal.

Regards
Gaurav


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