mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelaf@google.com>
To: Todd Kjos <tkjos@google.com>
Cc: "Todd Kjos" <tkjos@android.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"open list:ANDROID DRIVERS" <devel@driverdev.osuosl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Martijn Coenen" <maco@google.com>,
	"Joel Fernandes (Google)" <joel@joelfernandes.org>,
	"Android Kernel Team" <kernel-team@android.com>
Subject: Re: [PATCH v3 1/7] binder: create userspace-to-binder-buffer copy function
Date: Thu, 14 Feb 2019 16:25:49 -0500	[thread overview]
Message-ID: <20190214212549.GB185075@google.com> (raw)
In-Reply-To: <CAJWu+oqq0s3x7j+gPzSRREj2gjZxzAPS_=XVM4uhC9GjSM9zfw@mail.gmail.com>

On Thu, Feb 14, 2019 at 03:53:54PM -0500, Joel Fernandes wrote:
> On Thu, Feb 14, 2019 at 3:42 PM Todd Kjos <tkjos@google.com> wrote:
> >
> > On Thu, Feb 14, 2019 at 11:45 AM Joel Fernandes <joelaf@google.com> wrote:
> [snip]
> > > > + * check_buffer() - verify that buffer/offset is safe to access
> > > > + * @alloc: binder_alloc for this proc
> > > > + * @buffer: binder buffer to be accessed
> > > > + * @offset: offset into @buffer data
> > > > + * @bytes: bytes to access from offset
> > > > + *
> > > > + * Check that the @offset/@bytes are within the size of the given
> > > > + * @buffer and that the buffer is currently active and not freeable.
> > > > + * Offsets must also be multiples of sizeof(u32). The kernel is
> > >
> > > In all callers of binder_alloc_copy_user_to_buffer, the alignment of offsets
> > > is set to sizeof(void *). Then shouldn't this function check for sizeof(void *)
> > > alignment instead of u32?
> >
> > But there are other callers of check_buffer() later in the series that
> > don't require pointer-size alignment. u32 alignment is consistent with
> > the alignment requirements of the binder driver before this change.
> > The copy functions don't actually need to insist on alignment, but
> > these binder buffer objects have always used u32 alignment which has
> > been checked in the driver. If user code misaligned it, then errors
> > are returned. The alignment checks are really to be consistent with
> > previous binder driver behavior.
> 
> Got it, thanks.

One more thing I wanted to ask is, kmap() will now cause global lock
contention because of using spin_lock due to kmap_high().

Previously the binder driver was made to not use global lock (as you had
done). Now these paths will start global locking on 32-bit architectures.
Would that degrade performance?

Are we not using kmap_atomic() in this patch because of any concern that the
kmap fixmap space is limited and may run out?

thanks,

 - Joel



  reply	other threads:[~2019-02-14 21:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 18:35 [PATCH v3 0/7] binder: eliminate use of vmalloc space for binder buffers Todd Kjos
2019-02-08 18:35 ` [PATCH v3 1/7] binder: create userspace-to-binder-buffer copy function Todd Kjos
2019-02-14 19:45   ` Joel Fernandes
2019-02-14 20:42     ` Todd Kjos
2019-02-14 20:53       ` Joel Fernandes
2019-02-14 21:25         ` Joel Fernandes [this message]
2019-02-14 21:55           ` Todd Kjos
2019-02-14 22:07             ` Joel Fernandes
2019-02-08 18:35 ` [PATCH v3 2/7] binder: add functions to copy to/from binder buffers Todd Kjos
2019-02-08 18:35 ` [PATCH v3 3/7] binder: add function to copy binder object from buffer Todd Kjos
2019-02-08 18:35 ` [PATCH v3 4/7] binder: avoid kernel vm_area for buffer fixups Todd Kjos
2019-02-08 18:35 ` [PATCH v3 5/7] binder: remove kernel vm_area for buffer space Todd Kjos
2019-02-08 18:35 ` [PATCH v3 6/7] binder: remove user_buffer_offset Todd Kjos
2019-02-08 18:35 ` [PATCH v3 7/7] binder: use userspace pointer as base of buffer space Todd Kjos
2019-02-11 16:57 ` [PATCH v3 0/7] binder: eliminate use of vmalloc space for binder buffers Christoph Hellwig
2019-02-11 17:08   ` Todd Kjos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190214212549.GB185075@google.com \
    --to=joelaf@google.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@google.com \
    --cc=tkjos@android.com \
    --cc=tkjos@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome