diff options
author | Matthew Garrett <mjg59@google.com> | 2017-06-30 11:27:47 -0700 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-07-03 18:14:09 +0200 |
commit | d4cbada2a95667c4d5d4310298bfcb446b1357b5 (patch) | |
tree | c7915ded4a0afb62475fabe36341226e589fb6a2 /src/boot/efi/pe.h | |
parent | 9db307820e6f545665fc87f255af737228b7183c (diff) | |
download | systemd-d4cbada2a95667c4d5d4310298bfcb446b1357b5.tar.gz |
sd-boot: stub: Obtain PE section offsets from RAM, not disk (#6250)
In a Secure Boot scenario the stub loader will have been validated
before execution. A malicious drive could then change the data returned
in future reads, resulting in the loader obtaining incorrect section
offsets and (for instance) allowing the command line to be modified.
Pull that information out of the in-RAM representation of the loader
instead in order to avoid this.
Fixes: #6230
(Lennart did some minor coding style fixes, and renamed pefile.c → pe.c,
as suggested by Kay, given that the file now contains a function whose
name doesn't match the filename as prefix anymore.)
Diffstat (limited to 'src/boot/efi/pe.h')
-rw-r--r-- | src/boot/efi/pe.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/boot/efi/pe.h b/src/boot/efi/pe.h new file mode 100644 index 0000000000..fa8feea758 --- /dev/null +++ b/src/boot/efi/pe.h @@ -0,0 +1,22 @@ +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Copyright (C) 2015 Kay Sievers <kay@vrfy.org> + */ + +#ifndef __SDBOOT_PEFILE_H +#define __SDBOOT_PEFILE_H + +EFI_STATUS pe_memory_locate_sections(CHAR8 *base, + CHAR8 **sections, UINTN *addrs, UINTN *offsets, UINTN *sizes); +EFI_STATUS pe_file_locate_sections(EFI_FILE *dir, CHAR16 *path, + CHAR8 **sections, UINTN *addrs, UINTN *offsets, UINTN *sizes); +#endif |