From: Jan Lieskovsky <jlieskov@redhat.com>
To: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: David Miller <davem@davemloft.net>
Subject: sparc: Fix mremap VA span checking.
Date: Mon, 12 May 2008 13:15:12 +0200 [thread overview]
Message-ID: <1210590913.10883.9.camel@dhcp-lab-164.englab.brq.redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 753 bytes --]
Hello guys,
sorry for bothering you if wrong, but based on DaveM's
patch: <cite>
sparc: Fix mmap VA span checking.
David S. Miller [Wed, 7 May 2008 09:24:28 +0000 (02:24 -0700)]
[ Upstream commit: 5816339310b2d9623cf413d33e538b45e815da5d ]
We should not conditionalize VA range checks on MAP_FIXED.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
</cite>
I have investigated the code for MREMAP_FIXED in
sparc_mremap in arch/sparc/kernel/sys_sparc.c, for sys64_mremap
in arch/sparc64/kernel/sys_sparc.c and
for sys32_mremap in arch/sparc64/kernel/sys_sparc32.c
and there are similar conditional range checks ->
attaching the patches against 2.6.25.3.
Kind regards
Jan iankko Lieskovsky
[-- Attachment #2: sparc_sys_sparc.diff --]
[-- Type: text/x-patch, Size: 911 bytes --]
--- linux-2.6.25.3.old/arch/sparc/kernel/sys_sparc.c 2008-05-12 11:43:17.000000000 +0200
+++ linux-2.6.25.3/arch/sparc/kernel/sys_sparc.c 2008-05-12 12:20:32.000000000 +0200
@@ -308,14 +308,13 @@
new_len > TASK_SIZE - PAGE_SIZE)
goto out;
down_write(¤t->mm->mmap_sem);
- if (flags & MREMAP_FIXED) {
- if (ARCH_SUN4C_SUN4 &&
- new_addr < 0xe0000000 &&
- new_addr + new_len > 0x20000000)
- goto out_sem;
- if (new_addr + new_len > TASK_SIZE - PAGE_SIZE)
- goto out_sem;
- } else if ((ARCH_SUN4C_SUN4 && addr < 0xe0000000 &&
+ if (ARCH_SUN4C_SUN4 &&
+ new_addr < 0xe0000000 &&
+ new_addr + new_len > 0x20000000)
+ goto out_sem;
+ if (new_addr + new_len > TASK_SIZE - PAGE_SIZE)
+ goto out_sem;
+ else if ((ARCH_SUN4C_SUN4 && addr < 0xe0000000 &&
addr + new_len > 0x20000000) ||
addr + new_len > TASK_SIZE - PAGE_SIZE) {
unsigned long map_flags = 0;
[-- Attachment #3: sparc64_sys_sparc.diff --]
[-- Type: text/x-patch, Size: 587 bytes --]
--- linux-2.6.25.3.old/arch/sparc64/kernel/sys_sparc.c 2008-05-12 11:43:17.000000000 +0200
+++ linux-2.6.25.3/arch/sparc64/kernel/sys_sparc.c 2008-05-12 12:18:58.000000000 +0200
@@ -620,10 +620,9 @@
goto out;
down_write(¤t->mm->mmap_sem);
- if (flags & MREMAP_FIXED) {
- if (invalid_64bit_range(new_addr, new_len))
- goto out_sem;
- } else if (invalid_64bit_range(addr, new_len)) {
+ if (invalid_64bit_range(new_addr, new_len))
+ goto out_sem;
+ else if (invalid_64bit_range(addr, new_len)) {
unsigned long map_flags = 0;
struct file *file = NULL;
[-- Attachment #4: sparc64_sys_sparc32.diff --]
[-- Type: text/x-patch, Size: 587 bytes --]
--- linux-2.6.25.3.old/arch/sparc64/kernel/sys_sparc32.c 2008-05-12 11:43:17.000000000 +0200
+++ linux-2.6.25.3/arch/sparc64/kernel/sys_sparc32.c 2008-05-12 12:19:43.000000000 +0200
@@ -915,10 +915,9 @@
if (addr > STACK_TOP32 - old_len)
goto out;
down_write(¤t->mm->mmap_sem);
- if (flags & MREMAP_FIXED) {
- if (new_addr > STACK_TOP32 - new_len)
- goto out_sem;
- } else if (addr > STACK_TOP32 - new_len) {
+ if (new_addr > STACK_TOP32 - new_len)
+ goto out_sem;
+ else if (addr > STACK_TOP32 - new_len) {
unsigned long map_flags = 0;
struct file *file = NULL;
next reply other threads:[~2008-05-12 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 11:15 Jan Lieskovsky [this message]
2008-05-12 11:24 ` David Miller
2008-05-12 23:12 ` Martin Habets
2008-05-12 23:24 ` David Miller
2008-05-12 23:48 ` David Miller
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=1210590913.10883.9.camel@dhcp-lab-164.englab.brq.redhat.com \
--to=jlieskov@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sparclinux@vger.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®