From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A004363084 for ; Fri, 31 Jul 2026 21:15:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785532524; cv=none; b=mhvp0/SZ7SlBiKIhDTOucKezPosM51IAc5AHs81VOicYrCHVQzEGx4+RS1QEZ5zIk0dO443CEc4JlqMLzxeb+55i1oVZ8PrULFnms6HZd5+BTqDPoKR5sDkI0mgMZEkR3q0WvMOpolurY3ThNvEeY97GBR9AHp2rvHH9hl9B/To= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785532524; c=relaxed/simple; bh=tfway8HYZ5WCOmU94tVvG9Ex6N9dUtJeCUSDptLPmwA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=agExVqbssHMTBHw05jhk0Ue30CfbtpAeKZQbFJ+TNbtiq9sTXjPIxJFcel2nhgcrHNB3lh6iSDYxN6ip6j1UcnF1TPTmJDoI9Tw76SDLKYrhq2UYqvyJctOFK5v2arzNFmt83QD6HDWOSYhKuM0CZEW8yasxC0mzsZhGFZ6Jyc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LgX2YXeT; arc=none smtp.client-ip=209.85.128.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LgX2YXeT" Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-81ed073fed0so21358767b3.0 for ; Fri, 31 Jul 2026 14:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785532522; x=1786137322; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=elDw9oiQreFLpRRXW9sbDNq6XC8CGaBRYJ4NHBLdM0s=; b=LgX2YXeTw5Np7xRY2LuuBLMaG5+btS6Wj/e3o7RsGxtcO/C/84tSS+Cra2yF7JWRev fQJd4jarbWUo+tETAl67lWTWYo2eRJ+sMN1j5TVGRw3/luGgYJthTk8hw/xt5+6aYw4N XrlI9zZYiQFM1KEO0Jsv0vWl3k//9ITqkDUDdIRaeLMIcHz9qB8UxwRwBe+bfWva3PBt at5G/mfTVlwnPw89f3lCe1Kl259Ob1atBWsQSZ3Q78aQjyNrRdd6mUTGUN4GMwB5eFkk Bt0mg12Yly/5fo/gZbMqJpIbphCELiZ9oje/dATKfjFCUWyMK1sm+/QgTgDtqJnqJWrx HorA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785532522; x=1786137322; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=elDw9oiQreFLpRRXW9sbDNq6XC8CGaBRYJ4NHBLdM0s=; b=d3optHZFIPIgps+ehaTWe6k9Kvo0jd1avf/ekSVl1ePKpV3uytkcAHzURrsafqZ3jJ x62lehRbMcB/ImSLAP7fTpuH/1fD+3zAR5Xx6Ypq7UVbOIAZEsKjk+mce0Vh4xDYJ2z3 10/2R+7n5s5gnZOrKC4Dv6F3up5tLAQ0JTOcaZr/D3eHow5ddG/nE+eK8DulX9tlp0FE MdS4mBG3b3GH616wN2zO0dlrt5HYGWgtzFMY0tNHlHi4OgA346laRPCW4Qm41+zmKBRH 9fxW3UU3sff2LFDpZjSY5chgz7tPkBzZ+q/UI42YmmfV7gco504IIDbzGLWjbr/vcufW gx0g== X-Forwarded-Encrypted: i=1; AHgh+Rqt6oJYv/tODp98iDVD37P5NV9WQ+lkoUM1pwz4/WRcvugItCig33Fl4m2cRAuX6Q2ZKC5y3WCUsqpMhg4=@vger.kernel.org X-Gm-Message-State: AOJu0YxA1D+08VpiGoJKizwR82CWE2zZRAE5w/pDunxCOFoG5qvwComp Hipwx6hKkJdpvMD1TrrGjmAUDv1RgJROzZUSwEH0gq2U4ez/OQtug7c5 X-Gm-Gg: AR+sD12YS58Qu3MDQXFGcZXguQSqcDqjs0tbTtP+N/1I1jEx6fgTcS/ImqzAf9Q/FGu Uku9HKti1jZyi+kp4wkaiJ2u2w3Z2qvlpeXkHQMllBCdOPEVZ88oCiGEC0I/9BpGFA13Oh4zcX7 oD7gJ/A3c7WvvRXDQxbwS5STJHdx5eUQZuGDCLNH82ULsArSgkyZCatcBiBVyxiy1OUAVBHJBBH wYTOQ+H80+T3dXYtZotA/ZHm4Sijoe6TpW3ep7Ol/MzONzRK6XIpGjtxjdoWVD2FwQJAFlv/Spf HSsjAWSuaURoGlWmWk4Jwl4pMW2A1JgMOqedCXHNMR49N34PgmrqCioucBLzPUwfuJ8Q3IF8rJQ oKsrf0dIx9vhott0353fbnXOl9GVNPZDaPENjcb/D0k+LiaxOjcPJ4gdzA4lTdeA1loYbhP9DTf fktcoOFb+SEaVLmbSvNuer790nuFqqosLx3aZ2pIEYkK/RjzRb4CJCRZTXJheXuQ2mJmOZWkRF/ oMIXl4arIzs61aMqYbrcmBjUfGMXcEMN2AbzGxLjfcR X-Received: by 2002:a05:690c:604:b0:7fd:4ef9:e5a4 with SMTP id 00721157ae682-81fd4bd6688mr20512397b3.29.1785532521535; Fri, 31 Jul 2026 14:15:21 -0700 (PDT) Received: from zenbox ([2600:1700:18fb:6011:d52:64e9:32ac:b832]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81fcd124e8bsm15083237b3.41.2026.07.31.14.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 14:15:21 -0700 (PDT) Date: Fri, 31 Jul 2026 17:15:20 -0400 From: Justin Suess To: Paul Moore Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, mic@digikod.net, viro@zeniv.linux.org.uk, brauner@kernel.org, kees@kernel.org, gnoack@google.com, jack@suse.cz, song@kernel.org, yonghong.song@linux.dev, martin.lau@linux.dev, m@maowtm.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next 00/13] BPF interface for applying Landlock rulesets Message-ID: References: <20260731022047.189137-1-utilityemal77@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Jul 31, 2026 at 04:30:39PM -0400, Paul Moore wrote: > On Thu, Jul 30, 2026 at 10:21 PM Justin Suess wrote: > > > > Howdy, > > > > This series lets BPF programs apply an existing, userspace-created > > Landlock ruleset to a program during exec. The goal is unchanged from > > the RFC [1]: BPF does not create, inspect, or mutate Landlock policy, > > it only decides whether a ruleset that was already created and > > validated through Landlock's existing userspace API should be applied, > > based on runtime exec context. > > > > Motivation > > --- > > Deploying Landlock today requires the sandboxed program's > > cooperation. A process can only restrict itself, so applying a > > policy system-wide means wrapping every launch path with a helper > > that calls landlock_restrict_self(2) before exec, and anything > > spawned outside those wrappers runs unconfined. Supervising exec > > from userspace instead (ptrace, seccomp user notifications) is racy > > and slow. Meanwhile, the tools that do enforce system-wide policy > > with BPF LSM programs today (container security agents such as > > KubeArmor and Tetragon) end up reimplementing path-based access > > control in BPF, fraught with horrors of path reconstruction, bind > > mounts, rename races, and worse, which is exactly the problem Landlock > > already solves in the kernel, with maintained and versioned semantics. > > > > This series composes BPF and Landlock along their natural grain. The > > intended deployment: a supervisor creates one ruleset per policy > > class through the existing syscalls, a syscall BPF program parks > > them in map kptr fields, and an LSM BPF program picks which (if > > any) to apply to an execution based on its runtime context. The > > policy semantics stay Landlock's; BPF contributes only the > > programmable decision of when and to whom. Deciding inside the > > exec path closes the race a userspace supervisor cannot: the > > policy is in place before the first instruction of the new program > > runs. > > Discretionary models are fun, and useful in certain situations, but > they do have their limitations ;) To be fair, mandatory models have > their limitations too :) > This series does kind of blur the lines between DAC and MAC a little... interesting thought. > I've only just barely skimmed some of the patches in this patchset, > and I didn't have a chance to fully read your reply in the previous > revision yet, so I wanted to get you a quick response here ... as > incomplete as it may be. > > As you may, or may not have seen, there is currently an ongoing debate > regarding the location of LSM kfuncs that will impact this patchset. > Sadly, we don't appear to be approaching an agreement on this issue > which introduces some additional risk to this patchset. We'll have to > see how that ends up, but I just wanted you to be aware of the > situation. > I'll hold off on further iterations until that's resolved. Moving these kfuncs anywhere fortunately amounts to a trivial cut/paste on end anyway. > I need to look closer at both the LSM hooks and the BPF kfuncs before > I can really definitively comment on them. It looks like there has > been some progress towards an LSM agnostic interface, but I'm > concerned more work might be needed. However, as I said earlier, a > closer examination is needed and perhaps that will reveal something > different. > > It's also worth mentioning that this functionality looks an awful lot > like a call to lsm_set_self_attr(LSM_ATTR_EXEC, > , size, 0) with a lsm_ctx::ctx set to a > policy fd. Once again, perhaps a closer inspection will reveal that > it is nothing like that, but it kept popping into my head while > reading things so I wanted to mention it, especially as it a lot of > the framework infrastructure already exists. They were the direct inspiration for the hooks (and set/getprocattr). Main difference being the object in the hook is a trusted kernel pointer rather than a lsm_ctx blob or fd. We can't use an fd here since the sandboxed task and supervisor don't share an fd table. I'll wait for your full review, no rush. Justin > > -- > paul-moore.com