Add hypervisor sysfs-like support
v10 cover Add hypervisor sysfs-like support
On the 2019 Xen developer summit there was agreement that the Xen hypervisor should gain support for a hierarchical name-value store similar to the Linux kernel's sysfs.
This is a first implementation of that idea adding the basic functionality to hypervisor and tools side. The interface to any user program making use of that "xen-hypfs" is a new library "libxenhypfs" with a stable interface.
The series adds read-only nodes with buildinfo data and writable nodes with runtime parameters. xl is switched to use the new file system for modifying the runtime parameters and the old sysctl interface for that purpose is dropped.
Changes in V10:
- adressed review comments
Changes in V9:
- addressed review comments
Changes in V8:
- addressed review comments
- added CONFIG_HYPFS config option
Changes in V7:
- old patch 1 already applied
- add new patch 1 (carved out and modified from patch 9)
- addressed review comments
- modified public interface to have a max write size instead of a writable flag only
Changes in V6:
- added new patches 1, 10, 11, 12
- addressed review comments
- modified interface for creating nodes for runtime parameters
Changes in V5:
- switched to xsm for privilege check
Changes in V4:
- former patch 2 removed as already committed
- addressed review comments
Changes in V3:
- major rework, especially by supporting binary contents of entries
- added several new patches (1, 2, 7)
- full support of all runtime parameters
- support of writing entries (especially runtime parameters)
Changes in V2:
- all comments to V1 addressed
- added man-page for xenhypfs tool
- added runtime parameter read access for string parameters
Changes in V1:
- renamed xenfs ->xenhypfs
- added writable entries support at the interface level and in the xenhypfs tool
- added runtime parameter read access (integer type only for now)
- added docs/misc/hypfs-paths.pandoc for path descriptions
Juergen Gross (12):
xen/vmx: let opt_ept_ad always reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfs tools/libxl: use libxenhypfs for setting xen runtime parameters tools/libxc: remove xc_set_parameters()
xen: remove XEN_SYSCTL_set_parameter support
.gitignore | 6 + docs/features/hypervisorfs.pandoc | 92 +++++ docs/man/xenhypfs.1.pod | 61 ++++ docs/misc/hypfs-paths.pandoc | 165 +++++++++ tools/Rules.mk | 8 +- tools/flask/policy/modules/dom0.te | 4 +- tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 -- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/misc/Makefile | 6 + tools/misc/xenhypfs.c | 192 ++++++++++ tools/xl/xl_misc.c | 1 - xen/arch/arm/traps.c | 3 + xen/arch/arm/xen.lds.S | 13 +- xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hvm/vmx/vmcs.c | 47 ++- xen/arch/x86/hvm/vmx/vmx.c | 4 +- xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/domain.c | 21 +- xen/arch/x86/pv/hypercall.c | 3 + xen/arch/x86/xen.lds.S | 12 +- xen/common/Kconfig | 23 ++ xen/common/Makefile | 13 + xen/common/grant_table.c | 62 +++- xen/common/hypfs.c | 452 +++++++++++++++++++++++ xen/common/kernel.c | 84 ++++- xen/common/sysctl.c | 36 -- xen/drivers/char/console.c | 72 +++- xen/include/Makefile | 1 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +- xen/include/public/hypfs.h | 129 +++++++ xen/include/public/sysctl.h | 19 +- xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 123 +++++++ xen/include/xen/kernel.h | 3 + xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 126 +++++-- xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/tools/binfile | 43 +++ xen/xsm/dummy.c | 1 + xen/xsm/flask/Makefile | 5 +- xen/xsm/flask/flask-policy.S | 16 - xen/xsm/flask/hooks.c | 9 +- xen/xsm/flask/policy/access_vectors | 4 +- 56 files changed, 2445 insertions(+), 193 deletions(-) create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644 tools/libs/hypfs/Makefile create mode 100644 tools/libs/hypfs/core.c create mode 100644 tools/libs/hypfs/include/xenhypfs.h create mode 100644 tools/libs/hypfs/libxenhypfs.map create mode 100644 tools/libs/hypfs/xenhypfs.pc.in create mode 100644 tools/misc/xenhypfs.c create mode 100644 xen/common/hypfs.c create mode 100644 xen/include/public/hypfs.h create mode 100644 xen/include/xen/hypfs.h create mode 100755 xen/tools/binfile delete mode 100644 xen/xsm/flask/flask-policy.S
Signature · 1 line
2.26.1
PATCH v10 1/12 xen/vmx: let opt_ept_ad always reflect the current setting
In case opt_ept_ad has not been set explicitly by the user via command line or runtime parameter, it is treated as "no" on Avoton cpus.
Change that handling by setting opt_ept_ad to 0 for this cpu type explicitly if no user value has been set.
By putting this into the (renamed) boot time initialization of vmcs.c _vmx_cpu_up() can be made static.
--- xen/arch/x86/hvm/vmx/vmcs.c | 22 +++++++++++++++------- xen/arch/x86/hvm/vmx/vmx.c | 4 +--- xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +-- 3 files changed, 17 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +15 -7
@@ -315,10 +315,6 @@ static int vmx_init_vmcs_config(void)if ( !opt_ept_ad ) _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT ; -else if (/* Work around Erratum AVR41 on Avoton processors. */ - boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x4d && - opt_ept_ad <0 ) - _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT ;/* * Additional sanity checking before using EPT:
@@ -652,7 +648,7 @@ void vmx_cpu_dead(unsigned int cpu)vmx_pi_desc_fixup (cpu); } -int _vmx_cpu_up (bool bsp) +static int _vmx_cpu_up (bool bsp) {u32 eax, edx;int rc, bios_locked, cpu =smp_processor_id ();
@@ -2108,9 +2104,21 @@ static void vmcs_dump(unsigned char ch)printk ("**************************************\n" ); } -void __init setup_vmcs_dump (void ) +int __init vmx_vmcs_init (void ) { -register_keyhandler ('v' , vmcs_dump,"dump VT-x VMCSs" ,1 ); +int ret; + +if ( opt_ept_ad <0 ) +/* Work around Erratum AVR41 on Avoton processors. */ + opt_ept_ad = !(boot_cpu_data.x86 ==6 && + boot_cpu_data.x86_model ==0x4d ); + + ret =_vmx_cpu_up (true); + +if ( !ret ) +register_keyhandler ('v' , vmcs_dump,"dump VT-x VMCSs" ,1 ); + +return ret; }static void __init __maybe_unused build_assertions (void )
xen/arch/x86/hvm/vmx/vmx.c +1 -3
@@ -2482,7 +2482,7 @@ const struct hvm_function_table * __init start_vmx(void) {set_in_cr4 (X86_CR4_VMXE ); -if (_vmx_cpu_up (true) ) +if (vmx_vmcs_init () ) {printk ("VMX: failed to initialise.\n" );return NULL ;
@@ -2553,8 +2553,6 @@ const struct hvm_function_table * __init start_vmx(void) vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; } -setup_vmcs_dump (); -lbr_tsx_fixup_check ();bdf93_fixup_check ();
xen/include/asm-x86/hvm/vmx/vmcs.h +1 -2
@@ -21,11 +21,10 @@#include <xen/mm.h> extern void vmcs_dump_vcpu (struct vcpu *v); -extern void setup_vmcs_dump (void ); +extern int vmx_vmcs_init (void );extern int vmx_cpu_up_prepare (unsigned int cpu);extern void vmx_cpu_dead (unsigned int cpu);extern int vmx_cpu_up (void ); -extern int _vmx_cpu_up (bool bsp);extern void vmx_cpu_down (void );struct vmcs_struct {
Signature · 1 line
2.26.1
RE: [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting
Quoted 6 lines
From: Juergen Gross <[email protected]>
Sent: Tuesday, May 19, 2020 3:21 PMIn case
opt_ept_adhas not been set explicitly by the user via command line or runtime parameter, it is treated as "no" on Avoton cpus.
Quoted 8 lines
Change that handling by setting
opt_ept_adto 0 for this cpu type explicitly if no user value has been set.By putting this into the (renamed) boot time initialization of
vmcs.c_vmx_cpu_up()can be made static.Signed-off-by Juergen Gross <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Quoted 99 lines
--- xen/arch/x86/hvm/vmx/vmcs.c | 22 +++++++++++++++------- xen/arch/x86/hvm/vmx/vmx.c | 4 +--- xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +-- 3 files changed, 17 insertions(+), 12 deletions(-)xen/arch/x86/hvm/vmx/vmcs.c +0
-2@@ -315,10 +315,6 @@ static int vmx_init_vmcs_config(void)if ( !opt_ept_ad ) _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT ; -else if (/* Work around Erratum AVR41 on Avoton processors. */ - boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4d&&
xen/arch/x86/hvm/vmx/vmcs.c +15
-5- opt_ept_ad < 0 ) - _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT ;/* * Additional sanity checking before using EPT: @@ -652,7 +648,7 @@ void vmx_cpu_dead(unsigned int cpu)vmx_pi_desc_fixup (cpu); } -int _vmx_cpu_up (bool bsp) +static int _vmx_cpu_up (bool bsp) {u32 eax, edx;int rc, bios_locked, cpu =smp_processor_id ();@@ -2108,9 +2104,21 @@ static void vmcs_dump(unsigned char ch)printk ("**************************************\n" ); } -void __init setup_vmcs_dump (void ) +int __init vmx_vmcs_init (void ) { -register_keyhandler ('v' , vmcs_dump,"dump VT-x VMCSs" ,1 ); +int ret; + +if ( opt_ept_ad <0 ) +/* Work around Erratum AVR41 on Avoton processors. */ + opt_ept_ad = !(boot_cpu_data.x86 ==6 && + boot_cpu_data.x86_model ==0x4d ); + + ret =_vmx_cpu_up (true); + +if ( !ret ) +register_keyhandler ('v' , vmcs_dump,"dump VT-x VMCSs" ,1 ); + +return ret; }static void __init __maybe_unused build_assertions (void )xen/arch/x86/hvm/vmx/vmx.c +1
-1@@ -2482,7 +2482,7 @@ const struct hvm_function_table * __initstart_vmx (void) {set_in_cr4 (X86_CR4_VMXE ); -if (_vmx_cpu_up (true) ) +if (vmx_vmcs_init () ) {printk ("VMX: failed to initialise.\n" );return NULL;xen/arch/x86/hvm/vmx/vmx.c +0
-2@@ -2553,8 +2553,6 @@ const struct hvm_function_table * __initstart_vmx (void ) vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; } -setup_vmcs_dump (); -lbr_tsx_fixup_check ();bdf93_fixup_check ();xen/include/asm- renamed from xen/include/asm-x86/hvm/vmx/vmcs.h +0
-0
x86/hvm/vmx/vmcs.h
index95c1dea7b8..906810592f100644xen/include/asm-x86/hvm/vmx/vmcs.h +1
-3@@ -21,11 +21,10 @@#include <xen/mm.h> extern void vmcs_dump_vcpu (struct vcpu *v); -extern void setup_vmcs_dump (void ); +extern int vmx_vmcs_init (void );extern int vmx_cpu_up_prepare (unsigned int cpu);extern void vmx_cpu_dead (unsigned int cpu);extern int vmx_cpu_up (void ); -extern int _vmx_cpu_up (bool bsp);extern void vmx_cpu_down (void );struct vmcs_struct { --2.26.1
PATCH v10 2/12 xen: add a generic way to include binary files as variables
In reply to Juergen GrossAdd a new script xen/tools/binfile for including a binary file at build time being usable via a pointer and a size variable in the hypervisor.
Make use of that generic tool in xsm.
---
V3:
- new patch
V4:
- add alignment parameter (Jan Beulich)
- use .Lend instead of . (Jan Beulich)
--- .gitignore | 1 + xen/tools/binfile | 43 ++++++++++++++++++++++++++++++++++++ xen/xsm/flask/Makefile | 5 ++++- xen/xsm/flask/flask-policy.S | 16 -------------- 4 files changed, 48 insertions(+), 17 deletions(-) create mode 100755 xen/tools/binfile delete mode 100644 xen/xsm/flask/flask-policy.S
.gitignore +1 -0
@@ -314,6 +314,7 @@ xen/test/livepatch/*.livepatch xen/tools/kconfig/.tmp_gtkcheck xen/tools/kconfig/.tmp_qtcheck xen/tools/symbols +xen/xsm/flask/flask-policy.S xen/xsm/flask/include/av_perm_to_string.h xen/xsm/flask/include/av_permissions.h xen/xsm/flask/include/class_to_string.h
xen/tools/binfile new file +43 -0
43 lines not on this page · raw message
xen/xsm/flask/Makefile +4 -1
@@ -39,6 +39,9 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o flask-policy.o: policy.bin +flask-policy.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy + FLASK_BUILD_DIR := $(CURDIR) POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
@@ -48,4 +51,4 @@ policy.bin: FORCE .PHONY: clean clean:: - rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC) + rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC) flask-policy.S
xen/xsm/flask/flask-policy.S deleted +0 -16
@@ -1,16 +0,0 @@ -#include <asm/asm_defns.h> - - .section .init.rodata, "a", %progbits - -/* const unsigned char xsm_flask_init_policy[] __initconst */ - .global xsm_flask_init_policy -xsm_flask_init_policy: - .incbin "policy.bin" -.Lend: - - .type xsm_flask_init_policy, %object - .size xsm_flask_init_policy, . - xsm_flask_init_policy - -/* const unsigned int __initconst xsm_flask_init_policy_size */ - .global xsm_flask_init_policy_size - ASM_INT(xsm_flask_init_policy_size, .Lend - xsm_flask_init_policy)
Signature · 1 line
2.26.1
Re: [PATCH v10 02/12] xen: add a generic way to include binary files as variables
xen/xsm/flask/Makefile $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE · line 43
Quoted 8 lines · Juergen Gross
xen/xsm/flask/Makefile +2
-0@@ -39,6 +39,9 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o flask-policy.o: policy.bin +flask-policy.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policy
I realize the script gets installed as executable, but such permissions can get lost. Typically I think we invoke the shell instead, with the script as first argument. Thoughts? Would affect patch 8 then as well. Sorry for noticing this only now.
Jan
Re: [PATCH v10 02/12] xen: add a generic way to include binary files as variables
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
xen/xsm/flask/Makefile +0
-0@@ -39,6 +39,9 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o flask-policy.o: policy.bin
Quoted 7 lines
xen/xsm/flask/Makefile $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE · line 43
Quoted 2 lines
xen/xsm/flask/Makefile +2
-0+flask-policy.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policyI realize the script gets installed as executable, but such permissions can get lost. Typically I think we invoke the shell instead, with the script as first argument. Thoughts? Would affect patch 8 then as well. Sorry for noticing this only now.
Shall I resend or would you do that while committing?
Juergen
Re: [PATCH v10 02/12] xen: add a generic way to include binary files as variables
Quoted 16 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Juergen Gross
xen/xsm/flask/Makefile +0
-0@@ -39,6 +39,9 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o flask-policy.o: policy.binQuoted 7 lines
xen/xsm/flask/Makefile $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE · line 43
Quoted 2 lines
xen/xsm/flask/Makefile +2
-0+flask-policy.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policyI realize the script gets installed as executable, but such permissions can get lost. Typically I think we invoke the shell instead, with the script as first argument. Thoughts? Would affect patch 8 then as well. Sorry for noticing this only now.
Quoted 1 line
Shall I resend or would you do that while committing?
In patch 8 I'd be fine adding $(SHELL). Here, though, the question is whether it should be $(SHELL) or $(CONFIG_SHELL) - I don't have any idea why the latter exists in the first place. Daniel?
Jan
Re: [PATCH v10 02/12] xen: add a generic way to include binary files as variables
Quoted 17 lines · Jan Beulich
Quoted 16 lines · Jürgen Groß
Quoted 14 lines · Jan Beulich
xen/xsm/flask/Makefile $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE · line 43
Quoted 8 lines · Juergen Gross
xen/xsm/flask/Makefile +2
-0@@ -39,6 +39,9 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o flask-policy.o: policy.bin +flask-policy.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile -i $@ policy.bin xsm_flask_init_policyI realize the script gets installed as executable, but such permissions can get lost. Typically I think we invoke the shell instead, with the script as first argument. Thoughts? Would affect patch 8 then as well. Sorry for noticing this only now.
Quoted 5 lines
Quoted 1 line
Shall I resend or would you do that while committing?
In patch 8 I'd be fine adding $(SHELL). Here, though, the question is whether it should be $(SHELL) or $(CONFIG_SHELL) - I don't have any idea why the latter exists in the first place. Daniel?
Why would different shells be needed in the two patches?
The binfile script is rather simple without any bash-isms in it (AFAICT CONFIG_SHELL seems to prefer bash). So $(SHELL) should be fine IMO.
Juergen
PATCH v10 3/12 docs: add feature document for Xen hypervisor sysfs-like support
In reply to Juergen GrossOn the 2019 Xen developer summit there was agreement that the Xen hypervisor should gain support for a hierarchical name-value store similar to the Linux kernel's sysfs.
In the beginning there should only be basic support: entries can be added from the hypervisor itself only, there is a simple hypercall interface to read the data.
Add a feature document for setting the base of a discussion regarding the desired functionality and the entries to add.
---
V1:
- remove the "--" prefixes of the sub-commands of the user tool (Jan Beulich)
- rename xenfs to xenhypfs (Jan Beulich)
- add "tree" and "write" options to user tool
V2:
- move example tree to the paths description (Ian Jackson)
- specify allowed characters for keys and values (Ian Jackson)
V3:
- correct introduction (writable entries)
V4:
- add list specification
- add entry example (Julien Grall)
- correct date and Xen version (Julien Grall)
- add ARM64 as possible architecture (Julien Grall)
- add version description to the feature doc (Jan Beulich)
V8:
- clarify syntax used in hypfs-paths.pandoc (George Dunlap)
--- docs/features/hypervisorfs.pandoc | 92 +++++++++++++++++++++++++ docs/misc/hypfs-paths.pandoc | 107 ++++++++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/misc/hypfs-paths.pandoc
docs/features/hypervisorfs.pandoc new file +92 -0
@@ -0,0 +1,92 @@ +% Hypervisor FS +% Revision 1 + +\clearpage + +# Basics +---------------- --------------------- + Status: **Supported** + + Architectures: all + + Components: Hypervisor, toolstack +---------------- --------------------- + +# Overview + +The Hypervisor FS is a hierarchical name-value store for reporting +information to guests, especially dom0. It is similar to the Linux +kernel's sysfs. Entries and directories are created by the hypervisor, +while the toolstack is able to use a hypercall to query the entry +values or (if allowed by the hypervisor) to modify them. + +# User details + +With: + + xenhypfs ls <path> + +the user can list the entries of a specific path of the FS. Using: + + xenhypfs cat <path> + +the content of an entry can be retrieved. Using: + + xenhypfs write <path> <string> + +a writable entry can be modified. With: + + xenhypfs tree + +the complete Hypervisor FS entry tree can be printed. + +The FS paths are documented in `docs/misc/hypfs-paths.pandoc`. + +# Technical details + +Access to the hypervisor filesystem is done via the stable new hypercall +__HYPERVISOR_filesystem_op. This hypercall supports a sub-command +XEN_HYPFS_OP_get_version which will return the highest version of the +interface supported by the hypervisor. Additions to the interface need +to bump the interface version. The hypervisor is required to support the +previous interface versions, too (this implies that additions will always +require new sub-commands in order to allow the hypervisor to decide which +version of the interface to use). + +* hypercall interface specification + * `xen/include/public/hypfs.h` +* hypervisor internal files + * `xen/include/xen/hypfs.h` + * `xen/common/hypfs.c` +* `libxenhypfs` + * `tools/libs/libxenhypfs/*` +* `xenhypfs` + * `tools/misc/xenhypfs.c` +* path documentation + * `docs/misc/hypfs-paths.pandoc` + +# Testing + +Any new parameters or hardware mitigations should be verified to show up +correctly in the filesystem. + +# Areas for improvement + +* More detailed access rights +* Entries per domain and/or per cpupool + +# Known issues + +* None + +# References + +* None + +# History + +------------------------------------------------------------------------ +Date Revision Version Notes +---------- -------- -------- ------------------------------------------- +2020-01-23 1 Xen 4.14 Document written +---------- -------- -------- -------------------------------------------
docs/misc/hypfs-paths.pandoc new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
2.26.1
PATCH v10 4/12 xen: add basic hypervisor filesystem support
In reply to Juergen GrossAdd the infrastructure for the hypervisor filesystem.
This includes the hypercall interface and the base functions for entry creation, deletion and modification.
In order not to have to repeat the same pattern multiple times in case adding a new node should BUG_ON() failure, the helpers for adding a node (hypfs_add_dir() and hypfs_add_leaf()) get a nofault parameter causing the BUG() in case of a failure.
---
V1:
- rename files from filesystem.* to hypfs.*
- add dummy write entry support
- rename hypercall filesystem_op to hypfs_op
- add support for unsigned integer entries
V2:
- test new entry name to be valid
V3:
- major rework, especially by supporting binary contents of entries
- addressed all comments
V4:
- sort #includes alphabetically (Wei Liu)
- add public interface structures to xlat.lst (Jan Beulich)
- let DIRENTRY_SIZE() add 1 for trailing nul byte (Jan Beulich)
- remove hypfs_add_entry() (Jan Beulich)
- len -> ulen (Jan Beulich)
- switch sequence of tests in hypfs_get_entry_rel() (Jan Beulich)
- add const qualifier (Jan Beulich)
- return -ENOBUFS if only direntry but no entry contents are returned (Jan Beulich)
- use xmalloc() instead of xzalloc() (Jan Beulich)
- better error handling in hypfs_write_leaf() (Jan Beulich)
- return -EOPNOTSUPP for unknown sub-command (Jan Beulich)
- use plain integers for enum-like constants in public interface (Jan Beulich)
- rename XEN_HYPFS_OP_read_contents to XEN_HYPFS_OP_read (Jan Beulich)
- add some comments in include/public/hypfs.h (Jan Beulich)
- use const_char for user parameter path (Jan Beulich)
- add helpers for XEN_HYPFS_TYPE_BOOL and XEN_HYPFS_TYPE_INT entry definitions (Jan Beulich)
- make statically defined entries __read_mostly (Jan Beulich)
V5:
- switch to xsm for privilege check
V6:
- use memchr() for testing correct string length (Jan Beulich)
- reject writing to non-string leafs with wrong length (Jan Beulich)
- only support bools of natural size (Julien Grall)
- adjust blank padding in header (Jan Beulich)
- adjust comments in public header (Jan Beulich)
- rename hypfs_string_set() and add comment (Jan Beulich)
- add common HYPFS_INIT helper macro (Jan Beulich)
- really check structures added to xlat.lst (Jan Beulich)
- add missing xsm parts (Jan Beulich)
V7:
- simplify compat check (Jan Beulich)
- add max write size (Jan Beulich)
- better length testing of written string (Jan Beulich)
V8:
- add Kconfig item CONFIG_HYPFS (Jan Beulich)
- init write pointer in HYPFS_*_INIT_WRITABLE() (Jan Beulich)
- expand write ASSERT()s (Jan Beulich)
V9:
- move hypfs to correct position in Makefile (Jan Beulich)
- avoid recursion in hypfs_get_entry_rel() (Jan Beulich)
- make hypfs_get_entry() static (Jan Beulich)
- assert locking in read/write functions (Jan Beulich)
- add ASSERT() in hypfs_write_leaf() (Jan Beulich)
- add encoding test in hypfs_write_leaf() (Jan Beulich)
- test parameters of XEN_HYPFS_OP_get_version to be zero (Jan Beulich)
- add parantheses in macro (Jan Beulich)
- make ulen type unsigned int in functions (Jan Beulich)
V10:
- add locking ASSERT()s (Jan Beulich)
- correct indentation (Jan Beulich)
--- tools/flask/policy/modules/dom0.te | 2 +- xen/arch/arm/traps.c | 3 + xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/hypercall.c | 3 + xen/common/Kconfig | 11 + xen/common/Makefile | 1 + xen/common/hypfs.c | 422 ++++++++++++++++++++++++++++ xen/include/Makefile | 1 + xen/include/public/hypfs.h | 129 +++++++++ xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 121 ++++++++ xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/xsm/dummy.c | 1 + xen/xsm/flask/hooks.c | 6 + xen/xsm/flask/policy/access_vectors | 2 + 19 files changed, 732 insertions(+), 1 deletion(-) create mode 100644 xen/common/hypfs.c create mode 100644 xen/include/public/hypfs.h create mode 100644 xen/include/xen/hypfs.h
tools/flask/policy/modules/dom0.te +1 -1
@@ -11,7 +11,7 @@ allow dom0_t xen_t:xen { mtrr_del mtrr_read microcode physinfo quirk writeconsole readapic writeapic privprofile nonprivprofile kexec firmware sleep frequency getidle debug getcpuinfo heap pm_op mca_op lockprof cpupool_op - getscheduler setscheduler + getscheduler setscheduler hypfs_op }; allow dom0_t xen_t:xen2 { resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbol
xen/arch/arm/traps.c +3 -0
@@ -1381,6 +1381,9 @@ static arm_hypercall_t arm_hypercall_table[] = {#ifdef CONFIG_ARGO HYPERCALL(argo_op, 5),#endif +#ifdef CONFIG_HYPFS + HYPERCALL(hypfs_op, 5), +#endif };#ifndef NDEBUG
xen/arch/x86/hvm/hypercall.c +3 -0
@@ -150,6 +150,9 @@ static const hypercall_table_t hvm_hypercall_table[] = {#endif HYPERCALL (xenpmu_op),COMPAT_CALL (dm_op ), +#ifdef CONFIG_HYPFS +HYPERCALL (hypfs_op ), +#endifHYPERCALL (arch_1 ) };
xen/arch/x86/hypercall.c +3 -0
@@ -72,6 +72,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =#ifdef CONFIG_HVM ARGS(hvm_op, 2), ARGS(dm_op, 3), +#endif +#ifdef CONFIG_HYPFS +ARGS (hypfs_op,5 ), #endifARGS (mca,1 ), ARGS(arch_1, 1),
xen/arch/x86/pv/hypercall.c +3 -0
@@ -84,6 +84,9 @@ const hypercall_table_t pv_hypercall_table[] = {#ifdef CONFIG_HVM HYPERCALL(hvm_op), COMPAT_CALL(dm_op), +#endif +#ifdef CONFIG_HYPFS +HYPERCALL (hypfs_op), #endifHYPERCALL (mca), HYPERCALL(arch_1),
xen/common/Kconfig +11 -0
@@ -116,6 +116,17 @@ config SPECULATIVE_HARDEN_BRANCH endmenu +config HYPFS + bool "Hypervisor file system support" + default y + ---help--- + Support Xen hypervisor file system. This file system is used to + present various hypervisor internal data to dom0 and in some + cases to allow modifying settings. Disabling the support might + result in some features not being available. + + If unsure, say Y. + config KEXEC bool "kexec support" default y
xen/common/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o obj-$(CONFIG_GRANT_TABLE) += grant_table.o obj-y += guestcopy.o obj-bin-y += gunzip.init.o +obj-$(CONFIG_HYPFS) += hypfs.o obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.o
xen/common/hypfs.c new file +422 -0
422 lines not on this page · raw message
xen/include/Makefile +1 -0
@@ -9,6 +9,7 @@ headers-y := \ compat/event_channel.h \ compat/features.h \ compat/grant_table.h \ + compat/hypfs.h \ compat/kexec.h \ compat/memory.h \ compat/nmi.h \
xen/include/public/hypfs.h new file +129 -0
129 lines not on this page · raw message
xen/include/public/xen.h +1 -0
@@ -130,6 +130,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);#define __HYPERVISOR_argo_op 39#define __HYPERVISOR_xenpmu_op 40#define __HYPERVISOR_dm_op 41 +#define __HYPERVISOR_hypfs_op 42/* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48
xen/include/xen/hypercall.h +10 -0
@@ -150,6 +150,16 @@ do_dm_op( unsigned int nr_bufs, XEN_GUEST_HANDLE_PARAM(xen_dm_op_buf_t) bufs); +#ifdef CONFIG_HYPFS +extern long +do_hypfs_op ( +unsigned int cmd, +XEN_GUEST_HANDLE_PARAM (const_char) arg1, +unsigned long arg2, +XEN_GUEST_HANDLE_PARAM (void ) arg3, +unsigned long arg4); +#endif +#ifdef CONFIG_COMPAT extern int
xen/include/xen/hypfs.h new file +121 -0
121 lines not on this page · raw message
xen/include/xlat.lst +2 -0
@@ -86,6 +86,8 @@ ? vcpu_hvm_context hvm/hvm_vcpu.h ? vcpu_hvm_x86_32 hvm/hvm_vcpu.h ? vcpu_hvm_x86_64 hvm/hvm_vcpu.h +? hypfs_direntry hypfs.h +? hypfs_dirlistentry hypfs.h ? kexec_exec kexec.h ! kexec_image kexec.h ! kexec_range kexec.h
xen/include/xsm/dummy.h +6 -0
@@ -434,6 +434,12 @@ static XSM_INLINE int xsm_page_offline(XSM_DEFAULT_ARG uint32_t cmd)return xsm_default_action (action, current->domain,NULL ); } +static XSM_INLINE int xsm_hypfs_op(XSM_DEFAULT_VOID) +{ +XSM_ASSERT_ACTION (XSM_PRIV ); +return xsm_default_action (action, current->domain,NULL ); +} +static XSM_INLINE long xsm_do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {return -ENOSYS ;
xen/include/xsm/xsm.h +6 -0
@@ -127,6 +127,7 @@ struct xsm_operations {int (*resource_setup_misc) (void );int (*page_offline)(uint32_t cmd); +int (*hypfs_op)(void );long (*do_xsm_op) (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op);#ifdef CONFIG_COMPAT
@@ -536,6 +537,11 @@ static inline int xsm_page_offline(xsm_default_t def, uint32_t cmd)return xsm_ops->page_offline (cmd); } +static inline int xsm_hypfs_op (xsm_default_t def) +{ +return xsm_ops->hypfs_op (); +} +static inline long xsm_do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {return xsm_ops->do_xsm_op (op);
xen/xsm/dummy.c +1 -0
@@ -103,6 +103,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)set_to_dummy_if_null (ops, resource_setup_misc);set_to_dummy_if_null (ops, page_offline); +set_to_dummy_if_null (ops, hypfs_op);set_to_dummy_if_null (ops, hvm_param);set_to_dummy_if_null (ops, hvm_control);set_to_dummy_if_null (ops, hvm_param_nested);
xen/xsm/flask/hooks.c +6 -0
@@ -1173,6 +1173,11 @@ static inline int flask_page_offline(uint32_t cmd) } } +static inline int flask_hypfs_op (void ) +{ +return domain_has_xen (current->domain,XEN__HYPFS_OP ); +} +static int flask_add_to_physmap (struct domain *d1,struct domain *d2) {return domain_has_perm (d1, d2,SECCLASS_MMU ,MMU__PHYSMAP );
@@ -1812,6 +1817,7 @@ static struct xsm_operations flask_ops = { .resource_setup_misc = flask_resource_setup_misc, .page_offline = flask_page_offline, + .hypfs_op = flask_hypfs_op, .hvm_param = flask_hvm_param, .hvm_control = flask_hvm_param, .hvm_param_nested = flask_hvm_param_nested,
xen/xsm/flask/policy/access_vectors +2 -0
@@ -67,6 +67,8 @@ class xen lockprof # XEN_SYSCTL_cpupool_op cpupool_op +# hypfs hypercall + hypfs_op # XEN_SYSCTL_scheduler_op with XEN_DOMCTL_SCHEDOP_getinfo, XEN_SYSCTL_sched_id, XEN_DOMCTL_SCHEDOP_getvcpuinfo getscheduler # XEN_SYSCTL_scheduler_op with XEN_DOMCTL_SCHEDOP_putinfo, XEN_DOMCTL_SCHEDOP_putvcpuinfo
Signature · 1 line
2.26.1
Re: [PATCH v10 04/12] xen: add basic hypervisor filesystem support
Hi Juergen,
Quoted 5 lines · Juergen Gross
Add the infrastructure for the hypervisor filesystem.
This includes the hypercall interface and the base functions for entry creation, deletion and modification.
Quoted 7 lines
In order not to have to repeat the same pattern multiple times in case adding a new node should
BUG_ON()failure, the helpers for adding a node (hypfs_add_dir()andhypfs_add_leaf()) get a nofault parameter causing theBUG()in case of a failure.Signed-off-by Juergen Gross <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Cheers,
Quoted 1,043 lines
---
V1:
- rename files from filesystem.* to hypfs.*
- add dummy write entry support
- rename hypercallfilesystem_optohypfs_op
- add support for unsigned integer entriesV2:
- test new entry name to be validV3:
- major rework, especially by supporting binary contents of entries
- addressed all commentsV4:
- sort #includes alphabetically (Wei Liu)
- add public interface structures to xlat.lst (Jan Beulich)
- letDIRENTRY_SIZE()add 1 for trailing nul byte (Jan Beulich)
- removehypfs_add_entry()(Jan Beulich)
- len -> ulen (Jan Beulich)
- switch sequence of tests inhypfs_get_entry_rel()(Jan Beulich)
- add const qualifier (Jan Beulich)
- return-ENOBUFSif only direntry but no entry contents are returned (Jan Beulich)
- usexmalloc()instead ofxzalloc()(Jan Beulich)
- better error handling inhypfs_write_leaf()(Jan Beulich)
- return-EOPNOTSUPPfor unknown sub-command (Jan Beulich)
- use plain integers for enum-like constants in public interface (Jan Beulich)
- renameXEN_HYPFS_OP_read_contentstoXEN_HYPFS_OP_read(Jan Beulich)
- add some comments ininclude/public/hypfs.h(Jan Beulich)
- useconst_charfor user parameter path (Jan Beulich)
- add helpers forXEN_HYPFS_TYPE_BOOLandXEN_HYPFS_TYPE_INTentry definitions (Jan Beulich)
- make statically defined entries__read_mostly(Jan Beulich)V5:
- switch to xsm for privilege checkV6:
- usememchr()for testing correct string length (Jan Beulich)
- reject writing to non-string leafs with wrong length (Jan Beulich)
- only support bools of natural size (Julien Grall)
- adjust blank padding in header (Jan Beulich)
- adjust comments in public header (Jan Beulich)
- renamehypfs_string_set()and add comment (Jan Beulich)
- add commonHYPFS_INIThelper macro (Jan Beulich)
- really check structures added to xlat.lst (Jan Beulich)
- add missing xsm parts (Jan Beulich)V7:
- simplify compat check (Jan Beulich)
- add max write size (Jan Beulich)
- better length testing of written string (Jan Beulich)V8:
- addKconfigitemCONFIG_HYPFS(Jan Beulich)
- init write pointer in HYPFS_*_INIT_WRITABLE() (Jan Beulich)
- expand write ASSERT()s (Jan Beulich)V9:
- move hypfs to correct position inMakefile(Jan Beulich)
- avoid recursion inhypfs_get_entry_rel()(Jan Beulich)
- makehypfs_get_entry()static (Jan Beulich)
- assert locking in read/write functions (Jan Beulich)
- addASSERT()inhypfs_write_leaf()(Jan Beulich)
- add encoding test inhypfs_write_leaf()(Jan Beulich)
- test parameters ofXEN_HYPFS_OP_get_versionto be zero (Jan Beulich)
- add parantheses in macro (Jan Beulich)
- make ulen type unsigned int in functions (Jan Beulich)V10:
- add locking ASSERT()s (Jan Beulich)
- correct indentation (Jan Beulich)Signed-off-by Juergen Gross <[email protected]>--- tools/flask/policy/modules/dom0.te | 2 +- xen/arch/arm/traps.c | 3 + xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/hypercall.c | 3 + xen/common/Kconfig | 11 + xen/common/Makefile | 1 + xen/common/hypfs.c | 422 ++++++++++++++++++++++++++++ xen/include/Makefile | 1 + xen/include/public/hypfs.h | 129 +++++++++ xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 121 ++++++++ xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/xsm/dummy.c | 1 + xen/xsm/flask/hooks.c | 6 + xen/xsm/flask/policy/access_vectors | 2 + 19 files changed, 732 insertions(+), 1 deletion(-)create mode 100644
xen/common/hypfs.c
create mode 100644xen/include/public/hypfs.h
create mode 100644xen/include/xen/hypfs.htools/flask/policy/modules/dom0.te +1
-1@@ -11,7 +11,7 @@ allow dom0_t xen_t:xen { mtrr_del mtrr_read microcode physinfo quirk writeconsole readapic writeapic privprofile nonprivprofile kexec firmware sleep frequency getidle debug getcpuinfo heap pm_op mca_op lockprof cpupool_op - getscheduler setscheduler + getscheduler setscheduler hypfs_op }; allow dom0_t xen_t:xen2 { resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbolxen/arch/arm/traps.c +3
-0@@ -1381,6 +1381,9 @@ static arm_hypercall_t arm_hypercall_table[] = {#ifdef CONFIG_ARGO HYPERCALL(argo_op, 5),#endif +#ifdef CONFIG_HYPFS + HYPERCALL(hypfs_op, 5), +#endif };#ifndef NDEBUG xen/arch/x86/hvm/hypercall.c +3
-0@@ -150,6 +150,9 @@ static const hypercall_table_t hvm_hypercall_table[] = {#endif HYPERCALL (xenpmu_op),COMPAT_CALL (dm_op ), +#ifdef CONFIG_HYPFS +HYPERCALL (hypfs_op ), +#endifHYPERCALL (arch_1 ) };xen/arch/x86/hypercall.c +3
-0@@ -72,6 +72,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =#ifdef CONFIG_HVM ARGS(hvm_op, 2), ARGS(dm_op, 3), +#endif +#ifdef CONFIG_HYPFS +ARGS (hypfs_op,5 ), #endifARGS (mca,1 ), ARGS(arch_1, 1),xen/arch/x86/pv/hypercall.c +3
-0@@ -84,6 +84,9 @@ const hypercall_table_t pv_hypercall_table[] = {#ifdef CONFIG_HVM HYPERCALL(hvm_op), COMPAT_CALL(dm_op), +#endif +#ifdef CONFIG_HYPFS +HYPERCALL (hypfs_op), #endifHYPERCALL (mca), HYPERCALL(arch_1),xen/common/Kconfig +11
-0@@ -116,6 +116,17 @@ config SPECULATIVE_HARDEN_BRANCH endmenu +config HYPFS + bool "Hypervisor file system support" + default y + ---help--- + Support Xen hypervisor file system. This file system is used to + present various hypervisor internal data to dom0 and in some + cases to allow modifying settings. Disabling the support might + result in some features not being available. + + If unsure, say Y. + config KEXEC bool "kexec support" default yxen/common/Makefile +1
-0@@ -14,6 +14,7 @@ obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o obj-$(CONFIG_GRANT_TABLE) += grant_table.o obj-y += guestcopy.o obj-bin-y += gunzip.init.o +obj-$(CONFIG_HYPFS) += hypfs.o obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.oxen/common/hypfs.c new file +422
-0@@ -0,0 +1,422 @@ +/****************************************************************************** +* +* hypfs.c +* +* Simple sysfs-like file system for the hypervisor. +*/ + +#include <xen/err.h> +#include <xen/guest_access.h> +#include <xen/hypercall.h> +#include <xen/hypfs.h> +#include <xen/lib.h> +#include <xen/rwlock.h> +#include <public/hypfs.h> + +#ifdef CONFIG_COMPAT +#include <compat/hypfs.h> +CHECK_hypfs_dirlistentry; +#endif + +#define DIRENTRY_NAME_OFF offsetof(struct xen_hypfs_dirlistentry, name) +#define DIRENTRY_SIZE (name_len) \ + (DIRENTRY_NAME_OFF + \ + ROUNDUP((name_len) + 1, alignof(struct xen_hypfs_direntry))) + +static DEFINE_RWLOCK (hypfs_lock); +enum hypfs_lock_state { + hypfs_unlocked, + hypfs_read_locked, + hypfs_write_locked +}; +static DEFINE_PER_CPU(enum hypfs_lock_state, hypfs_locked); + +HYPFS_DIR_INIT (hypfs_root,"" ); + +static void hypfs_read_lock (void ) +{ +ASSERT (this_cpu (hypfs_locked) != hypfs_write_locked); + +read_lock (&hypfs_lock); +this_cpu (hypfs_locked) = hypfs_read_locked; +} + +static void hypfs_write_lock (void ) +{ +ASSERT (this_cpu (hypfs_locked) == hypfs_unlocked); + +write_lock (&hypfs_lock); +this_cpu (hypfs_locked) = hypfs_write_locked; +} + +static void hypfs_unlock (void ) +{ +enum hypfs_lock_state locked =this_cpu (hypfs_locked); + +this_cpu (hypfs_locked) = hypfs_unlocked; + +switch ( locked ) + { +case hypfs_read_locked: +read_unlock (&hypfs_lock); +break ; +case hypfs_write_locked: +write_unlock (&hypfs_lock); +break ; +default : +BUG (); + } +} + +static int add_entry (struct hypfs_entry_dir *parent,struct hypfs_entry *new) +{ +int ret = -ENOENT ; +struct hypfs_entry *e; + +hypfs_write_lock (); + + list_for_each_entry ( e, &parent->dirlist, list ) + { +int cmp =strcmp (e->name, new->name); + +if ( cmp >0 ) + { + ret =0 ; +list_add_tail (&new->list, &e->list); +break ; + } +if ( cmp ==0 ) + { + ret = -EEXIST ; +break ; + } + } + +if ( ret == -ENOENT ) + { + ret =0 ; +list_add_tail (&new->list, &parent->dirlist); + } + +if ( !ret ) + { +unsigned int sz =strlen (new->name); + + parent->e.size +=DIRENTRY_SIZE (sz); + } + +hypfs_unlock (); + +return ret; +} + +int hypfs_add_dir (struct hypfs_entry_dir *parent, +struct hypfs_entry_dir *dir,bool nofault) +{ +int ret; + + ret =add_entry (parent, &dir->e); +BUG_ON (nofault && ret); + +return ret; +} + +int hypfs_add_leaf (struct hypfs_entry_dir *parent, +struct hypfs_entry_leaf *leaf,bool nofault) +{ +int ret; + +if ( !leaf->content ) + ret = -EINVAL ; +else + ret =add_entry (parent, &leaf->e); +BUG_ON (nofault && ret); + +return ret; +} + +static int hypfs_get_path_user (char *buf, +XEN_GUEST_HANDLE_PARAM (const_char) uaddr, +unsigned long ulen) +{ +if ( ulen >XEN_HYPFS_MAX_PATHLEN ) +return -EINVAL ; + +if (copy_from_guest (buf, uaddr, ulen) ) +return -EFAULT ; + +if (memchr (buf,0 , ulen) != buf + ulen -1 ) +return -EINVAL ; + +return 0 ; +} + +static struct hypfs_entry *hypfs_get_entry_rel (struct hypfs_entry_dir *dir, +const char *path) +{ +const char *end; +struct hypfs_entry *entry; +unsigned int name_len; +bool again = true; + +while ( again ) + { +if ( dir->e.type !=XEN_HYPFS_TYPE_DIR ) +return NULL ; + +if ( !*path ) +return &dir->e; + + end =strchr (path,'/' ); +if ( !end ) + end =strchr (path,'\0' ); + name_len = end - path; + + again = false; + + list_for_each_entry ( entry, &dir->dirlist, list ) + { +int cmp =strncmp (path, entry->name, name_len); +struct hypfs_entry_dir *d =container_of (entry, + struct hypfs_entry_dir, e); + +if ( cmp <0 ) +return NULL ; +if ( !cmp &&strlen (entry->name) == name_len ) + { +if ( !*end ) +return entry; + + again = true; + dir = d; + path = end +1 ; + +break ; + } + } + } + +return NULL ; +} + +static struct hypfs_entry *hypfs_get_entry (const char *path) +{ +if ( path[0 ] !='/' ) +return NULL ; + +return hypfs_get_entry_rel (&hypfs_root, path +1 ); +} + +int hypfs_read_dir (const struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr) +{ +const struct hypfs_entry_dir *d; +const struct hypfs_entry *e; +unsigned int size = entry->size; + +ASSERT (this_cpu (hypfs_locked) != hypfs_unlocked); + + d = container_of(entry, const struct hypfs_entry_dir, e); + + list_for_each_entry ( e, &d->dirlist, list ) + { +struct xen_hypfs_dirlistentry direntry; +unsigned int e_namelen =strlen (e->name); +unsigned int e_len =DIRENTRY_SIZE (e_namelen); + + direntry.e.pad =0 ; + direntry.e.type = e->type; + direntry.e.encoding = e->encoding; + direntry.e.content_len = e->size; + direntry.e.max_write_len = e->max_size; + direntry.off_next =list_is_last (&e->list, &d->dirlist) ?0 : e_len; +if (copy_to_guest (uaddr, &direntry,1 ) ) +return -EFAULT ; + +if (copy_to_guest_offset (uaddr,DIRENTRY_NAME_OFF , + e->name, e_namelen +1 ) ) +return -EFAULT ; + +guest_handle_add_offset (uaddr, e_len); + +ASSERT (e_len <= size); + size -= e_len; + } + +return 0 ; +} + +int hypfs_read_leaf (const struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr) +{ +const struct hypfs_entry_leaf *l; + +ASSERT (this_cpu (hypfs_locked) != hypfs_unlocked); + + l = container_of(entry, const struct hypfs_entry_leaf, e); + +return copy_to_guest (uaddr, l->content, entry->size) ? -EFAULT :0 ; +} + +static int hypfs_read (const struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned long ulen) +{ +struct xen_hypfs_direntry e; +long ret = -EINVAL ; + +if ( ulen <sizeof (e) ) + goto out; + + e.pad =0 ; + e.type = entry->type; + e.encoding = entry->encoding; + e.content_len = entry->size; + e.max_write_len = entry->max_size; + + ret = -EFAULT ; +if (copy_to_guest (uaddr, &e,1 ) ) + goto out; + + ret = -ENOBUFS ; +if ( ulen < entry->size +sizeof (e) ) + goto out; + +guest_handle_add_offset (uaddr,sizeof (e)); + + ret = entry->read (entry, uaddr); + + out: +return ret; +} + +int hypfs_write_leaf (struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen) +{ +char *buf; +int ret; + +ASSERT (this_cpu (hypfs_locked) == hypfs_write_locked); +ASSERT (ulen <= leaf->e.max_size); + +if ( leaf->e.type !=XEN_HYPFS_TYPE_STRING && + leaf->e.type !=XEN_HYPFS_TYPE_BLOB && ulen != leaf->e.size ) +return -EDOM ; + + buf =xmalloc_array (char, ulen); +if ( !buf ) +return -ENOMEM ; + + ret = -EFAULT ; +if (copy_from_guest (buf, uaddr, ulen) ) + goto out; + + ret = -EINVAL ; +if ( leaf->e.type ==XEN_HYPFS_TYPE_STRING && + leaf->e.encoding ==XEN_HYPFS_ENC_PLAIN && +memchr (buf,0 , ulen) != (buf + ulen -1 ) ) + goto out; + + ret =0 ; +memcpy (leaf->write_ptr, buf, ulen); + leaf->e.size = ulen; + + out: +xfree (buf); +return ret; +} + +int hypfs_write_bool (struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen) +{ +bool buf; + +ASSERT (this_cpu (hypfs_locked) == hypfs_write_locked); +ASSERT (leaf->e.type ==XEN_HYPFS_TYPE_BOOL && + leaf->e.size ==sizeof (bool ) && + leaf->e.max_size ==sizeof (bool ) ); + +if ( ulen != leaf->e.max_size ) +return -EDOM ; + +if (copy_from_guest (&buf, uaddr, ulen) ) +return -EFAULT ; + + *(bool *)leaf->write_ptr = buf; + +return 0 ; +} + +static int hypfs_write (struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned long ulen) +{ +struct hypfs_entry_leaf *l; + +if ( !entry->write ) +return -EACCES ; + +ASSERT (entry->max_size); + +if ( ulen > entry->max_size ) +return -ENOSPC ; + + l = container_of(entry, struct hypfs_entry_leaf, e); + +return entry->write (l, uaddr, ulen); +} + +long do_hypfs_op (unsigned int cmd, +XEN_GUEST_HANDLE_PARAM (const_char) arg1,unsigned long arg2, +XEN_GUEST_HANDLE_PARAM (void ) arg3,unsigned long arg4) +{ +int ret; +struct hypfs_entry *entry; +static char path[XEN_HYPFS_MAX_PATHLEN ]; + +if (xsm_hypfs_op (XSM_PRIV ) ) +return -EPERM ; + +if ( cmd == XEN_HYPFS_OP_get_version ) + { +if ( !guest_handle_is_null (arg1) || arg2 || + !guest_handle_is_null (arg3) || arg4 ) +return -EINVAL ; + +return XEN_HYPFS_VERSION ; + } + +if ( cmd == XEN_HYPFS_OP_write_contents ) +hypfs_write_lock (); +else +hypfs_read_lock (); + + ret =hypfs_get_path_user (path, arg1, arg2); +if ( ret ) + goto out; + + entry =hypfs_get_entry (path); +if ( !entry ) + { + ret = -ENOENT ; + goto out; + } + +switch ( cmd ) + { +case XEN_HYPFS_OP_read: + ret =hypfs_read (entry, arg3, arg4); +break ; + +case XEN_HYPFS_OP_write_contents: + ret =hypfs_write (entry, arg3, arg4); +break ; + +default : + ret = -EOPNOTSUPP ; +break ; + } + + out: +hypfs_unlock (); + +return ret; +}xen/include/Makefile +1
-0@@ -9,6 +9,7 @@ headers-y := \ compat/event_channel.h \ compat/features.h \ compat/grant_table.h \ + compat/hypfs.h \ compat/kexec.h \ compat/memory.h \ compat/nmi.h \xen/include/public/hypfs.h new file +129
-0@@ -0,0 +1,129 @@ +/****************************************************************************** +* Xen Hypervisor Filesystem +* +* Copyright (c) 2019, SUSE Software Solutions Germany GmbH +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __XEN_PUBLIC_HYPFS_H__ +#define __XEN_PUBLIC_HYPFS_H__ + +#include "xen.h" + +/* +* Definitions for the __HYPERVISOR_hypfs_op hypercall. +*/ + +/* Highest version number of the hypfs interface currently defined. */ +#define XEN_HYPFS_VERSION 1 + +/* Maximum length of a path in the filesystem. */ +#define XEN_HYPFS_MAX_PATHLEN 1024 + +struct xen_hypfs_direntry { +uint8_t type; +#define XEN_HYPFS_TYPE_DIR 0 +#define XEN_HYPFS_TYPE_BLOB 1 +#define XEN_HYPFS_TYPE_STRING 2 +#define XEN_HYPFS_TYPE_UINT 3 +#define XEN_HYPFS_TYPE_INT 4 +#define XEN_HYPFS_TYPE_BOOL 5 +uint8_t encoding; +#define XEN_HYPFS_ENC_PLAIN 0 +#define XEN_HYPFS_ENC_GZIP 1 +uint16_t pad;/* Returned as 0. */ +uint32_t content_len;/* Current length of data. */ +uint32_t max_write_len;/* Max. length for writes (0 if read-only). */ +}; + +struct xen_hypfs_dirlistentry { +struct xen_hypfs_direntry e; +/* Offset in bytes to next entry (0 == this is the last entry). */ +uint16_t off_next; +/* Zero terminated entry name, possibly with some padding for alignment. */ +char name[XEN_FLEX_ARRAY_DIM ]; +}; + +/* +* Hypercall operations. +*/ + +/* +* XEN_HYPFS_OP_get_version +* +* Read highest interface version supported by the hypervisor. +* +* arg1 - arg4: all 0/NULL +* +* Possible return values: +* >0: highest supported interface version +* <0: negative Xen errno value +*/ +#define XEN_HYPFS_OP_get_version 0 + +/* +* XEN_HYPFS_OP_read +* +* Read a filesystem entry. +* +* Returns the direntry and contents of an entry in the buffer supplied by the +* caller (struct xen_hypfs_direntry with the contents following directly +* after it). +* The data buffer must be at least the size of the direntry returned. If the +* data buffer was not large enough for all the data -ENOBUFS and no entry +* data is returned, but the direntry will contain the needed size for the +* returned data. +* The format of the contents is according to its entry type and encoding. +* The contents of a directory are multiple struct xen_hypfs_dirlistentry +* items. +* +* arg1: XEN_GUEST_HANDLE(path name) +* arg2: length of path name (including trailing zero byte) +* arg3: XEN_GUEST_HANDLE(data buffer written by hypervisor) +* arg4: data buffer size +* +* Possible return values: +* 0: success +* <0 : negative Xen errno value +*/ +#define XEN_HYPFS_OP_read 1 + +/* +* XEN_HYPFS_OP_write_contents +* +* Write contents of a filesystem entry. +* +* Writes an entry with the contents of a buffer supplied by the caller. +* The data type and encoding can't be changed. The size can be changed only +* for blobs and strings. +* +* arg1: XEN_GUEST_HANDLE(path name) +* arg2: length of path name (including trailing zero byte) +* arg3: XEN_GUEST_HANDLE(content buffer read by hypervisor) +* arg4: content buffer size +* +* Possible return values: +* 0: success +* <0 : negative Xen errno value +*/ +#define XEN_HYPFS_OP_write_contents 2 + +#endif /* __XEN_PUBLIC_HYPFS_H__ */ xen/include/public/xen.h +1
-0@@ -130,6 +130,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);#define __HYPERVISOR_argo_op 39#define __HYPERVISOR_xenpmu_op 40#define __HYPERVISOR_dm_op 41 +#define __HYPERVISOR_hypfs_op 42/* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48xen/include/xen/hypercall.h +10
-0@@ -150,6 +150,16 @@ do_dm_op( unsigned int nr_bufs, XEN_GUEST_HANDLE_PARAM(xen_dm_op_buf_t) bufs); +#ifdef CONFIG_HYPFS +extern long +do_hypfs_op ( +unsigned int cmd, +XEN_GUEST_HANDLE_PARAM (const_char) arg1, +unsigned long arg2, +XEN_GUEST_HANDLE_PARAM (void ) arg3, +unsigned long arg4); +#endif +#ifdef CONFIG_COMPAT extern intxen/include/xen/hypfs.h new file +121
-0@@ -0,0 +1,121 @@ +#ifndef __XEN_HYPFS_H__ +#define __XEN_HYPFS_H__ + +#ifdef CONFIG_HYPFS +#include <xen/list.h> +#include <xen/string.h> +#include <public/hypfs.h> + +struct hypfs_entry_leaf ; + +struct hypfs_entry { +unsigned short type; +unsigned short encoding; +unsigned int size; +unsigned int max_size; +const char *name; +struct list_head list; +int (*read)(const struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr); +int (*write)(struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen); +}; + +struct hypfs_entry_leaf { +struct hypfs_entry e; +union { +const void *content; +void *write_ptr; + }; +}; + +struct hypfs_entry_dir { +struct hypfs_entry e; +struct list_head dirlist; +}; + +#define HYPFS_DIR_INIT (var, nam) \ + struct hypfs_entry_dir __read_mostly var = { \ + .e.type = XEN_HYPFS_TYPE_DIR, \ + .e.encoding = XEN_HYPFS_ENC_PLAIN, \ + .e.name = (nam), \ + .e.size = 0, \ + .e.max_size = 0, \ + .e.list = LIST_HEAD_INIT(var.e.list), \ + .e.read = hypfs_read_dir, \ + .dirlist = LIST_HEAD_INIT(var.dirlist), \ + } + +#define HYPFS_VARSIZE_INIT (var, typ, nam, msz) \ + struct hypfs_entry_leaf __read_mostly var = { \ + .e.type = (typ), \ + .e.encoding = XEN_HYPFS_ENC_PLAIN, \ + .e.name = (nam), \ + .e.max_size = (msz), \ + .e.read = hypfs_read_leaf, \ + } + +/* Content and size need to be set via hypfs_string_set_reference(). */ +#define HYPFS_STRING_INIT (var, nam) \ + HYPFS_VARSIZE_INIT(var, XEN_HYPFS_TYPE_STRING, nam, 0) + +/* +* Set content and size of a XEN_HYPFS_TYPE_STRING node. The node will point +* to str, so any later modification of *str should be followed by a call +* to hypfs_string_set_reference() in order to update the size of the node +* data. +*/ +static inline void hypfs_string_set_reference (struct hypfs_entry_leaf *leaf, +const char *str) +{ + leaf->content = str; + leaf->e.size =strlen (str) +1 ; +} + +#define HYPFS_FIXEDSIZE_INIT (var, typ, nam, contvar, wr) \ + struct hypfs_entry_leaf __read_mostly var = { \ + .e.type = (typ), \ + .e.encoding = XEN_HYPFS_ENC_PLAIN, \ + .e.name = (nam), \ + .e.size = sizeof(contvar), \ + .e.max_size = (wr) ? sizeof(contvar) : 0, \ + .e.read = hypfs_read_leaf, \ + .e.write = (wr), \ + .content = &(contvar), \ + } + +#define HYPFS_UINT_INIT (var, nam, contvar) \ + HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_UINT, nam, contvar, NULL) +#define HYPFS_UINT_INIT_WRITABLE (var, nam, contvar) \ + HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_UINT, nam, contvar, \ + hypfs_write_leaf) + +#define HYPFS_INT_INIT (var, nam, contvar) \ + HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_INT, nam, contvar, NULL) +#define HYPFS_INT_INIT_WRITABLE (var, nam, contvar) \ + HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_INT, nam, contvar, \ + hypfs_write_leaf) + +#define HYPFS_BOOL_INIT (var, nam, contvar) \ + HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_BOOL, nam, contvar, NULL) +#define HYPFS_BOOL_INIT_WRITABLE (var, nam, contvar) \ + HYPFS_FIXEDSIZE_INIT(var, XEN_HYPFS_TYPE_BOOL, nam, contvar, \ + hypfs_write_bool) + +extern struct hypfs_entry_dir hypfs_root; + +int hypfs_add_dir (struct hypfs_entry_dir *parent, +struct hypfs_entry_dir *dir,bool nofault); +int hypfs_add_leaf (struct hypfs_entry_dir *parent, +struct hypfs_entry_leaf *leaf,bool nofault); +int hypfs_read_dir (const struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr); +int hypfs_read_leaf (const struct hypfs_entry *entry, +XEN_GUEST_HANDLE_PARAM (void ) uaddr); +int hypfs_write_leaf (struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen); +int hypfs_write_bool (struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen); +#endif + +#endif /* __XEN_HYPFS_H__ */ xen/include/xlat.lst +2
-0@@ -86,6 +86,8 @@ ? vcpu_hvm_context hvm/hvm_vcpu.h ? vcpu_hvm_x86_32 hvm/hvm_vcpu.h ? vcpu_hvm_x86_64 hvm/hvm_vcpu.h +? hypfs_direntry hypfs.h +? hypfs_dirlistentry hypfs.h ? kexec_exec kexec.h ! kexec_image kexec.h ! kexec_range kexec.hxen/include/xsm/dummy.h +6
-0@@ -434,6 +434,12 @@ static XSM_INLINE int xsm_page_offline(XSM_DEFAULT_ARG uint32_t cmd)return xsm_default_action (action, current->domain,NULL ); } +static XSM_INLINE int xsm_hypfs_op(XSM_DEFAULT_VOID) +{ +XSM_ASSERT_ACTION (XSM_PRIV ); +return xsm_default_action (action, current->domain,NULL ); +} +static XSM_INLINE long xsm_do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {return -ENOSYS ;xen/include/xsm/xsm.h +6
-0@@ -127,6 +127,7 @@ struct xsm_operations {int (*resource_setup_misc) (void );int (*page_offline)(uint32_t cmd); +int (*hypfs_op)(void );long (*do_xsm_op) (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op);#ifdef CONFIG_COMPAT @@ -536,6 +537,11 @@ static inline int xsm_page_offline(xsm_default_t def, uint32_t cmd)return xsm_ops->page_offline (cmd); } +static inline int xsm_hypfs_op (xsm_default_t def) +{ +return xsm_ops->hypfs_op (); +} +static inline long xsm_do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {return xsm_ops->do_xsm_op (op);xen/xsm/dummy.c +1
-0@@ -103,6 +103,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)set_to_dummy_if_null (ops, resource_setup_misc);set_to_dummy_if_null (ops, page_offline); +set_to_dummy_if_null (ops, hypfs_op);set_to_dummy_if_null (ops, hvm_param);set_to_dummy_if_null (ops, hvm_control);set_to_dummy_if_null (ops, hvm_param_nested);xen/xsm/flask/hooks.c +6
-0@@ -1173,6 +1173,11 @@ static inline int flask_page_offline(uint32_t cmd) } } +static inline int flask_hypfs_op (void ) +{ +return domain_has_xen (current->domain,XEN__HYPFS_OP ); +} +static int flask_add_to_physmap (struct domain *d1,struct domain *d2) {return domain_has_perm (d1, d2,SECCLASS_MMU ,MMU__PHYSMAP );@@ -1812,6 +1817,7 @@ static struct xsm_operations flask_ops = { .resource_setup_misc = flask_resource_setup_misc, .page_offline = flask_page_offline, + .hypfs_op = flask_hypfs_op, .hvm_param = flask_hvm_param, .hvm_control = flask_hvm_param, .hvm_param_nested = flask_hvm_param_nested,xen/xsm/flask/policy/access_vectors +2
-0@@ -67,6 +67,8 @@ class xen lockprof # XEN_SYSCTL_cpupool_op cpupool_op +# hypfs hypercall + hypfs_op # XEN_SYSCTL_scheduler_op with XEN_DOMCTL_SCHEDOP_getinfo, XEN_SYSCTL_sched_id, XEN_DOMCTL_SCHEDOP_getvcpuinfo getscheduler # XEN_SYSCTL_scheduler_op with XEN_DOMCTL_SCHEDOP_putinfo, XEN_DOMCTL_SCHEDOP_putvcpuinfo
Signature · 1 line
Julien Grall
PATCH v10 5/12 libs: add libxenhypfs
In reply to Juergen GrossAdd the new library libxenhypfs for access to the hypervisor filesystem.
---
V1:
- rename to libxenhypfs
- add xenhypfs_write()
V3:
- major rework due to new hypervisor interface
- add decompression capability
V4:
- add dependency to libz in pkgconfig file (Wei Liu)
V7:
- don't assume hypervisor's sizeof(bool) is same as in user land
V8:
- add some comments regarding the semantics of the lib functions (George Dunlap)
--- .gitignore | 2 + tools/Rules.mk | 6 + tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + 8 files changed, 671 insertions(+) create mode 100644 tools/libs/hypfs/Makefile create mode 100644 tools/libs/hypfs/core.c create mode 100644 tools/libs/hypfs/include/xenhypfs.h create mode 100644 tools/libs/hypfs/libxenhypfs.map create mode 100644 tools/libs/hypfs/xenhypfs.pc.in
.gitignore +2 -0
@@ -110,6 +110,8 @@ tools/libs/evtchn/headers.chk tools/libs/evtchn/xenevtchn.pc tools/libs/gnttab/headers.chk tools/libs/gnttab/xengnttab.pc +tools/libs/hypfs/headers.chk +tools/libs/hypfs/xenhypfs.pc tools/libs/call/headers.chk tools/libs/call/xencall.pc tools/libs/foreignmemory/headers.chk
tools/Rules.mk +6 -0
@@ -19,6 +19,7 @@ XEN_LIBXENGNTTAB = $(XEN_ROOT)/tools/libs/gnttab XEN_LIBXENCALL = $(XEN_ROOT)/tools/libs/call XEN_LIBXENFOREIGNMEMORY = $(XEN_ROOT)/tools/libs/foreignmemory XEN_LIBXENDEVICEMODEL = $(XEN_ROOT)/tools/libs/devicemodel +XEN_LIBXENHYPFS = $(XEN_ROOT)/tools/libs/hypfs XEN_LIBXC = $(XEN_ROOT)/tools/libxc XEN_XENLIGHT = $(XEN_ROOT)/tools/libxl # Currently libxlutil lives in the same directory as libxenlight
@@ -132,6 +133,11 @@ SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLI LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_LIBXENDEVICEMODEL)/libxendevicemodel$(libextension) SHLIB_libxendevicemodel = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_LIBXENDEVICEMODEL) +CFLAGS_libxenhypfs = -I$(XEN_LIBXENHYPFS)/include $(CFLAGS_xeninclude) +SHDEPS_libxenhypfs = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_xencall) +LDLIBS_libxenhypfs = $(SHDEPS_libxenhypfs) $(XEN_LIBXENHYPFS)/libxenhypfs$(libextension) +SHLIB_libxenhypfs = $(SHDEPS_libxenhypfs) -Wl,-rpath-link=$(XEN_LIBXENHYPFS) + # code which compiles against libxenctrl get __XEN_TOOLS__ and # therefore sees the unstable hypercall interfaces. CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) $(CFLAGS_xeninclude) -D__XEN_TOOLS__
tools/libs/Makefile +1 -0
@@ -9,6 +9,7 @@ SUBDIRS-y += gnttab SUBDIRS-y += call SUBDIRS-y += foreignmemory SUBDIRS-y += devicemodel +SUBDIRS-y += hypfs ifeq ($(CONFIG_RUMP),y) SUBDIRS-y := toolcore
tools/libs/hypfs/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +XEN_ROOT = $(CURDIR)/../../.. +include $(XEN_ROOT)/tools/Rules.mk + +MAJOR = 1 +MINOR = 0 +LIBNAME := hypfs +USELIBS := toollog toolcore call + +APPEND_LDFLAGS += -lz + +SRCS-y += core.c + +include ../libs.mk + +$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENHYPFS)/include +$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
tools/libs/hypfs/core.c new file +536 -0
536 lines not on this page · raw message
tools/libs/hypfs/include/xenhypfs.h new file +90 -0
90 lines not on this page · raw message
tools/libs/hypfs/libxenhypfs.map new file +10 -0
@@ -0,0 +1,10 @@ +VERS_1.0 { + global: + xenhypfs_open; + xenhypfs_close; + xenhypfs_read_raw; + xenhypfs_read; + xenhypfs_readdir; + xenhypfs_write; + local: *; /* Do not expose anything by default */ +};
tools/libs/hypfs/xenhypfs.pc.in new file +10 -0
@@ -0,0 +1,10 @@ +prefix=@@prefix@@ +includedir=@@incdir@@ +libdir=@@libdir@@ + +Name: Xenhypfs +Description: The Xenhypfs library for Xen hypervisor +Version: @@version@@ +Cflags: -I${includedir} @@cflagslocal@@ +Libs: @@libsflag@@${libdir} -lxenhypfs +Requires.private: xentoolcore,xentoollog,xencall,z
Signature · 1 line
2.26.1
Re: [PATCH v10 05/12] libs: add libxenhypfs
Quoted 41 lines · Juergen Gross
tools/libs/hypfs/include/xenhypfs.h new file +35
-0@@ -0,0 +1,90 @@ +/* +* Copyright (c) 2019 SUSE Software Solutions Germany GmbH +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef XENHYPFS_H +#define XENHYPFS_H + +#include <stdbool.h> +#include <stdint.h> +#include <sys/types.h> + +/* Callers who don't care don't need to #include <xentoollog.h> */ +struct xentoollog_logger; + +typedef struct xenhypfs_handle xenhypfs_handle; + +struct xenhypfs_dirent { + char *name; + size_t size; + enum { + xenhypfs_type_dir, + xenhypfs_type_blob, + xenhypfs_type_string,
tools/libs/hypfs/include/xenhypfs.h line 45
Quoted 10 lines
tools/libs/hypfs/include/xenhypfs.h new file +10
-0+ xenhypfs_type_uint, + xenhypfs_type_int, + xenhypfs_type_bool + } type; +enum { + xenhypfs_enc_plain, + xenhypfs_enc_gzip + } encoding; +bool is_writable; +};
I'm afraid this a blocker bug for 4.14.
enum's aren't safe in public ABI structs, even under _GNU_SOURCE. Use unsigned int's, and declare the enumerations earlier.
There is also 3/7 bytes of trailing padding and very little forward extensibility. How about an unsigned int flags, of which writeable is the bottom bit, seeing as this is purely an informational field?
~Andrew
Re: [PATCH v10 05/12] libs: add libxenhypfs
Quoted 55 lines · Andrew Cooper
Quoted 41 lines · Juergen Gross
tools/libs/hypfs/include/xenhypfs.h new file +35
-0@@ -0,0 +1,90 @@ +/* +* Copyright (c) 2019 SUSE Software Solutions Germany GmbH +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef XENHYPFS_H +#define XENHYPFS_H + +#include <stdbool.h> +#include <stdint.h> +#include <sys/types.h> + +/* Callers who don't care don't need to #include <xentoollog.h> */ +struct xentoollog_logger; + +typedef struct xenhypfs_handle xenhypfs_handle; + +struct xenhypfs_dirent { + char *name; + size_t size; + enum { + xenhypfs_type_dir, + xenhypfs_type_blob, + xenhypfs_type_string,tools/libs/hypfs/include/xenhypfs.h line 45
Quoted 10 lines
tools/libs/hypfs/include/xenhypfs.h new file +10
-0+ xenhypfs_type_uint, + xenhypfs_type_int, + xenhypfs_type_bool + } type; +enum { + xenhypfs_enc_plain, + xenhypfs_enc_gzip + } encoding; +bool is_writable; +};I'm afraid this a blocker bug for 4.14.
Quoted 6 lines
enum's aren't safe in public ABI structs, even under _GNU_SOURCE. Use unsigned int's, and declare the enumerations earlier.
There is also 3/7 bytes of trailing padding and very little forward extensibility. How about an unsigned int flags, of which writeable is the bottom bit, seeing as this is purely an informational field?
Sounds fine. I'll send a patch on Tuesday (today is a local holiday in Germany and I need to do some outdoor work).
Juergen
PATCH v10 6/12 tools: add xenfs tool
In reply to Juergen GrossAdd the xenfs tool for accessing the hypervisor filesystem.
---
V1:
- rename to xenhypfs
- don't use "--" for subcommands
- add write support
V2:
- escape non-printable characters per default with cat subcommand (Ian Jackson)
- add -b option to cat subcommand (Ian Jackson)
- add man page
V3:
- adapt to new hypfs interface
V7:
- added missing bool for ls output
--- .gitignore | 1 + docs/man/xenhypfs.1.pod | 61 +++++++++++++ tools/misc/Makefile | 6 ++ tools/misc/xenhypfs.c | 192 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 260 insertions(+) create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 tools/misc/xenhypfs.c
.gitignore +1 -0
@@ -368,6 +368,7 @@ tools/libxl/test_timedereg tools/libxl/test_fdderegrace tools/firmware/etherboot/eb-roms.h tools/firmware/etherboot/gpxe-git-snapshot.tar.gz +tools/misc/xenhypfs tools/misc/xenwatchdogd tools/misc/xen-hvmcrash tools/misc/xen-lowmemd
docs/man/xenhypfs.1.pod new file +61 -0
61 lines not on this page · raw message
tools/misc/Makefile +6 -0
@@ -24,6 +24,7 @@ INSTALL_SBIN-$(CONFIG_X86) += xen-lowmemd INSTALL_SBIN-$(CONFIG_X86) += xen-mfndump INSTALL_SBIN-$(CONFIG_X86) += xen-ucode INSTALL_SBIN += xencov +INSTALL_SBIN += xenhypfs INSTALL_SBIN += xenlockprof INSTALL_SBIN += xenperf INSTALL_SBIN += xenpm
@@ -86,6 +87,9 @@ xenperf: xenperf.o xenpm: xenpm.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xenhypfs: xenhypfs.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenhypfs) $(APPEND_LDFLAGS) + xenlockprof: xenlockprof.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
@@ -94,6 +98,8 @@ xen-hptool.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc $(CFLAGS_libxencall) xen-hptool: xen-hptool.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS) +xenhypfs.o: CFLAGS += $(CFLAGS_libxenhypfs) + # xen-mfndump incorrectly uses libxc internals xen-mfndump.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc $(CFLAGS_libxencall) xen-mfndump: xen-mfndump.o
tools/misc/xenhypfs.c new file +192 -0
192 lines not on this page · raw message
Signature · 1 line
2.26.1
PATCH v10 7/12 xen: provide version information in hypfs
In reply to Juergen GrossProvide 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.
---
V3:
- new patch
V4:
- add __read_mostly annotations (Jan Beulich)
--- docs/misc/hypfs-paths.pandoc | 45 ++++++++++++++++++++++++++++++++++ xen/common/kernel.c | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+)
docs/misc/hypfs-paths.pandoc +45 -0
@@ -105,3 +105,48 @@ A populated Xen hypervisor file system might look like the following example: #### / The root of the hypervisor file system. + +#### /buildinfo/ + +A directory containing static information generated while building the +hypervisor. + +#### /buildinfo/changeset = STRING + +Git commit of the hypervisor. + +#### /buildinfo/compileinfo/ + +A directory containing information about compilation of Xen. + +#### /buildinfo/compileinfo/compile_by = STRING + +Information who compiled the hypervisor. + +#### /buildinfo/compileinfo/compile_date = STRING + +Date of the hypervisor compilation. + +#### /buildinfo/compileinfo/compile_domain = STRING + +Information about the compile domain. + +#### /buildinfo/compileinfo/compiler = STRING + +The compiler used to build Xen. + +#### /buildinfo/version/ + +A directory containing version information of the hypervisor. + +#### /buildinfo/version/extra = STRING + +Extra version information. + +#### /buildinfo/version/major = INTEGER + +The major version of Xen. + +#### /buildinfo/version/minor = INTEGER + +The minor version of Xen.
xen/common/kernel.c +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.26.1
Re: [PATCH v10 07/12] xen: provide version information in hypfs
xen/common/kernel.c void __init do_initcalls(void) · line 385
Quoted 13 lines · Juergen Gross
xen/common/kernel.c +9
-0@@ -373,6 +374,52 @@ void __init do_initcalls(void) (*call)(); } +#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);
These two lines fail to build with gcc 4.1 ("unknown field 'content' specified in initializer"), which I've deliberately tried as a last minute post-commit, pre-push check. I therefore reverted this change before pushing.
Paul, Jürgen - please advise how to proceed, considering today's deadline. I'd accept pushing the rest of the series, if a fix for the issue will then still be permitted in later. Otherwise I'd have to wait for a fixed (incremental) version.
Jan
Re: [PATCH v10 07/12] xen: provide version information in hypfs
Quoted 20 lines · Jan Beulich
Review void __init do_initcalls(void) · line 385
Quoted 13 lines · Juergen Gross
(quoted diff) +9
-0@@ -373,6 +374,52 @@ void __init do_initcalls(void) (*call)(); } +#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);These two lines fail to build with gcc 4.1 ("unknown field 'content' specified in initializer"), which I've deliberately tried as a last minute post-commit, pre-push check. I therefore reverted this change before pushing.
Quoted 4 lines
Paul, Jürgen - please advise how to proceed, considering today's deadline. I'd accept pushing the rest of the series, if a fix for the issue will then still be permitted in later. Otherwise I'd have to wait for a fixed (incremental) version
The attached patch should fix this problem (assuming the anonymous union is to blame).
Could you verify that, please?
In case the patch is fine, I'll resend the rest of the series with that patch included, as there are adaptions in later patches needed.
Juergen
From 1b56440bd50a523bbdbd96f0e1e96c85793108db Mon Sep 17 00:00:00 2001
From: Juergen Gross <[email protected]>
Date: Fri, 29 May 2020 11:09:43 +0200
Subject: [PATCH] xen/hypfs: make struct hypfs_entry_leaf initializers work
with gcc 4.1
gcc 4.1 has problems with static initializers for anonymous unions. Fix this by naming the union in struct hypfs_entry_leaf.
--- xen/common/hypfs.c | 8 ++++---- xen/include/xen/hypfs.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
xen/common/hypfs.c +4 -4
@@ -126,7 +126,7 @@ int hypfs_add_leaf(struct hypfs_entry_dir *parent, {int ret; -if ( !leaf->content ) +if ( !leaf->u.content ) ret = -EINVAL ;else ret =add_entry (parent, &leaf->e);
@@ -255,7 +255,7 @@ int hypfs_read_leaf(const struct hypfs_entry *entry, l = container_of(entry, const struct hypfs_entry_leaf, e); -return copy_to_guest (uaddr, l->content, entry->size) ? -EFAULT :0 ; +return copy_to_guest (uaddr, l->u.content, entry->size) ? -EFAULT :0 ; } static int hypfs_read(const struct hypfs_entry *entry,
@@ -317,7 +317,7 @@ int hypfs_write_leaf(struct hypfs_entry_leaf *leaf, goto out; ret =0 ; -memcpy (leaf->write_ptr, buf, ulen); +memcpy (leaf->u.write_ptr, buf, ulen); leaf->e.size = ulen; out:
@@ -341,7 +341,7 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf,if (copy_from_guest (&buf, uaddr, ulen) )return -EFAULT ; - *(bool *)leaf->write_ptr = buf; + *(bool *)leaf->u.write_ptr = buf;return 0 ; }
xen/include/xen/hypfs.h +3 -3
@@ -26,7 +26,7 @@ struct hypfs_entry_leaf {union {const void *content;void *write_ptr; - }; + } u; };struct hypfs_entry_dir {
@@ -68,7 +68,7 @@ struct hypfs_entry_dir {static inline void hypfs_string_set_reference (struct hypfs_entry_leaf *leaf,const char *str) { - leaf->content = str; + leaf->u.content = str; leaf->e.size =strlen (str) +1 ; }
@@ -81,7 +81,7 @@ static inline void hypfs_string_set_reference(struct hypfs_entry_leaf *leaf, .e.max_size = (wr) ? sizeof(contvar) : 0, \ .e.read = hypfs_read_leaf, \ .e.write = (wr), \ - .content = &(contvar), \ + .u.content = &(contvar), \ }#define HYPFS_UINT_INIT (var, nam, contvar) \
Signature · 1 line
2.26.2
Re: [PATCH v10 07/12] xen: provide version information in hypfs
Quoted 26 lines · Jürgen Groß
Quoted 20 lines · Jan Beulich
Review void __init do_initcalls(void) · line 385
Quoted 13 lines · Juergen Gross
(quoted diff) +9
-0@@ -373,6 +374,52 @@ void __init do_initcalls(void) (*call)(); } +#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);These two lines fail to build with gcc 4.1 ("unknown field 'content' specified in initializer"), which I've deliberately tried as a last minute post-commit, pre-push check. I therefore reverted this change before pushing.
Quoted 4 lines
Paul, Jürgen - please advise how to proceed, considering today's deadline. I'd accept pushing the rest of the series, if a fix for the issue will then still be permitted in later. Otherwise I'd have to wait for a fixed (incremental) version
Quoted 4 lines
The attached patch should fix this problem (assuming the anonymous union is to blame).
Could you verify that, please?
Quoted 2 lines
In case the patch is fine, I'll resend the rest of the series with that patch included, as there are adaptions in later patches needed.
No need to, if you trust me to have made the right changes - I've also verified the rest of the series builds fine there.
Jan
Re: [PATCH v10 07/12] xen: provide version information in hypfs
Quoted 32 lines · Jan Beulich
Quoted 26 lines · Jürgen Groß
Quoted 20 lines · Jan Beulich
Review void __init do_initcalls(void) · line 385
Quoted 13 lines · Juergen Gross
(quoted diff) +9
-0@@ -373,6 +374,52 @@ void __init do_initcalls(void) (*call)(); } +#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);These two lines fail to build with gcc 4.1 ("unknown field 'content' specified in initializer"), which I've deliberately tried as a last minute post-commit, pre-push check. I therefore reverted this change before pushing.
Quoted 4 lines
Paul, Jürgen - please advise how to proceed, considering today's deadline. I'd accept pushing the rest of the series, if a fix for the issue will then still be permitted in later. Otherwise I'd have to wait for a fixed (incremental) version
Quoted 4 lines
The attached patch should fix this problem (assuming the anonymous union is to blame).
Could you verify that, please?
Quoted 8 lines
Reviewed-by Jan Beulich <[email protected]>Tested-by Jan Beulich <[email protected]>Quoted 2 lines
In case the patch is fine, I'll resend the rest of the series with that patch included, as there are adaptions in later patches needed.
No need to, if you trust me to have made the right changes - I've also verified the rest of the series builds fine there.
Thanks, of course I trust you. :-)
Juergen
PATCH v10 8/12 xen: add /buildinfo/config entry to hypervisor filesystem
In reply to Juergen GrossAdd the /buildinfo/config entry to the hypervisor filesystem. This entry contains the .config file used to build the hypervisor.
---
V3:
- store data in gzip format
- use binfile mechanism to create data file
- move code to kernel.c
V6:
- add config item for the /buildinfo/config (Jan Beulich)
- make config related variables const in kernel.h (Jan Beulich)
V7:
- update doc (Jan Beulich)
- use "rm -f" in Makefile (Jan Beulich)
V8:
- add dependency top CONFIG_HYPFS
- use macro for definition of leaf (Jan Beulich)
V9:
- adjust type of xen_config_data (Jan Beulich)
--- .gitignore | 2 ++ docs/misc/hypfs-paths.pandoc | 4 ++++ xen/common/Kconfig | 11 +++++++++++ xen/common/Makefile | 12 ++++++++++++ xen/common/kernel.c | 11 +++++++++++ xen/include/xen/kernel.h | 3 +++ 6 files changed, 43 insertions(+)
.gitignore +2 -0
@@ -298,6 +298,8 @@ xen/arch/*/efi/boot.c xen/arch/*/efi/compat.c xen/arch/*/efi/efi.h xen/arch/*/efi/runtime.c +xen/common/config_data.S +xen/common/config.gz xen/include/headers*.chk xen/include/asm xen/include/asm-*/asm-offsets.h
docs/misc/hypfs-paths.pandoc +4 -0
@@ -135,6 +135,10 @@ Information about the compile domain. The compiler used to build Xen. +#### /buildinfo/config = STRING [CONFIG_HYPFS_CONFIG] + +The contents of the `xen/.config` file at the time of the hypervisor build. + #### /buildinfo/version/ A directory containing version information of the hypervisor.
xen/common/Kconfig +11 -0
@@ -127,6 +127,17 @@ config HYPFS If unsure, say Y. +config HYPFS_CONFIG + bool "Provide hypervisor .config via hypfs entry" + default y + depends on HYPFS + ---help--- + When enabled the contents of the .config file used to build the + hypervisor are provided via the hypfs entry /buildinfo/config. + + Disable this option in case you want to spare some memory or you + want to hide the .config contents from dom0. + config KEXEC bool "kexec support" default y
xen/common/Makefile +12 -0
@@ -1,6 +1,7 @@ obj-$(CONFIG_ARGO) += argo.o obj-y += bitmap.o obj-y += bsearch.o +obj-$(CONFIG_HYPFS_CONFIG) += config_data.o obj-$(CONFIG_CORE_PARKING) += core_parking.o obj-y += cpu.o obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
@@ -73,3 +74,14 @@ obj-$(CONFIG_UBSAN) += ubsan/ obj-$(CONFIG_NEEDS_LIBELF) += libelf/ obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/ + +config.gz: ../.config + gzip -c $< >$@ + +config_data.o: config.gz + +config_data.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile $@ config.gz xen_config_data + +clean:: + rm -f config_data.S config.gz 2>/dev/null
xen/common/kernel.c +11 -0
@@ -390,6 +390,10 @@ static HYPFS_STRING_INIT(compile_date, "compile_date"); static HYPFS_STRING_INIT(compile_domain, "compile_domain"); static HYPFS_STRING_INIT(extra, "extra"); +#ifdef CONFIG_HYPFS_CONFIG +static HYPFS_STRING_INIT(config, "config"); +#endif +static int __init buildinfo_init (void ) {hypfs_add_dir (&hypfs_root, &buildinfo, true);
@@ -415,6 +419,13 @@ static int __init buildinfo_init(void)hypfs_add_leaf (&version, &major, true);hypfs_add_leaf (&version, &minor, true); +#ifdef CONFIG_HYPFS_CONFIG + config.e.encoding =XEN_HYPFS_ENC_GZIP ; + config.e.size = xen_config_data_size; + config.content = xen_config_data; +hypfs_add_leaf (&buildinfo, &config, true); +#endif +return 0 ; }__initcall (buildinfo_init);
xen/include/xen/kernel.h +3 -0
@@ -100,5 +100,8 @@ extern enum system_state {bool_t is_active_kernel_text (unsigned long addr); +extern const char xen_config_data[]; +extern const unsigned int xen_config_data_size; +#endif /* _LINUX_KERNEL_H */
Signature · 1 line
2.26.1
Re: [PATCH v10 08/12] xen: add /buildinfo/config entry to hypervisor filesystem
Quoted 13 lines · Juergen Gross
xen/common/Makefile +1
-0@@ -1,6 +1,7 @@ obj-$(CONFIG_ARGO) += argo.o obj-y += bitmap.o obj-y += bsearch.o +obj-$(CONFIG_HYPFS_CONFIG) += config_data.o obj-$(CONFIG_CORE_PARKING) += core_parking.o obj-y += cpu.o obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
xen/common/Makefile obj-$(CONFIG_UBSAN) += ubsan/ · line 79
Quoted 6 lines
xen/common/Makefile +3
-0@@ -73,3 +74,14 @@ obj-$(CONFIG_UBSAN) += ubsan/ obj-$(CONFIG_NEEDS_LIBELF) += libelf/ obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/ + +config.gz: ../.config + gzip -c $< >$@
I had to disable HYPFS in the XenServer build. Inside RPM, this fails with
make[3]: *** No rule to make target ../.config', needed by config.gz'. Stop.
make[3]: *** Waiting for unfinished jobs....
This needs to be an expression involving $(KCONFIG_CONFIG) because .config is only the default, and it surely needs a $(XEN_ROOT) in there?
~Andrew
Re: [PATCH v10 08/12] xen: add /buildinfo/config entry to hypervisor filesystem
Quoted 15 lines · Andrew Cooper
Quoted 14 lines · Juergen Gross
xen/common/Makefile +1
-0@@ -1,6 +1,7 @@ obj-$(CONFIG_ARGO) += argo.o obj-y += bitmap.o obj-y += bsearch.o +obj-$(CONFIG_HYPFS_CONFIG) += config_data.o obj-$(CONFIG_CORE_PARKING) += core_parking.o obj-y += cpu.o obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o@@ -73,3 +74,14 @@ obj-$(CONFIG_UBSAN) += ubsan/
Quoted 7 lines
xen/common/Makefile obj-$(CONFIG_UBSAN) += ubsan/ · line 79
Quoted 5 lines
xen/common/Makefile +3
-0obj-$(CONFIG_NEEDS_LIBELF) += libelf/ obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/ + +config.gz: ../.config + gzip -c $< >$@I had to disable HYPFS in the XenServer build. Inside RPM, this fails with
Disabling CONFIG_HYPFS_CONFIG should work, too.
Quoted 7 lines
make[3]: *** No rule to make target
../.config', needed byconfig.gz'. Stop.
make[3]: *** Waiting for unfinished jobs....This needs to be an expression involving $(KCONFIG_CONFIG) because .config is only the default, and it surely needs a $(XEN_ROOT) in there?
Will send a patch.
Oh, in fact I'll send two patches, as I guess pv-shim doesn't want to have CONFIG_HYPFS set.
Juergen
PATCH v10 9/12 xen: add runtime parameter access support to hypfs
In reply to Juergen GrossAdd support to read and modify values of hypervisor runtime parameters via the hypervisor file system.
As runtime parameters can be modified via a sysctl, too, this path has to take the hypfs rw_lock as writer.
For custom runtime parameters the connection between the parameter value and the file system is done via an init function which will set the initial value (if needed) and the leaf properties.
---
V3:
- complete rework
- support custom parameters, too
- support parameter writing
V6:
- rewording in docs/misc/hypfs-paths.pandoc (Jan Beulich)
- use memchr() (Jan Beulich)
- use strlcat() (Jan Beulich)
- rework to use a custom parameter init function instead of a reference to a content variable, allowing to drop default strings
- style correction (Jan Beulich)
- dropping param_append_str() in favor of a custom function at its only use site
V7:
- fine tune some parameter initializations (Jan Beulich)
- call custom_runtime_set_var() after updating the value
- modify alignment in Arm linker script to 4 (Jan Beulich)
V8:
- modify alignment in Arm linker script to 8 (Julien Grall)
- fix ept runtime parameter reporting (Jan Beulich)
- rebase to support CONFIG_HYPFS
V9:
- add empty line in arm linker script (Jan Beulich)
- drop array size enum members (Jan Beulich)
- hide struct param_hypfs completely without CONFIG_HYPFS (Jan Beulich)
- don't write size from hypfs_write_custom() (Jan Beulich)
- drop underscores from macro parameters (Jan Beulich)
- add parantheses around macro parameters (Jan Beulich)
- don't set initial string param size (Jan Beulich)
- move code in vmcs.c in preparation of patch 12 (Jan Beulich)
--- docs/misc/hypfs-paths.pandoc | 9 +++ xen/arch/arm/xen.lds.S | 8 +++ xen/arch/x86/hvm/vmx/vmcs.c | 29 ++++++++- xen/arch/x86/pv/domain.c | 21 ++++++- xen/arch/x86/xen.lds.S | 7 +++ xen/common/grant_table.c | 62 ++++++++++++++---- xen/common/hypfs.c | 34 +++++++++- xen/common/kernel.c | 29 ++++++++- xen/drivers/char/console.c | 72 +++++++++++++++++++-- xen/include/xen/hypfs.h | 7 +++ xen/include/xen/param.h | 119 ++++++++++++++++++++++++++++++++++- 11 files changed, 372 insertions(+), 25 deletions(-)
docs/misc/hypfs-paths.pandoc +9 -0
@@ -154,3 +154,12 @@ The major version of Xen. #### /buildinfo/version/minor = INTEGER The minor version of Xen. + +#### /params/ + +A directory of runtime parameters. + +#### /params/* + +The individual parameters. The description of the different parameters can be +found in `docs/misc/xen-command-line.pandoc`.
xen/arch/arm/xen.lds.S +8 -0
@@ -89,6 +89,14 @@ SECTIONS __start_schedulers_array = .; *(.data.schedulers) __end_schedulers_array = .; + +#ifdef CONFIG_HYPFS + . = ALIGN(8); + __paramhypfs_start = .; + *(.data.paramhypfs) + __paramhypfs_end = .; +#endif + *(.data.rel) *(.data.rel.*) CONSTRUCTORS
xen/arch/x86/hvm/vmx/vmcs.c +28 -1
@@ -97,6 +97,30 @@ static int __init parse_ept_param(const char *s) }custom_param ("ept" , parse_ept_param); +#ifdef CONFIG_HYPFS +static char opt_ept_setting[10 ]; + +static void update_ept_param (void ) +{ +if ( opt_ept_exec_sp >=0 ) +snprintf (opt_ept_setting,sizeof (opt_ept_setting),"exec-sp=%d" , + opt_ept_exec_sp); +} + +static void __init init_ept_param (struct param_hypfs *par) +{ +update_ept_param (); +custom_runtime_set_var (par, opt_ept_setting); +} +#else +static void update_ept_param (void ) +{ +} +#endif + +static int parse_ept_param_runtime (const char *s); +custom_runtime_only_param ("ept" , parse_ept_param_runtime, init_ept_param); +static int parse_ept_param_runtime (const char *s) {struct domain *d;
@@ -115,6 +139,10 @@ static int parse_ept_param_runtime(const char *s) opt_ept_exec_sp = val; +update_ept_param (); +custom_runtime_set_var (param_2_parfs (parse_ept_param_runtime), + opt_ept_setting); +rcu_read_lock (&domlist_read_lock);for_each_domain ( d ) {
@@ -144,7 +172,6 @@ static int parse_ept_param_runtime(const char *s)return 0 ; } -custom_runtime_only_param ("ept" , parse_ept_param_runtime);/* Dynamic (run-time adjusted) execution control flags. */ u32 vmx_pin_based_exec_control__read_mostly ;
xen/arch/x86/pv/domain.c +20 -1
@@ -55,6 +55,23 @@ static __read_mostly enum { PCID_NOXPTI } opt_pcid =PCID_XPTI ; +#ifdef CONFIG_HYPFS +static const char opt_pcid_2_string[][7 ] = { + [PCID_OFF ] ="off" , + [PCID_ALL ] ="on" , + [PCID_XPTI ] ="xpti" , + [PCID_NOXPTI ] ="noxpti" , +}; + +static void __init opt_pcid_init (struct param_hypfs *par) +{ +custom_runtime_set_var (par, opt_pcid_2_string[opt_pcid]); +} +#endif + +static int parse_pcid (const char *s); +custom_runtime_param ("pcid" , parse_pcid, opt_pcid_init); +static int parse_pcid (const char *s) {int rc =0 ;
@@ -87,9 +104,11 @@ static int parse_pcid(const char *s)break ; } +custom_runtime_set_var (param_2_parfs (parse_pcid), + opt_pcid_2_string[opt_pcid]); +return rc; } -custom_runtime_param ("pcid" , parse_pcid);static void noreturncontinue_nonidle_domain (struct vcpu *v) {
xen/arch/x86/xen.lds.S +7 -0
@@ -279,6 +279,13 @@ SECTIONS __start_schedulers_array = .; *(.data.schedulers) __end_schedulers_array = .; + +#ifdef CONFIG_HYPFS + . = ALIGN(8); + __paramhypfs_start = .; + *(.data.paramhypfs) + __paramhypfs_end = .; +#endif } :text DECL_SECTION(.data) {
xen/common/grant_table.c +51 -11
87 lines not on this page · raw message
xen/common/hypfs.c +32 -2
@@ -10,6 +10,7 @@#include <xen/hypercall.h> #include <xen/hypfs.h> #include <xen/lib.h> +#include <xen/param.h> #include <xen/rwlock.h> #include <public/hypfs.h>
@@ -41,7 +42,7 @@ static void hypfs_read_lock(void)this_cpu (hypfs_locked) = hypfs_read_locked; } -static void hypfs_write_lock (void ) +void hypfs_write_lock (void ) {ASSERT (this_cpu (hypfs_locked) == hypfs_unlocked);
@@ -49,7 +50,7 @@ static void hypfs_write_lock(void)this_cpu (hypfs_locked) = hypfs_write_locked; } -static void hypfs_unlock (void ) +void hypfs_unlock (void ) {enum hypfs_lock_state locked =this_cpu (hypfs_locked);
@@ -346,6 +347,35 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf,return 0 ; } +int hypfs_write_custom (struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen) +{ +struct param_hypfs *p; +char *buf; +int ret; + +ASSERT (this_cpu (hypfs_locked) == hypfs_write_locked); + + buf =xzalloc_array (char, ulen); +if ( !buf ) +return -ENOMEM ; + + ret = -EFAULT ; +if (copy_from_guest (buf, uaddr, ulen) ) + goto out; + + ret = -EDOM ; +if (memchr (buf,0 , ulen) != (buf + ulen -1 ) ) + goto out; + + p = container_of(leaf, struct param_hypfs, hypfs); + ret = p->param->par.func (buf); + + out: +xfree (buf); +return ret; +} +static int hypfs_write (struct hypfs_entry *entry,XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned long ulen) {
xen/common/kernel.c +28 -1
@@ -198,7 +198,13 @@ static void __init _cmdline_parse(const char *cmdline)int runtime_parse (const char *line) { -return parse_params (line, __param_start, __param_end); +int ret; + +hypfs_write_lock (); + ret =parse_params (line, __param_start, __param_end); +hypfs_unlock (); + +return ret; }/**
@@ -429,6 +435,27 @@ static int __init buildinfo_init(void)return 0 ; }__initcall (buildinfo_init); + +static HYPFS_DIR_INIT(params, "params"); + +static int __init param_init (void ) +{ +struct param_hypfs *param; + +hypfs_add_dir (&hypfs_root, ¶ms, true); + +for ( param = __paramhypfs_start; param < __paramhypfs_end; param++ ) + { +if ( param->init_leaf ) + param->init_leaf (param); +else if ( param->hypfs.e.type ==XEN_HYPFS_TYPE_STRING ) + param->hypfs.e.size =strlen (param->hypfs.content) +1 ; +hypfs_add_leaf (¶ms, ¶m->hypfs, true); + } + +return 0 ; +} +__initcall (param_init);#endif # define DO (fn) long do_##fn
xen/drivers/char/console.c +66 -6
128 lines not on this page · raw message
xen/include/xen/hypfs.h +7 -0
@@ -116,6 +116,13 @@ int hypfs_write_leaf(struct hypfs_entry_leaf *leaf, XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);int hypfs_write_bool (struct hypfs_entry_leaf *leaf,XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen); +int hypfs_write_custom (struct hypfs_entry_leaf *leaf, +XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen); +void hypfs_write_lock (void ); +void hypfs_unlock (void ); +#else +static inline void hypfs_write_lock (void ) {} +static inline void hypfs_unlock (void ) {}#endif #endif /* __XEN_HYPFS_H__ */
xen/include/xen/param.h +116 -3
138 lines not on this page · raw message
Signature · 1 line
2.26.1
Re: [PATCH v10 09/12] xen: add runtime parameter access support to hypfs
Hi Juergen,
Quoted 6 lines · Juergen Gross
Add support to read and modify values of hypervisor runtime parameters via the hypervisor file system.
As runtime parameters can be modified via a sysctl, too, this path has to take the hypfs
rw_lockas writer.
Quoted 6 lines
For custom runtime parameters the connection between the parameter value and the file system is done via an init function which will set the initial value (if needed) and the leaf properties.
Signed-off-by Juergen Gross <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
PATCH v10 10/12 tools/libxl: use libxenhypfs for setting xen runtime parameters
In reply to Juergen GrossInstead of xc_set_parameters() use xenhypfs_write() for setting parameters of the hypervisor.
---
V6:
- new patch
--- tools/Rules.mk | 2 +- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++++++++++++++++++++++++++++++++---- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/xl/xl_misc.c | 1 - 6 files changed, 52 insertions(+), 10 deletions(-)
tools/Rules.mk +1 -1
@@ -178,7 +178,7 @@ CFLAGS += -O2 -fomit-frame-pointer endif CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) -SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) +SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs) LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension) SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)
tools/libxl/Makefile +2 -1
@@ -20,7 +20,7 @@ LIBUUID_LIBS += -luuid endif LIBXL_LIBS = -LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) +LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenhypfs) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) ifeq ($(CONFIG_LIBNL),y) LIBXL_LIBS += $(LIBNL3_LIBS) endif
@@ -33,6 +33,7 @@ CFLAGS_LIBXL += $(CFLAGS_libxentoolcore) CFLAGS_LIBXL += $(CFLAGS_libxenevtchn) CFLAGS_LIBXL += $(CFLAGS_libxenctrl) CFLAGS_LIBXL += $(CFLAGS_libxenguest) +CFLAGS_LIBXL += $(CFLAGS_libxenhypfs) CFLAGS_LIBXL += $(CFLAGS_libxenstore) ifeq ($(CONFIG_LIBNL),y) CFLAGS_LIBXL += $(LIBNL3_CFLAGS)
tools/libxl/libxl.c +47 -6
62 lines not on this page · raw message
tools/libxl/libxl_internal.h +1 -0
@@ -56,6 +56,7 @@#define XC_WANT_COMPAT_MAP_FOREIGN_API #include <xenctrl.h> #include <xenguest.h> +#include <xenhypfs.h> #include <xc_dom.h> #include <xen-tools/libs.h>
tools/libxl/xenlight.pc.in +1 -1
@@ -9,4 +9,4 @@ Description: The Xenlight library for Xen hypervisor Version: @@version@@ Cflags: -I${includedir} Libs: @@libsflag@@${libdir} -lxenlight -Requires.private: xentoollog,xenevtchn,xencontrol,xenguest,xenstore +Requires.private: xentoollog,xenevtchn,xencontrol,xenguest,xenstore,xenhypfs
tools/xl/xl_misc.c +0 -1
@@ -168,7 +168,6 @@ int main_set_parameters(int argc, char **argv)if (libxl_set_parameters (ctx, params)) {fprintf (stderr,"cannot set parameters: %s\n" , params); -fprintf (stderr,"Use \"xl dmesg\" to look for possible reason.\n" );return EXIT_FAILURE ; }
Signature · 1 line
2.26.1
Re: [PATCH v10 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters
Quoted 86 lines · Juergen Gross
Instead of
xc_set_parameters()usexenhypfs_write()for setting parameters of the hypervisor.Signed-off-by Juergen Gross <[email protected]>---
V6:
- new patch--- tools/Rules.mk | 2 +- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++++++++++++++++++++++++++++++++---- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/xl/xl_misc.c | 1 - 6 files changed, 52 insertions(+), 10 deletions(-)tools/Rules.mk +1
-1@@ -178,7 +178,7 @@ CFLAGS += -O2 -fomit-frame-pointer endif CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) -SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) +SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs) LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension) SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)tools/libxl/Makefile +2
-1@@ -20,7 +20,7 @@ LIBUUID_LIBS += -luuid endif LIBXL_LIBS = -LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) +LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenhypfs) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) ifeq ($(CONFIG_LIBNL),y) LIBXL_LIBS += $(LIBNL3_LIBS) endif@@ -33,6 +33,7 @@ CFLAGS_LIBXL += $(CFLAGS_libxentoolcore) CFLAGS_LIBXL += $(CFLAGS_libxenevtchn) CFLAGS_LIBXL += $(CFLAGS_libxenctrl) CFLAGS_LIBXL += $(CFLAGS_libxenguest) +CFLAGS_LIBXL += $(CFLAGS_libxenhypfs) CFLAGS_LIBXL += $(CFLAGS_libxenstore) ifeq ($(CONFIG_LIBNL),y) CFLAGS_LIBXL += $(LIBNL3_CFLAGS)tools/libxl/libxl.c +21
-5@@ -663,15 +663,56 @@ int libxl_set_parameters(libxl_ctx *ctx, char *params) {int ret;GC_INIT (ctx); +char *par, *val, *end, *path; +xenhypfs_handle *hypfs; - ret =xc_set_parameters (ctx->xch, params); -if (ret <0 ) { -LOGEV (ERROR , ret,"setting parameters" ); -GC_FREE ; -return ERROR_FAIL ; + hypfs =xenhypfs_open (ctx->lg,0 ); +if (!hypfs) { +LOGE (ERROR ,"opening Xen hypfs" ); + ret =ERROR_FAIL ; + goto out; } + +while (isblank (*params)) + params++; + +for (par = params; *par; par = end) { + end =strchr (par,' ' ); +if (!end) + end = par +strlen (par); + + val =strchr (par,'=' ); +if (val > end) + val =NULL ; +if (!val && !strncmp (par,"no" ,2 )) { + path =libxl__sprintf (gc,"/params/%s" , par +2 );
tools/libxl/libxl.c int libxl_set_parameters(libxl_ctx *ctx, char *params) · line 698
Quoted 10 lines
tools/libxl/libxl.c +10
-0+ path[end - par -2 +8 ] =0 ; + val ="no" ; + par +=2 ; + }else { + path =libxl__sprintf (gc,"/params/%s" , par); + path[val - par +8 ] =0 ; + val =libxl__strndup (gc, val +1 , end - val -1 ); + } + +LOG (DEBUG ,"setting node \"%s\" to value \"%s\"" , path, val);
Indentation is wrong, but this can be fixed upon committing.
I would very much like the parsing be moved to libxlu. That can wait till another day.
Regression: [PATCH v10 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters
In reply to Juergen GrossQuoted 4 lines · Juergen Gross
Instead of
xc_set_parameters()usexenhypfs_write()for setting parameters of the hypervisor.Signed-off-by Juergen Gross <[email protected]>
Something here isn't right. XenServer's testing for XSA-304 has shown the following bizarre behaviour.
# xl set-parameters ept= libxl: error: libxl.c:701:libxl_set_parameters: setting parameters: Invalid argument cannot set parameters: ept= # xl set-parameters ept=exec-sp # xl set-parameters ept=no-exec-sp libxl: error: libxl.c:701:libxl_set_parameters: setting parameters: No space left on device cannot set parameters: ept=no-exec-sp
Instrumentation shows that the first two examples here enter parse_ept_param_runtime() with the provided string, while the third example doesn't.
Given the -ENOSPC, I'm guessing there is some overly small internal buffer somewhere in the hyperfs infrastructure ?
~Andrew
Re: Regression: [PATCH v10 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters
Quoted 19 lines · Andrew Cooper
Quoted 4 lines · Juergen Gross
Instead of
xc_set_parameters()usexenhypfs_write()for setting parameters of the hypervisor.Signed-off-by Juergen Gross <[email protected]>Something here isn't right. XenServer's testing for XSA-304 has shown the following bizarre behaviour.
# xl set-parameters ept= libxl: error: libxl.c:701:libxl_set_parameters: setting parameters: Invalid argument cannot set parameters: ept= # xl set-parameters ept=exec-sp # xl set-parameters ept=no-exec-sp libxl: error: libxl.c:701:libxl_set_parameters: setting parameters: No space left on device cannot set parameters: ept=no-exec-sp
Quoted 6 lines
Instrumentation shows that the first two examples here enter
parse_ept_param_runtime()with the provided string, while the third example doesn't.Given the
-ENOSPC, I'm guessing there is some overly small internal buffer somewhere in the hyperfs infrastructure ?
Not, really, just a bad test for max length. Patch sent.
Juergen
PATCH v10 11/12 tools/libxc: remove xc_set_parameters()
In reply to Juergen GrossThere is no user of xc_set_parameters() left, so remove it.
---
V6:
- new patch
--- tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 --------------------- 2 files changed, 22 deletions(-)
tools/libxc/include/xenctrl.h +0 -1
@@ -1226,7 +1226,6 @@ int xc_readconsolering(xc_interface *xch, int clear, int incremental, uint32_t *pindex);int xc_send_debug_keys (xc_interface *xch,const char *keys); -int xc_set_parameters (xc_interface *xch,const char *params);typedef struct xen_sysctl_physinfo xc_physinfo_t ;typedef struct xen_sysctl_cputopo xc_cputopo_t ;
tools/libxc/xc_misc.c +0 -21
@@ -187,27 +187,6 @@ int xc_send_debug_keys(xc_interface *xch, const char *keys)return ret; } -int xc_set_parameters (xc_interface *xch,const char *params) -{ -int ret, len =strlen (params); -DECLARE_SYSCTL ; -DECLARE_HYPERCALL_BOUNCE_IN (params, len); - -if (xc_hypercall_bounce_pre (xch, params) ) -return -1 ; - - sysctl.cmd = XEN_SYSCTL_set_parameter; -set_xen_guest_handle (sysctl.u.set_parameter.params, params); - sysctl.u.set_parameter.size = len; -memset (sysctl.u.set_parameter.pad,0 ,sizeof (sysctl.u.set_parameter.pad)); - - ret =do_sysctl (xch, &sysctl); - -xc_hypercall_bounce_post (xch, params); - -return ret; -} -int xc_physinfo (xc_interface *xch,xc_physinfo_t *put_info) {
Signature · 1 line
2.26.1
Re: [PATCH v10 11/12] tools/libxc: remove xc_set_parameters()
Quoted 3 lines · Juergen Gross
There is no user of
xc_set_parameters()left, so remove it.Signed-off-by Juergen Gross <[email protected]>
PATCH v10 12/12 xen: remove XEN_SYSCTL_set_parameter support
In reply to Juergen GrossThe functionality of XEN_SYSCTL_set_parameter is available via hypfs now, so it can be removed.
This allows to remove the kernel_param structure for runtime parameters by putting the now only used structure element into the hypfs node structure of the runtime parameters.
---
V6:
- new patch
V7:
- only comment out definition of XEN_SYSCTL_set_parameter (Jan Beulich)
V8:
- rebase to use CONFIG_HYPFS
V9:
- adjust CONFIG_HYPFS Kconfig text (Jan Beulich)
--- tools/flask/policy/modules/dom0.te | 2 +- xen/arch/arm/xen.lds.S | 5 -- xen/arch/x86/hvm/vmx/vmcs.c | 6 +- xen/arch/x86/xen.lds.S | 5 -- xen/common/Kconfig | 5 +- xen/common/hypfs.c | 6 +- xen/common/kernel.c | 11 ---- xen/common/sysctl.c | 36 ------------ xen/include/public/sysctl.h | 19 +------ xen/include/xen/hypfs.h | 5 -- xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 87 +++++------------------------ xen/xsm/flask/hooks.c | 3 - xen/xsm/flask/policy/access_vectors | 2 - 14 files changed, 23 insertions(+), 170 deletions(-)
tools/flask/policy/modules/dom0.te +1 -1
@@ -16,7 +16,7 @@ allow dom0_t xen_t:xen { allow dom0_t xen_t:xen2 { resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbol get_cpu_levelling_caps get_cpu_featureset livepatch_op - coverage_op set_parameter + coverage_op }; # Allow dom0 to use all XENVER_ subops that have checks.
xen/arch/arm/xen.lds.S +0 -5
@@ -54,11 +54,6 @@ SECTIONS *(.data.rel.ro) *(.data.rel.ro.*) - . = ALIGN(POINTER_ALIGN); - __param_start = .; - *(.data.param) - __param_end = .; - __proc_info_start = .; *(.proc.info) __proc_info_end = .;
xen/arch/x86/hvm/vmx/vmcs.c +1 -5
@@ -112,11 +112,6 @@ static void __init init_ept_param(struct param_hypfs *par)update_ept_param ();custom_runtime_set_var (par, opt_ept_setting); } -#else -static void update_ept_param (void ) -{ -} -#endif static int parse_ept_param_runtime (const char *s);custom_runtime_only_param ("ept" , parse_ept_param_runtime, init_ept_param);
@@ -172,6 +167,7 @@ static int parse_ept_param_runtime(const char *s) return 0; } +#endif /* Dynamic (run-time adjusted) execution control flags. */ u32 vmx_pin_based_exec_control__read_mostly ;
xen/arch/x86/xen.lds.S +0 -5
@@ -128,11 +128,6 @@ SECTIONS *(.ex_table.pre) __stop___pre_ex_table = .; - . = ALIGN(POINTER_ALIGN); - __param_start = .; - *(.data.param) - __param_end = .; - #if defined(CONFIG_HAS_VPCI) && defined(CONFIG_LATE_HWDOM) . = ALIGN(POINTER_ALIGN); __start_vpci_array = .;
xen/common/Kconfig +3 -2
@@ -122,8 +122,9 @@ config HYPFS ---help--- Support Xen hypervisor file system. This file system is used to present various hypervisor internal data to dom0 and in some - cases to allow modifying settings. Disabling the support might - result in some features not being available. + cases to allow modifying settings. Disabling the support will + result in some features not being available, e.g. runtime parameter + setting. If unsure, say Y.
xen/common/hypfs.c +3 -3
@@ -42,7 +42,7 @@ static void hypfs_read_lock(void)this_cpu (hypfs_locked) = hypfs_read_locked; } -void hypfs_write_lock (void ) +static void hypfs_write_lock (void ) {ASSERT (this_cpu (hypfs_locked) == hypfs_unlocked);
@@ -50,7 +50,7 @@ void hypfs_write_lock(void)this_cpu (hypfs_locked) = hypfs_write_locked; } -void hypfs_unlock (void ) +static void hypfs_unlock (void ) {enum hypfs_lock_state locked =this_cpu (hypfs_locked);
@@ -369,7 +369,7 @@ int hypfs_write_custom(struct hypfs_entry_leaf *leaf, goto out; p = container_of(leaf, struct param_hypfs, hypfs); - ret = p->param->par.func (buf); + ret = p->func (buf); out:xfree (buf);
xen/common/kernel.c +0 -11
@@ -196,17 +196,6 @@ static void __init _cmdline_parse(const char *cmdline)parse_params (cmdline, __setup_start, __setup_end); } -int runtime_parse (const char *line) -{ -int ret; - -hypfs_write_lock (); - ret =parse_params (line, __param_start, __param_end); -hypfs_unlock (); - -return ret; -} -/** * cmdline_parse -- parses the xen command line. * If CONFIG_CMDLINE is set, it would be parsed prior to @cmdline.
xen/common/sysctl.c +0 -36
@@ -471,42 +471,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) copyback =1 ;break ; -case XEN_SYSCTL_set_parameter: - { -#define XEN_SET_PARAMETER_MAX_SIZE 1023 -char *params; - -if ( op->u.set_parameter.pad[0 ] || op->u.set_parameter.pad[1 ] || - op->u.set_parameter.pad[2 ] ) - { - ret = -EINVAL ; -break ; - } -if ( op->u.set_parameter.size >XEN_SET_PARAMETER_MAX_SIZE ) - { - ret = -E2BIG ; -break ; - } - params =xmalloc_bytes (op->u.set_parameter.size +1 ); -if ( !params ) - { - ret = -ENOMEM ; -break ; - } -if (copy_from_guest (params, op->u.set_parameter.params, - op->u.set_parameter.size) ) - ret = -EFAULT ; -else - { - params[op->u.set_parameter.size] =0 ; - ret =runtime_parse (params); - } - -xfree (params); - -break ; - } -default : ret =arch_do_sysctl (op, u_sysctl); copyback =0 ;
xen/include/public/sysctl.h +1 -18
@@ -1026,22 +1026,6 @@ struct xen_sysctl_livepatch_op { } u; }; -/* -* XEN_SYSCTL_set_parameter -* -* Change hypervisor parameters at runtime. -* The input string is parsed similar to the boot parameters. -* Parameters are a single string terminated by a NUL byte of max. size -* characters. Multiple settings can be specified by separating them -* with blanks. -*/ - -struct xen_sysctl_set_parameter { -XEN_GUEST_HANDLE_64 (const_char) params;/* IN: pointer to parameters. */ -uint16_t size;/* IN: size of parameters. */ -uint16_t pad[3 ];/* IN: MUST be zero. */ -}; -#if defined(__i386__) || defined(__x86_64__)/* * XEN_SYSCTL_get_cpu_policy (x86 specific)
@@ -1106,7 +1090,7 @@ struct xen_sysctl {#define XEN_SYSCTL_get_cpu_levelling_caps 25#define XEN_SYSCTL_get_cpu_featureset 26#define XEN_SYSCTL_livepatch_op 27 -#define XEN_SYSCTL_set_parameter 28 +/* #define XEN_SYSCTL_set_parameter 28 */ #define XEN_SYSCTL_get_cpu_policy 29uint32_t interface_version;/* XEN_SYSCTL_INTERFACE_VERSION */ union {
@@ -1135,7 +1119,6 @@ struct xen_sysctl {struct xen_sysctl_cpu_levelling_caps cpu_levelling_caps;struct xen_sysctl_cpu_featureset cpu_featureset;struct xen_sysctl_livepatch_op livepatch; -struct xen_sysctl_set_parameter set_parameter;#if defined(__i386__) || defined(__x86_64__)struct xen_sysctl_cpu_policy cpu_policy;#endif
xen/include/xen/hypfs.h +0 -5
@@ -118,11 +118,6 @@ int hypfs_write_bool(struct hypfs_entry_leaf *leaf, XEN_GUEST_HANDLE_PARAM(void) uaddr, unsigned int ulen);int hypfs_write_custom (struct hypfs_entry_leaf *leaf,XEN_GUEST_HANDLE_PARAM (void ) uaddr,unsigned int ulen); -void hypfs_write_lock (void ); -void hypfs_unlock (void ); -#else -static inline void hypfs_write_lock (void ) {} -static inline void hypfs_unlock (void ) {}#endif #endif /* __XEN_HYPFS_H__ */
xen/include/xen/lib.h +0 -1
@@ -75,7 +75,6 @@struct domain ;void cmdline_parse (const char *cmdline); -int runtime_parse (const char *line);int parse_bool (const char *s,const char *e);/**
xen/include/xen/param.h +14 -73
143 lines not on this page · raw message
xen/xsm/flask/hooks.c +0 -3
@@ -822,9 +822,6 @@ static int flask_sysctl(int cmd)case XEN_SYSCTL_coverage_op:return avc_current_has_perm (SECINITSID_XEN ,SECCLASS_XEN2 ,XEN2__COVERAGE_OP ,NULL ); -case XEN_SYSCTL_set_parameter: -return avc_current_has_perm (SECINITSID_XEN ,SECCLASS_XEN2 , -XEN2__SET_PARAMETER ,NULL );default :return avc_unknown_permission ("sysctl" , cmd);
xen/xsm/flask/policy/access_vectors +0 -2
@@ -99,8 +99,6 @@ class xen2 livepatch_op # XEN_SYSCTL_coverage_op coverage_op -# XEN_SYSCTL_set_parameter - set_parameter } # Classes domain and domain2 consist of operations that a domain performs on
Signature · 1 line
2.26.1
Quoted 132 lines · Juergen Gross
On the 2019 Xen developer summit there was agreement that the Xen hypervisor should gain support for a hierarchical name-value store similar to the Linux kernel's sysfs.
This is a first implementation of that idea adding the basic functionality to hypervisor and tools side. The interface to any user program making use of that "xen-hypfs" is a new library "libxenhypfs" with a stable interface.
The series adds read-only nodes with buildinfo data and writable nodes with runtime parameters. xl is switched to use the new file system for modifying the runtime parameters and the old sysctl interface for that purpose is dropped.
Changes in V10:
- adressed review commentsChanges in V9:
- addressed review commentsChanges in V8:
- addressed review comments
- addedCONFIG_HYPFSconfig optionChanges in V7:
- old patch 1 already applied
- add new patch 1 (carved out and modified from patch 9)
- addressed review comments
- modified public interface to have a max write size instead of a writable flag onlyChanges in V6:
- added new patches 1, 10, 11, 12
- addressed review comments
- modified interface for creating nodes for runtime parametersChanges in V5:
- switched to xsm for privilege checkChanges in V4:
- former patch 2 removed as already committed
- addressed review commentsChanges in V3:
- major rework, especially by supporting binary contents of entries
- added several new patches (1, 2, 7)
- full support of all runtime parameters
- support of writing entries (especially runtime parameters)Changes in V2:
- all comments to V1 addressed
- added man-page for xenhypfs tool
- added runtime parameter read access for string parametersChanges in V1:
- renamed xenfs ->xenhypfs
- added writable entries support at the interface level and in the xenhypfs tool
- added runtime parameter read access (integer type only for now)
- added docs/misc/hypfs-paths.pandoc for path descriptionsJuergen Gross (12):
xen/vmx: letopt_ept_adalways reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfstools/libxl: use libxenhypfs for setting xen runtime parameterstools/libxc: removexc_set_parameters()
xen: removeXEN_SYSCTL_set_parametersupport.gitignore | 6 + docs/features/hypervisorfs.pandoc | 92 +++++ docs/man/xenhypfs.1.pod | 61 ++++ docs/misc/hypfs-paths.pandoc | 165 +++++++++ tools/Rules.mk | 8 +- tools/flask/policy/modules/dom0.te | 4 +- tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 -- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/misc/Makefile | 6 + tools/misc/xenhypfs.c | 192 ++++++++++ tools/xl/xl_misc.c | 1 - xen/arch/arm/traps.c | 3 + xen/arch/arm/xen.lds.S | 13 +- xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hvm/vmx/vmcs.c | 47 ++- xen/arch/x86/hvm/vmx/vmx.c | 4 +- xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/domain.c | 21 +- xen/arch/x86/pv/hypercall.c | 3 + xen/arch/x86/xen.lds.S | 12 +- xen/common/Kconfig | 23 ++ xen/common/Makefile | 13 + xen/common/grant_table.c | 62 +++- xen/common/hypfs.c | 452 +++++++++++++++++++++++ xen/common/kernel.c | 84 ++++- xen/common/sysctl.c | 36 -- xen/drivers/char/console.c | 72 +++- xen/include/Makefile | 1 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +- xen/include/public/hypfs.h | 129 +++++++ xen/include/public/sysctl.h | 19 +- xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 123 +++++++ xen/include/xen/kernel.h | 3 + xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 126 +++++-- xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/tools/binfile | 43 +++ xen/xsm/dummy.c | 1 + xen/xsm/flask/Makefile | 5 +- xen/xsm/flask/flask-policy.S | 16 - xen/xsm/flask/hooks.c | 9 +- xen/xsm/flask/policy/access_vectors | 4 +- 56 files changed, 2445 insertions(+), 193 deletions(-)
Quoted 15 lines
create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644
tools/libs/hypfs/Makefilecreate mode 100644tools/libs/hypfs/core.ccreate mode 100644tools/libs/hypfs/include/xenhypfs.hcreate mode 100644tools/libs/hypfs/libxenhypfs.mapcreate mode 100644tools/libs/hypfs/xenhypfs.pc.increate mode 100644tools/misc/xenhypfs.ccreate mode 100644xen/common/hypfs.c
create mode 100644xen/include/public/hypfs.hcreate mode 100644xen/include/xen/hypfs.hcreate mode 100755 xen/tools/binfile
delete mode 100644xen/xsm/flask/flask-policy.S
There are some Acks missing on this series, so please have a look at the patches!
There are missing especially:
- Patch 1: VMX maintainers
- Patch 2 + 4: XSM maintainer
- Patch 4 + 9: Arm maintainer
- Patch 10 + 11: tools maintainers
I'd really like the series to go into 4.14 (deadline this Friday).
Juergen
Quoted 92 lines · Jürgen Groß
Quoted 72 lines · Juergen Gross
Juergen Gross (12):
xen/vmx: letopt_ept_adalways reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfstools/libxl: use libxenhypfs for setting xen runtime parameterstools/libxc: removexc_set_parameters()
xen: removeXEN_SYSCTL_set_parametersupport.gitignore | 6 + docs/features/hypervisorfs.pandoc | 92 +++++ docs/man/xenhypfs.1.pod | 61 ++++ docs/misc/hypfs-paths.pandoc | 165 +++++++++ tools/Rules.mk | 8 +- tools/flask/policy/modules/dom0.te | 4 +- tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 -- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/misc/Makefile | 6 + tools/misc/xenhypfs.c | 192 ++++++++++ tools/xl/xl_misc.c | 1 - xen/arch/arm/traps.c | 3 + xen/arch/arm/xen.lds.S | 13 +- xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hvm/vmx/vmcs.c | 47 ++- xen/arch/x86/hvm/vmx/vmx.c | 4 +- xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/domain.c | 21 +- xen/arch/x86/pv/hypercall.c | 3 + xen/arch/x86/xen.lds.S | 12 +- xen/common/Kconfig | 23 ++ xen/common/Makefile | 13 + xen/common/grant_table.c | 62 +++- xen/common/hypfs.c | 452 +++++++++++++++++++++++ xen/common/kernel.c | 84 ++++- xen/common/sysctl.c | 36 -- xen/drivers/char/console.c | 72 +++- xen/include/Makefile | 1 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +- xen/include/public/hypfs.h | 129 +++++++ xen/include/public/sysctl.h | 19 +- xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 123 +++++++ xen/include/xen/kernel.h | 3 + xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 126 +++++-- xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/tools/binfile | 43 +++ xen/xsm/dummy.c | 1 + xen/xsm/flask/Makefile | 5 +- xen/xsm/flask/flask-policy.S | 16 - xen/xsm/flask/hooks.c | 9 +- xen/xsm/flask/policy/access_vectors | 4 +- 56 files changed, 2445 insertions(+), 193 deletions(-)Quoted 15 lines
create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644
tools/libs/hypfs/Makefilecreate mode 100644tools/libs/hypfs/core.ccreate mode 100644tools/libs/hypfs/include/xenhypfs.hcreate mode 100644tools/libs/hypfs/libxenhypfs.mapcreate mode 100644tools/libs/hypfs/xenhypfs.pc.increate mode 100644tools/misc/xenhypfs.ccreate mode 100644xen/common/hypfs.c
create mode 100644xen/include/public/hypfs.hcreate mode 100644xen/include/xen/hypfs.hcreate mode 100755 xen/tools/binfile
delete mode 100644xen/xsm/flask/flask-policy.SThere are some Acks missing on this series, so please have a look at the patches!
Quoted 8 lines
There are missing especially:
- Patch 1: VMX maintainers
- Patch 2 + 4: XSM maintainer
- Patch 4 + 9: Arm maintainer
- Patch 10 + 11: tools maintainersI'd really like the series to go into 4.14 (deadline this Friday).
FTR I'm intending to waive the need for the first three of the named sets if they don't arrive by Friday (and there I don't mean last minute on Friday) - they're not overly intrusive (maybe with the exception of the XSM parts in #4) and the series has been pending for long enough. I don't feel comfortable to do so for patch 10, though; patch 11 looks to be simple enough again.
Paul, as the release manager, please let me know if you disagree.
Jan
Quoted 12 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 19 May 2020 08:45
To: Jürgen Groß <[email protected]>; Kevin Tian <[email protected]>; Julien Grall <[email protected]>; Jun Nakajima <[email protected]>; Wei Liu <[email protected]>; Ian Jackson <[email protected]>; Daniel De Graaf <[email protected]>; Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Anthony PERARD <[email protected]>; Volodymyr Babchuk <[email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [PATCH v10 00/12] Add hypervisor sysfs-like support
Quoted 102 lines
Quoted 100 lines · Jürgen Groß
Quoted 72 lines · Juergen Gross
Juergen Gross (12):
xen/vmx: letopt_ept_adalways reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfstools/libxl: use libxenhypfs for setting xen runtime parameterstools/libxc: removexc_set_parameters()
xen: removeXEN_SYSCTL_set_parametersupport.gitignore | 6 + docs/features/hypervisorfs.pandoc | 92 +++++ docs/man/xenhypfs.1.pod | 61 ++++ docs/misc/hypfs-paths.pandoc | 165 +++++++++ tools/Rules.mk | 8 +- tools/flask/policy/modules/dom0.te | 4 +- tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 -- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/misc/Makefile | 6 + tools/misc/xenhypfs.c | 192 ++++++++++ tools/xl/xl_misc.c | 1 - xen/arch/arm/traps.c | 3 + xen/arch/arm/xen.lds.S | 13 +- xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hvm/vmx/vmcs.c | 47 ++- xen/arch/x86/hvm/vmx/vmx.c | 4 +- xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/domain.c | 21 +- xen/arch/x86/pv/hypercall.c | 3 + xen/arch/x86/xen.lds.S | 12 +- xen/common/Kconfig | 23 ++ xen/common/Makefile | 13 + xen/common/grant_table.c | 62 +++- xen/common/hypfs.c | 452 +++++++++++++++++++++++ xen/common/kernel.c | 84 ++++- xen/common/sysctl.c | 36 -- xen/drivers/char/console.c | 72 +++- xen/include/Makefile | 1 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +- xen/include/public/hypfs.h | 129 +++++++ xen/include/public/sysctl.h | 19 +- xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 123 +++++++ xen/include/xen/kernel.h | 3 + xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 126 +++++-- xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/tools/binfile | 43 +++ xen/xsm/dummy.c | 1 + xen/xsm/flask/Makefile | 5 +- xen/xsm/flask/flask-policy.S | 16 - xen/xsm/flask/hooks.c | 9 +- xen/xsm/flask/policy/access_vectors | 4 +- 56 files changed, 2445 insertions(+), 193 deletions(-)Quoted 15 lines
create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644
tools/libs/hypfs/Makefilecreate mode 100644tools/libs/hypfs/core.ccreate mode 100644tools/libs/hypfs/include/xenhypfs.hcreate mode 100644tools/libs/hypfs/libxenhypfs.mapcreate mode 100644tools/libs/hypfs/xenhypfs.pc.increate mode 100644tools/misc/xenhypfs.ccreate mode 100644xen/common/hypfs.c
create mode 100644xen/include/public/hypfs.hcreate mode 100644xen/include/xen/hypfs.hcreate mode 100755 xen/tools/binfile
delete mode 100644xen/xsm/flask/flask-policy.SThere are some Acks missing on this series, so please have a look at the patches!
There are missing especially:
- Patch 1: VMX maintainers
- Patch 2 + 4: XSM maintainer
- Patch 4 + 9: Arm maintainer
- Patch 10 + 11: tools maintainersI'd really like the series to go into 4.14 (deadline this Friday).
I would also like to see this in 4.14.
Quoted 9 lines
FTR I'm intending to waive the need for the first three of the named sets if they don't arrive by Friday (and there I don't mean last minute on Friday) - they're not overly intrusive (maybe with the exception of the XSM parts in #4) and the series has been pending for long enough. I don't feel comfortable to do so for patch 10, though; patch 11 looks to be simple enough again.
Paul, as the release manager, please let me know if you disagree.
Looking at patch #4, I'm not confident that the XSM parts are complete (e.g. does xen.if need updating?). Also I'd put the new access vector in xen2, since that's where set_parameter currently is (and will be removed from in a later patch), but the xen class does appear to have space so that's really just my taste.
I agree that patch #10 really needs a tools maintainer ack but that patch #11 looks straightforward too so I'd be happy without one for that.
Paul
Quoted 1 line
Jan
Quoted 124 lines · Paul Durrant
Quoted 12 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 19 May 2020 08:45
To: Jürgen Groß <[email protected]>; Kevin Tian <[email protected]>; Julien Grall <[email protected]>; Jun Nakajima <[email protected]>; Wei Liu <[email protected]>; Ian Jackson <[email protected]>; Daniel De Graaf <[email protected]>; Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Anthony PERARD <[email protected]>; Volodymyr Babchuk <[email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [PATCH v10 00/12] Add hypervisor sysfs-like supportQuoted 102 lines
Quoted 100 lines · Jürgen Groß
Quoted 72 lines · Juergen Gross
Juergen Gross (12):
xen/vmx: letopt_ept_adalways reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfstools/libxl: use libxenhypfs for setting xen runtime parameterstools/libxc: removexc_set_parameters()
xen: removeXEN_SYSCTL_set_parametersupport.gitignore | 6 + docs/features/hypervisorfs.pandoc | 92 +++++ docs/man/xenhypfs.1.pod | 61 ++++ docs/misc/hypfs-paths.pandoc | 165 +++++++++ tools/Rules.mk | 8 +- tools/flask/policy/modules/dom0.te | 4 +- tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 -- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/misc/Makefile | 6 + tools/misc/xenhypfs.c | 192 ++++++++++ tools/xl/xl_misc.c | 1 - xen/arch/arm/traps.c | 3 + xen/arch/arm/xen.lds.S | 13 +- xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hvm/vmx/vmcs.c | 47 ++- xen/arch/x86/hvm/vmx/vmx.c | 4 +- xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/domain.c | 21 +- xen/arch/x86/pv/hypercall.c | 3 + xen/arch/x86/xen.lds.S | 12 +- xen/common/Kconfig | 23 ++ xen/common/Makefile | 13 + xen/common/grant_table.c | 62 +++- xen/common/hypfs.c | 452 +++++++++++++++++++++++ xen/common/kernel.c | 84 ++++- xen/common/sysctl.c | 36 -- xen/drivers/char/console.c | 72 +++- xen/include/Makefile | 1 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +- xen/include/public/hypfs.h | 129 +++++++ xen/include/public/sysctl.h | 19 +- xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 123 +++++++ xen/include/xen/kernel.h | 3 + xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 126 +++++-- xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/tools/binfile | 43 +++ xen/xsm/dummy.c | 1 + xen/xsm/flask/Makefile | 5 +- xen/xsm/flask/flask-policy.S | 16 - xen/xsm/flask/hooks.c | 9 +- xen/xsm/flask/policy/access_vectors | 4 +- 56 files changed, 2445 insertions(+), 193 deletions(-)Quoted 15 lines
create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644
tools/libs/hypfs/Makefilecreate mode 100644tools/libs/hypfs/core.ccreate mode 100644tools/libs/hypfs/include/xenhypfs.hcreate mode 100644tools/libs/hypfs/libxenhypfs.mapcreate mode 100644tools/libs/hypfs/xenhypfs.pc.increate mode 100644tools/misc/xenhypfs.ccreate mode 100644xen/common/hypfs.c
create mode 100644xen/include/public/hypfs.hcreate mode 100644xen/include/xen/hypfs.hcreate mode 100755 xen/tools/binfile
delete mode 100644xen/xsm/flask/flask-policy.SThere are some Acks missing on this series, so please have a look at the patches!
There are missing especially:
- Patch 1: VMX maintainers
- Patch 2 + 4: XSM maintainer
- Patch 4 + 9: Arm maintainer
- Patch 10 + 11: tools maintainersI'd really like the series to go into 4.14 (deadline this Friday).
I would also like to see this in 4.14.
Quoted 7 lines
FTR I'm intending to waive the need for the first three of the named sets if they don't arrive by Friday (and there I don't mean last minute on Friday) - they're not overly intrusive (maybe with the exception of the XSM parts in #4) and the series has been pending for long enough. I don't feel comfortable to do so for patch 10, though; patch 11 looks to be simple enough again.
Quoted 4 lines
Quoted 2 lines
Paul, as the release manager, please let me know if you disagree.
Looking at patch #4, I'm not confident that the XSM parts are complete (e.g. does xen.if need updating?). Also I'd put the new access vector in xen2, since that's where
set_parametercurrently is (and will be removed from in a later patch), but the xen class does appear to have space so that's really just my taste.
I don't think xen.if needs updating, as it contains only macros for groups of operations.
As the new hypercall isn't only replacing set_parameter, but has much wider semantics, I don't think it should go to xen2. There will be probably more interfaces being replaced and/or added after all.
Juergen
Quoted 142 lines
-----Original Message-----
From: Jürgen Groß <[email protected]>
Sent: 25 May 2020 08:02
To: [email protected]; 'Jan Beulich' <[email protected]>; 'Kevin Tian' <[email protected]>; 'Julien Grall' <[email protected]>; 'Jun Nakajima' <[email protected]>; 'Wei Liu' <[email protected]>; 'Ian Jackson' <[email protected]>; 'Daniel De Graaf' <[email protected]>
Cc: 'Stefano Stabellini' <[email protected]>; 'Andrew Cooper' <[email protected]>; 'George Dunlap' <[email protected]>; 'Anthony PERARD' <[email protected]>; xen- [email protected]; 'Volodymyr Babchuk' <[email protected]>; 'Roger Pau Monné' <[email protected]>
Subject: Re: [PATCH v10 00/12] Add hypervisor sysfs-like supportQuoted 4 lines · Paul Durrant
Quoted 4 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 19 May 2020 08:45
To: Jürgen Groß <[email protected]>; Kevin Tian <[email protected]>; Julien GrallQuoted 1 line
Quoted 1 line
Jun Nakajima <[email protected]>; Wei Liu <[email protected]>; Ian Jackson
Quoted 122 lines
Quoted 7 lines
Daniel De Graaf <[email protected]>; Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Anthony PERARD <[email protected]>; Volodymyr Babchuk <[email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [PATCH v10 00/12] Add hypervisor sysfs-like supportQuoted 102 lines
Quoted 100 lines · Jürgen Groß
Quoted 72 lines · Juergen Gross
Juergen Gross (12):
xen/vmx: letopt_ept_adalways reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfstools/libxl: use libxenhypfs for setting xen runtime parameterstools/libxc: removexc_set_parameters()
xen: removeXEN_SYSCTL_set_parametersupport.gitignore | 6 + docs/features/hypervisorfs.pandoc | 92 +++++ docs/man/xenhypfs.1.pod | 61 ++++ docs/misc/hypfs-paths.pandoc | 165 +++++++++ tools/Rules.mk | 8 +- tools/flask/policy/modules/dom0.te | 4 +- tools/libs/Makefile | 1 + tools/libs/hypfs/Makefile | 16 + tools/libs/hypfs/core.c | 536 ++++++++++++++++++++++++++++ tools/libs/hypfs/include/xenhypfs.h | 90 +++++ tools/libs/hypfs/libxenhypfs.map | 10 + tools/libs/hypfs/xenhypfs.pc.in | 10 + tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_misc.c | 21 -- tools/libxl/Makefile | 3 +- tools/libxl/libxl.c | 53 ++- tools/libxl/libxl_internal.h | 1 + tools/libxl/xenlight.pc.in | 2 +- tools/misc/Makefile | 6 + tools/misc/xenhypfs.c | 192 ++++++++++ tools/xl/xl_misc.c | 1 - xen/arch/arm/traps.c | 3 + xen/arch/arm/xen.lds.S | 13 +- xen/arch/x86/hvm/hypercall.c | 3 + xen/arch/x86/hvm/vmx/vmcs.c | 47 ++- xen/arch/x86/hvm/vmx/vmx.c | 4 +- xen/arch/x86/hypercall.c | 3 + xen/arch/x86/pv/domain.c | 21 +- xen/arch/x86/pv/hypercall.c | 3 + xen/arch/x86/xen.lds.S | 12 +- xen/common/Kconfig | 23 ++ xen/common/Makefile | 13 + xen/common/grant_table.c | 62 +++- xen/common/hypfs.c | 452 +++++++++++++++++++++++ xen/common/kernel.c | 84 ++++- xen/common/sysctl.c | 36 -- xen/drivers/char/console.c | 72 +++- xen/include/Makefile | 1 + xen/include/asm-x86/hvm/vmx/vmcs.h | 3 +- xen/include/public/hypfs.h | 129 +++++++ xen/include/public/sysctl.h | 19 +- xen/include/public/xen.h | 1 + xen/include/xen/hypercall.h | 10 + xen/include/xen/hypfs.h | 123 +++++++ xen/include/xen/kernel.h | 3 + xen/include/xen/lib.h | 1 - xen/include/xen/param.h | 126 +++++-- xen/include/xlat.lst | 2 + xen/include/xsm/dummy.h | 6 + xen/include/xsm/xsm.h | 6 + xen/tools/binfile | 43 +++ xen/xsm/dummy.c | 1 + xen/xsm/flask/Makefile | 5 +- xen/xsm/flask/flask-policy.S | 16 - xen/xsm/flask/hooks.c | 9 +- xen/xsm/flask/policy/access_vectors | 4 +- 56 files changed, 2445 insertions(+), 193 deletions(-)Quoted 15 lines
create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644
tools/libs/hypfs/Makefilecreate mode 100644tools/libs/hypfs/core.ccreate mode 100644tools/libs/hypfs/include/xenhypfs.hcreate mode 100644tools/libs/hypfs/libxenhypfs.mapcreate mode 100644tools/libs/hypfs/xenhypfs.pc.increate mode 100644tools/misc/xenhypfs.ccreate mode 100644xen/common/hypfs.c
create mode 100644xen/include/public/hypfs.hcreate mode 100644xen/include/xen/hypfs.hcreate mode 100755 xen/tools/binfile
delete mode 100644xen/xsm/flask/flask-policy.SThere are some Acks missing on this series, so please have a look at the patches!
There are missing especially:
- Patch 1: VMX maintainers
- Patch 2 + 4: XSM maintainer
- Patch 4 + 9: Arm maintainer
- Patch 10 + 11: tools maintainersI'd really like the series to go into 4.14 (deadline this Friday).
I would also like to see this in 4.14.
Quoted 9 lines
FTR I'm intending to waive the need for the first three of the named sets if they don't arrive by Friday (and there I don't mean last minute on Friday) - they're not overly intrusive (maybe with the exception of the XSM parts in #4) and the series has been pending for long enough. I don't feel comfortable to do so for patch 10, though; patch 11 looks to be simple enough again.
Paul, as the release manager, please let me know if you disagree.
Quoted 8 lines
Quoted 1 line
Looking at patch #4, I'm not confident that the XSM parts are complete (e.g. does xen.if need
updating?). Also I'd put the new access vector in xen2, since that's where
set_parametercurrently is (and will be removed from in a later patch), but the xen class does appear to have space so that's really just my taste.I don't think xen.if needs updating, as it contains only macros for groups of operations.
Ok.
Quoted 4 lines
As the new hypercall isn't only replacing
set_parameter, but has much wider semantics, I don't think it should go to xen2. There will be probably more interfaces being replaced and/or added after all.
If you're happy with it then, in the absence of a response from Daniel, then I think patch #4 can go in. Patch #10 and #11 have acks now, so it looks like the series is good to go. Could you send a patch for CHANGELOG.md as I think we'd consider this a significant feature :-)
Paul
Quoted 2 lines
Juergen
Quoted 15 lines · Paul Durrant
Quoted 12 lines
From: Jürgen Groß <[email protected]>
Sent: 25 May 2020 08:02Quoted 1 line · Paul Durrant
Looking at patch #4, I'm not confident that the XSM parts are complete (e.g. does xen.if need
updating?). Also I'd put the new access vector in xen2, since that's where
set_parametercurrently is (and will be removed from in a later patch), but the xen class does appear to have space so that's really just my taste.I don't think xen.if needs updating, as it contains only macros for groups of operations.
Ok.
Quoted 8 lines
Quoted 4 lines
As the new hypercall isn't only replacing
set_parameter, but has much wider semantics, I don't think it should go to xen2. There will be probably more interfaces being replaced and/or added after all.If you're happy with it then, in the absence of a response from Daniel, then I think patch #4 can go in. Patch #10 and #11 have acks now, so it looks like the series is good to go.
I've pinged Daniel privately, and hence would like to give him a day or two more to respond at least there. If I don't hear back, I'll put the series in before the end of the week.
Jan
Quoted 151 lines · Paul Durrant
Quoted 142 lines
-----Original Message-----
From: Jürgen Groß <[email protected]>
Sent: 25 May 2020 08:02
To: [email protected]; 'Jan Beulich' <[email protected]>; 'Kevin Tian' <[email protected]>; 'Julien Grall' <[email protected]>; 'Jun Nakajima' <[email protected]>; 'Wei Liu' <[email protected]>; 'Ian Jackson' <[email protected]>; 'Daniel De Graaf' <[email protected]>
Cc: 'Stefano Stabellini' <[email protected]>; 'Andrew Cooper' <[email protected]>; 'George Dunlap' <[email protected]>; 'Anthony PERARD' <[email protected]>; xen- [email protected]; 'Volodymyr Babchuk' <[email protected]>; 'Roger Pau Monné' <[email protected]>
Subject: Re: [PATCH v10 00/12] Add hypervisor sysfs-like supportQuoted 4 lines · Paul Durrant
Quoted 4 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 19 May 2020 08:45
To: Jürgen Groß <[email protected]>; Kevin Tian <[email protected]>; Julien GrallQuoted 1 line
Quoted 1 line
Jun Nakajima <[email protected]>; Wei Liu <[email protected]>; Ian Jackson
Quoted 122 lines
Quoted 7 lines
Daniel De Graaf <[email protected]>; Paul Durrant <[email protected]>
Cc: [email protected]; Stefano Stabellini <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Anthony PERARD <[email protected]>; Volodymyr Babchuk <[email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [PATCH v10 00/12] Add hypervisor sysfs-like supportQuoted 102 lines
Quoted 100 lines · Jürgen Groß
Quoted 78 lines · Juergen Gross
Juergen Gross (12):
xen/vmx: letopt_ept_adalways reflect the current setting
xen: add a generic way to include binary files as variables
docs: add feature document for Xen hypervisor sysfs-like support
xen: add basic hypervisor filesystem support
libs: add libxenhypfs
tools: add xenfs tool
xen: provide version information in hypfs
xen: add /buildinfo/config entry to hypervisor filesystem
xen: add runtime parameter access support to hypfstools/libxl: use libxenhypfs for setting xen runtime parameterstools/libxc: removexc_set_parameters()
xen: removeXEN_SYSCTL_set_parametersupport.gitignore | 6 +
docs/features/hypervisorfs.pandoc | 92 +++++
docs/man/xenhypfs.1.pod | 61 ++++
docs/misc/hypfs-paths.pandoc | 165 +++++++++
tools/Rules.mk| 8 +-
tools/flask/policy/modules/dom0.te| 4 +-
tools/libs/Makefile| 1 +
tools/libs/hypfs/Makefile| 16 +
tools/libs/hypfs/core.c| 536 ++++++++++++++++++++++++++++
tools/libs/hypfs/include/xenhypfs.h| 90 +++++
tools/libs/hypfs/libxenhypfs.map| 10 +
tools/libs/hypfs/xenhypfs.pc.in| 10 +
tools/libxc/include/xenctrl.h| 1 -
tools/libxc/xc_misc.c| 21 --
tools/libxl/Makefile| 3 +-
tools/libxl/libxl.c| 53 ++-
tools/libxl/libxl_internal.h| 1 +
tools/libxl/xenlight.pc.in| 2 +-
tools/misc/Makefile| 6 +
tools/misc/xenhypfs.c| 192 ++++++++++
tools/xl/xl_misc.c| 1 -
xen/arch/arm/traps.c| 3 +
xen/arch/arm/xen.lds.S| 13 +-
xen/arch/x86/hvm/hypercall.c| 3 +
xen/arch/x86/hvm/vmx/vmcs.c| 47 ++-
xen/arch/x86/hvm/vmx/vmx.c| 4 +-
xen/arch/x86/hypercall.c| 3 +
xen/arch/x86/pv/domain.c| 21 +-
xen/arch/x86/pv/hypercall.c| 3 +
xen/arch/x86/xen.lds.S| 12 +-
xen/common/Kconfig | 23 ++
xen/common/Makefile | 13 +
xen/common/grant_table.c| 62 +++-
xen/common/hypfs.c| 452 +++++++++++++++++++++++
xen/common/kernel.c| 84 ++++-
xen/common/sysctl.c| 36 --
xen/drivers/char/console.c| 72 +++-
xen/include/Makefile | 1 +
xen/include/asm-x86/hvm/vmx/vmcs.h| 3 +-
xen/include/public/hypfs.h| 129 +++++++
xen/include/public/sysctl.h| 19 +-
xen/include/public/xen.h| 1 +
xen/include/xen/hypercall.h| 10 +
xen/include/xen/hypfs.h| 123 +++++++
xen/include/xen/kernel.h| 3 +
xen/include/xen/lib.h| 1 -
xen/include/xen/param.h| 126 +++++--
xen/include/xlat.lst | 2 +
xen/include/xsm/dummy.h| 6 +
xen/include/xsm/xsm.h| 6 +
xen/tools/binfile | 43 +++
xen/xsm/dummy.c| 1 +
xen/xsm/flask/Makefile | 5 +-
xen/xsm/flask/flask-policy.S| 16 -
xen/xsm/flask/hooks.c| 9 +-
xen/xsm/flask/policy/access_vectors | 4 +-
56 files changed, 2445 insertions(+), 193 deletions(-) create mode 100644 docs/features/hypervisorfs.pandoc create mode 100644 docs/man/xenhypfs.1.pod create mode 100644 docs/misc/hypfs-paths.pandoc create mode 100644tools/libs/hypfs/Makefilecreate mode 100644tools/libs/hypfs/core.ccreate mode 100644tools/libs/hypfs/include/xenhypfs.hQuoted 9 lines
create mode 100644
tools/libs/hypfs/libxenhypfs.mapcreate mode 100644tools/libs/hypfs/xenhypfs.pc.increate mode 100644tools/misc/xenhypfs.ccreate mode 100644xen/common/hypfs.ccreate mode 100644xen/include/public/hypfs.hcreate mode 100644xen/include/xen/hypfs.hcreate mode 100755 xen/tools/binfile delete mode 100644xen/xsm/flask/flask-policy.SThere are some Acks missing on this series, so please have a look at the patches!
There are missing especially:
- Patch 1: VMX maintainers
- Patch 2 + 4: XSM maintainer
- Patch 4 + 9: Arm maintainer
- Patch 10 + 11: tools maintainersI'd really like the series to go into 4.14 (deadline this Friday).
I would also like to see this in 4.14.
Quoted 9 lines
FTR I'm intending to waive the need for the first three of the named sets if they don't arrive by Friday (and there I don't mean last minute on Friday) - they're not overly intrusive (maybe with the exception of the XSM parts in #4) and the series has been pending for long enough. I don't feel comfortable to do so for patch 10, though; patch 11 looks to be simple enough again.
Paul, as the release manager, please let me know if you disagree.
Quoted 8 lines
Quoted 1 line
Looking at patch #4, I'm not confident that the XSM parts are complete (e.g. does xen.if need
updating?). Also I'd put the new access vector in xen2, since that's where
set_parametercurrently is (and will be removed from in a later patch), but the xen class does appear to have space so that's really just my taste.I don't think xen.if needs updating, as it contains only macros for groups of operations.
Quoted 8 lines
Ok.
Quoted 4 lines
As the new hypercall isn't only replacing
set_parameter, but has much wider semantics, I don't think it should go to xen2. There will be probably more interfaces being replaced and/or added after all.If you're happy with it then, in the absence of a response from Daniel, then I think patch #4 can go in. Patch #10 and #11 have acks now, so it looks like the series is good to go. Could you send a patch for CHANGELOG.md as I think we'd consider this a significant feature :-)
Will send a patch for CHANGELOG.md and one for SUPPORT.md.
Juergen