Re: [PATCH v3] selinux_restorecon: Do not exit on directory cycles
Johannes Segitz <[email protected]> Tue, 28 Jul 2026 08:57:40 +0200
| Newsgroups | org.kernel.vger.selinux |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jul 27, 2026 at 09:35:19AM -0400, Stephen Smalley wrote: > On Mon, Jul 27, 2026 at 8:53 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 > > > > Signed-off-by: Johannes Segitz <[email protected]> > > --- > > libselinux/src/selinux_restorecon.c | 11 +++++------ > > 1 file changed, 5 insertions(+), 6 deletions(-) > > > > diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c > > index 30f1b836..fdefc92c 100644 > > --- a/libselinux/src/selinux_restorecon.c > > +++ b/libselinux/src/selinux_restorecon.c > > @@ -1393,15 +1393,14 @@ static void *selinux_restorecon_thread(void *arg) > > if (is_dir) { > > if (descend && walk_is_cycle(state, ent_sb.st_dev, > > ent_sb.st_ino)) { > > - selinux_log(SELINUX_ERROR, > > + selinux_log(SELINUX_WARNING, > > "Directory cycle on %s.\n", > > ent_path); > > close(ent_fd); > > - close(rd_fd); > > - errno = ELOOP; > > - state->error = -1; > > - state->abort = true; > > - goto finish; > > + if (rd_fd >= 0) > > + close(rd_fd); > > As before, you don't need the if (rd_fd >= 0) test here because this > is under an if (descend...) > so it is a tautology. And i thought you were going to explicitly note > the change in behavior via > e.g. a man page update or similar? yes, I might have gotten carried away that I finally beat git send-email into submission that I sent the wrong patch ... v4 will be there in a sec, sorry Johannes -- GPG Key EE16 6BCE AD56 E034 BFB3 3ADD 7BF7 29D5 E7C8 1FA0 Subkey fingerprint: 250F 43F5 F7CE 6F1E 9C59 4F95 BC27 DD9D 2CC4 FD66 SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg, Germany www.suse.com, Geschäftsführer: Jochen Jaser, Andrew McDonald, Abhinav Puri, (HRB 36809, AG Nürnberg)
signature.asc
(application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE----- iQJPBAEBCgA5FiEEJQ9D9ffObx6cWU+VvCfdnSzE/WYFAmpoUuMbFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJELwn3Z0sxP1mGYIP/Rau2yh86jvo9WcR+9rZ rIugNFN5toPz2aTQmrayRtpF/64C2rLM/ler+XbNIdQt5j0F6R64bKDO5QPkgPVx dzbI6WkJBcNeIs0jcznU61QFn/zls/IAOdVKipgIW3XAeQq2OtPUxml3lKzugBgP +7K/77QtAl998wlHPrxRb94oU1OtplCt3Obayg9z4royU2CjaRXDEM+TgSsw+ft8 3vkKR/wO8bpMFMDeKBOv9mcbbb8Ap1XwBkjZKZPV13NU1GUQvFEzhVP/wscbbt69 4lfEU9llsREHWWCcEu1th3EJrFMefoP1gUS8z4Y5iEQF+hkQjiTm8DE5K2e8HzNM g5Cp0yIwwI+h5zpVqY+ehX4x0XNB8UQqm0lbhtNZxBQOlOxIezTcKkTkSkol+blV yGvNNdfE/XUUIgTovDPW1xQhXnkUyjeRla0F/uNuyWBYVCL0I2/PDMvUaZSs7Vyu 2nLkyR6QSOiqOkGr6yvdrtrTONzkEMdx1KHeBE44msk5BvWAknDYX++NiCepq1Z4 ost8ll6axLY8Wx07F8uicWHmTY8BBRHbPFZe7bCRBC6SGP/FiIjEQ1w3mU9AIcj/ 43J91Stcxzicy82oFc5nzcmv6JoRoF3W6XwGYxFdrvUpLbhT6bObS0rsiVADPlVm cpSSMwSWmvUfsh7Xjr4zIFYC =HPZL -----END PGP SIGNATURE-----