From: James Jones <linux@theinnocuous.com>
To: Kees Cook <keescook@chromium.org>
Cc: bp@alien8.de, x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Remove a.out support
Date: Wed, 16 Mar 2022 05:06:10 +0000 [thread overview]
Message-ID: <bfbd9394-161b-0e70-00c5-79d0dd722e08@theinnocuous.com> (raw)
In-Reply-To: <202203151150.1CDB1D8DA@keescook>
On 3/15/22 12:51 PM, Kees Cook wrote:
> On Sat, Mar 12, 2022 at 06:06:26PM +0000, James Jones wrote:
>> [...]
>>> docs, including copies of the old mac and aln a.out binaries, is
>>> available here:
>>>
>>> https://github.com/cubanismo/jaguar-sdk
>
> Do these end up requiring libc4, etc? I see "uselib" syscalls in the
> disassembly...
>
> $ for i in $(objdump -b binary -D -m i386 aln mac | grep -B4 'int.*$0x80' \
> | grep -E 'int|eax' | grep mov | awk '{print $8}' | cut -d, -f1 \
> | cut -c2- | sort -u); do printf "%d\n" $i; done | sort -n
> 1 exit
> 3 read
> 4 write
> 5 open
> 6 close
> 10 unlink
> 13 time
> 19 lseek
> 20 getpid
> 37 kill
> 45 brk
> 54 ioctl
> 55 fcntl
> 86 uselib
> 89 readdir
> 91 munmap
> 106 stat
> 107 lstat
> 108 fstat
> 126 sigprocmask
>
> It seems like it should be possible to create an ELF wrapper for simple
> a.out binaries...
I didn't need to dig up any ancient libraries to get these working. They
seem to be completely statically linked.
Probably getting a bit off topic, but I did spend a few hours searching
around for any existing tools to convert a binary from a.out->ELF, and
trying to come up with something myself by extracting the sections with
objdump and re-combining them into an ELF using a linker script placing
the sections at the same locations. I couldn't get it working in an
evening or two messing with it so I moved on, but I agree something like
this seems possible in theory. I got 'mac' converted to an ELF that
would load up and print its input prompt if run without parameters, but
only if run as root. As a regular user, it segfaults somewhere before it
even starts executing in the text section AFAICT. Any actual assembling
segfaults even when running as root. I never got 'aln' to do anything
but segfault.
I dug the scripts up in the state they were in when I gave up (September
2020 according to mtime), and put them on github in case anyone wants to
have a go at it:
https://github.com/cubanismo/aout-to-elf/
It was an interesting problem in its own right, and I'd be curious to
know what I missed.
Thanks,
-James
> --
> Kees Cook
next prev parent reply other threads:[~2022-03-16 5:06 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 17:54 [PATCH] x86: Remove a.out support James Jones
2022-03-12 18:06 ` James Jones
2022-03-13 11:56 ` Borislav Petkov
2022-03-13 18:26 ` James Jones
2022-03-15 9:44 ` Borislav Petkov
2022-03-15 19:51 ` Kees Cook
2022-03-16 5:06 ` James Jones [this message]
2022-03-16 12:38 ` Arnd Bergmann
2022-03-16 22:30 ` Kees Cook
2022-03-17 2:04 ` James Jones
2022-03-17 2:08 ` David Laight
2022-03-17 10:17 ` Borislav Petkov
2022-03-17 18:53 ` Kees Cook
2022-03-17 2:32 ` David Laight
2022-03-17 3:22 ` Kees Cook
2022-03-16 16:10 ` Kees Cook
2022-03-16 17:05 ` David Laight
2022-04-02 22:14 ` Maciej W. Rozycki
2022-04-03 2:24 ` Kees Cook
2022-04-04 11:03 ` Maciej W. Rozycki
2022-04-04 17:07 ` David Laight
2022-04-04 18:18 ` Kees Cook
2022-04-04 8:24 ` Geert Uytterhoeven
-- strict thread matches above, loose matches on Subject: below --
2022-01-13 16:01 Borislav Petkov
2022-01-13 18:08 ` Kees Cook
2022-01-13 18:47 ` Theodore Ts'o
2022-01-13 22:56 ` Borislav Petkov
2022-01-14 4:06 ` Theodore Ts'o
2022-01-14 10:40 ` Arnd Bergmann
2022-01-14 19:09 ` Borislav Petkov
2022-01-14 9:51 ` David Laight
2022-01-14 14:52 ` Geert Uytterhoeven
2022-01-14 18:57 ` Theodore Ts'o
2022-01-14 19:00 ` Geert Uytterhoeven
2022-01-14 19:12 ` Borislav Petkov
2022-01-14 19:21 ` Geert Uytterhoeven
2022-01-14 19:35 ` Borislav Petkov
2022-01-15 11:37 ` Borislav Petkov
2022-01-15 19:42 ` John Paul Adrian Glaubitz
2022-03-09 20:03 ` [PATCH] a.out: Stop building a.out/osf1 support on alpha and m68k Eric W. Biederman
2022-03-09 22:04 ` Kees Cook
2022-03-10 23:29 ` [PATCH] x86: Remove a.out support Eric W. Biederman
2022-03-10 23:35 ` Linus Torvalds
2022-03-11 8:47 ` Arnd Bergmann
2022-03-11 10:03 ` Borislav Petkov
2022-01-15 4:54 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bfbd9394-161b-0e70-00c5-79d0dd722e08@theinnocuous.com \
--to=linux@theinnocuous.com \
--cc=bp@alien8.de \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).