public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: [PATCH] Fix section corruption bug
Date: Tue, 10 Jun 2014 11:48:15 +0200	[thread overview]
Message-ID: <1402393695.3940.37.camel@bordewijk.wildebeest.org> (raw)
In-Reply-To: 20140609190550.GE14956@toonder.wildebeest.org

[-- Attachment #1: Type: text/plain, Size: 868 bytes --]

Hi,

On Mon, 2014-06-09 at 21:05 +0200, Thilo Schulz wrote:
> When adding data to existing sections in ELF files, libelf may corrupt
> those sections, i.e. overwrite the existing data if certain conditions are
> met.
> 
> If an Elf_Scn structure has seen a call to elf_rawdata(scn) before but no
> call to elf_getdata(scn), scn->read_data flag is set, but not
> scn->data_list_rear.

Do you happen to have a small testcase that shows the buggy behavior? 

> Thus, elf_newdata(scn) incorrectly detects a "new user added section" when
> really it is a section with live, valid data that will be overwritten by
> elf_update(), corrupting the section.
>
> This patch fixes this incorrect behaviour.

I was wondering whether we want to check scn->rawdata.s directly, or if
we could rely on ELF_F_FILEDATA being set for scn->flags?

Thanks,

Mark


             reply	other threads:[~2014-06-10  9:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10  9:48 Mark Wielaard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-03-11 12:46 Mark Wielaard
2014-06-14  1:23 Thilo Schulz
2014-06-12 12:30 Mark Wielaard
2014-06-10 13:31 Thilo Schulz
2014-06-09 19:05 Thilo Schulz

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=1402393695.3940.37.camel@bordewijk.wildebeest.org \
    --to=mjw@redhat.com \
    --cc=elfutils-devel@lists.fedorahosted.org \
    /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).