svn commit: r368553 - head/sbin/decryptcore

2020-12-11 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Dec 11 14:32:42 2020
New Revision: 368553
URL: https://svnweb.freebsd.org/changeset/base/368553

Log:
  decryptcore: preload OpenSSL error strings; seed PRNG
  
  As in r360226, preload OpenSSL error strings and seed the PRNG
  before entering capability mode.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/decryptcore/decryptcore.c

Modified: head/sbin/decryptcore/decryptcore.c
==
--- head/sbin/decryptcore/decryptcore.c Fri Dec 11 14:11:41 2020
(r368552)
+++ head/sbin/decryptcore/decryptcore.c Fri Dec 11 14:32:42 2020
(r368553)
@@ -170,6 +170,19 @@ decrypt(int ofd, const char *privkeyfile, const char *
goto failed;
}
 
+   /*
+* Obsolescent OpenSSL only knows about /dev/random, and needs to
+* pre-seed before entering cap mode.  For whatever reason,
+* RSA_pub_encrypt uses the internal PRNG.
+*/
+#if OPENSSL_VERSION_NUMBER < 0x1010L
+   {
+   unsigned char c[1];
+   RAND_bytes(c, 1);
+   }
+#endif
+   ERR_load_crypto_strings();
+
caph_cache_catpages();
if (caph_enter() < 0) {
pjdlog_errno(LOG_ERR, "Unable to enter capability mode");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367059 - head/sys/ddb

2020-10-26 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Oct 26 16:42:53 2020
New Revision: 367059
URL: https://svnweb.freebsd.org/changeset/base/367059

Log:
  db_search_symbol: prevent pollution from bogus symbols
  
  The kernel will never map the first page, so any symbols in that
  range cannot refer to addresses.  Some third-party assembly files
  define internal constants which appear in their symbol table.
  Avoiding the lookup for those symbols avoids replacing small offsets
  with those symbols during disassembly.
  
  Reported by:  Anton Rang 
  Reviewed by:  Anton Rang , markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26895

Modified:
  head/sys/ddb/db_sym.c

Modified: head/sys/ddb/db_sym.c
==
--- head/sys/ddb/db_sym.c   Mon Oct 26 13:24:20 2020(r367058)
+++ head/sys/ddb/db_sym.c   Mon Oct 26 16:42:53 2020(r367059)
@@ -371,8 +371,21 @@ db_search_symbol(db_addr_t val, db_strategy_t strategy
unsigned intdiff;
size_t  newdiff;
int i;
-   c_db_sym_t  ret = C_DB_SYM_NULL, sym;
+   c_db_sym_t  ret, sym;
 
+   /*
+* The kernel will never map the first page, so any symbols in that
+* range cannot refer to addresses.  Some third-party assembly files
+* define internal constants which appear in their symbol table.
+* Avoiding the lookup for those symbols avoids replacing small offsets
+* with those symbols during disassembly.
+*/
+   if (val < PAGE_SIZE) {
+   *offp = 0;
+   return (C_DB_SYM_NULL);
+   }
+
+   ret = C_DB_SYM_NULL;
newdiff = diff = val;
for (i = 0; i < db_nsymtab; i++) {
sym = X_db_search_symbol(_symtabs[i], val, strategy, );
___
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: r366914 - head/sys/dev/ntb/test

2020-10-21 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Oct 21 17:11:57 2020
New Revision: 366914
URL: https://svnweb.freebsd.org/changeset/base/366914

Log:
  ntb_tool: ubuf is too small to hold a human readable 64 bit value
  
  ubuf buffer is too small. It should be 18 if a NULL is not needed,
  or 19 to hold the NULL terminator for the full 64-BIT value plus
  the 0x prefix.
  
  Submitted by: bret_ketc...@dell.com
  Reviewed by:  markj mav
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26893

Modified:
  head/sys/dev/ntb/test/ntb_tool.c

Modified: head/sys/dev/ntb/test/ntb_tool.c
==
--- head/sys/dev/ntb/test/ntb_tool.cWed Oct 21 16:30:34 2020
(r366913)
+++ head/sys/dev/ntb/test/ntb_tool.cWed Oct 21 17:11:57 2020
(r366914)
@@ -384,7 +384,7 @@ get_ubuf(struct sysctl_req *req, char *ubuf)
 static int
 read_out(struct sysctl_req *req, uint64_t val)
 {
-   char ubuf[16];
+   char ubuf[19];
 
memset((void *)ubuf, 0, sizeof(ubuf));
snprintf(ubuf, sizeof(ubuf), "0x%jx", val);
___
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: r366346 - head/contrib/netbsd-tests/lib/libc/sys

2020-10-01 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Oct  1 21:52:57 2020
New Revision: 366346
URL: https://svnweb.freebsd.org/changeset/base/366346

Log:
  fix setitimer test for returned it_value
  
  An old it_value of {4,3} is valid. Allow it.
  
  Reviewed by:  bdrewery
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26445

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cThu Oct  1 
21:48:22 2020(r366345)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cThu Oct  1 
21:52:57 2020(r366346)
@@ -195,8 +195,10 @@ ATF_TC_BODY(setitimer_old, tc)
ATF_REQUIRE(setitimer(ITIMER_REAL, , ) == 0);
 
 #ifdef __FreeBSD__
-   if (ot.it_value.tv_sec == 4 && ot.it_value.tv_usec == 3)
-   atf_tc_fail("setitimer(2) did not return remaining time");
+   ATF_REQUIRE_MSG(ot.it_value.tv_sec < 4 ||
+   ot.it_value.tv_sec == 4 && ot.it_value.tv_usec <= 3,
+   "setitimer(2) returned invalid it_value: %jd %jd",
+   (intmax_t)ot.it_value.tv_sec, (intmax_t)ot.it_value.tv_usec);
 #else
if (ot.it_value.tv_sec != 4 || ot.it_value.tv_usec != 3)
atf_tc_fail("setitimer(2) did not store old values");
___
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: r366345 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep

2020-10-01 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Oct  1 21:48:22 2020
New Revision: 366345
URL: https://svnweb.freebsd.org/changeset/base/366345

Log:
  zgrep: fix exit status with multiple files
  
  zgrep should exit with success when given multiple files and the
  pattern is found in at least one file.  Prior to this change,
  it would exit with success only if the pattern was found in _every_ file.
  
  Reviewed by:  dab ngie
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26616

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/zgrep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shThu Oct  1 21:05:50 
2020(r366344)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shThu Oct  1 21:48:22 
2020(r366345)
@@ -891,6 +891,24 @@ mflag_body()
 
atf_check -o inline:"test1:2\n" grep -m 2 -EHc "a|b|e|f" test1
 }
+
+atf_test_case zgrep_multiple_files
+zgrep_multiple_files_head()
+{
+   atf_set "descr" "Ensures that zgrep functions properly with multiple 
files"
+}
+zgrep_multiple_files_body()
+{
+   echo foo > test1
+   echo foo > test2
+   atf_check -o inline:"test1:foo\ntest2:foo\n" zgrep foo test1 test2
+
+   echo bar > test1
+   atf_check -o inline:"test2:foo\n" zgrep foo test1 test2
+
+   echo bar > test2
+   atf_check -s exit:1 zgrep foo test1 test2
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -944,5 +962,6 @@ atf_init_test_cases()
atf_add_test_case fgrep_oflag
atf_add_test_case cflag
atf_add_test_case mflag
+   atf_add_test_case zgrep_multiple_files
 # End FreeBSD
 }

Modified: head/usr.bin/grep/zgrep.sh
==
--- head/usr.bin/grep/zgrep.sh  Thu Oct  1 21:05:50 2020(r366344)
+++ head/usr.bin/grep/zgrep.sh  Thu Oct  1 21:48:22 2020(r366345)
@@ -157,28 +157,35 @@ then
 pattern_found=1
 fi
 
-ret=0
 # call grep ...
 if [ $# -lt 1 ]
 then
 # ... on stdin
 if [ ${pattern_file} -eq 0 ]; then
-   ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || 
ret=$?
+   ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" -
 else
-   ${cattool} ${catargs} - | ${grep} ${grep_args} -- - || ret=$?
+   ${cattool} ${catargs} - | ${grep} ${grep_args} -- -
 fi
+ret=$?
 else
 # ... on all files given on the command line
 if [ ${silent} -lt 1 -a $# -gt 1 ]; then
grep_args="-H ${grep_args}"
 fi
+# Succeed if any file matches.  First assume no match.
+ret=1
 for file; do
if [ ${pattern_file} -eq 0 ]; then
${cattool} ${catargs} -- "${file}" |
-   ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || 
ret=$?
+   ${grep} --label="${file}" ${grep_args} -- "${pattern}" -
else
${cattool} ${catargs} -- "${file}" |
-   ${grep} --label="${file}" ${grep_args} -- - || ret=$?
+   ${grep} --label="${file}" ${grep_args} -- -
+   fi
+   this_ret=$?
+   # A match (0) overrides a no-match (1).  An error (>=2) overrides all.
+   if [ ${this_ret} -eq 0 -a ${ret} -eq 1 ] || [ ${this_ret} -ge 2 ]; then
+   ret=${this_ret}
fi
 done
 fi
___
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: r365890 - head/sys/amd64/amd64

2020-09-18 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Sep 18 20:53:40 2020
New Revision: 365890
URL: https://svnweb.freebsd.org/changeset/base/365890

Log:
  amd64 pmap_pkru_same: prev_ppr was always NULL
  
  Fix the logic so it works as it appears.
  
  Reported by:  Coverity
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:D26211 (in progress, so omitting full URL)

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Sep 18 19:03:34 2020(r365889)
+++ head/sys/amd64/amd64/pmap.c Fri Sep 18 20:53:40 2020(r365890)
@@ -10788,9 +10788,11 @@ pmap_pkru_same(pmap_t pmap, vm_offset_t sva, vm_offset
sva >= VM_MAXUSER_ADDRESS)
return (true);
MPASS(eva <= VM_MAXUSER_ADDRESS);
-   for (va = sva, prev_ppr = NULL; va < eva;) {
+   for (va = sva; va < eva; prev_ppr = ppr) {
ppr = rangeset_lookup(>pm_pkru, va);
-   if ((ppr == NULL) ^ (prev_ppr == NULL))
+   if (va == sva)
+   prev_ppr = ppr;
+   else if ((ppr == NULL) ^ (prev_ppr == NULL))
return (false);
if (ppr == NULL) {
va += PAGE_SIZE;
___
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: r365886 - in head/sys: dev/fb dev/ksyms dev/vt/hw/fb fs/tmpfs kern vm

2020-09-18 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Sep 18 16:48:08 2020
New Revision: 365886
URL: https://svnweb.freebsd.org/changeset/base/365886

Log:
  vm_ooffset_t is now unsigned
  
  vm_ooffset_t is now unsigned. Remove some tests for negative values,
  or make other adjustments accordingly.
  
  Reported by:  Coverity
  Reviewed by:  kib markj
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26214

Modified:
  head/sys/dev/fb/fbd.c
  head/sys/dev/ksyms/ksyms.c
  head/sys/dev/vt/hw/fb/vt_fb.c
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/kern/uipc_shm.c
  head/sys/kern/vfs_vnops.c
  head/sys/vm/vnode_pager.c

Modified: head/sys/dev/fb/fbd.c
==
--- head/sys/dev/fb/fbd.c   Fri Sep 18 15:51:16 2020(r365885)
+++ head/sys/dev/fb/fbd.c   Fri Sep 18 16:48:08 2020(r365886)
@@ -176,7 +176,7 @@ fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_padd
if (info->fb_flags & FB_FLAG_NOMMAP)
return (ENODEV);
 
-   if (offset >= 0 && offset < info->fb_size) {
+   if (offset < info->fb_size) {
if (info->fb_pbase == 0)
*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
else

Modified: head/sys/dev/ksyms/ksyms.c
==
--- head/sys/dev/ksyms/ksyms.c  Fri Sep 18 15:51:16 2020(r365885)
+++ head/sys/dev/ksyms/ksyms.c  Fri Sep 18 16:48:08 2020(r365886)
@@ -484,7 +484,7 @@ ksyms_mmap_single(struct cdev *dev, vm_ooffset_t *offs
if (error != 0)
return (error);
 
-   if (*offset < 0 || *offset >= round_page(sc->sc_objsz) ||
+   if (*offset >= round_page(sc->sc_objsz) ||
size > round_page(sc->sc_objsz) - *offset ||
(nprot & ~PROT_READ) != 0)
return (EINVAL);

Modified: head/sys/dev/vt/hw/fb/vt_fb.c
==
--- head/sys/dev/vt/hw/fb/vt_fb.c   Fri Sep 18 15:51:16 2020
(r365885)
+++ head/sys/dev/vt/hw/fb/vt_fb.c   Fri Sep 18 16:48:08 2020
(r365886)
@@ -140,7 +140,7 @@ vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, 
if (info->fb_flags & FB_FLAG_NOMMAP)
return (ENODEV);
 
-   if (offset >= 0 && offset < info->fb_size) {
+   if (offset < info->fb_size) {
if (info->fb_pbase == 0) {
*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
} else {

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Fri Sep 18 15:51:16 2020
(r365885)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Fri Sep 18 16:48:08 2020
(r365886)
@@ -178,12 +178,14 @@ RB_PROTOTYPE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_ent
 size_t
 tmpfs_mem_avail(void)
 {
-   vm_ooffset_t avail;
+   size_t avail;
+   long reserved;
 
-   avail = swap_pager_avail + vm_free_count() - tmpfs_pages_reserved;
-   if (__predict_false(avail < 0))
-   avail = 0;
-   return (avail);
+   avail = swap_pager_avail + vm_free_count();
+   reserved = atomic_load_long(_pages_reserved);
+   if (__predict_false(avail < reserved))
+   return (0);
+   return (avail - reserved);
 }
 
 size_t

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cFri Sep 18 15:51:16 2020(r365885)
+++ head/sys/kern/uipc_shm.cFri Sep 18 16:48:08 2020(r365886)
@@ -1577,7 +1577,7 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a
 #ifdef _LP64
objsize > OFF_MAX ||
 #endif
-   foff < 0 || foff > OFF_MAX - objsize) {
+   foff > OFF_MAX - objsize) {
error = EINVAL;
goto out;
}

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Fri Sep 18 15:51:16 2020(r365885)
+++ head/sys/kern/vfs_vnops.c   Fri Sep 18 16:48:08 2020(r365886)
@@ -2630,7 +2630,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *ad
 #ifdef _LP64
size > OFF_MAX ||
 #endif
-   foff < 0 || foff > OFF_MAX - size)
+   foff > OFF_MAX - size)
return (EINVAL);
 
writecounted = FALSE;

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Fri Sep 18 15:51:16 2020(r365885)
+++ head/sys/vm/vnode_pager.c   Fri Sep 18 16:48:08 2020(r365886)
@@ -541,9 +541,6 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t addres
daddr_t vblock;
daddr_t voffset;
 
-   if (address < 0)
-

svn commit: r365845 - head/lib/libpmc/pmu-events

2020-09-17 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Sep 17 18:24:51 2020
New Revision: 365845
URL: https://svnweb.freebsd.org/changeset/base/365845

Log:
  Fix additional memory leak in process_mapfile
  
  Additional Coverity detected memory leak fix.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  cem, emaste
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26462

Modified:
  head/lib/libpmc/pmu-events/jevents.c

Modified: head/lib/libpmc/pmu-events/jevents.c
==
--- head/lib/libpmc/pmu-events/jevents.cThu Sep 17 18:06:57 2020
(r365844)
+++ head/lib/libpmc/pmu-events/jevents.cThu Sep 17 18:24:51 2020
(r365845)
@@ -821,6 +821,8 @@ process_mapfile(FILE *outfp, char *fpath)
/* TODO Deal with lines longer than 16K */
pr_info("%s: Mapfile %s: line %d too long, aborting\n",
prog, fpath, line_num);
+   free(line);
+   fclose(mapfp);
return -1;
}
line[strlen(line)-1] = '\0';
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365051 - head/usr.sbin/pmc

2020-09-01 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Sep  1 15:52:18 2020
New Revision: 365051
URL: https://svnweb.freebsd.org/changeset/base/365051

Log:
  pmc: Fix freed internal location read
  
  Coverity detected this error.  The fix duplicates the assignment on line 171.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26227

Modified:
  head/usr.sbin/pmc/cmd_pmc_summary.cc

Modified: head/usr.sbin/pmc/cmd_pmc_summary.cc
==
--- head/usr.sbin/pmc/cmd_pmc_summary.ccTue Sep  1 15:33:57 2020
(r365050)
+++ head/usr.sbin/pmc/cmd_pmc_summary.ccTue Sep  1 15:52:18 2020
(r365051)
@@ -156,7 +156,7 @@ pmc_summary_handler(int logfd, int k, bool do_full)
auto rate = ratemap[kv.first];
std::cout << "idx: " << kv.first << " name: " << name 
<< " rate: " << rate << std::endl;
while (!kv.second.empty()) {
-   auto  = kv.second.back();
+   auto val = kv.second.back();
kv.second.pop_back();
std::cout << val.second << ": " << val.first << 
std::endl;
}
___
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: r364998 - head/contrib/ofed/infiniband-diags/src

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 16:18:48 2020
New Revision: 364998
URL: https://svnweb.freebsd.org/changeset/base/364998

Log:
  infiniband-diags: Fix memory leak in dump_multicast_tables
  
  Coverity detected leak.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  hselasky, kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26228

Modified:
  head/contrib/ofed/infiniband-diags/src/ibroute.c

Modified: head/contrib/ofed/infiniband-diags/src/ibroute.c
==
--- head/contrib/ofed/infiniband-diags/src/ibroute.cMon Aug 31 16:17:28 
2020(r364997)
+++ head/contrib/ofed/infiniband-diags/src/ibroute.cMon Aug 31 16:18:48 
2020(r364998)
@@ -222,6 +222,7 @@ char *dump_multicast_tables(ib_portid_t * portid, unsi
fprintf(stderr, "SubnGet() failed"
"; MAD status 0x%x AM 0x%x\n",
status, mod);
+   free(mapnd);
return NULL;
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364997 - in head/sys/ofed: drivers/infiniband/core include/rdma

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 16:17:28 2020
New Revision: 364997
URL: https://svnweb.freebsd.org/changeset/base/364997

Log:
  infiniband: Appease Coverty
  
  Coverity claims the call to rdma_gid2ip in cma_igmp_send overwrites addr.
  Use a consistent definition of sockaddr to prevent detections and code
  changes in the future.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  hselasky, kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26229

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_addr.c
  head/sys/ofed/drivers/infiniband/core/ib_cma.c
  head/sys/ofed/drivers/infiniband/core/ib_sa_query.c
  head/sys/ofed/include/rdma/ib_addr.h

Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_addr.c Mon Aug 31 16:07:40 
2020(r364996)
+++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Mon Aug 31 16:17:28 
2020(r364997)
@@ -860,11 +860,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *s
struct rdma_dev_addr dev_addr;
struct resolve_cb_context ctx;
 
-   union {
-   struct sockaddr _sockaddr;
-   struct sockaddr_in  _sockaddr_in;
-   struct sockaddr_in6 _sockaddr_in6;
-   } sgid_addr, dgid_addr;
+   union rdma_sockaddr sgid_addr, dgid_addr;
 
rdma_gid2ip(_addr._sockaddr, sgid);
rdma_gid2ip(_addr._sockaddr, dgid);

Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_cma.c  Mon Aug 31 16:07:40 
2020(r364996)
+++ head/sys/ofed/drivers/infiniband/core/ib_cma.c  Mon Aug 31 16:17:28 
2020(r364997)
@@ -450,18 +450,15 @@ static int cma_igmp_send(struct net_device *ndev, cons
int retval;
 
if (ndev) {
-   union {
-   struct sockaddr sock;
-   struct sockaddr_storage storage;
-   } addr;
+   union rdma_sockaddr addr;
 
-   rdma_gid2ip(, mgid);
+   rdma_gid2ip(_sockaddr, mgid);
 
CURVNET_SET_QUIET(ndev->if_vnet);
if (join)
-   retval = -if_addmulti(ndev, , NULL);
+   retval = -if_addmulti(ndev, _sockaddr, NULL);
else
-   retval = -if_delmulti(ndev, );
+   retval = -if_delmulti(ndev, _sockaddr);
CURVNET_RESTORE();
} else {
retval = -ENODEV;

Modified: head/sys/ofed/drivers/infiniband/core/ib_sa_query.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Mon Aug 31 16:07:40 
2020(r364996)
+++ head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Mon Aug 31 16:17:28 
2020(r364997)
@@ -668,11 +668,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 
struct rdma_dev_addr dev_addr = {.bound_dev_if = rec->ifindex,
 .net = rec->net ? rec->net :
 _net};
-   union {
-   struct sockaddr _sockaddr;
-   struct sockaddr_in  _sockaddr_in;
-   struct sockaddr_in6 _sockaddr_in6;
-   } sgid_addr, dgid_addr;
+   union rdma_sockaddr sgid_addr, dgid_addr;
 
if (!device->get_netdev)
return -EOPNOTSUPP;

Modified: head/sys/ofed/include/rdma/ib_addr.h
==
--- head/sys/ofed/include/rdma/ib_addr.hMon Aug 31 16:07:40 2020
(r364996)
+++ head/sys/ofed/include/rdma/ib_addr.hMon Aug 31 16:17:28 2020
(r364997)
@@ -57,6 +57,13 @@ struct rdma_addr_client {
struct completion comp;
 };
 
+union rdma_sockaddr {
+   struct sockaddr _sockaddr;
+   struct sockaddr_in  _sockaddr_in;
+   struct sockaddr_in6 _sockaddr_in6;
+   struct sockaddr_storage _sockaddr_ss;
+};
+
 /**
  * rdma_addr_register_client - Register an address client.
  */
___
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: r364996 - head/lib/libpmc/pmu-events

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 16:07:40 2020
New Revision: 364996
URL: https://svnweb.freebsd.org/changeset/base/364996

Log:
  libpmc: Fix memory leak in process_mapfile
  
  Coverity detected memory leak fix.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  cem
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26230

Modified:
  head/lib/libpmc/pmu-events/jevents.c

Modified: head/lib/libpmc/pmu-events/jevents.c
==
--- head/lib/libpmc/pmu-events/jevents.cMon Aug 31 15:59:17 2020
(r364995)
+++ head/lib/libpmc/pmu-events/jevents.cMon Aug 31 16:07:40 2020
(r364996)
@@ -794,6 +794,7 @@ process_mapfile(FILE *outfp, char *fpath)
if (!mapfp) {
pr_info("%s: Error %s opening %s\n", prog, strerror(errno),
fpath);
+   free(line);
return -1;
}
 
@@ -850,6 +851,8 @@ process_mapfile(FILE *outfp, char *fpath)
 
 out:
print_mapping_table_suffix(outfp);
+   free(line);
+   fclose(mapfp);
return 0;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364992 - head/sys/fs/nfsserver

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 15:31:17 2020
New Revision: 364992
URL: https://svnweb.freebsd.org/changeset/base/364992

Log:
  Fix nfsrvd_locku memory leak
  
  Coverity detected memory leak fix.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  rmacklem
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26231

Modified:
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cMon Aug 31 15:26:01 2020
(r364991)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cMon Aug 31 15:31:17 2020
(r364992)
@@ -2720,6 +2720,8 @@ nfsrvd_locku(struct nfsrv_descript *nd, __unused int i
stp->ls_stateid.seqid = 0;
} else {
nd->nd_repstat = NFSERR_BADSTATEID;
+   free(stp, M_NFSDSTATE);
+   free(lop, M_NFSDLOCK);
goto nfsmout;
}
}
___
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: r364991 - head/contrib/ofed/opensm/opensm

2020-08-31 Thread Eric van Gyzen

On 8/31/20 10:26 AM, Eric van Gyzen wrote:

Author: vangyzen
Date: Mon Aug 31 15:26:01 2020
New Revision: 364991
URL: https://svnweb.freebsd.org/changeset/base/364991

Log:
   opensm: Fix a possible dereference of a NULL pointer
   


Submitted by:   bret_ketc...@dell.com


   Reported by: Coverity
   Reviewed by: hselasky, kib
   MFC after:   2 weeks
   Sponsored by:Dell EMC Isilon
   Differential Revision:   https://reviews.freebsd.org/D26233

Modified:
   head/contrib/ofed/opensm/opensm/osm_perfmgr.c

Modified: head/contrib/ofed/opensm/opensm/osm_perfmgr.c
==
--- head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:07:15 
2020(r364990)
+++ head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:26:01 
2020(r364991)
@@ -1311,6 +1311,14 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 0) {
@@ -1402,6 +1410,14 @@ static void perfmgr_check_pce_overflow(osm_perfmgr_t *
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 0) {


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


svn commit: r364991 - head/contrib/ofed/opensm/opensm

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 15:26:01 2020
New Revision: 364991
URL: https://svnweb.freebsd.org/changeset/base/364991

Log:
  opensm: Fix a possible dereference of a NULL pointer
  
  Reported by:  Coverity
  Reviewed by:  hselasky, kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26233

Modified:
  head/contrib/ofed/opensm/opensm/osm_perfmgr.c

Modified: head/contrib/ofed/opensm/opensm/osm_perfmgr.c
==
--- head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:07:15 
2020(r364990)
+++ head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:26:01 
2020(r364991)
@@ -1311,6 +1311,14 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 0) {
@@ -1402,6 +1410,14 @@ static void perfmgr_check_pce_overflow(osm_perfmgr_t *
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364989 - head/sys/dev/jedec_dimm

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 15:03:23 2020
New Revision: 364989
URL: https://svnweb.freebsd.org/changeset/base/364989

Log:
  jedec_dimm: fix array overrun
  
  Coverity detected the overrunning of sc->part_str.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26145

Modified:
  head/sys/dev/jedec_dimm/jedec_dimm.c

Modified: head/sys/dev/jedec_dimm/jedec_dimm.c
==
--- head/sys/dev/jedec_dimm/jedec_dimm.cMon Aug 31 14:47:23 2020
(r364988)
+++ head/sys/dev/jedec_dimm/jedec_dimm.cMon Aug 31 15:03:23 2020
(r364989)
@@ -795,7 +795,7 @@ jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, c
 
/* If we're dealing with ASCII, convert trailing spaces to NULs. */
if (ascii) {
-   for (i = dstsz; i > 0; i--) {
+   for (i = dstsz - 1; i > 0; i--) {
if (dst[i] == ' ') {
dst[i] = 0;
} else if (dst[i] == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364935 - head/sys/vm

2020-08-28 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 28 19:59:02 2020
New Revision: 364935
URL: https://svnweb.freebsd.org/changeset/base/364935

Log:
  vm_pageout_scan_active: ensure ps_delta is initialized
  
  Reported by:  Coverity
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26212

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cFri Aug 28 19:52:16 2020(r364934)
+++ head/sys/vm/vm_pageout.cFri Aug 28 19:59:02 2020(r364935)
@@ -1287,8 +1287,10 @@ act_scan:
 * so, discarding any references collected by
 * pmap_ts_referenced().
 */
-   if (__predict_false(_vm_page_queue(old) == PQ_NONE))
+   if (__predict_false(_vm_page_queue(old) == PQ_NONE)) {
+   ps_delta = 0;
break;
+   }
 
/*
 * Advance or decay the act_count based on recent usage.
___
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: r364933 - in head: lib/libmemstat sys/vm

2020-08-28 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 28 19:50:40 2020
New Revision: 364933
URL: https://svnweb.freebsd.org/changeset/base/364933

Log:
  memstat_kvm_uma: fix reading of uma_zone_domain structures
  
  Coverity flagged the scaling by sizeof(uzd).  That is the type
  of the pointer, so the scaling was already done by pointer arithmetic.
  However, this was also passing a stack frame pointer to kvm_read,
  so it was doubly wrong.
  
  Move ZDOM_GET into the !_KERNEL section and use it in libmemstat.
  
  Reported by:  Coverity
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26213

Modified:
  head/lib/libmemstat/memstat_uma.c
  head/sys/vm/uma_int.h

Modified: head/lib/libmemstat/memstat_uma.c
==
--- head/lib/libmemstat/memstat_uma.c   Fri Aug 28 19:21:11 2020
(r364932)
+++ head/lib/libmemstat/memstat_uma.c   Fri Aug 28 19:50:40 2020
(r364933)
@@ -455,9 +455,8 @@ skip_percpu:
mtp->mt_byteslimit = mtp->mt_countlimit * mtp->mt_size;
mtp->mt_count = mtp->mt_numallocs - mtp->mt_numfrees;
for (i = 0; i < ndomains; i++) {
-   ret = kread(kvm,
-   _cpu[mp_maxid + 1] + i * sizeof(uzd),
-   , sizeof(uzd), 0);
+   ret = kread(kvm, ZDOM_GET(uzp, i), ,
+   sizeof(uzd), 0);
if (ret != 0)
continue;
for (ubp =

Modified: head/sys/vm/uma_int.h
==
--- head/sys/vm/uma_int.h   Fri Aug 28 19:21:11 2020(r364932)
+++ head/sys/vm/uma_int.h   Fri Aug 28 19:50:40 2020(r364933)
@@ -526,6 +526,10 @@ struct uma_zone {
KASSERT(uma_zone_get_allocs((z)) == 0,  \
("zone %s initialization after use.", (z)->uz_name))
 
+/* Domains are contiguous after the last CPU */
+#defineZDOM_GET(z, n)  
\
+   (&((uma_zone_domain_t)&(z)->uz_cpu[mp_maxid + 1])[n])
+
 #undef UMA_ALIGN
 
 #ifdef _KERNEL
@@ -560,10 +564,6 @@ static __inline uma_slab_t hash_sfind(struct uma_hash 
 #defineKEG_ASSERT_COLD(k)  
\
KASSERT(uma_keg_get_allocs((k)) == 0,   \
("keg %s initialization after use.", (k)->uk_name))
-
-/* Domains are contiguous after the last CPU */
-#defineZDOM_GET(z, n)  
\
-(&((uma_zone_domain_t)&(z)->uz_cpu[mp_maxid + 1])[n])
 
 #defineZDOM_LOCK_INIT(z, zdom, lc) 
\
do {\
___
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: r364462 - head/sys/dev/ixgbe

2020-08-21 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 21 19:34:41 2020
New Revision: 364462
URL: https://svnweb.freebsd.org/changeset/base/364462

Log:
  ixgbe: fix impossible condition
  
  Coverity flagged this condition: The condition
  offset == 0 && offset == 65535
  can never be true because offset cannot be equal
  to two different values at the same time.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  tsoome, cem
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26144

Modified:
  head/sys/dev/ixgbe/ixgbe_common.c

Modified: head/sys/dev/ixgbe/ixgbe_common.c
==
--- head/sys/dev/ixgbe/ixgbe_common.c   Fri Aug 21 19:28:26 2020
(r364461)
+++ head/sys/dev/ixgbe/ixgbe_common.c   Fri Aug 21 19:34:41 2020
(r364462)
@@ -5147,8 +5147,8 @@ void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw,
nvm_ver->oem_valid = FALSE;
hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, );
 
-   /* Return is offset to OEM Product Version block is invalid */
-   if (offset == 0x0 && offset == NVM_INVALID_PTR)
+   /* Return if offset to OEM Product Version block is invalid */
+   if (offset == 0x0 || offset == NVM_INVALID_PTR)
return;
 
/* Read product version block */
___
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: r364457 - head/sys/amd64/amd64

2020-08-21 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 21 14:22:32 2020
New Revision: 364457
URL: https://svnweb.freebsd.org/changeset/base/364457

Log:
  amd64 pmap: potential integer overflowing expression
  
  Coverity has identified the line in this change as "Potential integer
  overflowing expression" due to the variable i declared as an int
  and used in an expression with vm_paddr_t, a 64bit variable.
  
  This change has very little effect as when this line is execute
  nkpt is small and phys_addr is a the beginning of physical memory.
  But there is no explicit protection that the above is true.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26141

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Aug 21 13:11:33 2020(r364456)
+++ head/sys/amd64/amd64/pmap.c Fri Aug 21 14:22:32 2020(r364457)
@@ -2111,7 +2111,7 @@ pmap_init(void)
 * Collect the page table pages that were replaced by a 2MB
 * page in create_pagetables().  They are zero filled.
 */
-   if (i << PDRSHIFT < KERNend &&
+   if ((vm_paddr_t)i << PDRSHIFT < KERNend &&
pmap_insert_pt_page(kernel_pmap, mpte, false))
panic("pmap_init: pmap_insert_pt_page failed");
}
___
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: r363867 - head/lib/libdevinfo

2020-08-04 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Aug  4 21:09:36 2020
New Revision: 363867
URL: https://svnweb.freebsd.org/changeset/base/363867

Log:
  devinfo: add man page links
  
  Add man page links for all functions in devinfo(3).
  
  Reported by:  vim
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libdevinfo/Makefile

Modified: head/lib/libdevinfo/Makefile
==
--- head/lib/libdevinfo/MakefileTue Aug  4 21:05:53 2020
(r363866)
+++ head/lib/libdevinfo/MakefileTue Aug  4 21:09:36 2020
(r363867)
@@ -5,6 +5,16 @@ SRCS=  devinfo.c
 INCS=  devinfo.h
 MAN=   devinfo.3
 
+MLINKS+=devinfo.3 devinfo_init.3
+MLINKS+=devinfo.3 devinfo_free.3
+MLINKS+=devinfo.3 devinfo_handle_to_device.3
+MLINKS+=devinfo.3 devinfo_handle_to_resource.3
+MLINKS+=devinfo.3 devinfo_handle_to_rman.3
+MLINKS+=devinfo.3 devinfo_foreach_device_child.3
+MLINKS+=devinfo.3 devinfo_foreach_device_resource.3
+MLINKS+=devinfo.3 devinfo_foreach_rman_resource.3
+MLINKS+=devinfo.3 devinfo_foreach_rman.3
+
 SHLIB_MAJOR=   6
 
 WARNS?=3
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363866 - head/lib/libdevinfo

2020-08-04 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Aug  4 21:05:53 2020
New Revision: 363866
URL: https://svnweb.freebsd.org/changeset/base/363866

Log:
  devinfo: fix memory leak on error paths
  
  Refactor to create devinfo_free_dev().  Call it to plug a memory leak
  on two error paths in devinfo_init_devices().
  
  Reported by:  Coverity
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libdevinfo/devinfo.c

Modified: head/lib/libdevinfo/devinfo.c
==
--- head/lib/libdevinfo/devinfo.c   Tue Aug  4 20:54:12 2020
(r363865)
+++ head/lib/libdevinfo/devinfo.c   Tue Aug  4 21:05:53 2020
(r363866)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 static int devinfo_init_devices(int generation);
 static int devinfo_init_resources(int generation);
+static voiddevinfo_free_dev(struct devinfo_i_dev *dd);
 
 TAILQ_HEAD(,devinfo_i_dev) devinfo_dev;
 TAILQ_HEAD(,devinfo_i_rman)devinfo_rman;
@@ -225,7 +226,7 @@ devinfo_init_devices(int generation)
rlen, sizeof(udev));
return (EINVAL);
}
-   if ((dd = malloc(sizeof(*dd))) == NULL)
+   if ((dd = calloc(1, sizeof(*dd))) == NULL)
return(ENOMEM);
dd->dd_dev.dd_handle = udev.dv_handle;
dd->dd_dev.dd_parent = udev.dv_parent;
@@ -242,10 +243,14 @@ devinfo_init_devices(int generation)
dd->dd_location = NULL;
 #define UNPACK(x)  \
dd->dd_dev.x = dd->x = strdup(walker);  \
-   if (dd->x == NULL)  \
+   if (dd->x == NULL) {\
+   devinfo_free_dev(dd);   \
return(ENOMEM); \
-   if (walker + strnlen(walker, ep - walker) >= ep)\
+   }   \
+   if (walker + strnlen(walker, ep - walker) >= ep) {  \
+   devinfo_free_dev(dd);   \
return(EINVAL); \
+   }   \
walker += strlen(walker) + 1;
 
UNPACK(dd_name);
@@ -365,6 +370,20 @@ devinfo_init_resources(int generation)
 }
 
 /*
+ * Free an individual dev.
+ */
+static void
+devinfo_free_dev(struct devinfo_i_dev *dd)
+{
+   free(dd->dd_name);
+   free(dd->dd_desc);
+   free(dd->dd_drivername);
+   free(dd->dd_pnpinfo);
+   free(dd->dd_location);
+   free(dd);
+}  
+
+/*
  * Free the list contents.
  */
 void
@@ -376,12 +395,7 @@ devinfo_free(void)
 
while ((dd = TAILQ_FIRST(_dev)) != NULL) {
TAILQ_REMOVE(_dev, dd, dd_link);
-   free(dd->dd_name);
-   free(dd->dd_desc);
-   free(dd->dd_drivername);
-   free(dd->dd_pnpinfo);
-   free(dd->dd_location);
-   free(dd);
+   devinfo_free_dev(dd);
}
while ((dm = TAILQ_FIRST(_rman)) != NULL) {
TAILQ_REMOVE(_rman, dm, dm_link);
___
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: r363607 - head/sys/vm

2020-07-28 Thread Eric van Gyzen

On 7/27/20 9:25 AM, Mark Johnston wrote:

+
+   /*
+* We may be attempting to free the page as part of the handling for an
+* I/O error, in which case the page was xbusied by a different thread.
+*/
+   vm_page_xbusy_claim(m);


I've just noticed that vm_page_xbusy_claim() ignores the WAITERS bit. 
Is this not a problem in practice?


Eric
___
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: r363221 - head/contrib/ofed/libibverbs/examples

2020-07-15 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul 15 13:26:15 2020
New Revision: 363221
URL: https://svnweb.freebsd.org/changeset/base/363221

Log:
  Fix style in r363220
  
  Apply the style change Kostik suggested in the review.
  
  Reported by:  kib
  MFC after:2 weeks
  X-MFC with:   r363220
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D25676

Modified:
  head/contrib/ofed/libibverbs/examples/rc_pingpong.c
  head/contrib/ofed/libibverbs/examples/srq_pingpong.c
  head/contrib/ofed/libibverbs/examples/uc_pingpong.c
  head/contrib/ofed/libibverbs/examples/ud_pingpong.c
  head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c

Modified: head/contrib/ofed/libibverbs/examples/rc_pingpong.c
==
--- head/contrib/ofed/libibverbs/examples/rc_pingpong.c Wed Jul 15 13:17:16 
2020(r363220)
+++ head/contrib/ofed/libibverbs/examples/rc_pingpong.c Wed Jul 15 13:26:15 
2020(r363221)
@@ -273,7 +273,7 @@ static struct pingpong_dest *pp_server_exch_dest(struc
return NULL;
}
 
-   if (listen(sockfd, 1)) {
+   if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;

Modified: head/contrib/ofed/libibverbs/examples/srq_pingpong.c
==
--- head/contrib/ofed/libibverbs/examples/srq_pingpong.cWed Jul 15 
13:17:16 2020(r363220)
+++ head/contrib/ofed/libibverbs/examples/srq_pingpong.cWed Jul 15 
13:26:15 2020(r363221)
@@ -283,7 +283,7 @@ static struct pingpong_dest *pp_server_exch_dest(struc
return NULL;
}
 
-   if (listen(sockfd, 1)) {
+   if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;

Modified: head/contrib/ofed/libibverbs/examples/uc_pingpong.c
==
--- head/contrib/ofed/libibverbs/examples/uc_pingpong.c Wed Jul 15 13:17:16 
2020(r363220)
+++ head/contrib/ofed/libibverbs/examples/uc_pingpong.c Wed Jul 15 13:26:15 
2020(r363221)
@@ -247,7 +247,7 @@ static struct pingpong_dest *pp_server_exch_dest(struc
return NULL;
}
 
-   if (listen(sockfd, 1)) {
+   if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;

Modified: head/contrib/ofed/libibverbs/examples/ud_pingpong.c
==
--- head/contrib/ofed/libibverbs/examples/ud_pingpong.c Wed Jul 15 13:17:16 
2020(r363220)
+++ head/contrib/ofed/libibverbs/examples/ud_pingpong.c Wed Jul 15 13:26:15 
2020(r363221)
@@ -245,7 +245,7 @@ static struct pingpong_dest *pp_server_exch_dest(struc
return NULL;
}
 
-   if (listen(sockfd, 1)) {
+   if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;

Modified: head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c
==
--- head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c   Wed Jul 15 
13:17:16 2020(r363220)
+++ head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c   Wed Jul 15 
13:26:15 2020(r363221)
@@ -630,7 +630,7 @@ static int pp_server_connect(int port)
return 1;
}
 
-   if (listen(sockfd, ctx.num_clients)) {
+   if (listen(sockfd, ctx.num_clients) < 0) {
perror("listen() failed");
close(sockfd);
return 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"


svn commit: r363220 - in head/contrib/ofed: infiniband-diags/src libibumad libibverbs libibverbs/examples libmlx5 librdmacm/examples opensm/opensm

2020-07-15 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul 15 13:17:16 2020
New Revision: 363220
URL: https://svnweb.freebsd.org/changeset/base/363220

Log:
  Fix Coverity issues in OFED
  
  read_ibdiag_config NULL deref
  read_ibdiag_config mem leak
  ib_mad_inv_field_str Missing comma in a string array initialization
  print_node_header NULL deref
  diff_node_ports copy-paste error
  ibportstate.c main() missing break in switch
  set_thresholds NULL ptr deref
  dump_unicast_tables leaks mapnd
  umad_cm_attr_str dead code
  __ibv_close_device close(-1)
  check return value of listen()
  mlx5 bitmap.h - bad bit shift - UB
  get_dst_addr check return value of inet_pton
  osm_perfmgr_init check return value of cl_spinlock_init
  osm_port_new memory leak on error path
  sa_mad_ctrl_rcv_callback missing break in switch case
  
  I did not include CID numbers because these were found by an internal
  run at Isilon.
  
  Reviewed by:  cem kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D25676

Modified:
  head/contrib/ofed/infiniband-diags/src/ibdiag_common.c
  head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c
  head/contrib/ofed/infiniband-diags/src/iblinkinfo.c
  head/contrib/ofed/infiniband-diags/src/ibportstate.c
  head/contrib/ofed/infiniband-diags/src/ibqueryerrors.c
  head/contrib/ofed/infiniband-diags/src/ibroute.c
  head/contrib/ofed/libibumad/umad_str.c
  head/contrib/ofed/libibverbs/device.c
  head/contrib/ofed/libibverbs/examples/rc_pingpong.c
  head/contrib/ofed/libibverbs/examples/srq_pingpong.c
  head/contrib/ofed/libibverbs/examples/uc_pingpong.c
  head/contrib/ofed/libibverbs/examples/ud_pingpong.c
  head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c
  head/contrib/ofed/libmlx5/bitmap.h
  head/contrib/ofed/librdmacm/examples/mckey.c
  head/contrib/ofed/opensm/opensm/osm_perfmgr.c
  head/contrib/ofed/opensm/opensm/osm_port.c
  head/contrib/ofed/opensm/opensm/osm_sa_mad_ctrl.c

Modified: head/contrib/ofed/infiniband-diags/src/ibdiag_common.c
==
--- head/contrib/ofed/infiniband-diags/src/ibdiag_common.c  Wed Jul 15 
12:08:06 2020(r363219)
+++ head/contrib/ofed/infiniband-diags/src/ibdiag_common.c  Wed Jul 15 
13:17:16 2020(r363220)
@@ -120,6 +120,7 @@ static inline int val_str_true(const char *val_str)
 void read_ibdiag_config(const char *file)
 {
char buf[1024];
+   char orig_buf[1024];
FILE *config_fd = NULL;
char *p_prefix, *p_last;
char *name;
@@ -142,8 +143,14 @@ void read_ibdiag_config(const char *file)
if (*p_prefix == '#')
continue; /* ignore comment lines */
 
+   strlcpy(orig_buf, buf, sizeof(orig_buf));
name = strtok_r(p_prefix, "=", _last);
val_str = strtok_r(NULL, "\n", _last);
+   if (!name || !val_str) {
+   fprintf(stderr, "%s: malformed line in \"%s\":\n%s\n",
+   prog_name, file, orig_buf);
+   continue;
+   }
 
if (strncmp(name, "CA", strlen("CA")) == 0) {
free(ibd_ca);
@@ -165,6 +172,7 @@ void read_ibdiag_config(const char *file)
ibd_sakey = strtoull(val_str, 0, 0);
} else if (strncmp(name, "nd_format",
   strlen("nd_format")) == 0) {
+   free(ibd_nd_format);
ibd_nd_format = strdup(val_str);
}
}

Modified: head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c
==
--- head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c  Wed Jul 15 12:08:06 
2020(r363219)
+++ head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c  Wed Jul 15 13:17:16 
2020(r363220)
@@ -222,7 +222,7 @@ static const char *ib_mad_inv_field_str[] = {
"MAD Reserved",
"MAD Reserved",
"MAD Reserved",
-   "MAD Invalid value in Attribute field(s) or Attribute Modifier"
+   "MAD Invalid value in Attribute field(s) or Attribute Modifier",
"MAD UNKNOWN ERROR"
 };
 #define MAD_ERR_UNKNOWN (ARR_SIZE(ib_mad_inv_field_str) - 1)

Modified: head/contrib/ofed/infiniband-diags/src/iblinkinfo.c
==
--- head/contrib/ofed/infiniband-diags/src/iblinkinfo.c Wed Jul 15 12:08:06 
2020(r363219)
+++ head/contrib/ofed/infiniband-diags/src/iblinkinfo.c Wed Jul 15 13:17:16 
2020(r363220)
@@ -293,7 +293,8 @@ void print_node_header(ibnd_node_t *node, int *out_hea
printf("%s%s: %s:\n",
out_prefix ? out_prefix : "",
nodetype_str(node), remap);
-   (*out_header_flag)++;
+   if (out_header_flag)
+

Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/

2020-06-27 Thread Eric van Gyzen

On 6/27/20 8:11 AM, John Baldwin wrote:

On 6/27/20 5:02 AM, Stefan Eßer wrote:

Author: se
Date: Sat Jun 27 12:02:01 2020
New Revision: 362681
URL: https://svnweb.freebsd.org/changeset/base/362681

Log:
   Import new 2-clause BSD licenced implementation of the bc and dc commands


Hmm, I didn't see a commit to add the vendor sources into ^/vendor first via our
standard process for contrib sources, nor any discussion about that in the 
review.


When you add this to the vendor area, please include the tests, to 
remove a barrier to integration.


Eric
___
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: r362126 - head/sys/vm

2020-06-12 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Jun 12 21:53:08 2020
New Revision: 362126
URL: https://svnweb.freebsd.org/changeset/base/362126

Log:
  Honor db_pager_quit in some vm_object ddb commands
  
  These can be rather verbose.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Fri Jun 12 21:51:20 2020(r362125)
+++ head/sys/vm/vm_object.c Fri Jun 12 21:53:08 2020(r362126)
@@ -2694,6 +2694,8 @@ DB_SHOW_COMMAND(vmochk, vm_object_check)
(void *)object->backing_object);
}
}
+   if (db_pager_quit)
+   return;
}
 }
 
@@ -2744,6 +2746,9 @@ DB_SHOW_COMMAND(object, vm_object_print_static)
 
db_printf("(off=0x%jx,page=0x%jx)",
(uintmax_t)p->pindex, (uintmax_t)VM_PAGE_TO_PHYS(p));
+
+   if (db_pager_quit)
+   break;
}
if (count != 0)
db_printf("\n");
___
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: r362121 - in head/sys: amd64/amd64 i386/i386

2020-06-12 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Jun 12 21:17:56 2020
New Revision: 362121
URL: https://svnweb.freebsd.org/changeset/base/362121

Log:
  FPU init: allocate initial state from UMA to ensure alignment
  
  The Intel Instruction Set Reference says this about the XSAVE instruction:
  
  Use of a destination operand not aligned to 64-byte boundary
  (in either 64-bit or 32-bit modes) results in a general-protection
  (#GP) exception.
  
  This alignment happens naturally when all malloc buckets are powers
  of two.  However, this change is necessary on some systems when
  certain non-power-of-two (and non-multiple of 64) malloc buckets
  are defined.
  
  Reviewed by:  cem; kib; earlier version by jhb
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D25098

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/i386/i386/npx.c

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Fri Jun 12 21:12:26 2020(r362120)
+++ head/sys/amd64/amd64/fpu.c  Fri Jun 12 21:17:56 2020(r362121)
@@ -372,8 +372,7 @@ fpuinitstate(void *arg __unused)
fpu_save_area_zone = uma_zcreate("FPU_save_area",
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
XSAVE_AREA_ALIGN - 1, 0);
-   fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
-   M_WAITOK | M_ZERO);
+   fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
if (use_xsave) {
max_ext_n = flsl(xsave_mask);
xsave_area_desc = malloc(max_ext_n * sizeof(struct

Modified: head/sys/i386/i386/npx.c
==
--- head/sys/i386/i386/npx.cFri Jun 12 21:12:26 2020(r362120)
+++ head/sys/i386/i386/npx.cFri Jun 12 21:17:56 2020(r362121)
@@ -483,8 +483,7 @@ npxinitstate(void *arg __unused)
fpu_save_area_zone = uma_zcreate("FPU_save_area",
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
XSAVE_AREA_ALIGN - 1, 0);
-   npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
-   M_WAITOK | M_ZERO);
+   npx_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
if (use_xsave) {
if (xsave_mask >> 32 != 0)
max_ext_n = fls(xsave_mask >> 32) + 32;
___
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: r362120 - in head/sys: amd64/amd64 i386/i386

2020-06-12 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Jun 12 21:12:26 2020
New Revision: 362120
URL: https://svnweb.freebsd.org/changeset/base/362120

Log:
  FPU: make xsave_area_desc static
  
  ...because it can be.
  
  Reviewed by:  cem kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D25098

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/i386/i386/npx.c

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Fri Jun 12 21:10:45 2020(r362119)
+++ head/sys/amd64/amd64/fpu.c  Fri Jun 12 21:12:26 2020(r362120)
@@ -159,7 +159,7 @@ uint64_t xsave_mask;/* the same */
 static uma_zone_t fpu_save_area_zone;
 static struct savefpu *fpu_initialstate;
 
-struct xsave_area_elm_descr {
+static struct xsave_area_elm_descr {
u_int   offset;
u_int   size;
 } *xsave_area_desc;

Modified: head/sys/i386/i386/npx.c
==
--- head/sys/i386/i386/npx.cFri Jun 12 21:10:45 2020(r362119)
+++ head/sys/i386/i386/npx.cFri Jun 12 21:12:26 2020(r362120)
@@ -201,7 +201,7 @@ uint64_t xsave_mask;
 static uma_zone_t fpu_save_area_zone;
 static union savefpu *npx_initialstate;
 
-struct xsave_area_elm_descr {
+static struct xsave_area_elm_descr {
u_int   offset;
u_int   size;
 } *xsave_area_desc;
___
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: r362119 - in head/sys: amd64/amd64 i386/i386

2020-06-12 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Jun 12 21:10:45 2020
New Revision: 362119
URL: https://svnweb.freebsd.org/changeset/base/362119

Log:
  FPU init: Do potentially blocking operations before disabling interrupts
  
  In particular, uma_zcreate creates sysctl oids, which locks an sx lock,
  which uses IPIs under contention.  IPIs tend not to work very well
  when interrupts are disabled.  Who knew, right?
  
  Reviewed by:  cem kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D25098

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/i386/i386/npx.c

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Fri Jun 12 20:39:42 2020(r362118)
+++ head/sys/amd64/amd64/fpu.c  Fri Jun 12 21:10:45 2020(r362119)
@@ -368,8 +368,18 @@ fpuinitstate(void *arg __unused)
register_t saveintr;
int cp[4], i, max_ext_n;
 
+   /* Do potentially blocking operations before disabling interrupts. */
+   fpu_save_area_zone = uma_zcreate("FPU_save_area",
+   cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
+   XSAVE_AREA_ALIGN - 1, 0);
fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
M_WAITOK | M_ZERO);
+   if (use_xsave) {
+   max_ext_n = flsl(xsave_mask);
+   xsave_area_desc = malloc(max_ext_n * sizeof(struct
+   xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
+   }
+
saveintr = intr_disable();
stop_emulating();
 
@@ -399,9 +409,6 @@ fpuinitstate(void *arg __unused)
offsetof(struct xstate_hdr, xstate_bv));
*xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE;
 
-   max_ext_n = flsl(xsave_mask);
-   xsave_area_desc = malloc(max_ext_n * sizeof(struct
-   xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
/* x87 state */
xsave_area_desc[0].offset = 0;
xsave_area_desc[0].size = 160;
@@ -415,10 +422,6 @@ fpuinitstate(void *arg __unused)
xsave_area_desc[i].size = cp[0];
}
}
-
-   fpu_save_area_zone = uma_zcreate("FPU_save_area",
-   cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
-   XSAVE_AREA_ALIGN - 1, 0);
 
start_emulating();
intr_restore(saveintr);

Modified: head/sys/i386/i386/npx.c
==
--- head/sys/i386/i386/npx.cFri Jun 12 20:39:42 2020(r362118)
+++ head/sys/i386/i386/npx.cFri Jun 12 21:10:45 2020(r362119)
@@ -479,8 +479,21 @@ npxinitstate(void *arg __unused)
if (!hw_float)
return;
 
+   /* Do potentially blocking operations before disabling interrupts. */
+   fpu_save_area_zone = uma_zcreate("FPU_save_area",
+   cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
+   XSAVE_AREA_ALIGN - 1, 0);
npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
M_WAITOK | M_ZERO);
+   if (use_xsave) {
+   if (xsave_mask >> 32 != 0)
+   max_ext_n = fls(xsave_mask >> 32) + 32;
+   else
+   max_ext_n = fls(xsave_mask);
+   xsave_area_desc = malloc(max_ext_n * sizeof(struct
+   xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
+   }
+
saveintr = intr_disable();
stop_emulating();
 
@@ -522,12 +535,6 @@ npxinitstate(void *arg __unused)
offsetof(struct xstate_hdr, xstate_bv));
*xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE;
 
-   if (xsave_mask >> 32 != 0)
-   max_ext_n = fls(xsave_mask >> 32) + 32;
-   else
-   max_ext_n = fls(xsave_mask);
-   xsave_area_desc = malloc(max_ext_n * sizeof(struct
-   xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
/* x87 state */
xsave_area_desc[0].offset = 0;
xsave_area_desc[0].size = 160;
@@ -541,10 +548,6 @@ npxinitstate(void *arg __unused)
xsave_area_desc[i].size = cp[0];
}
}
-
-   fpu_save_area_zone = uma_zcreate("FPU_save_area",
-   cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
-   XSAVE_AREA_ALIGN - 1, 0);
 
start_emulating();
intr_restore(saveintr);
___
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: r361699 - head/sys/kern

2020-06-01 Thread Eric van Gyzen

  void
  vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
  {
  
  	bcopy(oexp, exp, sizeof(*oexp));

-   exp->ex_numsecflavors = 0;
+   if (exp->ex_flags & MNT_EXPORTED) {
+   exp->ex_numsecflavors = 1;
+   exp->ex_secflavors[0] = AUTH_SYS;


#include  will be needed for this.

This of course opens a new can of worms with regard to namespace pollution.


rpc/types.h and rpc/auth.h are sufficient, but that doesn't make the can 
much smaller.


Eric
___
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: r360964 - in head: lib/libclang_rt lib/libthr lib/msun libexec/rtld-elf libexec/tftpd/tests share/mk stand stand/arm/uboot stand/efi stand/efi/boot1 stand/efi/loader stand/i386/boot2 s

2020-05-28 Thread Eric van Gyzen

On 5/25/20 3:37 AM, Tijl Coosemans wrote:

On Tue, 12 May 2020 15:22:41 + (UTC) Eric van Gyzen
 wrote:

Author: vangyzen
Date: Tue May 12 15:22:40 2020
New Revision: 360964
URL: https://svnweb.freebsd.org/changeset/base/360964

Log:
   Remove tests for obsolete compilers in the build system
   
   Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.

   Assume clang is at least 6, which was in 11.2-RELEASE.  Drop conditions
   for older compilers.
   
   Reviewed by:	imp (earlier version), emaste, jhb

   MFC after:   2 weeks
   Sponsored by:Dell EMC Isilon
   Differential Revision:   https://reviews.freebsd.org/D24802


This broke devel/linux_libusb.  It is FreeBSD libusb built with Linux
gcc 4.8.5 (devel/linux-c7-devtools).  It's probably caused by the
changes to share/mk/*.

http://beefy18.nyi.freebsd.org/data/head-amd64-default/p536258_s361404/logs/linux_libusb-13.0r358841.log


This should be fixed in r361605.  Thanks for bringing it to my attention.

Eric
___
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: r361606 - head

2020-05-28 Thread Eric van Gyzen
Author: vangyzen
Date: Thu May 28 22:05:33 2020
New Revision: 361606
URL: https://svnweb.freebsd.org/changeset/base/361606

Log:
  Add an UPDATING entry for r360964
  
  Reported by:  rpokala
  Sponsored by: Dell EMC Isilon

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Thu May 28 21:56:31 2020(r361605)
+++ head/UPDATING   Thu May 28 22:05:33 2020(r361606)
@@ -32,6 +32,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
information about prerequisites and upgrading, if you are not already
using clang 3.5.0 or higher.
 
+20200512:
+   Support for obsolete compilers has been removed from the build system.
+   Clang 6 and GCC 6.4 are the minimum supported versions.
+
 20200424:
closefrom(2) has been moved under COMPAT12, and replaced in libc with a
stub that calls close_range(2).  If using a custom kernel configuration,
___
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: r361605 - head/share/mk

2020-05-28 Thread Eric van Gyzen
Author: vangyzen
Date: Thu May 28 21:56:31 2020
New Revision: 361605
URL: https://svnweb.freebsd.org/changeset/base/361605

Log:
  Revert part of r360964
  
  ports/devel/linux_libusb builds FreeBSD libusb with GCC 4.8.5
  from devel/linux-c7-devtools.  Restore the tests for older GCC
  in bsd.sys.mk to accomodate such ports.
  
  Reported by:  tijl
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkThu May 28 21:30:29 2020(r361604)
+++ head/share/mk/bsd.sys.mkThu May 28 21:56:31 2020(r361605)
@@ -124,7 +124,12 @@ CWARNFLAGS+=   -Wno-format
 # GCC
 # We should clean up warnings produced with these flags.
 # They were originally added as a quick hack to enable gcc5/6.
+# The base system requires at least GCC 6.4, but some ports
+# use this file with older compilers.  Request an exprun
+# before changing these.
 .if ${COMPILER_TYPE} == "gcc"
+# GCC 5.2.0
+.if ${COMPILER_VERSION} >= 50200
 CWARNFLAGS+=   -Wno-error=address  \
-Wno-error=array-bounds \
-Wno-error=attributes   \
@@ -136,15 +141,20 @@ CWARNFLAGS+=  -Wno-error=address  
\
-Wno-error=extra\
-Wno-error=inline   \
-Wno-error=logical-not-parentheses  \
-   -Wno-error=nonnull-compare  \
-   -Wno-error=shift-negative-value \
-Wno-error=strict-aliasing  \
-   -Wno-error=tautological-compare \
-Wno-error=uninitialized\
-Wno-error=unused-but-set-variable  \
-   -Wno-error=unused-const-variable\
-Wno-error=unused-function  \
-Wno-error=unused-value
+.endif
+
+# GCC 6.1.0
+.if ${COMPILER_VERSION} >= 60100
+CWARNFLAGS+=   -Wno-error=nonnull-compare  \
+   -Wno-error=shift-negative-value \
+   -Wno-error=tautological-compare \
+   -Wno-error=unused-const-variable
+.endif
 
 # GCC 7.1.0
 .if ${COMPILER_VERSION} >= 70100
___
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: r361559 - head/lib/libifconfig

2020-05-27 Thread Eric van Gyzen
Author: vangyzen
Date: Wed May 27 18:26:10 2020
New Revision: 361559
URL: https://svnweb.freebsd.org/changeset/base/361559

Log:
  libifconfig: remove redundant NULL check
  
  Submitted by: puneeth_kumar.jotha...@emc.com
  Reported by:  Coverity
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libifconfig/libifconfig_inet6.c

Modified: head/lib/libifconfig/libifconfig_inet6.c
==
--- head/lib/libifconfig/libifconfig_inet6.cWed May 27 18:24:50 2020
(r361558)
+++ head/lib/libifconfig/libifconfig_inet6.cWed May 27 18:26:10 2020
(r361559)
@@ -97,7 +97,7 @@ ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h,
addr->lifetime = ifr6.ifr_ifru.ifru_lifetime; /* struct copy */
 
/* Set the vhid */
-   if (ifa->ifa_data && ifa->ifa_data) {
+   if (ifa->ifa_data) {
addr->vhid = ((struct if_data *)ifa->ifa_data)->ifi_vhid;
}
 
___
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: r360964 - in head: lib/libclang_rt lib/libthr lib/msun libexec/rtld-elf libexec/tftpd/tests share/mk stand stand/arm/uboot stand/efi stand/efi/boot1 stand/efi/loader stand/i386/boot2 s

2020-05-13 Thread Eric van Gyzen

> Why is this marked for MFC? FreeBSD 12 uses base GCC 4.2.1 on some platforms.

You’re right, this won’t be MFC’d.  My client is configured to add the MFC by 
default, and I failed to remove it.

Eric
___
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: r360964 - in head: lib/libclang_rt lib/libthr lib/msun libexec/rtld-elf libexec/tftpd/tests share/mk stand stand/arm/uboot stand/efi stand/efi/boot1 stand/efi/loader stand/i386/boot2 st...

2020-05-12 Thread Eric van Gyzen
Author: vangyzen
Date: Tue May 12 15:22:40 2020
New Revision: 360964
URL: https://svnweb.freebsd.org/changeset/base/360964

Log:
  Remove tests for obsolete compilers in the build system
  
  Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.
  Assume clang is at least 6, which was in 11.2-RELEASE.  Drop conditions
  for older compilers.
  
  Reviewed by:  imp (earlier version), emaste, jhb
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D24802

Modified:
  head/lib/libclang_rt/Makefile.inc
  head/lib/libthr/Makefile
  head/lib/msun/Makefile
  head/libexec/rtld-elf/Makefile
  head/libexec/tftpd/tests/Makefile
  head/share/mk/bsd.compiler.mk
  head/share/mk/bsd.sys.mk
  head/stand/arm/uboot/Makefile
  head/stand/defs.mk
  head/stand/efi/Makefile
  head/stand/efi/boot1/Makefile
  head/stand/efi/loader/Makefile
  head/stand/i386/boot2/Makefile
  head/stand/i386/isoboot/Makefile
  head/stand/libsa/Makefile
  head/sys/conf/Makefile.arm
  head/sys/conf/Makefile.powerpc
  head/sys/conf/kern.mk
  head/sys/conf/kern.post.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/modules/Makefile
  head/usr.sbin/acpi/acpidb/Makefile
  head/usr.sbin/trpt/Makefile
  head/usr.sbin/zic/zic/Makefile

Modified: head/lib/libclang_rt/Makefile.inc
==
--- head/lib/libclang_rt/Makefile.inc   Tue May 12 14:47:38 2020
(r360963)
+++ head/lib/libclang_rt/Makefile.inc   Tue May 12 15:22:40 2020
(r360964)
@@ -32,7 +32,7 @@ CFLAGS+=  ${PICFLAG}
 CFLAGS+=   -fno-builtin
 CFLAGS+=   -fno-exceptions
 CXXFLAGS+= -fno-rtti
-.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 30700
+.if ${COMPILER_TYPE} == clang
 CFLAGS+=   -fno-sanitize=safe-stack
 .endif
 CFLAGS+=   -fno-stack-protector

Modified: head/lib/libthr/Makefile
==
--- head/lib/libthr/MakefileTue May 12 14:47:38 2020(r360963)
+++ head/lib/libthr/MakefileTue May 12 15:22:40 2020(r360964)
@@ -29,10 +29,7 @@ CFLAGS+=-Winline
 
 CFLAGS.thr_stack.c+=   -Wno-cast-align
 CFLAGS.rtld_malloc.c+= -Wno-cast-align
-.include 
-.if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300)
 CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations
-.endif
 
 .ifndef NO_THREAD_UNWIND_STACK
 CFLAGS+=-fexceptions

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Tue May 12 14:47:38 2020(r360963)
+++ head/lib/msun/Makefile  Tue May 12 15:22:40 2020(r360964)
@@ -108,13 +108,13 @@ COMMON_SRCS+= catrigl.c \
s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \
s_scalbnl.c s_sinl.c s_sincosl.c \
s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
-# Work around this warning from gcc 6:
+# Work around this warning from gcc:
 # lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of
 # 'long double' [-Werror=overflow]
 # if( y >= LDBL_MAX )
 # See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067
 .include 
-.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 6
+.if ${COMPILER_TYPE} == "gcc"
 CFLAGS.e_powl.c+= -Wno-error=overflow
 .endif
 .endif

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Tue May 12 14:47:38 2020
(r360963)
+++ head/libexec/rtld-elf/Makefile  Tue May 12 15:22:40 2020
(r360964)
@@ -90,8 +90,4 @@ ${PROG_FULL}: ${VERSION_MAP}
 # GCC warns about redeclarations even though they have __exported
 # and are therefore not identical to the ones from the system headers.
 CFLAGS+=   -Wno-redundant-decls
-.if ${COMPILER_VERSION} < 40300
-# Silence -Wshadow false positives in ancient GCC
-CFLAGS+=   -Wno-shadow
-.endif
 .endif

Modified: head/libexec/tftpd/tests/Makefile
==
--- head/libexec/tftpd/tests/Makefile   Tue May 12 14:47:38 2020
(r360963)
+++ head/libexec/tftpd/tests/Makefile   Tue May 12 15:22:40 2020
(r360964)
@@ -2,11 +2,8 @@
 
 .include 
 
-# Skip on GCC 4.2, because it lacks __COUNTER__
-.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40300
 ATF_TESTS_C=   functional
 TEST_METADATA.functional+= timeout=15
-.endif
 
 LIBADD=util
 WARNS?=6

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Tue May 12 14:47:38 2020
(r360963)
+++ head/share/mk/bsd.compiler.mk   Tue May 12 15:22:40 2020
(r360964)
@@ -205,20 +205,12 @@ ${X_}COMPILER_FREEBSD_VERSION=unknown
 ${X_}COMPILER_RESOURCE_DIR!=   

svn commit: r360328 - in head/sys: kern sys x86/x86

2020-04-25 Thread Eric van Gyzen
Author: vangyzen
Date: Sun Apr 26 00:41:29 2020
New Revision: 360328
URL: https://svnweb.freebsd.org/changeset/base/360328

Log:
  Fix handling of NMIs from unknown sources (BMC, hypervisor)
  
  Release kernels have no KDB backends enabled, so they discard an NMI
  if it is not due to a hardware failure.  This includes NMIs from
  IPMI BMCs and hypervisors.
  
  Furthermore, the interaction of panic_on_nmi, kdb_on_nmi, and
  debugger_on_panic is confusing.
  
  Respond to all NMIs according to panic_on_nmi and debugger_on_panic.
  Remove kdb_on_nmi.  Expand the meaning of panic_on_nmi by making
  it a bitfield.  There are currently two bits: one for NMIs due to
  hardware failure, and one for all others.  Leave room for more.
  
  If panic_on_nmi and debugger_on_panic are both true, don't actually panic,
  but directly enter the debugger, to allow someone to leave the debugger
  and [hopefully] resume normal execution.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Relnotes: yes: machdep.kdb_on_nmi is gone; machdep.panic_on_nmi changed
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D24558

Modified:
  head/sys/kern/kern_shutdown.c
  head/sys/sys/kdb.h
  head/sys/x86/x86/cpu_machdep.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Sat Apr 25 23:35:49 2020
(r360327)
+++ head/sys/kern/kern_shutdown.c   Sun Apr 26 00:41:29 2020
(r360328)
@@ -119,9 +119,9 @@ SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CT
 
 #ifdef KDB
 #ifdef KDB_UNATTENDED
-static int debugger_on_panic = 0;
+int debugger_on_panic = 0;
 #else
-static int debugger_on_panic = 1;
+int debugger_on_panic = 1;
 #endif
 SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic,
 CTLFLAG_RWTUN | CTLFLAG_SECURE,

Modified: head/sys/sys/kdb.h
==
--- head/sys/sys/kdb.h  Sat Apr 25 23:35:49 2020(r360327)
+++ head/sys/sys/kdb.h  Sun Apr 26 00:41:29 2020(r360328)
@@ -65,6 +65,7 @@ struct kdb_dbbe {
 SET_DECLARE(kdb_dbbe_set, struct kdb_dbbe);
 
 extern u_char kdb_active;  /* Non-zero while in debugger. */
+extern int debugger_on_panic;  /* enter the debugger on panic. */
 extern int debugger_on_trap;   /* enter the debugger on trap. */
 extern struct kdb_dbbe *kdb_dbbe;  /* Default debugger backend or NULL. */
 extern struct trapframe *kdb_frame;/* Frame to kdb_trap(). */

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Sat Apr 25 23:35:49 2020
(r360327)
+++ head/sys/x86/x86/cpu_machdep.c  Sun Apr 26 00:41:29 2020
(r360328)
@@ -823,20 +823,14 @@ cpu_idle_tun(void *unused __unused)
 }
 SYSINIT(cpu_idle_tun, SI_SUB_CPU, SI_ORDER_MIDDLE, cpu_idle_tun, NULL);
 
-static int panic_on_nmi = 1;
+static int panic_on_nmi = 0xff;
 SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN,
 _on_nmi, 0,
-"Panic on NMI raised by hardware failure");
+"Panic on NMI: 1 = H/W failure; 2 = unknown; 0xff = all");
 int nmi_is_broadcast = 1;
 SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN,
 _is_broadcast, 0,
 "Chipset NMI is broadcast");
-#ifdef KDB
-int kdb_on_nmi = 1;
-SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN,
-_on_nmi, 0,
-"Go to KDB on NMI with unknown source");
-#endif
 
 void
 nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame)
@@ -847,19 +841,31 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe *
/* machine/parity/power fail/"kitchen sink" faults */
if (isa_nmi(frame->tf_err)) {
claimed = true;
-   if (panic_on_nmi)
+   if ((panic_on_nmi & 1) != 0)
panic("NMI indicates hardware failure");
}
 #endif /* DEV_ISA */
+
+   /*
+* NMIs can be useful for debugging.  They can be hooked up to a
+* pushbutton, usually on an ISA, PCI, or PCIe card.  They can also be
+* generated by an IPMI BMC, either manually or in response to a
+* watchdog timeout.  For example, see the "power diag" command in
+* ports/sysutils/ipmitool.  They can also be generated by a
+* hypervisor; see "bhyvectl --inject-nmi".
+*/
+
 #ifdef KDB
-   if (!claimed && kdb_on_nmi) {
-   /*
-* NMI can be hooked up to a pushbutton for debugging.
-*/
-   printf("NMI/cpu%d ... going to debugger\n", cpu);
-   kdb_trap(type, 0, frame);
+   if (!claimed && (panic_on_nmi & 2) != 0) {
+   if (debugger_on_panic) {
+   printf("NMI/cpu%d ... going to debugger\n", cpu);
+   claimed = kdb_trap(type, 0, frame);
+   }
}
 #endif /* 

svn commit: r360233 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc

2020-04-23 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Apr 23 23:57:43 2020
New Revision: 360233
URL: https://svnweb.freebsd.org/changeset/base/360233

Log:
  Update jemalloc to version 5.2.1
  
  Revert r354606 to restore r354605.
  
  Apply one line from jemalloc commit d01b425e5d1e1 in hash_x86_128()
  to fix the build with gcc, which only allows a fallthrough attribute
  to appear before a case or default label.
  
  Submitted by: jasone in r354605
  Discussed with:   jasone
  Reviewed by:  bdrewery
  MFC after:never, due to gcc 4.2.1
  Relnotes: yes
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D24522

Added:
  head/contrib/jemalloc/include/jemalloc/internal/bin_types.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/bin_types.h
  head/contrib/jemalloc/include/jemalloc/internal/hook.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/hook.h
  
head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs_FreeBSD.h
  head/contrib/jemalloc/include/jemalloc/internal/quantum.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/quantum.h
  head/contrib/jemalloc/include/jemalloc/internal/safety_check.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/safety_check.h
  head/contrib/jemalloc/include/jemalloc/internal/sc.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/sc.h
  head/contrib/jemalloc/include/jemalloc/internal/seq.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/seq.h
  head/contrib/jemalloc/include/jemalloc/internal/test_hooks.h
 - copied unchanged from r354605, 
head/contrib/jemalloc/include/jemalloc/internal/test_hooks.h
  head/contrib/jemalloc/src/hook.c
 - copied unchanged from r354605, head/contrib/jemalloc/src/hook.c
  head/contrib/jemalloc/src/safety_check.c
 - copied unchanged from r354605, head/contrib/jemalloc/src/safety_check.c
  head/contrib/jemalloc/src/sc.c
 - copied unchanged from r354605, head/contrib/jemalloc/src/sc.c
  head/contrib/jemalloc/src/test_hooks.c
 - copied unchanged from r354605, head/contrib/jemalloc/src/test_hooks.c
Deleted:
  head/contrib/jemalloc/include/jemalloc/internal/hooks.h
  head/contrib/jemalloc/include/jemalloc/internal/size_classes.h
  head/contrib/jemalloc/src/hooks.c
Modified:
  head/contrib/jemalloc/COPYING
  head/contrib/jemalloc/ChangeLog
  head/contrib/jemalloc/FREEBSD-Xlist
  head/contrib/jemalloc/FREEBSD-diffs
  head/contrib/jemalloc/VERSION
  head/contrib/jemalloc/doc/jemalloc.3
  head/contrib/jemalloc/include/jemalloc/internal/arena_externs.h
  head/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h
  head/contrib/jemalloc/include/jemalloc/internal/arena_stats.h
  head/contrib/jemalloc/include/jemalloc/internal/arena_structs_b.h
  head/contrib/jemalloc/include/jemalloc/internal/arena_types.h
  head/contrib/jemalloc/include/jemalloc/internal/atomic.h
  head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_atomic.h
  head/contrib/jemalloc/include/jemalloc/internal/atomic_gcc_sync.h
  head/contrib/jemalloc/include/jemalloc/internal/background_thread_externs.h
  head/contrib/jemalloc/include/jemalloc/internal/background_thread_inlines.h
  head/contrib/jemalloc/include/jemalloc/internal/background_thread_structs.h
  head/contrib/jemalloc/include/jemalloc/internal/base_structs.h
  head/contrib/jemalloc/include/jemalloc/internal/bin.h
  head/contrib/jemalloc/include/jemalloc/internal/bin_stats.h
  head/contrib/jemalloc/include/jemalloc/internal/bit_util.h
  head/contrib/jemalloc/include/jemalloc/internal/bitmap.h
  head/contrib/jemalloc/include/jemalloc/internal/cache_bin.h
  head/contrib/jemalloc/include/jemalloc/internal/ctl.h
  head/contrib/jemalloc/include/jemalloc/internal/emitter.h
  head/contrib/jemalloc/include/jemalloc/internal/extent_externs.h
  head/contrib/jemalloc/include/jemalloc/internal/extent_inlines.h
  head/contrib/jemalloc/include/jemalloc/internal/extent_structs.h
  head/contrib/jemalloc/include/jemalloc/internal/extent_types.h
  head/contrib/jemalloc/include/jemalloc/internal/hash.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_externs.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_b.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_macros.h
  head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h
  

Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-20 Thread Eric van Gyzen

+   sz = asprintf(, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
+   jailname);
+   if (sz < 0) {
+   /* Fall back to a random mac address. */



I was wondering if it would be valuable to give this fall back something
like:

printf("%s: unable to create fixed mac address; using random
mac address", if_name(ifp));

This will only be printed in rare circumstances. But in that case will
provide valuable information.


That would potentially be valuable, yes. On the other hand, we traditionally
don???t sprinkle a lot of printf()s around in the kernel. This is extremely
unlikely to happen, and if it does odds are attaching the interface will
fail at an earlier or later point, you may struggle to pass packets and run
into any number of other issues.
It???s also possible to diagnose absent the printf(), because the MAC
address will be locally administered rather than within the FreeBSD OUI.

So, in short: not a bad idea. You can argue it both ways, and I find myself
(weakly) on the opposite side.


Would displaying the message only when verbose boot mode is enabled be
a suitable compromise?


We could completely avoid the problems of dynamic allocation by calling 
SHA1Update three times, feeding each piece of data separately.


For bonus points, use a single char[] to save stack space, too.  Maybe 
use a union, for legibility, and to ensure the proper size without ugly 
assertions.


Eric
___
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: r358594 - head/sbin/dumpon

2020-03-03 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Mar  3 22:14:23 2020
New Revision: 358594
URL: https://svnweb.freebsd.org/changeset/base/358594

Log:
  dumpon: skip size check if using zstd
  
  As with gzip, let the dump device be smaller than physical memory
  when using zstd and full dumps.
  
  Also print the error message if the size check fails, even if -v
  is not specified.  Failing silently is not friendly.
  
  Reviewed by:  cem markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23923

Modified:
  head/sbin/dumpon/dumpon.c

Modified: head/sbin/dumpon/dumpon.c
==
--- head/sbin/dumpon/dumpon.c   Tue Mar  3 18:58:43 2020(r358593)
+++ head/sbin/dumpon/dumpon.c   Tue Mar  3 22:14:23 2020(r358594)
@@ -203,11 +203,8 @@ check_size(int fd, const char *fn)
err(EX_OSERR, "can't get memory size");
if (ioctl(fd, DIOCGMEDIASIZE, ) != 0)
err(EX_OSERR, "%s: can't get size", fn);
-   if ((uintmax_t)mediasize < (uintmax_t)physmem) {
-   if (verbose)
-   printf("%s is smaller than physical memory\n", fn);
-   exit(EX_IOERR);
-   }
+   if ((uintmax_t)mediasize < (uintmax_t)physmem)
+   errx(EX_IOERR, "%s is smaller than physical memory", fn);
 }
 
 #ifdef HAVE_CRYPTO
@@ -495,7 +492,7 @@ main(int argc, char *argv[])
usage();
 
fd = opendumpdev(dev, dumpdev);
-   if (!netdump && !gzip && !rflag)
+   if (!netdump && !gzip && !zstd && !rflag)
check_size(fd, dumpdev);
 
kdap = 
___
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: r358187 - head/sys/kern

2020-02-20 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Feb 20 23:53:48 2020
New Revision: 358187
URL: https://svnweb.freebsd.org/changeset/base/358187

Log:
  clamp kernel dump compression level when using gzip
  
  If the configured compression level for kernel dumps
  it outside the supported range, clamp it to the closest
  supported level.  Previously, dumpon would fail.
  
  zstd already does this internally, so the compressor
  needs no change.
  
  Reviewed by:  cem markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23765

Modified:
  head/sys/kern/subr_compressor.c

Modified: head/sys/kern/subr_compressor.c
==
--- head/sys/kern/subr_compressor.c Thu Feb 20 23:47:09 2020
(r358186)
+++ head/sys/kern/subr_compressor.c Thu Feb 20 23:53:48 2020
(r358187)
@@ -117,6 +117,13 @@ gz_init(size_t maxiosize, int level)
s->gz_stream.next_in = Z_NULL;
s->gz_stream.avail_in = 0;
 
+   if (level != Z_DEFAULT_COMPRESSION) {
+   if (level < Z_BEST_SPEED)
+   level = Z_BEST_SPEED;
+   else if (level > Z_BEST_COMPRESSION)
+   level = Z_BEST_COMPRESSION;
+   }
+
error = deflateInit2(>gz_stream, level, Z_DEFLATED, -MAX_WBITS,
DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
if (error != 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358186 - head/lib/libc/sys

2020-02-20 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Feb 20 23:47:09 2020
New Revision: 358186
URL: https://svnweb.freebsd.org/changeset/base/358186

Log:
  truncate(2): extending the file is required by POSIX 2008
  
  Update the man page to mention that extending a file with truncate(2)
  is required by POSIX as of 2008.
  
  Reviewed by:  bcr
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23354

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

Modified: head/lib/libc/sys/truncate.2
==
--- head/lib/libc/sys/truncate.2Thu Feb 20 21:52:36 2020
(r358185)
+++ head/lib/libc/sys/truncate.2Thu Feb 20 23:47:09 2020
(r358186)
@@ -28,7 +28,7 @@
 .\" @(#)truncate.2 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd May 4, 2015
+.Dd January 24, 2020
 .Dt TRUNCATE 2
 .Os
 .Sh NAME
@@ -160,6 +160,9 @@ system calls appeared in
 These calls should be generalized to allow ranges
 of bytes in a file to be discarded.
 .Pp
-Use of
+Historically, the use of
 .Fn truncate
-to extend a file is not portable.
+or
+.Fn ftruncate
+to extend a file was not portable, but this behavior became required in
+.St -p1003.1-2008 .
___
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: r356709 - head/usr.sbin/fstyp

2020-01-13 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Jan 13 22:36:29 2020
New Revision: 356709
URL: https://svnweb.freebsd.org/changeset/base/356709

Log:
  fstyp hammer2: remove dead code
  
  best_i will always be >= 0, so remove code to test otherwise.
  
  Reported by:  Coverity
  CID:  1412244
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23159

Modified:
  head/usr.sbin/fstyp/hammer2.c

Modified: head/usr.sbin/fstyp/hammer2.c
==
--- head/usr.sbin/fstyp/hammer2.c   Mon Jan 13 22:33:48 2020
(r356708)
+++ head/usr.sbin/fstyp/hammer2.c   Mon Jan 13 22:36:29 2020
(r356709)
@@ -87,11 +87,6 @@ __read_label(FILE *fp, char *label, size_t size)
best = broot;
}
}
-   if (best_i == -1) {
-   warnx("Failed to find volume header from zones");
-   error = 1;
-   goto done;
-   }
 
bref = [best_i]->voldata.sroot_blockset.blockref[0];
if (bref->type != HAMMER2_BREF_TYPE_INODE) {
___
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: r356708 - head/usr.sbin/fstyp

2020-01-13 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Jan 13 22:33:48 2020
New Revision: 356708
URL: https://svnweb.freebsd.org/changeset/base/356708

Log:
  fstyp hammer: use strlcpy
  
  Use strlcpy to guarantee NUL termination.  Due to this, there is
  no need for strncmp; simply use strcmp.
  
  Reported by:  Coverity
  CID:  1412242
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23159

Modified:
  head/usr.sbin/fstyp/hammer.c

Modified: head/usr.sbin/fstyp/hammer.c
==
--- head/usr.sbin/fstyp/hammer.cMon Jan 13 22:06:16 2020
(r356707)
+++ head/usr.sbin/fstyp/hammer.cMon Jan 13 22:33:48 2020
(r356708)
@@ -76,7 +76,7 @@ __test_ondisk(const hammer_volume_ondisk_t ondisk)
assert(count != 0);
memcpy(, >vol_fsid, sizeof(fsid));
memcpy(, >vol_fstype, sizeof(fstype));
-   strncpy(label, ondisk->vol_label, sizeof(label));
+   strlcpy(label, ondisk->vol_label, sizeof(label));
} else {
if (ondisk->vol_count != count)
return (5);
@@ -84,7 +84,7 @@ __test_ondisk(const hammer_volume_ondisk_t ondisk)
return (6);
if (memcmp(>vol_fstype, , sizeof(fstype)))
return (7);
-   if (strncmp(ondisk->vol_label, label, sizeof(label)))
+   if (strcmp(ondisk->vol_label, label))
return (8);
}
 
___
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: r356706 - head/sbin/savecore

2020-01-13 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Jan 13 22:01:37 2020
New Revision: 356706
URL: https://svnweb.freebsd.org/changeset/base/356706

Log:
  savecore: include time zone in info.N file
  
  This helps with event correlation when machines are distributed
  across multiple time zones.
  
  Format the time with relaxed ISO 8601 for all the usual reasons.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/savecore/savecore.c

Modified: head/sbin/savecore/savecore.c
==
--- head/sbin/savecore/savecore.c   Mon Jan 13 21:49:27 2020
(r356705)
+++ head/sbin/savecore/savecore.c   Mon Jan 13 22:01:37 2020
(r356706)
@@ -157,6 +157,8 @@ printheader(xo_handle_t *xo, const struct kerneldumphe
 {
uint64_t dumplen;
time_t t;
+   struct tm tm;
+   char time_str[64];
const char *stat_str;
const char *comp_str;
 
@@ -189,7 +191,10 @@ printheader(xo_handle_t *xo, const struct kerneldumphe
}
xo_emit_h(xo, "{P:  }{Lwc:Compression}{:compression/%s}\n", comp_str);
t = dtoh64(h->dumptime);
-   xo_emit_h(xo, "{P:  }{Lwc:Dumptime}{:dumptime/%s}", ctime());
+   localtime_r(, );
+   if (strftime(time_str, sizeof(time_str), "%F %T %z", ) == 0)
+   time_str[0] = '\0';
+   xo_emit_h(xo, "{P:  }{Lwc:Dumptime}{:dumptime/%s}\n", time_str);
xo_emit_h(xo, "{P:  }{Lwc:Hostname}{:hostname/%s}\n", h->hostname);
xo_emit_h(xo, "{P:  }{Lwc:Magic}{:magic/%s}\n", h->magic);
xo_emit_h(xo, "{P:  }{Lwc:Version String}{:version_string/%s}",
___
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: r356705 - head/sys/fs/nfs

2020-01-13 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Jan 13 21:49:27 2020
New Revision: 356705
URL: https://svnweb.freebsd.org/changeset/base/356705

Log:
  Add missing comma in nfsv4_errstr
  
  Reported by:  Coverity
  CID:  1412243
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/fs/nfs/nfsv4_errstr.h

Modified: head/sys/fs/nfs/nfsv4_errstr.h
==
--- head/sys/fs/nfs/nfsv4_errstr.h  Mon Jan 13 21:47:23 2020
(r356704)
+++ head/sys/fs/nfs/nfsv4_errstr.h  Mon Jan 13 21:49:27 2020
(r356705)
@@ -84,7 +84,7 @@ static const char *nfsv4_errstr[NFSERR_XATTR2BIG - 100
"file locking deadlock",
"open file blocks op",
"lockowner state revoked",
-   "callback path down"
+   "callback path down",
"bad IO mode",
"bad layout",
"bad session digest",
___
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: r355593 - head/sbin/fsck_ffs

2019-12-10 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec 10 20:04:08 2019
New Revision: 355593
URL: https://svnweb.freebsd.org/changeset/base/355593

Log:
  fsck_ffs: fix some memory leaks found by Coverity.
  
  Reported by:  Coverity
  CID:  1380549 1380550 1380551
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/fsck_ffs/setup.c

Modified: head/sbin/fsck_ffs/setup.c
==
--- head/sbin/fsck_ffs/setup.c  Tue Dec 10 20:02:57 2019(r355592)
+++ head/sbin/fsck_ffs/setup.c  Tue Dec 10 20:04:08 2019(r355593)
@@ -474,11 +474,15 @@ calcsb(char *dev, int devfd, struct fs *fs)
if (fsrbuf == NULL)
errx(EEXIT, "calcsb: cannot allocate recovery buffer");
if (blread(devfd, fsrbuf,
-   (SBLOCK_UFS2 - secsize) / dev_bsize, secsize) != 0)
+   (SBLOCK_UFS2 - secsize) / dev_bsize, secsize) != 0) {
+   free(fsrbuf);
return (0);
+   }
fsr = (struct fsrecovery *)[secsize - sizeof *fsr];
-   if (fsr->fsr_magic != FS_UFS2_MAGIC)
+   if (fsr->fsr_magic != FS_UFS2_MAGIC) {
+   free(fsrbuf);
return (0);
+   }
memset(fs, 0, sizeof(struct fs));
fs->fs_fpg = fsr->fsr_fpg;
fs->fs_fsbtodb = fsr->fsr_fsbtodb;
@@ -505,11 +509,14 @@ chkrecovery(int devfd)
 * Could not determine if backup material exists, so do not
 * offer to create it.
 */
+   fsrbuf = NULL;
if (ioctl(devfd, DIOCGSECTORSIZE, ) == -1 ||
(fsrbuf = Malloc(secsize)) == NULL ||
blread(devfd, fsrbuf, (SBLOCK_UFS2 - secsize) / dev_bsize,
- secsize) != 0)
+ secsize) != 0) {
+   free(fsrbuf);
return (1);
+   }
/*
 * Recovery material has already been created, so do not
 * need to create it again.
@@ -538,12 +545,14 @@ saverecovery(int readfd, int writefd)
char *fsrbuf;
u_int secsize;
 
+   fsrbuf = NULL;
if (sblock.fs_magic != FS_UFS2_MAGIC ||
ioctl(readfd, DIOCGSECTORSIZE, ) == -1 ||
(fsrbuf = Malloc(secsize)) == NULL ||
blread(readfd, fsrbuf, (SBLOCK_UFS2 - secsize) / dev_bsize,
  secsize) != 0) {
printf("RECOVERY DATA COULD NOT BE CREATED\n");
+   free(fsrbuf);
return;
}
fsr = (struct fsrecovery *)[secsize - sizeof *fsr];
___
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: r355436 - in head/sys: amd64/amd64 x86/x86

2019-12-06 Thread Eric van Gyzen


> On Dec 6, 2019, at 4:36 AM, Ed Maste  wrote:
> 
> On Thu, 5 Dec 2019 at 21:43, Scott Long  wrote:
>> 
>> Author: scottl
>> Date: Fri Dec  6 02:43:05 2019
>> New Revision: 355436
>> URL: https://svnweb.freebsd.org/changeset/base/355436
>> 
>> Log:
>>  Move the mds, irbs, and ssb mitigation knobs into machdep.mitigations.
> 
> If we're moving them and adding backwards-compatibility scaffolding we
> really should correct the sense of the sysctls at the same time.

I was just going to suggest that.  For some, 0 is secure; for others, 1 is 
secure.  Since they’re under “mitigations,” I think 1 should consistently mean 
“mitigated.”

Eric
___
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: r355370 - stable/11/usr.bin/tip/tip

2019-12-03 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec  3 22:59:55 2019
New Revision: 355370
URL: https://svnweb.freebsd.org/changeset/base/355370

Log:
  MFC r354624
  
  tip/cu: check for EOF on input on the local side
  
  If cu reads an EOF on the input side, it goes into a tight loop
  sending a garbage byte to the remote.  With this change, it exits
  gracefully, along with its child.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/usr.bin/tip/tip/tip.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/tip/tip/tip.c
==
--- stable/11/usr.bin/tip/tip/tip.c Tue Dec  3 22:57:10 2019
(r355369)
+++ stable/11/usr.bin/tip/tip/tip.c Tue Dec  3 22:59:55 2019
(r355370)
@@ -250,7 +250,6 @@ cucommon:
tipin();
else
tipout();
-   /*NOTREACHED*/
exit(0);
 }
 
@@ -400,11 +399,16 @@ tipin(void)
}
 
while (1) {
-   gch = getchar()_PAR;
-   /* XXX does not check for EOF */
+   gch = getchar();
+   if (gch == EOF)
+   return;
+   gch = gch & STRIP_PAR;
if ((gch == character(value(ESCAPE))) && bol) {
if (!noesc) {
-   if (!(gch = escape()))
+   gch = escape();
+   if (gch == EOF)
+   return;
+   if (gch == 0)
continue;
}
} else if (!cumode && gch == character(value(RAISECHAR))) {
@@ -418,7 +422,10 @@ tipin(void)
printf("\r\n");
continue;
} else if (!cumode && gch == character(value(FORCE)))
-   gch = getchar()_PAR;
+   gch = getchar();
+   if (gch == EOF)
+   return;
+   gch = gch & STRIP_PAR;
bol = any(gch, value(EOL));
if (boolean(value(RAISE)) && islower(gch))
gch = toupper(gch);
@@ -442,8 +449,10 @@ escape(void)
esctable_t *p;
char c = character(value(ESCAPE));
 
-   gch = (getchar()_PAR);
-   /* XXX does not check for EOF */
+   gch = getchar();
+   if (gch == EOF)
+   return (EOF);
+   gch = gch & STRIP_PAR;
for (p = etable; p->e_char; p++)
if (p->e_char == gch) {
if ((p->e_flags) && uid)
___
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: r355369 - stable/12/usr.bin/tip/tip

2019-12-03 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec  3 22:57:10 2019
New Revision: 355369
URL: https://svnweb.freebsd.org/changeset/base/355369

Log:
  MFC r354624
  
  tip/cu: check for EOF on input on the local side
  
  If cu reads an EOF on the input side, it goes into a tight loop
  sending a garbage byte to the remote.  With this change, it exits
  gracefully, along with its child.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/usr.bin/tip/tip/tip.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/tip/tip/tip.c
==
--- stable/12/usr.bin/tip/tip/tip.c Tue Dec  3 22:54:24 2019
(r355368)
+++ stable/12/usr.bin/tip/tip/tip.c Tue Dec  3 22:57:10 2019
(r355369)
@@ -252,7 +252,6 @@ cucommon:
tipin();
else
tipout();
-   /*NOTREACHED*/
exit(0);
 }
 
@@ -402,11 +401,16 @@ tipin(void)
}
 
while (1) {
-   gch = getchar()_PAR;
-   /* XXX does not check for EOF */
+   gch = getchar();
+   if (gch == EOF)
+   return;
+   gch = gch & STRIP_PAR;
if ((gch == character(value(ESCAPE))) && bol) {
if (!noesc) {
-   if (!(gch = escape()))
+   gch = escape();
+   if (gch == EOF)
+   return;
+   if (gch == 0)
continue;
}
} else if (!cumode && gch == character(value(RAISECHAR))) {
@@ -420,7 +424,10 @@ tipin(void)
printf("\r\n");
continue;
} else if (!cumode && gch == character(value(FORCE)))
-   gch = getchar()_PAR;
+   gch = getchar();
+   if (gch == EOF)
+   return;
+   gch = gch & STRIP_PAR;
bol = any(gch, value(EOL));
if (boolean(value(RAISE)) && islower(gch))
gch = toupper(gch);
@@ -444,8 +451,10 @@ escape(void)
esctable_t *p;
char c = character(value(ESCAPE));
 
-   gch = (getchar()_PAR);
-   /* XXX does not check for EOF */
+   gch = getchar();
+   if (gch == EOF)
+   return (EOF);
+   gch = gch & STRIP_PAR;
for (p = etable; p->e_char; p++)
if (p->e_char == gch) {
if ((p->e_flags) && uid)
___
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: r354624 - head/usr.bin/tip/tip

2019-11-11 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Nov 11 17:41:52 2019
New Revision: 354624
URL: https://svnweb.freebsd.org/changeset/base/354624

Log:
  tip/cu: check for EOF on input on the local side
  
  If cu reads an EOF on the input side, it goes into a tight loop
  sending a garbage byte to the remote.  With this change, it exits
  gracefully, along with its child.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/tip/tip/tip.c

Modified: head/usr.bin/tip/tip/tip.c
==
--- head/usr.bin/tip/tip/tip.c  Mon Nov 11 17:36:57 2019(r354623)
+++ head/usr.bin/tip/tip/tip.c  Mon Nov 11 17:41:52 2019(r354624)
@@ -252,7 +252,6 @@ cucommon:
tipin();
else
tipout();
-   /*NOTREACHED*/
exit(0);
 }
 
@@ -402,11 +401,16 @@ tipin(void)
}
 
while (1) {
-   gch = getchar()_PAR;
-   /* XXX does not check for EOF */
+   gch = getchar();
+   if (gch == EOF)
+   return;
+   gch = gch & STRIP_PAR;
if ((gch == character(value(ESCAPE))) && bol) {
if (!noesc) {
-   if (!(gch = escape()))
+   gch = escape();
+   if (gch == EOF)
+   return;
+   if (gch == 0)
continue;
}
} else if (!cumode && gch == character(value(RAISECHAR))) {
@@ -420,7 +424,10 @@ tipin(void)
printf("\r\n");
continue;
} else if (!cumode && gch == character(value(FORCE)))
-   gch = getchar()_PAR;
+   gch = getchar();
+   if (gch == EOF)
+   return;
+   gch = gch & STRIP_PAR;
bol = any(gch, value(EOL));
if (boolean(value(RAISE)) && islower(gch))
gch = toupper(gch);
@@ -444,8 +451,10 @@ escape(void)
esctable_t *p;
char c = character(value(ESCAPE));
 
-   gch = (getchar()_PAR);
-   /* XXX does not check for EOF */
+   gch = getchar();
+   if (gch == EOF)
+   return (EOF);
+   gch = gch & STRIP_PAR;
for (p = etable; p->e_char; p++)
if (p->e_char == gch) {
if ((p->e_flags) && uid)
___
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: r354548 - in head/sys: amd64/amd64 i386/i386

2019-11-08 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov  8 16:30:55 2019
New Revision: 354548
URL: https://svnweb.freebsd.org/changeset/base/354548

Log:
  vmm: pass M_WAITOK to uma_zalloc when allocating FPU save area
  
  Submitted by: patrick.sulliv...@dell.com
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D22276

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/i386/i386/npx.c

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Fri Nov  8 16:10:45 2019(r354547)
+++ head/sys/amd64/amd64/fpu.c  Fri Nov  8 16:30:55 2019(r354548)
@@ -1190,7 +1190,7 @@ struct savefpu *
 fpu_save_area_alloc(void)
 {
 
-   return (uma_zalloc(fpu_save_area_zone, 0));
+   return (uma_zalloc(fpu_save_area_zone, M_WAITOK));
 }
 
 void

Modified: head/sys/i386/i386/npx.c
==
--- head/sys/i386/i386/npx.cFri Nov  8 16:10:45 2019(r354547)
+++ head/sys/i386/i386/npx.cFri Nov  8 16:30:55 2019(r354548)
@@ -1473,7 +1473,7 @@ union savefpu *
 fpu_save_area_alloc(void)
 {
 
-   return (uma_zalloc(fpu_save_area_zone, 0));
+   return (uma_zalloc(fpu_save_area_zone, M_WAITOK));
 }
 
 void
___
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: r353448 - head/tests/sys/kern

2019-10-11 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Oct 11 21:23:46 2019
New Revision: 353448
URL: https://svnweb.freebsd.org/changeset/base/353448

Log:
  coredump_phnum_test: handle full file system gracefully
  
  Skip the test if the file system is full.  That's out of scope
  of this test.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/kern/coredump_phnum_test.sh

Modified: head/tests/sys/kern/coredump_phnum_test.sh
==
--- head/tests/sys/kern/coredump_phnum_test.sh  Fri Oct 11 18:41:24 2019
(r353447)
+++ head/tests/sys/kern/coredump_phnum_test.sh  Fri Oct 11 21:23:46 2019
(r353448)
@@ -53,17 +53,28 @@ coredump_phnum_body()
 
case "$cuc" in
0)
+   unzip_status=0
;;
1)
-   atf_check gunzip coredump_phnum_helper.core.gz
+   gunzip coredump_phnum_helper.core.gz 2>unzip_stderr
+   unzip_status=$?
;;
2)
-   atf_check zstd -qd coredump_phnum_helper.core.zst
+   zstd -qd coredump_phnum_helper.core.zst 2>unzip_stderr
+   unzip_status=$?
;;
*)
atf_skip "unsupported kern.compress_user_cores=$cuc"
;;
esac
+
+   if [ $unzip_status -ne 0 ]; then
+   if grep -q 'No space left on device' unzip_stderr; then
+   atf_skip "file system full: $(df $PWD | tail -n 1)"
+   fi
+   atf_fail "unzip failed; status ${unzip_status}; " \
+   "stderr: $(cat unzip_stderr)"
+   fi
 
# Check that core looks good
if [ ! -f coredump_phnum_helper.core ]; then
___
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: r353344 - head/sys/dev/ioat

2019-10-09 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Oct  9 12:14:10 2019
New Revision: 353344
URL: https://svnweb.freebsd.org/changeset/base/353344

Log:
  Add CTLFLAG_STATS to the dev.ioat.N.stats sysctl OIDs
  
  Refer to r353111.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cWed Oct  9 11:57:45 2019(r353343)
+++ head/sys/dev/ioat/ioat.cWed Oct  9 12:14:10 2019(r353344)
@@ -1997,23 +1997,23 @@ ioat_setup_sysctl(device_t device)
"IOAT channel statistics");
statpar = SYSCTL_CHILDREN(tmp);
 
-   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "interrupts", CTLFLAG_RW,
-   >stats.interrupts,
+   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "interrupts",
+   CTLFLAG_RW | CTLFLAG_STATS, >stats.interrupts,
"Number of interrupts processed on this channel");
-   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "descriptors", CTLFLAG_RW,
-   >stats.descriptors_processed,
+   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "descriptors",
+   CTLFLAG_RW | CTLFLAG_STATS, >stats.descriptors_processed,
"Number of descriptors processed on this channel");
-   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "submitted", CTLFLAG_RW,
-   >stats.descriptors_submitted,
+   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "submitted",
+   CTLFLAG_RW | CTLFLAG_STATS, >stats.descriptors_submitted,
"Number of descriptors submitted to this channel");
-   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "errored", CTLFLAG_RW,
-   >stats.descriptors_error,
+   SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "errored",
+   CTLFLAG_RW | CTLFLAG_STATS, >stats.descriptors_error,
"Number of descriptors failed by channel errors");
-   SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "halts", CTLFLAG_RW,
-   >stats.channel_halts, 0,
+   SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "halts",
+   CTLFLAG_RW | CTLFLAG_STATS, >stats.channel_halts, 0,
"Number of times the channel has halted");
-   SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "last_halt_chanerr", CTLFLAG_RW,
-   >stats.last_halt_chanerr, 0,
+   SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "last_halt_chanerr",
+   CTLFLAG_RW | CTLFLAG_STATS, >stats.last_halt_chanerr, 0,
"The raw CHANERR when the channel was last halted");
 
SYSCTL_ADD_PROC(ctx, statpar, OID_AUTO, "desc_per_interrupt",
___
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: r353305 - head/tests/sys/kern

2019-10-08 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Oct  8 13:43:05 2019
New Revision: 353305
URL: https://svnweb.freebsd.org/changeset/base/353305

Log:
  Fix problems in the kern_maxfiles__increase test
  
  ATF functions such as ATF_REQUIRE do not work correctly in child processes.
  Use plain C functions to report errors instead.
  
  In the parent, check for the untimely demise of children.  Without this,
  the test hung until the framework's timeout.
  
  Raise the resource limit on the number of open files.  If this was too low,
  the test hit the two problems above.
  
  Restore the kern.maxfiles sysctl OID in the cleanup function.
  The body prematurely removed the symlink in which the old value was saved.
  
  Make the test more robust by opening more files.  In fact, due to the
  integer division by 4, this was necessary to make the test valid with
  some initial values of maxfiles.  Thanks, asomers@.
  
  wait() for children instead of sleeping.
  
  Clean up a temporary file created by the test ("afile").
  
  Reviewed by:  asomers
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D21900

Modified:
  head/tests/sys/kern/kern_descrip_test.c

Modified: head/tests/sys/kern/kern_descrip_test.c
==
--- head/tests/sys/kern/kern_descrip_test.c Tue Oct  8 11:27:48 2019
(r353304)
+++ head/tests/sys/kern/kern_descrip_test.c Tue Oct  8 13:43:05 2019
(r353305)
@@ -28,16 +28,22 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
-#include 
-#include 
 #include 
+
 #include 
 
 static volatile sig_atomic_t done;
@@ -92,8 +98,13 @@ openfiles2(size_t n)
int r;
 
errno = 0;
-   for (i = 0; i < n; i++)
-   ATF_REQUIRE((r = open(AFILE, O_RDONLY)) != -1);
+   for (i = 0; i < n; i++) {
+   r = open(AFILE, O_RDONLY);
+   if (r < 0) {
+   fprintf(stderr, "open: %s\n", strerror(errno));
+   _exit(1);
+   }
+   }
kill(getppid(), SIGUSR1);
 
for (;;) {
@@ -118,10 +129,14 @@ openfiles(size_t n)
for (i = 0; i < PARALLEL; i++)
if (fork() == 0)
openfiles2(n / PARALLEL);
-   while (done != PARALLEL)
+   while (done != PARALLEL) {
usleep(1000);
+   ATF_REQUIRE_EQ_MSG(0, waitpid(-1, NULL, WNOHANG),
+   "a child exited unexpectedly");
+   }
unlink(RENDEZVOUS);
-   usleep(4);
+   for (i = 0; i < PARALLEL; i++)
+   ATF_CHECK_MSG(wait(NULL) > 0, "wait: %s", strerror(errno));
 }
 
 ATF_TC_WITH_CLEANUP(kern_maxfiles__increase);
@@ -138,6 +153,7 @@ ATF_TC_BODY(kern_maxfiles__increase, tc)
size_t oldlen;
int maxfiles, oldmaxfiles, current;
char buf[80];
+   struct rlimit rl;
 
oldlen = sizeof(maxfiles);
if (sysctlbyname("kern.maxfiles", , , NULL, 0) == -1)
@@ -160,8 +176,11 @@ ATF_TC_BODY(kern_maxfiles__increase, tc)
atf_tc_fail("getsysctlbyname(%s): %s", "kern.maxfiles",
strerror(errno));
 
-   openfiles(oldmaxfiles - current + 1);
-   (void)unlink(VALUE);
+   rl.rlim_cur = rl.rlim_max = maxfiles;
+   ATF_REQUIRE_EQ_MSG(0, setrlimit(RLIMIT_NOFILE, ),
+   "setrlimit(RLIMIT_NOFILE, %d): %s", maxfiles, strerror(errno));
+
+   openfiles(oldmaxfiles - current + EXPANDBY / 2);
 }
 
 ATF_TC_CLEANUP(kern_maxfiles__increase, tc)
@@ -178,6 +197,8 @@ ATF_TC_CLEANUP(kern_maxfiles__increase, tc)
, oldlen);
}
}
+   (void)unlink(VALUE);
+   (void)unlink(AFILE);
 }
 
 ATF_TP_ADD_TCS(tp)
___
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: r353114 - head/sys/x86/x86

2019-10-04 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Oct  4 21:46:11 2019
New Revision: 353114
URL: https://svnweb.freebsd.org/changeset/base/353114

Log:
  Make the hw.intrs sysctl OID read-only
  
  The handler ignores the new value, so make the OID read-only.
  
  I found this while working on r353111.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/x86/x86/intr_machdep.c

Modified: head/sys/x86/x86/intr_machdep.c
==
--- head/sys/x86/x86/intr_machdep.c Fri Oct  4 21:44:52 2019
(r353113)
+++ head/sys/x86/x86/intr_machdep.c Fri Oct  4 21:46:11 2019
(r353114)
@@ -750,7 +750,7 @@ sysctl_hw_intrs(SYSCTL_HANDLER_ARGS)
sbuf_delete();
return (error);
 }
-SYSCTL_PROC(_hw, OID_AUTO, intrs, CTLTYPE_STRING | CTLFLAG_RW,
+SYSCTL_PROC(_hw, OID_AUTO, intrs, CTLTYPE_STRING | CTLFLAG_RD,
 0, 0, sysctl_hw_intrs, "A", "interrupt:number @cpu: count");
 
 /*
___
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: r353113 - head/sys/ufs/ffs

2019-10-04 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Oct  4 21:44:52 2019
New Revision: 353113
URL: https://svnweb.freebsd.org/changeset/base/353113

Log:
  Add CTLFLAG_STATS to several debug.softdep sysctl OIDs
  
  Refer to r353111.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Fri Oct  4 21:43:43 2019
(r353112)
+++ head/sys/ufs/ffs/ffs_softdep.c  Fri Oct  4 21:44:52 2019
(r353113)
@@ -1311,54 +1311,55 @@ SYSCTL_INT(_debug_softdep, OID_AUTO, tickdelay, CTLFLA
 , 0, "");
 SYSCTL_INT(_debug_softdep, OID_AUTO, flush_threads, CTLFLAG_RD,
 _flush_threads, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, worklist_push, CTLFLAG_RW,
-_worklist_push, 0,"");
-SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_push, CTLFLAG_RW,
-_blk_limit_push, 0,"");
-SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_push, CTLFLAG_RW,
-_ino_limit_push, 0,"");
-SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_hit, CTLFLAG_RW,
-_blk_limit_hit, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_hit, CTLFLAG_RW,
-_ino_limit_hit, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, sync_limit_hit, CTLFLAG_RW,
-_sync_limit_hit, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, indir_blk_ptrs, CTLFLAG_RW,
-_indir_blk_ptrs, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, inode_bitmap, CTLFLAG_RW,
-_inode_bitmap, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, direct_blk_ptrs, CTLFLAG_RW,
-_direct_blk_ptrs, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, dir_entry, CTLFLAG_RW,
-_dir_entry, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, jaddref_rollback, CTLFLAG_RW,
-_jaddref, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, jnewblk_rollback, CTLFLAG_RW,
-_jnewblk, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, journal_low, CTLFLAG_RW,
-_journal_low, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, journal_min, CTLFLAG_RW,
-_journal_min, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, journal_wait, CTLFLAG_RW,
-_journal_wait, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_filepage, CTLFLAG_RW,
-_jwait_filepage, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_freeblks, CTLFLAG_RW,
-_jwait_freeblks, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_inode, CTLFLAG_RW,
-_jwait_inode, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_newblk, CTLFLAG_RW,
-_jwait_newblk, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_blkrequests, CTLFLAG_RW,
-_cleanup_blkrequests, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_inorequests, CTLFLAG_RW,
-_cleanup_inorequests, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_high_delay, CTLFLAG_RW,
-_cleanup_high_delay, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_retries, CTLFLAG_RW,
-_cleanup_retries, 0, "");
-SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_failures, CTLFLAG_RW,
-_cleanup_failures, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, worklist_push,
+CTLFLAG_RW | CTLFLAG_STATS, _worklist_push, 0,"");
+SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_push,
+CTLFLAG_RW | CTLFLAG_STATS, _blk_limit_push, 0,"");
+SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_push,
+CTLFLAG_RW | CTLFLAG_STATS, _ino_limit_push, 0,"");
+SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_hit,
+CTLFLAG_RW | CTLFLAG_STATS, _blk_limit_hit, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_hit,
+CTLFLAG_RW | CTLFLAG_STATS, _ino_limit_hit, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, sync_limit_hit,
+CTLFLAG_RW | CTLFLAG_STATS, _sync_limit_hit, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, indir_blk_ptrs,
+CTLFLAG_RW | CTLFLAG_STATS, _indir_blk_ptrs, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, inode_bitmap,
+CTLFLAG_RW | CTLFLAG_STATS, _inode_bitmap, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, direct_blk_ptrs,
+CTLFLAG_RW | CTLFLAG_STATS, _direct_blk_ptrs, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, dir_entry,
+CTLFLAG_RW | CTLFLAG_STATS, _dir_entry, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, jaddref_rollback,
+CTLFLAG_RW | CTLFLAG_STATS, _jaddref, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, jnewblk_rollback,
+CTLFLAG_RW | CTLFLAG_STATS, _jnewblk, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, journal_low,
+CTLFLAG_RW | CTLFLAG_STATS, _journal_low, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, journal_min,
+CTLFLAG_RW | CTLFLAG_STATS, _journal_min, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, journal_wait,
+CTLFLAG_RW | CTLFLAG_STATS, _journal_wait, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_filepage,
+CTLFLAG_RW | CTLFLAG_STATS, _jwait_filepage, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_freeblks,
+CTLFLAG_RW | CTLFLAG_STATS, _jwait_freeblks, 0, "");
+SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_inode,
+CTLFLAG_RW | 

svn commit: r353112 - head/sys/kern

2019-10-04 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Oct  4 21:43:43 2019
New Revision: 353112
URL: https://svnweb.freebsd.org/changeset/base/353112

Log:
  Add CTLFLAG_STATS to some vfs sysctl OIDs
  
  Add CTLFLAG_STATS to the following OIDs:
  
  vfs.altbufferflushes
  vfs.recursiveflushes
  vfs.barrierwrites
  vfs.flushwithdeps
  vfs.reassignbufcalls
  
  Refer to r353111.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Fri Oct  4 21:39:11 2019(r353111)
+++ head/sys/kern/vfs_bio.c Fri Oct  4 21:43:43 2019(r353112)
@@ -250,11 +250,11 @@ int bdwriteskip;
 SYSCTL_INT(_vfs, OID_AUTO, bdwriteskip, CTLFLAG_RW, ,
 0, "Number of buffers supplied to bdwrite with snapshot deadlock risk");
 int altbufferflushes;
-SYSCTL_INT(_vfs, OID_AUTO, altbufferflushes, CTLFLAG_RW, ,
-0, "Number of fsync flushes to limit dirty buffers");
+SYSCTL_INT(_vfs, OID_AUTO, altbufferflushes, CTLFLAG_RW | CTLFLAG_STATS,
+, 0, "Number of fsync flushes to limit dirty buffers");
 static int recursiveflushes;
-SYSCTL_INT(_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW, ,
-0, "Number of flushes skipped due to being recursive");
+SYSCTL_INT(_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW | CTLFLAG_STATS,
+, 0, "Number of flushes skipped due to being recursive");
 static int sysctl_numdirtybuffers(SYSCTL_HANDLER_ARGS);
 SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers,
 CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_numdirtybuffers, 
"I",
@@ -309,8 +309,8 @@ static counter_u64_t notbufdflushes;
 SYSCTL_COUNTER_U64(_vfs, OID_AUTO, notbufdflushes, CTLFLAG_RD, ,
 "Number of dirty buffer flushes done by the bufdaemon helpers");
 static long barrierwrites;
-SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, , 0,
-"Number of barrier writes");
+SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW | CTLFLAG_STATS,
+, 0, "Number of barrier writes");
 SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD,
 _buf_allowed, 0,
 "Permit the use of the unmapped i/o");
@@ -3423,8 +3423,9 @@ buf_daemon()
  * particularly sensitive to.
  */
 static int flushwithdeps = 0;
-SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW, ,
-0, "Number of buffers flushed with dependecies that require rollbacks");
+SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW | CTLFLAG_STATS,
+, 0,
+"Number of buffers flushed with dependecies that require rollbacks");
 
 static int
 flushbufqueues(struct vnode *lvp, struct bufdomain *bd, int target,

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cFri Oct  4 21:39:11 2019(r353111)
+++ head/sys/kern/vfs_subr.cFri Oct  4 21:43:43 2019(r353112)
@@ -210,8 +210,8 @@ SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_R
  * XXX these are probably of (very) limited utility now.
  */
 static int reassignbufcalls;
-SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, , 0,
-"Number of calls to reassignbuf");
+SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW | CTLFLAG_STATS,
+, 0, "Number of calls to reassignbuf");
 
 static counter_u64_t free_owe_inact;
 SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, _owe_inact,
___
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: r353111 - head/sys/sys

2019-10-04 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Oct  4 21:39:11 2019
New Revision: 353111
URL: https://svnweb.freebsd.org/changeset/base/353111

Log:
  Add CTLFLAG_STATS to all COUNTER_U64* sysctl OIDs
  
  CTLFLAG_STATS identifies a sysctl OID as statistical or informational,
  as opposed to a configurable/tunable OID that changes behavior.
  This can be used, for example, to verfiy that the kyua tests do not
  modify configurable OIDs when allow_sysctl_side_effects is true.
  
  Add CTLFLAG_STATS to all COUNTER_U64* OIDs.
  
  I will add the flag to more OIDs in a few subsequent commits, to
  facilitate MFC.  The flag should be added to many more OIDs.  I plan to
  add it those that my test found and some nearby that looked obvious.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Fri Oct  4 18:38:47 2019(r353110)
+++ head/sys/sys/sysctl.h   Fri Oct  4 21:39:11 2019(r353111)
@@ -699,7 +699,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
 /* Oid for a 64-bit unsigned counter(9).  The pointer must be non NULL. */
 #defineSYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr)   
\
SYSCTL_OID(parent, nbr, name,   \
-   CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\
+   CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access),\
(ptr), 0, sysctl_handle_counter_u64, "QU", descr);  \
CTASSERTaccess) & CTLTYPE) == 0 ||  \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) &&   \
@@ -712,7 +712,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
CTASSERT(((access) & CTLTYPE) == 0 ||   \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
sysctl_add_oid(ctx, parent, nbr, name,  \
-   CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\
+   CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access),\
__ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr),  \
NULL);  \
 })
