From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751661AbcFXSnL (ORCPT ); Fri, 24 Jun 2016 14:43:11 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33311 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751002AbcFXSnI (ORCPT ); Fri, 24 Jun 2016 14:43:08 -0400 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: stefanb@linux.vnet.ibm.com Subject: Re: [PATCH] tpm: vtpm_proxy: Introduce flag to prevent sysfs entries To: Jason Gunthorpe References: <1466779015-26965-1-git-send-email-stefanb@linux.vnet.ibm.com> <20160624174803.GA14506@obsidianresearch.com> Cc: tpmdd-devel@lists.sourceforge.net, jarkko.sakkinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org From: Stefan Berger Date: Fri, 24 Jun 2016 14:43:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160624174803.GA14506@obsidianresearch.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16062418-0024-0000-0000-000013F8A0AC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062418-0025-0000-0000-0000421E4794 Message-Id: <576D7F34.50201@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-24_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606240200 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/24/2016 01:48 PM, Jason Gunthorpe wrote: > On Fri, Jun 24, 2016 at 10:36:55AM -0400, Stefan Berger wrote: >> Introduce TPM_VTPM_PROXY_NO_SYSFS flag that prevents a vtpm_proxy driver >> instance from having the typical sysfs entries that shows the state of the >> TPM. The flag is to be set in the ioctl creating the vtpm_proxy device >> pair and maps on a new chip flags TPM_CHIP_FLAG_NO_SYSFS. > No other subsystem does something so goofy, this really needs to be > part of namespace support for TPM. And I am not sure how to go about this. TPM2 by the way doesn't have such entries, so it's much better from that perspective. > > Why can't you just make the sysfs files unreadable in user space? There are actually ways to go about this. Likely bind-mounting over /sys/device/virtual/tpm would be one solution to hide all virtual TPM device. Another is applying an AppArmor policy to the container denying access to tpm directories or entries. SELinux would not be so easy. The flag in this patch seemed like a 'cheap' way to eliminate that problem as well. > If a container can make them readable again can't it also just create > the chardev node? What do you mean by making them readable again? The chardev node can be created inside the container with the major and minor numbers as it was created with the ioctl. Stefan > > Jason >