cflow

This is just me rambling……

Anyways I was looking at some source, and instead of me trying to make heads or tails of it, it’d be more fun to have the machine try to do so, and in this endeavor I thought I’d try cflow.

So let’s try something terribly simply, like the fortune program from Unix 32v:

#include stdio.h

char line[500];
char bline[500];

main()
{
        double p;
        register char * l;
        long t;
        FILE *f;

        f = fopen("/usr/games/lib/fortunes", "r");
        if (f == NULL) {
                printf("Memory fault -- core dumped\n");
                exit(1);
        }
        time(&t);
        srand(getpid() + (int)((t>>16) + t));
        p = 1.;
        for(;;) {
                l = fgets(line, 500, f);
                if(l == NULL)
                        break;
                if(rand() < 2147483648./p)
                        strcpy(bline, line);
                p += 1.;
        }
        fputs(bline, stdout);
        return(0);
}

This is a simple program, to say the least.  So running cflow gives me this:

# cflow fortune.c
main() :
    fopen()
    printf()
    exit()
    time()
    srand()
    getpid()
    fgets()
    rand()
    strcpy()
    fputs()

Simple, right?  Now let’s add in the C pre-processor, and add in the 32v include paths….

# cflow --cpp='/usr/bin/cpp -nostdinc -I../../include -I../../include/sys -I.' -n fortune.c
    1 main() :
    2     fopen()
    3     printf()
    4     exit()
    5     time()
    6     srand()
    7     getpid()
    8     fgets()
    9     rand()
   10     strcpy()
   11     fputs()

OK same thing, I can’t say I was expecting anything else.  But now let’s add in libc:

# cflow --cpp='/usr/bin/cpp -nostdinc -I../../include -I../../include/sys -I.' -n fortune.c ../libc/gen/*.c ../libc/stdio/*.c
    1 main() [main () at ../libc/gen/ttytest.c:2]:
    2     fopen() [struct _iobuf fopen (file, mode) at ../libc/stdio/fopen.c:5]
    3     printf() [printf (fmt, args) at ../libc/stdio/printf.c:3]:
    4     exit()
    5     time()
    6     srand()
    7     getpid()
    8     fgets() [char *fgets (s, n, iop) at ../libc/stdio/fgets.c:4]
    9     rand() [rand () at ../libc/gen/rand.c:9]
   10     strcpy()
   11     fputs()
   12     ttyname() [char *ttyname (f) at ../libc/gen/ttyname.c:17]:
   13         isatty() [if (isatty (( & _iob[1]) _file)) at ../libc/stdio/flsbuf.c:24]:
   14             gtty() [gtty (fd, ap) at ../libc/gen/stty.c:13]:
   15                 ioctl()
   16         fstat()
   17         open()
   18         read()
   19         strcpy()
   20         strcat()
   21         stat()
   22         close()

Isn’t that cool?  Now what does the kernel do?

