grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] Add linuxefi module
Date: Tue, 21 Jan 2014 17:29:03 +0100	[thread overview]
Message-ID: <52DEA04F.6030002@gmail.com> (raw)
In-Reply-To: <20140121202447.66091674@opensuse.site>

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

On 21.01.2014 17:24, Andrey Borzenkov wrote:
> В 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. 
> 
This part is from RH "Secureboot" patch. Few things are right about that
patch. Whatever signature verifications would need to be integrated with
signatures framework (I have some scratch in phcoder/file_types)
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 274 bytes --]

  reply	other threads:[~2014-01-21 16:29 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
2014-01-21 16:29   ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
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=52DEA04F.6030002@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 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).