Subject: Re: ELF loader doesn't mprotect(PROT_EXEC).
To: Aymeric Vincent <Aymeric.Vincent@labri.fr>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 10/22/2004 15:30:15
Content-Type: text/plain; charset=us-ascii
On Thu, Oct 21, 2004 at 05:51:03PM +0200, Aymeric Vincent wrote:
> diff -u -u -r1.2 elfloader.c
> --- elfloader.c 28 Mar 2004 15:24:25 -0000 1.2
> +++ elfloader.c 21 Oct 2004 15:43:16 -0000
> @@ -758,7 +758,7 @@
> symbol->address =3D (char *)&symbol->code.plt;
> symval =3D (Elf_Addr) symbol->address;
> - ppc_flush_icache(&symbol->code.plt);
> + ppc_flush_icache(&symbol->code.plt); /* XXX why 6? */
Leave that change out. 1) just because you (or I) don't understand it
doesn't mean we should comment it as such. :-) Since we're not the=20
maintainers of the code, there's no requirement that folks answer us if=20
they figure it out, so the comment will probably never go away.
2) I bet the reason to do it is that there is no requriement that plt=20
and plt are actually in the same cache line. While plt and plt=20
are in the same cache line, it would be legal (AFAIK) for plt to be at=
the very end of a cache line, so thus plt & such are in the next one.
I'd gues that plt was chosen as it is towards the end of the code, so=20
since we flush the front and the back (and it's less than a cache line=20
long) we always have flushed the whole code.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----