Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1157583ybl; Thu, 22 Aug 2019 10:09:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjRAwOZmsXRaV6m8b3qpDSGXnC1F/5FG1Q7KqEo9SNJDJd/R7Nlp1oMWv2BfMG5F1irAGc X-Received: by 2002:a62:ce0e:: with SMTP id y14mr204562pfg.73.1566493769777; Thu, 22 Aug 2019 10:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566493769; cv=none; d=google.com; s=arc-20160816; b=QSO1MgL9rUcjMuXZorNcJdKrJRdE9il3etjUMvO5GwhHQTBw/9rm6l0g5nQjK47oJD WLqzYdzsTLTp1RSDZmjTX0KZzVlM2SQ4xBHePz9+CZcpD/5qphrUH6+vBOuxeIUocrrb KDEK80Wyzq1Wp87XYDtVrv2BzIsjG9JaHEY6PD1BhFJK4G4cYOVKNT+UUeuHi+LT3ZQl /KaumQ4zKvBEmky27nQwNEtQUCVsJ41aNYPZOGoOd58GaJeHNsJ9LRARlf4Yg6+1rpas yFeT5MYfcRTeEaWdHR8TfvOUM3CyJDOAWFzGX3unVAX7BUahwoydWeV31zM9eMigfJtQ JvJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=YwtplR1CFYbGjZgo8W/4wxxRItDNYPxgwL2JtePSrIY=; b=bx4AnUjdbb3B3ppukenQAldEpxx4r10LYOCO9wbDDjvO9Qm8WJnzo0nVrgzPm68exe nNZ756CmfsAypJY7JvtMGI/99vJ1Kf+RCuCRcqGoeHBpBYO3oZuIqLzeAtd82tVOFsNi TzHV3ufK/10GBgwNaYrOOaAXOUvii49cO114U7C6WiziRXO8TMhyrfttLiF25TInyaBt wtovC4DRhjn/7/ymJQjTKSLuwqL93M1tK5RIE/y1n8cSkcMFiha/Yh4mgSuD1QV4iCsI Q3w2Yx+PuK1qbvt0YE/SWmgZYsfr0ZJcPlBoWO1P9LZy3KJau7kYyA94E0qiYFDRIs0C eGfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y184si165489pfb.162.2019.08.22.10.09.13; Thu, 22 Aug 2019 10:09:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731612AbfHVNOT (ORCPT + 99 others); Thu, 22 Aug 2019 09:14:19 -0400 Received: from mx3.molgen.mpg.de ([141.14.17.11]:46797 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727685AbfHVNOT (ORCPT ); Thu, 22 Aug 2019 09:14:19 -0400 Received: from theinternet.molgen.mpg.de (theinternet.molgen.mpg.de [141.14.31.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: buczek) by mx.molgen.mpg.de (Postfix) with ESMTPSA id E8B0F201A3C3E; Thu, 22 Aug 2019 15:14:16 +0200 (CEST) Subject: Re: Brocken/incomplete `/proc/vmcore` To: Paul Menzel , Dave Young , Baoquan He , Vivek Goyal Cc: kexec@lists.infradead.org, Linux Kernel Mailing List References: <1d18de74-76e3-823c-7480-fad1d6012026@molgen.mpg.de> From: Donald Buczek Message-ID: <5431590a-e0fa-afac-2f38-8c3b60853d0d@molgen.mpg.de> Date: Thu, 22 Aug 2019 15:14:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1d18de74-76e3-823c-7480-fad1d6012026@molgen.mpg.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Paul, On 8/15/19 1:36 PM, Paul Menzel wrote: > Dear Linux folks, > > > Using Linux 4.19.57 (configuration attached), crashing the system, and > starting it using the same Linux kernel as crash kernel, the available > `/proc/vmcore` seems to be incomplete. > > Running GDB commands, working with `/proc/kcore`, do not work with > `/proc/vmcore`, and the addresses are not there. > > In the running system, iterating through the tasks works. > > ``` > macro define offsetof(type, member) ((size_t)(&((type *)0)->member)) > macro define container_of(ptr,type,member) ((type *)((size_t)ptr-offsetof(type,member))) > ``` > > ### /proc/kcore ### > > ``` > Core was generated by `BOOT_IMAGE=/boot/bzImage-4.19.57.mx64.286 root=LABEL=root ro crashkernel=512M c'. > #0 0x0000000000000000 in irq_stack_union () > (gdb) source gdb-macros.txt > (gdb) set $t=&init_task > (gdb) print $t->tasks > $1 = {next = 0xffff889ffbb0f080, prev = 0xffff88bff9b09300} > (gdb) print $t->pid > $2 = 0 > (gdb) set $t=container_of($t->tasks->next,struct task_struct,tasks) > (gdb) print $t->tasks > $3 = {next = 0xffff889ffbb0e340, prev = 0xffffffff82411a80 } > (gdb) print $t->pid > $4 = 1 > (gdb) set $t=container_of($t->tasks->next,struct task_struct,tasks) > (gdb) print $t->tasks > $5 = {next = 0xffff889ffbb530c0, prev = 0xffff889ffbb0f080} > (gdb) print $t->pid > $6 = 2 > ``` > > ### /proc/vmcore ### > > After the crash by SysRQ trigger, values in `/proc/vmcore` are incorrect. > > ``` > (gdb) set $t=&init_task > (gdb) print $t->tasks > $1 = {next = 0xffff889ffbb0f080, prev = 0xffff88bff9b09300} > (gdb) print $t->pid > $2 = 0 > (gdb) set $t=container_of($t->tasks->next,struct task_struct,tasks) > (gdb) print $t->tasks > $3 = {next = 0x0 , prev = 0x0 } > (gdb) print $t->pid > $4 = 0 > ``` > > We can reproduce this in a virtual machine and on a big server. It is the same bug as the one described in my mail "/proc/vmcore and wrong PAGE_OFFSET". The task list can be walked if addresses are corrected by 0x0000008000000000: (gdb) set $t=&init_task (gdb) print $t->pid $1 = 0 (gdb) set $t=container_of($t->tasks->next,struct task_struct,tasks) (gdb) set $t=(struct task_struct *)( (char *)$t - 0x0000008000000000) (gdb) print $t->pid $2 = 1 (gdb) set $t=container_of($t->tasks->next,struct task_struct,tasks) (gdb) set $t=(struct task_struct *)( (char *)$t - 0x0000008000000000) (gdb) print $t->pid $3 = 2 The debugger has wrongly mapped the physical memory at virtual 0xffff880000000000 instead of at 0xffff888000000000, because the vmcore file says so for yet unknown reasons. Donald > > > Kind regards, > > Paul > -- Donald Buczek buczek@molgen.mpg.de Tel: +49 30 8413 1433