shaharhoch@google.com has uploaded this change for review.
nfs_creds: Isolate extended groups and squashed gids on export switches
A single NFSv4 COMPOUND can switch between exports with different
Manage_Gids and Squash settings (for example via PUTROOTFH, LOOKUP, or
PUTFH), re-running nfs_req_creds() on the shared per-request op_ctx.
Fix three export-switch issues in nfs_creds.c:
1. In set_extended_groups(), op_ctx->caller_gdata != NULL was checked
before MANAGED_GIDS. Touching a Manage_Gids = true export populated
caller_gdata, causing later operations in the same COMPOUND on a
Manage_Gids = false export to enforce server-resolved groups instead
of AUTH_SYS groups. Check MANAGED_GIDS first and restore
original_creds groups when unset.
2. In squash_creds(), caller_garray_copy and managed_garray_copy were
allocated once when NULL and reused without checking whether
caller_glen grew on a later export in the COMPOUND, risking a heap
out-of-bounds write when squashing supplementary gid=0. Free any
prior squashed copies at the start of nfs_req_creds() (resetting
creds.caller_garray to original_creds if needed).
3. nfs_req_creds() clears MANAGED_GIDS at entry, and the RPCSEC_GSS
CREDS_LOADED fast path returned without restoring it. Set
MANAGED_GIDS at the start of the RPCSEC_GSS case for non-anonymous
credentials, and clear it if initial principal mapping fails.
Change-Id: Ic71fbba936bac3dfa69e5386556f94cc7fe502e8
Signed-off-by: Shahar Hochma <shaharhoch@google.com>
---
M src/support/nfs_creds.c
1 file changed, 35 insertions(+), 9 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/21/1259021/1
To view, visit change 1259021. To unsubscribe, or for help writing mail filters, visit settings.