From nobody Tue Feb 10 04:17:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=@amazon.de; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=amazon.de ARC-Seal: i=1; a=rsa-sha256; t=1614350592; cv=none; d=zohomail.com; s=zohoarc; b=mgEbLZ7jXwmTe1PCwJXxO15DgHebd51FNSna96d8DkZ211/ADTm8zNtppBv606483SHC0ACd24018xf4HjAzIVH2HAeMd+XhbkJ8rUz6kJpYZxroSjCNydO5PpjsUehULMKNmyIFyPIhtvC2WPx1K60mK+mgw829Hyu+edPtYZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614350592; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PoZZTY1JhoFNyUyWnPJ+qOgbzP4vOc+deh5S5ccFoAU=; b=KX22qJE7+OuR3qvvcqJDtamVuO9dN6oP+h1Y/Cv0uK6XYve15ezE3t2Xf1xfHhkXumYm/wDtiQJpP2yJcFRSZ58CnHZ3z5Jk+AtScvPQrFPL5Abykv8Vj1dHp8lilXey1v0TyNlN51qG9Vf6arTe3Ncdz4+Wi4VJr2d4iZDDR6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@amazon.de; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1614350592437582.9765346163647; Fri, 26 Feb 2021 06:43:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.90364.171040 (Exim 4.92) (envelope-from ) id 1lFeKa-0003qp-Dt; Fri, 26 Feb 2021 14:43:00 +0000 Received: by outflank-mailman (output) from mailman id 90364.171040; Fri, 26 Feb 2021 14:43:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFeKa-0003qf-Ab; Fri, 26 Feb 2021 14:43:00 +0000 Received: by outflank-mailman (input) for mailman id 90364; Fri, 26 Feb 2021 14:42:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFeKZ-0003Af-18 for xen-devel@lists.xenproject.org; Fri, 26 Feb 2021 14:42:59 +0000 Received: from smtp-fw-6001.amazon.com (unknown [52.95.48.154]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ad3255a7-ceb8-4214-be52-043c296c2896; Fri, 26 Feb 2021 14:42:50 +0000 (UTC) Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-c7131dcf.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 26 Feb 2021 14:42:49 +0000 Received: from EX13D37EUB002.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-c7131dcf.us-west-2.amazon.com (Postfix) with ESMTPS id EFEB6A21B1; Fri, 26 Feb 2021 14:42:48 +0000 (UTC) Received: from EX13MTAUEB002.ant.amazon.com (10.43.60.12) by EX13D37EUB002.ant.amazon.com (10.43.166.116) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 26 Feb 2021 14:42:47 +0000 Received: from u6fc700a6f3c650.ant.amazon.com (10.1.212.27) by mail-relay.amazon.com (10.43.60.234) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 26 Feb 2021 14:42:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Inumbo-ID: ad3255a7-ceb8-4214-be52-043c296c2896 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1614350570; x=1645886570; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=PoZZTY1JhoFNyUyWnPJ+qOgbzP4vOc+deh5S5ccFoAU=; b=al+WrVrFP/kMmEXS4N8LI45roAMxWvIcXsaBwsmFjrjToHum7nK8uxO8 7dPrZL1kfZkokl91OxBa7ts8XldulN7HkFzpxau+rDuKrcjAvkkILoNKJ gGlttY6/iKAcJlgFUMZicPgtyJ+UEiohRTlWJc+5zmbg2sef18GYV88Nn c=; X-IronPort-AV: E=Sophos;i="5.81,208,1610409600"; d="scan'208";a="92741617" From: Norbert Manthey To: CC: Ian Jackson , Juergen Gross , Wei Liu , Julien Grall , Michael Kurth , Norbert Manthey Subject: [PATCH XENSTORE v1 09/10] xs: handle daemon socket error Date: Fri, 26 Feb 2021 15:41:43 +0100 Message-ID: <20210226144144.9252-10-nmanthey@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210226144144.9252-1-nmanthey@amazon.de> References: <20210226144144.9252-1-nmanthey@amazon.de> MIME-Version: 1.0 Precedence: Bulk X-ZohoMail-DKIM: pass (identity @amazon.de) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When starting the daemon, we might see a NULL pointer instead of the path to the socket. Only relevant in case we start the process in a very deep directory path, with a length close to 4096 so that appending "/socket" would exceed the limit. Hence, such an error is unlikely, but should still be fixed to not result in a NULL pointer dereference. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Signed-off-by: Norbert Manthey Reviewed-by: Thomas Friebel Reviewed-by: Julien Grall Reviewed-by: Juergen Gross --- tools/libs/store/xs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c --- a/tools/libs/store/xs.c +++ b/tools/libs/store/xs.c @@ -240,6 +240,9 @@ static struct xs_handle *get_handle(const char *connect= _to) struct xs_handle *h =3D NULL; int saved_errno; =20 + if (!connect_to) + return NULL; + h =3D malloc(sizeof(*h)); if (h =3D=3D NULL) goto err; --=20 2.17.1 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879