Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp984890rdg; Wed, 11 Oct 2023 10:47:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGu8OkZh0WdGf37YQeGusO3nU4LfL4QxVQ+o/S5KD9UCl4Ud6Ct30U4sBk9HXpkTF2clZH2 X-Received: by 2002:a17:902:e74d:b0:1c7:7c2c:f846 with SMTP id p13-20020a170902e74d00b001c77c2cf846mr26715540plf.67.1697046430157; Wed, 11 Oct 2023 10:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697046430; cv=none; d=google.com; s=arc-20160816; b=zgnvXfg0zktQcBmMTsL17K5aZatMq1MU9WR7T903pFyhYZ+WpC9vCoBn/0lsavb2cw GCU+TOxBiRSJl4fQhXP/5CuxfgIed1IUdJ+Ft1sTNeo3T8PX+k7qqHiu3InIkVAu87Qc bWGCYzm4TvgsNR333IwLv+0iH2A/yeDWnAxagGET7i413YXsjX+OIqbFNJSVB1WAQ223 D6ejF4Bcvf7HP/4epvisdX/Ota6phEngMP/+VQxnsm0tqp7ugcwaEXScZvhafIwRdh45 OXIBWvWq+OszR7kQgjkt4AP1gmYKcGYvKMAWI2VSdlF9UqQIzDpNsoKk0oFeZ4Ju94h6 iB2g== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RCzVP8UrYQZ76dN/UQ2LzJjDZi9ezwtlnt+AYwChpM0=; fh=oaqoPc2hdkJ0jEng5yfh93EDoRxSlromDx4//zTVK/E=; b=f+QiyVxDoheEx0L/q+TzQT8+QLLeP6z6A9WpIfrwmH2TUjGzqKsiXlwpmusOOzr+Fc t3o+Thh+TMn64jw1S5+XTrJQwoSYLFh77WtxtDoXcn4xB7ubE8OejhnTIjj0bBh4ahY1 GaUSA50Sb9/rAPztiQbCWhKmeqihQN9pI+eZe4KXKdp8TPA9V99rYvS+IuHgYyWJiYXm GbTGQ8wp3EW+llzLWi1uKf4g+2n8gafGvVfCS5CtSuc4HTTwmRAFuCIptfvsPnoC/mpS 2E2V5ApSD1ZADsXNb4iro3SVQrrE8JfC8Tdyzbijr0LDZvlA/tdusaI501fR06JCzcoX HkRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lFTcfO13; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l5-20020a170903120500b001bb324569efsi203593plh.364.2023.10.11.10.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 10:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lFTcfO13; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-crypto-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 snail.vger.email (Postfix) with ESMTP id D97B38030297; Wed, 11 Oct 2023 10:46:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232952AbjJKRqj (ORCPT + 99 others); Wed, 11 Oct 2023 13:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232988AbjJKRqh (ORCPT ); Wed, 11 Oct 2023 13:46:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7297BB0; Wed, 11 Oct 2023 10:46:36 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E20AC433C7; Wed, 11 Oct 2023 17:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697046396; bh=/307fLip+mEBKfJijXaHEHz5w4xTiJRdHKRxGg5HNUE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lFTcfO13XmNGsmpaWpyxKul+lYgI9+Xk+PoDKht/5kqCTCWV51Rve3aYf9VHeHSw5 nx+/CVKUljzH/IkDR4NBoUqP2dJFH3swqIgfrBttjdBs32TF167hUPplXB2qoZba9C cJG+cSgACCNwZTOoKmuqlaMc+5qnj8iN1Ie55dKM= Date: Wed, 11 Oct 2023 19:46:32 +0200 From: Greg Kroah-Hartman To: Arnd Bergmann Cc: Alexander Graf , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Herbert Xu , Olivia Mackall , Petre Eftime , Erdem Meydanlli , Benjamin Herrenschmidt , David Woodhouse , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Kyunghwan Kwon Subject: Re: [PATCH v4 1/2] Import CBOR library Message-ID: <2023101156-helper-waving-09df@gregkh> References: <20231009212053.2007-1-graf@amazon.com> <20231009212053.2007-2-graf@amazon.com> <2023101010-overwrite-parakeet-91d5@gregkh> <0ee221bc-ea99-4724-9ebd-436e91417e4b@amazon.com> <2023101009-accustom-manifesto-8bdb@gregkh> <2023101001-ocelot-veteran-10db@gregkh> <2339287b-8b17-413b-aa86-f618ea7fc3fa@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2339287b-8b17-413b-aa86-f618ea7fc3fa@app.fastmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 10:46:41 -0700 (PDT) On Wed, Oct 11, 2023 at 02:24:48PM +0200, Arnd Bergmann wrote: > On Tue, Oct 10, 2023, at 10:27, Greg Kroah-Hartman wrote: > > On Tue, Oct 10, 2023 at 10:08:43AM +0200, Alexander Graf wrote: > >> On 10.10.23 10:03, Greg Kroah-Hartman wrote: > >> > >> > > Out of these, the NSM communication protocol uses all except Semantic tags > >> > > and Floats. The CBOR library that this patch imports does not have special > >> > > handling for Semantic tags, which leaves only floats which are already > >> > > #ifdef'ed out. That means there is not much to trim. > >> > > > >> > > What you see here is what's needed to parse CBOR in kernel - if that's what > >> > > we want to do. I'm happy to rip it out again and make it a pure user space > >> > > problem to do CBOR :). > >> > Yes, why are we parsing this in the kernel? What could go wrong with > >> > adding yet-another-parser in privileged context? :) > >> > > >> > Why does this have to be in the kernel, the data sent/recieved is over > >> > virtio, so why does the kernel have to parse it? I couldn't figure that > >> > out from the driver, yet the driver seems to have a lot of hard-coded > >> > parsing logic in it to assume specific message formats? > >> > >> > >> The parsing doesn't have to be in kernel and it probably shouldn't be > >> either. V3 of the patch was punting all the parsing to user space, at which > >> point you and Arnd said I should give it a try to do the protocol parsing in > >> kernel space instead. That's why the parser is here. > > > > Arnd said that, not me :) > > > >> If we conclude that all this in-kernel parsing is not worth it, I'm very > >> happy to just go back to the the v3 ioctl interface and post v5 with hwrng > >> merged into misc, but remove all CBOR logic again :) > > > > I think the less parsers we have in the kernel, the safer we are for > > obvious reasons. Unless you have a parser for this in rust? :) > > > > I don't really know, having a generic interface is good, but at the > > expense of this api is probably not good. individual ioctls might be > > better if there are not going to be any other drivers for this type of > > thing? > > I was definitely expecting something simpler than what was possible > in the v4 patch. I had another look now, and it's clear that the > ioctl interface is still not great because the variable data structures > shine through for some of the calls, and even to get to this point, > a whole lot of complexity is required underneath. > > To get anything better, one would probably have to redesign the entire > interface stack (hypervisor, kernel and userland) to use regular > fixed data structures, and this seems unlikely to happen. Why not fix this and do it properly? What's preventing that from happening? We don't want to create an interface here that is broken, or insecure, or a pain to maintain, right? thanks, greg k-h