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:Jann Horn <jannh@google.com> Signed-off-by:
James Morris <james.morris@microsoft.com> Conflicts: security/keys/process_keys.c security/keys/request_key.c Signed-off-by:
GUO Zihua <guozihua@huawei.com>
Loading
Please sign in to comment