To clarify, the regression appears to be the same problem that the rlimit increase is fixing, but the applications failing now are simply bigger. In general, any application that calls mlockall() with MCL_FUTURE, but doesn't adjust its rlimit (or change its systemd service file to adjust LimitMEMLOCK) is very likely destined to crash later in its life.
I believe the only lp bugs for this regression are bug 1890394 and bug 1902879, which are both fix-committed and verified, so this bug should be ok to release (again) after those are released. Also I will note both of those applications (slick-greeter and lightdm-gtk-greeter) were fixed by commenting out their calls to mlockall. There is also bug 1902871 and bug 1903199 but I believe those are both dups of bug 1900394. Also finally to reflect on cryptsetup's use of mlockall(), since it's the origin for this bug; cryptsetup is maybe "better" about its use of mlockall() since it keeps the mlock only for the duration of an 'action': if (action->required_memlock) crypt_memory_lock(NULL, 1); set_int_handler(0); r = action->handler(); if (action->required_memlock) crypt_memory_lock(NULL, 0); however, as this bug shows, that action handler function can still attempt to allocate enough memory to reach the rlimit and cause allocation failures. Personally, I think cryptsetup should be fixed upstream to call setrlimit() to increase its RLIMIT_MEMLOCK to infinity, at least while the mlock is in effect. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1830746 Title: memlock setting in systemd (pid 1) too low for containers (bionic) Status in systemd package in Ubuntu: Fix Released Status in systemd source package in Bionic: Fix Released Status in systemd source package in Cosmic: Won't Fix Status in systemd source package in Disco: Won't Fix Status in systemd source package in Eoan: Fix Released Status in systemd source package in Focal: Fix Released Bug description: [Impact] * Since systemd commit fb3ae275cb ("main: bump RLIMIT_NOFILE for the root user substantially") [https://github.com/systemd/systemd/commit/fb3ae275cb], which is present in Bionic, the memlock ulimit value was bumped to 16M. It's an adjustable limit, but the default (in previous Ubuntu releases/systemd versions) was really small. * Although bumping this value was a good thing, 16M is not enough and we can see failures on mlock'ed allocations on Bionic, like the one hereby reported by Kees or the recent introduced cryptsetup build failures (due to PPA builder updates to Bionic) - see https://bugs.launchpad.net/bugs//1891473. * It's especially harmful in containers to have such "small" limit, so we are hereby SRUing a more recent bump from upstream systemd, in the form of commit 91cfdd8d29 ("core: bump mlock ulimit to 64Mb") [https://github.com/systemd/systemd/commit/91cfdd8d29]. Latest Ubuntu releases, like Focal and subsequent ones, already include this patch so effectively we're putting Bionic on-par with newer releases. * A discussion about this topic (leading to this SRU) is present in ubuntu-devel ML: https://lists.ubuntu.com/archives/ubuntu- devel/2020-September/041159.html. [Test Case] * The straightforward test is to just look "ulimit -l" and "ulimit -Hl" in a current Bionic system, and then install an updated version with the hereby proposed SRU to see such limit bump from 16M to 64M (after a reboot) - a version containing this fix is available at my PPA as of 2020-09-10 [0] (likely to be deleted in next month or so). * A more interesting test is to run a Focal container in a current Bionic system and try to build the cryptsetup package - it'll fail in some tests. After updating the host (Bionic) systemd to include the mlock bump patch, the build succeeds in the Focal container. [Regression Potential] * Since it's a simple bump and it makes Bionic behave like Focal, I don't foresee regressions. One potential issue would be if some users rely on the lower default limit (16M) and this value is bumped by a package update, but that could be circumvented by setting a lower limit in limits.conf. The benefits for such bump are likely much bigger than any "regression" caused for users relying on such default limit. [0] https://launchpad.net/~gpiccoli/+archive/ubuntu/test1830746 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1830746/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp