From: Simon Horman <horms@kernel.org>
To: Serapheim Dimitropoulos <serapheimd@gmail.com>
Cc: kexec@lists.infradead.org, Bhupesh Sharma <bhsharma@redhat.com>,
Pingfan Liu <piliu@redhat.com>, Philipp Rudo <prudo@redhat.com>,
Serapheim Dimitropoulos <sdimitropoulos@coreweave.com>
Subject: Re: [PATCH kexec-tools] util_lib/elf_info: bound VMCOREINFO string comparisons
Date: Mon, 5 Oct 2026 10:07:27 +0100 [thread overview]
Message-ID: <20261005090727.GD184916@horms.kernel.org> (raw)
In-Reply-To: <20260911-codex-vmcoreinfo-bounds-mailtest-v1-1-32c9fe102018@coreweave.com>
On Fri, Sep 11, 2026 at 10:23:51AM -0400, Serapheim Dimitropoulos wrote:
> From: Serapheim Dimitropoulos <sdimitropoulos@coreweave.com>
>
> scan_vmcoreinfo() terminates each VMCOREINFO line before matching
> known field prefixes. Most fields nevertheless use memcmp() with the
> full prefix length, so a short line near the end of the note can make
> the comparison read beyond the allocated note buffer. AddressSanitizer
> reports a 24-byte read immediately past the allocation in this case.
>
> Use strncmp() for the terminated VMCOREINFO lines and in the arm64
> VMCOREINFO hook. Check the ELF note name length before comparing it,
> and ignore an empty VMCOREINFO descriptor.
>
> Fixes: f4ce0706d957 ("util_lib: Add functionality to read elf notes")
> Signed-off-by: Serapheim Dimitropoulos <sdimitropoulos@coreweave.com>
> ---
> AddressSanitizer found this while running vmcore-dmesg against a minimal
> arm64 ELF core. A two-byte VMCOREINFO descriptor containing "X\n" makes
> scan_vmcoreinfo() request a 24-byte comparison from the final four bytes
> of the 28-byte PT_NOTE allocation. ASan reports the read at
> scan_vmcoreinfo(), with the allocation originating in scan_notes().
>
> Before this patch the reproducer aborts with:
>
> ERROR: AddressSanitizer: heap-buffer-overflow
> READ of size 24
> 0 bytes after 28-byte region
>
> After the patch, the reproducer completes without a sanitizer report.
> Empty VMCOREINFO descriptors and undersized note names were also tested.
> A valid synthetic legacy vmcore exits successfully and produces the
> expected output byte-for-byte.
>
> The patch was tested on arm64 Ubuntu 24.04 with AddressSanitizer and with
> make distcheck.
Thanks, applied.
Sorry for the delay.
- util_lib/elf_info: bound VMCOREINFO string comparisons
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=0fd0d8e9ea97
prev parent reply other threads:[~2026-10-05 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 14:23 [PATCH kexec-tools] util_lib/elf_info: bound VMCOREINFO string comparisons Serapheim Dimitropoulos
2026-10-05 9:07 ` Simon Horman [this message]
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=20261005090727.GD184916@horms.kernel.org \
--to=horms@kernel.org \
--cc=bhsharma@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=piliu@redhat.com \
--cc=prudo@redhat.com \
--cc=sdimitropoulos@coreweave.com \
--cc=serapheimd@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.