Re: [PATCH v5 12/37] lib: prevent module unloading if memory is not freed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 06, 2024 at 10:24:10AM -0800, Suren Baghdasaryan wrote:
> Skip freeing module's data section if there are non-zero allocation tags
> because otherwise, once these allocations are freed, the access to their
> code tag would cause UAF.

So you just let them linger?

> Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>


>  /* Free a module, remove from lists, etc. */
>  static void free_module(struct module *mod)
>  {
> +	bool unload_codetags;
> +
>  	trace_module_free(mod);
>  
> -	codetag_unload_module(mod);
> +	unload_codetags = codetag_unload_module(mod);
> +	if (!unload_codetags)
> +		pr_warn("%s: memory allocation(s) from the module still alive, cannot unload cleanly\n",
> +			mod->name);
> +

Because this is not unwinding anything. Should'd we check if we can
free all tags first, if we can't then we can't free the module. If we
can then ensure we don't enter a state where we can't later?

  Luis




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux