mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +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
49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_VERMAGIC_H
|
|
#define _LINUX_VERMAGIC_H
|
|
|
|
#ifndef INCLUDE_VERMAGIC
|
|
#error "This header can be included from kernel/module.c or *.mod.c only"
|
|
#endif
|
|
|
|
#include <generated/utsrelease.h>
|
|
#include <asm/vermagic.h>
|
|
|
|
/* Simply sanity version stamp for modules. */
|
|
#ifdef CONFIG_SMP
|
|
#define MODULE_VERMAGIC_SMP "SMP "
|
|
#else
|
|
#define MODULE_VERMAGIC_SMP ""
|
|
#endif
|
|
#ifdef CONFIG_PREEMPT_BUILD
|
|
#define MODULE_VERMAGIC_PREEMPT "preempt "
|
|
#elif defined(CONFIG_PREEMPT_RT)
|
|
#define MODULE_VERMAGIC_PREEMPT "preempt_rt "
|
|
#else
|
|
#define MODULE_VERMAGIC_PREEMPT ""
|
|
#endif
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
#define MODULE_VERMAGIC_MODULE_UNLOAD "mod_unload "
|
|
#else
|
|
#define MODULE_VERMAGIC_MODULE_UNLOAD ""
|
|
#endif
|
|
#ifdef CONFIG_MODVERSIONS
|
|
#define MODULE_VERMAGIC_MODVERSIONS "modversions "
|
|
#else
|
|
#define MODULE_VERMAGIC_MODVERSIONS ""
|
|
#endif
|
|
#ifdef RANDSTRUCT
|
|
#include <generated/randstruct_hash.h>
|
|
#define MODULE_RANDSTRUCT "RANDSTRUCT_" RANDSTRUCT_HASHED_SEED
|
|
#else
|
|
#define MODULE_RANDSTRUCT
|
|
#endif
|
|
|
|
#define VERMAGIC_STRING \
|
|
UTS_RELEASE " " \
|
|
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
|
|
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
|
|
MODULE_ARCH_VERMAGIC \
|
|
MODULE_RANDSTRUCT
|
|
|
|
#endif /* _LINUX_VERMAGIC_H */
|