xen/xlat: Improvements to compat hypercall checking
cover xen/xlat: Improvements to compat hypercall checking
This started off as patch 3, and grew somewhat.
Patches 1-3 are simple and hopefully non-controversial.
Patch 4 is an attempt to make the headers less fragile, but came with an unexpected complication. Details in the patch.
Andrew Cooper (4):
xen/xlat: Sort out whitespace
xen/xlat: Sort structs per file
xen/gnttab: Perform compat/native gnttab_query_size check xen/public: Use -Wpadding for public headers
xen/common/Makefile | 1 + xen/common/compat/grant_table.c | 4 ++ xen/common/hdr-chk.c | 13 ++++++ xen/include/public/grant_table.h | 7 ++++ xen/include/xlat.lst | 70 +++++++++++++++++++++----------- 5 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 xen/common/hdr-chk.c
base-commit: c0f890cd9d5fd2c17a1e3110cb26f98c90ce8429
Signature · 1 line
2.30.2
PATCH 1/4 xen/xlat: Sort out whitespace
* Fix tabs/spaces mismatch for certain rows
* Insert lines between header files to improve legibility
---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/include/xlat.lst | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
xen/include/xlat.lst +27 -4
@@ -20,19 +20,24 @@ # First column indicator: # ! - needs translation # ? - needs checking + ? dom0_vga_console_info xen.h ? xenctl_bitmap xen.h ? mmu_update xen.h ! mmuext_op xen.h ! start_info xen.h ? vcpu_time_info xen.h + ? pmu_amd_ctxt arch-x86/pmu.h ? pmu_arch arch-x86/pmu.h ? pmu_cntr_pair arch-x86/pmu.h ? pmu_intel_ctxt arch-x86/pmu.h ? pmu_regs arch-x86/pmu.h + ! cpu_user_regs arch-x86/xen-@[email protected] + ! trap_info arch-x86/xen.h + ? cpu_offline_action arch-x86/xen-mca.h ? mc arch-x86/xen-mca.h ? mcinfo_bank arch-x86/xen-mca.h
@@ -50,6 +55,7 @@ ? mc_notifydomain arch-x86/xen-mca.h ! mc_physcpuinfo arch-x86/xen-mca.h ? page_offline_action arch-x86/xen-mca.h + ? argo_addr argo.h ! argo_iov argo.h ? argo_register_ring argo.h
@@ -59,6 +65,7 @@ ? argo_ring_message_header argo.h ? argo_send_addr argo.h ? argo_unregister_ring argo.h + ? evtchn_alloc_unbound event_channel.h ? evtchn_bind_interdomain event_channel.h ? evtchn_bind_ipi event_channel.h
@@ -74,6 +81,7 @@ ? evtchn_set_priority event_channel.h ? evtchn_status event_channel.h ? evtchn_unmask event_channel.h + ? gnttab_cache_flush grant_table.h ! gnttab_copy grant_table.h ? gnttab_dump_table grant_table.h
@@ -86,9 +94,10 @@ ? gnttab_get_version grant_table.h ! gnttab_get_status_frames grant_table.h ? grant_entry_v1 grant_table.h -? grant_entry_header grant_table.h +? grant_entry_header grant_table.h ? grant_entry_v2 grant_table.h ? gnttab_swap_grant_ref grant_table.h + ! dm_op_buf hvm/dm_op.h ? dm_op_create_ioreq_server hvm/dm_op.h ? dm_op_destroy_ioreq_server hvm/dm_op.h
@@ -108,15 +117,20 @@ ? dm_op_set_pci_intx_level hvm/dm_op.h ? dm_op_set_pci_link_route hvm/dm_op.h ? dm_op_track_dirty_vram hvm/dm_op.h + ! hvm_altp2m_set_mem_access_multi hvm/hvm_op.h + ? 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 + ! add_to_physmap memory.h ! add_to_physmap_batch memory.h ! foreign_memory_map memory.h
@@ -130,6 +144,7 @@ ! reserved_device_memory_map memory.h ? vmemrange memory.h ! vnuma_topology_info memory.h + ? physdev_eoi physdev.h ? physdev_get_free_pirq physdev.h ? physdev_irq physdev.h
@@ -143,6 +158,7 @@ ? physdev_restore_msi physdev.h ? physdev_set_iopl physdev.h ? physdev_setup_gsi physdev.h + ! pct_register platform.h ! power_register platform.h ? processor_csd platform.h
@@ -158,23 +174,30 @@ ? xenpf_pcpu_version platform.h ? xenpf_resource_entry platform.h ? xenpf_ucode_revision platform.h + ? pmu_data pmu.h ? pmu_params pmu.h + ! sched_poll sched.h ? sched_pin_override sched.h ? sched_remote_shutdown sched.h ? sched_shutdown sched.h + ? t_buf trace.h + ? vcpu_get_physid vcpu.h ? vcpu_register_vcpu_info vcpu.h ! vcpu_runstate_info vcpu.h ? vcpu_set_periodic_timer vcpu.h ! vcpu_set_singleshot_timer vcpu.h -? build_id version.h -? compile_info version.h -? feature_info version.h + +? build_id version.h +? compile_info version.h +? feature_info version.h + ? xenoprof_init xenoprof.h ? xenoprof_passive xenoprof.h + ? flask_access xsm/flask_op.h ? flask_cache_stats xsm/flask_op.h ? flask_hash_stats xsm/flask_op.h
base-commit: c0f890cd9d5fd2c17a1e3110cb26f98c90ce8429
Signature · 1 line
2.30.2
Re: [PATCH 1/4] xen/xlat: Sort out whitespace
Quoted 130 lines · Andrew Cooper
* Fix tabs/spaces mismatch for certain rows
* Insert lines between header files to improve legibilitySigned-off-by Andrew Cooper <[email protected]>---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>--- xen/include/xlat.lst | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)xen/include/xlat.lst +21
-1@@ -20,19 +20,24 @@ # First column indicator: # ! - needs translation # ? - needs checking + ? dom0_vga_console_info xen.h ? xenctl_bitmap xen.h ? mmu_update xen.h ! mmuext_op xen.h ! start_info xen.h ? vcpu_time_info xen.h + ? pmu_amd_ctxt arch-x86/pmu.h ? pmu_arch arch-x86/pmu.h ? pmu_cntr_pair arch-x86/pmu.h ? pmu_intel_ctxt arch-x86/pmu.h ? pmu_regs arch-x86/pmu.h + ! cpu_user_regs arch-x86/xen-@[email protected] + ! trap_info arch-x86/xen.h + ? cpu_offline_action arch-x86/xen-mca.h ? mc arch-x86/xen-mca.h ? mcinfo_bank arch-x86/xen-mca.h@@ -50,6 +55,7 @@ ? mc_notifydomain arch-x86/xen-mca.h ! mc_physcpuinfo arch-x86/xen-mca.h ? page_offline_action arch-x86/xen-mca.h + ? argo_addr argo.h ! argo_iov argo.h ? argo_register_ring argo.h@@ -59,6 +65,7 @@ ? argo_ring_message_header argo.h ? argo_send_addr argo.h ? argo_unregister_ring argo.h + ? evtchn_alloc_unbound event_channel.h ? evtchn_bind_interdomain event_channel.h ? evtchn_bind_ipi event_channel.h@@ -74,6 +81,7 @@ ? evtchn_set_priority event_channel.h ? evtchn_status event_channel.h ? evtchn_unmask event_channel.h + ? gnttab_cache_flush grant_table.h ! gnttab_copy grant_table.h ? gnttab_dump_table grant_table.h@@ -86,9 +94,10 @@ ? gnttab_get_version grant_table.h ! gnttab_get_status_frames grant_table.h ? grant_entry_v1 grant_table.h -? grant_entry_header grant_table.h +? grant_entry_header grant_table.h ? grant_entry_v2 grant_table.h ? gnttab_swap_grant_ref grant_table.h + ! dm_op_buf hvm/dm_op.h ? dm_op_create_ioreq_server hvm/dm_op.h ? dm_op_destroy_ioreq_server hvm/dm_op.h@@ -108,15 +117,20 @@ ? dm_op_set_pci_intx_level hvm/dm_op.h ? dm_op_set_pci_link_route hvm/dm_op.h ? dm_op_track_dirty_vram hvm/dm_op.h + ! hvm_altp2m_set_mem_access_multi hvm/hvm_op.h + ? 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 + ! add_to_physmap memory.h ! add_to_physmap_batch memory.h ! foreign_memory_map memory.h@@ -130,6 +144,7 @@ ! reserved_device_memory_map memory.h ? vmemrange memory.h ! vnuma_topology_info memory.h + ? physdev_eoi physdev.h ? physdev_get_free_pirq physdev.h ? physdev_irq physdev.h@@ -143,6 +158,7 @@ ? physdev_restore_msi physdev.h ? physdev_set_iopl physdev.h ? physdev_setup_gsi physdev.h + ! pct_register platform.h ! power_register platform.h ? processor_csd platform.h@@ -158,23 +174,30 @@ ? xenpf_pcpu_version platform.h ? xenpf_resource_entry platform.h ? xenpf_ucode_revision platform.h + ? pmu_data pmu.h ? pmu_params pmu.h + ! sched_poll sched.h ? sched_pin_override sched.h ? sched_remote_shutdown sched.h ? sched_shutdown sched.h + ? t_buf trace.h +
xen/include/xlat.lst line 194
Quoted 10 lines
xen/include/xlat.lst +2
-3? vcpu_get_physid vcpu.h ? vcpu_register_vcpu_info vcpu.h ! vcpu_runstate_info vcpu.h ? vcpu_set_periodic_timer vcpu.h ! vcpu_set_singleshot_timer vcpu.h -? build_id version.h -? compile_info version.h -? feature_info version.h + +? build_id version.h
This is misaligned after this patch. You might want to fix this on commit.
Quoted 14 lines
xen/include/xlat.lst +4
-0+? compile_info version.h +? feature_info version.h + ? xenoprof_init xenoprof.h ? xenoprof_passive xenoprof.h + ? flask_access xsm/flask_op.h ? flask_cache_stats xsm/flask_op.h ? flask_hash_stats xsm/flask_op.hbase-commit:
c0f890cd9d5fd2c17a1e3110cb26f98c90ce8429Signature · 1 line
2.30.2
Re: [PATCH 1/4] xen/xlat: Sort out whitespace
Quoted 144 lines · Stefano Stabellini
Quoted 130 lines · Andrew Cooper
* Fix tabs/spaces mismatch for certain rows
* Insert lines between header files to improve legibilitySigned-off-by Andrew Cooper <[email protected]>---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>--- xen/include/xlat.lst | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)xen/include/xlat.lst +21
-1@@ -20,19 +20,24 @@ # First column indicator: # ! - needs translation # ? - needs checking + ? dom0_vga_console_info xen.h ? xenctl_bitmap xen.h ? mmu_update xen.h ! mmuext_op xen.h ! start_info xen.h ? vcpu_time_info xen.h + ? pmu_amd_ctxt arch-x86/pmu.h ? pmu_arch arch-x86/pmu.h ? pmu_cntr_pair arch-x86/pmu.h ? pmu_intel_ctxt arch-x86/pmu.h ? pmu_regs arch-x86/pmu.h + ! cpu_user_regs arch-x86/xen-@[email protected] + ! trap_info arch-x86/xen.h + ? cpu_offline_action arch-x86/xen-mca.h ? mc arch-x86/xen-mca.h ? mcinfo_bank arch-x86/xen-mca.h@@ -50,6 +55,7 @@ ? mc_notifydomain arch-x86/xen-mca.h ! mc_physcpuinfo arch-x86/xen-mca.h ? page_offline_action arch-x86/xen-mca.h + ? argo_addr argo.h ! argo_iov argo.h ? argo_register_ring argo.h@@ -59,6 +65,7 @@ ? argo_ring_message_header argo.h ? argo_send_addr argo.h ? argo_unregister_ring argo.h + ? evtchn_alloc_unbound event_channel.h ? evtchn_bind_interdomain event_channel.h ? evtchn_bind_ipi event_channel.h@@ -74,6 +81,7 @@ ? evtchn_set_priority event_channel.h ? evtchn_status event_channel.h ? evtchn_unmask event_channel.h + ? gnttab_cache_flush grant_table.h ! gnttab_copy grant_table.h ? gnttab_dump_table grant_table.h@@ -86,9 +94,10 @@ ? gnttab_get_version grant_table.h ! gnttab_get_status_frames grant_table.h ? grant_entry_v1 grant_table.h -? grant_entry_header grant_table.h +? grant_entry_header grant_table.h ? grant_entry_v2 grant_table.h ? gnttab_swap_grant_ref grant_table.h + ! dm_op_buf hvm/dm_op.h ? dm_op_create_ioreq_server hvm/dm_op.h ? dm_op_destroy_ioreq_server hvm/dm_op.h@@ -108,15 +117,20 @@ ? dm_op_set_pci_intx_level hvm/dm_op.h ? dm_op_set_pci_link_route hvm/dm_op.h ? dm_op_track_dirty_vram hvm/dm_op.h + ! hvm_altp2m_set_mem_access_multi hvm/hvm_op.h + ? 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 + ! add_to_physmap memory.h ! add_to_physmap_batch memory.h ! foreign_memory_map memory.h@@ -130,6 +144,7 @@ ! reserved_device_memory_map memory.h ? vmemrange memory.h ! vnuma_topology_info memory.h + ? physdev_eoi physdev.h ? physdev_get_free_pirq physdev.h ? physdev_irq physdev.h@@ -143,6 +158,7 @@ ? physdev_restore_msi physdev.h ? physdev_set_iopl physdev.h ? physdev_setup_gsi physdev.h + ! pct_register platform.h ! power_register platform.h ? processor_csd platform.h@@ -158,23 +174,30 @@ ? xenpf_pcpu_version platform.h ? xenpf_resource_entry platform.h ? xenpf_ucode_revision platform.h + ? pmu_data pmu.h ? pmu_params pmu.h + ! sched_poll sched.h ? sched_pin_override sched.h ? sched_remote_shutdown sched.h ? sched_shutdown sched.h + ? t_buf trace.h +xen/include/xlat.lst line 194
Quoted 10 lines
xen/include/xlat.lst +2
-3? vcpu_get_physid vcpu.h ? vcpu_register_vcpu_info vcpu.h ! vcpu_runstate_info vcpu.h ? vcpu_set_periodic_timer vcpu.h ! vcpu_set_singleshot_timer vcpu.h -? build_id version.h -? compile_info version.h -? feature_info version.h + +? build_id version.hThis is misaligned after this patch. You might want to fix this on commit.
Quoted 1 line
Reviewed-by Stefano Stabellini <[email protected]>
Thanks, but what's misaligned about it?
This is one line where there was a space/tabs mismatch before, which has been corrected.
This is what cat -A thinks of the delta.
!^Ivcpu_set_singleshot_timer^Ivcpu.h$
-?^Ibuild_id version.h$
-?^Icompile_info version.h$
-?^Ifeature_info version.h$
+$
+?^Ibuild_id^I^I^Iversion.h$
+?^Icompile_info^I^I^Iversion.h$
+?^Ifeature_info^I^I^Iversion.h$
+$
?^Ixenoprof_init^I^I^Ixenoprof.h$
~Andrew
PATCH 2/4 xen/xlat: Sort structs per file
In reply to Andrew Cooper---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/include/xlat.lst | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
xen/include/xlat.lst +20 -20
@@ -22,11 +22,11 @@ # ? - needs checking ? dom0_vga_console_info xen.h -? xenctl_bitmap xen.h ? mmu_update xen.h ! mmuext_op xen.h ! start_info xen.h ? vcpu_time_info xen.h +? xenctl_bitmap xen.h ? pmu_amd_ctxt arch-x86/pmu.h ? pmu_arch arch-x86/pmu.h
@@ -40,13 +40,6 @@ ? cpu_offline_action arch-x86/xen-mca.h ? mc arch-x86/xen-mca.h -? mcinfo_bank arch-x86/xen-mca.h -? mcinfo_common arch-x86/xen-mca.h -? mcinfo_extended arch-x86/xen-mca.h -? mcinfo_global arch-x86/xen-mca.h -? mcinfo_logical_cpu arch-x86/xen-mca.h -? mcinfo_msr arch-x86/xen-mca.h -? mcinfo_recovery arch-x86/xen-mca.h ! mc_fetch arch-x86/xen-mca.h ? mc_info arch-x86/xen-mca.h ? mc_inject_v2 arch-x86/xen-mca.h
@@ -54,6 +47,13 @@ ? mc_msrinject arch-x86/xen-mca.h ? mc_notifydomain arch-x86/xen-mca.h ! mc_physcpuinfo arch-x86/xen-mca.h +? mcinfo_bank arch-x86/xen-mca.h +? mcinfo_common arch-x86/xen-mca.h +? mcinfo_extended arch-x86/xen-mca.h +? mcinfo_global arch-x86/xen-mca.h +? mcinfo_logical_cpu arch-x86/xen-mca.h +? mcinfo_msr arch-x86/xen-mca.h +? mcinfo_recovery arch-x86/xen-mca.h ? page_offline_action arch-x86/xen-mca.h ? argo_addr argo.h
@@ -85,18 +85,18 @@ ? gnttab_cache_flush grant_table.h ! gnttab_copy grant_table.h ? gnttab_dump_table grant_table.h +! gnttab_get_status_frames grant_table.h +? gnttab_get_version grant_table.h ? gnttab_map_grant_ref grant_table.h +? gnttab_set_version grant_table.h ! gnttab_setup_table grant_table.h +? gnttab_swap_grant_ref grant_table.h ! gnttab_transfer grant_table.h -? gnttab_unmap_grant_ref grant_table.h ? gnttab_unmap_and_replace grant_table.h -? gnttab_set_version grant_table.h -? gnttab_get_version grant_table.h -! gnttab_get_status_frames grant_table.h -? grant_entry_v1 grant_table.h +? gnttab_unmap_grant_ref grant_table.h ? grant_entry_header grant_table.h +? grant_entry_v1 grant_table.h ? grant_entry_v2 grant_table.h -? gnttab_swap_grant_ref grant_table.h ! dm_op_buf hvm/dm_op.h ? dm_op_create_ioreq_server hvm/dm_op.h
@@ -134,11 +134,11 @@ ! add_to_physmap memory.h ! add_to_physmap_batch memory.h ! foreign_memory_map memory.h +! mem_access_op memory.h +! mem_acquire_resource memory.h ! memory_exchange memory.h ! memory_map memory.h ! memory_reservation memory.h -! mem_access_op memory.h -! mem_acquire_resource memory.h ! pod_target memory.h ! remove_from_physmap memory.h ! reserved_device_memory_map memory.h
@@ -154,10 +154,10 @@ ? physdev_pci_device physdev.h ? physdev_pci_device_add physdev.h ? physdev_pci_mmcfg_reserved physdev.h -? physdev_unmap_pirq physdev.h ? physdev_restore_msi physdev.h ? physdev_set_iopl physdev.h ? physdev_setup_gsi physdev.h +? physdev_unmap_pirq physdev.h ! pct_register platform.h ! power_register platform.h
@@ -169,17 +169,17 @@ ? processor_px platform.h ! psd_package platform.h ? xenpf_enter_acpi_sleep platform.h -! xenpf_symdata platform.h -? xenpf_pcpuinfo platform.h ? xenpf_pcpu_version platform.h +? xenpf_pcpuinfo platform.h ? xenpf_resource_entry platform.h +! xenpf_symdata platform.h ? xenpf_ucode_revision platform.h ? pmu_data pmu.h ? pmu_params pmu.h -! sched_poll sched.h ? sched_pin_override sched.h +! sched_poll sched.h ? sched_remote_shutdown sched.h ? sched_shutdown sched.h
Signature · 1 line
2.30.2
Re: [PATCH 2/4] xen/xlat: Sort structs per file
Quoted 1 line · Andrew Cooper
Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 2/4] xen/xlat: Sort structs per file
In reply to Andrew CooperQuoted 1 line · Andrew Cooper
Signed-off-by Andrew Cooper <[email protected]>
While I don't mind the change as is, "sort" is ambiguous here in one regard. Personally I'd prefer if those parts of the change were dropped, but I can live with the sorting criteria being spelled out in the description:
Quoted 16 lines
xen/include/xlat.lst +0
-7@@ -40,13 +40,6 @@ ? cpu_offline_action arch-x86/xen-mca.h ? mc arch-x86/xen-mca.h -? mcinfo_bank arch-x86/xen-mca.h -? mcinfo_common arch-x86/xen-mca.h -? mcinfo_extended arch-x86/xen-mca.h -? mcinfo_global arch-x86/xen-mca.h -? mcinfo_logical_cpu arch-x86/xen-mca.h -? mcinfo_msr arch-x86/xen-mca.h -? mcinfo_recovery arch-x86/xen-mca.h ! mc_fetch arch-x86/xen-mca.h ? mc_info arch-x86/xen-mca.h ? mc_inject_v2 arch-x86/xen-mca.h@@ -54,6 +47,13 @@ ? mc_msrinject arch-x86/xen-mca.h
xen/include/xlat.lst line 57
Quoted 10 lines
xen/include/xlat.lst +7
-0? mc_notifydomain arch-x86/xen-mca.h ! mc_physcpuinfo arch-x86/xen-mca.h +? mcinfo_bank arch-x86/xen-mca.h +? mcinfo_common arch-x86/xen-mca.h +? mcinfo_extended arch-x86/xen-mca.h +? mcinfo_global arch-x86/xen-mca.h +? mcinfo_logical_cpu arch-x86/xen-mca.h +? mcinfo_msr arch-x86/xen-mca.h +? mcinfo_recovery arch-x86/xen-mca.h ? page_offline_action arch-x86/xen-mca.h
Imo this sorting was fine (at least one further instance below): Whether underscore sorts ahead of lower case letters depends on how sorting is done. I take you assume sorting as per the C locale, when the original sorting was considering undercores to be separators, i.e. in a different character class (together with e.g. dash or tilde).
When using C local sorting, I think arch-x86/xen-@[email protected] also would need moving past arch-x86/xen.h (whereas right now all separators are deemed equal and hence @ comes ahead of h which in turn is ahead of m).
Jan
Re: [PATCH 2/4] xen/xlat: Sort structs per file
Quoted 27 lines · Jan Beulich
Quoted 1 line · Andrew Cooper
Signed-off-by Andrew Cooper <[email protected]>While I don't mind the change as is, "sort" is ambiguous here in one regard. Personally I'd prefer if those parts of the change were dropped, but I can live with the sorting criteria being spelled out in the description:
Quoted 21 lines
xen/include/xlat.lst +3
-7@@ -40,13 +40,6 @@ ? cpu_offline_action arch-x86/xen-mca.h ? mc arch-x86/xen-mca.h -? mcinfo_bank arch-x86/xen-mca.h -? mcinfo_common arch-x86/xen-mca.h -? mcinfo_extended arch-x86/xen-mca.h -? mcinfo_global arch-x86/xen-mca.h -? mcinfo_logical_cpu arch-x86/xen-mca.h -? mcinfo_msr arch-x86/xen-mca.h -? mcinfo_recovery arch-x86/xen-mca.h ! mc_fetch arch-x86/xen-mca.h ? mc_info arch-x86/xen-mca.h ? mc_inject_v2 arch-x86/xen-mca.h@@ -54,6 +47,13 @@ ? mc_msrinject arch-x86/xen-mca.h ? mc_notifydomain arch-x86/xen-mca.h ! mc_physcpuinfo arch-x86/xen-mca.h +? mcinfo_bank arch-x86/xen-mca.h +? mcinfo_common arch-x86/xen-mca.h +? mcinfo_extended arch-x86/xen-mca.h
Quoted 8 lines
xen/include/xlat.lst line 57
Quoted 5 lines
xen/include/xlat.lst +4
-0+? mcinfo_global arch-x86/xen-mca.h +? mcinfo_logical_cpu arch-x86/xen-mca.h +? mcinfo_msr arch-x86/xen-mca.h +? mcinfo_recovery arch-x86/xen-mca.h ? page_offline_action arch-x86/xen-mca.hImo this sorting was fine (at least one further instance below): Whether underscore sorts ahead of lower case letters depends on how sorting is done. I take you assume sorting as per the C locale,
Indeed.
Quoted 3 lines
when the original sorting was
considering undercores to be separators, i.e. in a different character class (together with e.g. dash or tilde).
If _ is expected to be a separator, then the correct sorting would be:
mcmc_fetchmc_infomcinfo_bankmcinfo_commonmcinfo_extendedmcinfo_globalmcinfo_logical_cpumcinfo_msrmcinfo_recoverymc_inject_v2mc_mceinject
which is definitely not what we want. This came specifically from sort, not something I did by hand.
LANG=C sort gives the ordering presented in this patch.
Quoted 4 lines
When using C local sorting, I think
arch-x86/xen-@[email protected]also would need moving pastarch-x86/xen.h(whereas right now all separators are deemed equal and hence @ comes ahead of h which in turn is ahead of m).
sort agrees, so I'll do this too, and note it in the commit message.
~Andrew
PATCH 3/4 xen/gnttab: Perform compat/native gnttab_query_size check
In reply to Andrew CooperThis subop appears to have been missed from the compat checks.
---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/common/compat/grant_table.c | 4 ++++ xen/include/xlat.lst | 1 + 2 files changed, 5 insertions(+)
xen/common/compat/grant_table.c +4 -0
@@ -30,6 +30,10 @@ CHECK_gnttab_unmap_grant_ref; CHECK_gnttab_unmap_and_replace;#undef xen_gnttab_unmap_and_replace +#define xen_gnttab_query_size gnttab_query_size +CHECK_gnttab_query_size; +#undef xen_gnttab_query_size +DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_compat_t);DEFINE_XEN_GUEST_HANDLE (gnttab_transfer_compat_t);DEFINE_XEN_GUEST_HANDLE (gnttab_copy_compat_t);
xen/include/xlat.lst +1 -0
@@ -88,6 +88,7 @@ ! gnttab_get_status_frames grant_table.h ? gnttab_get_version grant_table.h ? gnttab_map_grant_ref grant_table.h +? gnttab_query_size grant_table.h ? gnttab_set_version grant_table.h ! gnttab_setup_table grant_table.h ? gnttab_swap_grant_ref grant_table.h
Signature · 1 line
2.30.2
Re: [PATCH 3/4] xen/gnttab: Perform compat/native gnttab_query_size check
Quoted 33 lines · Andrew Cooper
This subop appears to have been missed from the compat checks.
Signed-off-by Andrew Cooper <[email protected]>---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>--- xen/common/compat/grant_table.c | 4 ++++ xen/include/xlat.lst | 1 + 2 files changed, 5 insertions(+)xen/common/compat/grant_table.c +4
-0@@ -30,6 +30,10 @@ CHECK_gnttab_unmap_grant_ref; CHECK_gnttab_unmap_and_replace;#undef xen_gnttab_unmap_and_replace +#define xen_gnttab_query_size gnttab_query_size +CHECK_gnttab_query_size; +#undef xen_gnttab_query_size +DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_compat_t);DEFINE_XEN_GUEST_HANDLE (gnttab_transfer_compat_t);DEFINE_XEN_GUEST_HANDLE (gnttab_copy_compat_t);xen/include/xlat.lst +0
-0
xen/include/xlat.lst line 94
Quoted 7 lines
xen/include/xlat.lst +1
-0@@ -88,6 +88,7 @@ ! gnttab_get_status_frames grant_table.h ? gnttab_get_version grant_table.h ? gnttab_map_grant_ref grant_table.h +? gnttab_query_size grant_table.h ? gnttab_set_version grant_table.h ! gnttab_setup_table grant_table.h ? gnttab_swap_grant_ref grant_table.h
I am no compat layer expert, but shouldn't there be something like:
#ifndef CHECK_gnttab_map_grant_ref
CASE(map_grant_ref);#endif
somewhere under compat_grant_table_op ?
Re: [PATCH 3/4] xen/gnttab: Perform compat/native gnttab_query_size check
Quoted 45 lines · Stefano Stabellini
Quoted 33 lines · Andrew Cooper
This subop appears to have been missed from the compat checks.
Signed-off-by Andrew Cooper <[email protected]>---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>--- xen/common/compat/grant_table.c | 4 ++++ xen/include/xlat.lst | 1 + 2 files changed, 5 insertions(+)xen/common/compat/grant_table.c +4
-0@@ -30,6 +30,10 @@ CHECK_gnttab_unmap_grant_ref; CHECK_gnttab_unmap_and_replace;#undef xen_gnttab_unmap_and_replace +#define xen_gnttab_query_size gnttab_query_size +CHECK_gnttab_query_size; +#undef xen_gnttab_query_size +DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_compat_t);DEFINE_XEN_GUEST_HANDLE (gnttab_transfer_compat_t);DEFINE_XEN_GUEST_HANDLE (gnttab_copy_compat_t);xen/include/xlat.lst +0
-0xen/include/xlat.lst line 94
Quoted 7 lines
xen/include/xlat.lst +1
-0@@ -88,6 +88,7 @@ ! gnttab_get_status_frames grant_table.h ? gnttab_get_version grant_table.h ? gnttab_map_grant_ref grant_table.h +? gnttab_query_size grant_table.h ? gnttab_set_version grant_table.h ! gnttab_setup_table grant_table.h ? gnttab_swap_grant_ref grant_table.hI am no compat layer expert, but shouldn't there be something like:
Quoted 5 lines
#ifndef CHECK_gnttab_map_grant_ref CASE(map_grant_ref);#endif
somewhere under
compat_grant_table_op?
It's there first in the group of similar constructs. Or do you mean a counterpart thereof for query_size?
Jan
Re: [PATCH 3/4] xen/gnttab: Perform compat/native gnttab_query_size check
In reply to Andrew CooperQuoted 1 line · Andrew Cooper
This subop appears to have been missed from the compat checks.
Quoted 1 line
Signed-off-by Andrew Cooper <[email protected]>
With the addition that I'm now sure Stefano meant (see the reply to him):
Jan
PATCH 4/4 xen/public: Use -Wpadding for public headers
In reply to Andrew CooperRFC. In theory this is a great way to avoid some of the spiketraps involved with C being the official representation.
However, this doesn't build. gnttab_transfer has a layout that requires a CONFIG_COMPAT if we want to satisfy -Wpadding for both forms of the structure.
Thoughts on whether this cross-check is worthwhile-enough to warrant the ifdefary?
~Andrew
---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/common/Makefile | 1 + xen/common/hdr-chk.c | 13 +++++++++++++ xen/include/public/grant_table.h | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 xen/common/hdr-chk.c
xen/common/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-y += event_fifo.o obj-$(CONFIG_GRANT_TABLE) += grant_table.o obj-y += guestcopy.o obj-y += gzip/ +obj-y += hdr-chk.o obj-$(CONFIG_HYPFS) += hypfs.o obj-$(CONFIG_IOREQ_SERVER) += ioreq.o obj-y += irq.o
xen/common/hdr-chk.c new file +13 -0
@@ -0,0 +1,13 @@ +#include <xen/stdint.h> + +#include <public/xen.h> + +#pragma GCC diagnostic error "-Wpadded" + +#include <public/grant_table.h> + +#ifdef CONFIG_COMPAT + +#include <compat/grant_table.h> + +#endif /* CONFIG_COMPAT */
xen/include/public/grant_table.h +7 -0
@@ -355,6 +355,7 @@ struct gnttab_unmap_grant_ref {grant_handle_t handle;/* OUT parameters. */ int16_t status;/* => enum grant_status */ +uint16_t _pad0; };typedef struct gnttab_unmap_grant_ref gnttab_unmap_grant_ref_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t);
@@ -371,6 +372,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t);struct gnttab_setup_table {/* IN parameters. */ domid_t dom; +uint16_t _pad0;uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */
@@ -409,9 +411,12 @@ struct gnttab_transfer {/* IN parameters. */ xen_pfn_t mfn;domid_t domid; +uint16_t _pad0;grant_ref_t ref;/* OUT parameters. */ int16_t status; +uint16_t _pad1; +/* XXX compat-dependent padding. */ };typedef struct gnttab_transfer gnttab_transfer_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_transfer_t);
@@ -468,10 +473,12 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_copy_t);struct gnttab_query_size {/* IN parameters. */ domid_t dom; +uint16_t _ign1;/* OUT parameters. */ uint32_t nr_frames;uint32_t max_nr_frames;int16_t status;/* => enum grant_status */ +uint16_t _ign2; };typedef struct gnttab_query_size gnttab_query_size_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_query_size_t);
Signature · 1 line
2.30.2
Re: [PATCH 4/4] xen/public: Use -Wpadding for public headers
Quoted 8 lines · Andrew Cooper
RFC. In theory this is a great way to avoid some of the spiketraps involved with C being the official representation.
However, this doesn't build.
gnttab_transferhas a layout that requires aCONFIG_COMPATif we want to satisfy -Wpadding for both forms of the structure.Thoughts on whether this cross-check is worthwhile-enough to warrant the ifdefary?
I like this patch and I think we have no choice but going in this direction and adding all the padding explicitly with any related necessary ifdefary.
The only question for me is whether to:
1) add -Wpadding
2) add __packed__
3) do both
I think it is important to add __packed__ to the headers to clear out any misconceptions about possible hidden paddings and get a correct-by-default behavior for anyone that would import the headers into their own projects.
The only issue is that __packed__ makes -Wpadding not useful. We could technically add both if we disable __packed__ for the -Wpadding build. For instance we could use __packed which is defined by Xen, and change the definition of __packed to nothing for the -Wpadding build.
That way we get both the nice -Wpadding checks and also the nice obvious-by-default __packed__.
Quoted 93 lines
~Andrew
---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>--- xen/common/Makefile | 1 + xen/common/hdr-chk.c | 13 +++++++++++++ xen/include/public/grant_table.h | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 xen/common/hdr-chk.cxen/common/Makefile +1
-0@@ -15,6 +15,7 @@ obj-y += event_fifo.o obj-$(CONFIG_GRANT_TABLE) += grant_table.o obj-y += guestcopy.o obj-y += gzip/ +obj-y += hdr-chk.o obj-$(CONFIG_HYPFS) += hypfs.o obj-$(CONFIG_IOREQ_SERVER) += ioreq.o obj-y += irq.oxen/common/hdr-chk.c new file +13
-0@@ -0,0 +1,13 @@ +#include <xen/stdint.h> + +#include <public/xen.h> + +#pragma GCC diagnostic error "-Wpadded" + +#include <public/grant_table.h> + +#ifdef CONFIG_COMPAT + +#include <compat/grant_table.h> + +#endif /* CONFIG_COMPAT */ xen/include/public/grant_table.h +7
-0@@ -355,6 +355,7 @@ struct gnttab_unmap_grant_ref {grant_handle_t handle;/* OUT parameters. */ int16_t status;/* => enum grant_status */ +uint16_t _pad0; };typedef struct gnttab_unmap_grant_ref gnttab_unmap_grant_ref_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t);@@ -371,6 +372,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t);struct gnttab_setup_table {/* IN parameters. */ domid_t dom; +uint16_t _pad0;uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ @@ -409,9 +411,12 @@ struct gnttab_transfer {/* IN parameters. */ xen_pfn_t mfn;domid_t domid; +uint16_t _pad0;grant_ref_t ref;/* OUT parameters. */ int16_t status; +uint16_t _pad1; +/* XXX compat-dependent padding. */ };typedef struct gnttab_transfer gnttab_transfer_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_transfer_t);@@ -468,10 +473,12 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_copy_t);struct gnttab_query_size {/* IN parameters. */ domid_t dom; +uint16_t _ign1;/* OUT parameters. */ uint32_t nr_frames;uint32_t max_nr_frames;int16_t status;/* => enum grant_status */ +uint16_t _ign2; };typedef struct gnttab_query_size gnttab_query_size_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_query_size_t);Signature · 1 line
2.30.2
Re: [PATCH 4/4] xen/public: Use -Wpadding for public headers
Quoted 25 lines · Stefano Stabellini
Quoted 8 lines · Andrew Cooper
RFC. In theory this is a great way to avoid some of the spiketraps involved with C being the official representation.
However, this doesn't build.
gnttab_transferhas a layout that requires aCONFIG_COMPATif we want to satisfy -Wpadding for both forms of the structure.Thoughts on whether this cross-check is worthwhile-enough to warrant the ifdefary?
I like this patch and I think we have no choice but going in this direction and adding all the padding explicitly with any related necessary ifdefary.
The only question for me is whether to:
1) add -Wpadding
2) add__packed__
3) do bothI think it is important to add
__packed__to the headers to clear out any misconceptions about possible hidden paddings and get a correct-by-default behavior for anyone that would import the headers into their own projects.
Quoted 4 lines
The only issue is that
__packed__makes -Wpadding not useful. We could technically add both if we disable__packed__for the -Wpadding build. For instance we could use__packedwhich is defined by Xen, and change the definition of__packedto nothing for the -Wpadding build.
The other issue is that __packed__ isn't standard C, yet we intend the public header to be plain C89 compatible.
Jan
Re: [PATCH 4/4] xen/public: Use -Wpadding for public headers
In reply to Andrew CooperQuoted 8 lines · Andrew Cooper
RFC. In theory this is a great way to avoid some of the spiketraps involved with C being the official representation.
However, this doesn't build.
gnttab_transferhas a layout that requires aCONFIG_COMPATif we want to satisfy -Wpadding for both forms of the structure.Thoughts on whether this cross-check is worthwhile-enough to warrant the ifdefary?
#ifdef-ary in general would be okay. But any #ifdef CONFIG_* would look pretty odd to me in a public header. Perhaps as
#if defined(__XEN__) && defined(CONFIG_COMPAT)
it might be tolerable.
xen/common/hdr-chk.c line 5
Quoted 8 lines
xen/common/hdr-chk.c new file +5
-0@@ -0,0 +1,13 @@ +#include <xen/stdint.h> + +#include <public/xen.h> + +#pragma GCC diagnostic error "-Wpadded"
Everywhere up to here you say -Wpadding.
xen/common/hdr-chk.c line 13
Quoted 7 lines
xen/common/hdr-chk.c new file +7
-0+#include <public/grant_table.h> + +#ifdef CONFIG_COMPAT + +#include <compat/grant_table.h> + +#endif /* CONFIG_COMPAT */
I'm not overly happy to see a 2nd header checking "pass" added. We already have the headers.chk goal in xen/include/Makefile, after all. For the non- generated headers adding -Wpadded there would seem more natural to me, first and foremost because then it is less likely that one of the two places would be missed if a new header is added. Something long those lines may then need adding for the generated compat headers, but again preferably without enumerating them all in yet another place.
xen/include/public/grant_table.h struct gnttab_unmap_grant_ref { · line 358
Quoted 7 lines
xen/include/public/grant_table.h +1
-0@@ -355,6 +355,7 @@ struct gnttab_unmap_grant_ref {grant_handle_t handle;/* OUT parameters. */ int16_t status;/* => enum grant_status */ +uint16_t _pad0;
While you may view it as nitpicking, in the public headers I'm pretty firm on not wanting to see new name space violations, i.e. new names with leading underscores which aren't file-scope identifiers.
Furthermore what's the deal with using "pad0" here and in one more place, but "ign1" / "ign2" in other cases?
xen/include/public/grant_table.h DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t); · line 378
Quoted 8 lines
xen/include/public/grant_table.h +1
-0@@ -371,6 +372,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t);struct gnttab_setup_table {/* IN parameters. */ domid_t dom; +uint16_t _pad0;uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */
I'm surprised no padding field would be needed right below here, seeing that what follows is a handle:
#if __XEN_INTERFACE_VERSION__ < 0x00040300
XEN_GUEST_HANDLE(ulong) frame_list;
#else
XEN_GUEST_HANDLE(xen_pfn_t) frame_list;#endif
The size of this padding field would then also be compat-dependent, I suppose.
Jan
Quoted 11 lines · Andrew Cooper
This started off as patch 3, and grew somewhat.
Patches 1-3 are simple and hopefully non-controversial.
Patch 4 is an attempt to make the headers less fragile, but came with an unexpected complication. Details in the patch.
Andrew Cooper (4):
xen/xlat: Sort out whitespace
xen/xlat: Sort structs per file
xen/gnttab: Perform compat/nativegnttab_query_sizecheck
I'm timing out waiting for a justification on the whitespace comment.
Oleksii: Can I get a release ack on this please? Patch 3 is the main bugfix, which is the insertion of a missing build-time cross-check, so it's very low risk for the release.
Patch 4 was always RFC and not intended to go in as-was.
~Andrew
Quoted 14 lines · Andrew Cooper
Quoted 4 lines · Andrew Cooper
This started off as patch 3, and grew somewhat.
Patches 1-3 are simple and hopefully non-controversial.
Quoted 8 lines
Patch 4 is an attempt to make the headers less fragile, but came with an
unexpected complication. Details in the patch.Andrew Cooper (4):
xen/xlat: Sort out whitespace
xen/xlat: Sort structs per file
xen/gnttab: Perform compat/nativegnttab_query_sizecheck
Quoted 6 lines
I'm timing out waiting for a justification on the whitespace comment.
Oleksii: Can I get a release ack on this please? Patch 3 is the main bugfix, which is the insertion of a missing build-time cross-check, so
it's very low risk for the release.
~ Oleksii
Quoted 4 lines
Patch 4 was always RFC and not intended to go in as-was.
~Andrew