Re: [PATCH] x86: Remove a.out support

Kees Cook
2022-03-17T03:22:54Z

On Thu, Mar 17, 2022 at 02:32:29AM +0000, David Laight wrote:
> From: Kees Cook
> > Sent: 16 March 2022 22:30
> >
> > On Wed, Mar 16, 2022 at 01:38:31PM +0100, Arnd Bergmann wrote:
> > > is in the end, but it's likely easier than a standalone a.out loader
> > > in user space, or a conversion to ELF format.
> >
> > Yeah, the exec format is really simple. The only tricky bit was preparing
> > the stack and making sure everything landed in the right place for text
> > and data. James, can you try this? aln and mac run for me, but I'm not
> > actually exercising them beyond dumping argument lists, etc:
>
> Doesn't that restrict the a.out program to the address space below
> the normal base address for elf programs?
> So you'll only be able to load small programs - which might be ok here.
>
> OTOH it might be possible to link the 'loader program' to a high
> address - the elf loader will probably just load it.
> Best to link it static to avoid shared lib mmaps
> and probably try to avoid libc calls.
>
> I was wondering what happens when malloc() starts using
> sbrk() - but I guess it sees the top of the bss for the
> loaded and it all works fine.

I'll wait unless something breaks. :) Right now I just wanted to get aln
and mac working -- and that's a pretty small subset of all a.out
binaries. :)

--
Kees Cook