From: Johannes Segitz <jsegitz@suse.de>
To: selinux@vger.kernel.org
Subject: [PATCH] selinux_restorecon: Do not exit on directory cycles
Date: Tue, 21 Jul 2026 09:17:54 +0200 [thread overview]
Message-ID: <al8dIlPQqf4eHINW@suse.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]
All other failures are handled gracefully. Directory cycles can e.g.
happen on BTRFS filesystems with subvolumes. Skip them and continue
instead of exiting
Signed-off-by: Johannes Segitz <jsegitz@suse.de>
---
libselinux/src/selinux_restorecon.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
index 7ef2d45d..33d315a2 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -883,13 +883,12 @@ loop_body:
switch (ftsent->fts_info) {
case FTS_DC:
- selinux_log(SELINUX_ERROR,
+ selinux_log(SELINUX_WARNING,
"Directory cycle on %s.\n",
ftsent->fts_path);
errno = ELOOP;
- state->error = -1;
- state->abort = true;
- goto finish;
+ fts_set(fts, ftsent, FTS_SKIP);
+ continue;
case FTS_DP:
continue;
case FTS_DNR:
--
2.55.0
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
next reply other threads:[~2026-07-21 7:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 7:17 Johannes Segitz [this message]
2026-07-21 13:54 ` [PATCH] selinux_restorecon: Do not exit on directory cycles Stephen Smalley
2026-07-21 15:15 ` Johannes Segitz
-- strict thread matches above, loose matches on Subject: below --
2026-07-23 8:55 Johannes Segitz
2026-07-23 14:55 ` Stephen Smalley
2026-07-23 15:21 ` Johannes Segitz
2026-07-23 15:38 ` Stephen Smalley
2026-07-23 15:42 ` Johannes Segitz
2026-07-24 15:29 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=al8dIlPQqf4eHINW@suse.com \
--to=jsegitz@suse.de \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox