From: Eric Biggers <ebiggers3@gmail.com>
To: keyrings@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Michael Halcrow <mhalcrow@google.com>,
linux-cachefs@redhat.com, ecryptfs@vger.kernel.org,
linux-fscrypt@vger.kernel.org,
linux-security-module@vger.kernel.org,
Eric Biggers <ebiggers@google.com>,
stable@vger.kernel.org
Subject: [PATCH 2/7] FS-Cache: fix dereference of NULL user_key_payload
Date: Thu, 28 Sep 2017 14:25:57 -0700 [thread overview]
Message-ID: <20170928212602.41744-3-ebiggers3@gmail.com> (raw)
In-Reply-To: <20170928212602.41744-1-ebiggers3@gmail.com>
From: Eric Biggers <ebiggers@google.com>
When the file /proc/fs/fscache/objects (available with
CONFIG_FSCACHE_OBJECT_LIST=y) is opened, we request a user key with
description "fscache:objlist", then access its payload. However, a
revoked key has a NULL payload, and we failed to check for this.
request_key() *does* skip revoked keys, but there is still a window
where the key can be revoked before we access its payload.
Fix it by checking for a NULL payload, treating it like a key which was
already revoked at the time it was requested.
Fixes: 4fbf4291aa15 ("FS-Cache: Allow the current state of all objects to be dumped")
Cc: <stable@vger.kernel.org> [v2.6.32+]
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/fscache/object-list.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index b5ab06fabc60..0438d4cd91ef 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -331,6 +331,13 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
rcu_read_lock();
confkey = user_key_payload_rcu(key);
+ if (!confkey) {
+ /* key was revoked */
+ rcu_read_unlock();
+ key_put(key);
+ goto no_config;
+ }
+
buf = confkey->data;
for (len = confkey->datalen - 1; len >= 0; len--) {
--
2.14.2.822.g60be5d43e6-goog
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers3@gmail.com>
To: keyrings@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Michael Halcrow <mhalcrow@google.com>,
linux-cachefs@redhat.com, ecryptfs@vger.kernel.org,
linux-fscrypt@vger.kernel.org,
linux-security-module@vger.kernel.org,
Eric Biggers <ebiggers@google.com>,
stable@vger.kernel.org
Subject: [PATCH 2/7] FS-Cache: fix dereference of NULL user_key_payload
Date: Thu, 28 Sep 2017 21:25:57 +0000 [thread overview]
Message-ID: <20170928212602.41744-3-ebiggers3@gmail.com> (raw)
In-Reply-To: <20170928212602.41744-1-ebiggers3@gmail.com>
From: Eric Biggers <ebiggers@google.com>
When the file /proc/fs/fscache/objects (available with
CONFIG_FSCACHE_OBJECT_LIST=y) is opened, we request a user key with
description "fscache:objlist", then access its payload. However, a
revoked key has a NULL payload, and we failed to check for this.
request_key() *does* skip revoked keys, but there is still a window
where the key can be revoked before we access its payload.
Fix it by checking for a NULL payload, treating it like a key which was
already revoked at the time it was requested.
Fixes: 4fbf4291aa15 ("FS-Cache: Allow the current state of all objects to be dumped")
Cc: <stable@vger.kernel.org> [v2.6.32+]
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/fscache/object-list.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index b5ab06fabc60..0438d4cd91ef 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -331,6 +331,13 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
rcu_read_lock();
confkey = user_key_payload_rcu(key);
+ if (!confkey) {
+ /* key was revoked */
+ rcu_read_unlock();
+ key_put(key);
+ goto no_config;
+ }
+
buf = confkey->data;
for (len = confkey->datalen - 1; len >= 0; len--) {
--
2.14.2.822.g60be5d43e6-goog
WARNING: multiple messages have this Message-ID (diff)
From: ebiggers3@gmail.com (Eric Biggers)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 2/7] FS-Cache: fix dereference of NULL user_key_payload
Date: Thu, 28 Sep 2017 14:25:57 -0700 [thread overview]
Message-ID: <20170928212602.41744-3-ebiggers3@gmail.com> (raw)
In-Reply-To: <20170928212602.41744-1-ebiggers3@gmail.com>
From: Eric Biggers <ebiggers@google.com>
When the file /proc/fs/fscache/objects (available with
CONFIG_FSCACHE_OBJECT_LIST=y) is opened, we request a user key with
description "fscache:objlist", then access its payload. However, a
revoked key has a NULL payload, and we failed to check for this.
request_key() *does* skip revoked keys, but there is still a window
where the key can be revoked before we access its payload.
Fix it by checking for a NULL payload, treating it like a key which was
already revoked at the time it was requested.
Fixes: 4fbf4291aa15 ("FS-Cache: Allow the current state of all objects to be dumped")
Cc: <stable@vger.kernel.org> [v2.6.32+]
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/fscache/object-list.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index b5ab06fabc60..0438d4cd91ef 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -331,6 +331,13 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
rcu_read_lock();
confkey = user_key_payload_rcu(key);
+ if (!confkey) {
+ /* key was revoked */
+ rcu_read_unlock();
+ key_put(key);
+ goto no_config;
+ }
+
buf = confkey->data;
for (len = confkey->datalen - 1; len >= 0; len--) {
--
2.14.2.822.g60be5d43e6-goog
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-09-28 21:25 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 21:25 [PATCH 0/7] Fix dereferencing payload of revoked keys Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-09-28 21:25 ` [PATCH 1/7] KEYS: encrypted: fix dereference of NULL user_key_payload Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-10-03 10:51 ` James Morris
2017-10-03 10:51 ` James Morris
2017-10-03 10:51 ` James Morris
2017-09-28 21:25 ` Eric Biggers [this message]
2017-09-28 21:25 ` [PATCH 2/7] FS-Cache: " Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-10-03 10:51 ` James Morris
2017-10-03 10:51 ` James Morris
2017-10-03 10:51 ` James Morris
2017-09-28 21:25 ` [PATCH 3/7] lib/digsig: " Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-10-03 10:52 ` James Morris
2017-10-03 10:52 ` James Morris
2017-10-03 10:52 ` James Morris
2017-09-28 21:25 ` [PATCH 4/7] fscrypt: " Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-09-28 21:25 ` Eric Biggers
2017-10-03 10:56 ` James Morris
2017-10-03 10:56 ` James Morris
2017-10-03 10:56 ` James Morris
2017-09-28 21:26 ` [PATCH 5/7] ecryptfs: " Eric Biggers
2017-09-28 21:26 ` Eric Biggers
2017-09-28 21:26 ` Eric Biggers
2017-10-03 11:01 ` James Morris
2017-10-03 11:01 ` James Morris
2017-10-03 11:01 ` James Morris
2017-09-28 21:26 ` [PATCH 6/7] ecryptfs: fix out-of-bounds read of key payload Eric Biggers
2017-09-28 21:26 ` Eric Biggers
2017-09-28 21:26 ` Eric Biggers
2017-10-03 11:03 ` James Morris
2017-10-03 11:03 ` James Morris
2017-10-03 11:03 ` James Morris
2017-09-28 21:26 ` [PATCH 7/7] ecryptfs: move key payload accessor functions into keystore.c Eric Biggers
2017-09-28 21:26 ` Eric Biggers
2017-09-28 21:26 ` Eric Biggers
2017-10-03 11:05 ` James Morris
2017-10-03 11:05 ` James Morris
2017-10-03 11:05 ` James Morris
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=20170928212602.41744-3-ebiggers3@gmail.com \
--to=ebiggers3@gmail.com \
--cc=dhowells@redhat.com \
--cc=ebiggers@google.com \
--cc=ecryptfs@vger.kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-cachefs@redhat.com \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mhalcrow@google.com \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.