lkml.org 
[lkml]   [2011]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Force same size of struct autofs_v5_packet on x86 and x86_64
Date

Am 19.09.2011 um 08:10 schrieb Al Viro:

> On Mon, Sep 19, 2011 at 11:52:48AM +0800, Ian Kent wrote:
>
>>> btw. where are the padding bytes are added? how to tell gcc to display
>>> this?
>>
>> It's also been a long time since I looked into this so I don't remember
>> the processor alignment details.
>>
>> Not sure if there is a compiler option that would report this, sorry,
>> anyone else?
>
> Padding is added in the very end. The thing is, it's not a misaligned
> field per se; they all have a natural alignment in there. It's that
> __u64 ino has alignment 8 on amd64 and alignment 4 on i386. So the alignment
> requirements for the entire structure are different - on amd64 the address
> of the entire thing must be a multiple of 8 and on i386 it can be any multiple
> of 4. IOW, on i386 you can just put them one after another in e.g. an array
> (the size without any padding is 300 bytes) and on amd64 you need 4 bytes
> of padding added between them. I.e. sizeof needs to go up by 4, with the
> padding added in the end.

okay. that's what I thought.

@Ian: Is the read() from the pipe fd the only way to consume this structure from userspace?

if so: why not align the size of this structure for x86 and x86_64 to the same size?

the systemd compiled for x86_64 will probably work with this change, but does maybe report something like a short read or so, as it currently expects 304 bytes to read.
i didn't test this yet.

@al: what other autofs4 users are out there besides systemd?

with kind regards
thomas

\
 
 \ /
  Last update: 2011-09-19 11:33    [W:0.046 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site