Commit 99847750 authored by Jann Horn's avatar Jann Horn Committed by GUO Zihua
Browse files

keys: safe concurrent user->{session,uid}_keyring access

mainline inclusion
from mainline-v5.2-rc1
commit 0b9dc6c9
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9355O
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b9dc6c9f01c4a726558b82a3b6082a89d264eb5



--------------------------------

The current code can perform concurrent updates and reads on
user->session_keyring and user->uid_keyring. Add a comment to
struct user_struct to document the nontrivial locking semantics, and use
READ_ONCE() for unlocked readers and smp_store_release() for writers to
prevent memory ordering issues.

Fixes: 69664cf1 ("keys: don't generate user and user session keyrings unless they're accessed")
Signed-off-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarJames Morris <james.morris@microsoft.com>
Conflicts:
	security/keys/process_keys.c
	security/keys/request_key.c
Signed-off-by: default avatarGUO Zihua <guozihua@huawei.com>
parent 471243f2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment