svn commit: r335792 - head/tests/sys/audit

2018-06-28 Thread Alan Somers
Author: asomers
Date: Fri Jun 29 04:52:27 2018
New Revision: 335792
URL: https://svnweb.freebsd.org/changeset/base/335792

Log:
  audit(4): add tests for several more administrative syscalls
  
  Includes ntp_adjtime, auditctl, acct, auditon, and clock_settime.  Includes
  quotactl, mount, nmount, swapon, and swapoff in failure mode only.  Success
  tests for those syscalls will follow.  Also includes reboot(2) in failure
  mode only.  That one can't be tested in success mode.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15898

Modified:
  head/tests/sys/audit/administrative.c

Modified: head/tests/sys/audit/administrative.c
==
--- head/tests/sys/audit/administrative.c   Fri Jun 29 04:46:15 2018
(r335791)
+++ head/tests/sys/audit/administrative.c   Fri Jun 29 04:52:27 2018
(r335792)
@@ -27,10 +27,21 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include "utils.h"
@@ -42,6 +53,7 @@ static struct pollfd fds[1];
 static char adregex[80];
 static const char *auclass = "ad";
 static const char *path = "fileforaudit";
+static const char *successreg = "fileforaudit.*return,success";
 
 
 ATF_TC_WITH_CLEANUP(settimeofday_success);
@@ -101,6 +113,60 @@ ATF_TC_CLEANUP(settimeofday_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(clock_settime_success);
+ATF_TC_HEAD(clock_settime_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "clock_settime(2) call");
+}
+
+ATF_TC_BODY(clock_settime_success, tc)
+{
+   pid = getpid();
+   snprintf(adregex, sizeof(adregex), "clock_settime.*%d.*success", pid);
+
+   struct timespec tp;
+   ATF_REQUIRE_EQ(0, clock_gettime(CLOCK_REALTIME, ));
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Setting the same time as obtained by clock_gettime(2) */
+   ATF_REQUIRE_EQ(0, clock_settime(CLOCK_REALTIME, ));
+   check_audit(fds, adregex, pipefd);
+}
+
+ATF_TC_CLEANUP(clock_settime_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(clock_settime_failure);
+ATF_TC_HEAD(clock_settime_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "clock_settime(2) call");
+}
+
+ATF_TC_BODY(clock_settime_failure, tc)
+{
+   pid = getpid();
+   snprintf(adregex, sizeof(adregex), "clock_settime.*%d.*failure", pid);
+
+   struct timespec tp;
+   ATF_REQUIRE_EQ(0, clock_gettime(CLOCK_MONOTONIC, ));
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: cannot use CLOCK_MONOTONIC to set the system time */
+   ATF_REQUIRE_EQ(-1, clock_settime(CLOCK_MONOTONIC, ));
+   check_audit(fds, adregex, pipefd);
+}
+
+ATF_TC_CLEANUP(clock_settime_failure, tc)
+{
+   cleanup();
+}
+
+
 ATF_TC_WITH_CLEANUP(adjtime_success);
 ATF_TC_HEAD(adjtime_success, tc)
 {
@@ -115,7 +181,7 @@ ATF_TC_BODY(adjtime_success, tc)
 
FILE *pipefd = setup(fds, auclass);
/* We don't want to change the system time, hence NULL */
-   ATF_REQUIRE_EQ(0, adjtime(NULL,NULL));
+   ATF_REQUIRE_EQ(0, adjtime(NULL, NULL));
check_audit(fds, adregex, pipefd);
 }
 
@@ -148,7 +214,55 @@ ATF_TC_CLEANUP(adjtime_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(ntp_adjtime_success);
+ATF_TC_HEAD(ntp_adjtime_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "ntp_adjtime(2) call");
+}
 
+ATF_TC_BODY(ntp_adjtime_success, tc)
+{
+   struct timex timebuff;
+   bzero(, sizeof(timebuff));
+
+   pid = getpid();
+   snprintf(adregex, sizeof(adregex), "ntp_adjtime.*%d.*success", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE(ntp_adjtime() != -1);
+   check_audit(fds, adregex, pipefd);
+}
+
+ATF_TC_CLEANUP(ntp_adjtime_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(ntp_adjtime_failure);
+ATF_TC_HEAD(ntp_adjtime_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "ntp_adjtime(2) call");
+}
+
+ATF_TC_BODY(ntp_adjtime_failure, tc)
+{
+   pid = getpid();
+   snprintf(adregex, sizeof(adregex), "ntp_adjtime.*%d.*failure", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, ntp_adjtime(NULL));
+   check_audit(fds, adregex, pipefd);
+}
+
+ATF_TC_CLEANUP(ntp_adjtime_failure, tc)
+{
+   cleanup();
+}
+
+
 ATF_TC_WITH_CLEANUP(nfs_getfh_success);
 ATF_TC_HEAD(nfs_getfh_success, tc)
 {
@@ -200,6 +314,188 @@ ATF_TC_CLEANUP(nfs_getfh_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(auditctl_success);
+ATF_TC_HEAD(auditctl_success, 

svn commit: r335791 - head/tests/sys/audit

2018-06-28 Thread Alan Somers
Author: asomers
Date: Fri Jun 29 04:46:15 2018
New Revision: 335791
URL: https://svnweb.freebsd.org/changeset/base/335791

Log:
  audit(4): add tests for setsid, wait4, wait6, and kill
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D16035

Modified:
  head/tests/sys/audit/process-control.c

Modified: head/tests/sys/audit/process-control.c
==
--- head/tests/sys/audit/process-control.c  Fri Jun 29 04:08:14 2018
(r335790)
+++ head/tests/sys/audit/process-control.c  Fri Jun 29 04:46:15 2018
(r335791)
@@ -38,6 +38,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -70,7 +71,6 @@ ATF_TC_BODY(fork_success, tc)
check_audit(fds, pcregex, pipefd);
else
_exit(0);
-
 }
 
 ATF_TC_CLEANUP(fork_success, tc)
@@ -102,7 +102,6 @@ ATF_TC_BODY(rfork_success, tc)
check_audit(fds, pcregex, pipefd);
else
_exit(0);
-
 }
 
 ATF_TC_CLEANUP(rfork_success, tc)
@@ -135,6 +134,163 @@ ATF_TC_CLEANUP(rfork_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(wait4_success);
+ATF_TC_HEAD(wait4_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "wait4(2) call");
+}
+
+ATF_TC_BODY(wait4_success, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "wait4.*%d.*return,success", pid);
+
+   ATF_REQUIRE((pid = fork()) != -1);
+   if (pid) {
+   FILE *pipefd = setup(fds, auclass);
+   /* wpid = -1 : Wait for any child process */
+   ATF_REQUIRE(wait4(-1, , 0, NULL) != -1);
+   check_audit(fds, pcregex, pipefd);
+   }
+   else
+   _exit(0);
+}
+
+ATF_TC_CLEANUP(wait4_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(wait4_failure);
+ATF_TC_HEAD(wait4_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "wait4(2) call");
+}
+
+ATF_TC_BODY(wait4_failure, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "wait4.*%d.*return,failure", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: No child process to wait for */
+   ATF_REQUIRE_EQ(-1, wait4(-1, NULL, 0, NULL));
+   check_audit(fds, pcregex, pipefd);
+}
+
+ATF_TC_CLEANUP(wait4_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(wait6_success);
+ATF_TC_HEAD(wait6_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "wait6(2) call");
+}
+
+ATF_TC_BODY(wait6_success, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "wait6.*%d.*return,success", pid);
+
+   ATF_REQUIRE((pid = fork()) != -1);
+   if (pid) {
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE(wait6(P_ALL, 0, , WEXITED, NULL,NULL) != -1);
+   check_audit(fds, pcregex, pipefd);
+   }
+   else
+   _exit(0);
+}
+
+ATF_TC_CLEANUP(wait6_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(wait6_failure);
+ATF_TC_HEAD(wait6_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "wait6(2) call");
+}
+
+ATF_TC_BODY(wait6_failure, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "wait6.*%d.*return,failure", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid argument */
+   ATF_REQUIRE_EQ(-1, wait6(0, 0, NULL, 0, NULL, NULL));
+   check_audit(fds, pcregex, pipefd);
+}
+
+ATF_TC_CLEANUP(wait6_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(kill_success);
+ATF_TC_HEAD(kill_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "kill(2) call");
+}
+
+ATF_TC_BODY(kill_success, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "kill.*%d.*return,success", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Don't send any signal to anyone, live in peace! */
+   ATF_REQUIRE_EQ(0, kill(0, 0));
+   check_audit(fds, pcregex, pipefd);
+}
+
+ATF_TC_CLEANUP(kill_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(kill_failure);
+ATF_TC_HEAD(kill_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "kill(2) call");
+}
+
+ATF_TC_BODY(kill_failure, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "kill.*%d.*return,failure", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   /*
+* Failure reason: Non existent process with PID '-2'
+* Note: '-1' is not 

svn commit: r335790 - head/sys/vm

2018-06-28 Thread Alan Cox
Author: alc
Date: Fri Jun 29 04:08:14 2018
New Revision: 335790
URL: https://svnweb.freebsd.org/changeset/base/335790

Log:
  Three changes to vm_phys_alloc_seg_contig():
  
  1. Optimize the order computation.
  
  2. Update the pool for all of the chunks that are removed from the free
 page lists, and not just the first chunk.
  
  3. Simplify the code for returning excess pages to the free page lists.
  
  Reviewed by:  Doug Moore 

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Fri Jun 29 01:06:47 2018(r335789)
+++ head/sys/vm/vm_phys.c   Fri Jun 29 04:08:14 2018(r335790)
@@ -1239,7 +1239,7 @@ vm_phys_alloc_seg_contig(struct vm_phys_seg *seg, u_lo
KASSERT(powerof2(boundary), ("boundary is not a power of 2"));
vm_domain_free_assert_locked(VM_DOMAIN(seg->domain));
/* Compute the queue that is the best fit for npages. */
-   for (order = 0; (1 << order) < npages; order++);
+   order = flsl(npages - 1);
/* Search for a run satisfying the specified conditions. */
size = npages << PAGE_SHIFT;
for (oind = min(order, VM_NFREEORDER - 1); oind < VM_NFREEORDER;
@@ -1297,14 +1297,12 @@ vm_phys_alloc_seg_contig(struct vm_phys_seg *seg, u_lo
 done:
for (m = m_ret; m < _ret[npages]; m = [1 << oind]) {
fl = (*seg->free_queues)[m->pool];
-   vm_freelist_rem(fl, m, m->order);
+   vm_freelist_rem(fl, m, oind);
+   if (m->pool != VM_FREEPOOL_DEFAULT)
+   vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind);
}
-   if (m_ret->pool != VM_FREEPOOL_DEFAULT)
-   vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m_ret, oind);
-   fl = (*seg->free_queues)[m_ret->pool];
-   vm_phys_split_pages(m_ret, oind, fl, order);
/* Return excess pages to the free lists. */
-   npages_end = roundup2(npages, 1 << imin(oind, order));
+   npages_end = roundup2(npages, 1 << oind);
if (npages < npages_end)
vm_phys_free_contig(_ret[npages], npages_end - npages);
return (m_ret);
___
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: r335787 - head/etc/rc.d

2018-06-28 Thread Cy Schubert
In message <201806282213.w5smdwta093...@repo.freebsd.org>, Ian Lepore 
writes:
> Author: ian
> Date: Thu Jun 28 22:13:32 2018
> New Revision: 335787
> URL: https://svnweb.freebsd.org/changeset/base/335787
>
> Log:
>   When being verbose about various leapfile versions, also mention expiration
> .
>   
>   The expiration date is actually more of a version number than the version
>   date, because expiration changes twice a year, whereas the version only
>   changes when actual leap second events occur (except in USNO leapfiles,
>   which inappropriately bump the version with every expiration date change).
>
> Modified:
>   head/etc/rc.d/ntpd
>
> Modified: head/etc/rc.d/ntpd
> =
> =
> --- head/etc/rc.d/ntpdThu Jun 28 22:05:29 2018(r335786)
> +++ head/etc/rc.d/ntpdThu Jun 28 22:13:32 2018(r335787)
> @@ -106,8 +106,8 @@ ntpd_needfetch_leapfile() {
>   ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile)
>   ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile)
>   ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
> - $verbose ntp_src_leapfile version is $ntp_ver_no_src
> - $verbose ntp_db_leapfile version is $ntp_ver_no_db
> + $verbose ntp_src_leapfile version is $ntp_ver_no_src expires $ntp_expir
> y_src
> + $verbose ntp_db_leapfile version is $ntp_ver_no_db expires $ntp_expiry_
> db
>  
>   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \
>"$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \
>

Thanks.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

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


___
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: r335786 - head/etc/rc.d

