From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
syzbot+8c91f5d054e998721c57@syzkaller.appspotmail.com,
Jens Axboe <axboe@kernel.dk>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.6 12/43] io_uring: initialize ctx->sqo_wait earlier
Date: Fri, 5 Jun 2020 16:14:42 +0200 [thread overview]
Message-ID: <20200605140153.167206701@linuxfoundation.org> (raw)
In-Reply-To: <20200605140152.493743366@linuxfoundation.org>
From: Jens Axboe <axboe@kernel.dk>
[ Upstream commit 583863ed918136412ddf14de2e12534f17cfdc6f ]
Ensure that ctx->sqo_wait is initialized as soon as the ctx is allocated,
instead of deferring it to the offload setup. This fixes a syzbot
reported lockdep complaint, which is really due to trying to wake_up
on an uninitialized wait queue:
RSP: 002b:00007fffb1fb9aa8 EFLAGS: 00000246 ORIG_RAX: 00000000000001a9
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441319
RDX: 0000000000000001 RSI: 0000000020000140 RDI: 000000000000047b
RBP: 0000000000010475 R08: 0000000000000001 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402260
R13: 00000000004022f0 R14: 0000000000000000 R15: 0000000000000000
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 1 PID: 7090 Comm: syz-executor222 Not tainted 5.7.0-rc1-next-20200415-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x188/0x20d lib/dump_stack.c:118
assign_lock_key kernel/locking/lockdep.c:913 [inline]
register_lock_class+0x1664/0x1760 kernel/locking/lockdep.c:1225
__lock_acquire+0x104/0x4c50 kernel/locking/lockdep.c:4234
lock_acquire+0x1f2/0x8f0 kernel/locking/lockdep.c:4934
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:159
__wake_up_common_lock+0xb4/0x130 kernel/sched/wait.c:122
io_cqring_ev_posted+0xa5/0x1e0 fs/io_uring.c:1160
io_poll_remove_all fs/io_uring.c:4357 [inline]
io_ring_ctx_wait_and_kill+0x2bc/0x5a0 fs/io_uring.c:7305
io_uring_create fs/io_uring.c:7843 [inline]
io_uring_setup+0x115e/0x22b0 fs/io_uring.c:7870
do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x441319
Code: e8 5c ae 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 bb 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fffb1fb9aa8 EFLAGS: 00000246 ORIG_RAX: 00000000000001a9
Reported-by: syzbot+8c91f5d054e998721c57@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/io_uring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 832e042531bc..8bdf2629f7fd 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -822,6 +822,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
goto err;
ctx->flags = p->flags;
+ init_waitqueue_head(&ctx->sqo_wait);
init_waitqueue_head(&ctx->cq_wait);
INIT_LIST_HEAD(&ctx->cq_overflow_list);
init_completion(&ctx->completions[0]);
@@ -6004,7 +6005,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
{
int ret;
- init_waitqueue_head(&ctx->sqo_wait);
mmgrab(current->mm);
ctx->sqo_mm = current->mm;
--
2.25.1
next prev parent reply other threads:[~2020-06-05 14:25 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-05 14:14 [PATCH 5.6 00/43] 5.6.17-rc1 review Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 01/43] x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 02/43] Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window" Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 03/43] ARC: Fix ICCM & DCCM runtime size checks Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 04/43] ARC: [plat-eznps]: Restrict to CONFIG_ISA_ARCOMPACT Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 05/43] efi/libstub: Avoid returning uninitialized data from setup_graphics() Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 06/43] evm: Fix RCU list related warnings Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 07/43] scsi: pm: Balance pm_only counter of request queue during system resume Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 08/43] efi/earlycon: Fix early printk for wider fonts Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 09/43] x86/hyperv: Properly suspend/resume reenlightenment notifications Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 10/43] dmaengine: ti: k3-udma: Fix TR mode flags for slave_sg and memcpy Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 11/43] i2c: altera: Fix race between xfer_msg and isr thread Greg Kroah-Hartman
2020-06-05 14:14 ` Greg Kroah-Hartman [this message]
2020-06-05 14:14 ` [PATCH 5.6 13/43] io_uring: dont prepare DRAIN reqs twice Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 14/43] io_uring: fix FORCE_ASYNC req preparation Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 15/43] net: phy: propagate an error back to the callers of phy_sfp_probe Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 16/43] x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 17/43] net: bmac: Fix read of MAC address from ROM Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 18/43] drm/edid: Add Oculus Rift S to non-desktop list Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 19/43] s390/mm: fix set_huge_pte_at() for empty ptes Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 20/43] io_uring: reset -EBUSY error when io sq thread is waken up Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 21/43] drm/amd/display: DP training to set properly SCRAMBLING_DISABLE Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 22/43] riscv: Fix print_vm_layout build error if NOMMU Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 23/43] wireguard: selftests: use newer iproute2 for gcc-10 Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 24/43] null_blk: return error for invalid zone size Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 25/43] net: ethernet: ti: fix some return value check of cpsw_ale_create() Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 26/43] net/ethernet/freescale: rework quiesce/activate for ucc_geth Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 27/43] net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 28/43] selftests: mlxsw: qos_mc_aware: Specify arping timeout as an integer Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 29/43] net: Fix return value about devm_platform_ioremap_resource() Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 30/43] net: smsc911x: Fix runtime PM imbalance on error Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 31/43] mm: Fix mremap not considering huge pmd devmap Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 32/43] HID: sony: Fix for broken buttons on DS3 USB dongles Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 33/43] HID: multitouch: enable multi-input as a quirk for some devices Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 34/43] HID: i2c-hid: add Schneider SCL142ALM to descriptor override Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 35/43] p54usb: add AirVasT USB stick device-id Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 36/43] mt76: mt76x02u: Add support for newer versions of the XBox One wifi adapter Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 37/43] crypto: api - Fix use-after-free and race in crypto_spawn_alg Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 38/43] kernel/relay.c: handle alloc_percpu returning NULL in relay_open Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 39/43] mmc: fix compilation of user API Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 40/43] media: Revert "staging: imgu: Address a compiler warning on alignment" Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 41/43] media: staging: ipu3-imgu: Move alignment attribute to field Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 42/43] net: dsa: mt7530: set CPU port to fallback mode Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 43/43] airo: Fix read overflows sending packets Greg Kroah-Hartman
2020-06-05 15:30 ` [PATCH 5.6 00/43] 5.6.17-rc1 review Shuah Khan
2020-06-05 15:48 ` Greg Kroah-Hartman
2020-06-05 22:13 ` Shuah Khan
2020-06-06 6:27 ` Jon Hunter
2020-06-06 13:34 ` Guenter Roeck
2020-06-06 16:12 ` Naresh Kamboju
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=20200605140153.167206701@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+8c91f5d054e998721c57@syzkaller.appspotmail.com \
/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).