lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1165507162.32332.10.camel@twins>
Date:	Thu, 07 Dec 2006 16:59:22 +0100
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Menny Hamburger <menny@...net.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Simple OOM kill protection interface

On Thu, 2006-12-07 at 17:50 +0200, Menny Hamburger wrote:
> Hi,
> 
> Following is a rather simple module implementation that adds an interface for protecting against the oom_killer by setting the oomkilladj in the task struct.


> There are two interfaces:
> 1) /proc interface (/proc/oom_kill_protection) that can be used inside scripts
> 2) A device that registers an ioctl, which can be issued via a calling c program.
> 
> To create the device after the module is loaded do the following from a script:
> major_name=$(dmesg | grep oom_protect |  grep dynamic | tail -n 1 | awk '{print $5}' | xargs)
> if [ -n "$major_name" ]; then
>       mknod /dev/oom_protect c $major_name 1
> fi
> if [ ! -r /dev/oom_protect ]; then
>      logger -p error "Unable to create /dev/oom_protect"
> else
>      logger -p notice "Created device /dev/oom_protect"
> fi
> 
> Usage via a script:
> echo "setprotection $$ 1 > /proc/oom_kill_protection/ctl"
> 
> Usage via a c prog:
> #include <sys/ioctl.h>
> 
> .........
> 
> #define OOMSETPROTECTCMD   _IOWR('O', 1, int)
> 
> int oom_protection = 1, oom_protected = 1, fd;
> 
> if ((fd = open("/dev/oom_protect", 0)) >= 0) {
>     if (ioctl(fd, OOMSETPROTECTCMD, &oom_protection) == 0)
>         oom_protected = 1;
> 
>         close(fd);
> }
> .....

Whatever for?
Why is writing to /proc/{<pid>,self}/oom_adj not good enough?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