grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chang <mchang@suse.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] grub-file: fix segmentation fault
Date: Mon, 11 Apr 2016 12:00:02 +0800	[thread overview]
Message-ID: <20160411040002.GA4508@linux-9gqx.suse> (raw)
In-Reply-To: <57087EAE.6070903@gmail.com>

On Sat, Apr 09, 2016 at 07:01:50AM +0300, Andrei Borzenkov wrote:
> 08.04.2016 09:43, Michael Chang пишет:
> > In grub_file_open the file handle returned by file filters has no file->name
> > set which leads to segmentation fault later referenced by grub_elf_file. We
> > move the file->name value assignment after file filters to make sure it will be
> > set and returned.
> > 
> 
> This now makes filename unavailable to progress module (which gets the
> last grub_file in a chain) and it still does not cover corner case of
> failing grub_strdup in grub_file_open.

I don't get why the filename would, in the other way round to this patch trying
to fix, become unavailable to progress module? As far as I see the file
progress read hook in grub_file_read would use the file handle returned
from grub_file_open and do not hold another chaining of opened files ..

About covering the grub_strdup failure, the patch didn't do because it's not
the cause for the segfault so leaving it as it is, if you think it necessary we
can handle the error by returning null handle of course.
> 
> Fixing the former requires some redesign. But as long as we allow
> filename to remain empty in grub_file_open every user must explicitly
> check for it being NULL.

For what reason the filename returned by grub_file_open would be empty and how
to know it reasonable from the user ? Adding the check is fine, but still a bug
to me a filename is provided during grub_file_open but get ditched in returned
handle without a reason.

Thanks,
Michael


  reply	other threads:[~2016-04-11  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  6:43 [PATCH] grub-file: fix segmentation fault Michael Chang
2016-04-09  4:01 ` Andrei Borzenkov
2016-04-11  4:00   ` Michael Chang [this message]
2016-04-11  9:28     ` Andrei Borzenkov
2016-04-12  6:39       ` 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=20160411040002.GA4508@linux-9gqx.suse \
    --to=mchang@suse.com \
    --cc=grub-devel@gnu.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 NNTP newsgroup(s).