Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbcCGKG5 (ORCPT ); Mon, 7 Mar 2016 05:06:57 -0500 Received: from mail-ob0-f177.google.com ([209.85.214.177]:32907 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752637AbcCGKGR (ORCPT ); Mon, 7 Mar 2016 05:06:17 -0500 MIME-Version: 1.0 X-Originating-IP: [217.173.44.24] In-Reply-To: <9569.1436277884@warthog.procyon.org.uk> References: <9569.1436277884@warthog.procyon.org.uk> Date: Mon, 7 Mar 2016 11:06:14 +0100 Message-ID: Subject: Re: [PATCH] overlayfs: Warn on copy up if a process has a R/O fd open to the lower file From: Miklos Szeredi To: David Howells Cc: Al Viro , Kernel Mailing List , Linux-Fsdevel , "linux-unionfs@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1088 Lines: 38 On Tue, Jul 7, 2015 at 4:04 PM, David Howells wrote: > > Print a warning when overlayfs copies up a file if the process that triggered > the copy up has a R/O fd open to the lower file being copied up. > > This can help catch applications that do things like the following: > > fd1 = open("foo", O_RDONLY); > fd2 = open("foo", O_RDWR); > > where they expect fd1 and fd2 to refer to the same file - which will no longer > be the case post-copy up. > > With this patch, the following commands: > > bash 5 6<>/mnt/a/foo128 > > assuming /mnt/a/foo128 to be an un-copied up file on an overlay will produce > the following warning in the kernel log: > > overlayfs: Copying up foo129, but open R/O on fd 5 which will cease to > be coherent [pid=3818 bash] > > This is enabled by setting: > > /sys/module/overlay/parameters/check_copy_up > > to 1. > > The warnings are ratelimited and are also limited to one warning per file - > assuming the copy up completes in each case. > Queued. Thanks, Miklos