All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] mmap: restore -ENODEV on missing f_op->mmap
Date: Tue, 30 Oct 2007 18:20:52 -0400	[thread overview]
Message-ID: <4727AE44.10902@suse.com> (raw)

 Commit 80c5606c3b45e0176c32d3108ade1e1cb0b954f3 from Linus moved the
 VM_MAYEXEC code further down, but in the process broke the mmap_23_1
 test from the LTP suite. 

 Moving it down means that the test for FMODE_READ ends up above
 the test for f_op->mmap. If the write side of the pipe is called for
 mmap(), we end up returning -EACCES rather than -ENODEV. Was this
 an intended change of behavior? Unless there's a global error precedence
 in SuS that I missed, I think both error codes could be valid here,
 but it is a difference in behavior. Do any spec gurus know for certain?

 Personally, I think this is probably a case of LTP codifying existing
 behavior rather than testing the for the specification. If that's the case
 and nobody really cares about the change in behavior, I'm fine letting this
 drop.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

---

 mm/mmap.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/mm/mmap.c	2007-10-12 20:43:48.000000000 -0400
+++ b/mm/mmap.c	2007-10-23 15:44:45.000000000 -0400
@@ -900,6 +900,9 @@
 	int accountable = 1;
 	unsigned long reqprot = prot;
 
+	if (file && (!file->f_op || !file->f_op->mmap))
+		return -ENODEV;
+
 	/*
 	 * Does the application expect PROT_READ to imply PROT_EXEC?
 	 *
@@ -997,8 +1000,6 @@
 			if (is_file_hugepages(file))
 				accountable = 0;
 
-			if (!file->f_op || !file->f_op->mmap)
-				return -ENODEV;
 			break;
 
 		default:

-- 
Jeff Mahoney
SUSE Labs

             reply	other threads:[~2007-10-30 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 22:20 Jeff Mahoney [this message]
2007-10-30 22:45 ` [PATCH] mmap: restore -ENODEV on missing f_op->mmap Linus Torvalds
2007-10-30 23:13   ` Randy Dunlap
2007-10-31  1:07     ` Jeff Mahoney
2007-10-31  1:07   ` Jeff Mahoney

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=4727AE44.10902@suse.com \
    --to=jeffm@suse.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 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.