[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110217180042.GA30530@dtor-ws.eng.vmware.com>
Date: Thu, 17 Feb 2011 10:00:42 -0800
From: Dmitry Torokhov <dtor@...are.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Linux/m68k <linux-m68k@...r.kernel.org>,
Linux-Arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 1/3] module: deal with alignment issues in built-in
module versions
On Thu, Feb 17, 2011 at 09:45:37AM -0800, Linus Torvalds wrote:
> On Thu, Feb 17, 2011 at 9:31 AM, Dmitry Torokhov <dtor@...are.com> wrote:
> >
> > From what I understand __attribute__ ((aligned(x))) only guarantees
> > minimum alignment, not exact (gapless) alignment. GCC seems to lay out
> > pointers in the section without gaps on all arches that we have.
>
> I still don't see the problem.
>
> Have you actually _tried_ just adding the proper alignment to before
> the __modver thing in include/asm-generic/vmlinux.lds.h ?
>
> As far as I can tell, the bug is really simple:
> - the section is not aligned
> - but we told the compiler that that structure is aligned
>
> End result: there is a gap between the section start and the first structure.
>
> And the fix seems obvious: just make sure that the section is
> sufficiently aligned.
>
> IOW, why isn't the proper fix the obvious trivial one (attached)?
>
The problem is that on m68k size of the struct module_version_attribute
is not evenly divisible by sizeof(void *), thus when we lay out the
__modver section we align on 4 bytes but when we iterate we think that
the alignment is 2.
I/Geert tried adding __attribute__ (aligned(sizeof(void *))) to the type
definition itself so we have matching alignment everywhere, but DaveM
said that this only guarantees minimum alignment and that using
structures like we do shown to break from time to time in kprobes and
that only pointers worked reliably.
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists