mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Levon <moz@compsoc.man.ac.uk>
To: linux-kernel@vger.kernel.org
Subject: minor mmap bug ?
Date: Thu, 4 Oct 2001 04:00:35 +0100	[thread overview]
Message-ID: <20011004040035.A16861@compsoc.man.ac.uk> (raw)


2.4.10

In do_mmap_pgoff() :

    422         addr = get_unmapped_area(file, addr, len, pgoff, flags);
    423         if (addr & ~PAGE_MASK)
    424                 return addr;

in get_unmapped_area() :

    621         if (flags & MAP_FIXED) {
    622                 if (addr > TASK_SIZE - len)
    623                         return -EINVAL;
    624                 if (addr & ~PAGE_MASK)
    625                         return -EINVAL;
    626                 return addr;
    627         }


So it seems that if we hit the first case (addr > TASK_SIZE - len),
we don't return with EINVAL immediately. This code is a little weird anyway.

Is this a bug ?

Also, what's the reason for :

    405         if ((len = PAGE_ALIGN(len)) == 0)
    406                 return addr;


Also, shouldn't calc_vm_flags() mention MAP_LOCKED and the others specifically ?
The current "oh, it happens to be the same value" is distinctly non-obvious to me.


Also, why do several (all ?) of the do_mmap2()s do this :

     51         flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);

Is it something to do with mm->def_flags ?

thanks
john

-- 
" It is quite humbling to realize that the storage occupied by the longest line
from a typical Usenet posting is sufficient to provide a state space so vast
that all the computation power in the world can not conquer it."
	- Dave Wallace

                 reply	other threads:[~2001-10-04  3:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20011004040035.A16861@compsoc.man.ac.uk \
    --to=moz@compsoc.man.ac.uk \
    --cc=linux-kernel@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®