xen/multicall: Change nr_calls to uniformly be unsigned long

Right now, the non-compat declaration and definition of do_multicall()
differing types for the nr_calls parameter.

This is a MISRA rule 8.3 violation, but it's also time-bomb waiting for the
first 128bit architecture (RISC-V looks as if it might get there first).

Worse, the type chosen here has a side effect of truncating the guest
parameter, because Xen still doesn't have a clean hypercall ABI definition.

Switch uniformly to using unsigned long.

This addresses the MISRA violation, and while it is a guest-visible ABI
change, it's only in the corner case where the guest kernel passed a
bogus-but-correct-when-truncated value.  I can't find any any users of
mutilcall which pass a bad size to begin with, so this should have no
practical effect on guests.

In fact, this brings the behaviour of multicalls more in line with the header
description of how it behaves.

With this fix, Xen is now fully clean to Rule 8.3, so mark it so.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Andrew Cooper authored and Stefano Stabellini committed 2024-11-14 17:49:18 -08:00
1 parent d2c214ede0
commit d2bbb0d455
4 files changed
+6 -5

No files matched your search

@@ -45,6 +45,7 @@ MC3R1.R7.3||
MC3R1.R7.4||
MC3R1.R8.1||
MC3R1.R8.2||
MC3R1.R8.3||
MC3R1.R8.5||
MC3R1.R8.6||
MC3R1.R8.8||
+2 -2
View File
@@ -34,11 +34,11 @@ static void trace_multicall_call(multicall_entry_t *call)
}
ret_t do_multicall(
XEN_GUEST_HANDLE_PARAM(multicall_entry_t) call_list, uint32_t nr_calls)
XEN_GUEST_HANDLE_PARAM(multicall_entry_t) call_list, unsigned long nr_calls)
{
struct vcpu *curr = current;
struct mc_state *mcs = &curr->mc_state;
uint32_t i;
unsigned long i;
int rc = 0;
enum mc_disposition disp = mc_continue;
+2 -2
View File
@@ -135,7 +135,7 @@ xenoprof_op(int op, void *arg)
#ifdef CONFIG_COMPAT
prefix: compat
set_timer_op(uint32_t lo, uint32_t hi)
multicall(multicall_entry_compat_t *call_list, uint32_t nr_calls)
multicall(multicall_entry_compat_t *call_list, unsigned long nr_calls)
memory_op(unsigned int cmd, void *arg)
#ifdef CONFIG_IOREQ_SERVER
dm_op(domid_t domid, unsigned int nr_bufs, void *bufs)
@@ -172,7 +172,7 @@ console_io(unsigned int cmd, unsigned int count, char *buffer)
vm_assist(unsigned int cmd, unsigned int type)
event_channel_op(int cmd, void *arg)
mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
multicall(multicall_entry_t *call_list, unsigned int nr_calls)
multicall(multicall_entry_t *call_list, unsigned long nr_calls)
#ifdef CONFIG_PV
mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
stack_switch(unsigned long ss, unsigned long esp)
+1 -1
View File
@@ -623,7 +623,7 @@ DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
/*
* ` enum neg_errnoval
* ` HYPERVISOR_multicall(multicall_entry_t call_list[],
* ` uint32_t nr_calls);
* ` unsigned long nr_calls);
*
* NB. The fields are logically the natural register size for this
* architecture. In cases where xen_ulong_t is larger than this then
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.