Nope, it should definitely be
area->vm_pgoff + ((end - area->vm_start) >> PAGE_SHIFT);
instead. "pg_off" has already been shifted down once.
> The "other mmap-related problems" I mentioned are in 2.3.24 also (I
> checked 2.3.18 and *assumed* "probably works in 2.3.24 - a few kernel
> versions... what is that betwixt me and thee" :)).
>
> So, this "other" problem is that malloc(0x3000) results in a system call
> brk(0x4000) whilst I expect to see something like brk(0x804cdef). So it
> fails with ENOMEM. I will have to look at 2.3.18->2.3.24 and see whether
> brk(2) semantics has changed (it always had a *endds argument so I
> assumed it is still teh case).
Hmm.. For out-of-range values used at some point to return the old value
of brk(), not ENOMEM. Maybe that's the problem? Programs used to be able
to get their original brk-point by doing
brk = brk(0)
and if it now returns -ENOMEM instead of the starting brk, then that would
explain the behaviour you see above (wrong brk from malloc - it uses
0x4000 instead of 0x84x... because it incorrectly thought that the old brk
value was at -1 + alignment).?
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/