[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0eaac427354844a4fcfb0d9843cf3024c6af21df.camel@perches.com>
Date: Mon, 02 Mar 2020 05:09:58 -0800
From: Joe Perches <joe@...ches.com>
To: glider@...gle.com, tkjos@...gle.com, keescook@...omium.org,
gregkh@...uxfoundation.org, arve@...roid.com, mingo@...hat.com
Cc: dvyukov@...gle.com, jannh@...gle.com, devel@...verdev.osuosl.org,
peterz@...radead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] binder: do not initialize locals passed to
copy_from_user()
On Mon, 2020-03-02 at 14:04 +0100, glider@...gle.com wrote:
> Certain copy_from_user() invocations in binder.c are known to
> unconditionally initialize locals before their first use, like e.g. in
> the following case:
[]
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
[]
> @@ -3788,7 +3788,7 @@ static int binder_thread_write(struct binder_proc *proc,
>
> case BC_TRANSACTION_SG:
> case BC_REPLY_SG: {
> - struct binder_transaction_data_sg tr;
> + struct binder_transaction_data_sg tr __no_initialize;
>
> if (copy_from_user(&tr, ptr, sizeof(tr)))
I fail to see any value in marking tr with __no_initialize
when it's immediately written to by copy_from_user.
> return -EFAULT;
> @@ -3799,7 +3799,7 @@ static int binder_thread_write(struct binder_proc *proc,
> }
> case BC_TRANSACTION:
> case BC_REPLY: {
> - struct binder_transaction_data tr;
> + struct binder_transaction_data tr __no_initialize;
>
> if (copy_from_user(&tr, ptr, sizeof(tr)))
etc...
Powered by blists - more mailing lists