From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755385AbdEDR2c (ORCPT ); Thu, 4 May 2017 13:28:32 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47849 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752221AbdEDR2Y (ORCPT ); Thu, 4 May 2017 13:28:24 -0400 Subject: Re: [PATCH v3 1/3] tpm: vtpm_proxy: Implement new ioctl to get supported flags To: Jason Gunthorpe References: <1493909787-1848-1-git-send-email-stefanb@linux.vnet.ibm.com> <1493909787-1848-2-git-send-email-stefanb@linux.vnet.ibm.com> <20170504153416.GA15930@obsidianresearch.com> <56703d75-b238-0bad-386a-5b6963e250a1@linux.vnet.ibm.com> <20170504172042.GA19932@obsidianresearch.com> Cc: tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, jarkko.sakkinen@linux.intel.com, linux-kernel@vger.kernel.org From: Stefan Berger Date: Thu, 4 May 2017 13:28:17 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170504172042.GA19932@obsidianresearch.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17050417-0016-0000-0000-000006AD0175 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007021; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000209; SDB=6.00856223; UDB=6.00423842; IPR=6.00635388; BA=6.00005326; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015306; XFM=3.00000014; UTC=2017-05-04 17:28:20 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050417-0017-0000-0000-0000397CBD75 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-04_11:,, 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-1703280000 definitions=main-1705040259 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/04/2017 01:20 PM, Jason Gunthorpe wrote: > On Thu, May 04, 2017 at 01:13:18PM -0400, Stefan Berger wrote: >> On 05/04/2017 11:34 AM, Jason Gunthorpe wrote: >>> On Thu, May 04, 2017 at 10:56:25AM -0400, Stefan Berger wrote: >>>> Implement VTPM_PROXY_IOC_GET_SUPT_FLAGS ioctl to get the bitmask >>>> of flags that the vtpm_proxy driver supports in the >>>> VTPM_PROXY_IOC_NEW_DEV ioctl. This helps user space in deciding >>>> which flags to set in that ioctl. >>> you might be better off just having a VTPM_PROXY_IO_ENABLE_FEATURE >>> .feature = LOCALITY >> Do you have an example driver that shows how to do this ? Can user space >> query that feature? > Try and enable the feature, if it fails then there is no feature in > the kernel. > > This is the usual way to add new syscalls.. > >>> If that fails then the feature is not supported, no real need for the >>> query in that case. >>> >>> Not sure about Jarkko's point on request/release locality.. Is there a >>> scenario where the emulator should fail the request locality? >> We could filter localities 5 and higher on the level of the driver (patch >> 2/3) since basically there are only 5 localities (0-4) in any TPM interface >> today. The typical hardware locality 4 would be filtered by the emulator per >> policy passed via command line, but I would allow it on the level of this >> driver. An error message would be returned for any command executed in that >> locality, unless the 'policy' allows it. Localities 0-3 should just be >> selectable. The TPM TIS (in the hardware) implements some complicated scheme >> when it comes to allowing the selection of a locality and I would say we >> need none of that but just tell the vTPM proxy driver the locality (patch >> 2/3) in which the next command will be executed. > Well, if TIS hardware has some scheme I feel like the emulator uAPI should > have enough fidelity to ecompass existing hardware, even if your > current emulator does not need it. > > So allowing request_locality to fail from userspace seems reasonable. What's the best interface to use for this ?