diff options
| author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-01-11 10:43:16 +0100 |
|---|---|---|
| committer | Jeff Vander Stoep <jeffv@google.com> | 2016-09-22 13:38:22 -0700 |
| commit | 718645ea36329edb7d1c01871c13385fe1a2f03a (patch) | |
| tree | ed69f7aee0e3ad261b44ed6adc3357a65db0af1f /net/lapb/lapb_timer.c | |
| parent | 39b0815e4872fe6eb20a7d1b42b551e341cb7167 (diff) | |
UPSTREAM: efi: stub: add implementation of efi_random_alloc()
This implements efi_random_alloc(), which allocates a chunk of memory of
a certain size at a certain alignment, and uses the random_seed argument
it receives to randomize the address of the allocation.
This is implemented by iterating over the UEFI memory map, counting the
number of suitable slots (aligned offsets) within each region, and picking
a random number between 0 and 'number of slots - 1' to select the slot,
This should guarantee that each possible offset is chosen equally likely.
Suggested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Bug: 30369029
Patchset: kaslr-arm64-4.4
(cherry picked from commit 2ddbfc81eac84a299cb4747a8764bc43f23e9008)
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Change-Id: I8f59e3e91a71c752d69fd08ca43a890977c82919
Diffstat (limited to 'net/lapb/lapb_timer.c')
0 files changed, 0 insertions, 0 deletions
