Skip to content

RFC Fix ENOMEM errors during policy reload

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 RFC Latest2 patches 8 repliesIn review
  2. v3 RFC9 patches 2 repliesSuperseded
  3. v2 RFC4 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC3 patches7 repliesApplied

Changes in v4 from the cover letter

- folded in all incremental patches
- changed the reverse lookup cache size back to the original 3 as I realized that I don't really have a compelling reason to change it (I just like sizes to be powers of two...)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2selinux: use separate table for initial SID lookupsecurity/selinux/ss/policydb.c security/selinux/ss/services.c security/selinux/ss/services.h +2 more+173 -1104 replies
2/2selinux: overhaul sidtab to fix bug and improve performancesecurity/selinux/ss/mls.c security/selinux/ss/mls.h security/selinux/ss/services.c +2 more+459 -3234 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchStephen Smalley
1/2R-b
2/2R-b

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

Read the v4 thread

Cover letter [RFC PATCH v4 0/2] Fix ENOMEM errors during policy reload

Previous versions of this patchset:
https://lore.kernel.org/selinux/[email protected]/T/
https://lore.kernel.org/selinux/[email protected]/T/
https://lore.kernel.org/selinux/[email protected]/T/

Changes in v4:
- folded in all incremental patches
- changed the reverse lookup cache size back to the original 3 as I realized that I don't really have a compelling reason to change it (I just like sizes to be powers of two...)

Changes in v3:
(new changes are only in the "[fixup]" patches)
- fixed handling of SECSID_NULL (it is now remapped to unlabeled as before)
* verified using selinux-testsuite
- cosmetic tweak: add sidtab_lookup_initial() helper to make sidtab_search_core() a bit more readable
- fixed converting of unmapped contexts
* verified using the reproducer from Stephen Smalley
- cosmetic tweak: drop the 'out' goto label in convert_context()
- fixed SIDTAB_LEAF_ENTRIES to use SIDTAB_NODE_ALLOC_SIZE instead of using PAGE_SIZE directly

Changes in v2:
- dropped the first patch since it is already merged in -next
- fixed initial SID table to not reserve an entry for SECSID_NULL
- added back an equivalent of the reverse lookup cache
- fixed checkpatch.pl errors and some warnings

Testing:
An x86_64 Fedora 29 kernel with this patchset applied passes selinux-testsuite and the reproducer from GH issue #38 [1]. I also made sure that the two bugs discovered in previous version are now fixed.

[1] https://github.com/SELinuxProject/selinux-kernel/issues/38

Ondrej Mosnacek (2):
selinux: use separate table for initial SID lookup
selinux: overhaul sidtab to fix bug and improve performance

 security/selinux/ss/mls.c      |  23 +-
 security/selinux/ss/mls.h      |   3 +-
 security/selinux/ss/policydb.c |  10 +-
 security/selinux/ss/services.c | 200 +++++------
 security/selinux/ss/services.h |   2 +-
 security/selinux/ss/sidtab.c   | 616 +++++++++++++++++++++------------
 security/selinux/ss/sidtab.h   |  95 +++--
 7 files changed, 574 insertions(+), 375 deletions(-)
Signature · 1 line
2.19.2