From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754955AbcGVSDT (ORCPT ); Fri, 22 Jul 2016 14:03:19 -0400 Received: from mga09.intel.com ([134.134.136.24]:29083 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754860AbcGVSDP (ORCPT ); Fri, 22 Jul 2016 14:03:15 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,405,1464678000"; d="scan'208";a="851424978" Subject: [PATCH 2/3] x86: add some better documentation for probe_kernel_address() To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, luto@kernel.org, Dave Hansen , dave.hansen@linux.intel.com From: Dave Hansen Date: Fri, 22 Jul 2016 11:03:13 -0700 References: <20160722180310.99F5BCFF@viggo.jf.intel.com> In-Reply-To: <20160722180310.99F5BCFF@viggo.jf.intel.com> Message-Id: <20160722180313.59F73015@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen probe_kernel_address() has an unfortunate name since it is used to probe kernel *and* userspace addresses. Add a comment explaining some of the situation to help the next developer who might make the silly assumption that it is for probing kernel addresses. Signed-off-by: Dave Hansen --- b/include/linux/uaccess.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff -puN include/linux/uaccess.h~pkeys-902-document-probe_kernel_address include/linux/uaccess.h --- a/include/linux/uaccess.h~pkeys-902-document-probe_kernel_address 2016-07-22 10:52:32.909347999 -0700 +++ b/include/linux/uaccess.h 2016-07-22 10:52:32.912348134 -0700 @@ -106,6 +106,14 @@ extern long strncpy_from_unsafe(char *ds * @addr: address to read from * @retval: read into this variable * + * This is safe to call on both userspace and kernel addresses. + * Kernel faults (like vmalloc faults) may be handled but do not + * sleep. + * + * If access to @addr is a userspace address and faults, we will + * enter the page fault handler, not *handling* the fault in any + * way and returning -EFAULT. + * * Returns 0 on success, or -EFAULT. */ #define probe_kernel_address(addr, retval) \ _