mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
67840ad0fa
CRIU and GDB need to get the current shadow stack and WRSS enablement status. This information is already available via /proc/pid/status, but this is inconvenient for CRIU because it involves parsing the text output in an area of the code where this is difficult. Provide a status arch_prctl(), ARCH_SHSTK_STATUS for retrieving the status. Have arg2 be a userspace address, and make the new arch_prctl simply copy the features out to userspace. Suggested-by: Mike Rapoport <rppt@kernel.org> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: John Allen <john.allen@amd.com> Tested-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/all/20230613001108.3040476-43-rick.p.edgecombe%40intel.com
38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_SHSTK_H
|
|
#define _ASM_X86_SHSTK_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
#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);
|
|
#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; }
|
|
#endif /* CONFIG_X86_USER_SHADOW_STACK */
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* _ASM_X86_SHSTK_H */
|