Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-23 Thread Ruslan Bukin
Hi

It is booting fine with patch.

Thanks!

Ruslan

On Fri, Sep 23, 2016 at 12:34:40AM +0200, Mariusz Zaborski wrote:
> Thanks, I was able to reproduce that :)
> I attached the patch. Could you please confirm that it fix the problem?
> 
> Thank you and sorry for inconveniences,
> Mariusz
> 
> On 22 September 2016 at 18:11, Ruslan Bukin  wrote:
> > I have just tested this with MIPS64EL and the result is the same.
> > So you can try both EL or EB
> >
> > e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
> >> Hi
> >>
> >> It reports nothing. Yes I use qemu:
> >> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M 
> >> malta -kernel 
> >> ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
> >> /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net 
> >> nic -net user -m 2048M -redir tcp:4022::22
> >>
> >> Ruslan
> >>
> >> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> >> > I tested it on the mips for Malta kernel and it's works fine. I will
> >> > try to do it on mips64, are you using qemu to test it?
> >> > What is ctrl + t reporting you?
> >> >
> >> >
> >> > On 22 September 2016 at 16:56, Ruslan Bukin  
> >> > wrote:
> >> > > May be. The next line should be
> >> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> >> > >
> >> > > but it hangs before this line
> >> > >
> >> > > Ruslan
> >> > >
> >> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> >> > >> Hi Ruslan,
> >> > >>
> >> > >> Does it hang on some network script?
> >> > >>
> >> > >> Thanks,
> >> > >> Mariusz
> >> > >>
> >> > >>
> >> > >> On 22 September 2016 at 16:34, Ruslan Bukin 
> >> > >>  wrote:
> >> > >> > Hi Mariusz
> >> > >> >
> >> > >> > my MIPS64EB kernel stops booting with this
> >> > >> >
> >> > >> > somewhere here:
> >> > >> > [...]
> >> > >> > Starting file system checks:
> >> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 
> >> > >> > 946580 blocks, 0.0% fragmentation)
> >> > >> > Mounting local filesystems:.
> >> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> >> > >> > random: unblocking device.
> >> > >> >
> >> > >> > any idea ? (should I rebuild something?)
> >> > >> >
> >> > >> > thanks!
> >> > >> >
> >> > >> > Ruslan
> >> > >> >
> >> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> > >> >> Author: oshogbo
> >> > >> >> Date: Thu Sep 22 09:58:46 2016
> >> > >> >> New Revision: 306174
> >> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >> > >> >>
> >> > >> >> Log:
> >> > >> >>   capsicum: propagate rights on accept(2)
> >> > >> >>
> >> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
> >> > >> >> rights from
> >> > >> >>   the listening socket.
> >> > >> >>
> >> > >> >>   PR: 201052
> >> > >> >>   Reviewed by:emaste, jonathan
> >> > >> >>   Discussed with: many
> >> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >> > >> >>
> >> > >> >> Modified:
> >> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >> > >> >>   head/sys/compat/linux/linux_socket.c
> >> > >> >>   head/sys/kern/kern_sendfile.c
> >> > >> >>   head/sys/kern/uipc_syscalls.c
> >> > >> >>   head/sys/netinet/sctp_syscalls.c
> >> > >> >>   head/sys/sys/socketvar.h
> >> > >> >>
> >> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> > >> >> ==
> >> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
> >> > >> >> 2016(r306173)
> >> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
> >> > >> >> 2016(r306174)
> >> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >> > >> >>   int error;
> >> > >> >>
> >> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> >> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> >> > >> >> NULL);
> >> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> >> > >> >> NULL, NULL);
> >> > >> >>   if (error != 0)
> >> > >> >>   return (error);
> >> > >> >>   so = fp->f_data;
> >> > >> >>
> >> > >> >> Modified: head/sys/compat/linux/linux_socket.c
> >> > >> >> ==
> >> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
> >> > >> >> 2016(r306173)
> >> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
> >> > >> >> 2016(r306174)
> >> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
> >> > >> >> sockaddr_in))
> >> > >> >>  

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
Thanks, I was able to reproduce that :)
I attached the patch. Could you please confirm that it fix the problem?

Thank you and sorry for inconveniences,
Mariusz

