arch/arm64/kernel/proton-pack.c
Source file repositories/reference/linux-study-clean/arch/arm64/kernel/proton-pack.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/kernel/proton-pack.c- Extension
.c- Size
- 32336 bytes
- Lines
- 1207
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- 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/arm-smccc.hlinux/bpf.hlinux/cpu.hlinux/device.hlinux/nospec.hlinux/prctl.hlinux/sched/task_stack.hlinux/sysfs.hasm/debug-monitors.hasm/insn.hasm/spectre.hasm/traps.hasm/vectors.hasm/virt.h
Detected Declarations
enum spectre_v4_policyenum bhb_mitigation_bitsfunction Copyrightfunction cpu_show_spectre_v1function parse_spectre_v2_paramfunction spectre_v2_mitigations_offfunction _unprivileged_ebpf_enabledfunction cpu_show_spectre_v2function spectre_v2_get_cpu_hw_mitigation_statefunction spectre_v2_get_cpu_fw_mitigation_statefunction has_spectre_v2function arm64_get_spectre_v2_statefunction install_bp_hardening_cbfunction call_smc_arch_workaround_1function call_hvc_arch_workaround_1function qcom_link_stack_sanitisationfunction spectre_v2_get_sw_mitigation_cbfunction spectre_v2_enable_fw_mitigationfunction spectre_v2_enable_mitigationfunction has_spectre_v3afunction spectre_v3a_enable_mitigationfunction parse_spectre_v4_paramfunction spectre_v4_mitigations_offfunction spectre_v4_mitigations_dynamicfunction spectre_v4_mitigations_onfunction cpu_show_spec_store_bypassfunction arm64_get_spectre_v4_statefunction spectre_v4_get_cpu_hw_mitigation_statefunction spectre_v4_get_cpu_fw_mitigation_statefunction has_spectre_v4function try_emulate_el1_ssbsfunction spectre_v4_enable_hw_mitigationfunction spectre_v4_patch_fw_mitigation_enablefunction smccc_patch_fw_mitigation_conduitfunction spectre_v4_enable_fw_mitigationfunction spectre_v4_enable_mitigationfunction __update_pstate_ssbsfunction spectre_v4_enable_task_mitigationfunction execfunction ssbd_prctl_disable_mitigationfunction ssbd_prctl_setfunction execvefunction arch_prctl_spec_ctrl_setfunction ssbd_prctl_getfunction arch_prctl_spec_ctrl_getfunction arm64_get_spectre_bhb_statefunction is_spectre_bhb_safefunction spectre_bhb_loop_affected
Annotated Snippet
spectre_v4_mitigations_on()) {
return -EPERM;
}
ssbd_prctl_enable_mitigation(task);
task_set_spec_ssb_noexec(task);
break;
default:
return -ERANGE;
}
spectre_v4_enable_task_mitigation(task);
return 0;
}
int arch_prctl_spec_ctrl_set(struct task_struct *task, unsigned long which,
unsigned long ctrl)
{
switch (which) {
case PR_SPEC_STORE_BYPASS:
return ssbd_prctl_set(task, ctrl);
default:
return -ENODEV;
}
}
static int ssbd_prctl_get(struct task_struct *task)
{
switch (spectre_v4_state) {
case SPECTRE_UNAFFECTED:
return PR_SPEC_NOT_AFFECTED;
case SPECTRE_MITIGATED:
if (spectre_v4_mitigations_on())
return PR_SPEC_NOT_AFFECTED;
if (spectre_v4_mitigations_dynamic())
break;
/* Mitigations are disabled, so we're vulnerable. */
fallthrough;
case SPECTRE_VULNERABLE:
fallthrough;
default:
return PR_SPEC_ENABLE;
}
/* Check the mitigation state for this task */
if (task_spec_ssb_force_disable(task))
return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE;
if (task_spec_ssb_noexec(task))
return PR_SPEC_PRCTL | PR_SPEC_DISABLE_NOEXEC;
if (task_spec_ssb_disable(task))
return PR_SPEC_PRCTL | PR_SPEC_DISABLE;
return PR_SPEC_PRCTL | PR_SPEC_ENABLE;
}
int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which)
{
switch (which) {
case PR_SPEC_STORE_BYPASS:
return ssbd_prctl_get(task);
default:
return -ENODEV;
}
}
/*
* Spectre BHB.
*
* A CPU is either:
* - Mitigated by a branchy loop a CPU specific number of times, and listed
* in our "loop mitigated list".
* - Mitigated in software by the firmware Spectre v2 call.
* - Has the ClearBHB instruction to perform the mitigation.
* - Has the 'Exception Clears Branch History Buffer' (ECBHB) feature, so no
* software mitigation in the vectors is needed.
* - Has CSV2.3, so is unaffected.
*/
static enum mitigation_state spectre_bhb_state;
enum mitigation_state arm64_get_spectre_bhb_state(void)
{
return spectre_bhb_state;
}
enum bhb_mitigation_bits {
BHB_LOOP,
Annotation
- Immediate include surface: `linux/arm-smccc.h`, `linux/bpf.h`, `linux/cpu.h`, `linux/device.h`, `linux/nospec.h`, `linux/prctl.h`, `linux/sched/task_stack.h`, `linux/sysfs.h`.
- Detected declarations: `enum spectre_v4_policy`, `enum bhb_mitigation_bits`, `function Copyright`, `function cpu_show_spectre_v1`, `function parse_spectre_v2_param`, `function spectre_v2_mitigations_off`, `function _unprivileged_ebpf_enabled`, `function cpu_show_spectre_v2`, `function spectre_v2_get_cpu_hw_mitigation_state`, `function spectre_v2_get_cpu_fw_mitigation_state`.
- Atlas domain: Architecture Layer / arch/arm64.
- 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.