From nobody Mon Feb 9 10:48:15 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1589872911; cv=none; d=zohomail.com; s=zohoarc; b=ONECh/zv+5ggo8G5CFH8pBB42q2B+I9Vf63/7FyrrKjUpeX0vK2VqmnNJeto4eXj6tKm1g3J0t4L8JRekRdVBMz5pX/VUwMnoVfle/2L2RQJ7yGAqeUKucEMVPSXGu2kUbbqTKuyo0qI1uoEZ3ExLLPna98ON2gkK+FTPLo3M2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589872911; h=Content-Transfer-Encoding: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=U5ReLvnxUtTYr0XE63WaLyH/cPkqOv+cX4o6obBlJIA=; b=XXXZfpXgflym4rA5zxYN6Cdf5CL8ccL6iV9y53ofnWD25tYvgwomFqXPEYoemRqT1kGy8ILEGd6oj/FIhV/Z9x7PDClz42nwgkqYwZ0xg8Y19tpF8tNxRZOrlkJ1fiM7f3u7tgAxdnpN0RIxXIn+F2Qz4TacrFQ5FfFsZSQbfmw= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158987291128626.6891792444502; Tue, 19 May 2020 00:21:51 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jawYx-0004nG-9z; Tue, 19 May 2020 07:21:19 +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 1jawYv-0004mp-NJ for xen-devel@lists.xenproject.org; Tue, 19 May 2020 07:21:17 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 51106f6c-99a1-11ea-a8e2-12813bfff9fa; Tue, 19 May 2020 07:21:12 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 60E3EB21B; Tue, 19 May 2020 07:21:13 +0000 (UTC) X-Inumbo-ID: 51106f6c-99a1-11ea-a8e2-12813bfff9fa X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Subject: [PATCH v10 07/12] xen: provide version information in hypfs Date: Tue, 19 May 2020 09:21:01 +0200 Message-Id: <20200519072106.26894-8-jgross@suse.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200519072106.26894-1-jgross@suse.com> References: <20200519072106.26894-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Type: text/plain; charset="utf-8" Provide version and compile information in /buildinfo/ node of the Xen hypervisor file system. As this information is accessible by dom0 only no additional security problem arises. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Tested-by: Jan Beulich --- V3: - new patch V4: - add __read_mostly annotations (Jan Beulich) Signed-off-by: Juergen Gross --- docs/misc/hypfs-paths.pandoc | 45 ++++++++++++++++++++++++++++++++++ xen/common/kernel.c | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc index 39539fa1b5..d730caf394 100644 --- a/docs/misc/hypfs-paths.pandoc +++ b/docs/misc/hypfs-paths.pandoc @@ -105,3 +105,48 @@ A populated Xen hypervisor file system might look like= the following example: #### / =20 The root of the hypervisor file system. + +#### /buildinfo/ + +A directory containing static information generated while building the +hypervisor. + +#### /buildinfo/changeset =3D STRING + +Git commit of the hypervisor. + +#### /buildinfo/compileinfo/ + +A directory containing information about compilation of Xen. + +#### /buildinfo/compileinfo/compile_by =3D STRING + +Information who compiled the hypervisor. + +#### /buildinfo/compileinfo/compile_date =3D STRING + +Date of the hypervisor compilation. + +#### /buildinfo/compileinfo/compile_domain =3D STRING + +Information about the compile domain. + +#### /buildinfo/compileinfo/compiler =3D STRING + +The compiler used to build Xen. + +#### /buildinfo/version/ + +A directory containing version information of the hypervisor. + +#### /buildinfo/version/extra =3D STRING + +Extra version information. + +#### /buildinfo/version/major =3D INTEGER + +The major version of Xen. + +#### /buildinfo/version/minor =3D INTEGER + +The minor version of Xen. diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 572e3fc07d..db7bd23fcb 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -373,6 +374,52 @@ void __init do_initcalls(void) (*call)(); } =20 +#ifdef CONFIG_HYPFS +static unsigned int __read_mostly major_version; +static unsigned int __read_mostly minor_version; + +static HYPFS_DIR_INIT(buildinfo, "buildinfo"); +static HYPFS_DIR_INIT(compileinfo, "compileinfo"); +static HYPFS_DIR_INIT(version, "version"); +static HYPFS_UINT_INIT(major, "major", major_version); +static HYPFS_UINT_INIT(minor, "minor", minor_version); +static HYPFS_STRING_INIT(changeset, "changeset"); +static HYPFS_STRING_INIT(compiler, "compiler"); +static HYPFS_STRING_INIT(compile_by, "compile_by"); +static HYPFS_STRING_INIT(compile_date, "compile_date"); +static HYPFS_STRING_INIT(compile_domain, "compile_domain"); +static HYPFS_STRING_INIT(extra, "extra"); + +static int __init buildinfo_init(void) +{ + hypfs_add_dir(&hypfs_root, &buildinfo, true); + + hypfs_string_set_reference(&changeset, xen_changeset()); + hypfs_add_leaf(&buildinfo, &changeset, true); + + hypfs_add_dir(&buildinfo, &compileinfo, true); + hypfs_string_set_reference(&compiler, xen_compiler()); + hypfs_string_set_reference(&compile_by, xen_compile_by()); + hypfs_string_set_reference(&compile_date, xen_compile_date()); + hypfs_string_set_reference(&compile_domain, xen_compile_domain()); + hypfs_add_leaf(&compileinfo, &compiler, true); + hypfs_add_leaf(&compileinfo, &compile_by, true); + hypfs_add_leaf(&compileinfo, &compile_date, true); + hypfs_add_leaf(&compileinfo, &compile_domain, true); + + major_version =3D xen_major_version(); + minor_version =3D xen_minor_version(); + hypfs_add_dir(&buildinfo, &version, true); + hypfs_string_set_reference(&extra, xen_extra_version()); + hypfs_add_leaf(&version, &extra, true); + hypfs_add_leaf(&version, &major, true); + hypfs_add_leaf(&version, &minor, true); + + return 0; +} +__initcall(buildinfo_init); +#endif + # define DO(fn) long do_##fn =20 #endif --=20 2.26.1