diff options
| author | Jitendra Bhati <bhatijitendra2022@gmail.com> | 2026-08-18 21:46:01 +0000 |
|---|---|---|
| committer | Alan Somers <asomers@FreeBSD.org> | 2026-08-23 19:02:00 +0000 |
| commit | 22df19c09af64dc8711ee62796ba4cf3e7e4824f (patch) | |
| tree | 431ef75ecd9e337c4dbac273d96921af1c23f45b /tools/lldb-mi/MICmnLLDBDebugger.cpp | |
| parent | 4a07ed9bcd5fd8c6635d2e086b9e5b83deb21766 (diff) | |
Run the file-hierarchy traversal inside Capsicum capability mode
using the fts_openat(3) API. This confines chflags to the directory
hierarchies named on the command line, so a malicious or buggy tree
cannot redirect it at files elsewhere via a crafted symbolic link.
Because AT_FDCWD is rejected in capability mode, a directory descriptor
for the parent directory of every argument with an absolute path or a
path containing ".." is opened once before cap_enter(). Once every
descriptor is open, cap_enter() is called and the traversal acts through
fd-relative operations: chflagsat(fts_parent->fts_dirfd, fts_name).
With -L chflags follows symbolic links, which may point outside the
named hierarchy; chflag now rejects such accesses. The new
--dereference-links-unsafely option disables the sandbox to restore the
historical behavior for the rare callers that rely on it. But if the
symbolic was link was named directly on the command line, chflags will
still follow it (unless -h was given).
Add functional tests covering relative, absolute, "..", recursive
and mixed path arguments, and the symlink handling in both the
default and --dereference-links-unsafely modes; they skip on
filesystems that do not support the uchg flag.
Sponsored by: Google LLC (GSoC 2026)
Reviewed by: asomers
Relnotes: yes (for the -L behavior change)
Pull Request: https://github.com/freebsd/freebsd-src/pull/2375
Diffstat (limited to 'tools/lldb-mi/MICmnLLDBDebugger.cpp')
0 files changed, 0 insertions, 0 deletions