@@ -720,7 +720,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
 /* Oid for an array of counter(9)s.  The pointer and length must be non zero. 
*/
 #defineSYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, 
descr) \
SYSCTL_OID(parent, nbr, name,   \
-   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
+   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \
(ptr), (len), sysctl_handle_counter_u64_array, "S", descr); \
CTASSERTaccess) & CTLTYPE) == 0 ||  \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) &&\
@@ -734,7 +734,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
CTASSERT(((access) & CTLTYPE) == 0 ||   \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);  \
sysctl_add_oid(ctx, parent, nbr, name,  \
-   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
+   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \
__ptr, len, sysctl_handle_counter_u64_array, "S",   \
__DESCR(descr), 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: r352898 - head/tests/sys/kern

2019-09-30 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Sep 30 14:05:44 2019
New Revision: 352898
URL: https://svnweb.freebsd.org/changeset/base/352898

Log:
  Fix coredump_phnum_test when kern.compress_user_cores != 0
  
  If `kern.compress_user_cores` is non-zero, decompress the core file.
  
  Use `sysctl -f` to restore previous values.
  
  Don't bother restoring `ulimit -c`, since that's a per-process value.
  
  Check more commands with `atf_check`.
  
  Reviewed by:  olivier ngie
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D21820

Modified:
  head/tests/sys/kern/coredump_phnum_test.sh

Modified: head/tests/sys/kern/coredump_phnum_test.sh
==
--- head/tests/sys/kern/coredump_phnum_test.sh  Mon Sep 30 13:34:30 2019
(r352897)
+++ head/tests/sys/kern/coredump_phnum_test.sh  Mon Sep 30 14:05:44 2019
(r352898)
@@ -40,21 +40,31 @@ coredump_phnum_head()
 coredump_phnum_body()
 {
# Set up core dumping
-   cat > coredump_phnum_restore_state.sh <<-EOF
-   #!/bin/sh
-   ulimit -c '$(ulimit -c)'
-   sysctl kern.coredump=$(sysctl -n kern.coredump)
-   sysctl kern.corefile='$(sysctl -n kern.corefile)'
-   sysctl kern.compress_user_cores='$(sysctl -n kern.compress_user_cores)'
-EOF
+   atf_check -o save:coredump_phnum_restore_state sysctl -e \
+   kern.coredump kern.corefile
 
ulimit -c unlimited
-   sysctl kern.coredump=1
-   sysctl kern.compress_user_cores=0
-   sysctl kern.corefile="$(pwd)/coredump_phnum_helper.core"
+   atf_check -o ignore sysctl kern.coredump=1
+   atf_check -o ignore sysctl kern.corefile=coredump_phnum_helper.core
+   atf_check -o save:cuc sysctl -n kern.compress_user_cores
+   read cuc < cuc
 
atf_check -s signal:sigabrt "$(atf_get_srcdir)/coredump_phnum_helper"
 
+   case "$cuc" in
+   0)
+   ;;
+   1)
+   atf_check gunzip coredump_phnum_helper.core.gz
+   ;;
+   2)
+   atf_check zstd -qd coredump_phnum_helper.core.zst
+   ;;
+   *)
+   atf_skip "unsupported kern.compress_user_cores=$cuc"
+   ;;
+   esac
+
# Check that core looks good
if [ ! -f coredump_phnum_helper.core ]; then
atf_fail "Helper program did not dump core"
@@ -76,10 +86,11 @@ EOF
 coredump_phnum_cleanup()
 {
rm -f coredump_phnum_helper.core
-   if [ -f coredump_phnum_restore_state.sh ]; then
-   . ./coredump_phnum_restore_state.sh
+   if [ -f coredump_phnum_restore_state ]; then
+   sysctl -f coredump_phnum_restore_state
+   rm -f coredump_phnum_restore_state
fi
-   rm -f coredump_phnum_restore_state.sh
+   rm -f cuc
 }
 
 atf_init_test_cases()
