Cc: Andrew Morgan <morgan@...>, Chris Wright <chrisw@...>, Andrew Morgan <agm@...>, <casey@...>, Andrew Morton <akpm@...>, Stephen Smalley <sds@...>, KaiGai Kohei <kaigai@...>, James Morris <jmorris@...>, <linux-security-module@...>, lkml <linux-kernel@...>
On Tue, 2007-08-07 at 17:17 -0500, Serge E. Hallyn wrote:
You are unconditionally taking the i_mutex whether or not you actually
have any capabilities to remove. Normally, removing capabilities due to
a write is something which occurs once every blue moon. Can't you
introduce a heuristic along the lines of should_remove_suid() in order
to optimise away the common case?
In addition, if you need to remove both the capabilities and the suid
bits, then it should be unnecessary to take the i_mutex twice.
Trond
-