linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Dave Wysochanski <dwysocha@redhat.com>
Cc: NeilBrown <neilb@suse.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: RFC: Fixing net/sunrpc/cache.c: cache_listeners_exist() function for rogue process reading a 'channel' file
Date: Thu, 25 Jul 2019 14:54:21 -0400	[thread overview]
Message-ID: <20190725185421.GA15073@fieldses.org> (raw)
In-Reply-To: <22770aa2024c1dab1b7eaded1eed9957963413fb.camel@redhat.com>

On Thu, Jul 25, 2019 at 12:48:31PM -0400, Dave Wysochanski wrote:
> Neil, Bruce, and others,
> 
> I want to see if we can improve cache_listeners_exist() to not be
> fooled at all by a random process reading a 'channel' file.  Prior
> attempts have been made and Neil your most recent commit mitigated the
> effects however doesn't really solve it completely:
> 9d69338c8c5f "sunrpc/cache: handle missing listeners better"
> 
> Here are a couple approaches, based on my understanding of the
> interface and what any legitimate "user of the channel files" (aka
> daemons or userspace programs, most if not all live in nfs-utils) do in
> practice:
> 1) rather than tracking opens for read, track opens for write on the
> channel file (i.e. the 'readers' member in cache_detail)

Assuming we've checked that none of those random processes are opening
for write, that sounds reasonable to me.

> 2) in addition to or in place of #1, track calls to cache_poll()

I'm not sure how this would work.  What exactly would be the rule, and
how would we document the required behavior for somebody working on the
userland (rpc.mountd) side?

> Because this keeps coming up in one shape or form and is hard to
> troubleshoot when it occurs, I think we should fix this once and for
> all so I'm looking for feedback on approaches.  I thought of going down
> the road of a more elaborate daemon / kernel registration but that
> would require carefully making sure we have backward compatibility when
> variants of nfs-utils and kernel are installed.

It might be worth at least sketching out a design to get an idea how
complicated it would be.  Agreed that backwards compatibility would be
the annoying part.

--b.

  reply	other threads:[~2019-07-25 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 16:48 RFC: Fixing net/sunrpc/cache.c: cache_listeners_exist() function for rogue process reading a 'channel' file Dave Wysochanski
2019-07-25 18:54 ` Bruce Fields [this message]
2019-07-25 21:44   ` [RFC PATCH] SUNRPC: Harden the cache 'channel' interface to only allow legitimate daemons Dave Wysochanski
2019-07-25 21:50     ` J. Bruce Fields
2019-07-26 13:59       ` Dave Wysochanski
2019-07-26 22:33   ` [RFC PATCH] SUNRPC: Track writers of the 'channel' file to improve cache_listeners_exist Dave Wysochanski
2019-07-29 21:51     ` J. Bruce Fields
2019-07-30  0:02       ` NeilBrown
2019-07-30  0:49         ` J. Bruce Fields
2019-07-30  1:14           ` NeilBrown
2019-07-30 15:46             ` J. Bruce Fields

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=20190725185421.GA15073@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=dwysocha@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.com \
    /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).