___
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: r351118 - head/contrib/netbsd-tests/lib/libpthread

2019-08-16 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 16 13:10:08 2019
New Revision: 351118
URL: https://svnweb.freebsd.org/changeset/base/351118

Log:
  Update pthread_cond_timedwait() test to current NetBSD
  
  NetBSD adapted and committed our r350620.  Update to their version 1.8.
  
  Reviewed by:  ngie
  Obtained from:NetBSD
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D21279

Modified:
  head/contrib/netbsd-tests/lib/libpthread/t_condwait.c

Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c
==
--- head/contrib/netbsd-tests/lib/libpthread/t_condwait.c   Fri Aug 16 
12:28:37 2019(r351117)
+++ head/contrib/netbsd-tests/lib/libpthread/t_condwait.c   Fri Aug 16 
13:10:08 2019(r351118)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $ */
+/* $NetBSD: t_condwait.c,v 1.8 2019/08/11 11:42:23 martin Exp $ */
 
 /*
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $");
+__RCSID("$NetBSD: t_condwait.c,v 1.8 2019/08/11 11:42:23 martin Exp $");
 
 #include 
 #include 
@@ -50,10 +50,7 @@ static const int debug = 1;
 static void *
 run(void *param)
 {
-   struct timespec ts, to, te;
-#ifdef __FreeBSD__
-   struct timespec tw;
-#endif
+   struct timespec ts, to, te, twmin, twmax;
clockid_t clck;
pthread_condattr_t attr;
pthread_cond_t cond;
@@ -88,22 +85,23 @@ run(void *param)
printf("elapsed: %lld.%09ld sec\n",
(long long)to.tv_sec, to.tv_nsec);
}
+   twmin.tv_sec = WAITTIME;
+   twmin.tv_nsec = 0;
if (isQEMU()) {
-   double to_seconds = to.tv_sec + 1e-9 * to.tv_nsec;
-   ATF_REQUIRE(to_seconds >= WAITTIME * 0.9);
-   /* Loose upper limit because of qemu timing bugs */
-   ATF_REQUIRE(to_seconds < WAITTIME * 2.5);
+   struct timespec td, t;
+   // td.tv_sec = 0;
+   // td.tv_nsec = 9;
+   t = twmin;
+   // timespecsub(, , );
+   td.tv_sec = 2;
+   td.tv_nsec = 5;
+   timespecadd(, , );
} else {
-#ifdef __FreeBSD__
-   tw.tv_sec = WAITTIME;
-   tw.tv_nsec = 0;
-   ATF_REQUIRE(timespeccmp(, , >=));
-   tw.tv_sec++;
-   ATF_REQUIRE(timespeccmp(, , <=));
-#else
-   ATF_REQUIRE_EQ(to.tv_sec, WAITTIME);
-#endif
+   twmax = twmin;
+   twmax.tv_sec++;
}
+   ATF_REQUIRE(timespeccmp(, , >=));
+   ATF_REQUIRE(timespeccmp(, , <=));
break;
default:
ATF_REQUIRE_MSG(0, "pthread_cond_timedwait: %s", strerror(ret));
@@ -152,5 +150,5 @@ ATF_TP_ADD_TCS(tp)
 {
ATF_TP_ADD_TC(tp, cond_wait_real);
ATF_TP_ADD_TC(tp, cond_wait_mono);
-   return 0;
+   return atf_no_error();
 }
