Re: svn commit: r367038 - head/sbin/mount_nullfs

2020-10-25 Thread Cy Schubert
In message <20201025213509.GA1671@brick>, Edward Tomasz Napierala writes:
> On 1025T0717, Cy Schubert wrote:
> > In message  c
> > om>
> > , Oliver Pinter writes:
> > > On Sunday, October 25, 2020, Edward Tomasz Napierala 
> > > wrote:
> > >
> > > > Author: trasz
> > > > Date: Sun Oct 25 14:09:00 2020
> > > > New Revision: 367038
> > > > URL: https://svnweb.freebsd.org/changeset/base/367038
> > > >
> > > > Log:
> > > >   Remove the check that prevents creating "loops" from mount_nullfs(8).
> > > >
> > > >
> > > The simple question is: why?
> > 
> > I was about to ask that myself.
> > 
> > The why is usually more important than the how.
>
> Two reasons.
>
> First, from what I can tell this is an artificial limitation which serves
> no purpose.  I thought it was to prevent some kind of deadlock between
> vnodes, so I asked kib@, and he mentioned removing that very limitation
> from the kernel code; thus, it looks to me like a historical leftover.
>
> Second, I've stumbled upon this when trying to nullfs-mount '/' on
> '/compat/ubuntu/bsd/', which would be useful for autochroot functionality,
> when (or if) it becomes a thing.

Thanks.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

The need of the many outweighs the greed of the few.


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367038 - head/sbin/mount_nullfs

2020-10-25 Thread Oliver Pinter
On Sunday, October 25, 2020, Edward Tomasz Napierala 
wrote:

> On 1025T0717, Cy Schubert wrote:
> > In message  gmail.c
> > om>
> > , Oliver Pinter writes:
> > > On Sunday, October 25, 2020, Edward Tomasz Napierala <
> tr...@freebsd.org>
> > > wrote:
> > >
> > > > Author: trasz
> > > > Date: Sun Oct 25 14:09:00 2020
> > > > New Revision: 367038
> > > > URL: https://svnweb.freebsd.org/changeset/base/367038
> > > >
> > > > Log:
> > > >   Remove the check that prevents creating "loops" from
> mount_nullfs(8).
> > > >
> > > >
> > > The simple question is: why?
> >
> > I was about to ask that myself.
> >
> > The why is usually more important than the how.
>
> Two reasons.
>
> First, from what I can tell this is an artificial limitation which serves
> no purpose.  I thought it was to prevent some kind of deadlock between
> vnodes, so I asked kib@, and he mentioned removing that very limitation
> from the kernel code; thus, it looks to me like a historical leftover.
>
> Second, I've stumbled upon this when trying to nullfs-mount '/' on
> '/compat/ubuntu/bsd/', which would be useful for autochroot functionality,
> when (or if) it becomes a thing.


Thank you!
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367038 - head/sbin/mount_nullfs

2020-10-25 Thread Edward Tomasz Napierala
On 1025T0717, Cy Schubert wrote:
> In message  om>
> , Oliver Pinter writes:
> > On Sunday, October 25, 2020, Edward Tomasz Napierala 
> > wrote:
> >
> > > Author: trasz
> > > Date: Sun Oct 25 14:09:00 2020
> > > New Revision: 367038
> > > URL: https://svnweb.freebsd.org/changeset/base/367038
> > >
> > > Log:
> > >   Remove the check that prevents creating "loops" from mount_nullfs(8).
> > >
> > >
> > The simple question is: why?
> 
> I was about to ask that myself.
> 
> The why is usually more important than the how.

Two reasons.

First, from what I can tell this is an artificial limitation which serves
no purpose.  I thought it was to prevent some kind of deadlock between
vnodes, so I asked kib@, and he mentioned removing that very limitation
from the kernel code; thus, it looks to me like a historical leftover.

Second, I've stumbled upon this when trying to nullfs-mount '/' on
'/compat/ubuntu/bsd/', which would be useful for autochroot functionality,
when (or if) it becomes a thing.

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367038 - head/sbin/mount_nullfs

2020-10-25 Thread Cy Schubert
In message 
, Oliver Pinter writes:
> On Sunday, October 25, 2020, Edward Tomasz Napierala 
> wrote:
>
> > Author: trasz
> > Date: Sun Oct 25 14:09:00 2020
> > New Revision: 367038
> > URL: https://svnweb.freebsd.org/changeset/base/367038
> >
> > Log:
> >   Remove the check that prevents creating "loops" from mount_nullfs(8).
> >
> >
> The simple question is: why?

