Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755473AbaDTPD1 (ORCPT ); Sun, 20 Apr 2014 11:03:27 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:54040 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755201AbaDTPDW (ORCPT ); Sun, 20 Apr 2014 11:03:22 -0400 Date: Sun, 20 Apr 2014 17:03:21 +0200 From: Pavel Machek To: Andy Lutomirski Cc: "Theodore Ts'o" , 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)" Subject: Re: [PATCH 0/6] File Sealing & memfd_create() Message-ID: <20140420150321.GC15332@amd.pavel.ucw.cz> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2014-04-10 13:37:26, Andy Lutomirski wrote: > 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. Yes please. Current behaviour is very unexpected, and unexpected behaviour in security area is normally called "security hole". Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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/