]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - kernel/cred.c
tracing: Silence GCC 9 array bounds warning
[thirdparty/kernel/stable.git] / kernel / cred.c
index 45d77284aed0a91383e71e53bfadf6dd5017f7e0..07e069d00696eb9da7addeca6ad0c949e2083573 100644 (file)
@@ -450,6 +450,15 @@ int commit_creds(struct cred *new)
                if (task->mm)
                        set_dumpable(task->mm, suid_dumpable);
                task->pdeath_signal = 0;
+               /*
+                * If a task drops privileges and becomes nondumpable,
+                * the dumpability change must become visible before
+                * the credential change; otherwise, a __ptrace_may_access()
+                * racing with this change may be able to attach to a task it
+                * shouldn't be able to attach to (as if the task had dropped
+                * privileges without becoming nondumpable).
+                * Pairs with a read barrier in __ptrace_may_access().
+                */
                smp_wmb();
        }