[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YlkNS8I9NFPfJCUs@owl.dominikbrodowski.net>
Date: Fri, 15 Apr 2022 08:14:35 +0200
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] random: use memmove instead of memcpy for remaining 32
bytes
Am Thu, Apr 14, 2022 at 01:56:49AM +0200 schrieb Jason A. Donenfeld:
> In order to immediately overwrite the old key on the stack, before
> servicing a userspace request for bytes, we use the remaining 32 bytes
> of block 0 as the key. This means moving indices 8,9,a,b,c,d,e,f ->
> 4,5,6,7,8,9,a,b. Since 4 < 8, for the kernel implementations of
> memcpy(), this doesn't actually appear to be a problem in practice. But
> relying on that characteristic seems a bit brittle. So let's change that
> to a proper memmove(), which is the by-the-books way of handling
> overlapping memory copies.
>
> Cc: Dominik Brodowski <linux@...inikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
Reviewed-by: Dominik Brodowski <linux@...inikbrodowski.net>
Thanks,
Dominik
Powered by blists - more mailing lists