From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752105AbdHPKf3 (ORCPT ); Wed, 16 Aug 2017 06:35:29 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38474 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbdHPKfZ (ORCPT ); Wed, 16 Aug 2017 06:35:25 -0400 Date: Wed, 16 Aug 2017 13:25:26 +0300 From: "Kirill A. Shutemov" To: Dan Williams Cc: "Darrick J. Wong" , Jan Kara , "linux-nvdimm@lists.01.org" , Linux API , Dave Chinner , "linux-kernel@vger.kernel.org" , linux-xfs@vger.kernel.org, Linux MM , Jeff Moyer , Alexander Viro , Andy Lutomirski , linux-fsdevel , Ross Zwisler , Christoph Hellwig Subject: Re: [PATCH v4 3/3] fs, xfs: introduce MAP_DIRECT for creating block-map-sealed file ranges Message-ID: <20170816102526.kksbsvcr5cqcf35k@node.shutemov.name> References: <150277752553.23945.13932394738552748440.stgit@dwillia2-desk3.amr.corp.intel.com> <150277754211.23945.458876600578531019.stgit@dwillia2-desk3.amr.corp.intel.com> <20170815091836.c3xpsfgfwz7w35od@node.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 15, 2017 at 10:11:27AM -0700, Dan Williams wrote: > > We had issues before with user-imposed ETXTBSY. See MAP_DENYWRITE. > > > > Are we sure it won't a source of denial-of-service attacks? > > I believe MAP_DENYWRITE allowed any application with read access to be > able to deny writes which is obviously problematic. MAP_DIRECT is > different. You need write access to the file so you can already > destroy data that another application might depend on, and this only > blocks allocation and reflink. > > However, I'm not opposed to adding more safety around this. I think we > can address this concern with an fcntl seal as Dave suggests, but the > seal only applies to the 'struct file' instance and only gates whether > MAP_DIRECT is allowed on that file. The act of setting > F_MAY_SEAL_IOMAP requires CAP_IMMUTABLE, but MAP_DIRECT does not. This > allows the 'permission to mmap(MAP_DIRECT)' to be passed around with > an open file descriptor. Sounds like a good approach to me. -- Kirill A. Shutemov