CVS commit: src/sys/fs/ptyfs
Module Name:src Committed By: riastradh Date: Fri Aug 5 10:36:02 UTC 2022 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c Log Message: ptyfs: Don't copy out cookies past end of buffer. Reported-by: syzbot+2aae7c4eddc796f91...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=5fe24c1da952ac2ea498d745d6479bc6be91a751 To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/fs/ptyfs/ptyfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/ptyfs/ptyfs_vnops.c diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.68 src/sys/fs/ptyfs/ptyfs_vnops.c:1.69 --- src/sys/fs/ptyfs/ptyfs_vnops.c:1.68 Wed Dec 8 20:11:54 2021 +++ src/sys/fs/ptyfs/ptyfs_vnops.c Fri Aug 5 10:36:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_vnops.c,v 1.68 2021/12/08 20:11:54 andvar Exp $ */ +/* $NetBSD: ptyfs_vnops.c,v 1.69 2022/08/05 10:36:02 riastradh Exp $ */ /* * Copyright (c) 1993, 1995 @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.68 2021/12/08 20:11:54 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.69 2022/08/05 10:36:02 riastradh Exp $"); #include #include @@ -691,7 +691,7 @@ ptyfs_readdir(void *v) *ap->a_cookies = cookies; } - for (; i < 2; i++) { + for (; i < 2 && uio->uio_resid >= UIO_MX; i++) { /* `.' and/or `..' */ dp->d_fileno = PTYFS_FILENO(PTYFSroot, 0); dp->d_namlen = i + 1;
CVS commit: src/sys/fs/ptyfs
Module Name:src Committed By: riastradh Date: Fri Aug 5 10:36:02 UTC 2022 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c Log Message: ptyfs: Don't copy out cookies past end of buffer. Reported-by: syzbot+2aae7c4eddc796f91...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=5fe24c1da952ac2ea498d745d6479bc6be91a751 To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/fs/ptyfs/ptyfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/ptyfs
Module Name:src Committed By: christos Date: Thu Sep 26 18:35:48 UTC 2019 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c Log Message: cast VNOVAL to the the va_size type which is u_quad_t... I think it is time to change this to uint64_t... To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/fs/ptyfs/ptyfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/fs/ptyfs
Module Name:src Committed By: christos Date: Thu Sep 26 18:35:48 UTC 2019 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c Log Message: cast VNOVAL to the the va_size type which is u_quad_t... I think it is time to change this to uint64_t... To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/fs/ptyfs/ptyfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/ptyfs/ptyfs_vnops.c diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.55 src/sys/fs/ptyfs/ptyfs_vnops.c:1.56 --- src/sys/fs/ptyfs/ptyfs_vnops.c:1.55 Mon Sep 3 12:29:35 2018 +++ src/sys/fs/ptyfs/ptyfs_vnops.c Thu Sep 26 14:35:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_vnops.c,v 1.55 2018/09/03 16:29:35 riastradh Exp $ */ +/* $NetBSD: ptyfs_vnops.c,v 1.56 2019/09/26 18:35:48 christos Exp $ */ /* * Copyright (c) 1993, 1995 @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.55 2018/09/03 16:29:35 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.56 2019/09/26 18:35:48 christos Exp $"); #include #include @@ -405,7 +405,7 @@ ptyfs_setattr(void *v) kauth_action_t action = KAUTH_VNODE_WRITE_FLAGS; bool changing_sysflags = false; - if (vap->va_size != VNOVAL) { + if (vap->va_size != (u_quad_t)VNOVAL) { switch (ptyfs->ptyfs_type) { case PTYFSroot: return EISDIR; @@ -417,7 +417,7 @@ ptyfs_setattr(void *v) } } - if (vap->va_flags != VNOVAL) { + if (vap->va_flags != (u_quad_t)VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return EROFS;
Re: CVS commit: src/sys/fs/ptyfs
On Wed, 13 Aug 2014, Juergen Hannken-Illjes wrote: Modified Files: src/sys/fs/ptyfs: ptyfs.h ptyfs_subr.c ptyfs_vfsops.c ptyfs_vnops.c Log Message: - Add a map of active controlling ptys per mount and no longer abuse the vnode lifecycle. - No longer set "recycle" on VOP_INACTIVE(). - Make ptyfs_used_get() private to ptyfs_subr.c - Stop copying device attributes from traditional ptys on first allocation. - Remove unneeded argument "lwp" from ptyfs_allocvp() and ptyfs_free_get(). Please could you update the mount_ptyfs(8) man page to explain the new behaviour. --apb (Alan Barrett)
Re: CVS commit: src/sys/fs/ptyfs
In article <20121024204834.ga11...@netbsd.org>, David Holland wrote: >On Tue, Oct 23, 2012 at 07:31:01PM -0400, Christos Zoulas wrote: > > Module Name:src > > Committed By: christos > > Date: Tue Oct 23 23:31:01 UTC 2012 > > > > Modified Files: > > src/sys/fs/ptyfs: ptyfs_subr.c > > > > Log Message: > > fix the mystery of the bad directory times. > > > > [...] > > - ptyfs->ptyfs_flags |= PTYFS_CHANGE; > > + ptyfs->ptyfs_flag |= PTYFS_CHANGE; > >so, how'd we end up with both those members in the same structure, and >can someone rename one or preferably both of them to something with >semantic significance? That would be me. I will change one of the names on head. christos
Re: CVS commit: src/sys/fs/ptyfs
On Tue, Oct 23, 2012 at 07:31:01PM -0400, Christos Zoulas wrote: > Module Name: src > Committed By:christos > Date:Tue Oct 23 23:31:01 UTC 2012 > > Modified Files: > src/sys/fs/ptyfs: ptyfs_subr.c > > Log Message: > fix the mystery of the bad directory times. > > [...] > - ptyfs->ptyfs_flags |= PTYFS_CHANGE; > + ptyfs->ptyfs_flag |= PTYFS_CHANGE; so, how'd we end up with both those members in the same structure, and can someone rename one or preferably both of them to something with semantic significance? -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/sys/fs/ptyfs
On Tue, Mar 24, 2009 at 05:14:53AM +, YAMAMOTO Takashi wrote: > however, if the change mean to make ptyfs know the particular setup of > null mount over it, it sounds like an unacceptable hack to me. It is the least intrusive way to get the result without hacking the whole pts subsystem to allow multiple ptyfs instances. One problem with that is you need to either find a way to keep the vnodes synchronised or need to find a way to split the namespace. Joerg
Re: CVS commit: src/sys/fs/ptyfs
> On Mon, Mar 23, 2009 at 03:00:35AM +, YAMAMOTO Takashi wrote: >> > Case 1: You have /dev/pts mounted outside the chroot and want to use >> > e.g. sshd inside the chroot. >> >> in this case, there is no "correct" pathname anyway, right? >> i think it's more appropriate to return an error so that an application >> can fall back to eg. dev.db. > > If the PTSNAME ioctl fails, you don't gain anything. The problem here is > that the old code returned /%d for the chroot in all cases -- making it > impossible to use ptyfs if you also wanted to use e.g. sshd in a chroot. > Without that logic you can null mount /dev/pts and it magically works. > > Joerg hmm, null mount. it's what is not obvious to me from the change. thanks. however, if the change mean to make ptyfs know the particular setup of null mount over it, it sounds like an unacceptable hack to me. YAMAMOTO Takashi
Re: CVS commit: src/sys/fs/ptyfs
On Mon, Mar 23, 2009 at 03:00:35AM +, YAMAMOTO Takashi wrote: > > Case 1: You have /dev/pts mounted outside the chroot and want to use > > e.g. sshd inside the chroot. > > in this case, there is no "correct" pathname anyway, right? > i think it's more appropriate to return an error so that an application > can fall back to eg. dev.db. If the PTSNAME ioctl fails, you don't gain anything. The problem here is that the old code returned /%d for the chroot in all cases -- making it impossible to use ptyfs if you also wanted to use e.g. sshd in a chroot. Without that logic you can null mount /dev/pts and it magically works. Joerg
Re: CVS commit: src/sys/fs/ptyfs
hi, > On Mon, Mar 23, 2009 at 01:34:16AM +, YAMAMOTO Takashi wrote: >> probably i'm missing something obvious. >> i don't understand why you need to have two different behaviours. >> the chroot one can't work for the non-chroot case? > > Case 1: You have /dev/pts mounted outside the chroot and want to use > e.g. sshd inside the chroot. in this case, there is no "correct" pathname anyway, right? i think it's more appropriate to return an error so that an application can fall back to eg. dev.db. YAMAMOTO Takashi > > Case 2: You want to mount /dev/pts inside the chroot and want to use > e.g. sshd inside the chroot. > > Joerg
Re: CVS commit: src/sys/fs/ptyfs
On Mar 23, 2:57am, jo...@britannica.bec.de (Joerg Sonnenberger) wrote: -- Subject: Re: CVS commit: src/sys/fs/ptyfs | On Mon, Mar 23, 2009 at 01:34:16AM +, YAMAMOTO Takashi wrote: | > probably i'm missing something obvious. | > i don't understand why you need to have two different behaviours. | > the chroot one can't work for the non-chroot case? | | Case 1: You have /dev/pts mounted outside the chroot and want to use | e.g. sshd inside the chroot. | | Case 2: You want to mount /dev/pts inside the chroot and want to use | e.g. sshd inside the chroot. The problem is that we cannot mount ptyfs multiple times. There are two ways: - share major number and keep track which pty is under which mount. that will make both mounts not have sequential pty numbers. - have a separate major number for each mount. christos
Re: CVS commit: src/sys/fs/ptyfs
On Mar 23, 1:34am, y...@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote: -- Subject: Re: CVS commit: src/sys/fs/ptyfs | > How else you could select either behavior? | | probably i'm missing something obvious. | i don't understand why you need to have two different behaviours. | the chroot one can't work for the non-chroot case? It does not work in the loopback mount case IIRC. Joerg can explain it better. christos
Re: CVS commit: src/sys/fs/ptyfs
On Mon, Mar 23, 2009 at 01:34:16AM +, YAMAMOTO Takashi wrote: > probably i'm missing something obvious. > i don't understand why you need to have two different behaviours. > the chroot one can't work for the non-chroot case? Case 1: You have /dev/pts mounted outside the chroot and want to use e.g. sshd inside the chroot. Case 2: You want to mount /dev/pts inside the chroot and want to use e.g. sshd inside the chroot. Joerg
Re: CVS commit: src/sys/fs/ptyfs
> On Mar 23, 12:52am, y...@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote: > -- Subject: Re: CVS commit: src/sys/fs/ptyfs > > | hi, > | > | > Module Name: src > | > Committed By: christos > | > Date: Sun Mar 15 16:43:55 UTC 2009 > | > > | > Modified Files: > | > src/sys/fs/ptyfs: ptyfs.h ptyfs_vfsops.c > | > > | > Log Message: > | > Add a chroot flag, so that ptyfs can be mounted in a chrooted environment. > | > XXX: This is a hack, in reality we should allow multiple ptyfs mounts. > | > | why does this need to be a mount flag? > | > | YAMAMOTO Takashi > > How else you could select either behavior? probably i'm missing something obvious. i don't understand why you need to have two different behaviours. the chroot one can't work for the non-chroot case? YAMAMOTO Takashi > > christos
Re: CVS commit: src/sys/fs/ptyfs
On Mar 23, 12:52am, y...@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote: -- Subject: Re: CVS commit: src/sys/fs/ptyfs | hi, | | > Module Name:src | > Committed By: christos | > Date: Sun Mar 15 16:43:55 UTC 2009 | > | > Modified Files: | > src/sys/fs/ptyfs: ptyfs.h ptyfs_vfsops.c | > | > Log Message: | > Add a chroot flag, so that ptyfs can be mounted in a chrooted environment. | > XXX: This is a hack, in reality we should allow multiple ptyfs mounts. | | why does this need to be a mount flag? | | YAMAMOTO Takashi How else you could select either behavior? christos
Re: CVS commit: src/sys/fs/ptyfs
hi, > Module Name: src > Committed By: christos > Date: Sun Mar 15 16:43:55 UTC 2009 > > Modified Files: > src/sys/fs/ptyfs: ptyfs.h ptyfs_vfsops.c > > Log Message: > Add a chroot flag, so that ptyfs can be mounted in a chrooted environment. > XXX: This is a hack, in reality we should allow multiple ptyfs mounts. why does this need to be a mount flag? YAMAMOTO Takashi > > > To generate a diff of this commit: > cvs rdiff -u -r1.7 -r1.8 src/sys/fs/ptyfs/ptyfs.h > cvs rdiff -u -r1.38 -r1.39 src/sys/fs/ptyfs/ptyfs_vfsops.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files.