All other architectures but s390 use a void pointer named 'vdso'
to reference the VDSO mapping.
In a following patch, the VDSO data page will be put in front of
text, vdso_base will then not anymore point to VDSO text.
To avoid confusion between vdso_base and VDSO text, rename vdso_base
into vdso and make it a void __user *.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/8e6cefe474aa4ceba028abb729485cd46c140990.1601197618.git.christophe.leroy@csgroup.eu
 
 
 typedef struct {
        unsigned long id;
-       unsigned long vdso_base;
+       void __user *vdso;
 } mm_context_t;
 
 void update_bats(void);
 
 
        struct hash_mm_context *hash_context;
 
-       unsigned long vdso_base;
+       void __user *vdso;
        /*
         * pagetable fragment support
         */
 
        NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize);                      \
        NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize);                      \
        NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize);                      \
-       VDSO_AUX_ENT(AT_SYSINFO_EHDR, current->mm->context.vdso_base);  \
+       VDSO_AUX_ENT(AT_SYSINFO_EHDR, (unsigned long)current->mm->context.vdso);\
        ARCH_DLINFO_CACHE_GEOMETRY;                                     \
 } while (0)
 
 
 static inline void arch_unmap(struct mm_struct *mm,
                              unsigned long start, unsigned long end)
 {
-       if (start <= mm->context.vdso_base && mm->context.vdso_base < end)
-               mm->context.vdso_base = 0;
+       unsigned long vdso_base = (unsigned long)mm->context.vdso;
+
+       if (start <= vdso_base && vdso_base < end)
+               mm->context.vdso = NULL;
 }
 
 #ifdef CONFIG_PPC_MEM_KEYS
 
 typedef struct {
        unsigned int    id;
        unsigned int    active;
-       unsigned long   vdso_base;
+       void __user     *vdso;
 } mm_context_t;
 
 #endif /* !__ASSEMBLY__ */
 
 typedef struct {
        unsigned int    id;
        unsigned int    active;
-       unsigned long   vdso_base;
+       void __user     *vdso;
 } mm_context_t;
 
 /* patch sites */
 
 typedef struct {
        unsigned int id;
        unsigned int active;
-       unsigned long vdso_base;
+       void __user *vdso;
        void *pte_frag;
 } mm_context_t;
 
 
 typedef struct {
        unsigned int    id;
        unsigned int    active;
-       unsigned long   vdso_base;
+       void __user     *vdso;
 } mm_context_t;
 
 /* Page size definitions, common between 32 and 64-bit
 
        }
 
        /* Save user registers on the stack */
-       if (vdso32_rt_sigtramp && tsk->mm->context.vdso_base) {
-               tramp = tsk->mm->context.vdso_base + vdso32_rt_sigtramp;
+       if (vdso32_rt_sigtramp && tsk->mm->context.vdso) {
+               tramp = (unsigned long)tsk->mm->context.vdso + vdso32_rt_sigtramp;
        } else {
                tramp = (unsigned long)mctx->mc_pad;
                /* Set up the sigreturn trampoline: li r0,sigret; sc */
        else
                unsafe_save_user_regs(regs, mctx, tm_mctx, 1, failed);
 
-       if (vdso32_sigtramp && tsk->mm->context.vdso_base) {
-               tramp = tsk->mm->context.vdso_base + vdso32_sigtramp;
+       if (vdso32_sigtramp && tsk->mm->context.vdso) {
+               tramp = (unsigned long)tsk->mm->context.vdso + vdso32_sigtramp;
        } else {
                tramp = (unsigned long)mctx->mc_pad;
                /* Set up the sigreturn trampoline: li r0,sigret; sc */
 
        tsk->thread.fp_state.fpscr = 0;
 
        /* Set up to return from userspace. */
-       if (vdso64_rt_sigtramp && tsk->mm->context.vdso_base) {
-               regs->nip = tsk->mm->context.vdso_base + vdso64_rt_sigtramp;
+       if (vdso64_rt_sigtramp && tsk->mm->context.vdso) {
+               regs->nip = (unsigned long)tsk->mm->context.vdso + vdso64_rt_sigtramp;
        } else {
                err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
                if (err)
 
        if (new_size != text_size + PAGE_SIZE)
                return -EINVAL;
 
-       current->mm->context.vdso_base = new_vma->vm_start;
+       current->mm->context.vdso = (void __user *)new_vma->vm_start;
 
        return 0;
 }
         * install_special_mapping or the perf counter mmap tracking code
         * will fail to recognise it as a vDSO.
         */
-       current->mm->context.vdso_base = vdso_base;
+       mm->context.vdso = (void __user *)vdso_base;
 
        /*
         * our vma flags don't have VM_WRITE so by default, the process isn't
        struct mm_struct *mm = current->mm;
        int rc;
 
-       mm->context.vdso_base = 0;
+       mm->context.vdso = NULL;
 
        if (!vdso_ready)
                return 0;
 
        rc = __arch_setup_additional_pages(bprm, uses_interp);
        if (rc)
-               mm->context.vdso_base = 0;
+               mm->context.vdso = NULL;
 
        mmap_write_unlock(mm);
        return rc;
 
 {
        if (nip == fp + offsetof(struct signal_frame_32, mctx.mc_pad))
                return 1;
-       if (vdso32_sigtramp && current->mm->context.vdso_base &&
-           nip == current->mm->context.vdso_base + vdso32_sigtramp)
+       if (vdso32_sigtramp && current->mm->context.vdso &&
+           nip == (unsigned long)current->mm->context.vdso + vdso32_sigtramp)
                return 1;
        return 0;
 }
        if (nip == fp + offsetof(struct rt_signal_frame_32,
                                 uc.uc_mcontext.mc_pad))
                return 1;
-       if (vdso32_rt_sigtramp && current->mm->context.vdso_base &&
-           nip == current->mm->context.vdso_base + vdso32_rt_sigtramp)
+       if (vdso32_rt_sigtramp && current->mm->context.vdso &&
+           nip == (unsigned long)current->mm->context.vdso + vdso32_rt_sigtramp)
                return 1;
        return 0;
 }
 
 {
        if (nip == fp + offsetof(struct signal_frame_64, tramp))
                return 1;
-       if (vdso64_rt_sigtramp && current->mm->context.vdso_base &&
-           nip == current->mm->context.vdso_base + vdso64_rt_sigtramp)
+       if (vdso64_rt_sigtramp && current->mm->context.vdso &&
+           nip == (unsigned long)current->mm->context.vdso + vdso64_rt_sigtramp)
                return 1;
        return 0;
 }