From nobody Tue Feb 10 16:18:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1693259144; cv=none; d=zohomail.com; s=zohoarc; b=fq5GcZlBj+Oc9maetNIEYwyIpf2LKVdm12/q3V/JP0fNu2fiQ6NT69hAZMtStrXSwLrQBIk0UCog45zRKQcmqpoYGrQx7VA6WnxkOuKrYR/CcNrYTCblykNRoYrMw7rMuXLSZcPUiV4iAHAs6tpjKX5iF2cr+iur0OETr9C0SSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693259144; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9QfEW9cQFX2auPwFu2TxFTQzLbiuBk9u5C1MJi14hlU=; b=f1Z6NejGoUVlnxqUwh76V5T4lBr3ePBsTvxkyXHDJYltUlz45ws5vScwljn3hathSxq1c56KEH5e/wyMyBV/vrUNaQ/qh3Q0l7bY6bkBU29LswgoU9Sm5Zix2JMkT8LWbdQlXUUXRCL+3JYbsF5hUkKdqfPz5uKtyUnIyRk7wUA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1693259143929668.9235342014655; Mon, 28 Aug 2023 14:45:43 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-hIsdOzoiMMqrDBsrIfYejA-1; Mon, 28 Aug 2023 17:45:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85B95823E13; Mon, 28 Aug 2023 21:45:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70510112132D; Mon, 28 Aug 2023 21:45:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 71A4C19451C7; Mon, 28 Aug 2023 21:45:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 31E0519452C9 for ; Mon, 28 Aug 2023 21:45:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2292E140E964; Mon, 28 Aug 2023 21:45:16 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.17.242]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECAC5140E962; Mon, 28 Aug 2023 21:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693259142; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9QfEW9cQFX2auPwFu2TxFTQzLbiuBk9u5C1MJi14hlU=; b=iuxJh7goH7HOYiVn/sWW9k6JdRpP2kXNXVJhNniW5J2iZzE7UtrkhdqJ8/uQ8Zg/Cp6jnA yNgJQuEZk9XA0BTSQcapWpKP/bQqfI8/V9w023kzmWCzdI07WXWLuK/vEnLA6ojH6bvSZr 7wIXo/jCxuO1MhkaAH6l/rKtQ796nNE= X-MC-Unique: hIsdOzoiMMqrDBsrIfYejA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v7 18/35] util: secure erase virCommand send buffers Date: Mon, 28 Aug 2023 16:44:53 -0500 Message-ID: <20230828214510.903890-19-jjongsma@redhat.com> In-Reply-To: <20230828214510.903890-1-jjongsma@redhat.com> References: <20230828214510.903890-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Krempa Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693259145572100003 Content-Type: text/plain; charset="utf-8"; x-default="true" All users of virCommandSetSendBuffer() are using it to send sensitive data to a child process. So, since these buffers contain sensitive information, clear it with virSecureErase(). Signed-off-by: Jonathon Jongsma Reviewed-by: Peter Krempa --- src/util/vircommand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 5f094c625a..899d413dd2 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -54,6 +54,7 @@ #include "virpidfile.h" #include "virprocess.h" #include "virbuffer.h" +#include "virsecureerase.h" #include "virthread.h" #include "virstring.h" =20 @@ -1697,6 +1698,7 @@ virCommandFreeSendBuffers(virCommand *cmd) =20 for (i =3D 0; i < virCommandGetNumSendBuffers(cmd); i++) { VIR_FORCE_CLOSE(cmd->sendBuffers[i].fd); + virSecureErase(cmd->sendBuffers[i].buffer, cmd->sendBuffers[i].buf= len); VIR_FREE(cmd->sendBuffers[i].buffer); } VIR_FREE(cmd->sendBuffers); --=20 2.41.0