Re: [PATCH] /proc Security Hooks

From: Max Kellermann
Date: Wed Oct 17 2007 - 01:14:18 EST


On 2007/10/16 21:54, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
> On Tue, 16 Oct 2007 21:38:50 +0200
> Max Kellermann <mk@xxxxxxxxxx> wrote:
> > This patch attempts to unify duplicated code found in modules like
> > Linux VServer.
>
> can you please merge this patch only when you also merge the first
> user
> of it? That's the only way we can keep the LSM hooks sane... is to
> see
> them in thew conect of a user.

I wrote a module which uses this, but it's non-free and only used on
my employer's servers. But I could have a closer look at the Vserver
code and try to make it use my patch.

> > +#ifdef CONFIG_SECURITY_PROC
> > + if (security_proc_task(task) != 0)
> > + continue;
> > +#endif
>
> please don't use an ifdef like this; just make security_proc_task()
> be
> a define to 0 in the header for that CONFIG_ ..
> In addition, why is this a separate config option? LSM should really
> only be one big switch... microswitches like this don't make any
> sense.

Right, I initially wrote this patch some time ago when
linux/security.h didn't have an "#ifdef CONFIG_SECURITY". I'll adapt
that.

> > +#ifdef CONFIG_SECURITY_PROC
> > + if (security_proc_generic(de) != 0)
> > +
> > goto skip;
> > +#endif
>
> as does this one... but the goto looks horrid to me

I'm all against gotos, but seeing gotos all over the kernel, and my
code being in an #ifdef, this one goto looked "normal" to me. You're
right, I should change it.

Max
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/