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: <20120608142625.GC1711@redhat.com>
Date:	Fri, 8 Jun 2012 10:26:25 -0400
From:	Dave Jones <davej@...hat.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Hugh Dickins <hughd@...gle.com>, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	David Rientjes <rientjes@...gle.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Anton Arapov <anton@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	linux-kernel@...r.kernel.org
Subject: Re: oom-killer is crazy? (Was: [PATCH 0/3] uprobes fixes for 3.5)

On Fri, Jun 08, 2012 at 04:03:28PM +0200, Oleg Nesterov wrote:
 > On 06/07, Oleg Nesterov wrote:
 > >
 > > This doesn't depend on other uprobes patches I sent, and I think
 > > this is 3.5 material.
 > 
 > And during the testing I found another thing which should be fixed
 > in 3.5 imho. I noticed that oom-killer goes crazy. In the simplest
 > case, when there is the single and "obvious" memory hog it kills
 > sshd daemon.
 > 
 > Hmm. oom_badness() does
 > 
 > 	if (has_capability_noaudit(p, CAP_SYS_ADMIN))
 > 		points -= 30 * totalpages / 1000;
 > 
 > very nice, but what if this underflows? points is unsigned long.
 > points += p->signal->oom_score_adj... looks suspicious too.
 > 
 > Looks like we should remove "unsigned" from oom_badness() and
 > its callers? Probably not, it does "return points ? points : 1".

I've been running this from David for a week, but it still isn't right..

	Dave

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index ed0e196..416637f 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -183,7 +183,7 @@ static bool oom_unkillable_task(struct task_struct *p,
 unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
                          const nodemask_t *nodemask, unsigned long totalpages)
 {
-       unsigned long points;
+       long points;
 
        if (oom_unkillable_task(p, memcg, nodemask))
                return 0;
@@ -223,7 +223,7 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
         * Never return 0 for an eligible task regardless of the root bonus and
         * oom_score_adj (oom_score_adj can't be OOM_SCORE_ADJ_MIN here).
         */
-       return points ? points : 1;
+       return points > 0 ? points : 1;
 }
 
 /*





--
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