Messages in this thread | | | From | David Howells <> | Subject | Re: [PATCH 3/3] KEYS: Make the keyring quotas controllable through /proc/sys | Date | Fri, 14 Mar 2008 02:39:46 +0000 |
| |
Andrew Morton <akpm@linux-foundation.org> wrote:
> > #define key_serial(key) ((key) ? (key)->serial : 0) > > err, why was that a macro? It could have been implemented as an inline. > One which doesn't evaluate its argument twice (or once if it was -1).
Probably because the CONFIG_KEYS=n version of key_serial() has to be a macro (so as to discard key without any attempt at evaluation).
However, that doesn't apply to the CONFIG_KEYS=y case, so I'll whip up a patch to alter that for you.
> > +#ifdef CONFIG_SYSCTL > > +extern ctl_table key_sysctls[]; > > +#endif > > I've been going around telling people to not bother with the ifdefs here. > Upside: looks nicer. Downside: defers the build error from compile-time to > link-time.
Downside #2: the #ifdef is documentation of a sort. Personally, I prefer the extra #ifdef here as it makes it clearer to someone looking at the .h file why their code doesn't compile/link rather than them having to know to go fishing in Makefiles.
> open-coded knowledge of uid==0 might be problematic for containerisation. > Maybe it's on the containers team's radar, maybe it's actually not a > problem, don't know. (adds cc).
As I understand it, the same applies to any UID. UID 0/root is typically special, but I don't know how this is normally handled in alternate containers for other kernel objects. I can't just go and look at a capability on current because the quota belongs to the user, not the process.
I have become aware in the last couple of days that the container people missed or left out keys. Possibly key IDs as well as key quotas should be separated.
David
| |