From nobody Tue May 21 18:05:46 2024 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=fail(p=quarantine dis=none) header.from=swemel.ru ARC-Seal: i=1; a=rsa-sha256; t=1696852775; cv=none; d=zohomail.com; s=zohoarc; b=OI373LzMVfMrSCPswABDLOG+o8zKi5+VwhZ+nSKIaWqXUWvwTOv2dOpLttLhZIxn7AFO0BCB4sBQAS10VcDqP5zRuRgsOOO5oUhmQsIuXsxe2sltty1sw1Pcy66ZCZlaWiG8jYFESZVSx8/EFTQBtb9IDW64p/D5gp+zUH5NhJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696852775; h=Content-Type:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=aEi7CewhQ6jvVrQis+acOHlQdcluB4UVmb1+rd5Q1Ds=; b=Iiuwy7BghaA3AUfol1wFsAugGgbikmmnGrb3qksPMFaNomtaczKN8EfAvkFdbmEQ8LSUyRlEdVBWngDt7ipPZ7UafnqVnYUova47NODwjQtBK1Uyur5o0NCIVeYOZoe6Qt5km65TsoFYkiIxDMbIc5dkq8EMjqLss7/OH5uu63o= 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=fail header.from= (p=quarantine 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 1696852775186230.61985459281289; Mon, 9 Oct 2023 04:59:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-482-xq6udjtIPaS3Z0DUk6gnhw-1; Mon, 09 Oct 2023 07:59:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85F3C380673B; Mon, 9 Oct 2023 11:59:27 +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 D2551C0FE30; Mon, 9 Oct 2023 11:59:25 +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 56D2F19465A3; Mon, 9 Oct 2023 11:59:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EFC331946595 for ; Mon, 9 Oct 2023 11:59:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DE122215670B; Mon, 9 Oct 2023 11:59:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D61E1215671F for ; Mon, 9 Oct 2023 11:59:18 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D8D51C0758E for ; Mon, 9 Oct 2023 11:59:18 +0000 (UTC) Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-0y_OIHRjM0S1kaKb_expMg-1; Mon, 09 Oct 2023 07:59:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696852774; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=aEi7CewhQ6jvVrQis+acOHlQdcluB4UVmb1+rd5Q1Ds=; b=O/Keoqejjm477GFXms0UPUEAs32hTWHdR/aG6pLuHacoQGknx86sNSIqK5hW62/HpbWnxH SsrgLmeSDm+twhLQYhwXidqBuli860LE7w+a2aMyAjZP4qpln0HuWwvyflUR2nOI3iL6HB q6raG6IZUUhUBIF1Z7E7lSCg/Okc/kY= X-MC-Unique: xq6udjtIPaS3Z0DUk6gnhw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 0y_OIHRjM0S1kaKb_expMg-1 Message-ID: <8fc158de-4f38-7883-ef6a-49a05ad4dd48@swemel.ru> Date: Mon, 9 Oct 2023 14:59:11 +0300 MIME-Version: 1.0 Subject: Fwd: [PATCH v2] lxc: fix lxcContainerMountAllFS() DEREF_BEFORE_CHECK References: <20230907090456.563322-1-frolov@swemel.ru> To: libvir-list@redhat.com From: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0KTRgNC+0LvQvtCy?= In-Reply-To: <20230907090456.563322-1-frolov@swemel.ru> X-Forwarded-Message-Id: <20230907090456.563322-1-frolov@swemel.ru> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: swemel.ru Content-Type: multipart/alternative; boundary="------------IZcgKkPHxrobxScDwMnmKTYk" Content-Language: en-US X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696852777106100001 This is a multi-part message in MIME format. --------------IZcgKkPHxrobxScDwMnmKTYk Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format="flowed" ping. -------- =D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B0=D0=BF=D1=80=D0=B0=D0=B2=D0=BB= =D0=B5=D0=BD=D0=BD=D0=BE=D0=B5 =D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD= =D0=B8=D0=B5 -------- =D0=A2=D0=B5=D0=BC=D0=B0: [PATCH v2] lxc: fix lxcContainerMountAllFS() DER= EF_BEFORE_CHECK =D0=94=D0=B0=D1=82=D0=B0: Thu, 7 Sep 2023 12:04:57 +0300 =D0=9E=D1=82: Dmitry Frolov =D0=9A=D0=BE=D0=BC=D1=83: libvir-list@redhat.com =D0=9A=D0=BE=D0=BF=D0=B8=D1=8F: Dmitry Frolov vmDef->fss[i]->src->path may be NULL, so check is needed before passing it to VIR_DEBUG. Also removed checking vmDef->fss[i]->src for NULL, since it may not be NULL. Fixes: 57487085dc ("lxc: don't try to reference NULL when mounting=20 filesystems") Signed-off-by: Dmitry Frolov --- src/lxc/lxc_container.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 21220661f7..9601061b23 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1467,12 +1467,12 @@ static int lxcContainerMountAllFS(virDomainDef=20 *vmDef, if (STREQ(vmDef->fss[i]->dst, "/")) continue; - VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src->path,=20 vmDef->fss[i]->dst); + VIR_DEBUG("Mounting '%s' -> '%s'", NULLSTR(vmDef->fss[i]->src->path),=20 vmDef->fss[i]->dst); if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0) return -1; - if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path && + if (!(vmDef->fss[i]->src->path && STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) && lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0) return -1; --=20 2.34.1 --------------IZcgKkPHxrobxScDwMnmKTYk Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ping.

