[issue13148] simple bug in mmap size check
Charles-François Natali
report at bugs.python.org
Tue Oct 11 09:45:58 CEST 2011
Charles-François Natali <neologix at free.fr> added the comment:
> The condition contradicts the exception text:
Why?
The offset is zero-based, so 0 <= offset < size is a valid check.
> First of all, it doesn't fail (at least on Linux), I tested it before
> posting.
Hmmm.
You got lucky, since the offset must be a multiple of the page size.
> tried on newer Linux - crashes with my patch.
That's exactly why we perform such checks. Here's what POSIX says:
"""
[EINVAL]
The addr argument (if MAP_FIXED was specified) or off is not a multiple of the page size as returned by sysconf(), or are considered invalid by the implementation.
[ENXIO]
Addresses in the range [off, off + len) are invalid for the object specified by fildes.
"""
Since we usually want to avoid implementation-defined behavior (and crashes), I think it's better to stick with the current checks (note that issue #12556 concerned a really corner case: /proc entries supporting mmap but reporting a zero-length).
> Therefore, I'm no longer pushing for this change, I will need another
> workaround anyway.
Alright, closing then.
----------
resolution: -> rejected
stage: -> committed/rejected
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13148>
_______________________________________
More information about the Python-bugs-list
mailing list