kern/efi: Add initial stack protector implementation

It works only on UEFI platforms but can be quite easily extended to
others architectures and platforms if needed.

Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Marco A Benatto <mbenatto@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Chris Coulson authored and Daniel Kiper committed 2021-03-02 15:54:19 +01:00
1 parent 4ea7bae51f
commit 133d73079c
6 files changed
+179 -7

No files matched your search

+19
View File
@@ -344,6 +344,11 @@
{ 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } \
}
#define GRUB_EFI_RNG_PROTOCOL_GUID \
{ 0x3152bca5, 0xeade, 0x433d, \
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
}
struct grub_efi_sal_system_table
{
grub_uint32_t signature;
@@ -1705,6 +1710,20 @@ struct grub_efi_shim_lock_protocol
};
typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
typedef grub_efi_guid_t grub_efi_rng_algorithm_t;
struct grub_efi_rng_protocol
{
grub_efi_status_t (*get_info) (struct grub_efi_rng_protocol *this,
grub_efi_uintn_t *rng_algorithm_list_size,
grub_efi_rng_algorithm_t *rng_algorithm_list);
grub_efi_status_t (*get_rng) (struct grub_efi_rng_protocol *this,
grub_efi_rng_algorithm_t *rng_algorithm,
grub_efi_uintn_t rng_value_length,
grub_efi_uint8_t *rng_value);
};
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)
+30
View File
@@ -0,0 +1,30 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2021 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_STACK_PROTECTOR_H
#define GRUB_STACK_PROTECTOR_H 1
#include <grub/symbol.h>
#include <grub/types.h>
#ifdef GRUB_STACK_PROTECTOR
extern grub_addr_t EXPORT_VAR (__stack_chk_guard);
extern void __attribute__ ((noreturn)) EXPORT_FUNC (__stack_chk_fail) (void);
#endif
#endif /* GRUB_STACK_PROTECTOR_H */