From nobody Sat Apr 20 12:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559832883; cv=none; d=zoho.com; s=zohoarc; b=aHbysb/cDCnUYA/4Kk0KMls7PnC4JIN0O+TcFNtlNzE4sI9pRbYNwTqiNtEXWa2x1l4Cn3SoiLyTdU/gsGESuIQiquqa4caqh7feKhm+jw8Z/Alzt9KdPaFiIPFkm7igRLzN1mtFP9AzBKTRtJiuK+GjIoFYYiHcVoVMlJ3sTLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559832883; 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:ARC-Authentication-Results; bh=6Biwyo4UHZCPf6wkkUrQYzLotgaLt6qYYhU4rvaCm7A=; b=LFKkpuTtw5PGoy0FvBwjHs6MLV9Yuw9Z9ImlTQdaMd5khi1VBXzq0kgCibJ1IXDQ93b3rUnmUf1N9IZMVstszKzvS8BOZitNMG77HlZeykPbl62M8YajK9KBBaXRrbU4oCD6OVthILEIa/Wo2lk2KmeAFIzEJUakMS/SR7JJCZk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559832883044795.5207600458091; Thu, 6 Jun 2019 07:54:43 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hYtlJ-0000K6-Du; Thu, 06 Jun 2019 14:53:05 +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.89) (envelope-from ) id 1hYtlI-0000K1-9B for xen-devel@lists.xenproject.org; Thu, 06 Jun 2019 14:53:04 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c76f255c-886a-11e9-96f1-1bb4731b1534; Thu, 06 Jun 2019 14:53:01 +0000 (UTC) X-Inumbo-ID: c76f255c-886a-11e9-96f1-1bb4731b1534 Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=SoftFail smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: SoftFail (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com is inclined to not designate 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 include:spf.citrix.com include:spf2.citrix.com include:ironport.citrix.com exists:%{i}._spf.mta.salesforce.com ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: VJBci8yLgHLq7/lsdm+c/GuKKshgW2NjrMR3o2NCWJJnhXpQfkHlKmYSdRtWalos4qrothrFBR kmWWXwDl5GP5iTpUXoJ37ilYZA8UUZKvbEP4KwG3F9A9aFkIzONl074+B429slRRi8E0QbMYVS QaUqjnlAo8iSIAa4KxDAkLDokQXS7MmASYBCoJdeXYmp/cS/8Ttc2o26WjPeynIRG3uyWNxCOr OX8CbMbpTXwXDNARxWmwPrdPnOxOv+8rAR1lppfCtuzR3bMS/B8wgMiAsWIxMzsqFY8504kowe UL4= X-SBRS: -0.9 X-MesageID: 1413492 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,559,1557201600"; d="scan'208";a="1413492" From: Andrew Cooper To: Xen-devel Date: Thu, 6 Jun 2019 15:52:57 +0100 Message-ID: <1559832777-7818-1-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/pv: Fix undefined behaviour in check_descriptor() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" UBSAN reports: (XEN) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D (XEN) UBSAN: Undefined behaviour in x86_64/mm.c:1108:31 (XEN) left shift of 255 by 24 places cannot be represented in type 'int' (XEN) ----[ Xen-4.13-unstable x86_64 debug=3Dy Tainted: H ]---- (XEN) CPU: 60 (XEN) RIP: e008:[] ubsan.c#ubsan_epilogue+0xa/0xc2 (XEN) Xen call trace: (XEN) [] ubsan.c#ubsan_epilogue+0xa/0xc2 (XEN) [] __ubsan_handle_shift_out_of_bounds+0x15d/0x= 16c (XEN) [] check_descriptor+0x191/0x3dd (XEN) [] do_update_descriptor+0x7f/0x2b6 (XEN) [] compat_update_descriptor+0x1e/0x20 (XEN) [] pv_hypercall+0x87f/0xa6f (XEN) [] do_entry_int82+0x53/0x58 (XEN) [] entry_int82+0xbb/0xc0 (XEN) (XEN) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D Switch to an unsigned shift. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/x86_64/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index d8f558b..1721dcb 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -1105,7 +1105,7 @@ int check_descriptor(const struct domain *dom, seg_de= sc_t *d) * 0xf6800000. Extend these to allow access to the larger read= -only * M2P table available in 32on64 mode. */ - base =3D (b & (0xff << 24)) | ((b & 0xff) << 16) | (a >> 16); + base =3D (b & (0xffu << 24)) | ((b & 0xff) << 16) | (a >> 16); =20 limit =3D (b & 0xf0000) | (a & 0xffff); limit++; /* We add one because limit is inclusive. */ --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel