Re: [RFC 00/12] module: avoid userspace pressure on unwanted allocations

From: Linus Torvalds
Date: Fri Mar 24 2023 - 15:11:31 EST


On Fri, Mar 24, 2023 at 10:54 AM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
>
> +/*
> + * This clutch ensures we only allow a certain number concurrent threads at a

kludge, not clutch.

And it's much worse than a kludge. It's just wrong and disgusting.

> + pr_warn_ratelimited("kread_concurrent_max (%u) close to 0 (max_loads: %u), throttling...",
> + atomic_read(&kread_concurrent_max),
> + MAX_KREAD_CONCURRENT);

This is also wrong, since it's not kernel_read_file() that is the
problem, but whatever broken caller.

Yeah, yeah, in practice it's presumably always just finit_module()
doing kernel_read_file_from_fd(), but it's still *completely* wrong to
just say "function X is throttling" when "X" isn't the problem, and
doesn't tell what the _real_ problem is.

I really think this all needs some core fixing at the module layer,
not these kinds of horrific hacks.

Linus