Re: Fuse (and sshfs) support for OpenBSD

2013-06-03 Thread Gilles Chehade
On Mon, Jun 03, 2013 at 12:14:04PM -0400, Ted Unangst wrote:
> On Mon, Jun 03, 2013 at 17:14, Sylvestre Gallon wrote:
> > You will find in this mail a patch for fuse support in kernel. I will send 2
> > other mails for the userland and the ports patch. There is still work to do
> > on my fuse implementation but as I understand there is an hackathon occuring
> > at the moment and mpi@ tells me that it could be a good idea to send you
> > something before the end of this event, even if my implementation is not
> > perfect yet.
> 
> Thank you! I have added all the files, with the sole exception that
> the kernel GENERIC config and userland lib Makefile will not be
> enabled immediately.
> 

\o/

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Fuse (and sshfs) support for OpenBSD

2013-06-03 Thread Ted Unangst
On Mon, Jun 03, 2013 at 17:14, Sylvestre Gallon wrote:
> You will find in this mail a patch for fuse support in kernel. I will send 2
> other mails for the userland and the ports patch. There is still work to do
> on my fuse implementation but as I understand there is an hackathon occuring
> at the moment and mpi@ tells me that it could be a good idea to send you
> something before the end of this event, even if my implementation is not
> perfect yet.

Thank you! I have added all the files, with the sole exception that
the kernel GENERIC config and userland lib Makefile will not be
enabled immediately.



Re: Fuse (and sshfs) support for OpenBSD

2013-06-03 Thread Sylvestre Gallon
Here is the last patch. It does not differ from last time.

You only need to install sysutils/sshfs and if you have done all the last
tasks well. it will works like that : 

root # sshfs user@domainname:/path/to/file /mnt/

Cheers,

Index: sysutils/Makefile
===
RCS file: /cvs/ports/sysutils/Makefile,v
retrieving revision 1.290
diff -u -p -u -p -r1.290 Makefile
--- sysutils/Makefile   22 Apr 2013 06:48:58 -  1.290
+++ sysutils/Makefile   29 Apr 2013 13:50:36 -
@@ -188,6 +188,7 @@
  SUBDIR += snapdl
  SUBDIR += socket
  SUBDIR += socklog
+ SUBDIR += sshfs-fuse
  SUBDIR += stan
  SUBDIR += stow
  SUBDIR += stress
Index: sysutils/sshfs-fuse/Makefile
===
RCS file: sysutils/sshfs-fuse/Makefile
diff -N sysutils/sshfs-fuse/Makefile
--- /dev/null   1 Jan 1970 00:00:00 -
+++ sysutils/sshfs-fuse/Makefile29 Apr 2013 13:50:37 -
@@ -0,0 +1,24 @@
+# $OpenBSD: Makefile,v 1.33 2013/01/09 00:02:15 brad Exp $
+
+COMMENT=   Mount remote directories over ssh
+
+VERSION=   2.4
+DISTNAME=  sshfs-fuse-${VERSION}
+CATEGORIES=sysutils
+
+HOMEPAGE=  http://sshfs.sourceforge.net/
+MASTER_SITES=  
http://sourceforge.net/projects/fuse/files/sshfs-fuse/${VERSION}/
+
+MAINTAINER=Gallon Sylvestre 
+
+# LGPL
+PERMIT_PACKAGE_CDROM=  Yes
+PERMIT_PACKAGE_FTP=Yes
+PERMIT_DISTFILES_FTP=  Yes
+
+CONFIGURE_STYLE=gnu
+CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
+WANTLIB=   c pthread glib-2.0
+LIB_DEPENDS+=  devel/glib2
+
+.include 
Index: sysutils/sshfs-fuse/distinfo
===
RCS file: sysutils/sshfs-fuse/distinfo
diff -N sysutils/sshfs-fuse/distinfo
--- /dev/null   1 Jan 1970 00:00:00 -
+++ sysutils/sshfs-fuse/distinfo29 Apr 2013 13:50:37 -
@@ -0,0 +1,2 @@
+SHA256 (sshfs-fuse-2.4.tar.gz) = PJO6hSJWgJPJT/nFo3Y5KTgN0ik2XZBXaf+CR113TdE=
+SIZE (sshfs-fuse-2.4.tar.gz) = 132930
Index: sysutils/sshfs-fuse/patches/patch-sshfs_c
===
RCS file: sysutils/sshfs-fuse/patches/patch-sshfs_c
diff -N sysutils/sshfs-fuse/patches/patch-sshfs_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ sysutils/sshfs-fuse/patches/patch-sshfs_c   29 Apr 2013 13:50:37 -
@@ -0,0 +1,27 @@
+--- sshfs.c.orig   Thu Mar  8 10:34:39 2012
 sshfs.cFri Mar 29 10:37:09 2013
+@@ -11,7 +11,6 @@
+ 
+ #include 
+ #include 
+-#include 
+ #include 
+ #include 
+ #include 
+@@ -32,6 +31,7 @@
+ #include 
+ #include 
+ #include 
++#include 
+ #include 
+ #include 
+ #include 
+@@ -1543,7 +1543,7 @@ static int sftp_error_to_errno(uint32_t error)
+   case SSH_FX_NO_SUCH_FILE:  return ENOENT;
+   case SSH_FX_PERMISSION_DENIED: return EACCES;
+   case SSH_FX_FAILURE:   return EPERM;
+-  case SSH_FX_BAD_MESSAGE:   return EBADMSG;
++  case SSH_FX_BAD_MESSAGE:   return ENOMSG;
+   case SSH_FX_NO_CONNECTION: return ENOTCONN;
+   case SSH_FX_CONNECTION_LOST:   return ECONNABORTED;
+   case SSH_FX_OP_UNSUPPORTED:return EOPNOTSUPP;
Index: sysutils/sshfs-fuse/pkg/DESCR
===
RCS file: sysutils/sshfs-fuse/pkg/DESCR
diff -N sysutils/sshfs-fuse/pkg/DESCR
--- /dev/null   1 Jan 1970 00:00:00 -
+++ sysutils/sshfs-fuse/pkg/DESCR   29 Apr 2013 13:50:37 -
@@ -0,0 +1 @@
+SSHFS allows you to mount a remote directory over a normal ssh connection.
Index: sysutils/sshfs-fuse/pkg/PLIST
===
RCS file: sysutils/sshfs-fuse/pkg/PLIST
diff -N sysutils/sshfs-fuse/pkg/PLIST
--- /dev/null   1 Jan 1970 00:00:00 -
+++ sysutils/sshfs-fuse/pkg/PLIST   29 Apr 2013 13:50:37 -
@@ -0,0 +1,3 @@
+@comment $OpenBSD$
+@bin bin/sshfs
+@man man/man1/sshfs.1



Re: Fuse (and sshfs) support for OpenBSD

2013-04-19 Thread Sylvestre Gallon
On Fri, Apr 19, 2013 at 10:59 PM, Gregor Best  wrote:
> Hi,
>
>> [...]
>> I will spend the next days working on the NetBSD librefuse, I will try
>> to get it working with my kernel code and will come back here when I
>> have something that works.
>> [...]
>
> Are there any news on this? If you need a hand testing stuff and
> tracking down bugs, I'd be very happy to help.
>
> --
> Gregor Best

I am still working on it with the good advices of some devs (mpi@,
gilles@, todd@, armani@).

I Hope to have something re-submitable on tech@ in 1 or 2 weeks.

Cheers,
--
Sylvestre Gallon



Re: Fuse (and sshfs) support for OpenBSD

2013-04-19 Thread Gregor Best
Hi,

> [...]
> I will spend the next days working on the NetBSD librefuse, I will try
> to get it working with my kernel code and will come back here when I
> have something that works.
> [...]

Are there any news on this? If you need a hand testing stuff and
tracking down bugs, I'd be very happy to help.

-- 
Gregor Best


