lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8bcd10eb-97ac-4dbf-b59b-b7f12c4e24c6@proton.me>
Date: Mon, 02 Sep 2024 21:37:53 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...sung.com>, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] rust: add global lock support

On 02.09.24 13:37, Alice Ryhl wrote:
> On Fri, Aug 30, 2024 at 3:22 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>>
>> On 30.08.24 07:34, Alice Ryhl wrote:
>>> On Thu, Aug 29, 2024 at 8:17 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>>>>
>>>> On 27.08.24 10:41, Alice Ryhl wrote:
>>>>> We don't currently have any support for global locks in Rust, however
>>>>> they are very useful and I have needed to work around this limitation
>>>>> several times. My workarounds generally involve initializing the mutex
>>>>> in the module's init function, and this workaround is reflected here.
>>>>
>>>> I would not exactly call this a "workaround". If your use-case is
>>>> covered by putting a `Mutex`, then I would prefer it. Or did you need
>>>> additional ugly code to access it?
>>>
>>> Not sure what you mean by "putting a Mutex" but the workaround is
>>
>> Oh sorry, seems like I forgot to write the rest of that... Let me try
>> again: If your use-case is covered by putting a `Mutex` inside of the
>> type that implements `Module`, then I think you should do that instead
>> of using a global. (you need the inplace module patch for that)
> 
> I don't think it's possible to access the `Module` struct after `init`
> returns? Even with in-place init.

Oh I see... Maybe if you create it inside of an `Arc` or `Box` and then
pass it to something inside of your module that will then be called by
some other mechanism?

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