Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751478AbeAPJpF (ORCPT + 1 other); Tue, 16 Jan 2018 04:45:05 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:45738 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbeAPJpD (ORCPT ); Tue, 16 Jan 2018 04:45:03 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0BED9601D2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=gkohli@codeaurora.org Subject: Re: Query: Crash is coming during /prod/PID/stat and do_exit of same task To: Alexey Dobriyan Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20180110052017.GB2829@avx2> <20180116072008.GA6918@avx2> From: "Kohli, Gaurav" Message-ID: <9982db93-e392-f6da-e70b-d38d818cd4ff@codeaurora.org> Date: Tue, 16 Jan 2018 15:14:59 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180116072008.GA6918@avx2> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/16/2018 12:50 PM, Alexey Dobriyan wrote: > On Tue, Jan 16, 2018 at 11:06:47AM +0530, Kohli, Gaurav wrote: >> On 1/10/2018 10:50 AM, Alexey Dobriyan wrote: >> >>>> 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. > 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 -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.