arm64: vdso32: Remove a bunch of #ifdef CONFIG_COMPAT_VDSO guards
authorWill Deacon <will@kernel.org>
Mon, 22 Jun 2020 12:28:34 +0000 (13:28 +0100)
committerWill Deacon <will@kernel.org>
Tue, 1 Sep 2020 12:37:56 +0000 (13:37 +0100)
Most of the compat vDSO code can be built and guarded using IS_ENABLED,
so drop the unnecessary #ifdefs.

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/vdso.c

index d4202a32abc9ceed76779f41f77156d5a71088a7..1501b22a3cf66f8b29d648eac02b3f0d578078d4 100644 (file)
 #include <asm/vdso.h>
 
 extern char vdso_start[], vdso_end[];
-#ifdef CONFIG_COMPAT_VDSO
 extern char vdso32_start[], vdso32_end[];
-#endif /* CONFIG_COMPAT_VDSO */
 
 enum vdso_abi {
        VDSO_ABI_AA64,
-#ifdef CONFIG_COMPAT_VDSO
        VDSO_ABI_AA32,
-#endif /* CONFIG_COMPAT_VDSO */
 };
 
 enum vvar_pages {
@@ -284,21 +280,17 @@ up_fail:
 /*
  * Create and map the vectors page for AArch32 tasks.
  */
-#ifdef CONFIG_COMPAT_VDSO
 static int aarch32_vdso_mremap(const struct vm_special_mapping *sm,
                struct vm_area_struct *new_vma)
 {
        return __vdso_remap(VDSO_ABI_AA32, sm, new_vma);
 }
-#endif /* CONFIG_COMPAT_VDSO */
 
 enum aarch32_map {
        AA32_MAP_VECTORS, /* kuser helpers */
-#ifdef CONFIG_COMPAT_VDSO
+       AA32_MAP_SIGPAGE,
        AA32_MAP_VVAR,
        AA32_MAP_VDSO,
-#endif
-       AA32_MAP_SIGPAGE
 };
 
 static struct page *aarch32_vectors_page __ro_after_init;
@@ -309,7 +301,10 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
                .name   = "[vectors]", /* ABI */
                .pages  = &aarch32_vectors_page,
        },
-#ifdef CONFIG_COMPAT_VDSO
+       [AA32_MAP_SIGPAGE] = {
+               .name   = "[sigpage]", /* ABI */
+               .pages  = &aarch32_sig_page,
+       },
        [AA32_MAP_VVAR] = {
                .name = "[vvar]",
                .fault = vvar_fault,
@@ -319,11 +314,6 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
                .name = "[vdso]",
                .mremap = aarch32_vdso_mremap,
        },
-#endif /* CONFIG_COMPAT_VDSO */
-       [AA32_MAP_SIGPAGE] = {
-               .name   = "[sigpage]", /* ABI */
-               .pages  = &aarch32_sig_page,
-       },
 };
 
 static int aarch32_alloc_kuser_vdso_page(void)
@@ -362,25 +352,25 @@ static int aarch32_alloc_sigpage(void)
        return 0;
 }
 
-#ifdef CONFIG_COMPAT_VDSO
 static int __aarch32_alloc_vdso_pages(void)
 {
+
+       if (!IS_ENABLED(CONFIG_COMPAT_VDSO))
+               return 0;
+
        vdso_info[VDSO_ABI_AA32].dm = &aarch32_vdso_maps[AA32_MAP_VVAR];
        vdso_info[VDSO_ABI_AA32].cm = &aarch32_vdso_maps[AA32_MAP_VDSO];
 
        return __vdso_init(VDSO_ABI_AA32);
 }
-#endif /* CONFIG_COMPAT_VDSO */
 
 static int __init aarch32_alloc_vdso_pages(void)
 {
        int ret;
 
-#ifdef CONFIG_COMPAT_VDSO
        ret = __aarch32_alloc_vdso_pages();
        if (ret)
                return ret;
-#endif
 
        ret = aarch32_alloc_sigpage();
        if (ret)
@@ -449,14 +439,14 @@ int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
        if (ret)
                goto out;
 
-#ifdef CONFIG_COMPAT_VDSO
-       ret = __setup_additional_pages(VDSO_ABI_AA32,
-                                      mm,
-                                      bprm,
-                                      uses_interp);
-       if (ret)
-               goto out;
-#endif /* CONFIG_COMPAT_VDSO */
+       if (IS_ENABLED(CONFIG_COMPAT_VDSO)) {
+               ret = __setup_additional_pages(VDSO_ABI_AA32,
+                                              mm,
+                                              bprm,
+                                              uses_interp);
+               if (ret)
+                       goto out;
+       }
 
        ret = aarch32_sigreturn_setup(mm);
 out: