public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: akpm@linux-foundation.org
Cc: Christoph Hellwig <hch@infradead.org>,
	Mike Mason <mmlnx@us.ibm.com>,
	"Frank Ch. Eigler" <fche@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Linux Kernel Markers - Alignment Fix
Date: Tue, 2 Oct 2007 08:10:08 -0400	[thread overview]
Message-ID: <20071002121008.GA20843@Krystal> (raw)
In-Reply-To: <20070930140013.GB16981@Krystal>

Linux Kernel Markers - Alignment Fix

Fix the alignment of the struct marker declaration in the trace_mark() macro.
Otherwise, we run into problems on 64 bits architectures where the struct marker
structure is bigger than 32 bytes : gcc becomes alignment-happy and align these
structures on 32 bytes while the iteration on the markers is itself only aligned
on 8 bytes, as specified by the type attribute. Specifying the alignmentof the
type only is not enough to restrain gcc happiness; we must specify a variable
alignment attribute too.

This bug causes NULL pointer dereference at module load time on x86_64
when we load marker-example.ko.

Thanks to Mike Mason for reporting this.

It applies to 2.6.23-rc8-mm2, after the linux kernel markers coding style
fixes. This is an important bugfix that should be merged with the
markers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Christoph Hellwig <hch@infradead.org>
CC: Mike Mason <mmlnx@us.ibm.com>
CC: "Frank Ch. Eigler" <fche@redhat.com>
---
 include/linux/marker.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6-lttng/include/linux/marker.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/marker.h	2007-10-02 07:33:21.000000000 -0400
+++ linux-2.6-lttng/include/linux/marker.h	2007-10-02 07:33:58.000000000 -0400
@@ -58,7 +58,7 @@ struct marker {
 		__attribute__((section("__markers_strings")))		\
 		= format;						\
 		static struct marker __mark_##name			\
-		__attribute__((section("__markers"))) =			\
+		__attribute__((section("__markers"), aligned(8))) =	\
 		{ __mstrtab_name_##name, __mstrtab_format_##name,	\
 		0, __mark_empty_function, NULL };			\
 		asm volatile ("" : : "i" (&__mark_##name));		\
-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  parent reply	other threads:[~2007-10-02 12:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 14:28 [patch 0/5] Linux Kernel Markers for 2.6.23-rc8-mm2 Mathieu Desnoyers
2007-09-28 14:28 ` [patch 1/5] Combine instrumentation menus in kernel/Kconfig.instrumentation Mathieu Desnoyers
2007-09-28 14:28 ` [patch 2/5] Linux Kernel Markers Mathieu Desnoyers
2007-09-30  1:35   ` Rusty Russell
2007-09-30 14:00     ` Linux Kernel Markers - Coding Style Fixes Mathieu Desnoyers
2007-09-30 14:04       ` Mathieu Desnoyers
2007-10-02 12:10       ` Mathieu Desnoyers [this message]
2007-10-01 16:01     ` [PATCH] Change struct marker users Mathieu Desnoyers
2007-09-28 14:28 ` [patch 3/5] Add samples subdir Mathieu Desnoyers
2007-09-28 15:47   ` Randy Dunlap
2007-09-28 16:24     ` Mathieu Desnoyers
2007-09-28 14:28 ` [patch 4/5] Linux Kernel Markers - Samples Mathieu Desnoyers
2007-09-30 14:07   ` [PATCH] Linux Kernel Markers - Samples Coding Style Fix Mathieu Desnoyers
2007-10-11  9:13   ` [patch 4/5] Linux Kernel Markers - Samples Andrew Morton
2007-10-11 13:27     ` Mathieu Desnoyers
2007-10-11 18:32       ` Andrew Morton
2007-09-28 14:28 ` [patch 5/5] Linux Kernel Markers - Documentation Mathieu Desnoyers

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=20071002121008.GA20843@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=fche@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmlnx@us.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox