Re: [PATCH 8/19]: SCST SYSFS interface implementation

From: Dmitry Torokhov
Date: Mon Nov 15 2010 - 16:14:59 EST


On Mon, Nov 15, 2010 at 11:37:28PM +0300, Vladislav Bolkhovitin wrote:
> Dmitry Torokhov, on 11/15/2010 10:04 AM wrote:
>
> >> This is because SYSFS doesn't hold references for the corresponding
> >> kobjects for every open file handle. It holds references only when
> >> show() and store() functions called. So, everything is under control and
> >> a malicious user can do nothing to hold a reference forever.
> >
> > Right, Tejun plugged this particular (and very annoying) attributes
> > behavior
>
> This behavior isn't annoying, it's GREAT, because it allows to use SYSFS
> simply and reliably.

Right, I mean that _before_ Tejun plugged that hole the behavior _was_
annoying.

>
> >, but that does not mean that this is the only way kobject's
> > reference might be pinned.
>
> Could you be more specific and point out on exact ways for that? From my
> quite deep SYSFS source code study I see such cases should not exist.

While I do not know offhand I am sure there are such scenarios. Isn't
there any way for the users that you are waiting on descend back into
your module that is waiting for kobject removal and get stuck on some
resource?

Even if it isn't possible now the scheme is quite fragile. Kobjects are
refcounted so work with them appropriately (rely on refcount, do not
wait, etc).

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