Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp183584rdb; Fri, 29 Sep 2023 23:49:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfJsVKoDXap0wvMN/hUIzCQrLJrg6RG0IrXUiqinVqqFDPaWojbfRne5okq3fgH+P25sA5 X-Received: by 2002:ac8:7d03:0:b0:418:de43:93db with SMTP id g3-20020ac87d03000000b00418de4393dbmr7031444qtb.38.1696056550074; Fri, 29 Sep 2023 23:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696056550; cv=none; d=google.com; s=arc-20160816; b=qrwioAtE+z3mhUdxdFYrpCcAFbWvP55ul14N1k+5XLoKdszfPCEC5WVGTHpByhqSzk Ueaxq4sHMbRsnImgK6/g3YdmKrtYmOPxfQgaVeXM45/9Y0c5rMbBJXQrp5EcxkvvuiVQ uc+9cKHppbc7Rv72Zl1BATfxcmPUn5DRIBDg0lVdDJ2w76nxeECOsUHlmCqvIxvHC9yK 4t5TTB6cPmZ6YGqhPyQ6XUt9UFWIrxkRRqQIWpUtXvV/XCh8ocdxmC2DsrwSJqE6NcW+ IvhNGmjnHpZ/o6AcpMf+qTvzWHasNXX3L5x0kRwhUupURXOSjM9IkK80fTQ1/BNoq4fz w6nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XXvhzSWBYp8nSOLsXrlLAN9PXrzB34rCY+2SPSVkwJY=; fh=GGqNlvomORUVzWFdKQhPlrptb3KYKtOUfqGtIbjmD/8=; b=QFHSATMf7AZQdRdUwpqgp5pQyXIKClYZZpwC3aOl2v+uA3xO1wLIuGhnkGVAxA/eZ7 GIMk6Q+t7kEkMLWBET2zg8FC51w+IW7sbe5O7euVAKkUv4iJsGW9oVus3tC1XgIUuQWq 677rgX+yTts7vCeeKcseCkm378t1n1f7efBQpGQXtKvNnEfGg+/CuZ+Fv6iT3WFOCsCX XDTMoUhjybUilxT3BM31EDexHMS1+UYatLHvC7QEEN370OTLAZbGF/yexlkEu6mKjWvQ 7GK3/VZew/LzKqcCfaPQnkKlAV81V5FrDcubtV/fFCqeBe3XzQqEUieOlpwVmN8/Ud0+ Hw5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lPbui3hS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l63-20020a638842000000b00574006acf67si22874054pgd.17.2023.09.29.23.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 23:49:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lPbui3hS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 50BC480D6A36; Fri, 29 Sep 2023 23:47:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232155AbjI3GUz (ORCPT + 99 others); Sat, 30 Sep 2023 02:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjI3GUy (ORCPT ); Sat, 30 Sep 2023 02:20:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7410E1A7; Fri, 29 Sep 2023 23:20:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73349C433C7; Sat, 30 Sep 2023 06:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696054852; bh=YegthhuJUQjE8I3ZgOwiTP7mRlYp60Jw2QVs8hlYzb0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lPbui3hSWp5RMgU5g80OtG2U83WWfinhOHJMZyekdTalYgai3RnAAFyR6b6/Mijah lOdVqUphEVdsJMxohsqY94PKCFcObB1+Wm6j8DO9rquehs2Pnc/tK767E3PIHlQFws NduXwqhO6AWS/nyXhCGiFWbnZ8hY7zTtJC7JDXg0= Date: Sat, 30 Sep 2023 08:20:49 +0200 From: Greg Kroah-Hartman To: Alexander Graf Cc: Arnd Bergmann , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Herbert Xu , Olivia Mackall , Petre Eftime , Erdem Meydanlli , Benjamin Herrenschmidt , David Woodhouse , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo Subject: Re: [PATCH v2 1/2] misc: Add Nitro Secure Module driver Message-ID: <2023093054-swimming-whoopee-7ef8@gregkh> References: <20230929133320.74848-1-graf@amazon.com> <20230929133320.74848-2-graf@amazon.com> <74b2d869-0d96-46f9-a180-b405992e6c51@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 23:47:57 -0700 (PDT) On Fri, Sep 29, 2023 at 09:26:16PM +0200, Alexander Graf wrote: > Hi Arnd! > > On 29.09.23 19:28, Arnd Bergmann wrote: > > On Fri, Sep 29, 2023, at 09:33, Alexander Graf wrote: > > > When running Linux inside a Nitro Enclave, the hypervisor provides a > > > special virtio device called "NSM". This device has 2 main functions: > > > > > > 1) Provide attestation reports > > > 2) Modify PCR state > > > 3) Provide entropy > > > > > > This patch adds the core NSM driver that exposes a /dev/nsm device node > > > which user space can use to request attestation documents and influence > > > PCR states. A follow up patch will add a hwrng driver to feed its entropy > > > into the kernel. > > > > > > Originally-by: Petre Eftime > > > Signed-off-by: Alexander Graf > > Hi Alex, > > > > I've taken a first look at this driver and have some minor comments. > > > Thanks a bunch! > > > > The main point here is that I think we need to look at possible > > alternatives for the user space interface, and (if possible) change > > to a set of higher-level ioctl commands from the simple passthrough. > > > I'm slightly torn on that bit. I think in hindsight the NSM device probably > should have been a reserved vsock CID and the hwrng one should have just > been virtio-rng. > > The problem is that Nitro Enclaves were launched in 2020 and since an > ecosystem developed in multiple languages to support building code inside: > > https://github.com/aws/aws-nitro-enclaves-nsm-api/blob/main/src/driver/mod.rs#L66 > https://github.com/donkersgoed/aws-nsm-interface/blob/main/aws_nsm_interface/__init__.py#L264-L274 > ? https://github.com/hf/nsm/blob/main/nsm.go#L99-L129 > > > All of these use the (downstream) ioctl that this patch also implements. We > could change it, but instead of making it easier for user space to adapt the > device node, it would probably hurt more. > > I agree that this is not a great place to be in. This driver absolutely > should have been upstreamed 3 years ago. But I can't turn back time (yet) > :). As you know, this is no excuse to put an api in the kernel that isn't correct or good for the long-term. Just because people do foolish things outside of the kernel tree never means we have to accept them in our tree. Instead we can ask them to fix them properly as part of us taking the code. So please, work on doing this right. thanks, greg k-h