From nobody Tue Sep 10 11:45:57 2024 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X323032y3z5WK1c; Tue, 10 Sep 2024 11:46:04 +0000 (UTC) (envelope-from vadimnuclight@gmail.com) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X32300fVhz4t3M; Tue, 10 Sep 2024 11:46:04 +0000 (UTC) (envelope-from vadimnuclight@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2f75c0b78fbso6881101fa.1; Tue, 10 Sep 2024 04:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725968760; x=1726573560; darn=freebsd.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=WBkYJiNc2Nbz4EKv3F00lPQUtex0LWZeDlyUvZRnzLo=; b=eLmSAbnTTmxkV1BYRPvdL8ihc6tJk78BhA7fTqW43ezwpZsIQF8yfzUR5q57j1m8Hq PmxxvQ9gnR6I520lqhsrN/HSU7toU+Zrkr09eVhW3sckiEanD3a1G8lVWkEUG5LaPLwZ wK1imPmbTOizLqPsE9QlI8S0hIRosQxxfP9YksLVp0VdJxH209h/fTY9ExMaPIfXCBov eS+Gw18luw4/s7PvnFdRiHZgXRz5nBwYLsHkn+cF64Lil9lNdQl6SElKTmEejMRY5Up5 cYANsZPrZ33iOgqJJW5I0E2HFST3rkuuuGbnyovpEq9+T3A4WYJ4YMeBiFqrci9eHXRU CG9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725968760; x=1726573560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WBkYJiNc2Nbz4EKv3F00lPQUtex0LWZeDlyUvZRnzLo=; b=ITJmRrJAdnu++v3tPrkUoF9eSjrR8477wAgf7CZy5FV/U8xju4VpffAXrUBWSGX+yT VzZfc183gY8ZAD95hgLRPkAOQBNymtS65AWbscY4aMakUqu/PS6zZG6fzZ6vuPxDQkeS /n6r2yOM2YXLnXQWAOOTJFcNYBmNMvwkhiJ9+bgg5p0h5apd8VD8greF+3omjn4AHLUP lT4jjbSxeNNiLu1Yiw+NkDiLETRMkCVF29yIyyLA7Z3JdXH/EGLBMtGH24KLqp0RMTfY 21I+iqlRe96t9GeP5HBzb/tILoBZiulOkcHijdSRSlsWNYJ6wP0SEDnclIJZLrceXYpZ Mt2w== X-Forwarded-Encrypted: i=1; AJvYcCXABsXwFqB9228+lHx1x/NRaTNdGIhiAtvPEsG+ym0Qe7PTj6I1BmoO7P5N26nDz3+bC9sqLFi+imd0r48=@freebsd.org, AJvYcCXN/5rVKkRrdRC8xfQ4EvjUmuH9gjlcBFLDaK+BC2oxZ1Xyq8PU1B5rJ+LiV2I/2nMA7y5jLuSxU3oIYoTgpkI=@freebsd.org X-Gm-Message-State: AOJu0YyG7smioDa/4fInc26m+OFrnDfxv8+P0t+VgXwsk5SopzV5x55O zy2qQI/hEhuqgYkObWZ5LKpAV2NILwU3IPybXGSvkDtSoJ69xTFm X-Google-Smtp-Source: AGHT+IGT6G/PcabgIwPjGt4XifTh3HHZgQq37Ig9miee4qJLIrWgIe6f17r20iP9+oq+FYhtHbvv5A== X-Received: by 2002:a05:651c:1a0c:b0:2f7:6653:8046 with SMTP id 38308e7fff4ca-2f766538106mr45293161fa.25.1725968759775; Tue, 10 Sep 2024 04:45:59 -0700 (PDT) Received: from nuclight.lan ([37.204.254.214]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f75c07c539sm11600861fa.88.2024.09.10.04.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 04:45:59 -0700 (PDT) Date: Tue, 10 Sep 2024 14:45:57 +0300 From: Vadim Goncharov To: "Poul-Henning Kamp" , tcpdump-workers@lists.tcpdump.org Cc: freebsd-arch@FreeBSD.org, freebsd-hackers@FreeBSD.org, freebsd-net@FreeBSD.org, tech-net@NetBSD.org, Alexander Nasonov Subject: Re: BPF64: proposal of platform-independent hardware-friendly backwards-compatible eBPF alternative Message-ID: <20240910144557.4d95052a@nuclight.lan> In-Reply-To: <202409100638.48A6cor2090591@critter.freebsd.dk> References: <20240910040544.125245ad@nuclight.lan> <202409100638.48A6cor2090591@critter.freebsd.dk> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; amd64-portbld-freebsd12.4) List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4X32300fVhz4t3M On Tue, 10 Sep 2024 06:38:50 +0000 "Poul-Henning Kamp" wrote: > -------- > Vadim Goncharov writes: > > > I've put a sketch of design to https://github.com/nuclight/bpf64 > > with files: > > Counter proposal: > > 1. Define the Lua execution environment in the kernel. > > 2. Add syscall to submit a precompiled Lua program (as bytecode) Anyone who thinks "any generic bytecode" misses the main point, see below. > 3. Add syscall to execute submitted Lua program > > And yes: I'm being 100% serious. Well, preparing spec/letter in a rush I probably forgot the main reason for BPF (and successors) to exist thinking it's obviuos: safety. Let's restate: *BPF* allows UNTRUSTED user code to be executed SAFELY in kernel. It's easy for your Lua code (or whatever) code to hang kernel by infinite loop. Or crash it by access on arbitrary pointer. That's why original BPF has no backward jumps and memory access, and eBPF's nightmare verifier walks all code paths and check pointers. And that's why DTrace also has it's own VM and bytecode in kernel (see https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-924.pdf Chapter 7) Your "counter proposal" was essentially available for all these decades in form "oh, just write KLD in C instead of that limited tcpdump". > If we are going to reinvent "Channel Programs" 67 years after IBM > came up with them for their 709 vacuum tube computer, at the very > least we should use a sensible language syntax. Don't know what that is, quick googling shows something modern on AMQP. But Lua at least doesn't have *sensible* syntax, Perl or Tcl much better. And I'm surprised why Fort, being available in loader, wasn't ported for all these years. -- WBR, @nuclight