public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Ricky Beam <jfbeam@bluetronic.net>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@muc.de>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: __setup()'s not processed in bk-current
Date: Mon, 28 Jun 2004 16:57:07 -0700	[thread overview]
Message-ID: <20040628165707.328cce15.akpm@osdl.org> (raw)
In-Reply-To: <Pine.GSO.4.33.0406281523340.25702-100000@sweetums.bluetronic.net>

Ricky Beam <jfbeam@bluetronic.net> wrote:
>
> Do I smell some bad pointer math?  Yeap:
>  DEBUG: sizeof(obs_kernel_param): 24 (0x18)
> 
>  obsolete_checksetup(): line: ro
>  obsolete_checksetup(): checking: nosmp(5) @ ffffffff80593510
>  obsolete_checksetup(): checking: <NULL>(1) @ ffffffff80593528
> 
>  p++ moved the pointer sizeof(obs_kernel_param) ahead, but that's 8 bytes
>  short.

Thanks for working that out.  It's been handing around for ages.



We're now putting 24-byte structures into .init.setup via __setup.  But
x86_64's compiler is emitting a `.align 16' in there, so they end up on
32-byte boundaries and do_early_param()'s pointer arithmetic goes wrong.

Fix that up by forcing the compiler to align these structures to sizeof(long).



---

 25-akpm/include/linux/init.h |    1 +
 1 files changed, 1 insertion(+)

diff -puN include/linux/init.h~x86_64-setup-section-alignment-fix include/linux/init.h
--- 25/include/linux/init.h~x86_64-setup-section-alignment-fix	2004-06-28 16:47:41.000000000 -0700
+++ 25-akpm/include/linux/init.h	2004-06-28 16:47:41.000000000 -0700
@@ -119,6 +119,7 @@ struct obs_kernel_param {
 	static struct obs_kernel_param __setup_##unique_id	\
 		 __attribute_used__				\
 		 __attribute__((__section__(".init.setup")))	\
+		__attribute__((aligned((sizeof(long)))))	\
 		= { __setup_str_##unique_id, fn, early }
 
 #define __setup_null_param(str, unique_id)			\

_


  parent reply	other threads:[~2004-06-28 23:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-28 21:34 __setup()'s not processed in bk-current Ricky Beam
2004-06-28 23:29 ` Ricky Beam
2004-06-28 23:57 ` Andrew Morton [this message]
2004-06-29  2:43   ` Rusty Russell
2004-06-29  4:40     ` Richard Henderson

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=20040628165707.328cce15.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=ak@muc.de \
    --cc=jfbeam@bluetronic.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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