From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org, bernds_cb1@t-online.de,
sam@ravnborg.org
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] NOMMU: Fix execution off of ramfs with mmap() [try #2]
Date: Wed, 05 Jul 2006 18:54:47 +0100 [thread overview]
Message-ID: <20060705175447.12594.79107.stgit@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060705175440.12594.43069.stgit@warthog.cambridge.redhat.com>
From: David Howells <dhowells@redhat.com>
Fix execution through the FDPIC binfmt of programs stored on ramfs by
preventing the ramfs mmap() returning successfully on a private mapping of a
ramfs file. This causes NOMMU mmap to make a copy of the mapped portion of the
file and map that instead.
This could be improved by granting direct mapping access to read-only private
mappings for which the data is stored on a contiguous run of pages. However,
this is only likely to be the case if the file was extended with truncate
before being written.
ramfs is left to map the file directly for shared mappings so that SYSV IPC
and POSIX shared memory both still work.
Signed-Off-By: David Howells <dhowells@redhat.com>
---
fs/ramfs/file-nommu.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 99fffc9..677139b 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -283,9 +283,9 @@ unsigned long ramfs_nommu_get_unmapped_a
/*****************************************************************************/
/*
- * set up a mapping
+ * set up a mapping for shared memory segments
*/
int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma)
{
- return 0;
+ return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS;
}
next prev parent reply other threads:[~2006-07-05 17:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-05 17:54 [PATCH 0/5] Fix FRV, ELF-FDPIC and NOMMU stuff " David Howells
2006-07-05 17:54 ` [PATCH 1/5] FDPIC: Fix FDPIC compile errors " David Howells
2006-07-05 19:41 ` Andrew Morton
2006-07-05 20:48 ` Sam Ravnborg
2006-07-05 17:54 ` [PATCH 2/5] FRV: Fix FRV arch " David Howells
2006-07-05 17:54 ` David Howells [this message]
2006-07-05 17:54 ` [PATCH 4/5] [PATCH] FDPIC: Add coredump capability for the ELF-FDPIC binfmt " David Howells
2006-07-05 17:54 ` [PATCH 5/5] FRV: Introduce asm-offsets for FRV arch " David Howells
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=20060705175447.12594.79107.stgit@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=bernds_cb1@t-online.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=torvalds@osdl.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
Powered by JetHome