Re: [PATCH v5] fs: clear file privilege bits when mmap writing

From: Kees Cook
Date: Thu Dec 10 2015 - 17:00:16 EST


On Thu, Dec 10, 2015 at 1:56 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> On Thu, Dec 10, 2015 at 01:45:09PM -0800, Kees Cook wrote:
>> > but generally you need ->f_lock. And in situations where the bit can
>> > go only off->on, check it lockless, skip the whole thing entirely if it's
>> > already set and grab the spinlock otherwise.
>>
>> And I can take f_lock safely under mmap_sem?
>
> Are you asking whether it's safe to take a spinlock under an rwsem?

I keep getting various surprises while trying to implement this
change, so yeah, I just want to make sure I won't waste my time adding
taking the spinlock to the patch.

-Kees

--
Kees Cook
Chrome OS & Brillo Security
--
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/