lkml.org 
[lkml]   [2022]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] security: keys: add __randomize_layout to keyring_search_context
On Wed, May 18, 2022 at 09:18:41AM +0000, GONG, Ruiqi wrote:
> Struct keyring_search_context contains a pointer to `struct cred`, which
> is a security-critical structure and whose layout is randomized already.
> Apply __randomize_layout to struct keyring_search_context as well, as
> suggested in [1].
>
> [1]: https://github.com/KSPP/linux/issues/188
>
> Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>

Seems reasonable to me; it's an entirely internal structure.

Reviewed-by: Kees Cook <keescook@chromium.org>

> ---
> security/keys/internal.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/keys/internal.h b/security/keys/internal.h
> index 9b9cf3b6fcbb..3e3def5fbaa4 100644
> --- a/security/keys/internal.h
> +++ b/security/keys/internal.h
> @@ -136,7 +136,7 @@ struct keyring_search_context {
> bool possessed;
> key_ref_t result;
> time64_t now;
> -};
> +} __randomize_layout;
>
> extern bool key_default_cmp(const struct key *key,
> const struct key_match_data *match_data);
> --
> 2.17.1
>

--
Kees Cook

\
 
 \ /
  Last update: 2022-05-18 22:27    [W:0.100 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site