selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH userspace v2 0/6] Optionally rebuild policy store only if there were external changes to modules
@ 2022-02-03 16:53 Ondrej Mosnacek
  2022-02-03 16:53 ` [PATCH userspace v2 1/6] libsemanage: add missing include to boolean_record.c Ondrej Mosnacek
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Ondrej Mosnacek @ 2022-02-03 16:53 UTC (permalink / raw)
  To: selinux

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%)

-- 
2.34.1


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

end of thread, other threads:[~2022-02-18 18:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 16:53 [PATCH userspace v2 0/6] Optionally rebuild policy store only if there were external changes to modules Ondrej Mosnacek
2022-02-03 16:53 ` [PATCH userspace v2 1/6] libsemanage: add missing include to boolean_record.c Ondrej Mosnacek
2022-02-11 21:51   ` James Carter
2022-02-18 18:42     ` James Carter
2022-02-03 16:53 ` [PATCH userspace v2 2/6] semodule,libsemanage: move module hashing into libsemanage Ondrej Mosnacek
2022-02-03 16:53 ` [PATCH userspace v2 3/6] libsemanage: move compressed file handling into a separate object Ondrej Mosnacek
2022-02-03 16:53 ` [PATCH userspace v2 4/6] libsemanage: clean up semanage_direct_commit() a bit Ondrej Mosnacek
2022-02-03 16:53 ` [PATCH userspace v2 5/6] libsemanage: optionally rebuild policy when modules are changed externally Ondrej Mosnacek
2022-02-03 16:53 ` [PATCH userspace v2 6/6] semodule: add command-line option to detect module changes Ondrej Mosnacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).