Skip to content

RFC module: avoid userspace pressure on unwanted allocations

Luis Chamberlain linux-modules lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest12 patches 32 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12module: use goto errors on check_modinfo() and layout_and_allocate()kernel/module/main.c+8 -40 replies
2/12module: move get_modinfo() helpers all abovekernel/module/main.c+48 -520 replies
3/12module: rename next_string() to module_next_tag_pair()kernel/module/internal.h kernel/module/main.c+5 -30 replies
4/12module: add a for_each_modinfo_entry()kernel/module/internal.h kernel/module/main.c+4 -40 replies
5/12module: add debugging alias parsing supportinclude/linux/module.h kernel/module/Kconfig kernel/module/Makefile +3 more+145 -30 replies
6/12module: move early sanity checks into a helperkernel/module/main.c+26 -170 replies
7/12module: move check_modinfo() early to early_mod_check()kernel/module/main.c+5 -50 replies
8/12module: move finished_loading()kernel/module/main.c+21 -210 replies
9/12module: extract patient module check into helperkernel/module/main.c+40 -310 replies
10/12module: avoid allocation if module is already present and readykernel/module/main.c+4 -00 replies
11/12module: use list_add_tail_rcu() when adding modulekernel/module/main.c+1 -10 replies
12/12module: use aliases to find module on find_module_all()kernel/module/aliases.c kernel/module/internal.h kernel/module/main.c+45 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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/[email protected]/

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
Signature · 1 line
2.39.1