From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>,
Richard Weinberger <richard@nod.at>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 053/113] um: Silence lockdep complaint about mmap_sem
Date: Mon, 29 Jul 2019 21:22:20 +0200 [thread overview]
Message-ID: <20190729190708.242105787@linuxfoundation.org> (raw)
In-Reply-To: <20190729190655.455345569@linuxfoundation.org>
[ Upstream commit 80bf6ceaf9310b3f61934c69b382d4912deee049 ]
When we get into activate_mm(), lockdep complains that we're doing
something strange:
WARNING: possible circular locking dependency detected
5.1.0-10252-gb00152307319-dirty #121 Not tainted
------------------------------------------------------
inside.sh/366 is trying to acquire lock:
(____ptrval____) (&(&p->alloc_lock)->rlock){+.+.}, at: flush_old_exec+0x703/0x8d7
but task is already holding lock:
(____ptrval____) (&mm->mmap_sem){++++}, at: flush_old_exec+0x6c5/0x8d7
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&mm->mmap_sem){++++}:
[...]
__lock_acquire+0x12ab/0x139f
lock_acquire+0x155/0x18e
down_write+0x3f/0x98
flush_old_exec+0x748/0x8d7
load_elf_binary+0x2ca/0xddb
[...]
-> #0 (&(&p->alloc_lock)->rlock){+.+.}:
[...]
__lock_acquire+0x12ab/0x139f
lock_acquire+0x155/0x18e
_raw_spin_lock+0x30/0x83
flush_old_exec+0x703/0x8d7
load_elf_binary+0x2ca/0xddb
[...]
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&mm->mmap_sem);
lock(&(&p->alloc_lock)->rlock);
lock(&mm->mmap_sem);
lock(&(&p->alloc_lock)->rlock);
*** DEADLOCK ***
2 locks held by inside.sh/366:
#0: (____ptrval____) (&sig->cred_guard_mutex){+.+.}, at: __do_execve_file+0x12d/0x869
#1: (____ptrval____) (&mm->mmap_sem){++++}, at: flush_old_exec+0x6c5/0x8d7
stack backtrace:
CPU: 0 PID: 366 Comm: inside.sh Not tainted 5.1.0-10252-gb00152307319-dirty #121
Stack:
[...]
Call Trace:
[<600420de>] show_stack+0x13b/0x155
[<6048906b>] dump_stack+0x2a/0x2c
[<6009ae64>] print_circular_bug+0x332/0x343
[<6009c5c6>] check_prev_add+0x669/0xdad
[<600a06b4>] __lock_acquire+0x12ab/0x139f
[<6009f3d0>] lock_acquire+0x155/0x18e
[<604a07e0>] _raw_spin_lock+0x30/0x83
[<60151e6a>] flush_old_exec+0x703/0x8d7
[<601a8eb8>] load_elf_binary+0x2ca/0xddb
[...]
I think it's because in exec_mmap() we have
down_read(&old_mm->mmap_sem);
...
task_lock(tsk);
...
activate_mm(active_mm, mm);
(which does down_write(&mm->mmap_sem))
I'm not really sure why lockdep throws in the whole knowledge
about the task lock, but it seems that old_mm and mm shouldn't
ever be the same (and it doesn't deadlock) so tell lockdep that
they're different.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/um/include/asm/mmu_context.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
index fca34b2177e2..129fb1d1f1c5 100644
--- a/arch/um/include/asm/mmu_context.h
+++ b/arch/um/include/asm/mmu_context.h
@@ -53,7 +53,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
* when the new ->mm is used for the first time.
*/
__switch_mm(&new->context.id);
- down_write(&new->mmap_sem);
+ down_write_nested(&new->mmap_sem, 1);
uml_setup_stubs(new);
up_write(&new->mmap_sem);
}
--
2.20.1
next prev parent reply other threads:[~2019-07-29 20:06 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 19:21 [PATCH 4.19 000/113] 4.19.63-stable review Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 001/113] hvsock: fix epollout hang from race condition Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 002/113] drm/panel: simple: Fix panel_simple_dsi_probe Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 003/113] iio: adc: stm32-dfsdm: manage the get_irq error case Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 004/113] iio: adc: stm32-dfsdm: missing error case during probe Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 005/113] staging: vt6656: use meaningful error code during buffer allocation Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 006/113] usb: core: hub: Disable hub-initiated U1/U2 Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 007/113] tty: max310x: Fix invalid baudrate divisors calculator Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 008/113] pinctrl: rockchip: fix leaked of_node references Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 009/113] tty: serial: cpm_uart - fix init when SMC is relocated Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 010/113] drm/amd/display: Fill prescale_params->scale for RGB565 Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 011/113] drm/amdgpu/sriov: Need to initialize the HDP_NONSURFACE_BAStE Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 012/113] drm/amd/display: Disable ABM before destroy ABM struct Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 013/113] drm/amdkfd: Fix a potential memory leak Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 014/113] drm/amdkfd: Fix sdma queue map issue Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 015/113] drm/edid: Fix a missing-check bug in drm_load_edid_firmware() Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 016/113] PCI: Return error if cannot probe VF Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 017/113] drm/bridge: tc358767: read display_props in get_modes() Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 018/113] drm/bridge: sii902x: pixel clock unit is 10kHz instead of 1kHz Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 019/113] gpu: host1x: Increase maximum DMA segment size Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 020/113] drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 021/113] drm/crc-debugfs: Also sprinkle irqrestore over early exits Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 022/113] memstick: Fix error cleanup path of memstick_init Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 023/113] tty/serial: digicolor: Fix digicolor-usart already registered warning Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 024/113] tty: serial: msm_serial: avoid system lockup condition Greg Kroah-Hartman
2019-07-31 19:05 ` Pavel Machek
2019-07-31 20:34 ` Jorge Ramirez
2019-08-15 7:07 ` Pavel Machek
2019-07-29 19:21 ` [PATCH 4.19 025/113] serial: 8250: Fix TX interrupt handling condition Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 026/113] drm/amd/display: Always allocate initial connector state state Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 027/113] drm/virtio: Add memory barriers for capset cache Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 028/113] phy: renesas: rcar-gen2: Fix memory leak at error paths Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 029/113] drm/amd/display: fix compilation error Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 030/113] powerpc/pseries/mobility: prevent cpu hotplug during DT update Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 031/113] drm/rockchip: Properly adjust to a true clock in adjusted_mode Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 032/113] serial: imx: fix locking in set_termios() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 033/113] tty: serial_core: Set port active bit in uart_port_activate Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 034/113] usb: gadget: Zero ffs_io_data Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 035/113] mmc: sdhci: sdhci-pci-o2micro: Check if controller supports 8-bit width Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 036/113] powerpc/pci/of: Fix OF flags parsing for 64bit BARs Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 037/113] drm/msm: Depopulate platform on probe failure Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 038/113] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Greg Kroah-Hartman
2019-07-31 18:19 ` Pavel Machek
2019-07-29 19:22 ` [PATCH 4.19 039/113] PCI: sysfs: Ignore lockdep for remove attribute Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 040/113] i2c: stm32f7: fix the get_irq error cases Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 041/113] kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 042/113] genksyms: Teach parser about 128-bit built-in types Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 043/113] PCI: xilinx-nwl: Fix Multi MSI data programming Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 044/113] iio: iio-utils: Fix possible incorrect mask calculation Greg Kroah-Hartman
2019-07-30 18:51 ` Pavel Machek
2019-07-29 19:22 ` [PATCH 4.19 045/113] powerpc/cacheflush: fix variable set but not used Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 046/113] powerpc/xmon: Fix disabling tracing while in xmon Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 047/113] recordmcount: Fix spurious mcount entries on powerpc Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 048/113] mfd: madera: Add missing of table registration Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 049/113] mfd: core: Set fwnode for created devices Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 050/113] mfd: arizona: Fix undefined behavior Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 051/113] mfd: hi655x-pmic: Fix missing return value check for devm_regmap_init_mmio_clk Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 052/113] mm/swap: fix release_pages() when releasing devmap pages Greg Kroah-Hartman
2019-07-29 19:22 ` Greg Kroah-Hartman [this message]
2019-07-29 19:22 ` [PATCH 4.19 054/113] powerpc/4xx/uic: clear pending interrupt after irq type/pol change Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 055/113] RDMA/i40iw: Set queue pair state when being queried Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 056/113] serial: sh-sci: Terminate TX DMA during buffer flushing Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 057/113] serial: sh-sci: Fix TX DMA buffer flushing and workqueue races Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 058/113] IB/mlx5: Fixed reporting counters on 2nd port for Dual port RoCE Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 059/113] powerpc/mm: Handle page table allocation failures Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 060/113] IB/ipoib: Add child to parent list only if device initialized Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 061/113] arm64: assembler: Switch ESB-instruction with a vanilla nop if !ARM64_HAS_RAS Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 062/113] PCI: mobiveil: Fix PCI base address in MEM/IO outbound windows Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 063/113] PCI: mobiveil: Fix the Class Code field Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 064/113] kallsyms: exclude kasan local symbols on s390 Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 065/113] PCI: mobiveil: Initialize Primary/Secondary/Subordinate bus numbers Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 066/113] PCI: mobiveil: Use the 1st inbound window for MEM inbound transactions Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 067/113] perf test mmap-thread-lookup: Initialize variable to suppress memory sanitizer warning Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 068/113] perf stat: Fix use-after-freed pointer detected by the smatch tool Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 069/113] perf top: Fix potential NULL pointer dereference " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 070/113] perf session: Fix potential NULL pointer dereference found " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 071/113] perf annotate: Fix dereferencing freed memory " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 072/113] perf hists browser: Fix potential NULL pointer dereference " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 073/113] RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 074/113] PCI: dwc: pci-dra7xx: Fix compilation when !CONFIG_GPIOLIB Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 075/113] powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 076/113] block: init flush rq ref count to 1 Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 077/113] f2fs: avoid out-of-range memory access Greg Kroah-Hartman
2019-07-31 19:11 ` Pavel Machek
2019-08-01 1:19 ` Chao Yu
2019-07-29 19:22 ` [PATCH 4.19 078/113] mailbox: handle failed named mailbox channel request Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 079/113] dlm: check if workqueues are NULL before flushing/destroying Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 080/113] powerpc/eeh: Handle hugepages in ioremap space Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 081/113] block/bio-integrity: fix a memory leak bug Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 082/113] sh: prevent warnings when using iounmap Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 083/113] mm/kmemleak.c: fix check for softirq context Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 084/113] 9p: pass the correct prototype to read_cache_page Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 085/113] mm/gup.c: mark undo_dev_pagemap as __maybe_unused Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 086/113] mm/gup.c: remove some BUG_ONs from get_gate_page() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 087/113] memcg, fsnotify: no oom-kill for remote memcg charging Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 088/113] mm/mmu_notifier: use hlist_add_head_rcu() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 089/113] proc: use down_read_killable mmap_sem for /proc/pid/smaps_rollup Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 090/113] proc: use down_read_killable mmap_sem for /proc/pid/pagemap Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 091/113] proc: use down_read_killable mmap_sem for /proc/pid/clear_refs Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 092/113] proc: use down_read_killable mmap_sem for /proc/pid/map_files Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 093/113] cxgb4: reduce kernel stack usage in cudbg_collect_mem_region() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 094/113] proc: use down_read_killable mmap_sem for /proc/pid/maps Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 095/113] locking/lockdep: Fix lock used or unused stats error Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 096/113] mm: use down_read_killable for locking mmap_sem in access_remote_vm Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 097/113] locking/lockdep: Hide unused class variable Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 098/113] usb: wusbcore: fix unbalanced get/put cluster_id Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 099/113] usb: pci-quirks: Correct AMD PLL quirk detection Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 100/113] btrfs: inode: Dont compress if NODATASUM or NODATACOW set Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 101/113] x86/sysfb_efi: Add quirks for some devices with swapped width and height Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 102/113] x86/speculation/mds: Apply more accurate check on hypervisor platform Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 103/113] binder: prevent transactions to context manager from its own process Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 104/113] fpga-manager: altera-ps-spi: Fix build error Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 105/113] mei: me: add mule creek canyon (EHL) device ids Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 106/113] hpet: Fix division by zero in hpet_time_div() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 107/113] ALSA: ac97: Fix double free of ac97_codec_device Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 108/113] ALSA: line6: Fix wrong altsetting for LINE6_PODHD500_1 Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 109/113] ALSA: hda - Add a conexant codec entry to let mute led work Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 110/113] powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 111/113] powerpc/tm: Fix oops on sigreturn on systems without TM Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 112/113] libnvdimm/bus: Stop holding nvdimm_bus_list_mutex over __nd_ioctl() Greg Kroah-Hartman
2019-07-31 18:14 ` Pavel Machek
2019-07-31 19:31 ` Dan Williams
2019-08-01 8:47 ` Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 113/113] access: avoid the RCU grace period for the temporary subjective credentials Greg Kroah-Hartman
2019-07-30 2:34 ` [PATCH 4.19 000/113] 4.19.63-stable review kernelci.org bot
2019-07-30 9:11 ` Naresh Kamboju
2019-07-30 14:00 ` shuah
2019-07-30 18:42 ` Guenter Roeck
2019-07-31 5:30 ` Kelsey Skunberg
2019-07-31 9:35 ` Jon Hunter
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=20190729190708.242105787@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=johannes.berg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).