mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
![Kees Cook](/assets/img/avatar_default.png)
To enable Clang randstruct support, move the structure layout randomization seed generation out of scripts/gcc-plugins/ into scripts/basic/ so it happens early enough that it can be used by either compiler implementation. The gcc-plugin still builds its own header file, but now does so from the common "randstruct.seed" file. Cc: linux-hardening@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20220503205503.3054173-6-keescook@chromium.org
7 lines
228 B
Bash
Executable file
7 lines
228 B
Bash
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
SEED=$(od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n')
|
|
echo "$SEED" > "$1"
|
|
HASH=$(echo -n "$SEED" | sha256sum | cut -d" " -f1)
|
|
echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
|