From patchwork Tue Dec 17 15:46:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 11298033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FDDB138C for ; Tue, 17 Dec 2019 15:48:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B4422465E for ; Tue, 17 Dec 2019 15:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="gHesHr3i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B4422465E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihF3d-0003Tt-Av; Tue, 17 Dec 2019 15:46:45 +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 1ihF3b-0003Tk-VO for xen-devel@lists.xen.org; Tue, 17 Dec 2019 15:46:43 +0000 X-Inumbo-ID: 6bbe5e68-20e4-11ea-8f00-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6bbe5e68-20e4-11ea-8f00-12813bfff9fa; Tue, 17 Dec 2019 15:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576597603; h=from:to:cc:subject:date:message-id:mime-version; bh=JFlCHNsOyIZjydDC6J9E8GuCFd5W5QfHmY0eOY2YgDo=; b=gHesHr3ivkoNNlsoCJn18tL88P/pHrs1ZkPT0d+ekQfa0J3ymqXzZQzP Z/GivaZM4fA0B5XSxJhJi00qsbH5zY74ffJvQvTg9oLC49BiBb07NArZn 7ioz2+aSy18yzHDeIGS7JzIk45OJ4L438qrzg2K5NjAu/AtCUKPGl68gg 4=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=sergey.dyasli@citrix.com; spf=Pass smtp.mailfrom=sergey.dyasli@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of sergey.dyasli@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="sergey.dyasli@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of sergey.dyasli@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="sergey.dyasli@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: RzfMFzTjI8lKoVyeINpgANBXFtdOUWZBviiTLaDSXt6QRKeby0Dku0cajZxFAIzBgcqKxVjzNK Bw5P4kbsuhgqvW+DzAOQSVzYEjRArtxTuQ6RDyma14jQnpLknwb+wZ1FIlHENetEoa4B/mfSpt VyuaaPuufPfcejJg2Xsb8bN1FVlq2kGwdWPyR7SSmBQ7ArjRT8VYOsgmPySQah7F/XZpprVVYr QHV542SfNRGx3B5H+MNLdvt57noNiee8VMNXyz8Nxsbkbx9/XvlkAeVyYwSFrey4UGyei7rbHy yG4= X-SBRS: 2.7 X-MesageID: 9826433 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,326,1571716800"; d="scan'208";a="9826433" From: Sergey Dyasli To: Date: Tue, 17 Dec 2019 15:46:25 +0000 Message-ID: <20191217154625.31561-1-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] xsm: hide detailed Xen version from unprivileged guests 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: Sergey Dyasli , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Jan Beulich , Daniel De Graaf Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hide the following information that can help identify the running Xen binary version: XENVER_extraversion XENVER_compile_info XENVER_capabilities XENVER_changeset XENVER_commandline XENVER_build_id Return a more customer friendly empty string instead of "" which would be shown in tools like dmidecode. But allow guests to see this information in Debug builds of Xen. Signed-off-by: Sergey Dyasli --- CC: Andrew Cooper CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Julien Grall CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Wei Liu CC: Daniel De Graaf --- xen/common/version.c | 2 +- xen/include/xsm/dummy.h | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/xen/common/version.c b/xen/common/version.c index 937eb1281c..cc621ab76a 100644 --- a/xen/common/version.c +++ b/xen/common/version.c @@ -67,7 +67,7 @@ const char *xen_banner(void) const char *xen_deny(void) { - return ""; + return ""; } static const void *build_id_p __read_mostly; diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index b8e185e6fa..4a1a1bf2bd 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -750,16 +750,21 @@ static XSM_INLINE int xsm_xen_version (XSM_DEFAULT_ARG uint32_t op) case XENVER_get_features: /* These sub-ops ignore the permission checks and return data. */ return 0; - case XENVER_extraversion: - case XENVER_compile_info: - case XENVER_capabilities: - case XENVER_changeset: case XENVER_pagesize: case XENVER_guest_handle: /* These MUST always be accessible to any guest by default. */ return xsm_default_action(XSM_HOOK, current->domain, NULL); + + case XENVER_extraversion: + case XENVER_compile_info: + case XENVER_capabilities: + case XENVER_changeset: + case XENVER_commandline: + case XENVER_build_id: default: - return xsm_default_action(XSM_PRIV, current->domain, NULL); + /* Hide information from guests only in Release builds. */ + return xsm_default_action(debug_build() ? XSM_HOOK : XSM_PRIV, + current->domain, NULL); } }