From patchwork Wed Oct 25 09:27:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 117040 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp628250qgn; Wed, 25 Oct 2017 02:29:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Sb3dBkYXIoG/vG9+w5605SrH6sgCK+O//gVbVvp8w5+wSEcUaYrRkRXwdXEgIdOlAk7kT4 X-Received: by 10.36.202.3 with SMTP id k3mr1185350itg.87.1508923764895; Wed, 25 Oct 2017 02:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508923764; cv=none; d=google.com; s=arc-20160816; b=squZ0CfouKJFUyvyVXHj8eNZWwJ0qWxRQDdmnfpo6xuOGk7GnPttzAbkGKh4KyuC/Z W4aTLEcY6OJPlYXIm8GKHvFX9qAb1Yjietz4T8rbl5N4agWKDWCZuJuYm9QBO4Vq2mwS LaASBIxnrFfPJxJmhm+ovQvOi15LaiDJXLUyoVFWkDsJ287yRRyCkJIUMj0JcJcU2Yc9 rvqIUraRWenty0W9mSfdNu9r0gYz/F+j4uLBh+ZShFCWLGJKA+PCuTxTyr7XhtFYBf3W mVFQAdE7s1TLbfKE6stLoOoWIeM01a55oLEjh0bfA0N0k8fFxycn9riLhN+WjnNtI21n X4QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=UxXlZSuDuVTtjtV8y7g9eTnj4NQQmoj47ze93vuoYOo=; b=ODRfyihxpT5NCDiu+4icqtBquAchSPSut1wgxNkaGFZXnKH/wQBW9g1BXI6xHKnFBH HpD3L3PR5UnVs0Fi68CgyR3UBQZOTrk0f0f3189D46OSEVTb+zUWJsTDASJR61qGycN7 VpT/IxydR8cf94iMIo+P0cz/9XLiEpy/34RwcEcJz0q2debu/W0dAGfrcGqdUZWOfWGf EBE5ddF/yQt2i/1UPTLwSEZkjhpMRjS+T/X5Pu/u6IWc8yIV90VxtUjnKeGKjumd2oEo 9OeBO314J0oELlH0vfBMGDPDjPIVA06sblk8TArWq0/8ky6oUCUsF3I7uRNWS65EmKn5 Fo3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IIb0ul1E; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id o79si1626233ioi.169.2017.10.25.02.29.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 02:29:24 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IIb0ul1E; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7Hy3-0003eK-C6; Wed, 25 Oct 2017 09:27:19 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7Hy1-0003dV-W1 for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:18 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id CE/0D-07499-5F850F95; Wed, 25 Oct 2017 09:27:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsXiVRvsrPsl4kO kweQzOhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8apV79YCo4IV/xtm8TWwDhTsIuRi0NIYAaj xIa151hBHBaBdmaJ8/9mAjmcHBIC71gkjm3XgrDzJGa+P8QGYadJ7PmwjgXCLpeY/v0oE4gtJ KAlcfTUbFaIqS1MEktntgA5HBxsAiYSszokQGpEBJQk7q2azARSwyzwllFi4Z6bYMuEBQokGv 68ALNZBFQlZh5exghi8wp4S0y/sAdqmZzEzXOdzBMY+RcwMqxi1ChOLSpLLdI1NNFLKspMzyj JTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMIQYg2MF4fWPAIUZJDiYlUd5wjw+RQnxJ+SmV GYnFGfFFpTmpxYcYZTg4lCR4JYEhKSRYlJqeWpGWmQMMZpi0BAePkgjvq3CgNG9xQWJucWY6R OoUoyXHvj23/jBxdNy8CySfzXzdwCzEkpeflyolzrsfpEEApCGjNA9uHCziLjHKSgnzMgIdKM RTkFqUm1mCKv+KUZyDUUmY9zfIFJ7MvBK4ra+ADmICOqhJFeygkkSElFQDo8PCFfm7dHc1yf6 ewv1qqtCe983H+n6ssJl27GD/urZ/0+69keN7v2BWylfH3ZKz++5J2+qovGRudZ/izHYw03W3 eU0Qyx72cFn+VUHH3LaeZTu0Li7AwfvY0x/2JVzfTjkHJfO3vT62bNa5pXZp/MrnUvyW6sgcW 3dE75Cd8T39L0k7vBkzbiuxFGckGmoxFxUnAgAePlNFswIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-27.messagelabs.com!1508923635!100853816!1 X-Originating-IP: [74.125.83.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3655 invoked from network); 25 Oct 2017 09:27:16 -0000 Received: from mail-pg0-f67.google.com (HELO mail-pg0-f67.google.com) (74.125.83.67) by server-14.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:16 -0000 Received: by mail-pg0-f67.google.com with SMTP id s2so16838264pge.10 for ; Wed, 25 Oct 2017 02:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zy8Xnw6+aLmA1Y3jl9pWt1In8uySHj6pszzVRcxZ49A=; b=IIb0ul1EkfaxsHzEvTxKjfNRSpHnvOpfkylCkN/6pb4W6lroSabgr+tLXxemfuDHrm qYguun4aDA0JOn+Kfyro/jkVuvAOkqvijiMq5l98QM63T0NcXCtYTkRWXtUp5LXYdNH+ RoOW8XFlyprhh+2E5ZL32rXVRN5rXdds4+MQY= 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; bh=zy8Xnw6+aLmA1Y3jl9pWt1In8uySHj6pszzVRcxZ49A=; b=J3mx+eEQ4R+FLdnQpLSh2g9Dom+5gyWSTrS/hPUZe4FkmYQXuGypWtHMG5RDpzno3U 3hHHVbOWOt55+PQXFdJFmPd79wdh/E4gGH2bflJ9tlPCrp08LmM9FPyJlPQX8nMt7IbR Ve50vdZmlmkoD5gXQGq7pWX0Bu0nlO+TdMU0tuQVRU0z8QHf2Xd2mZY97tWaA90eERrR /+vAwiFRK7dUatEmpMNT2udp4aBP6GTLw5D6LupI7JD2qbExKNSti6JpneoJL+KbJ/qs NIr0fJ5h3mCXptOq4m44c6ZEwu4fBuT5CHeY/GKlNq5lj6sm3v9zoSXsVJqMfSlDXa50 4sJA== X-Gm-Message-State: AMCzsaXqqGj4Ggg7p7rkbBg9RG4+G3KrMMrmnRTRl98Yd6rnmKaQhHJc 4geyoKC5g5mqhc1If5kCivHZunI8tpI= X-Received: by 10.98.82.85 with SMTP id g82mr1604477pfb.31.1508923634983; Wed, 25 Oct 2017 02:27:14 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:14 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:04 +0530 Message-Id: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Ian Jackson , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 1/5 v2] libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn" X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" In libxl__device_vuart_add vuart_gfn is getting stored as a hex value: > flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn)); However, xenstore reads this value as a decimal value and tries to map the wrong address and fails. This patch introduces a new format specifier "PRIu_xen_pfn" which formats the value as a decimal value. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Jan Beulich CC: Andrew Cooper tools/libxl/libxl_console.c | 2 +- xen/include/public/arch-arm.h | 1 + xen/include/public/arch-x86/xen.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index c05dc28..6bfc0e5 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, flexarray_append(ro_front, "port"); flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port)); flexarray_append(ro_front, "ring-ref"); - flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn)); + flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->vuart_gfn)); flexarray_append(ro_front, "limit"); flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT)); flexarray_append(ro_front, "type"); diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 5708cd2..05fd11c 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -274,6 +274,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); typedef uint64_t xen_pfn_t; #define PRI_xen_pfn PRIx64 +#define PRIu_xen_pfn PRIu64 /* Maximum number of virtual CPUs in legacy multi-processor guests. */ /* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */ diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index ff91831..3b0b1d6 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -75,6 +75,7 @@ __DeFiNe__ __DECL_REG_LO16(name) e ## name #ifndef __ASSEMBLY__ typedef unsigned long xen_pfn_t; #define PRI_xen_pfn "lx" +#define PRIu_xen_pfn "lu" #endif #define XEN_HAVE_PV_GUEST_ENTRY 1 From patchwork Wed Oct 25 09:27:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 117038 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp628245qgn; Wed, 25 Oct 2017 02:29:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Rl5k1nZl5QHAzlknLyu56j+DtcI34WAfoUaexWokQShzBVquYu7o9H9if8BPpGe/GX/sFp X-Received: by 10.107.27.7 with SMTP id b7mr13483204iob.136.1508923764764; Wed, 25 Oct 2017 02:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508923764; cv=none; d=google.com; s=arc-20160816; b=BhhjGuhv85WiLsraNuldAl3IwKA2ryiivjP+V7n+FbTjoDGX+d13clj91sitziGG11 UZB53lhbevhzqbpNKQvUupyF5R2Bpr+81rpjirLsSGDelrfmqRLKl4wdLUF4amKvzAOv uumM+gCYbUsrlHlVRfOb/Z5PnGQtrP3ancZhy0FF4WsurViZteV++kgnWvuqr42OnIRq 4qICUAOlydaTNcIp4q1u0XlkDjZAMvSoC8b0kGxGExhnwmfLLXYII34hvEcEZ5/1Ebz6 eCtOVKhy63r341FPYfJxl6KZWNzQXzLjlZaMBZvM81wD7mFdF2NETaEUJ51qWfbRBx9Y ZWsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=HvyvD/oZenYRuFJWpIrEaLLBuGlQiPtybpgSH5rK/84=; b=yw6EuRG1WLzJVKza/IMuOGyVmNUEehoU6m3iyV6j1KyxPyumNpAwWQGdQnn27V81p1 mXrbsNAvxUhWZDhFCRUtijYXgGUatHQrsHH9PYu4U77AEruyZtIIEbKrFSzvfYd6czQD I4xqBFCuKmGvcMPFUhsaEAwRnci5YxaErTW0Xx9nPHK/H0GIBFS5QSqnUDxcB3Fj0fK8 Nk6zK2gqSgdaPQopog+b3y5HxqqvH1L08vROG5yqmIu/s7y02HL6yeKqhUDigMHffjOu W8evDP7JQ1bkmiho+iC33d4NbWAs3VsP4WaVHc5zskoxPo8Ie4m/AY3Ilez3VPDuYPfk FC9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U4rrQw99; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k198si1723864itk.47.2017.10.25.02.29.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 02:29:24 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U4rrQw99; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7Hy5-0003eb-JJ; Wed, 25 Oct 2017 09:27:21 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7Hy4-0003eV-Sa for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:20 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 7C/FB-11148-8F850F95; Wed, 25 Oct 2017 09:27:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsXiVRvsrPs94kO kwbVFqhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bLxqksBV+EK97+2snUwPiBv4uRi0NIYCaj xMo3a1hAHBaBecwSf++vZOxi5OSQEOhnldj6U6+LkQPIzpOYs9IIIpwm0XPnHSuEXSnxZPImN hBbSEBL4uip2awQdguTxOatgSCtbAImErM6JEDCIgJKEvdWTWYCWcUsMJ9RomlSL1ivsICXxJ wP58DWsgioSsx/towFxOYV8JaYc/wp1C45iZvnOplBbE4BH4lPN0EGgezylrjybQHjBEbBBYw Mqxg1ilOLylKLdA3N9JKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAsONAQh2ME59 H3eIUZKDSUmUN9zjQ6QQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd6n4UA5waLU9NSKtMwcYODDp CU4eJREeF+BpHmLCxJzizPTIVKnGO05jm26/IeJY9+eW0Cy4+ZdIPls5usGZiGWvPy8VClx3v 0gbQIgbRmleXBDYZF6iVFWSpiXEehMIZ6C1KLczBJU+VeM4hyMSsK8v0Gm8GTmlcDtfgV0FhP QWU2qYGeVJCKkpBoYnbb/M+eMmFZ6NasqePKNK5MMl1YKzVJROLLyYvR+SekSkfYu9/vK+0W3 TWAWVri17nz9urdyM1gMeeUnll5Yer35LUtw4XWtybxXNrk+Wzn1i82JoN+vXqmfnShiLCXHx 185V/zVebVfpxfLiZx1Z9t7aVfin+kzjsd9+n+5Pl7baoru36olb5RYijMSDbWYi4oTAQ/UgU LPAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1508923638!93065632!1 X-Originating-IP: [74.125.83.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 33376 invoked from network); 25 Oct 2017 09:27:19 -0000 Received: from mail-pg0-f67.google.com (HELO mail-pg0-f67.google.com) (74.125.83.67) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:19 -0000 Received: by mail-pg0-f67.google.com with SMTP id a192so16833754pge.9 for ; Wed, 25 Oct 2017 02:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vmXW/yEVPRL28MxJoHo7m81XwfWAj+rhLKzNFO1BwlQ=; b=U4rrQw99KRh8Er8nzIs64U50wmbiGoCxtlrCwlyXFB4RTAcqidvglsfFe8RDtpjhyD vxJlzBQVF8JUbURdtBBDSPfDsKBQ7ZVQZCDdsYfjuLXOLV39OS+WJRZmbKhbjd8j90BD eY/eMAwj8cadlLeI6zRr1miK83YTdbKUdcnS4= 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:in-reply-to :references; bh=vmXW/yEVPRL28MxJoHo7m81XwfWAj+rhLKzNFO1BwlQ=; b=QOvEZZo54afnUeabTe2H7x4bUAnRyB4Ww72scgdjVHzcGJSgpWb5CVLpqCBZdqEnrz /GlDOT34dgfoN/WBlwEWUJTaYI9j4mZW02iaHXUuhUBEOGFxUQycXRLL53Aee1xlCMgC fi24aoAo/HGs96V+xmaYnZNQbb8RqNjrZ2HUjEi7BYXZv1Fm9yN2R1ivfXkTY8YexomL Sb4/Y4JhDyCr9qQU8dGya+hmpYEsMRdF9MnU6hvwRMqZUoNmEG3HibpFnI7joFQJfSAl e8m337efUBusNjI/RnRkvI4OGKokLpTTFZ+Ri9O5G+KjqUX6+iB7JTRAjmy1vlh+d7Sm GTKw== X-Gm-Message-State: AMCzsaXXSM9Tk0s80fbnFnUaSstVrCj4vDilo/Yna78YWSc8oH3oz484 bPpc8v9Bip7qL7Nt4KTf5VgDrNlybxU= X-Received: by 10.98.200.85 with SMTP id z82mr1574073pff.313.1508923637870; Wed, 25 Oct 2017 02:27:17 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:17 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:05 +0530 Message-Id: <1508923628-26446-2-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 2/5 v2] libxl: Change the type of console_mfn to xen_pfn_t X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Currently the type of console mfn is unsigned long in libxl. This may be an issue for 32-bit toolstack running on 64-bit Xen, where the pfn are 64 bit. To ensure that console_mfn can hold any valid 64-bit pfn, the type of console_mfn is changed to xen_pfn_t. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/libxl/libxl_console.c | 2 +- tools/libxl/libxl_dom.c | 2 +- tools/libxl/libxl_internal.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 6bfc0e5..f2ca689 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -329,7 +329,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, flexarray_append(ro_front, "port"); flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port)); flexarray_append(ro_front, "ring-ref"); - flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn)); + flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->console_mfn)); } else { flexarray_append(front, "state"); flexarray_append(front, GCSPRINTF("%d", XenbusStateInitialising)); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index ef834e6..a58e74f 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -869,7 +869,7 @@ out: static int hvm_build_set_params(xc_interface *handle, uint32_t domid, libxl_domain_build_info *info, int store_evtchn, unsigned long *store_mfn, - int console_evtchn, unsigned long *console_mfn, + int console_evtchn, xen_pfn_t *console_mfn, domid_t store_domid, domid_t console_domid) { struct hvm_info_table *va_hvm; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 45e6df6..f52aeb3 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1128,7 +1128,7 @@ typedef struct { uint32_t console_port; uint32_t console_domid; - unsigned long console_mfn; + xen_pfn_t console_mfn; char *console_tty; char *saved_state; From patchwork Wed Oct 25 09:27:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 117039 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp628244qgn; Wed, 25 Oct 2017 02:29:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R+XxuOlgbxKeRwszzZLQp4hDb87NjwmnnU/wWT6qcqSa28koaj7PCM8lfnwWpcM6fJsifw X-Received: by 10.36.103.134 with SMTP id u128mr1156142itc.2.1508923764758; Wed, 25 Oct 2017 02:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508923764; cv=none; d=google.com; s=arc-20160816; b=FKbCpiDrpjA0zWQqceelYlQ172xWlVc3L+krw8VZcWRxcb70+RftN7ol3HniGw9kc4 9ZSYuSRzpdMlpGPoAUBMUKt1CI0/Zr4CDw/EtSy4daKciKgKjGCr3SEd8oIKP0rSTGY3 U9jAFWB+M9/lyvM42r55lfZW/hwY4ZKRUgF1E+6SuqD2Wf5a9E517gYfjpCf41/EPToh A8U93uLSvIao9vGyZw2B/V6rJB4L+JwEmpjDLJAY+zGB2PzP2CkGAkVhjswwV2ey9hQb BCcF7fdlf6rBBIV5pe56TUIhEm3eY+f9ZoDtQQ22JCgzFT2k9BgzkmYTIZV6Y0w81JgD FRVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=Mj8o2N/YcfuZAtWNPGCPGeWAbsrhPnFWNEq93zoe0yU=; b=mT7QHlg2mqyyZJKcDyrLo4zkm6U9L6SuQ9NLN1TshW0QtvUmXpyDsFOkjPU2dLnT28 dop+Ptwnc37/3pPxBcqlhbWuCC3qOuL84MMHM0pliui1kbuW/13LL2YQetY02Qk0UZzC MbcylquRadKhNAHDZhpTCJpX6AfAriLnJyW232lculLr76pkbXKnDjyym3W6Mfpyggn5 2kPkSbv3OhOwyQEM0Ox7S49r3iNRzYiodfnv5goXtn6wa2YU9uTRrT9gupLjDSKlmRmZ TSlMXurecrLQhK36FFVLVYa+PrVDP1fuLiNpkCVTWWCqLl2WJC+ByVyR1iSexzVGnyF5 mQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OZDrRHbz; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g82si1594123ioa.256.2017.10.25.02.29.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 02:29:24 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OZDrRHbz; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyC-0003fN-18; Wed, 25 Oct 2017 09:27:28 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyA-0003ex-CS for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:26 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id B5/27-00983-DF850F95; Wed, 25 Oct 2017 09:27:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRWlGSWpSXmKPExsVyMfTAQd2fER8 iDf4sNrP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMWzv3MWvBUsOLwg8VsDYwXeLsYuTiEBGYx SnzpuscI4rAIzGOWuPprLyuIIyHQzyoxb89Zti5GTiAnT+L66j2sEHaaxMV5m1gg7HKJ+XPaG UFsIQEtiaOnZrNCjG1hkujftY+pi5GDg03ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6gVbIC yQJPHi8CMwm0VAVWLCrHlgC3gFvCW2zmphglgmJ3HzXCcziM0p4CPx6eZkJojF3hJXvi1gnMA ouICRYRWjenFqUVlqka6xXlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGYMgxAMEO xuYvTocYJTmYlER5wz0+RArxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4I0DhrCQYFFqempFWmYOM Phh0hIcPEoivEkgad7igsTc4sx0iNQpRleOC3cu/WHiOLbpMpA8sOcWkOy4eRdIPpv5uoFZiC UvPy9VSpxXC6RZAKQ5ozQPbjQsci8xykoJ8zICHSvEU5BalJtZgir/ilGcg1FJmLcYZApPZl4 J3AWvgI5jAjquSRXsuJJEhJRUA2OryMIs7nunTD4Hqdt4ylvcOdu6j09k2lvnpUfs+G8GN03f pXByHuuHm20mp1bvSLvz59Wn1lvNJy7kK90UtWSM9lvfV+cgk6W27vj8/7d1bZxPe8Y4lJW2m vaWHH3v8/T2jKAlWzXzHCV0JimVTXQ5uvf4PQtGiwNBkqtSJ3xsTNluteiDl58SS3FGoqEWc1 FxIgDhB/8J1wIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1508923640!104322829!1 X-Originating-IP: [209.85.192.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55918 invoked from network); 25 Oct 2017 09:27:21 -0000 Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:21 -0000 Received: by mail-pf0-f193.google.com with SMTP id b85so21779033pfj.13 for ; Wed, 25 Oct 2017 02:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MbJnOrhSN4dms97WXwW1NxXA95YIfRoF4gRBCjPvfjU=; b=OZDrRHbz4lpJNidquOJ83R61IIpNJtNRVfephuMmcCrrrez6UJ1pzxLJ0/rMaFt+Ow LtX6FB5fLuUKqBs24h8pC9mo0bR4EKBS0+i+tc4Pl0yn3GBuYdgwTnbH8D0Ga/NPArfn aoEK1v4LKDACfZ8+UmRcGpudCSXyzXfpw1uBk= 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:in-reply-to :references; bh=MbJnOrhSN4dms97WXwW1NxXA95YIfRoF4gRBCjPvfjU=; b=oVw10aXR3o6Fqs1t6U9zde21qPYiuvo/frC8Eu7WY1Xxxnj5CgQDJhRq+PmkDqosEi q3AsBi6IGPEKj1lW3j28XT14RDqBPejJIPCyPbACMY9cxZyRb7I/LVWW4AQ/ahRDXXeJ Sz2fXtSRJPNU/YHp+ZL2AE9kgw0miMSTpqSVTTb7MZ9NjKVT6nqcRG2wEvPshn5eJZvY fumYxzwTCZbIY2b23J68wKE5lpVJciZmp+6iXWCr+2Gscn8zclnbCruR5ihhDq8+KTsf oSIXvxxTrXxlgOrg0mVW8mN5wbxylFZDYVa793wEx9W8Id0Mxr3D9DmeE/asO+sUwzEa vQjA== X-Gm-Message-State: AMCzsaXA6ynngrzriedBG6TNKCHizQriTka5y2sNiMn9MHiMT2BDkqRd o2u2FfRYIqUVlEJpnSPsmykJhr4ILeY= X-Received: by 10.98.21.86 with SMTP id 83mr1608167pfv.290.1508923640186; Wed, 25 Oct 2017 02:27:20 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:19 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:06 +0530 Message-Id: <1508923628-26446-3-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 3/5 v2] libxc: Fix the data type of mfn parameter passed to xc_map_foreign_range() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Currently the data type of mfn parameter passed to xc_map_foreign_range() is unsigned long. This could be problem for 32-bit arm architectures where the lengh of long is 32 bits while mfn happens to be a 64-bit value. To avoid truncating a 64-bit value, the type of mfn is changed from "unsigned long" to xen_pfn_t. Also the parameter name "mfn" is changed to "pfn" which is a more accurate indication of what this parameter represents. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/libxc/include/xenctrl_compat.h | 2 +- tools/libxc/xc_foreign_memory.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h index a655e47..5ee72bf 100644 --- a/tools/libxc/include/xenctrl_compat.h +++ b/tools/libxc/include/xenctrl_compat.h @@ -26,7 +26,7 @@ */ void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn ); + xen_pfn_t pfn); void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, const xen_pfn_t *arr, int num ); diff --git a/tools/libxc/xc_foreign_memory.c b/tools/libxc/xc_foreign_memory.c index 4053d26..c1f114a 100644 --- a/tools/libxc/xc_foreign_memory.c +++ b/tools/libxc/xc_foreign_memory.c @@ -33,7 +33,7 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn) + xen_pfn_t pfn) { xen_pfn_t *arr; int num; @@ -46,7 +46,7 @@ void *xc_map_foreign_range(xc_interface *xch, return NULL; for ( i = 0; i < num; i++ ) - arr[i] = mfn + i; + arr[i] = pfn + i; ret = xc_map_foreign_pages(xch, dom, prot, arr, num); free(arr); From patchwork Wed Oct 25 09:27:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 117041 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp628254qgn; Wed, 25 Oct 2017 02:29:25 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Q6g4VO4H6zd3q1HPWbCf4O3JXSO5LxI7oBxGvy36vhBK+jovEpTuZmfXYOHv7QFTtjygMu X-Received: by 10.107.183.197 with SMTP id h188mr23221558iof.183.1508923765225; Wed, 25 Oct 2017 02:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508923765; cv=none; d=google.com; s=arc-20160816; b=LZevBEPQgMe7u0vPNDLmSIuTAz8Qe/lqtlaZV5XuIKy9mU8FgjTtCVAxMWmWg1iuDu nsVqEIWE7Fj6SPfJ6HS3GgXMljLExL/++kPOcE3beNISuONphl7SOe/3foedRSumvJ8F zf/HnPWEb1qXhzh46rWCEsrjSxmjTYlA6ksVymxcxGSbLZlUvtZUywPy2CqFU380dSor CCPkmwFJO4Z674mRjc9qLmsJuNDk4pvWSaFwHMfJKJj0Y4gcvje5pIj1ps6v7Sur8idg HYyaQnfM8PGfaBHNOZbfE52EJch6oUuwCiqereO9NusuZtDC/xc0jNzfLCShazGPTnOd 2zPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=6eO6ybs1CeT47b+5zrVhgXDKd2S3c8FZLKrT5hgt4iY=; b=vyRVAmWfnw4loR8GQw43MxVoMYAFB6aGEVvuSYVR3WJgVK1P2rgkiG7l+hOMjwZSj1 7JaCjhxNgQJElFpdkQ7kJJZqKuVu+z8Orojv69N/sOnt1BnyIvmSjxzk86e09erMHfUl O1Dp0bxlsKfX1KpW/QPtO+Liz+8jNTawMYnDPFJab+9jJEwKwNyoFPUHIOqyyPKR6omY CODrcESA+aehxiXImUU5eP+XwMig5aBYUaScinnWCGdF7BefffL5mJjaAnpWjJBhBqfZ iwKXaVjsp0Xikh9DJD3Wkpm5PAL+64YiLpuZHlUUAgb0sAoWYm57SLjKhC+IFaM2nX0M 7e9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FT+McP9j; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y141si1697316ioy.44.2017.10.25.02.29.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 02:29:25 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FT+McP9j; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyA-0003f8-QL; Wed, 25 Oct 2017 09:27:26 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7Hy9-0003ew-U5 for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:26 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id AA/22-00431-DF850F95; Wed, 25 Oct 2017 09:27:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRWlGSWpSXmKPExsVyMfTAYd0/ER8 iDZZMFLX4vmUykwOjx+EPV1gCGKNYM/OS8isSWDP+HpjHXnBJsGLD3w9sDYwP+boYuTiEBGYy Svx7vY4ZxGERmMcs0ffyBRuIIyHQzyoxceZX9i5GTiAnT+J8z2NGCDtNYvbZN2wQdrnEjQWXW UBsIQEtiaOnZrNCjG1hknjW0gjUwMHBJmAiMatDAqRGREBJ4t6qyUwgNcwC8xklmib1gg0SFk iWeDuvhQnEZhFQlWj/v4YVxOYV8Jb4PruJCWKZnMTNc53MIDangI/Ep5uTmSAWe0tc+baAcQK j4AJGhlWMGsWpRWWpRbpGJnpJRZnpGSW5iZk5uoYGxnq5qcXFiempOYlJxXrJ+bmbGIFBV8/A wLiD8dVxv0OMkhxMSqK84R4fIoX4kvJTKjMSizPii0pzUosPMcpwcChJ8EoCg1hIsCg1PbUiL TMHGP4waQkOHiURXl2QNG9xQWJucWY6ROoUoz3HhTuX/jBxHNhzC0h23LwLJJ/NfN3ALMSSl5 +XKiXOuz8cqE0ApC2jNA9uKCxeLzHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5j0IMoUnM68 EbvcroLOYgM5qUgU7qyQRISXVwLhu76wV2QcO5ubmMD3Iyp0YybKXd0NNdfuPrTu28Tm+z/bN n9X+OXnt8StXTmzhnfNyxtMmhW5/n+nTxf6eyy6bFxa/ysWGdWUS67OHmeGntp07cvnmsW3zb Jgll9XNW2/MGlo7q07bPDd/9SPjQzH6QgkhJcvC8rb4Oe5ouury3TTuQPIZmXwlluKMREMt5q LiRAByVcQo0gIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1508923643!111936933!1 X-Originating-IP: [209.85.192.195] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26972 invoked from network); 25 Oct 2017 09:27:24 -0000 Received: from mail-pf0-f195.google.com (HELO mail-pf0-f195.google.com) (209.85.192.195) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:24 -0000 Received: by mail-pf0-f195.google.com with SMTP id n14so21783014pfh.8 for ; Wed, 25 Oct 2017 02:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Dr6lQC3lVVottQ+NHxC6FEsu1ICS2ANKP3R5G5Zhkgw=; b=FT+McP9jnUqLXJnom3b/fWEBpnOnjkxUwxT9PbH9l9a4Z9SFf9skhpEXFioMEQQFsR X6LtSJgzdMTDH0dkzdYcYsB/lZNgG4122jlJVW+qkey+ZvoEQqiiX4uF+3CpIHFc/j3m yKbmqAE0ay4EQcFsu/02AHjTkjLfbXhslgKI4= 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:in-reply-to :references; bh=Dr6lQC3lVVottQ+NHxC6FEsu1ICS2ANKP3R5G5Zhkgw=; b=JhiySzwhl71D/kfgKi+7KtNUtjzzffPs/MroWhQxYprAq3aUy8v8AlOc7z1rebHA69 P2Tzge8IjFXu2U9aCmj1YVxbRlkxso18yl5sw1+qjb8kFAqoA3RafUdRdNxe6DPC6KkQ 7KMu8QSdP0RQoDPdv4amRlNFDj3S6b9b2RXX2FoXvZL9V13t42ucyCHt2Pa8dtG0BNvJ cdgEnlkcgtg2mWDVU+cxzpFKGvrbzJDyy+a0xwqeNUHZtD/4gTJzV6clAJAVW+k1SZLB wnuxNn4QJ6BwBseC5VkrcFLMIcBdtxUN6q8bB9zS/a3YTVmsm23UnNDSJ9J+0KZRU+bJ x46A== X-Gm-Message-State: AMCzsaWs/4Al9iyvvhiJ5FbWoBFU86WpLGK/fgOYAux7BL+UFDHLmqm6 pqxbDs8soesHs1Cno3O7jcyyQ3JblHI= X-Received: by 10.98.75.77 with SMTP id y74mr1619875pfa.78.1508923642610; Wed, 25 Oct 2017 02:27:22 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:22 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:07 +0530 Message-Id: <1508923628-26446-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 4/5 v2] xenconsole: Change the type of ring_ref to xen_pfn_t in console_create_ring X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Currently, ring_ref is read as an integer in console_create_ring which could lead to truncation of the value as it is reading a 64-bit value. The fix is to modify the type of ring_ref to xen_pfn_t and use the correct format specifier to read the value correctly for all architectures. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/console/daemon/io.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index e22009a..1839973 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -19,6 +19,7 @@ #define _GNU_SOURCE +#include #include "utils.h" #include "io.h" #include @@ -81,6 +82,12 @@ static unsigned int nr_fds; #define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1)) +#if defined(CONFIG_ARM) +# define SCNi_xen_pfn SCNi64 +#else +# define SCNi_xen_pfn "li" +#endif + struct buffer { char *data; size_t consumed; @@ -98,7 +105,7 @@ struct console { struct buffer buffer; char *xspath; char *log_suffix; - int ring_ref; + xen_pfn_t ring_ref; xenevtchn_handle *xce_handle; int xce_pollfd_idx; int event_count; @@ -661,12 +668,13 @@ static void console_unmap_interface(struct console *con) static int console_create_ring(struct console *con) { - int err, remote_port, ring_ref, rc; + int err, remote_port, rc; + xen_pfn_t ring_ref; char *type, path[PATH_MAX]; struct domain *dom = con->d; err = xs_gather(xs, con->xspath, - "ring-ref", "%u", &ring_ref, + "ring-ref", "%"SCNi_xen_pfn, &ring_ref, "port", "%i", &remote_port, NULL); @@ -705,7 +713,7 @@ static int console_create_ring(struct console *con) con->interface = xc_map_foreign_range( xc, dom->domid, XC_PAGE_SIZE, PROT_READ|PROT_WRITE, - (unsigned long)ring_ref); + ring_ref); if (con->interface == NULL) { err = EINVAL; goto out; From patchwork Wed Oct 25 09:27:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 117042 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp628290qgn; Wed, 25 Oct 2017 02:29:27 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R1iZADKPHjn6WXerJjXBRpTiD0A1axYNz/33i6aUmF+o8Sdqux03eqz00xv1scyV0+f6cl X-Received: by 10.36.82.1 with SMTP id d1mr1138666itb.115.1508923767015; Wed, 25 Oct 2017 02:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508923767; cv=none; d=google.com; s=arc-20160816; b=DD1S5UJsbWJFX0680N2Mrnb02ng63z18nQzqKP+jJLxeqTAiNrSqpszoTLygY1l621 YkM+b+J8zpimiDXCNFP05T61pqD+0NS+xtgv4eK+9+iMT58q40hxJCKnOD8hK9dTk93y z53YvS+f4aeKV3v+0ll2WpY3Uha3tV0a5ypkR5ammEJ2Seozw6j1QIN6PCROMT3KbFGU EoloXHbvPgoZRl04HUIvMv2/848B7E5ZiGUcKSiabmjsU4J3LqPNFDOuelxaptIAYd8Q 45+QNikgXi9mxUq2PE846iRkKuXHDwHietHJsu51RUCL5ls7HVR26X+4P7QakbtwxUM7 4KWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=ugYpCKrgjb9Hr6jN7on7unEhDhx4Ld+g+H4ygPhydw8=; b=vO13NXATCUD5jYOF+CRDV7yrzf2zen2OGu3SDK5M15D3MzgkiuBkQ8Td2G3TjnULF2 yacnEQCEhSdcbd5b9n1Xz0jdPtnbMBOAZXJ12Zk6kFI751fW5E/yTSKf9MYUa3jVWthh zbqsu+qpKN5hKAs0xx43tssFt1XsbqcAHBrL0VZRxfizHb9w6gzLTsLmXjA6SAFVM6mM FTmBbHUx1jYejhX0z75e60Sg1cl3E4aSsCJrSBcHqpAi+rdKJEChan8mlxNWpCsHnVX8 MoyUZKhnvBHjWCS0GSiaacf4ZjGC/adwRpXRhPXR/EtMaCQjcxzO0s3GNiZlpqYhv2sR xc+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CRwwJKLH; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g206si1609056iof.114.2017.10.25.02.29.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 02:29:27 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CRwwJKLH; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyF-0003ft-81; Wed, 25 Oct 2017 09:27:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyD-0003fd-Qn for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:29 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 2C/D6-16147-10950F95; Wed, 25 Oct 2017 09:27:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAQd3/ER8 iDZZdErP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDM+nmpgKdgpVLHx1F62Bsaz/F2MnBxCAjMZ JS5Ncexi5OJgEZjHLNG0+g4LiCMh0M8qMXH7RyaQKgmBPIk592awdjFyANlpEh+6uCDCZRIf/ l9lhxikJXH01GxWkF4hgRYmiaV3rrGA1LMJmEjM6pAAqRERUJK4t2oyE0gNs8B8RommSb1sIA lhgQiJ63dXgw1iEVCVOH3vDiOIzSvgLXH2wgVmiGVyEjfPdYLZnAI+Ep9uTmaCWOwtceXbAsY JjIILGBlWMWoUpxaVpRbpGlnoJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEBlw9 AwPjDsb2E36HGCU5mJREecM9PkQK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuB9Gg6UEyxKTU+tS MvMAYY+TFqCg0dJhPcVSJq3uCAxtzgzHSJ1itGe48KdS3+YOA7suQUkO27eBZLPZr5uYBZiyc vPS5US590P0iYA0pZRmgc3FBarlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ8x4EmcKTmVc Ct/sV0FlMQGc1qYKdVZKIkJJqYJwp4JjO2J0rqT2B7+zvz3M2+HQZtyw6nCYg22Ny/cxBHo+W 7YVhiUV7HNJ1pn93nN34JXnhB8HoD9VzjtoI3q0KMVsvVZZe+1TQNTDuqvIZl9qEwFzuO1nMx 6s+ccSbrlwimVTJaHblP5vmjucs81+73lkZw9JkmX3m8ZzzLvVhu25VWNRsUGIpzkg01GIuKk 4EAB1WTtHQAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1508923646!56393991!1 X-Originating-IP: [209.85.192.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13269 invoked from network); 25 Oct 2017 09:27:27 -0000 Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:27 -0000 Received: by mail-pf0-f193.google.com with SMTP id 17so21798043pfn.12 for ; Wed, 25 Oct 2017 02:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SyQksW2D8oFECzaokhim+H3sKygwwsidoIodYalb1+4=; b=CRwwJKLHKulswwzswgh5PUSWVSBWlPUvOnjkPJUfGd50/HVPgmVL03XSle0YgmtyyB vPg95mTW5bBbyc073IX+UysesHhzcC+ezfXMasPhRne6dJf0lNamB7wkWz8pmpQh1syv C6XzeiHyzVP+OW1cKjQIC1aAPyx8evJBXQSQk= 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:in-reply-to :references; bh=SyQksW2D8oFECzaokhim+H3sKygwwsidoIodYalb1+4=; b=h8VRBQYUQNny+5NNte83GVFWjKopM7ZuVUSaExTupddup/eyFJiAxpEkBJmFYpsSdt CBUla08Rgl0OVMyuDqoh58OQ+PkBNhRZA1wF7cPx4mOMy2A8eohlg8RF5SbuMcUC8RV7 Hv/mRlLZh/zjIs8NQgJpvw0zKb0vaJoZ3yVkzXIi4z9lftZwojXLT6LscFSmGOJkmlZw jFKrmQ1Bux6rWreRxjgt0VnWjGhwbxHu0lpbIqGdOKEyAW2B1O7G/YnhRlx+4bl1BENa x/YsTu3nW36/cv6wsls6He0zEoIUIuclkhw+uVXF8MPTGEMNvkejllTAtukBHpKvtnT7 Mc/g== X-Gm-Message-State: AMCzsaWPgv28zoM4VHl5YVRZwVlMFMno9pGoe128eNz3QDygmSSQBLT1 ctOckvsnLbtYzwELbFiSh4H801JTAKI= X-Received: by 10.84.224.1 with SMTP id r1mr1225525plj.65.1508923645644; Wed, 25 Oct 2017 02:27:25 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:25 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:08 +0530 Message-Id: <1508923628-26446-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 5/5 v2] xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" xenconsole will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref. Signed-off-by: Bhupinder Thakur --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/console/daemon/io.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 1839973..aa291db 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -62,6 +62,8 @@ /* Duration of each time period in ms */ #define RATE_LIMIT_PERIOD 200 +#define XEN_INVALID_PFN (~(xen_pfn_t)0) + extern int log_reload; extern int log_guest; extern int log_hv; @@ -658,12 +660,12 @@ static void console_unmap_interface(struct console *con) { if (con->interface == NULL) return; - if (xgt_handle && con->ring_ref == -1) + if (xgt_handle && con->ring_ref == XEN_INVALID_PFN) xengnttab_unmap(xgt_handle, con->interface, 1); else munmap(con->interface, XC_PAGE_SIZE); con->interface = NULL; - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; } static int console_create_ring(struct console *con) @@ -698,7 +700,7 @@ static int console_create_ring(struct console *con) free(type); /* If using ring_ref and it has changed, remap */ - if (ring_ref != con->ring_ref && con->ring_ref != -1) + if (ring_ref != con->ring_ref && con->ring_ref != XEN_INVALID_PFN) console_unmap_interface(con); if (!con->interface && xgt_handle && con->use_gnttab) { @@ -706,7 +708,7 @@ static int console_create_ring(struct console *con) con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, PROT_READ|PROT_WRITE); - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; } if (!con->interface) { /* Fall back to xc_map_foreign_range */ @@ -812,7 +814,7 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->master_pollfd_idx = -1; con->slave_fd = -1; con->log_fd = -1; - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; con->local_port = -1; con->remote_port = -1; con->xce_pollfd_idx = -1;