From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9807BC4338F for ; Fri, 30 Jul 2021 01:24:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 766976101C for ; Fri, 30 Jul 2021 01:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233896AbhG3BYF (ORCPT ); Thu, 29 Jul 2021 21:24:05 -0400 Received: from mga04.intel.com ([192.55.52.120]:12648 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233516AbhG3BYE (ORCPT ); Thu, 29 Jul 2021 21:24:04 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="211124662" X-IronPort-AV: E=Sophos;i="5.84,280,1620716400"; d="scan'208";a="211124662" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2021 18:23:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,280,1620716400"; d="scan'208";a="417819686" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga006.jf.intel.com with ESMTP; 29 Jul 2021 18:23:59 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 29 Jul 2021 18:23:59 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 29 Jul 2021 18:23:58 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Thu, 29 Jul 2021 18:23:58 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Thu, 29 Jul 2021 18:23:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EOO0dB/2RKEAC7/N7qY3HynSBdN79CfY83LMwGYx6B4aEQmUnz72Dt9V73Xeox77CObXktsKJFKQ2OX4a57oJmb8cGnzTANXU+J7pzvloSOIcGOc82PYn5M7cvUCeRe+d9sx9JwB6yOOpYdfLpq7QXRl00LY+j25H55HfRrHJdjTZ295oL4cXqSHRQEhPcj9YvREkmryOG2mmIRXKTSMXShZqHKlW6gxECw8BwyaBgzrpeFMgBMAD8lPcY987pXGDxEgQjELokb86satRZbq5zNjEPPpguQkpwGbyIPlWVtMy8k8WhzaFUJnt12iU2Ppbj1I0XqH8zJU51OqoyVcvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ycIn7MFkBzD1XL9ZesNb9qeAtFzOGjG9gH+jHkMAmhI=; b=Ds3pvjI6teOqfT7DnUl7XajbeLEms5w649Sh3D1kin2Q4V4XkKi+0Dy+EXrmGmpR8B3LVKHGaWcCEL0lHc1zENcYUYHeYfhiDQkyFGy1XKc4uVzwWHeKlDH+BqbhH8fu6lcDcNfVZwmQQVgI37BN5nlvFk0CijTLqpcGUBpm8d9OWNM48pB72ArskLiiTmxrJxZ7k0FdWHWFXDbs9260xiGjyzTMHdalBkG9XQDR9HllxodOwl66VfsuK/7D8Q6T4nkk0IEXBGlqydLH5sx581mwzs07jG2Ah3JbqdKTbEZahOgqJnGW9FmDYC1msFnc7zwp6LXC5CgUMRXqohgR1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ycIn7MFkBzD1XL9ZesNb9qeAtFzOGjG9gH+jHkMAmhI=; b=qrZ+/Y1/Ri94r3c4YYI7ssYl4A5s5Wl0gn6/mZsIJo6G4VZTHpnzvRZp/VUk80gQzppPQjBLgfkI2nZ+biBxFWC5ttFwY4QaCjNgyncP6gs8PgpL7NCEpVbTLs49yM1bkFqd65lyDKrkPGij1rRplzcckJuBXg+SJ2lU2S7HARs= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=intel.com; Received: from SA2PR11MB5163.namprd11.prod.outlook.com (2603:10b6:806:113::20) by SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Fri, 30 Jul 2021 01:23:16 +0000 Received: from SA2PR11MB5163.namprd11.prod.outlook.com ([fe80::51db:698d:e2e3:7fc8]) by SA2PR11MB5163.namprd11.prod.outlook.com ([fe80::51db:698d:e2e3:7fc8%4]) with mapi id 15.20.4373.022; Fri, 30 Jul 2021 01:23:16 +0000 From: Russ Weight Subject: Re: [PATCH 02/12] fpga: sec-mgr: enable secure updates To: Greg KH , Tom Rix CC: Moritz Fischer , , References: <20210517023200.52707-1-mdf@kernel.org> <20210517023200.52707-3-mdf@kernel.org> <5d0552ce-d2bd-cca1-006e-8f11991fd378@intel.com> Message-ID: Date: Thu, 29 Jul 2021 18:23:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 In-Reply-To: <5d0552ce-d2bd-cca1-006e-8f11991fd378@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-ClientProxiedBy: MWHPR22CA0011.namprd22.prod.outlook.com (2603:10b6:300:ef::21) To SA2PR11MB5163.namprd11.prod.outlook.com (2603:10b6:806:113::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.0.2.4] (50.43.42.212) by MWHPR22CA0011.namprd22.prod.outlook.com (2603:10b6:300:ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17 via Frontend Transport; Fri, 30 Jul 2021 01:23:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 996f2647-33f5-4004-4d1a-08d952f89b9c X-MS-TrafficTypeDiagnostic: SN6PR11MB3504: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5uv2GmqwJAWOkSL4lsvY08yIx8eMqIrFV01SG1gNzJgQwxDY7SHEV/a+Wq1x0OITPCycY8y2xa5UK7QJCgoWW4asl+uOJd76wGH8mvGTdyMvIrFnUo3QAfMQR7mpGaIkhdGeclzu6/EemkrT+l7EjixnIf0ZXwgOxz7M3XNIZP24KMi9U57yqNgcMsws79oAuk1fd56JJwd4QXdULZmNA+k4XFjf8exRv204ZHO1oxR3gsB1WA8tLncxZPu4AOR0g/XMd+Ioubn+GRDCw3WcwboJK9FQQT/RiWUwOt+Kxai2wzPe/iMG3xogPcmzzz/0EWHLQgn/hyEW6iAqqL9jB5MBS4RqmgEQaybueLASYWy+CvnH5O/IsKJNJSGB6wWrWI194sSM3rzcY+iPU3hVhjyJSC7XEoW3BbUwqFVQfHdeRbxDYNczx/trv9IujHnpC7OdzKDb/AX6APyEYk0GH5CwDYwTQvP0yfey/1/Jm6l1QHJHpeDhfvap7LVP6YpGkaQLYqov/sWY1e1P+3jry7JtAQ0Ewg/MGcObQLbD9wOiBwZgw+rmOgaKpM7lPH6k256o4aWoVSlqvRy2o3NYMCFMrp9wrm7wKOU9y5/aOgiZl+wQYyIE7K/wrXpuzYpFT7QY9Z3eCSrqAIRKSxfMOiqXkr9yfG1UErX6wTBMm0NPWNjGCfZkIRf5quBsq4+W3aPwg9jlHydFA2NatNydE1j9JaZ77P4ljDaiuKTiKEw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA2PR11MB5163.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(346002)(366004)(376002)(39860400002)(8676002)(6486002)(316002)(8936002)(31686004)(478600001)(16576012)(66556008)(38100700002)(4326008)(66476007)(66946007)(6666004)(110136005)(53546011)(15650500001)(2616005)(956004)(36756003)(2906002)(31696002)(186003)(86362001)(5660300002)(26005)(83380400001)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exch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RCrJHgjJVoEED+Sah2+WJjRBUC/t48d4hmYeZL?= X-MS-Exchange-CrossTenant-Network-Message-Id: 996f2647-33f5-4004-4d1a-08d952f89b9c X-MS-Exchange-CrossTenant-AuthSource: SA2PR11MB5163.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2021 01:23:16.7855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: D09uWMtwNr5O5HL/GIRl3F4aTYkQAKD+tMzOKeXUKnqBQTwRn/M5HVC6cEHQ3CJyP0CfVLY3Rr5Buz26DueahogHxNeGZtrKRJOxk3rrr/4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3504 X-OriginatorOrg: intel.com Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org On 5/17/21 12:37 PM, Russ Weight wrote: > On 5/16/21 10:32 PM, Greg KH wrote: >> On Sun, May 16, 2021 at 07:31:50PM -0700, Moritz Fischer wrote: >>> From: Russ Weight >>> >>> Extend the FPGA Security Manager class driver to >>> include an update/filename sysfs node that can be used >>> to initiate a secure update. The filename of a secure >>> update file (BMC image, FPGA image, Root Entry Hash image, >>> or Code Signing Key cancellation image) can be written to >>> this sysfs entry to cause a secure update to occur. >> Why is userspace responsible for triggering this? Passing a "filename" >> into the kernel and having it do something with it is ripe for major >> problems, please do not. >> > I am using the "request_firmware" framework, which accepts a filename > and finds the firmware file under /lib/firmware. > > Is this not an acceptable use for request_firmware? > > - Russ Hi Greg, The dev_release fixes that you asked for in the FPGA Manager, Bridge, and Region code are almost complete. I'm trying to get back to the FPGA security manager patch set. Your previous comments challenged some basic assumptions. If it is OK, I would like to get some clarity before I rework the patches. Overview: The goal is to pass signed data to the PCIe FPGA Card's BMC. BMC firmware will authenticate the data and disposition it. In our case, FPGA image data, root entry hashes, and cancellation keys are authenticated and then stored in FLASH memory. The patchset contains both a class driver and a platform driver. Example Output of Current Driver:         [root@psera2-dell24 update]# echo -n intel/dcp_2_0_page0_0x2020002000000237_signed.bin > filename         [root@psera2-dell24 update]# while :; do cat status remaining_size ; sleep 3; done         preparing         8094720         <- snip ->         writing         8012800         <- snip ->         programming         0         <- snip ->         programming         0         <- snip ->         idle         0         ^C         [root@psera2-dell24 update]# cat error         [root@psera2-dell24 update]# Assumptions: (1) request_firmware(). We had assumed that making use of the existing request_firmware() would be preferred. This requires providing a filename under /lib/firmware to the framework. You commented (above): "Passing a 'filename' into the kernel and having it do something with it is ripe for problems, please do not." Unless you have additional comments on this, I will plan to NOT use the request_firmware framework. (2) sysfs interface. We had assumed that a sysfs interface would be preferred. If I am not passing a filename, then I think my only option with sysfs is to use a binary attribute and cat the data in. Is that acceptable, or would it be better to use IOCTLs to pass the data? (3) Platform Driver. This driver is for the BMC on the FPGA Card. I think that is similar to the SOC model. This is actually a sub-driver for the MAX10 BMC driver. Other platform drivers (e.g. hwmon) have already been accepted as subdrivers for the BMC. Is the platform driver the right approach? If not, can you please point me in the right direction? (4) Kernel worker thread: The worst case update is currently about 45 minutes (newer implementations are shorter). We chose to do the data transfer in a kernel worker thread and then make it possible for userspace to monitor the progress (currently via sysfs). Any concerns about doing the transfer in a background thread? (5) New vs modified driver: Perhaps "FPGA Security Manager" is not a good name. Simply put, the driver passes signed data from the host to the Card BMC for authentication and disposition. I looked at merging the class driver with the FPGA Manager, but: a) Secure updates make no use of the existing FPGA Manager code (FPGA state management, etc). The only similarity is in the ops data structure. b) Because of the kernel worker thread the driver remove functionality adds complexity that is not helpful to the FPGA Manager. I can, of course, combine the drivers anyway if you think that is better. I appreciate any feedback/direction you can give. Thanks, - Russ