|
|
Log in / Subscribe / Register

Restricting automatic kernel-module loading

Restricting automatic kernel-module loading

Posted Dec 4, 2017 21:42 UTC (Mon) by neilbrown (subscriber, #359)
Parent article: Restricting automatic kernel-module loading

> If this knob is set to zero (the default), autoloading works as it does in current kernels. Setting it to one restricts autoloading to processes with specific capabilities: processes with CAP_SYS_MODULE can cause any module to be loaded, while those with CAP_NET_ADMIN can autoload any module whose alias starts with netdev-. Setting this knob to two disables autoloading entirely. Once this value has been raised above zero, it cannot be lowered during the lifetime of the system.

One day we developers will grow up and understand that "always", "by-capability", and "never" are more human-readable than "0", "1", and "2".
Today, it seems, is not that day.


to post comments

Restricting automatic kernel-module loading

Posted Dec 4, 2017 22:03 UTC (Mon) by nix (subscriber, #2304) [Link] (5 responses)

It's also more extensible. Sure, 0 1 and 2 are nicely ordered, with more capability towards the 0 end -- but what if you want to add more layers in the middle? They'd have to get stuck up around 3, 4, 5 etc (to avoid breaking systems using the existing values), breaking the ordering and rendering it strictly worse in all respects than using readable strings. (Sure, those strings are only readable to English-speakers, but *anything* is better than simple numbers. Well, almost anything. Three random UUIDs would be worse. Oh god someone's going to do that now I just know it. echo efc2654e-5890-47dd-95e7-87de662a2acb into this file to enable and 566a274d-bb12-4735-8400-1a2637b0a922 to disable! augh)

Restricting automatic kernel-module loading

Posted Dec 5, 2017 3:21 UTC (Tue) by sorokin (guest, #88478) [Link] (1 responses)

Remembering my BASIC days, may I suggest using 10, 20 and 30 instead?

Restricting automatic kernel-module loading

Posted Dec 7, 2017 19:22 UTC (Thu) by jospoortvliet (guest, #33164) [Link]

Exactly! Simple and effective... doesn't solve all problems but that was what GOTO was for!

Restricting automatic kernel-module loading

Posted Dec 5, 2017 11:21 UTC (Tue) by ballombe (subscriber, #9523) [Link] (2 responses)

On the other hand, It is far easier to remember "1" than how to spell "by-capability".

Restricting automatic kernel-module loading

Posted Dec 5, 2017 12:00 UTC (Tue) by hrw (subscriber, #44826) [Link]

root@krzys:/sys/devices/platform/ar934x_wmac/leds/ath9k-phy0# cat trigger
none nand-disk switch0 timer default-on netdev usbport phy0rx phy0tx phy0assoc phy0radio [phy0tpt] phy1rx phy1tx phy1assoc phy1radio phy1tpt

$ cat the-switch-controlling-autoload-of-modules
always [by-capability] never

Doable?

Restricting automatic kernel-module loading

Posted Dec 6, 2017 13:59 UTC (Wed) by nix (subscriber, #2304) [Link]

It's far easier to remember how to spell '1', yes, but its meaning is entirely implicit and context-dependent. In practice you're going to have to look it up every time you use it, since this is not a flag you're likely to flip often. Meanwhile, textual strings are self-describing.

(Imagine this with the block layer. It's easy to flip to the deadline scheduler, just echo 1 > /sys/block/$foo/queue/scheduler! The default, cfq, is 3, of course, because it happened to be the third scheduler added. The second scheduler was removed long ago, so 2 is not valid any more, until of course someone adds another scheduler, when 2 is apt to get randomly picked up by that instead...)

Restricting automatic kernel-module loading

Posted Dec 5, 2017 6:15 UTC (Tue) by tixxdz (subscriber, #60564) [Link]

Actually I was going to do that, but given that all other related sysctl are numbers and the patch introduces lot of changes, I minimized any other new changes and probably you can guess why! the doc tries hard to reflect to their real semantics.

Restricting automatic kernel-module loading

Posted Dec 5, 2017 21:45 UTC (Tue) by vomlehn (guest, #45588) [Link]

Ach, you're getting soft lad. Why, when I was a little one and we wanted granola, we'd eat the whole oat plant and leave it to the digestive system to sort it all out. Just think of the performance gains we got from not processing the grains out beforehand. :-)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds