Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311

2020-05-08 Thread Mark Millard via svn-src-head
[I caused nfsd to having things shifted in mmeory some to
see it it tracked content vs. page boundary for where the
zeros stop. Non-nfsd examples omitted.]

> . . .
>> nfsd hit an assert, failing ret == sz_size2index_compute(size)
> 
> [Correction: That should have referenced sz_index2size_lookup(index).]
> 
>> (also, but a different caller of sz_size2index):
> 
> [Correction: The "also" comment should be ignored:
> sz_index2size_lookup(index) is referenced below.]
> 
>> 
>> (gdb) bt
>> #0  thr_kill () at thr_kill.S:4
>> #1  0x502b2170 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
>> #2  0x50211cc0 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
>> #3  0x50206104 in sz_index2size_lookup (index=) at 
>> /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:200
>> #4  sz_index2size (index=) at 
>> /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:207
>> #5  ifree (tsd=0x50094018, ptr=0x50041028, tcache=0x50094138, 
>> slow_path=) at jemalloc_jemalloc.c:2583
>> #6  0x50205cac in __je_free_default (ptr=0x50041028) at 
>> jemalloc_jemalloc.c:2784
>> #7  0x50206294 in __free (ptr=0x50041028) at jemalloc_jemalloc.c:2852
>> #8  0x50287ec8 in ns_src_free (src=0x50329004, srclistsize=) 
>> at /usr/src/lib/libc/net/nsdispatch.c:452
>> #9  ns_dbt_free (dbt=0x50329000) at /usr/src/lib/libc/net/nsdispatch.c:436
>> #10 vector_free (vec=0x50329000, count=, esize=12, 
>> free_elem=) at /usr/src/lib/libc/net/nsdispatch.c:253
>> #11 nss_atexit () at /usr/src/lib/libc/net/nsdispatch.c:578
>> #12 0x5028d958 in __cxa_finalize (dso=0x0) at 
>> /usr/src/lib/libc/stdlib/atexit.c:240
>> #13 0x502117f8 in exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:74
>> #14 0x10013f9c in child_cleanup (signo=) at 
>> /usr/src/usr.sbin/nfsd/nfsd.c:969
>> #15 
>> #16 0x in ?? ()
>> 
>> (gdb) up 3
>> #3  0x50206104 in sz_index2size_lookup (index=) at 
>> /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:200
>> 200  assert(ret == sz_index2size_compute(index));
>> 
>> (ret is optimized out.)
>> 
>> 197  JEMALLOC_ALWAYS_INLINE size_t
>> 198  sz_index2size_lookup(szind_t index) {
>> 199  size_t ret = (size_t)sz_index2size_tab[index];
>> 200  assert(ret == sz_index2size_compute(index));
>> 201  return ret;
>> 202  }
> 
> (gdb) print/x __je_sz_index2size_tab
> $3 = {0x0 }
> 
> Also:
> 
> (gdb) x/4x __je_arenas+16368/4
> 0x5030cab0 <__je_arenas+16368>:   0x  0x  
> 0x  0x
> (gdb) print/x __je_arenas_lock
>  
> $8 = {{{prof_data = {tot_wait_time = {ns = 0x0}, max_wait_time = {ns = 0x0}, 
> n_wait_times = 0x0, n_spin_acquired = 0x0, max_n_thds = 0x0, n_waiting_thds = 
> {repr = 0x0}, n_owner_switches = 0x0, 
>   prev_owner = 0x0, n_lock_ops = 0x0}, lock = 0x0, postponed_next = 0x0, 
> locked = {repr = 0x0}}}, witness = {name = 0x0, rank = 0x0, comp = 0x0, 
> opaque = 0x0, link = {qre_next = 0x0, 
> qre_prev = 0x0}}, lock_order = 0x0}
> (gdb) print/x __je_narenas_auto
> $9 = 0x0
> (gdb) print/x malloc_conf  
> $10 = 0x0
> (gdb) print/x __je_ncpus 
> $11 = 0x0
> (gdb) print/x __je_manual_arena_base
> $12 = 0x0
> (gdb) print/x __je_sz_pind2sz_tab   
> $13 = {0x0 }
> (gdb) print/x __je_sz_size2index_tab
> $1 = {0x0 , 0x1a, 0x1b , 0x1c  64 times>}
> 
>> Booting and immediately trying something like:
>> 
>> service nfsd stop
>> 
>> did not lead to a failure. But may be after
>> a while it would and be less drastic than a
>> reboot or power down.
> 
> More detail:
> 
> So, for rpcbind and nfds at some point a large part of
> __je_sz_size2index_tab is being stomped on, as is all of
> __je_sz_index2size_tab and more.
> 
> . . .
> 
> For nfsd, it is similar (again showing the partially
> non-zero live process context instead of the all-zeros
> from the .core file):
> 
> 0x5030cab0 <__je_arenas+16368>:   0x  0x  
> 0x  0x0009
> 0x5030cac0 <__je_arenas_lock>:0x  0x  
> 0x  0x
> 0x5030cad0 <__je_arenas_lock+16>: 0x  0x  
> 0x  0x
> 0x5030cae0 <__je_arenas_lock+32>: 0x  0x  
> 0x  0x
> 0x5030caf0 <__je_arenas_lock+48>: 0x  0x  
> 0x  0x
> 0x5030cb00 <__je_arenas_lock+64>: 0x  0x502ff070  
> 0x  0x
> 0x5030cb10 <__je_arenas_lock+80>: 0x500ebb04  0x0003  
> 0x  0x
> 0x5030cb20 <__je_arenas_lock+96>: 0x5030cb10  0x5030cb10  
> 0x  0x
> 
> Then the memory in the crash continues to be zero until:
> 
> 0x5030d000 <__je_sz_size2index_tab+384>:  0x1a1b1b1b  0x1b1b1b1b  
> 0x1b1b1b1b  0x1b1b1b1b
> 
> Notice the interesting page boundary for where non-zero
> is first available again!

svn commit: r360833 - head

2020-05-08 Thread Kyle Evans
Author: kevans
Date: Sat May  9 02:01:29 2020
New Revision: 360833
URL: https://svnweb.freebsd.org/changeset/base/360833

Log:
  installworld: attempt a certctl rehash at the tail end
  
  This can be run as root or normal user with no problem; if they hadn't
  twisted the WITHOUT_CAROOT knob, we'll attempt to use the host certctl to
  rehash the DESTDIR. This would allow one to build systems WITHOUT_OPENSSL +
  WITH_CAROOT with a populated /etc/ssl that they can then use with an
  appropriate *ssl from somewhere else.
  
  Cross-builds are fine because this will always use the host certctl, or just
  nag if it's missing and it wasn't a WITHOUT_CAROOT build.
  
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24641

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May  9 01:48:08 2020(r360832)
+++ head/Makefile.inc1  Sat May  9 02:01:29 2020(r360833)
@@ -1403,6 +1403,16 @@ distributeworld installworld stageworld: _installcheck
${DESTDIR}/${DISTDIR}/${dist}.debug.meta
 .endfor
 .endif
+.elif make(installworld) && ${MK_CAROOT} != "no"
+   # We could make certctl a bootstrap tool, but it requires OpenSSL and
+   # friends, which we likely don't want.  We'll rehash on a best-effort
+   # basis, otherwise we'll just mention that we're not doing it to raise
+   # awareness.
+   @if which certctl>/dev/null; then \
+   certctl rehash \
+   else \
+   echo "No certctl on the host, not rehashing target -- /etc/ssl 
may not be populated."; \
+   fi
 .endif
 
 packageworld: .PHONY
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360829 - head/tests/sys/fs/fusefs

2020-05-08 Thread Alan Somers
Author: asomers
Date: Fri May  8 23:00:02 2020
New Revision: 360829
URL: https://svnweb.freebsd.org/changeset/base/360829

Log:
  fusefs: fix two small bugs in the tests' expectations
  
  These two errors have been present since the tests' introduction.
  Coincidentally every test (I think there's only one) that cares about that
  field also works when the field's value is 0.
  
  MFC after:2 weeks

Modified:
  head/tests/sys/fs/fusefs/default_permissions.cc
  head/tests/sys/fs/fusefs/default_permissions_privileged.cc

Modified: head/tests/sys/fs/fusefs/default_permissions.cc
==
--- head/tests/sys/fs/fusefs/default_permissions.cc Fri May  8 22:26:52 
2020(r360828)
+++ head/tests/sys/fs/fusefs/default_permissions.cc Fri May  8 23:00:02 
2020(r360829)
@@ -125,7 +125,7 @@ void expect_getattr(uint64_t ino, mode_t mode, uint64_
out.body.attr.attr.mode = mode;
out.body.attr.attr.size = 0;
out.body.attr.attr.uid = uid;
-   out.body.attr.attr.uid = gid;
+   out.body.attr.attr.gid = gid;
out.body.attr.attr_valid = attr_valid;
})));
 }

Modified: head/tests/sys/fs/fusefs/default_permissions_privileged.cc
==
--- head/tests/sys/fs/fusefs/default_permissions_privileged.cc  Fri May  8 
22:26:52 2020(r360828)
+++ head/tests/sys/fs/fusefs/default_permissions_privileged.cc  Fri May  8 
23:00:02 2020(r360829)
@@ -85,7 +85,7 @@ void expect_getattr(uint64_t ino, mode_t mode, uint64_
out.body.attr.attr.mode = mode;
out.body.attr.attr.size = 0;
out.body.attr.attr.uid = uid;
-   out.body.attr.attr.uid = gid;
+   out.body.attr.attr.gid = gid;
out.body.attr.attr_valid = attr_valid;
})));
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360828 - head/sys/fs/fuse

2020-05-08 Thread Alan Somers
Author: asomers
Date: Fri May  8 22:26:52 2020
New Revision: 360828
URL: https://svnweb.freebsd.org/changeset/base/360828

Log:
  fusefs: better dtrace probes for asynchronous invalidation operations
  
  MFC after:2 weeks

Modified:
  head/sys/fs/fuse/fuse_internal.c

Modified: head/sys/fs/fuse/fuse_internal.c
==
--- head/sys/fs/fuse/fuse_internal.cFri May  8 22:22:12 2020
(r360827)
+++ head/sys/fs/fuse/fuse_internal.cFri May  8 22:26:52 2020
(r360828)
@@ -377,8 +377,8 @@ fuse_internal_fsync(struct vnode *vp,
 }
 
 /* Asynchronous invalidation */
-SDT_PROBE_DEFINE2(fusefs, , internal, invalidate_cache_hit,
-   "struct vnode*", "struct vnode*");
+SDT_PROBE_DEFINE3(fusefs, , internal, invalidate_entry,
+   "struct vnode*", "struct fuse_notify_inval_entry_out*", "char*");
 int
 fuse_internal_invalidate_entry(struct mount *mp, struct uio *uio)
 {
@@ -407,6 +407,7 @@ fuse_internal_invalidate_entry(struct mount *mp, struc
else
err = fuse_internal_get_cached_vnode( mp, fnieo.parent,
LK_SHARED, );
+   SDT_PROBE3(fusefs, , internal, invalidate_entry, dvp, , name);
/* 
 * If dvp is not in the cache, then it must've been reclaimed.  And
 * since fuse_vnop_reclaim does a cache_purge, name's entry must've
@@ -435,6 +436,8 @@ fuse_internal_invalidate_entry(struct mount *mp, struc
return (0);
 }
 
+SDT_PROBE_DEFINE2(fusefs, , internal, invalidate_inode,
+   "struct vnode*", "struct fuse_notify_inval_inode_out *");
 int
 fuse_internal_invalidate_inode(struct mount *mp, struct uio *uio)
 {
@@ -450,6 +453,7 @@ fuse_internal_invalidate_inode(struct mount *mp, struc
else
err = fuse_internal_get_cached_vnode(mp, fniio.ino, LK_SHARED,
);
+   SDT_PROBE2(fusefs, , internal, invalidate_inode, vp, );
if (err != 0 || vp == NULL)
return (err);
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360826 - head/sys/sys

2020-05-08 Thread Mitchell Horne
Author: mhorne
Date: Fri May  8 22:21:56 2020
New Revision: 360826
URL: https://svnweb.freebsd.org/changeset/base/360826

Log:
  Sync relocation definitions
  
  Add the most recent relocation types from the RISC-V ELF psABI spec.
  
  MFC after:3 days

Modified:
  head/sys/sys/elf_common.h

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Fri May  8 22:14:39 2020(r360825)
+++ head/sys/sys/elf_common.h   Fri May  8 22:21:56 2020(r360826)
@@ -1342,6 +1342,8 @@ typedef struct {
 #defineR_RISCV_SET854
 #defineR_RISCV_SET16   55
 #defineR_RISCV_SET32   56
+#defineR_RISCV_32_PCREL57
+#defineR_RISCV_IRELATIVE   58
 
 #defineR_SPARC_NONE0
 #defineR_SPARC_8   1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360827 - head/sys/dev/etherswitch

2020-05-08 Thread Adrian Chadd
Author: adrian
Date: Fri May  8 22:22:12 2020
New Revision: 360827
URL: https://svnweb.freebsd.org/changeset/base/360827

Log:
  [etherswitch] bump register width to 32 bits.
  
  Some ethernet switches have very large register windows; for example
  the AR8316 switch MIB starts at 0x2.
  
  Submitted by: Mori Hiroki 

Modified:
  head/sys/dev/etherswitch/etherswitch.h

Modified: head/sys/dev/etherswitch/etherswitch.h
==
--- head/sys/dev/etherswitch/etherswitch.h  Fri May  8 22:21:56 2020
(r360826)
+++ head/sys/dev/etherswitch/etherswitch.h  Fri May  8 22:22:12 2020
(r360827)
@@ -14,7 +14,7 @@ extern driver_t etherswitch_driver;
 #endif /* _KERNEL */
 
 struct etherswitch_reg {
-   uint16_treg;
+   uint32_treg;
uint32_tval;
 };
 typedef struct etherswitch_reg etherswitch_reg_t;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360824 - in head/sys/net: . route

2020-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri May  8 21:06:10 2020
New Revision: 360824
URL: https://svnweb.freebsd.org/changeset/base/360824

Log:
  Embed dst sockaddr into rtentry and remove rte packet counter
  
  Currently each rtentry has dst allocated separately from another zone,
   bloating cache accesses.
  
  Current 'struct rtentry' has 12 "mandatory" radix pointers in the beginning,
   leaving 4 usable pointers/32 bytes in the first 2 cache lines (amd64).
  Fields needed for the datapath are destination sockaddr and rt_nhop.
  
  So far it doesn't look like there is other routable addressing protocol other
   than IPv4/IPv6/MPLS, which uses keys longer than 20 bytes.
  With that in mind, embed dst into struct rtentry, making the first 24 bytes
   of rtentry within 128 bytes. That is enough to make IPv6 address within first
   128 bytes.
  
  It is still pretty easy to add code for supporting separately-allocated dst,
   however it doesn't make a lot of sense in having such code without a use 
case.
  
  As rS359823 moved the gateway to the nexthop structure, the dst embedding 
change
   removes the need for any additional allocations done by rt_setgate().
  
  Lastly, as a part of cleanup, remove counter(9) allocation code, as this field
   is not used in packet processing anymore.
  
  Reviewed by:  ae
  Differential Revision:https://reviews.freebsd.org/D24669

Modified:
  head/sys/net/route.c
  head/sys/net/route.h
  head/sys/net/route/route_ddb.c
  head/sys/net/route/route_var.h
  head/sys/net/rtsock.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cFri May  8 20:15:18 2020(r360823)
+++ head/sys/net/route.cFri May  8 21:06:10 2020(r360824)
@@ -241,10 +241,6 @@ rtentry_zinit(void *mem, int size, int how)
 {
struct rtentry *rt = mem;
 
-   rt->rt_pksent = counter_u64_alloc(how);
-   if (rt->rt_pksent == NULL)
-   return (ENOMEM);
-
RT_LOCK_INIT(rt);
 
return (0);
@@ -256,7 +252,6 @@ rtentry_zfini(void *mem, int size)
struct rtentry *rt = mem;
 
RT_LOCK_DESTROY(rt);
-   counter_u64_free(rt->rt_pksent);
 }
 
 static int
@@ -265,7 +260,6 @@ rtentry_ctor(void *mem, int size, void *arg, int how)
struct rtentry *rt = mem;
 
bzero(rt, offsetof(struct rtentry, rt_endzero));
-   counter_u64_zero(rt->rt_pksent);
rt->rt_chain = NULL;
 
return (0);
@@ -551,12 +545,6 @@ rtfree(struct rtentry *rt)
goto done;
}
 #endif
-   /*
-* The key is separatly alloc'd so free it (see rt_setgate()).
-* This also frees the gateway, as they are always malloc'd
-* together.
-*/
-   R_Free(rt_key(rt));
 
/* Unreference nexthop */
nhop_free(rt->rt_nhop);
@@ -1557,6 +1545,9 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
(gateway->sa_family != AF_UNSPEC) && (gateway->sa_family != 
AF_LINK))
return (EINVAL);
 