I went ahead and renamed the main function call in the 32v kernel so that way it doesn’t mesh the main’s but here is the call flow:

    # cflow --cpp='/usr/bin/cpp -nostdinc -I../../include -I../../include/sys -I.' -n  fortune.c ../libc/gen/*.c ../libc/stdio/*.c ../sys/sys/*.c
    1 main() [main () at ../libc/gen/ttytest.c:2]:
    2     fopen() [struct _iobuf fopen (file, mode) at ../libc/stdio/fopen.c:5]
    3     printf() [printf (fmt, args) at ../libc/stdio/printf.c:3]:
    4     exit() [exit (rv) at ../sys/sys/sys1.c:343]:
    5         closef()
    6         plock()
    7         iput()
    8         xfree() [xfree () at ../sys/sys/text.c:127]
    9         acct() [acct () at ../sys/sys/acct.c:51]:
   10             plock()
   11             compress()
   12             writei()
   13             prele()
   14         memfree()
   15         wakeup()
   16         setrun()
   17         swtch() [swtch () at ../sys/sys/slp.c:417]:
   18             save() [if (save (u u_ssav)) at ../sys/sys/text.c:253]
   19             resume()
   20             spl6()
   21             idle()
   22             spl0()
   23     srand()
   24     getpid() [getpid () at ../sys/sys/sys4.c:120]:
   25     fgets() [char *fgets (s, n, iop) at ../libc/stdio/fgets.c:4]
   26     rand() [rand () at ../libc/gen/rand.c:9]
   27     strcpy()
   28     fputs()
   29     ttyname() [char *ttyname (f) at ../libc/gen/ttyname.c:17]:
   30         isatty() [if (isatty (( & _iob[1]) _file)) at ../libc/stdio/flsbuf.c:24]:
   31             gtty() [gtty () at ../sys/sys/tty.c:90]:
   32                 ioctl() [ioctl () at ../sys/sys/tty.c:102]:
   33                     getf()
   34         fstat() [fstat () at ../sys/sys/sys3.c:18]:
   35             getf()
   36             stat1()
   37         open() [open () at ../sys/sys/sys2.c:80]
   38         read() [read () at ../sys/sys/sys2.c:12]:
   39             rdwr()
   40         strcpy()
   41         strcat()
   42         stat() [stat () at ../sys/sys/sys3.c:36]:
   43             namei() [struct inode namei (func, flag) at ../sys/sys/nami.c:21]
   44             uchar() [uchar () at ../sys/sys/nami.c:216]:
   45                 fubyte()
   46             stat1()
   47             iput()
   48         close() [close () at ../sys/sys/sys2.c:163]

For something more aggressive, check out the QuakeWorld Server, and UAE 0.4

CTI Keynote, Cliff Stoll – (Still) Stalking the Wily Hacker

In the off chance you’ve never read it, the book The Cuckoo’s Egg is an incredible read.  However what is more interesting with the passage of time, and with the revelations of various 3 letter agencies is understanding why they were so slow to react, and why they were ultimately dismayed with Stolls’ work to alert others is that they too were no doubt actively exploiting the same exploits that the Russian sponsored German hackers were using.  Much in the way that some vendor holes have remained pretty much during the products entire lifespan (Cisco PIX being one…).

Research UNIX v9

v9 on TME

This just in, I have just booted Research UNIX v9 on TME’s SUN-3 emulator!

And there we are booted up and logged in.. pardon the disk error..

funinthe

I’m slightly hesitant about uploading it, as it clearly isn’t right… And this is only the binary component, I have integrated the source tree onto the disk image.  But I haven’t actually tried to compile anything except a simple hello-world program.  You can download it here from sourceforge: SUN3-research_v9.7z  If anyone want’s to browse the source, it’s on my CVS browser thing.

Research UNIX v8

    v8 on SIMH

So what the heck is Research UNIX v8?  Or even what is Research UNIX?  Well a query against utzoo gave me this answer:

>I've seen people that use System V and the like refer to their Unix as
>"tenth edition" or "ninth edition", or whatever. I've always seen things as
>"System V release n", or whatever. Anyone know the difference between these
>different naming schemes ?

There are actually three designations: Versions, Editions, and
System/Releases. The proper names of the first six Unixen were
"The #th Edition". Colloquially, people called them "Version #".
The Version Sixth Edition split off several variations, one of which
became Version Seven (the Seventh Edition) and sired BSD. From
several others, System III was born, and later named System V.
Tacked onto this name were Release numbers and yes, Versions.
So you will see things line SVr3v2.

The Eighth, Ninth, and Tenth Editions seldom left Bell Labs
and are also referred to as "Research UNIX". Another system
(not UNIX) they are playing with is called "Plan 9". Every so
often, a feature, such as STREAMS, finds its way into System V.

In some ways, Research UNIX is closer to BSD than to System V.

In short, UNIX began it’s life as a research project.  Until recently versions 1-6 & 32v were available to the public.  However the later versions, 8,9,10 were not.  However thanks to the work over at TUHS it’s available for non commercial use:

