Re:BPF for Hid Drivers
by anonymousiam on Wednesday November 16, 2022 @12:12PM
(#33626678)
Doesn't this "solution" just move the problem? I suppose if it's easier to write/update/maintain a set of eBPF rules for quirky HIDs than it is to update the drivers/modules, then this is an improvement.
I wonder how Linus feels about this? Does it introduce a new attack surface for malware injection?
Re:BPF for Hid Drivers
by akira2501 on Wednesday November 16, 2022 @01:40PM
(#33628252)
It adds a layer where complex attacks can hide. I'm not so much worried about the 'insmod' as I am about long term data exfiltration being used against me. This certainly does seem to make that a little easier.
Re:BPF for Hid Drivers
by egberts1 on Thursday November 17, 2022 @06:58PM
(#33647794)
eBPF has a way to go before it is secured enough.
One should not use eBPF in production machines (along with many other things that uses the mixed write-execute memory regions such as web browsers with JavaScript enabled).
Re:BPF for Hid Drivers
by tinus_hn on Thursday November 17, 2022 @07:13AM
(#33637865)
This solution is like using Javascript instead of C. You can’t write a buffer overflow in Javascript, and you can even sandbox it. That way you can allow code to run that has had less review.
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.
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 chme on Wednesday November 16, 2022 @02:58PM
(#33629584)
I would really like to see this implemented for a steam deck or steam controller, where you can change it from keyboard&mouse to game controller, or change button bindings on the fly from user-space while loading different games or applications.
Currently steam is required to change the controller configuration...
Re:BPF for Hid Drivers
by namibj on Sunday November 20, 2022 @07:59AM
(#33680560)
You can, instead of auto-activating arbitrary-connected keyboards as keyboard-input-devices to applications, only do that when they have a specific physical path.
On Linux for example that'd be possible via tuned/changed udev rules.
Source: https://twitter.com/kernellogger/status/1592786651968839683
Linux Plumbers Conf talk: https://www.youtube.com/watch?v=w708RnBEdvE
I wonder how Linus feels about this? Does it introduce a new attack surface for malware injection?
At the very least, Linux kernel has signed driver modules.
eBPF is also working on signed programs [0]
[0] https://lwn.net/Articles/853489/
One should not use eBPF in production machines (along with many other things that uses the mixed write-execute memory regions such as web browsers with JavaScript enabled).
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.
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
- 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/
https://github.com/daniel5151/surface-dial-linux
Currently steam is required to change the controller configuration...