pgps3nCas5Iq2.pgp
Description: PGP signature


Re: Fuse (and sshfs) support for OpenBSD

2013-03-07 Thread Bob Beck
> Using puffs will induce a rewrite of all the kernel code, because the
> internals are completely different (and I think a little bit more
> complex, but this is a personal opinion...).
>
>
I might share that opinon :)



> For a libfuse support in basesystem we will need to do a librefuse
> like library. In this case we could perhaps keep the librefuse
> frontend and only rewrite the backend.

 |

>

Which solution do you think is best ? In any case and if you need me,
> I will be provide all the help I can :)
>

Essentially we just need the best solution to have a base acceptable fuse
library. I don't know
what the right answer to that is, but  perhaps starting with librefuse and
makeing it less refusey (and more towards
compatible with a working ISC licensed fuse implementation in the kernel
would be the way to go.


Re: Fuse (and sshfs) support for OpenBSD

2013-03-07 Thread Sylvestre Gallon
On Thu, Mar 7, 2013 at 3:03 PM, Bob Beck  wrote:
>
> 
>
> Which is why I keep pointing people at puffs and librefuse in netbsd
>
>

Hi,

Using puffs will induce a rewrite of all the kernel code, because the
internals are completely different (and I think a little bit more
complex, but this is a personal opinion...).

For a libfuse support in basesystem we will need to do a librefuse
like library. In this case we could perhaps keep the librefuse
frontend and only rewrite the backend.

Which solution do you think is best ? In any case and if you need me,
I will be provide all the help I can :)

Cheers,

--
Sylvestre Gallon



Re: Fuse (and sshfs) support for OpenBSD

2013-03-07 Thread Bob Beck
On Thu, Mar 7, 2013 at 6:16 AM, Gilles Chehade  wrote:

> On Thu, Mar 07, 2013 at 01:10:48PM +0100, Jonathan Armani wrote:
> > On Tue, Mar 05, 2013 at 03:24:06PM +0100, Sylvestre Gallon wrote:
> >
> > > I am not quite sure but I think that only libfuse and sshfs are GPL
> > > licenced. The patches for those two items are only present in ports.
> > >
> > > All the code present in src is ISC licenced. The kernel communicate
> with
> > > libfuse througth a device (ie /dev/fuse) and only share a header with
> the
> > > libfuse (fuse_kernel.h) which is BSD licenced. FreeBSD used the same
> way to
> > > implement it. (I do not know if it is a good example)
> > >
> >
> > Hi Sylvestre,
> >
> > Nice to see that someone is working on this.
> >
> > I think the problem here is that the kernel will provide a service that
> only
> > ports can use. If we want to use it in the basesystem, we will have to
> > rewrite a BSD licenced libfuse.
> >
>
> Quite frankly, if there's work in that area and hope that it does not go
> to waste, I will happily volunteer to work on that.
>




Which is why I keep pointing people at puffs and librefuse in netbsd



>
> --
> Gilles Chehade
>
> https://www.poolp.org  @poolpOrg
>
>


Re: Fuse (and sshfs) support for OpenBSD

2013-03-07 Thread Gilles Chehade
On Thu, Mar 07, 2013 at 01:10:48PM +0100, Jonathan Armani wrote:
> On Tue, Mar 05, 2013 at 03:24:06PM +0100, Sylvestre Gallon wrote:
> 
> > I am not quite sure but I think that only libfuse and sshfs are GPL
> > licenced. The patches for those two items are only present in ports.
> > 
> > All the code present in src is ISC licenced. The kernel communicate with
> > libfuse througth a device (ie /dev/fuse) and only share a header with the
> > libfuse (fuse_kernel.h) which is BSD licenced. FreeBSD used the same way to
> > implement it. (I do not know if it is a good example)
> > 
> 
> Hi Sylvestre,
> 
> Nice to see that someone is working on this.
> 
> I think the problem here is that the kernel will provide a service that only
> ports can use. If we want to use it in the basesystem, we will have to 
> rewrite a BSD licenced libfuse.
> 

