From: Dave Young <dyoung@redhat.com>
To: Xunlei Pang <xlpang@redhat.com>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
Baoquan He <bhe@redhat.com>, Petr Tesarik <ptesarik@suse.cz>,
Eric Biederman <ebiederm@xmission.com>,
Hari Bathini <hbathini@linux.vnet.ibm.com>,
akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 2/3] powerpc/fadump: Use the correct VMCOREINFO_NOTE_SIZE for phdr
Date: Wed, 26 Apr 2017 15:11:14 +0800 [thread overview]
Message-ID: <20170426071114.GC5381@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <1492688374-27903-2-git-send-email-xlpang@redhat.com>
Ccing ppc list
On 04/20/17 at 07:39pm, Xunlei Pang wrote:
> vmcoreinfo_max_size stands for the vmcoreinfo_data, the
> correct one we should use is vmcoreinfo_note whose total
> size is VMCOREINFO_NOTE_SIZE.
>
> Like explained in commit 77019967f06b ("kdump: fix exported
> size of vmcoreinfo note"), it should not affect the actual
> function, but we better fix it, also this change should be
> safe and backward compatible.
>
> After this, we can get rid of variable vmcoreinfo_max_size,
> let's use the corresponding macros directly, fewer variables
> means more safety for vmcoreinfo operation.
>
> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
> Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
> Signed-off-by: Xunlei Pang <xlpang@redhat.com>
> ---
> v3->v4:
> -Rebased on the latest linux-next
>
> arch/powerpc/kernel/fadump.c | 3 +--
> include/linux/crash_core.h | 1 -
> kernel/crash_core.c | 3 +--
> 3 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 466569e..7bd6cd0 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -893,8 +893,7 @@ static int fadump_create_elfcore_headers(char *bufp)
>
> phdr->p_paddr = fadump_relocate(paddr_vmcoreinfo_note());
> phdr->p_offset = phdr->p_paddr;
> - phdr->p_memsz = vmcoreinfo_max_size;
> - phdr->p_filesz = vmcoreinfo_max_size;
> + phdr->p_memsz = phdr->p_filesz = VMCOREINFO_NOTE_SIZE;
>
> /* Increment number of program headers. */
> (elf->e_phnum)++;
> diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
> index ba283a2..7d6bc7b 100644
> --- a/include/linux/crash_core.h
> +++ b/include/linux/crash_core.h
> @@ -55,7 +55,6 @@
>
> extern u32 *vmcoreinfo_note;
> extern size_t vmcoreinfo_size;
> -extern size_t vmcoreinfo_max_size;
>
> Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
> void *data, size_t data_len);
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 0321f04..43cdb00 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -16,7 +16,6 @@
> /* vmcoreinfo stuff */
> static unsigned char *vmcoreinfo_data;
> size_t vmcoreinfo_size;
> -size_t vmcoreinfo_max_size = VMCOREINFO_BYTES;
> u32 *vmcoreinfo_note;
>
> /*
> @@ -343,7 +342,7 @@ void vmcoreinfo_append_str(const char *fmt, ...)
> r = vscnprintf(buf, sizeof(buf), fmt, args);
> va_end(args);
>
> - r = min(r, vmcoreinfo_max_size - vmcoreinfo_size);
> + r = min(r, VMCOREINFO_BYTES - vmcoreinfo_size);
>
> memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r);
>
> --
> 1.8.3.1
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
Reviewed-by: Dave Young <dyoung@redhat.com>
Thanks
Dave
next prev parent reply other threads:[~2017-04-26 7:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 11:39 [PATCH v4 1/3] kexec: Move vmcoreinfo out of the kernel's .bss section Xunlei Pang
2017-04-20 11:39 ` [PATCH v4 2/3] powerpc/fadump: Use the correct VMCOREINFO_NOTE_SIZE for phdr Xunlei Pang
2017-04-21 0:55 ` Xunlei Pang
2017-04-26 7:11 ` Dave Young [this message]
2017-04-27 7:38 ` Mahesh Jagannath Salgaonkar
2017-04-20 11:39 ` [PATCH v4 3/3] kdump: Protect vmcoreinfo data under the crash memory Xunlei Pang
2017-04-26 7:09 ` Dave Young
2017-04-26 9:21 ` Xunlei Pang
2017-04-27 2:56 ` Dave Young
2017-04-20 14:24 ` [PATCH v4 1/3] kexec: Move vmcoreinfo out of the kernel's .bss section Juergen Gross
2017-04-24 15:18 ` Michael Holzheu
2017-04-26 7:19 ` Dave Young
2017-04-26 9:51 ` Xunlei Pang
2017-04-26 10:18 ` Xunlei Pang
2017-04-27 3:06 ` Dave Young
2017-04-27 5:25 ` Xunlei Pang
2017-04-27 5:44 ` Dave Young
2017-04-27 6:08 ` Xunlei Pang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170426071114.GC5381@dhcp-128-65.nay.redhat.com \
--to=dyoung@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=ebiederm@xmission.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ptesarik@suse.cz \
--cc=xlpang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).