News for hackers. Stuff that matters.
Re:GCC eBPF for Linux port has landed by monocasa on Monday September 09, 2019 @12:41PM (#20919752)
You can, it just won't be validated as the CFG read by the kernel has to be a DAG. But the compiler has no problems emitting code with arbitrary loops. cBPF is different; branch offsets are unsigned there.

I'm working on an exokernel built around a eBPF VM that'll let you use loops in certain circumstances (ie. more or less regular threads that happen to be in kernel space and are preemptible).

Re:GCC eBPF for Linux port has landed by justicezyx on Monday September 09, 2019 @04:09PM (#20921913)
> You can, it just won't be validated as the CFG read by the kernel has to be a DAG.

Are you saying the kernel bpf verifier can be disabled when loading a probe? AFAIK, there is no such option.

TBH, I cannot understand this statement. I've written a few thousands of lines of BCC C code as eBPF. Never encounter any reference to actually have loops in the code.

Re:GCC eBPF for Linux port has landed by comex on Monday September 09, 2019 @05:23PM (#20922613)
No, but you can write your own eBPF VM that doesn’t have the same restrictions.
Re:GCC eBPF for Linux port has landed by justicezyx on Monday September 09, 2019 @06:09PM (#20923022)
Do you have a link to the document?

I never heard of that one can write a new eBPF VM.

Re:GCC eBPF for Linux port has landed by monocasa on Monday September 09, 2019 @06:12PM (#20923046)
What do you mean? The source is all open, and the bytecode format is well documented. There's nothing stopping anyone from writing their own with different semantics.

There's no doc on my work as it's private jerk offy personal project that I work on when I get tired of jira tasks and process.

Edit: here's an example of one someone did in rust https://github.com/qmonnet/rbpf

Re:GCC eBPF for Linux port has landed by justicezyx on Monday September 09, 2019 @06:45PM (#20923316)
I was saying a eBPF vm running inside the kernel.

A userspace VM that do not have the same capability as the kernel one is not useful when tracing kernel internals.

Re:GCC eBPF for Linux port has landed by monocasa on Monday September 09, 2019 @07:02PM (#20923453)
You can patch your kernel, or write your own vm. BPF is ultimately just a kernel module under Linux. My vm runs in kernel space just fine as well (but is built on something that looks more like sel4 rather than Linux on the inside).

If you provided enough of std, or ported that VM to no_std that rust vm would work just fine in the kernel too.

Re:GCC eBPF for Linux port has landed by justicezyx on Monday September 09, 2019 @07:26PM (#20923622)
This is an interesting option.

Although in our case, our eBPF runs in external customer's environment, and we cannot ask them to patch their kernels with our code.

Re:GCC eBPF for Linux port has landed by monocasa on Monday September 09, 2019 @08:08PM (#20923891)
I feel like we're talking on two different levels here.

It's sort of like how Oak was this neat virtual machine for running on a early 90s PDA prototype. Then the writers of that VM realized that they had written a really general purpose VM, cleaned it up and released the first Java.

This general of a VM (talking about eBPF now) hasn't been a first class citizen of a mainstream kernel before. The devs are taking a very cautious approach (as they should), but ultimately eBPF is way bigger than a tracing tool. I wouldn't be surprised to see nearly everything you currently do with a kernel module ultimately being allowed by eBPF too. Maybe more like emulating other OS's kernels as easily as you'd start another container.

Re:GCC eBPF for Linux port has landed by justicezyx on Monday September 09, 2019 @10:10PM (#20924518)
Also different time scale.

I am on existing stuff can be readily used. You are probably estimating the future, I guess?