[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] BusyBox insmod problem. Global variables badly initialized.
From:       Goddeeris Frederic <Frederic.Goddeeris () siemens ! atea ! be>
Date:       2002-03-28 1:28:05
[Download RAW message or body]

Hi,

I have been struggling with global variables that are not always correctly
initialized in kernel modules and have been posting reports to ppclinux-dev
about this.

Somebody reported that he had seen the same issue while somebody else
reported he could not reproduce the problem. Today I discovered that when I
use the original insmod instead of the insmod in Busybox the issue seems
solved...

This is the modules I used for testing:

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

char MyMemSpace[2*0x100];
char *MemPointers[2] = {&(MyMemSpace[0]), &(MyMemSpace[0x100])};

typedef struct
{
	char *szName;
	char *szName2;
} MyStruct_t;

MyStruct_t MyStruct[] = {{"A", "A2"}, {"B", "B2"}};

int init_module(void)
{
	printk("TestDriver 3 Loaded\n");

	printk("MyMemSpace: 0x%lx 0x%lx \n",  (long)&(MyMemSpace[0]),
	       (long)&(MyMemSpace[0x100]));
	printk("MemPointers: 0x%lx 0x%lx \n", (long)(MemPointers[0]),
	       (long)(MemPointers[1]));

	printk("First Char is MyStruct[0].szName %c\n",
	       MyStruct[0].szName[0]);


	return -1;
}

void cleanup_module(void)
{
	return;
}

With insmod of busybox I get:
	MyMemSpace: 0xc304a1ec 0xc304a2ec
	MemPointers: 0xc304a1ec 0xc304a3ec
	First Char is MyStruct[0].szName e 

With the regular insmod I get:
	MyMemSpace: 0xc304226c 0xc304236c
	MemPointers: 0xc304226c 0xc304236c
	First Char is MyStruct[0].szName A

I use HHL2.0 (2.4.2), gcc 2.95.3, Busybox 0.60.2

Can somebody help me solving this issue?

Thanks,
Frederic 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic