From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 14FA9355F28 for ; Sat, 11 Apr 2026 12:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775909523; cv=none; b=JvgEsJd9ujb2LS7xbsv+45kQam8ONbCAwiqFW+O/r/kdKn7bG7sYT//uYWZyLcXUgQwoWdllAmhNol2rFHD6We4kLKwm/FMgvsAfulodM8E6nJdRpaVj2ne5//19PT/Li5+WZZFm8dPge42eoKuCfZw6p6ZW6ZbE1huboI3k2NA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775909523; c=relaxed/simple; bh=zsYs4OLXoGqDPcSmx3jK/qfu7bvAUeaA/qPH6qC3Rpo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c4aROy+ez93wh0blYzpbIUUC5KHWKqXYprk30hbpEWFnKLFbfn+J6QmOYdYHy7m/Mu5fhROOa2Q2NS8NLlSh+3N8Zgt6nuNEnQUyWfO+0rjRK/saIzIhCVde3KFotV47bfbMvniTnBnyMeVZiqs4uSXhCXftaBiQwQyxLtn5VAU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=furiosa.ai; spf=none smtp.mailfrom=furiosa.ai; dkim=pass (1024-bit key) header.d=furiosa.ai header.i=@furiosa.ai header.b=GhHhkdZp; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=furiosa.ai Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=furiosa.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=furiosa.ai header.i=@furiosa.ai header.b="GhHhkdZp" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-82f0fc82c76so579960b3a.0 for ; Sat, 11 Apr 2026 05:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=furiosa.ai; s=google; t=1775909521; x=1776514321; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=q1SyhuRgernCsatZuwdE9rDQ3zbipJuCy6jd3/mR088=; b=GhHhkdZpXhM74OnGkCRGDyH9B+Y/4SM9f1ixBpL9QEypLH4kq9kOADV5/gMuJfW4KV dGNOFJs+B9GHQpgBg1qEbnYBb/E9CkKh5ky3FqdunGWWDeVxHyfpJBD6im2HmDKms0W1 lYr6aLRFmlqExWYOpcT3H8THNG0vBdbk0WzSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775909521; x=1776514321; h=in-reply-to:content-disposition: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; bh=q1SyhuRgernCsatZuwdE9rDQ3zbipJuCy6jd3/mR088=; b=TlDa3RxC10OV0OrVrcVyuPaLI+2xZjwb8GvNst8oxpGYCP/mWCij1uPjZhgeoV/Zkx ILmpEiXLCvSGQ5JCbrGzd/fbRbQQlH0+qyk6BhKtF2hXHB4tn4AMck7HNKlot0TX+l0M OiwnK0ajVzUH0Quc51KplOhka0j63PO8x0t0w2rNX5F0jKzBCvEPCLgl20O9ExPMOXEh KDbp0fLIAbTWhdhhTwljzcZNmWwXF7rHUmKttAfVMHDTvPyTpsOQtRqxnqyibWVFu7iO XFy8HMEyxn6idFrFla46LnXKgWhnTwQFTA/M18aNxFRHcLKcFWUO8poxXhP59D43vrro rVAg== X-Forwarded-Encrypted: i=1; AJvYcCVOXQX4Ezyu5QJ4QVQWtmU78CN+qsQuNO8YWm81+i9IszLVmVdzoxUTjPsVVuQARKlg01y3tFVeOEifMLE=@vger.kernel.org X-Gm-Message-State: AOJu0YwpcluA3UZSgF2nMb0JLNm3ordChSrYHbcKY8FVmK7l4VXsMGuo LEhpww0Lg6xdw0UDoySgW/CpirUFPVyZALhHnBBmI+sPQKjcrAFCzERCmK3LvtQuy45yvjbVSAm vSBuAO6I= X-Gm-Gg: AeBDies2UDNyQOchkCB/QDe0rXj1Bu05CP+ka6AZBevKx4ruzh7AV7Rb4U2rchB/327 ji29XeCtkFQflOraNiL1hsU8RwOruR1lbhEBE2H9SafX4P7L4VafeQpKcksaxHL3nJQtZMWojaH 4o7l2BLoJhl834pNaYCGIi70/KSO+2g4lZ39fnbcLae9wWUQPlHzf9zxKDdFuy9Zyc/V+lwUVC6 ytFLd3sU4TUA8F+soAndUcE2BxgoJY9FTtPhd1OX7+DKNBTBR9Nr7NERaRaxtkbGPcEUe6+8gXE XU2/vR6CCa1o2xfbk48JcbbdOVtNtiumQ+ApWN9nBOqKMqPz3KZVJOr9xQoLUziBk7J1YghwNb3 XFkvkBvk7HuCaGK6CiyHnYXXby3D+XVWxGWq4q4nI+44dzREJSLJjRfkU+hLANuIVYyRi9mvKFs PyRym3zjTuPW/oY1vWYw== X-Received: by 2002:a05:6a00:138c:b0:82c:21af:a7bf with SMTP id d2e1a72fcca58-82f0c15db51mr7233864b3a.13.1775909521285; Sat, 11 Apr 2026 05:12:01 -0700 (PDT) Received: from sidong ([61.83.209.48]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f0c4b6d43sm4993403b3a.31.2026.04.11.05.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Apr 2026 05:12:00 -0700 (PDT) Date: Sat, 11 Apr 2026 12:11:56 +0000 From: Sidong Yang To: Greg Kroah-Hartman Cc: Jens Axboe , Daniel Almeida , Caleb Sander Mateos , Benno Lossin , Miguel Ojeda , Arnd Bergmann , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org Subject: Re: [PATCH v4 2/5] io_uring/cmd: zero-init pdu in io_uring_cmd_prep() to avoid UB Message-ID: References: <20260408140007.8401-1-sidong.yang@furiosa.ai> <20260408140007.8401-3-sidong.yang@furiosa.ai> <2026040908-certainly-dealmaker-5530@gregkh> 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: <2026040908-certainly-dealmaker-5530@gregkh> On Thu, Apr 09, 2026 at 07:27:18AM +0200, Greg Kroah-Hartman wrote: > On Wed, Apr 08, 2026 at 01:59:59PM +0000, Sidong Yang wrote: > > The pdu field in io_uring_cmd may contain stale data when a request > > object is recycled from the slab cache. Accessing uninitialized or > > garbage memory can lead to undefined behavior in users of the pdu. > > Who accesses this? If that happens, then yes this is a problem, but if > not, then there's no need for this change, right (i.e. either this is a > bug to be fixed now or not.) Hi Greg, Thank you for the review. You are right, this patch is not fixing an existing bug. I added it because the Rust abstraction provides read_pdu() which reads from the PDU, and without zero-initialization a Rust caller could observe stale data from a recycled slab object. While "stale but valid" might be harmless in C, in Rust we want to guarantee a clean initial state. That said, I realize this is a C-side change that is only motivated by the Rust side. I will drop this patch from the series and handle zero-initialization within the Rust miscdevice vtable wrapper instead (which the current code already does). Thanks, Sidong > > > Ensure the pdu buffer is cleared during io_uring_cmd_prep() so that > > each command starts from a well-defined state. This avoids exposing > > uninitialized memory and prevents potential misinterpretation of data > > from previous requests. > > Where is the memory exposed and who misinterprets it? > > > No functional change is intended other than guaranteeing that pdu is > > always zero-initialized before use. > > This strongly implies that this is not needed at all. > > thanks, > > greg k-h