Quite frankly, if there's work in that area and hope that it does not go
to waste, I will happily volunteer to work on that.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Fuse (and sshfs) support for OpenBSD

2013-03-07 Thread Jonathan Armani
On Tue, Mar 05, 2013 at 03:24:06PM +0100, Sylvestre Gallon wrote:

> I am not quite sure but I think that only libfuse and sshfs are GPL
> licenced. The patches for those two items are only present in ports.
> 
> All the code present in src is ISC licenced. The kernel communicate with
> libfuse througth a device (ie /dev/fuse) and only share a header with the
> libfuse (fuse_kernel.h) which is BSD licenced. FreeBSD used the same way to
> implement it. (I do not know if it is a good example)
> 

Hi Sylvestre,

Nice to see that someone is working on this.

I think the problem here is that the kernel will provide a service that only
ports can use. If we want to use it in the basesystem, we will have to 
rewrite a BSD licenced libfuse.

Other possibility is to make it a loadable kernel module, but I don't know 
the current state of our support.
 



Re: Fuse (and sshfs) support for OpenBSD

2013-03-06 Thread Ted Unangst
On Wed, Mar 06, 2013 at 22:27, Sylvestre Gallon wrote:
> Do you know if miscfs is the best place to put my code ?

I think so.

> Do I keep the device code (fuse_device.c) in the same directory than the
> filesystem code?

I'd prefer that.  sys/dev is kind of cluttered as it is, and since the
dev code and fs code are tightly coupled, it makes sense to keep it
all in one place.

> Do you know which fs type I can use in kern/vfs_init.c for fuse ? I've
> taken 42 but I have no idea what I was doing when I choose this number :)

Whatever.  I don't think those numbers are used.

> +/*
> + * The root inode is the root of the file system.  Inode 0 can't be
> used for
> + * normal purposes and bad blocks are normally linked to inode 1, thus
> + * the root inode is 2.
> + */
> +#defineFUSE_ROOTINO ((ino_t)1)

Internal disagreement here. :)



Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Sylvestre Gallon
On Tue, Mar 5, 2013 at 4:29 PM, Sylvestre Gallon  wrote:
>
> Martin,
>
> You will find inline the kernel patch
>

And here the userland :

Index: Makefile
===
RCS file: /cvs/src/sbin/Makefile,v
retrieving revision 1.97
diff -u -p -u -p -r1.97 Makefile
--- Makefile23 Aug 2012 06:37:27 -1.97
+++ Makefile5 Mar 2013 15:21:12 -
@@ -5,7 +5,7 @@ SUBDIR=atactl badsect bioctl clri dhcli
 fsck_msdos fsdb fsirand growfs ifconfig iked init iopctl ipsecctl  \
 isakmpd kbd ldattach lmccontrol mknod modload modunload mount \
 mount_cd9660 mount_ext2fs mount_ffs mount_msdos \
-mount_nfs mount_ntfs mount_procfs mount_udf \
+mount_nfs mount_ntfs mount_procfs mount_fusefs mount_udf \
 mount_vnd mountd ncheck_ffs newfs newfs_ext2fs newfs_msdos \
 nfsd nologin pdisk pfctl pflogd ping ping6 quotacheck \
 reboot restore route rtsol savecore scan_ffs \
