News for hackers. Stuff that matters.
Re:BPF for Hid Drivers by rektide on Wednesday November 16, 2022 @12:26PM (#33626885)
Is there a risk that companies could start having closed source code external to the kernel, to support devices, via this?

The monolithic GPL kernel has been a good legal defense, that strongly encourages good behavior. I love these capabilities, but the shift across the continuum towards a somewhat more microkernel-y behavior feels like it has risks.

Re:BPF for Hid Drivers by mdaverde on Wednesday November 16, 2022 @12:51PM (#33627382)
In the same way out-of-tree kernel modules are enforced to license themselves as GPL if they intend to use a lot (if not most) of the available functionality, eBPF programs fall under the same restrictions.

bpftool[0] allows you to see which programs are currently running in your system, their bpf asm instructions and whether they are GPL-compliant through `bpftool prog show`.

Of course, we still need companies to actually release the source code of their eBPF programs somewhere for the promise to be fulfilled.

[0] https://github.com/libbpf/bpftool

Re:BPF for Hid Drivers by Karliss on Wednesday November 16, 2022 @02:57PM (#33629583)
Isn't BPF execution constraints intentionally very tight, 4096 instruction, 512 bytes of stack, limited control flow? I don't think it's currently usable to implement general purpose drivers. Only reason it could work for HID drivers is because a lot of them are doing nothing more than very simple byte substitution either in device descriptor or the actual data reports. So I am not too worried about closed source driver.
Re:BPF for Hid Drivers by mdaverde on Wednesday November 16, 2022 @03:12PM (#33629823)
eBPF has changed several of these constraints [0]

- Verifier can explore up to 1million insns now instead of 4096

- 512 bytes of stack but with tail chaining you have up to 8k

- Bounded loops have been added. Unbounded loops are prevented by design to not stall the kernel

[0] https://docs.cilium.io/en/v1.12/bpf/