Skip to content

Commit 0cbc265

Browse files
committed
arm64: vdso32: Remove a bunch of #ifdef CONFIG_COMPAT_VDSO guards
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>
1 parent f75aef3 commit 0cbc265

1 file changed

Lines changed: 17 additions & 27 deletions

File tree

arch/arm64/kernel/vdso.c

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,11 @@
3030
#include <asm/vdso.h>
3131

3232
extern char vdso_start[], vdso_end[];
33-
#ifdef CONFIG_COMPAT_VDSO
3433
extern char vdso32_start[], vdso32_end[];
35-
#endif /* CONFIG_COMPAT_VDSO */
3634

3735
enum vdso_abi {
3836
VDSO_ABI_AA64,
39-
#ifdef CONFIG_COMPAT_VDSO
4037
VDSO_ABI_AA32,
41-
#endif /* CONFIG_COMPAT_VDSO */
4238
};
4339

4440
enum vvar_pages {
@@ -284,21 +280,17 @@ static int __setup_additional_pages(enum vdso_abi abi,
284280
/*
285281
* Create and map the vectors page for AArch32 tasks.
286282
*/
287-
#ifdef CONFIG_COMPAT_VDSO
288283
static int aarch32_vdso_mremap(const struct vm_special_mapping *sm,
289284
struct vm_area_struct *new_vma)
290285
{
291286
return __vdso_remap(VDSO_ABI_AA32, sm, new_vma);
292287
}
293-
#endif /* CONFIG_COMPAT_VDSO */
294288

295289
enum aarch32_map {
296290
AA32_MAP_VECTORS, /* kuser helpers */
297-
#ifdef CONFIG_COMPAT_VDSO
291+
AA32_MAP_SIGPAGE,
298292
AA32_MAP_VVAR,
299293
AA32_MAP_VDSO,
300-
#endif
301-
AA32_MAP_SIGPAGE
302294
};
303295

304296
static struct page *aarch32_vectors_page __ro_after_init;
@@ -309,7 +301,10 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
309301
.name = "[vectors]", /* ABI */
310302
.pages = &aarch32_vectors_page,
311303
},
312-
#ifdef CONFIG_COMPAT_VDSO
304+
[AA32_MAP_SIGPAGE] = {
305+
.name = "[sigpage]", /* ABI */
306+
.pages = &aarch32_sig_page,
307+
},
313308
[AA32_MAP_VVAR] = {
314309
.name = "[vvar]",
315310
.fault = vvar_fault,
@@ -319,11 +314,6 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
319314
.name = "[vdso]",
320315
.mremap = aarch32_vdso_mremap,
321316
},
322-
#endif /* CONFIG_COMPAT_VDSO */
323-
[AA32_MAP_SIGPAGE] = {
324-
.name = "[sigpage]", /* ABI */
325-
.pages = &aarch32_sig_page,
326-
},
327317
};
328318

329319
static int aarch32_alloc_kuser_vdso_page(void)
@@ -362,25 +352,25 @@ static int aarch32_alloc_sigpage(void)
362352
return 0;
363353
}
364354

365-
#ifdef CONFIG_COMPAT_VDSO
366355
static int __aarch32_alloc_vdso_pages(void)
367356
{
357+
358+
if (!IS_ENABLED(CONFIG_COMPAT_VDSO))
359+
return 0;
360+
368361
vdso_info[VDSO_ABI_AA32].dm = &aarch32_vdso_maps[AA32_MAP_VVAR];
369362
vdso_info[VDSO_ABI_AA32].cm = &aarch32_vdso_maps[AA32_MAP_VDSO];
370363

371364
return __vdso_init(VDSO_ABI_AA32);
372365
}
373-
#endif /* CONFIG_COMPAT_VDSO */
374366

375367
static int __init aarch32_alloc_vdso_pages(void)
376368
{
377369
int ret;
378370

379-
#ifdef CONFIG_COMPAT_VDSO
380371
ret = __aarch32_alloc_vdso_pages();
381372
if (ret)
382373
return ret;
383-
#endif
384374

385375
ret = aarch32_alloc_sigpage();
386376
if (ret)
@@ -449,14 +439,14 @@ int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
449439
if (ret)
450440
goto out;
451441

452-
#ifdef CONFIG_COMPAT_VDSO
453-
ret = __setup_additional_pages(VDSO_ABI_AA32,
454-
mm,
455-
bprm,
456-
uses_interp);
457-
if (ret)
458-
goto out;
459-
#endif /* CONFIG_COMPAT_VDSO */
442+
if (IS_ENABLED(CONFIG_COMPAT_VDSO)) {
443+
ret = __setup_additional_pages(VDSO_ABI_AA32,
444+
mm,
445+
bprm,
446+
uses_interp);
447+
if (ret)
448+
goto out;
449+
}
460450

461451
ret = aarch32_sigreturn_setup(mm);
462452
out:

0 commit comments

Comments
 (0)