Skip to content

Optionally rebuild policy store only if there were external changes to modules

Ondrej Mosnacek selinux 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 2 repliesIn review
  2. v1 RFC5 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- fix a spelling mistake found by James Carter
- eliminate 'rebuild' goto label from semanage_direct_commit()
- extract some of the semanage_direct_commit() cleanups into a separate patch
- unify checksum string format (semodule --checksum and the internal store checksum now use the same format and a common formatting helper)
- also the semanage_module_compute_checksum() is updated to do the formatting rather than leaving it up to semodule
- add missing space for null terminator to the checksum string buffers
- make the semantics of check_ext_changes more natural (and make them actually match the documentation)
- before: had to be used along with the rebuild flag to have an effect if no other changes are being done in the transaction
- now: check_ext_changes == 1 simply forces a rebuild any time module content changes are detected (i.e. it's kind of a conditional version of -B)
- also now: rebuild + check_ext_changes == rebuild
- rename --smart to --rebuild-if-modules-changed (it's long, but it's the least ambiguous I could come up with)
- also update semodule.8 man page
- update commit messages to reflect new naming and behavior

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6libsemanage: add missing include to boolean_record.clibsemanage/src/boolean_record.c+3 -12 replies
2/6semodule,libsemanage: move module hashing into libsemanagelibsemanage/include/semanage/modules.h libsemanage/src/libsemanage.map libsemanage/src/modules.c +5 more+114 -380 replies
3/6libsemanage: move compressed file handling into a separate objectlibsemanage/src/compressed_file.c libsemanage/src/compressed_file.h libsemanage/src/direct_api.c +2 more+354 -2670 replies
4/6libsemanage: clean up semanage_direct_commit() a bitlibsemanage/src/direct_api.c+45 -460 replies
5/6libsemanage: optionally rebuild policy when modules are changed externallylibsemanage/include/semanage/handle.h libsemanage/src/direct_api.c libsemanage/src/handle.c +6 more+175 -390 replies
6/6semodule: add command-line option to detect module changespolicycoreutils/semodule/semodule.8 policycoreutils/semodule/semodule.c+32 -70 replies

Reviews trailers per patch

1 of 6 patches has a Reviewed-by or Acked-by.

PatchJames Carter
1/6A-b
2/6
3/6
4/6
5/6
6/6

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

Read the v2 thread

Cover letter [PATCH userspace v2 0/6] Optionally rebuild policy store only if there were external changes to modules

This series extends libsemanage and semodule with optional capability to detect external changes to modules and perform a rebuild if there are any. See patch 5 for motivation and more details.

The first four patches are preparatory cleanup/refactoring, patch 5 implements the libsemanage side of the feature described above, and patch 6 adds a command-line option to semodule that allows to turn on the feature.

Default behavior of libsemanage and semodule is not changed (apart from added checksum calculation on each transaction, which however seems to add no noticeable overhead based on benchmarks - see patch 5 for details).

Another minor difference is a slightly different format of the checksum string printed by semodule --checksum ... (see patch 2).

v2:
- fix a spelling mistake found by James Carter
- eliminate 'rebuild' goto label from semanage_direct_commit()
- extract some of the semanage_direct_commit() cleanups into a separate patch
- unify checksum string format (semodule --checksum and the internal store checksum now use the same format and a common formatting helper)
- also the semanage_module_compute_checksum() is updated to do the formatting rather than leaving it up to semodule
- add missing space for null terminator to the checksum string buffers
- make the semantics of check_ext_changes more natural (and make them actually match the documentation)
- before: had to be used along with the rebuild flag to have an effect if no other changes are being done in the transaction
- now: check_ext_changes == 1 simply forces a rebuild any time module content changes are detected (i.e. it's kind of a conditional version of -B)
- also now: rebuild + check_ext_changes == rebuild
- rename --smart to --rebuild-if-modules-changed (it's long, but it's the least ambiguous I could come up with)
- also update semodule.8 man page
- update commit messages to reflect new naming and behavior

Ondrej Mosnacek (6):
libsemanage: add missing include to boolean_record.c semodule,libsemanage: move module hashing into libsemanage
libsemanage: move compressed file handling into a separate object
libsemanage: clean up semanage_direct_commit() a bit
libsemanage: optionally rebuild policy when modules are changed
externally
semodule: add command-line option to detect module changes

 libsemanage/include/semanage/handle.h         |   5 +
 libsemanage/include/semanage/modules.h        |  26 +
 libsemanage/src/boolean_record.c              |   4 +-
 libsemanage/src/compressed_file.c             | 224 ++++++++
 libsemanage/src/compressed_file.h             |  78 +++
 libsemanage/src/direct_api.c                  | 541 ++++++++----------
 libsemanage/src/direct_api.h                  |   4 -
 libsemanage/src/handle.c                      |  11 +-
 libsemanage/src/handle.h                      |   1 +
 libsemanage/src/libsemanage.map               |   5 +
 libsemanage/src/modules.c                     |  59 ++
 libsemanage/src/modules.h                     |   3 +
 libsemanage/src/semanage_store.c              |  53 +-
 libsemanage/src/semanage_store.h              |   1 +
 .../src/semanageswig_python_exception.i       |   8 +
 .../semodule => libsemanage/src}/sha256.c     |   0
 .../semodule => libsemanage/src}/sha256.h     |   0
 policycoreutils/semodule/Makefile             |   2 +-
 policycoreutils/semodule/semodule.8           |   7 +
 policycoreutils/semodule/semodule.c           |  85 ++-
 20 files changed, 721 insertions(+), 396 deletions(-)
 create mode 100644 libsemanage/src/compressed_file.c
 create mode 100644 libsemanage/src/compressed_file.h
 rename {policycoreutils/semodule => libsemanage/src}/sha256.c (100%)
 rename {policycoreutils/semodule => libsemanage/src}/sha256.h (100%)
Signature · 1 line
2.34.1