News for hackers. Stuff that matters.
Re:BPF: A New Type of Software by ClumsyPilot on Tuesday December 03, 2019 @08:39AM (#21692114)
This looks very similar to webassembly work going on right now, both use a secure VM, and both run in kernel space.

Would webassembly be a more general purpose way of accomplishing something like this?

Re:BPF: A New Type of Software by sho_hn on Tuesday December 03, 2019 @09:03AM (#21692288)
webassembly "runs in kernel space"?
Re:BPF: A New Type of Software by rhencke on Tuesday December 03, 2019 @09:45AM (#21692628)
Yes, though it's early days yet. See:

https://github.com/wasmerio/kernel-wasm

Re:BPF: A New Type of Software by jacquesm on Tuesday December 03, 2019 @01:30PM (#21695091)
Please no.
Re:BPF: A New Type of Software by lightgreen on Wednesday December 04, 2019 @12:10AM (#21699774)
Care to explain?
Re:BPF: A New Type of Software by jacquesm on Wednesday December 04, 2019 @01:49AM (#21700152)
The tendency to dump all kinds of unrelated stuff in the kernel is a very bad trend. It increases the attacks surface of the kernel in unpredictable ways and will lead to security issues, especially with something as complex as an interpreter.
Re:BPF: A New Type of Software by lightgreen on Wednesday December 04, 2019 @11:02PM (#21709872)
Interpreter is very small part of overall kernel codebase, and it is the same interpreter for all kinds of applications written in wa, need to be analyzed only once, but performance benefits of running code in kernel space are huge. Moreover, wa can even make kernel safer but rewriting certain not very performance critical parts of the kernel in wa.

But I got your point. Thanks!

Re:BPF: A New Type of Software by TickleSteve on Tuesday December 03, 2019 @08:48AM (#21692174)
A BPF interpreter can literally be ~100 LoC. A WebAssembly VM on the other hand will likely be ~1million LoC (without checking).

One is suitable for embedding into a kernel, the other isn't.

Re:BPF: A New Type of Software by sanxiyn on Tuesday December 03, 2019 @08:54AM (#21692221)
Where did you get ~1million number? https://github.com/bytecodealliance/wasm-micro-runtime is less than 100K LoC for example.
Re:BPF: A New Type of Software by 0-_-0 on Tuesday December 03, 2019 @09:08AM (#21692317)
If a micro runtime is 100K LOC then 1M LOC wasn't unrealistic.
Re:BPF: A New Type of Software by sanxiyn on Tuesday December 03, 2019 @09:28AM (#21692479)
About half is tests and sample codes. Runtime proper (core directory) is <50K.

It is also WASI runtime. WebAssembly runtime proper (core/iwasm/runtime directory) is more like 10K.

Re:BPF: A New Type of Software by kbumsik on Tuesday December 03, 2019 @09:20AM (#21692410)
This is a micro runtime that acts as a tiny WASM interpreter. 1M LOC sounds fair when complex runtime features such as JIT or AOT are included.
Re:BPF: A New Type of Software by nicoburns on Tuesday December 03, 2019 @08:56AM (#21692234)
> One is suitable for embedding into a kernel, the other isn't.

I'd be very surprised if the linux kernel doesn't eventually get web assembly support.

Re:BPF: A New Type of Software by manyworlds on Tuesday December 03, 2019 @09:28AM (#21692471)
Doubtful. Webassembly is Turing complete, BPF isn’t. Running untrusted unbounded code in the kernel is not smart. BPF was invented with kernel constraints in mind, webassembly was invented with browser constraints in mind. Completely different use cases
Re:BPF: A New Type of Software by nicoburns on Tuesday December 03, 2019 @10:08AM (#21692852)
> Running untrusted unbounded code in the kernel is not smart.

Well currently we run code (e.g. drivers) as trusted full-permission code. Surely, web-assembly would be better than this from a security perspective.

Re:BPF: A New Type of Software by manyworlds on Tuesday December 03, 2019 @10:19AM (#21692976)
Generally kernel code is also written to specific constraints. Out-of-tree drivers are usually bad at conforming and hypothetical out-of-tree webassembly drivers would be bad for similar reasons. Memory safety isn’t enough, using kernel interfaces safely requires conformance that webassembly can’t statically guarantee like BPF can

Basic examples: code that takes a lock and never releases it, code that loops forever, code that leaks kernel resources.

Re:BPF: A New Type of Software by boomlinde on Tuesday December 03, 2019 @10:29AM (#21693112)
What use case do you envision?
Re:BPF: A New Type of Software by mkup on Tuesday December 03, 2019 @02:47PM (#21695936)
Out-of-tree drivers, support for closed-source drivers in Linux (assuming kernel API for wasm drivers is stable).
Re:BPF: A New Type of Software by boomlinde on Tuesday December 03, 2019 @03:32PM (#21696392)
While I see how out-of-tree drivers using a stable API might be a desirable goal, I don't understand what WASM adds to the table. Maybe some degree of cross-arch portability, but that's already afforded by C and the kernel.
Re:BPF: A New Type of Software by mwcampbell on Tuesday December 03, 2019 @09:03AM (#21692282)
> without checking

Then how can you possibly know? Do you just assume that because it has "Web" in the name, it must be insanely complicated?

Re:BPF: A New Type of Software by ClumsyPilot on Tuesday December 03, 2019 @12:42PM (#21694574)
Thank you, I appreciate the perspective.

Perhaps WebAssembly kernel-space programming would still be viable for major trusted projects, like Kafka, where you literally dedicate the entire machine to that application.

Re:BPF: A New Type of Software by manyworlds on Tuesday December 03, 2019 @06:56PM (#21698242)
Unikernel or rump kernel would be better for that purpose