From nobody Mon Apr 29 04:47:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1590479278; cv=none; d=zohomail.com; s=zohoarc; b=J2/+eAseBbhGiMenu626E3HKVtNy/jTlS2xL5/gq47ldZIHvWGj8P7oEugxcGnoxAqkFcNsmKUiherRTvv+EKUt38rV+hAzzpj+lHuRgIueJ/v8hR+h3CpM/kYBQ5YkiOJAbZJ/GmXnonwcLTLJ7PhfB+kemo5vTNFpyt27COfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590479278; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=zXw4nts5zhCDsM2m84Hdw0SxZtQIC6iODNGwNOsAaFs=; b=Z7hH6F9yvohC2LaeWfvW/Q+LkseJGtKZwAHJylrmD58AsZ7EAYCLNlsE0a++t+NBjJdmbp/57N9yTaiLFdDc8MSwH93uKYqkP/7pDLire0Spgu3ZCySzIUdcfak4/JupCSjRMSVHzO14/h7Ck+Zkw8PZNgqKe9jIisuSKLHjDCY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1590479278349189.15677929433753; Tue, 26 May 2020 00:47:58 -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-117-6mJsG53HO3Sc1PIPWXr1Fg-1; Tue, 26 May 2020 03:47:54 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8674835B42; Tue, 26 May 2020 07:47:49 +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 8F6316106A; Tue, 26 May 2020 07:47:49 +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 0B1DF1809543; Tue, 26 May 2020 07:47:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04Q7lkRb015668 for ; Tue, 26 May 2020 03:47:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BDD4202683D; Tue, 26 May 2020 07:47:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A4542026E1C for ; Tue, 26 May 2020 07:47:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BEDA800294 for ; Tue, 26 May 2020 07:47:44 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-ju5JbsG4NJqgXTOQPBav7Q-1; Tue, 26 May 2020 03:47:39 -0400 Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jdUJG-00079y-88; Tue, 26 May 2020 07:47:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590479277; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zXw4nts5zhCDsM2m84Hdw0SxZtQIC6iODNGwNOsAaFs=; b=JK/1TJtOGIUN6jz4PYzje5Gda/SLKFoS2M4/k+inj8ocbFu6bDB/R1I3GnMbuQMt6Z58kR xIcJmag1iqxG2MPVcOuDaDWm3K5sEE7NRkW4DNi9GHRGpfiXQ7hTXlo2SlMXYBltL+AxgQ 0QVAyZc398V/99C3ryX+ZAkj32M7H/4= X-MC-Unique: 6mJsG53HO3Sc1PIPWXr1Fg-1 X-MC-Unique: ju5JbsG4NJqgXTOQPBav7Q-1 From: Christian Ehrhardt To: libvir-list@redhat.com Subject: [PATCH] security: don't fail if built without attr support Date: Tue, 26 May 2020 09:47:30 +0200 Message-Id: <20200526074730.3490799-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Michal Privoznik , Christian Ehrhardt 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.12 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" If built without attr support removing any image will trigger qemuBlockRemoveImageMetadata (the one that emits the warning) -> qemuSecurityMoveImageMetadata -> virSecurityManagerMoveImageMetadata -> virSecurityDACMoveImageMetadata -> virSecurityDACMoveImageMetadataHelper -> virProcessRunInFork (spawns subprocess) -> virSecurityMoveRememberedLabel In there due to !HAVE_LIBATTR virFileGetXAttrQuiet will return ENOSYS and from there the chain will error out. That is wrong and looks like: libvirtd[6320]: internal error: child reported (status=3D125): libvirtd[6320]: Unable to remove disk metadata on vm testguest from /var/lib/uvtool/libvirt/images/testguest.qcow (disk target vda) This change makes virSecurityDACMoveImageMetadataHelper accept that error code gracefully and in that sense it is an extension of: 5214b2f1a3f "security: Don't skip label restore on file systems lacking XAT= TRs" which does the same for other call chains into the virFile*XAttr functions. Signed-off-by: Christian Ehrhardt Reviewed-by: Michal Privoznik --- src/security/security_dac.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index bdc2d7edf3..7b95a6f86d 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1117,6 +1117,12 @@ virSecurityDACMoveImageMetadataHelper(pid_t pid G_GN= UC_UNUSED, =20 ret =3D virSecurityMoveRememberedLabel(SECURITY_DAC_NAME, data->src, d= ata->dst); virSecurityManagerMetadataUnlock(data->mgr, &state); + + if (ret =3D=3D -2) { + /* Libvirt built without XATTRS */ + ret =3D 0; + } + return ret; } =20 --=20 2.26.0