+   if (dst->sa_len > sizeof(((struct rtentry *)NULL)->rt_dstb))
+   return (EINVAL);
+
if (info->rti_ifa == NULL) {
error = rt_getifa_fib(info, rnh->rib_fibnum);
if (error)
@@ -1582,16 +1573,11 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
rt->rt_flags = RTF_UP | flags;
rt->rt_fibnum = rnh->rib_fibnum;
rt->rt_nhop = nh;
-   /*
-* Add the gateway. Possibly re-malloc-ing the storage for it.
-*/
-   if ((error = rt_setgate(rt, dst, gateway)) != 0) {
-   ifa_free(info->rti_ifa);
-   nhop_free(nh);
-   uma_zfree(V_rtzone, rt);
-   return (error);
-   }
 
+   /* Fill in dst */
+   memcpy(>rt_dst, dst, dst->sa_len);
+   rt_key(rt) = >rt_dst;
+
/*
 * point to the (possibly newly malloc'd) dest address.
 */
@@ -1623,7 +1609,6 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
rt_mpath_conflict(rnh, rt, netmask)) {
RIB_WUNLOCK(rnh);
 
-   R_Free(rt_key(rt));
nhop_free(nh);
uma_zfree(V_rtzone, rt);
return (EEXIST);
@@ -1663,7 +1648,6 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
 * then un-make it (this should be a function)
 */
if (rn == NULL) {
-   R_Free(rt_key(rt));
nhop_free(nh);
uma_zfree(V_rtzone, rt);
return (EEXIST);
@@ -1897,40 +1881,6 @@ rt_setmetrics(const struct rt_addrinfo *info, struct r
if (info->rti_mflags & RTV_EXPIRE)
rt->rt_expire = info->rti_rmx->rmx_expire ?
info->rti_rmx->rmx_expire - time_second + time_uptime : 0;
-}
-
-int
-rt_setgate(struct rtentry *rt, struct sockaddr 

svn commit: r360823 - head

2020-05-08 Thread Antoine Brodin
Author: antoine
Date: Fri May  8 20:15:18 2020
New Revision: 360823
URL: https://svnweb.freebsd.org/changeset/base/360823

Log:
  Add more obsolete files

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri May  8 18:53:06 2020(r360822)
+++ head/ObsoleteFiles.inc  Fri May  8 20:15:18 2020(r360823)
@@ -40,6 +40,9 @@
 OLD_FILES+=usr/bin/objdump
 OLD_FILES+=usr/share/man/man1/objdump.1.gz
 
+# 20200428: route_var.h moved to net/route
+OLD_FILES+=usr/include/net/route_var.h
+
 # 20200418: Make libauditd private
 OLD_FILES+=usr/lib/libauditd.a
 OLD_FILES+=usr/lib/libauditd.so
@@ -49,6 +52,9 @@ OLD_FILES+=usr/lib/libauditd_p.a
 # 20200418: Remove bogus man links
 OLD_FILES+=usr/share/man/man3/getauusernam_R.3.gz
 OLD_FILES+=usr/share/man/man3/getauclassnam_3.3.gz
+
+# 20200414: NFS file handle affinity code for the NFS server re-organized
+OLD_FILES+=usr/include/nfs/nfs_fha.h
 
 # 20200401: Remove procfs-based process debugging
 OLD_FILES+=usr/include/sys/pioctl.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360820 - head/usr.sbin/bhyve

2020-05-08 Thread Aleksandr Fedorov
Author: afedorov
Date: Fri May  8 17:15:54 2020
New Revision: 360820
URL: https://svnweb.freebsd.org/changeset/base/360820

Log:
  bhyve: Pass the full string of options to the network backends.
  
  Reviewed by:  vmaffione
  Approved by:  vmaffione (mentor)
  Sponsored by: vstack.com
  Differential Revision:https://reviews.freebsd.org/D24735

Modified:
  head/usr.sbin/bhyve/net_backends.c
  head/usr.sbin/bhyve/net_backends.h
  head/usr.sbin/bhyve/pci_e82545.c
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/net_backends.c
==
--- head/usr.sbin/bhyve/net_backends.c  Fri May  8 17:01:33 2020
(r360819)
+++ head/usr.sbin/bhyve/net_backends.c  Fri May  8 17:15:54 2020
(r360820)
@@ -91,7 +91,7 @@ struct net_backend {
 * and should not be called by the frontend.
 */
int (*init)(struct net_backend *be, const char *devname,
-   net_be_rxeof_t cb, void *param);
+   const char *opts, net_be_rxeof_t cb, void *param);
void (*cleanup)(struct net_backend *be);
 
/*
@@ -199,7 +199,7 @@ tap_cleanup(struct net_backend *be)
 
 static int
 tap_init(struct net_backend *be, const char *devname,
-net_be_rxeof_t cb, void *param)
+const char *opts, net_be_rxeof_t cb, void *param)
 {
struct tap_priv *priv = (struct tap_priv *)be->opaque;
char tbuf[80];
@@ -473,7 +473,7 @@ netmap_set_cap(struct net_backend *be, uint64_t featur
 
 static int
 netmap_init(struct net_backend *be, const char *devname,
-   net_be_rxeof_t cb, void *param)
+   const char *opts, net_be_rxeof_t cb, void *param)
 {
struct netmap_priv *priv = (struct netmap_priv *)be->opaque;
 
@@ -746,12 +746,22 @@ DATA_SET(net_backend_set, vale_backend);
  * the argument for the callback.
  */
 int
-netbe_init(struct net_backend **ret, const char *devname, net_be_rxeof_t cb,
+netbe_init(struct net_backend **ret, const char *opts, net_be_rxeof_t cb,
 void *param)
 {
struct net_backend **pbe, *nbe, *tbe = NULL;
+   char *devname;
+   char *options;
int err;
 
+   devname = options = strdup(opts);
+
+   if (devname == NULL) {
+   return (-1);
+   }
+
+   devname = strsep(, ",");
+
/*
 * Find the network backend that matches the user-provided
 * device name. net_backend_set is built using a linker set.
@@ -771,8 +781,11 @@ netbe_init(struct net_backend **ret, const char *devna
}
 
*ret = NULL;
-   if (tbe == NULL)
+   if (tbe == NULL) {
+   free(devname);
return (EINVAL);
+   }
+
nbe = calloc(1, sizeof(*nbe) + tbe->priv_size);
*nbe = *tbe;/* copy the template */
nbe->fd = -1;
@@ -781,13 +794,15 @@ netbe_init(struct net_backend **ret, const char *devna
nbe->fe_vnet_hdr_len = 0;
 
/* Initialize the backend. */
-   err = nbe->init(nbe, devname, cb, param);
+   err = nbe->init(nbe, devname, options, cb, param);
if (err) {
+   free(devname);
free(nbe);
return (err);
}
 
*ret = nbe;
+   free(devname);
 
return (0);
 }

Modified: head/usr.sbin/bhyve/net_backends.h
==
--- head/usr.sbin/bhyve/net_backends.h  Fri May  8 17:01:33 2020
(r360819)
+++ head/usr.sbin/bhyve/net_backends.h  Fri May  8 17:15:54 2020
(r360820)
@@ -37,7 +37,7 @@ typedef struct net_backend net_backend_t;
 
 /* Interface between network frontends and the network backends. */
 typedef void (*net_be_rxeof_t)(int, enum ev_type, void *param);
-intnetbe_init(net_backend_t **be, const char *devname, net_be_rxeof_t cb,
+intnetbe_init(net_backend_t **be, const char *opts, net_be_rxeof_t cb,
 void *param);
 void   netbe_cleanup(net_backend_t *be);
 uint64_t netbe_get_cap(net_backend_t *be);

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cFri May  8 17:01:33 2020
(r360819)
+++ head/usr.sbin/bhyve/pci_e82545.cFri May  8 17:15:54 2020
(r360820)
@@ -2281,7 +2281,7 @@ e82545_init(struct vmctx *ctx, struct pci_devinst *pi,
 {
char nstr[80];
struct e82545_softc *sc;
-   char *devname;
+   char *optscopy;
char *vtopts;
int mac_provided;
 
@@ -2332,7 +2332,7 @@ e82545_init(struct vmctx *ctx, struct pci_devinst *pi,
if (opts != NULL) {
int err = 0;
 
-   devname = vtopts = strdup(opts);
+   optscopy = vtopts = strdup(opts);
(void) strsep(, ",");
 
/*
@@ -2357,15 +2357,18 @@ e82545_init(struct vmctx *ctx, struct pci_devinst *pi,
}
}
 
+   

svn commit: r360819 - head/sys/net80211

2020-05-08 Thread Adrian Chadd
Author: adrian
Date: Fri May  8 17:01:33 2020
New Revision: 360819
URL: https://svnweb.freebsd.org/changeset/base/360819

Log:
  [net80211] Use the unicast key when transmitting DWDS AP multicast frames.
  
  I'm still not sure whether this is the full solution, but here goes.
  
  I have a two node DWDS setup - a main AP with the ethernet bridge uplink
  and a satellite AP in the back of the house. They're both AR9344+AR9580
  dual band 11n APs.
  
  The problem was that multicast frames was not going from the DWDS AP to
  the DWDS STA. Unicast frames are fine, and multicast frames from the
  DWDS STA to AP are fine.
  
  Now, multicast and unicast frames from the STA -> AP are just transmitted
  using the unicast key.  That's fine.  However, the AP -> STA multicast
  frames by default are transmitted using the current default / multicast
  key, the shared one between all STAs in a BSS.  Now, the DWDS implementation
  ignores non WDS frames - it only allows about 4 address frames outside
  of management / EAPOL frames! - so the STA side ignores the normal multicast
  frames.
  
  Instead, the AP side uses ieee80211_dwds_mcast() to send multicast frames
  to each WDS VAP that was created as part of the "dynamic" part of DWDS.
  This should be queuing them individually to each node instead of using
  the normal multicast send path; and this is how they should get turned into
  4-addr WDS frames.
  
  HOWEVER, ieee80211_encap() was trying to use the default TX key to queue
  them rather than the unicast key that's already setup.  Since this synthetic
  node doesn't have the default TX key setup, transmission fails.  Things
  would be fine in WEP and in open mode because in both cases you would
  have static keys (or no keys) setup.  It just fails in WPA mode.
  
  This resolves the issue.  AP DWDS multicast is now sent using the unicast
  key just like in STA mode and I'm pretty sure the STA mode side will stil
  work fine (as it's a STA VAP with a DWDS flag..)
  
  Tested:
  
  * TL-WDR3600/4300 APs

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cFri May  8 16:41:23 2020
(r360818)
+++ head/sys/net80211/ieee80211_output.cFri May  8 17:01:33 2020
(r360819)
@@ -1471,10 +1471,27 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee8
if (vap->iv_opmode == IEEE80211_M_STA ||
!IEEE80211_IS_MULTICAST(eh.ether_dhost) ||
(vap->iv_opmode == IEEE80211_M_WDS &&
-(vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY)))
+(vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY))) {
key = ieee80211_crypto_getucastkey(vap, ni);
-   else
+   } else if ((vap->iv_opmode == IEEE80211_M_WDS) &&
+   (! (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY))) {
+   /*
+* Use ucastkey for DWDS transmit nodes, multicast
+* or otherwise.
+*
+* This is required to ensure that multicast frames
+* from a DWDS AP to a DWDS STA is encrypted with
+* a key that can actually work.
+*
+* There's no default key for multicast traffic
+* on a DWDS WDS VAP node (note NOT the DWDS enabled
+* AP VAP, the dynamically created per-STA WDS node)
+* so encap fails and transmit fails.
+*/
+   key = ieee80211_crypto_getucastkey(vap, ni);
+   } else {
key = ieee80211_crypto_getmcastkey(vap, ni);
+   }
if (key == NULL && (m->m_flags & M_EAPOL) == 0) {
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO,
eh.ether_dhost,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360818 - head/sys/cam/scsi

2020-05-08 Thread John Baldwin
Author: jhb
Date: Fri May  8 16:41:23 2020
New Revision: 360818
URL: https://svnweb.freebsd.org/changeset/base/360818

Log:
  Fix a memory leak for ENCIOC_GETSTRING I introduced in r360171.
  
  MFC after:1 week
  Sponsored by: DARPA

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cFri May  8 15:05:05 2020
(r360817)
+++ head/sys/cam/scsi/scsi_enc_ses.cFri May  8 16:41:23 2020
(r360818)
@@ -2958,7 +2958,7 @@ ses_handle_string(enc_softc_t *enc, encioc_string_t *s
ret = enc_runcmd(enc, cdb, 6, buf, );
if (ret == 0 && ioc == ENCIOC_GETSTRING)
ret = copyout(buf, sstr->buf, sstr->bufsiz);
-   if (ioc == ENCIOC_SETSTRING)
+   if (ioc == ENCIOC_SETSTRING || ioc == ENCIOC_GETSTRING)
ENC_FREE(buf);
return (ret);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311

2020-05-08 Thread Mark Millard via svn-src-head
[More details for a sshd failure. The other
examples are omitted. The sshd failure also shows
a all-zeros-up-to-a-page-boundary issue, just for
a different address range.]

On 2020-May-7, at 12:06, Mark Millard  wrote:
> 
> [mountd failure example: also at sz_size2index_lookup assert
> for the same zero'd memory problem.]
> 
>> On 2020-May-7, at 00:46, Mark Millard  wrote:
>> 
>> [__je_sz_size2index_tab seems messed up in 2 of the
>> asserting contexts: first 384 are zero in both. More
>> before that is also messed up (all zero). I show the
>> details later below.]
>> 
>> On 2020-May-6, at 16:57, Mark Millard  wrote:
>> 
>>> [This explores process crashes that happen during system
>>> shutdown, in a context not having MALLOC_PRODUCTION= .
>>> So assert failures are reported as the stopping points.]
>>> 
>>> It looks like shutdown -p now, shutdown -r now, and the
>>> like can lead some processes to assert during their exit
>>> attempt, including a sshd failure (that I've not seen
>>> before), rpcbind, and nfsd. I show information about the
>>> observed asserts for those below.
>>> 
>>> 
>>> sshd hit an assert, failing slab == extent_slab_get(extent) :
>>> 
>>> (gdb) bt 
>>> #0  thr_kill () at thr_kill.S:4
>>> #1  0x50927170 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
>>> #2  0x50886cc0 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
>>> #3  0x508834b0 in arena_dalloc (tsdn=, ptr=, 
>>> tcache=, alloc_ctx=, slow_path=>> out>)
>>>  at 
>>> /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:315
>>> #4  idalloctm (tsdn=0x500dd040, ptr=0x5008a180, tcache=0x500dd160, 
>>> alloc_ctx=, is_internal=, 
>>> slow_path=)
>>>  at 
>>> /usr/src/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:118
>>> #5  0x5087b0a4 in ifree (tsd=0x500dd040, ptr=0x5008a180, tcache=0x500dd160, 
>>> slow_path=) at jemalloc_jemalloc.c:2590
>>> #6  0x5087acac in __je_free_default (ptr=0x5008a180) at 
>>> jemalloc_jemalloc.c:2784
>>> #7  0x5087b294 in __free (ptr=0x5008a180) at jemalloc_jemalloc.c:2852
>>> #8  0x10029464 in server_accept_loop (config_s=, 
>>> sock_in=, sock_out=, newsock=) 
>>> at /usr/src/crypto/openssh/sshd.c:1185
>>> #9  main (ac=, av=0xde3c) at 
>>> /usr/src/crypto/openssh/sshd.c:2009
>>> 
>>> . . .
>>> (gdb) up
>>> #2  0x50886cc0 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
>>> 67  (void)raise(SIGABRT);
>>> (gdb) up
>>> #3  0x508834b0 in arena_dalloc (tsdn=, ptr=, 
>>> tcache=, alloc_ctx=, slow_path=>> out>)
>>>  at 
>>> /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:315
>>> 315 assert(slab == extent_slab_get(extent));
>>> 
>>> (gdb) list
>>> 310 rtree_ctx = tsd_rtree_ctx(tsdn_tsd(tsdn));
>>> 311 extent_t *extent = rtree_extent_read(tsdn, 
>>> _rtree,
>>> 312 rtree_ctx, (uintptr_t)ptr, true);
>>> 313 assert(szind == extent_szind_get(extent));
>>> 314 assert(szind < SC_NSIZES);
>>> 315 assert(slab == extent_slab_get(extent));
>>> 316 }
>>> 317 
>>> 318 if (likely(slab)) {
>>> 319 /* Small allocation. */
>>> 
>>> More fully:
>>> 
>>> 285 JEMALLOC_ALWAYS_INLINE void
>>> 286 arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
>>> 287 alloc_ctx_t *alloc_ctx, bool slow_path) {
>>> 288 assert(!tsdn_null(tsdn) || tcache == NULL);
>>> 289 assert(ptr != NULL);
>>> 290 
>>> 291 if (unlikely(tcache == NULL)) {
>>> 292 arena_dalloc_no_tcache(tsdn, ptr);
>>> 293 return;
>>> 294 }
>>> 295 
>>> 296 szind_t szind;
>>> 297 bool slab;
>>> 298 rtree_ctx_t *rtree_ctx;
>>> 299 if (alloc_ctx != NULL) {
>>> 300 szind = alloc_ctx->szind;
>>> 301 slab = alloc_ctx->slab;
>>> 302 assert(szind != SC_NSIZES);
>>> 303 } else {
>>> 304 rtree_ctx = tsd_rtree_ctx(tsdn_tsd(tsdn));
>>> 305 rtree_szind_slab_read(tsdn, _rtree, rtree_ctx,
>>> 306 (uintptr_t)ptr, true, , );
>>> 307 }
>>> 308 
>>> 309 if (config_debug) {
>>> 310 rtree_ctx = tsd_rtree_ctx(tsdn_tsd(tsdn));
>>> 311 extent_t *extent = rtree_extent_read(tsdn, 
>>> _rtree,
>>> 312 rtree_ctx, (uintptr_t)ptr, true);
>>> 313 assert(szind == extent_szind_get(extent));
>>> 314 assert(szind < SC_NSIZES);
>>> 315 assert(slab == extent_slab_get(extent));
>>> 316 }
>>> 317 
>>> 318 if (likely(slab)) {
>>> 319 /* Small allocation. */
>>> 320 tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind,
>>> 321 slow_path);
>>> 322 } else {
>>> 323 arena_dalloc_large(tsdn, ptr, tcache, szind, slow_path);
>>> 324 }
>>> 325 }
>> 
>> . . .

The machine code for:


svn commit: r360816 - head/share/man/man5

2020-05-08 Thread Ed Maste
Author: emaste
Date: Fri May  8 15:03:28 2020
New Revision: 360816
URL: https://svnweb.freebsd.org/changeset/base/360816

Log:
  src.conf.5: regen after BINUTILS changes

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Fri May  8 14:54:40 2020
(r360815)
+++ head/share/man/man5/src.conf.5  Fri May  8 15:03:28 2020
(r360816)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd May 6, 2020
+.Dd May 8, 2020
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -202,13 +202,13 @@ Do not build GNU binutils
 as part of the bootstrap process.
 .Pp
 This is a default setting on
-arm/armv6, arm/armv7, arm64/aarch64, mips/mips, mips/mips64, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf.
+arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, mips/mips64, 
powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf.
 .It Va WITH_BINUTILS_BOOTSTRAP
 Build GNU binutils
 as part of the bootstrap process.
 .Pp
 This is a default setting on
-amd64/amd64 and i386/i386.
+amd64/amd64.
 .It Va WITHOUT_BLACKLIST
 Set this if you do not want to build
 .Xr blacklistd 8
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360815 - head/share/mk

2020-05-08 Thread Ed Maste
Author: emaste
Date: Fri May  8 14:54:40 2020
New Revision: 360815
URL: https://svnweb.freebsd.org/changeset/base/360815

Log:
  src.opts.mk: update BINUTILS options and add comments
  
  BINUTILS is needed only for ports, and will be disabled once the failing
  ports are addressed (likely by growing a binutils dependency).
  
  BINUTILS_BOOTSTRAP is needed only on amd64, for skein_block_asm.s. There
  is no need to enable it on i386.
  
  This will all be removed before FreeBSD 13.0.

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Fri May  8 14:48:45 2020(r360814)
+++ head/share/mk/src.opts.mk   Fri May  8 14:54:40 2020(r360815)
@@ -290,8 +290,13 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF
 .if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
 BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB
 .endif
-.if ${__T} == "amd64" || ${__T} == "i386"
+# BINUTILS is enabled on x86 to provide as for ports - PR 205250
+# BINUTILS_BOOTSTRAP is needed on amd64 only, for skein_block_asm.s
+.if ${__T} == "amd64"
 __DEFAULT_YES_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP
+.elif ${__T} == "i386"
+__DEFAULT_YES_OPTIONS+=BINUTILS
+__DEFAULT_NO_OPTIONS+=BINUTILS_BOOTSTRAP
 .else
 __DEFAULT_NO_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r360813 - in head/sys/fs: nfs nfsclient nfsserver

2020-05-08 Thread Ryan Moeller
Author: freqlabs
Date: Fri May  8 14:39:38 2020
New Revision: 360813
URL: https://svnweb.freebsd.org/changeset/base/360813

Log:
  Remove APPLEKEXT ifndefs
  
  They are no longer useful.
  
  Reviewed by:  rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24752

Modified:
  head/sys/fs/nfs/nfs_commonacl.c
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsserver/nfs_nfsdcache.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdsocket.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c
  head/sys/fs/nfsserver/nfs_nfsdsubs.c

Modified: head/sys/fs/nfs/nfs_commonacl.c
==
--- head/sys/fs/nfs/nfs_commonacl.c Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfs/nfs_commonacl.c Fri May  8 14:39:38 2020
(r360813)
@@ -30,11 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#ifndef APPLEKEXT
 #include 
 
 extern int nfsrv_useacl;
-#endif
 
 static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
 enum vtype type, acl_perm_t *permp);

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cFri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfs/nfs_commonsubs.cFri May  8 14:39:38 2020
(r360813)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
@@ -192,7 +191,6 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = {
{ 0, 1, 0, 0, LK_SHARED, 1, 1 },/* Listxattrs */
{ 0, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Removexattr */
 };
-#endif /* !APPLEKEXT */
 
 static int ncl_mbuf_mhlen = MHLEN;
 static int nfsrv_usercnt = 0;

Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- head/sys/fs/nfsclient/nfs_clcomsubs.c   Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsclient/nfs_clcomsubs.c   Fri May  8 14:39:38 2020
(r360813)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include 
 
 extern struct nfsstatsv1 nfsstatsv1;
@@ -49,7 +48,6 @@ extern int ncl_mbuf_mlen;
 extern enum vtype newnv2tov_type[8];
 extern enum vtype nv34tov_type[8];
 NFSCLSTATEMUTEX;
-#endif /* !APPLEKEXT */
 
 static nfsuint64 nfs_nullcookie = {{ 0, 0 }};
 

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cFri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cFri May  8 14:39:38 2020
(r360813)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
  * arguments are all at the end, after the NFSPROC_T *p one.
  */
 
-#ifndef APPLEKEXT
 #include "opt_inet6.h"
 
 #include 
@@ -82,7 +81,6 @@ int nfscl_assumeposixlocks = 1;
 int nfscl_enablecallb = 0;
 short nfsv4_cbport = NFSV4_CBPORT;
 int nfstest_openallsetattr = 0;
-#endif /* !APPLEKEXT */
 
 #defineDIRHDSIZoffsetof(struct dirent, d_name)
 

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==
--- head/sys/fs/nfsclient/nfs_clstate.c Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsclient/nfs_clstate.c Fri May  8 14:39:38 2020
(r360813)
@@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
  * (Since we are done with them, they do not need to be recovered.)
  */
 
-#ifndef APPLEKEXT
 #include 
 
 /*
@@ -98,7 +97,6 @@ int nfscl_inited = 0;
 struct nfsclhead nfsclhead;/* Head of clientid list */
 int nfscl_deleghighwater = NFSCLDELEGHIGHWATER;
 int nfscl_layouthighwater = NFSCLLAYOUTHIGHWATER;
-#endif /* !APPLEKEXT */
 
 static int nfscl_delegcnt = 0;
 static int nfscl_layoutcnt = 0;

Modified: head/sys/fs/nfsserver/nfs_nfsdcache.c
==
--- head/sys/fs/nfsserver/nfs_nfsdcache.c   Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsserver/nfs_nfsdcache.c   Fri May  8 14:39:38 2020
(r360813)
@@ -158,7 +158,6 @@ __FBSDID("$FreeBSD$");
  * that case. This level should be set high enough that this almost
  * never happens.
  */
-#ifndef APPLEKEXT
 #include 
 
 extern struct nfsstatsv1 nfsstatsv1;
@@ -166,7 +165,6 @@ extern struct mtx nfsrc_udpmtx;
 extern struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE];
 

svn commit: r360812 - head/sys/amd64/amd64

2020-05-08 Thread Mark Johnston
Author: markj
Date: Fri May  8 14:38:48 2020
New Revision: 360812
URL: https://svnweb.freebsd.org/changeset/base/360812

Log:
  Reinitialize thread0's stack base after enabling XSAVE.
  
  Otherwise the initial call to set_top_of_stack(), which occurs before
  fpuinit() sets the correct value for cpu_max_ext_state_size, leaves the
  stack base at an incorrect location.  Then, when the full area is
  zeroed, we end up erroneously zeroing part of the following page.
  
  Reviewed by:  kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D24754

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

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Fri May  8 14:13:30 2020
(r360811)
+++ head/sys/amd64/amd64/machdep.c  Fri May  8 14:38:48 2020
(r360812)
@@ -1857,7 +1857,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
setidt(IDT_IO_INTS + 15, IDTVEC(spuriousint), SDT_SYSIGT, SEL_KPL, 0);
 #endif
 #else
-#error "have you forgotten the isa device?";
+#error "have you forgotten the isa device?"
 #endif
 
if (late_console)
@@ -1867,12 +1867,13 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
fpuinit();
 
/*
-* Set up thread0 pcb save area after fpuinit calculated fpu save
-* area size.  Zero out the extended state header in fpu save
-* area.
+* Reinitialize thread0's stack base now that the xsave area size is
+* known.  Set up thread0's pcb save area after fpuinit calculated fpu
+* save area size.  Zero out the extended state header in fpu save area.
 */
+   set_top_of_stack_td();
thread0.td_pcb->pcb_save = get_pcb_user_save_td();
-   bzero(get_pcb_user_save_td(), cpu_max_ext_state_size);
+   bzero(thread0.td_pcb->pcb_save, cpu_max_ext_state_size);
if (use_xsave) {
xhdr = (struct xstate_hdr *)(get_pcb_user_save_td() +
1);
@@ -1882,7 +1883,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
rsp0 = thread0.td_md.md_stack_base;
/* Ensure the stack is aligned to 16 bytes */
rsp0 &= ~0xFul;
-   __pcpu[0].pc_common_tss.tss_rsp0 = rsp0;
+   PCPU_PTR(common_tss)->tss_rsp0 = rsp0;
amd64_bsp_pcpu_init2(rsp0);
 
/* transfer to user mode */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"