2018-06-28 Thread Cy Schubert
In message <201806282205.w5sm5t0c088...@repo.freebsd.org>, Ian Lepore 
writes:
> Author: ian
> Date: Thu Jun 28 22:05:29 2018
> New Revision: 335786
> URL: https://svnweb.freebsd.org/changeset/base/335786
>
> Log:
>   Rename variable ntp_tmp_leapfile to have a leading underbar, to distinguish
>   it from variables with similar names which are set in rc.conf.  This will
>   make more sense as the script grows more similar-name local variables in
>   some upcoming changes.
>
> Modified:
>   head/etc/rc.d/ntpd
>
> Modified: head/etc/rc.d/ntpd
> =
> =
> --- head/etc/rc.d/ntpdThu Jun 28 21:59:45 2018(r335785)
> +++ head/etc/rc.d/ntpdThu Jun 28 22:05:29 2018(r335786)
> @@ -20,7 +20,7 @@ fetch_cmd="ntpd_fetch_leapfile"
>  needfetch_cmd="ntpd_needfetch_leapfile"
>  start_precmd="ntpd_precmd"
>  
> -ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
> +_ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
>  
>  load_rc_config $name
>  
> @@ -56,7 +56,7 @@ ntpd_precmd()
>   ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
>   fi
>   ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
> - ln -fs "${ntpd_chrootdir}${ntp_tmp_leapfile}" ${ntp_tmp_leapfile}
> + ln -fs "${ntpd_chrootdir}${_ntp_tmp_leapfile}" ${_ntp_tmp_leapfile}
>  
>   #   Change run_rc_commands()'s internal copy of $ntpd_flags
>   #
> @@ -140,15 +140,15 @@ ntpd_fetch_leapfile() {
>   if ntpd_needfetch_leapfile ; then
>   for url in $ntp_leapfile_sources ; do
>   $verbose fetching $url
> - fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $ur
> l && break
> + fetch $ntp_leapfile_fetch_opts -o $_ntp_tmp_leapfile $u
> rl && break
>   done
> - ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile)
> - ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile)
> + ntp_ver_no_tmp=$(get_ntp_leapfile_ver $_ntp_tmp_leapfile)
> + ntp_expiry_tmp=$(get_ntp_leapfile_expiry $_ntp_tmp_leapfile)
>   if [ "$ntp_expiry_tmp" -gt "$ntp_expiry_db" -o \
>"$ntp_expiry_tmp" -eq "$ntp_expiry_db" -a \
>"$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then
>   $verbose using $url as $ntp_db_leapfile
> - mv -f $ntp_tmp_leapfile $ntp_db_leapfile ||
> + mv -f $_ntp_tmp_leapfile $ntp_db_leapfile ||
>   $verbose "warning: cannot replace $ntp_db_leapfile 
> (read-only fs?)"
>   else
>   $verbose using existing $ntp_db_leapfile
>

Thank you Ian.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

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


___
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: r335779 - in head/sys: arm/broadcom/bcm2835 conf

2018-06-28 Thread Emmanuel Vadot
On Thu, 28 Jun 2018 21:14:33 + (UTC)
Oleksandr Tymoshenko  wrote:

> Author: gonzo
> Date: Thu Jun 28 21:14:33 2018
> New Revision: 335779
> URL: https://svnweb.freebsd.org/changeset/base/335779
> 
> Log:
>   [rpi] Add SDHOST device driver for Raspberry Pi
>   
>   SDHOST is another SD controller that is present on Raspberry Pi (the
>   other one is SDHC and handled by bcm2835_sdhci driver). Both
>   controllers are capable of providing interface to SD card, actual
>   configuration can be set in dtb file. At the moment custom DTBs for
>   RPi/RPi2 have sdhost node disabled. On RPi3 sdhost is disabled in
>   snapshot images by applying mmc.dtbo overlay. To enalbe both devices
>   user has to edit config.txt on FAT partition and remove or comment
>   "dtoverlay=mmc" line.
>   
>   When no overlay applied on RPi3 SDHOST controls SD card and SDHC
>   interface can be used for SDIO. mmc.dtbo overlay disables SDHOST node
>   and switches SD card over to SDHC.  Likewise sdhost.dtbo overlay (not
>   currently included in snapshot image, but can be obtained from firmare
>   repo[1]) disabled SDHC node and switch SD card over to SDHOST.
>   
>   [1] https://github.com/raspberrypi/firmware/tree/master/boot/overlays
>   
>   Submitted by:   Klaus P. Ohrhallinger 
>   Differential Revision:  https://reviews.freebsd.org/D14168
> 
> Added:
>   head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c   (contents, props changed)
> Modified:
>   head/sys/arm/broadcom/bcm2835/files.bcm283x
>   head/sys/conf/files.arm64
> 

 Thanks !

 Note that if would be better to take overlays from the rpi-firmware
packages as it's where the dtb for the snapshot image is taken.

-- 
Emmanuel Vadot  
___
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: r335788 - head

2018-06-28 Thread Bryan Drewery
Author: bdrewery
Date: Thu Jun 28 22:24:16 2018
New Revision: 335788
URL: https://svnweb.freebsd.org/changeset/base/335788

Log:
  Fix unknown target check after r335450.
  
  X-MFC-with:   r335450
  Pointyhat to: bdrewery
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jun 28 22:13:32 2018(r335787)
+++ head/Makefile.inc1  Thu Jun 28 22:24:16 2018(r335788)
@@ -129,7 +129,41 @@ MACHINE_ABI?=  unknown
 
MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.0
 TARGET_ABI?=   unknown
 TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.0
+KNOWN_ARCHES?= aarch64/arm64 \
+   amd64 \
+   arm \
+   armeb/arm \
+   armv6/arm \
+   armv7/arm \
+   i386 \
+   mips \
+   mipsel/mips \
+   mips64el/mips \
+   mipsn32el/mips \
+   mips64/mips \
+   mipsn32/mips \
+   mipshf/mips \
+   mipselhf/mips \
+   mips64elhf/mips \
+   mips64hf/mips \
+   powerpc \
+   powerpc64/powerpc \
+   powerpcspe/powerpc \
+   riscv64/riscv \
+   riscv64sf/riscv \
+   sparc64
 
+.if ${TARGET} == ${TARGET_ARCH}
+_t=${TARGET}
+.else
+_t=${TARGET_ARCH}/${TARGET}
+.endif
+.for _t in ${_t}
+.if empty(KNOWN_ARCHES:M${_t})
+.error Unknown target ${TARGET_ARCH}:${TARGET}.
+.endif
+.endfor
+
 # If all targets are disabled for system llvm then don't expect it to work
 # for cross-builds.
 .if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \
@@ -524,41 +558,6 @@ EXTRA_REVISION=_${_BRANCH:C/.*-p([0-9]+$)/\1/}
 PKG_VERSION=   ${_REVISION}${EXTRA_REVISION}
 .endif
 .endif # !defined(_MKSHOWCONFIG)
-
-KNOWN_ARCHES?= aarch64/arm64 \
-   amd64 \
-   arm \
-   armeb/arm \
-   armv6/arm \
-   armv7/arm \
-   i386 \
-   mips \
-   mipsel/mips \
-   mips64el/mips \
-   mipsn32el/mips \
-   mips64/mips \
-   mipsn32/mips \
-   mipshf/mips \
-   mipselhf/mips \
-   mips64elhf/mips \
-   mips64hf/mips \
-   powerpc \
-   powerpc64/powerpc \
-   powerpcspe/powerpc \
-   riscv64/riscv \
-   riscv64sf/riscv \
-   sparc64
-
-.if ${TARGET} == ${TARGET_ARCH}
-_t=${TARGET}
-.else
-_t=${TARGET_ARCH}/${TARGET}
-.endif
-.for _t in ${_t}
-.if empty(KNOWN_ARCHES:M${_t})
-.error Unknown target ${TARGET_ARCH}:${TARGET}.
-.endif
-.endfor
 
 .if !defined(_MKSHOWCONFIG)
 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/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: r335787 - head/etc/rc.d

2018-06-28 Thread Ian Lepore
Author: ian
Date: Thu Jun 28 22:13:32 2018
New Revision: 335787
URL: https://svnweb.freebsd.org/changeset/base/335787

Log:
  When being verbose about various leapfile versions, also mention expiration.
  
  The expiration date is actually more of a version number than the version
  date, because expiration changes twice a year, whereas the version only
  changes when actual leap second events occur (except in USNO leapfiles,
  which inappropriately bump the version with every expiration date change).

Modified:
  head/etc/rc.d/ntpd

Modified: head/etc/rc.d/ntpd
==
--- head/etc/rc.d/ntpd  Thu Jun 28 22:05:29 2018(r335786)
+++ head/etc/rc.d/ntpd  Thu Jun 28 22:13:32 2018(r335787)
@@ -106,8 +106,8 @@ ntpd_needfetch_leapfile() {
ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile)
ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile)
ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
-   $verbose ntp_src_leapfile version is $ntp_ver_no_src
-   $verbose ntp_db_leapfile version is $ntp_ver_no_db
+   $verbose ntp_src_leapfile version is $ntp_ver_no_src expires 
$ntp_expiry_src
+   $verbose ntp_db_leapfile version is $ntp_ver_no_db expires 
$ntp_expiry_db
 
if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \
 "$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \
___
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: r335786 - head/etc/rc.d

2018-06-28 Thread Ian Lepore
Author: ian
Date: Thu Jun 28 22:05:29 2018
New Revision: 335786
URL: https://svnweb.freebsd.org/changeset/base/335786

Log:
  Rename variable ntp_tmp_leapfile to have a leading underbar, to distinguish
  it from variables with similar names which are set in rc.conf.  This will
  make more sense as the script grows more similar-name local variables in
  some upcoming changes.

Modified:
  head/etc/rc.d/ntpd

Modified: head/etc/rc.d/ntpd
==
--- head/etc/rc.d/ntpd  Thu Jun 28 21:59:45 2018(r335785)
+++ head/etc/rc.d/ntpd  Thu Jun 28 22:05:29 2018(r335786)
@@ -20,7 +20,7 @@ fetch_cmd="ntpd_fetch_leapfile"
 needfetch_cmd="ntpd_needfetch_leapfile"
 start_precmd="ntpd_precmd"
 
-ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
+_ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
 
 load_rc_config $name
 
@@ -56,7 +56,7 @@ ntpd_precmd()
( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
fi
ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
-   ln -fs "${ntpd_chrootdir}${ntp_tmp_leapfile}" ${ntp_tmp_leapfile}
+   ln -fs "${ntpd_chrootdir}${_ntp_tmp_leapfile}" ${_ntp_tmp_leapfile}
 
#   Change run_rc_commands()'s internal copy of $ntpd_flags
#
@@ -140,15 +140,15 @@ ntpd_fetch_leapfile() {
if ntpd_needfetch_leapfile ; then
for url in $ntp_leapfile_sources ; do
$verbose fetching $url
-   fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile 
$url && break
+   fetch $ntp_leapfile_fetch_opts -o $_ntp_tmp_leapfile 
$url && break
done
-   ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile)
-   ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile)
+   ntp_ver_no_tmp=$(get_ntp_leapfile_ver $_ntp_tmp_leapfile)
+   ntp_expiry_tmp=$(get_ntp_leapfile_expiry $_ntp_tmp_leapfile)
if [ "$ntp_expiry_tmp" -gt "$ntp_expiry_db" -o \
 "$ntp_expiry_tmp" -eq "$ntp_expiry_db" -a \
 "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then
$verbose using $url as $ntp_db_leapfile
-   mv -f $ntp_tmp_leapfile $ntp_db_leapfile ||
+   mv -f $_ntp_tmp_leapfile $ntp_db_leapfile ||
$verbose "warning: cannot replace $ntp_db_leapfile 
(read-only fs?)"
else
$verbose using existing $ntp_db_leapfile
___
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: r335785 - head/sys/dev/iwn

2018-06-28 Thread Eitan Adler
Author: eadler
Date: Thu Jun 28 21:59:45 2018
New Revision: 335785
URL: https://svnweb.freebsd.org/changeset/base/335785

Log:
  iwn: Correct Centrino Advanced-N 6235 constants
  
  The iwn 6235 is a 2x2 device (see
  https://ark.intel.com/products/66890/Intel-Centrino-Advanced-N-6235-Dual-Band)
  
  Reviewed by:  adrian, kevans
  Obtained from:Haiku

Modified:
  head/sys/dev/iwn/if_iwn_chip_cfg.h

Modified: head/sys/dev/iwn/if_iwn_chip_cfg.h
==
--- head/sys/dev/iwn/if_iwn_chip_cfg.h  Thu Jun 28 21:40:31 2018
(r335784)
+++ head/sys/dev/iwn/if_iwn_chip_cfg.h  Thu Jun 28 21:59:45 2018
(r335785)
@@ -382,8 +382,7 @@ static const struct iwn_base_params iwn_6235_base_para
| IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSET ),
.support_hostap = false,
.no_multi_vaps = true,
-   /* XXX 1x2? This NIC is 2x2, right? */
-   .additional_gp_drv_bit = IWN_GP_DRIVER_6050_1X2,
+   .additional_gp_drv_bit = 0,
.bt_mode = IWN_BT_ADVANCED,
.plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD,
 };
___
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: r335784 - head/sys/amd64/amd64

2018-06-28 Thread Mark Johnston
Author: markj
Date: Thu Jun 28 21:40:31 2018
New Revision: 335784
URL: https://svnweb.freebsd.org/changeset/base/335784

Log:
  Invalidate the mapping before updating its physical address.
  
  Doing so ensures that all threads sharing the pmap have a consistent
  view of the mapping.  This fixes the problem described in the commit
  log messages for r329254 without the overhead of an extra fault in the
  common case.  Once other pmap_enter() implementations are similarly
  modified, the workaround added in r329254 can be removed, reducing the
  overhead of CoW faults.
  
  With this change we can reuse the PV entry from the old mapping,
  potentially avoiding a call to reclaim_pv_chunk().  Otherwise, there is
  nothing preventing the old PV entry from being reclaimed.  In rare
  cases this could result in the PTE's page table page being freed,
  leading to a use-after-free of the page when the updated PTE is written
  following the allocation of the PV entry for the new mapping.
  
  Reported and tested by:   pho
  Reviewed by:  alc, kib
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D16005

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jun 28 21:27:34 2018(r335783)
+++ head/sys/amd64/amd64/pmap.c Thu Jun 28 21:40:31 2018(r335784)
@@ -4829,6 +4829,7 @@ retry:
panic("pmap_enter: invalid page directory va=%#lx", va);
 
origpte = *pte;
+   pv = NULL;
 
