From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 875BC380FE7 for ; Fri, 11 Sep 2026 22:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789166970; cv=none; b=oomtk9P+slcRMnxmByOtDOjyjmizh3qdYe/sS3wr/jOr4qUXQN5Q3gsMPOGcptLKR/fmB4G4kdE+53nsNOj3NK4pzc1bVGZ7YgCmlcpv2dpIdlY+OhsHqmtAZqwbq5m7kV6Quqz0mgr744tHDRZRzwAy8L0RaFmki4GfbbFofzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789166970; c=relaxed/simple; bh=r7gJUmlNhu91hRTpaNPKWXWjU0T1D5vdR1MPcCbBlXU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SmChvSYOsdDhUYCIGbXesgodOhh4PC4Wd3ArANBp91UjRqFCisEcZsPPmVKtUMMViLEiCZpJqphx6gMxIR1DOsoOp3IEOMaVmzHRCxVow9EzSVysCGlJ3kYlPxJInvrxXEsrZ4Ib/DOPU01zB4F9FJo/CZwg9XNnjDZDoN6LcDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M85Y2Yjy; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M85Y2Yjy" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-49e63568bfbso10492885e9.2 for ; Fri, 11 Sep 2026 15:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789166968; x=1789771768; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=QBxB2AmGJkKp9i5tKgUFrxZA33MoBn9KXbxevCCY/UU=; b=M85Y2YjyUtIsPAC+mGvNqZZ2yBZLcF/CM9+4iDMCN1Nk4ohckcNoBPcpWvfuvqBNDK QmYElMs1LN8P8Zr7EVBTE8H3pCpvk2eACjEPCV9N/tUVD4NNlMtTBSSTjPJakSsDCcNA Gp6yexVnMqd2aluKyae4JspeAqHz/Pnc+33YGDRfrFeU69gRfkUiIfp0UgRcFk3Icuzz bFGIemVen4RMy/nbN/IWeW+sMI2lWvVpn7EenB9bWwh/xNEKtG+nbLtQyamwkWCd1uxi bvkuFGZQXuUnvGUDRjwNAgYWLgpGrdwYdkZZhhQ2KkGsYjOIPRjkRy7VuJUG4+dZTMTq EuZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789166968; x=1789771768; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=QBxB2AmGJkKp9i5tKgUFrxZA33MoBn9KXbxevCCY/UU=; b=gUVgffXSPK2XPlpmjv0GTaX7efovnl7UzW1Sd2dZyVw5kRXt5xZY2n915DOlLTbTL8 qDodOCo88pGxnftaOHgDQpD2U/x/oSDXWEbCEI0E/Owcfnu2qCYm6fTjo3tNROi1Rijf A3lwaptlOE/ccbQH+9IQ0PkZ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 2002:a05:600c:1385:b0:49c:fc6e:8cbd with SMTP id 5b1f17b1804b1-49e619e86c6mr62588065e9.33.1789166967648; Fri, 11 Sep 2026 15:49:27 -0700 (PDT) Received: from unknown748F3CBA5068 (dynamic-095-114-033-154.95.114.pool.telefonica.de. [95.114.33.154]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb36e4a6sm9132172f8f.37.2026.09.11.15.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 15:49:26 -0700 (PDT) Date: Sat, 12 Sep 2026 00:48:54 +0200 From: Karl Mehltretter To: "Michael S. Tsirkin" Cc: virtualization@lists.linux.dev, jasowangio@gmail.com, eperezma@redhat.com, xuanzhuo@linux.alibaba.com, jiri@resnulli.us, sashiko-bot@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 3/3] virtio_pci_modern: move avq cleanup from reset to del_vqs Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Sep 11, 2026 at 05:20:15PM +0100, Michael S. Tsirkin wrote: > New in v3. v2 dropped sync from modern vp_reset in one combined > patch, leaving avq_cleanup in vp_reset. v3 moves avq_cleanup out > of vp_reset entirely into vp_del_vqs, fixing the race. Adds NULL > check for admin_vq.info for find_vqs error paths. > I think patch 3 introduces a use-after-free in the MSI-X setup error path. With VP_VQ_VECTOR_POLICY_EACH, vp_setup_vq() stores the admin queue's info pointer before request_irq(). If request_irq() fails, vp_del_vq() frees info but leaves admin_vq.info set. vp_find_vqs_msix() then calls vp_del_vqs(). vp_del_vqs() now calls vp_modern_avq_cleanup() first and dereferences the freed pointer: vq = vp_dev->admin_vq.info->vq; No interrupt needs to fire. I reproduced this on v3 with KASAN by returning -ENOMEM only for the admin queue's request_irq(): BUG: KASAN: slab-use-after-free in vp_modern_avq_cleanup+0xf4/0x110 KASAN shows the allocation in vp_setup_vq(), the free in vp_find_one_vq_msix(), and the access in vp_modern_avq_cleanup(). Adding *p_info = NULL after vp_del_vq() made the same test fall back and boot without a KASAN report. Thanks, Karl