From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.144 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796477722; b=bGr6XFZUDYlqnf15/QHhiMqDLmvDnHI7n0L2ybL6L5R3sSPV1+uPbfhtlnEjPO+NFWFS Kj4niCFBKHvqSdsojIMXIRGz51IVjqpqKfFpy67dtNaaIWANT1l/4pYot8Bk2JVS3T+Cz 01SXyEBVuMWpvxGK/GUCeileJUDcFyZG9er8t/HE0L1Jgtnt+9WpP2H4IfS0sfgKxqLhM hIm4orR8C2zQp2E/ihx+8NU9Yi8ElTc45B0nedsWRreCz9j1Rr4SrL3lECMxSsBJKvG1B 5LtUAu5Jqc657Zm0at9E0SBEDUt5xukw/DZxLO07MLdFGiRTkW1K4zTZLRYJ/h1lwTw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796477722; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=bow8cCrEutxypzY3Rmmt+lWoDuE2bLvEX3UBsqqMeuM=; b=l21F4vRAfVjE4xEt73UQ26m0PN5vd1lDjwGlCcO+Fa1PRltgxu4/zvEdubZ8ReS6xCRX mkx+FE2W+ic5YmuVcgCqDuaT5Bv7/8jgX1eYp22L79n2P0/EabwWBpI+GUKMdJou2XOMy LMkiqL5VDmlWNc9wsilZgWQvM7y+MEeRRNgiyzd5PNkOWBrg5kanOJVvcLEtoXz7D+IfM YTD3ZKD1tvTUFGn30hliJVMllgpCpmXzoKqn2Kz/B1eQHVGCU2pe/w5w78PxuituhVYKC ClIgiEAR9G2DHORPpXtLgejmjTxOYVG+YThqgE1tjUnnyNJuEZeT35tsTdnap01xcTw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=jannau.net; spf=pass smtp.mailfrom=jannau.net; dkim=pass header.d=jannau.net header.i=@jannau.net header.a=rsa-sha256 header.s=fm2 header.b=dcgfke5a; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b="marvM/lb"; arc=none smtp.remote-ip=202.12.124.144 Received: from fout-b1-smtp.messagingengine.com (fout-b1-smtp.messagingengine.com [202.12.124.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84D0E606A32F for ; Sat, 5 Dec 2026 13:35:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 84D0E606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jannau.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=jannau.net header.i=@jannau.net header.a=rsa-sha256 header.s=fm2 header.b=dcgfke5a; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=marvM/lb Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id F3D4C1D00151 for ; Sat, 5 Dec 2026 08:35:21 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Sat, 05 Dec 2026 08:35:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jannau.net; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1796477718; x=1796564118; bh=bow8cCrEut xypzY3Rmmt+lWoDuE2bLvEX3UBsqqMeuM=; b=dcgfke5aY07+XojZdUjFmXSUsk MaK/YLUJ93UFWj2d+7lgP/NKhJuZbaz/IQnyMttNeYH9TYrJ2hdMDr3tDRGKxfQ9 n7y7GW8n17PYjyXY6J4eoXVq1w+6e6stBqWYnkeNQw6p2loq9K6oyVtbcdz461eD sSovdc/AoVJJhooF7EhN0L6KU5uk47PIoNzRoxMRlt2j8pZz36itxdJruJj3nnlV 9RAcOPhxYdr2rE1VIwXdKZ8gwogOmFqjiPaHbnob7pqtavqU4LoL2X0RpG9gz9tN nI2BOEZvSsP2jN+8rq8mkQuCWQJF+U+v+I+1HE6lRuzuCoGJDuVTMIfL5hBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1796477718; x=1796564118; bh=bow8cCrEutxypzY3Rmmt+lWoDuE2bLvEX3U BsqqMeuM=; b=marvM/lb7qdT9aQUC+5ChfOzd4j/HcFyetgkNw28G27GNMuM48b vxXzlcwmgmKXmKpu0Epw4MssGxdUUtQwrfkGyTiGSZyI0HQ59hFhEsMnWPzvfGKf 7HCoF6OU1ZYcPGGZI5o2/VSXaO8q93rUdEiLt5XRIcfQ/kQSplYGApttqNInrY1l oUUE6G1s03ElSbhpn6/yRIMX0T8H6azI9OGCtaRJfFpjl+EFOXgCZDdvgV2mQT8N 8Npp30opqLXY7qvW/EnijhIu+yjPml5ENyBXAqJdPUyeQ4dHGYXI9apOIsYmYblb 31MRIaIxgwmTj3v/5ApJ+4f2St8QwOOX8Bg== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=jannau.net a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796477718; d=jannau.net; mf=PGpAamFubmF1Lm5ldD4=; rt=PGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+; s=fm2:rsa-sha256:JlxGJr8kRAAJ18QJWsYJLpigAneL5qfaJ0aDy1a4R1N/dWn w5pN0+7Vxi7QoJ+CIIDVYsp/TdJzBfH5yBTt1XL0r8HCpx/fyZSp9IHu0WLmLKWw p4dGUnC5iduZAIFLsTnknXh8wjxa9YUp+yDyqFDJvf5Z1gvxONc/0LZYfTJdr/1k tAe/jjJKUReTUvqXYmEvPzXBTwdt5HRj8XR6Ep9DawfQh+KNF1peFpcjrGSuqdWD 9Aae9sE7tDHJ3DF4u5G0PQfHVBiG5zgQPTO40TJzf/luW82O35ym63cKL7lYor8m whxTiarmr8mui+7hN4R/4PKkaLg3eJXd2Hi+vpg==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:5H5isMUXK2jd+ukemwESaoLCGvJc6c/SoCFIPGK+Fag=:hNfRDQfcGFkfd5LZo34wT2bkLXOKWEXuP9IdrOd2/Rw=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTF9UUIqC5gWrL2tS8pLAmAx+rzSoJdnxQZP/wqXu0TxvTPnurgvcCnkOiEhKQCt3V qVD6DA/NTvEsXUipEE0oCnWXJcL5O3IO7gWAq/q7Pyud/ReLM9Sc6khoVR/9Yx14oY5nCI Mz53/+tod9/RXvHYGrMl58DJS/saQJutEOLzC40uyXw8Z3OwGImaw9VVhFuqM0D1fgfcVw 8+qxvlCH9bxhhqtMXelfSs5IQApoTZbXV4sMw4qvP0q8NDkj0eSOjHsDIdEfz58flgWTTg CFHM7KwvmT+3gA7oqH5rj2LVhoaUlGHVfunk2rXIad/6ZJlOkEhuKtzM+tasq+8a36XXYM g64+G/u6Nrb7heGtQB/X3Z2eSAtTLNm62zlr8BkFJcsgBej0AlZLLz8HrE5AZbQkaloBZl mtHLdf9UOCLAo3xx9iqnwssUPIhaIhXKOyw2dqTSvXdNKysH5W8rKZMLcMUXxppIh2DKe/ P9fq1/Um6Rbx/3wYZ7xHF95RsAK/JAlx6EIeE1uuR4eMlH26TFWIef4ypoRJOXRARI2Egl IkiKEfbXeZXMdM3YcPHVsWfFpYVeanJou5WJ32+SHIJPfEFU/SYapguml4lGj2ZKGAZIkE s5UL32NdmO898q84d46KzaF5QXn5cAOli1eAJn7gS/rAHUSBj/9MUPQ61DdA X-ME-Proxy: Feedback-ID: i47b949f6:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Dec 2026 08:35:16 -0500 (EST) Date: Sat, 5 Dec 2026 14:35:15 +0100 From: Janne Grunau To: Daniel Almeida Cc: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Tamir Duberstein , Alexandre Courbot , Onur =?utf-8?B?w5Z6a2Fu?= , David Airlie , Simona Vetter , Sami Tolvanen , Lyude Paul , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, stable+noautosel@kernel.org, Deborah Brouwer Subject: Re: [PATCH v3 3/5] rust: drm: gem: shmem: Implement prime_import_sg_table callback Message-ID: <20261205133515.GA551683@robin.jannau.net> References: <20261203-rust-drm-gem-shmem-imported-sgt-v3-0-8ca393e83e20@jannau.net> <20261203-rust-drm-gem-shmem-imported-sgt-v3-3-8ca393e83e20@jannau.net> <0FBD4F41-517B-4108-AC90-9D89F960AA5F@collabora.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <0FBD4F41-517B-4108-AC90-9D89F960AA5F@collabora.com> On Fri, Dec 04, 2026 at 06:15:17PM -0300, Daniel Almeida wrote: > > > > On 3 Dec 2026, at 07:14, Janne Grunau wrote: > > > > The C drm_gem_shmem_prime_import_sg_table() helper function uses > > `__drm_gem_shmem_create()` to create shmem objects. In the absence of a > > `gem_create_object` callback this allocates just a `struct > > drm_gem_shmem_object` resulting in buffer overflows when using it as > > Rust `Object`. > > Implementing the `gem_create_object` callback for RUST DRM drivers is > > not sufficient as `__drm_gem_shmem_create()` uses `kfree(obj)` in error > > paths. This is unsound if the DriverObject contains fields with > > non-trivial `Drop` implementations as noted in [1]. > > > > Imported BOs have no userspace creation arguments, so extend > > `DriverObject` with a `create_imported(dev, size)` constructor and > > implement it for Tyr's `BoData`, Nova, and the in-tree KUnit driver. > > > > Tested with the asahi downstream driver. > > > > Link: https://lore.kernel.org/rust-for-linux/20261118114102.490384-1-aliceryhl@google.com/ [1] > > Fixes: 80df573af9ef ("rust: drm: gem: shmem: Add DRM shmem helper abstraction") > > Cc: stable+noautosel@kernel.org # no in tree users > > Suggested-by: Alice Ryhl > > Co-developed-by: Sami Tolvanen > > Signed-off-by: Sami Tolvanen > > Tested-by: Deborah Brouwer > > Signed-off-by: Janne Grunau > > --- [...] > > diff --git a/rust/kernel/drm/driver.rs b/rust/kernel/drm/driver.rs > > index f6db91e81e79..7e8e842421a4 100644 > > --- a/rust/kernel/drm/driver.rs > > +++ b/rust/kernel/drm/driver.rs > > @@ -118,7 +118,7 @@ pub trait Driver { > > type RegistrationData<'a>: Send + Sync + 'a; > > > > /// The type used to manage memory for this driver. > > - type Object: AllocImpl; > > + type Object: AllocImpl; > > I think this should be its own, preceding patch, IMHO. > > This change is needed regardless. The problem only became apparent now with > imported buffers, but it is otherwise a pre-existing issue. I don't disagree but I forgot to split this off before I sent v4 out. I don't think it justifies a respin. We're very close to -rc6 and I'd like to see this in the pull request for v7.5. Janne