From owner-freebsd-current@freebsd.org Wed Sep 23 16:35:08 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1772D3FE435 for ; Wed, 23 Sep 2020 16:35:08 +0000 (UTC) (envelope-from rhurlin@gwdg.de) Received: from gmailer.gwdg.de (gmailer.gwdg.de [134.76.11.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BxP0q2zbbz3ZCb; Wed, 23 Sep 2020 16:35:07 +0000 (UTC) (envelope-from rhurlin@gwdg.de) Received: from excmbx-03.um.gwdg.de ([134.76.9.218] helo=email.gwdg.de) by mailer.gwdg.de with esmtp (GWDG Mailer) (envelope-from ) id 1kL7jV-0000tz-TS; Wed, 23 Sep 2020 18:35:05 +0200 Received: from krabat.raven.hur (10.250.9.199) by EXCMBX-03.um.gwdg.de (134.76.9.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2044.4; Wed, 23 Sep 2020 18:35:05 +0200 Subject: Re: Fwd: Re: r365488 page faults on AMD Ryzen 9 3950X To: Mark Johnston , Konstantin Belousov CC: Hans Petter Selasky , monochrome , References: <11d27d41-029a-d7f5-eccc-0ba3a3fcfe97@gwdg.de> <2bbfb4b3-92e9-b3ca-9c31-6c513cee2f2d@gwdg.de> <20200920093814.GD94807@kib.kiev.ua> <0249197f-29f6-4df4-eb63-ca786aaea39d@gwdg.de> <20200920195526.GH94807@kib.kiev.ua> <20200920200735.GJ94807@kib.kiev.ua> <1621df05-35a9-92b9-ffee-d93c17110d87@gwdg.de> <2673660d-3a6e-97c9-82a2-17b5ab8b987b@gwdg.de> <20200921221329.GD2570@kib.kiev.ua> <20200922225128.GA10974@raichu> Reply-To: "Hurling, Rainer" From: Rainer Hurling Message-ID: <77a92c5c-9d0a-6433-8879-7108730118dc@gwdg.de> Date: Wed, 23 Sep 2020 18:35:00 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.3.0 MIME-Version: 1.0 In-Reply-To: <20200922225128.GA10974@raichu> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.250.9.199] X-ClientProxiedBy: excmbx-25.um.gwdg.de (134.76.9.235) To EXCMBX-03.um.gwdg.de (134.76.9.218) X-Virus-Scanned: (clean) by clamav X-Rspamd-Queue-Id: 4BxP0q2zbbz3ZCb X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.74 / 15.00]; HAS_REPLYTO(0.00)[rhurlin@FreeBSD.org]; HAS_XOIP(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:134.76.10.0/23]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; RCVD_IN_DNSWL_MED(-0.20)[134.76.11.17:from]; NEURAL_HAM_SHORT(-0.24)[-0.241]; FREEMAIL_TO(0.00)[freebsd.org,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:680, ipnet:134.76.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[rhurlin]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.008]; NEURAL_HAM_LONG(-0.99)[-0.988]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; DMARC_NA(0.00)[gwdg.de]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RWL_MAILSPIKE_VERYGOOD(0.00)[134.76.11.17:from]; MAILMAN_DEST(0.00)[freebsd-current] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Sep 2020 16:35:08 -0000 On 23.09.20 00:51, Mark Johnston wrote: > On Tue, Sep 22, 2020 at 01:13:29AM +0300, Konstantin Belousov wrote: >> On Mon, Sep 21, 2020 at 08:57:46PM +0200, Rainer Hurling wrote: >>> Fatal trap 12: page fault while in kernel mode >>> cpuid = 31; apic id = 1f >>> fault virtual address = 0x25407efa >> This address is very suspicious. >> >> I cannot claim it as the fact, but most likely cause for such garbage >> pointer value is mismatched ABI between kernel and module. In other >> words, the module was built against headers from different kernel. > > For some reason clang is not complaining about a missing declaration for > vm_pager_allocate(), despite -Wmissing-prototypes in the CFLAGS... > > This patch is required on top of a patched extract of the vbox sources: > > --- the-freebsd-kernel.h.orig 2020-09-22 18:49:26.499329000 -0400 > +++ the-freebsd-kernel.h 2020-09-22 18:49:55.317615000 -0400 > @@ -68,6 +68,7 @@ > #include > #include /* KERN_SUCCESS ++ */ > #include > +#include > #include /* vm_phys_alloc_* */ > #include /* kmem_alloc_attr */ > #include /* vm_contig_grow_cache */ > --- memobj-r0drv-freebsd.c.orig 2020-09-22 18:49:25.010456000 -0400 > +++ memobj-r0drv-freebsd.c 2020-09-22 18:49:47.462276000 -0400 > @@ -323,7 +323,8 @@ > size_t cPages = atop(pMemFreeBSD->Core.cb); > int rc; > > - pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); > + pMemFreeBSD->pObject = vm_pager_allocate(OBJT_PHYS, NULL, > + pMemFreeBSD->Core.cb, VM_PROT_ALL, 0, curthread->td_ucred); > > /* No additional object reference for auto-deallocation upon unmapping. */ > #if __FreeBSD_version >= 1000055 > @@ -457,7 +458,8 @@ > return VERR_NO_MEMORY; > } > > - pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb)); > + pMemFreeBSD->pObject = vm_pager_allocate(OBJT_PHYS, NULL, > + pMemFreeBSD->Core.cb, VM_PROT_ALL, 0, curthread->td_ucred); > > if (PhysHighest != NIL_RTHCPHYS) > VmPhysAddrHigh = PhysHighest; > I can confirm that these patches (two files) work for me. The system reboots with loaded vbox kernel modules. Many thanks for your help and investigations! Best regards, Rainer