public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Ilya Leoshkevich <iii@linux.ibm.com>, elfutils-devel@sourceware.org
Subject: Re: [PATCH RFC 06/11] Initialize reglocs for VMCOREINFO
Date: Wed, 08 Feb 2023 18:27:46 +0100	[thread overview]
Message-ID: <df1e8928180f4b2cdcadad0bf725b74668e492a8.camel@klomp.org> (raw)
In-Reply-To: <20230206222513.1773039-7-iii@linux.ibm.com>

Hi Ilya,

On Mon, 2023-02-06 at 23:25 +0100, Ilya Leoshkevich via Elfutils-devel
wrote:
> MSan complains:
> 
>     Uninitialized value was created by an allocation of 'reglocs' in the stack frame
>        #0 0x562d35c686f0 in handle_core_note elfutils/src/readelf.c:12674:3
>        #const Ebl_Register_Location *reglocs;
>     ==1006199==WARNING: MemorySanitizer: use-of-uninitialized-value
>        #0 0x562d35c68a2a in handle_core_note elfutils/src/readelf.c:12692:11
>        #colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset,
>        #                               reglocs, nregloc);
> 
> Strictly speaking, this is not a problem, because nregloc == 0, but for
> other note types we initialize it anyway, so do it here as well.

Yeah, this is something valgrind wouldn't complain about since it
doesn't see passing of an undefined value as "use". But I think msan is
technically correct that passing an indeterminate value to a function
provokes undefined behavior. Also it is of course more consistent with
the rest of the code which does initialize reglocs even when nregloc is
zero.

Pushed as is.

Thanks,

Mark


> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  backends/linux-core-note.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
> index 9faae4c3..238ec16d 100644
> --- a/backends/linux-core-note.c
> +++ b/backends/linux-core-note.c
> @@ -239,6 +239,7 @@ EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name,
>  	return 0;
>        *regs_offset = 0;
>        *nregloc = 0;
> +      *reglocs = NULL;
>        *nitems = 1;
>        *items = vmcoreinfo_items;
>        return 1;


  reply	other threads:[~2023-02-08 17:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 22:25 [PATCH RFC 00/11] Add Memory Sanitizer support Ilya Leoshkevich
2023-02-06 22:25 ` [PATCH RFC 01/11] libdwfl: Fix debuginfod_client redefinition Ilya Leoshkevich
2023-02-07 19:22   ` Mark Wielaard
2023-02-07 19:47     ` Ilya Leoshkevich
2023-02-06 22:25 ` [PATCH RFC 02/11] libasm: Fix xdefault_pattern initialization Ilya Leoshkevich
2023-02-07 19:41   ` Mark Wielaard
2023-02-07 19:49     ` Ilya Leoshkevich
2023-02-06 22:25 ` [PATCH RFC 03/11] printversion: Fix unused variable Ilya Leoshkevich
2023-02-07 20:44   ` Mark Wielaard
2023-02-08 12:22     ` Ilya Leoshkevich
2023-02-09 14:04       ` Mark Wielaard
2023-02-09 14:57         ` Ilya Leoshkevich
2023-02-06 22:25 ` [PATCH RFC 04/11] readelf: Fix set but not used parameter Ilya Leoshkevich
2023-02-08 16:52   ` Mark Wielaard
2023-02-06 22:25 ` [PATCH RFC 05/11] readelf: Fix set but not used variable Ilya Leoshkevich
2023-02-08 17:09   ` Mark Wielaard
2023-02-06 22:25 ` [PATCH RFC 06/11] Initialize reglocs for VMCOREINFO Ilya Leoshkevich
2023-02-08 17:27   ` Mark Wielaard [this message]
2023-02-06 22:25 ` [PATCH RFC 07/11] addr2line: Do not test demangling in run-addr2line-i-test.sh Ilya Leoshkevich
2023-02-08 18:15   ` Mark Wielaard
2023-02-06 22:25 ` [PATCH RFC 08/11] x86_64_return_value_location: Support lvalue and rvalue references Ilya Leoshkevich
2023-02-06 22:25 ` [PATCH RFC 09/11] configure: Use -fno-addrsig if possible Ilya Leoshkevich
2023-02-06 22:25 ` [PATCH RFC 10/11] configure: Add --disable-demangle Ilya Leoshkevich
2023-02-08 18:14   ` Mark Wielaard
2023-02-06 22:25 ` [PATCH RFC 11/11] configure: Add --enable-sanitize-memory Ilya Leoshkevich
2023-02-07 19:05 ` [PATCH RFC 00/11] Add Memory Sanitizer support Mark Wielaard
2023-02-07 19:46   ` Ilya Leoshkevich

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=df1e8928180f4b2cdcadad0bf725b74668e492a8.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=iii@linux.ibm.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 read-only IMAP folder(s) and NNTP newsgroup(s).