/*
 * Is the specified virtual address already mapped?
@@ -4870,6 +4871,43 @@ retry:
goto unchanged;
goto validate;
}
+
+   /*
+* The physical page has changed.  Temporarily invalidate
+* the mapping.  This ensures that all threads sharing the
+* pmap keep a consistent view of the mapping, which is
+* necessary for the correct handling of COW faults.  It
+* also permits reuse of the old mapping's PV entry,
+* avoiding an allocation.
+*
+* For consistency, handle unmanaged mappings the same way.
+*/
+   origpte = pte_load_clear(pte);
+   KASSERT((origpte & PG_FRAME) == opa,
+   ("pmap_enter: unexpected pa update for %#lx", va));
+   if ((origpte & PG_MANAGED) != 0) {
+   om = PHYS_TO_VM_PAGE(opa);
+
+   /*
+* The pmap lock is sufficient to synchronize with
+* concurrent calls to pmap_page_test_mappings() and
+* pmap_ts_referenced().
+*/
+   if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
+   vm_page_dirty(om);
+   if ((origpte & PG_A) != 0)
+   vm_page_aflag_set(om, PGA_REFERENCED);
+   CHANGE_PV_LIST_LOCK_TO_PHYS(, opa);
+   pv = pmap_pvh_remove(>md, pmap, va);
+   if ((om->aflags & PGA_WRITEABLE) != 0 &&
+   TAILQ_EMPTY(>md.pv_list) &&
+   ((om->flags & PG_FICTITIOUS) != 0 ||
+   TAILQ_EMPTY(_to_pvh(opa)->pv_list)))
+   vm_page_aflag_clear(om, PGA_WRITEABLE);
+   }
+   if ((origpte & PG_A) != 0)
+   pmap_invalidate_page(pmap, va);
+   origpte = 0;
} else {
/*
 * Increment the counters.
@@ -4883,8 +4921,10 @@ retry:
 * Enter on the PV list if part of our managed memory.
 */
if ((newpte & PG_MANAGED) != 0) {
-   pv = get_pv_entry(pmap, );
-   pv->pv_va = va;
+   if (pv == NULL) {
+   pv = get_pv_entry(pmap, );
+   pv->pv_va = va;
+   }
CHANGE_PV_LIST_LOCK_TO_PHYS(, pa);
TAILQ_INSERT_TAIL(>md.pv_list, pv, pv_next);
m->md.pv_gen++;
@@ -4898,25 +4938,10 @@ retry:
if ((origpte & PG_V) != 0) {
 validate:
origpte = pte_load_store(pte, newpte);
-   opa = origpte & PG_FRAME;
-   if (opa != pa) {
-   if ((origpte & PG_MANAGED) != 0) {
-   om = PHYS_TO_VM_PAGE(opa);
-   if ((origpte & (PG_M | PG_RW)) == (PG_M |
-   PG_RW))
-   vm_page_dirty(om);
-   if ((origpte & PG_A) != 0)
-   vm_page_aflag_set(om, PGA_REFERENCED);
-   

svn commit: r335783 - head/sys/mips/malta

2018-06-28 Thread John Baldwin
Author: jhb
Date: Thu Jun 28 21:27:34 2018
New Revision: 335783
URL: https://svnweb.freebsd.org/changeset/base/335783

Log:
  Support 2GB of memory on Malta systems with FreeBSD/mips.
  
  When 2GB of memory is enabled for QEMU's Malta emulation, the physical
  memory ends at an address of 2^32 - 1.  This causes an integer overflow
  to zero when computing the upper bound of the second phys_avail[] range.
  As a result, FreeBSD/mips kernels were only using the first 256MB of
  RAM and ignoring the remaining 1.75GB.  To work around this, truncate
  the extended memory size to 2GB minus one page for 32-bit mips kernels.
  
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D16027

Modified:
  head/sys/mips/malta/malta_machdep.c

Modified: head/sys/mips/malta/malta_machdep.c
==
--- head/sys/mips/malta/malta_machdep.c Thu Jun 28 21:26:14 2018
(r335782)
+++ head/sys/mips/malta/malta_machdep.c Thu Jun 28 21:27:34 2018
(r335783)
@@ -344,6 +344,15 @@ platform_start(__register_t a0, __register_t a1,  __re
printf("memsize = %llu (0x%08x)\n",
(unsigned long long) memsize, memsize);
printf("ememsize = %llu\n", (unsigned long long) ememsize);
+
+#ifdef __mips_o32
+   /*
+* For O32 phys_avail[] can't address memory beyond 2^32,
+* so cap extended memory to 2GB minus one page.
+*/
+   if (ememsize >= 2ULL * 1024 * 1024 * 1024)
+   ememsize = 2ULL * 1024 * 1024 * 1024 - PAGE_SIZE;
+#endif
}
 
/*
___
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: r335782 - head

2018-06-28 Thread John Baldwin
Author: jhb
Date: Thu Jun 28 21:26:14 2018
New Revision: 335782
URL: https://svnweb.freebsd.org/changeset/base/335782

Log:
  Remove the various build flag hacks for GCC cross-compile.
  
  The xtoolchain GCC packages have not required these flags since ports
  commits r465416 and r466701.  The in-tree GCC 4.2.1 has also been patched
  in r335716 and r335717 to correctly honor --sysroot when looking for
  includes and libraries.
  
  Reviewed by:  bdrewery
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D16055

Modified:
  head/Makefile.inc1
  head/Makefile.libcompat

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jun 28 21:23:05 2018(r335781)
+++ head/Makefile.inc1  Thu Jun 28 21:26:14 2018(r335782)
@@ -750,19 +750,6 @@ BFLAGS+=   -B${WORLDTMP}/usr/bin
 .endif
 .if ${WANT_COMPILER_TYPE} == gcc || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
-# GCC requires -isystem and -L when using a cross-compiler.  --sysroot
-# won't set header path and -L is used to ensure the base library path
-# is added before the port PREFIX library path.
-XCFLAGS+=  -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
-# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler
-# combined with --sysroot.
-XCFLAGS+=  -B${WORLDTMP}/usr/lib
-# Force using libc++ for external GCC.
-.if defined(X_COMPILER_TYPE) && \
-${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800
-XCXXFLAGS+=-isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \
-   -nostdinc++
-.endif
 .elif ${WANT_COMPILER_TYPE} == clang || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang)
 XCFLAGS+=  -target ${TARGET_TRIPLE}

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Thu Jun 28 21:23:05 2018(r335781)
+++ head/Makefile.libcompat Thu Jun 28 21:26:14 2018(r335782)
@@ -100,22 +100,6 @@ LIBCOMPATCFLAGS+=  ${LIBCOMPATCPUFLAGS} \
 # Clang/GCC.
 LIBCOMPATCFLAGS+=  -B${LIBCOMPATTMP}/usr/lib${libcompat}
 
-.if ${WANT_COMPILER_TYPE} == gcc || \
-(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
-# GCC requires -isystem when using a cross-compiler and --sysroot.  Note that
-# Makefile.inc1 only applies this with an external compiler but libcompat
-# always does since even in-tree GCC 4.2 needs this to override the built-in
-# sysroot path which --sysroot does not actually do for headers.
-LIBCOMPATCFLAGS+=  -isystem ${LIBCOMPATTMP}/usr/include
-# Force using libc++ for external GCC.
-.if defined(X_COMPILER_TYPE) && \
-${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 && \
-(${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no")
-LIBCOMPATCXXFLAGS+=-isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \
-   -nostdinc++
-.endif
-.endif
-
 # Yes, the flags are redundant.
 LIBCOMPATWMAKEENV+= \
INSTALL="sh ${.CURDIR}/tools/install.sh" \
___
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: r335781 - stable/10/contrib/smbfs/lib/smb

2018-06-28 Thread Brooks Davis
Author: brooks
Date: Thu Jun 28 21:23:05 2018
New Revision: 335781
URL: https://svnweb.freebsd.org/changeset/base/335781

Log:
  MFC r335641:
  
  Fix a stack overflow in mount_smbfs when hostname is too long.
  
  The local hostname was blindly copied into the to the nn_name array.
  When the hostname exceeded 16 bytes, it would overflow.  Truncate the
  hostname to 15 bytes plus a 0 terminator which is the "workstation name"
  suffix.
  
  Use defensive strlcpy() when filling nn_name in all cases.
  
  PR:   228354
  Reported by:  donald.buchh...@intel.com
  Reviewed by:  jpaetzel,  ian (prior version)
  Discussed with:   Security Officer (gtetlow)
  Security: Stack overflow with the hostname.
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D15936

Modified:
  stable/10/contrib/smbfs/lib/smb/ctx.c
  stable/10/contrib/smbfs/lib/smb/nbns_rq.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/smbfs/lib/smb/ctx.c
==
--- stable/10/contrib/smbfs/lib/smb/ctx.c   Thu Jun 28 21:16:50 2018
(r335780)
+++ stable/10/contrib/smbfs/lib/smb/ctx.c   Thu Jun 28 21:23:05 2018
(r335781)
@@ -549,7 +549,9 @@ smb_ctx_resolve(struct smb_ctx *ctx)
}
nn.nn_scope = ctx->ct_nb->nb_scope;
nn.nn_type = NBT_SERVER;
-   strcpy(nn.nn_name, ssn->ioc_srvname);
+   if (strlen(ssn->ioc_srvname) > NB_NAMELEN)
+   return NBERROR(NBERR_NAMETOOLONG);
+   strlcpy(nn.nn_name, ssn->ioc_srvname, sizeof(nn.nn_name));
error = nb_sockaddr(sap, , );
nb_snbfree(sap);
if (error) {
@@ -565,7 +567,11 @@ smb_ctx_resolve(struct smb_ctx *ctx)
}
nls_str_upper(ctx->ct_locname, ctx->ct_locname);
}
-   strcpy(nn.nn_name, ctx->ct_locname);
+   /*
+* Truncate the local host name to NB_NAMELEN-1 which gives a
+* suffix of 0 which is "workstation name".
+*/
+   strlcpy(nn.nn_name, ctx->ct_locname, NB_NAMELEN);
nn.nn_type = NBT_WKSTA;
nn.nn_scope = ctx->ct_nb->nb_scope;
error = nb_sockaddr(NULL, , );

Modified: stable/10/contrib/smbfs/lib/smb/nbns_rq.c
==
--- stable/10/contrib/smbfs/lib/smb/nbns_rq.c   Thu Jun 28 21:16:50 2018
(r335780)
+++ stable/10/contrib/smbfs/lib/smb/nbns_rq.c   Thu Jun 28 21:23:05 2018
(r335781)
@@ -74,7 +74,7 @@ nbns_resolvename(const char *name, struct nb_ctx *ctx,
if (error)
return error;
bzero(, sizeof(nn));
-   strcpy(nn.nn_name, name);
+   strlcpy(nn.nn_name, name, sizeof(nn.nn_name));
nn.nn_scope = ctx->nb_scope;
nn.nn_type = NBT_SERVER;
rqp->nr_nmflags = NBNS_NMFLAG_RD;
___
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: r335779 - in head/sys: arm/broadcom/bcm2835 conf

2018-06-28 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jun 28 21:14:33 2018
New Revision: 335779
URL: https://svnweb.freebsd.org/changeset/base/335779

Log:
  [rpi] Add SDHOST device driver for Raspberry Pi
  
  SDHOST is another SD controller that is present on Raspberry Pi (the
  other one is SDHC and handled by bcm2835_sdhci driver). Both
  controllers are capable of providing interface to SD card, actual
  configuration can be set in dtb file. At the moment custom DTBs for
  RPi/RPi2 have sdhost node disabled. On RPi3 sdhost is disabled in
  snapshot images by applying mmc.dtbo overlay. To enalbe both devices
  user has to edit config.txt on FAT partition and remove or comment
  "dtoverlay=mmc" line.
  
  When no overlay applied on RPi3 SDHOST controls SD card and SDHC
  interface can be used for SDIO. mmc.dtbo overlay disables SDHOST node
  and switches SD card over to SDHC.  Likewise sdhost.dtbo overlay (not
  currently included in snapshot image, but can be obtained from firmare
  repo[1]) disabled SDHC node and switch SD card over to SDHOST.
  
  [1] https://github.com/raspberrypi/firmware/tree/master/boot/overlays
  
  Submitted by: Klaus P. Ohrhallinger 
  Differential Revision:https://reviews.freebsd.org/D14168

Added:
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c   (contents, props changed)
Modified:
  head/sys/arm/broadcom/bcm2835/files.bcm283x
  head/sys/conf/files.arm64

Added: head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c  Thu Jun 28 21:14:33 
2018(r335779)
@@ -0,0 +1,1301 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 Klaus P. Ohrhallinger 
+ * All rights reserved.
+ *
+ * Based on bcm2835_sdhci.c:
+ * Copyright (c) 2012 Oleksandr Tymoshenko 
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ */
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * pin 48-53 - card slot
+ * pin 34-39 - radio module
+ *
+ * alt-0 - rubbish SDHCI  (0x7e202000) aka sdhost
+ * alt-3 - advanced SDHCI (0x7e30) aka sdhci/mmc/sdio
+ *
+ * driving card slot with mmc:
+ *
+ * sdhost_pins {
+ * brcm,pins = <0x30 0x31 0x32 0x33 0x34 0x35>;
+ * brcm,function = <0x7>;
+ * brcm,pull = <0x0 0x2 0x2 0x2 0x2 0x2>;
+ * phandle = <0x17>;
+ * };
+ * sdio_pins {
+ * brcm,pins = <0x22 0x23 0x24 0x25 0x26 0x27>;
+ * brcm,function = <0x4>;
+ * brcm,pull = <0x0 0x2 0x2 0x2 0x2 0x2>;
+ * phandle = <0x18>;
+ * };
+ *
+ * driving card slot with sdhost:
+ *
+ * sdhost_pins {
+ * brcm,pins = <0x30 0x31 0x32 0x33 0x34 0x35>;
+ * brcm,function = <0x4>;
+ * brcm,pull = <0x0 0x2 0x2 0x2 0x2 0x2>;
+ * phandle = <0x17>;
+ * };
+ * sdio_pins {
+ * brcm,pins = <0x22 0x23 0x24 0x25 0x26 0x27>;
+ * brcm,function = <0x7>;
+ * brcm,pull = <0x0 0x2 0x2 0x2 0x2 0x2>;
+ * phandle = <0x18>;
+ * };
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "mmcbr_if.h"
+#include "sdhci_if.h"
+
+#include "opt_mmccam.h"
+
+#include "bcm2835_dma.h"
+#include 
+#include "bcm2835_vcbus.h"
+
+
+/* #define SDHOST_DEBUG */
+
+
+/* Registers */
+#define HC_COMMAND 0x00/* Command and flags */
+#define HC_ARGUMENT0x04
+#define HC_TIMEOUTCOUNTER  0x08
+#define HC_CLOCKDIVISOR0x0c
+#define HC_RESPONSE_0  0x10
+#define 

Re: svn commit: r335765 - head/sys/sys

2018-06-28 Thread David A. Bright
On 06/28/2018 01:45 PM, Justin Hibbits wrote:

>> Author: dab
>> Date: Thu Jun 28 17:01:04 2018
>> New Revision: 335765

> 
> This breaks gcc builds, with the following errors:

Fixed in r335776.

Thanks to cem@ for a suggested fix (and to others that also suggested
alternative fixes) and to jhibbits@ for verifying the fix.


-- 
David Bright
d...@freebsd.org
___
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: r335776 - head/sys/sys

2018-06-28 Thread David Bright
Author: dab
Date: Thu Jun 28 20:37:17 2018
New Revision: 335776
URL: https://svnweb.freebsd.org/changeset/base/335776

Log:
  Fix compilation error in r335765 under gcc 4.2.1.
  
  The anonymous object initialization introduced in r335765 was
  acceptable to clang, but not gcc 4.2.1. Fix it for both.
  
  Reported by:  jhibbits@
  Pointy Hat:   myself
  MFC after:1 week
  X-MFC-with:   r335765
  Sponsored by: Dell EMC

Modified:
  head/sys/sys/event.h

Modified: head/sys/sys/event.h
==
--- head/sys/sys/event.hThu Jun 28 20:36:21 2018(r335775)
+++ head/sys/sys/event.hThu Jun 28 20:37:17 2018(r335776)
@@ -58,10 +58,7 @@
.fflags = (d),  \
.data = (e),\
.udata = (f),   \
-   .ext[0] = 0,\
-   .ext[1] = 0,\
-   .ext[2] = 0,\
-   .ext[3] = 0,\
+   .ext = {0}, \
 }; \
 } while(0)
 #else /* Pre-C99 or not STDC (e.g., C++) */
___
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: r335775 - head/sys/arm64/linux

2018-06-28 Thread Ed Maste
Author: emaste
Date: Thu Jun 28 20:36:21 2018
New Revision: 335775
URL: https://svnweb.freebsd.org/changeset/base/335775

Log:
  Add stub arm64 linuxulator VDSO ldscript
  
  This needs to be revisited with the VDSO implementation, but is
  sufficient to allow the linux64 module to build on arm64 for testing
  and development.
  
  Sponsored by: Turing Robotic Industries

Added:
  head/sys/arm64/linux/linux_vdso.lds.s   (contents, props changed)

Added: head/sys/arm64/linux/linux_vdso.lds.s
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/linux/linux_vdso.lds.s   Thu Jun 28 20:36:21 2018
(r335775)
@@ -0,0 +1,22 @@
+/*
+ * Stub arm64 vdso linker script.
+ * LINUXTODO: update along with VDSO implementation
+ *
+ * $FreeBSD$
+ */
+
+SECTIONS
+{
+   . = . + SIZEOF_HEADERS;
+   .text   : { *(.text*) }
+   .rodata : { *(.rodata*) }
+   .hash   : { *(.hash) }
+   .gnu.hash   : { *(.gnu.hash) }
+   .dynsym : { *(.dynsym) }
+   .dynstr : { *(.dynstr) }
+   .gnu.version: { *(.gnu.version) }
+   .gnu.version_d  : { *(.gnu.version_d) }
+   .gnu.version_r  : { *(.gnu.version_r) }
+   .data   : { *(.data*) }
+   .dynamic: { *(.dynamic) }
+}
___
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: r335774 - stable/11/contrib/smbfs/lib/smb

2018-06-28 Thread Brooks Davis
Author: brooks
Date: Thu Jun 28 20:33:12 2018
New Revision: 335774
URL: https://svnweb.freebsd.org/changeset/base/335774

Log:
  MFC r335641:
  
  Fix a stack overflow in mount_smbfs when hostname is too long.
  
  The local hostname was blindly copied into the to the nn_name array.
  When the hostname exceeded 16 bytes, it would overflow.  Truncate the
  hostname to 15 bytes plus a 0 terminator which is the "workstation name"
  suffix.
  
  Use defensive strlcpy() when filling nn_name in all cases.
  
  PR:   228354
  Reported by:  donald.buchh...@intel.com
  Reviewed by:  jpaetzel,  ian (prior version)
  Discussed with:   Security Officer (gtetlow)
  Security: Stack overflow with the hostname.
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D15936

Modified:
  stable/11/contrib/smbfs/lib/smb/ctx.c
  stable/11/contrib/smbfs/lib/smb/nbns_rq.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/smbfs/lib/smb/ctx.c
==
--- stable/11/contrib/smbfs/lib/smb/ctx.c   Thu Jun 28 19:42:10 2018
(r335773)
+++ stable/11/contrib/smbfs/lib/smb/ctx.c   Thu Jun 28 20:33:12 2018
(r335774)
@@ -549,7 +549,9 @@ smb_ctx_resolve(struct smb_ctx *ctx)
}
nn.nn_scope = ctx->ct_nb->nb_scope;
nn.nn_type = NBT_SERVER;
-   strcpy(nn.nn_name, ssn->ioc_srvname);
+   if (strlen(ssn->ioc_srvname) > NB_NAMELEN)
+   return NBERROR(NBERR_NAMETOOLONG);
+   strlcpy(nn.nn_name, ssn->ioc_srvname, sizeof(nn.nn_name));
error = nb_sockaddr(sap, , );
nb_snbfree(sap);
if (error) {
@@ -565,7 +567,11 @@ smb_ctx_resolve(struct smb_ctx *ctx)
}
nls_str_upper(ctx->ct_locname, ctx->ct_locname);
}
-   strcpy(nn.nn_name, ctx->ct_locname);
+   /*
+* Truncate the local host name to NB_NAMELEN-1 which gives a
+* suffix of 0 which is "workstation name".
+*/
+   strlcpy(nn.nn_name, ctx->ct_locname, NB_NAMELEN);
nn.nn_type = NBT_WKSTA;
nn.nn_scope = ctx->ct_nb->nb_scope;
error = nb_sockaddr(NULL, , );

Modified: stable/11/contrib/smbfs/lib/smb/nbns_rq.c
==
--- stable/11/contrib/smbfs/lib/smb/nbns_rq.c   Thu Jun 28 19:42:10 2018
(r335773)
+++ stable/11/contrib/smbfs/lib/smb/nbns_rq.c   Thu Jun 28 20:33:12 2018
(r335774)
@@ -74,7 +74,7 @@ nbns_resolvename(const char *name, struct nb_ctx *ctx,
if (error)
return error;
bzero(, sizeof(nn));
-   strcpy(nn.nn_name, name);
+   strlcpy(nn.nn_name, name, sizeof(nn.nn_name));
nn.nn_scope = ctx->nb_scope;
nn.nn_type = NBT_SERVER;
rqp->nr_nmflags = NBNS_NMFLAG_RD;
___
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: r335765 - head/sys/sys

2018-06-28 Thread Ed Schouten
2018-06-28 21:09 GMT+02:00 Conrad Meyer :
> I think the right initializer is something like:
>
> *(kevp_) = (struct kevent) {
> ...
> .ext = {
>   [0] = 0,
>   [1] = 0,
> ...
> },
> };

The nice thing about using an inline function is that you can get rid
of the compound literal:

static __inline void
EV_SET(struct kevent *kevp, ...)
{
struct kevent kev = {
// initializer goes here.
};
*kevp = kev;
}

This should even work with C89 compilers, assuming 
provides some smartness for __inline.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
___
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: r335773 - head/stand/efi/boot1

2018-06-28 Thread Warner Losh
Author: imp
Date: Thu Jun 28 19:42:10 2018
New Revision: 335773
URL: https://svnweb.freebsd.org/changeset/base/335773

Log:
  Revert preference to be an int.
  
  While in base we use it as a boolean (of the wrong spelling), there's
  at least one out of tree user that needs it to be int since priorirty
  is a small int, not a 0/1. In deference to the time it's wasted me and
  my team, push this up into FreeBSD for whatever short life boot1 may
  have in the tree.

Modified:
  head/stand/efi/boot1/boot_module.h

Modified: head/stand/efi/boot1/boot_module.h
==
--- head/stand/efi/boot1/boot_module.h  Thu Jun 28 19:42:05 2018
(r335772)
+++ head/stand/efi/boot1/boot_module.h  Thu Jun 28 19:42:10 2018
(r335773)
@@ -51,7 +51,7 @@ typedef struct dev_info
EFI_HANDLE *devhandle;
void *devdata;
uint64_t partoff;
-   BOOLEAN preferred;
+   int preferred;
struct dev_info *next;
 } dev_info_t;
 
___
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: r335765 - head/sys/sys

2018-06-28 Thread Conrad Meyer
I think the right initializer is something like:

*(kevp_) = (struct kevent) {
...
.ext = {
  [0] = 0,
  [1] = 0,
...
},
};

(I.e., use a C99 array static initializer to initialize the array
member of struct kevent.)

Best,
Conrad

On Thu, Jun 28, 2018 at 11:45 AM, Justin Hibbits  wrote:
> Hi David,
>
> On Thu, Jun 28, 2018 at 12:01 PM David Bright  wrote:
>>
>> Author: dab
>> Date: Thu Jun 28 17:01:04 2018
>> New Revision: 335765
>> URL: https://svnweb.freebsd.org/changeset/base/335765
>>
>> Log:
>>   Remove potential identifier conflict in the EV_SET macro.
>>
>>   PR43905 pointed out a problem with the EV_SET macro if the passed
>>   struct kevent pointer were specified with an expression with side
>>   effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
>>   local block that defined an internal variable (named "kevp") to get
>>   the pointer value once. This worked, but could cause issues if an
>>   existing variable named "kevp" is in scope. To avoid that issue,
>>   jilles@ pointed out that "C99 compound literals and designated
>>   initializers allow doing this cleanly using a macro". This change
>>   incorporates that suggestion, essentially verbatim from jilles@
>>   comment on PR43905, except retaining the old definition for pre-C99 or
>>   non-STDC (e.g., C++) compilers.
>>
>>   PR:   43905
>>   Submitted by: Jilles Tjoelker (jilles@)
>>   Reported by:  Lamont Granquist 
>>   Reviewed by:  jmg (no comments), jilles
>>   MFC after:1 week
>>   Sponsored by: Dell EMC
>>   Differential Revision:
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905
>>
>> Modified:
>>   head/sys/sys/event.h
>>
>> Modified: head/sys/sys/event.h
>> ==
>> --- head/sys/sys/event.hThu Jun 28 15:30:51 2018(r335764)
>> +++ head/sys/sys/event.hThu Jun 28 17:01:04 2018(r335765)
>> @@ -49,7 +49,26 @@
>>  #define EVFILT_EMPTY   (-13)   /* empty send socket buf */
>>  #define EVFILT_SYSCOUNT13
>>
>> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
>>  #define EV_SET(kevp_, a, b, c, d, e, f) do {   \
>> +*(kevp_) = (struct kevent){\
>> +   .ident = (a),   \
>> +   .filter = (b),  \
>> +   .flags = (c),   \
>> +   .fflags = (d),  \
>> +   .data = (e),\
>> +   .udata = (f),   \
>> +   .ext[0] = 0,\
>> +   .ext[1] = 0,\
>> +   .ext[2] = 0,\
>> +   .ext[3] = 0,\
>> +}; \
>> +} while(0)
>> +#else /* Pre-C99 or not STDC (e.g., C++) */
>> +/* The definition of the local variable kevp could possibly conflict
>> + * with a user-defined value passed in parameters a-f.
>> + */
>> +#define EV_SET(kevp_, a, b, c, d, e, f) do {   \
>> struct kevent *kevp = (kevp_);  \
>> (kevp)->ident = (a);\
>> (kevp)->filter = (b);   \
>> @@ -62,6 +81,7 @@
>> (kevp)->ext[2] = 0; \
>> (kevp)->ext[3] = 0; \
>>  } while(0)
>> +#endif
>>
>>  struct kevent {
>> __uintptr_t ident;  /* identifier for this event */
>>
>
> This breaks gcc builds, with the following errors:
>
> 18:02:13 /usr/src/bin/pwait/pwait.c: In function 'main':
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
> for '(anonymous).ext')
>
> This can be seen in the tinderbox (https://ci.freebsd.org/tinderbox)
>
> I encountered this as a failure in building usr.sbin/camdd, which
> shows the same type of error.
>
> - Justin
>
___
svn-src-all@freebsd.org mailing list

Re: svn commit: r335765 - head/sys/sys

2018-06-28 Thread Ed Schouten
Hi David,

2018-06-28 19:01 GMT+02:00 David Bright :
> +#define EV_SET(kevp_, a, b, c, d, e, f) do {   \

Some time ago I also looked into this and realised that it may even be
possible to do something like this:

static __inline void
EV_SET(...)
{
}

/* Compatibility for code that tests #ifdef EV_SET. */
#define EV_SET EV_SET

This has the advantage that you get pretty neat error messages in case
you get the typing of arguments wrong, as if you're just calling a
function incorrectly. The EV_SET() macro is never used in contexts
that require constant values.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
___
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: r335765 - head/sys/sys

2018-06-28 Thread David A. Bright
On 06/28/2018 02:04 PM, Bryan Drewery wrote:
> On 6/28/2018 11:45 AM, Justin Hibbits wrote:
>> Hi David,

>> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
>> overwritten
>> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
>> for '(anonymous).ext')
>>
>> This can be seen in the tinderbox (https://ci.freebsd.org/tinderbox)
> 
> I think in this case it may break ports and other external builds too.
> If possible please try to fix the macro to avoid the issue. I didn't
> analyze it to see if it is feasible though.

I'm looking at this. I'm a bit perplexed by the diagnostic but would
like to figure out a fix. If I can't soon I'll revert.

-- 
David Bright
d...@freebsd.org
___
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: r335765 - head/sys/sys

2018-06-28 Thread Bryan Drewery
On 6/28/2018 11:45 AM, Justin Hibbits wrote:
> Hi David,
> 
> On Thu, Jun 28, 2018 at 12:01 PM David Bright  wrote:
>>
>> Author: dab
>> Date: Thu Jun 28 17:01:04 2018
>> New Revision: 335765
>> URL: https://svnweb.freebsd.org/changeset/base/335765
>>
>> Log:
>>   Remove potential identifier conflict in the EV_SET macro.
>>
>>   PR43905 pointed out a problem with the EV_SET macro if the passed
>>   struct kevent pointer were specified with an expression with side
>>   effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
>>   local block that defined an internal variable (named "kevp") to get
>>   the pointer value once. This worked, but could cause issues if an
>>   existing variable named "kevp" is in scope. To avoid that issue,
>>   jilles@ pointed out that "C99 compound literals and designated
>>   initializers allow doing this cleanly using a macro". This change
>>   incorporates that suggestion, essentially verbatim from jilles@
>>   comment on PR43905, except retaining the old definition for pre-C99 or
>>   non-STDC (e.g., C++) compilers.
>>
>>   PR:   43905
>>   Submitted by: Jilles Tjoelker (jilles@)
>>   Reported by:  Lamont Granquist 
>>   Reviewed by:  jmg (no comments), jilles
>>   MFC after:1 week
>>   Sponsored by: Dell EMC
>>   Differential Revision:
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905
>>
>> Modified:
>>   head/sys/sys/event.h
>>
>> Modified: head/sys/sys/event.h
>> ==
>> --- head/sys/sys/event.hThu Jun 28 15:30:51 2018(r335764)
>> +++ head/sys/sys/event.hThu Jun 28 17:01:04 2018(r335765)
>> @@ -49,7 +49,26 @@
>>  #define EVFILT_EMPTY   (-13)   /* empty send socket buf */
>>  #define EVFILT_SYSCOUNT13
>>
>> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
>>  #define EV_SET(kevp_, a, b, c, d, e, f) do {   \
>> +*(kevp_) = (struct kevent){\
>> +   .ident = (a),   \
>> +   .filter = (b),  \
>> +   .flags = (c),   \
>> +   .fflags = (d),  \
>> +   .data = (e),\
>> +   .udata = (f),   \
>> +   .ext[0] = 0,\
>> +   .ext[1] = 0,\
>> +   .ext[2] = 0,\
>> +   .ext[3] = 0,\
>> +}; \
>> +} while(0)
>> +#else /* Pre-C99 or not STDC (e.g., C++) */
>> +/* The definition of the local variable kevp could possibly conflict
>> + * with a user-defined value passed in parameters a-f.
>> + */
>> +#define EV_SET(kevp_, a, b, c, d, e, f) do {   \
>> struct kevent *kevp = (kevp_);  \
>> (kevp)->ident = (a);\
>> (kevp)->filter = (b);   \
>> @@ -62,6 +81,7 @@
>> (kevp)->ext[2] = 0; \
>> (kevp)->ext[3] = 0; \
>>  } while(0)
>> +#endif
>>
>>  struct kevent {
>> __uintptr_t ident;  /* identifier for this event */
>>
> 
> This breaks gcc builds, with the following errors:
> 
> 18:02:13 /usr/src/bin/pwait/pwait.c: In function 'main':
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
> for '(anonymous).ext')
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field 
> overwritten
> 18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
> for '(anonymous).ext')
> 
> This can be seen in the tinderbox (https://ci.freebsd.org/tinderbox)
> 
> I encountered this as a failure in building usr.sbin/camdd, which
> shows the same type of error.

I think in this case it may break ports and other external builds too.
If possible please try to fix the macro to avoid the issue. I didn't
analyze it to see if it is feasible though.


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r335771 - head

2018-06-28 Thread Bryan Drewery
Author: bdrewery
Date: Thu Jun 28 19:01:53 2018
New Revision: 335771
URL: https://svnweb.freebsd.org/changeset/base/335771

Log:
  SYSTEM_COMPILER/LINKER: Fix cross-build support after r335706.
  
  X-MFC-With:   r335706
  MFC after:2 weeks
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jun 28 18:22:20 2018(r335770)
+++ head/Makefile.inc1  Thu Jun 28 19:01:53 2018(r335771)
@@ -132,7 +132,7 @@ TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:
 
 # If all targets are disabled for system llvm then don't expect it to work
 # for cross-builds.
-.if ${MK_LLVM_TARGET_ALL} == "no" && \
+.if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \
 ${MACHINE} != ${TARGET} && ${MACHINE_ARCH} != ${TARGET_ARCH} && \
 !make(showconfig)
 MK_SYSTEM_COMPILER=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"


Re: svn commit: r335765 - head/sys/sys

2018-06-28 Thread Justin Hibbits
Hi David,

On Thu, Jun 28, 2018 at 12:01 PM David Bright  wrote:
>
> Author: dab
> Date: Thu Jun 28 17:01:04 2018
> New Revision: 335765
> URL: https://svnweb.freebsd.org/changeset/base/335765
>
> Log:
>   Remove potential identifier conflict in the EV_SET macro.
>
>   PR43905 pointed out a problem with the EV_SET macro if the passed
>   struct kevent pointer were specified with an expression with side
>   effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
>   local block that defined an internal variable (named "kevp") to get
>   the pointer value once. This worked, but could cause issues if an
>   existing variable named "kevp" is in scope. To avoid that issue,
>   jilles@ pointed out that "C99 compound literals and designated
>   initializers allow doing this cleanly using a macro". This change
>   incorporates that suggestion, essentially verbatim from jilles@
>   comment on PR43905, except retaining the old definition for pre-C99 or
>   non-STDC (e.g., C++) compilers.
>
>   PR:   43905
>   Submitted by: Jilles Tjoelker (jilles@)
>   Reported by:  Lamont Granquist 
>   Reviewed by:  jmg (no comments), jilles
>   MFC after:1 week
>   Sponsored by: Dell EMC
>   Differential Revision:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905
>
> Modified:
>   head/sys/sys/event.h
>
> Modified: head/sys/sys/event.h
> ==
> --- head/sys/sys/event.hThu Jun 28 15:30:51 2018(r335764)
> +++ head/sys/sys/event.hThu Jun 28 17:01:04 2018(r335765)
> @@ -49,7 +49,26 @@
>  #define EVFILT_EMPTY   (-13)   /* empty send socket buf */
>  #define EVFILT_SYSCOUNT13
>
> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
>  #define EV_SET(kevp_, a, b, c, d, e, f) do {   \
> +*(kevp_) = (struct kevent){\
> +   .ident = (a),   \
> +   .filter = (b),  \
> +   .flags = (c),   \
> +   .fflags = (d),  \
> +   .data = (e),\
> +   .udata = (f),   \
> +   .ext[0] = 0,\
> +   .ext[1] = 0,\
> +   .ext[2] = 0,\
> +   .ext[3] = 0,\
> +}; \
> +} while(0)
> +#else /* Pre-C99 or not STDC (e.g., C++) */
> +/* The definition of the local variable kevp could possibly conflict
> + * with a user-defined value passed in parameters a-f.
> + */
> +#define EV_SET(kevp_, a, b, c, d, e, f) do {   \
> struct kevent *kevp = (kevp_);  \
> (kevp)->ident = (a);\
> (kevp)->filter = (b);   \
> @@ -62,6 +81,7 @@
> (kevp)->ext[2] = 0; \
> (kevp)->ext[3] = 0; \
>  } while(0)
> +#endif
>
>  struct kevent {
> __uintptr_t ident;  /* identifier for this event */
>

This breaks gcc builds, with the following errors:

18:02:13 /usr/src/bin/pwait/pwait.c: In function 'main':
18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field overwritten
18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
for '(anonymous).ext')
18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field overwritten
18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
for '(anonymous).ext')
18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: initialized field overwritten
18:02:13 /usr/src/bin/pwait/pwait.c:144: warning: (near initialization
for '(anonymous).ext')
18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field overwritten
18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
for '(anonymous).ext')
18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field overwritten
18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
for '(anonymous).ext')
18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: initialized field overwritten
18:02:13 /usr/src/bin/pwait/pwait.c:158: warning: (near initialization
for '(anonymous).ext')

This can be seen in the tinderbox (https://ci.freebsd.org/tinderbox)

I encountered this as a failure in building usr.sbin/camdd, which
shows the same type of error.

- Justin
___
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: r335770 - head

2018-06-28 Thread Bryan Drewery
Author: bdrewery
Date: Thu Jun 28 18:22:20 2018
New Revision: 335770
URL: https://svnweb.freebsd.org/changeset/base/335770

Log:
  tinderbox: If the clang lookup fails fallback to the old default behavior.
  
  This fixes errors from the MK_CLANG_BOOTSTRAP/MK_LLD_BOOTSTRAP lookups
  to not force using XCC/XLD but to rather just build them as normal by
  allowing their own bootstrap logic to work.
  
  MFC after:3 weeks
  X-MFC-with:   r335711 r335769
  Sponsored by: Dell EMC

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Thu Jun 28 18:19:46 2018(r335769)
+++ head/Makefile   Thu Jun 28 18:22:20 2018(r335770)
@@ -587,19 +587,21 @@ universe_${target}_worlds: .PHONY
 _need_clang_${target}_${target_arch} != \
env TARGET=${target} TARGET_ARCH=${target_arch} \
${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-compiler \
-   ${MAKE_PARAMS_${target}} -V MK_CLANG_BOOTSTRAP
+   ${MAKE_PARAMS_${target}} -V MK_CLANG_BOOTSTRAP 2>/dev/null || \
+   echo unknown
 .export _need_clang_${target}_${target_arch}
 .endif
 .if !defined(_need_lld_${target}_${target_arch})
 _need_lld_${target}_${target_arch} != \
env TARGET=${target} TARGET_ARCH=${target_arch} \
${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-linker \
-   ${MAKE_PARAMS_${target}} -V MK_LLD_BOOTSTRAP
+   ${MAKE_PARAMS_${target}} -V MK_LLD_BOOTSTRAP 2>/dev/null || \
+   echo unknown
 .export _need_lld_${target}_${target_arch}
 .endif
 # Setup env for each arch to use the one clang.
 .if defined(_need_clang_${target}_${target_arch}) && \
-${_need_clang_${target}_${target_arch}} != "no"
+${_need_clang_${target}_${target_arch}} == "yes"
 # No check on existing XCC or CROSS_BINUTILS_PREFIX, etc, is needed since
 # we use the test-system-compiler logic to determine if clang needs to be
 # built.  It will be no from that logic if already using an external
@@ -613,7 +615,7 @@ MAKE_PARAMS_${target}+= \
XCPP="${HOST_OBJTOP}/tmp/usr/bin/cpp"
 .endif
 .if defined(_need_lld_${target}_${target_arch}) && \
-${_need_lld_${target}_${target_arch}} != "no"
+${_need_lld_${target}_${target_arch}} == "yes"
 MAKE_PARAMS_${target}+= \
XLD="${HOST_OBJTOP}/tmp/usr/bin/ld"
 .endif
@@ -625,9 +627,9 @@ universe_${target}_done: universe_${target}_worlds .PH
 .for target_arch in ${TARGET_ARCHES_${target}}
 universe_${target}_worlds: universe_${target}_${target_arch} .PHONY
 .if (defined(_need_clang_${target}_${target_arch}) && \
-${_need_clang_${target}_${target_arch}} != "no") || \
+${_need_clang_${target}_${target_arch}} == "yes") || \
 (defined(_need_lld_${target}_${target_arch}) && \
-${_need_lld_${target}_${target_arch}} != "no")
+${_need_lld_${target}_${target_arch}} == "yes")
 universe_${target}_${target_arch}: universe-toolchain
 universe_${target}_prologue: universe-toolchain
 .endif
___
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: r335769 - head

2018-06-28 Thread John Baldwin
Author: jhb
Date: Thu Jun 28 18:19:46 2018
New Revision: 335769
URL: https://svnweb.freebsd.org/changeset/base/335769

Log:
  Include existing MAKE_PARAMS_ when determining the universe toolchain.
  
  This fixes a warning for each RISCV target during universe by passing in
  the required CROSS_TOOLCHAIN setting which will in turn set
  CROSS_BINUTILS_PREFIX correctly.  It also ensures that a tinderbox build
  uses the correct compiler for riscv.  Previously it was using the shared
  clang compiler instead of riscv64-gcc.
  
  Reviewed by:  bdrewery
  Sponsored by: DARPA / AFRL
  Differential Revision:https://reviews.freebsd.org/D16049

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Thu Jun 28 18:17:20 2018(r335768)
+++ head/Makefile   Thu Jun 28 18:19:46 2018(r335769)
@@ -587,14 +587,14 @@ universe_${target}_worlds: .PHONY
 _need_clang_${target}_${target_arch} != \
env TARGET=${target} TARGET_ARCH=${target_arch} \
${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-compiler \
-   -V MK_CLANG_BOOTSTRAP
+   ${MAKE_PARAMS_${target}} -V MK_CLANG_BOOTSTRAP
 .export _need_clang_${target}_${target_arch}
 .endif
 .if !defined(_need_lld_${target}_${target_arch})
 _need_lld_${target}_${target_arch} != \
env TARGET=${target} TARGET_ARCH=${target_arch} \
${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-linker \
-   -V MK_LLD_BOOTSTRAP
+   ${MAKE_PARAMS_${target}} -V MK_LLD_BOOTSTRAP
 .export _need_lld_${target}_${target_arch}
 .endif
 # Setup env for each arch to use the one clang.
___
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: r335768 - head/lib/libc/sys

2018-06-28 Thread Conrad Meyer
Author: cem
Date: Thu Jun 28 18:17:20 2018
New Revision: 335768
URL: https://svnweb.freebsd.org/changeset/base/335768

Log:
  sigaction.2: Minor cleanups
  
  Add vertical space between struct definition and function prototype.
  
  Use "NULL" to describe zero pointers, instead of "zero."
  
  Remove perhaps unclear "can not" and replace.  Tag struct member names used
  with appropriate tags.

Modified:
  head/lib/libc/sys/sigaction.2

Modified: head/lib/libc/sys/sigaction.2
==
--- head/lib/libc/sys/sigaction.2   Thu Jun 28 17:52:06 2018
(r335767)
+++ head/lib/libc/sys/sigaction.2   Thu Jun 28 18:17:20 2018
(r335768)
@@ -28,7 +28,7 @@
 .\"From: @(#)sigaction.2   8.2 (Berkeley) 4/3/94
 .\" $FreeBSD$
 .\"
-.Dd September 30, 2016
+.Dd June 28, 2018
 .Dt SIGACTION 2
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@ struct  sigaction {
 sigset_t sa_mask;   /* signal mask to apply */
 };
 .Ed
+.Pp
 .Ft int
 .Fo sigaction
 .Fa "int sig"
@@ -143,15 +144,13 @@ assigns an action for a signal specified by
 .Fa sig .
 If
 .Fa act
-is non-zero, it
-specifies an action
+is non-NULL, it specifies an action
 .Dv ( SIG_DFL ,
 .Dv SIG_IGN ,
-or a handler routine) and mask
-to be used when delivering the specified signal.
+or a handler routine) and mask to be used when delivering the specified signal.
 If
 .Fa oact
-is non-zero, the previous handling information for the signal
+is non-NULL, the previous handling information for the signal
 is returned to the user.
 .Pp
 The above declaration of
@@ -161,8 +160,12 @@ It is provided only to list the accessible members.
 See
 .In sys/signal.h
 for the actual definition.
-In particular, the storage occupied by sa_handler and sa_sigaction overlaps,
-and an application can not use both simultaneously.
+In particular, the storage occupied by
+.Va sa_handler
+and
+.Va sa_sigaction
+overlaps, and it is nonsensical for an application to attempt to use both
+simultaneously.
 .Pp
 Once a signal handler is installed, it normally remains installed
 until another
___
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: r335767 - head/sys/vm

2018-06-28 Thread Alan Cox
Author: alc
Date: Thu Jun 28 17:52:06 2018
New Revision: 335767
URL: https://svnweb.freebsd.org/changeset/base/335767

Log:
  Reflow one of the comments describing vm_phys_alloc_npages().

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Thu Jun 28 17:07:20 2018(r335766)
+++ head/sys/vm/vm_phys.c   Thu Jun 28 17:52:06 2018(r335767)
@@ -609,10 +609,10 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_f
  * within the specified domain.  Returns the actual number of allocated pages
  * and a pointer to each page through the array ma[].
  *
- * The returned pages may not be physically contiguous.  However, in contrast 
to
- * performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0),
- * calling this function once to allocate the desired number of pages will 
avoid
- * wasted time in vm_phys_split_pages().
+ * The returned pages may not be physically contiguous.  However, in contrast
+ * to performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0),
+ * calling this function once to allocate the desired number of pages will
+ * avoid wasted time in vm_phys_split_pages().
  *
  * The free page queues for the specified domain must be locked.
  */
