From: Kees Cook <keescook@chromium.org>
To: "GONG, Ruiqi" <gongruiqi1@huawei.com>
Cc: David Howells <dhowells@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
James Morris <jmorris@namei.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org,
Wang Weiyang <wangweiyang2@huawei.com>,
Xiu Jianfeng <xiujianfeng@huawei.com>
Subject: Re: [PATCH] security: keys: add __randomize_layout to keyring_search_context
Date: Wed, 18 May 2022 13:25:28 -0700 [thread overview]
Message-ID: <202205181325.0D772A54@keescook> (raw)
In-Reply-To: <20220518091841.141441-1-gongruiqi1@huawei.com>
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
prev parent reply other threads:[~2022-05-18 20:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 9:18 [PATCH] security: keys: add __randomize_layout to keyring_search_context GONG, Ruiqi
2022-05-18 20:25 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202205181325.0D772A54@keescook \
--to=keescook@chromium.org \
--cc=dhowells@redhat.com \
--cc=gongruiqi1@huawei.com \
--cc=jarkko@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=wangweiyang2@huawei.com \
--cc=xiujianfeng@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).