-------- =D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B0=D0=BF=D1=80=D0=B0=D0=B2= =D0=BB=D0=B5=D0=BD=D0=BD=D0=BE=D0=B5 =D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5= =D0=BD=D0=B8=D0=B5 --------
=D0= =A2=D0=B5=D0=BC=D0=B0: [PATCH v2] lxc: fix lxcContainerMountAllFS() DEREF_BEFORE_CHECK
=D0= =94=D0=B0=D1=82=D0=B0: Thu, 7 Sep 2023 12:04:57 +0300
=D0= =9E=D1=82: Dmitry Frolov <frolov@swemel.ru>
=D0= =9A=D0=BE=D0=BC=D1=83: libvir-list@redhat.com
=D0= =9A=D0=BE=D0=BF=D0=B8=D1=8F: Dmitry Frolov <frolov@swemel.ru>


vmDef->fss[i]->src->path may be NULL,
so check is needed before passing it to VIR_DEBUG.
Also removed checking vmDef->fss[i]->src for NULL, since it may not be NULL.

Fixes: 57487085dc ("lxc: don't try to reference NULL when mounting filesystems")

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
---
src/lxc/lxc_container.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 21220661f7..9601061b23 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1467,12 +1467,12 @@ static int lxcContainerMountAllFS(virDomainDef *vmDef,
if (STREQ(vmDef->fss[i]->dst, "/"))
continue;
- VIR_DEBUG("Mounting '%s' -> '%s'", vmDef->fss[i]->src->path, vmDef->fss[i]->dst);
+ VIR_DEBUG("Mounting '%s' -> '%s'", NULLSTR(vmDef->fss[i]->src->path), vmDef->fss[i]->dst);
if (lxcContainerResolveSymlinks(vmDef->fss[i], false) < 0)
return -1;
- if (!(vmDef->fss[i]->src && vmDef->fss[i]->src->path &&
+ if (!(vmDef->fss[i]->src->path &&
STRPREFIX(vmDef->fss[i]->src->path, vmDef->fss[i]->dst)) &&
lxcContainerUnmountSubtree(vmDef->fss[i]->dst, false) < 0)
return -1;
--=20
2.34.1

--------------IZcgKkPHxrobxScDwMnmKTYk--