From nobody Sat May 4 06:54:22 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1612453848; cv=none; d=zohomail.com; s=zohoarc; b=Afk2ANySCiKh7k/oHU3a5mPSEOewpLPhSJTvH2AEHsxm5hGhV4ySiXdlJGKNrjJ6pcfjd1voR0UavRZhzTzg2qek2vZncQT1s7gmt0DSGNhzicUbx/SqzjvB29/fgzc6DPenVARfjrsynfqe+khMQ+3N7C31XXXEQm0l2JhItUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612453848; 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=utvHbU/H8V5SHaGYS7pAAcrvNz5Xi82zfni6Fj0+kNQ=; b=NS092w/CKnRTly8k8ei8zJeTh0Ah8hZfy79LmNYFdj7mBVRoG3dJntVIuzi7HlXY97QCelErQBscfK/MsrKxjaJX3HfgJjmsEBtYPszMq4L2U0ThS8lGudbaTKMbiFpP/j6Wd2fobdgBRuYGZ6VbpdNgXDH2VjugkT62uJ1zCAs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612453848678279.26821364380055; Thu, 4 Feb 2021 07:50:48 -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-591-Ok5y5aFkOyaZCfErNYe_Uw-1; Thu, 04 Feb 2021 10:50:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF41D107ACF8; Thu, 4 Feb 2021 15:50:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30CB170483; Thu, 4 Feb 2021 15:50:38 +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 782404EBC6; Thu, 4 Feb 2021 15:50:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 114Fm81o010775 for ; Thu, 4 Feb 2021 10:48:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id BC09A1037AB; Thu, 4 Feb 2021 15:48:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6E9A10482B for ; Thu, 4 Feb 2021 15:48:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 91798858F15 for ; Thu, 4 Feb 2021 15:48:06 +0000 (UTC) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-YDB4acgfNX-r9GTxreVIHw-1; Thu, 04 Feb 2021 10:48:04 -0500 Received: by mail-lf1-f45.google.com with SMTP id h7so5215088lfc.6 for ; Thu, 04 Feb 2021 07:48:04 -0800 (PST) Received: from kloomba.my.domain ([5.227.218.122]) by smtp.gmail.com with ESMTPSA id a11sm618893lfi.197.2021.02.04.07.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 07:48:01 -0800 (PST) X-MC-Unique: Ok5y5aFkOyaZCfErNYe_Uw-1 X-MC-Unique: YDB4acgfNX-r9GTxreVIHw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=utvHbU/H8V5SHaGYS7pAAcrvNz5Xi82zfni6Fj0+kNQ=; b=Q1XfW8s8oupruIM/asSfTj5POYTZ2ySQ7Qpptgxd4TnQrMSiLak08RUeEWxTczQkjW 71pdARgy9GtD7VyOgCmOGmR8G8rIAY3nmEv8wZKcMXVxDq0pjPhyHcllsTsknCRXEuq2 9vNx/gc1vVWMzRBlUcFqfes3jmCaaagYK22ucUQVuVcYAOjEKFGoJuubU9rn5d4x5Ysb 0BOvRibVmoq2JOpQYj6xvzxL+u29hstdUbzO6NE6RiHKUF2esA2r6S2kbcKu3Qby36yA CILYa0P0rjId2yCkAYJtWDRdGx5lKuFageqwgwJA60gI/RYj2Tr+jh0c9GyixghJwRqx bgYw== X-Gm-Message-State: AOAM532BokQx9NDcRFTl+WP2V1OQIRW4e3MlnISltKaENBt9HCcPmnjP bOM7cJjaBIelwRYCa9YxNPajw1FhSA8NY7Al X-Google-Smtp-Source: ABdhPJzAswmPhrlcltY9p/rrGxcsnpaHQKLOfmC3dsTRHQmZLlRxRqC0ysxYuxTP3Vi1omfX9ZUGwg== X-Received: by 2002:a05:6512:50d:: with SMTP id o13mr2298lfb.527.1612453682639; Thu, 04 Feb 2021 07:48:02 -0800 (PST) From: Roman Bogorodskiy To: libvir-list@redhat.com Subject: [PATCH] bhyve: relax emulator binary value check Date: Thu, 4 Feb 2021 19:47:49 +0400 Message-Id: <20210204154749.76615-1-bogorodskiy@gmail.com> MIME-Version: 1.0 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 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Roman Bogorodskiy 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.11 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 Content-Type: text/plain; charset="utf-8" Currently, requesting domain capabilities fails when the specified emulator binary does not equal to "/usr/sbin/bhyve". Relax this check to allow any path with basename "bhyve", as it's a common case when binary is specified without an absolute path. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- I'm not sure how useful is this check in general: at this point we don't use the user specified emulator value anyway, just use BHYVE constant. Probably it would be better to just drop the entire "else" block? src/bhyve/bhyve_driver.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 78c3241293..277be8dbb0 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1647,11 +1647,14 @@ bhyveConnectGetDomainCapabilities(virConnectPtr con= n, =20 if (emulatorbin =3D=3D NULL) { emulatorbin =3D "/usr/sbin/bhyve"; - } else if (STRNEQ(emulatorbin, "/usr/sbin/bhyve")) { - virReportError(VIR_ERR_INVALID_ARG, - _("unknown emulator binary: %s"), - emulatorbin); - goto cleanup; + } else { + g_autofree char *emulatorbasename =3D g_path_get_basename(emulator= bin); + if (STRNEQ(emulatorbasename, "bhyve")) { + virReportError(VIR_ERR_INVALID_ARG, + _("unknown emulator binary: %s"), + emulatorbin); + goto cleanup; + } } =20 if (!(caps =3D virBhyveDomainCapsBuild(conn->privateData, emulatorbin, --=20 2.30.0