^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright 2007 Andi Kleen, SUSE Labs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * This contains most of the x86 vDSO kernel-side code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/sched/task_stack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/random.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/cpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/time_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/pvclock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/vgtod.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/proto.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/vdso.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/vvar.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <asm/tlb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <asm/desc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <asm/cpufeature.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <clocksource/hyperv_timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #undef _ASM_X86_VVAR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define EMIT_VVAR(name, offset) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) const size_t name ## _offset = offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include <asm/vvar.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct vdso_data *arch_get_vdso_data(void *vvar_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) return (struct vdso_data *)(vvar_page + _vdso_data_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #undef EMIT_VVAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned int vclocks_used __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #if defined(CONFIG_X86_64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned int __read_mostly vdso64_enabled = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void __init init_vdso_image(const struct vdso_image *image)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) BUG_ON(image->size % PAGE_SIZE != 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) apply_alternatives((struct alt_instr *)(image->data + image->alt),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) (struct alt_instr *)(image->data + image->alt +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) image->alt_len));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static const struct vm_special_mapping vvar_mapping;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct linux_binprm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static vm_fault_t vdso_fault(const struct vm_special_mapping *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct vm_area_struct *vma, struct vm_fault *vmf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) const struct vdso_image *image = vma->vm_mm->context.vdso_image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) if (!image || (vmf->pgoff << PAGE_SHIFT) >= image->size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return VM_FAULT_SIGBUS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) vmf->page = virt_to_page(image->data + (vmf->pgoff << PAGE_SHIFT));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) get_page(vmf->page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static void vdso_fix_landing(const struct vdso_image *image,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct vm_area_struct *new_vma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) if (in_ia32_syscall() && image == &vdso_image_32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct pt_regs *regs = current_pt_regs();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) unsigned long vdso_land = image->sym_int80_landing_pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) unsigned long old_land_addr = vdso_land +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) (unsigned long)current->mm->context.vdso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* Fixing userspace landing - look at do_fast_syscall_32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) if (regs->ip == old_land_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) regs->ip = new_vma->vm_start + vdso_land;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) static int vdso_mremap(const struct vm_special_mapping *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct vm_area_struct *new_vma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) const struct vdso_image *image = current->mm->context.vdso_image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) if (image->size != new_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) vdso_fix_landing(image, new_vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) current->mm->context.vdso = (void __user *)new_vma->vm_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static int vvar_mremap(const struct vm_special_mapping *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct vm_area_struct *new_vma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) const struct vdso_image *image = new_vma->vm_mm->context.vdso_image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) if (new_size != -image->sym_vvar_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #ifdef CONFIG_TIME_NS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static struct page *find_timens_vvar_page(struct vm_area_struct *vma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) if (likely(vma->vm_mm == current->mm))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return current->nsproxy->time_ns->vvar_page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * VM_PFNMAP | VM_IO protect .fault() handler from being called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * through interfaces like /proc/$pid/mem or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * process_vm_{readv,writev}() as long as there's no .access()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * in special_mapping_vmops().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * For more details check_vma_flags() and __access_remote_vm()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) WARN(1, "vvar_page accessed remotely");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * The vvar page layout depends on whether a task belongs to the root or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * non-root time namespace. Whenever a task changes its namespace, the VVAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * page tables are cleared and then they will re-faulted with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * corresponding layout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * See also the comment near timens_setup_vdso_data() for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) struct mm_struct *mm = task->mm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct vm_area_struct *vma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) mmap_read_lock(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) for (vma = mm->mmap; vma; vma = vma->vm_next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) unsigned long size = vma->vm_end - vma->vm_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if (vma_is_special_mapping(vma, &vvar_mapping))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) zap_page_range(vma, vma->vm_start, size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) mmap_read_unlock(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static inline struct page *find_timens_vvar_page(struct vm_area_struct *vma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct vm_area_struct *vma, struct vm_fault *vmf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) const struct vdso_image *image = vma->vm_mm->context.vdso_image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) unsigned long pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) long sym_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) if (!image)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) return VM_FAULT_SIGBUS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) sym_offset = (long)(vmf->pgoff << PAGE_SHIFT) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) image->sym_vvar_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * Sanity check: a symbol offset of zero means that the page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * does not exist for this vdso image, not that the page is at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * offset zero relative to the text mapping. This should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * impossible here, because sym_offset should only be zero for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * the page past the end of the vvar mapping.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) if (sym_offset == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) return VM_FAULT_SIGBUS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) if (sym_offset == image->sym_vvar_page) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) struct page *timens_page = find_timens_vvar_page(vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) pfn = __pa_symbol(&__vvar_page) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * If a task belongs to a time namespace then a namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * specific VVAR is mapped with the sym_vvar_page offset and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * the real VVAR page is mapped with the sym_timens_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * offset.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * See also the comment near timens_setup_vdso_data().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) if (timens_page) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) unsigned long addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) vm_fault_t err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * Optimization: inside time namespace pre-fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) * VVAR page too. As on timens page there are only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * offsets for clocks on VVAR, it'll be faulted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * shortly by VDSO code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) addr = vmf->address + (image->sym_timens_page - sym_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) err = vmf_insert_pfn(vma, addr, pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) if (unlikely(err & VM_FAULT_ERROR))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) pfn = page_to_pfn(timens_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) return vmf_insert_pfn(vma, vmf->address, pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) } else if (sym_offset == image->sym_pvclock_page) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) struct pvclock_vsyscall_time_info *pvti =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) pvclock_get_pvti_cpu0_va();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if (pvti && vclock_was_used(VDSO_CLOCKMODE_PVCLOCK)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) return vmf_insert_pfn_prot(vma, vmf->address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) __pa(pvti) >> PAGE_SHIFT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) pgprot_decrypted(vma->vm_page_prot));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) } else if (sym_offset == image->sym_hvclock_page) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) struct ms_hyperv_tsc_page *tsc_pg = hv_get_tsc_page();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) if (tsc_pg && vclock_was_used(VDSO_CLOCKMODE_HVCLOCK))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) return vmf_insert_pfn(vma, vmf->address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) virt_to_phys(tsc_pg) >> PAGE_SHIFT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) } else if (sym_offset == image->sym_timens_page) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct page *timens_page = find_timens_vvar_page(vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) if (!timens_page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) return VM_FAULT_SIGBUS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) pfn = __pa_symbol(&__vvar_page) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) return vmf_insert_pfn(vma, vmf->address, pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) return VM_FAULT_SIGBUS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) static const struct vm_special_mapping vdso_mapping = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .name = "[vdso]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .fault = vdso_fault,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .mremap = vdso_mremap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) static const struct vm_special_mapping vvar_mapping = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .name = "[vvar]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .fault = vvar_fault,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) .mremap = vvar_mremap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * Add vdso and vvar mappings to current process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * @image - blob to map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * @addr - request a specific address (zero to map at free addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) static int map_vdso(const struct vdso_image *image, unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) struct mm_struct *mm = current->mm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) struct vm_area_struct *vma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) unsigned long text_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) if (mmap_write_lock_killable(mm))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) return -EINTR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) addr = get_unmapped_area(NULL, addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) image->size - image->sym_vvar_start, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) if (IS_ERR_VALUE(addr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) ret = addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) goto up_fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) text_start = addr - image->sym_vvar_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) * MAYWRITE to allow gdb to COW and set breakpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) vma = _install_special_mapping(mm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) text_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) image->size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) VM_READ|VM_EXEC|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) &vdso_mapping);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) if (IS_ERR(vma)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) ret = PTR_ERR(vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) goto up_fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) vma = _install_special_mapping(mm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) -image->sym_vvar_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) VM_PFNMAP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) &vvar_mapping);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) if (IS_ERR(vma)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) ret = PTR_ERR(vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) do_munmap(mm, text_start, image->size, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) current->mm->context.vdso = (void __user *)text_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) current->mm->context.vdso_image = image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) up_fail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) mmap_write_unlock(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * Put the vdso above the (randomized) stack with another randomized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) * offset. This way there is no hole in the middle of address space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) * To save memory make sure it is still in the same PTE as the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * top. This doesn't give that many random bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) * Note that this algorithm is imperfect: the distribution of the vdso
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) * start address within a PMD is biased toward the end.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) * Only used for the 64-bit and x32 vdsos.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) static unsigned long vdso_addr(unsigned long start, unsigned len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) unsigned long addr, end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) unsigned offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) * Round up the start address. It can start out unaligned as a result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) * of stack start randomization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) start = PAGE_ALIGN(start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) /* Round the lowest possible end address up to a PMD boundary. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) end = (start + len + PMD_SIZE - 1) & PMD_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) if (end >= TASK_SIZE_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) end = TASK_SIZE_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) end -= len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) if (end > start) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) addr = start + (offset << PAGE_SHIFT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) addr = start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) * Forcibly align the final address in case we have a hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * issue that requires alignment for performance reasons.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) addr = align_vdso_addr(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) return addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) static int map_vdso_randomized(const struct vdso_image *image)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) unsigned long addr = vdso_addr(current->mm->start_stack, image->size-image->sym_vvar_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) return map_vdso(image, addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) int map_vdso_once(const struct vdso_image *image, unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) struct mm_struct *mm = current->mm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) struct vm_area_struct *vma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) mmap_write_lock(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) * Check if we have already mapped vdso blob - fail to prevent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) * abusing from userspace install_speciall_mapping, which may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) * not do accounting and rlimit right.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) * We could search vma near context.vdso, but it's a slowpath,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) * so let's explicitly check all VMAs to be completely sure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) for (vma = mm->mmap; vma; vma = vma->vm_next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) if (vma_is_special_mapping(vma, &vdso_mapping) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) vma_is_special_mapping(vma, &vvar_mapping)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) mmap_write_unlock(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) return -EEXIST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) mmap_write_unlock(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) return map_vdso(image, addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) static int load_vdso32(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) if (vdso32_enabled != 1) /* Other values all mean "disabled" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) return map_vdso(&vdso_image_32, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) if (!vdso64_enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) return map_vdso_randomized(&vdso_image_64);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) #ifdef CONFIG_COMPAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) int compat_arch_setup_additional_pages(struct linux_binprm *bprm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) int uses_interp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) #ifdef CONFIG_X86_X32_ABI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if (test_thread_flag(TIF_X32)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) if (!vdso64_enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) return map_vdso_randomized(&vdso_image_x32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) #ifdef CONFIG_IA32_EMULATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) return load_vdso32();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) return load_vdso32();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) static __init int vdso_setup(char *s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) vdso64_enabled = simple_strtoul(s, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) __setup("vdso=", vdso_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) static int __init init_vdso(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) BUILD_BUG_ON(VDSO_CLOCKMODE_MAX >= 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) init_vdso_image(&vdso_image_64);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) #ifdef CONFIG_X86_X32_ABI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) init_vdso_image(&vdso_image_x32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) subsys_initcall(init_vdso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) #endif /* CONFIG_X86_64 */