David Howells
0837e49ab3
KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
...
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 debug this:
rcu_scheduler_active = 2, debug_locks = 0
1 lock held by mount.nfs/5987:
#0 : (rcu_read_lock){......}, at: [<d000000002527abc>] nfs_idmap_get_key+0x15c/0x420 [nfsv4]
stack backtrace:
CPU: 1 PID: 5987 Comm: mount.nfs Tainted: G W 4.10.0 #1
Call Trace:
dump_stack+0xe8/0x154 (unreliable)
lockdep_rcu_suspicious+0x140/0x190
nfs_idmap_get_key+0x380/0x420 [nfsv4]
nfs_map_name_to_uid+0x2a0/0x3b0 [nfsv4]
decode_getfattr_attrs+0xfac/0x16b0 [nfsv4]
decode_getfattr_generic.constprop.106+0xbc/0x150 [nfsv4]
nfs4_xdr_dec_lookup_root+0xac/0xb0 [nfsv4]
rpcauth_unwrap_resp+0xe8/0x140 [sunrpc]
call_decode+0x29c/0x910 [sunrpc]
__rpc_execute+0x140/0x8f0 [sunrpc]
rpc_run_task+0x170/0x200 [sunrpc]
nfs4_call_sync_sequence+0x68/0xa0 [nfsv4]
_nfs4_lookup_root.isra.44+0xd0/0xf0 [nfsv4]
nfs4_lookup_root+0xe0/0x350 [nfsv4]
nfs4_lookup_root_sec+0x70/0xa0 [nfsv4]
nfs4_find_root_sec+0xc4/0x100 [nfsv4]
nfs4_proc_get_rootfh+0x5c/0xf0 [nfsv4]
nfs4_get_rootfh+0x6c/0x190 [nfsv4]
nfs4_server_common_setup+0xc4/0x260 [nfsv4]
nfs4_create_server+0x278/0x3c0 [nfsv4]
nfs4_remote_mount+0x50/0xb0 [nfsv4]
mount_fs+0x74/0x210
vfs_kern_mount+0x78/0x220
nfs_do_root_mount+0xb0/0x140 [nfsv4]
nfs4_try_mount+0x60/0x100 [nfsv4]
nfs_fs_mount+0x5ec/0xda0 [nfs]
mount_fs+0x74/0x210
vfs_kern_mount+0x78/0x220
do_mount+0x254/0xf70
SyS_mount+0x94/0x100
system_call+0x38/0xe0
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
2017-03-02 10:09:00 +11:00
..
842
fonts
lib/fonts/Kconfig: keep non-Sparc fonts listed together
2017-02-27 18:43:46 -08:00
lz4
lib/lz4: remove back-compat wrappers
2017-02-24 17:46:57 -08:00
lzo
mpi
mpi: Fix NULL ptr dereference in mpi_powm() [ver #3 ]
2016-11-25 12:57:50 +11:00
raid6
lib/raid6: Add AVX2 optimized xor_syndrome functions
2016-11-07 15:08:20 -08:00
reed_solomon
xz
zlib_deflate
zlib_inflate
.gitignore
argv_split.c
asn1_decoder.c
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
2016-05-17 09:33:39 -07:00
assoc_array.c
assoc_array: don't call compare_object() on a node
2016-04-06 14:06:48 +01:00
atomic64.c
locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()
2016-06-16 10:48:32 +02:00
atomic64_test.c
lib: add module support to atomic64 tests
2017-02-24 17:46:57 -08:00
audit.c
bcd.c
bch.c
bitmap.c
lib/bitmap.c: enhance bitmap syntax
2016-10-11 15:06:30 -07:00
bitrev.c
bsearch.c
btree.c
bug.c
build_OID_registry
bust_spinlocks.c
chacha20.c
random: replace non-blocking pool with a Chacha20-based CRNG
2016-07-03 00:57:23 -04:00
check_signature.c
checksum.c
clz_ctz.c
clz_tab.c
cmdline.c
compat_audit.c
cordic.c
cpu_rmap.c
cpumask.c
crc-ccitt.c
crc-itu-t.c
crc-t10dif.c
crc7.c
crc8.c
crc16.c
crc32.c
lib: add module support to crc32 tests
2017-02-24 17:46:57 -08:00
crc32defs.h
crc32test.c
lib: add module support to crc32 tests
2017-02-24 17:46:57 -08:00
ctype.c
debug_info.c
debug_locks.c
debugobjects.c
debugobjects: Improve variable naming
2017-02-10 09:53:04 +01:00
dec_and_lock.c
decompress.c
decompress_bunzip2.c
decompress_inflate.c
decompress_unlz4.c
lib/decompress_unlz4: change module to work with new LZ4 module version
2017-02-24 17:46:57 -08:00
decompress_unlzma.c
decompress_unlzo.c
decompress_unxz.c
devres.c
digsig.c
KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
2017-03-02 10:09:00 +11:00
div64.c
dma-debug.c
dma-debug: add comment for failed to check map error
2017-02-22 16:41:26 -08:00
dma-noop.c
lib/dma-noop: Clarify a comment
2017-01-24 12:23:35 -05:00
dma-virt.c
lib/dma-virt: Add dma_virt_ops
2017-01-24 12:23:35 -05:00
dump_stack.c
dynamic_debug.c
dynamic_debug: add jump label support
2016-08-04 08:50:07 -04:00
dynamic_queue_limits.c
earlycpio.c
lib/cpio: Make find_cpio_data()'s offset arg optional
2016-06-08 11:04:19 +02:00
extable.c
Replace <asm/uaccess.h> with <linux/uaccess.h> globally
2016-12-24 11:46:01 -08:00
fault-inject.c
fdt.c
fdt_empty_tree.c
fdt_ro.c
fdt_rw.c
fdt_strerror.c
fdt_sw.c
fdt_wip.c
find_bit.c
lib/find_bit.c: micro-optimise find_next_*_bit
2017-02-24 17:46:57 -08:00
flex_array.c
flex_proportions.c
gcd.c
lib/GCD.c: use binary GCD algorithm instead of Euclidean
2016-05-20 17:58:30 -07:00
gen_crc32table.c
genalloc.c
lib/genalloc.c: start search from start of chunk
2016-10-27 18:43:43 -07:00
glob.c
lib: add module support to glob tests
2017-02-24 17:46:57 -08:00
globtest.c
lib: add module support to glob tests
2017-02-24 17:46:57 -08:00
hexdump.c
hweight.c
x86/hweight: Get rid of the special calling convention
2016-06-08 15:01:02 +02:00
idr.c
idr: Add missing __rcu annotations
2017-02-13 21:44:10 -05:00
inflate.c
int_sqrt.c
interval_tree.c
interval_tree_test.c
iomap.c
iomap_copy.c
iommu-common.c
iommu-helper.c
lib/iommu-helper: skip to next segment
2016-08-02 19:35:07 -04:00
ioremap.c
mm: do not export ioremap_page_range symbol for external module
2017-01-24 16:26:14 -08:00
iov_iter.c
fix a fencepost error in pipe_advance()
2017-01-14 19:50:41 -05:00
irq_poll.c
This adds a new gcc plugin named "latent_entropy". It is designed to
2016-10-15 10:03:15 -07:00
irq_regs.c
is_single_threaded.c
jedec_ddr_data.c
kasprintf.c
Kconfig
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-02-28 10:00:39 -08:00
Kconfig.debug
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2017-02-28 10:44:16 -08:00
Kconfig.kasan
mm, kasan: switch SLUB to stackdepot, enable memory quarantine for SLUB
2016-07-28 16:07:41 -07:00
Kconfig.kgdb
kgdb: depends on VT
2016-05-23 17:04:14 -07:00
Kconfig.kmemcheck
Kconfig.ubsan
Kconfig: lib/Kconfig.ubsan fix reference to ubsan documentation
2016-12-14 16:04:08 -08:00
kfifo.c
klist.c
kobject.c
kobject_uevent.c
kobject: improve function-level documentation
2016-10-28 02:42:10 -04:00
kstrtox.c
Replace <asm/uaccess.h> with <linux/uaccess.h> globally
2016-12-24 11:46:01 -08:00
kstrtox.h
lcm.c
libcrc32c.c
list_debug.c
bug: switch data corruption check to __must_check
2017-02-24 17:46:56 -08:00
list_sort.c
llist.c
locking-selftest-hardirq.h
locking-selftest-mutex.h
locking-selftest-rlock-hardirq.h
locking-selftest-rlock-softirq.h
locking-selftest-rlock.h
locking-selftest-rsem.h
locking-selftest-softirq.h
locking-selftest-spin-hardirq.h
locking-selftest-spin-softirq.h
locking-selftest-spin.h
locking-selftest-wlock-hardirq.h
locking-selftest-wlock-softirq.h
locking-selftest-wlock.h
locking-selftest-wsem.h
locking-selftest.c
locking/selftest: Fix output since KERN_CONT changes
2016-11-25 07:12:19 +01:00
lockref.c
locking/core: Remove cpu_relax_lowlatency() users
2016-11-16 10:15:10 +01:00
lru_cache.c
Makefile
Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax
2017-02-28 20:29:41 -08:00
md5.c
memory-notifier-error-inject.c
memweight.c
net_utils.c
netdev-notifier-error-inject.c
nlattr.c
netlink: smaller nla_attr_minlen table
2016-11-19 22:11:25 -05:00
nmi_backtrace.c
printk: rename nmi.c and exported api
2017-02-08 11:02:33 +01:00
nodemask.c
include/linux/nodemask.h: create next_node_in() helper
2016-05-19 19:12:14 -07:00
notifier-error-inject.c
notifier-error-inject.h
of-reconfig-notifier-error-inject.c
oid_registry.c
once.c
parman.c
lib: Introduce priority array area manager
2017-02-03 16:35:42 -05:00
parser.c
parser: add u64 number parser
2016-12-06 10:17:03 +02:00
pci_iomap.c
percpu-refcount.c
percpu-refcount: init ->confirm_switch member properly
2016-08-11 13:52:23 -04:00
percpu_counter.c
percpu_counter: percpu_counter_hotcpu_callback() cleanup
2017-01-20 10:06:56 -05:00
percpu_ida.c
percpu_test.c
plist.c
pm-notifier-error-inject.c
prime_numbers.c
lib/prime_numbers: Suppress warn on kmalloc failure
2017-01-23 09:17:12 +01:00
radix-tree.c
Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax
2017-02-28 20:29:41 -08:00
random32.c
This adds a new gcc plugin named "latent_entropy". It is designed to
2016-10-15 10:03:15 -07:00
ratelimit.c
ratelimit: extend to print suppressed messages on release
2016-08-02 19:35:06 -04:00
rational.c
rbtree.c
rbtree: use designated initializers
2017-02-24 17:46:57 -08:00
rbtree_test.c
reciprocal_div.c
refcount.c
locking/refcounts: Out-of-line everything
2017-02-24 09:02:10 +01:00
rhashtable.c
rhashtable: Fix RCU dereference annotation in rht_bucket_nested
2017-02-26 21:33:43 -05:00
sbitmap.c
sbitmap: add helpers for dumping to a seq_file
2017-01-27 08:17:44 -07:00
scatterlist.c
scatterlist: do not disable IRQs in sg_copy_buffer
2017-02-27 18:43:46 -08:00
seq_buf.c
sg_pool.c
lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c
2016-04-15 16:53:14 -04:00
sg_split.c
sha1.c
show_mem.c
lib/show_mem.c: teach show_mem to work with the given nodemask
2017-02-22 16:41:30 -08:00
siphash.c
siphash: implement HalfSipHash1-3 for hash tables
2017-01-09 13:58:57 -05:00
smp_processor_id.c
sort.c
lib: add CONFIG_TEST_SORT to enable self-test of sort()
2017-02-24 17:46:57 -08:00
stackdepot.c
lib/stackdepot: export save/fetch stack for drivers
2016-11-11 08:12:37 -08:00
stmp_device.c
string.c
string_helpers.c
string_helpers: add kstrdup_quotable_file
2016-04-21 10:47:26 +10:00
strncpy_from_user.c
lib: harden strncpy_from_user
2016-10-11 15:06:30 -07:00
strnlen_user.c
unsafe_[get|put]_user: change interface to use a error target label
2016-08-08 13:02:01 -07:00
swiotlb.c
swiotlb: ensure that page-sized mappings are page-aligned
2017-01-15 12:37:24 -05:00
syscall.c
lib/syscall: Pin the task stack in collect_syscall()
2016-09-16 09:18:53 +02:00
test-kstrtox.c
test-string_helpers.c
test_bitmap.c
test_bpf.c
bpf, test: fix ld_abs + vlan push/pop stress test
2016-10-20 14:39:06 -04:00
test_firmware.c
test_firmware: add test custom fallback trigger
2017-01-25 11:52:34 +01:00
test_hash.c
lib/test_hash.c: fix warning in preprocessor symbol evaluation
2016-09-01 17:52:01 -07:00
test_hexdump.c
test_kasan.c
kasan: add memcg kmem_cache test
2017-02-24 17:46:56 -08:00
test_module.c
test_parman.c
lib: fix spelling mistake: "actualy" -> "actually"
2017-02-26 11:03:38 -05:00
test_printf.c
test_rhashtable.c
rhashtable-test: Fix max_size parameter description
2016-08-08 12:52:42 -07:00
test_siphash.c
siphash: implement HalfSipHash1-3 for hash tables
2017-01-09 13:58:57 -05:00
test_sort.c
lib/test_sort.c: make it explicitly non-modular
2017-02-24 17:46:57 -08:00
test_static_key_base.c
test_static_keys.c
test_user_copy.c
usercopy: ARM NOMMU has no 64-bit get_user
2017-02-22 11:24:08 -08:00
test_uuid.c
lib/uuid: add a test module
2016-05-30 15:26:57 -07:00
textsearch.c
timerqueue.c
timerqueue: Use rb_entry_safe() instead of open-coding it
2017-01-20 08:03:42 +01:00
ts_bm.c
ts_fsm.c
ts_kmp.c
ubsan.c
UBSAN: fix typo in format string
2016-08-02 17:31:41 -04:00
ubsan.h
ucs2_string.c
lib/ucs2_string: Speed up ucs2_utf8size()
2016-09-09 16:08:46 +01:00
uuid.c
lib/uuid.c: use correct offset in uuid parser
2016-05-30 15:26:57 -07:00
vsprintf.c
lib/vsprintf.c: remove %Z support
2017-02-27 18:43:47 -08:00
win_minmax.c
lib/win_minmax: windowed min or max estimator
2016-09-21 00:22:59 -04:00