From: Stefani Seibold <stefani@seibold.net>
To: Andy Lutomirski <luto@amacapital.net>
Cc: X86 ML <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
Greg KH <gregkh@linuxfoundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Andi Kleen <ak@linux.intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
John Stultz <john.stultz@linaro.org>,
Pavel Emelyanov <xemul@parallels.com>,
Cyrill Gorcunov <gorcunov@openvz.org>,
andriy.shevchenko@linux.intel.com,
Martin.Runge@rohde-schwarz.com, Andreas.Brief@rohde-schwarz.com
Subject: Re: [PATCH v2 3/4] x86: Patch alternatives in the 32-bit vDSO
Date: Sat, 01 Mar 2014 15:04:27 +0100 [thread overview]
Message-ID: <1393682667.982.28.camel@wall-e.seibold.net> (raw)
In-Reply-To: <09bf3b51cae30d91b5e8fb05453c1d8d886d3839.1393545985.git.luto@amacapital.net>
Am Donnerstag, den 27.02.2014, 16:18 -0800 schrieb Andy Lutomirski:
> rdtsc_barrier() needs this.
>
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
> arch/x86/include/asm/vdso.h | 2 ++
> arch/x86/vdso/vdso32-setup.c | 25 +++++++++++++------------
> arch/x86/vdso/vma.c | 9 ++++++---
> 3 files changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
> index 6db8b23..a844f90 100644
> --- a/arch/x86/include/asm/vdso.h
> +++ b/arch/x86/include/asm/vdso.h
> @@ -40,4 +40,6 @@ extern const char vdso32_int80_start, vdso32_int80_end;
> extern const char vdso32_syscall_start, vdso32_syscall_end;
> extern const char vdso32_sysenter_start, vdso32_sysenter_end;
>
> +void __init patch_vdso32(void *vdso, size_t len);
> +
> #endif /* _ASM_X86_VDSO_H */
> diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
> index 6b74a46..b37aa1d 100644
> --- a/arch/x86/vdso/vdso32-setup.c
> +++ b/arch/x86/vdso/vdso32-setup.c
> @@ -273,29 +273,30 @@ static void map_compat_vdso(int map)
>
> int __init sysenter_setup(void)
> {
> - void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
> - const void *vsyscall;
> - size_t vsyscall_len;
> + void *vdso_page = (void *)get_zeroed_page(GFP_ATOMIC);
> + const void *vdso;
> + size_t vdso_len;
>
> - vdso32_pages[0] = virt_to_page(syscall_page);
> + vdso32_pages[0] = virt_to_page(vdso_page);
>
> #ifdef CONFIG_X86_32
> gate_vma_init();
> #endif
>
> if (vdso32_syscall()) {
> - vsyscall = &vdso32_syscall_start;
> - vsyscall_len = &vdso32_syscall_end - &vdso32_syscall_start;
> + vdso = &vdso32_syscall_start;
> + vdso_len = &vdso32_syscall_end - &vdso32_syscall_start;
> } else if (vdso32_sysenter()){
> - vsyscall = &vdso32_sysenter_start;
> - vsyscall_len = &vdso32_sysenter_end - &vdso32_sysenter_start;
> + vdso = &vdso32_sysenter_start;
> + vdso_len = &vdso32_sysenter_end - &vdso32_sysenter_start;
> } else {
> - vsyscall = &vdso32_int80_start;
> - vsyscall_len = &vdso32_int80_end - &vdso32_int80_start;
> + vdso = &vdso32_int80_start;
> + vdso_len = &vdso32_int80_end - &vdso32_int80_start;
> }
>
> - memcpy(syscall_page, vsyscall, vsyscall_len);
> - relocate_vdso(syscall_page);
> + memcpy(vdso_page, vdso, vdso_len);
> + patch_vdso32(vdso_page, vdso_len);
This will fail with 32 bit kernels since vma.c is only build for 64 bit
kernel. I have fixed this.
> + relocate_vdso(vdso_page);
>
> return 0;
> }
> diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
> index 431e875..149caa1 100644
> --- a/arch/x86/vdso/vma.c
> +++ b/arch/x86/vdso/vma.c
> @@ -28,8 +28,11 @@ static unsigned vdso_size;
> extern char vdsox32_start[], vdsox32_end[];
> extern struct page *vdsox32_pages[];
> static unsigned vdsox32_size;
> +#endif
>
> -static void __init patch_vdsox32(void *vdso, size_t len)
> +#if defined(CONFIG_X86_32) || defined(CONFIG_X86_X32_ABI) || \
> + defined(CONFIG_COMPAT)
> +void __init patch_vdso32(void *vdso, size_t len)
> {
> Elf32_Ehdr *hdr = vdso;
> Elf32_Shdr *sechdrs, *alt_sec = 0;
> @@ -52,7 +55,7 @@ static void __init patch_vdsox32(void *vdso, size_t len)
> }
>
> /* If we get here, it's probably a bug. */
> - pr_warning("patch_vdsox32: .altinstructions not found\n");
> + pr_warning("patch_vdso32: .altinstructions not found\n");
> return; /* nothing to patch */
>
> found:
> @@ -104,7 +107,7 @@ static int __init init_vdso(void)
> vdso_pages[i] = virt_to_page(vdso_start + i*PAGE_SIZE);
>
> #ifdef CONFIG_X86_X32_ABI
> - patch_vdsox32(vdsox32_start, vdsox32_end - vdsox32_start);
> + patch_vdso32(vdsox32_start, vdsox32_end - vdsox32_start);
> npages = (vdsox32_end - vdsox32_start + PAGE_SIZE - 1) / PAGE_SIZE;
> vdsox32_size = npages << PAGE_SHIFT;
> for (i = 0; i < npages; i++)
next prev parent reply other threads:[~2014-03-01 14:04 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 19:34 Final: Add 32 bit VDSO time function support Stefani Seibold
2014-02-26 20:10 ` Andy Lutomirski
2014-02-26 20:45 ` Greg KH
2014-02-26 20:54 ` Andy Lutomirski
2014-02-27 0:55 ` Andy Lutomirski
2014-02-27 1:02 ` [PATCH 0/2] Improvements/fixes to 32-bit vdso timing Andy Lutomirski
2014-02-27 1:02 ` [PATCH 1/2] x86: Mark __vdso entries as asmlinkage Andy Lutomirski
2014-02-27 3:25 ` H. Peter Anvin
2014-02-27 3:39 ` Andi Kleen
2014-02-27 5:06 ` H. Peter Anvin
2014-02-27 5:19 ` Andy Lutomirski
2014-02-27 5:22 ` H. Peter Anvin
2014-02-27 20:11 ` Andy Lutomirski
2014-02-27 23:12 ` H. Peter Anvin
2014-02-27 5:07 ` H. Peter Anvin
2014-02-27 1:02 ` [PATCH 2/2] x86: Inline the CLOCK_MONOTONIC vdso code Andy Lutomirski
2014-02-28 0:18 ` [PATCH v2 0/4] vDSO fixes, on top of tip/x86/vdso Andy Lutomirski
2014-02-28 0:18 ` [PATCH v2 1/4] x86: Use the default ABI for the 32-bit vDSO Andy Lutomirski
2014-02-28 7:28 ` Stefani Seibold
2014-02-28 15:06 ` H. Peter Anvin
2014-02-28 20:19 ` Andy Lutomirski
2014-03-01 13:43 ` Stefani Seibold
2014-02-28 0:18 ` [PATCH v2 2/4] x86: Inline the CLOCK_MONOTONIC vdso code Andy Lutomirski
2014-02-28 0:18 ` [PATCH v2 3/4] x86: Patch alternatives in the 32-bit vDSO Andy Lutomirski
2014-02-28 7:22 ` Stefani Seibold
2014-03-01 14:04 ` Stefani Seibold [this message]
2014-02-28 0:18 ` [PATCH v2 4/4] x86: Zero-pad the VVAR page Andy Lutomirski
2014-02-28 7:33 ` [PATCH v2 0/4] vDSO fixes, on top of tip/x86/vdso Stefani Seibold
2014-02-28 20:15 ` Andy Lutomirski
2014-03-01 14:02 ` Stefani Seibold
2014-02-28 7:22 ` Final: Add 32 bit VDSO time function support Stefani Seibold
2014-03-01 2:00 ` Andy Lutomirski
2014-03-01 22:56 ` H. Peter Anvin
2014-03-02 8:01 ` Stefani Seibold
2014-02-27 5:07 ` H. Peter Anvin
2014-02-27 12:14 ` 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=1393682667.982.28.camel@wall-e.seibold.net \
--to=stefani@seibold.net \
--cc=Andreas.Brief@rohde-schwarz.com \
--cc=Martin.Runge@rohde-schwarz.com \
--cc=aarcange@redhat.com \
--cc=ak@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gorcunov@openvz.org \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xemul@parallels.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.