Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp435860rdb; Wed, 20 Dec 2023 01:15:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkTJd9Ihczwv3JMmc0fchwHnXdCIxbtOGyIUICfqzcWxMzy+BjKmfFvpOnecGc7Rnl9UUU X-Received: by 2002:a05:6214:234f:b0:67f:1889:65ea with SMTP id hu15-20020a056214234f00b0067f188965eamr12007778qvb.126.1703063727931; Wed, 20 Dec 2023 01:15:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703063727; cv=none; d=google.com; s=arc-20160816; b=XK+Vswy5dKKxFW4nmRrJeH/4UWx1980vFYavSB6vpm3JpEkW64xeqxG8Q4Ivn6F/If ZdKGIxh7XNBpQteGqf3SqU8ABvAwG6UmcX5SoLTgSXkYxaecIEGDScQNa8uZMzbAS2Vj ewStsVrKAwNh6AuXJKQExqee15Cg3dDRsGoNCcSfdE6j240NzEYZAY/bUNuHMvby2dVH F3LH12mugI/yAjm03dTbGMRu2VCYnwnTEfxBOhiurRvqWeFcFSSNWW3rIkEhVSH1P3Ro ps7AGiUKj0K1RZaBzsTKcY98E5RAnumUJrEkazJHg43ULMZkZGFcWNUbDjE3veayi5iO /Gpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from; bh=ssqBP7TCCyaWqELfBnfTUYwnzQ1KnF3Eec7H+PfedQk=; fh=63KYZMTOEI7LIr2RlyI1+rW05X1pjQ4btzdUtFh+9mA=; b=dOulCNv2526kfvb43SPemN1zeasIwINY5DkwlpBmzUiqOCx1EfBrWAOxwMZl9l8FOk tRB8KdXHIWwP3X4c6OH/oT+Wo9jU/0dgusIijttN0Wbzj15p+NyEyFuudYiblXqjhyjk 0KMiOLTUa/5q5+fLgej0yEUcsHvVBrsSKY691g19nLcELQFvFCTrsAbWnLE9SkDXZLuZ dUJeohnd2tbrJIrH3akl3SumQEW4w+D8ma4MaSJG9ATDbJhPxy4cVglzpW8np0Xdzzgj N5k8kWVT9HDjADZgbdWFs6LzNUXDMvn0hu0e9NjXcH3WRt5BmAbqqnZga4HgWemWntZy a7EQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6629-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j9-20020a0cf309000000b0067f63d12e9esi2752136qvl.205.2023.12.20.01.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 01:15:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6629-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AB2911C24557 for ; Wed, 20 Dec 2023 09:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B80C1D6BC; Wed, 20 Dec 2023 09:15:22 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42B911D6AE; Wed, 20 Dec 2023 09:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 3BK9ELam045394; Wed, 20 Dec 2023 17:14:21 +0800 (+08) (envelope-from Dongliang.Cui@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4Sw7516cbWz2PrKRR; Wed, 20 Dec 2023 17:08:05 +0800 (CST) Received: from tj10388pcu.spreadtrum.com (10.5.32.11) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 20 Dec 2023 17:14:19 +0800 From: Dongliang Cui To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , , CC: Dongliang Cui , Hongyu Jin Subject: [PATCH]eventfs: Apply the gid in the mounting parameters to all files Date: Wed, 20 Dec 2023 17:15:06 +0800 Message-ID: <1703063706-30539-1-git-send-email-dongliang.cui@unisoc.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL:SHSQR01.spreadtrum.com 3BK9ELam045394 I found that in the latest version, the nodes of tracefs have been changed to dynamically created. This has caused me to encounter a problem where the gid I specified in the mounting parameters cannot apply to all files, as in the following situation: /data/tmp/events # mount | grep tracefs tracefs on /data/tmp type tracefs (rw,seclabel,relatime,gid=3012) gid 3012 = readtracefs /data/tmp # ls -lh total 0 -r--r----- 1 root readtracefs 0 1970-01-01 08:00 README -r--r----- 1 root readtracefs 0 1970-01-01 08:00 available_events ums9621_1h10:/data/tmp/events # ls -lh total 0 drwxr-xr-x 2 root root 0 2023-12-19 00:56 alarmtimer drwxr-xr-x 2 root root 0 2023-12-19 00:56 asoc It will prevent certain applications from accessing tracefs properly, I try to avoid this issue by making the following modifications. Signed-off-by: Dongliang Cui --- fs/tracefs/inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index ae648de..5296ff7 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -560,6 +560,16 @@ struct dentry *eventfs_failed_creating(struct dentry *dentry) */ struct dentry *eventfs_end_creating(struct dentry *dentry) { + struct tracefs_fs_info *fsi; + struct tracefs_mount_opts *opts; + + if (dentry && dentry->d_inode) { + fsi = dentry->d_inode->i_sb->s_fs_info; + opts = &fsi->mount_opts; + if (opts->opts & BIT(Opt_gid)) + change_gid(dentry, opts->gid); + } + return dentry; } -- 2.7.4