From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B96C76190 for ; Thu, 25 Jul 2019 18:54:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B73021901 for ; Thu, 25 Jul 2019 18:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726183AbfGYSyW (ORCPT ); Thu, 25 Jul 2019 14:54:22 -0400 Received: from fieldses.org ([173.255.197.46]:36312 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbfGYSyV (ORCPT ); Thu, 25 Jul 2019 14:54:21 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 7575D6D9; Thu, 25 Jul 2019 14:54:21 -0400 (EDT) Date: Thu, 25 Jul 2019 14:54:21 -0400 From: Bruce Fields To: Dave Wysochanski Cc: NeilBrown , Linux NFS Mailing List Subject: Re: RFC: Fixing net/sunrpc/cache.c: cache_listeners_exist() function for rogue process reading a 'channel' file Message-ID: <20190725185421.GA15073@fieldses.org> References: <22770aa2024c1dab1b7eaded1eed9957963413fb.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22770aa2024c1dab1b7eaded1eed9957963413fb.camel@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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.