Re: [PATCH] rust: allocator: Prevents mis-aligned allocation

From: Boqun Feng
Date: Sat Jul 29 2023 - 19:41:50 EST


On Sat, Jul 29, 2023 at 04:01:03PM +0200, Miguel Ojeda wrote:
> On Tue, Jun 13, 2023 at 6:44 PM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
> >
> > Cc: stable@xxxxxxxxxxxxxxx # v6.1+
>
> Applied to `rust-next`, thanks!
>
> However, should this go to stable? The actual functions being called
> are the `__rust_*` ones (until they get removed in 1.71), no? Thus

Interesting, I wasn't aware of the `__rust_*` "hack" here, so you are
right, this doesn't fix the issue in stable kernels.

> this is not actually fixing the actual functions being called, right?
>
> If that is correct, then the fix should change the functions below,
> perhaps adding `krealloc_with_flags()` from the other patch (it does
> not need to be a method, by the way), and calling it with a `Layout`
> like the generated ones do. Then I can rebase `rust-next` on top of

Sounds good, however I think it'll be better if I resend this one, and
the other one originally from Bjorn based on the introduction of
function `krealloc_with_flags` (I will name it as `krealloc_aligned`,
since it's a function that returns a aligned object with krealloc).

Thoughts?

Regards,
Boqun

> the fix that adds the `krealloc_with_flags()`.
>
> Cheers,
> Miguel