Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Mar 2023 17:01:33 -0400
From:      Joseph Mingrone <jrm@FreeBSD.org>
To:        Jung-uk Kim <jkim@FreeBSD.org>
Cc:        ports-committers@FreeBSD.org,  dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   Re: git: f4a869a6424a - main - emulators/virtualbox-ose-kmod: Fix build with LLVM 15
Message-ID:  <86lek94ms2.fsf@phe.ftfl.ca>
In-Reply-To: <db37602f-3e6b-65e7-b829-03cabbba6c91@FreeBSD.org> (Jung-uk Kim's message of "Mon, 6 Mar 2023 15:54:21 -0500")
References:  <202303061317.326DHUiq095917@gitrepo.freebsd.org> <db37602f-3e6b-65e7-b829-03cabbba6c91@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain

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

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKkBAEBCgCOFiEEVbCTpybDiFVxIrrVNqQMg7DW754FAmQGVK5fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDU1
QjA5M0E3MjZDMzg4NTU3MTIyQkFENTM2QTQwQzgzQjBENkVGOUUQHGpybUBmcmVl
YnNkLm9yZwAKCRA2pAyDsNbvnkG5D/sGyRFwK+92UW5dsf6FujdyUpiHDZ8c6F1J
++19QFMlcqXwM+uMI3BIfCHEZ28rK+A2VhLgZwhbeFxkVvgEYyGCSt02mR00crdl
xfFkOTL8l/4Jsxp73S3iVw6eIU0Xtcj+CQ6ZV0zpUMizlA1t7jpcxrKEmgYjuCPe
NIdlGbGU+Z1gi2E4UrsM7X3kv55dNWJLx47xTHJ04tyEQoAX+G841Qg/I1mFCUcG
8hI21+V+Y/p5zzXbrfAdbVol2RqIKJuFcl1kV3mDUGVnrPBE3L9YA0i61KLa+u1g
Hqx3vsM1KX5gGy+YtW5CXVAyu3O68A2+bKrz7ZV1a5iZgV73Mv9dUF44UgmvT+ve
zd1WavzjOzGp2IMSUjpBB0oPphZb9qjcOLSvBPHeF9K/PIFg/o45SLWFCCNHNw43
OV506/HeAdoiLCNJizKHnh7pyk/pWK4OZI4UY87A/Em+QKrkkCtxTtKwAZKD6Q/k
OYO9a/Y59QtzXroHLrocjcNovRjGDC3TBflpca/Xeg5Z4N0/KgVljACSTOWOaWGU
XUY8lStktN+n8HVujA5mWqel5B50BuR2m5QvTPztXjCw/j68JY1hgYZNSxPz4wXp
BmrZDQtxytiHxVPAnkeJjyHpAmH9ZdwauZgLN588/4rTnYb4MRHQx6VcUNStrPNd
Le5nPy/OmQ==
=KjO0
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lek94ms2.fsf>