tree: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
head: ff1f49b2ed7c150a69d1537a374c27e9db8acbb0
commit: 19c5678d5c1bad385a1beb8eaa00c9d50f4ce836 [2/3] efi/random: Increase
size of firmware supplied randomness
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 19c5678d5c1bad385a1beb8eaa00c9d50f4ce836
# save the attached .config to linux build tree
make.cross ARCH=arm64
All errors (new ones prefixed by >>):
In file included from drivers/firmware/efi/libstub/random.c:12:0:
drivers/firmware/efi/libstub/random.c: In function 'efi_random_get_seed':
>> drivers/firmware/efi/libstub/random.c:163:21: error: 'RANDOM_SEED_SIZE'
>> undeclared (first use in this function)
sizeof(*seed) + RANDOM_SEED_SIZE,
^
arch/arm64/include/asm/efi.h:73:60: note: in definition of macro
'efi_call_early'
#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
^~~
drivers/firmware/efi/libstub/random.c:163:21: note: each undeclared
identifier is reported only once for each function it appears in
sizeof(*seed) + RANDOM_SEED_SIZE,
^
arch/arm64/include/asm/efi.h:73:60: note: in definition of macro
'efi_call_early'
#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
^~~
vim +/RANDOM_SEED_SIZE +163 drivers/firmware/efi/libstub/random.c
e4fbf476 Ard Biesheuvel 2016-01-10 @12 #include
e4fbf476 Ard Biesheuvel 2016-01-10 13
e4fbf476 Ard Biesheuvel 2016-01-10 14 #include "efistub.h"
e4fbf476 Ard Biesheuvel 2016-01-10 15
e4fbf476 Ard Biesheuvel 2016-01-10 16 struct efi_rng_protocol {
e4fbf476 Ard Biesheuvel 2016-01-10 17 efi_status_t (*get_info)(struct
efi_rng_protocol *,
e4fbf476 Ard Biesheuvel 2016-01-10 18
unsigned long *, efi_guid_t *);
e4fbf476 Ard Biesheuvel 2016-01-10 19 efi_status_t (*get_rng)(struct
efi_rng_protocol *,
e4fbf476 Ard Biesheuvel 2016-01-10 20
efi_guid_t *, unsigned long, u8 *out);
e4fbf476 Ard Biesheuvel 2016-01-10 21 };
e4fbf476 Ard Biesheuvel 2016-01-10 22
e4fbf476 Ard Biesheuvel 2016-01-10 23 efi_status_t
efi_get_random_bytes(efi_system_table_t *sys_table_arg,
e4fbf476 Ard Biesheuvel 2016-01-10 24
unsigned long size, u8 *out)
e4fbf476 Ard Biesheuvel 2016-01-10 25 {
e4fbf476 Ard Biesheuvel 2016-01-10 26 efi_guid_t rng_proto =
EFI_RNG_PROTOCOL_GUID;
e4fbf476 Ard Biesheuvel 2016-01-10 27 efi_status_t status;
e4fbf476 Ard Biesheuvel 2016-01-10 28 struct efi_rng_protocol *rng;
e4fbf476 Ard Biesheuvel 2016-01-10 29
e4fbf476 Ard Biesheuvel 2016-01-10 30 status =
efi_call_early(locate_protocol, _proto, NULL,
e4fbf476 Ard Biesheuvel 2016-01-10 31 (void
**));
e4fbf476 Ard Biesheuvel 2016-01-10 32 if (status != EFI_SUCCESS)
e4fbf476 Ard Biesheuvel 2016-01-10 33 return status;
e4fbf476 Ard Biesheuvel 2016-01-10 34
e4fbf476 Ard Biesheuvel 2016-01-10 35 return rng->get_rng(rng, NULL,
size, out);
e4fbf476 Ard Biesheuvel 2016-01-10 36 }
2ddbfc81 Ard Biesheuvel 2016-01-11 37
2ddbfc81 Ard Biesheuvel 2016-01-11 38 /*
2ddbfc81 Ard Biesheuvel 2016-01-11 39 * Return the number of slots covered
by this entry, i.e., the number of
2ddbfc81 Ard Biesheuvel 2016-01-11 40 * addresses it covers that are
suitably aligned and supply enough room
2ddbfc81 Ard Biesheuvel 2016-01-11 41 * for the allocation.
2ddbfc81 Ard Biesheuvel 2016-01-11 42 */
2ddbfc81 Ard Biesheuvel 2016-01-11 43 static unsigned long
get_entry_num_slots(efi_memory_desc_t *md,
2ddbfc81 Ard Biesheuvel 2016-01-11 44
unsigned long size,
a6a14469 Ard Biesheuvel 2016-11-12 45
unsigned long align_shift)
2ddbfc81 Ard Biesheuvel 2016-01-11 46 {
a6a14469 Ard Biesheuvel 2016-11-12 47 unsigned long align = 1UL <<
align_shift;
018edcfa Ard Biesheuvel 2016-11-24 48 u64 first_slot, last_slot,
region_end;
2ddbfc81 Ard Biesheuvel 2016-01-11 49
2ddbfc81 Ard Biesheuvel 2016-01-11 50 if (md->type !=
EFI_CONVENTIONAL_MEMORY)
2ddbfc81 Ard Biesheuvel 2016-01-11 51 return 0;
2ddbfc81 Ard Biesheuvel 2016-01-11 52
018edcfa Ard Biesheuvel 2016-11-24 53 region_end =
min((u64)ULONG_MAX, md->phys_addr + md->num_pages*EFI_PAGE_SIZE - 1);
2ddbfc81 Ard Biesheuvel 2016-01-11 54
018edcfa Ard Biesheuvel