Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270012AbUJHPUO (ORCPT ); Fri, 8 Oct 2004 11:20:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270008AbUJHPUN (ORCPT ); Fri, 8 Oct 2004 11:20:13 -0400 Received: from oceanite.ens-lyon.fr ([140.77.1.22]:1422 "EHLO oceanite.ens-lyon.fr") by vger.kernel.org with ESMTP id S270012AbUJHPTG (ORCPT ); Fri, 8 Oct 2004 11:19:06 -0400 Message-ID: <4166AFD0.2020905@ens-lyon.fr> Date: Fri, 08 Oct 2004 17:18:40 +0200 From: Brice Goglin Reply-To: Brice.Goglin@ens-lyon.org User-Agent: Mozilla Thunderbird 0.8 (X11/20040918) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Kenneth Casson Leighton Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> In-Reply-To: <20041008151837.GI5551@lkcl.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 864 Lines: 27 > call sys_rename, sys_pread, sys_create, sys_mknod, sys_rmdir > etc. - everything that does file access. If you ever actually call sys_this or sys_that ... from the kernel, you'll have to do something like this to avoid copy_from/to_user to fail because the target buffer is not in kernel space: mm_segment_t old_fs; old_fs = get_fs(); set_fs(KERNEL_DS); set_fs(old_fs); Just look for set_fs in the kernel source to find examples. -- Brice Goglin ================================================ Ph.D Student Laboratoire de l'Informatique et du Parall?lisme CNRS-ENS Lyon-INRIA-UCB Lyon France - 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/