Linux: Keyrings PAG handling changes
authorMarc Dionne <marc.c.dionne@gmail.com>
Sun, 25 Oct 2009 02:10:46 +0000 (22:10 -0400)
committerDerrick Brashear <shadow|account-1000005@unknown>
Mon, 23 Nov 2009 04:44:41 +0000 (20:44 -0800)
commit7b272177de4c6f78db7f2315f4e30e85ab7660bb
tree2f9ad9b4450186a341f50752e5c36565cd92b931
parent51ece42ab438295d3807180dae34963c676f170a
Linux: Keyrings PAG handling changes

We can take advantage of the fact that PagInCred now receives
a kernel credentials structure as an argument (including any session
keyring) to make some improvements in the handling of PAGs
when keyrings are in use.

These changes are effective only if keyrings are in use and we
have a recent enough kernel where we can use the kernel
credentials structure.

1 - Search the session keyring of the passed credentials instead of
the current process' to determine the PAG, if any.  This was always
not really correct, and now we're able to do the right thing.
In some situations such as background writeback and pre-fetching,
this means that we'll now do it with the right credentials, even when
in a PAG.

2 - Don't use groups at all to determine PAG membership.  Doing so
can lead to some inconsistent situations such as the one described
in RT 125198, where a process gets access through a soon to be
deleted PAG.  Make PagInCred look exclusively at the keyrings.
Groups are still updated to try to reflect the current PAG for now,
if the passed credentials belong to the current process.

Note that a process can no longer get a PAG's privileges simply by
adding the corresponding groups to its group list.

No behaviour change for kernels prior to 2.6.29.

FIXES 125198

Change-Id: Ifb171993cc9ca9d6a97fb7312909485ec0666efb
Reviewed-on: http://gerrit.openafs.org/730
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_prototypes.h
src/afs/afs_osi_pag.c