From nobody Thu May 2 04:14:45 2024 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; 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=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1625252649; cv=none; d=zohomail.com; s=zohoarc; b=ar2nrlXehaH1ztEmweTUZ1oQOWkAYfOCyoXR0osqk9drfmaVpSU9pf9+YS4+diQf5S3LqyFyMZZ3iCDbPmcgoWrFjg2kv3J9uKqlAoN/63dLb8/3seBp4YqTG2Z7B2TLyWiGiHbp17B2XBHly7BW0ntJdN2hTk1le0efT4OQwYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625252649; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=CWjHe7INuyRC7g1Av7K37AbIf+6Nfi8g9I/Vs0ePnRE=; b=ZhLJv0jqaiQ4v97Nt0nyXLJOfQE2DPSxmOovJvJjOpRaqHPqNL/hnMFkhuJmA0G/0VHa9j5oYLu4zIqD6+v/52X5WaMe50mtsEiFfzUfBWL5LIi8Fhb342gGXtdEkNOrdntuHURlLk9IglIu+z0j7g/395OpvgyTp8IRuukN/40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 162525264916144.18335145651315; Fri, 2 Jul 2021 12:04:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.149302.276046 (Exim 4.92) (envelope-from ) id 1lzOS4-0004bM-Vq; Fri, 02 Jul 2021 19:03:48 +0000 Received: by outflank-mailman (output) from mailman id 149302.276046; Fri, 02 Jul 2021 19:03:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lzOS4-0004bF-Sm; Fri, 02 Jul 2021 19:03:48 +0000 Received: by outflank-mailman (input) for mailman id 149302; Fri, 02 Jul 2021 19:03:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lzOS4-0004b9-9L for xen-devel@lists.xenproject.org; Fri, 02 Jul 2021 19:03:48 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c6e9edb3-9766-4be2-bc1d-fa69b044b748; Fri, 02 Jul 2021 19:03:47 +0000 (UTC) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c6e9edb3-9766-4be2-bc1d-fa69b044b748 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1625252627; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9SOX91f3hRKaTPe6o7t7fdvabRZeV3+jzwC4q2f8vfM=; b=bn69MBVXlWBsAm+FCU7jyg8GCjykMDEfQihg/+C26zyHbZcSmVB8tIq3 lAAHfeXfiAkMveYiW2ZDU54qQM0ubs82BsFf9xXFLZsHZHSor6/ZjeuTO /NkaO05AZyIebkEiDONwdno/GE1kLJqAPkcC8lZsrqSagbLztFEcOjwjn E=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: kZ7R2aNXK7xosx3lmuMrbGttPgNSIrQL4vk030p8lm94pJ0XiFcPJ5cnbqHXIgiYpJ1fRRzs1d Jn8CVj4R/RVg1LutiETFu30iA8dulbNCkvsRwxEMRBT0FG0/rUENVek2trmRLlyuPhaX+RPfKV sxau0udUq26yzxUNkVtKZhkrNLMuO4zDz+t4T2b13vRztdqxK6Oa3UUja4c1j6uU8cbBYT68rN IjX2CMRY5ovRksE//znyjRH3qVcfsLYatG7TLaKJREabVFFUFxwZSRd+HxRQzkfO3k8f8q5w2x 7A4= X-SBRS: 5.1 X-MesageID: 47863081 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:vmWBBK2BjUq/ipG/pBjcaQqjBLwkLtp133Aq2lEZdPRUGvb4qy nIpoV86faUskd3ZJhOo6HiBEDtexzhHP1OkO0s1NWZLWvbUQKTRekIh+aP/9SJIVyGygc378 ddmsZFZuEYdWIK6PrH3A== X-IronPort-AV: E=Sophos;i="5.83,319,1616472000"; d="scan'208";a="47863081" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Ian Jackson , Olaf Hering Subject: [PATCH] tools/libxenguest: Fix max_extd_leaf calculation for legacy restore Date: Fri, 2 Jul 2021 20:03:34 +0100 Message-ID: <20210702190334.31271-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1625252652075100001 0x1c is lower than any value which will actually be observed in p->extd.max_leaf, but higher than the logical 9 leaves worth of extended da= ta on Intel systems, causing x86_cpuid_copy_to_buffer() to fail with -ENOBUFS. Correct the calculation. The problem was first noticed in c/s 34990446ca9 "libxl: don't ignore the return value from xc_cpuid_apply_policy" but introduced earlier. Fixes: 34990446ca91 ("libxl: don't ignore the return value from xc_cpuid_ap= ply_policy") Reported-by: Olaf Hering Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Ian Jackson CC: Olaf Hering Olaf - as I've changed the fix, I haven't included your T-by tag, but I'm confident that this will suitably address the issue. --- tools/libs/guest/xg_cpuid_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x8= 6.c index e01d657e0394..0c9c4fefc1ef 100644 --- a/tools/libs/guest/xg_cpuid_x86.c +++ b/tools/libs/guest/xg_cpuid_x86.c @@ -513,7 +513,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t d= omid, bool restore, /* Clamp maximum leaves to the ones supported on 4.12. */ p->basic.max_leaf =3D min(p->basic.max_leaf, 0xdu); p->feat.max_subleaf =3D 0; - p->extd.max_leaf =3D min(p->extd.max_leaf, 0x1cu); + p->extd.max_leaf =3D min(p->extd.max_leaf, 0x8000001c); } =20 if ( featureset ) --=20 2.11.0