On 22 September 2016 at 18:11, Ruslan Bukin  wrote:
> I have just tested this with MIPS64EL and the result is the same.
> So you can try both EL or EB
>
> e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel
>
> Ruslan
>
> On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
>> Hi
>>
>> It reports nothing. Yes I use qemu:
>> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M malta 
>> -kernel ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel 
>> -hda /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net 
>> nic -net user -m 2048M -redir tcp:4022::22
>>
>> Ruslan
>>
>> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
>> > I tested it on the mips for Malta kernel and it's works fine. I will
>> > try to do it on mips64, are you using qemu to test it?
>> > What is ctrl + t reporting you?
>> >
>> >
>> > On 22 September 2016 at 16:56, Ruslan Bukin  
>> > wrote:
>> > > May be. The next line should be
>> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
>> > >
>> > > but it hangs before this line
>> > >
>> > > Ruslan
>> > >
>> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
>> > >> Hi Ruslan,
>> > >>
>> > >> Does it hang on some network script?
>> > >>
>> > >> Thanks,
>> > >> Mariusz
>> > >>
>> > >>
>> > >> On 22 September 2016 at 16:34, Ruslan Bukin  
>> > >> wrote:
>> > >> > Hi Mariusz
>> > >> >
>> > >> > my MIPS64EB kernel stops booting with this
>> > >> >
>> > >> > somewhere here:
>> > >> > [...]
>> > >> > Starting file system checks:
>> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
>> > >> > blocks, 0.0% fragmentation)
>> > >> > Mounting local filesystems:.
>> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
>> > >> > random: unblocking device.
>> > >> >
>> > >> > any idea ? (should I rebuild something?)
>> > >> >
>> > >> > thanks!
>> > >> >
>> > >> > Ruslan
>> > >> >
>> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
>> > >> >> Author: oshogbo
>> > >> >> Date: Thu Sep 22 09:58:46 2016
>> > >> >> New Revision: 306174
>> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
>> > >> >>
>> > >> >> Log:
>> > >> >>   capsicum: propagate rights on accept(2)
>> > >> >>
>> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
>> > >> >> rights from
>> > >> >>   the listening socket.
>> > >> >>
>> > >> >>   PR: 201052
>> > >> >>   Reviewed by:emaste, jonathan
>> > >> >>   Discussed with: many
>> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
>> > >> >>
>> > >> >> Modified:
>> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
>> > >> >>   head/sys/compat/linux/linux_socket.c
>> > >> >>   head/sys/kern/kern_sendfile.c
>> > >> >>   head/sys/kern/uipc_syscalls.c
>> > >> >>   head/sys/netinet/sctp_syscalls.c
>> > >> >>   head/sys/sys/socketvar.h
>> > >> >>
>> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
>> > >> >> ==
>> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
>> > >> >> 2016(r306173)
>> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
>> > >> >> 2016(r306174)
>> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>> > >> >>   int error;
>> > >> >>
>> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
>> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
>> > >> >> NULL);
>> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
>> > >> >> NULL, NULL);
>> > >> >>   if (error != 0)
>> > >> >>   return (error);
>> > >> >>   so = fp->f_data;
>> > >> >>
>> > >> >> Modified: head/sys/compat/linux/linux_socket.c
>> > >> >> ==
>> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
>> > >> >> 2016(r306173)
>> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
>> > >> >> 2016(r306174)
>> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
>> > >> >> sockaddr_in))
>> > >> >>   return (EINVAL);
>> > >> >>   if (error == EINVAL) {
>> > >> >> - error1 = getsock_cap(td, s, , , 
>> > >> >> NULL);
>> > >> >> + error1 = getsock_cap(td, s, , , 
>> > >> >> NULL, NULL);
>> > >> >>   if (error1 != 0)
>> > >> >>   return (error1);
>> > >> 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
I have just tested this with MIPS64EL and the result is the same.
So you can try both EL or EB

e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel

Ruslan

On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
> Hi
> 
> It reports nothing. Yes I use qemu:
> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M malta 
> -kernel ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
> /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net nic 
> -net user -m 2048M -redir tcp:4022::22
> 
> Ruslan
> 
> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> > I tested it on the mips for Malta kernel and it's works fine. I will
> > try to do it on mips64, are you using qemu to test it?
> > What is ctrl + t reporting you?
> > 
> > 
> > On 22 September 2016 at 16:56, Ruslan Bukin  
> > wrote:
> > > May be. The next line should be
> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> > >
> > > but it hangs before this line
> > >
> > > Ruslan
> > >
> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> > >> Hi Ruslan,
> > >>
> > >> Does it hang on some network script?
> > >>
> > >> Thanks,
> > >> Mariusz
> > >>
> > >>
> > >> On 22 September 2016 at 16:34, Ruslan Bukin  
> > >> wrote:
> > >> > Hi Mariusz
> > >> >
> > >> > my MIPS64EB kernel stops booting with this
> > >> >
> > >> > somewhere here:
> > >> > [...]
> > >> > Starting file system checks:
> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
> > >> > blocks, 0.0% fragmentation)
> > >> > Mounting local filesystems:.
> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> > >> > random: unblocking device.
> > >> >
> > >> > any idea ? (should I rebuild something?)
> > >> >
> > >> > thanks!
> > >> >
> > >> > Ruslan
> > >> >
> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> > >> >> Author: oshogbo
> > >> >> Date: Thu Sep 22 09:58:46 2016
> > >> >> New Revision: 306174
> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> > >> >>
> > >> >> Log:
> > >> >>   capsicum: propagate rights on accept(2)
> > >> >>
> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
> > >> >> rights from
> > >> >>   the listening socket.
> > >> >>
> > >> >>   PR: 201052
> > >> >>   Reviewed by:emaste, jonathan
> > >> >>   Discussed with: many
> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> > >> >>
> > >> >> Modified:
> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> > >> >>   head/sys/compat/linux/linux_socket.c
> > >> >>   head/sys/kern/kern_sendfile.c
> > >> >>   head/sys/kern/uipc_syscalls.c
> > >> >>   head/sys/netinet/sctp_syscalls.c
> > >> >>   head/sys/sys/socketvar.h
> > >> >>
> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> > >> >> ==
> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
> > >> >> 2016(r306173)
> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
> > >> >> 2016(r306174)
> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> > >> >>   int error;
> > >> >>
> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> > >> >> NULL);
> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> > >> >> NULL, NULL);
> > >> >>   if (error != 0)
> > >> >>   return (error);
> > >> >>   so = fp->f_data;
> > >> >>
> > >> >> Modified: head/sys/compat/linux/linux_socket.c
> > >> >> ==
> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
> > >> >> 2016(r306173)
> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
> > >> >> 2016(r306174)
> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
> > >> >> sockaddr_in))
> > >> >>   return (EINVAL);
> > >> >>   if (error == EINVAL) {
> > >> >> - error1 = getsock_cap(td, s, , , NULL);
> > >> >> + error1 = getsock_cap(td, s, , , NULL, 
> > >> >> NULL);
> > >> >>   if (error1 != 0)
> > >> >>   return (error1);
> > >> >>   so = fp->f_data;
> > >> >>
> > >> >> Modified: head/sys/kern/kern_sendfile.c
> > >> >> ==
> > >> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> > >> >> (r306173)
> > >> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> > 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
Hi

It reports nothing. Yes I use qemu:
/home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M malta 
-kernel ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
/home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net nic 
-net user -m 2048M -redir tcp:4022::22

Ruslan

On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> I tested it on the mips for Malta kernel and it's works fine. I will
> try to do it on mips64, are you using qemu to test it?
> What is ctrl + t reporting you?
> 
> 
> On 22 September 2016 at 16:56, Ruslan Bukin  wrote:
> > May be. The next line should be
> > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> >
> > but it hangs before this line
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> >> Hi Ruslan,
> >>
> >> Does it hang on some network script?
> >>
> >> Thanks,
> >> Mariusz
> >>
> >>
> >> On 22 September 2016 at 16:34, Ruslan Bukin  
> >> wrote:
> >> > Hi Mariusz
> >> >
> >> > my MIPS64EB kernel stops booting with this
> >> >
> >> > somewhere here:
> >> > [...]
> >> > Starting file system checks:
> >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
> >> > blocks, 0.0% fragmentation)
> >> > Mounting local filesystems:.
> >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> >> > random: unblocking device.
> >> >
> >> > any idea ? (should I rebuild something?)
> >> >
> >> > thanks!
> >> >
> >> > Ruslan
> >> >
> >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> >> Author: oshogbo
> >> >> Date: Thu Sep 22 09:58:46 2016
> >> >> New Revision: 306174
> >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >> >>
> >> >> Log:
> >> >>   capsicum: propagate rights on accept(2)
> >> >>
> >> >>   Descriptor returned by accept(2) should inherits capabilities rights 
> >> >> from
> >> >>   the listening socket.
> >> >>
> >> >>   PR: 201052
> >> >>   Reviewed by:emaste, jonathan
> >> >>   Discussed with: many
> >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >> >>
> >> >> Modified:
> >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >> >>   head/sys/compat/linux/linux_socket.c
> >> >>   head/sys/kern/kern_sendfile.c
> >> >>   head/sys/kern/uipc_syscalls.c
> >> >>   head/sys/netinet/sctp_syscalls.c
> >> >>   head/sys/sys/socketvar.h
> >> >>
> >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> >> ==
> >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016  
> >> >>   (r306173)
> >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016  
> >> >>   (r306174)
> >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >> >>   int error;
> >> >>
> >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
> >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
> >> >> NULL);
> >> >>   if (error != 0)
> >> >>   return (error);
> >> >>   so = fp->f_data;
> >> >>
> >> >> Modified: head/sys/compat/linux/linux_socket.c
> >> >> ==
> >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016  
> >> >>   (r306173)
> >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016  
> >> >>   (r306174)
> >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >> >>   if (error == EFAULT && namelen != sizeof(struct 
> >> >> sockaddr_in))
> >> >>   return (EINVAL);
> >> >>   if (error == EINVAL) {
> >> >> - error1 = getsock_cap(td, s, , , NULL);
> >> >> + error1 = getsock_cap(td, s, , , NULL, 
> >> >> NULL);
> >> >>   if (error1 != 0)
> >> >>   return (error1);
> >> >>   so = fp->f_data;
> >> >>
> >> >> Modified: head/sys/kern/kern_sendfile.c
> >> >> ==
> >> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> >> >> (r306173)
> >> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> >> >> (r306174)
> >> >> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
> >> >>* The socket must be a stream socket and connected.
> >> >>*/
> >> >>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
> >> >> - sock_fp, NULL);
> >> >> + sock_fp, NULL, NULL);
> >> >>   if (error != 0)
> >> >>   return (error);
> >> >>   *so = (*sock_fp)->f_data;
> >> >>
> >> >> Modified: head/sys/kern/uipc_syscalls.c
> >> >> 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
I tested it on the mips for Malta kernel and it's works fine. I will
try to do it on mips64, are you using qemu to test it?
What is ctrl + t reporting you?


