From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Mel Gorman <mgorman@techsingularity.net>,
Andrea Arcangeli <aarcange@redhat.com>,
Hugh Dickins <hughd@google.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.16.y-ckt 082/104] mm: hugetlbfs: skip shared VMAs when unmapping private pages to satisfy a fault
Date: Mon, 26 Oct 2015 13:43:04 +0000 [thread overview]
Message-ID: <1445867006-18048-83-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1445867006-18048-1-git-send-email-luis.henriques@canonical.com>
3.16.7-ckt19 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <mgorman@techsingularity.net>
commit 2f84a8990ebbe235c59716896e017c6b2ca1200f upstream.
SunDong reported the following on
https://bugzilla.kernel.org/show_bug.cgi?id=103841
I think I find a linux bug, I have the test cases is constructed. I
can stable recurring problems in fedora22(4.0.4) kernel version,
arch for x86_64. I construct transparent huge page, when the parent
and child process with MAP_SHARE, MAP_PRIVATE way to access the same
huge page area, it has the opportunity to lead to huge page copy on
write failure, and then it will munmap the child corresponding mmap
area, but then the child mmap area with VM_MAYSHARE attributes, child
process munmap this area can trigger VM_BUG_ON in set_vma_resv_flags
functions (vma - > vm_flags & VM_MAYSHARE).
There were a number of problems with the report (e.g. it's hugetlbfs that
triggers this, not transparent huge pages) but it was fundamentally
correct in that a VM_BUG_ON in set_vma_resv_flags() can be triggered that
looks like this
vma ffff8804651fd0d0 start 00007fc474e00000 end 00007fc475e00000
next ffff8804651fd018 prev ffff8804651fd188 mm ffff88046b1b1800
prot 8000000000000027 anon_vma (null) vm_ops ffffffff8182a7a0
pgoff 0 file ffff88106bdb9800 private_data (null)
flags: 0x84400fb(read|write|shared|mayread|maywrite|mayexec|mayshare|dontexpand|hugetlb)
------------
kernel BUG at mm/hugetlb.c:462!
SMP
Modules linked in: xt_pkttype xt_LOG xt_limit [..]
CPU: 38 PID: 26839 Comm: map Not tainted 4.0.4-default #1
Hardware name: Dell Inc. PowerEdge R810/0TT6JF, BIOS 2.7.4 04/26/2012
set_vma_resv_flags+0x2d/0x30
The VM_BUG_ON is correct because private and shared mappings have
different reservation accounting but the warning clearly shows that the
VMA is shared.
When a private COW fails to allocate a new page then only the process
that created the VMA gets the page -- all the children unmap the page.
If the children access that data in the future then they get killed.
The problem is that the same file is mapped shared and private. During
the COW, the allocation fails, the VMAs are traversed to unmap the other
private pages but a shared VMA is found and the bug is triggered. This
patch identifies such VMAs and skips them.
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Reported-by: SunDong <sund_sky@126.com>
Reviewed-by: Michal Hocko <mhocko@suse.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: David Rientjes <rientjes@google.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
mm/hugetlb.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 94add6da0fad..f3111955b701 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2790,6 +2790,14 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
continue;
/*
+ * Shared VMAs have their own reserves and do not affect
+ * MAP_PRIVATE accounting but it is possible that a shared
+ * VMA is using the same page so check and skip such VMAs.
+ */
+ if (iter_vma->vm_flags & VM_MAYSHARE)
+ continue;
+
+ /*
* Unmap the page from other VMAs without their own reserves.
* They get marked to be SIGKILLed if they fault in these
* areas. This is because a future no-page fault on this VMA
next prev parent reply other threads:[~2015-10-26 13:52 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 13:41 [3.16.y-ckt stable] Linux 3.16.7-ckt19 stable review Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 001/104] ARM: 8429/1: disable GCC SRA optimization Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 002/104] CIFS: fix type confusion in copy offload ioctl Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 003/104] hwmon: (nct6775) Swap STEP_UP_TIME and STEP_DOWN_TIME registers for most chips Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 004/104] x86/apic: Serialize LVTT and TSC_DEADLINE writes Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 005/104] arm64: head.S: initialise mdcr_el2 in el2_setup Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 006/104] kvm: don't try to register to KVM_FAST_MMIO_BUS for non mmio eventfd Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 007/104] kvm: factor out core eventfd assign/deassign logic Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 008/104] kvm: fix double free for fast mmio eventfd Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 009/104] kvm: fix zero length mmio searching Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 010/104] ARM: fix Thumb2 signal handling when ARMv6 is enabled Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 011/104] powerpc/boot: Specify ABI v2 when building an LE boot wrapper Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 012/104] powerpc/mm: Recompute hash value after a failed update Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 013/104] x86/platform: Fix Geode LX timekeeping in the generic x86 build Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 014/104] arm64: compat: fix vfp save/restore across signal handlers in big-endian Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 015/104] arm64: errata: add module build workaround for erratum #843419 Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 016/104] arm64: KVM: Disable virtual timer even if the guest is not using it Luis Henriques
2015-10-26 13:41 ` [PATCH 3.16.y-ckt 017/104] arm: " Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 018/104] hp-wmi: Add missing __init annotations to initialization code Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 019/104] hp-wmi: limit hotkey enable Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 020/104] zram: fix possible use after free in zcomp_create() Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 021/104] perf header: Fixup reading of HEADER_NRCPUS feature Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 022/104] dcache: Handle escaped paths in prepend_path Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 023/104] vfs: Test for and handle paths that are unreachable from their mnt_root Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 024/104] spi: spi-pxa2xx: Check status register to determine if SSSR_TINT is disabled Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 025/104] spi: Fix documentation of spi_alloc_master() Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 026/104] USB: option: add ZTE PIDs Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 027/104] drm/vmwgfx: Fix up user_dmabuf refcounting Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 028/104] ARM: dts: omap3-beagle: make i2c3, ddc and tfp410 gpio work again Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 029/104] Btrfs: fix read corruption of compressed and shared extents Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 030/104] btrfs: skip waiting on ordered range for special files Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 031/104] usb: chipidea: udc: using the correct stall implementation Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 032/104] net: mvneta: fix DMA buffer unmapping in mvneta_rx() Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 033/104] iser-target: remove command with state ISTATE_REMOVE Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 034/104] staging: ion: fix corruption of ion_import_dma_buf Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 035/104] KVM: x86: trap AMD MSRs for the TSeg base and mask Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 036/104] usb: Use the USB_SS_MULT() macro to get the burst multiplier Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 037/104] xhci: give command abortion one more chance before killing xhci Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 038/104] usb: xhci: Clear XHCI_STATE_DYING on start Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 039/104] usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 040/104] xhci: change xhci 1.0 only restrictions to support xhci 1.1 Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 041/104] xhci-mem: Use setup_timer Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 042/104] xhci: init command timeout timer earlier to avoid deleting it uninitialized Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 043/104] spi: xtensa-xtfpga: fix register endianness Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 044/104] disabling oplocks/leases via module parm enable_oplocks broken for SMB3 Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 045/104] cifs: use server timestamp for ntlmv2 authentication Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 046/104] x86/paravirt: Replace the paravirt nop with a bona fide empty function Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 047/104] x86/nmi/64: Fix a paravirt stack-clobbering bug in the NMI code Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 048/104] ASoC: pxa: pxa2xx-ac97: fix dma requestor lines Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 049/104] ocfs2/dlm: fix deadlock when dispatch assert master Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 050/104] drm/i915/bios: handle MIPI Sequence Block v3+ gracefully Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 051/104] USB: whiteheat: fix potential null-deref at probe Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 052/104] drm/qxl: only report first monitor as connected if we have no state Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 053/104] PCI: Fix devfn for VPD access through function 0 Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 054/104] PCI: Use function 0 VPD for identical functions, regular VPD for others Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 055/104] netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 056/104] ASoC: fix broken pxa SoC support Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 057/104] ARM: dts: omap5-uevm.dts: fix i2c5 pinctrl offsets Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 058/104] vxlan: set needed headroom correctly Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 059/104] Revert "ARM: orion5x: fix legacy orion5x IRQ numbers" Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 060/104] jbd2: avoid infinite loop when destroying aborted journal Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 061/104] asix: Don't reset PHY on if_up for ASIX 88772 Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 062/104] asix: Do full reset during ax88772_bind Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 063/104] fib_rules: Fix dump_rules() not to exit early Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 064/104] net/xen-netfront: only napi_synchronize() if running Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 065/104] cpufreq: intel_pstate: Remove unnecessary type casting in div_s64() call Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 066/104] intel_pstate: Fix overflow in busy_scaled due to long delay Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 067/104] tools lib traceevent: Fix string handling in heterogeneous arch environments Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 068/104] perf tools: Fix copying of /proc/kcore Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 069/104] m68k: Define asmlinkage_protect Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 070/104] UBI: Validate data_size Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 071/104] UBI: return ENOSPC if no enough space available Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 072/104] drm/radeon: Restore LCD backlight level on resume (>= R5xx) Luis Henriques
2015-10-27 2:10 ` Michel Dänzer
2015-10-28 10:45 ` Luis Henriques
2015-11-02 7:52 ` Michel Dänzer
2015-11-11 15:43 ` Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 073/104] MIPS: dma-default: Fix 32-bit fall back to GFP_DMA Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 074/104] MIPS: CPS: Stop dangling delay slot from has_mt Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 075/104] MIPS: CPS: Don't include MT code in non-MT kernels Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 076/104] MIPS: CPS: #ifdef on CONFIG_MIPS_MT_SMP rather than CONFIG_MIPS_MT Luis Henriques
2015-10-26 13:42 ` [PATCH 3.16.y-ckt 077/104] Initialize msg/shm IPC objects before doing ipc_addid() Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 078/104] drm/qxl: recreate the primary surface when the bo is not primary Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 079/104] genirq: Fix race in register_irq_proc() Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 080/104] x86/efi: Fix boot crash by mapping EFI memmap entries bottom-up at runtime, instead of top-down Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 081/104] Use WARN_ON_ONCE for missing X86_FEATURE_NRIPS Luis Henriques
2015-10-26 13:43 ` Luis Henriques [this message]
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 083/104] x86/mm: Set NX on gap between __ex_table and rodata Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 084/104] clocksource: Fix abs() usage w/ 64bit values Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 085/104] dmaengine: dw: properly read DWC_PARAMS register Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 086/104] mm/slab: fix unexpected index mapping result of kmalloc_size(INDEX_NODE+1) Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 087/104] drm/vmwgfx: Fix kernel NULL pointer dereference on older hardware Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 088/104] fs: if a coredump already exists, unlink and recreate with O_EXCL Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 089/104] sctp: donot reset the overall_error_count in SHUTDOWN_RECEIVE state Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 090/104] ipc/sem.c: fully initialize sem_array before making it visible Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 091/104] drivers: usb :fsl: Implement Workaround for USB Erratum A007792 Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 092/104] drivers: usb: fsl: Workaround for USB erratum-A005275 Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 093/104] l2tp: protect tunnel->del_work by ref_count Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 094/104] af_unix: Convert the unix_sk macro to an inline function for type safety Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 095/104] af_unix: return data from multiple SKBs on recv() with MSG_PEEK flag Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 096/104] net/unix: fix logic about sk_peek_offset Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 097/104] skbuff: Fix skb checksum flag on skb pull Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 098/104] skbuff: Fix skb checksum partial check Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 099/104] net: add pfmemalloc check in sk_add_backlog() Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 100/104] ppp: don't override sk->sk_state in pppoe_flush_dev() Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 101/104] ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 102/104] ovs: do not allocate memory from offline numa node Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 103/104] netlink: Trim skb to alloc size to avoid MSG_TRUNC Luis Henriques
2015-10-26 13:43 ` [PATCH 3.16.y-ckt 104/104] net: add length argument to skb_copy_and_csum_datagram_iovec Luis Henriques
2015-10-26 19:02 ` [3.16.y-ckt stable] Linux 3.16.7-ckt19 stable review Luis Henriques
2015-10-28 16:51 ` Luis Henriques
2015-10-26 19:05 ` [PATCH 3.16.y-ckt 105/107] KEYS: Fix race between key destruction and finding a keyring by name Luis Henriques
2015-10-26 19:05 ` [PATCH 3.16.y-ckt 106/107] KEYS: Fix crash when attempt to garbage collect an uninstantiated keyring Luis Henriques
2015-10-26 19:05 ` [PATCH 3.16.y-ckt 107/107] KEYS: Don't permit request_key() to construct a new keyring Luis Henriques
2015-10-28 16:52 ` [PATCH 3.16.y-ckt 108/108] Btrfs: update fix for read corruption of compressed and shared extents Luis Henriques
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=1445867006-18048-83-git-send-email-luis.henriques@canonical.com \
--to=luis.henriques@canonical.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=n-horiguchi@ah.jp.nec.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
all inboxes | Powered by JetHome®