From nobody Sun Feb 8 11:22:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1604409238; cv=none; d=zohomail.com; s=zohoarc; b=Tn6ZZeBTdAGvq792tlnjkRzZPyNccWUAFb8kc38Eu0EQPt4Y9FWia4FXf+sI72zYIqAeY64W3KZIy7k7c4DREcQkuEZOi0VeXuBcgW1iA0tmus4F0IwjGz7neOkTy4NjnlpCbRKg0DJmasMDyJU4OnrzYywc804JgmwNYyJtsyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604409238; 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=7qW4S6J1YPlOkS234rAJUmz6FYJnJkPxesg5YgqnGKo=; b=djkt9Ep8+vQdyJG3N7B8/gpu0WyqQoCzbtDzPO06wCs0B3IlQMUy8z7OwH6oF2T/xgYkCv/U9AQ0TiwNHQZRPIh1UH32Kt5hKAd0xk2gBBHvNV6dqnvDGRy3oS1OeNEjdyF1xWto4cPB8BA3estLlp6tT1pgm3Q3GRYHCypvVDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1604409238860682.9296653252377; Tue, 3 Nov 2020 05:13:58 -0800 (PST) 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-213-gk-kAuiqO_SqXQL2wRX6hw-1; Tue, 03 Nov 2020 08:13:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 13FFB86ABCF; Tue, 3 Nov 2020 13:13: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 DDA051002C3E; Tue, 3 Nov 2020 13:13:48 +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 A0ABE1826D39; Tue, 3 Nov 2020 13:13:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3DDaAR020140 for ; Tue, 3 Nov 2020 08:13:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id E2D561002C29; Tue, 3 Nov 2020 13:13:36 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31BA61002C1F; Tue, 3 Nov 2020 13:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604409237; 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=7qW4S6J1YPlOkS234rAJUmz6FYJnJkPxesg5YgqnGKo=; b=PTr06S50ez8X+oAvK0vlFElADARGV8W1HVKc5zcRxLoBNNofDwmU4AegB6DvL1RBqrupiY ZFMnZY+D+VEj9VKYP0JQOviib+av/DF9fsI+L/uHouh3TaEmCrv56C2h9KOStXuW/JDaUD DPz3VXMMJpCMb9Y9K9CcHt02M4PlyiQ= X-MC-Unique: gk-kAuiqO_SqXQL2wRX6hw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] security_util: Don't error on macOS when getting/setting/moving XATTRs Date: Tue, 3 Nov 2020 14:13:26 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: r.bolshakov@yadro.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.84 on 10.5.11.22 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" There are three internal APIs implemented in this security_util file: virSecurityGetRememberedLabel(), virSecuritySetRememberedLabel() and virSecurityMoveRememberedLabel() for getting, setting and moving remembered seclabel. All three have a special return value of -2 when XATTRs are not supported (for whatever reason) and callers are expected to handle it gracefully. However, after my commit of v5.7.0-rc1~115 it may happen that one of the three functions returned -1 even though XATTRs are not supported (and thus -2 should have been returned). Fixes: 7cfb7aab573a031880a1f4fd20747843fea109ba Signed-off-by: Michal Privoznik Reviewed-by: Roman Bolshakov --- src/security/security_util.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/security/security_util.c b/src/security/security_util.c index 7fa5163fe4..622bd901ee 100644 --- a/src/security/security_util.c +++ b/src/security/security_util.c @@ -269,8 +269,11 @@ virSecurityGetRememberedLabel(const char *name, =20 *label =3D NULL; =20 - if (!(ref_name =3D virSecurityGetRefCountAttrName(name))) + if (!(ref_name =3D virSecurityGetRefCountAttrName(name))) { + if (errno =3D=3D ENOSYS) + return -2; return -1; + } =20 if (virFileGetXAttrQuiet(path, ref_name, &value) < 0) { if (errno =3D=3D ENOSYS || errno =3D=3D ENODATA || errno =3D=3D EN= OTSUP) @@ -364,8 +367,11 @@ virSecuritySetRememberedLabel(const char *name, g_autofree char *value =3D NULL; unsigned int refcount =3D 0; =20 - if (!(ref_name =3D virSecurityGetRefCountAttrName(name))) + if (!(ref_name =3D virSecurityGetRefCountAttrName(name))) { + if (errno =3D=3D ENOSYS) + return -2; return -1; + } =20 if (virFileGetXAttrQuiet(path, ref_name, &value) < 0) { if (errno =3D=3D ENOSYS || errno =3D=3D ENOTSUP) { @@ -452,8 +458,11 @@ virSecurityMoveRememberedLabel(const char *name, =20 if (!(ref_name =3D virSecurityGetRefCountAttrName(name)) || !(attr_name =3D virSecurityGetAttrName(name)) || - !(timestamp_name =3D virSecurityGetTimestampAttrName(name))) + !(timestamp_name =3D virSecurityGetTimestampAttrName(name))) { + if (errno =3D=3D ENOSYS) + return -2; return -1; + } =20 if (virFileGetXAttrQuiet(src, ref_name, &ref_value) < 0) { if (errno =3D=3D ENOSYS || errno =3D=3D ENOTSUP) { --=20 2.26.2