Next up in our series of p2k18 hackathon reports is from Paul Irofti (), who writes:

After a long discussion with Martin (mpi@), Philip (guenther@) and Robert (robert@), we managed to pin-point the problems which lead to two diffs from me. The first fixed the existing semaphore implementation to respect signals marked with SA_RESTART and also performed timespec validation. As a side-benefit, Robert also ported posixtestsuite to OpenBSD which was soon taken over by Alexander (bluhm@).

The second, and much more exciting one, is a new implementation that makes sem_post(3) async-signal-safe (i.e. you can call it from a signal handler without deadlocking). This should also be faster as it uses atomic operations and futexes to mitigate locking.

As often happens, this effort uncovered other problems in the tree which I and others have started investigating and fixing.

An itch I wanted to scratch for a long time is WiFi network scanning. It always bothered me that I have to wait for a long time when running ifconfig scan and, if that was not enough, the entire network stack was blocked during the operation.

Fortunately (or perhaps intentionally), I was sharing a table with Martin and Stefan (stsp@) so I started nagging them about it. A first attempt at fixing things fast and dirty was to push down and remove the network lock around the ieee80211 stack. This turned out to be not sufficient as the lock was still taken and the network still froze during scan. On the bright side I pushed down the network lock and my commit seemed to have motivated Theo (tb@) to push it even further down.

Next, we tried to do this right(tm). The discussion between Stefan, Martin, and me about the issue reached the table across where Theo (deraadt@) was sitting and he jumped in enthusiastically (as always) and soon enough a plan was laid out: turn the SCAN ioctl into a nop and always store nwid credentials independent of the hardware underneath.

Soon enough I already had a diff for the first part and it has since hit the tree. Tip: you can now run ifconfig scan without doas(1). Credential storage will be a longer process and fortunately Peter (phessler@) had an old diff lying around that implemented the first bits.

My work in the wireless stack quickly lead me to another topic of interest: the device and stack computation of the received signal strength indication (RSSI). First off, I dislike that we present signal strength in either percentage or dBm. It should be unified across the stack. Second, some devices mis-calculate or even mis-interpret the numbers that the hardware presents. So I finally took the time to read the documentation and to check what other operating systems are doing to settle this mess. Unless life decides otherwise, you should start seeing diffs from me about this soon enough.

Between the cracks I managed to slip in a couple of ports diffs and update almost all the ports I maintain. I still have not built up the courage to go for math/suitespare.

Overall this has been a very productive hackathon with lots of collaborations in a very pleasant location! A big thank you to Gilles, Theo and the OpenBSD Foundation for making this possible!

My only regret is that I did not get the chance to bother Martin about yet another topic that I had naive diffs for: fuse (buffer passing) optimization.

Bisou pour tous les machines,

Paul

