Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11207511ybi; Thu, 25 Jul 2019 11:54:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAUjLQAAz5rvBaCFg8Vm2wZlaMyk/Bkg1z7FON3aAMzo7ewMu42B4rkV8Ay+HAha3r8kcK X-Received: by 2002:a17:90a:dac3:: with SMTP id g3mr93831226pjx.45.1564080891162; Thu, 25 Jul 2019 11:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564080891; cv=none; d=google.com; s=arc-20160816; b=vGx7joU4YHrMcFzQT+x75y99olBgsu0FeDdyp1bIBtNqgoKtrDeuGwAO/r+AijJ/Ar aIVjf3SW91wA3C1PaG5+1srIcbQyMecqj4+mn7tKrtJY/DiuUaaTwV5duryzD7fLGiu0 wE7YC2P3wJKunW1QguLQx42epe8j8NRlt2nDT+VIpHJEKZSP+hpetcCcCKoYUSttCi3j YifTqjI3znfUYP+6vpxTvnLZIqZcFw5FXE3fypg/41xqxRqDA2dbNviwgBiqXE9YxhkL rU2ojtQXEKkQTRa/Teld+yWJmHP2WNZAf1BfHMLenmFsC/67lPnRVDj8ltt2pBLIuNmz d94w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HViBe8yfOBBOrU3xZo7KCQaCNenLpt0n7Kp3hVuNtiA=; b=XiGmVTfA2OuDAXx7aiTuIz54CQ/KpaPLtwo6DRf1ezH6rrgR37RTWrWEgKTDvWWWro H1CN21zFuH5kccgRwmvmm6UwC1ZZctCf6WcCVED+NXI/obGHRvteeGE2ACematEv94HN tq/JtFYCSb297C41NmeNNTzHqfFVBarDs/As4sS/sD9snY9Q3hRc/ipjRjDWFND3061Y J01TOqNV/uXZN4d4luFpLPTPDHPPTW3SUsO9IVqQ1TWNXSJJzYazyG5t+p5BnH24npWj lfYcBLPqG9gbpUYMUlXO1s9+B9ZDNo7lUqCt15BgYI6E9CoNxymw00iVDibxFySNrNlJ Xntg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x69si16868596pgd.168.2019.07.25.11.54.28; Thu, 25 Jul 2019 11:54:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726183AbfGYSyW (ORCPT + 99 others); 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.