Showing posts from 2018

Wikipedia did not replace books after all

I contributed to Wikipedia in its early days. It's incredible that after so many years of contributions from so many people, there are still many, many areas where articles could be massively improved.

See the one about Startup companies. As of December 2018, it's still weird. This surprised me.

In those idealistic years of the early 2000s, I was sure that by now almost all knowledge in the world would be captured in an open and free encyclopedia. I also believed that other forms of collaborative content would replace guide books and they would be much better.

I was very wrong. I have a few hypotheses as to why.

Certain topics are so ambiguous that it's a struggle to write about them in an objective way. The Wikipedia style is to write about "succinct description of dry verifiable facts", but for these topics people want to write about their preferred insights. Insights are subjective, you can't find scientific consensus about them, so the page becomes this me…

bpf_trace_printk as a last-resort method to debug eBPF programs

It's hard to debug problems in eBPF programs. When everything fails, there is a last-resort: use bpf_trace_printk.

bpf_trace_printk can be used as such:

bpf_trace_printk("fname %s\\n", valp->fname);

The double-escaped \\n is needed when the C source code is embedded in a Python multi-line string, which is the case for most bcc examples.

You can use formatting directives like %s and %d, but you can only use one per line.

To see the output, first run the bcc program as usual, then do this in a separate terminal:

$ sudo cat /sys/kernel/debug/tracing/trace_pipe foo-29323 [002] d... 12090253.569332: : fname /etc/ foo-29323 [002] d... 12090253.569350: : fname /lib/x86_64-linux-gnu/ foo-29323 [002] d... 12090253.569384: : fname /lib/x86_64-linux-gnu/ foo-29323 [002] d... 12090253.570230: : fname /proc/sys/net/core/somaxconn foo-29323 [002] d... 12090253.571336: : fname /dev/null
Tail won't work. cat will already take care of streaming the outp…

nictuku/dht in the wild

Open-source is magical. When I wrote my distributed hash table library back in 2012, I just wanted to write something cool that made computers talk to each other efficiently at a very large scale.
Since publishing it, the library has been used by botnets, has a source code evolution video and was used by someone's Bachelor thesis in Switzerland.
And today I found out that computer scientists from University of British Columbia and University of Bamberg have analyzed the library in a very cool paper to verify that it's correct! They analyzed logs and checked that the library's behavior follows invariants expected for a correct implementation of Kademlia. In text: We logged state after the results of a Find_Value request were added to a peer’s routing table. On each execution we found that ∀ peers i, j, peeri .min_distance = peerj .min_distance in all total-order groups. This invariant, in conjunction with O(LoŠ“(n)) message bound, provides strong evidence for the correctnes…