Re: Accessing kernel memory from multiple modules

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

 



2010/6/26 Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx>:
> 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?

it's allocated statically no? so in the stack of module 1...
maybe i'm wrong, there is no stack for module, of couse, maybe it's global?
i'm really curious about this

cya
-- 
noone is alone.

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