Sorry, I've lost the original patch from two separate mailboxes...
The proper behavior depends on how we end up tying filesystems to user
namespaces, which isn't actually decided yet.
The way I was recommending doing that was:
A filesystem is tied to a user namespace. If a uid in another naemspace
is to be allowed to access the filesystem, it will actually - through a
key in it's keyring (which acts like a capability) - be mapped to a uid
in the filesystem's uid namespace. So in Eric's example, if Alice
brings Bob over quota, Alice would have done so through some user
Charlie who she is authorized to act as through her keyring. So Charlie
should be the id which would be logged over netlink.
Of course there is currently no support for this. So I'd recommend one
of two options: either just punt on uid namespace for now and we'll fix
it when we improve user namespaces - so log Alice's userid. Or we can
try to do it somewhat correct now, which might be done as follows:
1. introduce get_uid_in_userns(tsk). For now this just returns
tsk->uid if current->userns == tsk->userns, else it returns
0.
This way in Eric's scenario, Bob would be told that root,
not an invalid user (Alice) had brought him over quota.
Eventually, this would walk tsk's keychain for a uid entry
in current's active user namespace.
2. Add the userns to the netlink message.
Again I need to find Jan's orginal patch, but I'll take a look at this.
-serge
-