C

Linux Shared Memory HOWTO

I wrote this HOWTO on the various ways to use shared memory on Linux almost 10 years ago, and its still the #1 site on google for "Linux Shared Memory", so I suppose it has stood the test of time. The document describes BSD mmap and System V IPC, with several examples, and a section on creating a toy malloc debugger (which later actually morphed into NJAMD.

C++ Functor to C Function Pointer Conversion

Pop quiz hotshot: You're on a bus with no Internet connection. You absolutely need to interface some new C++ code with a shoddy old C interface based on function pointers. The new C++ code makes heavy use of functors to carry state between call invocations. The C code must call these C++ functors by way of a function pointer, and only a function pointer. Your function pointer prototype cannot take any additional arguments for the class type. What do you do? What do you do...

The AntiAntiSniffer Sniffer

This was an entertaining little one-off. Basically, it started with the l0pht announcing a sniffer detection utility on Friday, July 23, 1999. Coincidentally, I was bored late that night at the NCSA when I was reading their announcement, and decided I'd spend the night defeating their program. Normally I would have just went home, but when I realized that I could call my program The AntiAntiSniffer Sniffer, I couldn't resist. I worked through the night and the next day, and by Sunday, I had come up with something that in theory, defeated all of their methods of sniffer detection, 3 days before they actually released the detector.

Autocode

The point of this project was to write platform independent stack overflow shellcode using only a C compiler and no asm. I succeeded, almost. The compiled autocode.c file disassembles itself, and outputs working shellcode. However, the major drawback is that on x86 it doesn't seem possible to eliminate the 0's from the resulting instructions. I attempted to fix this by adding an XOR encoder, but the problem is even that contained 0's when it attempted to obtain EIP through the usual call mechanism. The offset to the relative call instruction contained 0s.. Oh well. It was a fun exercise.

NJAMD: Malloc Debugger

NJAMD (Not Just Another Malloc Debugger) was a project I started after I realized memory issues in C were my biggest source of program bugs and the current solution at the time (Electric Fence) didn't have all the features I wanted. It eventually made it into RedHat, Debian, and a few other distributions, but fell by the wayside once Valgrind came on the scene. My last effort with the project was to rewrite it in C++, just to prove you could write something that low level successfully in C++ and have it still be just as fast, portable, and flexible as plain C. Unfortunately, I never polished or released the C++ code, but you can check it out of sourceforge.

Zummy: It's Alive!

Zummy is an IRC Q&A bot that used to answer FAQs in the EFnet IRC channel #LinuxOS near the end of the last millennium. He can learn from linking-verb based statements in a channel and subsequently answer questions using those definitions. He also has a keyword-based system that can be programmed by channel ops. Believe it or not, Zummy was actually even quoted in a publication as a consultant, thus passing an unofficial Turing test.

Abast Mateys, PCMAX off the i2c bow!

Back in about 2002, I wrote a Linux 2.4.x device driver for a neat solvenian company in exchange for some of their equipment. You see, back in my more maverick and idealistic days, I was in to pirate radio. (I suppose by admitting this, I just blew my chances at getting an FCC license, but I don't foresee ever appling for one anyways). The prose below represents an idealism that to me now feels almost pointlessly quixotic (and I say this while volunteering to preserve Internet privacy! HAH!), but it was a lot of fun at the time, and still is quite informative for anyone who feels like tinkering with this stuff. It is a rare surviving excerpt from the fscked.org of 2002.

Perhaps the most amusing part of this whole project was when I interviewed at Microsoft for an internship. My last interviewer was a real clean-cut, stodgy, almost military-looking guy who didn't ask me any technical questions at all. Instead, he just grilled me about this project: why I did it, what it was for, if I thought it was a good idea, etc etc. I recall doing my best to answer his questions without getting into too many specifics. Whatever I said must have done the trick, because they actually gave me the job.

Syndicate content