From owner-svn-src-stable@freebsd.org Wed Oct 16 07:04:02 2019 Return-Path: Delivered-To: svn-src-stable@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 0EFE015D555; Wed, 16 Oct 2019 07:04:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46tNZ96dc5z4LX6; Wed, 16 Oct 2019 07:04:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7785332C; Wed, 16 Oct 2019 07:04:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9G74108000920; Wed, 16 Oct 2019 07:04:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9G741LC000919; Wed, 16 Oct 2019 07:04:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910160704.x9G741LC000919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Oct 2019 07:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353620 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 353620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 07:04:02 -0000 Author: kib Date: Wed Oct 16 07:04:01 2019 New Revision: 353620 URL: https://svnweb.freebsd.org/changeset/base/353620 Log: MFC r353463: Restore nofaulting operations after r352807. Modified: stable/12/sys/vm/vm_fault.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_fault.c ============================================================================== --- stable/12/sys/vm/vm_fault.c Wed Oct 16 07:02:02 2019 (r353619) +++ stable/12/sys/vm/vm_fault.c Wed Oct 16 07:04:01 2019 (r353620) @@ -562,15 +562,11 @@ int vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, int *signo, int *ucode) { - struct thread *td; int result; MPASS(signo == NULL || ucode != NULL); - td = curthread; - if ((td->td_pflags & TDP_NOFAULTING) != 0) - return (KERN_PROTECTION_FAILURE); #ifdef KTRACE - if (map != kernel_map && KTRPOINT(td, KTR_FAULT)) + if (map != kernel_map && KTRPOINT(curthread, KTR_FAULT)) ktrfault(vaddr, fault_type); #endif result = vm_fault(map, trunc_page(vaddr), fault_type, fault_flags, @@ -582,7 +578,7 @@ vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot result == KERN_OUT_OF_BOUNDS, ("Unexpected Mach error %d from vm_fault()", result)); #ifdef KTRACE - if (map != kernel_map && KTRPOINT(td, KTR_FAULTEND)) + if (map != kernel_map && KTRPOINT(curthread, KTR_FAULTEND)) ktrfaultend(result); #endif if (result != KERN_SUCCESS && signo != NULL) { @@ -652,6 +648,10 @@ vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fa bool dead, hardfault, is_first_object_locked; VM_CNT_INC(v_vm_faults); + + if ((curthread->td_pflags & TDP_NOFAULTING) != 0) + return (KERN_PROTECTION_FAILURE); + fs.vp = NULL; faultcount = 0; nera = -1;