___
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: r335765 - head/sys/sys

2018-06-28 Thread David A. Bright
On 06/28/2018 12:06 PM, David A. Bright wrote:

> On 06/28/2018 12:01 PM, David Bright wrote:
>
>> Author: dab
>> Date: Thu Jun 28 17:01:04 2018
>> New Revision: 335765
>> URL: https://svnweb.freebsd.org/changeset/base/335765
>>
>> Log:
>>   Remove potential identifier conflict in the EV_SET macro.
>>   
>>
>>   Differential Revision: 
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905
> Oops; wrong URL: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905
Goodness. Third time's the charm: https://reviews.freebsd.org/D15679

Sorry for the noise.

-- 
David Bright
d...@freebsd.org

___
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: r335766 - head/sys/dev/efidev

2018-06-28 Thread Ian Lepore
Author: ian
Date: Thu Jun 28 17:07:20 2018
New Revision: 335766
URL: https://svnweb.freebsd.org/changeset/base/335766

Log:
  Add missing MODULE_VERSION() and MODULE_DEPEND().

Modified:
  head/sys/dev/efidev/efirtc.c

Modified: head/sys/dev/efidev/efirtc.c
==
--- head/sys/dev/efidev/efirtc.cThu Jun 28 17:01:04 2018
(r335765)
+++ head/sys/dev/efidev/efirtc.cThu Jun 28 17:07:20 2018
(r335766)
@@ -202,3 +202,5 @@ static driver_t efirtc_driver = {
 };
 
 DRIVER_MODULE(efirtc, nexus, efirtc_driver, efirtc_devclass, 0, 0);
