From: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
To: linux-security-module@vger.kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, paul@paul-moore.com,
jmorris@namei.org, serge@hallyn.com, brauner@kernel.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,
tasos.papagiannnis@gmail.com
Subject: [RFC PATCH 0/2] security: Add pre-lookup pathname open check
Date: Fri, 20 Nov 2026 11:48:18 +0200 [thread overview]
Message-ID: <20261120094820.11929-1-tasos.papagiannnis@gmail.com> (raw)
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.
Today, in Tetragon[1] we capture kernel-copied names through
getname/getname_flags probes and correlates them with open
results. Enforcement additionally probes do_open and passes decisions
through BPF maps to the file_open LSM hook. This requires correlating
state across several internal probes and the enforcement hook.
This series proposes security_file_open_name(), an LSM hook exposing
the kernel-copied pathname, the VFS-selected starting path, effective
open flags, creation mode and lookup flags before pathname traversal.
BPF LSM programs can inspect these arguments and reject requests before
file creation or truncation. Existing checks on the resolved object
continue to apply.
This is submitted as an RFC in order to get feedback on whether the
proposed LSM hook is a reasonable addition.
[1] https://github.com/cilium/tetragon
Anastasios Papagiannis (2):
security: Add hook for unresolved pathname opens
selftests/bpf: Test pathname open enforcement
fs/namei.c | 15 ++-
include/linux/lsm_hook_defs.h | 2 +
include/linux/security.h | 10 ++
security/security.c | 27 +++++
.../selftests/bpf/prog_tests/file_open_name.c | 103 ++++++++++++++++++
.../selftests/bpf/progs/file_open_name.c | 56 ++++++++++
6 files changed, 211 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/file_open_name.c
create mode 100644 tools/testing/selftests/bpf/progs/file_open_name.c
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0
next reply other threads:[~2026-11-20 9:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 9:48 Anastasios Papagiannis [this message]
2026-11-20 9:48 ` [RFC PATCH 1/2] security: Add hook for unresolved pathname opens Anastasios Papagiannis
2026-11-20 10:44 ` bot+bpf-ci
2026-11-20 9:48 ` [RFC PATCH 2/2] selftests/bpf: Test pathname open enforcement Anastasios Papagiannis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120094820.11929-1-tasos.papagiannnis@gmail.com \
--to=tasos.papagiannnis@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jack@suse.cz \
--cc=jmorris@namei.org \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=matt@bobrowski.net \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®