Alcatel-Lucent USA Inc has permitted usage saying "will not assert its
copyright rights with respect to any non-commercial copying, distribution,
performance, display or creation of derivative works of 
Research Unix®1 Editions 8,9, and 10."

So awesome!

The version of Research v8 is split onto 2 tape images, one for the graphical terminals, and the other for the OS install onto the VAX.  The distribution is not suitable for any standalone operation, and requires a previously installed 4.1BSD machine, with a second disk to install v8 onto.  Part of the installation requires you to compile your own kernel.  I ran into a bit of problems as it’s not a 100% process, but after referencing this guide from David du Colombier, I had the system up and running.  Naturally reading the installation manual helped a great deal too.

As always there is strange artifacts left in the backup, such as this scoreboard from rogue:

Top Ten Rogueists:
Rank Score Name
1 5545 Rog-O-Matic XIII for mjs: quit on level 17.
2 5043 ken: killed on level 23 by a dragon.
3 3858 zip: killed on level 16 by an invisible stalker.
4 3249 Rog-O-Matic VII: killed on level 16 by an invisible stalker.
5 2226 Rog-O-Matic VII: killed on level 13 by a troll.
6 2172 St. Jude: killed on level 13 by a troll.
7 1660 Rog-O-Matic VII: quit on level 11.
8 1632 Chipmunk the Jello: killed on level 10 by a centaur.
9 844 Rog-O-Matic VII: quit on level 5.
10 401 Rog-O-Matic VII: killed on level 4 by a snake.

Does this mean Ken Thompson was an avid rogue fan?  Perhaps.  Naturally I quickly compiled the v100 version of aclock, and had it running.

aclock on v8

I’ll have to edit this and more and more as I find out, but I’ve been busy in real life, and of course I know that in addition to v8, there is also v9 & v10 to tackle.

As always, if you want you can download my pre-installed from my site : researchv8.7z

You will have to bring your own copy of the SIMH VAX-11/780 simulator.  As of 31/3/2017 ther is issues with the github version of SIMH, and you will have issues with the disks on the VAX.  You need to disable the async with a simple set command in your ini file:

set noasync

And you should now be good to go!  As always you’ll have to battle the 404 page for the correct link and the username & password.

sorry.

Manually adding ncurses & VDE support to the Linux Qemu build

For some reason I had issues for this to automatically pick up building Qemu 2.8.0 on Ubuntu 16.10 (Which is really Debian)…

Anyways, be sure to have the needed dev components installed.  If you have a FRESH system, natrually you’ll need a lot more.

apt-get install libvdeplug-dev
apt-get install libvde-dev
apt-get install ncurses-dev

editing the file config-host.mak, I found I needed to add the following to turn on ncurses & VDE:

CONFIG_CURSES=y
CONFIG_VDE=y

And lastly add in the following libs to the libs_softmmu, to ensure it’ll link

-lncurses -lvdeplug

And now I’m good!

From my notes on flags needed to run Qemu the old fashioned way:

-net none -device pcnet,mac=00:0a:21:df:df:01,netdev=qemu-lan -netdev vde,id=qemu-lan,sock=/tmp/local/

This will join it to the VDE listening in /tmp/local

Obviously I have something more interesting and more evil going on….

2013-2017 Aclock Binary Contributions

(this is a guest post from Antoni Sawicki aka Tenox)

I was little busy and I didn’t process new binary submissions for over three years. Here they are, more or less in order of appearance.While not a lot for 3 years they are very important historically! Also almost all contributed, thank you all!

AmigaOS bootable floppy disk by Jason Stevens.

Aclock on Amiga

Android port by Adam Gutman. See below, it also runs on a watch!

aclock-android

MVME PowerPC Linux by Plamen Mihaylov.

ELKS by Lorenzo Gatti. This also includes a boot image! It’s hard to believe I somehow missed ELKS in my own efforts. Also there is a boot image available.