Index: mount_fusefs/Makefile
===
RCS file: mount_fusefs/Makefile
diff -N mount_fusefs/Makefile
--- /dev/null1 Jan 1970 00:00:00 -
+++ mount_fusefs/Makefile5 Mar 2013 15:21:18 -
@@ -0,0 +1,10 @@
+#$OpenBSD: src/sbin/mount_procfs/Makefile,v 1.7 2004/06/22
21:12:00 otto Exp $
+
+PROG=mount_fusefs
+SRCS=mount_fusefs.c getmntopts.c
+
+MOUNT=${.CURDIR}/../mount
+CFLAGS+= -I${MOUNT}
+.PATH:${MOUNT}
+
+.include 
Index: mount_fusefs/mount_fusefs.c
===
RCS file: mount_fusefs/mount_fusefs.c
diff -N mount_fusefs/mount_fusefs.c
--- /dev/null1 Jan 1970 00:00:00 -
+++ mount_fusefs/mount_fusefs.c5 Mar 2013 15:21:18 -
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012 Sylvestre Gallon 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mntopts.h"
+
+const struct mntopt mopts[] = {
+MOPT_STDOPTS,
+{ "subtype",0, MFLAG_SET | MFLAG_STRVAL | MFLAG_OPT },
+{ "fsname",0, MFLAG_SET | MFLAG_STRVAL | MFLAG_OPT },
+{ NULL }
+};
+
+voidusage(void);
+
+int
+main(int argc, char *argv[])
+{
+int ch, mntflags, altflags;
+struct fusefs_args args;
+char path[MAXPATHLEN];
+
+mntflags = altflags = 0;
+while ((ch = getopt(argc, argv, "o:")) != -1)
+switch (ch) {
+case 'o':
+altflags |= getmntopts(optarg, mopts, &mntflags);
+break;
+case '?':
+default:
+usage();
+}
+argc -= optind;
+argv += optind;
+
+if (argc != 2)
+usage();
+
+args.flags = altflags;
+args.fd = atoi(argv[0]);
+
+if (realpath(argv[1], path) == NULL)
+err(1, "realpath %s", argv[1]);
+
+if (mount(MOUNT_FUSEFS, path, mntflags, &args)) {
+if (errno == EOPNOTSUPP)
+errx(1, "%s: Filesystem not supported by kernel",
+argv[1]);
+else
+err(1, "%s", argv[1]);
+}
+exit(0);
+}
+
+void
+usage(void)
+{
+(void)fprintf(stderr,
+"usage: mount_procfs [-o options] fd mount_point\n");
+exit(1);
+}



Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Sylvestre Gallon
On Tue, Mar 5, 2013 at 2:44 PM, Bob Beck  wrote:

> Sylvestre, one of the problems with fuse itself is that it's GPL
> licensed, and not appropriate
> for inclusion in base. If you've got interets and talent in this area,
> you might want to consider
> having a peek at puffs (and refuse) from netbsd which has a workable
> license and could
> be included in base.   I would definitely help if you're interested...
>
> -Bob
>
>
Bob,

I am not quite sure but I think that only libfuse and sshfs are GPL
licenced. The patches for those two items are only present in ports.

All the code present in src is ISC licenced. The kernel communicate with
libfuse througth a device (ie /dev/fuse) and only share a header with the
libfuse (fuse_kernel.h) which is BSD licenced. FreeBSD used the same way to
implement it. (I do not know if it is a good example)

Anyway, It could be fun to have a peek at puffs/refuse and have your help :)

Cheers,

-- 
Sylvestre Gallon


Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Martin Pieuchot
On 05/03/13(Tue) 06:44, Bob Beck wrote:
> Sylvestre, one of the problems with fuse itself is that it's GPL
> licensed, and not appropriate for inclusion in base. If you've got
> interets and talent in this area,  you might want to consider
> having a peek at puffs (and refuse) from netbsd which has a workable
> license and could be included in base. 
> I would definitely help if you're interested...

It looks to me that Sylvestre wrote it's own ISC-licensed implementation.

Sylvestre that's a lot of work, and a lot of new code :) I'd suggest you
to send your diff inline (maybe splitting the userland and kernel parts) 
so that people can comment on them.

M.



Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Jiri B
On Tue, Mar 05, 2013 at 02:11:41PM +0100, Gilles Chehade wrote:
> On Tue, Mar 05, 2013 at 01:49:20PM +0100, Antoine Jacoutot wrote:
> > On Tue, Mar 05, 2013 at 01:43:24PM +0100, Sylvestre Gallon wrote:
> > > Hi tech@
> > > 
> > > I send you this mail because a few months ago I tried to dabble with fuse
> > > filesystem and OpenBSD. After some time working on this subject I have
> > > succeeded to create something that works. It is not even near to be 
> > > perfect
> > > but with some changes and adaptions I think it could do the job.
> > 
> > Before anyone flame you for whatever reason, let me say that I am *very* 
> > happy that some work in done in this area.
> > I'll try and play with this and see what comes out of it; may take a little 
> > bit of time though.
> > 
> 
> Yup, same here

