From nobody Mon Feb 9 11:28:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1670841139; cv=none; d=zohomail.com; s=zohoarc; b=eF+8qjPbwwORVlBDZ0T2fR0v6FdLO9kUbSERMDzoNU+EvmNHRXsyTIKYQiaDJrCR1zz5jPTD66IisRjgCJz7HiZlP2WSq+Ui4l/A2xEyFFPXPI0Jho4wR07oVGENo6h3rr0m+u8K9JjAQTn9lVJnxdV+sNpt94MuChERWRFVEEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670841139; h=Content-Type:Content-Transfer-Encoding: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=hGtCJM9QtdHYG+NU+M77SIgLwyydQ8KPIF35Jg7j0TI=; b=i/+Gfw2APfYQrlABrbACXtEx9Spt27R3QHQRvRZlTzufxpptE+ILYY6ymlKLlttz2gtNjCN7dmxu50YkCbxWGqUZRqhuD8UXRvq9woiwHN/wJBtIMp+m89YgZ3eHFq2SzlIbM9ev+cSuimLEhjhh0kkwb9VpEKgqWMyPkcudk5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1670841139309122.01076024314705; Mon, 12 Dec 2022 02:32:19 -0800 (PST) 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-516-vU3-GVhANB2y-cK3BSW3TQ-1; Mon, 12 Dec 2022 05:32:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F868101A5BB; Mon, 12 Dec 2022 10:32:13 +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 1AEA117595; Mon, 12 Dec 2022 10:32:13 +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 E13A119465B8; Mon, 12 Dec 2022 10:32:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 816A91946588 for ; Mon, 12 Dec 2022 10:32:09 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 61AD41759F; Mon, 12 Dec 2022 10:32:09 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 461D351EF; Mon, 12 Dec 2022 10:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670841137; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hGtCJM9QtdHYG+NU+M77SIgLwyydQ8KPIF35Jg7j0TI=; b=isXZsMTze3hHdBoIhdkp+Lrg8HwP2tNVoKJSQqU6+LYeLS1yqsSCOKIChnLQzG3w0Zq7u5 5KPk2rkRV9VRsq+w06JUEIg3tKzRhVo3xQ2IIoLrBQaUcvEOFrJJwq1PGOXfMZjBJWmjWN OdpXOChILL8WQaemOSmKf5ikdWrDLb0= X-MC-Unique: vU3-GVhANB2y-cK3BSW3TQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] util: implement secure erase with explicit_bzero Date: Mon, 12 Dec 2022 05:32:06 -0500 Message-Id: <20221212103208.531717-2-berrange@redhat.com> In-Reply-To: <20221212103208.531717-1-berrange@redhat.com> References: <20221212103208.531717-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1670841141967100002 This is available on at least FreeBSD and GLibc >=3D 2.25. Signed-off-by: Daniel P. Berrang=C3=A9 --- meson.build | 1 + src/util/virsecureerase.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/meson.build b/meson.build index f9834a36c2..553d4328d0 100644 --- a/meson.build +++ b/meson.build @@ -537,6 +537,7 @@ libvirt_export_dynamic =3D cc.first_supported_link_argu= ment([ =20 functions =3D [ 'elf_aux_info', + 'explicit_bzero', 'fallocate', 'getauxval', 'getegid', diff --git a/src/util/virsecureerase.c b/src/util/virsecureerase.c index ead12803da..00542da99d 100644 --- a/src/util/virsecureerase.c +++ b/src/util/virsecureerase.c @@ -19,6 +19,8 @@ =20 #include =20 +#include + #include "virsecureerase.h" =20 /** @@ -40,7 +42,11 @@ virSecureErase(void *ptr, if (!ptr || size =3D=3D 0) return; =20 +#ifdef WITH_EXPLICIT_BZERO + explicit_bzero(ptr, size); +#else memset(ptr, 0, size); +#endif } =20 /** --=20 2.38.1