Re: git: f4a869a6424a - main - emulators/virtualbox-ose-kmod: Fix build with LLVM 15
- In reply to: Jung-uk Kim : "Re: git: f4a869a6424a - main - emulators/virtualbox-ose-kmod: Fix build with LLVM 15"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Mar 2023 21:01:33 UTC
On Mon, 2023-03-06 at 15:54, Jung-uk Kim <jkim@FreeBSD.org> wrote:
> On 23. 3. 6., Joseph Mingrone wrote:
>> The branch main has been updated by jrm:
>> URL: https://cgit.FreeBSD.org/ports/commit/?id=f4a869a6424aa8bc32d50642762d9f294c7ce3da
>> commit f4a869a6424aa8bc32d50642762d9f294c7ce3da
>> Author: Joseph Mingrone <jrm@FreeBSD.org>
>> AuthorDate: 2023-03-04 04:31:00 +0000
>> Commit: Joseph Mingrone <jrm@FreeBSD.org>
>> CommitDate: 2023-03-06 13:15:34 +0000
>> emulators/virtualbox-ose-kmod: Fix build with LLVM 15
>> Starting with clang 15, the -Wint-conversion warning diagnostic for
>> implicit int <-> pointer conversions defaults to an error. Use a cast to
>> fix such an error here.
>> See also: https://lists.freebsd.org/archives/freebsd-emulation/2023-February/000431.html
>> https://lists.freebsd.org/archives/freebsd-emulation/2023-February/000460.html
>> PR: 269721
>> Reported by: fbl@aoek.com, ohartmann@walstatt.org, rkoberman@gmail.com
>> Differential Revision: https://reviews.freebsd.org/D38906
>> Sponsored by: The FreeBSD Foundation
>> ---
>> ...ch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c | 13 +++++++------
>> 1 file changed, 7 insertions(+), 6 deletions(-)
>> diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c b/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c
>> index 2e2c292d7ee8..b7e262dd4ba2 100644
>> --- a/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c
>> +++ b/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c
>> @@ -1,5 +1,5 @@
>> ---- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2021-10-18 10:58:03.000000000 -0700
>> -+++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c 2021-11-19 15:31:33.152269000 -0800
>> +--- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2022-07-19 20:58:42 UTC
>> ++++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
>> @@ -44,8 +44,10 @@
>> #include <sys/fcntl.h>
>> #include <sys/conf.h>
>> @@ -26,7 +26,7 @@
>> #ifdef VBOX_WITH_HARDENING
>> # define VBOXDRV_PERM 0600
>> #else
>> -@@ -76,7 +85,9 @@ static d_open_t VBoxDrvFreeBSDOpenUsr;
>> +@@ -76,7 +85,9 @@ static d_ioctl_t VBoxDrvFreeBSDIOCtl;
>> static d_open_t VBoxDrvFreeBSDOpenSys;
>> static void vboxdrvFreeBSDDtr(void *pvData);
>> static d_ioctl_t VBoxDrvFreeBSDIOCtl;
>> @@ -112,7 +112,7 @@
>> pvUser = *(void **)pvData;
>> - int rc = copyin(pvUser, &Hdr, sizeof(Hdr));
>> - if (RT_UNLIKELY(rc))
>> -+ if (RT_FAILURE(RTR0MemUserCopyFrom(&Hdr, pvUser, sizeof(Hdr))))
>> ++ if (RT_FAILURE(RTR0MemUserCopyFrom(&Hdr, (uintptr_t)pvUser, sizeof(Hdr))))
>> {
>> - OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyin(%p,Hdr,) -> %#x; ulCmd=%#lx\n", pvUser, rc, ulCmd));
>> - return rc;
>> @@ -151,7 +151,7 @@
>> Log(("VBoxDrvFreeBSDIOCtlSlow: returns %d / %d ulCmd=%lx\n", 0, pHdr->rc, ulCmd));
>> -@@ -540,8 +595,7 @@ bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDE
>> +@@ -540,8 +595,7 @@ bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
>> bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
>> {
>> @@ -161,7 +161,7 @@
>> }
>> -@@ -624,19 +678,43 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu,
>> +@@ -624,20 +678,44 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu,
>> #endif /* SUPDRV_WITH_MSR_PROBER */
>> @@ -206,3 +206,4 @@
>> + return fFlags;
>> }
>> +
> This fix was incomplete.
> /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/freebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c:461:50: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'RTR3PTR' (aka 'unsigned long')
> [-Wint-conversion]
> if (RT_FAILURE(RTR0MemUserCopyFrom(pHdr, pvUser, Hdr.cbIn)))
> ^~~~~~
> include/iprt/errcore.h:99:58: note: expanded from macro 'RT_FAILURE'
> #define RT_FAILURE(rc) ( RT_UNLIKELY(!RT_SUCCESS_NP(rc)) )
> ^~
> include/iprt/errcore.h:80:38: note: expanded from macro 'RT_SUCCESS_NP'
> # define RT_SUCCESS_NP(rc) ( (int)(rc) >= VINF_SUCCESS )
> ^~
> include/iprt/cdefs.h:1826:53: note: expanded from macro 'RT_UNLIKELY'
> # define RT_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
> ^~~~
> include/iprt/mem.h:756:56: note: passing argument to parameter 'R3PtrSrc' here
> RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb);
> ^
> /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/freebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c:494:46: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'RTR3PTR' (aka 'unsigned long')
> [-Wint-conversion]
> if (RT_FAILURE(RTR0MemUserCopyTo(pvUser, pHdr, cbOut)))
> ^~~~~~
> include/iprt/errcore.h:99:58: note: expanded from macro 'RT_FAILURE'
> #define RT_FAILURE(rc) ( RT_UNLIKELY(!RT_SUCCESS_NP(rc)) )
> ^~
> include/iprt/errcore.h:80:38: note: expanded from macro 'RT_SUCCESS_NP'
> # define RT_SUCCESS_NP(rc) ( (int)(rc) >= VINF_SUCCESS )
> ^~
> include/iprt/cdefs.h:1826:53: note: expanded from macro 'RT_UNLIKELY'
> # define RT_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
> ^~~~
> include/iprt/mem.h:768:41: note: passing argument to parameter 'R3PtrDst' here
> RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb);
> ^
> 2 errors generated.
> I'll commit a fix.
> Jung-uk Kim
Sorry. I didn't see those errors when testing and `poudriere testport` built fine for me.
http://pkg.ftfl.ca/data/14amd64-default/2023-03-06_16h57m27s/logs/virtualbox-ose-kmod-6.1.36.log