From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, Frantisek Hrbata <fhrbata@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Oleg Nesterov <oleg@redhat.com>,
David Rientjes <rientjes@google.com>
Subject: [23/75] oom: fix integer overflow of points in oom_badness
Date: Tue, 03 Jan 2012 14:32:56 -0800 [thread overview]
Message-ID: <20120103223322.926106871@clark.kroah.org> (raw)
In-Reply-To: <20120103223332.GA4112@kroah.com>
3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frantisek Hrbata <fhrbata@redhat.com>
commit ff05b6f7ae762b6eb464183eec994b28ea09f6dd upstream.
An integer overflow will happen on 64bit archs if task's sum of rss,
swapents and nr_ptes exceeds (2^31)/1000 value. This was introduced by
commit
f755a04 oom: use pte pages in OOM score
where the oom score computation was divided into several steps and it's no
longer computed as one expression in unsigned long(rss, swapents, nr_pte
are unsigned long), where the result value assigned to points(int) is in
range(1..1000). So there could be an int overflow while computing
176 points *= 1000;
and points may have negative value. Meaning the oom score for a mem hog task
will be one.
196 if (points <= 0)
197 return 1;
For example:
[ 3366] 0 3366 35390480 24303939 5 0 0 oom01
Out of memory: Kill process 3366 (oom01) score 1 or sacrifice child
Here the oom1 process consumes more than 24303939(rss)*4096~=92GB physical
memory, but it's oom score is one.
In this situation the mem hog task is skipped and oom killer kills another and
most probably innocent task with oom score greater than one.
The points variable should be of type long instead of int to prevent the
int overflow.
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
mm/oom_kill.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -162,7 +162,7 @@ static bool oom_unkillable_task(struct t
unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
const nodemask_t *nodemask, unsigned long totalpages)
{
- int points;
+ long points;
if (oom_unkillable_task(p, mem, nodemask))
return 0;
next prev parent reply other threads:[~2012-01-03 22:41 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-03 22:33 [00/75] 3.1.8-stable review Greg KH
2012-01-03 22:32 ` [01/75] ARM: OMAP: rx51: fix USB Greg KH
2012-01-03 22:32 ` [02/75] ipip, sit: copy parms.name after register_netdevice Greg KH
2012-01-03 22:32 ` [03/75] rtc: Expire alarms after the time is set Greg KH
2012-01-03 22:46 ` John Stultz
2012-01-03 22:53 ` Greg KH
2012-01-03 22:32 ` [04/75] rtc: m41t80: Workaround broken alarm functionality Greg KH
2012-01-03 22:32 ` [05/75] ALSA: HDA: Set position fix to LPIB for an Atom/Poulsbo based device Greg KH
2012-01-03 22:32 ` [06/75] drm/i915: set the right SDVO transcoder for CPT Greg KH
2012-01-03 22:32 ` [07/75] drm/i915: prevent division by zero when asking for chipset power Greg KH
2012-01-03 22:32 ` [08/75] cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails Greg KH
2012-01-03 22:32 ` [09/75] cfq-iosched: fix cfq_cic_link() race confition Greg KH
2012-01-03 22:32 ` [10/75] SCSI: zfcp: return early from slave_destroy if slave_alloc returned early Greg KH
2012-01-03 22:32 ` [11/75] SCSI: mpt2sas: _scsih_smart_predicted_fault uses GFP_KERNEL in interrupt context Greg KH
2012-01-03 22:32 ` [12/75] SCSI: fcoe: Fix preempt count leak in fcoe_filter_frames() Greg KH
2012-01-03 22:32 ` [13/75] mac80211: fix another race in aggregation start Greg KH
2012-01-03 22:32 ` [14/75] ASoC: Fix WM8996 24.576MHz clock operation Greg KH
2012-01-03 22:32 ` [15/75] block: initialize request_queues numa node during Greg KH
2012-01-03 22:32 ` [16/75] ssb: fix init regression with SoCs Greg KH
2012-01-03 22:32 ` [17/75] rtl8192{ce,cu,de,se}: avoid problems because of possible ERFOFF -> ERFSLEEP transition Greg KH
2012-01-03 22:32 ` [18/75] MXC PWM: should active during DOZE/WAIT/DBG mode Greg KH
2012-01-03 22:32 ` [19/75] Input: synaptics - fix touchpad not working after S2R on Vostro V13 Greg KH
2012-01-03 22:32 ` [20/75] percpu: fix per_cpu_ptr_to_phys() handling of non-page-aligned addresses Greg KH
2012-01-03 22:32 ` [21/75] IB/mlx4: Fix shutdown crash accessing a non-existent bitmap Greg KH
2012-01-03 22:32 ` [22/75] binary_sysctl(): fix memory leak Greg KH
2012-01-03 22:32 ` Greg KH [this message]
2012-01-03 22:32 ` [24/75] oprofile: Fix uninitialized memory access when writing to writing to oprofilefs Greg KH
2012-01-03 22:32 ` [25/75] SUNRPC: Ensure we always bump the backlog queue in xprt_free_slot Greg KH
2012-01-03 22:32 ` [26/75] NFS: Fix a regression in nfs_file_llseek() Greg KH
2012-01-03 22:33 ` [27/75] NFSv4.1: Ensure that we handle _all_ SEQUENCE status bits Greg KH
2012-01-03 22:33 ` [28/75] SELinux: Fix RCU deref check warning in sel_netport_insert() Greg KH
2012-01-03 22:33 ` [29/75] media: omap_vout: Fix compile error in 3.1 Greg KH
2012-01-03 22:33 ` [30/75] nilfs2: unbreak compat ioctl Greg KH
2012-01-03 22:33 ` [31/75] mmc: vub300: fix type of firmware_rom_wait_states module parameter Greg KH
2012-01-03 22:33 ` [32/75] cgroups: fix a css_set not found bug in cgroup_attach_proc Greg KH
2012-01-03 22:33 ` [33/75] mfd: Fix twl-core oops while calling twl_i2c_* for unbound driver Greg KH
2012-01-03 22:33 ` [34/75] vfs: __read_cache_page should use gfp argument rather than GFP_KERNEL Greg KH
2012-01-03 22:33 ` [35/75] media: s5p-fimc: Use correct fourcc for RGB565 colour format Greg KH
2012-01-03 22:33 ` [36/75] ath9k: fix max phy rate at rate control init Greg KH
2012-01-03 22:33 ` [37/75] iwlwifi: do not set the sequence control bit is not needed Greg KH
2012-01-03 22:33 ` [38/75] iwlwifi: allow to switch to HT40 if not associated Greg KH
2012-01-03 22:33 ` [39/75] memcg: keep root group unchanged if creation fails Greg KH
2012-01-03 22:33 ` [40/75] VFS: Fix race between CPU hotplug and lglocks Greg KH
2012-01-03 22:33 ` [41/75] ARM:imx:fix pwm period value Greg KH
2012-01-03 22:33 ` [42/75] ARM: 7214/1: mmc: mmci: Fixup handling of MCI_STARTBITERR Greg KH
2012-01-03 22:33 ` [43/75] ARM: 7220/1: mmc: mmci: Fixup error handling for dma Greg KH
2012-01-03 22:33 ` [44/75] oprofile, arm/sh: Fix oprofile_arch_exit() linkage issue Greg KH
2012-01-03 22:33 ` [45/75] futex: Fix uninterruptible loop due to gate_area Greg KH
2012-01-03 22:33 ` [46/75] watchdog: hpwdt: Changes to handle NX secure bit in 32bit path Greg KH
2012-01-03 22:33 ` [47/75] drm/radeon/kms: bail on BTC parts if MC ucode is missing Greg KH
2012-01-03 22:33 ` [48/75] mm: hugetlb: fix non-atomic enqueue of huge page Greg KH
2012-01-03 22:33 ` [49/75] mm/mempolicy.c: refix mbind_range() vma issue Greg KH
2012-01-03 22:33 ` [50/75] mpt2sas crashes on shutdown Greg KH
2012-01-04 8:53 ` Nandigama, Nagalakshmi
2012-01-04 15:18 ` Greg KH
2012-01-04 15:19 ` James Bottomley
2012-01-04 15:25 ` [PATCH] mpt2sas: fix non-x86 crash " James Bottomley
2012-01-04 19:21 ` Greg KH
2012-01-04 19:39 ` David Miller
2012-01-05 19:10 ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.0-stable tree gregkh
2012-01-05 19:25 ` Patch "mpt2sas: fix non-x86 crash on shutdown" has been added to the 3.1-stable tree gregkh
2012-01-03 22:33 ` [51/75] sparc64: Fix MSIQ HV call ordering in pci_sun4v_msiq_build_irq() Greg KH
2012-01-03 22:33 ` [52/75] sparc32: Be less strict in matching %lo part of relocation Greg KH
2012-01-03 22:33 ` [53/75] sparc64: Patch sun4v code sequences properly on module load Greg KH
2012-01-03 22:33 ` [54/75] sparc: Kill custom io_remap_pfn_range() Greg KH
2012-01-03 22:33 ` [55/75] sparc32: Remove non-kernel code from memcpy implementation Greg KH
2012-01-03 22:33 ` [56/75] sparc32: Remove uses of %g7 in " Greg KH
2012-01-03 22:33 ` [57/75] sparc32: Correct the return value of memcpy Greg KH
2012-01-03 22:33 ` [58/75] sparc64: Fix masking and shifting in VIS fpcmp emulation Greg KH
2012-01-03 22:33 ` [59/75] sparc: Fix handling of orig_i0 wrt. debugging when restarting syscalls Greg KH
2012-01-03 22:33 ` [60/75] net: bpf_jit: fix an off-one bug in x86_64 cond jump target Greg KH
2012-01-03 22:33 ` [61/75] ppp: fix pptp double release_sock in pptp_bind() Greg KH
2012-01-03 22:33 ` [62/75] llc: llc_cmsg_rcv was getting called after sk_eat_skb Greg KH
2012-01-03 22:33 ` [63/75] mqprio: Avoid panic if no options are provided Greg KH
2012-01-03 22:33 ` [64/75] net: have ipconfig not wait if no dev is available Greg KH
2012-01-03 22:33 ` [65/75] sch_gred: should not use GFP_KERNEL while holding a spinlock Greg KH
2012-01-03 22:33 ` [66/75] sctp: fix incorrect overflow check on autoclose Greg KH
2012-01-03 22:33 ` [67/75] sctp: Do not account for sizeof(struct sk_buff) in estimated rwnd Greg KH
2012-01-03 22:33 ` [68/75] net: Add a flow_cache_flush_deferred function Greg KH
2012-01-03 22:33 ` [69/75] ipv4: flush route cache after change accept_local Greg KH
2012-01-03 22:33 ` [70/75] ipv6: Check dest prefix length on original route not copied one in rt6_alloc_cow() Greg KH
2012-01-03 22:33 ` [71/75] net: introduce DST_NOPEER dst flag Greg KH
2012-01-03 22:33 ` [72/75] ipv4: reintroduce route cache garbage collector Greg KH
2012-01-03 22:33 ` [73/75] ipv4: using prefetch requires including prefetch.h Greg KH
2012-01-03 22:33 ` [74/75] iwlwifi: update SCD BC table for all SCD queues Greg KH
2012-01-03 22:33 ` [75/75] mfd: Turn on the twl4030-madc MADC clock Greg KH
2012-01-05 19:26 ` [00/75] 3.1.8-stable review Greg KH
2012-01-05 22:36 ` Greg KH
2012-01-05 22:30 ` [49/80] mpt2sas: fix non-x86 crash on shutdown Greg KH
2012-01-05 22:30 ` [75/80] drm/radeon/kms/atom: fix possible segfault in pm setup Greg KH
2012-01-05 22:30 ` [76/80] hung_task: fix false positive during vfork Greg KH
2012-01-05 22:30 ` [77/80] Revert "rtc: Disable the alarm in the hardware" Greg KH
2012-01-05 22:30 ` [78/80] ptrace: partially fix the do_wait(WEXITED) vs EXIT_DEAD->EXIT_ZOMBIE race Greg KH
2012-01-05 22:30 ` [79/80] ptrace: ensure JOBCTL_STOP_SIGMASK is not zero after detach Greg KH
2012-01-05 22:30 ` [80/80] ath9k: Fix kernel panic in AR2427 in AP mode Greg KH
2012-01-05 19:29 ` [00/75] 3.1.8-stable review Linus Torvalds
2012-01-05 19:36 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120103223322.926106871@clark.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=fhrbata@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rientjes@google.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome