Skip to content

Commit 24244df

Browse files
committed
Merge tag 'x86-entry-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 vdso updates from Ingo Molnar: "Two changes to simplify the x86 vDSO code a bit" * tag 'x86-entry-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/vdso: Remove redundant #ifdeffery around in_ia32_syscall() x86/vdso: Remove #ifdeffery around page setup variants
2 parents 0aee061 + bdb30d5 commit 24244df

File tree

3 files changed

+12
-35
lines changed

3 files changed

+12
-35
lines changed

arch/x86/entry/vdso/vma.c

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ static vm_fault_t vdso_fault(const struct vm_special_mapping *sm,
6565
static void vdso_fix_landing(const struct vdso_image *image,
6666
struct vm_area_struct *new_vma)
6767
{
68-
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
6968
if (in_ia32_syscall() && image == &vdso_image_32) {
7069
struct pt_regs *regs = current_pt_regs();
7170
unsigned long vdso_land = image->sym_int80_landing_pad;
@@ -76,7 +75,6 @@ static void vdso_fix_landing(const struct vdso_image *image,
7675
if (regs->ip == old_land_addr)
7776
regs->ip = new_vma->vm_start + vdso_land;
7877
}
79-
#endif
8078
}
8179

8280
static int vdso_mremap(const struct vm_special_mapping *sm,
@@ -227,53 +225,45 @@ int map_vdso_once(const struct vdso_image *image, unsigned long addr)
227225
return map_vdso(image, addr);
228226
}
229227

230-
#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
231228
static int load_vdso32(void)
232229
{
233230
if (vdso32_enabled != 1) /* Other values all mean "disabled" */
234231
return 0;
235232

236233
return map_vdso(&vdso_image_32, 0);
237234
}
238-
#endif
239235

240-
#ifdef CONFIG_X86_64
241236
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
242237
{
243-
if (!vdso64_enabled)
244-
return 0;
238+
if (IS_ENABLED(CONFIG_X86_64)) {
239+
if (!vdso64_enabled)
240+
return 0;
241+
242+
return map_vdso(&vdso_image_64, 0);
243+
}
245244

246-
return map_vdso(&vdso_image_64, 0);
245+
return load_vdso32();
247246
}
248247

249248
#ifdef CONFIG_COMPAT
250249
int compat_arch_setup_additional_pages(struct linux_binprm *bprm,
251250
int uses_interp, bool x32)
252251
{
253-
#ifdef CONFIG_X86_X32_ABI
254-
if (x32) {
252+
if (IS_ENABLED(CONFIG_X86_X32_ABI) && x32) {
255253
if (!vdso64_enabled)
256254
return 0;
257255
return map_vdso(&vdso_image_x32, 0);
258256
}
259-
#endif
260-
#ifdef CONFIG_IA32_EMULATION
261-
return load_vdso32();
262-
#else
257+
258+
if (IS_ENABLED(CONFIG_IA32_EMULATION))
259+
return load_vdso32();
260+
263261
return 0;
264-
#endif
265-
}
266-
#endif
267-
#else
268-
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
269-
{
270-
return load_vdso32();
271262
}
272263
#endif
273264

274265
bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
275266
{
276-
#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
277267
const struct vdso_image *image = current->mm->context.vdso_image;
278268
unsigned long vdso = (unsigned long) current->mm->context.vdso;
279269

@@ -282,7 +272,6 @@ bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
282272
regs->ip == vdso + image->sym_vdso32_rt_sigreturn_landing_pad)
283273
return true;
284274
}
285-
#endif
286275
return false;
287276
}
288277

arch/x86/include/asm/elf.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,8 @@ typedef struct user_i387_struct elf_fpregset_t;
7676

7777
#include <asm/vdso.h>
7878

79-
#ifdef CONFIG_X86_64
8079
extern unsigned int vdso64_enabled;
81-
#endif
82-
#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
8380
extern unsigned int vdso32_enabled;
84-
#endif
8581

8682
/*
8783
* This is used to ensure we don't load something for the wrong architecture.

arch/x86/include/asm/vdso.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,9 @@ struct vdso_image {
2727
long sym_vdso32_rt_sigreturn_landing_pad;
2828
};
2929

30-
#ifdef CONFIG_X86_64
3130
extern const struct vdso_image vdso_image_64;
32-
#endif
33-
34-
#ifdef CONFIG_X86_X32_ABI
3531
extern const struct vdso_image vdso_image_x32;
36-
#endif
37-
38-
#if defined CONFIG_X86_32 || defined CONFIG_COMPAT
3932
extern const struct vdso_image vdso_image_32;
40-
#endif
4133

4234
extern int __init init_vdso_image(const struct vdso_image *image);
4335

0 commit comments

Comments
 (0)