From: Kronos <kronos@kronoz.cjb.net>
To: Philippe Elie <phil.el@wanadoo.fr>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: [Compile Regression in 2.4.25-pre8][PATCH 37/42]
Date: Wed, 4 Feb 2004 21:22:05 +0100 [thread overview]
Message-ID: <20040204202205.GA1717@dreamland.darkstar.lan> (raw)
In-Reply-To: <20040203231421.GC10009@zaniah>
Il Tue, Feb 03, 2004 at 11:14:21PM +0000, Philippe Elie ha scritto:
> > diff -Nru -X dontdiff linux-2.4-vanilla/include/asm-i386/page.h linux-2.4/include/asm-i386/page.h
> > --- linux-2.4-vanilla/include/asm-i386/page.h Tue Nov 11 18:05:52 2003
> > +++ linux-2.4/include/asm-i386/page.h Tue Feb 3 07:26:04 2004
> > @@ -10,6 +10,7 @@
> > #ifndef __ASSEMBLY__
> >
> > #include <linux/config.h>
> > +#include <linux/compiler.h>
> >
> > #ifdef CONFIG_X86_USE_3DNOW
> >
> > @@ -94,6 +95,26 @@
> > * The offending file and line are encoded after the "officially
> > * undefined" opcode for parsing in the trap handler.
> > */
> > +#ifdef __bug
> > +#if 1 /* Set to zero for a slightly smaller kernel */
> > +__bug void __bugfn(void) {
> > + while(1) {
> > + __asm__ __volatile__( "ud2\n"
> > + "\t.word %c0\n"
> > + "\t.long %c1\n"
> > + : : "i" (__LINE__), "i" (__FILE__));
> > + }
> > +}
>
> You must pass __LINE__ and __FILE__ as parameter to this function.
Good point. It's not that easy though ;)
BUG() places file name and line number after the invalid opcode (ud2) and
the kernel trap handler decodes these information when printing a BUG().
In order to do that you need immediate values to pass to assembler.
I think that the following patch will work. This is a BUG() from a dummy module
which calls BUG() in the init function:
kernel BUG at /tmp/mod3.c:22!
invalid operand: 0000 [#3]
CPU: 0
EIP: 0060:[<e09ed003>] Tainted: PF
EFLAGS: 00010202
EIP is at modinit+0x3/0x20 [mod3]
eax: e09ed000 ebx: cdf9a000 ecx: c036de78 edx: 00000000
esi: e09ed180 edi: c036de78 ebp: cdf9bfa4 esp: cdf9bfa4
ds: 007b es: 007b ss: 0068
Process insmod (pid: 1960, threadinfo=cdf9a000 task=dd7546b0)
Stack: cdf9bfbc c01345d8 0804b018 080486dd 4009199b c036de5c cdf9a000 c0109067
0804b018 0000055c 0804b008 080486dd 4009199b bffffb28 00000080 0000007b
0000007b 00000080 400fb4ce 00000073 00000246 bffffae0 0000007b
Call Trace:
[<c01345d8>] sys_init_module+0x118/0x240
[<c0109067>] syscall_call+0x7/0xb
Code: 0f 0b 16 00 25 d0 9e e0 90 8d 74 26 00 eb fe 8d b4 26 00 00
Segmentation fault
It seems ok to me (kernel is tainted because I forgot MODULE_LICENSE...).
Comments on the patch?
diff -Nru -X dontdiff linux-2.4-vanilla/include/asm-i386/page.h linux-2.4/include/asm-i386/page.h
--- linux-2.4-vanilla/include/asm-i386/page.h Tue Nov 11 18:05:52 2003
+++ linux-2.4/include/asm-i386/page.h Wed Feb 4 14:43:00 2004
@@ -95,14 +95,28 @@
* undefined" opcode for parsing in the trap handler.
*/
+#ifdef __bug
+static inline void __dummy_noreturn(void) __bug;
+static inline void __dummy_noreturn(void) {
+ while(1) {}
+}
+#else
+#define __dummy_noreturn() do {} while(0)
+#endif
+
#if 1 /* Set to zero for a slightly smaller kernel */
-#define BUG() \
- __asm__ __volatile__( "ud2\n" \
- "\t.word %c0\n" \
- "\t.long %c1\n" \
- : : "i" (__LINE__), "i" (__FILE__))
+#define BUG() do { \
+ __asm__ __volatile__( "ud2\n" \
+ "\t.word %c0\n" \
+ "\t.long %c1\n" \
+ : : "i" (__LINE__), "i" (__FILE__)); \
+ __dummy_noreturn(); \
+ } while(0)
#else
-#define BUG() __asm__ __volatile__("ud2\n")
+#define BUG() do { \
+ __asm__ __volatile__("ud2\n"); \
+ __dummy_noreturn(); \
+ } while(0)
#endif
#define PAGE_BUG(page) do { \
diff -Nru -X dontdiff linux-2.4-vanilla/include/linux/compiler.h linux-2.4/include/linux/compiler.h
--- linux-2.4-vanilla/include/linux/compiler.h Tue Sep 18 23:12:45 2001
+++ linux-2.4/include/linux/compiler.h Tue Feb 3 18:29:56 2004
@@ -13,4 +13,11 @@
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
+#if __GNUC__ >= 3
+/* __noreturn__ is implemented since gcc 2.5.
+ * __always_inline__ is not present in 2.9x
+ */
+#define __bug __attribute__((__noreturn__, __always_inline__))
+#endif
+
#endif /* __LINUX_COMPILER_H */
Luca
--
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
"L'ottimista pensa che questo sia il migliore dei mondi possibili.
Il pessimista sa che e` vero" -- J. Robert Oppenheimer
next prev parent reply other threads:[~2004-02-04 20:24 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-30 18:15 [Compile Regression] 2.4.25-pre8: 126 warnings 0 errors Xose Vazquez Perez
2004-01-30 18:40 ` Xose Vazquez Perez
2004-01-30 19:11 ` Marcelo Tosatti
2004-01-30 20:49 ` Kronos
[not found] ` <Pine.LNX.4.58L.0401301855410.3140@logos.cnet>
2004-02-02 18:09 ` Kronos
2004-02-02 18:19 ` [Compile Regression in 2.4.25-pre8][PATCH 1/42] Kronos
2004-02-02 18:20 ` [Compile Regression in 2.4.25-pre8][PATCH 2/42] Kronos
2004-02-02 18:21 ` [Compile Regression in 2.4.25-pre8][PATCH 3/42] Kronos
2004-02-02 18:21 ` [Compile Regression in 2.4.25-pre8][PATCH 4/42] Kronos
2004-02-02 18:26 ` [Compile Regression in 2.4.25-pre8][PATCH 5/42] Kronos
2004-02-02 18:43 ` [Compile Regression in 2.4.25-pre8][PATCH 6/42] Kronos
2004-02-02 19:42 ` [Compile Regression in 2.4.25-pre8][PATCH 7/42] Kronos
2004-02-02 19:42 ` [Compile Regression in 2.4.25-pre8][PATCH 8/42] Kronos
2004-02-02 19:43 ` [Compile Regression in 2.4.25-pre8][PATCH 9/42] Kronos
2004-02-02 19:44 ` [Compile Regression in 2.4.25-pre8][PATCH 10/42] Kronos
2004-02-02 19:44 ` [Compile Regression in 2.4.25-pre8][PATCH 11/42] Kronos
2004-02-02 21:25 ` Richard B. Johnson
2004-02-03 21:04 ` Kronos
2004-02-04 12:27 ` Richard B. Johnson
2004-02-02 19:45 ` [Compile Regression in 2.4.25-pre8][PATCH 12/42] Kronos
2004-02-02 19:45 ` [Compile Regression in 2.4.25-pre8][PATCH 13/42] Kronos
2004-02-02 19:46 ` [Compile Regression in 2.4.25-pre8][PATCH 14/42] Kronos
2004-02-02 19:46 ` [Compile Regression in 2.4.25-pre8][PATCH 15/42] Kronos
2004-02-04 16:46 ` Marcelo Tosatti
2004-02-04 20:19 ` Kronos
2004-02-02 19:46 ` [Compile Regression in 2.4.25-pre8][PATCH 16/42] Kronos
2004-02-02 21:51 ` Marcelo Tosatti
2004-02-02 19:47 ` [Compile Regression in 2.4.25-pre8][PATCH 17/42] Kronos
2004-02-02 19:47 ` [Compile Regression in 2.4.25-pre8][PATCH 18/42] Kronos
2004-02-02 19:48 ` [Compile Regression in 2.4.25-pre8][PATCH 19/42] Kronos
2004-02-02 19:48 ` [Compile Regression in 2.4.25-pre8][PATCH 20/42] Kronos
2004-02-02 19:48 ` [Compile Regression in 2.4.25-pre8][PATCH 21/42] Kronos
2004-02-02 19:56 ` [Compile Regression in 2.4.25-pre8][PATCH 22/42] Kronos
2004-02-02 19:57 ` [Compile Regression in 2.4.25-pre8][PATCH 23/42] Kronos
2004-02-02 19:57 ` [Compile Regression in 2.4.25-pre8][PATCH 24/42] Kronos
2004-02-02 19:57 ` [Compile Regression in 2.4.25-pre8][PATCH 25/42] Kronos
2004-02-02 19:58 ` [Compile Regression in 2.4.25-pre8][PATCH 26/42] Kronos
2004-02-02 19:58 ` [Compile Regression in 2.4.25-pre8][PATCH 27/42] Kronos
2004-02-02 19:58 ` [Compile Regression in 2.4.25-pre8][PATCH 28/42] Kronos
2004-02-02 19:58 ` [Compile Regression in 2.4.25-pre8][PATCH 29/42] Kronos
2004-02-02 19:59 ` [Compile Regression in 2.4.25-pre8][PATCH 30/42] Kronos
2004-02-02 20:00 ` [Compile Regression in 2.4.25-pre8][PATCH 31/42] Kronos
2004-02-02 20:01 ` [Compile Regression in 2.4.25-pre8][PATCH 32/42] Kronos
2004-02-02 20:01 ` [Compile Regression in 2.4.25-pre8][PATCH 33/42] Kronos
2004-02-02 20:02 ` [Compile Regression in 2.4.25-pre8][PATCH 34/42] Kronos
2004-02-02 20:03 ` [Compile Regression in 2.4.25-pre8][PATCH 35/42] Kronos
2004-02-02 20:03 ` [Compile Regression in 2.4.25-pre8][PATCH 36/42] Kronos
2004-02-02 20:03 ` [Compile Regression in 2.4.25-pre8][PATCH 37/42] Kronos
2004-02-02 21:08 ` Geert Uytterhoeven
2004-02-02 21:25 ` Kronos
2004-02-03 21:07 ` Kronos
2004-02-03 23:14 ` Philippe Elie
2004-02-04 20:22 ` Kronos [this message]
2004-02-02 20:04 ` [Compile Regression in 2.4.25-pre8][PATCH 38/42] Kronos
2004-02-02 20:04 ` [Compile Regression in 2.4.25-pre8][PATCH 39/42] Kronos
2004-02-02 20:05 ` [Compile Regression in 2.4.25-pre8][PATCH 40/42] Kronos
2004-02-02 20:05 ` [Compile Regression in 2.4.25-pre8][PATCH 41/42] Kronos
2004-02-02 20:06 ` [Compile Regression in 2.4.25-pre8][PATCH 42/42] Kronos
2004-01-30 22:18 ` [Compile Regression] 2.4.25-pre8: 126 warnings 0 errors Nathan Scott
2004-02-08 0:12 [Compile Regression in 2.4.25-pre8][PATCH 37/42] Jon Foster
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=20040204202205.GA1717@dreamland.darkstar.lan \
--to=kronos@kronoz.cjb.net \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=phil.el@wanadoo.fr \
/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
all inboxes | Powered by JetHome®