From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brad Plant Subject: Re: is_loadable_phdr Date: Fri, 29 Jan 2010 09:02:04 +1100 Message-ID: <20100129090204.3f9a414b@daedalus> References: <20100129065509.0dba48bc@daedalus> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1377008114==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "pageexec@freemail.hu" , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============1377008114== Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_///PSoHBy630QH1XazOF4KPc"; protocol="application/pgp-signature" --Sig_///PSoHBy630QH1XazOF4KPc Content-Type: multipart/mixed; boundary="MP_/3X3FsfrR0UB_46j.kaVTsQW" --MP_/3X3FsfrR0UB_46j.kaVTsQW Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thu, 28 Jan 2010 21:14:14 +0000 Keir Fraser wrote: > On 28/01/2010 19:55, "Brad Plant" wrote: >=20 > > I'm trying to get an understanding of why a segment has to be writeable= or > > executable for xen to load it. Does anyone know why this is so? > >=20 > > Also, is it likely that this behaviour could be changed? My understandi= ng is > > that it's perfectly valid to have an ELF kernel with read-only segments= in it. > > Attempting to use an image with a read-only segment leads to the kernel > > failing to boot with weird and hard to debug crashes. >=20 > Yes, we can change that. Send a patch for it. So there's no reason not loading read-only segments then? I've attached a patch that'll change elf_phdr_is_loadable's behaviour. It j= ust adds PF_R into the mix. I don't know if this will cause some unwanted s= ide effects. Unfortunately there'll be some very unhappy people if I go reb= ooting an entire physical machine at the moment. Cheers, Brad --MP_/3X3FsfrR0UB_46j.kaVTsQW Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=libelf-tools.c.patch --- xen/common/libelf/libelf-tools.c.orig 2010-01-29 08:44:48.000000000 +11= 00 +++ xen/common/libelf/libelf-tools.c 2010-01-29 08:59:18.000000000 +1100 @@ -235,7 +235,7 @@ int elf_phdr_is_loadable(struct elf_bina uint64_t p_type =3D elf_uval(elf, phdr, p_type); uint64_t p_flags =3D elf_uval(elf, phdr, p_flags); =20 - return ((p_type =3D=3D PT_LOAD) && (p_flags & (PF_W | PF_X)) !=3D 0); + return ((p_type =3D=3D PT_LOAD) && (p_flags & (PF_R | PF_W | PF_X)) != =3D 0); } =20 /* --MP_/3X3FsfrR0UB_46j.kaVTsQW-- --Sig_///PSoHBy630QH1XazOF4KPc Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAktiCVwACgkQtFxK98yAy+kunwCcC8wzLYuJ+ts1COfwQ14kHSTI h6IAnip3vj18G1NkcCRvcjRLCDt2JZOx =3M3S -----END PGP SIGNATURE----- --Sig_///PSoHBy630QH1XazOF4KPc-- --===============1377008114== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1377008114==--