Re: [PATCH RFC 02/16] proc: add pde_pin() and pde_unpin()

From: Alexey Dobriyan

Date: Wed Nov 04 2026 - 14:24:06 EST


> +/* Pin an entry that can go away around a call into it, see use_pde(). */
> +static bool pde_pin(struct proc_dir_entry *pde)
> +{
> + return pde_is_permanent(pde) || use_pde(pde);
> +}
> +
> +static void pde_unpin(struct proc_dir_entry *pde)
> +{
> + if (!pde_is_permanent(pde))
> + unuse_pde(pde);
> +}

Oh, I didn't sent this before because of theoretical bug.

If someone uses permanent bug by mistake or because of misguided
perfomance optimization...

Permanent flags is set after publishing PDE to the world,
so there is a window where +1 is done but -1 is not done.

And then 2147483647 security researchers arrive and overflow it.

There is no detection of buggy usage: proc_make_permanent on dynamic
PDEs from buggy modules. It's easy to grep but I'm not signing up for
that.

/proc/alexey