Skip to contentSkip to conversation

libceph: handle an empty authorize reply

PATCH In review Ilya Dryomov 2 participants 4 messages Feb 25, 2019 – Feb 27, 2019 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libceph: handle an empty authorize reply

The authorize reply can be empty, for example when the ticket used to build the authorizer is too old and TAG_BADAUTHORIZER is returned from the service. Calling ->verify_authorizer_reply() results in an attempt to decrypt and validate (somewhat) random data in au->buf (most likely the signature block from calc_signature()), which fails and ends up in con_fault_finish() with !con->auth_retry. The ticket isn't invalidated and the connection is retried again and again until a new ticket is obtained from the monitor:

libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply

Let TAG_BADAUTHORIZER handler kick in and increment con->auth_retry.

Fixes 5c056fdc5b47 ("libceph: verify authorize reply on connect")
[[email protected]: backport to 4.4: extra arg, no CEPHX_V2]
---
 net/ceph/messenger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
net/ceph/messenger.c +8 -4
index 3e6897efe1eb..3ed2796d008b 100644
@@ -2049,15 +2049,19 @@ static int process_connect(struct ceph_connection *con)
 	dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
 
 	if (con->auth_reply_buf) {
+		int len = le32_to_cpu(con->in_reply.authorizer_len);
+
 		/*
 		 * Any connection that defines ->get_authorizer()
 		 * should also define ->verify_authorizer_reply().
 		 * See get_connect_authorizer().
 		 */
-		ret = con->ops->verify_authorizer_reply(con, 0);
-		if (ret < 0) {
-			con->error_msg = "bad authorize reply";
-			return ret;
+		if (len) {
+			ret = con->ops->verify_authorizer_reply(con, 0);
+			if (ret < 0) {
+				con->error_msg = "bad authorize reply";
+				return ret;
+			}
 		}
 	}
 
Signature · 1 line
2.19.2
maintainer
#1 lore raw
Quoted 22 lines · Ilya Dryomov

The authorize reply can be empty, for example when the ticket used to build the authorizer is too old and TAG_BADAUTHORIZER is returned from the service. Calling ->verify_authorizer_reply() results in an attempt to decrypt and validate (somewhat) random data in au->buf (most likely the signature block from calc_signature()), which fails and ends up in con_fault_finish() with !con->auth_retry. The ticket isn't invalidated and the connection is retried again and again until a new ticket is obtained from the monitor:

libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply

Let TAG_BADAUTHORIZER handler kick in and increment con->auth_retry.

Fixes 5c056fdc5b47 ("libceph: verify authorize reply on connect")
[[email protected]: backport to 4.4: extra arg, no CEPHX_V2]
Quoted 3 lines
---
 net/ceph/messenger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

What is the git commit id of this patch in Linus's tree?

thanks,

greg k-h

#2 lore raw
Quoted 28 lines · Greg KH
Quoted 22 lines · Ilya Dryomov

The authorize reply can be empty, for example when the ticket used to build the authorizer is too old and TAG_BADAUTHORIZER is returned from the service. Calling ->verify_authorizer_reply() results in an attempt to decrypt and validate (somewhat) random data in au->buf (most likely the signature block from calc_signature()), which fails and ends up in con_fault_finish() with !con->auth_retry. The ticket isn't invalidated and the connection is retried again and again until a new ticket is obtained from the monitor:

libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply

Let TAG_BADAUTHORIZER handler kick in and increment con->auth_retry.

Fixes 5c056fdc5b47 ("libceph: verify authorize reply on connect")
[[email protected]: backport to 4.4: extra arg, no CEPHX_V2]
Quoted 3 lines
---
 net/ceph/messenger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Quoted 1 line

What is the git commit id of this patch in Linus's tree?

Commit 0fd3fd0a9bb0b02b6435bb7070e9f7b82a23f068 upstream.

Thanks,

Ilya

maintainer
#3 lore raw
Quoted 29 lines · Ilya Dryomov
Quoted 28 lines · Greg KH
Quoted 25 lines · Ilya Dryomov

The authorize reply can be empty, for example when the ticket used to build the authorizer is too old and TAG_BADAUTHORIZER is returned from the service. Calling ->verify_authorizer_reply() results in an attempt to decrypt and validate (somewhat) random data in au->buf (most likely the signature block from calc_signature()), which fails and ends up in con_fault_finish() with !con->auth_retry. The ticket isn't invalidated and the connection is retried again and again until a new ticket is obtained from the monitor:

libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply

Let TAG_BADAUTHORIZER handler kick in and increment con->auth_retry.

Fixes 5c056fdc5b47 ("libceph: verify authorize reply on connect")
[[email protected]: backport to 4.4: extra arg, no CEPHX_V2]
---
 net/ceph/messenger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Quoted 3 lines
Quoted 1 line

What is the git commit id of this patch in Linus's tree?

Commit 0fd3fd0a9bb0b02b6435bb7070e9f7b82a23f068 upstream.

thanks, now queued up.

greg k-h