mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] security: Add pre-lookup pathname open check
@ 2026-11-20  9:48 Anastasios Papagiannis
  2026-11-20  9:48 ` [RFC PATCH 1/2] security: Add hook for unresolved pathname opens Anastasios Papagiannis
  2026-11-20  9:48 ` [RFC PATCH 2/2] selftests/bpf: Test pathname open enforcement Anastasios Papagiannis
  0 siblings, 2 replies; 4+ messages in thread
From: Anastasios Papagiannis @ 2026-11-20  9:48 UTC (permalink / raw)
  To: linux-security-module
  Cc: bpf, linux-kernel, linux-fsdevel, paul, jmorris, serge, brauner,
	viro, jack, ast, daniel, andrii, kpsingh, matt, eddyz87,
	tasos.papagiannnis

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  9:48 [RFC PATCH 0/2] security: Add pre-lookup pathname open check Anastasios Papagiannis
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

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®