Fwd: learning proc read write

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

 



FYI. plz CMIIW.

---------- Forwarded message ----------
From: Manoj Awasthi <lkml.manoj@xxxxxxxxx>
Date: २००६ अगस्त ११ २३:५९
Subject: Re: learning proc read write
To: Keppler Alecrim <alecrim@xxxxxxxxx>

Hi Keppler,
 
problem seems like some memory corruption ! see some comments inline. since I too am new to kernel and this group so CMIIW.
 
I was writing a new comand line when the error happened
 
[42949478.160000] Kernel panic - not syncing: Kernel mode fault at addr 0x61202d68, ip 0x400ab0b8
[42949478.160000 ]  [42949478.160000]
 
addr 0x61202d68 does not seem like a kernel address. right ? ( < 3GB)
 
+    out=kmalloc(200,GFP_KERNEL);
 
are you sure about 200 bytes of memory ? is it all that you need ? I don't think so.
 
+    item=kmalloc(20,GFP_KERNEL);
+    strcpy(out,"");
+    for_each_process(p)//pointer p will run for all process
+    {
+         if(c->uid == p->uid)//some uid = user identifier
+         {
+            sprintf(item,"< %d , %s  >\n",p->pid,p->comm);//store on task identifier and name on item
+            strcat(out,item); //acumulate item to out
 
here you will die ! since you did not check for memory so an overflow will take place.

+         }
Thanks

--
 
--
Francisco Keppler Silva Alecrim
Instituto Nokia de Tecnologia (INdT) - OSMRC


--
--
Francisco Keppler Silva Alecrim
Instituto Nokia de Tecnologia (INdT) - OSMRC

[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