Received: by 10.192.165.148 with SMTP id m20csp481069imm; Fri, 27 Apr 2018 02:17:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoACMIR/GQdGCROFMfct2a6lvTFLEpkvHZFjB9t8tO7SzRNGX3CYIXf67Z1tsHetC7hXZlg X-Received: by 2002:a63:b54b:: with SMTP id u11-v6mr1435247pgo.365.1524820630750; Fri, 27 Apr 2018 02:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524820630; cv=none; d=google.com; s=arc-20160816; b=MBoC6Vcyb1n22CY5mGjF3SG5A1YE+KdfjJA9VjvBnk1dfujJc8XMkklgAI892lHqMM aa32TEDQFjM9kNGwNrFE77fXCxs2ffc4cHbKm5forrrrib+bJ7rC+XRgi1i6sZmB3p4F KbAq5+3XoH3v76VPgGWodGFchkzNfyIk3PP/rHWTKaXn3nrNKFc00RSrN6i1E8bBOWYD jXlbG0M6rdt0Ua5kzNqAbfEXmG4It8Br1HyyccoxIdc2RJvekFt9SezwfnLCPpsjRydL VBKRkdoPyJlclDSOOxFY+hxwRmMmKQwKejkxaJLWlPl5BKOxzBsIP7BlYgsrb+YE9cwi +fIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :organization:from:references:cc:to:subject :arc-authentication-results; bh=XWunTtr5FKf2sjC3BMCG9dCEd5zhe2J9EgFSMRNmZA0=; b=dj6NR7b1IrU0d/sujOGwqEfuLDj0cWqtKAZHXZS3cF9dkdZqJ72PIJ8rek///DWcPy 2lBkvFLGuUDC5jXBQ0tQ4WYO8DaaB3sLvQjm1KfoqUf0nUoU2dFTBJipgBkxumAS9jTE 3/FSbft2RpqlfQ64JLKnBBadUyVpkIMs9btZZ/rK7p2x353tZibmFifseXiXonao9PlJ 2upJcdwBBqkjSprY67dZWhMyAssVzQj3TEP7rNB1o89e5Cnwtut1Eqvn9RZlQOhHShXG mwpJyn3v0QgHBC7MUPWjdRdAegWsHd5GatJn+fSr9Ylnabsgv3z7Zmhnl1A8ymGZeFtL 7hUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e39-v6si890123plg.335.2018.04.27.02.16.56; Fri, 27 Apr 2018 02:17:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757746AbeD0JOg (ORCPT + 99 others); Fri, 27 Apr 2018 05:14:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35518 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755540AbeD0JOd (ORCPT ); Fri, 27 Apr 2018 05:14:33 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3R9D8tX122126 for ; Fri, 27 Apr 2018 05:14:33 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hkvkdk9ag-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 27 Apr 2018 05:14:33 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Apr 2018 10:14:30 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 27 Apr 2018 10:14:27 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3R9ERdU65732630; Fri, 27 Apr 2018 09:14:27 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B24F752041; Fri, 27 Apr 2018 09:05:02 +0100 (BST) Received: from oc3784624756.ibm.com (unknown [9.152.212.151]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 61EA652043; Fri, 27 Apr 2018 09:05:02 +0100 (BST) Subject: Re: [PATCH] inode: debugfs_create_dir uses mode permission from parent To: Greg KH Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org References: <20180427080712.2380-1-tmricht@linux.ibm.com> <20180427082737.GA25242@kroah.com> From: Thomas-Mich Richter Organization: IBM LTC Date: Fri, 27 Apr 2018 11:14:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180427082737.GA25242@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18042709-0040-0000-0000-00000452A4AA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042709-0041-0000-0000-000020F6B046 Message-Id: <504bade7-7b06-c9d4-e4e2-736b9ee5a313@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-27_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804270092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/27/2018 10:27 AM, Greg KH wrote: > On Fri, Apr 27, 2018 at 10:07:12AM +0200, Thomas Richter wrote: >> Currently function debugfs_create_dir() creates a new >> directory in the debugfs (usually mounted /sys/kernel/debug) >> with permission rwxr-xr-x. This is hard coded. >> >> Change this to use the parent directory permission. >> >> Fixes: edac65eaf8d5c ("debugfs: take mode-dependent parts of debugfs_get_inode() into callers") >> Signed-off-by: Thomas Richter >> Cc: Greg Kroah-Hartman >> --- >> fs/debugfs/inode.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c >> index 13b01351dd1c..80618330d86a 100644 >> --- a/fs/debugfs/inode.c >> +++ b/fs/debugfs/inode.c >> @@ -512,7 +512,10 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) >> if (unlikely(!inode)) >> return failed_creating(dentry); >> >> - inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; >> + if(!parent) >> + parent = debugfs_mount->mnt_root; >> + inode->i_mode = S_IFDIR | (d_inode(parent)->i_mode >> + & (S_IRWXU | S_IRWXG)); >> inode->i_op = &simple_dir_inode_operations; >> inode->i_fop = &simple_dir_operations; >> > > This looks ok, but is it going to change the permissions of existing > stuff in ways that might breaks things, right? Right, but debugfs is usually mounted on /sys/kernel/debug with permissions rwx to root owner. It can be changed after the mount, of course. Unless this is done, the directory permissions for /sys/kernel/debug will stop any descend regardless of the subdirectory permissions. > > Have you done a before/after comparison? I have tested this patch on my Linux 4.17.0rc2 kernel on s390. That worked well, I have not tested other systems. -- Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294