3 ms·
I think OpenSnitch just uses eBPF to capture metadata about the new connection, the "hold for user confirmation" does not happen inside eBPF. The eBPF does not
by yencabulator 4y ago
I think OpenSnitch just uses eBPF to capture metadata about the new connection, the "hold for user confirmation" does not happen inside eBPF. The eBPF does not need to block waiting for user input.
https://github.com/evilsocket/opensnitch/blob/4ce8b0e57cfb2587bd7cf85c275de40e4c2478c9/daemon/conman/connection.go#L88-L97 https://github.com/evilsocket/opensnitch/blob/4ce8b0e57cfb25...
https://github.com/evilsocket/opensnitch/blob/d9e0c59158ddf6ba7346bcbc984ee4243857668b/daemon/firewall/iptables/rules.go#L56-L59 https://github.com/evilsocket/opensnitch/blob/d9e0c59158ddf6...
- nathants 4y agoby the time a user prompt is displayed, all metadata has been joined to the packet, and libnetfilterqueue is waiting for a decision. my understanding of what is happening is as follows: - 1: libnetfilterqueue gets a packet. - 2: lookup packet via ebpf to get pid and argv. - 3: lookup rule, on miss prompt user to allow/deny. - 4: libnetfilterqueue allows/denies the packet. the tricky part is step 2. afaik there are 3 possibilities: - ebpf already knows about about this packet, return pid and argv. - ebpf will know about this packet shortly, wait, then return pid and argv. - ebpf dropped the data because of ringbuffer overflow, wait, then give up.
- yencabulator 4y agoMy understanding: ebpf runs at connect(2) time, stores metadata in a map; later, an NFQUEUE userspace helper fetches the metadata from the map.
- nathants 4y agothis is correct. it's the datarace between these components, and the possibility of ebpf dropping data because of a slow userspace callback, that makes this flaky.