linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Wysochanski <dwysocha@redhat.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 0/2] Fix crash in trace_rpcgss_context due to 0-length acceptor
Date: Tue,  5 Jan 2021 17:06:32 -0500	[thread overview]
Message-ID: <20210105220634.27910-1-dwysocha@redhat.com> (raw)

This small patchset fixes a kernel crash when the rpcgss_context trace event is
enabled and IO is in flight when a kerberos ticket expires.  The crash occurs
because the acceptor name may be 0 bytes long and the gss_fill_context() function
does not handle it properly.  This causes the ctx->gc_acceptor.data to be
ZERO_SIZE_PTR which is not properly recognized by the tracepoint code.

The first patch is a simple refactor and eliminates duplicate helper functions
related to the crash.  The second patch is the actual fix inside one of the
helper functions due to the definition of an opaque XDR object.  This object
is defined in RFC 4506 (see section 4.10), where 'length' is an integer in a
range including 0.

Reproducer

# Enable the tracepoint and mount the share
trace-cmd start -e rpcgss:*
mount -osec=krb5 nfs-server:/export /mnt/nfs

# Obtain a kerberos ticket
# Set ticket lifetime to something small like 20 seconds
su test -c "kinit -l 20 test"

# Sleep for a portion of the ticket lifetime so we are writing while the ticket expires
sleep 10

# Now run some IO long enough that the ticket expires midway
dd if=/dev/urandom of=/mnt/nfs/file bs=1M count=100


Dave Wysochanski (2):
  SUNRPC: Move simple_get_bytes and simple_get_netobj into xdr.h
  SUNRPC: Handle 0 length opaque XDR object data properly

 include/linux/sunrpc/xdr.h          | 33 +++++++++++++++++++++++++++--
 net/sunrpc/auth_gss/auth_gss.c      | 29 -------------------------
 net/sunrpc/auth_gss/gss_krb5_mech.c | 29 -------------------------
 3 files changed, 31 insertions(+), 60 deletions(-)

-- 
2.25.2


             reply	other threads:[~2021-01-05 22:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 22:06 Dave Wysochanski [this message]
2021-01-05 22:06 ` [PATCH 1/2] SUNRPC: Move simple_get_bytes and simple_get_netobj into xdr.h Dave Wysochanski
2021-01-05 22:06 ` [PATCH 2/2] SUNRPC: Handle 0 length opaque XDR object data properly Dave Wysochanski
2021-01-21 15:22   ` David Wysochanski

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=20210105220634.27910-1-dwysocha@redhat.com \
    --to=dwysocha@redhat.com \
    --cc=linux-nfs@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 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).