From nobody Sat Apr 27 02:17:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1602595971; cv=none; d=zohomail.com; s=zohoarc; b=CSo4IAUv6AcbQCYpxB/pXxtOzABPpvh+sokLpWU2NYwLXKTH87Nzr57yAKApHV9ME6pn25tITRlP4W//NLc+m7ph8YnTF6gfJCA4slni09J32F/r0BdkiDYU9bUeCTrrU9p65Ij1egf9dnHSLWfbwVT0H6z3wFMu3gHTy2ga0Do= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602595971; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=FdnurCc/eu4oIvzrkG188/G3rlmh4K0O2H9uGZ7J+io=; b=KPrZ5WMS4eR9hX0XNjOVN5XlQAXG+UgsCQdx08RZs7uai7TNdDyiP/p5qfogAXVg0NyLCMbA9SRKW+XPCN3LqsU+/uEPRrj7WHQibzuA8lklTtWdDV9MXpFY7PKoP/bGcANeHK1ryoBgP032RI7yaSIpit0CrrynVavLHMcmCKE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1602595971580853.9609755784469; Tue, 13 Oct 2020 06:32:51 -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-508-rOpHFzIKPJCWGjy5nebt3A-1; Tue, 13 Oct 2020 09:32:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A361E10E2187; Tue, 13 Oct 2020 13:32:41 +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 03E2427CC1; Tue, 13 Oct 2020 13:32:40 +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 13DCA58126; Tue, 13 Oct 2020 13:32:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09DDWbSP012061 for ; Tue, 13 Oct 2020 09:32:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1057B5C26C; Tue, 13 Oct 2020 13:32:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85B295C22B for ; Tue, 13 Oct 2020 13:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602595970; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FdnurCc/eu4oIvzrkG188/G3rlmh4K0O2H9uGZ7J+io=; b=ZBXVpcArH3wI7idV0pPyncC+QU/nhX88Hsz+8l1O+nFzVTqExAvX46gF1jBxWK2E+L/+3j GAx+GfjFwoaCzXlbenrep1qMN7xk55x1GqpCRYyocS6YXuyx/arCICYqCMIQzABr6dpSO8 fXfg+/OZqTKh5WRRTQ7QiKcS0EWMXZo= X-MC-Unique: rOpHFzIKPJCWGjy5nebt3A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu_slirp: Check if helper exists before fetching its capabilities Date: Tue, 13 Oct 2020 15:32:28 +0200 Message-Id: <7fc62bd552b7838a8cdf111fafae3011c585a1ca.1602595948.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.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.23 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" I've noticed when running libvirtd in the session mode that whenever I start a virtual machine the following error is printed into logs: error : cannot execute binary /usr/bin/slirp-helper: No such file or dire= ctory The error message is produced in qemuSlirpNewForHelper() which does attempt to be a NO-OP if the helper doesn't exist by checking if its path is NULL, but that's not usually the case because in the default config (in virQEMUDriverConfigNew()) its path is initialized to QEMU_SLIRP_HELPER. And while it is true that during configure we try to get the actual path of the helper we fallback to the path above if not found. Fix the check so that the function checks whether the helper exists and is executable. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/qemu/qemu_slirp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c index d2e4ed79be..4e5ab12727 100644 --- a/src/qemu/qemu_slirp.c +++ b/src/qemu/qemu_slirp.c @@ -101,7 +101,8 @@ qemuSlirpNewForHelper(const char *helper) virJSONValuePtr featuresJSON; size_t i, nfeatures; =20 - if (!helper) + if (!helper || + !virFileIsExecutable(helper)) return NULL; =20 slirp =3D qemuSlirpNew(); --=20 2.26.2