All of lore.kernel.org
 help / color / mirror / Atom feed
From: Serban Constantinescu <Serban.Constantinescu@arm.com>
To: "Arve Hjønnevåg" <arve@android.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"kernel-team@android.com" <kernel-team@android.com>,
	"john.stultz@linaro.org" <john.stultz@linaro.org>,
	Dave Butcher <Dave.Butcher@arm.com>
Subject: Re: [PATCH v3 0/6] Android Binder IPC Fixes
Date: Thu, 02 May 2013 17:38:27 +0100	[thread overview]
Message-ID: <51829683.5010807@arm.com> (raw)
In-Reply-To: <CAMP5XgdryPAf29dY2yEEZ3TShNutQEgrUjBzYcE_JsUckbof9g@mail.gmail.com>

On 01/05/13 00:52, Arve Hjønnevåg wrote:
> On Tue, Apr 30, 2013 at 1:36 AM, Serban Constantinescu
> <Serban.Constantinescu@arm.com> wrote:
>> Hi Arve,
>>
>>
>> On 30/04/13 00:13, Arve Hjønnevåg wrote:
>>>
>>> On Mon, Apr 29, 2013 at 9:16 AM, Serban Constantinescu
>>> <Serban.Constantinescu@arm.com> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> Any feedback or comments on this patch set?
>>>>
>>>
>>> You don't seem to have addressed my feedback on the previous patch set.
>>
>>
>> For v3 I have modified the following according to your review:
>>
>>
>>> Changes for v3:
>>> 1:  Dropped the patch that was replacing uint32_t types with unsigned int
>>> 2:  Dropped the patch fixing the IOCTL types(since it has been added to
>>> Greg's
>>>      staging tree)
>>> 3:  Split one patch into two: 'modify binder_write_read' and '64bit
>>> changes'
>>> 4:  Modified BINDER_SET_MAX_THREADS ioctl definition accordint to Arve's
>>> review
>>> 5:  Modified the binder command IOCTL declarations according to Arve's
>>> review
>>
>>
>> The following were left out:
>>
>>> On 11/04/13 22:40, Arve Hjønnevåg wrote:
>>> OK, relaxing the alignment requirement for *offp to what the hardware
>>>>
>>>> requires makes sense. Is there any macros in the kernel to help with
>>>> this, instead of hard-coding it to 4 bytes?
>>
>>
>> There is no kernel macro that I know which will help here(one that springs
>> to mind is PTR_ALIGN but it aligns to (unsigned long) - we need one that
>> aligns to (u32)). Any ideas?
>>
>
> Perhaps using __alignof__(struct flat_binder_object) will work. This
> is the least important part of that change however. I saw no response
> to my concern that your changes can cause less memory to be allocated
> than you write to.

This can happen for situations where (buffer_start + buffer_size) are 
not aligned to (void *), because offset_start is calculated as:

> offp = (size_t *)(buffer->data + ALIGN(buffer->data_size, sizeof(void *)));

Thus you can have a situation where instead of reading offset[i] you 
will read (offset[i] >> 32 | offset[i+1] << 32) (offset is size_t - 
8byte for 64bit systems).

I will address this issue in v4 of the patch set.

>
>>> On 11/04/13 21:38, Arve Hjønnevåg wrote:
>>> OK, but if you are using this change let a 64 bit user-space know that
>>>>
>>>> the driver has been fixed, then this patch needs to go after the
>>>> patches that change the structures on 64 bit systems.
>>
>>
>> For 32bit systems nothing has changed so they will continue to work as
>> before. For 64bit systems the size of binder_version was signed long before
>> the patch and __s32 after the patch is applied. Thus a 64bit system using
>> the old interface will fail immediately after opening the binder driver,
>> while cheeking the binder version (since the BINDER_VERSION ioctl will be
>> different pre/post patch - size of binder_version differs).
>>
>> For 64/32 systems once I will have the userspace wrapper ready I will add
>> another ioctl(as discussed) that will check if the driver is 64bit
>> ready(among the first things to do on binder_open).
>>
>
> Why fix the BINDER_VERSION ioctl to succeed on a 64 bit system before
> the driver is usable on a 64 bit system?

Leaving the binder_version as a long will cause the BINDER_VERSION ioctl 
to fail just on 64/32 - since the size will be different between 32bit 
compilers and 64bit compilers. The call will succeed on 64/64 and 32/32 
(since they use the same kernel headers).

>> Please let me know if there is anything that skipped my review and you would
>> like to integrate in this patch set.
>>
>
> It may be better to reply to my original emails instead of copying
> bits of them here.

I will do that! I did not understand your initial reply to the buffer 
size issue, my fault!


Thanks for your feedback,
Serban

-- 
Best Regards,

Serban Constantinescu
PDSW Engineer ARM Ltd.


  reply	other threads:[~2013-05-02 16:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 12:25 [PATCH v3 0/6] Android Binder IPC Fixes Serban Constantinescu
2013-04-12 12:25 ` [PATCH v3 1/6] staging: android: binder: modify struct binder_write_read to use size_t Serban Constantinescu
2013-04-12 12:25 ` [PATCH v3 2/6] staging: android: binder: fix binder interface for 64bit compat layer Serban Constantinescu
2013-04-12 12:25 ` [PATCH v3 3/6] staging: android: binder: fix BINDER_SET_MAX_THREADS declaration Serban Constantinescu
2013-04-12 12:25 ` [PATCH v3 4/6] staging: android: binder: fix BC_FREE_BUFFER ioctl declaration Serban Constantinescu
2013-04-12 12:25 ` [PATCH v3 5/6] staging: android: binder: fix alignment issues Serban Constantinescu
2013-04-12 12:25 ` [PATCH v3 6/6] staging: android: binder: replace types with portable ones Serban Constantinescu
2013-04-29 16:16 ` [PATCH v3 0/6] Android Binder IPC Fixes Serban Constantinescu
2013-04-29 23:13   ` Arve Hjønnevåg
2013-04-30  8:36     ` Serban Constantinescu
2013-04-30 23:52       ` Arve Hjønnevåg
2013-05-02 16:38         ` Serban Constantinescu [this message]
2013-04-30  7:31 ` Kirill A. Shutemov
2013-04-30  8:52   ` Serban Constantinescu
2013-04-30 10:04     ` Kirill A. Shutemov
2013-04-30 10:09       ` Serban Constantinescu

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=51829683.5010807@arm.com \
    --to=serban.constantinescu@arm.com \
    --cc=Dave.Butcher@arm.com \
    --cc=arve@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.