___
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: r350620 - head/contrib/netbsd-tests/lib/libpthread

2019-08-05 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug  5 22:59:35 2019
New Revision: 350620
URL: https://svnweb.freebsd.org/changeset/base/350620

Log:
  Relax time constraint in pthread_cond_timedwait unit test
  
  pthread_cond_timedwait() should wait _at least_ until the timeout,
  but it might appear to wait longer due to system activity and
  scheduling.  The test ignored fractional seconds when comparing the
  actual and expected timeouts, so it allowed anywhere between zero
  and one extra second of wait time.  Zero is a bit unreasonable.
  Compare fractional seconds so we always allow up to one extra second.
  
  Reviewed by:  ngie
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/netbsd-tests/lib/libpthread/t_condwait.c

Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c
==
--- head/contrib/netbsd-tests/lib/libpthread/t_condwait.c   Mon Aug  5 
22:04:16 2019(r350619)
+++ head/contrib/netbsd-tests/lib/libpthread/t_condwait.c   Mon Aug  5 
22:59:35 2019(r350620)
@@ -51,6 +51,9 @@ static void *
 run(void *param)
 {
struct timespec ts, to, te;
+#ifdef __FreeBSD__
+   struct timespec tw;
+#endif
clockid_t clck;
pthread_condattr_t attr;
pthread_cond_t cond;
@@ -91,7 +94,15 @@ run(void *param)
/* Loose upper limit because of qemu timing bugs */
ATF_REQUIRE(to_seconds < WAITTIME * 2.5);
} else {
+#ifdef __FreeBSD__
+   tw.tv_sec = WAITTIME;
+   tw.tv_nsec = 0;
+   ATF_REQUIRE(timespeccmp(, , >=));
+   tw.tv_sec++;
+   ATF_REQUIRE(timespeccmp(, , <=));
+#else
ATF_REQUIRE_EQ(to.tv_sec, WAITTIME);
+#endif
}
break;
default:
___
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: r350056 - stable/11/sys/dev/vt