MVME M68k NetBSD by Plamen Mihaylov. Thank you for collecting all these beautiful and rare Motorola MVME machines!

HeliOS on Transputer by Michael Bruestle. Oh boy I have been looking for this for quite some time! Unless you started 30 years ago, transputters are rather hard to get into from scratch. This port should also work on Atari ATW800. I wish I had one to test 🙂

BSDI 1.1 by Dima Naumov. This is very cool because of all the flavors of BSD I somehow missed this one! I’m still trying to figure out BSDi, BSD/OS and BSD/386 naming convention. Someone please help.

VxWorks by myself. While VxWorks port existed before it was only compiled for a simulated Pentium (SIMPENTIUM) rather than actual target CPUs. I have came across a set of compilers and built it for ARM, MIPS, PowerPC, SH and Xscale. I still don’t have SPARC. See this post about how to run your own target on VMware.

ReactOS by Dima Naumov. While it’s expected that native Win32 aclock will run on ReactOS, this is a build targeting the OS specifically. Sharp X68000 running Human68k OS, by Jason Stevens. That’s a nice surprise! I’ve been looking for this one for a while. No screenshot for but hopefully Jason will be able to produce one. Human68k has a very cool looking GUI!

Microsoft XENIX 1.0 running on AT/286 by Michal Necasek. This was possible thanks for Michal’s huge efforts to patch this historical os to run on VirtualBox.

I happen to own the original set of floppy disks that Microsoft produced and shipped to various OEMs such as IBM, Radio Shack, Intel, SCO, etc.

The set comes with a development kit which now you can run on a VM. You can read some more about efforts to virtualize Microsoft/IBM Xenix on Michal’s Blog.

Venix/86 on AT/286 by Jim Carpenter. This port was delivered as part of a virtualization challenge, which was won by Jim. Thank you and congratulations again! There also is a runner up entry by Mihai Gaitos which has some fascinating details including about Aurora software that came with the system.

Wyse UNIX for 386 by Mihai Gaitos. This port was delivered as part of a similar virtualization challenge, which was won by Michai. Congrats!

Cisco 1700 (PPC) emulated via Dynamips by Jason Stevens. This one is also very close to my heart because of my networking past and present. I will definitely want to try load it on a physical device! Jason is also working on MIPS version so hopefully this will run on Cisco 2500 and up.

Android Wear. Parker Reed send me this photo of Aclock Android by Adam Gutman running on an actual watch! Wow this is so cool!

BSD/OS 4.1 aka BSDI for SPARC by Plamen Mihaylov. Also thanks to Cory Smelosky for releasing the images!

EFI firmware on various platforms, such as x86, x64, ia64, arm32 and 64 by Natalia Portillo aka Claunia. This aclock can be launched from UEFI Shell or by running EFI standalone application if EFI shell is not available.

This is a screenshot of aclock EFI x64 running on HP DL380 via iLO remote console.

Linux and FreeBSD builds for ARM and PowerPC by Natalia Portillo. Claunia sent me a Christmas package with a aclock builds lot of missing CPUs for Linux and FreeBSD, both 32bit and 64bit PPC and ARM for both OSes. Total 8 binaries!

Singularity on x86 by Natalia Portillo. SingularityOS was a research operating system from Microsoft. Rumor has it Microsoft wanted for it to eventually replace Windows NT line with managed code OS. As expected it didn’t perform too well and with doom of Windows Vista the project was eventually scrapped. Singularity development kit has been released to the public on CodePlex. Since the OS is text mode only, it was a natural target for Aclock. A port in C# (OMFG) has been created and the binary integrated in to the iso boot image.

RISC iX running on Acorn R260 by Raymond Stricklin aka Bear. I was scorching the earth looking for a working copy of RISC iX and there he had it. Thank you. It’s beautiful.

