grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chang <mchang@suse.com>
To: Andrei Borzenkov <arvidjaar@gmail.com>
Cc: "Daniel Kiper" <dkiper@net-space.pl>,
	"Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>,
	"The development of GNU GRUB" <grub-devel@gnu.org>
Subject: Re: [PATCH v2] grub-file: fix segmentation fault
Date: Tue, 22 Nov 2016 15:10:08 +0800	[thread overview]
Message-ID: <20161122071008.GD17065@linux-9gqx.suse.de> (raw)
In-Reply-To: <CAA91j0UqwL-m+zTAsTzSkwwYXhcAYQBPrxD0mmwTs3XW7ow4dw@mail.gmail.com>

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

On Fri, Nov 18, 2016 at 11:50:25AM +0300, Andrei Borzenkov wrote:
> Hmm ... I must admit I am confused how we can get NULL here. Filters
> are called after primary file->name is set and each filter copies
> previous struct file, which means returned file will inherit pointer
> to the same file name.

No. I don't think so. Looking into gzio or xzio file filters they did not copy
original handle to new allocated one. And the new handle gets initialized
without file->name being set from original one. The new handle then returned
to upper file layer with file->name being null.

> Anyway, exactly because filters themselves do not free file->name this
> patch means memory leak.

Same reason above, as long as the filters did not allocate it, they did not
need to free.

> Michael, could you provide reproducer for it?

I can still reproduce the segfault on latest git HEAD. Here is kernel image
attached to reproduce the problem with:

 grub/build-xen # ./grub-file --is-x86_64-xen-domu /boot/vmlinux-4.8.4-1-default.gz
 Segmentation fault (core dumped)

Thanks,
Michael

[-- Attachment #2: vmlinux-4.8.4-1-default.gz --]
[-- Type: application/x-gzip, Size: 9616296 bytes --]

  reply	other threads:[~2016-11-22  8:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12  6:24 [PATCH v2] grub-file: fix segmentation fault Michael Chang
2016-11-17 19:08 ` Daniel Kiper
2016-11-18  8:50   ` Andrei Borzenkov
2016-11-22  7:10     ` Michael Chang [this message]
2016-11-22  7:33       ` Michael Chang
2016-11-22 18:39       ` Andrei Borzenkov
2016-11-23  6:44         ` Michael Chang

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=20161122071008.GD17065@linux-9gqx.suse.de \
    --to=mchang@suse.com \
    --cc=arvidjaar@gmail.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    --cc=phcoder@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 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 NNTP newsgroup(s).