+MODULE_VERSION(efirtc, 1);
+MODULE_DEPEND(efirtc, efirt, 1, 1, 1);
___
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: r335765 - head/sys/sys

2018-06-28 Thread David A. Bright
On 06/28/2018 12:01 PM, David Bright wrote:

> Author: dab
> Date: Thu Jun 28 17:01:04 2018
> New Revision: 335765
> URL: https://svnweb.freebsd.org/changeset/base/335765
>
> Log:
>   Remove potential identifier conflict in the EV_SET macro.
>   
>
>   Differential Revision:  
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905

Oops; wrong URL: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905

-- 
David Bright
d...@freebsd.org

___
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: r335765 - head/sys/sys

2018-06-28 Thread David Bright
Author: dab
Date: Thu Jun 28 17:01:04 2018
New Revision: 335765
URL: https://svnweb.freebsd.org/changeset/base/335765

Log:
  Remove potential identifier conflict in the EV_SET macro.
  
  PR43905 pointed out a problem with the EV_SET macro if the passed
  struct kevent pointer were specified with an expression with side
  effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
  local block that defined an internal variable (named "kevp") to get
  the pointer value once. This worked, but could cause issues if an
  existing variable named "kevp" is in scope. To avoid that issue,
  jilles@ pointed out that "C99 compound literals and designated
  initializers allow doing this cleanly using a macro". This change
  incorporates that suggestion, essentially verbatim from jilles@
  comment on PR43905, except retaining the old definition for pre-C99 or
  non-STDC (e.g., C++) compilers.
  
  PR:   43905
  Submitted by: Jilles Tjoelker (jilles@)
  Reported by:  Lamont Granquist 
  Reviewed by:  jmg (no comments), jilles
  MFC after:1 week
  Sponsored by: Dell EMC
  Differential Revision:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905

Modified:
  head/sys/sys/event.h

Modified: head/sys/sys/event.h
==
--- head/sys/sys/event.hThu Jun 28 15:30:51 2018(r335764)
+++ head/sys/sys/event.hThu Jun 28 17:01:04 2018(r335765)
@@ -49,7 +49,26 @@
 #define EVFILT_EMPTY   (-13)   /* empty send socket buf */
 #define EVFILT_SYSCOUNT13
 
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #define EV_SET(kevp_, a, b, c, d, e, f) do {   \
+*(kevp_) = (struct kevent){\
+   .ident = (a),   \
+   .filter = (b),  \
+   .flags = (c),   \
+   .fflags = (d),  \
+   .data = (e),\
+   .udata = (f),   \
+   .ext[0] = 0,\
+   .ext[1] = 0,\
+   .ext[2] = 0,\
+   .ext[3] = 0,\
+}; \
+} while(0)
+#else /* Pre-C99 or not STDC (e.g., C++) */
+/* The definition of the local variable kevp could possibly conflict
+ * with a user-defined value passed in parameters a-f.
+ */
+#define EV_SET(kevp_, a, b, c, d, e, f) do {   \
struct kevent *kevp = (kevp_);  \
(kevp)->ident = (a);\
(kevp)->filter = (b);   \
@@ -62,6 +81,7 @@
(kevp)->ext[2] = 0; \
(kevp)->ext[3] = 0; \
 } while(0)
