Bug 11078 - avoid procfs race condition
Summary: avoid procfs race condition
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-10 17:07 UTC by David Smith
Modified: 2010-03-23 21:16 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2009-12-10 17:07:40 UTC
Using create_proc_entry() + ->proc_fops assignment is racy because
->proc_fops will be NULL for some time.  To avoid this, we need to use
proc_create().

This would change something like:

        struct proc_dir_entry *entry;
 
        entry = create_proc_entry("foo", 0, NULL);
        if (entry)
                entry->proc_fops = &file_ops;

To something like:

        struct proc_dir_entry *entry;
        entry = proc_create("foo", 0, NULL, &file_ops);

This will require re-architecting the _stp_create_procfs() runtime function (in
runtime/procfs.c) a bit to take a fops argument.
Comment 1 David Smith 2010-02-03 17:57:52 UTC
Fixed in commit 23b7dbf.