HNHacker News
TopNewBestAskShowJobs

jkbs

3 karma · joined February 16, 2019

submissionscomments
jkbs··on When can two TCP sockets share a local address?
Fair point, though gauging what is the knowledge-level of your audience is hard. Gotta pick what to include and what to omit if you want to keep it concise.
jkbs··on When can two TCP sockets share a local address?
Any pointers? What would you change?
jkbs··on Missing Manuals – io_uring worker pool
Xfig, naturally... just kidding ;-) They have been drawn with draw.io.
jkbs··on A Single Register Value
Glad you liked it. We will keep on writing, if you keep on reading ;-)
jkbs··on Conntrack tales – one thousand and one flows
Try resubmitting to netfilter mailing list:

http://vger.kernel.org/vger-lists.html#netfilter-devel

jkbs··on eBPF Can't Count?
The MMIO restrictions make sense. Thanks for the explanation!
jkbs··on eBPF Can't Count?
If you have the Linux kernel eBPF verifier in mind, it actually has a quite comprehensive test suite:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

Tests for the corner case that has caused the problem have been added shortly after it was fixed:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

jkbs··on eBPF Can't Count?
Cool idea. I played around with it.

As majke mentioned we need optimizations or the backend compiler will complain:

  $ clang -O0 -target bpf filter_alu32.c -emit-llvm -S -c -o filter_alu32.ll
  $ llc -march=bpf -mattr=+alu32 -filetype=obj filter_alu32.ll
  LLVM ERROR: Unsupported relocation: try to compile with -O2 or above, or check your static variable usage
The code has to be non-trivial to hit the error. I think its the use of eBPF maps that triggers it.

What if we turned off the optimizations in the frontend and ran just the backend optimizer, though? I had some success with this approach:

  $ clang -O0 -target bpf filter_alu32.c -emit-llvm -S -c -o filter_alu32.ll
  $ opt -O2 filter_alu32.ll | llc -march=bpf -mattr=+alu32 -filetype=obj -o filter_alu32.o
  $ llvm-objdump -S filter_alu32.o | grep -e -=
        45:       1c 21 00 00 00 00 00 00         w1 -= w2
        53:       1c 21 00 00 00 00 00 00         w1 -= w2
        65:       1c 21 00 00 00 00 00 00         w1 -= w2
You end up with more eBPF instructions if you don't use the frontend optimizer but the code doesn't need any hacks. Perhaps it can be tweaked further by applying frontend optimizations selectively?

So thanks for the suggestion. It's another working solution.

You can find the code for this experiment here: https://github.com/jsitnicki/cloudflare-blog/commit/acf28b69...