Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845AbcLFOvi (ORCPT ); Tue, 6 Dec 2016 09:51:38 -0500 Received: from mail-oi0-f52.google.com ([209.85.218.52]:34243 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbcLFOvg (ORCPT ); Tue, 6 Dec 2016 09:51:36 -0500 MIME-Version: 1.0 X-Originating-IP: [217.173.44.24] In-Reply-To: <1481035527.2573.14.camel@redhat.com> References: <1480962075.2544.30.camel@redhat.com> <20161206100243.GF2622@veci.piliscsaba.szeredi.hu> <1481026405.2573.10.camel@redhat.com> <20161206143914.GG2622@veci.piliscsaba.szeredi.hu> <1481035527.2573.14.camel@redhat.com> From: Miklos Szeredi Date: Tue, 6 Dec 2016 15:51:34 +0100 Message-ID: Subject: Re: FUSE: regression when clearing setuid bits on chown To: Jeff Layton Cc: linux-fsdevel , open list , Al Viro Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1199 Lines: 31 On Tue, Dec 6, 2016 at 3:45 PM, Jeff Layton wrote: >> @@ -1739,8 +1739,6 @@ static int fuse_setattr(struct dentry *e >> * This should be done on write(), truncate() and chown(). >> */ >> if (!fc->handle_killpriv) { > > One more thing too. I don't think we really want to monkey with the mode > at all if there is a request to set the mode already in the request. So > maybe this should be: > > if (!fc->handle_killpriv && !(attr->ia_mode & ATTR_MODE)) > > Granted that won't generally happen from normal process context, but we > could have knfsd in here too and I think that's possible from there. Apparently this can't happen even from knfsd; notify_change() has this comment: /* * We now pass ATTR_KILL_S*ID to the lower level setattr function so * that the function has the ability to reinterpret a mode change * that's due to these bits. This adds an implicit restriction that * no function will ever call notify_change with both ATTR_MODE and * ATTR_KILL_S*ID set. */ if ((ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) && (ia_valid & ATTR_MODE)) BUG(); Thanks, Miklos