--- On Fri, 6/25/10, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote: > From: Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> > Subject: Re: Accessing kernel memory from multiple modules > To: "Usman S. Ansari" <uansari@xxxxxxxxx> > Cc: "Linux Kernel List" <kernelnewbies@xxxxxxxxxxxx> > Date: Friday, June 25, 2010, 9:01 PM > Dear Usman... > > Sorry if I can't give complete explanation, but hopefully > it's enough... > > On Sat, Jun 26, 2010 at 02:31, Usman S. Ansari <uansari@xxxxxxxxx> > wrote: > > I have two kernel modules running. > > > > Module 1: > > - struct a > > { > > int val1; > > char *buffer > > ... > > }; > > > > - Then in module 1, I have following global > declaration > > struct a buf[20]; > > > > - Module 1, calls a exported function > "module2_function(int *)" from modules 2: > > it passes &buff[0].val1 as a parameter to the > module2_functon > > > > Module 2: > > - I assign buff[0].val1 to variable defined as *i > > - I print *i, and see same data which was assigned by > module 1, i.e. 0x9595 > > - Have following instruction > > - *i = 1; > > - print *i again and new values i.e. 1 is printed > > - after this in less than a second whole freezes > > > > After debugging for whole day, I tried following, > which seems to fix this issue > > - I changed struct a buf[20]; to kmalloc > > - now system does not freez > > If my eyes doesn't trick me, initially it's both uninitialized and > unallocated. Are we agree here? No. This array to struct is defined as a global in module # 1, where is it accessed (read and written). Issue comes in when I pass pointer to module # 2 and it is written to (read is OK). > So then, when you gave it a value, kernel tries to store > it, but realized the "container" isn't prepared. Unfortunately, > kernels doesn't do page fault the same way we see in user space. Don't understand what you are saying. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