Archives

  • Why scons is cool

    I’ve recently started playing with scons a little for some small personal projects. It’s not perfect, but I’ve rapidly come to the conclusion that it’s a probably far better choice than make in many cases. The main exceptions would be cases where you need to integrate into legacy build systems, or if asking or expecting [...]

    Nov 7th, 2010 | Filed under Software Engineering
    Tags: , , , ,
  • Using Haskell’s ‘newtype’ in C

    A common problem in software engineering is avoiding confusion and errors when dealing with multiple types of data that share the same representation. Classic examples include differentiating between measurements stored in different units, distinguishing between a string of HTML and a string of plain text (one of these needs to be encoded before it can [...]

    Oct 11th, 2010 | Filed under Software Engineering
  • amd64 and va_arg

    A while back, I was poking around LLVM bugs, and discovered, to my surprise, that LLVM doesn’t support the va_arg intrinsic, used by functions to accept multiple arguments, at all on amd64. It turns out that clang and llvm-gcc, the compilers that backend to LLVM, have their own implementations in the frontend, so this isn’t [...]

    Oct 4th, 2010 | Filed under Low-level hacking
  • Write yourself an strace in 70 lines of code

    Basically anyone who’s used Linux for any amount of time eventually comes to know and love the strace command. strace is the system-call tracer, which traces the calls that a program makes into the kernel in order to interact with the outside world. If you’re not already familiar with this incredibly versatile tool, I suggest [...]

    Aug 29th, 2010 | Filed under Software Engineering
  • Implementing a declarative mini-language in the C preprocessor

    Last time, I announced Check Plus, a declarative language for defining Check tests in C. This time, I want to talk about the tricks I used to implement a declarative minilanguage using the C preprocessor (and some GCC extensions). The Problem We want to write some toplevel declarations that look like: #define SUITE_NAME example BEGIN_SUITE(“Example [...]

    Jul 4th, 2010 | Filed under Software Engineering
  • Check Plus: An EDSL for writing unit tests in C

    Check is an excellent unit-testing framework for C code, used by a number of relatively well-known projects. It includes features such as running all tests in separate address spaces (using fork(2)), which means that the test suite can properly report segfaults or similar crashes without the test runner crashes. My main complaint about Check is [...]

    Jun 26th, 2010 | Filed under Software Engineering
  • CVE-2007-4573: The Anatomy of a Kernel Exploit

    CVE-2007-4573 is two years old at this point, but it remains one of my favorite vulnerabilities. It was a local privilege-escalation vulnerability on all x86_64 kernels prior to v2.6.22.7. It’s very simple to understand with a little bit of background, and the exploit is super-simple, but it’s still more interesting than Yet Another NULL Pointer [...]

    Feb 5th, 2010 | Filed under Computer Security
Posts Tagged ‘C’