All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.18, 4.4] libceph: handle an empty authorize reply
@ 2019-02-25 20:12 Ilya Dryomov
  2019-02-25 21:02 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Dryomov @ 2019-02-25 20:12 UTC (permalink / raw)
  To: stable; +Cc: Greg KH

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.

Cc: stable@vger.kernel.org
Fixes: 5c056fdc5b47 ("libceph: verify authorize reply on connect")
Link: https://tracker.ceph.com/issues/20164
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
[idryomov@gmail.com: backport to 4.4: extra arg, no CEPHX_V2]
---
 net/ceph/messenger.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 3e6897efe1eb..3ed2796d008b 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -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;
+			}
 		}
 	}
 
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3.18, 4.4] libceph: handle an empty authorize reply
  2019-02-25 20:12 [PATCH 3.18, 4.4] libceph: handle an empty authorize reply Ilya Dryomov
@ 2019-02-25 21:02 ` Greg KH
  2019-02-26  9:39   ` Ilya Dryomov
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2019-02-25 21:02 UTC (permalink / raw)
  To: Ilya Dryomov; +Cc: stable

On Mon, Feb 25, 2019 at 09:12:06PM +0100, Ilya Dryomov wrote:
> 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.
> 
> Cc: stable@vger.kernel.org
> Fixes: 5c056fdc5b47 ("libceph: verify authorize reply on connect")
> Link: https://tracker.ceph.com/issues/20164
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> Reviewed-by: Sage Weil <sage@redhat.com>
> [idryomov@gmail.com: backport to 4.4: extra arg, no CEPHX_V2]
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3.18, 4.4] libceph: handle an empty authorize reply
  2019-02-25 21:02 ` Greg KH
@ 2019-02-26  9:39   ` Ilya Dryomov
  2019-02-27 14:13     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Dryomov @ 2019-02-26  9:39 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

On Mon, Feb 25, 2019 at 10:02 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, Feb 25, 2019 at 09:12:06PM +0100, Ilya Dryomov wrote:
> > 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.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 5c056fdc5b47 ("libceph: verify authorize reply on connect")
> > Link: https://tracker.ceph.com/issues/20164
> > Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> > Reviewed-by: Sage Weil <sage@redhat.com>
> > [idryomov@gmail.com: backport to 4.4: extra arg, no CEPHX_V2]
> > ---
> >  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?

Commit 0fd3fd0a9bb0b02b6435bb7070e9f7b82a23f068 upstream.

Thanks,

                Ilya

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3.18, 4.4] libceph: handle an empty authorize reply
  2019-02-26  9:39   ` Ilya Dryomov
@ 2019-02-27 14:13     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2019-02-27 14:13 UTC (permalink / raw)
  To: Ilya Dryomov; +Cc: stable

On Tue, Feb 26, 2019 at 10:39:46AM +0100, Ilya Dryomov wrote:
> On Mon, Feb 25, 2019 at 10:02 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Mon, Feb 25, 2019 at 09:12:06PM +0100, Ilya Dryomov wrote:
> > > 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.
> > >
> > > Cc: stable@vger.kernel.org
> > > Fixes: 5c056fdc5b47 ("libceph: verify authorize reply on connect")
> > > Link: https://tracker.ceph.com/issues/20164
> > > Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> > > Reviewed-by: Sage Weil <sage@redhat.com>
> > > [idryomov@gmail.com: backport to 4.4: extra arg, no CEPHX_V2]
> > > ---
> > >  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?
> 
> Commit 0fd3fd0a9bb0b02b6435bb7070e9f7b82a23f068 upstream.

thanks, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-27 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-25 20:12 [PATCH 3.18, 4.4] libceph: handle an empty authorize reply Ilya Dryomov
2019-02-25 21:02 ` Greg KH
2019-02-26  9:39   ` Ilya Dryomov
2019-02-27 14:13     ` Greg KH

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.