Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Avoiding RWX segments in XEN3_DOM0/XEN3_DOMU kernels



On Sat, Oct 21, 2023 at 04:21:39PM +0000, Taylor R Campbell wrote:
> > Date: Sat, 21 Oct 2023 17:37:01 +0200
> > From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
> > 
> > On Sat, Oct 21, 2023 at 05:12:17PM +0200, Martin Husemann wrote:
> > > On Sun, Jul 16, 2023 at 10:24:35AM +0000, Taylor R Campbell wrote:
> > > > The attached patch tries to fix it by splitting the linker script into
> > > > three different segments -- one with read/execute (for .text), one
> > > > read-only (for .rodata and various others), and one with read/write
> > > > (for .data and everything else), along with the note.
> > > > 
> > > > Can someone try this and report back, or take a look and tell me if
> > > > I'm barking up the wrong tree to fix the problem?  (Not a linker
> > > > script expert here.)
> > > 
> > > Works for me - dom0 and domU kernel boot, linker warnings are gone.
> > 
> > Doens't this ends up with bigger kernel images, with a hole between text,
> > rodata and data ? The hole would be a waste of ram.
> 
> Possible, I didn't check.
> 
> > Note that this won't change much things in practice: Xen loads this as a
> > single large blob mapped read/write, and the NetBSD bootstrap remaps
> > it RX, RO or RW based on __rodata_start and __data_start
> 
> How can it remap without separate sections?  RX or RW data could
> straddle the boundaries of the RO section if they're not separate.

i think it works because of the
                . = ALIGN(__PAGE_SIZE);

> 
> Alternatively, if everything already is aligned as needed -- how would
> this expand the kernel images?

Could't ld decide to put some space between sections ?
I'm not a specialist of ld or ldscripts either ...

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index