From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1142D27A127; Thu, 5 Jun 2025 20:33:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749155604; cv=none; b=NvC8eQ/JJA46dCJrfsq/p7plzQpqVzRj9NxFgT1dUf+YpodZZMZkIvGZCFNjG0WEJAmrxX/WJbb5nSj+sFPuFxYE2fiGO9/Y+8koYfVJJekmf/+UISP2sD+Cre6+0Mzf/nRROoAnFYmzZ9HFJVyFPjvewCl0I4Clxi3NPFDFPAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749155604; c=relaxed/simple; bh=LqPpE5uLwfjDAz02pBK0TvjVK+8DTskFli7aSpfSgTs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uWzS8Y6/4BKNdb+ZrNAVwxlDwIxL+pEQ+OxysJAuzqDEB9xTlrnNfOtbkq6WslaIW4CqZxt6eH18i6pgkDjsdByoqBRZ2Fkut4m4uUzMJHfGAbSXryaTib+NSIFljnKnjG/kg0YpguLAemVNYeU3suRDpZiu7DKeXJUNbIpUlWI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UGgYBYmZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UGgYBYmZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF3E2C4CEEB; Thu, 5 Jun 2025 20:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749155603; bh=LqPpE5uLwfjDAz02pBK0TvjVK+8DTskFli7aSpfSgTs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=UGgYBYmZH9f1+FHgAlKdJCFw3jcobKPBsADjisneQVg6NP1ZRlONu4cHfBk9VdvUb 8WY/35dj6D69eCiUuDUnTyg7mNCfxbI7bilnru7s8SbaZ9lC1WzPsrI9KxYfNsGgfd OWRET5ZnD0SaxKHZAa5J9BI2FGqt9nX6aV0Qf8XKLgQ/e8whLiFBQ6k+vRN0MC+NJl IaegNTAgV1mXAyMPY0YGHwjKFkMHQiyqNyUgLdrM6jRblJknAlyjt/gIHSTpVj0Qcs +SsSQGUvvJEWIwqtrjBJBsBW4Z0XGoX8GmZPO9A4JbVD0Tr1WhAeiJLYwdby+Nokjw 2AYg7EL9aswlg== Message-ID: Date: Thu, 5 Jun 2025 22:33:17 +0200 Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] rust: types: add FOREIGN_ALIGN to ForeignOwnable To: Andreas Hindborg Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Bjorn Helgaas , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Greg Kroah-Hartman , "Rafael J. Wysocki" , Tamir Duberstein , Viresh Kumar , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, =?UTF-8?Q?Ma=C3=ADra_Canal?= References: <20250605-pointed-to-v1-1-ee1e262912cc@kernel.org> From: Danilo Krummrich Content-Language: en-US In-Reply-To: <20250605-pointed-to-v1-1-ee1e262912cc@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/5/25 9:55 PM, Andreas Hindborg wrote: > The current implementation of `ForeignOwnable` is leaking the type of the > opaque pointer to consumers of the API. This allows consumers of the opaque > pointer to rely on the information that can be extracted from the pointer > type. > > To prevent this, change the API to the version suggested by Maira > Canal (link below): Remove `ForeignOwnable::PointedTo` in favor of a > constant, which specifies the alignment of the pointers returned by > `into_foreign`. > > Suggested-by: Alice Ryhl > Suggested-by: MaĆ­ra Canal > Link: https://lore.kernel.org/r/20240309235927.168915-3-mcanal@igalia.com > Signed-off-by: Andreas Hindborg I think having the pointer type be `crate::ffi::c_void` was much more convenient for users of the API anyways. :) Acked-by: Danilo Krummrich