Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756699AbYH1UVs (ORCPT ); Thu, 28 Aug 2008 16:21:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753386AbYH1UVk (ORCPT ); Thu, 28 Aug 2008 16:21:40 -0400 Received: from terminus.zytor.com ([198.137.202.10]:33272 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752913AbYH1UVj (ORCPT ); Thu, 28 Aug 2008 16:21:39 -0400 Message-ID: <48B708C4.4000405@kernel.org> Date: Thu, 28 Aug 2008 13:21:24 -0700 From: "H. Peter Anvin" Organization: Linux Kernel Organization, Inc. User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: Miklos Szeredi CC: tj@kernel.org, fuse-devel@lists.sourceforge.net, greg@kroah.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/7] FUSE: implement ioctl support References: <1219945263-21074-1-git-send-email-tj@kernel.org> <1219945263-21074-6-git-send-email-tj@kernel.org> <48B6EC83.1070207@kernel.org> <48B6EE36.5070209@kernel.org> <48B6F7C5.3020204@kernel.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1221 Lines: 30 Miklos Szeredi wrote: > On Thu, 28 Aug 2008, H. Peter Anvin wrote: >> Tejun Heo wrote: >>> Ah.... funky. If this retry thing is too repulsive, I guess the best >>> alternative would be directly accessing caller's memory as Miklos suggested. >>> >> Be careful -- there are some serious dragons there in the presence of >> multiple threads. > > OK, it should map /proc/pid/task/tid/mem. Or rather > /proc/tid/task/tid/mem, as the pid (tgid) of the caller is not > currently passed to the filesystem. > Uhm, no. You can still have it change underneath you as long as you have any thread of execution with access to the same memory. This is *hard* to get right, and we screw this up in the kernel with painful regularity. The throught of having user-space processes, which don't have access to the kernel locking primitives and functions like copy_from_user() dealing with this stuff scares me crazy. That is why I'm suggesting using an in-kernel linearizer. -hpa -- 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/