From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CA5C3DA7D9 for ; Mon, 9 Mar 2026 16:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773073765; cv=none; b=SjBlC+1LSik8eEAaJ1gAT/y1UT8wFv2q2X9QV6HBcBOxXjh2FMzkuF0pD6TRw1c+PFFIdEF0fRbU795ejivSLuIw4oMHPi01RR8KMiwd1BrroWg8qw3l+b/SDrDs/YGlMrwbXSsjcAk8s+ad1XMz7zk9m0tuBUZGZdo70Rd7GPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773073765; c=relaxed/simple; bh=UzNWTyd3SfcrfOQYE9PSx3JhKAI8b4XbeA/73gkXD0g=; h=Content-Type:From:Mime-Version:Subject:Date:Message-Id:References: Cc:In-Reply-To:To; b=YgRhkQbMD24jMv5JyknHlqhbk8LqWUFyvxcOanhpT2p7P/Vc6WBfY3iUROTS+OsgQq5t51Y9fyfV1QnIKUn6KvUamcqONCnUSshT5uoVaSmuLbQSHwTLmWDVn16Z3dPdHz3arXIbHyI/o5l0OtB1Mv96rR0zn/WAEkknighMcA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=afhafXXs; arc=none smtp.client-ip=74.125.82.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="afhafXXs" Received: by mail-dl1-f52.google.com with SMTP id a92af1059eb24-1271195d2a7so7607650c88.0 for ; Mon, 09 Mar 2026 09:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1773073762; x=1773678562; darn=vger.kernel.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=vUO4Zji7vHPsyKdLX1pAkmn2sfTGcz9pCB1/6/pG8iA=; b=afhafXXscLyUuPmfBoF6UYtHkGCA4YE5Ygv/uiJZjnqOU/3n170qMHcp/D8qEghc5U Vjn1IPS2rqCN8MaU+gBDCkNYsvzf+Ua6vf9mRYcGasDcQYFfZLZqWNwUm2GbkhF5Yd1l nkbvmnHW5HVFx6mVdrYXQN2g0vSDj63u2VcloewOhkSbwXZifMoGLsrZsA/RzcRcXyfK +LReS280jFbREykmKNjPk6tLqfnEcgEBNcoZ2RtYSaDLLB0i/qO8yjdk6NFM9jetMYBP 6wZenlfgdozzKSjkiHql1tQOAei/sOeRohghJbW1fsTQEvfuCfAZIrCP6x1mDAl1pdnG PyFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773073762; x=1773678562; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=vUO4Zji7vHPsyKdLX1pAkmn2sfTGcz9pCB1/6/pG8iA=; b=F3Ju9ZhfdW//h/ofmY6UQxmb5vTHPF8jxYPPFT/UoSpn1+fUXKQgQ8PA6ZVmsin2tG +AyNSd2/Kb0pAVaXRqJ8Htle5048E6Bnfwced5CKA1peBiEtqMYnkJCb0NXsX73wnVln oIG5a0z2qN2hr8xtit0sJmLCO8DGPVZJfcVM9GpXBh6sYJUvaS2sOOCH5QVmgzldGDLg Mz+1paWsomTZwiCxqL3j2ZhLJSxAgCjy6yn8YZbcF7yiYvSCQXqsHuRJetTvbvpr6J75 u7Rs7Ok9gH171jK/+8es6njiOGUXaljxjvhE/G9pWUBPfpk3SOKH3fDe++iNqo5q7qkl +S2Q== X-Forwarded-Encrypted: i=1; AJvYcCU0nfsBEmvoo3EhaRpgpqLLL8FfnDbU0wgbrjaFDodFylZMC1YQDwiBVxbKl+6eAsLvXAZgAIBWRHcDEcg=@vger.kernel.org X-Gm-Message-State: AOJu0Yzs4reC2MM/ZLOG1BqNBW9dFAPSE6wR4Zht82n+CHKqk0pfILc6 2O3LLa34Zjd5wB62Y9UddLpOBh5pxF/myvEJksApWuskJtvQN4kHdI4dozNrC3aUYFg= X-Gm-Gg: ATEYQzwRshGC68IQ0kT6UStxYJ4YULTAIIH1TsRAv8f0OlJLGScuDtjuW0xYS6mIm4j HYAGwScv4ty+G25MQ5txMW5cROAMPVEaKN3ITOQqlomp2SMbou21dtaX9gMvg62QHHRSSWwgnua H3osHpOJfR4HCrLzUMFEkaUwbkh5bqt2aX10m+ByfZe43cMq4RS8eahIJPeIMKvhl0zZ95aX4rr NmXRKu5aOnUjhBJ7ODeF7+++u3QGl6hM5mbZBydVG4UDommr3QuSxmHy2q67FRRjK3N/sWiJz8+ ZghWeklmdeMXLW666acCsnEf0woMHL0alc1UXQdJUci1LT8cynnj/QTJsrbJ3LESXvDlaf7u56g Xlx3PDpd5/FZ/41Lviarz9CtCEqx5KkjYfp5afbrnQHJH/6V2msltzLuubiXaAa3rEj786TBo/X zcOXju+QrRuG5uVRA61j0wqCrpOqdbsvs4j5T0fdYQU7oABtrnXjZQNArf7s+ayMVhUHrGve8Sg 1qC4biPFGcgGhkj3U3PvIivyzdDJtE3RWAp5xBP9ixrSSM= X-Received: by 2002:a05:7022:e1e:b0:128:d455:8501 with SMTP id a92af1059eb24-128d4558a50mr2367107c88.37.1773073762275; Mon, 09 Mar 2026 09:29:22 -0700 (PDT) Received: from smtpclient.apple ([2600:380:746e:1a72:40e9:6056:eb6b:53f]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-128db3d79fbsm2178258c88.4.2026.03.09.09.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 09:29:21 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Jens Axboe Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v1] io_uring/register.c: fix NULL pointer dereference in io_register_resize_rings Date: Mon, 9 Mar 2026 10:29:10 -0600 Message-Id: <42AD516A-B078-40A5-94EE-80739B9883E7@kernel.dk> References: Cc: Hao-Yu Yang , security@kernel.org, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: To: Linus Torvalds X-Mailer: iPhone Mail (23D8133) On Mar 9, 2026, at 10:05=E2=80=AFAM, Linus Torvalds wrote: >=20 > =EF=BB=BFOn Mon, 9 Mar 2026 at 06:11, Jens Axboe wrote: >>=20 >> You probably want something ala: >>=20 >> mutex_lock(&ctx->mmap_lock); >> spin_lock(&ctx->completion_lock(); >> + local_irq_disable(); >=20 > How could that ever work? >=20 > Irqs will happily continue on other CPUs, so disabling interrupts is > complete nonsense as far as I can tell - whether done with > spin_lock_irq() *or* with local_irq_disable()/. >=20 > So basically, touching ctx->rings from irq context in this section is > simply not an option - or the rings pointer just needs to be updated > atomically so that it doesn't matter. >=20 > I assume this was tested in qemu on a single-core setup, so that > fundamental mistake was hidden by an irrelevant configuration. >=20 > Where is the actual oops - for some inexplicable reason that had been > edited out, and it only had the call trace leading up toit? Based on > the incomplete information and the faulting address of 0x24, I'm > *guessing* that it is >=20 > if (ctx->flags & IORING_SETUP_TASKRUN_FLAG) > atomic_or(IORING_SQ_TASKRUN, &ctx->rings->sq_flags); >=20 > in io_req_normal_work_add(), but that may be complete garbage. >=20 > So the actual fix may be to just make damn sure that > IORING_SETUP_TASKRUN_FLAG is *not* set when the rings are resized. >=20 > But for all I know, (a) I may be looking at entirely the wrong place > and (b) there might be millions of other places that want to access > ctx->rings, so the above may be the rantings of a crazy old man. Nah you=E2=80=99re totally right. I=E2=80=99m operating in few hours of slee= p and on a plane. I=E2=80=99ll take a closer look later. The flag mask prote= cting it is a good idea, another one could be just a specific irq safe resiz= e lock would be better here. Jens