From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Mikulas Patocka <mpatocka@redhat.com>,
John David Anglin <dave.anglin@bell.net>,
Andi Kleen <ak@linux.intel.com>, Christoph Lameter <cl@linux.com>,
Helge Deller <deller@gmx.de>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.5 08/88] mm: fix crash when using XFS on loopback
Date: Fri, 7 Feb 2014 11:22:05 +0000 [thread overview]
Message-ID: <1391772205-22239-9-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1391772205-22239-1-git-send-email-luis.henriques@canonical.com>
3.5.7.30 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 03e5ac2fc3bf6f4140db0371e8bb4243b24e3e02 upstream.
Commit 8456a648cf44 ("slab: use struct page for slab management") causes
a crash in the LVM2 testsuite on PA-RISC (the crashing test is
fsadm.sh). The testsuite doesn't crash on 3.12, crashes on 3.13-rc1 and
later.
Bad Address (null pointer deref?): Code=15 regs=000000413edd89a0 (Addr=000006202224647d)
CPU: 3 PID: 24008 Comm: loop0 Not tainted 3.13.0-rc6 #5
task: 00000001bf3c0048 ti: 000000413edd8000 task.ti: 000000413edd8000
YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00001000000001101111100100001110 Not tainted
r00-03 000000ff0806f90e 00000000405c8de0 000000004013e6c0 000000413edd83f0
r04-07 00000000405a95e0 0000000000000200 00000001414735f0 00000001bf349e40
r08-11 0000000010fe3d10 0000000000000001 00000040829c7778 000000413efd9000
r12-15 0000000000000000 000000004060d800 0000000010fe3000 0000000010fe3000
r16-19 000000413edd82a0 00000041078ddbc0 0000000000000010 0000000000000001
r20-23 0008f3d0d83a8000 0000000000000000 00000040829c7778 0000000000000080
r24-27 00000001bf349e40 00000001bf349e40 202d66202224640d 00000000405a95e0
r28-31 202d662022246465 000000413edd88f0 000000413edd89a0 0000000000000001
sr00-03 000000000532c000 0000000000000000 0000000000000000 000000000532c000
sr04-07 0000000000000000 0000000000000000 0000000000000000 0000000000000000
IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401fe42c 00000000401fe430
IIR: 539c0030 ISR: 00000000202d6000 IOR: 000006202224647d
CPU: 3 CR30: 000000413edd8000 CR31: 0000000000000000
ORIG_R28: 00000000405a95e0
IAOQ[0]: vma_interval_tree_iter_first+0x14/0x48
IAOQ[1]: vma_interval_tree_iter_first+0x18/0x48
RP(r2): flush_dcache_page+0x128/0x388
Backtrace:
flush_dcache_page+0x128/0x388
lo_splice_actor+0x90/0x148 [loop]
splice_from_pipe_feed+0xc0/0x1d0
__splice_from_pipe+0xac/0xc0
lo_direct_splice_actor+0x1c/0x70 [loop]
splice_direct_to_actor+0xec/0x228
lo_receive+0xe4/0x298 [loop]
loop_thread+0x478/0x640 [loop]
kthread+0x134/0x168
end_fault_vector+0x20/0x28
xfs_setsize_buftarg+0x0/0x90 [xfs]
Kernel panic - not syncing: Bad Address (null pointer deref?)
Commit 8456a648cf44 changes the page structure so that the slab
subsystem reuses the page->mapping field.
The crash happens in the following way:
* XFS allocates some memory from slab and issues a bio to read data
into it.
* the bio is sent to the loopback device.
* lo_receive creates an actor and calls splice_direct_to_actor.
* lo_splice_actor copies data to the target page.
* lo_splice_actor calls flush_dcache_page because the page may be
mapped by userspace. In that case we need to flush the kernel cache.
* flush_dcache_page asks for the list of userspace mappings, however
that page->mapping field is reused by the slab subsystem for a
different purpose. This causes the crash.
Note that other architectures without coherent caches (sparc, arm, mips)
also call page_mapping from flush_dcache_page, so they may crash in the
same way.
This patch fixes this bug by testing if the page is a slab page in
page_mapping and returning NULL if it is.
The patch also fixes VM_BUG_ON(PageSlab(page)) that could happen in
earlier kernels in the same scenario on architectures without cache
coherence when CONFIG_DEBUG_VM is enabled - so it should be backported
to stable kernels.
In the old kernels, the function page_mapping is placed in
include/linux/mm.h, so you should modify the patch accordingly when
backporting it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: John David Anglin <dave.anglin@bell.net>]
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Christoph Lameter <cl@linux.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
Reviewed-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Helge Deller <deller@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: backported to 3.5:
- file rename: mm/util.c -> include/linux/mm.h ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
include/linux/mm.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 53eb728..23a80570 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -791,7 +791,10 @@ static inline struct address_space *page_mapping(struct page *page)
{
struct address_space *mapping = page->mapping;
- VM_BUG_ON(PageSlab(page));
+ /* This happens if someone calls flush_dcache_page on slab page */
+ if (unlikely(PageSlab(page)))
+ return NULL;
+
if (unlikely(PageSwapCache(page)))
mapping = &swapper_space;
else if ((unsigned long)mapping & PAGE_MAPPING_ANON)
--
1.8.3.2
next prev parent reply other threads:[~2014-02-07 11:24 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 11:21 [3.5.y.z extended stable] Linux 3.5.7.30 stable review Luis Henriques
2014-02-07 11:21 ` [PATCH 3.5 01/88] ext4: fix deadlock when writing in ENOSPC conditions Luis Henriques
2014-02-07 11:21 ` [PATCH 3.5 02/88] writeback: Fix data corruption on NFS Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 03/88] md/raid5: Fix possible confusion when multiple write errors occur Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 04/88] md/raid10: fix two bugs in handling of known-bad-blocks Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 05/88] md/raid10: fix bug when raid10 recovery fails to recover a block Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 06/88] hwmon: (coretemp) Fix truncated name of alarm attributes Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 07/88] nilfs2: fix segctor bug that causes file system corruption Luis Henriques
2014-02-07 11:22 ` Luis Henriques [this message]
2014-02-07 11:22 ` [PATCH 3.5 09/88] vfs: In d_path don't call d_dname on a mount point Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 10/88] perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 11/88] staging: comedi: 8255_pci: fix for newer PCI-DIO48H Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 12/88] mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 13/88] serial: amba-pl011: use port lock to guard control register access Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 14/88] rtlwifi: rtl8192cu: Fix W=1 build warning Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 15/88] rtlwifi: rtl8192cu: Add new firmware Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 16/88] rtlwifi: Set the link state Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 17/88] rtlwifi: rtl8192c: Add new definitions in the dm_common header Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 18/88] rtlwifi: rtl8192cu: Fix some code in RF handling Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 19/88] NFSv4: OPEN must handle the NFS4ERR_IO return code correctly Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 20/88] parport: parport_pc: remove double PCI ID for NetMos Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 21/88] staging: vt6656: [BUG] BBvUpdatePreEDThreshold Always set sensitivity on bScanning Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 22/88] [SCSI] bfa: Chinook quad port 16G FC HBA claim issue Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 23/88] usb: option: add new zte 3g modem pids to option driver Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 24/88] [media] dib8000: make 32 bits read atomic Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 25/88] serial: add support for 200 v3 series Titan card Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 26/88] usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix() Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 27/88] x86/efi: Fix off-by-one bug in EFI Boot Services reservation Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 28/88] perf kvm: Fix kvm report without guestmount Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 29/88] mtd: mxc_nand: remove duplicated ecc_stats counting Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 30/88] xen/pvhvm: If xen_platform_pci=0 is set don't blow up (v4) Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 31/88] USB: serial: add support for iBall 3.5G connect usb modem Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 32/88] USB: Nokia 502 is an unusual device Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 33/88] USB: cypress_m8: fix ring-indicator detection and reporting Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 34/88] ALSA: rme9652: fix a missing comma in channel_map_9636_ds[] Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 35/88] sunrpc: Fix infinite loop in RPC state machine Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 36/88] spidev: fix hang when transfer_one_message fails Luis Henriques
2014-02-07 18:17 ` Daniel Santos
2014-02-07 18:37 ` Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 37/88] dm thin: initialize dm_thin_new_mapping returned by get_next_mapping Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 38/88] SELinux: Fix memory leak upon loading policy Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 39/88] drm/radeon: warn users when hw_i2c is enabled (v2) Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 40/88] USB: ftdi_sio: added CS5 quirk for broken smartcard readers Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 41/88] serial: 8250: enable UART_BUG_NOMSR for Tegra Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 42/88] dm: wait until embedded kobject is released before destroying a device Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 43/88] dm space map common: make sure new space is used during extend Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 44/88] ASoC: adau1701: Fix ADAU1701_SEROCTL_WORD_LEN_16 constant Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 45/88] radeon/pm: Guard access to rdev->pm.power_state array Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 46/88] drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 47/88] staging: r8712u: Set device type to wlan Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 48/88] ALSA: Enable CONFIG_ZONE_DMA for smaller PCI DMA masks Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 49/88] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 50/88] rtlwifi: rtl8192cu: Add new device ID Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 51/88] mwifiex: add missing endian conversion for fw_tsf Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 52/88] b43: Fix lockdep splat Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 53/88] b43: Fix unload oops if firmware is not available Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 54/88] b43legacy: " Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 55/88] nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 56/88] audit: correct a type mismatch in audit_syscall_exit() Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 57/88] md/raid5: fix long-standing problem with bitmap handling on write failure Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 58/88] drm/radeon: set the full cache bit for fences on r7xx+ Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 59/88] hp_accel: Add a new PnP ID HPQ6007 for new HP laptops Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 60/88] intel-iommu: fix off-by-one in pagetable freeing Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 61/88] fuse: fix pipe_buf_operations Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 62/88] drm/cirrus: correct register values for 16bpp Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 63/88] IB/qib: Fix QP check when looping back to/from QP1 Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 64/88] ore: Fix wrong math in allocation of per device BIO Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 65/88] b43: fix the wrong assignment of status.freq in b43_rx() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 66/88] KVM: PPC: e500: Fix bad address type in deliver_tlb_misss() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 67/88] Btrfs: handle EAGAIN case properly in btrfs_drop_snapshot() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 68/88] ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 69/88] powerpc: Make sure "cache" directory is removed when offlining cpu Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 70/88] drm/radeon/DCE4+: clear bios scratch dpms bit (v2) Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 71/88] mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 72/88] target/iscsi: Fix network portal creation race Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 73/88] mm, oom: base root bonus on current usage Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 74/88] x86, x32: Correct invalid use of user timespec in the kernel Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 75/88] alpha: fix broken network checksum Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 76/88] ARM: at91: smc: bug fix in sam9_smc_cs_read() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 77/88] KVM: s390: fix diagnose code extraction Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 78/88] e752x_edac: Fix pci_dev usage count Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 79/88] lib/decompressors: fix "no limit" output buffer length Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 80/88] bnx2x: fix DMA unmapping of TSO split BDs Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 81/88] inet_diag: fix inet_diag_dump_icsk() timewait socket state logic Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 82/88] net: avoid reference counter overflows on fib_rules in multicast forwarding Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 83/88] net,via-rhine: Fix tx_timeout handling Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 84/88] mm: hugetlbfs: fix hugetlbfs optimization Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 85/88] usb: core: get config and string descriptors for unauthorized devices Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 86/88] tty/serial: at91: Handle shutdown more safely Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 87/88] slub: Fix calculation of cpu slabs Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 88/88] turbostat: Use GCC's CPUID functions to support PIC 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=1391772205-22239-9-git-send-email-luis.henriques@canonical.com \
--to=luis.henriques@canonical.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=dave.anglin@bell.net \
--cc=deller@gmx.de \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.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®