site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=hAGwX2+7pRwtKQkZlGYDX+OD5TtvbXZukjDANFCBHBE=; b=FMDLZAuO03RAsSBtDQo5dsbWTMQdvXk1soFqdPsnECG4bgpP1afE0tLs3WftuWcbIsH1LFKEQIKvPaw+FIl6rHboqUw0y5R5ncXOhaf6TswS+6mmoKcA15qwrU5nZG3gOUXDWRmuTNY1D0sUzR1sniG5OfnvPzQ/LA+mj007yA4= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=U65D543zD0Ef6A72ZaFHVx3gPat2IUUHFfPfUz+wkGi/P9c5qZB+zW/ffyXQs7wvRn/jOsAiy9adMNj19+AjumyWnl5QB/WQCddOQk2bkoxMPihqHF+e0vz2ydMse5ggKxZ4CSXhHDUYHR/BmYzysiq9yZVNJYzio7JB09f+ArI= On 10/13/07, Michael Smith <drivers@mu.org> wrote:
On Oct 11, 2007, at 6:05 AM, Liviu Andron wrote:
I have some troubles in accessing files from user space using Kauth. Access means read or write.
It is not clear from what you've written here exactly what you are trying to do.
I am going to assume that you have a KAUTH filter and a user-space component that communicates with this filter. In the user-space component, you want to read/write files that are being seen by the filter.
Correct.
1) The recommended way from the technical documentation is to read/ write in kernel, but all the mailing lists discussions say to do it in user space.
As per Terry, I am not aware of any documentation that suggests you should be reading/writing files from within the kernel. It is highly discouraged.
Answered to Terry.
2) Assuming that I send the path from kernel to the user space daemon (returned by vn_getpath from the vnode parameter) , I have the following issues: - for files with paths longer than MATXPAHTLEN (1024) , which can be created with Finder: - vn_getpath returns error 28 (KERN_INVALID_POLICY) - the callback for OPEN/CLOSE actions is called with empty path (arg1) or it's not called at all
As has been noted, vn_getpath operates on an arbitrary buffer supplied by the caller. If you make your buffer bigger on seeing this error, you should be OK.
Note that the close callback is only called for the last close on a file.
Thanks for the last tip, but it isn't what I intended to say. I'll try to post next days more information related to long paths.
4) Another possible solution seems to be using VNOP_READ/ VNOP_WRITE in kernel space and transfer data to daemon
This devolves to doing file I/O in the kernel again, which is still highly discouraged.
= Mike
Look what I understand: implementing Kauth listeners (and I need both fileop and vnode listeners) with the need to read/write from/to files must be done by using the path in user space.( 1) no file I/O in kernel 2) no way to provide a file descriptor to the user space). Problems with the paths in user space: 1) maybe the path cannot be always retrieved 2) very long paths: technical problems when transferring them in user space (large memory allocations, IODataQueue needs a limit) (I just say it is difficult) ( anyway , the path isn't very interesting unlike reading/writing from/to files) 3) (?) a file descriptor might be impossible to obtain if the vnode is created with exclusive access ; wait for the last CLOSE ? what about a shutdown ? (the only way I see to avoid exclusivness is to read/write from the initial vnode, but that's kernel) I mentioned these problems in the second reply, first 2 can be avoided with a file descriptor retrieved from the vnode in kernel, which also can't be done. Thanks for the help. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com