linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	 x86@kernel.org,  "H. Peter Anvin" <hpa@zytor.com>,
	 Kees Cook <kees@kernel.org>,
	 Thomas Gleixner <tglx@linutronix.de>,
	 linux-kernel@vger.kernel.org,  linux-mm@kvack.org
Subject: Re: [PATCH 2/2] x86: vdso: Remove redundant ifdeffery around in_ia32_syscall()
Date: Tue, 10 Sep 2024 09:34:46 -0500	[thread overview]
Message-ID: <8734m7d1bt.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <20240910-x86-vdso-ifdef-v1-2-877c9df9b081@linutronix.de> ("Thomas =?utf-8?Q?Wei=C3=9Fschuh=22's?= message of "Tue, 10 Sep 2024 12:11:36 +0200")

Thomas Weißschuh <thomas.weissschuh@linutronix.de> writes:

> The ifdefs only guard code that is also guarded by in_ia32_syscall(),
> which already contains the same ifdefs itself.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
>  arch/x86/entry/vdso/vma.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
> index 9059b9d96393..ab2b011471e0 100644
> --- a/arch/x86/entry/vdso/vma.c
> +++ b/arch/x86/entry/vdso/vma.c
> @@ -75,7 +75,6 @@ static vm_fault_t vdso_fault(const struct vm_special_mapping *sm,
>  static void vdso_fix_landing(const struct vdso_image *image,
>  		struct vm_area_struct *new_vma)
>  {
> -#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
>  	if (in_ia32_syscall() && image == &vdso_image_32) {
>  		struct pt_regs *regs = current_pt_regs();
>  		unsigned long vdso_land = image->sym_int80_landing_pad;
> @@ -86,7 +85,6 @@ static void vdso_fix_landing(const struct vdso_image *image,
>  		if (regs->ip == old_land_addr)
>  			regs->ip = new_vma->vm_start + vdso_land;
>  	}
> -#endif
>  }
>  
>  static int vdso_mremap(const struct vm_special_mapping *sm,
> @@ -339,7 +337,6 @@ int compat_arch_setup_additional_pages(struct linux_binprm *bprm,
>  
>  bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
>  {
> -#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
>  	const struct vdso_image *image = current->mm->context.vdso_image;
>  	unsigned long vdso = (unsigned long) current->mm->context.vdso;
>  
> @@ -348,7 +345,6 @@ bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
>  		    regs->ip == vdso + image->sym_vdso32_rt_sigreturn_landing_pad)
>  			return true;
>  	}
> -#endif
>  	return false;
>  }

Have you tested to verify that after this change
arch_syscall_is_vdso_signature compiles out the "image" and "vdso"
variables?

If the compilers don't it might be worth it rearrange the code as:
	if (in_ia32_syscall()) {
		const struct vdso_image *image = current->mm->context.vdso_image;
		unsigned long vdso = (unsigned long) current->mm->context.vdso;

		if (image == &vdso_image_32) {
                	....
                        return true;
                }
	}
        return false.

Making the variables depend upon in_ia32_syscall() so you can be certain
they are compiles out.

Eric



  reply	other threads:[~2024-09-10 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 10:11 [PATCH 0/2] x86: vdso: Two small ifdef cleanups Thomas Weißschuh
2024-09-10 10:11 ` [PATCH 1/2] x86: vdso: Remove ifdeffery around page setup variants Thomas Weißschuh
2024-09-10 10:11 ` [PATCH 2/2] x86: vdso: Remove redundant ifdeffery around in_ia32_syscall() Thomas Weißschuh
2024-09-10 14:34   ` Eric W. Biederman [this message]
2024-09-10 18:10     ` Thomas Weißschuh
2025-04-22 12:25 ` [PATCH 0/2] x86: vdso: Two small ifdef cleanups Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734m7d1bt.fsf@email.froward.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox