From: Andy Lutomirski <luto@amacapital.net>
To: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@amacapital.net>
Subject: [PATCH 2/3] x86_64,vsyscall: Turn vsyscalls all the way off when vsyscall=none
Date: Thu, 22 May 2014 15:24:15 -0700 [thread overview]
Message-ID: <00157d645245f5476d0177d853a9c5c0dc7efb2b.1400797362.git.luto@amacapital.net> (raw)
In-Reply-To: <cover.1400797362.git.luto@amacapital.net>
In-Reply-To: <cover.1400797362.git.luto@amacapital.net>
I see no point in having an unusable read-only page sitting at
0xffffffffff600000 when vsyscall=none. Instead, skip mapping it and
remove it from /proc/PID/maps.
I kept the ratelimited warning when programs try to use a vsyscall
in this mode, since it may help admins avoid confusion.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---
arch/x86/kernel/vsyscall_64.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index ad84894..8d38eb5 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -309,6 +309,8 @@ struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
if (!mm || mm->context.ia32_compat)
return NULL;
#endif
+ if (vsyscall_mode == NONE)
+ return NULL;
return &gate_vma;
}
@@ -329,7 +331,7 @@ int in_gate_area(struct mm_struct *mm, unsigned long addr)
*/
int in_gate_area_no_mm(unsigned long addr)
{
- return (addr & PAGE_MASK) == VSYSCALL_ADDR;
+ return vsyscall_mode != NONE && (addr & PAGE_MASK) == VSYSCALL_ADDR;
}
/*
@@ -380,10 +382,12 @@ void __init map_vsyscall(void)
extern char __vsyscall_page;
unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
- __set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
- vsyscall_mode == NATIVE
- ? PAGE_KERNEL_VSYSCALL
- : PAGE_KERNEL_VVAR);
+ if (vsyscall_mode != NONE)
+ __set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
+ vsyscall_mode == NATIVE
+ ? PAGE_KERNEL_VSYSCALL
+ : PAGE_KERNEL_VVAR);
+
BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) !=
(unsigned long)VSYSCALL_ADDR);
}
--
1.9.0
next prev parent reply other threads:[~2014-05-22 22:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 22:24 [PATCH 0/3] x86_64,vsyscall: Minor cleanups and fixes Andy Lutomirski
2014-05-22 22:24 ` [PATCH 1/3] x86_64,vsyscall: Move all of the gate_area code to vsyscall_64.c Andy Lutomirski
2014-05-22 22:24 ` Andy Lutomirski [this message]
2014-05-22 22:24 ` [PATCH 3/3] x86_64,vsyscall: Fix warn_bad_vsyscall log output Andy Lutomirski
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=00157d645245f5476d0177d853a9c5c0dc7efb2b.1400797362.git.luto@amacapital.net \
--to=luto@amacapital.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).