public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Serge Kuznetsov" <sk@deeptown.org>
To: <linux-kernel@vger.kernel.org>
Subject: [procfs] Questions regarding proc_mkdir, proc_create, and possible bugs there.
Date: Thu, 14 Nov 2002 11:28:19 -0500	[thread overview]
Message-ID: <010401c28bfa$d805d160$34c096cd@toybox> (raw)

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.

                 reply	other threads:[~2002-11-14 16:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='010401c28bfa$d805d160$34c096cd@toybox' \
    --to=sk@deeptown.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox