Live data from Hacker News

eBPF Verification Is Untenable

twitter.com

71–80 of 116 posts

Re: eBPF Verification Is Untenable

#71
post #5

I'm not happy about the entire concept of running user code in the kernel. As a special-purpose hack for servers that do very little else, maybe. As a standard OS feature, it seems to create too big an attack surface. One which has been exploited.[1] [1] https://www.theregister.com/2022/02/23/chinese_nsa_linux/

Your example doesn’t really document an exploit but use of it as a tool in an attack. It’s just an interface they chose to use, not something they broke.

Re: eBPF Verification Is Untenable

#72
post #19

Earlier quoted context omitted.

For the most part, the kernel doesn't provide generic string processing helpers. Most helpers are there to form the basis for specific eBPF integration points (the majority are packet and socket handling tools). https://man7.org/linux/man-pages/man7/bpf-helpers.7.html

The kernel provides quite a few string processing helpers; I'm not sure why they're not documented. Perhaps the purpose of the document is to highlight bpf specific functionality rather than underlying runtime helpers? You can see them listed here: https://elixir.bootlin.com/linux/latest/source/kernel/bpf/he... And my point in highlighting them in this discussion was to get one to consider how of trap outs to the ker…

This a link to string->integer conversion and comparison, and nothing else.

Re: eBPF Verification Is Untenable

#73
post #45

Earlier quoted context omitted.

Unprivileged BPF is used for socket filters, for programs to BPF-extend themselves. It wasn't ever the case that unprivileged eBPF would allow you to, say, load a TC filter and read everybody's traffic.

Ok but you can like put a tracepoint on read/write and peek at what’s going through those, no?

I have no idea, because every system I've ever worked on has disabled unprivileged eBPF.

Re: eBPF Verification Is Untenable

#74
post #50
post #47

Earlier quoted context omitted.

> eBPF code gets to read and, with many limits, write kernel memory Import kernel read/write functions into the Wasm module, so they can be policed. Or, if performance needs be, map limited portions of the kernel memory into the Wasm extensions linear memory. > programs terminate, Several Wasm runtimes count Wasm instructions (e.g. by internal bytecode rewriting) and dynamically enforce execution times. If static enf…

The BPF verifier doesn't simply count instructions (though there is a maximum instruction count as a failsafe). It can't: eBPF programs are JIT'd down to machine code --- that's part of what makes eBPF so attractive, because the code you're running is comparably fast to the "native" kernel code. Instead, it refuses to admit programs that can't be proven to constrain their loops.

I don't think jitting necessarily precludes counting runtime instructions. You could always jit in an internal variable that gets incremented for each high level instruction being translated. And of course you can optimize the increments within each basic block. There's even a cool minimum spanning tree algorithm due to Larus and Ball originally for path profiling that might be adaptable to reduce increments across the blocks.

I know this is a bit of an aside. The point still stands about the user not wanting their bpf program to terminate at runtime investment.

Re: eBPF Verification Is Untenable

#75
post #72

Earlier quoted context omitted.

The kernel provides quite a few string processing helpers; I'm not sure why they're not documented. Perhaps the purpose of the document is to highlight bpf specific functionality rather than underlying runtime helpers? You can see them listed here: https://elixir.bootlin.com/linux/latest/source/kernel/bpf/he... And my point in highlighting them in this discussion was to get one to consider how of trap outs to the ker…

This a link to string->integer conversion and comparison, and nothing else.

So "generic string processing helpers" provided by the kernel?

Re: eBPF Verification Is Untenable

#76
post #72

Earlier quoted context omitted.

The kernel provides quite a few string processing helpers; I'm not sure why they're not documented. Perhaps the purpose of the document is to highlight bpf specific functionality rather than underlying runtime helpers? You can see them listed here: https://elixir.bootlin.com/linux/latest/source/kernel/bpf/he... And my point in highlighting them in this discussion was to get one to consider how of trap outs to the ker…

This a link to string->integer conversion and comparison, and nothing else.

that's what GP said.

They are semantically simple string operations whose computational complexity scales with string length. Near unbound string lengths would exhaust the time (somewhat aproximated by instruction) budget of eBPF applications doing even a single one.

Re: eBPF Verification Is Untenable

#78
When I read the title I thought this was maybe about eBPF verification and the difficulty of creating eBPF programs that actually pass the verifier. What's the HN take on this?

Re: eBPF Verification Is Untenable

#79
post #76
post #72

Earlier quoted context omitted.

This a link to string->integer conversion and comparison, and nothing else.

that's what GP said. They are semantically simple string operations whose computational complexity scales with string length. Near unbound string lengths would exhaust the time (somewhat aproximated by instruction) budget of eBPF applications doing even a single one.

That's all that's there. String-integer conversion and comparison.
Post reply on HN