+#endif
 
 struct kevent {
__uintptr_t ident;  /* identifier for this event */
___
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: r335764 - stable/11/release/doc/en_US.ISO8859-1/errata

2018-06-28 Thread Glen Barber
Author: gjb
Date: Thu Jun 28 15:30:51 2018
New Revision: 335764
URL: https://svnweb.freebsd.org/changeset/base/335764

Log:
  Add an errata entry regarding Bugzilla 228536.
  
  PR:   228536
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/errata/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlThu Jun 28 
15:00:18 2018(r335763)
+++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlThu Jun 28 
15:30:51 2018(r335764)
@@ -218,6 +218,22 @@ boot
  had been added; this should have stated
  .
   
+
+  
+   [2018-06-28] An issue had been reported after the
+ release of 11.2 with x11/nvidia-driver installed from
+ the upstream package mirrors via .
+
+   Building x11/nvidia-driver from
+ the  collection has been reported to resolve
+ the issue.
+
+   See PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228536;>228536
+ for more information.
+  
 
   
 
___
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: r335763 - head/etc/devd

2018-06-28 Thread Warner Losh
Author: imp
Date: Thu Jun 28 15:00:18 2018
New Revision: 335763
URL: https://svnweb.freebsd.org/changeset/base/335763

Log:
  Fix quoting in sending the NOMATCH event to devmatch
  
  The NOMATCH event was previously quoted to protect it from shell
  expansion. However, that quoting now interferes with the quoting devd
  is doing. Quote to protect just the ?.

Modified:
  head/etc/devd/devmatch.conf

Modified: head/etc/devd/devmatch.conf
==
--- head/etc/devd/devmatch.conf Thu Jun 28 13:48:59 2018(r335762)
+++ head/etc/devd/devmatch.conf Thu Jun 28 15:00:18 2018(r335763)
@@ -9,7 +9,7 @@
 #
 # Generic NOMATCH event
 nomatch 100 {
-   action "service devmatch quietstart '?$_'";
+   action "service devmatch quietstart '?'$_";
 };
 
 # Add the following to devd.conf to prevent this from running:
___
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: r335762 - in head: . etc release/packages share/mk share/termcap usr.bin/vgrind

2018-06-28 Thread Brad Davis
Author: brd
Date: Thu Jun 28 13:48:59 2018
New Revision: 335762
URL: https://svnweb.freebsd.org/changeset/base/335762

Log:
  Simplify using bsd.endian.mk and have it provide CAP_MKDB_ENDIAN, since it is
  the most common usage.
  
  Approved by:  bapt (mentor)

Modified:
  head/Makefile.inc1
  head/etc/Makefile
  head/release/packages/generate-ucl.sh
  head/share/mk/bsd.endian.mk
  head/share/termcap/Makefile
  head/usr.bin/vgrind/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jun 28 12:55:05 2018(r335761)
+++ head/Makefile.inc1  Thu Jun 28 13:48:59 2018(r335762)
@@ -1803,13 +1803,11 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul
env -i LC_COLLATE=C sort ${KSTAGEDIR}/kernel.meta | \
awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
-v kernel=yes -v _kernconf=${INSTALLKERNEL} ; \
-   cap_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VCAP_MKDB_ENDIAN` ; \
sed -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \
-e "s/%KERNELDIR%/kernel/" \
-e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \
-e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \
-   -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
${SRCDIR}/release/packages/kernel.ucl \
> ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl 
; \
@@ -1837,13 +1835,11 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_
env -i LC_COLLATE=C sort ${KSTAGEDIR}/kernel.${_kernel}.meta | \
awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
-v kernel=yes -v _kernconf=${_kernel} ; \
-   cap_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VCAP_MKDB_ENDIAN` ; \
sed -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \
-e "s/%KERNELDIR%/kernel.${_kernel}/" \
-e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \
-e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \
-   -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
${SRCDIR}/release/packages/kernel.ucl \
> ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl 
; \

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Thu Jun 28 12:55:05 2018(r335761)
+++ head/etc/Makefile   Thu Jun 28 13:48:59 2018(r335762)
@@ -178,13 +178,6 @@ distribute:
${_+_}cd ${.CURDIR} ; ${MAKE} distribution 
DESTDIR=${DISTDIR}/${DISTRIBUTION}
 
 .include 
-.if ${TARGET_ENDIANNESS} == "1234"
-CAP_MKDB_ENDIAN?= -l
-.elif ${TARGET_ENDIANNESS} == "4321"
-CAP_MKDB_ENDIAN?= -b
-.else
-CAP_MKDB_ENDIAN?=
-.endif
 
 .if defined(NO_ROOT)
 METALOG.add?=  cat -l >> ${METALOG}

Modified: head/release/packages/generate-ucl.sh
==
--- head/release/packages/generate-ucl.sh   Thu Jun 28 12:55:05 2018
(r335761)
+++ head/release/packages/generate-ucl.sh   Thu Jun 28 13:48:59 2018
(r335762)
@@ -131,7 +131,7 @@ main() {
[ -z "${desc}" ] && desc="${outname} package"
 
cp "${uclsource}" "${uclfile}"
-   cap_arg="$(make -C ${srctree}/etc -VCAP_MKDB_ENDIAN)"
+   cap_arg="$( make -f ${srctree}/share/mk/bsd.endian.mk -VCAP_MKDB_ENDIAN 
)"
sed -i '' -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/${origname}/" \
-e "s/%COMMENT%/${comment}/" \

Modified: head/share/mk/bsd.endian.mk
==
--- head/share/mk/bsd.endian.mk Thu Jun 28 12:55:05 2018(r335761)
+++ head/share/mk/bsd.endian.mk Thu Jun 28 13:48:59 2018(r335762)
@@ -7,6 +7,7 @@
 ${MACHINE_CPUARCH} == "riscv" || \
 ${MACHINE_ARCH:Mmips*el*} != ""
 TARGET_ENDIANNESS= 1234
+CAP_MKDB_ENDIAN= -l
 .elif ${MACHINE_ARCH} == "powerpc" || \
 ${MACHINE_ARCH} == "powerpc64" || \
 ${MACHINE_ARCH} == "powerpcspe" || \
@@ -14,4 +15,5 @@ TARGET_ENDIANNESS= 1234
 (${MACHINE} == "arm" && ${MACHINE_ARCH:Marm*eb*} != "") || \
 ${MACHINE_ARCH:Mmips*} != ""
 TARGET_ENDIANNESS= 4321
+CAP_MKDB_ENDIAN= -b
 .endif

Modified: head/share/termcap/Makefile
==
--- head/share/termcap/Makefile Thu Jun 28 12:55:05 2018(r335761)
+++ head/share/termcap/Makefile Thu Jun 28 13:48:59 2018(r335762)
@@ -12,13 +12,6 @@ FILESDIR=${BINDIR}/misc
 CLEANFILES+=   termcap.db
 
 .include 
-.if ${TARGET_ENDIANNESS} == "1234"
-CAP_MKDB_ENDIAN= -l
-.elif ${TARGET_ENDIANNESS} == "4321"

Re: svn commit: r335629 - in head: share/man/man4 sys/dev/vt/hw/vga

2018-06-28 Thread Rodney W. Grimes
> On Tue, Jun 26, 2018 at 10:18:39AM -0600, Ian Lepore wrote:
> > On Tue, 2018-06-26 at 08:55 -0700, Rodney W. Grimes wrote:
> > > > 
> > > > On Tue, Jun 26, 2018 at 05:21:27AM +, Alexey Dokuchaev wrote:
> > > > > 
> > > > > On Mon, Jun 25, 2018 at 08:43:51AM -0700, Rodney W. Grimes wrote:
> > > > > > 
> > > > > > > 
> > > > > > > New Revision: 335629
> > > > > > > URL: https://svnweb.freebsd.org/changeset/base/335629
> > > > > > > 
> > > > > > > Log:
> > > > > > > ? vt: add option to ignore NO_VGA flag in ACPI
> > > > > > > ??
> > > > > > > ? To workaround buggy firmware that sets this flag when
> > > > > > > there's actually
> > > > > > > ? a VGA present.
> > > > > > > ??
> > > > > > > ? Reported and tested by: Yasuhiro KIMURA  > > > > > > e.org>
> > > > > > > ? Sponsored by:   Citrix Systems R
> > > > > > > ? Reviewed by:kib
> > > > > > > ? Differential revision:  https://reviews.freebsd.org/D
> > > > > > > 16003
> > > > > > It is generally best to avoid double negatives,
> > > > > > couldnt this of been better named? (hw.vga.acpi_force_vga)
> > > > > Yes please; I get constantly confused when calculating negatives
> > > > > and
> > > > > often get them wrong.
> > > > This is specifically done to workaround a firmware bug where some
> > > > buggy firmwares set the NO_VGA flag in ACPI.
> > > We are not conflicted about working around the buggy ACPI.
> > > 
> > > > 
> > > > So the option does
> > > > exactly what the name says, it ignores the NO_VGA flag in ACPI. IMO
> > > > acpi_force_vga is not as descriptive as the current name.
> > > Interestingly that is the text you use to describe it in the man
> > > page, so it seems as if it is good for the description, but not
> > > good for the name of the flag itself?
> > > 
> > > .It Va hw.vga.acpi_ignore_no_vga
> > > Set to 1 to force the usage of the VGA driver regardless of whether
> > > ACPI IAPC_BOOT_ARCH signals no VGA support.
> > > Can be used to workaround firmware bugs in the ACPI tables.
> > > 
> > > This does not mention the ACPI table entry being over ridden,
> > >if (flags & ACPI_FADT_NO_VGA)
> > > 
> > > Further digging I believe you have placed this in the wrong
> > > part of the hierarchy.??You put it in hw.vga, and it really
> > > should be in hw.acpi.
> > > Maybe hw.acpi.bootflags.ignore.no_vga.
> > > 
> > > Are there any other bootflags we may want to ignore?
> > > 
> > > Regards,
> > 
> > 
> > There is ACPI_FADT_NO_CMOS_RTC, with an associated tunable
> > hw.atrtc.enabled (default is -1), which can be:
Shouldnt this really be in hw.acpi.

> > 
> > ? -1 - enabled unless acpi says ACPI_FADT_NO_CMOS_RTC
> > ? ?0 - unconditionally disabled
> > ? ?1 - unconditionally enabled
> > 
> > The idea was that if RTC is provided by EFI runtime services, this flag
> > would indicate that old-school CMOS RTC drivers should not be used.
> > ?But, predictably, it turns out there are bioses that set this flag
> > even when booting in legacy non-efi mode, leading to a need to ignore
> > the flag and force use of the old driver.
> 
> I could take this approach for vt and add hw.vt.enabled = { -1, 0, 1 }
> if that seems better.

Lets not scatter more ACPI stuff into non ACPI parts
of the sysctl oid tree.
If you do go this route it should really be in hw.acpi.*


-- 
Rod Grimes rgri...@freebsd.org
___
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: r335761 - stable/11/usr.sbin/syslogd

2018-06-28 Thread Ed Schouten
Author: ed
Date: Thu Jun 28 12:55:05 2018
New Revision: 335761
URL: https://svnweb.freebsd.org/changeset/base/335761

Log:
  MFC r335565:
  
Still parse messages that don't contain an RFC 3164 timestamp.
  
The changes made in r326573 required that messages always start with an
RFC 3164 timestamp. It looks like certain devices, but also certain
logging libraries (Python 3's "logging" package) simply don't generate
RFC 3164 formatted messages containing a timestamp.
  
Make timestamps optional again. When the timestamp is missing, also
assume that the message contains no hostname. The first word of the
message likely already belongs to the message payload.
  
  PR:   229236

Modified:
  stable/11/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/syslogd/syslogd.c
==
--- stable/11/usr.sbin/syslogd/syslogd.cThu Jun 28 11:39:27 2018
(r335760)
+++ stable/11/usr.sbin/syslogd/syslogd.cThu Jun 28 12:55:05 2018
(r335761)
@@ -1170,68 +1170,70 @@ parsemsg_rfc3164(const char *from, int pri, char *msg)
size_t i, msglen;
char line[MAXLINE + 1];
 
-   /* Parse the timestamp provided by the remote side. */
-   if (strptime(msg, RFC3164_DATEFMT, _parsed) !=
-   msg + RFC3164_DATELEN || msg[RFC3164_DATELEN] != ' ') {
-   dprintf("Failed to parse TIMESTAMP from %s: %s\n", from, msg);
-   return;
-   }
-   msg += RFC3164_DATELEN + 1;
+   /*
+* Parse the TIMESTAMP provided by the remote side. If none is
+* found, assume this is not an RFC 3164 formatted message,
+* only containing a TAG and a MSG.
+*/
+   timestamp = NULL;
+   if (strptime(msg, RFC3164_DATEFMT, _parsed) ==
+   msg + RFC3164_DATELEN && msg[RFC3164_DATELEN] == ' ') {
+   msg += RFC3164_DATELEN + 1;
+   if (!RemoteAddDate) {
+   struct tm tm_now;
+   time_t t_now;
+   int year;
 
-   if (!RemoteAddDate) {
-   struct tm tm_now;
-   time_t t_now;
-   int year;
+   /*
+* As the timestamp does not contain the year
+* number, daylight saving time information, nor
+* a time zone, attempt to infer it. Due to
+* clock skews, the timestamp may even be part
+* of the next year. Use the last year for which
+* the timestamp is at most one week in the
+* future.
+*
+* This loop can only run for at most three
+* iterations before terminating.
+*/
+   t_now = time(NULL);
+   localtime_r(_now, _now);
+   for (year = tm_now.tm_year + 1;; --year) {
+   assert(year >= tm_now.tm_year - 1);
+   timestamp_remote.tm = tm_parsed;
+   timestamp_remote.tm.tm_year = year;
+   timestamp_remote.tm.tm_isdst = -1;
+   timestamp_remote.usec = 0;
+   if (mktime(_remote.tm) <
+   t_now + 7 * 24 * 60 * 60)
+   break;
+   }
+   timestamp = _remote;
+   }
 
/*
-* As the timestamp does not contain the year number,
-* daylight saving time information, nor a time zone,
-* attempt to infer it. Due to clock skews, the
-* timestamp may even be part of the next year. Use the
-* last year for which the timestamp is at most one week
-* in the future.
-*
-* This loop can only run for at most three iterations
-* before terminating.
+* A single space character MUST also follow the HOSTNAME field.
 */
-   t_now = time(NULL);
-   localtime_r(_now, _now);
-   for (year = tm_now.tm_year + 1;; --year) {
-   assert(year >= tm_now.tm_year - 1);
-   timestamp_remote.tm = tm_parsed;
-   timestamp_remote.tm.tm_year = year;
-   timestamp_remote.tm.tm_isdst = -1;
-   timestamp_remote.usec = 0;
-   if (mktime(_remote.tm) <
-   t_now + 7 * 24 * 60 * 60)
+   msglen = strlen(msg);
+   for (i = 0; i < MIN(MAXHOSTNAMELEN, msglen); i++) {
+   if (msg[i] == ' ') 

svn commit: r335760 - in head/sys: net netinet netinet6

2018-06-28 Thread Andrey V. Elsukov
Author: ae
Date: Thu Jun 28 11:39:27 2018
New Revision: 335760
URL: https://svnweb.freebsd.org/changeset/base/335760

Log:
  Add NULL pointer check.
  
  encap_lookup_t method can be invoked by IP encap subsytem even if none
  of gif/gre/me interfaces are exist. Hash tables are allocated on demand,
  when first interface is created. So, make NULL pointer check before
  doing access to hash table.
  
  PR:   229378

Modified:
  head/sys/net/if_me.c
  head/sys/netinet/in_gif.c
  head/sys/netinet/ip_gre.c
  head/sys/netinet6/in6_gif.c
  head/sys/netinet6/ip6_gre.c

Modified: head/sys/net/if_me.c
==
--- head/sys/net/if_me.cThu Jun 28 09:42:30 2018(r335759)
+++ head/sys/net/if_me.cThu Jun 28 11:39:27 2018(r335760)
@@ -312,6 +312,9 @@ me_lookup(const struct mbuf *m, int off, int proto, vo
const struct ip *ip;
struct me_softc *sc;
 
+   if (V_me_hashtbl == NULL)
+   return (0);
+
MPASS(in_epoch());
ip = mtod(m, const struct ip *);
CK_LIST_FOREACH(sc, _HASH(ip->ip_dst.s_addr,

Modified: head/sys/netinet/in_gif.c
==
--- head/sys/netinet/in_gif.c   Thu Jun 28 09:42:30 2018(r335759)
+++ head/sys/netinet/in_gif.c   Thu Jun 28 11:39:27 2018(r335760)
@@ -289,6 +289,9 @@ in_gif_lookup(const struct mbuf *m, int off, int proto
struct gif_softc *sc;
int ret;
 
+   if (V_ipv4_hashtbl == NULL)
+   return (0);
+
MPASS(in_epoch());
ip = mtod(m, const struct ip *);
/*

Modified: head/sys/netinet/ip_gre.c
==
--- head/sys/netinet/ip_gre.c   Thu Jun 28 09:42:30 2018(r335759)
+++ head/sys/netinet/ip_gre.c   Thu Jun 28 11:39:27 2018(r335760)
@@ -115,6 +115,9 @@ in_gre_lookup(const struct mbuf *m, int off, int proto
const struct ip *ip;
struct gre_softc *sc;
 
+   if (V_ipv4_hashtbl == NULL)
+   return (0);
+
MPASS(in_epoch());
ip = mtod(m, const struct ip *);
CK_LIST_FOREACH(sc, _HASH(ip->ip_dst.s_addr,

Modified: head/sys/netinet6/in6_gif.c
==
--- head/sys/netinet6/in6_gif.c Thu Jun 28 09:42:30 2018(r335759)
+++ head/sys/netinet6/in6_gif.c Thu Jun 28 11:39:27 2018(r335760)
@@ -309,6 +309,9 @@ in6_gif_lookup(const struct mbuf *m, int off, int prot
struct gif_softc *sc;
int ret;
 
+   if (V_ipv6_hashtbl == NULL)
+   return (0);
+
MPASS(in_epoch());
/*
 * NOTE: it is safe to iterate without any locking here, because softc

Modified: head/sys/netinet6/ip6_gre.c
==
--- head/sys/netinet6/ip6_gre.c Thu Jun 28 09:42:30 2018(r335759)
+++ head/sys/netinet6/ip6_gre.c Thu Jun 28 11:39:27 2018(r335760)
@@ -107,6 +107,9 @@ in6_gre_lookup(const struct mbuf *m, int off, int prot
const struct ip6_hdr *ip6;
struct gre_softc *sc;
 
+   if (V_ipv6_hashtbl == NULL)
+   return (0);
+
MPASS(in_epoch());
ip6 = mtod(m, const struct ip6_hdr *);
CK_LIST_FOREACH(sc, _HASH(>ip6_dst, >ip6_src), chain) {
___
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: r335759 - head/sbin/ipfw

2018-06-28 Thread Andrey V. Elsukov
Author: ae
Date: Thu Jun 28 09:42:30 2018
New Revision: 335759
URL: https://svnweb.freebsd.org/changeset/base/335759

Log:
  Remove extra "ipfw" from example.
  
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Thu Jun 28 07:01:56 2018(r335758)
+++ head/sbin/ipfw/ipfw.8   Thu Jun 28 09:42:30 2018(r335759)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 9, 2018
+.Dd June 28, 2018
 .Dt IPFW 8
 .Os
 .Sh NAME
@@ -3834,9 +3834,9 @@ In the following example per-interface firewall is cre
 .Dl "ipfw table OUT add vlan20 22000"
 .Dl "ipfw table OUT add vlan30 23000"
 .Dl ".."
-.Dl "ipfw add 100 ipfw setfib tablearg ip from any to any recv 'table(IN)' in"
-.Dl "ipfw add 200 ipfw skipto tablearg ip from any to any recv 'table(IN)' in"
-.Dl "ipfw add 300 ipfw skipto tablearg ip from any to any xmit 'table(OUT)' 
out"
+.Dl "ipfw add 100 setfib tablearg ip from any to any recv 'table(IN)' in"
+.Dl "ipfw add 200 skipto tablearg ip from any to any recv 'table(IN)' in"
+.Dl "ipfw add 300 skipto tablearg ip from any to any xmit 'table(OUT)' out"
 .Pp
 The following example illustrate usage of flow tables:
 .Pp
___
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: r335629 - in head: share/man/man4 sys/dev/vt/hw/vga

2018-06-28 Thread Roger Pau Monné
On Tue, Jun 26, 2018 at 10:18:39AM -0600, Ian Lepore wrote:
> On Tue, 2018-06-26 at 08:55 -0700, Rodney W. Grimes wrote:
> > > 
> > > On Tue, Jun 26, 2018 at 05:21:27AM +, Alexey Dokuchaev wrote:
> > > > 
> > > > On Mon, Jun 25, 2018 at 08:43:51AM -0700, Rodney W. Grimes wrote:
> > > > > 
> > > > > > 
> > > > > > New Revision: 335629
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/335629
> > > > > > 
> > > > > > Log:
> > > > > >   vt: add option to ignore NO_VGA flag in ACPI
> > > > > >   
> > > > > >   To workaround buggy firmware that sets this flag when
> > > > > > there's actually
> > > > > >   a VGA present.
> > > > > >   
> > > > > >   Reported and tested by:   Yasuhiro KIMURA  > > > > > e.org>
> > > > > >   Sponsored by: Citrix Systems R
> > > > > >   Reviewed by:  kib
> > > > > >   Differential revision:https://reviews.freebsd.org/D
> > > > > > 16003
> > > > > It is generally best to avoid double negatives,
> > > > > couldnt this of been better named? (hw.vga.acpi_force_vga)
> > > > Yes please; I get constantly confused when calculating negatives
> > > > and
> > > > often get them wrong.
> > > This is specifically done to workaround a firmware bug where some
> > > buggy firmwares set the NO_VGA flag in ACPI.
> > We are not conflicted about working around the buggy ACPI.
> > 
> > > 
> > > So the option does
> > > exactly what the name says, it ignores the NO_VGA flag in ACPI. IMO
> > > acpi_force_vga is not as descriptive as the current name.
> > Interestingly that is the text you use to describe it in the man
> > page, so it seems as if it is good for the description, but not
> > good for the name of the flag itself?
> > 
> > .It Va hw.vga.acpi_ignore_no_vga
> > Set to 1 to force the usage of the VGA driver regardless of whether
> > ACPI IAPC_BOOT_ARCH signals no VGA support.
> > Can be used to workaround firmware bugs in the ACPI tables.
> > 
> > This does not mention the ACPI table entry being over ridden,
> >  if (flags & ACPI_FADT_NO_VGA)
> > 
> > Further digging I believe you have placed this in the wrong
> > part of the hierarchy.  You put it in hw.vga, and it really
> > should be in hw.acpi.
> > Maybe hw.acpi.bootflags.ignore.no_vga.
> > 
> > Are there any other bootflags we may want to ignore?
> > 
> > Regards,
> 
> 
> There is ACPI_FADT_NO_CMOS_RTC, with an associated tunable
> hw.atrtc.enabled (default is -1), which can be:
> 
>   -1 - enabled unless acpi says ACPI_FADT_NO_CMOS_RTC
>    0 - unconditionally disabled
>    1 - unconditionally enabled
> 
> The idea was that if RTC is provided by EFI runtime services, this flag
> would indicate that old-school CMOS RTC drivers should not be used.
>  But, predictably, it turns out there are bioses that set this flag
> even when booting in legacy non-efi mode, leading to a need to ignore
> the flag and force use of the old driver.

I could take this approach for vt and add hw.vt.enabled = { -1, 0, 1 }
if that seems better.

Roger.
___
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: r335690 - head/sys/kern

2018-06-28 Thread Warner Losh
On Wed, Jun 27, 2018 at 7:46 AM, Warner Losh  wrote:

>
>
> On Wed, Jun 27, 2018 at 7:44 AM, Shawn Webb 
> wrote:
>
>> On Wed, Jun 27, 2018 at 07:42:52AM -0600, Warner Losh wrote:
>> > On Wed, Jun 27, 2018 at 12:59 AM, Oliver Pinter <
>> > oliver.pin...@hardenedbsd.org> wrote:
>> >
>> > >
>> > >
>> > > On Wednesday, June 27, 2018, Warner Losh  wrote:
>> > >
>> > >> Author: imp
>> > >> Date: Wed Jun 27 04:11:09 2018
>> > >> New Revision: 335690
>> > >> URL: https://svnweb.freebsd.org/changeset/base/335690
>> > >>
>> > >> Log:
>> > >>   Fix devctl generation for core files.
>> > >>
>> > >>   We have a problem with vn_fullpath_global when the file exists.
>> Work
>> > >>   around it by printing the full path if the core file name starts
>> with /,
>> > >>   or current working directory followed by the filename if not.
>> > >>
>> > >>   Sponsored by: Netflix
>> > >>   Differential Review: https://reviews.freebsd.org/D16026
>> > >>
>> > >> Modified:
>> > >>   head/sys/kern/kern_sig.c
>> > >>
>> > >> Modified: head/sys/kern/kern_sig.c
>> > >> 
>> > >> ==
>> > >> --- head/sys/kern/kern_sig.cWed Jun 27 04:10:48 2018
>> (r335689)
>> > >> +++ head/sys/kern/kern_sig.cWed Jun 27 04:11:09 2018
>> (r335690)
>> > >> @@ -3431,24 +3431,6 @@ out:
>> > >> return (0);
>> > >>  }
>> > >>
>> > >> -static int
>> > >> -coredump_sanitise_path(const char *path)
>> > >> -{
>> > >> -   size_t i;
>> > >> -
>> > >> -   /*
>> > >> -* Only send a subset of ASCII to devd(8) because it
>> > >> -* might pass these strings to sh -c.
>> > >> -*/
>> > >> -   for (i = 0; path[i]; i++)
>> > >> -   if (!(isalpha(path[i]) || isdigit(path[i])) &&
>> > >> -   path[i] != '/' && path[i] != '.' &&
>> > >> -   path[i] != '-')
>> > >> -   return (0);
>> > >
>> > >
>> > > This part of code existed to prevent shell code injection via file
>> names.
>> > > After this commit we lose this.
>> > >
>> >
>> > It's devd's job to prevent that, not the kernel's.
>>
>> Has devd been updated? Or is this particular vulnerability manifest
>> again?
>>
>
> devd is fine as far as I know, apart from the default action. I'm fixing
> that now.
>

As of r335756 the quoting issue that this code was for was fixed. I thought
I'd jumped through these hoops years ago, but I can't find the tree I did
it in, and it's clear I never committed it.

Warner
___
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: r335690 - head/sys/kern

2018-06-28 Thread Warner Losh
On Thu, Jun 28, 2018 at 12:54 AM, Devin Teske  wrote:

>
> On Jun 27, 2018, at 7:35 PM, Warner Losh  wrote:
>
>
>
> On Wed, Jun 27, 2018 at 8:14 PM, Devin Teske  wrote:
>
>>
>> On Jun 27, 2018, at 6:58 PM, Warner Losh  wrote:
>>
>>
>>
>> On Wed, Jun 27, 2018 at 7:49 PM, Devin Teske  wrote:
>>
>>>
>>> On Jun 27, 2018, at 5:59 PM, Warner Losh  wrote:
>>>
>>>
>>>
>>> On Wed, Jun 27, 2018 at 5:52 PM, Gleb Smirnoff 
>>> wrote:
>>>
 On Wed, Jun 27, 2018 at 04:11:09AM +, Warner Losh wrote:
 W> Author: imp
 W> Date: Wed Jun 27 04:11:09 2018
 W> New Revision: 335690
 W> URL: https://svnweb.freebsd.org/changeset/base/335690
 W>
 W> Log:
 W>   Fix devctl generation for core files.
 W>
 W>   We have a problem with vn_fullpath_global when the file exists.
 Work
 W>   around it by printing the full path if the core file name starts
 with /,
 W>   or current working directory followed by the filename if not.

 Is this going to work when a core is dumped not at current working
 directory,
 but at absolute path? e.g. kern.corefile=/var/log/cores/%N.core

>>>
>>> Yes. That works.
>>>
>>>
 Looks like the vn_fullpath_global needs to be fixed rather than problem
 workarounded.

>>>
>>> It can't be fixed reliably. FreeBSD does not and cannot map a vnode to a
>>> name. The only reason we're able to at all is due to the name cache. And
>>> when we recreate a file, we invalidate the name cache. And even if we fixed
>>> that, there's no guarantee the name cache won't get flushed before we
>>> translate the name Linux can do this because it keeps the path name
>>> associated with the inode. FreeBSD simply doesn't.
>>>
>>>
>>> They said it couldn't be done, but I personally have done it ...
>>>
>>> I map vnodes to full paths in dwatch. It's not impossible, just
>>> implausibly hard.
>>>
>>> I derived my formula by reading the C code which was very twisty-turny
>>> and rather hard to read at times (and I have been using C since 1998 on
>>> everything from AIX and OSF/1 to HP/UX, Cygwin, MinGW, FreeBSD, countless
>>> Linux-like things, IRIX, and a God-awful remainder of many others; the
>>> vnode code was an adventure to say the least).
>>>
>>> You're welcome to see how it's done in /usr/libexec/dwatch/vop_create
>>>
>>> I load up a clause-local variable named "path" with a path constructed
>>> from a pointer to a vnode structure argument to VOP_CREATE(9).
>>>
>>> The D code could easily be rewritten back into C to walk the vnode to
>>> completion (compared to the D code which is bounded by depth-limit since
>>> DTrace doesn't provide loops; so you have to, as I have done, use a
>>> higher-level language wrapper to repeat the code to some desired limit;
>>> dwatch defaulting to 64 for directory depth limit).
>>>
>>> Compared this, say, to vfssnoop.d from Chapter 5 of the DTrace book
>>> which utilizes the vfs:namei:lookup: probes. My approach in dwatch is far
>>> more accurate, produces full paths, and I've benchmarked it at lower
>>> overhead with better results.
>>>
>>> Maybe some of this can be useful? If not, just ignore me.
>>>
>>
>> IMHO, there's no benefit from the crazy hoops than the super simple
>> heuristic I did: if the path starts with / print it. If the path doesn't
>> print cwd / and then the path.
>>
>> I look forward to seeing your conversion of the D to C that works, even
>> when there's namespace cache pressure.
>>
>>
>> I was looking at the output of "dwatch -dX vop_create" (the -d flag to
>> dwatch causes the generated dwatch to be printed instead of executed) and
>> thinking to myself:
>>
>> I could easily convert this, as I can recognize the flattened loop
>> structure. However, not many people will be able to do it. I wasn't really
>> volunteering, but now I'm curious what other people see when they run
>> "dwatch -dX vop_create". If it's half as bad as I think it is, then I'll
>> gladly do it -- but will have to balance it against work priorities.
>>
>
> We don't have the data you do in vop_create anymore, just the vp at the
> point in the code where we want to do the reverse translation... But we
> also have a name that's been filled in from the template and cwd, which
> gives us almost the same thing as we'd hoped to dig out of the name cache...
>
>
> Given:
>
> struct vnode *vp, const char *fi_name
>
> Here's a rough (not optimized; unchecked) crack at a C equivalent:
>

Thanks, but this code suffers from the same problem that
vn_fullpath_global() suffers from: we clear out parts of the cache when we
open an existing file with O_CREAT. This one NULL leads to a cascade of
failures, as show below.



> #include 
> #include 
>
> #include 
>
> int i, max_depth = 64;
> char *d_name = NULL;
> char *fi_fs = NULL;
> char *fi_mount = NULL;
> char *cp;
> struct namecache *ncp = NULL;
> struct mount *mount = NULL;
> struct vnode *dvp = NULL;
> char *nc[max_depth+1];
> char path[PATH_MAX] = __DECONST(char *, "");
>
> if (vp 

svn commit: r335758 - stable/10

2018-06-28 Thread Devin Teske
Author: dteske
Date: Thu Jun 28 07:01:56 2018
New Revision: 335758
URL: https://svnweb.freebsd.org/changeset/base/335758

Log:
  Add mergeinfo for MFC r335607
  
  This is a direct commit on stable/10 accounting for missing mergeinfo from
  SVN r335744. Difficulties with dealing with 'stand' vs 'sys/boot' in MFCs.
  
  Reported by:  kevans
  Sponsored by: Smule, Inc.

Modified:
Directory Properties:
  stable/10/   (props changed)
___
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: r335690 - head/sys/kern

2018-06-28 Thread Devin Teske


> On Jun 27, 2018, at 7:35 PM, Warner Losh  wrote:
> 
> 
> 
> On Wed, Jun 27, 2018 at 8:14 PM, Devin Teske  > wrote:
> 
>> On Jun 27, 2018, at 6:58 PM, Warner Losh > > wrote:
>> 
>> 
>> 
>> On Wed, Jun 27, 2018 at 7:49 PM, Devin Teske > > wrote:
>> 
>>> On Jun 27, 2018, at 5:59 PM, Warner Losh >> > wrote:
>>> 
>>> 
>>> 
>>> On Wed, Jun 27, 2018 at 5:52 PM, Gleb Smirnoff >> > wrote:
>>> On Wed, Jun 27, 2018 at 04:11:09AM +, Warner Losh wrote:
>>> W> Author: imp
>>> W> Date: Wed Jun 27 04:11:09 2018
>>> W> New Revision: 335690
>>> W> URL: https://svnweb.freebsd.org/changeset/base/335690 
>>> 
>>> W> 
>>> W> Log:
>>> W>   Fix devctl generation for core files.
>>> W>   
>>> W>   We have a problem with vn_fullpath_global when the file exists. Work
>>> W>   around it by printing the full path if the core file name starts with 
>>> /,
>>> W>   or current working directory followed by the filename if not.
>>> 
>>> Is this going to work when a core is dumped not at current working 
>>> directory,
>>> but at absolute path? e.g. kern.corefile=/var/log/cores/%N.core
>>> 
>>> Yes. That works.
>>>  
>>> Looks like the vn_fullpath_global needs to be fixed rather than problem
>>> workarounded.
>>> 
>>> It can't be fixed reliably. FreeBSD does not and cannot map a vnode to a 
>>> name. The only reason we're able to at all is due to the name cache. And 
>>> when we recreate a file, we invalidate the name cache. And even if we fixed 
>>> that, there's no guarantee the name cache won't get flushed before we 
>>> translate the name Linux can do this because it keeps the path name 
>>> associated with the inode. FreeBSD simply doesn't.
>>> 
>> 
>> They said it couldn't be done, but I personally have done it ...
>> 
>> I map vnodes to full paths in dwatch. It's not impossible, just implausibly 
>> hard.
>> 
>> I derived my formula by reading the C code which was very twisty-turny and 
>> rather hard to read at times (and I have been using C since 1998 on 
>> everything from AIX and OSF/1 to HP/UX, Cygwin, MinGW, FreeBSD, countless 
>> Linux-like things, IRIX, and a God-awful remainder of many others; the vnode 
>> code was an adventure to say the least).
>> 
>> You're welcome to see how it's done in /usr/libexec/dwatch/vop_create
>> 
>> I load up a clause-local variable named "path" with a path constructed from 
>> a pointer to a vnode structure argument to VOP_CREATE(9).
>> 
>> The D code could easily be rewritten back into C to walk the vnode to 
>> completion (compared to the D code which is bounded by depth-limit since 
>> DTrace doesn't provide loops; so you have to, as I have done, use a 
>> higher-level language wrapper to repeat the code to some desired limit; 
>> dwatch defaulting to 64 for directory depth limit).
>> 
>> Compared this, say, to vfssnoop.d from Chapter 5 of the DTrace book which 
>> utilizes the vfs:namei:lookup: probes. My approach in dwatch is far more 
>> accurate, produces full paths, and I've benchmarked it at lower overhead 
>> with better results.
>> 
>> Maybe some of this can be useful? If not, just ignore me.
>> 
>> IMHO, there's no benefit from the crazy hoops than the super simple 
>> heuristic I did: if the path starts with / print it. If the path doesn't 
>> print cwd / and then the path.
>> 
>> I look forward to seeing your conversion of the D to C that works, even when 
>> there's namespace cache pressure.
>> 
> 
> I was looking at the output of "dwatch -dX vop_create" (the -d flag to dwatch 
> causes the generated dwatch to be printed instead of executed) and thinking 
> to myself:
> 
> I could easily convert this, as I can recognize the flattened loop structure. 
> However, not many people will be able to do it. I wasn't really volunteering, 
> but now I'm curious what other people see when they run "dwatch -dX 
> vop_create". If it's half as bad as I think it is, then I'll gladly do it -- 
> but will have to balance it against work priorities.
> 
> We don't have the data you do in vop_create anymore, just the vp at the point 
> in the code where we want to do the reverse translation... But we also have a 
> name that's been filled in from the template and cwd, which gives us almost 
> the same thing as we'd hoped to dig out of the name cache...
> 

Given:

struct vnode *vp, const char *fi_name

Here's a rough (not optimized; unchecked) crack at a C equivalent:

#include 
#include 

#include 

int i, max_depth = 64;
char *d_name = NULL;
char *fi_fs = NULL;
char *fi_mount = NULL;
char *cp;
struct namecache *ncp = NULL;
struct mount *mount = NULL;
struct vnode *dvp = NULL;
char *nc[max_depth+1];
char path[PATH_MAX] = __DECONST(char *, "");

if (vp != NULL) {
ncp = 

Re: svn commit: r335746 - head/bin/sh

2018-06-28 Thread Bruce Evans

On Wed, 27 Jun 2018, Bryan Drewery wrote:


Log:
 Stop building intermediate .o files.

 These are not used to link the final tool anymore.  At some point in the past
 the suffix rules changed to not link these in.  The original reason for this in
 r19176 is unclear but seems to be related to mkdep.  The .depend handling is
 still broken here as it is for all build tool patterns like this.


It was to give reproducible builds.  The default .c rule still causes all
compilers to build a temporary .o file in /tmp (or $TMPDIR).  aout put the
name of the object file in the executable.  This is useful for debugging,
but is broken in elf.  Even compiling with -g doesn't keep the names of
object files.

I don't remember needing to fix this for normal programs.  bsd.prog.mk
never used the default .c rule AFAIR.  This is partly so that mkdep works/
worked.  It only directly generates/generated dependencies associated with
the .c.o rule.

Example of aout nm -n output:

XX 1020 F /usr/lib/scrt0.o

File name symbol.

XX 1020 T start
XX 1090 F /var/tmp/cc0189221.o

This one from building with cc -o foo foo.c.

XX 1090 t ___gnu_compiled_c
XX 1090 t gcc2_compiled.
XX 109c T _main
XX 1140 T ___do_global_dtors
XX 1140 F __main.o
XX 1168 T ___do_global_ctors
XX 11c0 T ___main

End of main program/object file.

XX 11e0 T _atexit
XX 11e0 F _exit.o
XX 11e0 F atexit.o
XX 1250 T _wait
XX 1250 F wait.o
XX ...

There is an F symbol for every library file linked.  This is most useful
for determining where the functions came from, especially without full
debugging symbols.

The F symbols are badly sorted (by name after number), so they are
often after the first function name in each file, especially for library
functions whose name starts with an underscore.

Bruce
___
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"