From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: Re: [RFC v10][PATCH 05/13] Dump memory address space Date: Mon, 01 Dec 2008 10:00:12 -0800 Message-ID: <1228154412.2971.44.camel@nimitz> References: <1227747884-14150-1-git-send-email-orenl@cs.columbia.edu> <1227747884-14150-6-git-send-email-orenl@cs.columbia.edu> <20081128105351.GQ28946@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20081128105351.GQ28946-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Al Viro Cc: Oren Laadan , Andrew Morton , Linus Torvalds , containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Thomas Gleixner , Serge Hallyn , Ingo Molnar , "H. Peter Anvin" List-Id: linux-api@vger.kernel.org On Fri, 2008-11-28 at 10:53 +0000, Al Viro wrote: > > > +static int cr_ctx_checkpoint(struct cr_ctx *ctx, pid_t pid) > > +{ > > + ctx->root_pid = pid; > > + > > + /* > > + * assume checkpointer is in container's root vfs > > + * FIXME: this works for now, but will change with real containers > > + */ > > + ctx->vfsroot = ¤t->fs->root; > > + path_get(ctx->vfsroot); > > This is going to break as soon as you get another thread doing e.g. chroot(2) > while you are in there. Yeah, we do need at least a read_lock(¤t->fs->lock) to keep people from chroot()'ing underneath us. > And it's a really, _really_ bad idea to take a > pointer to shared object, increment refcount on the current *contents* of > said object and assume that dropping refcount on the later contents of the > same will balance out. Absolutely. I assume you mean get_fs_struct(current) instead of path_get(). -- Dave -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753676AbYLASAv (ORCPT ); Mon, 1 Dec 2008 13:00:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752519AbYLASAm (ORCPT ); Mon, 1 Dec 2008 13:00:42 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:41312 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752371AbYLASAl (ORCPT ); Mon, 1 Dec 2008 13:00:41 -0500 Subject: Re: [RFC v10][PATCH 05/13] Dump memory address space From: Dave Hansen To: Al Viro Cc: Oren Laadan , Andrew Morton , Linus Torvalds , containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Thomas Gleixner , Serge Hallyn , Ingo Molnar , "H. Peter Anvin" In-Reply-To: <20081128105351.GQ28946@ZenIV.linux.org.uk> References: <1227747884-14150-1-git-send-email-orenl@cs.columbia.edu> <1227747884-14150-6-git-send-email-orenl@cs.columbia.edu> <20081128105351.GQ28946@ZenIV.linux.org.uk> Content-Type: text/plain Date: Mon, 01 Dec 2008 10:00:12 -0800 Message-Id: <1228154412.2971.44.camel@nimitz> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2008-11-28 at 10:53 +0000, Al Viro wrote: > > > +static int cr_ctx_checkpoint(struct cr_ctx *ctx, pid_t pid) > > +{ > > + ctx->root_pid = pid; > > + > > + /* > > + * assume checkpointer is in container's root vfs > > + * FIXME: this works for now, but will change with real containers > > + */ > > + ctx->vfsroot = ¤t->fs->root; > > + path_get(ctx->vfsroot); > > This is going to break as soon as you get another thread doing e.g. chroot(2) > while you are in there. Yeah, we do need at least a read_lock(¤t->fs->lock) to keep people from chroot()'ing underneath us. > And it's a really, _really_ bad idea to take a > pointer to shared object, increment refcount on the current *contents* of > said object and assume that dropping refcount on the later contents of the > same will balance out. Absolutely. I assume you mean get_fs_struct(current) instead of path_get(). -- Dave From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e33.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id mB1I0GZt024068 for ; Mon, 1 Dec 2008 11:00:16 -0700 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mB1I0WIe052224 for ; Mon, 1 Dec 2008 11:00:32 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mB1I0HMK031742 for ; Mon, 1 Dec 2008 11:00:20 -0700 Subject: Re: [RFC v10][PATCH 05/13] Dump memory address space From: Dave Hansen In-Reply-To: <20081128105351.GQ28946@ZenIV.linux.org.uk> References: <1227747884-14150-1-git-send-email-orenl@cs.columbia.edu> <1227747884-14150-6-git-send-email-orenl@cs.columbia.edu> <20081128105351.GQ28946@ZenIV.linux.org.uk> Content-Type: text/plain Date: Mon, 01 Dec 2008 10:00:12 -0800 Message-Id: <1228154412.2971.44.camel@nimitz> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Al Viro Cc: Oren Laadan , Andrew Morton , Linus Torvalds , containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Thomas Gleixner , Serge Hallyn , Ingo Molnar , "H. Peter Anvin" List-ID: On Fri, 2008-11-28 at 10:53 +0000, Al Viro wrote: > > > +static int cr_ctx_checkpoint(struct cr_ctx *ctx, pid_t pid) > > +{ > > + ctx->root_pid = pid; > > + > > + /* > > + * assume checkpointer is in container's root vfs > > + * FIXME: this works for now, but will change with real containers > > + */ > > + ctx->vfsroot = ¤t->fs->root; > > + path_get(ctx->vfsroot); > > This is going to break as soon as you get another thread doing e.g. chroot(2) > while you are in there. Yeah, we do need at least a read_lock(¤t->fs->lock) to keep people from chroot()'ing underneath us. > And it's a really, _really_ bad idea to take a > pointer to shared object, increment refcount on the current *contents* of > said object and assume that dropping refcount on the later contents of the > same will balance out. Absolutely. I assume you mean get_fs_struct(current) instead of path_get(). -- Dave -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org