From: DervishD <raul@viadomus.com>
To: vda@port.imtp.ilyichevsk.odessa.ua
Cc: Linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: mmap() doesn't like certain value...
Date: Fri, 10 May 2002 10:39:28 +0200 [thread overview]
Message-ID: <3CDB8740.mailBO1BW5NO@viadomus.com> (raw)
In-Reply-To: <3CD983C5.mail1K71EX1NG@viadomus.com> <200205100810.g4A8AaX28554@Port.imtp.ilyichevsk.odessa.ua>
Hi Denis :)
Thanks for answering :)
> if ((len = PAGE_ALIGN(len)) == 0)
> return addr;
This is the problem.
> if (len > TASK_SIZE)
> return -EINVAL;
And is corrected just by inverting the two quoted code snips :)
If we test for len being greater than TASK_SIZE *before* aligning
it then the function works properly (the alignment will be done
properly in the task address space). No patch needed really ;)
>> I know: this lengths are enormous, nobody uses them, etc... but I
>Looks like you found an obscure corner case. Good!
I'll give a try to the inversion, that should work. I have
written a small stress program for mmap, so in a few hours the patch
will be ready. Must I post it here or send it directly to Marcello?
>> If this is not a bug, but an intended behaviour please excuse me.
>> Moreover, I can provide a patch (I suppose) against the 2.4.18 tree.
>Do it.
Ok :) I'll prepare the patch right now. Unified diff?
>BTW, does anybody know why len==0 is not flagged as error?
Well, I suppose that if you request 0 bytes, any address returned
is valid, since it cannot be accessed (SIGSEGV...). Anyway the man
page for mmap() clearly says that the address returned is NEVER 0, so
we must test for len==0 and invert the other tests.
Thanks a lot for answering, I was supposing that anybody on the
list was ignoring this obvious and easy to correct bug :?
Raúl
next prev parent reply other threads:[~2002-05-10 8:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-08 20:00 mmap() doesn't like certain value DervishD
2002-05-10 13:13 ` Denis Vlasenko
2002-05-10 8:39 ` DervishD [this message]
2002-05-10 19:41 ` Denis Vlasenko
2002-05-10 23:50 ` DervishD
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=3CDB8740.mailBO1BW5NO@viadomus.com \
--to=raul@viadomus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vda@port.imtp.ilyichevsk.odessa.ua \
/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