From: Andrey Borzenkov <arvidjaar@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: lkundrak@v3.sk, Matthew Garrett <matthew.garrett@nebula.com>
Subject: Re: [PATCH] Add linuxefi module
Date: Tue, 21 Jan 2014 20:24:47 +0400 [thread overview]
Message-ID: <20140121202447.66091674@opensuse.site> (raw)
In-Reply-To: <1390260488-18091-1-git-send-email-lkundrak@v3.sk>
В Tue, 21 Jan 2014 00:28:08 +0100
Lubomir Rintel <lkundrak@v3.sk> пишет:
>
> module = {
> + name = linuxefi;
> + efi = loader/i386/efi/linux.c;
> + efi = lib/cmdline.c;
> + enable = i386_efi;
> + enable = x86_64_efi;
> +};
> +
Is it relevant for arm64-efi?
> +static grub_err_t
> +grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
> + int argc, char *argv[])
> +{
> + grub_file_t file = 0;
> + struct linux_kernel_header lh;
> + grub_ssize_t len, start, filelen;
> + void *kernel;
> +
> + grub_dl_ref (my_mod);
> +
> + if (argc == 0)
> + {
> + grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
> + goto fail;
> + }
> +
> + file = grub_file_open (argv[0]);
> + if (! file)
> + goto fail;
> +
> + filelen = grub_file_size (file);
> +
> + kernel = grub_malloc(filelen);
> +
> + if (!kernel)
> + {
> + grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer"));
> + goto fail;
> + }
> +
> + if (grub_file_read (file, kernel, filelen) != filelen)
> + {
> + grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
> + goto fail;
> + }
> +
> + if (! grub_linuxefi_secure_validate (kernel, filelen))
> + {
> + grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]);
> + grub_free (kernel);
> + goto fail;
> + }
> +
> + grub_file_seek (file, 0);
> +
> + grub_free(kernel);
> +
This leaves possibility to modify file after it was verified. It
should continue to use in-memory content.
next prev parent reply other threads:[~2014-01-21 16:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-20 23:28 [PATCH] Add linuxefi module Lubomir Rintel
2014-01-21 1:46 ` SevenBits
2014-01-21 13:43 ` Colin Watson
2014-01-21 13:53 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-21 15:24 ` SevenBits
2014-01-21 16:24 ` Andrey Borzenkov [this message]
2014-01-21 16:29 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-21 23:29 ` Colin Watson
2014-01-22 15:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-21 16:30 ` Matthew Garrett
2014-01-21 19:20 ` Leif Lindholm
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=20140121202447.66091674@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=lkundrak@v3.sk \
--cc=matthew.garrett@nebula.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 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.