2019-07-16 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Jul 16 16:49:11 2019
New Revision: 350056
URL: https://svnweb.freebsd.org/changeset/base/350056

Log:
  MFC r349834
  
  Ignore kern.vt.splash_cpu without graphics
  
  When the system has no graphical console, such as bhyve in common
  configurations, ignore kern.vt.splash_cpu, instead of panicking
  on INVARIANTS kernels.
  
  Reviewed by:  cem dumbbell
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20877

Modified:
  stable/11/sys/dev/vt/vt_cpulogos.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/vt/vt_cpulogos.c
==
--- stable/11/sys/dev/vt/vt_cpulogos.c  Tue Jul 16 16:33:44 2019
(r350055)
+++ stable/11/sys/dev/vt/vt_cpulogos.c  Tue Jul 16 16:49:11 2019
(r350056)
@@ -227,9 +227,8 @@ vt_init_logos(void *dummy)
return;
 
VT_LOCK(vd);
-   KASSERT((vd->vd_flags & VDF_INITIALIZED) != 0,
-   ("vd %p not initialized", vd));
-
+   if ((vd->vd_flags & VDF_INITIALIZED) == 0)
+   goto out;
if ((vd->vd_flags & (VDF_DEAD | VDF_TEXTMODE)) != 0)
goto out;
if (vd->vd_height <= vt_logo_sprite_height)
___
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: r350050 - stable/12/sys/dev/vt

