From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=178.63.66.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796225784; b=GNw0JLyDTXO1ZnlyfR/+A/9NLLf7Chrf8X9HVSE77pwjkyOugQWqNlTz9eHDZ4ry8BtW VpUqiW6x9VMB8/0o0uZsTo39xOIf11WbLxGWSi3/pmcj4vkcqilCx/nFfFuv/9RD6GmdY NDbbtywktuaMysVZ86cfTiRMTKZSvUEsiQ5m2XhhfMHCd4bzbqRTFfNFSBsVwYIAGeRsJ zLK3LlNKHSno4956Va29zLFhOwXiwfx24DLhUQ35Zsla1KBNmxmU2O+LJs7YgtvZRsPya 9PG1Av7jkD3PECBf2hwSs10pwlkUD7V8ZMlLRou9gXck8wv3rGhZYXPiktdGWv10bRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796225784; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=killDRssPL6W2G0zK1muB7Bq1+EY4R49PEwXy9zOQ3s=; b=KSsu4Dx5cxE37QAQS4CxOVFY2tvOb90TqFP0p2pLCZf5HD1LpulMub0mzaL4oWry3Hvg 3UU9njKeN61uH9wgOree8Mg/Iyr2hF+zRJmKLW8G0eVmlXxAizBrgvAcyUweZIC/R97Fb Dfu/xyTmDNIExlX7WyI5FWkArxHMzdnUvZGFs3rjm29Brc//DgP8K6LEPSwq7v4DSS2e9 +3lH/dplU/m9RbJwtBeT9mnRe6ViaZoz1Wm7tZvizKHiUJYwRYFG1DLHwUtwTvYEY1FHC X8jIcV2dmUEXIr5agCdPw+I2/QCUSA2WLsGHkUmeJ2pA72WxrvgFzduG6NDi+0EPuSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=hallyn.com; spf=(null) smtp.mailfrom=hallyn.com; dkim=pass header.d=hallyn.com header.i=@hallyn.com header.a=rsa-sha256 header.s=mail header.b=yksjCR0s; arc=none smtp.remote-ip=178.63.66.53 Received: from mail.hallyn.com (mail.hallyn.com [178.63.66.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69735606A31A; Wed, 2 Dec 2026 15:36:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 69735606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hallyn.com Authentication-Results: smtp.subspace.kernel.org; spf=tempfail smtp.mailfrom=hallyn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=hallyn.com header.i=@hallyn.com header.a=rsa-sha256 header.s=mail header.b=yksjCR0s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hallyn.com; s=mail; t=1796225780; bh=+gaHxyPXtbIAr6huhefg3T61o5oSP9Hotln6SQcef74=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yksjCR0sC7d6HO7tb3oLWdqoOEJ5BTw3N/oexvb5ZXq70voXANUcnIf6WDVRR/jSP eJcMkg1I2XRkRL8YcDC9MJMcYu/kIpbVFvTFn1mpP4aKknkgnbO56ASBKmL1hkOpNv ctTdODXzmj76yIWpGPJbuVckBFNP55vekZCbYQNaHDnAxzOS8yiNNbtBVfBpFxQEsU kJsrjAic5rS+b1zqqtlz/r+IUY2RSE5542r6P62ZUlcoNdEO9HOjKakoCe1+ClWme1 Pl+mHBWPHvXnIzCD5rUQQZUKZTrAaC/EM5H5ZQQVODFPBuYKMk00wVv3StS9KCa/b/ MMYfFrV+VsF5A== Received: by mail.hallyn.com (Postfix, from userid 1001) id 4195C5BC; Wed, 2 Dec 2026 09:36:20 -0600 (CST) Date: Wed, 2 Dec 2026 09:36:20 -0600 From: "Serge E. Hallyn" To: Christian Brauner Cc: Anastasios Papagiannis , linux-security-module@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, paul@paul-moore.com, jmorris@namei.org, viro@zeniv.linux.org.uk, jack@suse.cz, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, matt@bobrowski.net, eddyz87@gmail.com Subject: Re: [RFC PATCH 0/2] security: Add pre-lookup pathname open check Message-ID: References: <20261120094820.11929-1-tasos.papagiannnis@gmail.com> <20261202-funkhaus-bernhardiner-gedreht-d212d37a1254@brauner> X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202-funkhaus-bernhardiner-gedreht-d212d37a1254@brauner> On Wed, Dec 02, 2026 at 03:35:14PM +0100, Christian Brauner wrote: > On Fri, Nov 20, 2026 at 11:48:18AM +0200, Anastasios Papagiannis wrote: > > Some security policies need to inspect the original open pathname, for > > example to report or block suspected path traversal attempts. A resolved > > pathname no longer preserves components such as "..", and requests that > > fail lookup may never reach a hook exposing the resolved target. > > That's really weird. The string doesn't tell you at all what gets > opened. The hook only sees the string userspace passed in. Symlink > bodies, magic links like /proc/self/fd/N and mount crossings all happen > after it ran. > > The raw_symlink test illustrates that. The hook sees "./alias", not > "target". So a ".." filter is bypassed by a symlink whose target > contains "..", and bind mounts make the same file reachable under any > number of names. > > Whatever the policy infers about where the string leads can also change > through a concurrent rename or mount before we walk it. > > If you want to keep a lookup from escaping a directory that's > RESOLVE_BENEATH or RESOLVE_IN_ROOT. They check ".." during the walk on > the actual dentries, fail with -EAGAIN if a rename or mount raced with > it and also cover absolute symlinks and magic links. > > > BPF LSM programs can inspect these arguments and reject requests before > > file creation or truncation. > > You can already do that on the object? security_path_mknod() and > security_inode_create() run before we create the file and > security_file_open() runs before we truncate it. > > This also puts an LSM call into path_init() which every lookup goes > through and grows struct nameidata for all of them and calls the hook up > to 3 times per open: RCU walk, ref-walk, LOOKUP_REVAL. So it also makes > LOOKUP_RCU and the -ECHILD retry part of an LSM interface. That VFS > guts, so no. > > Tetragon already gets the name from its probes and that's fine for > observability. I don't want LSM hooks used as a tracing interface for > names? That seems very misguided. FWIW, I agree here. This seems the wrong place to solve this. -serge