Subject: Re: ELF loader doesn't mprotect(PROT_EXEC).
To: Aymeric Vincent <Aymeric.Vincent@labri.fr>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-x11
Date: 10/22/2004 15:30:15
--JwB53PgKC5A7+0Ej
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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[0];
> symval =3D (Elf_Addr) symbol->address;
> ppc_flush_icache(&symbol->code.plt[0]);
> - ppc_flush_icache(&symbol->code.plt[6]);
> + ppc_flush_icache(&symbol->code.plt[6]); /* XXX why 6? */
> break;
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[0]=20
and plt[6] are actually in the same cache line. While plt[6] and plt[4]=20
are in the same cache line, it would be legal (AFAIK) for plt[0] to be at=
=20
the very end of a cache line, so thus plt[4] & such are in the next one.
I'd gues that plt[6] 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.
Take care,
Bill
--JwB53PgKC5A7+0Ej
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQFBeYn3Wz+3JHUci9cRAqKoAJ0UxDMIMBCUJlZi5IFq0InUgnPdAgCggISM
lpnvf74ozWQklRTNKvODMnA=
=0BFS
-----END PGP SIGNATURE-----
--JwB53PgKC5A7+0Ej--