2019-07-16 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Jul 16 16:05:42 2019
New Revision: 350050
URL: https://svnweb.freebsd.org/changeset/base/350050

Log:
  MFC r349834
  
  Ignore kern.vt.splash_cpu without graphics
  
  When the system has no graphical console, such as bhyve in common
  configurations, ignore kern.vt.splash_cpu, instead of panicking
  on INVARIANTS kernels.
  
  Reviewed by:  cem dumbbell
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20877

Modified:
  stable/12/sys/dev/vt/vt_cpulogos.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/vt/vt_cpulogos.c
==
--- stable/12/sys/dev/vt/vt_cpulogos.c  Tue Jul 16 16:03:08 2019
(r350049)
+++ stable/12/sys/dev/vt/vt_cpulogos.c  Tue Jul 16 16:05:42 2019
(r350050)
@@ -227,9 +227,8 @@ vt_init_logos(void *dummy)
return;
 
VT_LOCK(vd);
-   KASSERT((vd->vd_flags & VDF_INITIALIZED) != 0,
-   ("vd %p not initialized", vd));
-
+   if ((vd->vd_flags & VDF_INITIALIZED) == 0)
+   goto out;
if ((vd->vd_flags & (VDF_DEAD | VDF_TEXTMODE)) != 0)
goto out;
if (vd->vd_height <= vt_logo_sprite_height)
___
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: r350043 - in head: share/man/man5 sys/kern

2019-07-16 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Jul 16 15:51:09 2019
New Revision: 350043
URL: https://svnweb.freebsd.org/changeset/base/350043

Log:
  Adds signal number format to kern.corefile
  
  Add format capability to core file names to include signal
  that generated the core. This can help various validation workflows
  where all cores should not be considered equally (SIGQUIT is often
  intentional and not an error unlike SIGSEGV or SIGBUS)
  
  Submitted by: David Leimbach (leim...@gmail.com)
  Reviewed by:  markj
  MFC after:1 week
  Relnotes: sysctl kern.corefile can now include the signal number
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20970

Modified:
  head/share/man/man5/core.5
  head/sys/kern/kern_sig.c

Modified: head/share/man/man5/core.5
==
--- head/share/man/man5/core.5  Tue Jul 16 15:49:43 2019(r350042)
+++ head/share/man/man5/core.5  Tue Jul 16 15:51:09 2019(r350043)
@@ -82,6 +82,8 @@ generated by a particular process.
 process name.
 .It Em \&%P
 processes PID.
+.It Em \&%S
+signal during core.
 .It Em \&%U
 process UID.
 .El

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cTue Jul 16 15:49:43 2019(r350042)
+++ head/sys/kern/kern_sig.cTue Jul 16 15:51:09 2019(r350043)
@@ -3433,7 +3433,7 @@ corefile_open_last(struct thread *td, char *name, int 
  */
 static int
 corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
-int compress, struct vnode **vpp, char **namep)
+int compress, int signum, struct vnode **vpp, char **namep)
 {
struct sbuf sb;
struct nameidata nd;
@@ -3482,6 +3482,9 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, 
case 'P':   /* process id */
sbuf_printf(, "%u", pid);
break;
+   case 'S':   /* signal number */
+   sbuf_printf(, "%i", signum);
+   break;
case 'U':   /* user id */
sbuf_printf(, "%u", uid);
break;
@@ -3599,7 +3602,7 @@ coredump(struct thread *td)
PROC_UNLOCK(p);
 
error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td,
-   compress_user_cores, , );
+   compress_user_cores, p->p_sig, , );
if (error != 0)
return (error);
 
___
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: r349834 - head/sys/dev/vt

2019-07-08 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Jul  8 13:46:26 2019
New Revision: 349834
URL: https://svnweb.freebsd.org/changeset/base/349834

Log:
  Ignore kern.vt.splash_cpu without graphics
  
  When the system has no graphical console, such as bhyve in common
  configurations, ignore kern.vt.splash_cpu, instead of panicking
  on INVARIANTS kernels.
  
  Reviewed by:  cem dumbbell
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20877

Modified:
  head/sys/dev/vt/vt_cpulogos.c

Modified: head/sys/dev/vt/vt_cpulogos.c
==
--- head/sys/dev/vt/vt_cpulogos.c   Mon Jul  8 13:01:54 2019
(r349833)
+++ head/sys/dev/vt/vt_cpulogos.c   Mon Jul  8 13:46:26 2019
(r349834)
@@ -229,9 +229,8 @@ vt_init_logos(void *dummy)
return;
 
VT_LOCK(vd);
-   KASSERT((vd->vd_flags & VDF_INITIALIZED) != 0,
-   ("vd %p not initialized", vd));
-
+   if ((vd->vd_flags & VDF_INITIALIZED) == 0)
+   goto out;
if ((vd->vd_flags & (VDF_DEAD | VDF_TEXTMODE)) != 0)
goto out;
if (vd->vd_height <= vt_logo_sprite_height)
___
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: r349693 - stable/11/sys/dev/virtio/scsi

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:54:56 2019
New Revision: 349693
URL: https://svnweb.freebsd.org/changeset/base/349693

Log:
  MFC r349285
  
  VirtIO SCSI:  validate seg_max on attach
  
  Until head r349278 (stable/12 r349690), bhyve presented a seg_max
  to the guest that was too large.  Detect this case and clamp it to
  the virtqueue size.  Otherwise, we would fail the "too many segments
  to enqueue" assertion in virtqueue_enqueue().
  
  I hit this by running a guest with a MAXPHYS of 256 KB.
  
  Reviewed by:  bryanv cem
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20703

Modified:
  stable/11/sys/dev/virtio/scsi/virtio_scsi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/virtio/scsi/virtio_scsi.c
==
--- stable/11/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:54:37 2019
(r349692)
+++ stable/11/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:54:56 2019
(r349693)
@@ -79,6 +79,7 @@ static void   vtscsi_read_config(struct vtscsi_softc *,
struct virtio_scsi_config *);
 static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
 static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static voidvtscsi_check_sizes(struct vtscsi_softc *);
 static voidvtscsi_write_device_config(struct vtscsi_softc *);
 static int vtscsi_reinit(struct vtscsi_softc *);
 
@@ -312,6 +313,8 @@ vtscsi_attach(device_t dev)
goto fail;
}
 
+   vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -476,6 +479,26 @@ vtscsi_alloc_virtqueues(struct vtscsi_softc *sc)
"%s request", device_get_nameunit(dev));
 
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+   int rqsize;
+
+   if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+   /*
+* Ensure the assertions in virtqueue_enqueue(),
+* even if the hypervisor reports a bad seg_max.
+*/
+   rqsize = virtqueue_size(sc->vtscsi_request_vq);
+   if (sc->vtscsi_max_nsegs > rqsize) {
+   device_printf(sc->vtscsi_dev,
+   "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+   rqsize);
+   sc->vtscsi_max_nsegs = rqsize;
+   }
+   }
 }
 
 static void
___
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: r349691 - stable/12/sys/dev/virtio/scsi

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:52:24 2019
New Revision: 349691
URL: https://svnweb.freebsd.org/changeset/base/349691

Log:
  MFC r349285
  
  VirtIO SCSI:  validate seg_max on attach
  
  Until head r349278 (stable/12 r349690), bhyve presented a seg_max
  to the guest that was too large.  Detect this case and clamp it to
  the virtqueue size.  Otherwise, we would fail the "too many segments
  to enqueue" assertion in virtqueue_enqueue().
  
  I hit this by running a guest with a MAXPHYS of 256 KB.
  
  Reviewed by:  bryanv cem
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20703

Modified:
  stable/12/sys/dev/virtio/scsi/virtio_scsi.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/virtio/scsi/virtio_scsi.c
==
--- stable/12/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:50:22 2019
(r349690)
+++ stable/12/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:52:24 2019
(r349691)
@@ -81,6 +81,7 @@ static void   vtscsi_read_config(struct vtscsi_softc *,
struct virtio_scsi_config *);
 static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
 static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static voidvtscsi_check_sizes(struct vtscsi_softc *);
 static voidvtscsi_write_device_config(struct vtscsi_softc *);
 static int vtscsi_reinit(struct vtscsi_softc *);
 
@@ -314,6 +315,8 @@ vtscsi_attach(device_t dev)
goto fail;
}
 
+   vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -478,6 +481,26 @@ vtscsi_alloc_virtqueues(struct vtscsi_softc *sc)
"%s request", device_get_nameunit(dev));
 
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+   int rqsize;
+
+   if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+   /*
+* Ensure the assertions in virtqueue_enqueue(),
+* even if the hypervisor reports a bad seg_max.
+*/
+   rqsize = virtqueue_size(sc->vtscsi_request_vq);
+   if (sc->vtscsi_max_nsegs > rqsize) {
+   device_printf(sc->vtscsi_dev,
+   "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+   rqsize);
+   sc->vtscsi_max_nsegs = rqsize;
+   }
+   }
 }
 
 static void
___
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: r349690 - stable/12/usr.sbin/bhyve

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:50:22 2019
New Revision: 349690
URL: https://svnweb.freebsd.org/changeset/base/349690

Log:
  MFC r349278
  
  bhyve: Fix vtscsi maximum segment config
  
  The seg_max value reported to the guest should be two less than the
  host's maximum, in order to leave room for the request and the
  response.  This is analogous to r347033 for virtio_block.
  
  We hit the "too many segments to enqueue" assertion on OneFS because
  we increase MAXPHYS to 256 KB.
  
  Reviewed by:  bryanv
  Discussed with:   cem jhb rgrimes
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20529

Modified:
  stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Wed Jul  3 19:46:05 2019
(r349689)
+++ stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Wed Jul  3 19:50:22 2019
(r349690)
@@ -309,7 +309,8 @@ pci_vtscsi_reset(void *vsc)
/* initialize config structure */
sc->vss_config = (struct pci_vtscsi_config){
.num_queues = VTSCSI_REQUESTQ,
-   .seg_max = VTSCSI_MAXSEG,
+   /* Leave room for the request and the response. */
+   .seg_max = VTSCSI_MAXSEG - 2,
.max_sectors = 2,
.cmd_per_lun = 1,
.event_info_size = sizeof(struct pci_vtscsi_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: r349677 - in head: sys/kern tools/test/callout_free

2019-07-03 Thread Eric van Gyzen
}
+   cpu++;
+   }
 }
 #endif /* DDB */

Added: head/tools/test/callout_free/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/test/callout_free/Makefile   Wed Jul  3 19:22:44 2019
(r349677)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+KMOD=  callout_free
+SRCS=  callout_free.c
+
+.include 

Added: head/tools/test/callout_free/callout_free.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/test/callout_free/callout_free.c Wed Jul  3 19:22:44 2019
(r349677)
@@ -0,0 +1,87 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Eric van Gyzen
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Free a pending callout.  This was useful for testing the
+ * "show callout_last" ddb command.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct callout callout_free;
+static struct mtx callout_free_mutex;
+static int callout_free_arg;
+
+static void
+callout_free_func(void *arg)
+{
+   printf("squirrel!\n");
+   mtx_destroy(_free_mutex);
+   memset(_free, 'C', sizeof(callout_free));
+}
+
+static int
+callout_free_load(module_t mod, int cmd, void *arg)
+{
+   int error;
+
+   switch (cmd) {
+   case MOD_LOAD:
+   mtx_init(_free_mutex, "callout_free", NULL, MTX_DEF);
+   /*
+* Do not pass CALLOUT_RETURNUNLOCKED so the callout
+* subsystem will unlock the "destroyed" mutex.
+*/
+   callout_init_mtx(_free, _free_mutex, 0);
+   printf("callout_free_func = %p\n", callout_free_func);
+   printf("callout_free_arg = %p\n", _free_arg);
+   callout_reset(_free, hz/10, callout_free_func,
+   _free_arg);
+   error = 0;
+   break;
+
+   case MOD_UNLOAD:
+   error = 0;
+   break;
+
+   default:
+   error = EOPNOTSUPP;
+   break;
+   }
+
+   return (error);
+}
+
+DEV_MODULE(callout_free, callout_free_load, 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: r349285 - head/sys/dev/virtio/scsi

2019-06-21 Thread Eric van Gyzen
Author: vangyzen
Date: Sat Jun 22 01:20:45 2019
New Revision: 349285
URL: https://svnweb.freebsd.org/changeset/base/349285

Log:
  VirtIO SCSI:  validate seg_max on attach
  
  Until r349278, bhyve presented a seg_max to the guest that was too large.
  Detect this case and clamp it to the virtqueue size.  Otherwise, we would
  fail the "too many segments to enqueue" assertion in virtqueue_enqueue().
  
  I hit this by running a guest with a MAXPHYS of 256 KB.
  
  Reviewed by:  bryanv cem
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20703

Modified:
  head/sys/dev/virtio/scsi/virtio_scsi.c

Modified: head/sys/dev/virtio/scsi/virtio_scsi.c
==
--- head/sys/dev/virtio/scsi/virtio_scsi.c  Sat Jun 22 01:06:41 2019
(r349284)
+++ head/sys/dev/virtio/scsi/virtio_scsi.c  Sat Jun 22 01:20:45 2019
(r349285)
@@ -81,6 +81,7 @@ static void   vtscsi_read_config(struct vtscsi_softc *,
struct virtio_scsi_config *);
 static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
 static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static voidvtscsi_check_sizes(struct vtscsi_softc *);
 static voidvtscsi_write_device_config(struct vtscsi_softc *);
 static int vtscsi_reinit(struct vtscsi_softc *);
 
@@ -311,6 +312,8 @@ vtscsi_attach(device_t dev)
goto fail;
}
 
+   vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -475,6 +478,26 @@ vtscsi_alloc_virtqueues(struct vtscsi_softc *sc)
"%s request", device_get_nameunit(dev));
 
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+   int rqsize;
+
+   if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+   /*
+* Ensure the assertions in virtqueue_enqueue(),
+* even if the hypervisor reports a bad seg_max.
+*/
+   rqsize = virtqueue_size(sc->vtscsi_request_vq);
+   if (sc->vtscsi_max_nsegs > rqsize) {
+   device_printf(sc->vtscsi_dev,
+   "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+   rqsize);
+   sc->vtscsi_max_nsegs = rqsize;
+   }
+   }
 }
 
 static void
___
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: r349278 - head/usr.sbin/bhyve

2019-06-21 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Jun 21 18:57:33 2019
New Revision: 349278
URL: https://svnweb.freebsd.org/changeset/base/349278

Log:
  bhyve: Fix vtscsi maximum segment config
  
  The seg_max value reported to the guest should be two less than the
  host's maximum, in order to leave room for the request and the
  response.  This is analogous to r347033 for virtio_block.
  
  We hit the "too many segments to enqueue" assertion on OneFS because
  we increase MAXPHYS to 256 KB.
  
  Reviewed by:  bryanv
  Discussed with:   cem jhb rgrimes
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20529

