arch/arm64/kernel/mte.c
Source file repositories/reference/linux-study-clean/arch/arm64/kernel/mte.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/kernel/mte.c- Extension
.c- Size
- 16525 bytes
- Lines
- 660
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/cpu.hlinux/kernel.hlinux/mm.hlinux/prctl.hlinux/ptrace.hlinux/sched.hlinux/sched/mm.hlinux/string.hlinux/swap.hlinux/swapops.hlinux/thread_info.hlinux/types.hlinux/uaccess.hlinux/uio.hasm/barrier.hasm/cpufeature.hasm/mte.hasm/ptrace.hasm/sysreg.h
Detected Declarations
function mte_sync_tagsfunction memcmp_pagesfunction __mte_enable_kernelfunction mte_enable_kernel_syncfunction mte_enable_kernel_asyncfunction mte_enable_kernel_asymmfunction mte_enable_kernel_store_onlyfunction mte_check_tfsr_el1function mte_update_sctlr_userfunction mte_update_gcr_exclfunction kasan_hw_tags_enablefunction mte_thread_init_userfunction mte_thread_switchfunction mte_cpu_setupfunction mte_suspend_enterfunction mte_suspend_exitfunction set_mte_ctrlfunction get_mte_ctrlfunction __access_remote_vmfunction access_remote_tagsfunction mte_ptrace_copy_tagsfunction mte_tcf_preferred_showfunction mte_tcf_preferred_storefunction register_mte_tcf_preferred_sysctlfunction for_each_possible_cpufunction mte_probe_user_rangemodule init register_mte_tcf_preferred_sysctlexport mte_async_or_asymm_mode
Annotated Snippet
subsys_initcall(register_mte_tcf_preferred_sysctl);
/*
* Return 0 on success, the number of bytes not probed otherwise.
*/
size_t mte_probe_user_range(const char __user *uaddr, size_t size)
{
const char __user *end = uaddr + size;
char val;
__raw_get_user(val, uaddr, efault);
uaddr = PTR_ALIGN(uaddr, MTE_GRANULE_SIZE);
while (uaddr < end) {
/*
* A read is sufficient for mte, the caller should have probed
* for the pte write permission if required.
*/
__raw_get_user(val, uaddr, efault);
uaddr += MTE_GRANULE_SIZE;
}
(void)val;
return 0;
efault:
return end - uaddr;
}
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/cpu.h`, `linux/kernel.h`, `linux/mm.h`, `linux/prctl.h`, `linux/ptrace.h`, `linux/sched.h`, `linux/sched/mm.h`.
- Detected declarations: `function mte_sync_tags`, `function memcmp_pages`, `function __mte_enable_kernel`, `function mte_enable_kernel_sync`, `function mte_enable_kernel_async`, `function mte_enable_kernel_asymm`, `function mte_enable_kernel_store_only`, `function mte_check_tfsr_el1`, `function mte_update_sctlr_user`, `function mte_update_gcr_excl`.
- Atlas domain: Architecture Layer / arch/arm64.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.