Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Oct 2024 21:26:57 -0400
From:      "Kevin P. Neal" <kpn@neutralgood.org>
To:        "Gavin D. Howard" <gavin@gavinhoward.com>
Cc:        freebsd-arch@freebsd.org, freebsd-hackers@freebsd.org, freebsd-net@freebsd.org, tcpdump-workers@lists.tcpdump.org, tech-net@netbsd.org, Alexander Nasonov <alnsn@netbsd.org>
Subject:   Re:  BPF64: proposal of platform-independent hardware-friendly backwards-compatible eBPF alternative
Message-ID:  <ZwxzYa3ngC3oeZsZ@neutralgood.org>
In-Reply-To: <wLzD36W8VSXSlBByVmK745ezszNVGM-hfWOobdrCb1vmx9snihwW_gBgeAlvtKWL55fnAZgr9G5ztIO3UjD3Wou3-YPxmLkMp9AFuGHwXsA=@gavinhoward.com>
References:  <20240910040544.125245ad@nuclight.lan> <wLzD36W8VSXSlBByVmK745ezszNVGM-hfWOobdrCb1vmx9snihwW_gBgeAlvtKWL55fnAZgr9G5ztIO3UjD3Wou3-YPxmLkMp9AFuGHwXsA=@gavinhoward.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 10, 2024 at 02:41:20PM +0000, Gavin D. Howard wrote:
> But the good thing about this is that FreeBSD could use LLVM IR as the
> BPF64 language, which means any language that compiles to LLVM is a
> possible target.

Please don't do this.

The LLVM IR language is a moving target. IR that works in one version is
not guaranteed to work in prior versions. There is an upgrade step where
it tries to read in older IR, but writing out older IR is a problem. It
can be solved, I think the DirectX LLVM backend ("DXIL") does this, but I
still suggest you not do this.
 
> As for restricting access, I think it would be possible to check the
> instructions in LLVM IR for any unsafe instructions or calls to
> restricted functions.
> 
> The downsides:
> 
> * Someone would need to write an LLVM analyze pass or whatever they're
>   called. Maybe more than one.

Close. "Analysis pass".

> * The kernel would need the ability to compile LLVM IR, making LLVM part
>   of the Ring 0 domain.
> 	* Either that, or someone builds an LLVM-to-bytecode translator.
> 	* But the analysis pass(es) must still live in the kernel.

LLVM is huge. Really huge. A codebase that large has no business being in
the kernel.
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/
"14. Re-reading No. 13, I realize that it's quite possible I'm losing my
mind. I'm glad that for the most part I'm not aware it's happening."
  -- from "20 things I'm thankful for": Fortune, Nov 29, 2004, page 230



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZwxzYa3ngC3oeZsZ>