[Xen-devel] [PATCH 2/7] elf: Increase buf size in get_pt_note_info()

Andrew Cooper andrew.cooper3 at citrix.com
Fri Jul 12 10:04:41 EDT 2013


On 12/07/13 14:48, Daniel Kiper wrote:
> get_pt_note_info() always ignores VMCOREINFO_XEN note
> because buf size is too small. It does not have place
> for \0 char which marks EOS. This patch fixes that bug
> and VMCOREINFO_XEN note living in /proc/vmcore file
> could be properly detected now.
>
> Signed-off-by: Daniel Kiper <daniel.kiper at oracle.com>
> ---
>  elf_info.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/elf_info.c b/elf_info.c
> index 0c1e36a..70a6dd2 100644
> --- a/elf_info.c
> +++ b/elf_info.c
> @@ -310,7 +310,7 @@ get_pt_note_info(void)
>  {
>  	int n_type, size_name, size_desc;
>  	off_t offset, offset_desc;
> -	char buf[VMCOREINFO_XEN_NOTE_NAME_BYTES];
> +	char buf[VMCOREINFO_XEN_NOTE_NAME_BYTES + 1];
>  	char note[MAX_SIZE_NHDR];
>  
>  	nr_cpus = 0;

Elf Note namesz is defined to include the terminating null character, so
I would argue that VMCOREINFO_XEN_NOTE_NAME_BYTES is off-by-one.

~Andrew



More information about the kexec mailing list