From nobody Thu Sep 12 06:29:38 2024 X-Original-To: freebsd-hackers@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 4X46x95FlDz5TyKw for ; Thu, 12 Sep 2024 06:29:49 +0000 (UTC) (envelope-from gavin@gavinhoward.com) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X46x73pnWz4Lm6 for ; Thu, 12 Sep 2024 06:29:47 +0000 (UTC) (envelope-from gavin@gavinhoward.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gavinhoward.com header.s=protonmail3 header.b=Hy0rupHV; dmarc=pass (policy=quarantine) header.from=gavinhoward.com; spf=pass (mx1.freebsd.org: domain of gavin@gavinhoward.com designates 185.70.43.17 as permitted sender) smtp.mailfrom=gavin@gavinhoward.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gavinhoward.com; s=protonmail3; t=1726122582; x=1726381782; bh=QAmKSSQaggjol4eYGFjGxy/LBpMgE7fM0GWTXEcHwJE=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Hy0rupHVYBcIvYUlU9w7JRe70p39vmqfmyOAzxFVuFh2HyxGktF8IwUPPbf9nCWSa q27aemlnCM4pRXWTJjYQu3J0CPoECBKn0Pg5WRPV4RAEBsxCxXtI/l+rbjGw2ctr8z EesxeQKqyciCezU8TaRS7d2VrFL3U/eRA1jnefC4s747lZsux9ii65qpZ/nAdILen4 XNODJrRrtuQHfU0eZgf3zAl75O1XOrSFQ8BDExuyjkr1dkZq4zBn5X73YsD89lnCfN 6Nsm38lCmvq5PRF3S1pXnC4tV+YUxQjxrFn4zfFdpj5tjuwV76EAEToUwEc3My/L7k UHRFoXp+wpmXQ== Date: Thu, 12 Sep 2024 06:29:38 +0000 To: "freebsd-hackers@FreeBSD.org" From: "Gavin D. Howard" Subject: Re: BPF64: proposal of platform-independent hardware-friendly backwards-compatible eBPF alternative Message-ID: In-Reply-To: <20240910181711.5d324ac5@nuclight.lan> References: <20240910040544.125245ad@nuclight.lan> <20240910181711.5d324ac5@nuclight.lan> Feedback-ID: 18790518:user:proton X-Pm-Message-ID: 8d0760b21a122fadbb2d01b393e1cdf20d5127c6 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.20 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gavinhoward.com,quarantine]; R_SPF_ALLOW(-0.20)[+ip4:185.70.43.0/24]; R_DKIM_ALLOW(-0.20)[gavinhoward.com:s=protonmail3]; RWL_MAILSPIKE_VERYGOOD(-0.20)[185.70.43.17:from]; MIME_GOOD(-0.10)[text/plain]; FREEFALL_USER(0.00)[gavin]; ASN(0.00)[asn:62371, ipnet:185.70.43.0/24, country:CH]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_EQ_ADDR_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@FreeBSD.org]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[gavinhoward.com:+] X-Rspamd-Queue-Id: 4X46x73pnWz4Lm6 > > If I understand Turing-completeness correctly, the "no backward jumps > > but allow recursion and quit on stack overflow" is exactly equivalent > > to having non-infinite loops. > > Sure, but then look at practical usefulness: suppose you have stack of > 32 frames (current limit of eBPF and BPF64). Then you can have only 31 > iterations on a loop, loosing ability to call more functions from loop > body. That is true. However, I wonder if everyone is going at this the wrong way. More specifically, I wonder if we are targeting the entirely wrong level. Maybe verifying bytecode or some other low-level code form is just too hard. What if it were easier just to provide a higher level language that had enough restrictions to be just barely not Turing-complete. To test that idea, I did a quick experiment. I have been working on a language called Yao for the past three years. One feature I planned for the future was the ability to restrict what packages and keywords are available at compile time. I had already put in the plumbing, but I just hadn't implemented it. But I decided to quickly implement it as an experiment. First, I needed a stack limit: https://git.yzena.com/Yzena/Yc/commit/99c822bf7b Now, you can run this: ``` $ ./release/yc yao --max-stack-depth=3D32