[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4891D58E.1070308@goop.org>
Date: Thu, 31 Jul 2008 08:09:02 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Maxin John <maxin.john@...il.com>
CC: linux-kernel@...r.kernel.org
Subject: Re: regarding mprotect() implementation in 2.6.26 kernel
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists