svn commit: r315661 - stable/10/tools/build/mk

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 21 05:15:10 2017
New Revision: 315661
URL: https://svnweb.freebsd.org/changeset/base/315661

Log:
  MFC r314241,r315228:
  
  r314241:
  
  Fill in MK_RESCUE by finding paths in ${DESTDIR}/rescue and adding
  them to OLD_FILES/OLD_DIRS, as necessary.
  
  r315228:
  
  Redirect standard error from find /rescue to /dev/null
  
  This mutes noise from find when /rescue doesn't exist.

Modified:
  stable/10/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/10/tools/build/mk/OptionalObsoleteFiles.inc  Tue Mar 21 05:13:14 
2017(r315660)
+++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc  Tue Mar 21 05:15:10 
2017(r315661)
@@ -4438,9 +4438,14 @@ OLD_FILES+=usr/tests/usr.sbin/etcupdate/
 OLD_DIRS+=usr/tests/usr.sbin/etcupdate
 .endif
 
-#.if ${MK_RESCUE} == no
-# to be filled in or replaced with a special target
-#.endif
+.if ${MK_RESCUE} == no
+. if exists(${DESTDIR}${TESTSBASE})
+RESCUE_DIRS!=find ${DESTDIR}/rescue -type d 2>/dev/null | sed -e 
's,^${DESTDIR}/,,'; echo
+OLD_DIRS+=${RESCUE_DIRS}
+RESCUE_FILES!=find ${DESTDIR}/rescue \! -type d 2>/dev/null | sed -e 
's,^${DESTDIR}/,,'; echo
+OLD_FILES+=${RESCUE_FILES}
+. endif
+.endif
 
 .if ${MK_ROUTED} == no
 OLD_FILES+=rescue/routed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315660 - stable/11/tools/build/mk

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 21 05:13:14 2017
New Revision: 315660
URL: https://svnweb.freebsd.org/changeset/base/315660

Log:
  MFC r314241,r315228:
  
  r314241:
  
  Fill in MK_RESCUE by finding paths in ${DESTDIR}/rescue and adding
  them to OLD_FILES/OLD_DIRS, as necessary.
  
  r315228:
  
  Redirect standard error from find /rescue to /dev/null
  
  This mutes noise from find when /rescue doesn't exist.

Modified:
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Tue Mar 21 03:42:28 
2017(r315659)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Tue Mar 21 05:13:14 
2017(r315660)
@@ -7131,9 +7131,14 @@ OLD_FILES+=usr/share/man/man1/rlog.1.gz
 OLD_FILES+=usr/share/man/man5/rcsfile.5.gz
 .endif
 
-#.if ${MK_RESCUE} == no
-# to be filled in or replaced with a special target
-#.endif
+.if ${MK_RESCUE} == no
+. if exists(${DESTDIR}${TESTSBASE})
+RESCUE_DIRS!=find ${DESTDIR}/rescue -type d 2>/dev/null | sed -e 
's,^${DESTDIR}/,,'; echo
+OLD_DIRS+=${RESCUE_DIRS}
+RESCUE_FILES!=find ${DESTDIR}/rescue \! -type d 2>/dev/null | sed -e 
's,^${DESTDIR}/,,'; echo
+OLD_FILES+=${RESCUE_FILES}
+. endif
+.endif
 
 .if ${MK_ROUTED} == no
 OLD_FILES+=rescue/routed
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315659 - stable/11/usr.sbin/lpr/common_source

2017-03-20 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Mar 21 03:42:28 2017
New Revision: 315659
URL: https://svnweb.freebsd.org/changeset/base/315659

Log:
  MFC r314877:
  lpr(1): small bounds check with reallocarray(3).
  
  While here plug a memory leak upon error and postpose the multiplication
  until after reallocation has succeded.
  
  Hinted partially by:  OpenBSD
  Reviewed by:  gad

Modified:
  stable/11/usr.sbin/lpr/common_source/common.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/lpr/common_source/common.c
