Bug 1379001

Summary: Default locked memory limits are too low
Product: [Fedora] Fedora Reporter: bztdlinux
Component: systemdAssignee: systemd-maint
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: dennis, johannbg, kevin, lnykryn, msekleta, muadda, ssahani, s, systemd-maint, tmraz, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-30 17:38:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description bztdlinux 2016-09-23 21:12:33 UTC
Description of problem:
For Fedora Workstation, the current limit on mlock()ed memory per user
is 64kiB, which less than what some applications need.

In particular, Bitcoin Core uses mlock() to prevent private keys from
being swapped to disk. The total size of the wallet keys can exceed 300kB.

Audio is another use case that uses mlock() to prevent skips. Fedora
already has special cases for some apps such as jack, which it gives 4GB.

Steps to Reproduce:
$ ulimit -l
64

Solution:
This was first brought up on fedora-devel: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GJGTCOVZ26YJO7QIFSAYEFDPU4DMWBXC/

Suggested solutions are setting the limit to be a percentage of system RAM, such as 1%. If a percentage isn't possible, I would suggest a relatively large default, such as 64MiB. The limit is basically a weak DoS prevention measure - on Workstation, it would probably make sense to have no limit at all for the logged in user.

The 64kiB default limit comes from the kernel, so it might make sense to change it there instead of in PAM limit settings.

Comment 1 Kevin Fenzi 2016-09-28 18:36:08 UTC
From reading related bugs this seems like it should be moved to systemd, so doing so. 

Note that I don't think we likely would want to change f24... but we could consider changing f25 and rawhide.

Comment 2 Fedora End Of Life 2017-07-25 23:13:23 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Zbigniew Jędrzejewski-Szmek 2017-07-27 13:28:49 UTC
So the issue is that this limit is per-process. If the limit is set to 1% of the RAM, one user can DOS the machine by running 100 processes. I *think* locked memory is also controlled by memory.high/memory.max cgroup limits, but those limits are off by default (The memory controller has overhead and uses quite a bit of memory for its accounting). There's also a limit on number of processes in each unit (TasksMax, usually 4915), which limits the total number of mlock'able memory to 4915*64kB = 307MB per user session. So I don't think we can bump this limit without some per-user limit.

Comment 4 Jan Kurik 2017-08-15 06:54:50 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 5 Ben Cotton 2018-11-27 18:38:27 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Ben Cotton 2018-11-30 17:38:37 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.