[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Out of memory killer misconfigured?



On Tue, Mar 29, 2022 at 09:03:14PM +0100, piorunz wrote:
> On 29/03/2022 20:16, Greg Wooledge wrote:
> > Resource limits are a thing.  man setrlimit (you may have to install
> > manpages-dev first).
> 
> How do I use it? I've read manual but that would need to written down as
> a C++ program or something? ;(

Usually things are launched from either a shell, or from systemd.

If the thing is launched from bash, then you can use bash's "ulimit"
command to set the resource limits before launching the thing.

If it's launched by systemd, look at systemd.exec(5) and search for
"Limit" to see how to specify resource limits in a unit file.

If it's launched from some shell that isn't bash, then you might be
able to find a "ulimit" or "limit" command that works in the other
shell.  Otherwise, you can use wrapper tools like DJB's "softlimit"
(from daemontools) to set resource limits and chain-load the desired thing.

> I need, nothing else! I don't understand why memory
> limit like that is not built in to Debian, opening possibility to DoS
> every system by allocating too much memory by unprivileged userland
> process.

Resource limits are not set by default, because they will cause processes
to die if they're set too low.  Only the person who needs them will be
able to determine which processes need a limit placed on them, and how
low the limit should be set.


Reply to: