From owner-freebsd-current@freebsd.org Tue Sep 22 22:51:35 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 9D1A83E2B2B for ; Tue, 22 Sep 2020 22:51:35 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (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 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BwxPf67vtz3Ynm; Tue, 22 Sep 2020 22:51:34 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-il1-x143.google.com with SMTP id s88so18951000ilb.6; Tue, 22 Sep 2020 15:51:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=1lt2X9dFdC8idIzes+JetVg8k+fWOAHUDC29xAKTaJk=; b=ITxy0eZGUpSSi9VMo5XZCUJWgRXCs7kMpbKbew9s/UlChVcNckK9BurxLaCnLDQe5b 6gy4pRYCwIGMqWfsatBcK53H6iuPeX6gIQCOD8XBN2eldZNLYMpCQZLl5w5LKsNOiI1v O2Om7iQxoCbuxL6eClYrVFawlg0Y787iSQ63tgKfhqvmdATZehOOYSuaF9f0Kx/m0b+G eJLYtXwMszIUFptWjT2AJQtqGRckcACKtG1NF7XZCXg9sAZ4hLKip1vybVq/6MSHsdtp MUQuLBw4l7B81DMu+ekoyysF85cp97jXsqS6I4J5IALtW1aivoOfTHaBosiJ+8y3boE0 INgA== X-Gm-Message-State: AOAM530+ZxSUJ/yCIxR77/oI65TVxXL7ITdFrlZ/AwAGezKH9fqpsA46 fima+CZ3L4NFL6pUvvOqqA0= X-Google-Smtp-Source: ABdhPJwcUfcG7Iip5RlBG6JXkHnlIFVRABeJ4MQIDR3wiZGZdfWURO2BXaopcWFKhkZR1myNHMinhg== X-Received: by 2002:a92:cb01:: with SMTP id s1mr6346318ilo.225.1600815093088; Tue, 22 Sep 2020 15:51:33 -0700 (PDT) Received: from raichu (toroon0560w-lp130-01-174-88-77-103.dsl.bell.ca. [174.88.77.103]) by smtp.gmail.com with ESMTPSA id u9sm7728169iow.26.2020.09.22.15.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 15:51:32 -0700 (PDT) Sender: Mark Johnston Date: Tue, 22 Sep 2020 18:51:28 -0400 From: Mark Johnston To: Konstantin Belousov Cc: rhurlin@freebsd.org, Hans Petter Selasky , monochrome , freebsd-current@freebsd.org Subject: Re: Fwd: Re: r365488 page faults on AMD Ryzen 9 3950X Message-ID: <20200922225128.GA10974@raichu> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200921221329.GD2570@kib.kiev.ua> X-Rspamd-Queue-Id: 4BwxPf67vtz3Ynm X-Spamd-Bar: - X-Spamd-Result: default: False [-1.41 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.03)[-1.031]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.31)[0.307]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::143:from]; NEURAL_HAM_MEDIUM(-0.99)[-0.986]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; 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: Tue, 22 Sep 2020 22:51:35 -0000 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;