Yes, it would be nice to have libguestfs which uses FUSE
working on OpenBSD so one could modify qemu/kvm OpenBSD images
directly ;)

jirib



Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Bob Beck
Sylvestre, one of the problems with fuse itself is that it's GPL
licensed, and not appropriate
for inclusion in base. If you've got interets and talent in this area,
you might want to consider
having a peek at puffs (and refuse) from netbsd which has a workable
license and could
be included in base.   I would definitely help if you're interested...

-Bob


On Tue, Mar 5, 2013 at 5:43 AM, Sylvestre Gallon  wrote:
> Hi tech@
>
> I send you this mail because a few months ago I tried to dabble with fuse
> filesystem and OpenBSD. After some time working on this subject I have
> succeeded to create something that works. It is not even near to be perfect
> but with some changes and adaptions I think it could do the job.
>
> In order to use these patches you will need to follow this procedure:
>
> * apply the ports patch :
> root # cd /usr/ports
> root # ftp http://www.pmbsd.org/patch-fuse-ports
> root # patch -p0 < patch-fuse-ports
>
> * apply the src patch
> root # cd /usr/src
> root # ftp http://www.pmbsd.org/patch-fuse-src
> root # patch -p0 < patch-fuse-src
>
> * upgrade your system mount.h
> root # cp /usr/src/sys/sys/mount.h /usr/include/sys/mount.h
>
> * compile all mount and umount binaries
> root # cd /usr/src/sbin/mount && make && make install
> root # cd /usr/src/sbin/mount_ffs && make && make install
> root # cd /usr/src/sbin/mount_fusefs && make && make install (there are
> warning for a missing manpage)
>   ...
> root # cd /usr/src/sbin/umount && make && make install
>
> * build a new kernel
> root # cd /usr/src/sys/arch/i386/conf
> root # config GENERIC
> root # cd ../compile/GENERIC
> root # make && make install
>
> * update MAKEDEV script and launch it to create the fuse device
> root # cd /dev
> root # ftp http://www.pmbsd.org/patch-fuse-MAKEDEV
> root # patch MAKEDEV < patch-fuse-MAKEDEV
> root # ./MAKEDEV
> root # ./MAKEDEV fuse
>
> * install devel/fuse and sysutils/sshfs-fuse packages
>root # cd /usr/ports/devel/fuse && make && make install
>root # cd /usr/ports/sysutils/sshfs-fuse && make && make install
>
> * reboot and try sshfs
>root # reboot
>root # sshfs s...@pmbsd.org:/home/syl/code /mnt
>root # ls /mnt
>
>
> As I said before, this is not perfect... There are some outstanding
> features to implement and bugs or architectural mistakes to solve...
>
> There is some work to do to implement these missing vnops and vfs features :
>
>   * vptof
>   * fhtovp
>   * checkexp
>   * sysctl
>   * strategy
>   * fsync
>   * symlink
>   * rename vnop
>   * you could only mount one filesystem at once.
>
> I think some security improvement could be done on these patches like :
> - fix some panics and tsleep hole that could produce DoS...
> - allow the use of fuse with a securelevel equal to -1...
> - other security stuff that I'm surely missing :)
>
> I will not explain all the fuse protocol in this mail but if you want
> information on how it works I will answer your questions in a private mail.
>
> If you have any questions about these patches or want me to change or
> rework something in this code I will be happy to do it.
>
> Thanks for your time,
>
> Cheers,
>
> --
> Sylvestre Gallon



Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Gilles Chehade
On Tue, Mar 05, 2013 at 01:49:20PM +0100, Antoine Jacoutot wrote:
> On Tue, Mar 05, 2013 at 01:43:24PM +0100, Sylvestre Gallon wrote:
> > Hi tech@
> > 
> > I send you this mail because a few months ago I tried to dabble with fuse
> > filesystem and OpenBSD. After some time working on this subject I have
> > succeeded to create something that works. It is not even near to be perfect
> > but with some changes and adaptions I think it could do the job.
> 
> Before anyone flame you for whatever reason, let me say that I am *very* 
> happy that some work in done in this area.
> I'll try and play with this and see what comes out of it; may take a little 
> bit of time though.
> 

