RE: [PATCH v3 12/13] rust: sync: reduce stack usage of `UniqueArc::try_new_uninit`

From: David Laight
Date: Thu Mar 30 2023 - 10:59:12 EST


From: y86-dev@xxxxxxxxxxxxxx
> Sent: 29 March 2023 23:34
>
> `UniqueArc::try_new_uninit` calls `Arc::try_new(MaybeUninit::uninit())`.
> This results in the uninitialized memory being placed on the stack,
> which may be arbitrarily large due to the generic `T` and thus could
> cause a stack overflow for large types.

Does that mean rust is using (the equivalent of) alloca() ?

That is banned for C code in the kernel for any sizes.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)