mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Tim Abbott <tabbott@ksplice.com>
Cc: x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>,
	Anders Kaseorg <andersk@ksplice.com>
Subject: Re: [PATCH v3 1/5] x86: fix fragile computation of vsyscall address
Date: Thu, 17 Sep 2009 19:22:27 +0400	[thread overview]
Message-ID: <20090917152227.GA8817@lenovo> (raw)
In-Reply-To: <1253133870-25140-2-git-send-email-tabbott@ksplice.com>

[Tim Abbott - Wed, Sep 16, 2009 at 04:44:26PM -0400]
|
| From: Anders Kaseorg <andersk@ksplice.com>
| 
| Previously, the address of the vsyscall page (VSYSCALL_PHYS_ADDR,
| VSYSCALL_VIRT_ADDR) was computed by arithmetic on the address of the
| last section.  This leads to bugs when new sections are inserted, such
| as the one fixed by commit d312ceda567ab91acd756cde95ac5fbc6b40ed40.
| Let's compute it from the current address instead.
| 
| Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
| ---
|  arch/x86/kernel/vmlinux.lds.S |   19 +++++++------------
|  1 files changed, 7 insertions(+), 12 deletions(-)
| 
| diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
| index 0ccb57d..b96ca47 100644
| --- a/arch/x86/kernel/vmlinux.lds.S
| +++ b/arch/x86/kernel/vmlinux.lds.S
| @@ -135,24 +135,21 @@ SECTIONS
|  #ifdef CONFIG_X86_64
|  
|  #define VSYSCALL_ADDR (-10*1024*1024)
| -#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
| -                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
| -#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
| -                            PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|  
| -#define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
| +#define VLOAD_OFFSET (VSYSCALL_ADDR - __vsyscall_0 + LOAD_OFFSET)
|  #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
|  
| -#define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
| +#define VVIRT_OFFSET (VSYSCALL_ADDR - __vsyscall_0)
|  #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
|  
| +	. = ALIGN(4096);

Hi Tim, it seems there should be PAGE_SIZE, or I miss something?
(great work btw!)

| +	__vsyscall_0 = .;
| +
...

	-- Cyrill

  reply	other threads:[~2009-09-17 15:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 20:44 [PATCH v3 0/5] Linker script cleanup patches for x86 Tim Abbott
2009-09-16 20:44 ` [PATCH v3 1/5] x86: fix fragile computation of vsyscall address Tim Abbott
2009-09-17 15:22   ` Cyrill Gorcunov [this message]
2009-09-16 20:44 ` [PATCH v3 2/5] x86: convert compressed loader to use __HEAD and HEAD_TEXT macros Tim Abbott
2009-09-16 20:44 ` [PATCH v3 3/5] x86: convert " Tim Abbott
2009-09-16 20:44 ` [PATCH v3 4/5] x86: Use section .data.page_aligned for the idt_table Tim Abbott
2009-09-16 20:44 ` [PATCH v3 5/5] x86: Cleanup linker script using new linker script macros Tim Abbott

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=20090917152227.GA8817@lenovo \
    --to=gorcunov@gmail.com \
    --cc=andersk@ksplice.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sam@ravnborg.org \
    --cc=tabbott@ksplice.com \
    --cc=tglx@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

all inboxes | Powered by JetHome®