All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Maxin John <maxin.john@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: regarding mprotect() implementation in 2.6.26 kernel
Date: Thu, 31 Jul 2008 08:09:02 -0700	[thread overview]
Message-ID: <4891D58E.1070308@goop.org> (raw)
In-Reply-To: <9debc4410807310324m4a76aaf5s253242e5cc2bb130@mail.gmail.com>

Maxin John wrote:
> Dear Christoph Hellwig,
>
> ( I guess you are the right person to ask this question ?)
>
> The POSIX.2 specification of mprotect() says:
>
> errorno should be set as ENOMEM if the addresses in the range [addr,
> (addr + len)] are invalid for the address space of a process, or
> specify one or more pages which are not mapped.
>
> However, in the mprotect implementation  (asmlinkage long
> sys_mprotect(unsigned long start, size_t len, unsigned long prot)) in
> linux/mm/mprotect.c file, if we call mprotect() with start as NULL and
> len as 0, mprotect() returns 0 and it is not setting the errono.The
> following code confirms this behaviour.
>   

Address 0 is a valid process address.  And you've set the length to
zero, so you technically haven't referred to any memory at all, so it
doesn't matter what the address is.

    J

  reply	other threads:[~2008-07-31 15:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9debc4410807310315n4da5beafh853a71f532420e9a@mail.gmail.com>
2008-07-31 10:24 ` regarding mprotect() implementation in 2.6.26 kernel Maxin John
2008-07-31 15:09   ` Jeremy Fitzhardinge [this message]
2008-08-04 10:19     ` Maxin John
2008-08-04 10:34       ` Michael Kerrisk
2008-08-04 10:41         ` Michael Kerrisk
2008-08-04 11:18           ` Maxin John

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=4891D58E.1070308@goop.org \
    --to=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxin.john@gmail.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 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.