binder: fix test regression due to sender_euid change
authorTodd Kjos <tkjos@google.com>
Fri, 12 Nov 2021 18:07:20 +0000 (10:07 -0800)
committerPDO SCM Team <hudsoncm@motorola.com>
Wed, 9 Mar 2022 03:23:29 +0000 (21:23 -0600)
commit c21a80ca0684ec2910344d72556c816cb8940c01 upstream.

This is a partial revert of commit
29bc22ac5e5b ("binder: use euid from cred instead of using task").
Setting sender_euid using proc->cred caused some Android system test
regressions that need further investigation. It is a partial
reversion because subsequent patches rely on proc->cred.

Mot-CRs-fixed: (CR)
CVE-Fixed: CVE-2021-39686
Bug: 200688826

Fixes: 29bc22ac5e5b ("binder: use euid from cred instead of using task")
Cc: stable@vger.kernel.org # 4.4+
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I9b1769a3510fed250bb21859ef8beebabe034c66
Link: https://lore.kernel.org/r/20211112180720.2858135-1-tkjos@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gajjala Chakradhar <gajjalac@motorola.com>
Reviewed-on: https://gerrit.mot.com/2197697
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit 6ce7f93a97f4242bbfd6c0bea6a0e7Montana7813b4d)

drivers/android/binder.c

index 2295c0872291a87f700a2248ff62f2d05740223a..6b3fb65b0dfd3d33b7047670f046e66044b6e980 100644 (file)
@@ -3208,7 +3208,7 @@ static void binder_transaction(struct binder_proc *proc,
                t->from = thread;
        else
                t->from = NULL;
-       t->sender_euid = proc->cred->euid;
+       t->sender_euid = task_euid(proc->tsk);
        t->to_proc = target_proc;
        t->to_thread = target_thread;
        t->code = tr->code;