libxencall: osdep_hypercall() should return long
authorJan Beulich <jbeulich@suse.com>
Thu, 24 Jun 2021 14:38:37 +0000 (16:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 24 Jun 2021 14:38:37 +0000 (16:38 +0200)
Some hypercalls, memory-op in particular, can return values requiring
more than 31 bits to represent. Hence the underlying layers need to make
sure they won't truncate such values. (Note that for Solaris the
function also gets renamed, to match the other OSes.)

Due to them merely propagating ioctl()'s return value, this change is
benign on Linux and Solaris. IOW there's an actual effect here only for
the BSDs and MiniOS, but even then further adjustments are needed at the
xencall<N>() level.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <iwj@xenproject.org>
tools/libs/call/freebsd.c
tools/libs/call/linux.c
tools/libs/call/minios.c
tools/libs/call/netbsd.c
tools/libs/call/private.h
tools/libs/call/solaris.c

index 28bfd852c1ec81589d8b51c423ac0b04e6f393c3..6d2e8704b3de549f8e3e6e1de158138fc0c8ef11 100644 (file)
@@ -62,7 +62,7 @@ int osdep_xencall_close(xencall_handle *xcall)
     return close(fd);
 }
 
-int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+long osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
 {
     int fd = xcall->fd;
     int ret;
index 51fa4899ebf648bb2267363f89ea76420984b085..6d588e6bea8fab3e2dfe18966d95ae09c14899c3 100644 (file)
@@ -80,7 +80,7 @@ int osdep_xencall_close(xencall_handle *xcall)
     return 0;
 }
 
-int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+long osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
 {
     return ioctl(xcall->fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
 }
index 9f7a96995fb2ec9c5e6ee48bdc97cb70f5323c7b..3f33b8357829cc632f8775eda46e1a15699f0d5a 100644 (file)
@@ -38,7 +38,7 @@ int osdep_xencall_close(xencall_handle *xcall)
     return 0;
 }
 
-int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+long osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
 {
     multicall_entry_t call;
     int i, ret;
index 4dcc2919ba05252a20fe81fa2192a3390b31da9c..91ae68357e3ef7b973499c7621515bb4150c61bb 100644 (file)
@@ -96,7 +96,7 @@ void osdep_free_pages(xencall_handle *xcall, void *ptr, size_t npages)
     free(ptr);
 }
 
-int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+long osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
 {
     int fd = xcall->fd;
     int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
index 7944ac5baf07a23bbad3190c54e5d9b636c3a8ff..9c3aa432efe2561621e90b3fa2fdc62b95fe6cd7 100644 (file)
@@ -55,7 +55,7 @@ struct xencall_handle {
 int osdep_xencall_open(xencall_handle *xcall);
 int osdep_xencall_close(xencall_handle *xcall);
 
-int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall);
+long osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall);
 
 void *osdep_alloc_pages(xencall_handle *xcall, size_t nr_pages);
 void osdep_free_pages(xencall_handle *xcall, void *p, size_t nr_pages);
index c63b6a329a141b905e7b57141df2214bb073f6cb..304262bd057b37e9724cf9e177b20e1b70e9dcde 100644 (file)
@@ -80,7 +80,7 @@ void osdep_free_hypercall_buffer(xencall_handle *xcall, void *ptr,
     free(ptr);
 }
 
-int do_xen_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+long osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
 {
     int fd = xcall->fd;
     return ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);