Re: [PATCH] security: don't treat structure as an array of struct hlist_head
From: Kees Cook
Date: Tue Apr 12 2022 - 13:26:21 EST
On Thu, Apr 07, 2022 at 10:59:30AM -0700, Bill Wendling wrote:
> The initialization of "security_hook_heads" is done by casting it to
> another structure pointer type, and treating it as an array of "struct
> hlist_head" objects. This requires an exception be made in "randstruct",
> because otherwise it will emit an error, reducing the effectiveness of
> the hardening technique.
>
> Instead of using a cast, initialize the individual struct hlist_head
> elements in security_hook_heads explicitly. This removes the need for
> the cast and randstruct exception.
>
> Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx>
> Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Ah! Yes, thanks. This is a good solution for this. I'd rather not have
any exceptions in the randstruct plugin. :) I'll take this via the
hardening tree unless anyone objects.
-Kees
--
Kees Cook