Skip to content

nss: warm the group mmap cache during initgroups - #9052

Open
karlg100 wants to merge 2 commits into
SSSD:masterfrom
karlg100:kag/nss-initgroups-group-mmap-warmup
Open

nss: warm the group mmap cache during initgroups#9052
karlg100 wants to merge 2 commits into
SSSD:masterfrom
karlg100:kag/nss-initgroups-group-mmap-warmup

Conversation

@karlg100

@karlg100 karlg100 commented Aug 7, 2026

Copy link
Copy Markdown

Problem

With ignore_group_members enabled, an initgroups response already contains
the name and GID needed for a memberless group memory-cache entry.

However, the NSS responder currently caches only the initgroups result. It
does not populate the group mmap cache for the groups returned by that
request. Callers may therefore resolve each returned GID separately,
repeating responder and cache work during login and VPN-sensitive
authentication paths.

Solution

While constructing an initgroups response:

  • store each returned group in the group mmap cache;
  • use an empty member list, consistent with ignore_group_members;
  • skip warming when group members are not ignored;
  • skip warming when cache invalidation was explicitly requested;
  • reuse one temporary talloc context across the result loop.

Failure to warm an individual group remains non-fatal and does not change the
initgroups response.

Tests

Wrap sss_mmap_cache_gr_store() in the NSS responder unit test and verify
that:

  • both initgroups groups are written to the mmap cache;
  • the expected names and GIDs are stored;
  • no synthetic group members are added.

Scope

This is an independent NSS responder optimization. It does not depend on the
verified-group rename or transactional memberOf changes in #9050 and #9051,
and it is not required for the #9049 watchdog fix.

Validation

  • The equivalent change is present in the tested RHEL 9 and RHEL 10
    investigation branches.
  • NSS responder tests passed on those branches.
  • The exact master-based branch will be built and its focused NSS tests run
    before marking this PR ready for review.

Related: #9049

With ignore_group_members enabled, an initgroups result already contains every field needed for a memberless group cache entry. Without warming the group mmap cache, callers resolve each returned GID separately and repeat responder/cache work across VPN-sensitive login paths.

Store each returned group in the mmap cache with an empty member list, unless cache invalidation was requested. Reuse one temporary talloc context across the result loop.

Dependency: none. This optimization is independent of the memberof transaction engine and may be cherry-picked separately.
Wrap sss_mmap_cache_gr_store in the NSS responder unit test and capture the groups written while ignore_group_members is enabled.

Verify both initgroups groups are cached with the expected names and GIDs and no synthetic member list.

Dependency: the initgroups group mmap warm-up patch.
@karlg100
karlg100 marked this pull request as ready for review August 7, 2026 19:50
@pbrezina pbrezina self-assigned this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants