Re: [PATCH] selinux_restorecon: Do not exit on directory cycles

Stephen Smalley <[email protected]> Thu, 23 Jul 2026 11:38:24 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ6oS-W+5e6G-KqSr60CP+GTU3G_A6d0nLpFHQMPnqccGg@mail.gmail.com>
On Thu, Jul 23, 2026 at 11:21 AM Johannes Segitz <[email protected]> wrote:
>
> On Thu, Jul 23, 2026 at 10:55:48AM -0400, Stephen Smalley wrote:
> > On Thu, Jul 23, 2026 at 4:56 AM Johannes Segitz <[email protected]> wrote:
> > >
> > > All other failures are handled gracefully. Directory cycles can e.g.
> > > happen on BTRFS filesystems with subvolumes. Skip them and continue
> > > instead of exiting
> >
> > This is a user-visible behavior change so we should note it; restorecon -R
> > on a tree with a bind mount of an ancestor will now complete with rc 0 and
> > only a WARNING rather than aborting with ELOOP.
>
> Okay, I can write something up. But in general you would be fine with the
> behavior change?

I am (although other maintainers are free to disagree).

> > Missing Signed-off-by line and the patch still doesn't apply for me
> > (did you send it using git send-email and against current selinux/main?)
> > but also see comment below on the code.
>
> I start feel like an idiot. The first time I used this old repo with the
> wrong branch, but this time I made sure it applies, but didn't use
> git send-mail.
>
> I did
> # git format-patch -1 HEAD
> 0001-selinux_restorecon-Do-not-exit-on-directory-cycles.patch
>
> which for me then applies:
> # git checkout main
> Already on 'main'
> Your branch is up to date with 'origin/main'.
> # git rev-parse --short HEAD
> 84d424b8
> # git am 0001-selinux_restorecon-Do-not-exit-on-directory-cycles.patch
> Applying: selinux_restorecon: Do not exit on directory cycles
>
> Maybe my manual inclusion in the mail breaks it? I attach it now to the
> mail

Yes, unfortunately mail clients are unforgiving of inline patches
these days so we recommend
using git send-email,
https://github.com/SELinuxProject/selinux/wiki/Contributing#contributing-code

We still prefer inline patches for ease of review and inline commenting.