]> git.ipfire.org Git - thirdparty/systemd.git/commit
tree-wide: lock in all memory pages when mlockall() is utilized, and on demand
authorMike Yuan <me@yhndnzj.com>
Sat, 10 Jan 2026 19:46:25 +0000 (20:46 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Jan 2026 12:56:34 +0000 (13:56 +0100)
commit51190631968f2a69acf5da3e3412b003805538f2
tree7315d2f95c12f1bb31d7cae6caa306b0bf4fedbb
parentbcbf80c43d107ad233edc990a60bdc40f517085a
tree-wide: lock in all memory pages when mlockall() is utilized, and on demand

When employing MCL_FUTURE we don't actually want it to impose
immediate population of malloc()-ed pages. Hence let's set
MCL_ONFAULT everywhere.

Additionally, specify MCL_CURRENT to ensure future memory allocations
on already mapped pages are covered too. (Addresses
https://github.com/systemd/systemd/pull/40319#discussion_r2693726196)

Note that in shutdown the mlockall() is done to avoid keeping swap space
busy, hence a dedicated call w/ MCL_CURRENT and w/o MCL_ONFAULT is made.
src/cryptenroll/cryptenroll.c
src/cryptsetup/cryptsetup.c
src/shutdown/shutdown.c