Re: 2.2.8pre6, can't run ZMAGIC binaries

Linus Torvalds (torvalds@transmeta.com)
Wed, 12 May 1999 08:30:55 -0700 (PDT)


On Wed, 12 May 1999, Andrea Arcangeli wrote:
>
> Why don't we want to allow a private mmap not page aligned?

Partly it's a complexity issue, partly it's a "least surprise" issue.

We already do not allow anybody doing "mmap()" to have anything but page
alignment. The only loophole right now is "internal" mmaps in the kernel,
namely executing a binary.

The reason we don't allow "real" mmap's is that we want to give the user
mmap coherency (even with private mappings, if they are just read-only)
with other mmaps and write() calls. We don't _have_ to, but it's a matter
of being polite and well-behaved (and yes, there are programs out there
that assume that there is coherency - even though it's not guaranteed by
standards nor even implemented in all unixes).

The only way to guarantee coherency is to guarantee that everybody has the
same physical page - which in turn means that everybody has to agree on
alignment. Thus the page-alignment requirement.

And once you have guaranteed page alignment for normal mmaps, the
complexity issue makes it attractive to do the same for executables too.
Note that 1kB executables have mondo problems: they don't even run if the
underlying filesystem has a blocksize > 1kB - another thing that would be
fixed if you just read them into memory directly.

Reading them into anonymous memory has the disadvantage that you lose the
ability to share pages, but as basically nobody should be using the old
original a.out 1kB format anyway, that's ok (note that the only format
that has problems is the _really_ old original ZMAGIC a.out format, only
availabl eon the x86 - "normal" a.out binaries as done two years ago are
fine, and ELF is obviously fine).

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/