mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* genksyms crashes on drivers/char/joystick/pcigame.c
@ 2003-04-01 15:19 Adam Lackorzynski
  2003-04-02 11:17 ` Keith Owens
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Lackorzynski @ 2003-04-01 15:19 UTC (permalink / raw)
  To: linux-kernel

Hi,

when genksyms is used on drivers/char/joystick/pcigame.c during "make
dep" it segfaults. There isn't any joystick configuration in the kernel
(it's a plain "make oldconfig" from a fresh kernel copy).

/tmp/linux-2.4.20/drivers/char/joystick$ gcc -Wall -O2 -I/tmp/linux-2.4.20/include  -E -D__GENKSYMS__ pcigame.c| genksyms -p smp_ -k 2.4.20
Segmentation fault

$ genksyms -V       
genksyms version 2.4.25
...

It looks like the segfault is caused by the following line from the gcc
output above:

struct pcigame *((void *)0)
{
        struct pcigame *pcigame;
        int i;


which evaluates from

struct pcigame *pcigame_attach(struct pci_dev *dev, int type)
{
        struct pcigame *pcigame;
        int i;


pcigame_attach(a,b) is defined to NULL in include/linux/pci_gameport.h if
CONFIG_INPUT_PCIGAME{,_MODULE} isn't set (which is the case here).
Fixing this line makes genksyms work. Don't know who's at fault here but
segfaulting doesn't look good...




Adam
-- 
Adam                 adam@os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: genksyms crashes on drivers/char/joystick/pcigame.c
  2003-04-01 15:19 genksyms crashes on drivers/char/joystick/pcigame.c Adam Lackorzynski
@ 2003-04-02 11:17 ` Keith Owens
  2003-04-02 12:15   ` Adam Lackorzynski
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Owens @ 2003-04-02 11:17 UTC (permalink / raw)
  To: Adam Lackorzynski; +Cc: linux-kernel

On Tue, 1 Apr 2003 17:19:18 +0200, 
Adam Lackorzynski <adam@os.inf.tu-dresden.de> wrote:
>when genksyms is used on drivers/char/joystick/pcigame.c during "make
>dep" it segfaults.

genksyms assumes and requires valid C code as input.  genksyms does not
attempt to validate the source, that is the job of gcc.  If gcc barfs
on the code, then do not attempt to run it through genksyms.  This
looks like a chicken and egg problem but is not, compile with
MODVERSIONS=n to verify that new code is valid before building with
MODVERSIONS=y.  To put it another way, do not run modversions on test
kernels.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: genksyms crashes on drivers/char/joystick/pcigame.c
  2003-04-02 11:17 ` Keith Owens
@ 2003-04-02 12:15   ` Adam Lackorzynski
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Lackorzynski @ 2003-04-02 12:15 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Wed Apr 02, 2003 at 21:17:11 +1000, Keith Owens wrote:
> On Tue, 1 Apr 2003 17:19:18 +0200, 
> Adam Lackorzynski <adam@os.inf.tu-dresden.de> wrote:
> >when genksyms is used on drivers/char/joystick/pcigame.c during "make
> >dep" it segfaults.
> 
> genksyms assumes and requires valid C code as input.  genksyms does not
> attempt to validate the source, that is the job of gcc.  If gcc barfs
> on the code, then do not attempt to run it through genksyms.  This
> looks like a chicken and egg problem but is not, compile with
> MODVERSIONS=n to verify that new code is valid before building with
> MODVERSIONS=y.  To put it another way, do not run modversions on test
> kernels.

I don't understand a vanilla 2.4.20 kernel as a "test kernel". This
segfault happens everytime a "make dep" with modversions and without
these joystick options is done and that's probably not too uncommon.
There's just no error message indicating that it's faulting.
Changing include/linux/pci_gameport.h prevents genksyms from segfaulting and
produces output, I'm not sure if this has other side effects.


For 2.4.20:
--- include/linux/pci_gameport.h.orig   2003-04-02 14:00:46.000000000 +0200
+++ include/linux/pci_gameport.h        2003-04-02 14:02:01.000000000 +0200
@@ -31,9 +31,6 @@
 #if defined(CONFIG_INPUT_PCIGAME) || defined(CONFIG_INPUT_PCIGAME_MODULE)
 extern struct pcigame *pcigame_attach(struct pci_dev *dev, int type);
 extern void pcigame_detach(struct pcigame *game);
-#else
-#define pcigame_attach(a,b)    NULL
-#define pcigame_detach(a)
 #endif
 
 #endif





Adam
-- 
Adam                 adam@os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-02 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-01 15:19 genksyms crashes on drivers/char/joystick/pcigame.c Adam Lackorzynski
2003-04-02 11:17 ` Keith Owens
2003-04-02 12:15   ` Adam Lackorzynski

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®