arch/powerpc/kernel/security.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/security.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/security.c- Extension
.c- Size
- 22200 bytes
- Lines
- 868
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/kernel.hlinux/device.hlinux/memblock.hlinux/nospec.hlinux/prctl.hlinux/seq_buf.hlinux/sysfs.hlinux/debugfs.hasm/asm-prototypes.hasm/text-patching.hasm/security_features.hasm/sections.hasm/setup.hasm/inst.hsetup.h
Detected Declarations
enum branch_cache_flush_typefunction enable_barrier_nospecfunction setup_barrier_nospecfunction handle_nospectre_v1function barrier_nospec_setfunction barrier_nospec_getfunction barrier_nospec_debugfs_initfunction security_feature_debugfs_initfunction handle_nospectre_v2function setup_spectre_v2function cpu_show_meltdownfunction cpu_show_l1tffunction cpu_show_spectre_v1function cpu_show_spectre_v2function handle_no_stf_barrierfunction stf_barrier_type_getfunction handle_ssbdfunction handle_no_ssbdfunction stf_barrier_enablefunction setup_stf_barrierfunction cpu_show_spec_store_bypassfunction ssb_prctl_getfunction arch_prctl_spec_ctrl_getfunction stf_barrier_setfunction stf_barrier_getfunction stf_barrier_debugfs_initfunction update_branch_cache_flushfunction toggle_branch_cache_flushfunction setup_count_cache_flushfunction handle_no_rfi_flushfunction handle_no_entry_flushfunction handle_no_uaccess_flushfunction handle_no_ptifunction do_nothingfunction entry_flush_enablefunction uaccess_flush_enablefunction init_fallback_flushfunction for_each_possible_cpufunction setup_rfi_flushfunction setup_entry_flushfunction setup_uaccess_flushfunction count_cache_flush_setfunction count_cache_flush_getfunction link_stack_flush_getfunction count_cache_flush_debugfs_initfunction rfi_flush_setfunction rfi_flush_getfunction entry_flush_set
Annotated Snippet
device_initcall(barrier_nospec_debugfs_init);
static __init int security_feature_debugfs_init(void)
{
debugfs_create_x64("security_features", 0400, arch_debugfs_dir,
&powerpc_security_features);
return 0;
}
device_initcall(security_feature_debugfs_init);
#endif /* CONFIG_DEBUG_FS */
#if defined(CONFIG_PPC_E500) || defined(CONFIG_PPC_BOOK3S_64)
static int __init handle_nospectre_v2(char *p)
{
no_spectrev2 = true;
return 0;
}
early_param("nospectre_v2", handle_nospectre_v2);
#endif /* CONFIG_PPC_E500 || CONFIG_PPC_BOOK3S_64 */
#ifdef CONFIG_PPC_E500
void __init setup_spectre_v2(void)
{
if (no_spectrev2 || cpu_mitigations_off())
do_btb_flush_fixups();
else
btb_flush_enabled = true;
}
#endif /* CONFIG_PPC_E500 */
#ifdef CONFIG_PPC_BOOK3S_64
ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
{
bool thread_priv;
thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV);
if (rfi_flush) {
struct seq_buf s;
seq_buf_init(&s, buf, PAGE_SIZE - 1);
seq_buf_printf(&s, "Mitigation: RFI Flush");
if (thread_priv)
seq_buf_printf(&s, ", L1D private per thread");
seq_buf_printf(&s, "\n");
return s.len;
}
if (thread_priv)
return sysfs_emit(buf, "Vulnerable: L1D private per thread\n");
if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) &&
!security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR))
return sysfs_emit(buf, "Not affected\n");
return sysfs_emit(buf, "Vulnerable\n");
}
ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf)
{
return cpu_show_meltdown(dev, attr, buf);
}
#endif
ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf)
{
struct seq_buf s;
seq_buf_init(&s, buf, PAGE_SIZE - 1);
if (security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR)) {
if (barrier_nospec_enabled)
seq_buf_printf(&s, "Mitigation: __user pointer sanitization");
else
seq_buf_printf(&s, "Vulnerable");
if (security_ftr_enabled(SEC_FTR_SPEC_BAR_ORI31))
seq_buf_printf(&s, ", ori31 speculation barrier enabled");
seq_buf_printf(&s, "\n");
} else
seq_buf_printf(&s, "Not affected\n");
return s.len;
}
ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, char *buf)
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/kernel.h`, `linux/device.h`, `linux/memblock.h`, `linux/nospec.h`, `linux/prctl.h`, `linux/seq_buf.h`, `linux/sysfs.h`.
- Detected declarations: `enum branch_cache_flush_type`, `function enable_barrier_nospec`, `function setup_barrier_nospec`, `function handle_nospectre_v1`, `function barrier_nospec_set`, `function barrier_nospec_get`, `function barrier_nospec_debugfs_init`, `function security_feature_debugfs_init`, `function handle_nospectre_v2`, `function setup_spectre_v2`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration 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.