public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [procfs] Questions regarding proc_mkdir, proc_create, and possible bugs there.
@ 2002-11-14 16:28 Serge Kuznetsov
  0 siblings, 0 replies; only message in thread
From: Serge Kuznetsov @ 2002-11-14 16:28 UTC (permalink / raw)
  To: linux-kernel

Hi guys,

I've got a headache when I trying to understand why it's a common practice to use calls for proc_mkdir, like that:

proc_mkdir ( "drivers/superdriver", 0 ); ?

In proc_mkdir it unwraps to 

 ent = proc_create ( &0, &"drivers/superdriver", (S_IFDIR | S_IRUGO | S_IXUGO),2);

and in proc_create it works like:

 /* skip some code */

        if (!(*(&0)) && xlate_proc_name(name, &0, &fn) != 0)                         
                goto out;                                                                  

/* skip the rest */
 
I can understand what by address 0x00000000 ( in kernel space ) it suppose to be some value ( GIDT[0] if I am not wrong ), but it's quite dangerous to use this practice.

Correct me if I am wrong.

PS: In xlate_proc_entry parent is not being checks for NULL but just stores the result, and it can happen SEGFAULT there. 

PPS: BTW, I tested my module, and maid insmod/rmmod every time, I found when module_init called mkdir_every time I do insmod, in /proc dir created the new duplicate subdir with absolutely the same name, and it grows when I do insmod/rmmod but forget to call remove_proc_entry. I think the issue in xlate_proc_name and NULL pointer.

PPPS: Now I am testing the patch for it.


All the Best!
Serge.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-14 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-14 16:28 [procfs] Questions regarding proc_mkdir, proc_create, and possible bugs there Serge Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox