Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932454AbcJNPA2 (ORCPT ); Fri, 14 Oct 2016 11:00:28 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51078 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbcJNPAU (ORCPT ); Fri, 14 Oct 2016 11:00:20 -0400 Date: Fri, 14 Oct 2016 16:00:17 +0100 From: Al Viro To: Mattias Nissler Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] [PATCH] Add a "nolinks" mount option. Message-ID: <20161014150017.GB19539@ZenIV.linux.org.uk> References: <1476455305-35554-1-git-send-email-mnissler@chromium.org> <20161014145515.GA19539@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161014145515.GA19539@ZenIV.linux.org.uk> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1560 Lines: 26 On Fri, Oct 14, 2016 at 03:55:15PM +0100, Al Viro wrote: > > Setting the "nolinks" mount option helps prevent privileged writers > > from modifying files unintentionally in case there is an unexpected > > link along the accessed path. The "nolinks" option is thus useful as a > > defensive measure against persistent exploits (i.e. a system getting > > re-exploited after a reboot) for systems that employ a read-only or > > dm-verity-protected rootfs. These systems prevent non-legit binaries > > from running after reboot. However, legit code typically still reads > > from and writes to a writable file system previously under full > > control of the attacker, who can place symlinks to trick file writes > > after reboot to target a file of their choice. "nolinks" fundamentally > > prevents this. > > Which parts of the tree would be on that "protected" rootfs and which would > you mount with that option? Description above is rather vague and I'm > not convinced that it actually buys you anything. Details, please... PS: what the hell do restrictions on _following_ symlinks have to _creating_ hardlinks? I'm trying to imagine a threat model where both would apply or anything else beyond the word "link" they would have in common... The one you've described above might have something to do with the first one (modulo missing description of the setup you have in mind), but it clearly has nothing to do with the second - attackers could've created whatever they wanted while the fs had been under their control, after all. Doesn't make sense...