mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with UAPI headers that rather should use __ASSEMBLER__ instead. So let's standardize on the __ASSEMBLER__ macro that is provided by the compilers now. This is mostly a mechanical patch (done with a simple "sed -i" statement), with some manual tweaks in <asm/frame.h>, <asm/hw_irq.h> and <asm/setup.h> that mentioned this macro in comments with some missing underscores. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Juergen Gross <jgross@suse.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20250314071013.1575167-38-thuth@redhat.com
42 lines
1.4 KiB
C
42 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_SHSTK_H
|
|
#define _ASM_X86_SHSTK_H
|
|
|
|
#ifndef __ASSEMBLER__
|
|
#include <linux/types.h>
|
|
|
|
struct task_struct;
|
|
struct ksignal;
|
|
|
|
#ifdef CONFIG_X86_USER_SHADOW_STACK
|
|
struct thread_shstk {
|
|
u64 base;
|
|
u64 size;
|
|
};
|
|
|
|
long shstk_prctl(struct task_struct *task, int option, unsigned long arg2);
|
|
void reset_thread_features(void);
|
|
unsigned long shstk_alloc_thread_stack(struct task_struct *p, unsigned long clone_flags,
|
|
unsigned long stack_size);
|
|
void shstk_free(struct task_struct *p);
|
|
int setup_signal_shadow_stack(struct ksignal *ksig);
|
|
int restore_signal_shadow_stack(void);
|
|
int shstk_update_last_frame(unsigned long val);
|
|
bool shstk_is_enabled(void);
|
|
#else
|
|
static inline long shstk_prctl(struct task_struct *task, int option,
|
|
unsigned long arg2) { return -EINVAL; }
|
|
static inline void reset_thread_features(void) {}
|
|
static inline unsigned long shstk_alloc_thread_stack(struct task_struct *p,
|
|
unsigned long clone_flags,
|
|
unsigned long stack_size) { return 0; }
|
|
static inline void shstk_free(struct task_struct *p) {}
|
|
static inline int setup_signal_shadow_stack(struct ksignal *ksig) { return 0; }
|
|
static inline int restore_signal_shadow_stack(void) { return 0; }
|
|
static inline int shstk_update_last_frame(unsigned long val) { return 0; }
|
|
static inline bool shstk_is_enabled(void) { return false; }
|
|
#endif /* CONFIG_X86_USER_SHADOW_STACK */
|
|
|
|
#endif /* __ASSEMBLER__ */
|
|
|
|
#endif /* _ASM_X86_SHSTK_H */
|