Re: [PATCH v2] rust: macros: fix soundness issue in `module!` macro

From: Miguel Ojeda
Date: Tue Apr 16 2024 - 15:37:44 EST


On Tue, Apr 16, 2024 at 7:07 PM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
>
> As reported by Dirk Behme:
>
> https://rust-for-linux.zulipchat.com/#narrow/stream/291565-Help/topic/How.20to.20use.20THIS_MODULE.20with.20.22.20rust.3A.20macros.3A.20fix.20soundness.20.2E.22/near/433512583
>
> The following is needed to allow modules using `THIS_MODULE` as a static
> variable. That being said, maybe we can merge this patch as it is, since
> it doesn't break mainline, and the following change can be done in a
> separate patch.

Fixed in `rust-fixes` now.

[ Moved `THIS_MODULE` out of the private-in-private modules since it
should remain public, as Dirk Behme noticed [1]. Capitalized comments,
avoided newline in non-list SAFETY comments and reworded to add
Reported-by and newline. ]
Link: https://rust-for-linux.zulipchat.com/#narrow/stream/291565-Help/topic/x/near/433512583
[1]

Cheers,
Miguel