Re: Accessing kernel memory from multiple modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

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.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux