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

2020-03-05 Thread Al Viro
On Thu, Mar 05, 2020 at 10:03:25AM +0100, Rasmus Villemoes wrote: > Does copy_from_user guarantee to zero-initialize the remaining buffer if > copying fails partway through? That's guaranteed, short of raw_copy_from_user() being completely broken. What raw_copy_from_user() implementation must gua

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

2020-03-05 Thread Rasmus Villemoes
On 02/03/2020 19.31, Jann Horn wrote: > On Mon, Mar 2, 2020 at 7:17 PM Alexander Potapenko wrote: >> On Mon, Mar 2, 2020 at 3:00 PM Joe Perches wrote: >>> >>> So? CONFIG_INIT_STACK_ALL by design slows down code. >> Correct. >> >>> This marking would likely need to be done for nearly all >>> 3000

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

2020-03-05 Thread Kees Cook
On Thu, Mar 05, 2020 at 11:07:56AM +0300, Dan Carpenter wrote: > On Wed, Mar 04, 2020 at 10:13:40AM -0800, Kees Cook wrote: > > On Tue, Mar 03, 2020 at 12:38:32PM +0300, Dan Carpenter wrote: > > > The real fix is to initialize everything manually, the automated > > > initialization is a hardenning

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

2020-03-05 Thread Dan Carpenter
On Wed, Mar 04, 2020 at 10:13:40AM -0800, Kees Cook wrote: > On Tue, Mar 03, 2020 at 12:38:32PM +0300, Dan Carpenter wrote: > > The real fix is to initialize everything manually, the automated > > initialization is a hardenning feature which many people will disable. > > I cannot disagree more wit

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

2020-03-04 Thread Kees Cook
On Tue, Mar 03, 2020 at 12:38:32PM +0300, Dan Carpenter wrote: > The real fix is to initialize everything manually, the automated > initialization is a hardenning feature which many people will disable. I cannot disagree more with this sentiment. Linus has specifically said he wants this initializ

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

2020-03-03 Thread Dan Carpenter
On Tue, Mar 03, 2020 at 05:56:51AM -0800, Joe Perches wrote: > > The real fix is to initialize everything manually, the automated > > initialization is a hardenning feature which many people will disable. > > So I don't think the hardenning needs to be perfect, it needs to simple > > and fast. > >

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

2020-03-03 Thread Joe Perches
On Tue, 2020-03-03 at 12:38 +0300, Dan Carpenter wrote: > On Tue, Mar 03, 2020 at 10:14:18AM +0100, Alexander Potapenko wrote: > > On Mon, Mar 2, 2020 at 7:51 PM Joe Perches wrote: > > > On Mon, 2020-03-02 at 19:17 +0100, Alexander Potapenko wrote: > > > > On Mon, Mar 2, 2020 at 3:00 PM Joe Perche

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

2020-03-03 Thread Dan Carpenter
On Tue, Mar 03, 2020 at 10:14:18AM +0100, Alexander Potapenko wrote: > On Mon, Mar 2, 2020 at 7:51 PM Joe Perches wrote: > > > > On Mon, 2020-03-02 at 19:17 +0100, Alexander Potapenko wrote: > > > On Mon, Mar 2, 2020 at 3:00 PM Joe Perches wrote: > > > > On Mon, 2020-03-02 at 14:25 +0100, Alexand

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

2020-03-02 Thread Joe Perches
On Mon, 2020-03-02 at 19:17 +0100, Alexander Potapenko wrote: > On Mon, Mar 2, 2020 at 3:00 PM Joe Perches wrote: > > On Mon, 2020-03-02 at 14:25 +0100, Alexander Potapenko wrote: > > > On Mon, Mar 2, 2020 at 2:11 PM Joe Perches wrote: > > > > On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com

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

2020-03-02 Thread Alexander Potapenko
On Mon, Mar 2, 2020 at 6:38 PM Greg KH wrote: > > On Mon, Mar 02, 2020 at 02:04:29PM +0100, gli...@google.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: > > > > st

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

2020-03-02 Thread Greg KH
On Mon, Mar 02, 2020 at 02:04:29PM +0100, gli...@google.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: > > struct binder_transaction_data tr; > if (copy_from_user(

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

2020-03-02 Thread Joe Perches
On Mon, 2020-03-02 at 14:25 +0100, Alexander Potapenko wrote: > On Mon, Mar 2, 2020 at 2:11 PM Joe Perches wrote: > > On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com wrote: > > > Certain copy_from_user() invocations in binder.c are known to > > > unconditionally initialize locals before their

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

2020-03-02 Thread Dan Carpenter
On Mon, Mar 02, 2020 at 02:25:51PM +0100, Alexander Potapenko wrote: > On Mon, Mar 2, 2020 at 2:11 PM Joe Perches wrote: > > > > On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com wrote: > > > Certain copy_from_user() invocations in binder.c are known to > > > unconditionally initialize locals b

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

2020-03-02 Thread Joe Perches
On Mon, 2020-03-02 at 14:04 +0100, gli...@google.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 [] > @@ -3