Finally had some time to get back from the OpenBSD hackathon and take stock of what I worked on. It was pretty interesting one this year, as I went without having much idea of what to work on (unlike last year, when I had a mad backlog to catch up on). Some stuff I did during the week included:
- Clean up the atomicio
interface used in OpenSSH and
nc(1) to
provide simpler semantics. Error checking from read/write functions
are a real headache in C, as the functions return
-1
on error, which means a signedssize_t
is returned. However, they accept an unsigned value as the size of the buffer to process, which means they could potentially return a value outside the range of the return value. This means you have to check if the return is-1
, which indicates an error, and otherwise cast to asize_t
to correctly get the buffer size back. With the new atomicio, it always returns asize_t
, and returns0
to signal an error (witherrno
containing the error, andEPIPE
being set for anEOF
condition). - Start looking at the Bluetooth stack to get L2CAP and RFCOMM
support. We are half-way through un-netgraphing the FreeBSD stack
and having a more traditional
netbt
socket interface (much likenetinet
ornetinet6
) to Bluetooth. - Use CIL to implement a few fun kernel
source->source transforms.
kerneltrace
just accepts a regular expression and inserts aprintf
in the function prologue which outputs the function name and any arguments passed into it. Had this idea when chatting with Marius, and it turned out to be very useful when trying to figure out dataflow in the Bluetooth stack (just compile withmake CC="/usr/local/bin/cilly --dokerneltrace --trace-regexp='ubt|ng_blue'"
). The second one was even simpler;randomvars
assigns a non-zero value to every local variable in a function call to help track down uninitialized-local-variable bugs. Heres one Chad Loder found in mg(1). - Other random signed/unsigned cleanups in OpenSSH. Boring but important I guess...
All in all, the hackathon re-motivated me to continue work on the OCaml-based daemons that Dave Scott and I have been hacking on. I don't want to be fixing random buffer or integer overflows in an OpenBSD hackathon 5 years from now; we need to move on to more high-level issues.