Re: [PATCH] libselinux: selinux_restorecon: avoid triggering auto-mounts unnecessarily

Stephen Smalley <[email protected]> Wed, 29 Jul 2026 10:07:42 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ7tyeUgPEERV+y7w8rEuD0ypHoT71ZWeC2x54-cvok=UA@mail.gmail.com>
On Wed, Jul 29, 2026 at 9:38 AM Félix-Antoine Fortin
<[email protected]> wrote:
>
> Sorry for failing to provide an update earlier.
>
> While implementing patch, I found out my initial analysis was wrong.
> autofs entries do not have the seclabel attribute. This was not the
> right cause for the automount.
>
> What I found out was, there was a second mount on XFS with the same
> path, and the seclabel attribute.
> restorecon was therefore triggering automount while reading info on
> another mount with the same path.
>
> In summary: restorecon called statvfs() on the pathname of a hidden
> seclabel bind mount listed in /proc/mounts.
> Because that pathname is covered by a systemd autofs mount, the
> pathname-based statvfs() resolves to
> the topmost autofs mount and unexpectedly activates the corresponding
> NFS filesystem.
>
> If we would like to avoid restorecon triggering automount, the patch
> solution I initially proposed has no effect.

Thanks for the update. Ok ignore my patch then.
Not sure if there is any easy fix for the situation you describe.