All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: nested functions used by multiboot2 loader corrupt stack
Date: Mon, 21 Jan 2008 00:47:30 +0100	[thread overview]
Message-ID: <20080120234730.GA24779@thorin> (raw)
In-Reply-To: <ca0f59980801170747v6461ca04p91def54d6cf96e54@mail.gmail.com>

On Thu, Jan 17, 2008 at 11:47:50PM +0800, Bean wrote:
> 
> Embedded function used %ecx to store the pointer to it's parent's
> stack. However, the program is compiled using option -mregparm=3,
> which means it can use up to 3 registry to pass parameter.In
> grub_elf32_load_segment, there are three parameter elf, phdr and hook,
> which will take up %eax, %edx and %ecx. The value of %ecx, hook, will
> be overwritten. Use NESTED_FUNC_ATTR ensure that only the first two
> parameter will be passed using registry
> 
> This problem can occur when the following conditions are true:
> 
> 1, Use embedded function as callback.
> 2, The embedded function use local variable in it's parent's stack.
> 3, The embedded function has at least three parameters.

Thanks for the explanation, I think I got the idea now.

I reviewed all GRUB code for other instances of this bug, and only found
the equivalent 64-bit versions of the functions you fixed to be affected.

Just committed a fix based on your patch (plus the 64-bit ones).

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



      reply	other threads:[~2008-01-20 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16 23:05 nested functions used by multiboot2 loader corrupt stack Robert Millan
2008-01-17  8:15 ` Bean
2008-01-17 12:21   ` Robert Millan
2008-01-17 15:47     ` Bean
2008-01-20 23:47       ` Robert Millan [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=20080120234730.GA24779@thorin \
    --to=rmh@aybabtu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.