Modified:
  head/usr.sbin/bhyve/pci_virtio_scsi.c

Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- head/usr.sbin/bhyve/pci_virtio_scsi.c   Fri Jun 21 18:48:07 2019
(r349277)
+++ head/usr.sbin/bhyve/pci_virtio_scsi.c   Fri Jun 21 18:57:33 2019
(r349278)
@@ -309,7 +309,8 @@ pci_vtscsi_reset(void *vsc)
/* initialize config structure */
sc->vss_config = (struct pci_vtscsi_config){
.num_queues = VTSCSI_REQUESTQ,
-   .seg_max = VTSCSI_MAXSEG,
+   /* Leave room for the request and the response. */
+   .seg_max = VTSCSI_MAXSEG - 2,
.max_sectors = 2,
.cmd_per_lun = 1,
.event_info_size = sizeof(struct pci_vtscsi_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"


URLs in the PR field of commit logs

2019-03-27 Thread Eric van Gyzen
(I apologize for the massive cross-post.  There was no obvious place to
announce this.)

I plan to change the Subversion commit hooks to accept URLs in the PR
field of commit logs.  See

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236229

If you anticipate specific problems this might cause, or have any other
relevant discussion, please comment on that bug.

Thanks,

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


URLs in the PR field of commit logs

2019-03-07 Thread Eric van Gyzen
(I apologize for the massive cross-post.  There was no obvious place to
announce this.)

I plan to change the Subversion commit hooks to accept URLs in the PR
field of commit logs.  See

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236229

If you anticipate specific problems this might cause, or have any other
relevant discussion, please comment on that bug.

Thanks,

Eric
___
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: r344567 - in head: etc/mtree include sbin sbin/veriexec

2019-02-27 Thread Eric van Gyzen

> On Feb 26, 2019, at 10:17 PM, Warner Losh  wrote:
> 
> 
> 
> On Tue, Feb 26, 2019, 6:50 AM Alexey Dokuchaev  > wrote:
> On Mon, Feb 25, 2019 at 10:19:45PM -0800, Rodney W. Grimes wrote:
> > > Author: sjg
> > > Date: Tue Feb 26 06:17:23 2019
> > > New Revision: 344567
> > > URL: https://svnweb.freebsd.org/changeset/base/344567 
> > > 
> > > 
> > > Log:
> > >   Add verifying manifest loader for mac_veriexec
> > >   
> > >   This tool will verify a signed manifest and load contents into
> > >   mac_veriexec for storage
> > >   
> > >   Sponsored by: Juniper Networks
> > >   Differential Revision:D16575
> > 
> > Just a small nit, for future reference, from the template:
> > > Differential Revision:https://reviews.freebsd.org/D### 
> > > 
> > (*full* phabric URL needed).
> 
> IMHO we should just fix the scripts to accept D alone, without
> the URL.  We don't do that for PR (bugzilla) references, and the fact
> that we do for the phab is both needless and confusing.  Also, that
> URL might change one day while we could probably keep the old numbers
> if we move.
> 
> When this came up before, it was an upstream decision to require the full 
> path. The reasoning is that D space isn't unique and the review may 
> happen in a different instance of phab than the default one. When those exact 
> objections were raised, the experience of moving to bugzilla was cited to 
> show the URL can remain stable. And if we went to another system's, we could 
> keep the old in place and then we would need a new URL to disambiguate. There 
> were good reasons we decided this before.
> 
> So this has been litigated before, and the consensus was we needed to break 
> with the practice of not putting URLs in commit messages for these reasons.

I completely agree.  In fact, I’d like to see full bugzilla URLs in commit logs 
instead of just the bug number.  Every app I use to read commit logs will make 
URLs clickable, even my terminal emulator.  The fact that I have to manually 
open bugzilla and copy/type the bug number is annoying.

And yes, I volunteer to make the necessary changes to accept URLs in the PR 
field.  We just need consensus.

Eric
___
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: r343672 - head/libexec/rtld-elf/i386

2019-02-01 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Feb  1 23:16:59 2019
New Revision: 343672
URL: https://svnweb.freebsd.org/changeset/base/343672

Log:
  rtld: pacify -Wmaybe-uninitialized from gcc6
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/libexec/rtld-elf/i386/reloc.c

Modified: head/libexec/rtld-elf/i386/reloc.c
==
--- head/libexec/rtld-elf/i386/reloc.c  Fri Feb  1 23:15:54 2019
(r343671)
+++ head/libexec/rtld-elf/i386/reloc.c  Fri Feb  1 23:16:59 2019
(r343672)
@@ -146,6 +146,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int
} else
cache = NULL;
 
+   /* Appease some compilers. */
+   symval = 0;
+   def = NULL;
+
rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize);
for (rel = obj->rel;  rel < rellim;  rel++) {
switch (ELF_R_TYPE(rel->r_info)) {
___
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: r343671 - head/lib/msun

2019-02-01 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Feb  1 23:15:54 2019
New Revision: 343671
URL: https://svnweb.freebsd.org/changeset/base/343671

Log:
  libm: squelch -Woverflow from gcc6
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/msun/Makefile

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Fri Feb  1 23:04:45 2019(r343670)
+++ head/lib/msun/Makefile  Fri Feb  1 23:15:54 2019(r343671)
@@ -108,6 +108,15 @@ COMMON_SRCS+=  catrigl.c \
s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \
s_scalbnl.c s_sinl.c s_sincosl.c \
s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
+# Work around this warning from gcc 6:
+# lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of
+# 'long double' [-Werror=overflow]
+# if( y >= LDBL_MAX )
+# See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067
+.include 
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 6
+CFLAGS.e_powl.c+= -Wno-error=overflow
+.endif
 .endif
 
 # C99 complex functions
___
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: r341508 - in head/sys: conf net/altq

2018-12-04 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec  4 23:53:42 2018
New Revision: 341508
URL: https://svnweb.freebsd.org/changeset/base/341508

Log:
  altq:  manual cleanup after r341507
  
  Remove a file that became practically empty.
  Fix indentation.
  
  Like r341507, I do not plan to MFC, but anyone else can.

Deleted:
  head/sys/net/altq/altq_cdnr.c
Modified:
  head/sys/conf/files
  head/sys/net/altq/altq_cbq.c
  head/sys/net/altq/altq_hfsc.c
  head/sys/net/altq/altq_priq.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Dec  4 23:46:43 2018(r341507)
+++ head/sys/conf/files Tue Dec  4 23:53:42 2018(r341508)
@@ -4058,7 +4058,6 @@ libkern/timingsafe_bcmp.c standard
 libkern/zlib.c optional crypto | geom_uzip | ipsec | \
ipsec_support | mxge | netgraph_deflate | ddb_ctf | gzio
 net/altq/altq_cbq.coptional altq
-net/altq/altq_cdnr.c   optional altq
 net/altq/altq_codel.c  optional altq
 net/altq/altq_hfsc.c   optional altq
 net/altq/altq_fairq.c  optional altq

Modified: head/sys/net/altq/altq_cbq.c
==
--- head/sys/net/altq/altq_cbq.cTue Dec  4 23:46:43 2018
(r341507)
+++ head/sys/net/altq/altq_cbq.cTue Dec  4 23:53:42 2018
(r341508)
@@ -483,7 +483,7 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct
return (ENOBUFS);
}
}
-   cl->pktattr_ = NULL;
+   cl->pktattr_ = NULL;
len = m_pktlen(m);
if (rmc_queue_packet(cl, m) != 0) {
/* drop occurred.  some mbuf was freed in rmc_queue_packet. */

Modified: head/sys/net/altq/altq_hfsc.c
==
--- head/sys/net/altq/altq_hfsc.c   Tue Dec  4 23:46:43 2018
(r341507)
+++ head/sys/net/altq/altq_hfsc.c   Tue Dec  4 23:53:42 2018
(r341508)
@@ -689,7 +689,7 @@ hfsc_enqueue(struct ifaltq *ifq, struct mbuf *m, struc
return (ENOBUFS);
}
}
-   cl->cl_pktattr = NULL;
+   cl->cl_pktattr = NULL;
len = m_pktlen(m);
if (hfsc_addq(cl, m) != 0) {
/* drop occurred.  mbuf was freed in hfsc_addq. */

Modified: head/sys/net/altq/altq_priq.c
==
--- head/sys/net/altq/altq_priq.c   Tue Dec  4 23:46:43 2018
(r341507)
+++ head/sys/net/altq/altq_priq.c   Tue Dec  4 23:53:42 2018
(r341508)
@@ -473,7 +473,7 @@ priq_enqueue(struct ifaltq *ifq, struct mbuf *m, struc
return (ENOBUFS);
}
}
-   cl->cl_pktattr = NULL;
+   cl->cl_pktattr = NULL;
len = m_pktlen(m);
if (priq_addq(cl, m) != 0) {
/* drop occurred.  mbuf was freed in priq_addq. */
___
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: r341507 - head/sys/net/altq

2018-12-04 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Dec  4 23:46:43 2018
New Revision: 341507
URL: https://svnweb.freebsd.org/changeset/base/341507

Log:
  altq: remove ALTQ3_COMPAT code
  
  This code has apparently never compiled on FreeBSD since its
  introduction in 2004 (r130365).  It has certainly not compiled
  since 2006, when r164033 added #elsif [sic] preprocessor directives.
  The code was left in the tree to reduce the diff from upstream (KAME).
  Since that upstream is no longer relevant, remove the long-dead code.
  
  This commit is the direct result of:
  
  unifdef -m -UALTQ3_COMPAT sys/net/altq/*
  
  A later commit will do some manual cleanup.
  
  I do not plan to MFC this.  If that would help you, go for it.

Modified:
  head/sys/net/altq/altq.h
  head/sys/net/altq/altq_cbq.c
  head/sys/net/altq/altq_cbq.h
  head/sys/net/altq/altq_cdnr.c
  head/sys/net/altq/altq_hfsc.c
  head/sys/net/altq/altq_hfsc.h
  head/sys/net/altq/altq_priq.c
  head/sys/net/altq/altq_priq.h
  head/sys/net/altq/altq_red.c
  head/sys/net/altq/altq_red.h
  head/sys/net/altq/altq_rio.c
  head/sys/net/altq/altq_rio.h
  head/sys/net/altq/altq_rmclass.c
  head/sys/net/altq/altq_subr.c

Modified: head/sys/net/altq/altq.h
==
--- head/sys/net/altq/altq.hTue Dec  4 22:52:15 2018(r341506)
+++ head/sys/net/altq/altq.hTue Dec  4 23:46:43 2018(r341507)
@@ -38,17 +38,7 @@
 #define ALTQ3_CLFIER_COMPAT/* for compatibility with altq-3 classifier */
 #endif
 
-#ifdef ALTQ3_COMPAT
-#include 
-#include 
-#include 
-#include 
 
-#ifndef IFNAMSIZ
-#defineIFNAMSIZ16
-#endif
-#endif /* ALTQ3_COMPAT */
-
 /* altq discipline type */
 #defineALTQT_NONE  0   /* reserved */
 #defineALTQT_CBQ   1   /* cbq */
@@ -67,12 +57,6 @@
 #defineALTQT_CODEL 14  /* CoDel */
 #defineALTQT_MAX   15  /* should be max discipline 
type + 1 */
 
-#ifdef ALTQ3_COMPAT
-struct altqreq {
-   charifname[IFNAMSIZ];   /* if name, e.g. "en0" */
-   u_long  arg;/* request-specific argument */
-};
-#endif
 
 /* simple token backet meter profile */
 struct tb_profile {
@@ -80,87 +64,8 @@ struct   tb_profile {
u_int32_t   depth;  /* depth in bytes */
 };
 
-#ifdef ALTQ3_COMPAT
-struct tbrreq {
-   charifname[IFNAMSIZ];   /* if name, e.g. "en0" */
-   struct  tb_profile tb_prof; /* token bucket profile */
-};
 
-#ifdef ALTQ3_CLFIER_COMPAT
 /*
- * common network flow info structure
- */
-struct flowinfo {
-   u_char  fi_len; /* total length */
-   u_char  fi_family;  /* address family */
-   u_int8_tfi_data[46];/* actually longer; address family
-  specific flow info. */
-};
-
-/*
- * flow info structure for internet protocol family.
- * (currently this is the only protocol family supported)
- */
-struct flowinfo_in {
-   u_char  fi_len; /* sizeof(struct flowinfo_in) */
-   u_char  fi_family;  /* AF_INET */
-   u_int8_tfi_proto;   /* IPPROTO_XXX */
-   u_int8_tfi_tos; /* type-of-service */
-   struct in_addr  fi_dst; /* dest address */
-   struct in_addr  fi_src; /* src address */
-   u_int16_t   fi_dport;   /* dest port */
-   u_int16_t   fi_sport;   /* src port */
-   u_int32_t   fi_gpi; /* generalized port id for ipsec */
-   u_int8_t_pad[28];   /* make the size equal to
-  flowinfo_in6 */
-};
-
-#ifdef SIN6_LEN
-struct flowinfo_in6 {
-   u_char  fi6_len;/* sizeof(struct flowinfo_in6) */
-   u_char  fi6_family; /* AF_INET6 */
-   u_int8_tfi6_proto;  /* IPPROTO_XXX */
-   u_int8_tfi6_tclass; /* traffic class */
-   u_int32_t   fi6_flowlabel;  /* ipv6 flowlabel */
-   u_int16_t   fi6_dport;  /* dest port */
-   u_int16_t   fi6_sport;  /* src port */
-   u_int32_t   fi6_gpi;/* generalized port id */
-   struct in6_addr fi6_dst;/* dest address */
-   struct in6_addr fi6_src;/* src address */
-};
-#endif /* INET6 */
-
-/*
- * flow filters for AF_INET and AF_INET6
- */
-struct flow_filter {
-   int ff_ruleno;
-   struct flowinfo_in  ff_flow;
-   struct {
-   struct in_addr  mask_dst;
-   struct in_addr  mask_src;
-   u_int8_tmask_tos;
-   u_int8_t_pad[3];
-   } ff_mask;
-   u_int8_t _pad2[24]; /* make the size equal to flow_filter6 */
-};
-
-#ifdef SIN6_LEN
-struct flow_filter6 {
-   int ff_ruleno;
-   struct flowinfo_in6 ff_flow6;
-   struct {
-  

svn commit: r341354 - head/tests/sys/kern

2018-11-30 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov 30 23:47:57 2018
New Revision: 341354
URL: https://svnweb.freebsd.org/changeset/base/341354

Log:
  Maybe make gcc happy
  
  According to Jenkins, the GCC architectures were unhappy because:
  
  sigaltstack.c:82: warning: missing initializer
  sigaltstack.c:82: warning: (near initialization for 'oss.ss_size')
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/kern/sigaltstack.c

Modified: head/tests/sys/kern/sigaltstack.c
==
--- head/tests/sys/kern/sigaltstack.c   Fri Nov 30 22:44:33 2018
(r341353)
+++ head/tests/sys/kern/sigaltstack.c   Fri Nov 30 23:47:57 2018
(r341354)
@@ -79,7 +79,9 @@ ATF_TC_BODY(ss_onstack, tc)
stack_t ss = {
.ss_size = SIGSTKSZ,
};
-   stack_t oss = {0};
+   stack_t oss = {
+   .ss_size = 0,
+   };
 
ss.ss_sp = malloc(ss.ss_size);
ATF_REQUIRE(ss.ss_sp != 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: r341353 - in head: sys/arm/arm sys/arm64/arm64 sys/riscv/riscv tests/sys/kern

2018-11-30 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov 30 22:44:33 2018
New Revision: 341353
URL: https://svnweb.freebsd.org/changeset/base/341353

Log:
  Fix reporting of SS_ONSTACK
  
  Fix reporting of SS_ONSTACK in nested signal delivery when sigaltstack()
  is used on some architectures.
  
  Add a unit test for this.  I tested the test by introducing the bug
  on amd64.  I did not test it on other architectures.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D18347

Added:
  head/tests/sys/kern/sigaltstack.c   (contents, props changed)
Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm64/arm64/machdep.c
  head/sys/riscv/riscv/machdep.c
  head/tests/sys/kern/Makefile

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Fri Nov 30 21:57:02 2018(r341352)
+++ head/sys/arm/arm/machdep.c  Fri Nov 30 22:44:33 2018(r341353)
@@ -653,9 +653,9 @@ sendsig(catcher, ksi, mask)
 #endif
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
-   frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK )
-   ? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE;
frame.sf_uc.uc_stack = td->td_sigstk;
+   frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) != 0 ?
+   (onstack ? SS_ONSTACK : 0) : SS_DISABLE;
mtx_unlock(>ps_mtx);
PROC_UNLOCK(td->td_proc);
 

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Fri Nov 30 21:57:02 2018
(r341352)
+++ head/sys/arm64/arm64/machdep.c  Fri Nov 30 22:44:33 2018
(r341353)
@@ -661,9 +661,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
-   frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ?
-   ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE;
frame.sf_uc.uc_stack = td->td_sigstk;
+   frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) != 0 ?
+   (onstack ? SS_ONSTACK : 0) : SS_DISABLE;
mtx_unlock(>ps_mtx);
PROC_UNLOCK(td->td_proc);
 

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri Nov 30 21:57:02 2018
(r341352)
+++ head/sys/riscv/riscv/machdep.c  Fri Nov 30 22:44:33 2018
(r341353)
@@ -587,9 +587,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
-   frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ?
-   ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE;
frame.sf_uc.uc_stack = td->td_sigstk;
+   frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) != 0 ?
+   (onstack ? SS_ONSTACK : 0) : SS_DISABLE;
mtx_unlock(>ps_mtx);
PROC_UNLOCK(td->td_proc);
 

Modified: head/tests/sys/kern/Makefile
==
--- head/tests/sys/kern/MakefileFri Nov 30 21:57:02 2018
(r341352)
+++ head/tests/sys/kern/MakefileFri Nov 30 22:44:33 2018
(r341353)
@@ -10,6 +10,7 @@ ATF_TESTS_C+= kern_descrip_test
 ATF_TESTS_C+=  ptrace_test
 TEST_METADATA.ptrace_test+=timeout="15"
 ATF_TESTS_C+=  reaper
+ATF_TESTS_C+=  sigaltstack
 PLAIN_TESTS_C+=subr_unit_test
 ATF_TESTS_C+=  sys_getrandom
 ATF_TESTS_C+=  unix_passfd_test

Added: head/tests/sys/kern/sigaltstack.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/kern/sigaltstack.c   Fri Nov 30 22:44:33 2018
(r341353)
@@ -0,0 +1,115 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 Eric van Gyzen
+ *
+ * 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 FO

svn commit: r341282 - in head/sys: kern vm

2018-11-29 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov 30 04:59:43 2018
New Revision: 341282
URL: https://svnweb.freebsd.org/changeset/base/341282

Log:
  Include path for tmpfs objects in vm.objects sysctl
  
  This applies the fix in r283924 to the vm.objects sysctl
  added by r283624 so the output will include the vnode
  information (i.e. path) for tmpfs objects.
  
  Reviewed by:  kib, dab
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D2724

Modified:
  head/sys/kern/kern_proc.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Fri Nov 30 04:18:31 2018(r341281)
+++ head/sys/kern/kern_proc.c   Fri Nov 30 04:59:43 2018(r341282)
@@ -2219,43 +2219,11 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS)
freepath = NULL;
fullpath = "";
if (lobj) {
-   vp = NULL;
-   switch (lobj->type) {
-   case OBJT_DEFAULT:
-   kve->kve_type = KVME_TYPE_DEFAULT;
-   break;
-   case OBJT_VNODE:
-   kve->kve_type = KVME_TYPE_VNODE;
-   vp = lobj->handle;
-   vref(vp);
-   break;
-   case OBJT_SWAP:
-   if ((lobj->flags & OBJ_TMPFS_NODE) != 0) {
-   kve->kve_type = KVME_TYPE_VNODE;
-   if ((lobj->flags & OBJ_TMPFS) != 0) {
-   vp = 
lobj->un_pager.swp.swp_tmpfs;
-   vref(vp);
-   }
-   } else {
-   kve->kve_type = KVME_TYPE_SWAP;
-   }
-   break;
-   case OBJT_DEVICE:
-   kve->kve_type = KVME_TYPE_DEVICE;
-   break;
-   case OBJT_PHYS:
-   kve->kve_type = KVME_TYPE_PHYS;
-   break;
-   case OBJT_DEAD:
-   kve->kve_type = KVME_TYPE_DEAD;
-   break;
-   case OBJT_SG:
-   kve->kve_type = KVME_TYPE_SG;
-   break;
-   default:
+   kve->kve_type = vm_object_kvme_type(lobj, );
+   if (kve->kve_type == KVME_TYPE_MGTDEVICE)
kve->kve_type = KVME_TYPE_UNKNOWN;
-   break;
-   }
+   if (vp != NULL)
+   vref(vp);
if (lobj != obj)
VM_OBJECT_RUNLOCK(lobj);
 
@@ -2463,46 +2431,9 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s
freepath = NULL;
fullpath = "";
if (lobj != NULL) {
-   vp = NULL;
-   switch (lobj->type) {
-   case OBJT_DEFAULT:
-   kve->kve_type = KVME_TYPE_DEFAULT;
-   break;
-   case OBJT_VNODE:
-   kve->kve_type = KVME_TYPE_VNODE;
-   vp = lobj->handle;
+   kve->kve_type = vm_object_kvme_type(lobj, );
+   if (vp != NULL)
vref(vp);
-   break;
-   case OBJT_SWAP:
-   if ((lobj->flags & OBJ_TMPFS_NODE) != 0) {
-   kve->kve_type = KVME_TYPE_VNODE;
-   if ((lobj->flags & OBJ_TMPFS) != 0) {
-   vp = 
lobj->un_pager.swp.swp_tmpfs;
-   vref(vp);
-   }
-   } else {
-   kve->kve_type = KVME_TYPE_SWAP;
-   }
-   break;
-   case OBJT_DEVICE:
-   kve->kve_type = KVME_TYPE_DEVICE;
-   break;
-   case OBJT_PHYS:
-   kve->kve_type = KVME_TYPE_PHYS;
-   break;
-   case OBJT_DEAD:
-   kve->kve_type = KVME_TYPE_DEAD;
-   break;
-

svn commit: r341281 - head/sys/vm

2018-11-29 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov 30 04:18:31 2018
New Revision: 341281
URL: https://svnweb.freebsd.org/changeset/base/341281

Log:
  Add assertions and comment to vm_object_vnode()
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D2724

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Fri Nov 30 04:15:56 2018(r341280)
+++ head/sys/vm/vm_object.c Fri Nov 30 04:18:31 2018(r341281)
@@ -2306,16 +2306,28 @@ next_page:
}
 }
 
+/*
+ * Return the vnode for the given object, or NULL if none exists.
+ * For tmpfs objects, the function may return NULL if there is
+ * no vnode allocated at the time of the call.
+ */
 struct vnode *
 vm_object_vnode(vm_object_t object)
 {
+   struct vnode *vp;
 
VM_OBJECT_ASSERT_LOCKED(object);
-   if (object->type == OBJT_VNODE)
-   return (object->handle);
-   if (object->type == OBJT_SWAP && (object->flags & OBJ_TMPFS) != 0)
-   return (object->un_pager.swp.swp_tmpfs);
-   return (NULL);
+   if (object->type == OBJT_VNODE) {
+   vp = object->handle;
+   KASSERT(vp != NULL, ("%s: OBJT_VNODE has no vnode", __func__));
+   } else if (object->type == OBJT_SWAP &&
+   (object->flags & OBJ_TMPFS) != 0) {
+   vp = object->un_pager.swp.swp_tmpfs;
+   KASSERT(vp != NULL, ("%s: OBJT_TMPFS has no vnode", __func__));
+   } else {
+   vp = NULL;
+   }
+   return (vp);
 }
 
 static int
___
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: r341278 - head/lib/libthr/thread

2018-11-29 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov 30 03:02:49 2018
New Revision: 341278
URL: https://svnweb.freebsd.org/changeset/base/341278

Log:
  Use _thr_isthreaded() and _thr_setthreaded() wrappers
  
  ...instead of directly using the global variable.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libthr/thread/thr_fork.c
  head/lib/libthr/thread/thr_spinlock.c

Modified: head/lib/libthr/thread/thr_fork.c
==
--- head/lib/libthr/thread/thr_fork.c   Fri Nov 30 03:01:32 2018
(r341277)
+++ head/lib/libthr/thread/thr_fork.c   Fri Nov 30 03:02:49 2018
(r341278)
@@ -219,9 +219,9 @@ __thr_fork(void)
_thr_rwl_rdlock(&_thr_atfork_lock);
 
if (was_threaded) {
-   __isthreaded = 1;
+   _thr_setthreaded(1);
_malloc_postfork();
-   __isthreaded = 0;
+   _thr_setthreaded(0);
}
 
/* Ready to continue, unblock signals. */ 

Modified: head/lib/libthr/thread/thr_spinlock.c
==
--- head/lib/libthr/thread/thr_spinlock.c   Fri Nov 30 03:01:32 2018
(r341277)
+++ head/lib/libthr/thread/thr_spinlock.c   Fri Nov 30 03:02:49 2018
(r341278)
@@ -58,7 +58,7 @@ static intinitialized;
 static voidinit_spinlock(spinlock_t *lck);
 
 /*
- * These are for compatability only.  Spinlocks of this type
+ * These are for compatibility only.  Spinlocks of this type
  * are deprecated.
  */
 
@@ -76,7 +76,7 @@ __thr_spinlock(spinlock_t *lck)
 {
struct spinlock_extra *_extra;
 
-   if (!__isthreaded)
+   if (!_thr_isthreaded())
PANIC("Spinlock called when not threaded.");
if (!initialized)
PANIC("Spinlocks not initialized.");
___
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: r341277 - head/lib/libthr/thread

2018-11-29 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Nov 30 03:01:32 2018
New Revision: 341277
URL: https://svnweb.freebsd.org/changeset/base/341277

Log:
  _thr_setthreaded() cannot fail; change return type to void
  
  Also remove logic to avoid unnecessary stores to the global variable.
  Thread creation and destruction are heavy enough that any supposed savings
  is in the noise.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libthr/thread/thr_create.c
  head/lib/libthr/thread/thr_kern.c
  head/lib/libthr/thread/thr_private.h

Modified: head/lib/libthr/thread/thr_create.c
==
--- head/lib/libthr/thread/thr_create.c Fri Nov 30 02:14:41 2018
(r341276)
+++ head/lib/libthr/thread/thr_create.c Fri Nov 30 03:01:32 2018
(r341277)
@@ -73,8 +73,7 @@ _pthread_create(pthread_t * __restrict thread,
 */
if (_thr_isthreaded() == 0) {
_malloc_first_thread();
-   if (_thr_setthreaded(1))
-   return (EAGAIN);
+   _thr_setthreaded(1);
}
 
curthread = _get_curthread();

Modified: head/lib/libthr/thread/thr_kern.c
==
--- head/lib/libthr/thread/thr_kern.c   Fri Nov 30 02:14:41 2018
(r341276)
+++ head/lib/libthr/thread/thr_kern.c   Fri Nov 30 03:01:32 2018
(r341277)
@@ -53,14 +53,10 @@ static struct wake_addr default_wake_addr;
  * This is called when the first thread (other than the initial
  * thread) is created.
  */
-int
+void
 _thr_setthreaded(int threaded)
 {
-   if (((threaded == 0) ^ (__isthreaded == 0)) == 0)
-   return (0);
-
__isthreaded = threaded;
-   return (0);
 }
 
 void

Modified: head/lib/libthr/thread/thr_private.h
==
--- head/lib/libthr/thread/thr_private.hFri Nov 30 02:14:41 2018
(r341276)
+++ head/lib/libthr/thread/thr_private.hFri Nov 30 03:01:32 2018
(r341277)
@@ -776,7 +776,7 @@ extern struct pthread   *_single_thread __hidden;
  * Function prototype definitions.
  */
 __BEGIN_DECLS
-int_thr_setthreaded(int) __hidden;
+void   _thr_setthreaded(int) __hidden;
 int_mutex_cv_lock(struct pthread_mutex *, int, bool) __hidden;
 int_mutex_cv_unlock(struct pthread_mutex *, int *, int *) __hidden;
 int _mutex_cv_attach(struct pthread_mutex *, int) __hidden;
___
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: r341166 - in stable/11/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 21:20:51 2018
New Revision: 341166
URL: https://svnweb.freebsd.org/changeset/base/341166

Log:
  MFC r340995
  
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/arm/arm/machdep.c
  stable/11/sys/arm64/arm64/machdep.c
  stable/11/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/arm/machdep.c
==
--- stable/11/sys/arm/arm/machdep.c Wed Nov 28 21:19:58 2018
(r341165)
+++ stable/11/sys/arm/arm/machdep.c Wed Nov 28 21:20:51 2018
(r341166)
@@ -609,6 +609,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: stable/11/sys/arm64/arm64/machdep.c
==
--- stable/11/sys/arm64/arm64/machdep.c Wed Nov 28 21:19:58 2018
(r341165)
+++ stable/11/sys/arm64/arm64/machdep.c Wed Nov 28 21:20:51 2018
(r341166)
@@ -590,6 +590,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: stable/11/sys/riscv/riscv/machdep.c
==
--- stable/11/sys/riscv/riscv/machdep.c Wed Nov 28 21:19:58 2018
(r341165)
+++ stable/11/sys/riscv/riscv/machdep.c Wed Nov 28 21:20:51 2018
(r341166)
@@ -522,6 +522,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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: r341165 - in stable/11/sys: amd64/ia32 mips/mips powerpc/powerpc

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 21:19:58 2018
New Revision: 341165
URL: https://svnweb.freebsd.org/changeset/base/341165

Log:
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Security: FreeBSD-EN-18:12.mem
  Security: CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/amd64/ia32/ia32_signal.c
  stable/11/sys/mips/mips/freebsd32_machdep.c
  stable/11/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/ia32/ia32_signal.c
==
--- stable/11/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 20:03:53 2018
(r341164)
+++ stable/11/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 21:19:58 2018
(r341165)
@@ -260,6 +260,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -300,6 +301,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/11/sys/mips/mips/freebsd32_machdep.c
==
--- stable/11/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 20:03:53 2018
(r341164)
+++ stable/11/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 21:19:58 2018
(r341165)
@@ -290,6 +290,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -329,6 +330,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/11/sys/powerpc/powerpc/exec_machdep.c
==
--- stable/11/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 20:03:53 
2018(r341164)
+++ stable/11/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 21:19:58 
2018(r341165)
@@ -801,6 +801,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -840,6 +841,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
___
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: r341153 - in releng/12.0/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 16:58:35 2018
New Revision: 341153
URL: https://svnweb.freebsd.org/changeset/base/341153

Log:
  MFS r341147
  
  MFC r340995
  
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  Approved by:  re (gjb)
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  releng/12.0/sys/arm/arm/machdep.c
  releng/12.0/sys/arm64/arm64/machdep.c
  releng/12.0/sys/riscv/riscv/machdep.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/arm/arm/machdep.c
==
--- releng/12.0/sys/arm/arm/machdep.c   Wed Nov 28 16:52:41 2018
(r341152)
+++ releng/12.0/sys/arm/arm/machdep.c   Wed Nov 28 16:58:35 2018
(r341153)
@@ -641,6 +641,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: releng/12.0/sys/arm64/arm64/machdep.c
==
--- releng/12.0/sys/arm64/arm64/machdep.c   Wed Nov 28 16:52:41 2018
(r341152)
+++ releng/12.0/sys/arm64/arm64/machdep.c   Wed Nov 28 16:58:35 2018
(r341153)
@@ -656,6 +656,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: releng/12.0/sys/riscv/riscv/machdep.c
==
--- releng/12.0/sys/riscv/riscv/machdep.c   Wed Nov 28 16:52:41 2018
(r341152)
+++ releng/12.0/sys/riscv/riscv/machdep.c   Wed Nov 28 16:58:35 2018
(r341153)
@@ -583,6 +583,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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: r341149 - in releng/12.0/sys: amd64/ia32 mips/mips powerpc/powerpc

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 16:20:04 2018
New Revision: 341149
URL: https://svnweb.freebsd.org/changeset/base/341149

Log:
  MFS r341146
  
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Approved by:  re (gjb)
  Security: FreeBSD-EN-18:12.mem
  Security: CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  releng/12.0/sys/amd64/ia32/ia32_signal.c
  releng/12.0/sys/mips/mips/freebsd32_machdep.c
  releng/12.0/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/amd64/ia32/ia32_signal.c
==
--- releng/12.0/sys/amd64/ia32/ia32_signal.cWed Nov 28 16:00:52 2018
(r341148)
+++ releng/12.0/sys/amd64/ia32/ia32_signal.cWed Nov 28 16:20:04 2018
(r341149)
@@ -261,6 +261,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -301,6 +302,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: releng/12.0/sys/mips/mips/freebsd32_machdep.c
==
--- releng/12.0/sys/mips/mips/freebsd32_machdep.c   Wed Nov 28 16:00:52 
2018(r341148)
+++ releng/12.0/sys/mips/mips/freebsd32_machdep.c   Wed Nov 28 16:20:04 
2018(r341149)
@@ -294,6 +294,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -333,6 +334,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: releng/12.0/sys/powerpc/powerpc/exec_machdep.c
==
--- releng/12.0/sys/powerpc/powerpc/exec_machdep.c  Wed Nov 28 16:00:52 
2018(r341148)
+++ releng/12.0/sys/powerpc/powerpc/exec_machdep.c  Wed Nov 28 16:20:04 
2018(r341149)
@@ -783,6 +783,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -822,6 +823,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
___
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: r341147 - in stable/12/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 15:34:46 2018
New Revision: 341147
URL: https://svnweb.freebsd.org/changeset/base/341147

Log:
  MFC r340995
  
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/arm/arm/machdep.c
  stable/12/sys/arm64/arm64/machdep.c
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/arm/machdep.c
==
--- stable/12/sys/arm/arm/machdep.c Wed Nov 28 15:31:05 2018
(r341146)
+++ stable/12/sys/arm/arm/machdep.c Wed Nov 28 15:34:46 2018
(r341147)
@@ -641,6 +641,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: stable/12/sys/arm64/arm64/machdep.c
==
--- stable/12/sys/arm64/arm64/machdep.c Wed Nov 28 15:31:05 2018
(r341146)
+++ stable/12/sys/arm64/arm64/machdep.c Wed Nov 28 15:34:46 2018
(r341147)
@@ -656,6 +656,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Wed Nov 28 15:31:05 2018
(r341146)
+++ stable/12/sys/riscv/riscv/machdep.c Wed Nov 28 15:34:46 2018
(r341147)
@@ -583,6 +583,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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: r341146 - in stable/12/sys: amd64/ia32 mips/mips powerpc/powerpc

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 15:31:05 2018
New Revision: 341146
URL: https://svnweb.freebsd.org/changeset/base/341146

Log:
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Security: FreeBSD-EN-18:12.mem
  Security: CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/amd64/ia32/ia32_signal.c
  stable/12/sys/mips/mips/freebsd32_machdep.c
  stable/12/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/ia32/ia32_signal.c
==
--- stable/12/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 15:29:58 2018
(r341145)
+++ stable/12/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 15:31:05 2018
(r341146)
@@ -261,6 +261,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -301,6 +302,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/12/sys/mips/mips/freebsd32_machdep.c
==
--- stable/12/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 15:29:58 2018
(r341145)
+++ stable/12/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 15:31:05 2018
(r341146)
@@ -294,6 +294,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -333,6 +334,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/12/sys/powerpc/powerpc/exec_machdep.c
==
--- stable/12/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 15:29:58 
2018(r341145)
+++ stable/12/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 15:31:05 
2018(r341146)
@@ -783,6 +783,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -822,6 +823,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
___
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: r341100 - stable/11/sys/kern

2018-11-27 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Nov 27 22:33:58 2018
New Revision: 341100
URL: https://svnweb.freebsd.org/changeset/base/341100

Log:
  MFC r340409
  
  Make no assertions about lock state when the scheduler is stopped.
  
  Change the assert paths in rm, rw, and sx locks to match the lock
  and unlock paths.  I did this for mutexes in r306346.
  
  Reported by:  Travis Lane 
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/kern/kern_rmlock.c
  stable/11/sys/kern/kern_rwlock.c
  stable/11/sys/kern/kern_sx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_rmlock.c
==
--- stable/11/sys/kern/kern_rmlock.cTue Nov 27 22:32:34 2018
(r341099)
+++ stable/11/sys/kern/kern_rmlock.cTue Nov 27 22:33:58 2018
(r341100)
@@ -740,7 +740,7 @@ _rm_assert(const struct rmlock *rm, int what, const ch
 {
int count;
 
-   if (panicstr != NULL)
+   if (SCHEDULER_STOPPED())
return;
switch (what) {
case RA_LOCKED:

Modified: stable/11/sys/kern/kern_rwlock.c
==
--- stable/11/sys/kern/kern_rwlock.cTue Nov 27 22:32:34 2018
(r341099)
+++ stable/11/sys/kern/kern_rwlock.cTue Nov 27 22:33:58 2018
(r341100)
@@ -1378,7 +1378,7 @@ __rw_assert(const volatile uintptr_t *c, int what, con
 {
const struct rwlock *rw;
 
-   if (panicstr != NULL)
+   if (SCHEDULER_STOPPED())
return;
 
rw = rwlock2rw(c);

Modified: stable/11/sys/kern/kern_sx.c
==
--- stable/11/sys/kern/kern_sx.cTue Nov 27 22:32:34 2018
(r341099)
+++ stable/11/sys/kern/kern_sx.cTue Nov 27 22:33:58 2018
(r341100)
@@ -1312,7 +1312,7 @@ _sx_assert(const struct sx *sx, int what, const char *
int slocked = 0;
 #endif
 
-   if (panicstr != NULL)
+   if (SCHEDULER_STOPPED())
return;
switch (what) {
case SA_SLOCKED:
___
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: r341099 - stable/12/sys/kern

2018-11-27 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Nov 27 22:32:34 2018
New Revision: 341099
URL: https://svnweb.freebsd.org/changeset/base/341099

Log:
  MFC r340409
  
  Make no assertions about lock state when the scheduler is stopped.
  
  Change the assert paths in rm, rw, and sx locks to match the lock
  and unlock paths.  I did this for mutexes in r306346.
  
  Reported by:  Travis Lane 
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/kern/kern_rmlock.c
  stable/12/sys/kern/kern_rwlock.c
  stable/12/sys/kern/kern_sx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_rmlock.c
==
--- stable/12/sys/kern/kern_rmlock.cTue Nov 27 22:02:54 2018
(r341098)
+++ stable/12/sys/kern/kern_rmlock.cTue Nov 27 22:32:34 2018
(r341099)
@@ -742,7 +742,7 @@ _rm_assert(const struct rmlock *rm, int what, const ch
 {
int count;
 
-   if (panicstr != NULL)
+   if (SCHEDULER_STOPPED())
return;
switch (what) {
case RA_LOCKED:

Modified: stable/12/sys/kern/kern_rwlock.c
==
--- stable/12/sys/kern/kern_rwlock.cTue Nov 27 22:02:54 2018
(r341098)
+++ stable/12/sys/kern/kern_rwlock.cTue Nov 27 22:32:34 2018
(r341099)
@@ -1439,7 +1439,7 @@ __rw_assert(const volatile uintptr_t *c, int what, con
 {
const struct rwlock *rw;
 
-   if (panicstr != NULL)
+   if (SCHEDULER_STOPPED())
return;
 
rw = rwlock2rw(c);

Modified: stable/12/sys/kern/kern_sx.c
==
--- stable/12/sys/kern/kern_sx.cTue Nov 27 22:02:54 2018
(r341098)
+++ stable/12/sys/kern/kern_sx.cTue Nov 27 22:32:34 2018
(r341099)
@@ -1416,7 +1416,7 @@ _sx_assert(const struct sx *sx, int what, const char *
int slocked = 0;
 #endif
 
-   if (panicstr != NULL)
+   if (SCHEDULER_STOPPED())
return;
switch (what) {
case SA_SLOCKED:
___
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: r341092 - stable/12/usr.sbin/periodic/etc/daily

2018-11-27 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Nov 27 19:45:24 2018
New Revision: 341092
URL: https://svnweb.freebsd.org/changeset/base/341092

Log:
  MFC r340345
  
  Fix daily mailq script for Postfix and daily_show_success="NO"
  
  Exit with a zero status when Postfix reports "Mail queue is empty" so this
  section won't appear in the report at all when daily_show_success="NO".
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/usr.sbin/periodic/etc/daily/440.status-mailq
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/periodic/etc/daily/440.status-mailq
==
--- stable/12/usr.sbin/periodic/etc/daily/440.status-mailq  Tue Nov 27 
19:44:39 2018(r341091)
+++ stable/12/usr.sbin/periodic/etc/daily/440.status-mailq  Tue Nov 27 
19:45:24 2018(r341092)
@@ -33,7 +33,7 @@ case "$daily_status_mailq_enable" in
*)
mailq;;
esac | tee /dev/stderr |
-   egrep -v '(mqueue is empty|Total requests)' | wc -l)
+   egrep -v '((Mail |m)queue is empty|Total requests)' | wc -l)
[ $rc -gt 0 ] && rc=1 || rc=0
 
case "$daily_status_include_submit_mailq" in
___
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: r341090 - stable/12

2018-11-27 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Nov 27 19:44:04 2018
New Revision: 341090
URL: https://svnweb.freebsd.org/changeset/base/341090

Log:
  MFC r340328
  
  Update comment about 'universe' disk usage
  
  It's 167 GB now (or 81 GB with ZFS lz4).
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile
==
--- stable/12/Makefile  Tue Nov 27 19:43:16 2018(r341089)
+++ stable/12/Makefile  Tue Nov 27 19:44:04 2018(r341090)
@@ -61,9 +61,10 @@
 # Most of the user-driven targets (as listed above) are implemented in
 # Makefile.inc1.  The exceptions are universe, tinderbox and targets.
 #
-# If you want to build your system from source be sure that /usr/obj has
-# at least 6GB of diskspace available.  A complete 'universe' build requires
-# about 100GB of space.
+# If you want to build your system from source, be sure that /usr/obj has
+# at least 6 GB of disk space available.  A complete 'universe' build of
+# r340283 (2018-11) required 167 GB of space.  ZFS lz4 compression
+# achieved a 2.18x ratio, reducing actual space to 81 GB.
 #
 # For individuals wanting to build from the sources currently on their
 # system, the simple instructions are:
___
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: r341087 - stable/11/sys/netinet6

2018-11-27 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Nov 27 19:40:18 2018
New Revision: 341087
URL: https://svnweb.freebsd.org/changeset/base/341087

Log:
  MFC r340257
  
  in6_ifattach_linklocal: handle immediate removal of the new LLA
  
  If another thread immediately removes the link-local address
  added by in6_update_ifa(), in6ifa_ifpforlinklocal() can return NULL,
  so the following assertion (or dereference) is wrong.
  Remove the assertion, and handle NULL somewhat better than panicking.
  This matches all of the other callers of in6_update_ifa().
  
  PR:   219250
  Reviewed by:  bz, dab (both an earlier version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D17898

Modified:
  stable/11/sys/netinet6/in6_ifattach.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet6/in6_ifattach.c
==
--- stable/11/sys/netinet6/in6_ifattach.c   Tue Nov 27 19:40:07 2018
(r341086)
+++ stable/11/sys/netinet6/in6_ifattach.c   Tue Nov 27 19:40:18 2018
(r341087)
@@ -502,9 +502,16 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet
return (-1);
}
 
-   ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */
-   KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp));
-
+   ia = in6ifa_ifpforlinklocal(ifp, 0);
+   if (ia == NULL) {
+   /*
+* Another thread removed the address that we just added.
+* This should be rare, but it happens.
+*/
+   nd6log((LOG_NOTICE, "%s: %s: new link-local address "
+   "disappeared\n", __func__, if_name(ifp)));
+   return (-1);
+   }
ifa_free(>ia_ifa);
 
/*
___
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: r341086 - stable/12/sys/netinet6

2018-11-27 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Nov 27 19:40:07 2018
New Revision: 341086
URL: https://svnweb.freebsd.org/changeset/base/341086

Log:
  MFC r340257
  
  in6_ifattach_linklocal: handle immediate removal of the new LLA
  
  If another thread immediately removes the link-local address
  added by in6_update_ifa(), in6ifa_ifpforlinklocal() can return NULL,
  so the following assertion (or dereference) is wrong.
  Remove the assertion, and handle NULL somewhat better than panicking.
  This matches all of the other callers of in6_update_ifa().
  
  PR:   219250
  Reviewed by:  bz, dab (both an earlier version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D17898

Modified:
  stable/12/sys/netinet6/in6_ifattach.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet6/in6_ifattach.c
==
--- stable/12/sys/netinet6/in6_ifattach.c   Tue Nov 27 17:58:25 2018
(r341085)
+++ stable/12/sys/netinet6/in6_ifattach.c   Tue Nov 27 19:40:07 2018
(r341086)
@@ -481,9 +481,16 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet
return (-1);
}
 
-   ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */
-   KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp));
-
+   ia = in6ifa_ifpforlinklocal(ifp, 0);
+   if (ia == NULL) {
+   /*
+* Another thread removed the address that we just added.
+* This should be rare, but it happens.
+*/
+   nd6log((LOG_NOTICE, "%s: %s: new link-local address "
+   "disappeared\n", __func__, if_name(ifp)));
+   return (-1);
+   }
ifa_free(>ia_ifa);
 
/*
___
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: r340996 - in head/sys: amd64/amd64 amd64/ia32 i386/i386 kern

2018-11-26 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Nov 26 20:56:05 2018
New Revision: 340996
URL: https://svnweb.freebsd.org/changeset/base/340996

Log:
  Remove superfluous bzero in getcontext/swapcontext/sendsig
  
  We zero the whole structure; we don't need to zero the __spare__ field again.
  
  Remove trailing whitespace.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/i386/i386/machdep.c
  head/sys/kern/kern_context.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Mon Nov 26 20:52:53 2018
(r340995)
+++ head/sys/amd64/amd64/machdep.c  Mon Nov 26 20:56:05 2018
(r340996)
@@ -392,7 +392,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase;
bzero(sf.sf_uc.uc_mcontext.mc_spare,
sizeof(sf.sf_uc.uc_mcontext.mc_spare));
-   bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
/* Allocate space for the signal handler context. */
if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&

Modified: head/sys/amd64/ia32/ia32_signal.c
==
--- head/sys/amd64/ia32/ia32_signal.c   Mon Nov 26 20:52:53 2018
(r340995)
+++ head/sys/amd64/ia32/ia32_signal.c   Mon Nov 26 20:56:05 2018
(r340996)
@@ -266,7 +266,6 @@ freebsd32_getcontext(struct thread *td, struct freebsd
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
-   bzero(__spare__, sizeof(uc.__spare__));
ret = copyout(, uap->ucp, UC_COPY_SIZE);
}
return (ret);
@@ -276,7 +275,7 @@ int
 freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap)
 {
struct ia32_ucontext uc;
-   int ret;
+   int ret;
 
if (uap->ucp == NULL)
ret = EINVAL;
@@ -297,7 +296,7 @@ int
 freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args 
*uap)
 {
struct ia32_ucontext uc;
-   int ret;
+   int ret;
 
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
@@ -622,7 +621,6 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t 
fpstate_drop(td);
sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase;
sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase;
-   bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
/* Allocate space for the signal handler context. */
if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cMon Nov 26 20:52:53 2018
(r340995)
+++ head/sys/i386/i386/machdep.cMon Nov 26 20:56:05 2018
(r340996)
@@ -645,7 +645,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
sdp->sd_lobase;
bzero(sf.sf_uc.uc_mcontext.mc_spare2,
sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
-   bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
 
/* Allocate space for the signal handler context. */
if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&

Modified: head/sys/kern/kern_context.c
==
--- head/sys/kern/kern_context.cMon Nov 26 20:52:53 2018
(r340995)
+++ head/sys/kern/kern_context.cMon Nov 26 20:56:05 2018
(r340996)
@@ -75,7 +75,6 @@ sys_getcontext(struct thread *td, struct getcontext_ar
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
-   bzero(uc.__spare__, sizeof(uc.__spare__));
ret = copyout(, uap->ucp, UC_COPY_SIZE);
}
return (ret);
@@ -85,7 +84,7 @@ int
 sys_setcontext(struct thread *td, struct setcontext_args *uap)
 {
ucontext_t uc;
-   int ret;
+   int ret;
 
if (uap->ucp == NULL)
ret = EINVAL;
@@ -106,14 +105,13 @@ int
 sys_swapcontext(struct thread *td, struct swapcontext_args *uap)
 {
ucontext_t uc;
-   int ret;
+   int ret;
 
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
bzero(, sizeof(ucontext_t));
get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
-   bzero(uc.__spare__, sizeof(uc.__spare__));
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
PROC_UNLOCK(td->td_proc);
___
svn-src-all@freebsd.org mailing list

svn commit: r340995 - in head/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-26 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Nov 26 20:52:53 2018
New Revision: 340995
URL: https://svnweb.freebsd.org/changeset/base/340995

Log:
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  MFC after:2 days
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm64/arm64/machdep.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Mon Nov 26 20:50:55 2018(r340994)
+++ head/sys/arm/arm/machdep.c  Mon Nov 26 20:52:53 2018(r340995)
@@ -641,6 +641,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Mon Nov 26 20:50:55 2018
(r340994)
+++ head/sys/arm64/arm64/machdep.c  Mon Nov 26 20:52:53 2018
(r340995)
@@ -656,6 +656,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Mon Nov 26 20:50:55 2018
(r340994)
+++ head/sys/riscv/riscv/machdep.c  Mon Nov 26 20:52:53 2018
(r340995)
@@ -582,6 +582,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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"


  1   2   3   4   >