On 22 September 2016 at 16:56, Ruslan Bukin  wrote:
> May be. The next line should be
> /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
>
> but it hangs before this line
>
> Ruslan
>
> On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
>> Hi Ruslan,
>>
>> Does it hang on some network script?
>>
>> Thanks,
>> Mariusz
>>
>>
>> On 22 September 2016 at 16:34, Ruslan Bukin  
>> wrote:
>> > Hi Mariusz
>> >
>> > my MIPS64EB kernel stops booting with this
>> >
>> > somewhere here:
>> > [...]
>> > Starting file system checks:
>> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
>> > blocks, 0.0% fragmentation)
>> > Mounting local filesystems:.
>> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
>> > random: unblocking device.
>> >
>> > any idea ? (should I rebuild something?)
>> >
>> > thanks!
>> >
>> > Ruslan
>> >
>> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
>> >> Author: oshogbo
>> >> Date: Thu Sep 22 09:58:46 2016
>> >> New Revision: 306174
>> >> URL: https://svnweb.freebsd.org/changeset/base/306174
>> >>
>> >> Log:
>> >>   capsicum: propagate rights on accept(2)
>> >>
>> >>   Descriptor returned by accept(2) should inherits capabilities rights 
>> >> from
>> >>   the listening socket.
>> >>
>> >>   PR: 201052
>> >>   Reviewed by:emaste, jonathan
>> >>   Discussed with: many
>> >>   Differential Revision:  https://reviews.freebsd.org/D7724
>> >>
>> >> Modified:
>> >>   head/sys/compat/cloudabi/cloudabi_sock.c
>> >>   head/sys/compat/linux/linux_socket.c
>> >>   head/sys/kern/kern_sendfile.c
>> >>   head/sys/kern/uipc_syscalls.c
>> >>   head/sys/netinet/sctp_syscalls.c
>> >>   head/sys/sys/socketvar.h
>> >>
>> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
>> >> ==
>> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>> >>   int error;
>> >>
>> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
>> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
>> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
>> >> NULL);
>> >>   if (error != 0)
>> >>   return (error);
>> >>   so = fp->f_data;
>> >>
>> >> Modified: head/sys/compat/linux/linux_socket.c
>> >> ==
>> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>> >>   if (error == EFAULT && namelen != sizeof(struct 
>> >> sockaddr_in))
>> >>   return (EINVAL);
>> >>   if (error == EINVAL) {
>> >> - error1 = getsock_cap(td, s, , , NULL);
>> >> + error1 = getsock_cap(td, s, , , NULL, 
>> >> NULL);
>> >>   if (error1 != 0)
>> >>   return (error1);
>> >>   so = fp->f_data;
>> >>
>> >> Modified: head/sys/kern/kern_sendfile.c
>> >> ==
>> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
>> >>* The socket must be a stream socket and connected.
>> >>*/
>> >>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
>> >> - sock_fp, NULL);
>> >> + sock_fp, NULL, NULL);
>> >>   if (error != 0)
>> >>   return (error);
>> >>   *so = (*sock_fp)->f_data;
>> >>
>> >> Modified: head/sys/kern/uipc_syscalls.c
>> >> ==
>> >> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
>> >>  /*
>> >>   * Convert a user file descriptor to a kernel file entry and check if 
>> >> required
>> >>   * capability rights are present.
>> >> + * If required copy of current set of capability rights is returned.
>> >>   * A reference on the file entry is held upon returning.
>> >>   */
>> >>  int
>> >>  

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
May be. The next line should be
/etc/rc: WARNING: $hostname is not set -- see rc.conf(5).

