FWIW, the GNU linker can reorder the kernel on i386-current
with 256MB RAM:

   # env LD=ld.bfd /usr/libexec/reorder_kernel

---

relink.log:

(SHA256) /bsd: OK
LD="ld.bfd" LDFLAGS="-g" sh makegap.sh 0xcccccccc gapdummy.o
ld.bfd -T ld.script -X --warn-common -nopie -o newbsd ${SYSTEM_HEAD} vers.o 
${OBJS}
text    data    bss     dec     hex
11916299        262796  1101824 13280919        caa697
mv newbsd newbsd.gdb
ctfstrip -S -o newbsd newbsd.gdb
rm -f bsd.gdb
mv -f newbsd bsd
install -F -m 700 bsd /bsd && sha256 -h /var/db/kernel.SHA256 /bsd

Kernel has been relinked and is active on next reboot.

SHA256 (/bsd) = 3c9cca9da06acdc92270f6f0e68b57447881a01e3e2584a0086291efb5033ba7

---

On Fri, Apr 10, 2020 at 10:52:37AM -0600, Theo de Raadt wrote:
> I am succesfully relinking kernels on a landisk with 128MB of ram.
> 
> I think this conversation is ridiculous:
> 
> If a machine is too small, then it is too small.  Do I have to paypal
> a $0.05 to some users?
> 
> Nick Holland <[email protected]> wrote:
> 
> > 
> > 
> > 
> > On 2020-04-10 10:10, Stefan Sperling wrote:
> > > On Fri, Apr 10, 2020 at 09:35:16AM -0400, Nick Holland wrote:
> > >> Question about kernel randomization and relinking...
> > >> 
> > >> It seems to take a fair amount of RAM, at least for systems that
> > >> are forced to run i386.  And I mean real RAM -- swap doesn't seem
> > >> to cut it.  
> > >> 
> > >> I discovered that several machines I was intending on using for
> > >> minimal purposes just couldn't complete relinking.  So I built a
> > >> VM and started playing with the RAM.
> > >> 
> > >> Built with 1G RAM, default was a 1.2G swap, worked fine.
> > >> Reduced to 256MB RAM, Kernel failed to relink.  As with my old
> > >> junk.
> > >>
> > >> The magic number seemed to be between 320MB (failed) and 384MB 
> > >> (worked) of RAM.  Ok, fine.  
> > > 
> > > FWIW, my soekris net5501 with 256MB of RAM and 512MB swap does manage
> > > to relink a kernel (on 6.6 + syspatches).
> > 
> > Whoops.  Guess I should have mentioned, that was -current, as of
> > yesterday 
> > OpenBSD 6.7-beta (GENERIC.MP) #110: Thu Apr  9 01:20:52 MDT 2020
> >     [email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP
> > real mem  = 334970880 (319MB)
> > avail mem = 313077760 (298MB)
> > 
> > and probably a couple weeks ago for the real (old) hw.
> > 
> > I'm curious if your Soekris can handle 6.7-beta.
> > 
> > Nick.
> > 
> > 
> > > 
> > > # ls -l relink.log
> > > -rw-r--r--  1 root  wheel  -  507B Apr 10 13:33 relink.log
> > > # cat relink.log                               
> > > (SHA256) /bsd: OK
> > > LD="ld" LDFLAGS="-g" sh makegap.sh 0xcccccccc gapdummy.o
> > > ld -T ld.script -X --warn-common -nopie -o newbsd ${SYSTEM_HEAD} vers.o 
> > > ${OBJS}
> > > text    data    bss     dec     hex
> > > 11815507        267748  1101824 13185079        c93037
> > > mv newbsd newbsd.gdb
> > > ctfstrip -S -o newbsd newbsd.gdb
> > > rm -f bsd.gdb
> > > mv -f newbsd bsd
> > > install -F -m 700 bsd /bsd && sha256 -h /var/db/kernel.SHA256 /bsd
> > > 
> > > Kernel has been relinked and is active on next reboot.
> > > 
> > > SHA256 (/bsd) = 
> > > a940ce989d708e5b87a1186ee81bd624066baeabe67b8405b52e4fa2988b565
> > > 
> > > 
> > > # dislabel -pm wd0
> > > #                size           offset  fstype [fsize bsize   cpg]
> > >   a:           353.0M               64  4.2BSD   2048 16384  5624 # /
> > >   b:           511.1M           722944    swap                    # none
> > >   c:         15280.0M                0  unused                    
> > >   d:           444.8M          1769728  4.2BSD   2048 16384  7116 # /tmp
> > >   e:           607.7M          2680576  4.2BSD   2048 16384  9685 # /var
> > >   f:          1703.0M          3925216  4.2BSD   2048 16384 12958 # /usr
> > >   g:           505.8M          7412896  4.2BSD   2048 16384  8060 # 
> > > /usr/X11R6
> > >   h:          1632.9M          8448736  4.2BSD   2048 16384 12958 # 
> > > /usr/local
> > >   i:          1381.2M         11792960  4.2BSD   2048 16384 12958 # 
> > > /usr/src
> > >   j:          5282.4M         14621632  4.2BSD   2048 16384 12958 # 
> > > /usr/obj
> > >   k:          2850.9M         25439936  4.2BSD   2048 16384 12958 # /home
> > > 
> > 

Reply via email to