From nobody Mon Feb 27 23:10:38 2023 X-Original-To: emulation@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PQbnq4CJ1z3tJ96 for ; Mon, 27 Feb 2023 23:10:39 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PQbnq2SQvz3vV1 for ; Mon, 27 Feb 2023 23:10:39 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Authentication-Results: mx1.freebsd.org; none Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 3DC473C0199; Mon, 27 Feb 2023 23:10:38 +0000 (UTC) Date: Mon, 27 Feb 2023 23:10:38 +0000 From: Brooks Davis To: Kevin Oberman Cc: "freebsd-emulation@freebsd.org" Subject: Re: virtualbon-ose-kmod build fails with 14-CURRENT and llvm15 Message-ID: References: List-Id: Development of Emulators of other operating systems List-Archive: https://lists.freebsd.org/archives/freebsd-emulation List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-emulation@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Rspamd-Queue-Id: 4PQbnq2SQvz3vV1 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Mon, Feb 27, 2023 at 02:58:44PM -0800, Kevin Oberman wrote: > On Mon, Feb 27, 2023 at 10:27 AM Brooks Davis wrote: >=20 > > On Sun, Feb 26, 2023 at 09:45:34AM -0800, Kevin Oberman wrote: > > > I updated my system yesterday. I then tried to rebuild > > virtualbox-ose-kmod. > > > This fails under llvm15. The same source code built successfully with > > > llvm14, so I assume that the code has a problem with 15. I suspect th= at > > 15 > > > changed some default and declared this as an error, but may be "fixed" > > with > > > the proper build option. > > > > > > Here is the command and error that I see: > > > > > > cc -O2 -pipe -fno-strict-aliasing -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT= _R0 > > > -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VBOX -w > > > -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_AMD64 -We= rror > > > -D_KERNEL -DKLD_MODULE -nostdinc -Iinclude -I. -Ir0drv -include > > > > > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/fre= ebsd.amd64/release/bin/src/vboxdrv/opt_global.h > > > -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common > > > -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer > > > -fdebug-prefix-map=3D./machine=3D/usr/src/sys/amd64/include > > > -fdebug-prefix-map=3D./x86=3D/usr/src/sys/x86/include > > > -fdebug-prefix-map=3D./i386=3D/usr/src/sys/i386/include -MD > > > -MF.depend.SUPDrv-freebsd.o -MTSUPDrv-freebsd.o -mcmodel=3Dkernel > > > -mno-red-zone -mno-mmx -mno-sse -msoft-float > > > -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-prote= ctor > > > -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes > > > -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign > > > -D__printf__=3D__freebsd_kprintf__ -Wmissing-include-dirs > > > -fdiagnostics-show-option -Wno-unknown-pragmas > > > -Wno-error=3Dtautological-compare -Wno-error=3Dempty-body > > > -Wno-error=3Dparentheses-equality -Wno-error=3Dunused-function > > > -Wno-error=3Dpointer-sign -Wno-error=3Dshift-negative-value > > > -Wno-address-of-packed-member -Wno-error=3Darray-parameter > > > -Wno-error=3Ddeprecated-non-prototype -Wno-error=3Dstrict-prototypes > > > -Wno-error=3Dunused-but-set-variable -Wno-format-zero-length -mno-a= es > > > -mno-avx -std=3Diso9899:1999 -c > > > > > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/fre= ebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c > > > -o SUPDrv-freebsd.o > > > > > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/fre= ebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c:433:50: > > > error: incompatible pointer to integer conversion passing 'void *' to > > > parameter of type 'RTR3PTR' (aka 'unsigned long') [-Wint-conversion] > > > if (RT_FAILURE(RTR0MemUserCopyFrom(&Hdr, pvUser, sizeof(Hdr))= )) > > > ^~~~~~ > > > include/iprt/errcore.h:99:58: note: expanded from macro 'RT_FAILURE' > > > > > > Any help appreciated. I really need virtualbox. I think I may force i= t to > > > build with llvm14, but I's prefer a fix to build with llvm15. > > > > Assuming the code works in practice, it should just be a matter of > > adding a cast (void *)(uintptr_t)pvUser. > > > > -- Brooks > > >=20 > Thanks to both of you. Fixing the code seems preferable to patching and > rebuilding llvm15, so I tried, but it made no difference, other than the > cast, but I may have truncated the error message too soon. Here is the > complete message after the patch: > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/freeb= sd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c:433:50: > error: incompatible pointer to integer conversion passing 'void *' to > parameter of type 'RTR3PTR' (aka 'unsigned long') [-Wint-conversion] > if (RT_FAILURE(RTR0MemUserCopyFrom(&Hdr, (void *)(uintptr_t)pvUse= r, > sizeof(Hdr)))) > ^~~~~~~~~~~~~~~~~~~~~~~~~ > 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) >=3D 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 c= b); > ^ >=20 > Please understand that I am not a C programmer. Looking at this leaves me > a bit lost. Sorry, I misread the error message and lead you astray by suggesting the opposite of the correct thing. The correct cast is probably (uintptr_t)pvUser. -- Brooks