From nobody Sat Aug 19 08:27:12 2023 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RSX0q34ySz4qPtr for ; Sat, 19 Aug 2023 08:27:23 +0000 (UTC) (envelope-from meka@tilda.center) Received: from c3po.tilda.center (c3po.tilda.center [108.61.164.129]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4RSX0n6D00z4cKD for ; Sat, 19 Aug 2023 08:27:21 +0000 (UTC) (envelope-from meka@tilda.center) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tilda.center header.s=c3po header.b=HELV0+Wl; spf=pass (mx1.freebsd.org: domain of meka@tilda.center designates 108.61.164.129 as permitted sender) smtp.mailfrom=meka@tilda.center; dmarc=pass (policy=reject) header.from=tilda.center Received: from [192.168.111.193] (meka.rs [109.93.255.137]) by c3po.tilda.center (Postfix) with ESMTPSA id 4D9E522420 for ; Sat, 19 Aug 2023 10:24:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tilda.center; s=c3po; t=1692433492; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PoBG/t5BahbIj60nAog7iyN1n+jikQdkvrc1GB2JqGM=; b=HELV0+Wl8quuU2HuOrTFEIFtMP8R7vZeBuK7YmArRcm78HfTlcIbwHNcAm37VouxzRuVeC 4K58ylbD1eLpQnT7cKBXkizAPN2cWGDv4NvhuguD3xhSg3eDuKOAoWwJAEb7iugS7vCp7w Ngva9w7I8zIUTgQzXCU7qDoW2wSYYNU= Message-ID: <2d2f8c74-47d0-ebb1-154f-3aab68d8a084@tilda.center> Date: Sat, 19 Aug 2023 10:27:12 +0200 List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: Sudden need for bhyve TPM Emulation... willing to port swtpm? To: virtualization@freebsd.org References: <662af723-de9f-36d9-c960-ef08379ca26e@callfortesting.org> <1d4e6558-0c56-5758-d87e-e9bf4aacc0a5@tilda.center> <85ee3beda055c5bc9fae26c07247fe0cea1458e9.camel@FreeBSD.org> <2f1539fc-f8b2-2ec5-9c68-c60f68e66c0e@tilda.center> <2c1205c0fc48e8c6ac103d3f3ca0c722a7cd3c6e.camel@FreeBSD.org> <06ae27b6-7a38-ff73-8d9b-70b6be517ccc@tilda.center> <82499999351da778ffb9735f76ecc5d522305273.camel@FreeBSD.org> Content-Language: en-US From: =?UTF-8?Q?Goran_Meki=c4=87?= In-Reply-To: <82499999351da778ffb9735f76ecc5d522305273.camel@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-2.86 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.96)[-0.957]; DMARC_POLICY_ALLOW(-0.50)[tilda.center,reject]; R_DKIM_ALLOW(-0.20)[tilda.center:s=c3po]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; ONCE_RECEIVED(0.10)[]; TO_DN_NONE(0.00)[]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; ASN(0.00)[asn:20473, ipnet:108.61.164.0/22, country:US]; PREVIOUSLY_DELIVERED(0.00)[virtualization@freebsd.org]; RCVD_COUNT_ONE(0.00)[1]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MLMMJ_DEST(0.00)[virtualization@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[tilda.center:+]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Spamd-Bar: -- X-Rspamd-Queue-Id: 4RSX0n6D00z4cKD >> With updated port there's also support for CUSE, which would allow >> swtpm >> to be used with pass-through. The problem is that socket and CUSE >> have >> problems which I described in upstream issue: >> https://github.com/stefanberger/swtpm/issues/820. If there are any >> suggestions how to fix that fuse error, I'd like to hear them and try >> and fix it. >> >> Regards, >> meka Hello, I was wrong. Linux CUSE is extension of FUSE while FreeBSD CUSE has totally different implementation, so it can not be used by swtpm. As swtpm has control and server channels, I suppose we need both. To start both: # swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl type=unixio,path=/tmp/mytpm1/ctrl --tpm2 --log level=20 --server type=unixio,path=/tmp/mytpm1/server Now to initialize it one should run # swtpm_ioctl --unix /tmp/mytpm1/swtpm-sock -i If -i is replaced with --stop, swtpm is stopped. Now if I understand correctly, init function of bhyve should do -i, deinit should do --stop. If that's correct, I will start implementing init and for now ignore deinit. As swtpm is BSD licenced, I think it is OK for us to reuse parts of swtpm_ioctl code. Anyway, if I'm wrong about anything, please point it out. Regards, meka