I was about to ask that myself.

The why is usually more important than the how.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

The need of the many outweighs the greed of the few.



___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367038 - head/sbin/mount_nullfs

2020-10-25 Thread Oliver Pinter
On Sunday, October 25, 2020, Edward Tomasz Napierala 
wrote:

> Author: trasz
> Date: Sun Oct 25 14:09:00 2020
> New Revision: 367038
> URL: https://svnweb.freebsd.org/changeset/base/367038
>
> Log:
>   Remove the check that prevents creating "loops" from mount_nullfs(8).
>
>
The simple question is: why?



>   Reviewed by:  kib
>   MFC after:2 weeks
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D26921
>
> Modified:
>   head/sbin/mount_nullfs/mount_nullfs.c
>
> Modified: head/sbin/mount_nullfs/mount_nullfs.c
> 
> ==
> --- head/sbin/mount_nullfs/mount_nullfs.c   Sun Oct 25 10:08:46 2020
>   (r367037)
> +++ head/sbin/mount_nullfs/mount_nullfs.c   Sun Oct 25 14:09:00 2020
>   (r367038)
> @@ -59,7 +59,6 @@ static const char rcsid[] =
>
>  #include "mntopts.h"
>
> -intsubdir(const char *, const char *);
>  static voidusage(void) __dead2;
>
>  int
> @@ -104,10 +103,6 @@ main(int argc, char *argv[])
> if (checkpath(argv[1], source) != 0)
> err(EX_USAGE, "%s", source);
>
> -   if (subdir(target, source) || subdir(source, target))
> -   errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
> -   argv[0], target, argv[1]);
> -
> build_iovec(, , "fstype", nullfs, (size_t)-1);
> build_iovec(, , "fspath", source, (size_t)-1);
> build_iovec(, , "target", target, (size_t)-1);
> @@ -119,21 +114,6 @@ main(int argc, char *argv[])
> err(1, "%s", source);
> }
> exit(0);
> -}
> -
> -int
> -subdir(const char *p, const char *dir)
> -{
> -   int l;
> -
> -   l = strlen(dir);
> -   if (l <= 1)
> -   return (1);
> -
> -   if ((strncmp(p, dir, l) == 0) && (p[l] == '/' || p[l] == '\0'))
> -   return (1);
> -
> -   return (0);
>  }
>
>  static void
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367038 - head/sbin/mount_nullfs

2020-10-25 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Oct 25 14:09:00 2020
New Revision: 367038
URL: https://svnweb.freebsd.org/changeset/base/367038

Log:
  Remove the check that prevents creating "loops" from mount_nullfs(8).
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26921

Modified:
  head/sbin/mount_nullfs/mount_nullfs.c

Modified: head/sbin/mount_nullfs/mount_nullfs.c
==
--- head/sbin/mount_nullfs/mount_nullfs.c   Sun Oct 25 10:08:46 2020
(r367037)
+++ head/sbin/mount_nullfs/mount_nullfs.c   Sun Oct 25 14:09:00 2020
(r367038)
@@ -59,7 +59,6 @@ static const char rcsid[] =
 
 #include "mntopts.h"
 
-intsubdir(const char *, const char *);
 static voidusage(void) __dead2;
 
 int
@@ -104,10 +103,6 @@ main(int argc, char *argv[])
if (checkpath(argv[1], source) != 0)
err(EX_USAGE, "%s", source);
 
-   if (subdir(target, source) || subdir(source, target))
-   errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
-   argv[0], target, argv[1]);
-
build_iovec(, , "fstype", nullfs, (size_t)-1);
build_iovec(, , "fspath", source, (size_t)-1);
build_iovec(, , "target", target, (size_t)-1);
@@ -119,21 +114,6 @@ main(int argc, char *argv[])
err(1, "%s", source);
}
exit(0);
-}
-
-int
-subdir(const char *p, const char *dir)
-{
-   int l;
-
-   l = strlen(dir);
-   if (l <= 1)
-   return (1);
-
-   if ((strncmp(p, dir, l) == 0) && (p[l] == '/' || p[l] == '\0'))
-   return (1);
-
-   return (0);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"