Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759156AbaDJUhs (ORCPT ); Thu, 10 Apr 2014 16:37:48 -0400 Received: from mail-qc0-f180.google.com ([209.85.216.180]:50125 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753617AbaDJUhq (ORCPT ); Thu, 10 Apr 2014 16:37:46 -0400 MIME-Version: 1.0 In-Reply-To: <20140410203246.GB31614@thunk.org> References: <1395256011-2423-1-git-send-email-dh.herrmann@gmail.com> <20140320153250.GC20618@thunk.org> <20140320163806.GA10440@thunk.org> <5346ED93.9040500@amacapital.net> <20140410203246.GB31614@thunk.org> From: Andy Lutomirski Date: Thu, 10 Apr 2014 13:37:26 -0700 Message-ID: Subject: Re: [PATCH 0/6] File Sealing & memfd_create() To: "Theodore Ts'o" , Andy Lutomirski , David Herrmann , linux-kernel , Hugh Dickins , Alexander Viro , Karol Lewandowski , Kay Sievers , Daniel Mack , Lennart Poettering , John Stultz , Greg Kroah-Hartman , Tejun Heo , Johannes Weiner , "dri-devel@lists.freedesktop.org" , linux-fsdevel , linux-mm , Andrew Morton , Linus Torvalds , Ryan Lortie , "Michael Kerrisk (man-pages)" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 10, 2014 at 1:32 PM, Theodore Ts'o wrote: > On Thu, Apr 10, 2014 at 12:14:27PM -0700, Andy Lutomirski wrote: >> >> This is the second time in a week that someone has asked for a way to >> have a struct file (or struct inode or whatever) that can't be reopened >> through /proc/pid/fd. This should be quite easy to implement as a >> separate feature. > > What I suggested on a different thread was to add the following new > file descriptor flags, to join FD_CLOEXEC, which would be maniuplated > using the F_GETFD and F_SETFD fcntl commands: > > FD_NOPROCFS disallow being able to open the inode via /proc//fd > > FD_NOPASSFD disallow being able to pass the fd via a unix domain socket > > FD_LOCKFLAGS if this bit is set, disallow any further changes of FD_CLOEXEC, > FD_NOPROCFS, FD_NOPASSFD, and FD_LOCKFLAGS flags. > > Regardless of what else we might need to meet the use case for the > proposed File Sealing API, I think this is a useful feature that could > be used in many other contexts besides just the proposed > memfd_create() use case. It occurs to me that, before going nuts with these kinds of flags, it may pay to just try to fix the /proc/self/fd issue for real -- we could just make open("/proc/self/fd/3", O_RDWR) fail if fd 3 is read-only. That may be enough for the file sealing thing. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/