From nobody Mon Feb 27 23:40:33 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 4PQcSg6ykhz3tKdV for ; Mon, 27 Feb 2023 23:40:51 +0000 (UTC) (envelope-from kob6558@gmail.com) Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PQcSg4Xvqz40kM; Mon, 27 Feb 2023 23:40:51 +0000 (UTC) (envelope-from kob6558@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-536af432ee5so225109357b3.0; Mon, 27 Feb 2023 15:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=flA0cLSBzsC6cbTa25eozXAWhW3bPvPmm2BELtNH/ro=; b=KoAlZ74JbhZemQbEqcEDmTJybnSGArNsA7f8a2684MbpiMh4ejyGuJdDGU++kq/jzs ZbXo/5g66akgcqK/RuS0HizbBlqC3ydYWMM6em2sgRZOjwMP36ymX4UvaJIJvIniu4yw mcIcXN4EeJMc7Rt179oxX11RAusu0FnUmAypM+KOltCNgo8i3NEcj6S4XPYaGDfTH2Af UkkkQ3kbTTeYu9hTn4kARuxWCIJOpt1+OWQHt7nY5gIdGoCUreeQ4mz4CNw+pAFbz/Z7 9X0Ws0RMDzad7k3tskKde0rx+khxx95009cEGnZeUMUUj5tcEynJ1msM+mcpSyuTJ43T iNaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=flA0cLSBzsC6cbTa25eozXAWhW3bPvPmm2BELtNH/ro=; b=IG0B2oZSzWdr63nzdLjbeiAENt576O7cKaKA2IxGD8lC8Xyhytpw/G52Ri1loorJXT Z7cQnK4A06PLDexozhjIupsmSmfAoWhqfzYCOj1cFTtih5bid5JvySqdxX57U5JkV29T Xj6HvMBaW6nDJZ6aeezHbdTmTYWkBK4cSLQ7A98ahy5Nk9eLzGI6gUVmy51hRSyy12f2 E3R4/sokx86bUyTI5DMdlCJ3Cto/rKHxb8ldoHF2ZwUn2IFqmpI075SBNIGbaLN9fUSh FOVIPWle39kV7eOHmOhQGbUgbiukmXR0t5fWcEY+0uKxUVqnU+0zccQqwgTDy46z/i+X zOCw== X-Gm-Message-State: AO0yUKUDQ3Xir4lZ4HMxDXoS0yNyYpaigxsJFbHDdYbdsfCU5E7+PJ0G cJGAcXb6aFrkEvNpROEY18MM4TOhG+c4AlT01gxkZDpc X-Google-Smtp-Source: AK7set94YZVM8rDnCyzHnQyoQHLWus4XKMMc6VDdW/ynNXlp3DukrT+YQU3nXOto3I2yNu/+srU0kv88K/YEhDEPi1c= X-Received: by 2002:a25:8c0b:0:b0:a20:11a9:bd4a with SMTP id k11-20020a258c0b000000b00a2011a9bd4amr98598ybl.0.1677541250124; Mon, 27 Feb 2023 15:40:50 -0800 (PST) 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 References: In-Reply-To: From: Kevin Oberman Date: Mon, 27 Feb 2023 15:40:33 -0800 Message-ID: Subject: Re: virtualbon-ose-kmod build fails with 14-CURRENT and llvm15 To: Brooks Davis Cc: "freebsd-emulation@freebsd.org" Content-Type: multipart/alternative; boundary="0000000000004f4fba05f5b702b2" X-Rspamd-Queue-Id: 4PQcSg4Xvqz40kM X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --0000000000004f4fba05f5b702b2 Content-Type: text/plain; charset="UTF-8" Thanks, Brooks! That seems to have been the right cast. At least it compiles correctly. I'll test it after I reboot the new kernel and installworld, probably this evening. I was a bit confused by what appeared as a cast of a void to a void, but assumed I was just not understanding. On Mon, Feb 27, 2023 at 3:10 PM Brooks Davis wrote: > 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: > > > > > 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 > that > > > 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 > -Werror > > > > -D_KERNEL -DKLD_MODULE -nostdinc -Iinclude -I. -Ir0drv -include > > > > > > > > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/freebsd.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=./machine=/usr/src/sys/amd64/include > > > > -fdebug-prefix-map=./x86=/usr/src/sys/x86/include > > > > -fdebug-prefix-map=./i386=/usr/src/sys/i386/include -MD > > > > -MF.depend.SUPDrv-freebsd.o -MTSUPDrv-freebsd.o -mcmodel=kernel > > > > -mno-red-zone -mno-mmx -mno-sse -msoft-float > > > > -fno-asynchronous-unwind-tables -ffreestanding -fwrapv > -fstack-protector > > > > -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes > > > > -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign > > > > -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs > > > > -fdiagnostics-show-option -Wno-unknown-pragmas > > > > -Wno-error=tautological-compare -Wno-error=empty-body > > > > -Wno-error=parentheses-equality -Wno-error=unused-function > > > > -Wno-error=pointer-sign -Wno-error=shift-negative-value > > > > -Wno-address-of-packed-member -Wno-error=array-parameter > > > > -Wno-error=deprecated-non-prototype -Wno-error=strict-prototypes > > > > -Wno-error=unused-but-set-variable -Wno-format-zero-length -mno-aes > > > > -mno-avx -std=iso9899:1999 -c > > > > > > > > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/out/freebsd.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/freebsd.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 > it 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 > > > > > > > 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/freebsd.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)pvUser, > > 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) >= 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); > > ^ > > > > 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 > -- Kevin Oberman, Part time kid herder and retired Network Engineer E-mail: rkoberman@gmail.com PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683 --0000000000004f4fba05f5b702b2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, Brooks! That seems to have been the righ= t cast. At least it compiles correctly. I'll=C2=A0 test it after I rebo= ot the new kernel and installworld, probably this evening.
=
I was a bit confused by what appeared as a cast of a vo= id to a void, but assumed I was just not understanding.

=
On Mon, Fe= b 27, 2023 at 3:10 PM Brooks Davis <brooks@freebsd.org> wrote:
On Mon, Feb 27, 2023 at 02:58:44PM -0800, Kevin Oberman= wrote:
> On Mon, Feb 27, 2023 at 10:27 AM Brooks Davis <brooks@freebsd.org> wrote:
>
> > 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 successf= ully with
> > > llvm14, so I assume that the code has a problem with 15. I s= uspect that
> > 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=C2=A0 -O2 -pipe -fno-strict-aliasing -DRT_OS_FREEBSD -DIN= _RING0 -DIN_RT_R0
> > > -DIN_SUP_R0 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX -DRT_WITH_VB= OX -w
> > > -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_A= MD64=C2=A0 -Werror
> > > -D_KERNEL -DKLD_MODULE -nostdinc=C2=A0 -Iinclude -I. -Ir0drv= -include
> > >
> > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/o= ut/freebsd.amd64/release/bin/src/vboxdrv/opt_global.h
> > > -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-co= mmon
> > >=C2=A0 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer > > > -fdebug-prefix-map=3D./machine=3D/usr/src/sys/amd64/include<= br> > > > -fdebug-prefix-map=3D./x86=3D/usr/src/sys/x86/include
> > > -fdebug-prefix-map=3D./i386=3D/usr/src/sys/i386/include=C2= =A0 =C2=A0 =C2=A0-MD
> > >=C2=A0 -MF.depend.SUPDrv-freebsd.o -MTSUPDrv-freebsd.o -mcmod= el=3Dkernel
> > > -mno-red-zone -mno-mmx -mno-sse -msoft-float
> > >=C2=A0 -fno-asynchronous-unwind-tables -ffreestanding -fwrapv= -fstack-protector
> > > -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototy= pes
> > > -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-functi= on
> > > -Wno-error=3Dpointer-sign -Wno-error=3Dshift-negative-value<= br> > > > -Wno-address-of-packed-member -Wno-error=3Darray-parameter > > > -Wno-error=3Ddeprecated-non-prototype -Wno-error=3Dstrict-pr= ototypes
> > > -Wno-error=3Dunused-but-set-variable -Wno-format-zero-length= =C2=A0 =C2=A0-mno-aes
> > > -mno-avx=C2=A0 -std=3Diso9899:1999 -c
> > >
> > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/o= ut/freebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c
> > > -o SUPDrv-freebsd.o
> > >
> > /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-6.1.36/o= ut/freebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c:433:50: > > > error: incompatible pointer to integer conversion passing &#= 39;void *' to
> > > parameter of type 'RTR3PTR' (aka 'unsigned long&= #39;) [-Wint-conversion]
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (RT_FAILURE(RTR0MemUserC= opyFrom(&Hdr, pvUser, sizeof(Hdr))))
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~~~~~
> > > include/iprt/errcore.h:99:58: note: expanded from macro '= ;RT_FAILURE'
> > >
> > > Any help appreciated. I really need virtualbox. I think I ma= y force it to
> > > build with llvm14, but I's prefer a fix to build with ll= vm15.
> >
> > Assuming the code works in practice, it should just be a matter o= f
> > adding a cast (void *)(uintptr_t)pvUser.
> >
> > -- Brooks
> >
>
> Thanks to both of you. Fixing the code seems preferable to patching an= d
> rebuilding llvm15, so I tried, but it made no difference, other than t= he
> 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/fr= eebsd.amd64/release/bin/src/vboxdrv/freebsd/SUPDrv-freebsd.c:433:50:
> error: incompatible pointer to integer conversion passing 'void *&= #39; to
> parameter of type 'RTR3PTR' (aka 'unsigned long') [-Wi= nt-conversion]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (RT_FAILURE(RTR0MemUserCopyFrom(&a= mp;Hdr, (void *)(uintptr_t)pvUser,
> sizeof(Hdr))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~~~~~~~~~~~~~~~~~~~~~~~~
> include/iprt/errcore.h:99:58: note: expanded from macro 'RT_FAILUR= E'
> #define RT_FAILURE(rc)=C2=A0 =C2=A0 =C2=A0 ( RT_UNLIKELY(!RT_SUCCESS_N= P(rc)) )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~
> include/iprt/errcore.h:80:38: note: expanded from macro 'RT_SUCCES= S_NP'
> # define RT_SUCCESS_NP(rc)=C2=A0 =C2=A0( (int)(rc) >=3D VINF_SUCCES= S )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~
> include/iprt/cdefs.h:1826:53: note: expanded from macro 'RT_UNLIKE= LY'
> #=C2=A0 define RT_UNLIKELY(expr)=C2=A0 =C2=A0 =C2=A0__builtin_expect(!= !(expr), 0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^~~~
> include/iprt/mem.h:756:56: note: passing argument to parameter 'R3= PtrSrc'
> here
> RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_= t cb);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^
>
> Please understand that I am not a C programmer.=C2=A0 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.=C2=A0 The correct cast is probably
(uintptr_t)pvUser.

-- Brooks


--
Kevin Oberman, Part time kid herder and retired Net= work Engineer
E-mail: rkoberman@gmail.com
PGP Fingerprint: D03FB98AFA78E= 3B78C1694B318AB39EF1B055683
--0000000000004f4fba05f5b702b2--