31 ms·
Rex is a safe kernel extension framework that allows Rust in the place of eBPF
- vlovich123 10mo agoAs a lover of Rust, ooo boy does this sound like a bad idea. The Rust compiler is not guaranteed to always output safe code against malicious inputs given that there’s numerous known soundness bugs that allow exploiting this. Unless I’m missing something this is a security nightmare of an idea. Also there’s reasons why eBPF programs aren’t allowed to run arbitrarily long and this just ignores that problem too.
- benatkin 10mo agoIn this comment someone tries to justify its design, citing a lwn article: https://github.com/rex-rs/rex/issues/2#issuecomment-2696533992 https://github.com/rex-rs/rex/issues/2#issuecomment-26965339...
- NewJazz 10mo agoThat's one aspect of the design. Again, complexity requirements are there for a reason. No explanation seen for why this eschews them.
- deleted 10mo ago[deleted]
- _flux 10mo agoI think this is a fair take: > We currently do not support unprivileged use case (same as BPF). Basically, Rex extensions are expected to be loaded by privileged context only. As I understand it, in privileged context would be one where one is also be able to load new kernel modules, that also don't have any limitations, although I suppose the system could be configured otherwise as well for some reasons. So this is like a more convenient way to inject kernel code at runtime than kernel modules or eBPF modules are, with some associated downsides (such as being less safe than eBPF; the question about non-termination seems apt at the end of the thread). It doesn't seem like they are targeting to actually put this into mainstream kernel, and I doubt it could really happen anyway..
- NewJazz 10mo agoYeah I agree with this assessment. It is not an eBPF replacement for many reasons. But could be a slightly safer alternative to kernel modules.
- pjmlp 10mo agoFully agree. If it has to be native code, it should live on user space, at very least.
- vlovich123 10mo agoOr at the very least it should be framed as a way to load kernel modules written in Rust. I just don’t understand the framing that this is an alternative to eBPF programs.
- aliceryhl 10mo agoI asked about this when they presented the project at the Linux Plumbers conference. They replied that it's not really intended to be a security boundary, and that you should not let anyone malicious load these programs. Given this thread model, I think their project is entirely reasonable. Safe Rust will prevent accidental mistakes even if you could technically circumvent it if you really try.
- IshKebab 10mo agoAs I understand it eBPF has also given up on that due to Spectre. As a result you need root to use it on most distros anyway, and the kernel devs aren't going to expand its use (some systems are stuck on cBPF). So it's not like eBPF is secure and this isn't. They're both insecure in different ways.
- westurner 10mo agoSo eBPF for a WAF isn't worth it? re: eBPF and WAFs: https://news.ycombinator.com/item?id=45951011 https://news.ycombinator.com/item?id=45951011 From https://news.ycombinator.com/context?id=43564972 https://news.ycombinator.com/context?id=43564972 : > Should a microkernel implement eBPF and WASM, or, for the same reasons that justify a microkernel should eBPF and most other things be confined or relegated or segregated in userspace; in terms of microkernel goals like separation of concerns and least privilege and then performance? "Isolated Execution Environment for eBPF" (2025-04) https://news.ycombinator.com/item?id=43697214 https://news.ycombinator.com/item?id=43697214 "ePass: Verifier-Cooperative Runtime Enforcement for eBPF" (2025-12) https://ebpf.foundation/epass-verifier-cooperative-runtime-enforcement-for-ebpf/ https://ebpf.foundation/epass-verifier-cooperative-runtime-e... .. https://news.ycombinator.com/item?id=46412121 https://news.ycombinator.com/item?id=46412121
- tptacek 10mo agoeBPF's limitations are as much about reliability as security. The bounded loop restriction, for instance, prevents eBPF programs from locking up your machine.
- 10mo ago
- nickpsecurity 10mo agoI considering it now. Aside from correctness verification, the main reason we'd use a limited language for packet inspection is in case the policy is malicious. How often is that the case? For most people, they trust most or all of the code running on their machine. They certainly trust their firewall policy to not be malware. If you already trust it, using a better, safe language might be helpful. In many cases, eBPF will be fine. This isn't the first time this has been done. SPIN was an operating system in Modula-3 that allowed type-safe linking of code into the kernel, balancing safety and performance.
- dietr1ch 10mo agoCan't my eBPF sched starve my monitoring processes, or my eBPF firewall rules prevent me from getting security updates? If Eve gets to load bad eBPFs programs in your computer then I doubt counter-measures in how they run can save you.
- ronsor 10mo agoEvil eBPF programs can hide their presence from the bpf syscall as well.
- ignoramous 10mo agoInteresting. Any good read you'd recommend on the topic/attack? Thanks.
- ronsor 10mo agoLook up "eBPF rootkits" This is a good article about one found in the wild: https://www.synacktiv.com/en/publications/linkpro-ebpf-rootkit-analysis https://www.synacktiv.com/en/publications/linkpro-ebpf-rootk...
- bawolff 10mo ago> This approach avoids the overly restricted verification requirements (e.g., program complexity constraints) Maybe i'm missing something, but isn't that a bad thing?
- pjmlp 10mo agoYes, very bad, even worse when coming from supposedly security conscious programming language community.
- NewJazz 10mo agoThey're not in the core language group... Do these people have influence in the stdlib, compiler, prominent libraries? Kernel community? Why judge the whole Rust community for the choices made by one minor subgroup?
- testdelacc1 10mo agoIt’s a common HN trope to generalise a “community” based on a handful of people or even just one person. “See this is why I dislike the xyz community”, says a person justifying their confirmation bias. Perhaps the world is too complex without breaking it down into in-groups and out-groups, with any out-groups supposedly being completely homogenous. Pretty intellectually lazy but fairly common on HN, to the point where it’s not even worth calling out.
- johnisgood 10mo agoI mean, I was going to reply "take a wild guess" to him, but your message is correct, too. (I may come across as an Ada zealot myself.)
- nickpsecurity 10mo agoQuick, random question. I heard way back that SPARK was getting safe pointers in response to Rust's borrow checker. Has full Ada solved their unsafe de-allocation problem in a way that's comparable to the borrow checker's guarantees?
- dracarys18 10mo agoWe need a way to run HolyC in the kernel
- logicchains 10mo agoYou can run HolyC in the kernel. Just not the Linux kernel.
- wakawaka28 10mo ago[flagged]
- deleted 10mo ago[deleted]
- snvzz 10mo agoThe parasite will eventually kill its host.
- dathinab 10mo agoplease don't (replace your typical eBPF filter with it, but do replace you custom kernel modules with it where viable ;) ) rust type system is not a security mechanism it's a mechanism to avoid bugs which can become security issues not a way to enforce well behavior on a kernel boundary as an example the current rust compiler has some bugs where it accepts unsound programs which are not seen as supper high priority as you most most likely won't run into them by accident. If rust where a verification system enforcing security at a kernel boundary this would be sever CVEs... also eBPF verification checks more properties, e.g. that a program will deterministically terminate and can't take too long to do so, which is very important for the kind of thing eBPF is(1). and eBPF programs are also not supposed to do anything overly complex or difficult to compute but instead should only do "simple" checks and accounting and potentially delegate some parts to user space helper program. So all the nice benefits rust has aren't really that useful. In the end there is a huge gap between the kind of "perfect verification" you need for something like eBPF and "type checking to avoid nasty bugs". One defends against mistakes the other against malicious code. To be fair if your use case doesn't fit into eBPF at all and you choice is rex-rs or a full kernel driver rex-rs is seems a far better choice then a full custom rust driver in a lot of way. IMHO it would be grate if rust verification could become at some point so good that it can protect reliably against malicious code and have extensions for enforcing code with guaranteed termination/max execution budged. But rust isn't anywhere close to it, and it's also not a core goal rust development focused on. (1): In case anyone is wondering how that works given that the halting problem is undecidable: The halting problem applies to any arbitrary program. But there are subsets of programs which can be proven to halt (or not halt). E.g. `return 0` is trivially proven to halt and `while True: pass` trivially to not halt (but `while(1){}` is UB in C++ and henceforth might be compiled to a program which halts, it's still an endless loop in C)
- mirashii 10mo ago> which is very important for the kind of thing eBPF is(1) The question is, going into 2026, what kind of thing is eBPF? It seems like all hope of it being a security boundary has been thwarted by micro-architectural vulnerabilities to the extent that you can no longer load eBPF programs as non-root. So, is it a security boundary? That's an honest question that I've not been able to find an answer to in the kernel documentation or recent mailing list posts. If it's not a security boundary, what is it? There's a few other nice properties enforced by the validator, like protos for a subset of kernel functions, which provides some load-time validation that you've built against a compatible kernel. That's something that's lost here, so we don't get the same compile once, run everywhere properties eBPF has. One might argue this is a big loss, but in the branch that eBPF is not a security subsystem, it's worth asking whether these are strictly necessary checks that need to be enforced, or whether they're niceties that bring a higher hope of stability and reduce the burden of code review that are perfectly fine to bypass given those caveats.
- calmingsolitude 10mo agoThis is a pretty cool project and I think the comments here are being overly negative. Sure, removing the constraints that the eBPF verifier requires might encourage more complex and less performant code - but this is just another tool in the toolbox. For truly production systems, I can see the battle-tested eBPF being the top choice over a dubious kernel extension. But for quick prototyping? Rex can probably take the cake here once the project matures a bit more.
- otabdeveloper4 10mo agoSorry dude, I don't want you guys vibecoding my kernel modules while spouting cargocult platitudes that "it can't have bugs, it's written in Rust".
- vlovich123 10mo agoIt’s not about battle testing but that eBPF is has specific restrictions that a) won’t lock up your kernel b) won’t cause a security exploit by being loaded. Now Spectre throws a wrench in things, but the framing is weird; why compare it to eBPF vs just making a mechanism to load kernel modules written in Rust.
- mirashii 10mo ago> why compare it to eBPF vs just making a mechanism to load kernel modules written in Rust. Because it's not just a mechanism to load kernel modules in Rust, it's specifically a mechanism to load them in the same places that ebpf programs are loadable, using the existing kernel machinery for executing ebpf programs, and with some helpers to interface with existing epbf programs.
- vlovich123 10mo agoeBPF still guarantees that a loaded program won’t crash or hang the kernel. Rex does let you hang the kernel.
- amelius 10mo agoFor the sake of safety, can't we simply have a back-end that emits eBPF?
- vitus 10mo agoWe do; most people don't just write eBPF by hand. https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target/BPF https://github.com/llvm/llvm-project/tree/main/llvm/lib/Targ...
- larodi 10mo agoREX is a BBS language back from the 90s ::))
- edwardtay 10mo ago[flagged]