From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796372647; b=jSGLzg/QQ9sIrjoM/rbHLuVl1vfUv/U6A2zTX5CwIfwFhRgs3ay3HSs56wkZhSnzIidf euyr6AMsH1jeJouIUtMWwGlBdNCPRdUrkw+AxclL4OpTovBEli5qZ3ZyuNYL23B8kaZke o67RiXmcPMaEfp0G0gcb2igXZ9NlLtiER7m7Y6jpqmqpEPp+GoUNH9t93y1JF/O4z2mBZ 2h1OO29txFtVgSyA4erVNmIgHs8gtMcCx/TuGcEVM0hxRZvblD94YC333lMD1ynlVM4is do2M2NbDFUe81oiN92L/2lRGBxAOMrnrqVH8LSL/fArwyMUqt/KOC3+kgo0Dz1C3AFQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796372647; h=Received:DKIM-Signature:X-Mailer:From:To:Cc:Subject:In-Reply-To: References:Date:Message-ID:MIME-Version:Content-Type; bh=OH/N8l4Sbw1FnAuOO1ph7BkCdKAgu8ip0aYy/L97KII=; b=3MC7Zp/l644Lqo0J92AWXYuyQdjeZ+68PVBabaFHRd5aRMEoVtIOJQimfAYfY4xg8pSe /KRyUT8WdysoVuGpZaeWSkhxS2rbaHBK6xR6Mq0/xLpMGFH4FKT2Tzlx5M7j0HGjl+Fep BKn53gsWruVrbpgLlrZfpFbknd4eE7pN8i7tjwriUxqMLvf8nTpcMD7EWQaocLz92bgbr bs5B2NWytRR6UoPc1ZL6KrJNG6oqxEiH25nPTBIZO65O3otrBAZazZprQKdcHsKauN/RC yhfpNbmjGDdeH5Zl4U1vFWtqUJ96vnFaK9Fkjrx5kfQPq6rj/5qMtcrRYVvkbfgAeRg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZzfFZU1q; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F122E606A33F; Fri, 4 Dec 2026 08:24:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZzfFZU1q Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F52A1F000C2; Fri, 4 Dec 2026 08:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796372646; bh=OH/N8l4Sbw1FnAuOO1ph7BkCdKAgu8ip0aYy/L97KII=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=ZzfFZU1q7IgV+ZNGaF4E5SqLgcvKi1LPgcD3+ewZqEju3bk+xqOkrsBCEB4Ba9uY+ GjIA9ZrpWfx8fhBcBCJS/OrD35M7BnyEmFFFIEXmEQo0bqVXdW/DGkTkrKb96Lz2tH qCvHiMHPp7MpL448nQC2le7bnWCOoVaoc8GYWcS62Zzs/F47N8qWtwueBRIEGo7wjh 811A7P2Wlg12dHn8fC8M7rWKUzRw6cZrLRUJY5cQbTuQUyu5C1CXEFE4RuljA1HcBK 5cVfGu2mbnfp0+NtvrO6ZxRLrRVDVjhWZtb5XNOxUuN1zu2OSg7xiwngqiZhcxCQEd IrRGe1JcKY0rw== X-Mailer: emacs 31.1 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Jiri Pirko , linux-coco@lists.linux.dev Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, jgg@ziepe.ca, david.quigley@intel.com, lukas@wunner.de, ksinyuk@kernel.org, rodrigo.vivi@intel.com, cedric.xing@intel.com, sameo@meta.com, drdeeglaze@gmail.com, James.Bottomley@HansenPartnership.com, aik@amd.com, jpiotrowski@nvidia.com, qinkun@google.com, pgonda@google.com, jic23@kernel.org, alistair.francis@wdc.com, ankita@nvidia.com, suzuki.poulose@arm.com, kas@kernel.org, rick.p.edgecombe@intel.com, elena.reshetova@intel.com, dave.hansen@linux.intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, peter.fang@intel.com, jarkko@kernel.org, zohar@linux.ibm.com, yeoreum.yun@arm.com, dave.jiang@intel.com, nik.borisov@suse.com, sergii.dmytruk@3mdeb.com Subject: Re: [PATCH RFC v2 15/15] tools/ctlv: Add ctlvctl In-Reply-To: <20261113155515.2510194-16-jiri@resnulli.us> References: <20261113155515.2510194-1-jiri@resnulli.us> <20261113155515.2510194-16-jiri@resnulli.us> Date: Fri, 04 Dec 2026 13:53:52 +0530 Message-ID: X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain Jiri Pirko writes: > From: Jiri Pirko > > Add a command-line client that discovers and queries any CTLV device, > with optional names from a specification directory. > [ ... 182 lines skipped ... ] > +In JSON, a blob is ``{"file": ""}``, passed as ``va`` memory. An input > +blob holds the file. An output blob is written to the file whole, so give it > +the ``"length"`` the operation writes; without one it starts at a byte and > +grows to each ``required-length`` the operation fails with, the operation > +being retried. An ``inout`` blob is read from the file and written back. > + [ ... 1376 lines skipped ... ] > +/* The device does not say how much it wrote, so a file gets the whole blob. */ > +static int blobs_save(const struct blob_files *blobs) > +{ > + unsigned int i; > + > + for (i = 0; i < blobs->count; i++) { > + const struct blob_file *blob = &blobs->files[i]; > + FILE *file; > + int ret = 0; > + > + if (blob->node->blob_direction == CTLV_BLOB_DIRECTION_INPUT) > + continue; > + file = fopen(blob->path, "we"); > + if (!file) > + ret = -errno; > + else if (fwrite(blob->data, 1, blob->len, file) != blob->len) > Should we limit this write to the length returned by evidence-get? IIUC, blob->len is the output buffer capacity, while evidence-get reports the actual evidence length in results.length. That can be smaller than blob->len > + ret = errno ? -errno : -EIO; > + if (file && fclose(file) && !ret) > + ret = errno ? -errno : -EIO; > + if (ret) { > + fprintf(stderr, "%s: %s: %s\n", prog, blob->path, > + strerror(-ret)); > + return ret; > + } > + } > + return 0; > +} > + -aneesh