public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Evgeny Vereshchagin <evvers@ya.ru>
Subject: Re: [PATCH] libelf: Free and clear rawdata_base and zdata_base consistently
Date: Wed, 2 Aug 2023 18:06:41 +0200	[thread overview]
Message-ID: <20230802160641.GB14316@gnu.wildebeest.org> (raw)
In-Reply-To: <20230730154420.709620-1-mark@klomp.org>

Hi,

On Sun, Jul 30, 2023 at 05:44:20PM +0200, Mark Wielaard wrote:
> There could be a leak if a program called elf_strptr on a compressed
> section, but the program never requests the (uncompressed) section data,
> but does explicitly (re)compress that same section data.
> 
> Fix this by explicitly always freeing and clearing the zdata_base
> and rawdata_base in __libelf_reset_rawdata and elf_compress. Also
> clear zdata_base in elf_end so the pointer isn't indeterminate when
> it is being used in a later comparison against rawdata_base.
> 
> 	* libelf/elf_compress.c (elf_compress): Explicitly free
> 	zdata_base before clearing.
> 	(__libelf_reset_rawdata): Free zdata_base if it isn't
> 	(going to be) used for rawdata_base. Explicitly clear
> 	rawdata_base and zdata_base after free.
> 	* libelf/elf_end.c (elf_end): Clear zdata_base after free.

Pushed.

Mark

      reply	other threads:[~2023-08-02 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-30 15:44 Mark Wielaard
2023-08-02 16:06 ` Mark Wielaard [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=20230802160641.GB14316@gnu.wildebeest.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=evvers@ya.ru \
    /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).