Received: by 10.192.165.148 with SMTP id m20csp315154imm; Wed, 2 May 2018 00:18:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrbaQIJRfPAIjEK1zcpBKvMj4CVfQDiw9hS9RhVhihJIfm3PAVBvnAWrlrIhqrxos2Ace/V X-Received: by 2002:a17:902:380c:: with SMTP id l12-v6mr7238220plc.19.1525245507997; Wed, 02 May 2018 00:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525245507; cv=none; d=google.com; s=arc-20160816; b=dSTOaX23vKSlIC9gzdTCvWqUq9tfmayuVlnX8Txu2N/kB4BDxuE7W9NkILIvOEiMpD rHU1drz0i5xem7u3GA7EryIyX0hc02HGDyqcropZ9n6smzCwCtE4OtLZFapOCKuItM55 GrEXXVrzsgXucV0/JKAfcOA2PARoEbOUBSNf/Z2JITQGLDuazrxFAcKZEqFFMarMP+9U OzGkINVQ4LwCYPOQWEaaBGDbNtkHI4Pzvht/fmZcCsq/FPFXcSDO8E7k15rlyfzZ5P7i gGGIUUj8hePdJ8iJhu3Lt5YUNKsGlfinmp+KOdyECS1aK+mi/pHhXwVcXPqE3Eg86fzt Hopw== 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=Uc+9YYT4ecb25kbjOJR7YrZKGzDbKDlM45cfWblQVmo=; b=gBZ5wdcDrpZJ5lynpFKOC4DsgCIRTVo4R/7GIHj2nbobA7TWomh5jhI2xhMjK+VxfN KIY4cc/f2tjcNVOijhFr1+mSX8x2eomU1YG6452Sf63OoPEwWS2ebjLy4Hy7QKY1qowK oWw5gXO4AnJjDblUBw33SYy1G/rLVkxiL8LO7mCfgz64VsNo24vszWZ1jZrFD51ahLnc km56FLToVbTx05DeLrF+NoXPmWUNDiI+dGFb/3jPnQmKSi9R2HPbrVIJDL9CR4RBkIW7 QZb2vjsv5qKnqg25aHAfW0M663IpkMPd25UXgTC3QFpmDvttBl4WQ1BepaYPFzWayTBb w3iA== 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 u2-v6si9064400pgb.321.2018.05.02.00.18.13; Wed, 02 May 2018 00:18:27 -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 S1751134AbeEBHQi (ORCPT + 99 others); Wed, 2 May 2018 03:16:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33304 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbeEBHQh (ORCPT ); Wed, 2 May 2018 03:16:37 -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 w427Et5A141256 for ; Wed, 2 May 2018 03:16:36 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hq4jwrsdn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 02 May 2018 03:16:36 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 May 2018 08:16:34 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 2 May 2018 08:16:30 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w427GU087209248; Wed, 2 May 2018 07:16:30 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96A1142041; Wed, 2 May 2018 08:07:42 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 315AE4203F; Wed, 2 May 2018 08:07:42 +0100 (BST) Received: from oc3784624756.ibm.com (unknown [9.152.212.113]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 2 May 2018 08:07:42 +0100 (BST) Subject: Re: [PATCH v2] inode: debugfs_create_dir uses mode permission from parent To: Kees Cook , Greg KH Cc: Kernel Hardening , brueckner@linux.vnet.ibm.com, Martin Schwidefsky , Heiko Carstens , LKML References: <20180427123547.15727-1-tmricht@linux.ibm.com> <20180427134936.GA31171@kroah.com> From: Thomas-Mich Richter Organization: IBM LTC Date: Wed, 2 May 2018 09:16:29 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18050207-0040-0000-0000-0000045405B5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050207-0041-0000-0000-000020F82425 Message-Id: <8d3e702b-470a-542e-4e0d-6a3c58419f0f@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-02_03:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805020073 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/27/2018 04:58 PM, Kees Cook wrote: > On Fri, Apr 27, 2018 at 6:49 AM, Greg KH wrote: >> I'm going to add Kees and the kernel-hardning list here, as I'd like >> their opinions for the patch below. >> >> Kees, do you have any problems with this patch? I know you worked on >> making debugfs more "secure" from non-root users, this should still keep >> the intial mount permissions all fine, right? Anything I'm not >> considering here? > > This appears correct to me. I'd like to see some stronger rationale > for why this is needed, just so I have a "design" to compare the > implementation against. :) > > Normally, the top-level directory permissions should block all the > subdirectories too. The only time I think of this being needed is if > someone is explicitly bind-mounting a subdirectory to another location > (e.g. Chrome OS does this for the i915 subdirectory). In that case, > I'd expect them to tweak permissions too. Thomas, what's your > use-case? > > -Kees > There is no 'real use case'. I wrote the patch because of discussions regarding file permissions for files located deeply in the directory tree, for example -r--r--r-- 1 root root 0 Apr 27 14:23 /sys/kernel/debug/kprobes/blacklist which gives the impression it is world readable. This happened to me in recent discussions when I wrote patches to fix some of the address randomized output of /sys files which broke the perf tool. During discussion people often forgot that the root /sys/kernel/debug is rwx for root only and blocks non root access to subdirectories and files. They simply looked at the file permissions. I have not thougth about the bind-mount case nor did I test this scenario. -- 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