From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932646AbaDVOb4 (ORCPT ); Tue, 22 Apr 2014 10:31:56 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:43062 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932601AbaDVObx (ORCPT ); Tue, 22 Apr 2014 10:31:53 -0400 Date: Tue, 22 Apr 2014 16:31:52 +0200 From: Pavel Machek To: David Herrmann Cc: Andy Lutomirski , linux-kernel , linux-fsdevel , Alexander Viro , "Theodore Ts'o" Subject: Re: [RFC 2/2] fs,proc: Respect FMODE_WRITE when opening /proc/pid/fd/N Message-ID: <20140422143152.GA23716@amd.pavel.ucw.cz> References: <430cfc67aae9b9ad5eab4d293107285ad44c5fd9.1398097304.git.luto@amacapital.net> 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 Hi! > On Mon, Apr 21, 2014 at 6:22 PM, Andy Lutomirski wrote: > > This patch does this: > > I can see _what_ the patch does, but your patch lacks any discussion > _why_ it is needed. Can you provide at least one real example where > this fixes a security issue? Such as here? http://www.securityfocus.com/archive/1/507386 > > This may break userspace. If so, I would guess that anything broken > > by it is either an actual exploit or is so broken that it doesn't > > deserve to continue working. If it breaks something important, then > > maybe it will need a sysctl. > > This patch breaks the following use-case: > > fd = open("/run", O_RDWR | O_TMPFILE); > sprintf(path, "/proc/self/fd/%d", fd); > fd2 = open(buf, O_RDONLY); You meant open(path, ) here? > sprintf(path, "/proc/self/fd/%d", fd2); > linkat(AT_FDCWD, path, AT_FDCWD, "/run/some_lock_file", AT_FOLLOW_SYMLINK); > > I mean I explicitly create the object as _writable_ but then keep a > read-only descriptor for debugging purposes (to make sure that the > program no longer writes to the file). This is no security feature, > but only a safety feature in case something goes wrong. But I still > want to be able to create hard-links (I _do_ have write-permissions on > the object/inode). Does some real code do it? I believe this deserves to be broken -- you explicitely opened that read-only... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html