Hahaha. Haha. Haha haha. Fucking posix standard nightmare fuel.


@cperciva: I just figured out how to safely and portably close a file descriptor in a multithreaded process without running into problems with EINTR. It only took me ~7.5 years after writing this blog post: 1/

@cperciva: Run once: 1. Create a socket pair s[2]. 2. Write a random cookie into s[0]. To close(fd), wrapped in a mutex: 1. dup2(s[1], fd) until it succeeds or fails with !EINTR. 2. close(fd). 3. If we got EINTR, recv(fd, MSG_PEEK). 4. If we read the random cookie, goto 2. 2/

@cperciva: The first trick here is that unlike close(), dup2() has well-defined semantics in POSIX with respect to EINTR: It's atomic, so there's no way for another thread to accidentally reuse the same descriptor # between the implied close and reopen. 3/

@cperciva: The second trick here is that while we can use dup2 to guarantee that the original descriptor was safely closed, we now need to close the duplicate -- but we can distinguish between "EINTR and closed" and "EINTR and still open" by seeing if MSG_PEEK returns our magic cookie. 4/

@cperciva: If we're on a perverse OS where close(fd) can successfully close the descriptor and still return -1 / EINTR, and another thread wins a race and reuses that descriptor, there's still no way we'll see our random cookie, so we won't make the mistake of trying to close it again. 5/

@cperciva: I'm not sure that I would recommend this approach to anyone -- but it's nice to know that closing a file descriptor in a multithreaded process is in fact possible.

HBO Chernobyl views 

How to factory reset your lightbulb: turn it off, turn it on, off, on, off, on, ... Eight seconds every time. Hope you like counting to 8!

Painting yourself into a corner #Rust style 

"...dogs’ faces are structured for complex expression in a way that wolves’ aren’t, thanks to a special pair of muscles framing their eyes. these muscles are responsible for that “adopt me” look that dogs can pull by raising their inner eyebrows. it’s the first biological evidence scientists have found that domesticated dogs might have evolved a specialized ability used expressly to communicate better with humans."


I'll cover travel expenses of anyone willing to come to vBSDcon 2019 and talk security as long as you can bring a 0-day for FreeBSD.

Please boost.

Turns out it's hard to use modern cryptography libraries with safe APIs once you get just ankle deep in this stuff. The only one that actually lets you get all pieces working together is good old (or good new if you will).

% egrep -wR "(BigNum|EcGroup|EcPoint)" . | wc -l

Wish it was approaching 0.

#OpenBSD #relayd is nothing if not super elegant. I was surprised how easy it is to setup Layer 7 load balancing. I currently have a 3 node setup. 1 node runs relayd and the other 2 run WordPress/httpd/MariaDB.

Magnifique! 😍


Bonsoir, j'ai fait une tarte à la rhubarbe.


Show more

Exclusive or something