On Tue, Apr 1, 2025 at 1:14 PM Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote: > > > +void proc_make_permanent(struct proc_dir_entry *de) > > +{ > > + pde_make_permanent(de); > > +} > > +EXPORT_SYMBOL(proc_make_permanent); > > no, no, no, no > > this is wrong! > > marking should be done in the context of a module! > > the reason it is not exported is because the aren't safeguards against > module misuse > > the flag is supposed to be used in case where > a) PDE itself is never removed and, > b) all the code supporting is never removed, > so that locking can be skipped > > this it fine to mark /proc/filesystems because kernel controls it > > this is fine to mark /proc/aaa if all module does is to write some > info to it and deletes it during rmmod > > but it is not fine to mark /proc/aaa/bbb if "bbb" is created/deleted > while module is running, > locking _must_ be done in this case Well I'm unhappy to begin with, but did not want to do anything churn-inducing. The above looks like a minimal solution to me. The pde_ marking things are in an internal header and I did not want to move them around. If anything I'm surprised there is no mechanism to get this done (I assumed there would be a passable flags argument, but got nothing). What I need here is that /proc/filesystems thing sorted out, as in this call: > proc_create_single("filesystems", 0, NULL, filesystems_proc_show); Would you be ok with adding proc_create_single_permanent() which hides the logic and is not exported to modules? -- Mateusz Guzik <mjguzik gmail.com>