linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <fork0@users.sourceforge.net>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] FIx 'noexec' behavior
Date: Sun, 7 Dec 2003 17:19:20 +0100	[thread overview]
Message-ID: <20031207161920.GA1715@steel.home> (raw)
In-Reply-To: <20031207133906.GA1140@steel.home>

On 2003-12-07 13:42:00, wli wrote:
> > I had to put a check for 'file' (as Ulrich suggested).
> > Otherwise it deadlocks again.
> > Is it possible for ->f_vfsmnt to be NULL at all? Should it be tested?
> > diff -Nru a/mm/mmap.c b/mm/mmap.c
> > --- a/mm/mmap.c Sun Dec  7 14:37:33 2003
> > +++ b/mm/mmap.c Sun Dec  7 14:37:33 2003
> > @@ -478,7 +478,7 @@
> >         if (file && (!file->f_op || !file->f_op->mmap))
> >                 return -ENODEV;
> >  
> > -       if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
> > +       if ((prot & PROT_EXEC) && file && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
> >                 return -EPERM;
> >  
> >         if (!len)
> 
> This does not resemble the code I was looking at from current bk.
> 

probably you were looking at the already fixed code:

ChangeSet@1.1512, 2003-12-06 14:34:40-08:00, torvalds@home.osdl.org +1 -0
  Fix the PROT_EXEC breakage on anonymous mmap.

  Clean up the tests while at it.

	if (file) {
		if (!file->f_op || !file->f_op->mmap)
			return -ENODEV;

		if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
			return -EPERM;
	}


The code I was looking at was the one from Ulrich:

ChangeSet 1.1507 2003/12/04 22:26:06 drepper@redhat.com
  [PATCH] Fix 'noexec' behaviour

  We should not allow mmap() with PROT_EXEC on mounts marked "noexec",
  since otherwise there is no way for user-supplied executable loaders
  (like ld.so and emulator environments) to properly honour the
  "noexec"ness of the target.

	if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
		return -EPERM;



  parent reply	other threads:[~2003-12-07 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-07 13:39 [PATCH] FIx 'noexec' behavior Alex Riesen
2003-12-07 13:42 ` William Lee Irwin III
2003-12-07 16:19 ` Alex Riesen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-12-07 12:06 Alex Riesen
2003-12-07 12:17 ` William Lee Irwin III
     [not found] <20031206200322.86264.qmail@web14902.mail.yahoo.com>
2003-12-06 20:07 ` Ulrich Drepper
2003-12-06 19:18 Jon Smirl
2003-12-06 19:34 ` Ulrich Drepper
2003-12-06 19:57   ` OGAWA Hirofumi
2003-12-06 20:15     ` Jon Smirl
2003-12-06 17:27 Jon Smirl
2003-12-06 18:20 ` Ulrich Drepper

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=20031207161920.GA1715@steel.home \
    --to=fork0@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wli@holomorphy.com \
    /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).