All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-3.5 0/5] selinux_restorecon(3), setfiles(8): skip relabeling errors
@ 2022-04-28  6:53 Laszlo Ersek
  2022-04-28  6:53 ` [PATCH for-3.5 1/5] setfiles: fix up inconsistent indentation Laszlo Ersek
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Laszlo Ersek @ 2022-04-28  6:53 UTC (permalink / raw)
  To: SELinux List, Laszlo Ersek; +Cc: Richard W.M. Jones, Petr Lautrbach

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518

The first three patches in the series are cleanups.

The fourth patch introduces a new feature (and API) to libselinux, and
the fifth patch exposes the feature through a new setfiles(8) command
line option.

In libguestfs, we invoke setfiles(8) on masses of directory trees (in a
large amount of virtual machines). We don't care if relabeling fails on
a few individual files, but we still want to catch fatal errors.
Currently these error conditions are impossible to tell apart, because
selinux_restorecon[_parallel()], even though it is capable of continuing
through relabeling errors, ultimately reports even the case of *only*
relabeling errors, with return value (-1). Setfiles(8) then has no
choice but to exit with status 255 in this case as well.

The fourth patch introduces a new selinux_restorecon[_parallel()] flag,
namely SELINUX_RESTORECON_COUNT_ERRORS, which counts, but otherwise
ignores, relabeling errors encountered during the file tree walk. In
case the function succeeds, the skipped error count can be fetched with
a new API, selinux_restorecon_get_skipped_errors(). This relies on
static library data, which is inspired by existent APIs such as
selinux_restorecon_set_sehandle(3) and
selinux_restorecon_set_exclude_list(3) -- those do the same (albeit
before calling selinux_restorecon[_parallel()], not after).

The fifth patch wires the new flag to the new setfiles(8) option "-C".

Please CC me on all replies to the series; I'm not subscribed to the
SELinux mailing list. ("CONTRIBUTING.md" does not say that subscribing
is a requirement.)

Cc: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Petr Lautrbach <plautrba@redhat.com>

Thanks,
Laszlo

Laszlo Ersek (5):
  setfiles: fix up inconsistent indentation
  setfiles: remove useless assignment and comment (after RHBZ#1926386)
  setfiles: remove useless "iamrestorecon" checks in option parsing
  selinux_restorecon: introduce SELINUX_RESTORECON_COUNT_ERRORS
  setfiles: introduce the -C option for distinguishing file tree walk
    errors

 libselinux/include/selinux/restorecon.h                     | 15 ++++++++
 libselinux/man/man3/selinux_restorecon.3                    | 22 +++++++++++-
 libselinux/man/man3/selinux_restorecon_get_skipped_errors.3 | 28 +++++++++++++++
 libselinux/src/libselinux.map                               |  5 +++
 libselinux/src/selinux_restorecon.c                         | 34 +++++++++++++++---
 policycoreutils/setfiles/restore.c                          |  8 +++--
 policycoreutils/setfiles/restore.h                          |  4 ++-
 policycoreutils/setfiles/setfiles.8                         | 22 ++++++++++++
 policycoreutils/setfiles/setfiles.c                         | 36 +++++++++-----------
 9 files changed, 145 insertions(+), 29 deletions(-)
 create mode 100644 libselinux/man/man3/selinux_restorecon_get_skipped_errors.3


base-commit: 2a167d1156578fc29541f6fb60af65452f431aae
-- 
2.19.1.3.g30247aa5d201


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-04-29 10:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28  6:53 [PATCH for-3.5 0/5] selinux_restorecon(3), setfiles(8): skip relabeling errors Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 1/5] setfiles: fix up inconsistent indentation Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 2/5] setfiles: remove useless assignment and comment (after RHBZ#1926386) Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 3/5] setfiles: remove useless "iamrestorecon" checks in option parsing Laszlo Ersek
2022-04-28 16:07   ` Daniel Burgener
2022-04-28  6:53 ` [PATCH for-3.5 4/5] selinux_restorecon: introduce SELINUX_RESTORECON_COUNT_ERRORS Laszlo Ersek
2022-04-29  8:13   ` Petr Lautrbach
2022-04-29 10:20     ` Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 5/5] setfiles: introduce the -C option for distinguishing file tree walk errors Laszlo Ersek
2022-04-28  9:22 ` [PATCH for-3.5 0/5] selinux_restorecon(3), setfiles(8): skip relabeling errors Richard W.M. Jones
2022-04-28  9:40   ` Laszlo Ersek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.