Minix 3 for ARM by Natalia Portillo. Latest release of Minix adds experimental support for ARM architecture. No network and framebuffer but aclock works over a serial console!

Again thank you for all your contributions!

If you want to to help contribute to aclock, there is a wanted list. Some of them come with a monetary reward. Please contact me before undergoing any major work as some of them are under way.

Also, aclock now lives on GitHub, for easier.. everything.

Python command line network speed test

Not bragging..

So you know all the old speedtest.net stuff.  They have their old flash based client, and a html5 client, but what if you are on a bare VPS, and you don’t want to install X and the gigs of desktop to run a simple bandwidth test?

Well install python, and then run this:

curl -s  https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python –

And away it goes!

# curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python –
Retrieving speedtest.net configuration…
Testing from Joe’s Datacenter (172.86.179.14)…
Retrieving speedtest.net server list…
Selecting best server based on ping…
Hosted by Packet Layer Consulting LLC (Kansas City, KS) [5.37 km]: 5.394 ms
Testing download speed……………………………………………………………………..
Download: 53.06 Mbit/s
Testing upload speed……………………………………………………………………………………….
Upload: 110.83 Mbit/s

Nice!

BackOffice Server 4.5 aka how to get the best of 1990’s Microsoft Server Tech!

Stylized logo!

Every so often, I’ll get either emails or messages from various people wanting to run their own exchange server setup in a similar method that I have setup, except that they are lacking either Windows NT Server discs, or even the Exchange server disc.  I always end up pointing people to eBay, although contrary to the last few years, prices of old Exchange Server have gotten expensive.  However there is a different SKU, and way to get them both, plus a lot more, enter the late 1990’s server craze of product consolidation, Microsoft Back office.

Back Office media kit

In all version 4.5 comes on 7 CD’s containing:

  • Windows NT Server 4.0/IE 5.0/MMC 1.0
  • SQL Server 7.0
  • Proxy Server 2.0/Option Pack
  • Exchange Server 5.5
  • Site Server 1.0
  • Systems Management Server 2.0
  • SNA Server 4.0

Before server virtualization took off, the trend for small branch offices and small organizations was to get a single server and try to run everything all at once.  Of course this leads to an incredible amount of inter-tangled dependencies, and possible collisions when involving 3rd party software, along with possible performance issues for stacking so much onto one box.  How times have changed!  Where today we may run all the same services on a single physical box, however with each server component getting its own VM, it lends to far better stability as you don’t have so many applications with possible DLL/system versioning issues, and better resource management as you can easily prioritize VM’s or even suspended ones that are infrequently needed.  Having lived through it, there was nothing like having a needed service pack for one issue on one component, which then broke something else.  Needless to say this is why we have virtualization, and things like docker to deal with DLL hell.

CD’s

There is no real difference between these Back office versions of the server apps, which is why I would recommend this over a standalone package as you get so much more.

SMTP along with POP and IMAP, are largely unchanged.  While Outlook 2016 may not support Exchange 5.5 directly, you can configure it as an IMAP server, and connect just fine.  I’d highly recommend something like stunnel to wrap it with modern encryption, something that Windows NT 4.0 is lacking.  Combined with an external relay to do “modern” features like DKIM, spam filtering and obscuring your server’s direct connection on the internet, there is nothing wrong with using it as a backed, even in 2017.

SQL 7 is the first version in the “rewrite” of Sybase SQL, supporting the new client libraries, which .Net 4.5 on Windows 10 can still happily connect to, unlike SQL 6.5 and below.  I use it occasionally to quickly prototype stuff as needed or load up datasets to transform them.  I also like the SQL scheduler to do jobs in steps, as it can catch error codes, and you can setup elaborate processes.

