LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 02-03-2014, 03:17 AM   #1
re_nelson
Member
 
Registered: Oct 2011
Location: Texas, USA
Distribution: LFS-SVN, Gentoo-2.2 ~amd64, CentOS-7, Slackware64-current, FreeBSD-10.1, Arch
Posts: 182

Rep: Reputation: Disabled
Running old a.out binaries on Slackware64-current


More out of curiosity than any compelling need, I wanted to relive the good old days of 1993 again with any early Slackware (a typical RCS revision is @(#)/etc/rc.d/rc.inet1 1.01 05/27/93). I rebuilt the kernel modules using the default generic configuration for kernel 3.10.17 adding only the ia32_aout to those already configured. The module then cleanly loaded with modprobe.setarch i386 --uname-2.6 -3 -R -X -Z -F -L -B ./tetris

Then I replicated the libc4-era ancient libraries (libc.so.4.4.2 and others of that vintage) to /lib. There were no name conflicts between those libraries and the modern ones.

But upon trying to run any of the binaries, here's what happens and it's what occurs with any of the old commands -- not just tetris:

Code:
strace -f ./tetris 
execve("./tetris", ["./tetris"], [/* 52 vars */]) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0} ---
+++ killed by SIGSEGV +++
Segmentation fault
Prefixing it with setarch i386 does not improve matters nor with any combination that it affords such as setarch i386 --uname-2.6 -3 -R -X -Z -F -L -B ./tetris.

I've read that Alan Cox has been able to run old a.out binaries on modern Linux. Has anyone tried this form of time travel with success? The strace doesn't give a lot to go on. This happens on both bare metal and three virtual machines (VirtualBox, VMPlayer and QEMU).

Last edited by re_nelson; 02-03-2014 at 03:19 AM.
 
Old 02-03-2014, 09:15 PM   #2
re_nelson
Member
 
Registered: Oct 2011
Location: Texas, USA
Distribution: LFS-SVN, Gentoo-2.2 ~amd64, CentOS-7, Slackware64-current, FreeBSD-10.1, Arch
Posts: 182

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by re_nelson View Post
More out of curiosity than any compelling need, I wanted to relive the good old days of 1993 again with any early Slackware (a typical RCS revision is @(#)/etc/rc.d/rc.inet1 1.01 05/27/93). I rebuilt the kernel modules using the default generic configuration for kernel 3.10.17 adding only the ia32_aout to those already configured.
For anyone else pining "...for the days when men were men and wrote their own device drivers...", here's how I have successfully been able to time travel to 20+ years ago on my shiny, new Slackware64-current system.

1). Build the modules using Pat's stock 3.10.17 configuration with this option enabled: CONFIG_IA32_AOUT=m.

2). Alter the command line flags to add this parameter: noexec=off. This is the key and provided the solution to my problem.

3). Arrange for modprobe ia32_aout to execute at boot time via /etc/rc.d/rc.local.

Then party like it's 1993!

Code:
chroot /var/historic/slackware.historic/ /bin/env -i USER=root HOME=/ TERM=linux PS1='\u:\w\$ ' SHELL=/bin/bash PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash -login

Linux 0.99pl13. (Posix).
No mail.

root:/# uname -rv
3.10.17 #1 SMP Wed Oct 23 16:28:33 CDT 2013

root:/# cat > a.c
int main(void) {
puts("Greetings from the 20th century and the world of a.out.");
return 0;
}gcc -v a.c 
Reading specs from /usr/lib/gcc-lib/i486-linux/2.4.5/specs
gcc version 2.4.5
 /usr/lib/gcc-lib/i486-linux/2.4.5/cpp -lang-c -v -undef -D__GNUC__=2 -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -D__i486__ a.c /usr/tmp/cca01426.i
GNU CPP version 2.4.5 (80386, BSD syntax)
 /usr/lib/gcc-lib/i486-linux/2.4.5/cc1 /usr/tmp/cca01426.i -quiet -dumpbase a.c -version -o /usr/tmp/cca01426.s
GNU C version 2.4.5 (80386, BSD syntax) compiled by GNU C version 2.4.5.
 as -o /usr/tmp/cca014261.o /usr/tmp/cca01426.s
 ld -dll-verbose -m486 /usr/lib/crt0.o -L/usr/lib/gcc-lib/i486-linux/2.4.5 /usr/tmp/cca014261.o -lgcc -lc -lgcc
