From owner-svn-src-all@freebsd.org Thu Mar 16 16:53:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7DB4D0E60B; Thu, 16 Mar 2017 16:53:24 +0000 (UTC) (envelope-from hselasky@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 mx1.freebsd.org (Postfix) with ESMTPS id 83F86152D; Thu, 16 Mar 2017 16:53:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2GGrMFh038811; Thu, 16 Mar 2017 16:53:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2GGrMHg038810; Thu, 16 Mar 2017 16:53:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201703161653.v2GGrMHg038810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 Mar 2017 16:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315420 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Mar 2017 16:53:24 -0000 Author: hselasky Date: Thu Mar 16 16:53:22 2017 New Revision: 315420 URL: https://svnweb.freebsd.org/changeset/base/315420 Log: The LinuxKPI pagefault disable and enable functions can only be used pairwise to support the FreeBSD way of pushing and popping the page fault flags. Ensure this by requiring every occurrence of pagefault disable function call to have a corresponding pagefault enable call. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/uaccess.h Modified: head/sys/compat/linuxkpi/common/include/linux/uaccess.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/uaccess.h Thu Mar 16 16:49:27 2017 (r315419) +++ head/sys/compat/linuxkpi/common/include/linux/uaccess.h Thu Mar 16 16:53:22 2017 (r315420) @@ -67,22 +67,13 @@ extern int linux_copyout(const void *kad extern size_t linux_clear_user(void *uaddr, size_t len); extern int linux_access_ok(int rw, const void *uaddr, size_t len); -/* - * NOTE: The returned value from pagefault_disable() must be stored - * and passed to pagefault_enable(). Else possible recursion on the - * state can be lost. - */ -static inline int __must_check -pagefault_disable(void) -{ - return (vm_fault_disable_pagefaults()); -} +#define pagefault_disable(void) do { \ + int __saved_pflags = \ + vm_fault_disable_pagefaults() -static inline void -pagefault_enable(int save) -{ - vm_fault_enable_pagefaults(save); -} +#define pagefault_enable(void) \ + vm_fault_enable_pagefaults(__saved_pflags); \ +} while (0) static inline bool pagefault_disabled(void)