From nobody Tue Sep 9 19:04:48 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1753279367; cv=none; d=zohomail.com; s=zohoarc; b=lUzqTunMaYqL4c/xEqWykc5ONYbLVfueddCIe0cBWPhhXIxxqj8boC8TBX44bKUpbTwG5Y/Tu+kw7fkZrFrYLn+SlIB5tHfSVOU1KY75H/qY/uag8aLDgTmq5mYOaNML2FdWuPYX5yWgQ4og94A0bw2FFJsebmQFx+GpDweA/m8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753279367; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=SFYFFaeL7VQeM9P3bTayq9Iommj3VK43l5cY6UoDgX8=; b=hQnlSCexlKS2vH1lAsSRJJ8ml2IZ9JORgg7oiDCfdv558xGdON0ttR80Q8OA6jBlMzi8Wy3nvohtXn6hRfDUUh5orC5NyrqvIesKcaiRuaAKPbuKT9ZPV91V2Mfc3yKHyB4ZVfbJQ8CVF92Vy668rBVh7aSFO9ecjxpZl53hkc4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1753279367192499.47151420977923; Wed, 23 Jul 2025 07:02:47 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C2A6911C2; Wed, 23 Jul 2025 10:02:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9779A1375; Wed, 23 Jul 2025 10:00:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 912C9139E; Wed, 23 Jul 2025 10:00:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E735211B8 for ; Wed, 23 Jul 2025 10:00:21 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-EiDlQrRSPiaz_jae0b6XvQ-1; Wed, 23 Jul 2025 10:00:16 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 23B7D19560A2 for ; Wed, 23 Jul 2025 14:00:16 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 711841956063 for ; Wed, 23 Jul 2025 14:00:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753279221; h=from:from: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; bh=G9bjj5jkv1gk76Z3Y4/8J+ZKCCMP0fK7W0KZrQ2wTKE=; b=eV3XtTMfyNCPN2Tm4O2cSDV/PooLZ5d6Y/YmBD9s5Nqy8a5Nfj34/kRF5EeUm3cq4LKhVd KUqByXb2v43fK20fot9yCuo3rokfB1U56x3N3QSXp/ku8WHCgEv9V3xlbd3CkxJqMcVkcP ax45TWIO3wUq3MysNb8S1CwcjJ3vyzw= X-MC-Unique: EiDlQrRSPiaz_jae0b6XvQ-1 X-Mimecast-MFC-AGG-ID: EiDlQrRSPiaz_jae0b6XvQ_1753279216 To: devel@lists.libvirt.org Subject: [PATCH 4/5] security_apparmor: Drop needless checks for seclabel->model == "apparmor" Date: Wed, 23 Jul 2025 16:00:07 +0200 Message-ID: <0484a9cc0b5de0b0001c72e2658c00ab39d6c21d.1753279190.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: u85AFx_IspBaevFzfj9UCpjpE2Z8pICHjqAElvc85m8_1753279216 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6B2QFLERCACRB5D6BS6HONNKCGINT5WG X-Message-ID-Hash: 6B2QFLERCACRB5D6BS6HONNKCGINT5WG X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1753279368348116600 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik In few instances, after virDomainDefGetSecurityLabelDef(SECURITY_APPARMOR_NAME) was called, we take the returned secdef and compare secdef->model against SECURITY_APPARMOR_NAME. This makes no sense because virDomainDefGetSecurityLabelDef() has already done this comparison. Signed-off-by: Michal Privoznik --- src/security/security_apparmor.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index 40907c9364..c7412a76c0 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -520,14 +520,6 @@ AppArmorSetSecurityProcessLabel(virSecurityManager *mg= r G_GNUC_UNUSED, if ((profile_name =3D get_profile_name(def)) =3D=3D NULL) return -1; =20 - if (STRNEQ(SECURITY_APPARMOR_NAME, secdef->model)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: \'%1$s\' model c= onfigured for domain, but hypervisor driver is \'%2$s\'."), - secdef->model, SECURITY_APPARMOR_NAME); - if (use_apparmor() > 0) - return -1; - } - VIR_DEBUG("Changing AppArmor profile to %s", profile_name); if (aa_change_profile(profile_name) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -557,14 +549,6 @@ AppArmorSetSecurityChildProcessLabel(virSecurityManage= r *mgr G_GNUC_UNUSED, if (!secdef || !secdef->label) return 0; =20 - if (STRNEQ(SECURITY_APPARMOR_NAME, secdef->model)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: \'%1$s\' model c= onfigured for domain, but hypervisor driver is \'%2$s\'."), - secdef->model, SECURITY_APPARMOR_NAME); - if (use_apparmor() > 0) - return -1; - } - if ((profile_name =3D get_profile_name(def)) =3D=3D NULL) return -1; =20 --=20 2.49.1