but it hangs before this line

Ruslan

On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> Hi Ruslan,
> 
> Does it hang on some network script?
> 
> Thanks,
> Mariusz
> 
> 
> On 22 September 2016 at 16:34, Ruslan Bukin  wrote:
> > Hi Mariusz
> >
> > my MIPS64EB kernel stops booting with this
> >
> > somewhere here:
> > [...]
> > Starting file system checks:
> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
> > blocks, 0.0% fragmentation)
> > Mounting local filesystems:.
> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> > random: unblocking device.
> >
> > any idea ? (should I rebuild something?)
> >
> > thanks!
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> Author: oshogbo
> >> Date: Thu Sep 22 09:58:46 2016
> >> New Revision: 306174
> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >>
> >> Log:
> >>   capsicum: propagate rights on accept(2)
> >>
> >>   Descriptor returned by accept(2) should inherits capabilities rights from
> >>   the listening socket.
> >>
> >>   PR: 201052
> >>   Reviewed by:emaste, jonathan
> >>   Discussed with: many
> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >>
> >> Modified:
> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >>   head/sys/compat/linux/linux_socket.c
> >>   head/sys/kern/kern_sendfile.c
> >>   head/sys/kern/uipc_syscalls.c
> >>   head/sys/netinet/sctp_syscalls.c
> >>   head/sys/sys/socketvar.h
> >>
> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> ==
> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016 
> >>(r306173)
> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016 
> >>(r306174)
> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >>   int error;
> >>
> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
> >> NULL);
> >>   if (error != 0)
> >>   return (error);
> >>   so = fp->f_data;
> >>
> >> Modified: head/sys/compat/linux/linux_socket.c
> >> ==
> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016 
> >>(r306173)
> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016 
> >>(r306174)
> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >>   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
> >>   return (EINVAL);
> >>   if (error == EINVAL) {
> >> - error1 = getsock_cap(td, s, , , NULL);
> >> + error1 = getsock_cap(td, s, , , NULL, 
> >> NULL);
> >>   if (error1 != 0)
> >>   return (error1);
> >>   so = fp->f_data;
> >>
> >> Modified: head/sys/kern/kern_sendfile.c
> >> ==
> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> >> (r306173)
> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> >> (r306174)
> >> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
> >>* The socket must be a stream socket and connected.
> >>*/
> >>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
> >> - sock_fp, NULL);
> >> + sock_fp, NULL, NULL);
> >>   if (error != 0)
> >>   return (error);
> >>   *so = (*sock_fp)->f_data;
> >>
> >> Modified: head/sys/kern/uipc_syscalls.c
> >> ==
> >> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
> >> (r306173)
> >> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
> >> (r306174)
> >> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
> >>  /*
> >>   * Convert a user file descriptor to a kernel file entry and check if 
> >> required
> >>   * capability rights are present.
> >> + * If required copy of current set of capability rights is returned.
> >>   * A reference on the file entry is held upon returning.
> >>   */
> >>  int
> >>  getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
> >> -struct file **fpp, u_int *fflagp)
> >> +struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
> >>  {
> >>   struct file *fp;
> >>   int error;
> >>
> >> - error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
> >> + error = fget_cap(td, fd, rightsp, , havecapsp);
> >>   

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
Hi Mariusz

my MIPS64EB kernel stops booting with this

somewhere here:
[...]
Starting file system checks:
/dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 blocks, 
0.0% fragmentation)
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
random: unblocking device.

