* [PATCH] sys_mmap doesn't follow posix.1 when parameter len=0
@ 2005-05-23 0:47 Zhang, Yanmin
2005-05-25 22:55 ` David Mosberger
0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Yanmin @ 2005-05-23 0:47 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 340 bytes --]
In IA64 kernel, sys_mmap calls do_mmap2 and do_mmap2 returns addr if
len=0, which means the mmap sys call succeeds.
Posix.1 says:
The mmap() function shall fail if:
[EINVAL]
The value of len is zero.
Here is a patch to fix it.
Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
<<do_mmap2_zero_len_2.6.12_rc4.patch>>
[-- Attachment #2: do_mmap2_zero_len_2.6.12_rc4.patch --]
[-- Type: application/octet-stream, Size: 600 bytes --]
diff -Nraup linux-2.6.12-rc4/arch/ia64/kernel/sys_ia64.c linux-2.6.12-rc4_fix/arch/ia64/kernel/sys_ia64.c
--- linux-2.6.12-rc4/arch/ia64/kernel/sys_ia64.c 2005-05-13 14:14:13.000000000 +0800
+++ linux-2.6.12-rc4_fix/arch/ia64/kernel/sys_ia64.c 2005-05-20 13:10:32.000000000 +0800
@@ -182,13 +182,6 @@ do_mmap2 (unsigned long addr, unsigned l
}
}
- /*
- * A zero mmap always succeeds in Linux, independent of whether or not the
- * remaining arguments are valid.
- */
- if (len == 0)
- goto out;
-
/* Careful about overflows.. */
len = PAGE_ALIGN(len);
if (!len || len > TASK_SIZE) {
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] sys_mmap doesn't follow posix.1 when parameter len=0
2005-05-23 0:47 [PATCH] sys_mmap doesn't follow posix.1 when parameter len=0 Zhang, Yanmin
@ 2005-05-25 22:55 ` David Mosberger
0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger @ 2005-05-25 22:55 UTC (permalink / raw)
To: linux-ia64
>>>>> On Mon, 23 May 2005 08:47:06 +0800, "Zhang, Yanmin" <yanmin.zhang@intel.com> said:
Yanmin> In IA64 kernel, sys_mmap calls do_mmap2 and do_mmap2 returns
Yanmin> addr if len=0, which means the mmap sys call succeeds.
Yanmin> Posix.1 says: The mmap() function shall fail if: [EINVAL]
Yanmin> The value of len is zero.
Yanmin> Here is a patch to fix it.
Yanmin> Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Looks like Gordon Jin changed mm/mmap.c to be POSIX compliant back in
March 2005 but didn't update the ia64 code. Looks fine to me.
--david
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-25 22:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-23 0:47 [PATCH] sys_mmap doesn't follow posix.1 when parameter len=0 Zhang, Yanmin
2005-05-25 22:55 ` David Mosberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox