KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
David Howells authored
rcu_dereference_key() and user_key_payload() are currently being used in
two different, incompatible ways:

 (1) As a wrapper to rcu_dereference() - when only the RCU read lock used
     to protect the key.

 (2) As a wrapper to rcu_dereference_protected() - when the key semaphor is
     used to protect the key and the may be being modified.

Fix this by splitting both of the key wrappers to produce:

 (1) RCU accessors for keys when caller has the key semaphore locked:

	dereference_key_locked()
	user_key_payload_locked()

 (2) RCU accessors for keys when caller holds the RCU read lock:

	dereference_key_rcu()
	user_key_payload_rcu()

This should fix following warning in the NFS idmapper

  ===============================
  [ INFO: suspicious RCU usage. ]
  4.10.0 #1 Tainted: G        W
  -------------------------------
  ./include/keys/user-type.h:53 suspicious rcu_dereference_protected() usage!
  other info that might help us debu...
0837e49a
Name Last commit Last update
Documentation KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
arch Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
block lib/vsprintf.c: remove %Z support
certs certs: Add a secondary system keyring that can be added to dynamically
crypto crypto: change LZ4 modules to work with new LZ4 module version
drivers KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
firmware WHENCE: use https://linuxtv.org for LinuxTV URLs
fs KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
include KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
init Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax
ipc ipc/shm: Fix shmat mmap nil-page protection
kernel Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
lib KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
mm Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax
net KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
samples Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
scripts checkpatch: warn when formats use %Z and suggest %z
security KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
sound Merge tag 'sound-fix-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
tools Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax
usr kbuild: initramfs cleanup, set target from Kconfig
virt mm: add new mmget() helper
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Add hch to .get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files
.gitignore Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
.mailmap mailmap: add codeaurora.org names for nameless email commits
COPYING [PATCH] update FSF address in COPYING
CREDITS MAINTAINERS: Remove old e-mail address
Kbuild scripts/gdb: provide linux constants
Kconfig kbuild: migrate all arch to the kconfig mainmenu upgrade
MAINTAINERS Merge tag 'powerpc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Makefile Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
README README: add a new README file, pointing to the Documentation/
Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.