Fixup count 0
Removed 1174 symbols from symtab
Fixup table address: 1064

root:/# ./a.out 
Greetings from the 20th century and the world of a.out.

root:/# file a.out && ldd a.out 
a.out: Linux/i386 demand paged executable not stripped
        libc.so.4 (DLL Jump 4.4pl1)

root:/# gawk -W version 
Gnu Awk (gawk) 2.13, patchlevel 2

root:/# gawk -F: '$3 > 404' /etc/passwd 
gonzo::418:1::/home/gonzo:/bin/bash
satan::419:1::/home/hell:/bin/bash
snake::420:1::/home/pit:/bin/bash
A survey a few months back placed a lot of Slackers in my generation (AARP and beyond) so I figured some would get a kick out of such antiquity. "But if memories were all I sang / I'd rather drive a truck". Now that the problem has been solved, I'm heading back to the future and will launch a command that wasn't even a pipedream way back then: slackpkg update. Just thinking about the jump tables of that era got me cured real quick of my flirtation with the not-so-good olde daze.
 
3 members found this post helpful.
Old 02-03-2014, 09:35 PM   #3
j_v
Member
 
Registered: Oct 2011
Distribution: Slackware64, LFS, Crux
Posts: 207

Rep: Reputation: 31
Cool. Good post. I might give this a go, next snowbound weekend. It would cool to see what it was like even before my first install of 3.3.
 
Old 02-07-2014, 04:20 PM   #4
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 211

Rep: Reputation: Disabled
Thanx. I have to try this when I catch more time for playing with retro stuff. Anyway, I think the problem is not limited only to Slack64 Current. I remember having problems with 32-bit 14.0 and probably 13.37. Couldn't find a solution on the web at the time.
 
Old 02-07-2014, 04:31 PM   #5
re_nelson
Member
 
Registered: Oct 2011
Location: Texas, USA
Distribution: LFS-SVN, Gentoo-2.2 ~amd64, CentOS-7, Slackware64-current, FreeBSD-10.1, Arch
Posts: 182

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bobzilla View Post
Thanx. I have to try this when I catch more time for playing with retro stuff. Anyway, I think the problem is not limited only to Slack64 Current. I remember having problems with 32-bit 14.0 and probably 13.37. Couldn't find a solution on the web at the time.
You're right. Indeed its transcends any particular Linux operating system, Slackware or otherwise. The noexec=off kernel command line allows the ancient a.out binaries to run any number of both 64 and 32-bit platforms I have handy here, Arch, Gentoo-2.2 AMD64 and my own system, loosely based on Linux from Scratch.

For some additional background, my interest in going retro was triggered by going down memory lane by trying to build Emacs-19.34b on all of the above (and more) systems. The dump process of creating emacs from temacs would invariably segfault. That ultimately led to gaining real knowledge of ASLR (Address space layout randomization), something that was only vague to me at the time. Both the noexec=off kernel flag and the twiddling of the --addr-no-randomize flag with setarch are relevant. The latter allowed me to build that old Emacs set the course for me learn more about means to defeat the feature of address randomization. There's also a personality(2) flag that can set to enable a process to bypass address space randomization.

By the way, it's not prudent to disable the noexec flag on a production system. It's there for a reason. I only toggle it when I want to enter a time tunnel back to the early 1990s.

Last edited by re_nelson; 02-07-2014 at 04:42 PM.
 
Old 02-07-2014, 04:50 PM   #6
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 211

Rep: Reputation: Disabled
Quote:
Originally Posted by re_nelson View Post
By the way, it's not prudent to disable the noexec flag on a production system. It's there for a reason. I only toggle it when I want to enter a time tunnel back to the early 1990s.
Of course. But I guess you wouldn't run 1994 a.out binary on a production system either.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Slackware64-current on AWS cloud Skaperen Slackware 14 09-02-2013 11:46 PM
[SOLVED] GRUB2 build errors running slackware64-current (slackware 14) squid890 Slackware 10 07-03-2013 12:23 AM
Slackware64-current crawling when VirtualBox is running gtludwig Slackware 10 03-08-2012 06:53 PM
upgrading slackware64 13.1 multilib to slackware64 -current multilib Cultist Slackware 4 03-12-2011 10:04 AM
Updating from Slackware64-current to Slackware64 13. glore2002 Slackware 4 08-28-2009 07:50 PM


All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration