Stupid ideas

May 20, 2010 23:51

So deraj and I want to open our own lab. Not going to spill the beans on that anymore. But now I have some hope of ever having time to work on some of my wilder ideas. Basically, no one but maybe Jared or myself will pay me to work on my ideas. They want to pay me to work on their ideas usually. For physics, I could probably find people who have similar enough ideas to me sometimes and might pay me to work on the ideas I have that are similar to theirs. But that's pretty isolated.

As some of you may know, I was a bit of a Dreamcast hacker at Beloit. Nothing too serious, but I had fun playing around anyway. They sold for $20 at the local GameStop (or whatever), so I picked up a couple and fucked with them. Of course, since I didn't have a computer at that time, all the hacking was done on other people's machines. It started on Argonne National Lab ATLAS Data Room machines, and progressed later to random shit on Kristina and Avi's computers. Most of the stuff done on Avi's computers was actually learning how to burn Sega CDs, which mainly I recall needed some program made for Saturn to get the data copied correctly and any other junk. Damn, I need a new CDX. Kristina's computer died, and I didn't actually take that much stuff off of it, like all the code to make the NesterDC disc I had. I gave my hacked DC to my sister as a gift, and now we don't speak anymore. So there go all the DC games I downloaded from Steve. And there goes my Linux Live CD for DC. But I do have an extra copy of the NesterDC (it was awesome for visual effects at Carter's New Years party this year...I'd just find some game with a long intro sequence or one that played itself and let it roll for a few hours).

Of course, now I'm actually much more apt at Linux than I ever was in undergrad (go Gentoo learning go!). I was reading about the Ken Thompson hack and I was like, damn, life sucks dude. Well, I was telling my colleague over dinner about the Ken Thompson hack and how damn clever it is, and I decided I guess one of these days I really need to write my own compiler code and compile with with some self-written assembly language if I ever want to keep ken from logging into my machine. (Sidenote to Cancer: Your dad should be Ken Thompson for halloween.) There are only two processors I ever wanted to learn the assembly languages for: Z80 and SH4. I'll let those clever ones of you figure out why on your own. Of course, generalizing to the processors rather than specific items I wanted to hack at least makes it seem like a better way to spend my time, right? Dude, I could totally boot Linux on your set-top box! And I guess very briefly recently I was interested in the Motorolla processors (I kinda want to get an old G4 Mac...and run Linux on it...), but I think I don't need to learn the assembly for that anyway.

So these various lines of thought made me say to Binh, "Well, if I want to avoid the Ken Thompson hack, I guess I need to write my own code compiler, but I should choose some funny language to do it in." I then digressed about how I was supposed to take COBOL in high school and by mistake took a class on Microsystems Development. (COBOL is often used in business, so it didn't become clear to me until too late that we were never going to learn COBOL, and the class's goal was us writing a program to control some business data; most people used like some horrible thing by Mircosoft I scoured from my memory, but I used VisualBasic (less horrible) to make a program for a company like UPS). Anyway, I looked up COBOL after dinner, and I was like, "There's no way in hell I'm going to learn that language."

Then I was poking around the dev-lang category of portage and also Wikipedia's List of Programming Languages and I was reminded again of Haskell. I looked it over, and I decided, yes, this is the next language I need to learn, this is totally off the hook! Not only that, but there are lots of different compilers for Haskell (and ALL are open source!!), so it looks like a good community and also somewhere a new compiler would at least be welcomed. For starters, I'm going to install xmonad tonight, because Jared was blabbing about how cool it is, and I was wanting to eventually run Xfce, LXDE and xmonad all on my laptop and put the optional logins on SLiM, which I'm already running (yeah, it only took me like three years to stop using console login and startx, get over it). So, that gives me at least some code in the language of choice that I was already looking at, making my idea at least a little more sane, right?

But the trick is how do I compile a compiler without getting screwed by Ken Thompson? One could write a haskell compiler in another language and use that compiler, but in theory a good Ken Thompson hack should even insert itself into other compilers! I guess the answer is you have to invent a new language yourself. That sounds like a nightmare. The other answer is not to be so paranoid and assume that if you, for example, compile a Haskell compiler in COBOL, there won't be a KTH in your new compiler, and then you can go to town. I guess another way might be to write your compiler in assembly language on some insane architecture and hope that no one was KTHing the hardware drivers for your Z80 processor machine anticipating you might write a Haskell complier with it and KTHing your compiler. But then I have to cross compile it to make it work somewhere, you know, useful. Like my Dreamcast for example.

This is more of a project idea for fun than paranoia, by the way.

You might be wondering at this point what in the fuck I'm going on about. Basically there are a few ideas here.

I want to port or make a functional clone of Devil Linux for the Dreamcast. The only reason to put Linux on a dreamcast, besides having too much time, is that it can serve as a reasonable network controller. That's exactly what Devil Linux is intended for: Live CD mounting for network controlling. The idea is it's very difficult to hack, because you just reboot the machine. No matter how much someone hacks your Dreamcast (minus KTH), they can never alter the CD. So, throw a daily reboot on it and burn the disc with your network parameters in the configs (or use the VMU drivers to store configs there if you want and unmount and remove the VMU after boot when the machine is still offline). This nearly-unhackable network controller (if this comes to pass, I will register hackmydc dot com and encourage people to try to hack it) does go hand in hand with working on the KTH problem.

But how best to proceed? I've begun digging up all the old DC Linux sites and links in fear they were broken. Some have moved, but all the information is still online! Woo!

Now, while writing this post, I figured what is basically the surest way to avoid KTH. Basically, you need a really old computer running code that's before the language in question was invented. Then you can't be KTHed on your new compiler.

Oh shit, and I just found the missing square puzzle. This is going to bother me for awhile. This is related from logic and stuff, but in any case, I refused to actually read the KTH because I want to do it myself, likewise I didn't read the solution to the puzzle because I want to think about it.

Although Haskell is a fairly new language, I don't trust my luck to get ahold of a 1984 computer with reasonable code, a way to export the data easily, and, more importantly, any way to cross compile it. Thus, the solution is to find the newest programming language, learn it, take an old but recent machine, and write compiler in *that new language*, with, let's say, the gcc on my Mac OS 10.4 boot cd, and then use that new compiler and that new language to write your compilers for C, and whatever else. Presumably, the machine can, at the beginning, be Intel. Then with that clean code you can safely compile any other compilers you want, if you know the source code is clean. But then it seems to make more sense to write a C compiler, because probably early Haskell was coded that way (but I'd need to check), and then it might save the effort to write so much new code.

So what's the newest programming language, and how hard is it going to be to port the C compiler source code? Damn, this is way too hard.

Well, I can go to Akihabara and get a used DC maybe this weekend. And I put Linux on one of those before. So that project can be done, in any case.

So now I've connected SH4 processors, Haskell, and an operating system of solid steel all in one place. Did you ever think you'd read such a thing? Just remember, you read it here first.

Edit: I have a sense my KTH avoidance is wrong. I thought about it walking home. I'm too drunk right now to care to read it again. It goes like this, for the ultra paranoid. A KTH could have options in, say, a C++ compiler to KTH a FORTRAN compiler. So that's also a problem. Now consider new code language, codename GOATFACE. GOATFACE can be comprimised hours after its release, if I give the source code, which I would personally. (That point is irrelevant to overall KTH, because I'm using free software because so far I'm too lazy to write my own.) However, an older compiler cannot know the language of GOATFACE to implement a KTH. Thus, if you took a new language and an older compiler, there cannot bet GOATFACE KTH in the old compiler. It's just impossible. Now, in that language, let's say C++, you write a compiler for language GOATFACE in C++, based on, say, last year's ANSI standards. So now you have a safe binary. You can use goatface to compile code, and know Ken Thompson is not in your binary. It's really entropically impossible. That's my only work around besides assembly language.

Sure, you can write your own language, but I'm a hack, and I look for the path of least resistance. And sure, you could re-write your own login commands, but that only avoids the example case of the KTH. Better to hit it at the source.
Previous post Next post
Up