Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2026 18:10:07 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= <des@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org,  Jitendra Bhati <bhatijitendra2022@gmail.com>
Subject:   Re: git: e03ed9daeb49 - main - fts: refactor to use fd-relative operations internally
Message-ID:  <CAOtMX2g3Dc9J3KWHYtOZNEGEJ3=5ETord8Zprt3MTrax5tgLqw@mail.gmail.com>
In-Reply-To: <864iispzxf.fsf@ltc.des.dev>
References:  <6a3a9e2c.1d985.79db71af@gitrepo.freebsd.org> <864iispzxf.fsf@ltc.des.dev>

index | next in thread | previous in thread | raw e-mail

On Tue, Jun 23, 2026 at 6:03 PM Dag-Erling Smørgrav <des@freebsd.org> wrote:
>
> Alan Somers <asomers@FreeBSD.org> writes:
> > commit e03ed9daeb49fffa1d16b8d00240c65e92650d01
> > Author:     Jitendra Bhati <bhatijitendra2022@gmail.com>
> > AuthorDate: 2026-06-12 17:07:55 +0000
> > Commit:     Alan Somers <asomers@FreeBSD.org>
> > CommitDate: 2026-06-23 14:53:56 +0000
> >
> >     fts: refactor to use fd-relative operations internally
> >
> >     Replace all _open() calls with _openat() in __fts_open(), fts_read(),
> >     and fts_children().
> >
> >     Add fts_dirfd to FTSENT. Callers can use
> >     openat(ent->fts_dirfd, ent->fts_name, ...) to access files
> >     safely without relying on fts_accpath, which enables:
> >
> >     1. Capsicum capability mode where path-based operations fail
> >     2. Security-sensitive programs that avoid TOCTOU races
> >
> >     Replace statfs(ent->fts_path) with _fstatfs(ent->fts_dirfd) in
> >     fts_ufslinks() when fts_dirfd is valid, falling back to statfs() for
> >     root-level entries where fts_dirfd is -1
> >
> >     This is a preparatory change for fts_openat() which will allow
> >     callers to provide a pre-opened directory fd, enabling fts(3)
> >     traversal inside Capsicum capability mode.
> >
> >     Sponsored by:   Google LLC (GSoC 2026)
> >     Reviewed by:    asomers, jillest
> >     MFC after:      2 weeks
> >     Pull Request:   https://github.com/freebsd/freebsd-src/pull/2278
>
> This needs to be reverted.  It changes struct _ftsent which is part of
> the libc ABI.  You will have to fork FTS (again) and have one version
> with fts_dirfd and fts_openat() and one without.

I don't think there's any guarantee that the size of _ftsent is fixed.
Since the API only passes FTSENT around by pointer, we are free to add
fields.  Or am I missing something?


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2g3Dc9J3KWHYtOZNEGEJ3=5ETord8Zprt3MTrax5tgLqw>