Yup, same here

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Fuse (and sshfs) support for OpenBSD

2013-03-05 Thread Antoine Jacoutot
On Tue, Mar 05, 2013 at 01:43:24PM +0100, Sylvestre Gallon wrote:
> Hi tech@
> 
> I send you this mail because a few months ago I tried to dabble with fuse
> filesystem and OpenBSD. After some time working on this subject I have
> succeeded to create something that works. It is not even near to be perfect
> but with some changes and adaptions I think it could do the job.

Before anyone flame you for whatever reason, let me say that I am *very* happy 
that some work in done in this area.
I'll try and play with this and see what comes out of it; may take a little bit 
of time though.


> In order to use these patches you will need to follow this procedure:
> 
> * apply the ports patch :
> root # cd /usr/ports
> root # ftp http://www.pmbsd.org/patch-fuse-ports
> root # patch -p0 < patch-fuse-ports
> 
> * apply the src patch
> root # cd /usr/src
> root # ftp http://www.pmbsd.org/patch-fuse-src
> root # patch -p0 < patch-fuse-src
> 
> * upgrade your system mount.h
> root # cp /usr/src/sys/sys/mount.h /usr/include/sys/mount.h
> 
> * compile all mount and umount binaries
> root # cd /usr/src/sbin/mount && make && make install
> root # cd /usr/src/sbin/mount_ffs && make && make install
> root # cd /usr/src/sbin/mount_fusefs && make && make install (there are
> warning for a missing manpage)
>   ...
> root # cd /usr/src/sbin/umount && make && make install
> 
> * build a new kernel
> root # cd /usr/src/sys/arch/i386/conf
> root # config GENERIC
> root # cd ../compile/GENERIC
> root # make && make install
> 
> * update MAKEDEV script and launch it to create the fuse device
> root # cd /dev
> root # ftp http://www.pmbsd.org/patch-fuse-MAKEDEV
> root # patch MAKEDEV < patch-fuse-MAKEDEV
> root # ./MAKEDEV
> root # ./MAKEDEV fuse
> 
> * install devel/fuse and sysutils/sshfs-fuse packages
>root # cd /usr/ports/devel/fuse && make && make install
>root # cd /usr/ports/sysutils/sshfs-fuse && make && make install
> 
> * reboot and try sshfs
>root # reboot
>root # sshfs s...@pmbsd.org:/home/syl/code /mnt
>root # ls /mnt
> 
> 
> As I said before, this is not perfect... There are some outstanding
> features to implement and bugs or architectural mistakes to solve...
> 
> There is some work to do to implement these missing vnops and vfs features :
> 
>   * vptof
>   * fhtovp
>   * checkexp
>   * sysctl
>   * strategy
>   * fsync
>   * symlink
>   * rename vnop
>   * you could only mount one filesystem at once.
> 
> I think some security improvement could be done on these patches like :
> - fix some panics and tsleep hole that could produce DoS...
> - allow the use of fuse with a securelevel equal to -1...
> - other security stuff that I'm surely missing :)
> 
> I will not explain all the fuse protocol in this mail but if you want
> information on how it works I will answer your questions in a private mail.
> 
> If you have any questions about these patches or want me to change or
> rework something in this code I will be happy to do it.
> 
> Thanks for your time,
> 
> Cheers,
> 
> -- 
> Sylvestre Gallon

-- 
Antoine