public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
From: "GONG, Ruiqi" <gongruiqi1@huawei.com>
To: David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	James Morris <jmorris@namei.org>,
	"Serge E . Hallyn" <serge@hallyn.com>,
	"Kees Cook" <keescook@chromium.org>
Cc: <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>, <gongruiqi1@huawei.com>
Subject: [PATCH] security: keys: add __randomize_layout to keyring_search_context
Date: Wed, 18 May 2022 09:18:41 +0000	[thread overview]
Message-ID: <20220518091841.141441-1-gongruiqi1@huawei.com> (raw)

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>
---
 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


             reply	other threads:[~2022-05-18  1:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:18 GONG, Ruiqi [this message]
2022-05-18 20:25 ` [PATCH] security: keys: add __randomize_layout to keyring_search_context Kees Cook

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=20220518091841.141441-1-gongruiqi1@huawei.com \
    --to=gongruiqi1@huawei.com \
    --cc=dhowells@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.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