From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbcLESWV (ORCPT ); Mon, 5 Dec 2016 13:22:21 -0500 Received: from mail-qk0-f179.google.com ([209.85.220.179]:35108 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbcLESWN (ORCPT ); Mon, 5 Dec 2016 13:22:13 -0500 Message-ID: <1480962075.2544.30.camel@redhat.com> Subject: FUSE: regression when clearing setuid bits on chown From: Jeff Layton To: Miklos Szeredi Cc: linux-fsdevel , open list , Al Viro Date: Mon, 05 Dec 2016 13:21:15 -0500 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miklos, I think we've found a "regression" that has crept in due to this patch: commit a09f99eddef44035ec764075a37bace8181bec38 Author: Miklos Szeredi Date:   Sat Oct 1 07:32:32 2016 +0200     fuse: fix killing s[ug]id in setattr      Basically, the pjdfstests set the ownership of a file to 06555, and then chowns it (as root) to a new uid/gid. Prior to the patch above, fuse would send down a setattr with both the uid/gid change and a new mode. Now, it just sends down the uid/gid change. Technically this is NOTABUG, since POSIX doesn't _require_ that we clear these bits for a privileged process, but Linux (wisely) has done that and I think we don't want to change that behavior here. So, the issue I think is the use of should_remove_suid, which will always return 0 when the process has CAP_FSETID. That's appropriate (I think) for write/truncate, but not chown, where we want to ignore that. Thoughts on the right fix here? A simple fix would be to add an "override" bool to should_remove_suid, but maybe there's some more elegant way to do it? -- Jeff Layton