arch/arm64/kernel/vdso.c
Source file repositories/reference/linux-study-clean/arch/arm64/kernel/vdso.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/kernel/vdso.c- Extension
.c- Size
- 7821 bytes
- Lines
- 346
- 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.
- 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/cache.hlinux/clocksource.hlinux/elf.hlinux/err.hlinux/errno.hlinux/gfp.hlinux/kernel.hlinux/mm.hlinux/sched.hlinux/signal.hlinux/slab.hlinux/vdso_datastore.hlinux/vmalloc.hvdso/datapage.hvdso/helpers.hvdso/vsyscall.hasm/cacheflush.hasm/signal32.hasm/vdso.h
Detected Declarations
struct vdso_abi_infoenum vdso_abienum aarch32_mapfunction vdso_mremapfunction __vdso_initfunction __setup_additional_pagesfunction aarch32_sigpage_mremapfunction aarch32_alloc_kuser_vdso_pagefunction aarch32_alloc_sigpagefunction __aarch32_alloc_vdso_pagesfunction aarch32_alloc_vdso_pagesfunction aarch32_kuser_helpers_setupfunction aarch32_sigreturn_setupfunction aarch32_setup_additional_pagesfunction vdso_initfunction arch_setup_additional_pages
Annotated Snippet
struct vdso_abi_info {
const char *name;
const char *vdso_code_start;
const char *vdso_code_end;
unsigned long vdso_pages;
/* Code Mapping */
struct vm_special_mapping *cm;
};
static struct vdso_abi_info vdso_info[] __ro_after_init = {
[VDSO_ABI_AA64] = {
.name = "vdso",
.vdso_code_start = vdso_start,
.vdso_code_end = vdso_end,
},
#ifdef CONFIG_COMPAT_VDSO
[VDSO_ABI_AA32] = {
.name = "vdso32",
.vdso_code_start = vdso32_start,
.vdso_code_end = vdso32_end,
},
#endif /* CONFIG_COMPAT_VDSO */
};
static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
{
current->mm->context.vdso = (void *)new_vma->vm_start;
return 0;
}
static int __init __vdso_init(enum vdso_abi abi)
{
int i;
struct page **vdso_pagelist;
unsigned long pfn;
if (memcmp(vdso_info[abi].vdso_code_start, "\177ELF", 4)) {
pr_err("vDSO is not a valid ELF object!\n");
return -EINVAL;
}
vdso_info[abi].vdso_pages = (
vdso_info[abi].vdso_code_end -
vdso_info[abi].vdso_code_start) >>
PAGE_SHIFT;
vdso_pagelist = kzalloc_objs(struct page *, vdso_info[abi].vdso_pages);
if (vdso_pagelist == NULL)
return -ENOMEM;
/* Grab the vDSO code pages. */
pfn = sym_to_pfn(vdso_info[abi].vdso_code_start);
for (i = 0; i < vdso_info[abi].vdso_pages; i++)
vdso_pagelist[i] = pfn_to_page(pfn + i);
vdso_info[abi].cm->pages = vdso_pagelist;
return 0;
}
static int __setup_additional_pages(enum vdso_abi abi,
struct mm_struct *mm,
struct linux_binprm *bprm,
int uses_interp)
{
unsigned long vdso_base, vdso_text_len, vdso_mapping_len;
unsigned long gp_flags = 0;
void *ret;
BUILD_BUG_ON(VDSO_NR_PAGES != __VDSO_PAGES);
vdso_text_len = vdso_info[abi].vdso_pages << PAGE_SHIFT;
/* Be sure to map the data page */
vdso_mapping_len = vdso_text_len + VDSO_NR_PAGES * PAGE_SIZE;
vdso_base = get_unmapped_area(NULL, 0, vdso_mapping_len, 0, 0);
if (IS_ERR_VALUE(vdso_base)) {
ret = ERR_PTR(vdso_base);
goto up_fail;
}
ret = vdso_install_vvar_mapping(mm, vdso_base);
if (IS_ERR(ret))
goto up_fail;
if (system_supports_bti_kernel())
gp_flags = VM_ARM64_BTI;
Annotation
- Immediate include surface: `linux/cache.h`, `linux/clocksource.h`, `linux/elf.h`, `linux/err.h`, `linux/errno.h`, `linux/gfp.h`, `linux/kernel.h`, `linux/mm.h`.
- Detected declarations: `struct vdso_abi_info`, `enum vdso_abi`, `enum aarch32_map`, `function vdso_mremap`, `function __vdso_init`, `function __setup_additional_pages`, `function aarch32_sigpage_mremap`, `function aarch32_alloc_kuser_vdso_page`, `function aarch32_alloc_sigpage`, `function __aarch32_alloc_vdso_pages`.
- 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.