This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: sparc 32-bit dirent broken
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: David Miller <davem at davemloft dot net>
- Cc: fweimer at redhat dot com, libc-alpha at sourceware dot org
- Date: Thu, 10 Oct 2013 23:26:11 +0200
- Subject: Re: sparc 32-bit dirent broken
- Authentication-results: sourceware.org; auth=none
- References: <52570475 dot 2050107 at redhat dot com> <20131010 dot 164308 dot 103134182855731464 dot davem at davemloft dot net> <20131010 dot 170628 dot 144428253182134045 dot davem at davemloft dot net> <20131010 dot 171716 dot 69341787771640099 dot davem at davemloft dot net>
On Thu, Oct 10, 2013 at 05:17:16PM -0400, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Thu, 10 Oct 2013 17:06:28 -0400 (EDT)
>
> > I'll test out this theory.
>
> Indeed, the following patch fixes the bug. We were just being lucky
> beforehand in that the off_t was 64-bit and therefore making the
> data[] array be 64-bit aligned as well. Once you add the errcode
> there it is only 4-byte aligned.
>
> On powerpc/x86-32 there are no alignment traps, so you wouldn't notice
> this problem on those platforms.
>
> The critical element is whatever alignment d_off/d_ino need, that can
> be either __off_t/__ino_t or __off64_t/__ino64_t.
>
> Any suggestions for a better alignof or is this good enough to fix
> the problem? We probably should have a per-sysdep definition of
> "largest C type alignment" so we can use it in situations like this.
>
Is adding largest C type alignment worth hassle? For io structures a buffer
cause much bigger footprint that few bytes possibly wasted due of alignment.