From: Bernd Jendrissek <berndj@prism.co.za>
To: Kendrick Hamilton <hamilton@sedsystems.ca>
Cc: gcc@gcc.gnu.org, linux-kernel@vger.kernel.org
Subject: Re: Problem Installing Linux Kernel Module compiled with gcc-3.2.x
Date: Fri, 30 May 2003 19:22:40 +0200 [thread overview]
Message-ID: <20030530192240.A7564@prism.co.za> (raw)
In-Reply-To: <Pine.LNX.4.44.0305300919510.3613-100000@sw-55.sedsystems.ca>
Not *exactly* on-topic for gcc@gcc.gnu.org I suppose, but here goes.
[Cc'ed to linux-kernel@vger.kernel.org]
On Fri, May 30, 2003 at 09:26:51AM -0600, Kendrick Hamilton wrote:
> I have a module for a custom developped PCI card. The device
> driver is written for the Linux 2.4 series kernels. When I build the
> module and the Linux kernel with gcc-2.95.3, the module installs
> correctly. When I build the module and the Linux kernel with gcc-3.2.3
> (also other gcc-3.2.x), the module installs but the Linux kernel crashes
> in random places outside of the module. Do you have any suggestions of
> what to look for? I can email you the complete module source code. I have
> not tried gcc-3.3 because I cannot compile the current Linux kernel with
> it (there is a known bug that is being fixed and should be out in
> Linux-2.4.21).
Been there, done that, got the T-shirt. I was lucky: while my module
installed, it broke in a fairly harmless way. (It just didn't work; it
didn't screw with my system.)
If you look at linux/include/linux/spinlock.h, you'll see:
/*
* Your basic spinlocks, allowing only a single CPU anywhere
*
* Most gcc versions have a nasty bug with empty initializers.
*/
#if (__GNUC__ > 2)
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
#else
typedef struct { int gcc_is_buggy; } spinlock_t;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
#endif
There are a couple of spinlock_t's (directly or through other structs) in
the task_struct. So when your module accesses parts of the "current"
task_struct beyond the first spinlock_t, you better hope it's reading and
not writing (which was the case with my module).
I bet your module modifies "current".
Hmm, actually I thought the kernel had a mechanism to prevent a GCC 3.x
module from being loaded into a GCC 2.x kernel and vice versa?
next parent reply other threads:[~2003-05-30 17:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44.0305300919510.3613-100000@sw-55.sedsystems.ca>
2003-05-30 17:22 ` Bernd Jendrissek [this message]
2003-05-30 17:31 ` Problem Installing Linux Kernel Module compiled with gcc-3.2.x Kendrick Hamilton
2003-05-30 18:02 ` Bernd Jendrissek
2003-05-30 17:33 ` Joe Buck
2003-05-30 18:43 ` Bernd Jendrissek
2003-05-30 19:02 ` Joe Buck
2003-05-30 19:36 ` Alan Cox
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=20030530192240.A7564@prism.co.za \
--to=berndj@prism.co.za \
--cc=gcc@gcc.gnu.org \
--cc=hamilton@sedsystems.ca \
--cc=linux-kernel@vger.kernel.org \
/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