From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269935AbUJHMxn (ORCPT ); Fri, 8 Oct 2004 08:53:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269956AbUJHMxn (ORCPT ); Fri, 8 Oct 2004 08:53:43 -0400 Received: from open.hands.com ([195.224.53.39]:40396 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S269935AbUJHMxe (ORCPT ); Fri, 8 Oct 2004 08:53:34 -0400 Date: Fri, 8 Oct 2004 14:04:42 +0100 From: Luke Kenneth Casson Leighton To: linux-kernel@vger.kernel.org Subject: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008130442.GE5551@lkcl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org could someone kindly advise me on the location of some example code in the kernel which calls one of the userspace system calls from inside the kernel? alternatively if this has never been considered before, please could someone advise me as to how it might be achieved? thank you, l. [p.s. i found asm/unistd.h, i found the macros syscall012345 etc., i believe i don't quite understand what these are for, and may be on the wrong track.] -- -- Truth, honesty and respect are rare commodities that all spring from the same well: Love. If you love yourself and everyone and everything around you, funnily and coincidentally enough, life gets a lot better. -- lkcl.net
lkcl@lkcl.net
From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269952AbUJHNQO (ORCPT ); Fri, 8 Oct 2004 09:16:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269958AbUJHNQO (ORCPT ); Fri, 8 Oct 2004 09:16:14 -0400 Received: from smtp204.mail.sc5.yahoo.com ([216.136.130.127]:6062 "HELO smtp204.mail.sc5.yahoo.com") by vger.kernel.org with SMTP id S269952AbUJHNQL (ORCPT ); Fri, 8 Oct 2004 09:16:11 -0400 Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel From: Fabiano Ramos To: Luke Kenneth Casson Leighton Cc: linux-kernel@vger.kernel.org In-Reply-To: <20041008130442.GE5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> Content-Type: text/plain Date: Fri, 08 Oct 2004 10:07:04 -0300 Message-Id: <1097240824.4389.26.camel@lfs.barra.bali> Mime-Version: 1.0 X-Mailer: Evolution 2.0.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2004-10-08 at 14:04 +0100, Luke Kenneth Casson Leighton wrote: > could someone kindly advise me on the location of some example code in > the kernel which calls one of the userspace system calls from inside the > kernel? > > alternatively if this has never been considered before, please could > someone advise me as to how it might be achieved? > you cannot do that. For every sys_xx there is a do_xx, that can be called from inside the kernel. > thank you, > > l. > > [p.s. i found asm/unistd.h, i found the macros syscall012345 > etc., i believe i don't quite understand what these are for, and > may be on the wrong track.] These are are available for you to make syscalls from user mode without library support (usually that brand new syscall you added). They are basically wrappers that expand into C code. _syscallx, where x is the number of arguments the syscall needs. > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269976AbUJHNl3 (ORCPT ); Fri, 8 Oct 2004 09:41:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269988AbUJHNl2 (ORCPT ); Fri, 8 Oct 2004 09:41:28 -0400 Received: from oceanite.ens-lyon.fr ([140.77.1.22]:15674 "EHLO oceanite.ens-lyon.fr") by vger.kernel.org with ESMTP id S269976AbUJHNiu (ORCPT ); Fri, 8 Oct 2004 09:38:50 -0400 Message-ID: <41669844.1070907@ens-lyon.fr> Date: Fri, 08 Oct 2004 15:38:12 +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: Fabiano Ramos 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> <1097240824.4389.26.camel@lfs.barra.bali> In-Reply-To: <1097240824.4389.26.camel@lfs.barra.bali> 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 > For every sys_xx there is a do_xx, that can > be called from inside the kernel. Well, not every sys_xx, but most of them :) For example there's no do_epoll_ctl for sys_epoll_ctl. I requested this one a long time ago but didn't get it. Regards, Brice Goglin ================================================ Ph.D Student Laboratoire de l'Informatique et du Parallélisme CNRS-ENS Lyon-INRIA-UCB Lyon From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269979AbUJHOCJ (ORCPT ); Fri, 8 Oct 2004 10:02:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269982AbUJHOCJ (ORCPT ); Fri, 8 Oct 2004 10:02:09 -0400 Received: from mail5.iserv.net ([204.177.184.155]:62096 "EHLO mail5.iserv.net") by vger.kernel.org with ESMTP id S269979AbUJHOCH (ORCPT ); Fri, 8 Oct 2004 10:02:07 -0400 Message-ID: <41669DE0.9050005@didntduck.org> Date: Fri, 08 Oct 2004 10:02:08 -0400 From: Brian Gerst User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 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> In-Reply-To: <20041008130442.GE5551@lkcl.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Luke Kenneth Casson Leighton wrote: > could someone kindly advise me on the location of some example code in > the kernel which calls one of the userspace system calls from inside the > kernel? > > alternatively if this has never been considered before, please could > someone advise me as to how it might be achieved? What are you trying to do? In most cases needing to use syscalls from within the kernel is an indication of a design flaw. The most common case is loading firmware, which should use request_firmware() instead. -- Brian Gerst From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270001AbUJHPIH (ORCPT ); Fri, 8 Oct 2004 11:08:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270005AbUJHPIH (ORCPT ); Fri, 8 Oct 2004 11:08:07 -0400 Received: from open.hands.com ([195.224.53.39]:16080 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S270001AbUJHPIC (ORCPT ); Fri, 8 Oct 2004 11:08:02 -0400 Date: Fri, 8 Oct 2004 16:18:37 +0100 From: Luke Kenneth Casson Leighton To: Brian Gerst Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008151837.GI5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41669DE0.9050005@didntduck.org> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2004 at 10:02:08AM -0400, Brian Gerst wrote: > Luke Kenneth Casson Leighton wrote: > >could someone kindly advise me on the location of some example code in > >the kernel which calls one of the userspace system calls from inside the > >kernel? > > > >alternatively if this has never been considered before, please could > >someone advise me as to how it might be achieved? > > What are you trying to do? call sys_rename, sys_pread, sys_create, sys_mknod, sys_rmdir etc. - everything that does file access. > In most cases needing to use syscalls from > within the kernel is an indication of a design flaw. in this case it's an attempt to avoid cutting and pasting the entire contents of sys_rename, sys_pread, sys_this, sys_that, removing the first couple and last few lines (that do copy_from_user) and replacing the arguments with either a dentry or a kernel-side char* instead of an __user char*. my alternative is to patch every single vfs-related sys_* in fs/*.c to be able to "plug in" to these functions. l. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269994AbUJHPNF (ORCPT ); Fri, 8 Oct 2004 11:13:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270005AbUJHPNF (ORCPT ); Fri, 8 Oct 2004 11:13:05 -0400 Received: from gate.firmix.at ([80.109.18.208]:50870 "EHLO gate.firmix.at") by vger.kernel.org with ESMTP id S269994AbUJHPNB (ORCPT ); Fri, 8 Oct 2004 11:13:01 -0400 Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel From: Bernd Petrovitsch To: Luke Kenneth Casson Leighton Cc: Brian Gerst , linux-kernel@vger.kernel.org In-Reply-To: <20041008151837.GI5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> Content-Type: text/plain Organization: Firmix Software GmbH Message-Id: <1097248370.26463.0.camel@tara.firmix.at> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.5 Date: Fri, 08 Oct 2004 17:12:51 +0200 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2004-10-08 at 16:18 +0100, Luke Kenneth Casson Leighton wrote: > On Fri, Oct 08, 2004 at 10:02:08AM -0400, Brian Gerst wrote: > > Luke Kenneth Casson Leighton wrote: > > >could someone kindly advise me on the location of some example code in > > >the kernel which calls one of the userspace system calls from inside the > > >kernel? > > > > > >alternatively if this has never been considered before, please could > > >someone advise me as to how it might be achieved? > > > > What are you trying to do? > > call sys_rename, sys_pread, sys_create, sys_mknod, sys_rmdir > etc. - everything that does file access. > > > In most cases needing to use syscalls from > > within the kernel is an indication of a design flaw. > > in this case it's an attempt to avoid cutting and pasting > the entire contents of sys_rename, sys_pread, sys_this, > sys_that, removing the first couple and last few lines (that > do copy_from_user) and replacing the arguments with either > a dentry or a kernel-side char* instead of an __user char*. > > my alternative is to patch every single vfs-related sys_* in fs/*.c to > be able to "plug in" to these functions. Why not implement it in user-space? Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services From mboxrd@z Thu Jan 1 00:00:00 1970 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 > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270014AbUJHPYh (ORCPT ); Fri, 8 Oct 2004 11:24:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270015AbUJHPYh (ORCPT ); Fri, 8 Oct 2004 11:24:37 -0400 Received: from open.hands.com ([195.224.53.39]:38608 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S270014AbUJHPY1 (ORCPT ); Fri, 8 Oct 2004 11:24:27 -0400 Date: Fri, 8 Oct 2004 16:35:23 +0100 From: Luke Kenneth Casson Leighton To: Fabiano Ramos Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008153523.GK5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <1097240824.4389.26.camel@lfs.barra.bali> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1097240824.4389.26.camel@lfs.barra.bali> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2004 at 10:07:04AM -0300, Fabiano Ramos wrote: > On Fri, 2004-10-08 at 14:04 +0100, Luke Kenneth Casson Leighton wrote: > > could someone kindly advise me on the location of some example code in > > the kernel which calls one of the userspace system calls from inside the > > kernel? > > > > alternatively if this has never been considered before, please could > > someone advise me as to how it might be achieved? > > > > you cannot do that. For every sys_xx there is a do_xx, that can > be called from inside the kernel. so, there's a do_rename (yes i found that and ISTRC that when i used it i can't exactly remember what the problem was: either i got an error code -14 or i got "warning symbol do_rename not found" when my module was linked together, even though it says EXPORT_SYMBOL(do_rename) in fs/namei.c, so i was forced to cut/paste sys_rename) and there's a do_open no there isn't, there's filp_open. and a do_pread64 no there isn't i had to cut/paste sys_pread64 which was okay because it's pretty basic, just call vfs_read. and a do_mkdir no there isn't so i had to cut/paste that. basically what i am doing is writing a file system "proxy" module which re-calls back into the filesystem with a prefix onto the front of the pathname. > > [p.s. i found asm/unistd.h, i found the macros syscall012345 > > etc., i believe i don't quite understand what these are for, and > > may be on the wrong track.] > > These are are available for you to make syscalls from user mode > without library support (usually that brand new syscall you added). > They are basically wrappers that expand into C code. _syscallx, > where x is the number of arguments the syscall needs. so, it's for use the other way round. okay, thanks for keeping me off a broken line of enquiry. [oh, and i'll be abandoning this line of enquiry _entirely_ if i find that supermount-ng can do the same job - namely manage to keep userspace programs happy when users rip out media] -- -- Truth, honesty and respect are rare commodities that all spring from the same well: Love. If you love yourself and everyone and everything around you, funnily and coincidentally enough, life gets a lot better. -- lkcl.net
lkcl@lkcl.net
From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270020AbUJHP26 (ORCPT ); Fri, 8 Oct 2004 11:28:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270025AbUJHP2m (ORCPT ); Fri, 8 Oct 2004 11:28:42 -0400 Received: from mail3.iserv.net ([204.177.184.153]:26051 "EHLO mail3.iserv.net") by vger.kernel.org with ESMTP id S270020AbUJHP1o (ORCPT ); Fri, 8 Oct 2004 11:27:44 -0400 Message-ID: <4166B1F3.4020102@didntduck.org> Date: Fri, 08 Oct 2004 11:27:47 -0400 From: Brian Gerst User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 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=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Luke Kenneth Casson Leighton wrote: > On Fri, Oct 08, 2004 at 10:02:08AM -0400, Brian Gerst wrote: > >>Luke Kenneth Casson Leighton wrote: >> >>>could someone kindly advise me on the location of some example code in >>>the kernel which calls one of the userspace system calls from inside the >>>kernel? >>> >>>alternatively if this has never been considered before, please could >>>someone advise me as to how it might be achieved? >> >>What are you trying to do? > > > call sys_rename, sys_pread, sys_create, sys_mknod, sys_rmdir > etc. - everything that does file access. > Why? What are you trying to do that cannot be done in userspace? -- Brian Gerst From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270013AbUJHPiD (ORCPT ); Fri, 8 Oct 2004 11:38:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270032AbUJHPiD (ORCPT ); Fri, 8 Oct 2004 11:38:03 -0400 Received: from smtp209.mail.sc5.yahoo.com ([216.136.130.117]:1981 "HELO smtp209.mail.sc5.yahoo.com") by vger.kernel.org with SMTP id S270013AbUJHPhw (ORCPT ); Fri, 8 Oct 2004 11:37:52 -0400 Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel From: Fabiano Ramos To: Brice.Goglin@ens-lyon.org Cc: linux-kernel@vger.kernel.org In-Reply-To: <41669844.1070907@ens-lyon.fr> References: <20041008130442.GE5551@lkcl.net> <1097240824.4389.26.camel@lfs.barra.bali> <41669844.1070907@ens-lyon.fr> Content-Type: text/plain; charset=iso-8859-1 Date: Fri, 08 Oct 2004 12:04:50 -0300 Message-Id: <1097247890.5766.3.camel@lfs.barra.bali> Mime-Version: 1.0 X-Mailer: Evolution 2.0.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2004-10-08 at 15:38 +0200, Brice Goglin wrote: > > For every sys_xx there is a do_xx, that can > > be called from inside the kernel. > > Well, not every sys_xx, but most of them :) yes, you're right. ptrace() is another example. Too quick of an answer from may part ;) > For example there's no do_epoll_ctl for sys_epoll_ctl. > I requested this one a long time ago but didn't get it. > > Regards, > > Brice Goglin > ================================================ > Ph.D Student > Laboratoire de l'Informatique et du Parallélisme > CNRS-ENS Lyon-INRIA-UCB Lyon > - > 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/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S267517AbUJHQKc (ORCPT ); Fri, 8 Oct 2004 12:10:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270039AbUJHQKc (ORCPT ); Fri, 8 Oct 2004 12:10:32 -0400 Received: from open.hands.com ([195.224.53.39]:42961 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S267517AbUJHQKU (ORCPT ); Fri, 8 Oct 2004 12:10:20 -0400 Date: Fri, 8 Oct 2004 17:20:25 +0100 From: Luke Kenneth Casson Leighton To: Brice.Goglin@ens-lyon.org Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008162025.GL5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> <4166AFD0.2020905@ens-lyon.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4166AFD0.2020905@ens-lyon.fr> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2004 at 05:18:40PM +0200, Brice Goglin wrote: > > 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); that's it! that's what i was looking for. thank you. l. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269992AbUJHQhI (ORCPT ); Fri, 8 Oct 2004 12:37:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270006AbUJHQhI (ORCPT ); Fri, 8 Oct 2004 12:37:08 -0400 Received: from lug-owl.de ([195.71.106.12]:10727 "EHLO lug-owl.de") by vger.kernel.org with ESMTP id S269992AbUJHQhC (ORCPT ); Fri, 8 Oct 2004 12:37:02 -0400 Date: Fri, 8 Oct 2004 18:37:01 +0200 From: Jan-Benedict Glaw To: Luke Kenneth Casson Leighton Cc: Brice.Goglin@ens-lyon.org, linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008163701.GV5033@lug-owl.de> Mail-Followup-To: Luke Kenneth Casson Leighton , Brice.Goglin@ens-lyon.org, linux-kernel@vger.kernel.org References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> <4166AFD0.2020905@ens-lyon.fr> <20041008162025.GL5551@lkcl.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5EhqeiticJwWsSCK" Content-Disposition: inline In-Reply-To: <20041008162025.GL5551@lkcl.net> X-Operating-System: Linux mail 2.6.8-rc4 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net User-Agent: Mutt/1.5.6i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --5EhqeiticJwWsSCK Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, 2004-10-08 17:20:25 +0100, Luke Kenneth Casson Leighton wrote in message <20041008162025.GL5551@lkcl.net>: > On Fri, Oct 08, 2004 at 05:18:40PM +0200, Brice Goglin wrote: > > mm_segment_t old_fs; > > old_fs =3D get_fs(); > > set_fs(KERNEL_DS); > > > > set_fs(old_fs); > =20 > that's it! that's what i was looking for. thank you. Most probably, this is not what you were looking for. You just don't know that yet (-: MfG, JBG --=20 Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 = _ O _ "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg = _ _ O fuer einen Freien Staat voll Freier B=FCrger" | im Internet! | im Irak! = O O O ret =3D do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA)= ); --5EhqeiticJwWsSCK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBZsItHb1edYOZ4bsRAgnNAJsFN4S5dNrnVMr83H0muHQ2VsTvfgCfeJcT KEUxY8bYT63TG+BHAjJVZfU= =JcwQ -----END PGP SIGNATURE----- --5EhqeiticJwWsSCK-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270028AbUJHQv4 (ORCPT ); Fri, 8 Oct 2004 12:51:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270037AbUJHQv4 (ORCPT ); Fri, 8 Oct 2004 12:51:56 -0400 Received: from open.hands.com ([195.224.53.39]:45522 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S270028AbUJHQvy (ORCPT ); Fri, 8 Oct 2004 12:51:54 -0400 Date: Fri, 8 Oct 2004 18:03:00 +0100 From: Luke Kenneth Casson Leighton To: Bernd Petrovitsch Cc: Brian Gerst , linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008170300.GM5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> <1097248370.26463.0.camel@tara.firmix.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1097248370.26463.0.camel@tara.firmix.at> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2004 at 05:12:51PM +0200, Bernd Petrovitsch wrote: > > my alternative is to patch every single vfs-related sys_* in fs/*.c to > > be able to "plug in" to these functions. > > Why not implement it in user-space? that is the base that i am working from (fuse). the problem comes when adding support to fuse for xattrs, and the subsequent use of those xattrs for SE/Linux. security/selinux/hooks.c cannot cope with the -512 response "please try later" which the fuse module always always always sends, in order for fuse to give the userspace daemon a chance to wake up and smell the roses. ... and i sure ain't gonna hack selinux about! l. -- -- Truth, honesty and respect are rare commodities that all spring from the same well: Love. If you love yourself and everyone and everything around you, funnily and coincidentally enough, life gets a lot better. -- lkcl.net
lkcl@lkcl.net
From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270037AbUJHQxd (ORCPT ); Fri, 8 Oct 2004 12:53:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270039AbUJHQxc (ORCPT ); Fri, 8 Oct 2004 12:53:32 -0400 Received: from open.hands.com ([195.224.53.39]:48338 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S270037AbUJHQxU (ORCPT ); Fri, 8 Oct 2004 12:53:20 -0400 Date: Fri, 8 Oct 2004 18:04:26 +0100 From: Luke Kenneth Casson Leighton To: Brian Gerst Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008170426.GN5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> <4166B1F3.4020102@didntduck.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4166B1F3.4020102@didntduck.org> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2004 at 11:27:47AM -0400, Brian Gerst wrote: > >>What are you trying to do? > > > > > > call sys_rename, sys_pread, sys_create, sys_mknod, sys_rmdir > > etc. - everything that does file access. > > > > Why? What are you trying to do that cannot be done in userspace? see other message: i'm trying to combine fuse + its example program fusexmp into a kernelspace module: when i added xattrs i get a -512 pleasetrylater response which selinux cannot cope with. l. -- -- Truth, honesty and respect are rare commodities that all spring from the same well: Love. If you love yourself and everyone and everything around you, funnily and coincidentally enough, life gets a lot better. -- lkcl.net
lkcl@lkcl.net
From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S270070AbUJHR1A (ORCPT ); Fri, 8 Oct 2004 13:27:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S270067AbUJHR07 (ORCPT ); Fri, 8 Oct 2004 13:26:59 -0400 Received: from open.hands.com ([195.224.53.39]:29907 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S270071AbUJHR0r (ORCPT ); Fri, 8 Oct 2004 13:26:47 -0400 Date: Fri, 8 Oct 2004 18:37:50 +0100 From: Luke Kenneth Casson Leighton To: Brice.Goglin@ens-lyon.org, linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041008173750.GP5551@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <41669DE0.9050005@didntduck.org> <20041008151837.GI5551@lkcl.net> <4166AFD0.2020905@ens-lyon.fr> <20041008162025.GL5551@lkcl.net> <20041008163701.GV5033@lug-owl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041008163701.GV5033@lug-owl.de> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2004 at 06:37:01PM +0200, Jan-Benedict Glaw wrote: > On Fri, 2004-10-08 17:20:25 +0100, Luke Kenneth Casson Leighton > wrote in message <20041008162025.GL5551@lkcl.net>: > > On Fri, Oct 08, 2004 at 05:18:40PM +0200, Brice Goglin wrote: > > > > mm_segment_t old_fs; > > > old_fs = get_fs(); > > > set_fs(KERNEL_DS); > > > > > > set_fs(old_fs); > > > > that's it! that's what i was looking for. thank you. > > Most probably, this is not what you were looking for. You just don't > know that yet (-: *grin*. yeh, like someone else privately responded saying i might want to look at compat_alloc_userspace() instead :) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268541AbUJJXNP (ORCPT ); Sun, 10 Oct 2004 19:13:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268544AbUJJXNP (ORCPT ); Sun, 10 Oct 2004 19:13:15 -0400 Received: from eth1023.nsw.adsl.internode.on.net ([150.101.206.254]:52945 "EHLO naya.ABOOSPLANET.COM") by vger.kernel.org with ESMTP id S268541AbUJJXNJ convert rfc822-to-8bit (ORCPT ); Sun, 10 Oct 2004 19:13:09 -0400 Subject: RE: how do you call userspace syscalls (e.g. sys_rename) from inside kernel MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Date: Mon, 11 Oct 2004 09:13:06 +1000 Content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Message-ID: <3D6FC8DFDDD0CE44A3BE652A27AD42A54569@naya.aboosplanet.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Thread-Index: AcStS0S/qdK0Dz2VR0W3R7Sc3DU3xwB0dKXg From: "Aboo Valappil" To: "Luke Kenneth Casson Leighton" , "Fabiano Ramos" Cc: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi, In the past I looked in to open, read and write a file from a kernel module. But problem I faced using the kernel function was that it checks for the permissions of the file and path against the "current" process. For eg: open_namei() function ... My requirement was to open the file regardless of the permissions on the file and also not by modifying task_struct of the current process to change the permissions first ! I also wanted not associate the file with the current/any processes. Any ideas on this ? Then I thought of using a work around and avoid opening files in kernel mode. Thanks Aboo -----Original Message----- From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Luke Kenneth Casson Leighton Sent: Saturday, October 09, 2004 1:35 AM To: Fabiano Ramos Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel On Fri, Oct 08, 2004 at 10:07:04AM -0300, Fabiano Ramos wrote: > On Fri, 2004-10-08 at 14:04 +0100, Luke Kenneth Casson Leighton wrote: > > could someone kindly advise me on the location of some example code in > > the kernel which calls one of the userspace system calls from inside the > > kernel? > > > > alternatively if this has never been considered before, please could > > someone advise me as to how it might be achieved? > > > > you cannot do that. For every sys_xx there is a do_xx, that can > be called from inside the kernel. so, there's a do_rename (yes i found that and ISTRC that when i used it i can't exactly remember what the problem was: either i got an error code -14 or i got "warning symbol do_rename not found" when my module was linked together, even though it says EXPORT_SYMBOL(do_rename) in fs/namei.c, so i was forced to cut/paste sys_rename) and there's a do_open no there isn't, there's filp_open. and a do_pread64 no there isn't i had to cut/paste sys_pread64 which was okay because it's pretty basic, just call vfs_read. and a do_mkdir no there isn't so i had to cut/paste that. basically what i am doing is writing a file system "proxy" module which re-calls back into the filesystem with a prefix onto the front of the pathname. > > [p.s. i found asm/unistd.h, i found the macros syscall012345 > > etc., i believe i don't quite understand what these are for, and > > may be on the wrong track.] > > These are are available for you to make syscalls from user mode > without library support (usually that brand new syscall you added). > They are basically wrappers that expand into C code. _syscallx, > where x is the number of arguments the syscall needs. so, it's for use the other way round. okay, thanks for keeping me off a broken line of enquiry. [oh, and i'll be abandoning this line of enquiry _entirely_ if i find that supermount-ng can do the same job - namely manage to keep userspace programs happy when users rip out media] -- -- Truth, honesty and respect are rare commodities that all spring from the same well: Love. If you love yourself and everyone and everything around you, funnily and coincidentally enough, life gets a lot better. -- lkcl.net
lkcl@lkcl.net
- 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/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268576AbUJJXiZ (ORCPT ); Sun, 10 Oct 2004 19:38:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268577AbUJJXiZ (ORCPT ); Sun, 10 Oct 2004 19:38:25 -0400 Received: from natsmtp00.rzone.de ([81.169.145.165]:15037 "EHLO natsmtp00.rzone.de") by vger.kernel.org with ESMTP id S268576AbUJJXiX (ORCPT ); Sun, 10 Oct 2004 19:38:23 -0400 From: Arnd Bergmann To: "Aboo Valappil" Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Date: Mon, 11 Oct 2004 01:35:16 +0200 User-Agent: KMail/1.6.2 Cc: "Luke Kenneth Casson Leighton" , "Fabiano Ramos" , References: <3D6FC8DFDDD0CE44A3BE652A27AD42A54569@naya.aboosplanet.com> In-Reply-To: <3D6FC8DFDDD0CE44A3BE652A27AD42A54569@naya.aboosplanet.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-02=_4ccaBOKKkFiFwaO"; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <200410110135.20747.arnd@arndb.de> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --Boundary-02=_4ccaBOKKkFiFwaO Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Maandag 11 Oktober 2004 01:13, Aboo Valappil wrote: > I also wanted not associate the file with the current/any > processes.=20 >=20 > Any ideas on this ? >=20 > Then I thought of using a work around and avoid opening files in kernel > mode. Most of the code that traditionally used to read files from inside the kernel can be converted to calling request_firmware(). The basic idea is that you have a user space helper that writes the data into the kernel instead of the other way round. Arnd <>< --Boundary-02=_4ccaBOKKkFiFwaO Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBacc45t5GS2LDRf4RAhkpAJ9TfP6dUbxsJeU1BqS3FleCStQmWQCeOPbp pNb6BZf9fIsylkYxBML9eB4= =Ari/ -----END PGP SIGNATURE----- --Boundary-02=_4ccaBOKKkFiFwaO-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268745AbUJKKGi (ORCPT ); Mon, 11 Oct 2004 06:06:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268751AbUJKKGi (ORCPT ); Mon, 11 Oct 2004 06:06:38 -0400 Received: from twin.jikos.cz ([213.151.79.26]:22233 "EHLO twin.jikos.cz") by vger.kernel.org with ESMTP id S268745AbUJKKGe (ORCPT ); Mon, 11 Oct 2004 06:06:34 -0400 Date: Mon, 11 Oct 2004 11:56:18 +0200 (CEST) From: Jirka Kosina To: Aboo Valappil cc: Luke Kenneth Casson Leighton , Fabiano Ramos , linux-kernel@vger.kernel.org Subject: RE: how do you call userspace syscalls (e.g. sys_rename) from inside kernel In-Reply-To: <3D6FC8DFDDD0CE44A3BE652A27AD42A54569@naya.aboosplanet.com> Message-ID: References: <3D6FC8DFDDD0CE44A3BE652A27AD42A54569@naya.aboosplanet.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Oct 2004, Aboo Valappil wrote: > In the past I looked in to open, read and write a file from a kernel > module. But problem I faced using the kernel function was that it > checks for the permissions of the file and path against the "current" > process. For eg: open_namei() function ... My requirement was to open > the file regardless of the permissions on the file and also not by > modifying task_struct of the current process to change the permissions > first ! I also wanted not associate the file with the current/any > processes. Any ideas on this ? 1) This is offtopic on LKML, kernelnewbies might be more apropriate list 2) look at set_fs() and filp_open() calls, they might be useful for you 3) Think twice if opening files from kernel is the thing you are willing to do -- JiKos. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269379AbUJLAPl (ORCPT ); Mon, 11 Oct 2004 20:15:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269381AbUJLAPl (ORCPT ); Mon, 11 Oct 2004 20:15:41 -0400 Received: from rproxy.gmail.com ([64.233.170.202]:43154 "EHLO mproxy.gmail.com") by vger.kernel.org with ESMTP id S269379AbUJLAPi (ORCPT ); Mon, 11 Oct 2004 20:15:38 -0400 Message-ID: <35fb2e5904101117156b033f6b@mail.gmail.com> Date: Tue, 12 Oct 2004 01:15:34 +0100 From: Jon Masters Reply-To: jonathan@jonmasters.org To: Luke Kenneth Casson Leighton Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Cc: linux-kernel@vger.kernel.org In-Reply-To: <20041008130442.GE5551@lkcl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20041008130442.GE5551@lkcl.net> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Oct 2004 14:04:42 +0100, Luke Kenneth Casson Leighton wrote: > could someone kindly advise me on the location of some example code in > the kernel which calls one of the userspace system calls from inside the > kernel? Hi Luke, I enjoyed your recent talk at OxLUG in which you mentioned this briefly. Could you please send me the source that you are working on so that I can take a look and make suggestions if tha'ts useful - I posted to the OxLUG list but you're not actually on it and although I now have your address from someone, this post reminded me. I've copied lkml for two reasons - a). Someone else might want to take a look. b). I sat and talked with Luke for a while about this, he's not a typical "I want to do stuff in the kernel I should be doing from userspace" kind of person in my opinion (there might still be a better way but until I see more what he's actually doing then I can't work out what). Jon. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261234AbUJLNFf (ORCPT ); Tue, 12 Oct 2004 09:05:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261405AbUJLNFf (ORCPT ); Tue, 12 Oct 2004 09:05:35 -0400 Received: from open.hands.com ([195.224.53.39]:58841 "EHLO open.hands.com") by vger.kernel.org with ESMTP id S261234AbUJLNFW (ORCPT ); Tue, 12 Oct 2004 09:05:22 -0400 Date: Tue, 12 Oct 2004 14:16:22 +0100 From: Luke Kenneth Casson Leighton To: jonathan@jonmasters.org Cc: linux-kernel@vger.kernel.org Subject: Re: how do you call userspace syscalls (e.g. sys_rename) from inside kernel Message-ID: <20041012131622.GX22010@lkcl.net> References: <20041008130442.GE5551@lkcl.net> <35fb2e5904101117156b033f6b@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35fb2e5904101117156b033f6b@mail.gmail.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-hands-com-MailScanner: Found to be clean X-hands-com-MailScanner-SpamScore: s X-MailScanner-From: lkcl@lkcl.net Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org hiya jon, i'm placing _a_ version at http://hands.com/~lkcl/fuse.xattr.2.tgz. it's the "mostly userspace" version, with hacked-up xattrs that "track" what the userspace code does, inside the kernel. due to having to implement fuse "getxattr" and friends in kernel-space (in order to avoid having the -512 error message returned to selinux/hooks.c), there are two locations in the code where you must specify the proxy point: 1) example/fusexmp.c you must change "/home/sez" to your-directory. 2) kernel/util.c likewise. in 1) it is the location where userspace file access occurs. 2) is obviously matching the userspace xattr access. i _do_ have a version of fuse where pretty-much-everything-but-the-inode-allocation-which-is-done-in-libfuse-has-been-moved-to-kernel. i've been examining a number of kernel modules (ncpfs primarily) in an attempt to understand how to move libfuse's userspace inode allocation system into kernelspace. i'm tempted to abandon fuse and use lufs instead... that has a directory cache in userspace but at least it appears to allocate inodes in kernel (using iunique()). hmmm... On Tue, Oct 12, 2004 at 01:15:34AM +0100, Jon Masters wrote: > On Fri, 8 Oct 2004 14:04:42 +0100, Luke Kenneth Casson Leighton > wrote: > > could someone kindly advise me on the location of some example code in > > the kernel which calls one of the userspace system calls from inside the > > kernel? > > Hi Luke, > > I enjoyed your recent talk at OxLUG in which you mentioned this > briefly. Could you please send me the source that you are working on > so that I can take a look and make suggestions if tha'ts useful - I > posted to the OxLUG list but you're not actually on it and although I > now have your address from someone, this post reminded me. > > I've copied lkml for two reasons - a). Someone else might want to take > a look. b). I sat and talked with Luke for a while about this, he's > not a typical "I want to do stuff in the kernel I should be doing from > userspace" kind of person in my opinion (there might still be a better > way but until I see more what he's actually doing then I can't work > out what). > > Jon. -- -- Truth, honesty and respect are rare commodities that all spring from the same well: Love. If you love yourself and everyone and everything around you, funnily and coincidentally enough, life gets a lot better. -- lkcl.net
lkcl@lkcl.net