From nobody Sun Feb 8 23:05:34 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=1623141937; cv=none; d=zohomail.com; s=zohoarc; b=eRvl4fu0levWHcc9QCp3jm8ks/wNsL69sVezETWYmmfxDKagwa2LMYN8y9mzx6y8/bh23NY7hVLKRvZpu5kLkJVoobP/c9ulzuarsGVGDzb9cdigX4YL0gwqvroIqB7X5h9Sk5tIy3IgZmF+EZh0npezYolxQg2VU6u932bxhO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623141937; 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=on6anguM57NoZaGmOJynOanhFCEmZfPdNhH6/xmYGok=; b=Q1o+XWXuXm4U40Os3HvPafC0IZTJccIZsQzTNM0i+K6is3auslXLYXsybR87db0l6dKwyQDjzH9EJVTSjAwqphc9EhSkmy3+//O5ihqYVrbzm+//CH0ingSw4fafSGisCxUrepTSHIWkV3qn84MTgVntLk7DxFmH2gfJPP1DNjA= 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) header.from= 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 1623141937267824.1957563254732; Tue, 8 Jun 2021 01:45:37 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-SGpykKgSOgG3EFvFxH-jyg-1; Tue, 08 Jun 2021 04:45:34 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96B45106BB29; Tue, 8 Jun 2021 08:45:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72DEF5D9E3; Tue, 8 Jun 2021 08:45:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 13F2F1801267; Tue, 8 Jun 2021 08:45:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1588jJct007059 for ; Tue, 8 Jun 2021 04:45:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 89D125D75A; Tue, 8 Jun 2021 08:45:19 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CE2B5D736 for ; Tue, 8 Jun 2021 08:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623141936; 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=on6anguM57NoZaGmOJynOanhFCEmZfPdNhH6/xmYGok=; b=IFJ1Q9Kg/v5mnR6TZX9Jv4cUccvQ5KIYyDvJZGtV391fXnI+xwLKO6PYkNmLB69VhxaLpj aGIK0MENGI8J09pchvNTgD+bXeEBVgRNQmvjgVUh5hJHL0MbXcjy0vEF4I1xv3RZglkSaA hKMKFUR3Tc5YvvIEBihoZEYHGuB4Xns= X-MC-Unique: SGpykKgSOgG3EFvFxH-jyg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/5] virt-host-validate: Call VIR_HOST_VALIDATE_FAILURE() more frequently Date: Tue, 8 Jun 2021 10:45:09 +0200 Message-Id: <19f14bfbf8180a49e5894ffb2bc127e78ceaaf18.1623141866.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Ideally, every virHostMsgFail() would be coupled with VIR_HOST_VALIDATE_FAILURE() so that the failure is correctly propagated to the caller. However, in virHostValidateSecureGuests() we are either ignoring @level and returning 0 directly (no error), or not returning at all, relying on 'return 0' at the end of the function. Neither of these help propagate failure correctly. Signed-off-by: Michal Privoznik --- tools/virt-host-validate-common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-c= ommon.c index 4482690b4b..9ec4e6f00b 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -467,7 +467,7 @@ int virHostValidateSecureGuests(const char *hvname, if (!virFileIsDir("/sys/firmware/uv")) { virHostMsgFail(level, "IBM Secure Execution not supported = by " "the currently used kernel"); - return 0; + return VIR_HOST_VALIDATE_FAILURE(level); } =20 /* we're prefix matching rather than equality matching here, b= ecause @@ -486,16 +486,18 @@ int virHostValidateSecureGuests(const char *hvname, "IBM Secure Execution appears to be disable= d " "in kernel. Add prot_virt=3D1 to kernel cmd= line " "arguments"); + return VIR_HOST_VALIDATE_FAILURE(level); } } else { virHostMsgFail(level, "Hardware or firmware does not provide " "support for IBM Secure Execution"); + return VIR_HOST_VALIDATE_FAILURE(level); } } else if (hasAMDSev) { if (virFileReadValueString(&mod_value, "/sys/module/kvm_amd/parame= ters/sev") < 0) { virHostMsgFail(level, "AMD Secure Encrypted Virtualization not= " "supported by the currently used kernel"= ); - return 0; + return VIR_HOST_VALIDATE_FAILURE(level); } =20 if (mod_value[0] !=3D '1') { @@ -503,7 +505,7 @@ int virHostValidateSecureGuests(const char *hvname, "AMD Secure Encrypted Virtualization appears to= be " "disabled in kernel. Add kvm_amd.sev=3D1 " "to the kernel cmdline arguments"); - return 0; + return VIR_HOST_VALIDATE_FAILURE(level); } =20 if (virFileExists("/dev/sev")) { @@ -513,6 +515,7 @@ int virHostValidateSecureGuests(const char *hvname, virHostMsgFail(level, "AMD Secure Encrypted Virtualization appears to= be " "disabled in firemare."); + return VIR_HOST_VALIDATE_FAILURE(level); } } else { virHostMsgFail(level, --=20 2.31.1