Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934927AbcJFUKB (ORCPT ); Thu, 6 Oct 2016 16:10:01 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:43151 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933172AbcJFUJ5 (ORCPT ); Thu, 6 Oct 2016 16:09:57 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Baoquan He Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, akpm@linux-foundation.org, mingo@redhat.com, hpa@zytor.com, dyoung@redhat.com, tonli@redhat.com, keescook@chromium.org, takahiro.akashi@linaro.org, thgarnie@google.com, ats-kumagai@wm.jp.nec.com References: <1475743561-23912-1-git-send-email-bhe@redhat.com> Date: Thu, 06 Oct 2016 15:07:53 -0500 In-Reply-To: <1475743561-23912-1-git-send-email-bhe@redhat.com> (Baoquan He's message of "Thu, 6 Oct 2016 16:46:01 +0800") Message-ID: <877f9lckbq.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1bsEzF-0001JA-Am;;;mid=<877f9lckbq.fsf@x220.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=75.170.125.99;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18uWB/LmvppCoxosx3OHZ7lcxwqge7WGFU= X-SA-Exim-Connect-IP: 75.170.125.99 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.0 XMBody_17 BODY: Spammy words in all caps * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 1.0 XM_Sft_Co_L33T No description available. X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Baoquan He X-Spam-Relay-Country: X-Spam-Timing: total 523 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.8 (0.7%), b_tie_ro: 2.6 (0.5%), parse: 0.87 (0.2%), extract_message_metadata: 3.2 (0.6%), get_uri_detail_list: 1.43 (0.3%), tests_pri_-1000: 3.6 (0.7%), tests_pri_-950: 1.01 (0.2%), tests_pri_-900: 0.86 (0.2%), tests_pri_-400: 32 (6.1%), check_bayes: 31 (5.9%), b_tokenize: 6 (1.1%), b_tok_get_all: 13 (2.4%), b_comp_prob: 1.78 (0.3%), b_tok_touch_all: 7 (1.3%), b_finish: 2.4 (0.5%), tests_pri_0: 465 (88.9%), check_dkim_signature: 0.45 (0.1%), check_dkim_adsp: 57 (11.0%), tests_pri_500: 4.1 (0.8%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] kexec: Export memory sections virtual addresses to vmcoreinfo X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2265 Lines: 60 Baoquan He writes: > KASLR memory randomization can randomize the base of the physical memory > mapping (PAGE_OFFSET), vmalloc (VMALLOC_START) and vmemmap > (VMEMMAP_START). These need be exported to VMCOREINFO so that user space > utility, mainly makedumpfile can use them to identify the base of each > memory section. Here using VMCOREINFO_NUMBER we can reuse the existing > struct number_table in makedumpfile to import data easily. > > Since they are related to x86_64 only, put them into > arch_crash_save_vmcoreinfo. And move the exportion of KERNEL_IMAGE_SIZE > together since it's also for x86_64 only. *Scratches my head* I would have thought this information would have better fit in the ELF header. Where it actually has a field for virtual address. It also has a field for physical address, and a third field for offset in the file (which is where the kdump finds these things in memory aftewards). Why do we need need more magic vmcoreinfo to handle this? Eric > > Signed-off-by: Baoquan He > --- > arch/x86/kernel/machine_kexec_64.c | 4 ++++ > kernel/kexec_core.c | 3 --- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c > index 5a294e4..e150dd7 100644 > --- a/arch/x86/kernel/machine_kexec_64.c > +++ b/arch/x86/kernel/machine_kexec_64.c > @@ -337,6 +337,10 @@ void arch_crash_save_vmcoreinfo(void) > #endif > vmcoreinfo_append_str("KERNELOFFSET=%lx\n", > kaslr_offset()); > + VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE); > + VMCOREINFO_NUMBER(PAGE_OFFSET); > + VMCOREINFO_NUMBER(VMALLOC_START); > + VMCOREINFO_NUMBER(VMEMMAP_START); > } > > /* arch-dependent functionality related to kexec file-based syscall */ > diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > index 5616755..8ad3a29e 100644 > --- a/kernel/kexec_core.c > +++ b/kernel/kexec_core.c > @@ -1467,9 +1467,6 @@ static int __init crash_save_vmcoreinfo_init(void) > #endif > VMCOREINFO_NUMBER(PG_head_mask); > VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE); > -#ifdef CONFIG_X86 > - VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE); > -#endif > #ifdef CONFIG_HUGETLB_PAGE > VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR); > #endif