lkml.org 
[lkml]   [2012]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [tip:x86/x32] x32: Fix alignment fail in struct compat_siginfo
From
On Wed, Mar 14, 2012 at 2:43 PM, tip-bot for H. Peter Anvin
<hpa@zytor.com> wrote:
> Commit-ID:  31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
> Gitweb:     http://git.kernel.org/tip/31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4
> Author:     H. Peter Anvin <hpa@zytor.com>
> AuthorDate: Wed, 14 Mar 2012 14:27:52 -0700
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Wed, 14 Mar 2012 14:27:52 -0700
>
> x32: Fix alignment fail in struct compat_siginfo
>
> Adding struct _sigchld_x32 caused a misalignment cascade in struct
> siginfo, because union _sifields is located on an 4-byte boundary
> (8-byte misaligned.)
>
> Adding new fields that are 8-byte aligned caused the intermediate
> structures to also be aligned to 8 bytes, thereby adding padding in
> unexpected places.
>
> Thus, change s64 to compat_s64 here, which makes it "misaligned on
> paper".  In reality these fields *are* actually aligned (there are 3
> preceeding ints outside the union and 3 inside struct _sigchld_x32),
> but because of the intervening union and struct it is not possible for
> gcc to avoid padding without breaking the ABI.
>

Just for the record, although the offsets of _utime and _stime are
multiple of 8 bytes, struct siginfo is only aligned at 4 bytes. So
the addresses of _utime and _stime may not be 8byte aligned.
But misaligned int64 load/store are OK for x86-64.

--
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-03-15 00:19    [W:0.444 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site