Re: [PATCH] capability: WARN when invalid capability is requestedrather than BUG/panic

From: Eric Paris
Date: Tue Sep 30 2008 - 13:24:05 EST


On Tue, 2008-09-30 at 11:28 -0500, Serge E. Hallyn wrote:
> Quoting Eric Paris (eparis@xxxxxxxxxx):

> > > Perhaps we should have CAP_TO_INDEX mask itself?
> > >
> > > #define CAP_TO_INDEX(x) (((x) >> 5) & _KERNEL_CAPABILITY_U32S)
> >
> > Well, you save a branch and won't get the pagefault so it does 'fix' the
> > pagefault/panic from cap code. It doesn't tell us when others screw up
> > and SELinux is still possibly going to BUG(). We are also going to
> > actually be returning a permission decision not on what was requested
> > but on something wholely different.
>
> So exactly what was requested?

A capability that they cannot possibly have since it doesn't exist :)

> > I like mine better, but I'm ok with yours and can just do my changes in
> > SELinux if this is how cap wants to handle it. I don't really like the
>
> Heh I don't like either one, just thought this would reduce the overhead
> a bit :)

No argument from me that patching up for buggy drivers sucks. Yours
would be less overhead, and it would return the cap system back to
pre-2.6.25 operation (garbage in garbage out but no panic). Since we
already have the branch in SELinux its no 'extra' overhead to EPERM
there instead of here (garbage in EPERM out).

-Eric

--
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/