From: phcoder <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: grub_machine_fini on efi systems
Date: Tue, 17 Feb 2009 00:16:34 +0100 [thread overview]
Message-ID: <4999F3D2.2080306@gmail.com> (raw)
In-Reply-To: <4999EE71.100@gmail.com>
Remark 1: when loading OS grub has to call grub_efi_exit_boot_services
which unloads efi nearly completely. On the other hand it shouldn't be
called when returning with exit command. Perhaps we should split
grub_machine_fini in two: one for preparing for OS and other for
exiting. But then when one chainloads then grub_efi_exit_boot_services
shouldn't be called. So I propose that loader function should cope with
environment preparation. For cases when some preparation is needed
independently of the type of loaded os (like setting 'map' hook) the
best solution IMO would be preboot hooks.
Remark 2: it should be clearly stated somewhere what the boot function
may and may not use (e.g. boot function isn't allowed to read from disk,
boot function may use grub_printf but not and so on) so that boot
function conflicts neither with grub_machine_fini nor with preboot hooks
Remark 3: in case of an error the non-returning boot function may
return. I see 3 possible solution:
a) forbid such an action. Use grub_fatal if really necessary
b) loader should call a special function at point of noreturn
c) delete the separation between returnable and not returnable booters.
grub_machine_prepare_for_os and preboot_hooks in my proposition patch
would then be extended with second function which is called upon the
return to undo the action of the hook itself
Regards
Vladimir 'phcoder' Serbinenko
phcoder wrote:
> Hello. I found a serious problem which may be the cause of linux not
> booting on some efi systems. grub_machine_fini is called before
> grub_linux_boot. grub_machine_fini returns all memory allocated by grub2
> to efi. This includes all memory used to load modules. So actually efi
> can rightfully destroy linux module before it has slightest chance to do
> its job. I asked step21 to declare linux boot as returnable to stop
> grub_machine_fini. However it's nothing more then a workaround. I hope
> that someone will find a way to fix this nicely because for the moment I
> see none. (perhaps tomorrow I'll find sth)
> Regards
> Vladimir 'phcoder' Serbinenko
next prev parent reply other threads:[~2009-02-16 23:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-16 22:53 grub_machine_fini on efi systems phcoder
2009-02-16 23:16 ` phcoder [this message]
2009-02-17 2:56 ` Peter Cros
2009-02-17 3:02 ` Bean
2009-02-17 5:01 ` Peter Cros
2009-02-17 12:11 ` Peter Cros
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=4999F3D2.2080306@gmail.com \
--to=phcoder@gmail.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.