Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1448704

[PATCH 2/3] x86: add some better documentation for probe_kernel_address()

From Dave Hansen <dave@sr71.net>
Newsgroups linux.kernel
Subject [PATCH 2/3] x86: add some better documentation for probe_kernel_address()
Date 2016-07-22 20:10 +0200
Message-ID <rXN3A-Qn-25@gated-at.bofh.it> (permalink)
References <rXN3z-Qn-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dave Hansen <dave.hansen@linux.intel.com>

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 <dave.hansen@linux.intel.com>
---

 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)		\
_

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] x86, pkeys: fix prefetch/pkeys interaction Dave Hansen <dave@sr71.net> - 2016-07-22 20:10 +0200
  [PATCH 2/3] x86: add some better documentation for probe_kernel_address() Dave Hansen <dave@sr71.net> - 2016-07-22 20:10 +0200
    Re: [PATCH 2/3] x86: add some better documentation for probe_kernel_address() Andy Lutomirski <luto@amacapital.net> - 2016-07-22 20:20 +0200
      Re: [PATCH 2/3] x86: add some better documentation for  probe_kernel_address() Dave Hansen <dave@sr71.net> - 2016-07-22 20:20 +0200
        Re: [PATCH 2/3] x86: add some better documentation for probe_kernel_address() Andy Lutomirski <luto@amacapital.net> - 2016-07-22 20:30 +0200
  [PATCH 3/3] x86, pkeys: allow instruction fetches in presence of pkeys Dave Hansen <dave@sr71.net> - 2016-07-22 20:10 +0200

csiph-web