A long time ago we had some issues with userspace doing stupid stuff. Well, it turns out even the kernel and do stupid stuff too, as we're learning with the ACPI modules aliaes and that hammering tons of loads. So add a bit of code which gets us a bit more in the defensive about these situations. To experiment, this also adds in-kernel alias support to see if this helps with some larger systems. This is all based on some old code which tried to add defensive mechanisms the last of which was here and I had dropped the ball: https://lore.kernel.org/all/20171208001540.23696-1-mcgrof@xxxxxxxxxx/ I've only compile tested this for now. Will need to stress to test with kmod tests 0008 and 0009 to see if there's any differences. I'll have to re-test and re-gnuplot stuff there. But early feedback is appreciated, hence the RFC. David Hildenbrand had reported a while ago issues with userspace doing insane things with allocations bringing a system down to its knees. This is part of the motivation for this series. I repeat, I only have compiled tested this so far. A few Suggested-by there linger since Linus had suggested a few of these ideas a long time ago and we just never picked them up. Luis Chamberlain (12): module: use goto errors on check_modinfo() and layout_and_allocate() module: move get_modinfo() helpers all above module: rename next_string() to module_next_tag_pair() module: add a for_each_modinfo_entry() module: add debugging alias parsing support module: move early sanity checks into a helper module: move check_modinfo() early to early_mod_check() module: move finished_loading() module: extract patient module check into helper module: avoid allocation if module is already present and ready module: use list_add_tail_rcu() when adding module module: use aliases to find module on find_module_all() include/linux/module.h | 4 + kernel/module/Kconfig | 19 +++ kernel/module/Makefile | 1 + kernel/module/aliases.c | 109 +++++++++++++ kernel/module/internal.h | 25 +++ kernel/module/main.c | 324 +++++++++++++++++++++++---------------- 6 files changed, 346 insertions(+), 136 deletions(-) create mode 100644 kernel/module/aliases.c -- 2.39.1