From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030475AbcHELMV (ORCPT ); Fri, 5 Aug 2016 07:12:21 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34963 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934925AbcHELMU (ORCPT ); Fri, 5 Aug 2016 07:12:20 -0400 From: Nicolai Stange To: Brian Starkey Cc: Nicolai Stange , Liviu Dudau , Greg Kroah-Hartman , LKML Subject: Re: [PATCH] debugfs: Add proxy function for the mmap file operation References: <20160729143459.2672-1-Liviu.Dudau@arm.com> <87oa5gpcu1.fsf@gmail.com> <87wpjzkrgn.fsf@gmail.com> <20160805101849.GA29995@e106950-lin.cambridge.arm.com> Date: Fri, 05 Aug 2016 13:11:45 +0200 In-Reply-To: <20160805101849.GA29995@e106950-lin.cambridge.arm.com> (Brian Starkey's message of "Fri, 5 Aug 2016 11:18:49 +0100") Message-ID: <8760rfzczy.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Brian Starkey writes: > On Tue, Aug 02, 2016 at 07:31:36PM +0200, Nicolai Stange wrote: >>Nicolai Stange writes: >>> However, if you wish to have some mmapable debugfs file which *can* go >>> away, introducing mmap support in the debugfs full proxy is perfectly >>> valid. But please see below. >> >>Assuming that you've got such a use case, please consider resending your >>patch along with the Cocci script below (and the Coccinelle team CC'ed, >>of course). If OTOH your mmapable debugfs files are never removed, just >>drop this message and use debugfs_create_file_unsafe() instead. > > So we do have an implementation using this, but it's likely we will > keep it out-of-tree (it's a stop-gap until we can get a non-debugfs > implementation of the functionality into mainline). > > Do you think it's worth merging this (and your cocci script) anyway to > save someone else doing the same thing later? I personally think that having ->mmap() support in debugfs would be a good thing to have in general and I expect there to be some further demand in the future. But I also think that it is a little bit fragile in the current state: how many people actually run the Cocci scripts on their changes? AFAICT, even the kbuild test robot doesn't do this. And after all, the Cocci script I provided could very well miss some obfuscated writes to vma->vm_ops: if they aren't done from ->mmap() themselves, but from some helper function invoked therein, for example. I would personally prefer a hand coded full_proxy_mmap() which WARN()s if the proxied ->mmap() changes vma->vm_ops: - this would add an extra safety net - ->mmap() for debugfs files isn't performance critical - and lastly, we're already doing something similar to this in open_proxy_open(). But in the end, it's not mine but Greg K-H's opinion that matters here... Thanks, Nicolai