Skip to content

Parallel setfiles/restorecon

Ondrej Mosnacek selinux 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 4 repliesIn review
  2. v37 patches 2 repliesSuperseded
  3. v26 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC6 patches4 repliesSuperseded

Changes in v4 from the cover letter

- add a patch to fix a pre-existing data race in is_context_customizable()

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8label_file: fix a data racelibselinux/src/label_file.c libselinux/src/label_file.h+14 -30 replies
2/8selinux_restorecon: simplify fl_head allocation by using calloc()libselinux/src/selinux_restorecon.c+1 -20 replies
3/8selinux_restorecon: protect file_spec list with a mutexlibselinux/src/selinux_restorecon.c+14 -20 replies
4/8libselinux: make selinux_log() thread-safelibselinux/src/callbacks.c libselinux/src/callbacks.h+17 -40 replies
5/8libselinux: make is_context_customizable() thread-safelibselinux/src/is_customizable_type.c+11 -121 reply
6/8selinux_restorecon: add a global mutex to synchronize progress outputlibselinux/src/selinux_restorecon.c+3 -00 replies
7/8selinux_restorecon: introduce selinux_restorecon_parallel(3)libselinux/include/selinux/restorecon.h libselinux/man/man3/selinux_restorecon.3 libselinux/man/man3/selinux_restorecon_parallel.3 +5 more+368 -1470 replies
8/8setfiles/restorecon: support parallel relabelingpolicycoreutils/setfiles/Makefile policycoreutils/setfiles/restore.c policycoreutils/setfiles/restore.h +3 more+41 -160 replies

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristian GöttschePetr Lautrbach
SeriesA-b
1/8
2/8
3/8
4/8
5/8T-b
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH userspace v4 0/8] Parallel setfiles/restorecon

This series adds basic support for parallel relabeling to the libselinux API and the setfiles/restorecon CLI tools. It turns out that doing the relabeling in parallel can significantly reduce the time even with a relatively simple approach.

The first patch fixes a data race around match tracking in label_file. Second patch is a small cleanup found along the way. Patches 3-6 are small incremental changes that various functions more thread-safe. Patch 7 then completes the parallel relabeling implementation at libselinux level and adds a new function to the API that allows to make use of it. Finally, patch 8 adds parallel relabeling support to the setfiles/restorecon tools.

The relevant man pages are also updated to reflect the new functionality.

The patch descriptions contain more details, namely the last patch has also some benchmark numbers.

Changes v3->v4:
- add a patch to fix a pre-existing data race in is_context_customizable()

Changes v2->v3:
- add a patch to fix a pre-existing data race in label_file
- wait for threads to complete using pthread_join(3) to prevent thread leaks

Changes v1->v2:
- make selinux_log() synchronized instead of introducing selinux_log_sync()
- fix -Wcomma warning
- update the swig files as well
- bump new symbol version to LIBSELINUX_3.3 (this may need further update depending on when this gets merged)

Ondrej Mosnacek (8):
label_file: fix a data race
selinux_restorecon: simplify fl_head allocation by using calloc()
selinux_restorecon: protect file_spec list with a mutex
libselinux: make selinux_log() thread-safe
libselinux: make is_context_customizable() thread-safe
selinux_restorecon: add a global mutex to synchronize progress output
selinux_restorecon: introduce selinux_restorecon_parallel(3) setfiles/restorecon: support parallel relabeling

 libselinux/include/selinux/restorecon.h       |  14 +
 libselinux/man/man3/selinux_restorecon.3      |  29 ++
 .../man/man3/selinux_restorecon_parallel.3    |   1 +
 libselinux/src/callbacks.c                    |   8 +-
 libselinux/src/callbacks.h                    |  13 +-
 libselinux/src/is_customizable_type.c         |  23 +-
 libselinux/src/label_file.c                   |  15 +-
 libselinux/src/label_file.h                   |   2 +-
 libselinux/src/libselinux.map                 |   5 +
 libselinux/src/selinux_internal.h             |  16 +
 libselinux/src/selinux_restorecon.c           | 458 ++++++++++++------
 libselinux/src/selinuxswig_python.i           |   6 +-
 libselinux/src/selinuxswig_python_exception.i |   8 +
 policycoreutils/setfiles/Makefile             |   2 +-
 policycoreutils/setfiles/restore.c            |   7 +-
 policycoreutils/setfiles/restore.h            |   2 +-
 policycoreutils/setfiles/restorecon.8         |   9 +
 policycoreutils/setfiles/setfiles.8           |   9 +
 policycoreutils/setfiles/setfiles.c           |  28 +-
 19 files changed, 469 insertions(+), 186 deletions(-)
 create mode 100644 libselinux/man/man3/selinux_restorecon_parallel.3
Signature · 1 line
2.31.1