Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033728AbdD0C4r (ORCPT ); Wed, 26 Apr 2017 22:56:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48372 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754433AbdD0C4l (ORCPT ); Wed, 26 Apr 2017 22:56:41 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 50C8E9D502 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dyoung@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 50C8E9D502 Date: Thu, 27 Apr 2017 10:56:30 +0800 From: Dave Young To: xlpang@redhat.com Cc: Baoquan He , kexec@lists.infradead.org, Petr Tesarik , linux-kernel@vger.kernel.org, Eric Biederman , Hari Bathini , akpm@linux-foundation.org, Michael Holzheu Subject: Re: [PATCH v4 3/3] kdump: Protect vmcoreinfo data under the crash memory Message-ID: <20170427025630.GA10602@dhcp-128-65.nay.redhat.com> References: <1492688374-27903-1-git-send-email-xlpang@redhat.com> <1492688374-27903-3-git-send-email-xlpang@redhat.com> <20170426070936.GB5381@dhcp-128-65.nay.redhat.com> <590066A2.4090309@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <590066A2.4090309@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Apr 2017 02:56:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1356 Lines: 44 [snip] > >> index 43cdb00..a29e9ad 100644 > >> --- a/kernel/crash_core.c > >> +++ b/kernel/crash_core.c > >> @@ -15,9 +15,12 @@ > >> > >> /* vmcoreinfo stuff */ > >> static unsigned char *vmcoreinfo_data; > >> -size_t vmcoreinfo_size; > >> +static size_t vmcoreinfo_size; > >> u32 *vmcoreinfo_note; > >> > >> +/* trusted vmcoreinfo, e.g. we can make a copy in the crash memory */ > > May make it clearer like: > > /* Trusted vmcoreinfo copy in the kdump reserved memory */ > > My thought is that it is in crash_core.c now which should be independent of kexec/kdump, > so I used "e.g. ..." just like one use case. Ok, then it is fine. [snip] > >> static int kimage_add_entry(struct kimage *image, kimage_entry_t entry) > >> { > >> if (*image->entry != 0) > >> @@ -598,6 +632,11 @@ void kimage_free(struct kimage *image) > >> if (image->file_mode) > >> kimage_file_post_load_cleanup(image); > >> > >> + if (image->vmcoreinfo_data_copy) { > >> + crash_update_vmcoreinfo_safecopy(NULL); > >> + vunmap(image->vmcoreinfo_data_copy); > >> + } > >> + > > Should move above chunk before the freeing of the actual page? > > It should be fine, because it is allocated from the reserved memory, it doesn't > need to be freed. Anyway I can move it above to avoid confusion. Thanks! > Yes, it looks better, thanks for explanation. Thanks Dave