Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

From: Greg KH
Date: Mon Mar 02 2020 - 12:38:56 EST


On Mon, Mar 02, 2020 at 02:04:29PM +0100, glider@xxxxxxxxxx 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:
>
> struct binder_transaction_data tr;
> if (copy_from_user(&tr, ptr, sizeof(tr)))
> return -EFAULT;
>
> In such cases enabling CONFIG_INIT_STACK_ALL leads to insertion of
> redundant locals initialization that the compiler fails to remove.
> To work around this problem till Clang can deal with it, we apply
> __no_initialize to local Binder structures.

I would like to see actual benchmark numbers showing this is
needed/useful otherwise it's going to just be random people adding this
marking to random places with no real reason.

thanks,

greg k-h