==
--- stable/11/usr.sbin/lpr/common_source/common.c   Tue Mar 21 01:24:56 
2017(r315658)
+++ stable/11/usr.sbin/lpr/common_source/common.c   Tue Mar 21 03:42:28 
2017(r315659)
@@ -167,11 +167,13 @@ getq(const struct printer *pp, struct jo
 * realloc the maximum size.
 */
if (++nitems > arraysz) {
-   arraysz *= 2;
-   queue = (struct jobqueue **)realloc((char *)queue,
-   arraysz * sizeof(struct jobqueue *));
-   if (queue == NULL)
+   queue = (struct jobqueue **)reallocarray((char *)queue,
+   arraysz, 2 * sizeof(struct jobqueue *));
+   if (queue == NULL) {
+   free(q);
goto errdone;
+   }
+   arraysz *= 2;
}
queue[nitems-1] = q;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315656 - head/tests/sys/netinet

2017-03-20 Thread Alan Somers
On Mon, Mar 20, 2017 at 6:55 PM, Ngie Cooper  wrote:
> On Mon, Mar 20, 2017 at 4:07 PM, Alan Somers  wrote:
>> Author: asomers
>> Date: Mon Mar 20 23:07:34 2017
>> New Revision: 315656
>> URL: https://svnweb.freebsd.org/changeset/base/315656
>>
>> Log:
>>   Fix back-to-back runs of sys/netinet/fibs_test;slaac_on_nondefault_fib6
>>
>>   This test was failing if run twice because rtadvd takes too long to die.
>>   The rtadvd process from the first run was still running when the
>>   second run created its interfaces.  The solution is to use SIGKILL during
>>   the cleanup instead of SIGTERM so rtadvd will die faster.
>>
>>   While I'm here, randomize the addresses used for the test, which makes bugs
>>   like this easier to spot, and fix the cleanup order to be the opposite of
>>   the setup order
>>
>>   PR:   217871
>>   MFC after:18 days
>>   X-MFC-With:   315458
>>   Sponsored by: Spectra Logic Corp
>
> Hi Alan,
> I wonder if another seatbelt needs to be added for this scenario
> because running a separate copy of rtadvd could adversely affect the
> running system behavior...
> Thanks,
> -Ngie

I thought about that, but I decided against it, because rtadvd(8)
requires you to specify which interfaces it should operate on, either
on the command line or with rtadvctl(8).  This test always creates a
new interface and only runs rtadvd on the new interface.  Also,
rtadvd(8) allows you to override the default pidfile, configfile, and
socket file, which this test does.  So I don't think that the test
rtadvd and the system rtadvd can ever affect each other.

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


svn commit: r315658 - in stable/10/sys: compat/freebsd32 compat/linux kern

2017-03-20 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Mar 21 01:24:56 2017
New Revision: 315658
URL: https://svnweb.freebsd.org/changeset/base/315658

Log:
  MFC r315510
  
  nanosleep: plug a kernel memory disclosure
  
  nanosleep() updates rmtp on EINVAL.  In that case, kern_nanosleep()
  has not updated rmt, so sys_nanosleep() updates the user-space rmtp
  by copying garbage from its stack frame.  This is not only a kernel
  memory disclosure, it's also not POSIX-compliant.  Fix it to update
  rmtp only on EINTR.
  
  Security: possibly
  Sponsored by: Dell EMC

Modified:
  stable/10/sys/compat/freebsd32/freebsd32_misc.c
  stable/10/sys/compat/linux/linux_time.c
  stable/10/sys/kern/kern_time.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/10/sys/compat/freebsd32/freebsd32_misc.c Tue Mar 21 01:23:34 
2017(r315657)
+++ stable/10/sys/compat/freebsd32/freebsd32_misc.c Tue Mar 21 01:24:56 
2017(r315658)
@@ -2367,7 +2367,7 @@ freebsd32_nanosleep(struct thread *td, s
!useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
return (EFAULT);
error = kern_nanosleep(td, , );
-   if (error && uap->rmtp) {
+   if (error == EINTR && uap->rmtp) {
int error2;
 
CP(rmt, rmt32, tv_sec);

Modified: stable/10/sys/compat/linux/linux_time.c
==
--- stable/10/sys/compat/linux/linux_time.c Tue Mar 21 01:23:34 2017
(r315657)
+++ stable/10/sys/compat/linux/linux_time.c Tue Mar 21 01:24:56 2017
(r315658)
@@ -490,7 +490,7 @@ linux_nanosleep(struct thread *td, struc
return (error);
}
error = kern_nanosleep(td, , rmtp);
-   if (args->rmtp != NULL) {
+   if (error == EINTR && args->rmtp != NULL) {
native_to_linux_timespec(, rmtp);
error2 = copyout(, args->rmtp, sizeof(lrmts));
if (error2 != 0) {
@@ -552,7 +552,7 @@ linux_clock_nanosleep(struct thread *td,
return (error);
}
error = kern_nanosleep(td, , rmtp);
-   if (args->rmtp != NULL) {
+   if (error == EINTR && args->rmtp != NULL) {
/* XXX. Not for TIMER_ABSTIME */
native_to_linux_timespec(, rmtp);
error2 = copyout(, args->rmtp, sizeof(lrmts));

Modified: stable/10/sys/kern/kern_time.c
==
--- stable/10/sys/kern/kern_time.c  Tue Mar 21 01:23:34 2017
(r315657)
+++ stable/10/sys/kern/kern_time.c  Tue Mar 21 01:24:56 2017
(r315658)
@@ -546,7 +546,7 @@ sys_nanosleep(struct thread *td, struct 
!useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
return (EFAULT);
error = kern_nanosleep(td, , );
-   if (error && uap->rmtp) {
+   if (error == EINTR && uap->rmtp) {
int error2;
 
error2 = copyout(, uap->rmtp, sizeof(rmt));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315657 - in stable/11/sys: compat/freebsd32 compat/linux kern

2017-03-20 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Mar 21 01:23:34 2017
New Revision: 315657
URL: https://svnweb.freebsd.org/changeset/base/315657

Log:
  MFC r315510
  
  nanosleep: plug a kernel memory disclosure
  
  nanosleep() updates rmtp on EINVAL.  In that case, kern_nanosleep()
  has not updated rmt, so sys_nanosleep() updates the user-space rmtp
  by copying garbage from its stack frame.  This is not only a kernel
  memory disclosure, it's also not POSIX-compliant.  Fix it to update
  rmtp only on EINTR.
  
  Security: possibly
  Sponsored by: Dell EMC

Modified:
  stable/11/sys/compat/freebsd32/freebsd32_misc.c
  stable/11/sys/compat/linux/linux_time.c
  stable/11/sys/kern/kern_time.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/11/sys/compat/freebsd32/freebsd32_misc.c Mon Mar 20 23:07:34 
2017(r315656)
+++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Tue Mar 21 01:23:34 
2017(r315657)
@@ -2241,7 +2241,7 @@ freebsd32_nanosleep(struct thread *td, s
!useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
return (EFAULT);
error = kern_nanosleep(td, , );
-   if (error && uap->rmtp) {
+   if (error == EINTR && uap->rmtp) {
int error2;
 
CP(rmt, rmt32, tv_sec);

Modified: stable/11/sys/compat/linux/linux_time.c
==
--- stable/11/sys/compat/linux/linux_time.c Mon Mar 20 23:07:34 2017
(r315656)
+++ stable/11/sys/compat/linux/linux_time.c Tue Mar 21 01:23:34 2017
(r315657)
@@ -489,7 +489,7 @@ linux_nanosleep(struct thread *td, struc
return (error);
}
error = kern_nanosleep(td, , rmtp);
-   if (args->rmtp != NULL) {
+   if (error == EINTR && args->rmtp != NULL) {
native_to_linux_timespec(, rmtp);
error2 = copyout(, args->rmtp, sizeof(lrmts));
if (error2 != 0) {
@@ -551,7 +551,7 @@ linux_clock_nanosleep(struct thread *td,
return (error);
}
error = kern_nanosleep(td, , rmtp);
-   if (args->rmtp != NULL) {
+   if (error == EINTR && args->rmtp != NULL) {
/* XXX. Not for TIMER_ABSTIME */
native_to_linux_timespec(, rmtp);
error2 = copyout(, args->rmtp, sizeof(lrmts));

Modified: stable/11/sys/kern/kern_time.c
==
--- stable/11/sys/kern/kern_time.c  Mon Mar 20 23:07:34 2017
(r315656)
+++ stable/11/sys/kern/kern_time.c  Tue Mar 21 01:23:34 2017
(r315657)
@@ -541,7 +541,7 @@ sys_nanosleep(struct thread *td, struct 
!useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE))
return (EFAULT);
error = kern_nanosleep(td, , );
-   if (error && uap->rmtp) {
+   if (error == EINTR && uap->rmtp) {
int error2;
 
error2 = copyout(, uap->rmtp, sizeof(rmt));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315656 - head/tests/sys/netinet

2017-03-20 Thread Ngie Cooper
On Mon, Mar 20, 2017 at 4:07 PM, Alan Somers  wrote:
> Author: asomers
> Date: Mon Mar 20 23:07:34 2017
> New Revision: 315656
> URL: https://svnweb.freebsd.org/changeset/base/315656
>
> Log:
>   Fix back-to-back runs of sys/netinet/fibs_test;slaac_on_nondefault_fib6
>
>   This test was failing if run twice because rtadvd takes too long to die.
>   The rtadvd process from the first run was still running when the
>   second run created its interfaces.  The solution is to use SIGKILL during
>   the cleanup instead of SIGTERM so rtadvd will die faster.
>
>   While I'm here, randomize the addresses used for the test, which makes bugs
>   like this easier to spot, and fix the cleanup order to be the opposite of
>   the setup order
>
>   PR:   217871
>   MFC after:18 days
>   X-MFC-With:   315458
>   Sponsored by: Spectra Logic Corp

Hi Alan,
I wonder if another seatbelt needs to be added for this scenario
because running a separate copy of rtadvd could adversely affect the
running system behavior...
Thanks,
-Ngie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315656 - head/tests/sys/netinet

2017-03-20 Thread Alan Somers
Author: asomers
Date: Mon Mar 20 23:07:34 2017
New Revision: 315656
URL: https://svnweb.freebsd.org/changeset/base/315656

Log:
  Fix back-to-back runs of sys/netinet/fibs_test;slaac_on_nondefault_fib6
  
  This test was failing if run twice because rtadvd takes too long to die.
  The rtadvd process from the first run was still running when the
  second run created its interfaces.  The solution is to use SIGKILL during
  the cleanup instead of SIGTERM so rtadvd will die faster.
  
  While I'm here, randomize the addresses used for the test, which makes bugs
  like this easier to spot, and fix the cleanup order to be the opposite of
  the setup order
  
  PR:   217871
  MFC after:18 days
  X-MFC-With:   315458
  Sponsored by: Spectra Logic Corp

Modified:
  head/tests/sys/netinet/fibs_test.sh

Modified: head/tests/sys/netinet/fibs_test.sh
==
--- head/tests/sys/netinet/fibs_test.sh Mon Mar 20 22:36:28 2017
(r315655)
+++ head/tests/sys/netinet/fibs_test.sh Mon Mar 20 23:07:34 2017
(r315656)
@@ -451,12 +451,12 @@ slaac_on_nondefault_fib6_head()
 }
 slaac_on_nondefault_fib6_body()
 {
-   atf_skip "BUG217871 SLAAC on a newly created epair sometimes fails to 
add routes"
# Configure the epair interfaces to use nonrouteable RFC3849
# addresses and non-default FIBs
-   ADDR="2001:db8::2"
-   GATEWAY="2001:db8::1"
-   SUBNET="2001:db8:"
+   PREFIX="2001:db8:$(printf "%x" `jot -r 1 0 65535`):$(printf "%x" `jot 
-r 1 0 65535`)"
+   ADDR="$PREFIX::2"
+   GATEWAY="$PREFIX::1"
+   SUBNET="$PREFIX:"
MASK="64"
 
# Check system configuration
@@ -509,19 +509,23 @@ slaac_on_nondefault_fib6_body()
 }
 slaac_on_nondefault_fib6_cleanup()
 {
-   cleanup_ifaces
if [ -f "rtadvd.pid" ]; then
-   pkill -F rtadvd.pid
+   # rtadvd can take a long time to shutdown.  Use SIGKILL to kill
+   # it right away.  The downside to using SIGKILL is that it
+   # won't send final RAs to all interfaces, but we don't care
+   # because we're about to destroy its interface anyway.
+   pkill -kill -F rtadvd.pid
rm -f rtadvd.pid
fi
-   if [ -f "rfc6204w3.state" ] ; then
-   sysctl "net.inet6.ip6.rfc6204w3"=`cat "rfc6204w3.state"`
-   rm "rfc6204w3.state"
-   fi
+   cleanup_ifaces
if [ -f "forwarding.state" ] ; then
sysctl "net.inet6.ip6.forwarding"=`cat "forwarding.state"`
rm "forwarding.state"
fi
+   if [ -f "rfc6204w3.state" ] ; then
+   sysctl "net.inet6.ip6.rfc6204w3"=`cat "rfc6204w3.state"`
+   rm "rfc6204w3.state"
+   fi
 }
 
 # Regression test for kern/187550
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315655 - head/usr.sbin/lpr/chkprintcap

2017-03-20 Thread Garance A Drosehn
Author: gad
Date: Mon Mar 20 22:36:28 2017
New Revision: 315655
URL: https://svnweb.freebsd.org/changeset/base/315655

Log:
  Fixes to chkprintcap:
  - Check the return from a call to malloc() in skim_printcap(), and
return a NULL if that fails.
  - Fix a small memory leak in main() that happens if skim_printcap()
returns an error, including the new error-return of NULL.
  
  Submitted by: Tom Rix 
  Reviewed by:  pfg, ngie
  MFC after:4 weeks
  Sponsored by: Dell EMC Isilon, Juniper
  Differential Revision:D9954, D9982

Modified:
  head/usr.sbin/lpr/chkprintcap/chkprintcap.c
  head/usr.sbin/lpr/chkprintcap/skimprintcap.c

Modified: head/usr.sbin/lpr/chkprintcap/chkprintcap.c
==
--- head/usr.sbin/lpr/chkprintcap/chkprintcap.c Mon Mar 20 22:33:22 2017
(r315654)
+++ head/usr.sbin/lpr/chkprintcap/chkprintcap.c Mon Mar 20 22:36:28 2017
(r315655)
@@ -113,8 +113,13 @@ main(int argc, char **argv)
 * the printcap file.
*/
skres = skim_printcap(pcap_fname, verbosity);
-   if (skres->fatalerr)
-   return (skres->fatalerr);
+   if (skres == NULL) {
+   problems = 1;
+   goto main_ret;
+   } else if (skres->fatalerr) {
+   problems = skres->fatalerr;
+   goto main_ret;
+   }
 
/*
 * Now use the standard capability-db routines to check the values
@@ -156,6 +161,9 @@ next:
warnx("WARNING:  but only found %d queues to process!",
queuecnt);
}
+
+main_ret:
+   free(pcap_fname);
return (problems);
 }
 

Modified: head/usr.sbin/lpr/chkprintcap/skimprintcap.c
==
--- head/usr.sbin/lpr/chkprintcap/skimprintcap.cMon Mar 20 22:33:22 
2017(r315654)
+++ head/usr.sbin/lpr/chkprintcap/skimprintcap.cMon Mar 20 22:36:28 
2017(r315655)
@@ -82,6 +82,8 @@ skim_printcap(const char *pcap_fname, in
enum {CMNT_LINE, ENTRY_LINE, TAB_LINE, TABERR_LINE} is_type, had_type;
 
skinf = malloc(sizeof(struct skiminfo));
+   if (skinf == NULL)
+   return (NULL);
memset(skinf, 0, sizeof(struct skiminfo));
 
pc_file = fopen(pcap_fname, "r");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315654 - head/rescue/rescue

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Mon Mar 20 22:33:22 2017
New Revision: 315654
URL: https://svnweb.freebsd.org/changeset/base/315654

Log:
  Fix linking /rescue/rescue to multiple programs in usr.bin after r315113
  
  I meant for the line that conditionally added in /usr/bin/nc support to
  be `+=', not `=`. This restores hardlinks for all programs in usr.bin
  specified before nc(1), e.g., bunzip2 and tar.
  
  Reported by:  Andrzej Tobola 
  Submitted by: Scott Allendorf 
  Pointyhat to: ngie
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/rescue/rescue/Makefile

Modified: head/rescue/rescue/Makefile
==
--- head/rescue/rescue/Makefile Mon Mar 20 22:20:17 2017(r315653)
+++ head/rescue/rescue/Makefile Mon Mar 20 22:33:22 2017(r315654)
@@ -210,7 +210,7 @@ CRUNCH_LIBS+= -lcrypto
 CRUNCH_LIBS+= -lmd
 
 .if ${MK_NETCAT} != "no"
-CRUNCH_PROGS_usr.bin= nc
+CRUNCH_PROGS_usr.bin+= nc
 .endif
 
 .if ${MK_VI} != "no"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315653 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386

2017-03-20 Thread Toomas Soome
Author: tsoome
Date: Mon Mar 20 22:20:17 2017
New Revision: 315653
URL: https://svnweb.freebsd.org/changeset/base/315653

Log:
  loader: verify the value from dhcp.interface-mtu and use snprintf to set mtu
  
  Since the uset can set dhcp.interface-mtu, we need to try to validate the
  value. So we verify if the conversion to int is successful and we will not
  allow to set value greater than max IPv4 packet size.
  
  Also use snprintf for safety.
  
  Reviewed by:  allanjude, bapt
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D8492

Modified:
  head/lib/libstand/bootp.c
  head/sys/boot/common/dev_net.c
  head/sys/boot/i386/libi386/pxe.c

Modified: head/lib/libstand/bootp.c
==
--- head/lib/libstand/bootp.c   Mon Mar 20 20:44:14 2017(r315652)
+++ head/lib/libstand/bootp.c   Mon Mar 20 22:20:17 2017(r315653)
@@ -39,6 +39,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -403,11 +404,29 @@ vend_rfc1048(cp, len)
strlcpy(hostname, val, sizeof(hostname));
}
if (tag == TAG_INTF_MTU) {
+   intf_mtu = 0;
if ((val = getenv("dhcp.interface-mtu")) != NULL) {
-   intf_mtu = (u_int)strtoul(val, NULL, 0);
-   } else {
-   intf_mtu = be16dec(cp);
+   unsigned long tmp;
+   char *end;
+
+   errno = 0;
+   /*
+* Do not allow MTU to exceed max IPv4 packet
+* size, max value of 16-bit word.
+*/
+   tmp = strtoul(val, , 0);
+   if (errno != 0 ||
+   *val == '\0' || *end != '\0' ||
+   tmp > USHRT_MAX) {
+   printf("%s: bad value: \"%s\", "
+   "ignoring\n",
+   "dhcp.interface-mtu", val);
+   } else {
+   intf_mtu = (u_int)tmp;
+   }
}
+   if (intf_mtu <= 0)
+   intf_mtu = be16dec(cp);
}
 #ifdef SUPPORT_DHCP
if (tag == TAG_DHCP_MSGTYPE) {

Modified: head/sys/boot/common/dev_net.c
==
--- head/sys/boot/common/dev_net.c  Mon Mar 20 20:44:14 2017
(r315652)
+++ head/sys/boot/common/dev_net.c  Mon Mar 20 22:20:17 2017
(r315653)
@@ -175,7 +175,7 @@ net_open(struct open_file *f, ...)
}
if (intf_mtu != 0) {
char mtu[16];
-   sprintf(mtu, "%u", intf_mtu);
+   snprintf(mtu, sizeof(mtu), "%u", intf_mtu);
setenv("boot.netif.mtu", mtu, 1);
}
 

Modified: head/sys/boot/i386/libi386/pxe.c
==
--- head/sys/boot/i386/libi386/pxe.cMon Mar 20 20:44:14 2017
(r315652)
+++ head/sys/boot/i386/libi386/pxe.cMon Mar 20 22:20:17 2017
(r315653)
@@ -342,7 +342,7 @@ pxe_open(struct open_file *f, ...)
}
if (intf_mtu != 0) {
char mtu[16];
-   sprintf(mtu, "%u", intf_mtu);
+   snprintf(sizeof(mtu), mtu, "%u", intf_mtu);
setenv("boot.netif.mtu", mtu, 1);
}
printf("pxe_open: server addr: %s\n", 
inet_ntoa(rootip));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315652 - head/sys/dev/isp

2017-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 20 20:44:14 2017
New Revision: 315652
URL: https://svnweb.freebsd.org/changeset/base/315652

Log:
  Remove some more dead code.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Mon Mar 20 19:27:35 2017
(r315651)
+++ head/sys/dev/isp/isp_freebsd.c  Mon Mar 20 20:44:14 2017
(r315652)
@@ -294,7 +294,6 @@ isp_attach(ispsoftc_t *isp)
callout_init_mtx(>isp_osinfo.tmo, >isp_osinfo.lock, 0);
isp_timer_count = hz >> 2;
callout_reset(>isp_osinfo.tmo, isp_timer_count, isp_timer, isp);
-   isp->isp_osinfo.timer_active = 1;
 
isp->isp_osinfo.cdev = make_dev(_cdevsw, du, UID_ROOT, 
GID_OPERATOR, 0600, "%s", nu);
if (isp->isp_osinfo.cdev) {
@@ -315,10 +314,6 @@ unwind:
ISP_UNLOCK(isp);
cam_sim_free(sim, FALSE);
}
-   if (isp->isp_osinfo.cdev) {
-   destroy_dev(isp->isp_osinfo.cdev);
-   isp->isp_osinfo.cdev = NULL;
-   }
cam_simq_free(isp->isp_osinfo.devq);
isp->isp_osinfo.devq = NULL;
return (-1);
@@ -327,35 +322,20 @@ unwind:
 int
 isp_detach(ispsoftc_t *isp)
 {
-   struct cam_sim *sim;
int chan;
 
-   ISP_LOCK(isp);
-   for (chan = isp->isp_nchan - 1; chan >= 0; chan -= 1) {
-   ISP_GET_PC(isp, chan, sim, sim);
-   if (sim->refcount > 2) {
-   ISP_UNLOCK(isp);
-   return (EBUSY);
-   }
+   if (isp->isp_osinfo.cdev) {
+   destroy_dev(isp->isp_osinfo.cdev);
+   isp->isp_osinfo.cdev = NULL;
}
+   ISP_LOCK(isp);
/* Tell spawned threads that we're exiting. */
isp->isp_osinfo.is_exiting = 1;
-   if (isp->isp_osinfo.timer_active) {
-   callout_stop(>isp_osinfo.tmo);
-   isp->isp_osinfo.timer_active = 0;
-   }
for (chan = isp->isp_nchan - 1; chan >= 0; chan -= 1)
isp_detach_chan(isp, chan);
ISP_UNLOCK(isp);
-
-   if (isp->isp_osinfo.cdev) {
-   destroy_dev(isp->isp_osinfo.cdev);
-   isp->isp_osinfo.cdev = NULL;
-   }
-   if (isp->isp_osinfo.devq != NULL) {
-   cam_simq_free(isp->isp_osinfo.devq);
-   isp->isp_osinfo.devq = NULL;
-   }
+   callout_drain(>isp_osinfo.tmo);
+   cam_simq_free(isp->isp_osinfo.devq);
return (0);
 }
 

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Mon Mar 20 19:27:35 2017
(r315651)
+++ head/sys/dev/isp/isp_freebsd.h  Mon Mar 20 20:44:14 2017
(r315652)
@@ -297,16 +297,7 @@ struct isposinfo {
struct isp_pcmd *   pcmd_pool;
struct isp_pcmd *   pcmd_free;
 
-   uint32_t
-#ifdef ISP_TARGET_MODE
-   tmwanted: 1,
-   tmbusy  : 1,
-#else
-   : 2,
-#endif
-   sixtyfourbit: 1,/* sixtyfour bit platform */
-   timer_active: 1,
-   autoconf: 1;
+   int sixtyfourbit;   /* sixtyfour bit platform */
int mbox_sleeping;
int mbox_sleep_ok;
int mboxbsy;

Modified: head/sys/dev/isp/ispvar.h
==
--- head/sys/dev/isp/ispvar.h   Mon Mar 20 19:27:35 2017(r315651)
+++ head/sys/dev/isp/ispvar.h   Mon Mar 20 20:44:14 2017(r315652)
@@ -532,9 +532,8 @@ struct ispsoftc {
uint32_tisp_maxluns;/* maximum luns supported */
 
uint32_tisp_clock   : 8,/* input clock */
-   : 4,
+   : 5,
isp_port: 1,/* 23XX/24XX only */
-   isp_open: 1,/* opened (ioctl) */
isp_bustype : 1,/* SBus or PCI */
isp_loaded_fw   : 1,/* loaded firmware */
isp_dblev   : 16;   /* debug log mask */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315651 - in head/sys/dev/bhnd/cores: chipc pmu

2017-03-20 Thread Landon J. Fuller
Author: landonf
Date: Mon Mar 20 19:27:35 2017
New Revision: 315651
URL: https://svnweb.freebsd.org/changeset/base/315651

Log:
  Integrate BCM4706 PMU (rev6) support, derived from the ISC-licensed Broadcom
  sbchipc.h and hndpmu.c sources included in the RT-N16 and later firmware
  source drops.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/cores/chipc/chipcreg.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
  head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h

Modified: head/sys/dev/bhnd/cores/chipc/chipcreg.h
==
--- head/sys/dev/bhnd/cores/chipc/chipcreg.hMon Mar 20 19:25:42 2017
(r315650)
+++ head/sys/dev/bhnd/cores/chipc/chipcreg.hMon Mar 20 19:27:35 2017
(r315651)
@@ -1,11 +1,11 @@
 /*-
  * Copyright (c) 2015-2016 Landon Fuller 
- * Copyright (c) 2010 Broadcom Corporation
+ * Copyright (c) 2010-2015 Broadcom Corporation
  * All rights reserved.
  *
- * This file is derived from the sbchipc.h header distributed with
- * Broadcom's initial brcm80211 Linux driver release, as
- * contributed to the Linux staging repository.
+ * This file is derived from the sbchipc.h header contributed by Broadcom 
+ * to to the Linux staging repository, as well as later revisions of sbchipc.h
+ * distributed with the Asus RT-N16 firmware source code release.
  * 
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -928,6 +928,29 @@ enum {
 #defineCHIPC_CST43228_SDIO_OTP_PRESENT 0x10
 #defineCHIPC_CST43228_SDIO_RESET   0x20
 
+/* 4706 chipstatus reg bits */
+#defineCHIPC_CST4706_LOWCOST_PKG   (1<<0)  /* 0: 
full-featured package 1: low-cost package */
+#defineCHIPC_CST4706_SFLASH_PRESENT(1<<1)  /* 0: parallel, 
1: serial flash is present */
+#defineCHIPC_CST4706_SFLASH_TYPE   (1<<2)  /* 0: 8b-p/ST-s 
flash, 1: 16b-p/Atmal-s flash */
+#defineCHIPC_CST4706_MIPS_BENDIAN  (1<<3)  /* 0: little,  
1: big endian */
+#defineCHIPC_CST4706_PCIE1_DISABLE (1<<5)  /* PCIE1 enable 
strap pin */
+
+/* 4706 flashstrconfig reg bits */
+#defineCHIPC_FLSTRCF4706_MASK  0x00ff
+#defineCHIPC_FLSTRCF4706_SF1   0x0001  /* 2nd 
serial flash present */
+#defineCHIPC_FLSTRCF4706_PF1   0x0002  /* 2nd 
parallel flash present */
+#defineCHIPC_FLSTRCF4706_SF1_TYPE  0x0004  /* 2nd 
serial flash type : 0 : ST, 1 : Atmel */
+#defineCHIPC_FLSTRCF4706_NF1   0x0008  /* 2nd 
NAND flash present */
+#defineCHIPC_FLSTRCF4706_1ST_MADDR_SEG_MASK0x00f0  /* 
Valid value mask */
+#defineCHIPC_FLSTRCF4706_1ST_MADDR_SEG_SHIFT   4
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_4MB   0x1 /* 4MB 
*/
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_8MB   0x2 /* 8MB 
*/
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_16MB  0x3 /* 16MB 
*/
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_32MB  0x4 /* 32MB 
*/
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_64MB  0x5 /* 64MB 
*/
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_128MB 0x6 /* 
128MB */
+#define  CHIPC_FLSTRCF4706_1ST_MADDR_SEG_256MB 0x7 /* 
256MB */
+
 /*
 * Register eci_inputlo bitfield values.
 * - BT packet type information bits [7:0]

Modified: head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
==
--- head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c Mon Mar 20 19:25:42 2017
(r315650)
+++ head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c Mon Mar 20 19:27:35 2017
(r315651)
@@ -69,6 +69,9 @@ static uint32_t   bhnd_pmu1_alpclk0(struct
 
 static uint32_tbhnd_pmu5_clock(struct bhnd_pmu_query *sc, u_int pll0, 
u_int m);
 
+static uint32_tbhnd_pmu6_4706_clock(struct bhnd_pmu_query *sc, u_int 
pll0,
+   u_int m);
+
 /* PMU resources */
 static boolbhnd_pmu_res_depfltr_bb(struct bhnd_pmu_softc *sc);
 static boolbhnd_pmu_res_depfltr_ncb(struct bhnd_pmu_softc *sc);
@@ -2329,6 +2332,47 @@ bhnd_pmu5_clock(struct bhnd_pmu_query *s
return ((fc / div) * 100);
 }
 
+static uint32_t
+bhnd_pmu6_4706_clock(struct bhnd_pmu_query *sc, u_int pll0, u_int m)
+{
+   uint32_t chipst, clock;
+   uint32_t ndiv, p1div, p2div, tmp;
+
+   /* Get N, P1 and P2 dividers to determine CPU clock */
+   BHND_PMU_WRITE_4(sc, BHND_PMU_PLL_CONTROL_ADDR,
+   pll0 + BHND_PMU6_4706_PROCPLL_OFF);
+   BHND_PMU_READ_4(sc, BHND_PMU_PLL_CONTROL_ADDR);
+
+   tmp = BHND_PMU_READ_4(sc, BHND_PMU_PLL_CONTROL_DATA);
+   ndiv = BHND_PMU_GET_BITS(tmp, 

svn commit: r315650 - head/sys/arm/freescale/imx

2017-03-20 Thread Andrew Turner
Author: andrew
Date: Mon Mar 20 19:25:42 2017
New Revision: 315650
URL: https://svnweb.freebsd.org/changeset/base/315650

Log:
  Use tc_priv to find the softc in the i.MX timer driver.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/freescale/imx/imx_gpt.c

Modified: head/sys/arm/freescale/imx/imx_gpt.c
==
--- head/sys/arm/freescale/imx/imx_gpt.cMon Mar 20 19:24:16 2017
(r315649)
+++ head/sys/arm/freescale/imx/imx_gpt.cMon Mar 20 19:25:42 2017
(r315650)
@@ -271,6 +271,7 @@ imx_gpt_attach(device_t dev)
 
/* Register as a timecounter. */
imx_gpt_timecounter.tc_frequency = sc->clkfreq;
+   imx_gpt_timecounter.tc_priv = sc;
tc_init(_gpt_timecounter);
 
/* If this is the first unit, store the softc for use in DELAY. */
@@ -368,14 +369,13 @@ imx_gpt_intr(void *arg)
return (FILTER_HANDLED);
 }
 
-u_int
+static u_int
 imx_gpt_get_timecount(struct timecounter *tc)
 {
+   struct imx_gpt_softc *sc;
 
-   if (imx_gpt_sc == NULL)
-   return (0);
-
-   return (READ4(imx_gpt_sc, IMX_GPT_CNT));
+   sc = tc->tc_priv;
+   return (READ4(sc, IMX_GPT_CNT));
 }
 
 static device_method_t imx_gpt_methods[] = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315649 - head/usr.bin/diff

2017-03-20 Thread Baptiste Daroussin
Author: bapt
Date: Mon Mar 20 19:24:16 2017
New Revision: 315649
URL: https://svnweb.freebsd.org/changeset/base/315649

Log:
  Cache tzdata when running under capsicum
  
  PR:   217957
  Reported by:  tobik@

Modified:
  head/usr.bin/diff/diffreg.c

Modified: head/usr.bin/diff/diffreg.c
==
--- head/usr.bin/diff/diffreg.c Mon Mar 20 19:16:28 2017(r315648)
+++ head/usr.bin/diff/diffreg.c Mon Mar 20 19:24:16 2017(r315649)
@@ -440,6 +440,7 @@ diffreg(char *file1, char *file2, int fl
err(2, "unable to limit stdio");
 
caph_cache_catpages();
+   caph_cache_tzdata();
if (cap_enter() < 0 && errno != ENOSYS)
err(2, "unable to enter capability mode");
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315648 - head/lib/libstand

2017-03-20 Thread Toomas Soome
Author: tsoome
Date: Mon Mar 20 19:16:28 2017
New Revision: 315648
URL: https://svnweb.freebsd.org/changeset/base/315648

Log:
  libstand: verify value provided by nfs.read_size
  
  Implement simple value check and feedback.
  
  Reviewed by:  allanjude, rpokala
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D8491

Modified:
  head/lib/libstand/nfs.c

Modified: head/lib/libstand/nfs.c
==
--- head/lib/libstand/nfs.c Mon Mar 20 18:28:22 2017(r315647)
+++ head/lib/libstand/nfs.c Mon Mar 20 19:16:28 2017(r315648)
@@ -214,6 +214,38 @@ struct fs_ops nfs_fsops = {
 
 static int nfs_read_size = NFSREAD_MIN_SIZE;
 
+/*
+ * Improve boot performance over NFS
+ */
+static void
+set_nfs_read_size(void)
+{
+   char *env, *end;
+   char buf[10];
+
+   if ((env = getenv("nfs.read_size")) != NULL) {
+   errno = 0;
+   nfs_read_size = (int)strtol(env, , 0);
+   if (errno != 0 || *env == '\0' || *end != '\0') {
+   printf("%s: bad value: \"%s\", defaulting to %d\n",
+   "nfs.read_size", env, NFSREAD_MIN_SIZE);
+   nfs_read_size = NFSREAD_MIN_SIZE;
+   }
+   }
+   if (nfs_read_size < NFSREAD_MIN_SIZE) {
+   printf("%s: bad value: \"%d\", defaulting to %d\n",
+   "nfs.read_size", nfs_read_size, NFSREAD_MIN_SIZE);
+   nfs_read_size = NFSREAD_MIN_SIZE;
+   }
+   if (nfs_read_size > NFSREAD_MAX_SIZE) {
+   printf("%s: bad value: \"%d\", defaulting to %d\n",
+   "nfs.read_size", nfs_read_size, NFSREAD_MIN_SIZE);
+   nfs_read_size = NFSREAD_MAX_SIZE;
+   }
+   snprintf(buf, sizeof (buf), "%d", nfs_read_size);
+   setenv("nfs.read_size", buf, 1);
+}
+
 #ifdef OLD_NFSV2
 /*
  * Fetch the root file handle (call mount daemon)
@@ -269,16 +301,7 @@ nfs_getrootfh(struct iodesc *d, char *pa
return (ntohl(repl->errno));
bcopy(repl->fh, fhp, sizeof(repl->fh));
 
-   /*
-* Improve boot performance over NFS
-*/
-   if (getenv("nfs.read_size") != NULL)
-   nfs_read_size = strtol(getenv("nfs.read_size"), NULL, 0);
-   if (nfs_read_size < NFSREAD_MIN_SIZE)
-   nfs_read_size = NFSREAD_MIN_SIZE;
-   if (nfs_read_size > NFSREAD_MAX_SIZE)
-   nfs_read_size = NFSREAD_MAX_SIZE;
-
+   set_nfs_read_size();
return (0);
 }
 
@@ -885,6 +908,8 @@ nfs_getrootfh(struct iodesc *d, char *pa
return (ntohl(repl->errno));
*fhlenp = ntohl(repl->fhsize);
bcopy(repl->fh, fhp, *fhlenp);
+
+   set_nfs_read_size();
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315647 - head/lib/libkvm

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Mon Mar 20 18:28:22 2017
New Revision: 315647
URL: https://svnweb.freebsd.org/changeset/base/315647

Log:
  Handle kd == NULL gracefully with kvm_close(3)
  
  Don't segfault in kvm_close(3) if provided a NULL pointer. Instead, return
  -1 and set errno to EINVAL.
  
  Document this new behavior explicitly.
  
  MFC after:1 week
  Reviewed by:  vangyzen
  Sponsored by: Dell EMC Isilon
  Differential Revision:D10065

Modified:
  head/lib/libkvm/kvm.c
  head/lib/libkvm/kvm_open.3

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Mon Mar 20 18:15:36 2017(r315646)
+++ head/lib/libkvm/kvm.c   Mon Mar 20 18:28:22 2017(r315647)
@@ -272,6 +272,10 @@ kvm_close(kvm_t *kd)
 {
int error = 0;
 
+   if (kd == NULL) {
+   errno = EINVAL;
+   return (-1);
+   }
if (kd->vmst != NULL)
kd->arch->ka_freevtop(kd);
if (kd->pmfd >= 0)

Modified: head/lib/libkvm/kvm_open.3
==
--- head/lib/libkvm/kvm_open.3  Mon Mar 20 18:15:36 2017(r315646)
+++ head/lib/libkvm/kvm_open.3  Mon Mar 20 18:28:22 2017(r315647)
@@ -32,7 +32,7 @@
 .\" @(#)kvm_open.3 8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd March 19, 2017
+.Dd March 20, 2017
 .Dt KVM_OPEN 3
 .Os
 .Sh NAME
@@ -227,10 +227,29 @@ and
 write the error message into
 .Fa errbuf .
 .Pp
+.Rv -std kvm_close
+.Sh ERRORS
 The
 .Fn kvm_close
-function returns 0 on success and -1 on failure.
+function may fail and set the global variable
+.Va errno
+for any of the errors specified for
+.Xr close 2 .
+.Pp
+The
+.Fn kvm_close
+function may also fail and set
+.Va errno
+if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value passed via
+.Fa kd
+was
+.Dv NULL .
+.El
 .Sh SEE ALSO
+.Xr close 2 ,
 .Xr open 2 ,
 .Xr kvm 3 ,
 .Xr kvm_getargv 3 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315646 - head/sys/boot/i386/libi386

2017-03-20 Thread Toomas Soome
Author: tsoome
Date: Mon Mar 20 18:15:36 2017
New Revision: 315646
URL: https://svnweb.freebsd.org/changeset/base/315646

Log:
  loader: pxe.h constants have wrong values
  
  FLTR_PRMSCS should be 0x4 and FLTR_SRC_RTG should be 0x8
  
  PXE Specification 2.1 PXENV_UNDI_OPEN, page 59.
  
  http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf
  
  Reviewed by:  allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D10056

Modified:
  head/sys/boot/i386/libi386/pxe.h

Modified: head/sys/boot/i386/libi386/pxe.h
==
--- head/sys/boot/i386/libi386/pxe.hMon Mar 20 18:03:40 2017
(r315645)
+++ head/sys/boot/i386/libi386/pxe.hMon Mar 20 18:15:36 2017
(r315646)
@@ -175,8 +175,8 @@ typedef struct {
uint16_tPktFilter;
 #  define FLTR_DIRECTED0x0001
 #  define FLTR_BRDCST  0x0002
-#  define FLTR_PRMSCS  0x0003
-#  define FLTR_SRC_RTG 0x0004
+#  define FLTR_PRMSCS  0x0004
+#  define FLTR_SRC_RTG 0x0008
 
t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
 } PACKED t_PXENV_UNDI_OPEN;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315645 - head/sys/boot/userboot/userboot

2017-03-20 Thread Toomas Soome
Author: tsoome
Date: Mon Mar 20 18:03:40 2017
New Revision: 315645
URL: https://svnweb.freebsd.org/changeset/base/315645

Log:
  loader: disk_cleanup was left in userboot_disk.c
  
  In r315408, disk_cleanup was removed, which is called at
  sys/boot/userboot/userboot/userboot_disk.c:113.
  This causes bhyveload to fail.
  
  PR:   217935
  Reported by:  Fabian Freyer
  Reviewed by:  allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D10060

Modified:
  head/sys/boot/userboot/userboot/userboot_disk.c

Modified: head/sys/boot/userboot/userboot/userboot_disk.c
==
--- head/sys/boot/userboot/userboot/userboot_disk.c Mon Mar 20 17:57:24 
2017(r315644)
+++ head/sys/boot/userboot/userboot/userboot_disk.c Mon Mar 20 18:03:40 
2017(r315645)
@@ -110,7 +110,6 @@ userdisk_cleanup(void)
 
if (userdisk_maxunit > 0)
free(ud_info);
-   disk_cleanup(_disk);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315644 - head/usr.sbin/inetd

2017-03-20 Thread Hiroki Sato
Author: hrs
Date: Mon Mar 20 17:57:24 2017
New Revision: 315644
URL: https://svnweb.freebsd.org/changeset/base/315644

Log:
  Simplify a pipe for signal handling.

Modified:
  head/usr.sbin/inetd/inetd.c

Modified: head/usr.sbin/inetd/inetd.c
==
--- head/usr.sbin/inetd/inetd.c Mon Mar 20 17:46:33 2017(r315643)
+++ head/usr.sbin/inetd/inetd.c Mon Mar 20 17:57:24 2017(r315644)
@@ -214,7 +214,6 @@ __FBSDID("$FreeBSD$");
 #endif
 static voidclose_sep(struct servtab *);
 static voidflag_signal(int);
-static voidflag_config(int);
 static voidconfig(void);
 static int cpmip(const struct servtab *, int);
 static voidendconfig(void);
@@ -224,11 +223,9 @@ static struct servtab *getconfigent(void
 static int matchservent(const char *, const char *, const char *);
 static char*nextline(FILE *);
 static voidaddchild(struct servtab *, int);
-static voidflag_reapchild(int);
 static voidreapchild(void);
 static voidenable(struct servtab *);
 static voiddisable(struct servtab *);
-static voidflag_retry(int);
 static voidretry(void);
 static int setconfig(void);
 static voidsetup(struct servtab *);
@@ -532,17 +529,17 @@ main(int argc, char **argv)
}
 #endif
 
-   sa.sa_flags = 0;
+   sa = (struct sigaction){
+   .sa_flags = 0,
+   .sa_handler = flag_signal,
+   };
sigemptyset(_mask);
sigaddset(_mask, SIGALRM);
sigaddset(_mask, SIGCHLD);
sigaddset(_mask, SIGHUP);
-   sa.sa_handler = flag_retry;
sigaction(SIGALRM, , );
config();
-   sa.sa_handler = flag_config;
sigaction(SIGHUP, , );
-   sa.sa_handler = flag_reapchild;
sigaction(SIGCHLD, , );
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, , );
@@ -591,30 +588,34 @@ main(int argc, char **argv)
}
/* handle any queued signal flags */
if (FD_ISSET(signalpipe[0], )) {
-   int nsig;
+   int nsig, signo;
+
if (ioctl(signalpipe[0], FIONREAD, ) != 0) {
-   syslog(LOG_ERR, "ioctl: %m");
-   exit(EX_OSERR);
+   syslog(LOG_ERR, "ioctl: %m");
+   exit(EX_OSERR);
}
+   nsig /= sizeof(signo);
while (--nsig >= 0) {
-   char c;
-   if (read(signalpipe[0], , 1) != 1) {
-   syslog(LOG_ERR, "read: %m");
-   exit(EX_OSERR);
-   }
-   if (debug)
-   warnx("handling signal flag %c", c);
-   switch(c) {
-   case 'A': /* sigalrm */
-   retry();
-   break;
-   case 'C': /* sigchld */
-   reapchild();
-   break;
-   case 'H': /* sighup */
-   config();
-   break;
-   }
+   size_t len;
+
+   len = read(signalpipe[0], , sizeof(signo));
+   if (len != sizeof(signo)) {
+   syslog(LOG_ERR, "read: %m");
+   exit(EX_OSERR);
+   }
+   if (debug)
+   warnx("handling signal flag %d", signo);
+   switch (signo) {
+   case SIGALRM:
+   retry();
+   break;
+   case SIGCHLD:
+   reapchild();
+   break;
+   case SIGHUP:
+   config();
+   break;
+   }
}
}
for (sep = servtab; n && sep; sep = sep->se_next)
@@ -900,11 +901,12 @@ main(int argc, char **argv)
  */
 
 static void
-flag_signal(int c)
+flag_signal(int signo)
 {
-   char ch = c;
+   size_t len;
 
-   if (write(signalpipe[1], , 1) != 1) {
+   len = write(signalpipe[1], , sizeof(signo));
+   if (len != sizeof(signo)) {
syslog(LOG_ERR, "write: %m");
_exit(EX_OSERR);
}
@@ -932,16 +934,6 @@ addchild(struct servtab *sep, pid_t pid)
disable(sep);
 }
 
-/*
- * Some child process has exited. See if it's on somebody's list.
- */
-
-static void
-flag_reapchild(int signo __unused)
-{
-   flag_signal('C');
-}
-
 static void
 reapchild(void)
 {
@@ -981,12 +973,6 @@ reapchild(void)
 }
 
 static void
-flag_config(int signo __unused)
-{
-   flag_signal('H');
-}
-
-static void
 config(void)
 {
struct servtab *sep, *new, **sepp;
@@ -1250,12 +1236,6 @@ unregisterrpc(struct servtab *sep)
 }
 
 static void
-flag_retry(int 

Re: svn commit: r315643 - head/usr.sbin/syslogd

2017-03-20 Thread Ngie Cooper (yaneurabeya)

> On Mar 20, 2017, at 10:46, Hiroki Sato  wrote:
> 
> Author: hrs
> Date: Mon Mar 20 17:46:33 2017
> New Revision: 315643
> URL: https://svnweb.freebsd.org/changeset/base/315643
> 
> Log:
>  Fix a regression which prevented an IPv6 address in a -b option from
>  working.
> 
>  PR:  217939
>  Differential Revision:   https://reviews.freebsd.org/D10064

Thank you very much — I’ll see if I can write tests for this and other things 
to avoid future regressions.
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r315643 - head/usr.sbin/syslogd

2017-03-20 Thread Hiroki Sato
Author: hrs
Date: Mon Mar 20 17:46:33 2017
New Revision: 315643
URL: https://svnweb.freebsd.org/changeset/base/315643

Log:
  Fix a regression which prevented an IPv6 address in a -b option from
  working.
  
  PR:   217939
  Differential Revision:https://reviews.freebsd.org/D10064

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Mon Mar 20 17:26:13 2017
(r315642)
+++ head/usr.sbin/syslogd/syslogd.c Mon Mar 20 17:46:33 2017
(r315643)
@@ -477,7 +477,15 @@ main(int argc, char *argv[])
break;
case 'b':
bflag = 1;
-   if ((p = strchr(optarg, ':')) == NULL) {
+   p = strchr(optarg, ']');
+   if (p != NULL)
+   p = strchr(p + 1, ':');
+   else {
+   p = strchr(optarg, ':');
+   if (p != NULL && strchr(p + 1, ':') != NULL)
+   p = NULL; /* backward compatibility */
+   }
+   if (p == NULL) {
/* A hostname or filename only. */
addpeer(&(struct peer){
.pe_name = optarg,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315642 - head/contrib/bsnmp/lib

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Mon Mar 20 17:26:13 2017
New Revision: 315642
URL: https://svnweb.freebsd.org/changeset/base/315642

Log:
  bsnmp: explicitly test the return value for open_client_{local,udp} in 
snmp_open(..)
  
  open_client_* returns -1 on failure; 0 on success. Ensure that the return 
value is
  0 -- otherwise exit snmp_open(..).
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/bsnmp/lib/snmpclient.c

Modified: head/contrib/bsnmp/lib/snmpclient.c
==
--- head/contrib/bsnmp/lib/snmpclient.c Mon Mar 20 17:17:54 2017
(r315641)
+++ head/contrib/bsnmp/lib/snmpclient.c Mon Mar 20 17:26:13 2017
(r315642)
@@ -1068,13 +1068,13 @@ snmp_open(const char *host, const char *
switch (snmp_client.trans) {
 
  case SNMP_TRANS_UDP:
-   if (open_client_udp(host, port))
+   if (open_client_udp(host, port) != 0)
return (-1);
break;
 
  case SNMP_TRANS_LOC_DGRAM:
  case SNMP_TRANS_LOC_STREAM:
-   if (open_client_local(host))
+   if (open_client_local(host) != 0)
return (-1);
break;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315641 - head/contrib/bsnmp/lib

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Mon Mar 20 17:17:54 2017
New Revision: 315641
URL: https://svnweb.freebsd.org/changeset/base/315641

Log:
  bsnmp: don't leak snmp_client.fd in open_client_udp(..) on connect(2) failure
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/bsnmp/lib/snmpclient.c

Modified: head/contrib/bsnmp/lib/snmpclient.c
==
--- head/contrib/bsnmp/lib/snmpclient.c Mon Mar 20 16:44:55 2017
(r315640)
+++ head/contrib/bsnmp/lib/snmpclient.c Mon Mar 20 17:17:54 2017
(r315641)
@@ -947,6 +947,8 @@ open_client_udp(const char *host, const 
if ((res = res->ai_next) == NULL) {
seterr(_client, "%s", strerror(errno));
freeaddrinfo(res0);
+   (void)close(snmp_client.fd);
+   snmp_client.fd = -1;
return (-1);
}
} else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315640 - in head: lib/libnetbsd usr.bin usr.bin/getaddrinfo

2017-03-20 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Mar 20 16:44:55 2017
New Revision: 315640
URL: https://svnweb.freebsd.org/changeset/base/315640

Log:
  Port the getaddrinfo(1) utility from NetBSD
  
  Submitted by: Lohith Bellad 
  Reviewed by:  hiren (earlier rev), ae
  Obtained from:NetBSD
  MFC after:1 week
  Relnotes: yes
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D9365

Added:
  head/lib/libnetbsd/sockaddr_snprintf.c   (contents, props changed)
  head/usr.bin/getaddrinfo/
  head/usr.bin/getaddrinfo/Makefile   (contents, props changed)
  head/usr.bin/getaddrinfo/getaddrinfo.1   (contents, props changed)
  head/usr.bin/getaddrinfo/getaddrinfo.c   (contents, props changed)
  head/usr.bin/getaddrinfo/tables.awk   (contents, props changed)
Modified:
  head/lib/libnetbsd/Makefile
  head/lib/libnetbsd/util.h
  head/usr.bin/Makefile

Modified: head/lib/libnetbsd/Makefile
==
--- head/lib/libnetbsd/Makefile Mon Mar 20 16:30:02 2017(r315639)
+++ head/lib/libnetbsd/Makefile Mon Mar 20 16:44:55 2017(r315640)
@@ -7,7 +7,7 @@ LIB=netbsd
 
 CFLAGS+=   -I${.CURDIR}
 
-SRCS+= strsuftoll.c util.c util.h
+SRCS+= sockaddr_snprintf.c strsuftoll.c util.c util.h
 
 INTERNALLIB=
 

Added: head/lib/libnetbsd/sockaddr_snprintf.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libnetbsd/sockaddr_snprintf.c  Mon Mar 20 16:44:55 2017
(r315640)
@@ -0,0 +1,317 @@
+/* $NetBSD: sockaddr_snprintf.c,v 1.14 2016/12/29 18:30:55 christos Exp $  
*/
+
+/*-
+ * Copyright (c) 2004, 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#ifdef HAVE_NET_IF_DL_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BSD4_4
+# define SALEN(sa) ((sa)->sa ## _len)
+#else
+# define SALEN(sa) ((unsigned)sizeof(*sa))
+#endif
+
+static int
+debug_in(char *str, size_t len, const struct sockaddr_in *sin)
+{
+   return snprintf(str, len, "sin_len=%u, sin_family=%u, sin_port=%u, "
+   "sin_addr.s_addr=%08x",
+   SALEN(sin), sin->sin_family, sin->sin_port,
+   sin->sin_addr.s_addr);
+}
+
+static int
+debug_in6(char *str, size_t len, const struct sockaddr_in6 *sin6)
+{
+   const uint8_t *s = sin6->sin6_addr.s6_addr;
+
+   return snprintf(str, len, "sin6_len=%u, sin6_family=%u, sin6_port=%u, "
+   "sin6_flowinfo=%u, "
+   "sin6_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:"
+   "%02x:%02x:%02x:%02x:%02x:%02x, sin6_scope_id=%u",
+   SALEN(sin6), sin6->sin6_family, sin6->sin6_port,
+   sin6->sin6_flowinfo, s[0x0], s[0x1], s[0x2], s[0x3], s[0x4], s[0x5],
+   s[0x6], s[0x7], s[0x8], s[0x9], s[0xa], s[0xb], s[0xc], s[0xd],
+   s[0xe], s[0xf], sin6->sin6_scope_id);
+}
+
+static int
+debug_un(char *str, size_t len, const struct sockaddr_un *sun)
+{
+   return snprintf(str, len, "sun_len=%u, sun_family=%u, sun_path=%*s",
+   SALEN(sun), sun->sun_family, (int)sizeof(sun->sun_path),
+   sun->sun_path);
+}
+
+#ifdef HAVE_NET_IF_DL_H
+static int
+debug_dl(char *str, size_t len, const struct sockaddr_dl *sdl)
+{
+   const uint8_t *s = (const void 

svn commit: r315639 - head/lib/libcam

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Mon Mar 20 16:30:02 2017
New Revision: 315639
URL: https://svnweb.freebsd.org/changeset/base/315639

Log:
  libcam: NULL out freed `ccb.cdm.matches` and `ccb.cdm.patterns` pointers
  
  This is being done to avoid potential double frees with the values.
  
  Differential Revision:D9970
  MFC after:1 week
  Reviewed by:  imp
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libcam/camlib.c

Modified: head/lib/libcam/camlib.c
==
--- head/lib/libcam/camlib.cMon Mar 20 14:17:00 2017(r315638)
+++ head/lib/libcam/camlib.cMon Mar 20 16:30:02 2017(r315639)
@@ -308,6 +308,7 @@ cam_open_btl(path_id_t path_id, target_i
snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
 "%s: couldn't malloc pattern buffer", func_name);
free(ccb.cdm.matches);
+   ccb.cdm.matches = NULL;
close(fd);
return(NULL);
}
@@ -371,7 +372,9 @@ cam_open_btl(path_id_t path_id, target_i
periph_result = [0].result.periph_result;
pass_unit = periph_result->unit_number;
free(ccb.cdm.matches);
+   ccb.cdm.matches = NULL;
free(ccb.cdm.patterns);
+   ccb.cdm.patterns = NULL;
close(fd);
sprintf(dev_path, "/dev/pass%d", pass_unit);
return(cam_real_open_device(dev_path, flags, device, NULL,
@@ -388,7 +391,9 @@ cam_open_btl(path_id_t path_id, target_i
 
 btl_bailout:
free(ccb.cdm.matches);
+   ccb.cdm.matches = NULL;
free(ccb.cdm.patterns);
+   ccb.cdm.patterns = NULL;
close(fd);
return(NULL);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315636 - in head: contrib/libarchive contrib/libarchive/cpio contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar contrib/libarchive/tar/test contrib...

2017-03-20 Thread Martin Matuska
Author: mm
Date: Mon Mar 20 13:02:27 2017
New Revision: 315636
URL: https://svnweb.freebsd.org/changeset/base/315636

Log:
  MFV r315633, 315635:
  
  Sync libarchive with vendor
  
  Vendor changes/bugfixes (FreeBSD-related):
PR 867 (bsdcpio): show numeric uid/gid when names are not found
PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
PR 880 (pax): Fix handling of "size" pax header keyword
PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
Break ACL read/write code into platform-specific source files
Unbreak static dependency on libbz2
  
  MFC after:1 week

Added:
  head/contrib/libarchive/libarchive/archive_acl_maps.h
 - copied, changed from r315633, 
vendor/libarchive/dist/libarchive/archive_acl_maps.h
  head/contrib/libarchive/libarchive/archive_acl_maps_freebsd.c
 - copied, changed from r315633, 
vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.c
  head/contrib/libarchive/libarchive/archive_platform_acl.h
 - copied unchanged from r315633, 
vendor/libarchive/dist/libarchive/archive_platform_acl.h
  head/contrib/libarchive/libarchive/archive_read_disk_acl_freebsd.c
 - copied unchanged from r315633, 
vendor/libarchive/dist/libarchive/archive_read_disk_acl_freebsd.c
  head/contrib/libarchive/libarchive/archive_version_details.c
 - copied unchanged from r315633, 
vendor/libarchive/dist/libarchive/archive_version_details.c
  head/contrib/libarchive/libarchive/archive_write_disk_acl_freebsd.c
 - copied unchanged from r315633, 
vendor/libarchive/dist/libarchive/archive_write_disk_acl_freebsd.c
Deleted:
  head/contrib/libarchive/libarchive/archive_write_disk_acl.c
Modified:
  head/contrib/libarchive/NEWS
  head/contrib/libarchive/cpio/cpio.c
  head/contrib/libarchive/libarchive/archive_entry.3
  head/contrib/libarchive/libarchive/archive_entry_acl.3
  head/contrib/libarchive/libarchive/archive_platform.h
  head/contrib/libarchive/libarchive/archive_random.c
  head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  head/contrib/libarchive/libarchive/archive_read_disk_private.h
  head/contrib/libarchive/libarchive/archive_read_open.3
  head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
  head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_zip.c
  head/contrib/libarchive/libarchive/archive_util.c
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/libarchive/archive_write_disk_private.h
  head/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c
  head/contrib/libarchive/libarchive/test/test_acl_platform_posix1e.c
  head/contrib/libarchive/tar/bsdtar.1
  head/contrib/libarchive/tar/test/test_option_acls.c
  head/contrib/libarchive/test_utils/test_common.h
  head/contrib/libarchive/test_utils/test_main.c
  head/lib/libarchive/Makefile
  head/lib/libarchive/config_freebsd.h
  head/usr.bin/bsdcat/tests/Makefile
  head/usr.bin/cpio/tests/Makefile
  head/usr.bin/tar/tests/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/NEWS
==
--- head/contrib/libarchive/NEWSMon Mar 20 11:55:03 2017
(r315635)
+++ head/contrib/libarchive/NEWSMon Mar 20 13:02:27 2017
(r315636)
@@ -1,3 +1,5 @@
+Mar 16, 2017: NFSv4 ACL support for Linux (librichacl)
+
 Feb 26, 2017: libarchive 3.3.1 released
 Security & Feature release
 
@@ -293,7 +295,7 @@ May 04, 2008: libarchive 2.5.3b released
* libarchive: Mark which entry strings are set; be accurate about
  distinguishing empty strings ("") from unset ones (NULL)
* tar: Don't crash reading entries with empty filenames
-   * libarchive_test, bsdtar_test, bsdcpio_test:  Better detaults:
+   * libarchive_test, bsdtar_test, bsdcpio_test:  Better defaults:
  run all tests, delete temp dirs, summarize repeated failures
* -no-undefined to libtool for Cygwin
* libarchive_test: Skip large file tests on systems with 32-bit off_t

Modified: head/contrib/libarchive/cpio/cpio.c
==
--- head/contrib/libarchive/cpio/cpio.c Mon Mar 20 11:55:03 2017
(r315635)
+++ head/contrib/libarchive/cpio/cpio.c Mon Mar 20 13:02:27 2017
(r315636)
@@ -1344,23 +1344,23 @@ lookup_name(struct cpio *cpio, struct na
cache->cache[slot].name = NULL;
}
 
-   if (lookup_fn(cpio, , id) == 0) {
-   if (name == NULL || name[0] == '\0') {
-   /* If lookup failed, format it as a number. */
-   snprintf(asnum, sizeof(asnum), "%u", (unsigned)id);
-   name = asnum;
-   }
-   

svn commit: r315635 - vendor/libarchive/dist/libarchive

2017-03-20 Thread Martin Matuska
Author: mm
Date: Mon Mar 20 11:55:03 2017
New Revision: 315635
URL: https://svnweb.freebsd.org/changeset/base/315635

Log:
  Update vendor/libarchive to git 3e37a9e051bb7674115ca1e262551a070a92283a
  
  Vendor changes:
Fix type in archive_read_open(3)
Always use extern keyword for shared constants in archive_acl_maps.h

Modified:
  vendor/libarchive/dist/libarchive/archive_acl_maps.h
  vendor/libarchive/dist/libarchive/archive_acl_maps_darwin.c
  vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.c
  vendor/libarchive/dist/libarchive/archive_acl_maps_linux.c
  vendor/libarchive/dist/libarchive/archive_acl_maps_sunos.c
  vendor/libarchive/dist/libarchive/archive_read_open.3

Modified: vendor/libarchive/dist/libarchive/archive_acl_maps.h
==
--- vendor/libarchive/dist/libarchive/archive_acl_maps.hMon Mar 20 
11:29:40 2017(r315634)
+++ vendor/libarchive/dist/libarchive/archive_acl_maps.hMon Mar 20 
11:55:03 2017(r315635)
@@ -37,7 +37,6 @@ typedef struct {
const int p_perm;   /* Platform permission or flag */
 } acl_perm_map_t;
 
-#ifndef _ARCHIVE_ACL_MAPS_DEFS
 #if ARCHIVE_ACL_POSIX1E
 extern const acl_perm_map_t acl_posix_perm_map[];
 extern const int acl_posix_perm_map_size;
@@ -48,5 +47,4 @@ extern const int acl_nfs4_perm_map_size;
 extern const acl_perm_map_t acl_nfs4_flag_map[];
 extern const int acl_nfs4_flag_map_size;
 #endif
-#endif /* !_ARCHIVE_ACL_MAPS_DEFS */
 #endif /* ARCHIVE_ACL_MAPS_H_INCLUDED */

Modified: vendor/libarchive/dist/libarchive/archive_acl_maps_darwin.c
==
--- vendor/libarchive/dist/libarchive/archive_acl_maps_darwin.c Mon Mar 20 
11:29:40 2017(r315634)
+++ vendor/libarchive/dist/libarchive/archive_acl_maps_darwin.c Mon Mar 20 
11:55:03 2017(r315635)
@@ -36,7 +36,6 @@
 #include "archive_entry.h"
 #include "archive_private.h"
 #include "archive_read_disk_private.h"
-#define _ARCHIVE_ACL_MAPS_DEFS
 #include "archive_acl_maps.h"
 
 const acl_perm_map_t acl_nfs4_perm_map[] = {

Modified: vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.c
==
--- vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.cMon Mar 
20 11:29:40 2017(r315634)
+++ vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.cMon Mar 
20 11:55:03 2017(r315635)
@@ -36,7 +36,6 @@
 #include "archive_entry.h"
 #include "archive_private.h"
 #include "archive_read_disk_private.h"
-#define _ARCHIVE_ACL_MAPS_DEFS
 #include "archive_acl_maps.h"
 
 const acl_perm_map_t acl_posix_perm_map[] = {

Modified: vendor/libarchive/dist/libarchive/archive_acl_maps_linux.c
==
--- vendor/libarchive/dist/libarchive/archive_acl_maps_linux.c  Mon Mar 20 
11:29:40 2017(r315634)
+++ vendor/libarchive/dist/libarchive/archive_acl_maps_linux.c  Mon Mar 20 
11:55:03 2017(r315635)
@@ -39,7 +39,6 @@
 #include "archive_entry.h"
 #include "archive_private.h"
 #include "archive_read_disk_private.h"
-#define _ARCHIVE_ACL_MAPS_DEFS
 #include "archive_acl_maps.h"
 
 #if ARCHIVE_ACL_LIBACL

Modified: vendor/libarchive/dist/libarchive/archive_acl_maps_sunos.c
==
--- vendor/libarchive/dist/libarchive/archive_acl_maps_sunos.c  Mon Mar 20 
11:29:40 2017(r315634)
+++ vendor/libarchive/dist/libarchive/archive_acl_maps_sunos.c  Mon Mar 20 
11:55:03 2017(r315635)
@@ -36,7 +36,6 @@
 #include "archive_entry.h"
 #include "archive_private.h"
 #include "archive_read_disk_private.h"
-#define _ARCHIVE_ACL_MAPS_DEFS
 #include "archive_acl_maps.h"
 
 const acl_perm_map_t acl_posix_perm_map[] = {

Modified: vendor/libarchive/dist/libarchive/archive_read_open.3
==
--- vendor/libarchive/dist/libarchive/archive_read_open.3   Mon Mar 20 
11:29:40 2017(r315634)
+++ vendor/libarchive/dist/libarchive/archive_read_open.3   Mon Mar 20 
11:55:03 2017(r315635)
@@ -67,7 +67,7 @@ Streaming Archive Library (libarchive, -
 .Fa "size_t block_size"
 .Fc
 .Ft int
-.Fn archive_read_open_memory "struct archive *" "void *buff" "size_t size"
+.Fn archive_read_open_memory "struct archive *" "const void *buff" "size_t 
size"
 .Sh DESCRIPTION
 .Bl -tag -compact -width indent
 .It Fn archive_read_open
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315633 - in vendor/libarchive/dist: . build/cmake cat/test cpio cpio/test libarchive libarchive/test tar tar/test test_utils

2017-03-20 Thread Martin Matuska
Author: mm
Date: Mon Mar 20 11:12:31 2017
New Revision: 315633
URL: https://svnweb.freebsd.org/changeset/base/315633

Log:
  Update vendor/libarchive to git 5881c9021a85668bd945593f5ba43a0d22c53d71
  
  Vendor changes (FreeBSD-related):
Break ACL read/write code into platform-specific source files
  
  Vendor bugfixes (FreeBSD-related):
PR 867 (bsdcpio): show numeric uid/gid when names are not found
PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
PR 880 (pax): Fix handling of "size" pax header keyword
PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
Unbreak static dependency on libbz2

Added:
  vendor/libarchive/dist/libarchive/archive_acl_maps.h   (contents, props 
changed)
  vendor/libarchive/dist/libarchive/archive_acl_maps_darwin.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_acl_maps_linux.c   (contents, props 
changed)
  vendor/libarchive/dist/libarchive/archive_acl_maps_sunos.c   (contents, props 
changed)
  vendor/libarchive/dist/libarchive/archive_platform_acl.h   (contents, props 
changed)
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_darwin.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_freebsd.c   
(contents, props changed)
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_linux.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_sunos.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_version_details.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_darwin.c   
(contents, props changed)
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_freebsd.c
 - copied, changed from r315632, 
vendor/libarchive/dist/libarchive/archive_write_disk_acl.c
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_linux.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_sunos.c   (contents, 
props changed)
Deleted:
  vendor/libarchive/dist/libarchive/archive_write_disk_acl.c
Modified:
  vendor/libarchive/dist/CMakeLists.txt
  vendor/libarchive/dist/Makefile.am
  vendor/libarchive/dist/NEWS
  vendor/libarchive/dist/build/cmake/config.h.in
  vendor/libarchive/dist/cat/test/CMakeLists.txt
  vendor/libarchive/dist/configure.ac
  vendor/libarchive/dist/cpio/cpio.c
  vendor/libarchive/dist/cpio/test/CMakeLists.txt
  vendor/libarchive/dist/libarchive/CMakeLists.txt
  vendor/libarchive/dist/libarchive/archive_entry.3
  vendor/libarchive/dist/libarchive/archive_entry_acl.3
  vendor/libarchive/dist/libarchive/archive_platform.h
  vendor/libarchive/dist/libarchive/archive_random.c
  vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c
  vendor/libarchive/dist/libarchive/archive_read_disk_private.h
  vendor/libarchive/dist/libarchive/archive_read_support_format_mtree.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c
  vendor/libarchive/dist/libarchive/archive_util.c
  vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
  vendor/libarchive/dist/libarchive/archive_write_disk_private.h
  vendor/libarchive/dist/libarchive/mtree.5
  vendor/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c
  vendor/libarchive/dist/libarchive/test/test_acl_platform_posix1e.c
  vendor/libarchive/dist/tar/bsdtar.1
  vendor/libarchive/dist/tar/test/CMakeLists.txt
  vendor/libarchive/dist/tar/test/test_option_acls.c
  vendor/libarchive/dist/test_utils/test_common.h
  vendor/libarchive/dist/test_utils/test_main.c

Modified: vendor/libarchive/dist/CMakeLists.txt
==
--- vendor/libarchive/dist/CMakeLists.txt   Mon Mar 20 10:48:10 2017
(r315632)
+++ vendor/libarchive/dist/CMakeLists.txt   Mon Mar 20 11:12:31 2017
(r315633)
@@ -602,6 +602,7 @@ LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE
 LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H)
 LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
 LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
+LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H)
 LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
 LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
 LA_CHECK_INCLUDE_FILE("sys/statfs.h" HAVE_SYS_STATFS_H)
@@ -619,6 +620,9 @@ LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WC
 LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
 IF(ENABLE_CNG)
   LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H)
+  IF(HAVE_BCRYPT_H)
+LIST(APPEND ADDITIONAL_LIBS "Bcrypt")
+  ENDIF(HAVE_BCRYPT_H)
 ELSE(ENABLE_CNG)
   UNSET(HAVE_BCRYPT_H CACHE)
 ENDIF(ENABLE_CNG)
@@ -1593,83 +1597,212 @@ ENDIF(ENABLE_XATTR)
 # which makes the following checks rather 

svn commit: r315625 - stable/10/sys/net

2017-03-20 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 20 08:16:05 2017
New Revision: 315625
URL: https://svnweb.freebsd.org/changeset/base/315625

Log:
  MFC r315192:
Ignore ifnet renaming in the bpf ifnet departure handler.
  
PR: 213015

Modified:
  stable/10/sys/net/bpf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/bpf.c
==
--- stable/10/sys/net/bpf.c Mon Mar 20 08:10:58 2017(r315624)
+++ stable/10/sys/net/bpf.c Mon Mar 20 08:16:05 2017(r315625)
@@ -2581,6 +2581,10 @@ bpf_ifdetach(void *arg __unused, struct 
struct bpf_if *bp, *bp_temp;
int nmatched = 0;
 
+   /* Ignore ifnet renaming. */
+   if (ifp->if_flags & IFF_RENAMING)
+   return;
+
BPF_LOCK();
/*
 * Find matching entries in free list.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315624 - stable/11/sys/net

2017-03-20 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 20 08:10:58 2017
New Revision: 315624
URL: https://svnweb.freebsd.org/changeset/base/315624

Log:
  MFC r315192:
Ignore ifnet renaming in the bpf ifnet departure handler.
  
PR: 213015

Modified:
  stable/11/sys/net/bpf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/bpf.c
==
--- stable/11/sys/net/bpf.c Mon Mar 20 08:10:35 2017(r315623)
+++ stable/11/sys/net/bpf.c Mon Mar 20 08:10:58 2017(r315624)
@@ -2678,6 +2678,10 @@ bpf_ifdetach(void *arg __unused, struct 
struct bpf_if *bp, *bp_temp;
int nmatched = 0;
 
+   /* Ignore ifnet renaming. */
+   if (ifp->if_flags & IFF_RENAMING)
+   return;
+
BPF_LOCK();
/*
 * Find matching entries in free list.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315623 - head/sys/dev/rtwn

2017-03-20 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 20 08:10:35 2017
New Revision: 315623
URL: https://svnweb.freebsd.org/changeset/base/315623

Log:
  rtwn: fix node id assignment.
  
  Do not assign new id if node is reused.
  
  Tested with RTL8821AU, HOSTAP mode + RTL8188EU, STA mode
  (with inactivity timeout == 90)

Modified:
  head/sys/dev/rtwn/if_rtwn.c

Modified: head/sys/dev/rtwn/if_rtwn.c
==
--- head/sys/dev/rtwn/if_rtwn.c Mon Mar 20 06:12:55 2017(r315622)
+++ head/sys/dev/rtwn/if_rtwn.c Mon Mar 20 08:10:35 2017(r315623)
@@ -1718,13 +1718,13 @@ rtwn_node_alloc(struct ieee80211vap *vap
 }
 
 static void
-rtwn_newassoc(struct ieee80211_node *ni, int isnew)
+rtwn_newassoc(struct ieee80211_node *ni, int isnew __unused)
 {
struct rtwn_softc *sc = ni->ni_ic->ic_softc;
struct rtwn_node *un = RTWN_NODE(ni);
int id;
 
-   if (!isnew)
+   if (un->id != RTWN_MACID_UNDEFINED)
return;
 
RTWN_NT_LOCK(sc);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r309933 - head/usr.sbin/syslogd

2017-03-20 Thread Ngie Cooper (yaneurabeya)

> On Mar 19, 2017, at 23:43, Ngie Cooper (yaneurabeya)  
> wrote:
> 
>> 
>> On Dec 12, 2016, at 11:33, Hiroki Sato  wrote:
>> 
>> Author: hrs
>> Date: Mon Dec 12 19:33:40 2016
>> New Revision: 309933
>> URL: https://svnweb.freebsd.org/changeset/base/309933
>> 
>> Log:
>> - Refactor listening socket list.  All of the listening sockets are
>>   now maintained in a single linked-list in a transport-independent manner.
>> - Use queue.h for linked-list structure.
>> - Use linked-list for AllowedPeers.
>> - Use getaddrinfo(8) even for Unix Domain sockets.
>> - Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
>> - Define fu_* macro for union f_un to shorten the member names.
>> - Remove an extra #include .
>> - Add "static" to non-exported symbols.
>> - !INET support is still incomplete but will be fixed later.
>> 
>> There is no functional change except for some minor debug messages.
> 
> Hello Hiroki-san,

「どうもすみません・・・佐藤さんと言ったはずですね。」


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r309933 - head/usr.sbin/syslogd

2017-03-20 Thread Ngie Cooper (yaneurabeya)

> On Dec 12, 2016, at 11:33, Hiroki Sato  wrote:
> 
> Author: hrs
> Date: Mon Dec 12 19:33:40 2016
> New Revision: 309933
> URL: https://svnweb.freebsd.org/changeset/base/309933
> 
> Log:
>  - Refactor listening socket list.  All of the listening sockets are
>now maintained in a single linked-list in a transport-independent manner.
>  - Use queue.h for linked-list structure.
>  - Use linked-list for AllowedPeers.
>  - Use getaddrinfo(8) even for Unix Domain sockets.
>  - Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
>  - Define fu_* macro for union f_un to shorten the member names.
>  - Remove an extra #include .
>  - Add "static" to non-exported symbols.
>  - !INET support is still incomplete but will be fixed later.
> 
>  There is no functional change except for some minor debug messages.

Hello Hiroki-san,
This change unfortunately breaks binding to IPv6 addresses, as 
discussed in this bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217939 
. If I can figure out how to make it work (soon), I’ll send out a CR with my 
proposed changes.
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r315622 - head/usr.sbin/syslogd

2017-03-20 Thread Ngie Cooper
Author: ngie
Date: Mon Mar 20 06:12:55 2017
New Revision: 315622
URL: https://svnweb.freebsd.org/changeset/base/315622

Log:
  syslogd: try to print out a more helpful message in socksetup(..) if/when
  getaddrinfo fails
  
  If the asprintf call fails, fall back to the old code (as a last ditch effort
  to provide the end-user with helpful output).
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Mon Mar 20 05:15:55 2017
(r315621)
+++ head/usr.sbin/syslogd/syslogd.c Mon Mar 20 06:12:55 2017
(r315622)
@@ -2907,8 +2907,17 @@ socksetup(struct peer *pe)
pe->pe_serv = "syslog";
error = getaddrinfo(pe->pe_name, pe->pe_serv, , );
if (error) {
-   logerror(gai_strerror(error));
+   char *msgbuf;
+
+   asprintf(, "getaddrinfo failed for %s%s: %s",
+   pe->pe_name == NULL ? "" : pe->pe_name, pe->pe_serv,
+   gai_strerror(error));
errno = 0;
+   if (msgbuf == NULL)
+   logerror(gai_strerror(error));
+   else
+   logerror(msgbuf);
+   free(msgbuf);
die(0);
}
for (res = res0; res != NULL; res = res->ai_next) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"