News for hackers. Stuff that matters.
Re:Facebook open-sources new suite of Linux kernel component... by monocasa on Tuesday October 30, 2018 @01:35PM (#18339220)
> Not every laptop user needs to be able to run BPF.

True for the moment, but I can see that changing. Having a safe VM at the system call layer is a game changer for so many subsystems. It turns the Linux kernel into a hybrid exokernel.

Re:Facebook open-sources new suite of Linux kernel component... by DelightOne on Tuesday October 30, 2018 @03:47PM (#18340641)
How would other subsystems use the safety of the BPF program - which I assume is the safe VM you mention? Do they have to assume that the network stack may not halt and have special code for it or sth ?
Re:Facebook open-sources new suite of Linux kernel component... by nouseforaname on Tuesday October 30, 2018 @05:27PM (#18341424)
Systemd uses bpf, it can be used for accounting of I/O.
Re:Facebook open-sources new suite of Linux kernel component... by monocasa on Tuesday October 30, 2018 @03:55PM (#18340721)
eBPF doesn't _have_ to use the network stack at all. So imagine i2c devices that get pulled out of the kernel. KVM drivers for top half of MMIO so KVM only needs half the number of context switches. Audio DSP kernels that run at interrupt time for super low latency. Really almost any interesting real time work. Etc.
Re:Facebook open-sources new suite of Linux kernel component... by DelightOne on Tuesday October 30, 2018 @04:39PM (#18341087)
> i2c devices that get pulled out of the kernel.

I thought eBPF programs run inside the kernel. Or are they _from_ userspace, run inside the kernel and so provide efficient into-kernel calls as well as direct access to certain _allowed_ hardware? I hope I’m not riding around semantics, sorry if I do.

Re:Facebook open-sources new suite of Linux kernel component... by monocasa on Tuesday October 30, 2018 @05:07PM (#18341281)
They are programs, provided by user space, that are sandboxed to run safely in kernel space. Anything that isn't a RISC-esque instruction in BPF is a jump to a kernel function, and each flavor of BPF (BPF_PROG_TYPE_*) has it's own table of allowed functions. Most of the program types that are mainlined call functions in the net stack, but that's not intrinsic to the idea of BPF.

So in the I2C case, I could see device drivers that get called to handle the weird things that I2C devices do where you're not really sure until master interrupt time exactly what needs to happen next and you need to make a real time decision. So a BPF program that implements a state machine and is run directly from the master interrupt could be more performant and more power efficient than doing it in user space, and safer than doing it in kernel space.

Did that answer your question?

Re:Facebook open-sources new suite of Linux kernel component... by DelightOne on Tuesday October 30, 2018 @05:47PM (#18341552)
I finally understand what program type stands for and the gist of the rest, thank you.
Re:Facebook open-sources new suite of Linux kernel component... by rurban on Tuesday October 30, 2018 @06:49PM (#18341913)
It's fast but certainly not safe. it has native arrays, with which you can easily exploit spectre or meltdown issues. to be safe you need to turn it off.
Re:Facebook open-sources new suite of Linux kernel component... by monocasa on Tuesday October 30, 2018 @06:58PM (#18341956)
The MAP_ARRAY access goes through an external function call, which gives you a nice place to hook for mitigations. And this stuff is going to have to be fixed properly, as running sandboxed untrusted code in a higher context is waaayyy to useful in a post Moore's law world. Kernels like XOK relied on similar techniques up and down their system call layer; it had three different virtual machines.