From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796054410; b=iwXdFihOUZIzGLrWo6mq9KuVCbzZTl/HNY30oqqKzzy1uZlZVqRLNDSIWOASXX/2wO51 1ArPBAoXSDKIGHm9wAR5NcX8SlUe521dG053c+FXN6oOTI267tFFyGLGV59mrsIiqdKJ/ RX2g/XONK32wOe+pBn2hLkGr773cqlkzfOi1EGFGbDnpLaey+1I7hN0YyWvOiB+h2/wOF 1+AgPRxUXYhjwVk1x9tVqXqoWFcsKqsdksNr3/8d9mV0tjxYLuiAoAQj1W3f3vCd3hiwn kb4aYDr5wTKedZBpoDznLMHgDQfYPKSLQzekTJAb37z+EjpuYrxmmfaqUZ245ywnaGA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796054410; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=jvLa31yVYzPj/ZhtQiQS6KDxIz7Roo7TWXP8sff9VoM=; b=BXdGhmEmw9KhfNObRkoNs5RVWZc/ksCZ+rmrvWZK/7NdaiZhUdgYSyHHquxxf1L70A5Y k7Ey3PWPanvW0s8cyXImsoeIUAXG0yCWV3yr3BH8k3sYZvQKMoj0Lj1mVAmhhPBkZKxoN I3FpXhpIcz9ttZiuLf2mTi8d94k6xUEtfc+nXMtJJvsPaq5Rl+t110aI4ZJoj0lx5W9Ci pRc5ZuL8NB2XjTy/+3rjv+VO6XDTEUeyZRCNRDWktZwmDGeDCw9RDo7h0l7hcv60hEtoX Mycs2od9sPAVYxoxdO6X/jiRlBYAKCvoUQG0C0kcU+wLRoK3vJxhqo0LQUo/Ag8Ln8Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XcXSquE5; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 7E863606A329; Mon, 30 Nov 2026 16:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XcXSquE5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D820A1F0089B; Mon, 30 Nov 2026 16:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796054410; bh=jvLa31yVYzPj/ZhtQiQS6KDxIz7Roo7TWXP8sff9VoM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=XcXSquE5EQmz3EStcwUdKpRFl939n+WFooSUkHtEX/31a5lPoHWn9OI5Xu/Ez87p5 Wy4HEK6Kza18aYu4KZDZV3/hKFomRnO71evJo02yFOxApkTp+Nl2IgCw3qRAWg5Sii WSBVAvGJ3hcG2m46X+FsF0KPFMQtd5qd+IV4NpkTpM/71WPCnRugF6t43oEA7UGSVn d8jc3SSJ2x/Bpv/dvxFjgAZjXx+EHKQyZwgkNWuZQIXCD8K2JU88r2OpZv0T/7Abx8 C+3Bej9qpP1+szHrVITKe8a/no7Agrcp6ooTQwkqVLpQgvHFNHmqgNQHrwF37G5bgv /Wf7RGYT6ctNQ== From: Andreas Hindborg To: Bilal Hashim , Miguel Ojeda Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Bilal Hashim Subject: Re: [PATCH] rust: configfs: initialize AttributeList at compile time without UnsafeCell In-Reply-To: <87y0aas4d5.fsf@t14s.mail-host-address-is-not-set> References: <20261127120646.664-1-AeeSec@126.com> <87y0aas4d5.fsf@t14s.mail-host-address-is-not-set> Date: Mon, 30 Nov 2026 17:00:02 +0100 Message-ID: <87v75es41p.fsf@t14s.mail-host-address-is-not-set> 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-Transfer-Encoding: quoted-printable Andreas Hindborg writes: > Hi Bilal, > > "Bilal Hashim" writes: > >> The configfs_attrs! macro currently declares a global static AttributeLi= st >> wrapping an UnsafeCell<[*mut c_void; N]> and populates it at runtime via >> AttributeList::add() on every macro invocation. >> >> Although the static identifier is lexically scoped inside the macro bloc= k, >> the static storage is globally shared across all invocations and threads. >> When a function invoking configfs_attrs! (such as make_group() in >> drivers/block/rnull/configfs.rs) executes concurrently on multiple >> threads, or while C configfs concurrently reads ct_attrs_const, the >> unsynchronized &mut writes into the static UnsafeCell cause aliasing UB >> and a data race. >> >> Replace UnsafeCell and the runtime AttributeList::add() calls with a pure >> const AttributeList initialized at compile time inside the static item. >> This eliminates the data race, removes the runtime pointer stores from >> make_group(), and allows the attribute table to reside in read-only >> memory. > > Thanks for the patch! You should also include these people in the Cc list: Boqun Feng (reviewer:RUST) Gary Guo (reviewer:RUST) "Bj=C3=B6rn Roy Baron" (reviewer:RUST) Benno Lossin (reviewer:RUST) Alice Ryhl (reviewer:RUST) Trevor Gross (reviewer:RUST) Danilo Krummrich (reviewer:RUST) Daniel Almeida (reviewer:RUST) Tamir Duberstein (reviewer:RUST) Alexandre Courbot (reviewer:RUST) "Onur =C3=96zkan" (reviewer:RUST) You can use scripts/get_maintainer.pl to get the list. I would encourage you to use the `b4` tool to submit patches. It automates a lot of the stuff that people often get wrong [1]. Best regards, Andreas Hindborg [1] https://b4.docs.kernel.org/en/latest/