any idea ? (should I rebuild something?)

thanks!

Ruslan

On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> Author: oshogbo
> Date: Thu Sep 22 09:58:46 2016
> New Revision: 306174
> URL: https://svnweb.freebsd.org/changeset/base/306174
> 
> Log:
>   capsicum: propagate rights on accept(2)
>   
>   Descriptor returned by accept(2) should inherits capabilities rights from
>   the listening socket.
>   
>   PR: 201052
>   Reviewed by:emaste, jonathan
>   Discussed with: many
>   Differential Revision:  https://reviews.freebsd.org/D7724
> 
> Modified:
>   head/sys/compat/cloudabi/cloudabi_sock.c
>   head/sys/compat/linux/linux_socket.c
>   head/sys/kern/kern_sendfile.c
>   head/sys/kern/uipc_syscalls.c
>   head/sys/netinet/sctp_syscalls.c
>   head/sys/sys/socketvar.h
> 
> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> ==
> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>   int error;
>  
>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, NULL);
>   if (error != 0)
>   return (error);
>   so = fp->f_data;
> 
> Modified: head/sys/compat/linux/linux_socket.c
> ==
> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
>   return (EINVAL);
>   if (error == EINVAL) {
> - error1 = getsock_cap(td, s, , , NULL);
> + error1 = getsock_cap(td, s, , , NULL, NULL);
>   if (error1 != 0)
>   return (error1);
>   so = fp->f_data;
> 
> Modified: head/sys/kern/kern_sendfile.c
> ==
> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int 
>* The socket must be a stream socket and connected.
>*/
>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
> - sock_fp, NULL);
> + sock_fp, NULL, NULL);
>   if (error != 0)
>   return (error);
>   *so = (*sock_fp)->f_data;
> 
> Modified: head/sys/kern/uipc_syscalls.c
> ==
> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
>  /*
>   * Convert a user file descriptor to a kernel file entry and check if 
> required
>   * capability rights are present.
> + * If required copy of current set of capability rights is returned.
>   * A reference on the file entry is held upon returning.
>   */
>  int
>  getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
> -struct file **fpp, u_int *fflagp)
> +struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
>  {
>   struct file *fp;
>   int error;
>  
> - error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
> + error = fget_cap(td, fd, rightsp, , havecapsp);
>   if (error != 0)
>   return (error);
>   if (fp->f_type != DTYPE_SOCKET) {
>   fdrop(fp, td);
> + if (havecapsp != NULL)
> + filecaps_free(havecapsp);
>   return (ENOTSOCK);
>   }
>   if (fflagp != NULL)
> @@ -188,7 +191,7 @@ kern_bindat(struct thread *td, int dirfd
>   AUDIT_ARG_FD(fd);
>   AUDIT_ARG_SOCKADDR(td, dirfd, sa);
>   error = getsock_cap(td, fd, cap_rights_init(, CAP_BIND),
> - , NULL);
> + , NULL, NULL);
>   if (error != 0)
>   return (error);
>   so = fp->f_data;
> @@ -235,7 +238,7 @@ sys_listen(struct thread *td, struct lis
>  
>   AUDIT_ARG_FD(uap->s);
>   error = 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
Hi Ruslan,

Does it hang on some network script?

Thanks,
Mariusz


On 22 September 2016 at 16:34, Ruslan Bukin  wrote:
> Hi Mariusz
>
> my MIPS64EB kernel stops booting with this
>
> somewhere here:
> [...]
> Starting file system checks:
> /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 blocks, 
> 0.0% fragmentation)
> Mounting local filesystems:.
> ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> random: unblocking device.
>
> any idea ? (should I rebuild something?)
>
> thanks!
>
> Ruslan
>
> On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
>> Author: oshogbo
>> Date: Thu Sep 22 09:58:46 2016
>> New Revision: 306174
>> URL: https://svnweb.freebsd.org/changeset/base/306174
>>
>> Log:
>>   capsicum: propagate rights on accept(2)
>>
>>   Descriptor returned by accept(2) should inherits capabilities rights from
>>   the listening socket.
>>
>>   PR: 201052
>>   Reviewed by:emaste, jonathan
>>   Discussed with: many
>>   Differential Revision:  https://reviews.freebsd.org/D7724
>>
>> Modified:
>>   head/sys/compat/cloudabi/cloudabi_sock.c
>>   head/sys/compat/linux/linux_socket.c
>>   head/sys/kern/kern_sendfile.c
>>   head/sys/kern/uipc_syscalls.c
>>   head/sys/netinet/sctp_syscalls.c
>>   head/sys/sys/socketvar.h
>>
>> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
>> ==
>> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016   
>>  (r306173)
>> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016   
>>  (r306174)
>> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>>   int error;
>>
>>   error = getsock_cap(td, uap->sock, cap_rights_init(,
>> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
>> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
>> NULL);
>>   if (error != 0)
>>   return (error);
>>   so = fp->f_data;
>>
>> Modified: head/sys/compat/linux/linux_socket.c
>> ==
>> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016   
>>  (r306173)
>> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016   
>>  (r306174)
>> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>>   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
>>   return (EINVAL);
>>   if (error == EINVAL) {
>> - error1 = getsock_cap(td, s, , , NULL);
>> + error1 = getsock_cap(td, s, , , NULL, NULL);
>>   if (error1 != 0)
>>   return (error1);
>>   so = fp->f_data;
>>
>> Modified: head/sys/kern/kern_sendfile.c
>> ==
>> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
>> (r306173)
>> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
>> (r306174)
>> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
>>* The socket must be a stream socket and connected.
>>*/
>>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
>> - sock_fp, NULL);
>> + sock_fp, NULL, NULL);
>>   if (error != 0)
>>   return (error);
>>   *so = (*sock_fp)->f_data;
>>
>> Modified: head/sys/kern/uipc_syscalls.c
>> ==
>> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
>> (r306173)
>> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
>> (r306174)
>> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
>>  /*
>>   * Convert a user file descriptor to a kernel file entry and check if 
>> required
>>   * capability rights are present.
>> + * If required copy of current set of capability rights is returned.
>>   * A reference on the file entry is held upon returning.
>>   */
>>  int
>>  getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
>> -struct file **fpp, u_int *fflagp)
>> +struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
>>  {
>>   struct file *fp;
>>   int error;
>>
>> - error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
>> + error = fget_cap(td, fd, rightsp, , havecapsp);
>>   if (error != 0)
>>   return (error);
>>   if (fp->f_type != DTYPE_SOCKET) {
>>   fdrop(fp, td);
>> + if (havecapsp != NULL)
>> + filecaps_free(havecapsp);
>>   return (ENOTSOCK);
>>   }
>>   if (fflagp != NULL)
>> @@ -188,7 +191,7 @@ kern_bindat(struct thread *td, int dirfd
>>   AUDIT_ARG_FD(fd);
>>   AUDIT_ARG_SOCKADDR(td, dirfd, sa);
>>   error =