Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp835075rdb; Sat, 7 Oct 2023 00:51:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7L5uXRXyn/x8SB7f72vnH3nRXHdmsiBMH3R4hh370QWVFhFrcfZVj2h+9gO9J2/E4s6Y/ X-Received: by 2002:a05:6a21:9989:b0:14c:daa9:5e22 with SMTP id ve9-20020a056a21998900b0014cdaa95e22mr12627203pzb.45.1696665110773; Sat, 07 Oct 2023 00:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696665110; cv=none; d=google.com; s=arc-20160816; b=QglN+FTv76E+5TVa6B3QFy/Q8GmMRiNSXOMeSqrWvPqQe5hFA5Hr3HjYTxsqOI1TTz kve6rL/5Iki8KSgfdWXh1J1E1lBarzPrYYC/hRFk3qRfD0FDZ1AlyVBNZqu2OOE4BzPN zdQyA3smDfTsJFU8E4APJpIS4t6Yzzx+allBRQ+snzjBZi8CgDMrse+rW9y4CpmbHvml ACEMpuEtLi0R+u9ZgC7CjKoygTaMIYO7EyOAiumKB3h3d24KonFumQgPp2jpqFNEiWxg 338gv0C0MbciAH8Vu4/anEFx5lf61Ch7KmPof3MWVMz8oD9Wb/OZNMlpW31GkUVvT0NY SuWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IL6H5VoBRpOqVzPYQ3RJbppwYGMKi8FhTxtOJkmxhus=; fh=x5Kr00bHXz0cdFvVMR7m4R/KyZpjYc6K2DvGCQbVlVI=; b=EUzpCI6rwnGbpcrt/eGf0DzjC8kBqplfZmqoyRtnGJO9QHucbHqsJMZBzZv9TcVB+o /761TvylO9LPik91xYxhUn8Y7Mt7rnI4IDyYweQwliFfgS0y0jNIu8Qf9Lm1JsIQ6ctB reawzMAoSW6vmJycdjKYtWo4KjYucO5rrlL9soA6eNbSnnioKAKt1w2hZB46RslWhywC GRrPUDh9GcTTxl5ZS3i5AneEru1pBizn4EcrHr5eEOXzi72TvsjBbd10f0FSzUBdsK/Y UhKWDLGC9B+I+xdHovxd37pGUKSyitTg2W2k9bC1SATRoNJGziV8kQD87YH3w40K8dH0 yqig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fHyvfov+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k3-20020a6568c3000000b00577461b010fsi3336654pgt.685.2023.10.07.00.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 00:51:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fHyvfov+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 15AE48038F84; Sat, 7 Oct 2023 00:51:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343713AbjJGHvi (ORCPT + 99 others); Sat, 7 Oct 2023 03:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343650AbjJGHvh (ORCPT ); Sat, 7 Oct 2023 03:51:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6FFB9 for ; Sat, 7 Oct 2023 00:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696665047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IL6H5VoBRpOqVzPYQ3RJbppwYGMKi8FhTxtOJkmxhus=; b=fHyvfov+D3drIE1sVjLsg+0GfekfLtLuMpBRpKRF7YTijeYc+uKnExy+NkqfDcL6so+zt/ wxfVQISsLBMEd3NZmfGdF713oBttj7Kpw95U/F337ji+XIe/syuNg+bK9gVB7OxBm6K8jm rywTZRJFys7pqXHF+PXvTBXHVzAPi9s= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-w7SxC4ueNaSkhHfQMJOwvw-1; Sat, 07 Oct 2023 03:50:45 -0400 X-MC-Unique: w7SxC4ueNaSkhHfQMJOwvw-1 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-58b2d243b26so707672a12.3 for ; Sat, 07 Oct 2023 00:50:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696665044; x=1697269844; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IL6H5VoBRpOqVzPYQ3RJbppwYGMKi8FhTxtOJkmxhus=; b=jVuWs662jV1hTpYzOau0ZW4UR7mbOcHaS3Z8472+TcAVQyYf1Eef2SrdgsUZiugZMi wftSuqPiqk1BUAROuU1usEeYK0HwDnUNwZ6vGUSL04hOznx4gv2B2sivRjKRfBfrSB6R gITdOC3l8fbk1rjjiC3sOJs0zKBgZGVuD1MABjiMd2YhdFXpLMJF2r1sKDsGdAZXJeHN cwCWdh2+XW9GNO5pIRYELNbNFJdhpd0Zj/W/fZ6ylf9iM0bA4GghKMC5gGMehAPe4oXk ovGrOvm2pgR5PNYLkPaZ806ToBSjC7NYEEVBvK+6JSwIBxaj30gAfxVRPx1vxX0Hz3eG nbYg== X-Gm-Message-State: AOJu0Yx4s654rd2/EG01sHKsop3mghkmdNM7U7w442l3QiN3vcr4Qw03 RYbryATV5j1y1XN+UXKwrKFl7Zz652eLu8a0irW/k/ixthsExxCjKaaXPDsrV8yuizzo2A8SJzl lYaERlmmEsF7k/c3h7vtpBh7sOnYiQcTt X-Received: by 2002:a05:6a20:144c:b0:13c:ca8b:7e29 with SMTP id a12-20020a056a20144c00b0013cca8b7e29mr11909256pzi.12.1696665044404; Sat, 07 Oct 2023 00:50:44 -0700 (PDT) X-Received: by 2002:a05:6a20:144c:b0:13c:ca8b:7e29 with SMTP id a12-20020a056a20144c00b0013cca8b7e29mr11909245pzi.12.1696665044053; Sat, 07 Oct 2023 00:50:44 -0700 (PDT) Received: from [10.72.112.33] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id r11-20020aa7844b000000b0069b772c4325sm2613613pfn.87.2023.10.07.00.50.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Oct 2023 00:50:43 -0700 (PDT) Message-ID: <507202a9-b71d-e52b-0306-dd89044ff442@redhat.com> Date: Sat, 7 Oct 2023 15:50:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] fuse: pass ATTR_KILL_SUID/ATTR_KILL_SGID mode bits to user space Content-Language: en-US To: miklos@szeredi.hu Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230921022436.1191166-1-xiubli@redhat.com> From: Xiubo Li In-Reply-To: <20230921022436.1191166-1-xiubli@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 07 Oct 2023 00:51:46 -0700 (PDT) Ping... On 9/21/23 10:24, xiubli@redhat.com wrote: > From: Xiubo Li > > Such as for the xfstest-dev's generic/684 test case it will clear > suid and sgid if the fallocate request is commit by an unprivileged > user. > > We need to pass the ATTR_KILL_SUID/ATTR_KILL_SGID flags to userspace. > > Signed-off-by: Xiubo Li > --- > fs/fuse/dir.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c > index f67bef9d83c4..73dcf54efbff 100644 > --- a/fs/fuse/dir.c > +++ b/fs/fuse/dir.c > @@ -1938,11 +1938,11 @@ static int fuse_setattr(struct mnt_idmap *idmap, struct dentry *entry, > > attr->ia_mode = inode->i_mode; > if (inode->i_mode & S_ISUID) { > - attr->ia_valid |= ATTR_MODE; > + attr->ia_valid |= ATTR_KILL_SUID | ATTR_MODE; > attr->ia_mode &= ~S_ISUID; > } > if ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { > - attr->ia_valid |= ATTR_MODE; > + attr->ia_valid |= ATTR_KILL_SGID | ATTR_MODE; > attr->ia_mode &= ~S_ISGID; > } > }