Re: [PATCH v3 03/13] seccomp_filters: new mode with configurablesyscall filters

From: Steven Rostedt
Date: Thu Jun 02 2011 - 16:48:06 EST


On Thu, 2011-06-02 at 15:28 -0500, Will Drewry wrote:

[ Snipped 860 lines of non relevant text ]

Seriously guys, Please trim your replies. These last few messages were
ridicules. I spent more than 30 seconds searching for what the email was
about. That's too much wasted time.

-- Steve


> >> Ah, I spaced on rcu_dereference(). The goal was to make the
> >> assignment and replacement of the seccomp_filters pointer
> >> RCU-protected (in seccomp_state) so there's no concern over it being
> >> replaced partial on platforms where pointer assignments are non-atomic
> >> - such as via /proc/<pid>/seccomp_filters access or a call via the
> >> exported symbols. Object lifetime is managed by reference counting so
> >> that I don't have to worry about extending the RCU read-side critical
> >> section by much or deal with pre-allocations.
> >>
> >> I'll add rcu_dereference() to all the get_seccomp_filters() uses where
> >> it makes sense, so that it is called safely. Just to make sure, does
> >> it make sense to continue to rcu protect the specific pointer?
> >
> > It might. The usual other options is to use a lock outside of the element
> > containing the reference count to protect reference-count manipulation.
> > If there is some convenient lock, especially if it is already held where
> > needed, then locking is more straightforward. Otherwise, RCU is usually
> > a reasonable option.
>
> I was concerned about the overhead a lock would have at each system
> call entry, but I didn't benchmark it to see. I'll add the
> rcu_dereference right away, then look into seeing whether there's a
> cleaner approach. I was trying to be overly protective of mutating
> any data internal to the filters through complete replacement on any
> change. I'll take a step back and see if
>


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