linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Perl <cperl@janestreet.com>
To: linux-nfs@vger.kernel.org
Cc: Chris Perl <cperl@janestreet.com>
Subject: [PATCH 0/1] Fix incorrect sharing of AUTH_SYS and AUTH_GSS_KRB5 data structures
Date: Fri,  9 Nov 2018 04:02:50 -0500	[thread overview]
Message-ID: <20181109090251.14145-1-cperl@janestreet.com> (raw)

Hi!

I explained most of the details in the commit, but the gist is that
mounts that don't have an explicit `sec' option passed will never get
through the first part of the if statement I removed, meaning a mount
which has its auth flavor discovered at mount time (e.g. in
`nfs_try_mount_request') cannot pass that test.

This means auth flavors are not compared and can lead to incorrect
sharing of data structures via `nfs_fs_mount_common'.

I am not the most familiar with all this code, so I might be missing
something about why that check is needed.  Please correct me if it
needs to remain.

In addition to testing this patch on a real system I tested something
almost equivalent to this patch by using systemtap to force
`b->auth_info.flavor_len' to 1 on every invocation if it was 0 (so the
if would always succeed) and back to 0 on exit.  Doing both of these
things caused my issues to go away and helped to reinforce my notion
that this was the right fix.

In case you're interested, that script is below.  Note that it hooks
onto `nfs_compare_super' and not `nfs_compare_mount_options' because
the latter is inlined.

Please copy me directly on any replies, as I'm not a member of the
list.

global revert;

probe module("nfs").function("nfs_compare_super").call
{
	server = @cast($data, "struct nfs_sb_mountdata")->server;
	if (server->auth_info->flavor_len == 0) {
		server->auth_info->flavor_len = 1;
		revert = 1;
	}
}

probe module("nfs").function("nfs_compare_super").return
{
	server = @cast($data, "struct nfs_sb_mountdata")->server;
	if (revert) {
		revert = 0;
		server->auth_info->flavor_len = 0;
	}
}

Chris Perl (1):
  NFS: nfs_compare_mount_options always compare auth flavors.

 fs/nfs/super.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.17.1


             reply	other threads:[~2018-11-09  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  9:02 Chris Perl [this message]
2018-11-09  9:02 ` [PATCH 1/1] NFS: nfs_compare_mount_options always compare auth flavors Chris Perl

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=20181109090251.14145-1-cperl@janestreet.com \
    --to=cperl@janestreet.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).