From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) by kanga.kvack.org (Postfix) with ESMTP id 566A56B0038 for ; Thu, 10 Dec 2015 17:00:08 -0500 (EST) Received: by iofh3 with SMTP id h3so107955526iof.3 for ; Thu, 10 Dec 2015 14:00:08 -0800 (PST) Received: from mail-ig0-x236.google.com (mail-ig0-x236.google.com. [2607:f8b0:4001:c05::236]) by mx.google.com with ESMTPS id u7si893667igk.100.2015.12.10.14.00.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Dec 2015 14:00:07 -0800 (PST) Received: by mail-ig0-x236.google.com with SMTP id mv3so27660668igc.0 for ; Thu, 10 Dec 2015 14:00:07 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <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> <20151210215648.GG20997@ZenIV.linux.org.uk> Date: Thu, 10 Dec 2015 14:00:07 -0800 Message-ID: Subject: Re: [PATCH v5] fs: clear file privilege bits when mmap writing From: Kees Cook Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Al Viro Cc: Willy Tarreau , Andrew Morton , Jan Kara , yalin wang , "Eric W. Biederman" , "linux-fsdevel@vger.kernel.org" , Linux-MM , LKML On Thu, Dec 10, 2015 at 1:56 PM, Al Viro 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, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org