From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753850AbbLJV5O (ORCPT ); Thu, 10 Dec 2015 16:57:14 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:34069 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750834AbbLJV5M (ORCPT ); Thu, 10 Dec 2015 16:57:12 -0500 Date: Thu, 10 Dec 2015 21:56:48 +0000 From: Al Viro To: Kees Cook Cc: Willy Tarreau , Andrew Morton , Jan Kara , yalin wang , "Eric W. Biederman" , "linux-fsdevel@vger.kernel.org" , Linux-MM , LKML Subject: Re: [PATCH v5] fs: clear file privilege bits when mmap writing Message-ID: <20151210215648.GG20997@ZenIV.linux.org.uk> References: <20151209225148.GA14794@www.outflux.net> <20151210070635.GC31922@1wt.eu> <20151210181611.GB32083@1wt.eu> <20151210193351.GE20997@ZenIV.linux.org.uk> <20151210202749.GF20997@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?