arch/riscv/include/asm/usercfi.h
Source file repositories/reference/linux-study-clean/arch/riscv/include/asm/usercfi.h
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/include/asm/usercfi.h- Extension
.h- Size
- 3186 bytes
- Lines
- 99
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/prctl.hlinux/errno.h
Detected Declarations
struct task_structstruct kernel_clone_argsstruct cfi_state
Annotated Snippet
struct cfi_state {
unsigned long ubcfi_en : 1; /* Enable for backward cfi. */
unsigned long ubcfi_locked : 1;
unsigned long ufcfi_en : 1; /* Enable for forward cfi. Note that ELP goes in sstatus */
unsigned long ufcfi_locked : 1;
unsigned long user_shdw_stk; /* Current user shadow stack pointer */
unsigned long shdw_stk_base; /* Base address of shadow stack */
unsigned long shdw_stk_size; /* size of shadow stack */
};
unsigned long shstk_alloc_thread_stack(struct task_struct *tsk,
const struct kernel_clone_args *args);
void shstk_release(struct task_struct *tsk);
void set_shstk_base(struct task_struct *task, unsigned long shstk_addr, unsigned long size);
unsigned long get_shstk_base(struct task_struct *task, unsigned long *size);
void set_active_shstk(struct task_struct *task, unsigned long shstk_addr);
bool is_shstk_enabled(struct task_struct *task);
bool is_shstk_locked(struct task_struct *task);
bool is_shstk_allocated(struct task_struct *task);
void set_shstk_lock(struct task_struct *task, bool lock);
void set_shstk_status(struct task_struct *task, bool enable);
unsigned long get_active_shstk(struct task_struct *task);
int restore_user_shstk(struct task_struct *tsk, unsigned long shstk_ptr);
int save_user_shstk(struct task_struct *tsk, unsigned long *saved_shstk_ptr);
bool is_indir_lp_enabled(struct task_struct *task);
bool is_indir_lp_locked(struct task_struct *task);
void set_indir_lp_status(struct task_struct *task, bool enable);
void set_indir_lp_lock(struct task_struct *task, bool lock);
#define PR_SHADOW_STACK_SUPPORTED_STATUS_MASK (PR_SHADOW_STACK_ENABLE)
#define PR_CFI_SUPPORTED_STATUS_MASK (PR_CFI_ENABLE | PR_CFI_DISABLE | PR_CFI_LOCK)
#else
#define shstk_alloc_thread_stack(tsk, args) 0
#define shstk_release(tsk)
#define get_shstk_base(task, size) 0UL
#define set_shstk_base(task, shstk_addr, size) do {} while (0)
#define set_active_shstk(task, shstk_addr) do {} while (0)
#define is_shstk_enabled(task) false
#define is_shstk_locked(task) false
#define is_shstk_allocated(task) false
#define set_shstk_lock(task, lock) do {} while (0)
#define set_shstk_status(task, enable) do {} while (0)
#define is_indir_lp_enabled(task) false
#define is_indir_lp_locked(task) false
#define set_indir_lp_status(task, enable) do {} while (0)
#define set_indir_lp_lock(task, lock) do {} while (0)
#define restore_user_shstk(tsk, shstk_ptr) -EINVAL
#define save_user_shstk(tsk, saved_shstk_ptr) -EINVAL
#define get_active_shstk(task) 0UL
#endif /* CONFIG_RISCV_USER_CFI */
bool is_user_shstk_enabled(void);
bool is_user_lpad_enabled(void);
#endif /* __ASSEMBLER__ */
#endif /* _ASM_RISCV_USERCFI_H */
Annotation
- Immediate include surface: `linux/types.h`, `linux/prctl.h`, `linux/errno.h`.
- Detected declarations: `struct task_struct`, `struct kernel_clone_args`, `struct cfi_state`.
- Atlas domain: Architecture Layer / arch/riscv.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.