mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Maxin John" <maxin.john@gmail.com>
Cc: "Jeremy Fitzhardinge" <jeremy@goop.org>,
	linux-kernel@vger.kernel.org, ak@muc.de, mtk.manpages@gmail.com,
	shields@tembel.org, hirofumi@mail.parknet.co.jp
Subject: Re: regarding mprotect() implementation in 2.6.26 kernel
Date: Mon, 4 Aug 2008 12:34:14 +0200	[thread overview]
Message-ID: <cfd18e0f0808040334p67b2c9f8g586fa984f6c96e55@mail.gmail.com> (raw)
In-Reply-To: <9debc4410808040319i3358a916v3b6cd534c0a0802c@mail.gmail.com>

Hallo Maxin,

On Mon, Aug 4, 2008 at 12:19 PM, Maxin John <maxin.john@gmail.com> wrote:
> Dear Jeremy,
>
>              Thank you very much for the information and I am sorry
> for my delayed reply.
>
>        As per the patch created by Mr. hirofumi for the 2.5.26 kernel
> which is described in
> http://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.26 ,
> and
> http://linux.bkbits.net:8080/linux-2.6/?PAGE=gnupatch&REV=1.403.147.22
> , the mprotect system call will set errno as ENOMEM instead of
> EFAULT.
>
> But the latest man page(man-pages-3.05) of mprotect still contains
> information regarding EFAULT.

Yes, that text looks to be in error.

> The SuSv3 specification of mprotect also
> doesn't say anything about EFAULT in the mprotect() details. The
> following patch removes the information regarding EFAULT from the
> mprotect man page.

Before I apply this...  Did you check what was the situation in 2.4 kernels?

Cheers,

Michael


> diff -Naur man-pages-3.05/man2/mprotect.2
> man-pages-3.05_modified/man2/mprotect.2
> --- man-pages-3.05/man2/mprotect.2      2008-07-23 19:42:13.000000000 +0530
> +++ man-pages-3.05_modified/man2/mprotect.2     2008-08-04
> 15:34:33.400869088 +0530
> @@ -87,9 +87,6 @@
>  to mark it
>  .BR PROT_WRITE .
>  .TP
> -.B EFAULT
> -The memory cannot be accessed.
> -.TP
>  .B EINVAL
>  \fIaddr\fP is not a valid pointer,
>  or not a multiple of the system page size.
> ~
>
>  Please advise me if this information is irrelevant or wrong.
>
> Thanks and Regards,
>
> Maxin B. John
> Bangalore, India.
>
>
> On Thu, Jul 31, 2008 at 8:39 PM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>> 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
>>
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html

  reply	other threads:[~2008-08-04 10:34 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 ` Maxin John
2008-07-31 15:09   ` Jeremy Fitzhardinge
2008-08-04 10:19     ` Maxin John
2008-08-04 10:34       ` Michael Kerrisk [this message]
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=cfd18e0f0808040334p67b2c9f8g586fa984f6c96e55@mail.gmail.com \
    --to=mtk.manpages@googlemail.com \
    --cc=ak@muc.de \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxin.john@gmail.com \
    --cc=mtk.manpages@gmail.com \
    --cc=shields@tembel.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®