shaharhoch@google.com has uploaded this change for review. ( https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1259021?usp=email ) Change subject: nfs_creds: Isolate extended groups and squashed gids on export switches ...................................................................... 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 https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1259021?usp=email To unsubscribe, or for help writing mail filters, visit https://review.gerrithub.io/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: ffilz/nfs-ganesha Gerrit-Branch: next Gerrit-Change-Id: Ic71fbba936bac3dfa69e5386556f94cc7fe502e8 Gerrit-Change-Number: 1259021 Gerrit-PatchSet: 1 Gerrit-Owner: shaharhoch@google.com