I can’t imagine having a use for SNA Server anymore as IBM had shifted all their mainframes from SNA, to TCP/IP.  I would imagine with a current software contract that is what people would be using, but somehow I’d like to imagine some large organization still using 3270’s on people’s desks, and a SNA gateway to bring sessions to people’s desks.  But that is highly unlikely.  Back in the day COM/TI was a big deal to take COBOL transactions and package them up as Microsoft COM objects to later be called either directly, or middleware via DCOM.  Although who knows, when it comes to legacy stuff, Im sure somewhere has type 1 token ring MAU’s, and SDLC links.

Packages like Back Office is what basically pushed out Novel from the market as they didn’t develop their own solutions in time, and deploying server software to Novel Netware proved to not only be very precarious, but along with it’s single application process space, proved to be extremely unreliable.  Not to mention that older protocol companies like DEC, IBM or Novel were entrenched in their own proprietary network stacks, and TCP/IP was frequently seen as something to be purchased separately both for the OS, and the application.  Microsoft certainly did the right thing by having a free TCP/IP for Windows for Workgroups, and including it in Windows NT, and Windows 95.

As always the option Pack for Windows NT 4.0 nearly brings it up to the functional level of Windows 2000, and is a great way to build that virtual corporation for testing.

 

Sourcecode to Darwin 0.1 located!

Over on the NeXT Computers forum, the source code has been uploaded and shared to all!

Rob Blessin uploaded the source!

So naturally I mirrored it as soon as I found out, dumped it into CVS, so I can load it up in CVS2WEB, and src2html.

And I setup a quick mirror over on my vpsland site (as always 404 error gives the correct password). It’s source code only, so no binaries.

As an edit, it was source only, but I’ve made binaries, and even Qemu images.

Installing VMware ESXi 5.5.0 Update 3 on KVM

Well I had no luck with the boot process hanging during initialization.  I searched a little, and came across this thread, stating :

The line that says “Running inside a VM; adjusting spinout timeout to 180 seconds” would suggest that KVM implements enough of our backdoor interface to make it look like we’re running under a VMware hypervisor.  When we’re running in this environment, we use the backdoor to get the host TSC frequency.  I suspect that KVM doesn’t implement the “GETMHZ” backdoor call, so we are confused about the TSC frequency.  The 30ms delay turns into … 30 hours?  30 years?

So they had a source code change for QEMU 1.7.0, however it obviously doesn’t work in 2.x.  It was rolled up stream, and then made into a switch to disable with a simple flag to add into the command line.

-machine vmport=off

So with that set I ran the following:

kvm -vnc 0.0.0.0:1 -cpu host \
-machine vmport=off \
-m 4096M \
-smp cpus=2 \
-drive file=esx-1.qcow2,if=ide,index=0,media=disk \
-serial telnet:127.0.0.1:5001,server,nowait \
-monitor tcp:127.0.0.1:6001,server,nowait \
-cdrom /root/VMware-VMvisor-Installer-5.5.0.update03-3116895.x86_64.iso -boot d \
-net none \
-device vmxnet3,mac=00:2e:3c:92:26:00,netdev=esx-0 \
-device vmxnet3,mac=00:2e:3c:92:26:01,netdev=esx-1 \
-device e1000,mac=00:2e:3c:92:26:02,netdev=esx-2 \
-device e1000,mac=00:2e:3c:92:26:03,netdev=esx-3 \
-netdev socket,id=esx-0,udp=127.0.0.1:10000,localaddr=127.0.0.1:20000 \
-netdev socket,id=esx-1,udp=127.0.0.1:10001,localaddr=127.0.0.1:20001 \
-netdev socket,id=esx-2,udp=127.0.0.1:10002,localaddr=127.0.0.1:20002 \
-netdev socket,id=esx-3,udp=127.0.0.1:10003,localaddr=127.0.0.1:20003

And now I can boot up, and install VMWare!

ESXi 5.5.0 on Qemu KVM

By default you will not be permitted to start any virtual machine.  To get around this you have to enable VMWare to run nested.
Add the following to /etc/vmware/config under ESX:

vmx.allowNested=TRUE

And then you are good to go!

VM running on nested ESXi 5.5.0