Accessing kernel memory from multiple modules

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

 



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

Can anyone explain why is this. In first case, why is system freezing ?

Thanks

--
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