svn commit: r363939 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Thu Aug  6 04:20:14 2020
New Revision: 363939
URL: https://svnweb.freebsd.org/changeset/base/363939

Log:
  cache: add more predicts for failing conditions

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Thu Aug  6 04:19:47 2020(r363938)
+++ head/sys/kern/vfs_cache.c   Thu Aug  6 04:20:14 2020(r363939)
@@ -3389,7 +3389,7 @@ cache_fplookup_final_child(struct cache_fpl *fpl, enum
if ((cnp->cn_flags & LOCKSHARED) == 0)
lkflags = LK_EXCLUSIVE;
error = vget_finish(tvp, lkflags, tvs);
-   if (error != 0) {
+   if (__predict_false(error != 0)) {
return (cache_fpl_aborted(fpl));
}
} else {
@@ -3442,7 +3442,7 @@ cache_fplookup_final_withparent(struct cache_fpl *fpl)
 
if ((cnp->cn_flags & LOCKPARENT) != 0) {
error = vget_finish(dvp, LK_EXCLUSIVE, dvs);
-   if (error != 0) {
+   if (__predict_false(error != 0)) {
vget_abort(tvp, tvs);
return (cache_fpl_aborted(fpl));
}
@@ -3460,7 +3460,7 @@ cache_fplookup_final_withparent(struct cache_fpl *fpl)
}
 
error = cache_fplookup_final_child(fpl, tvs);
-   if (error != 0) {
+   if (__predict_false(error != 0)) {
MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED);
if ((cnp->cn_flags & LOCKPARENT) != 0)
vput(dvp);
___
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: r363938 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Thu Aug  6 04:19:47 2020
New Revision: 363938
URL: https://svnweb.freebsd.org/changeset/base/363938

Log:
  cache: plug unititalized variable use
  
  CID:  1431128

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Thu Aug  6 01:49:00 2020(r363937)
+++ head/sys/kern/vfs_cache.c   Thu Aug  6 04:19:47 2020(r363938)
@@ -3456,8 +3456,7 @@ cache_fplookup_final_withparent(struct cache_fpl *fpl)
vput(dvp);
else
vrele(dvp);
-   cache_fpl_aborted(fpl);
-   return (error);
+   return (cache_fpl_aborted(fpl));
}
 
error = cache_fplookup_final_child(fpl, tvs);
___
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: r363935 - head/sys/security/mac

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Thu Aug  6 00:23:06 2020
New Revision: 363935
URL: https://svnweb.freebsd.org/changeset/base/363935

Log:
  mac: even up all entry points to the same scheme
  
  - use a macro for checking whether the site is enabled
  - expand it to 0 if mac is not compiled in to begin with

Modified:
  head/sys/security/mac/mac_framework.h

Modified: head/sys/security/mac/mac_framework.h
==
--- head/sys/security/mac/mac_framework.h   Wed Aug  5 22:09:57 2020
(r363934)
+++ head/sys/security/mac/mac_framework.h   Thu Aug  6 00:23:06 2020
(r363935)
@@ -264,11 +264,12 @@ extern bool mac_priv_check_fp_flag;
 #else
 #define mac_priv_check_fp_flag 0
 #endif
+#define mac_priv_check_enabled()   __predict_false(mac_priv_check_fp_flag)
 static inline int
 mac_priv_check(struct ucred *cred, int priv)
 {
 
-   if (__predict_false(mac_priv_check_fp_flag))
+   if (mac_priv_check_enabled())
return (mac_priv_check_impl(cred, priv));
return (0);
 }
@@ -279,11 +280,12 @@ extern bool mac_priv_grant_fp_flag;
 #else
 #define mac_priv_grant_fp_flag 0
 #endif
+#define mac_priv_grant_enabled()   __predict_false(mac_priv_grant_fp_flag)
 static inline int
 mac_priv_grant(struct ucred *cred, int priv)
 {
 
-   if (__predict_false(mac_priv_grant_fp_flag))
+   if (mac_priv_grant_enabled())
return (mac_priv_grant_impl(cred, priv));
return (EPERM);
 }
@@ -441,7 +443,11 @@ intmac_vnode_check_listextattr(struct ucred *cred, 
st
 
 intmac_vnode_check_lookup_impl(struct ucred *cred, struct vnode *dvp,
struct componentname *cnp);
+#ifdef MAC
 extern bool mac_vnode_check_lookup_fp_flag;
+#else
+#define mac_vnode_check_lookup_fp_flag 0
+#endif
 #define mac_vnode_check_lookup_enabled() 
__predict_false(mac_vnode_check_lookup_fp_flag)
 static inline int
 mac_vnode_check_lookup(struct ucred *cred, struct vnode *dvp,
@@ -456,28 +462,38 @@ mac_vnode_check_lookup(struct ucred *cred, struct vnod
 
 intmac_vnode_check_mmap_impl(struct ucred *cred, struct vnode *vp, int 
prot,
int flags);
+#ifdef MAC
 extern bool mac_vnode_check_mmap_fp_flag;
+#else
+#define mac_vnode_check_mmap_fp_flag 0
+#endif
+#define mac_vnode_check_mmap_enabled() 
__predict_false(mac_vnode_check_mmap_fp_flag)
 static inline int
 mac_vnode_check_mmap(struct ucred *cred, struct vnode *vp, int prot,
 int flags)
 {
 
mac_vnode_assert_locked(vp, "mac_vnode_check_mmap");
-   if (__predict_false(mac_vnode_check_mmap_fp_flag))
+   if (mac_vnode_check_mmap_enabled())
return (mac_vnode_check_mmap_impl(cred, vp, prot, flags));
return (0);
 }
 
 intmac_vnode_check_open_impl(struct ucred *cred, struct vnode *vp,
accmode_t accmode);
+#ifdef MAC
 extern bool mac_vnode_check_open_fp_flag;
+#else
+#define mac_vnode_check_open_fp_flag 0
+#endif
+#define mac_vnode_check_open_enabled() 
__predict_false(mac_vnode_check_open_fp_flag)
 static inline int
 mac_vnode_check_open(struct ucred *cred, struct vnode *vp,
 accmode_t accmode)
 {
 
mac_vnode_assert_locked(vp, "mac_vnode_check_open");
-   if (__predict_false(mac_vnode_check_open_fp_flag))
+   if (mac_vnode_check_open_enabled())
return (mac_vnode_check_open_impl(cred, vp, accmode));
return (0);
 }
@@ -526,42 +542,57 @@ int   mac_vnode_check_setutimes(struct ucred *cred, 
stru
 
 intmac_vnode_check_stat_impl(struct ucred *active_cred,
struct ucred *file_cred, struct vnode *vp);
+#ifdef MAC
 extern bool mac_vnode_check_stat_fp_flag;
+#else
+#define mac_vnode_check_stat_fp_flag 0
+#endif
+#define mac_vnode_check_stat_enabled() 
__predict_false(mac_vnode_check_stat_fp_flag)
 static inline int
 mac_vnode_check_stat(struct ucred *active_cred, struct ucred *file_cred,
 struct vnode *vp)
 {
 
mac_vnode_assert_locked(vp, "mac_vnode_check_stat");
-   if (__predict_false(mac_vnode_check_stat_fp_flag))
+   if (mac_vnode_check_stat_enabled())
return (mac_vnode_check_stat_impl(active_cred, file_cred, vp));
return (0);
 }
 
 intmac_vnode_check_read_impl(struct ucred *active_cred,
struct ucred *file_cred, struct vnode *vp);
+#ifdef MAC
 extern bool mac_vnode_check_read_fp_flag;
+#else
+#define mac_vnode_check_read_fp_flag 0
+#endif
+#define mac_vnode_check_read_enabled() 
__predict_false(mac_vnode_check_read_fp_flag)
 static inline int
 mac_vnode_check_read(struct ucred *active_cred, struct ucred *file_cred,
 struct vnode *vp)
 {
 
mac_vnode_assert_locked(vp, "mac_vnode_check_read");
-   if (__predict_false(mac_vnode_check_read_fp_flag))
+   if (mac_vnode_check_read_enabled())
return (mac_vnode_check_read_impl(active_cred, file_cred, vp));
return (0);
 }
 
 intmac_vnode_check_write_impl(struct ucred *active_cred,

Re: svn commit: r363862 - head/sys/cam/mmc

2020-08-05 Thread Bjoern A. Zeeb

On 4 Aug 2020, at 20:04, Emmanuel Vadot wrote:


Author: manu
Date: Tue Aug  4 20:04:00 2020
New Revision: 363862
URL: https://svnweb.freebsd.org/changeset/base/363862

Log:
  mmccam: Hold the periph during init

  We need to sleep during this routine so acquire the cam hold too.


Turns out that with this my /dev/sddaX.. device nodes are never created.
Reverting this and things work a lot better again.




  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D25946

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Aug  4 20:02:23 2020(r363861)
+++ head/sys/cam/mmc/mmc_da.c   Tue Aug  4 20:04:00 2020(r363862)
@@ -1109,7 +1109,9 @@ sdda_start_init_task(void *context, int pending) 
{

  CAM_PRIORITY_NONE);

cam_periph_lock(periph);
+   cam_periph_hold(periph, PRIBIO|PCATCH);
sdda_start_init(context, new_ccb);
+   cam_periph_unhold(periph);
cam_periph_unlock(periph);
xpt_free_ccb(new_ccb);
 }

___
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: r363933 - head/sys/riscv/include

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 22:09:40 2020
New Revision: 363933
URL: https://svnweb.freebsd.org/changeset/base/363933

Log:
  riscv: fix uintfptr_t
  
  Fixes compilation after r363932

Modified:
  head/sys/riscv/include/profile.h

Modified: head/sys/riscv/include/profile.h
==
--- head/sys/riscv/include/profile.hWed Aug  5 20:42:08 2020
(r363932)
+++ head/sys/riscv/include/profile.hWed Aug  5 22:09:40 2020
(r363933)
@@ -70,7 +70,7 @@ void  mcount(uintfptr_t frompc, uintfptr_t selfpc);
 
 #else /* !_KERNEL */
 
-typedef unsigned long long uintfptr_t;
+typedef__uintfptr_tuintfptr_t;
 
 #define_MCOUNT_DECLvoid mcount
 #defineMCOUNT
___
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: r363934 - head/sys/arm64/include

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 22:09:57 2020
New Revision: 363934
URL: https://svnweb.freebsd.org/changeset/base/363934

Log:
  arm64: fix uintfptr_t
  
  Fixes compilation after r363932

Modified:
  head/sys/arm64/include/profile.h

Modified: head/sys/arm64/include/profile.h
==
--- head/sys/arm64/include/profile.hWed Aug  5 22:09:40 2020
(r363933)
+++ head/sys/arm64/include/profile.hWed Aug  5 22:09:57 2020
(r363934)
@@ -70,7 +70,7 @@ void  mcount(uintfptr_t frompc, uintfptr_t selfpc);
 
 #else /* !_KERNEL */
 
-typedef unsigned long long uintfptr_t;
+typedef __uintfptr_tuintfptr_t;
 
 #define_MCOUNT_DECLvoid mcount
 #defineMCOUNT
___
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: r363932 - head/usr.sbin/pmcstat

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 20:42:08 2020
New Revision: 363932
URL: https://svnweb.freebsd.org/changeset/base/363932

Log:
  pmcstat: fix build on non-64 bit platforms

Modified:
  head/usr.sbin/pmcstat/pmcpl_callgraph.c

Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c
==
--- head/usr.sbin/pmcstat/pmcpl_callgraph.c Wed Aug  5 19:34:13 2020
(r363931)
+++ head/usr.sbin/pmcstat/pmcpl_callgraph.c Wed Aug  5 20:42:08 2020
(r363932)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -501,7 +502,7 @@ pmcstat_cgnode_topprint(struct pmcstat_cgnode *cg,
(void *)(cg->pcg_image->pi_vaddr + cg->pcg_func));
break;
case FLAG_SHOW_OFFSET:
-   snprintf(ns, sizeof(ns), "%s+%#0lx",
+   snprintf(ns, sizeof(ns), "%s+%#0" PRIx64,
pmcstat_string_unintern(sym->ps_name),
cg->pcg_func - sym->ps_start);
break;
___
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: r363931 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 19:34:13 2020
New Revision: 363931
URL: https://svnweb.freebsd.org/changeset/base/363931

Log:
  vfs hash: annotate the lock with __exclusive_cache_line
  
  Note the code does not scale in the current form.

Modified:
  head/sys/kern/vfs_hash.c

Modified: head/sys/kern/vfs_hash.c
==
--- head/sys/kern/vfs_hash.cWed Aug  5 19:15:59 2020(r363930)
+++ head/sys/kern/vfs_hash.cWed Aug  5 19:34:13 2020(r363931)
@@ -43,7 +43,7 @@ static MALLOC_DEFINE(M_VFS_HASH, "vfs_hash", "VFS hash
 static LIST_HEAD(vfs_hash_head, vnode) *vfs_hash_tbl;
 static LIST_HEAD(,vnode)   vfs_hash_side;
 static u_long  vfs_hash_mask;
-static struct rwlock   vfs_hash_lock;
+static struct rwlock __exclusive_cache_line vfs_hash_lock;
 
 static void
 vfs_hashinit(void *dummy __unused)
___
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: r363930 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 19:15:59 2020
New Revision: 363930
URL: https://svnweb.freebsd.org/changeset/base/363930

Log:
  pipe: reduce atime precision
  
  The routine is called on successful write and read, which on pipes happens a
  lot and for small sizes.
  
  Precision provided by default seems way bigger than necessary and it causes
  problems in vms on amd64 (it rdtscp's which vmexits). getnanotime seems to
  provide the level roughly in lines of Linux so we should be good here.
  
  Sample result from will-it-scale pipe1_processes -t 1 (ops/s):
  before: 426464
  after: 3247421
  
  Note the that atime handling for named pipes is broken with and without the
  patch. The filesystem code is never used for updating atime and never looks
  at the updated field. Consequently, while there are no provisions added to
  handle named pipes separately, the change is a nop for that case.
  
  Differential Revision: https://reviews.freebsd.org/D23964

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cWed Aug  5 19:11:31 2020(r363929)
+++ head/sys/kern/sys_pipe.cWed Aug  5 19:15:59 2020(r363930)
@@ -230,6 +230,7 @@ static int pipe_create(struct pipe *pipe, bool backing
 static int pipe_paircreate(struct thread *td, struct pipepair **p_pp);
 static __inline int pipelock(struct pipe *cpipe, int catch);
 static __inline void pipeunlock(struct pipe *cpipe);
+static void pipe_timestamp(struct timespec *tsp);
 #ifndef PIPE_NODIRECT
 static int pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio);
 static void pipe_destroy_write_buffer(struct pipe *wpipe);
@@ -279,7 +280,7 @@ pipe_zone_ctor(void *mem, int size, void *arg, int fla
 */
rpipe = >pp_rpipe;
bzero(rpipe, sizeof(*rpipe));
-   vfs_timestamp(>pipe_ctime);
+   pipe_timestamp(>pipe_ctime);
rpipe->pipe_atime = rpipe->pipe_mtime = rpipe->pipe_ctime;
 
wpipe = >pp_wpipe;
@@ -422,6 +423,20 @@ pipe_dtor(struct pipe *dpipe)
 }
 
 /*
+ * Get a timestamp.
+ *
+ * This used to be vfs_timestamp but the higher precision is unnecessary and
+ * can very negatively affect performance in virtualized environments (e.g., on
+ * vms running on amd64 when using the rdtscp instruction).
+ */
+static void
+pipe_timestamp(struct timespec *tsp)
+{
+
+   getnanotime(tsp);
+}
+
+/*
  * The pipe system call for the DTYPE_PIPE type of pipes.  If we fail, let
  * the zone pick up the pieces via pipeclose().
  */
@@ -804,7 +819,7 @@ locked_error:
 
/* XXX: should probably do this before getting any locks. */
if (error == 0)
-   vfs_timestamp(>pipe_atime);
+   pipe_timestamp(>pipe_atime);
 unlocked_error:
--rpipe->pipe_busy;
 
@@ -1290,7 +1305,7 @@ pipe_write(struct file *fp, struct uio *uio, struct uc
error = 0;
 
if (error == 0)
-   vfs_timestamp(>pipe_mtime);
+   pipe_timestamp(>pipe_mtime);
 
/*
 * We have something to offer,
___
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: r363929 - in head/sys: amd64/include dev/iommu i386/include x86/include

2020-08-05 Thread Ruslan Bukin
Author: br
Date: Wed Aug  5 19:11:31 2020
New Revision: 363929
URL: https://svnweb.freebsd.org/changeset/base/363929

Log:
  o Add machine/iommu.h and include MD iommu headers from it,
so we don't ifdef for every arch in busdma_iommu.c;
  o No need to include specialreg.h for x86, remove it.
  
  Requested by: andrew
  Reviewed by:  kib
  Sponsored by: DARPA/AFRL
  Differential Revision:https://reviews.freebsd.org/D25957

Added:
  head/sys/amd64/include/iommu.h   (contents, props changed)
  head/sys/i386/include/iommu.h   (contents, props changed)
  head/sys/x86/include/iommu.h   (contents, props changed)
Modified:
  head/sys/dev/iommu/busdma_iommu.c
  head/sys/dev/iommu/iommu_gas.c

Added: head/sys/amd64/include/iommu.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/include/iommu.h  Wed Aug  5 19:11:31 2020
(r363929)
@@ -0,0 +1,6 @@
+/*-
+ * This file is in the public domain.
+ */
+/* $FreeBSD$ */
+
+#include 

Modified: head/sys/dev/iommu/busdma_iommu.c
==
--- head/sys/dev/iommu/busdma_iommu.c   Wed Aug  5 19:05:49 2020
(r363928)
+++ head/sys/dev/iommu/busdma_iommu.c   Wed Aug  5 19:11:31 2020
(r363929)
@@ -59,17 +59,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#if defined(__amd64__) || defined(__i386__)
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
-#endif
 
 /*
  * busdma_iommu.c, the implementation of the busdma(9) interface using

Modified: head/sys/dev/iommu/iommu_gas.c
==
--- head/sys/dev/iommu/iommu_gas.c  Wed Aug  5 19:05:49 2020
(r363928)
+++ head/sys/dev/iommu/iommu_gas.c  Wed Aug  5 19:11:31 2020
(r363929)
@@ -65,9 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#if defined(__amd64__) || defined(__i386__)
-#include 
-#endif
+#include 
 #include 
 
 /*

Added: head/sys/i386/include/iommu.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/i386/include/iommu.h   Wed Aug  5 19:11:31 2020
(r363929)
@@ -0,0 +1,6 @@
+/*-
+ * This file is in the public domain.
+ */
+/* $FreeBSD$ */
+
+#include 

Added: head/sys/x86/include/iommu.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/x86/include/iommu.hWed Aug  5 19:11:31 2020
(r363929)
@@ -0,0 +1,13 @@
+/*-
+ * This file is in the public domain.
+ */
+/* $FreeBSD$ */
+
+#ifndef_MACHINE_IOMMU_H_
+#define_MACHINE_IOMMU_H_
+
+#include 
+#include 
+#include 
+
+#endif /* !_MACHINE_IOMMU_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: r363928 - in head: lib/libpmcstat usr.sbin/pmcstat

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 19:05:49 2020
New Revision: 363928
URL: https://svnweb.freebsd.org/changeset/base/363928

Log:
  pmcstat: implement showing offsets into symbols in top mode
  
  The -I option (and hotkey) is reused for this. Skipping symbol resolution is
  moved to the new -A option (and hotkey).
  
  While arguably this violates POLA I think it's a change for the better.
  ALso note the -I option was added in head.
  
  Differential Revision:https://reviews.freebsd.org/D21658

Modified:
  head/lib/libpmcstat/libpmcstat.h
  head/usr.sbin/pmcstat/pmcpl_callgraph.c
  head/usr.sbin/pmcstat/pmcstat.8
  head/usr.sbin/pmcstat/pmcstat.c
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/lib/libpmcstat/libpmcstat.h
==
--- head/lib/libpmcstat/libpmcstat.hWed Aug  5 18:22:24 2020
(r363927)
+++ head/lib/libpmcstat/libpmcstat.hWed Aug  5 19:05:49 2020
(r363928)
@@ -107,8 +107,9 @@ struct pmcstat_args {
 #defineFLAGS_HAS_CPUMASK   0x0004  /* -c */
 #defineFLAG_HAS_DURATION   0x0008  /* -l secs */
 #defineFLAG_DO_WIDE_GPROF_HC   0x0010  /* -e */
-#defineFLAG_SKIP_TOP_FN_RES0x0020  /* -I */
+#defineFLAG_SKIP_TOP_FN_RES0x0020  /* -A */
 #defineFLAG_FILTER_THREAD_ID   0x0040  /* -L */
+#defineFLAG_SHOW_OFFSET0x0080  /* -I */
 
int pa_required;/* required features */
int pa_pplugin; /* pre-processing plugin */

Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c
==
--- head/usr.sbin/pmcstat/pmcpl_callgraph.c Wed Aug  5 18:22:24 2020
(r363927)
+++ head/usr.sbin/pmcstat/pmcpl_callgraph.c Wed Aug  5 19:05:49 2020
(r363928)
@@ -152,10 +152,12 @@ pmcstat_cgnode_hash_lookup_pc(struct pmcstat_process *
 * Try determine the function at this offset.  If we can't
 * find a function round leave the `pc' value alone.
 */
-   if ((sym = pmcstat_symbol_search(image, pc)) != NULL)
-   pc = sym->ps_start;
-   else
-   pmcstat_stats.ps_samples_unknown_function++;
+   if (!(args.pa_flags & (FLAG_SKIP_TOP_FN_RES | FLAG_SHOW_OFFSET))) {
+   if ((sym = pmcstat_symbol_search(image, pc)) != NULL)
+   pc = sym->ps_start;
+   else
+   pmcstat_stats.ps_samples_unknown_function++;
+   }
 
for (hash = i = 0; i < sizeof(uintfptr_t); i++)
hash += (pc >> i) & 0xFF;
@@ -485,22 +487,35 @@ pmcstat_cgnode_topprint(struct pmcstat_cgnode *cg,
v = PMCPL_CG_COUNTP(cg);
snprintf(vs, sizeof(vs), "%.1f", v);
v_attrs = PMCSTAT_ATTRPERCENT(v);
-   sym = NULL;
 
/* Format name. */
-   if (!(args.pa_flags & FLAG_SKIP_TOP_FN_RES))
-   sym = pmcstat_symbol_search(cg->pcg_image, cg->pcg_func);
-   if (sym != NULL) {
-   snprintf(ns, sizeof(ns), "%s",
-   pmcstat_string_unintern(sym->ps_name));
-   } else
+   sym = pmcstat_symbol_search(cg->pcg_image, cg->pcg_func);
+   if (sym == NULL) {
snprintf(ns, sizeof(ns), "%p",
(void *)(cg->pcg_image->pi_vaddr + cg->pcg_func));
+   } else {
+   switch (args.pa_flags & (FLAG_SKIP_TOP_FN_RES | 
FLAG_SHOW_OFFSET)) {
+   case FLAG_SKIP_TOP_FN_RES | FLAG_SHOW_OFFSET:
+   case FLAG_SKIP_TOP_FN_RES:
+   snprintf(ns, sizeof(ns), "%p",
+   (void *)(cg->pcg_image->pi_vaddr + cg->pcg_func));
+   break;
+   case FLAG_SHOW_OFFSET:
+   snprintf(ns, sizeof(ns), "%s+%#0lx",
+   pmcstat_string_unintern(sym->ps_name),
+   cg->pcg_func - sym->ps_start);
+   break;
+   default:
+   snprintf(ns, sizeof(ns), "%s",
+   pmcstat_string_unintern(sym->ps_name));
+   break;
+   }
+   }
 
PMCSTAT_ATTRON(v_attrs);
PMCSTAT_PRINTW("%5.5s", vs);
PMCSTAT_ATTROFF(v_attrs);
-   PMCSTAT_PRINTW(" %-10.10s %-20.20s",
+   PMCSTAT_PRINTW(" %-10.10s %-30.30s",
pmcstat_string_unintern(cg->pcg_image->pi_name),
ns);
 
@@ -624,7 +639,7 @@ pmcpl_cg_topdisplay(void)
qsort(sortbuffer, nentries, sizeof(struct pmcstat_cgnode *),
pmcstat_cgnode_compare);
 
-   PMCSTAT_PRINTW("%5.5s %-10.10s %-20.20s %s\n",
+   PMCSTAT_PRINTW("%5.5s %-10.10s %-30.30s %s\n",
"%SAMP", "IMAGE", "FUNCTION", "CALLERS");
 
nentries = min(pmcstat_displayheight - 2, nentries);


Re: svn commit: r363875 - head/sys/ufs/ffs

2020-08-05 Thread Peter Holm
On Wed, Aug 05, 2020 at 11:15:53AM -0400, Mark Johnston wrote:
> On Tue, Aug 04, 2020 at 11:09:16PM +, Mateusz Guzik wrote:
> > Author: mjg
> > Date: Tue Aug  4 23:09:15 2020
> > New Revision: 363875
> > URL: https://svnweb.freebsd.org/changeset/base/363875
> > 
> > Log:
> >   ufs: only pass LK_ADAPTIVE if LK_NODDLKTREAT is set
> >   
> >   This restores the pre-adaptive spinning state for SU which livelocks
> >   otherwise. Note this is a bug in SU.
> >   
> >   Reported by:  pho
> 
> What is the bug?

https://people.freebsd.org/~pho/stress/log/mjguzik037.txt

- Peter
> ___
> svn-src-...@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-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: r363927 - head/sys/arm64/rockchip/clk

2020-08-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Aug  5 18:22:24 2020
New Revision: 363927
URL: https://svnweb.freebsd.org/changeset/base/363927

Log:
  Add clocks for ethernet controllers on RK3328
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D25918

Modified:
  head/sys/arm64/rockchip/clk/rk3328_cru.c

Modified: head/sys/arm64/rockchip/clk/rk3328_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3328_cru.cWed Aug  5 18:21:22 2020
(r363926)
+++ head/sys/arm64/rockchip/clk/rk3328_cru.cWed Aug  5 18:22:24 2020
(r363927)
@@ -49,10 +49,31 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+/* Registers */
+#defineRK3328_GRF_SOC_CON4 0x410
+#defineRK3328_GRF_MAC_CON1 0x904
+#defineRK3328_GRF_MAC_CON2 0x908
+
 /* GATES */
 
+#defineSCLK_MAC2PHY_RXTX   83
+#defineSCLK_MAC2PHY_SRC84
+#defineSCLK_MAC2PHY_REF85
+#defineSCLK_MAC2PHY_OUT86
+#defineSCLK_MAC2IO_RX  87
+#defineSCLK_MAC2IO_TX  88
+#defineSCLK_MAC2IO_REFOUT  89
+#defineSCLK_MAC2IO_REF 90
+#defineSCLK_MAC2IO_OUT 91
 #defineSCLK_USB3OTG_REF96
+#defineSCLK_MAC2IO_SRC 99
+#defineSCLK_MAC2IO 100
+#defineSCLK_MAC2PHY101
+#defineSCLK_MAC2IO_EXT 102
 #defineACLK_USB3OTG132
+#define ACLK_GMAC  146
+#define ACLK_MAC2PHY   149
+#define ACLK_MAC2IO150
 #defineACLK_PERI   153
 #definePCLK_GPIO0  200
 #definePCLK_GPIO1  201
@@ -63,6 +84,9 @@ __FBSDID("$FreeBSD$");
 #definePCLK_I2C2   207
 #definePCLK_I2C3   208
 #definePCLK_TSADC  213
+#define PCLK_GMAC  220
+#define PCLK_MAC2PHY   222
+#define PCLK_MAC2IO223
 #definePCLK_USB3PHY_OTG224
 #definePCLK_USB3PHY_PIPE   225
 #definePCLK_USB3_GRF   226
@@ -87,6 +111,14 @@ static struct rk_cru_gate rk3328_gates[] = {
CRU_GATE(0, "pclk_bus", "pclk_bus_pre", 0x220, 3)
CRU_GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0x220, 4)
 
+   /* CRU_CLKGATE_CON8 */
+   CRU_GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0x224, 7)
+   CRU_GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0x224, 
6)
+   CRU_GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0x224, 5)
+   CRU_GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0x224, 4)
+   CRU_GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0x224, 3)
+   CRU_GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0x224, 1)
+
/* CRU_CLKGATE_CON10 */
CRU_GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", 0x228, 0)
 
@@ -116,6 +148,12 @@ static struct rk_cru_gate rk3328_gates[] = {
CRU_GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0x24C, 14)
CRU_GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0x24C, 15)
 
+   /* CRU_CLKGATE_CON26 */
+   CRU_GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0x268, 0)
+   CRU_GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0x268, 1)
+   CRU_GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0x268, 2)
+   CRU_GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0x268, 3)
+
/* CRU_CLKGATE_CON28 */
CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0x270, 1)
CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0x270, 
2)
@@ -1077,6 +1115,210 @@ static struct rk_clk_composite_def ref_usb3otg_src = {
.flags = RK_CLK_COMPOSITE_HAVE_GATE,
 };
 
+static const char *mac2io_src_parents[] = { "cpll", "gpll" };
+
+static struct rk_clk_composite_def mac2io_src = {
+   .clkdef = {
+   .id = SCLK_MAC2IO_SRC,
+   .name = "clk_mac2io_src",
+   .parent_names = mac2io_src_parents,
+   .parent_cnt = nitems(mac2io_src_parents),
+   },
+   /* CRU_CLKSEL_CON27 */
+   .muxdiv_offset = 0x16c,
+
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 5,
+
+   /* CRU_CLKGATE_CON3 */
+   .gate_offset = 0x20c,
+   .gate_shift = 1,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_GATE | RK_CLK_COMPOSITE_HAVE_MUX,
+};
+
+static const char *mac2io_out_parents[] = { "cpll", "gpll" };
+
+static struct rk_clk_composite_def mac2io_out = {
+   .clkdef = {
+   .id = SCLK_MAC2IO_OUT,
+   .name = "clk_mac2io_out",
+   .parent_names = mac2io_out_parents,
+   .parent_cnt = nitems(mac2io_out_parents),
+   },
+   /* CRU_CLKSEL_CON27 */
+   .muxdiv_offset = 0x16c,
+
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 5,
+
+   /* 

svn commit: r363926 - head/sys/arm64/rockchip/clk

2020-08-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Aug  5 18:21:22 2020
New Revision: 363926
URL: https://svnweb.freebsd.org/changeset/base/363926

Log:
  Add flag for SYSCON-controlled clocks on Rockhip platform
  
  Ethernet clocks on RK3328 are controlled by SYSCON registers, so add
  RK_CLK_COMPOSITE_GRF flag to indicate that clock node should access grf
  registers instead of CRU's
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D25918

Modified:
  head/sys/arm64/rockchip/clk/rk_clk_composite.c
  head/sys/arm64/rockchip/clk/rk_clk_composite.h

Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c
==
--- head/sys/arm64/rockchip/clk/rk_clk_composite.c  Wed Aug  5 17:26:20 
2020(r363925)
+++ head/sys/arm64/rockchip/clk/rk_clk_composite.c  Wed Aug  5 18:21:22 
2020(r363926)
@@ -35,10 +35,12 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 
 #include "clkdev_if.h"
+#include "syscon_if.h"
 
 struct rk_clk_composite_sc {
uint32_tmuxdiv_offset;
@@ -54,12 +56,14 @@ struct rk_clk_composite_sc {
uint32_tgate_shift;
 
uint32_tflags;
+
+   struct syscon   *grf;
 };
 
 #defineWRITE4(_clk, off, val)  
\
-   CLKDEV_WRITE_4(clknode_get_device(_clk), off, val)
+   rk_clk_composite_write_4(_clk, off, val)
 #defineREAD4(_clk, off, val)   
\
-   CLKDEV_READ_4(clknode_get_device(_clk), off, val)
+   rk_clk_composite_read_4(_clk, off, val)
 #defineDEVICE_LOCK(_clk)   
\
CLKDEV_DEVICE_LOCK(clknode_get_device(_clk))
 #defineDEVICE_UNLOCK(_clk) 
\
@@ -74,6 +78,49 @@ struct rk_clk_composite_sc {
 #definedprintf(format, arg...)
 #endif
 
+static void
+rk_clk_composite_read_4(struct clknode *clk, bus_addr_t addr, uint32_t *val)
+{
+   struct rk_clk_composite_sc *sc;
+
+   sc = clknode_get_softc(clk);
+   if (sc->grf)
+   *val = SYSCON_READ_4(sc->grf, addr);
+   else
+   CLKDEV_READ_4(clknode_get_device(clk), addr, val);
+}
+
+static void
+rk_clk_composite_write_4(struct clknode *clk, bus_addr_t addr, uint32_t val)
+{
+   struct rk_clk_composite_sc *sc;
+
+   sc = clknode_get_softc(clk);
+   if (sc->grf)
+   SYSCON_WRITE_4(sc->grf, addr, val | (0x << 16));
+   else
+   CLKDEV_WRITE_4(clknode_get_device(clk), addr, val);
+}
+
+static struct syscon *
+rk_clk_composite_get_grf(struct clknode *clk)
+{
+   device_t dev;
+   phandle_t node;
+   struct syscon *grf;
+
+   grf = NULL;
+   dev = clknode_get_device(clk);
+   node = ofw_bus_get_node(dev);
+   if (OF_hasprop(node, "rockchip,grf") &&
+   syscon_get_by_ofw_property(dev, node,
+   "rockchip,grf", ) != 0) {
+   return (NULL);
+}
+
+   return (grf);
+}
+
 static int
 rk_clk_composite_init(struct clknode *clk, device_t dev)
 {
@@ -81,6 +128,12 @@ rk_clk_composite_init(struct clknode *clk, device_t de
uint32_t val, idx;
 
sc = clknode_get_softc(clk);
+   if ((sc->flags & RK_CLK_COMPOSITE_GRF) != 0) {
+   sc->grf = rk_clk_composite_get_grf(clk);
+   if (sc->grf == NULL)
+   panic("clock %s has GRF flag set but no syscon is 
available",
+   clknode_get_name(clk));
+   }
 
idx = 0;
if ((sc->flags & RK_CLK_COMPOSITE_HAVE_MUX) != 0) {

Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.h
==
--- head/sys/arm64/rockchip/clk/rk_clk_composite.h  Wed Aug  5 17:26:20 
2020(r363925)
+++ head/sys/arm64/rockchip/clk/rk_clk_composite.h  Wed Aug  5 18:21:22 
2020(r363926)
@@ -53,6 +53,7 @@ struct rk_clk_composite_def {
 #defineRK_CLK_COMPOSITE_HAVE_GATE  0x0002
 #defineRK_CLK_COMPOSITE_DIV_EXP0x0004  /* Register   0, 1, 2, 
2, ... */
/* Divider1, 2, 4, 8, ... */
+#defineRK_CLK_COMPOSITE_GRF0x0008 /* Use syscon registers 
instead of CRU's */
 int rk_clk_composite_register(struct clkdom *clkdom,
 struct rk_clk_composite_def *clkdef);
 
___
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: r363891 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
That's fine, then the arch does not have avoidably increased alignment.

On 8/5/20, Don Lewis  wrote:
> On  5 Aug, Mateusz Guzik wrote:
>> Author: mjg
>> Date: Wed Aug  5 09:24:38 2020
>> New Revision: 363891
>> URL: https://svnweb.freebsd.org/changeset/base/363891
>>
>> Log:
>>   cache: reduce zone alignment to 8 bytes
>>
>>   It used to be sizeof of the given struct to accomodate for 32 bit mips
>>   doing 64 bit loads, but the same can be achieved with requireing just
>>   64 bit alignment.
>>
>>   While here reorder struct namecache so that most commonly used fields
>>   are closer.
>>
>> Modified:
>>   head/sys/kern/vfs_cache.c
>>
>> Modified: head/sys/kern/vfs_cache.c
>> ==
>> --- head/sys/kern/vfs_cache.cWed Aug  5 09:24:00 2020
>> (r363890)
>> +++ head/sys/kern/vfs_cache.cWed Aug  5 09:24:38 2020
>> (r363891)
>> @@ -122,9 +122,9 @@ _Static_assert(sizeof(struct negstate) <=
>> sizeof(struc
>>  "the state must fit in a union with a pointer without growing it");
>>
>>  struct  namecache {
>> -CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
>>  LIST_ENTRY(namecache) nc_src;   /* source vnode list */
>>  TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
>> +CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
>>  struct  vnode *nc_dvp;  /* vnode of parent of name */
>>  union {
>>  struct  vnode *nu_vp;   /* vnode the name refers to */
>> @@ -142,6 +142,8 @@ struct   namecache {
>>   * to be stored.  The nc_dotdottime field is used when a cache entry is
>> mapping
>>   * both a non-dotdot directory name plus dotdot for the directory's
>>   * parent.
>> + *
>> + * See below for alignment requirement.
>>   */
>>  struct  namecache_ts {
>>  struct  timespec nc_time;   /* timespec provided by fs */
>> @@ -150,6 +152,14 @@ struct  namecache_ts {
>>  struct namecache nc_nc;
>>  };
>>
>> +/*
>> + * At least mips n32 performs 64-bit accesses to timespec as found
>> + * in namecache_ts and requires them to be aligned. Since others
>> + * may be in the same spot suffer a little bit and enforce the
>> + * alignment for everyone. Note this is a nop for 64-bit platforms.
>> + */
>> +#define CACHE_ZONE_ALIGNMENTUMA_ALIGNOF(time_t)
>
> time_t is only 32 bits on i386
>
>


-- 
Mateusz Guzik 
___
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: r363925 - head/tools/uma/smrstress

2020-08-05 Thread Mark Johnston
Author: markj
Date: Wed Aug  5 17:26:20 2020
New Revision: 363925
URL: https://svnweb.freebsd.org/changeset/base/363925

Log:
  Fix the smrstress build after r358400.
  
  Reported by:  pho

Modified:
  head/tools/uma/smrstress/smrstress.c

Modified: head/tools/uma/smrstress/smrstress.c
==
--- head/tools/uma/smrstress/smrstress.cWed Aug  5 17:14:37 2020
(r363924)
+++ head/tools/uma/smrstress/smrstress.cWed Aug  5 17:26:20 2020
(r363925)
@@ -68,7 +68,7 @@ smrs_error(struct smrs *smrs, const char *fmt, ...)
 
atomic_add_int(_failures, 1);
printf("SMR ERROR: wr_seq %d, rd_seq %d, c_seq %d, generation %d, count 
%d ",
-   smrs_smr->c_shared->s_wr_seq, smrs_smr->c_shared->s_rd_seq,
+   smrs_smr->c_shared->s_wr.seq, smrs_smr->c_shared->s_rd_seq,
zpcpu_get(smrs_smr)->c_seq, smrs->generation, smrs->count);
va_start(ap, fmt);
(void)vprintf(fmt, ap);
___
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: r363917 - head/sys/compat/freebsd32

2020-08-05 Thread Mark Johnston
Author: markj
Date: Wed Aug  5 17:06:14 2020
New Revision: 363917
URL: https://svnweb.freebsd.org/changeset/base/363917

Log:
  Fix a TOCTOU vulnerability in freebsd32_copyin_control().
  
  PR:   248257
  Reported by:  m00nbsd working with Trend Micro Zero Day Initiative
  Reviewed by:  kib
  Security: SA-20:23.sendmsg
  Security: CVE-2020-7460
  Security: ZDI-CAN-11543

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Wed Aug  5 15:33:32 2020
(r363916)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Wed Aug  5 17:06:14 2020
(r363917)
@@ -1449,78 +1449,90 @@ freebsd32_recvmsg(td, uap)
 static int
 freebsd32_copyin_control(struct mbuf **mp, caddr_t buf, u_int buflen)
 {
+   struct cmsghdr *cm;
struct mbuf *m;
-   void *md;
-   u_int idx, len, msglen;
+   void *in, *in1, *md;
+   u_int msglen, outlen;
int error;
 
-   buflen = FREEBSD32_ALIGN(buflen);
-
if (buflen > MCLBYTES)
return (EINVAL);
 
+   in = malloc(buflen, M_TEMP, M_WAITOK);
+   error = copyin(buf, in, buflen);
+   if (error != 0)
+   goto out;
+
/*
-* Iterate over the buffer and get the length of each message
-* in there. This has 32-bit alignment and padding. Use it to
-* determine the length of these messages when using 64-bit
-* alignment and padding.
+* Make a pass over the input buffer to determine the amount of space
+* required for 64 bit-aligned copies of the control messages.
 */
-   idx = 0;
-   len = 0;
-   while (idx < buflen) {
-   error = copyin(buf + idx, , sizeof(msglen));
-   if (error)
-   return (error);
-   if (msglen < sizeof(struct cmsghdr))
-   return (EINVAL);
-   msglen = FREEBSD32_ALIGN(msglen);
-   if (idx + msglen > buflen)
-   return (EINVAL);
-   idx += msglen;
-   msglen += CMSG_ALIGN(sizeof(struct cmsghdr)) -
-   FREEBSD32_ALIGN(sizeof(struct cmsghdr));
-   len += CMSG_ALIGN(msglen);
-   }
-
-   if (len > MCLBYTES)
-   return (EINVAL);
-
-   m = m_get(M_WAITOK, MT_CONTROL);
-   if (len > MLEN)
-   MCLGET(m, M_WAITOK);
-   m->m_len = len;
-
-   md = mtod(m, void *);
+   in1 = in;
+   outlen = 0;
while (buflen > 0) {
-   error = copyin(buf, md, sizeof(struct cmsghdr));
-   if (error)
+   if (buflen < sizeof(*cm)) {
+   error = EINVAL;
break;
-   msglen = *(u_int *)md;
-   msglen = FREEBSD32_ALIGN(msglen);
+   }
+   cm = (struct cmsghdr *)in1;
+   if (cm->cmsg_len < FREEBSD32_ALIGN(sizeof(*cm))) {
+   error = EINVAL;
+   break;
+   }
+   msglen = FREEBSD32_ALIGN(cm->cmsg_len);
+   if (msglen > buflen || msglen < cm->cmsg_len) {
+   error = EINVAL;
+   break;
+   }
+   buflen -= msglen;
 
-   /* Modify the message length to account for alignment. */
-   *(u_int *)md = msglen + CMSG_ALIGN(sizeof(struct cmsghdr)) -
-   FREEBSD32_ALIGN(sizeof(struct cmsghdr));
+   in1 = (char *)in1 + msglen;
+   outlen += CMSG_ALIGN(sizeof(*cm)) +
+   CMSG_ALIGN(msglen - FREEBSD32_ALIGN(sizeof(*cm)));
+   }
+   if (error == 0 && outlen > MCLBYTES) {
+   /*
+* XXXMJ This implies that the upper limit on 32-bit aligned
+* control messages is less than MCLBYTES, and so we are not
+* perfectly compatible.  However, there is no platform
+* guarantee that mbuf clusters larger than MCLBYTES can be
+* allocated.
+*/
+   error = EINVAL;
+   }
+   if (error != 0)
+   goto out;
 
-   md = (char *)md + CMSG_ALIGN(sizeof(struct cmsghdr));
-   buf += FREEBSD32_ALIGN(sizeof(struct cmsghdr));
-   buflen -= FREEBSD32_ALIGN(sizeof(struct cmsghdr));
+   m = m_get2(outlen, M_WAITOK, MT_CONTROL, 0);
+   m->m_len = outlen;
+   md = mtod(m, void *);
 
-   msglen -= FREEBSD32_ALIGN(sizeof(struct cmsghdr));
-   if (msglen > 0) {
-   error = copyin(buf, md, msglen);
-   if (error)
-   break;
-   md = (char *)md + CMSG_ALIGN(msglen);
-   buf += msglen;
-   

Re: svn commit: r363891 - head/sys/kern

2020-08-05 Thread Don Lewis
On  5 Aug, Mateusz Guzik wrote:
> Author: mjg
> Date: Wed Aug  5 09:24:38 2020
> New Revision: 363891
> URL: https://svnweb.freebsd.org/changeset/base/363891
> 
> Log:
>   cache: reduce zone alignment to 8 bytes
>   
>   It used to be sizeof of the given struct to accomodate for 32 bit mips
>   doing 64 bit loads, but the same can be achieved with requireing just
>   64 bit alignment.
>   
>   While here reorder struct namecache so that most commonly used fields
>   are closer.
> 
> Modified:
>   head/sys/kern/vfs_cache.c
> 
> Modified: head/sys/kern/vfs_cache.c
> ==
> --- head/sys/kern/vfs_cache.c Wed Aug  5 09:24:00 2020(r363890)
> +++ head/sys/kern/vfs_cache.c Wed Aug  5 09:24:38 2020(r363891)
> @@ -122,9 +122,9 @@ _Static_assert(sizeof(struct negstate) <= sizeof(struc
>  "the state must fit in a union with a pointer without growing it");
>  
>  struct   namecache {
> - CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
>   LIST_ENTRY(namecache) nc_src;   /* source vnode list */
>   TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
> + CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
>   struct  vnode *nc_dvp;  /* vnode of parent of name */
>   union {
>   struct  vnode *nu_vp;   /* vnode the name refers to */
> @@ -142,6 +142,8 @@ structnamecache {
>   * to be stored.  The nc_dotdottime field is used when a cache entry is 
> mapping
>   * both a non-dotdot directory name plus dotdot for the directory's
>   * parent.
> + *
> + * See below for alignment requirement.
>   */
>  struct   namecache_ts {
>   struct  timespec nc_time;   /* timespec provided by fs */
> @@ -150,6 +152,14 @@ struct   namecache_ts {
>   struct namecache nc_nc;
>  };
>  
> +/*
> + * At least mips n32 performs 64-bit accesses to timespec as found
> + * in namecache_ts and requires them to be aligned. Since others
> + * may be in the same spot suffer a little bit and enforce the
> + * alignment for everyone. Note this is a nop for 64-bit platforms.
> + */
> +#define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t)

time_t is only 32 bits on i386

___
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: r363916 - head/contrib/ipfilter/iplang

2020-08-05 Thread Cy Schubert
Author: cy
Date: Wed Aug  5 15:33:32 2020
New Revision: 363916
URL: https://svnweb.freebsd.org/changeset/base/363916

Log:
  Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
  complete description.
  
  MFC after:1 week

Modified:
  head/contrib/ipfilter/iplang/iplang_y.y

Modified: head/contrib/ipfilter/iplang/iplang_y.y
==
--- head/contrib/ipfilter/iplang/iplang_y.y Wed Aug  5 15:20:07 2020
(r363915)
+++ head/contrib/ipfilter/iplang/iplang_y.y Wed Aug  5 15:33:32 2020
(r363916)
@@ -30,11 +30,9 @@
 #include 
 #include 
 #include 
-#ifndeflinux
 # include 
 # include 
 # include 
-#endif
 #include 
 #include 
 #include 
@@ -589,29 +587,7 @@ struct statetoopt  tosecopts[] = {
{ 0, 0 }
 };
 
-#ifdef bsdi
-struct ether_addr *
-ether_aton(s)
-   char *s;
-{
-   static struct ether_addr n;
-   u_int i[6];
 
-   if (sscanf(s, " %x:%x:%x:%x:%x:%x ", [0], [1],
-   [2], [3], [4], [5]) == 6) {
-   n.ether_addr_octet[0] = (u_char)i[0];
-   n.ether_addr_octet[1] = (u_char)i[1];
-   n.ether_addr_octet[2] = (u_char)i[2];
-   n.ether_addr_octet[3] = (u_char)i[3];
-   n.ether_addr_octet[4] = (u_char)i[4];
-   n.ether_addr_octet[5] = (u_char)i[5];
-   return 
-   }
-   return NULL;
-}
-#endif
-
-
 struct in_addr getipv4addr(arg)
 char *arg;
 {
@@ -645,7 +621,6 @@ struct ether_addr *buf;
 {
struct ether_addr *e;
 
-#if !defined(hpux) && !defined(linux)
e = ether_aton(arg);
if (!e)
fprintf(stderr, "Invalid ethernet address: %s\n", arg);
@@ -657,9 +632,6 @@ struct ether_addr *buf;
  sizeof(e->ether_addr_octet));
 # endif
return e;
-#else
-   return NULL;
-#endif
 }
 
 
@@ -1584,9 +1556,7 @@ int arg;
 void set_icmpmtu(arg)
 int arg;
 {
-#ifBSD >= 199306
icmp->icmp_nextmtu = htons(arg);
-#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: r363915 - in head/contrib/bc: . locales src

2020-08-05 Thread Stefan Eßer
Author: se
Date: Wed Aug  5 15:20:07 2020
New Revision: 363915
URL: https://svnweb.freebsd.org/changeset/base/363915

Log:
  Upgrade to version 3.1.5
  
  This version fixes some entries in the chinese message catalogs which could
  lead to program crashes when used.

Modified:
  head/contrib/bc/Makefile.in
  head/contrib/bc/NEWS.md
  head/contrib/bc/locales/zh_CN.GB18030.msg
  head/contrib/bc/locales/zh_CN.GB2312.msg
  head/contrib/bc/locales/zh_CN.GBK.msg
  head/contrib/bc/locales/zh_CN.UTF-8.msg
  head/contrib/bc/locales/zh_CN.eucCN.msg
  head/contrib/bc/src/program.c
  head/contrib/bc/src/vm.c
Directory Properties:
  head/contrib/bc/   (props changed)

Modified: head/contrib/bc/Makefile.in
==
--- head/contrib/bc/Makefile.in Wed Aug  5 14:42:45 2020(r363914)
+++ head/contrib/bc/Makefile.in Wed Aug  5 15:20:07 2020(r363915)
@@ -29,7 +29,7 @@
 #
 .POSIX:
 
-VERSION = 3.1.4
+VERSION = 3.1.5
 
 SRC = %%SRC%%
 OBJ = %%OBJ%%

Modified: head/contrib/bc/NEWS.md
==
--- head/contrib/bc/NEWS.md Wed Aug  5 14:42:45 2020(r363914)
+++ head/contrib/bc/NEWS.md Wed Aug  5 15:20:07 2020(r363915)
@@ -1,5 +1,13 @@
 # News
 
+## 3.1.5
+
+This is a production release that fixes the Chinese locales (which caused `bc`
+to crash) and a crash caused by `bc` executing code when it should not have 
been
+able to.
+
+***ALL USERS SHOULD UPGRADE.***
+
 ## 3.1.4
 
 This is a production release that fixes one bug, changes two behaviors, and

Modified: head/contrib/bc/locales/zh_CN.GB18030.msg
==
Binary file (source and/or target). No diff available.

Modified: head/contrib/bc/locales/zh_CN.GB2312.msg
==
Binary file (source and/or target). No diff available.

Modified: head/contrib/bc/locales/zh_CN.GBK.msg
==
Binary file (source and/or target). No diff available.

Modified: head/contrib/bc/locales/zh_CN.UTF-8.msg
==
Binary file (source and/or target). No diff available.

Modified: head/contrib/bc/locales/zh_CN.eucCN.msg
==
Binary file (source and/or target). No diff available.

Modified: head/contrib/bc/src/program.c
==
--- head/contrib/bc/src/program.c   Wed Aug  5 14:42:45 2020
(r363914)
+++ head/contrib/bc/src/program.c   Wed Aug  5 15:20:07 2020
(r363915)
@@ -1271,11 +1271,12 @@ static void bc_program_divmod(BcProgram *p) {
BcNum *n1, *n2;
size_t req;
 
+   bc_vec_expand(>results, p->results.len + 2);
+
+   // We don't need to update the pointer because
+   // the capacity is enough due to the line above.
res2 = bc_program_prepResult(p);
res = bc_program_prepResult(p);
-
-   // Update the pointer, just in case.
-   res2 = bc_vec_item_rev(>results, 1);
 
bc_program_binOpPrep(p, , , , , 2);
 

Modified: head/contrib/bc/src/vm.c
==
--- head/contrib/bc/src/vm.cWed Aug  5 14:42:45 2020(r363914)
+++ head/contrib/bc/src/vm.cWed Aug  5 15:20:07 2020(r363915)
@@ -464,7 +464,7 @@ static void bc_vm_process(const char *text) {
 
while (BC_PARSE_CAN_PARSE(vm.prs)) vm.parse();
 
-   bc_program_exec();
+   if(BC_IS_DC || !BC_PARSE_NO_EXEC()) 
bc_program_exec();
 
assert(BC_IS_DC || vm.prog.results.len == 0);
 
___
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: r363875 - head/sys/ufs/ffs

2020-08-05 Thread Mark Johnston
On Tue, Aug 04, 2020 at 11:09:16PM +, Mateusz Guzik wrote:
> Author: mjg
> Date: Tue Aug  4 23:09:15 2020
> New Revision: 363875
> URL: https://svnweb.freebsd.org/changeset/base/363875
> 
> Log:
>   ufs: only pass LK_ADAPTIVE if LK_NODDLKTREAT is set
>   
>   This restores the pre-adaptive spinning state for SU which livelocks
>   otherwise. Note this is a bug in SU.
>   
>   Reported by:pho

What is the bug?
___
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: r363911 - in head: cddl/contrib/opensolaris/cmd/zinject cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/commo...

2020-08-05 Thread Toomas Soome
Author: tsoome
Date: Wed Aug  5 14:32:20 2020
New Revision: 363911
URL: https://svnweb.freebsd.org/changeset/base/363911

Log:
  MFOpenZFS: Add support for boot environment data to be stored in the label
  
  We are building new bootonce mechanism (previously zfs bootnext) and it is
  based on this OpenZFS change. Since this patch is nicely self contained,
  I am commiting it as is, and we can stack our changes.
  
  Original patch description follows:
  
  Modern bootloaders leverage data stored in the root filesystem to
  enable some of their powerful features. GRUB specifically has a grubenv
  file which can store large amounts of configuration data that can be
  read and written at boot time and during normal operation. This allows
  sysadmins to configure useful features like automated failover after
  failed boot attempts. Unfortunately, due to the Copy-on-Write nature
  of ZFS, the standard behavior of these tools cannot handle writing to
  ZFS files safely at boot time. We need an alternative way to store
  data that allows the bootloader to make changes to the data.
  
  This work is very similar to work that was done on Illumos to enable
  similar functionality in the FreeBSD bootloader. This patch is different
  in that the data being stored is a raw grubenv file; this file can store
  arbitrary variables and values, and the scripting provided by grub is
  powerful enough that special structures are not required to implement
  advanced behavior.
  
  We repurpose the second padding area in each label to store the grubenv
  file, protected by an embedded checksum. We add two ioctls to get and
  set this data, and libzfs_core and libzfs functions to access them more
  easily. There are no direct command line interfaces to these functions;
  these will be added directly to the bootloader utilities.
  
  Reviewed-by: Pavel Zakharov 
  Reviewed-by: Matthew Ahrens 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Paul Dagnelie 
  Closes #10009
  
  Obtained from:OpenZFS
  Sponsored by: Netflix, Klara Inc.

Modified:
  head/cddl/contrib/opensolaris/cmd/zinject/translate.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h

Modified: head/cddl/contrib/opensolaris/cmd/zinject/translate.c
==
--- head/cddl/contrib/opensolaris/cmd/zinject/translate.c   Wed Aug  5 
14:08:44 2020(r363910)
+++ head/cddl/contrib/opensolaris/cmd/zinject/translate.c   Wed Aug  5 
14:32:20 2020(r363911)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2020 by Delphix. All rights reserved.
  */
 
 #include 
@@ -484,7 +484,7 @@ translate_device(const char *pool, const char *device,
record->zi_end = record->zi_start + VDEV_PAD_SIZE - 1;
break;
case TYPE_LABEL_PAD2:
-   record->zi_start = offsetof(vdev_label_t, vl_pad2);
+   record->zi_start = offsetof(vdev_label_t, vl_be);
record->zi_end = record->zi_start + VDEV_PAD_SIZE - 1;
break;
}

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hWed Aug  5 
14:08:44 2020(r363910)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hWed Aug  5 
14:32:20 2020(r363911)
@@ -837,6 +837,8 @@ extern int zpool_in_use(libzfs_handle_t *, int, pool_s
 extern int zpool_read_label(int, nvlist_t **);
 extern int zpool_read_all_labels(int, nvlist_t **);
 extern int zpool_clear_label(int);
+extern int zpool_set_bootenv(zpool_handle_t *, const char *);
+extern int zpool_get_bootenv(zpool_handle_t *, char *, size_t, off_t);
 
 /* is this zvol valid for use as a dump device? */
 extern int zvol_check_dump_config(char *);

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Wed Aug 
 5 14:08:44 2020(r363910)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Wed Aug 
 5 14:32:20 2020(r363911)

svn commit: r363910 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-08-05 Thread Toomas Soome
Author: tsoome
Date: Wed Aug  5 14:08:44 2020
New Revision: 363910
URL: https://svnweb.freebsd.org/changeset/base/363910

Log:
  zfs_keys_nextboot array is missing ZPOOL_CONFIG_POOL_GUID and 
ZPOOL_CONFIG_GUID
  
  As we do check the incomint nvlist, we either need to list all possible
  keys or use wildcard.
  
  PR:   248462
  Reported by:  larafer...@gmail.com
  Sponsored by: Netflix, Klara Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Aug 
 5 11:54:51 2020(r363909)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Aug 
 5 14:08:44 2020(r363910)
@@ -3656,7 +3656,9 @@ zfs_ioc_log_history(const char *unused, nvlist_t *innv
 
 #ifdef __FreeBSD__
 static const zfs_ioc_key_t zfs_keys_nextboot[] = {
-   {"command", DATA_TYPE_STRING,   0},
+   {"command", DATA_TYPE_STRING,   0},
+   {ZPOOL_CONFIG_POOL_GUID,DATA_TYPE_UINT64,   0},
+   {ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64,   0}
 };
 
 static int
___
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: r363909 - in head/sys: arm64/conf riscv/conf

2020-08-05 Thread Andrew Turner
Author: andrew
Date: Wed Aug  5 11:54:51 2020
New Revision: 363909
URL: https://svnweb.freebsd.org/changeset/base/363909

Log:
  Add DDB_CTF to the arm64 and riscv kernel configs
  
  This allows DTrace fbt probes to find arguments.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/riscv/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Wed Aug  5 11:54:02 2020(r363908)
+++ head/sys/arm64/conf/GENERIC Wed Aug  5 11:54:51 2020(r363909)
@@ -72,6 +72,7 @@ options   CAPABILITIES# Capsicum capabilities
 optionsMAC # TrustedBSD MAC Framework
 optionsKDTRACE_FRAME   # Ensure frames are compiled in
 optionsKDTRACE_HOOKS   # Kernel DTrace hooks
+optionsDDB_CTF # Kernel ELF linker loads CTF data
 optionsVFP # Floating-point support
 optionsRACCT   # Resource accounting framework
 optionsRACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Wed Aug  5 11:54:02 2020(r363908)
+++ head/sys/riscv/conf/GENERIC Wed Aug  5 11:54:51 2020(r363909)
@@ -67,6 +67,7 @@ options   CAPABILITIES# Capsicum capabilities
 optionsMAC # TrustedBSD MAC Framework
 optionsKDTRACE_FRAME   # Ensure frames are compiled in
 optionsKDTRACE_HOOKS   # Kernel DTrace hooks
+optionsDDB_CTF # Kernel ELF linker loads CTF data
 optionsFPE # Floating-point extension support
 optionsRACCT   # Resource accounting framework
 optionsRACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
___
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: r363908 - head/share/dtrace

2020-08-05 Thread Andrey V. Elsukov
Author: ae
Date: Wed Aug  5 11:54:02 2020
New Revision: 363908
URL: https://svnweb.freebsd.org/changeset/base/363908

Log:
  Synchronize definitions in mbuf.d with values from mbuf.h
  
  Obtained from:Yandex LLC
  Sponsored by: Yandex LLC

Modified:
  head/share/dtrace/mbuf.d

Modified: head/share/dtrace/mbuf.d
==
--- head/share/dtrace/mbuf.dWed Aug  5 11:41:41 2020(r363907)
+++ head/share/dtrace/mbuf.dWed Aug  5 11:54:02 2020(r363908)
@@ -53,37 +53,41 @@ inline int M_MCAST =0x0020; /* send/received as 
l
 inline int M_PROMISC = 0x0040; /* packet was not for us */
 #pragma D binding "1.6.3" M_VLANTAG
 inline int M_VLANTAG = 0x0080; /* ether_vtag is valid */
-#pragma D binding "1.6.3" M_UNUSED_8
-inline int M_UNUSED_8 =0x0100; /* --available-- */
+#pragma D binding "1.13" M_EXTPG
+inline int M_EXTPG =   0x0100; /* has array of unmapped pages and TLS */
 #pragma D binding "1.6.3" M_NOFREE
 inline int M_NOFREE =  0x0200; /* do not free mbuf, embedded in cluster */
+#pragma D binding "1.13" M_TSTMP
+inline int M_TSTMP =   0x0400; /* rcv_tstmp field is valid */
+#pragma D binding "1.13" M_TSTMP_HPREC
+inline int M_TSTMP_HPREC = 0x0800; /* rcv_tstmp is high-prec */
+#pragma D binding "1.13" M_TSTMP_LRO
+inline int M_TSTMP_LRO = 0x1000; /* Time LRO pushed in pkt is valid */
+ 
+#pragma D binding "1.13" M_PROTO1
+inline int M_PROTO1 =  0x2000; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO2
+inline int M_PROTO2 =  0x4000; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO3
+inline int M_PROTO3 =  0x8000; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO4
+inline int M_PROTO4 =  0x0001; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO5
+inline int M_PROTO5 =  0x0002; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO6
+inline int M_PROTO6 =  0x0004; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO7
+inline int M_PROTO7 =  0x0008; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO8
+inline int M_PROTO8 =  0x0010; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO9
+inline int M_PROTO9 =  0x0020; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO10
+inline int M_PROTO10 = 0x0040; /* protocol-specific */
+#pragma D binding "1.13" M_PROTO11
+inline int M_PROTO11 = 0x0080; /* protocol-specific */
 
-#pragma D binding "1.6.3" M_PROTO1
-inline int M_PROTO1 =  0x1000; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO2
-inline int M_PROTO2 =  0x2000; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO3
-inline int M_PROTO3 =  0x4000; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO4
-inline int M_PROTO4 =  0x8000; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO5
-inline int M_PROTO5 =  0x0001; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO6
-inline int M_PROTO6 =  0x0002; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO7
-inline int M_PROTO7 =  0x0004; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO8
-inline int M_PROTO8 =  0x0008; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO9
-inline int M_PROTO9 =  0x0010; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO10
-inline int M_PROTO10 = 0x0020; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO11
-inline int M_PROTO11 = 0x0040; /* protocol-specific */
-#pragma D binding "1.6.3" M_PROTO12
-inline int M_PROTO12 = 0x0080; /* protocol-specific */
-
-#pragma D binding "1.6.3" mbufflags_string
+#pragma D binding "1.13" mbufflags_string
 inline string mbufflags_string[uint32_t flags] =
 flags & M_EXT ? "M_EXT" :
 flags & M_PKTHDR ? "M_PKTHDR" :
@@ -93,8 +97,11 @@ inline string mbufflags_string[uint32_t flags] =
 flags & M_MCAST? "M_MCAST" :
 flags & M_PROMISC  ? "M_PROMISC" :
 flags & M_VLANTAG  ? "M_VLANTAG" :
-flags & M_UNUSED_8 ? "M_UNUSED_8" :
-flags & M_NOFREE  ? "M_NOFREE" :
+flags & M_EXTPG? "M_EXTPG" :
+flags & M_NOFREE   ? "M_NOFREE" :
+flags & M_TSTMP? "M_TSTMP" :
+flags & M_TSTMP_HPREC ? "M_TSTMP_HPREC" :
+flags & M_TSTMP_LRO ? "M_TSTMP_LRO" :
 flags & M_PROTO1  ? "M_PROTO1" :
 flags & M_PROTO2 ? "M_PROTO2" :
 flags & M_PROTO3 ? "M_PROTO3" :
@@ -106,7 +113,6 @@ inline string mbufflags_string[uint32_t flags] =
 flags & M_PROTO9 ? "M_PROTO9" :
 flags & M_PROTO10 ? "M_PROTO10" :
 flags & M_PROTO11 ? "M_PROTO11" :
-flags & M_PROTO12 ? "M_PROTO12" :
 "none" ;
 
 typedef struct mbufinfo {
___
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: r363907 - head/share/man/man7

2020-08-05 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Wed Aug  5 11:41:41 2020
New Revision: 363907
URL: https://svnweb.freebsd.org/changeset/base/363907

Log:
  environ(7): Update the description and include some more environment variables
  
  - Add a better introduction to the DESCRIPTION section
  - Add a description for MANPATH and POSIXLY_CORRECT
  - Asorted improvements for the usage of some macros
  
  PR:   43823
  Submitted by: Lyndon Nerenberg 
  Reviewed by:  0mp, bcr
  Approved by:  0mp, bcr
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25912

Modified:
  head/share/man/man7/environ.7

Modified: head/share/man/man7/environ.7
==
--- head/share/man/man7/environ.7   Wed Aug  5 11:39:09 2020
(r363906)
+++ head/share/man/man7/environ.7   Wed Aug  5 11:41:41 2020
(r363907)
@@ -28,7 +28,7 @@
 .\"@(#)environ.7   8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd February 14, 2020
+.Dd August 5, 2020
 .Dt ENVIRON 7
 .Os
 .Sh NAME
@@ -37,21 +37,59 @@
 .Sh SYNOPSIS
 .Ar extern char **environ ;
 .Sh DESCRIPTION
-An array of strings called the
+An array of strings, called the
 .Ar environment
-is made available by
+is made available to each process by
 .Xr execve 2
 when a process begins.
 By convention these strings have the form
-.Dq Ar name=value .
-The following names are used by various commands:
-.Bl -tag -width LC_MONETARY
+.Va name Ns No = Ns Ar value ,
+and are referred to as
+.Dq environment variables .
+A process can query, update, and delete these strings using the
+.Xr getenv 3 ,
+.Xr setenv 3 ,
+and
+.Xr unsetenv 3
+functions, respectively.
+The shells also provide commands to manipulate the environment;
+they are described in the respective shell manual pages.
+.Pp
+What follows is a list of environment variables typically
+seen on a
+.Ux
+system.
+It includes only those variables that a user can expect to see during their
+day-to-day use of the system, and is far from complete.
+Environment variables specific to a particular program or library function
+are documented in the
+.Sx ENVIRONMENT
+section of the appropriate manual page.
+.Sh ENVIRONMENT
+.Bl -tag -width LD_LIBRARY_PATH
 .It Ev BLOCKSIZE
-The size of the block units used by several commands, most notably
+The size of the block units used by several disk-related commands,
+most notably
 .Xr df 1 ,
 .Xr du 1
 and
 .Xr ls 1 .
+.Ev BLOCKSIZE
+may be specified in units of a byte by specifying a number,
+in units of a kilobyte by specifying a number followed by
+.Ql K
+or
+.Ql k ,
+in units of a megabyte by specifying a number followed by
+.Ql M
+or
+.Ql m ,
+and in units of a gigabyte by specifying a number followed
+by
+.Ql G
+or
+.Ql g .
+Sizes less than 512 bytes or greater than a gigabyte are ignored.
 This variable is processed by the
 .Xr getbsize 3
 function.
@@ -117,6 +155,10 @@ used by
 .Xr mail 1 ,
 .Xr sh 1 ,
 and many other mail clients.
+.It Ev MANPATH
+The sequence of directories, separated by colons, searched by
+.Xr man 1
+when looking for manual pages.
 .It Ev NLSPATH
 List of directories to be searched for the message catalog referred to by
 .Ev LC_MESSAGES .
@@ -139,6 +181,9 @@ etc, when looking for an executable file.
 .Ev PATH
 is set to ``/usr/bin:/bin'' initially by
 .Xr login 1 .
+.It Ev POSIXLY_CORRECT
+When set to any value, this environment variable modifies the behaviour
+of certain commands to (mostly) execute in a strictly POSIX-compliant manner.
 .It Ev PRINTER
 The name of the default printer to be used by
 .Xr lpr 1 ,
@@ -178,7 +223,7 @@ no
 is equivalent to a
 .Ev TERMPATH
 of
-.Dq Pa $HOME/.termcap:/etc/termcap .
+.Pa $HOME/.termcap:/etc/termcap .
 .Ev TERMPATH
 is ignored if
 .Ev TERMCAP
@@ -186,22 +231,27 @@ contains a full pathname.
 .It Ev TMPDIR
 The directory in which to store temporary files.
 Most applications use either
-.Dq /tmp
+.Pa /tmp
 or
-.Dq /var/tmp .
+.Pa /var/tmp .
 Setting this variable will make them use another directory.
 .It Ev TZ
 The timezone to use when displaying dates.
 The normal format is a pathname relative to
-.Dq Pa /usr/share/zoneinfo .
+.Pa /usr/share/zoneinfo .
 For example, the command
-.Dq env TZ=America/Los_Angeles date
+.Pp
+.Dl env TZ=America/Los_Angeles date
+.Pp
 displays the current time in California.
 See
 .Xr tzset 3
 for more information.
 .It Ev USER
 The login name of the user.
+It is recommended that portable applications use
+.Ev LOGNAME
+instead.
 .El
 .Pp
 Further names may be placed in the environment by the
___
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: r363906 - in head/sys: kern sys

2020-08-05 Thread Andrey V. Elsukov
Author: ae
Date: Wed Aug  5 11:39:09 2020
New Revision: 363906
URL: https://svnweb.freebsd.org/changeset/base/363906

Log:
  Add m__getjcl SDT probe.
  
  Obtained from:Yandex LLC
  MFC after:1 week
  Sponsored by: Yandex LLC

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Wed Aug  5 11:38:33 2020(r363905)
+++ head/sys/kern/kern_mbuf.c   Wed Aug  5 11:39:09 2020(r363906)
@@ -1397,6 +1397,7 @@ m_getjcl(int how, short type, int flags, int size)
uma_zfree(zone_mbuf, m);
return (NULL);
}
+   MBUF_PROBE5(m__getjcl, how, type, flags, size, m);
return (m);
 }
 

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Wed Aug  5 11:38:33 2020(r363905)
+++ head/sys/kern/uipc_mbuf.c   Wed Aug  5 11:39:09 2020(r363906)
@@ -78,6 +78,13 @@ SDT_PROBE_DEFINE4_XLATE(sdt, , , m__getcl,
 "uint32_t", "uint32_t",
 "struct mbuf *", "mbufinfo_t *");
 
+SDT_PROBE_DEFINE5_XLATE(sdt, , , m__getjcl,
+"uint32_t", "uint32_t",
+"uint16_t", "uint16_t",
+"uint32_t", "uint32_t",
+"uint32_t", "uint32_t",
+"struct mbuf *", "mbufinfo_t *");
+
 SDT_PROBE_DEFINE3_XLATE(sdt, , , m__clget,
 "struct mbuf *", "mbufinfo_t *",
 "uint32_t", "uint32_t",

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Wed Aug  5 11:38:33 2020(r363905)
+++ head/sys/sys/mbuf.h Wed Aug  5 11:39:09 2020(r363906)
@@ -65,6 +65,7 @@ SDT_PROBE_DECLARE(sdt, , , m__init);
 SDT_PROBE_DECLARE(sdt, , , m__gethdr);
 SDT_PROBE_DECLARE(sdt, , , m__get);
 SDT_PROBE_DECLARE(sdt, , , m__getcl);
+SDT_PROBE_DECLARE(sdt, , , m__getjcl);
 SDT_PROBE_DECLARE(sdt, , , m__clget);
 SDT_PROBE_DECLARE(sdt, , , m__cljget);
 SDT_PROBE_DECLARE(sdt, , , m__cljset);
___
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: r363905 - head/share/man/man4

2020-08-05 Thread Andriy Gapon
Author: avg
Date: Wed Aug  5 11:38:33 2020
New Revision: 363905
URL: https://svnweb.freebsd.org/changeset/base/363905

Log:
  gpiokeys: add a basic manual page
  
  Reviewed by:  manu, bjk, 0mp
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D25939

Added:
  head/share/man/man4/gpiokeys.4   (contents, props changed)

Added: head/share/man/man4/gpiokeys.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/gpiokeys.4  Wed Aug  5 11:38:33 2020
(r363905)
@@ -0,0 +1,152 @@
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+.\"
+.\" Copyright (c) 2020 Andriy Gapon 
+.\"
+.\" 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$
+.\"
+.Dd August 5, 2020
+.Dt GPIOKEYS 4
+.Os
+.Sh NAME
+.Nm gpiokeys
+.Nd GPIO keys device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options FDT"
+.Cd "device gpio"
+.Cd "device gpiokeys"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+gpiokeys_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a way to represent a set of general purpose inputs as a
+.Xr keyboard 4
+device.
+At the moment the driver supports only
+.Xr FDT 4
+based systems.
+The DTS determines what pins are mapped to buttons and what key codes are
+generated for each virtual button.
+The
+.Xr keyboard 4
+device can be used from userland to monitor for input changes.
+.Pp
+On an
+.Xr FDT 4
+based system
+the DTS part for a
+.Nm
+device usually looks like:
+.Bd -literal
+/ {
+
+   ...
+
+   gpio_keys {
+   compatible = "gpio-keys";
+
+   btn1 {
+   label = "button1";
+   linux,code = ;
+   gpios = < 0 3 GPIO_ACTIVE_LOW>
+   };
+
+   btn2 {
+   label = "button2";
+   linux,code = ;
+   gpios = < 0 4 GPIO_ACTIVE_LOW>
+   };
+   };
+};
+.Ed
+.Pp
+For more details about the
+.Va gpios
+property, please consult
+.Pa /usr/src/sys/dts/bindings-gpio.txt .
+.Pp
+The
+.Nm
+driver supports two properties for specifying a key code.
+.Pp
+The property
+.Va freebsd,code
+specifies a
+.Fx
+native scancode compatible with
+.Xr kbdmap 5
+keyboard maps.
+.Pp
+The property
+.Va linux,code
+specifies an evdev scancode.
+That scancode is internally translated to a native scancode.
+Note that not all evdev scancodes have corresponding native scancodes.
+If a scancode cannot be translated, then a diagnostic message is printed
+and the input is ignored.
+.Pp
+The property
+.Va label
+is a descriptive name of a button.
+It is used for diagnostic messages only.
+This property is optional.
+If not set, the node name is used in its place.
+.Pp
+The property
+.Va autorepeat
+determines whether autorepeat is enabled for a button.
+.Pp
+The property
+.Va debounce-interval
+defines debouncing interval time in milliseconds.
+If not specified the interval defaults to 5.
+.Sh SEE ALSO
+.Xr fdt 4 ,
+.Xr gpio 4 ,
+.Xr keyboard 4 ,
+.Xr kbdmap 5
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 12.2 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Oleksandr Tymoshenko Aq Mt go...@freebsd.org .
+This
+manual page was written by
+.An Andriy Gapon Aq Mt a...@freebsd.org .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To 

svn commit: r363904 - head/sbin/ipfw

2020-08-05 Thread Andrey V. Elsukov
Author: ae
Date: Wed Aug  5 11:26:49 2020
New Revision: 363904
URL: https://svnweb.freebsd.org/changeset/base/363904

Log:
  Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.
  
  Submitted by: Evgeniy Khramtsov 
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25734

Modified:
  head/sbin/ipfw/nat64clat.c
  head/sbin/ipfw/nat64stl.c

Modified: head/sbin/ipfw/nat64clat.c
==
--- head/sbin/ipfw/nat64clat.c  Wed Aug  5 11:26:14 2020(r363903)
+++ head/sbin/ipfw/nat64clat.c  Wed Aug  5 11:26:49 2020(r363904)
@@ -303,6 +303,9 @@ nat64clat_config(const char *name, uint8_t set, int ac
 
if ((p = strchr(*av, '/')) != NULL)
*p++ = '\0';
+   else
+   errx(EX_USAGE,
+   "Prefix length required: %s", *av);
if (inet_pton(AF_INET6, *av, ) != 1)
errx(EX_USAGE,
"Bad prefix: %s", *av);

Modified: head/sbin/ipfw/nat64stl.c
==
--- head/sbin/ipfw/nat64stl.c   Wed Aug  5 11:26:14 2020(r363903)
+++ head/sbin/ipfw/nat64stl.c   Wed Aug  5 11:26:49 2020(r363904)
@@ -249,6 +249,9 @@ nat64stl_create(const char *name, uint8_t set, int ac,
NEED1("IPv6 prefix6 required");
if ((p = strchr(*av, '/')) != NULL)
*p++ = '\0';
+   else
+   errx(EX_USAGE,
+   "Prefix length required: %s", *av);
if (inet_pton(AF_INET6, *av, >prefix6) != 1)
errx(EX_USAGE,
"Bad prefix: %s", *av);
___
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: r363903 - head/share/man/man7

2020-08-05 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Aug  5 11:26:14 2020
New Revision: 363903
URL: https://svnweb.freebsd.org/changeset/base/363903

Log:
  Do not describe portsnap(8) as a way to manage /usr/ports

Modified:
  head/share/man/man7/build.7

Modified: head/share/man/man7/build.7
==
--- head/share/man/man7/build.7 Wed Aug  5 11:11:31 2020(r363902)
+++ head/share/man/man7/build.7 Wed Aug  5 11:26:14 2020(r363903)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 3, 2020
+.Dd August 5, 2020
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -41,10 +41,8 @@ and
 .Pa /usr/ports .
 These directories may be initially empty or non-existent until updated with
 .Xr svn 1
-or
-.Xr svnlite 1
-or
-.Xr portsnap 8 .
+(or
+.Xr svnlite 1 ) .
 Directory
 .Pa /usr/src
 contains the
@@ -852,7 +850,6 @@ manpage first appeared in
 .Xr tests 7 ,
 .Xr config 8 ,
 .Xr mergemaster 8 ,
-.Xr portsnap 8 ,
 .Xr reboot 8 ,
 .Xr shutdown 8
 .Sh AUTHORS
___
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: r363900 - head/sys/netinet6

2020-08-05 Thread Andrey V. Elsukov
Author: ae
Date: Wed Aug  5 10:27:11 2020
New Revision: 363900
URL: https://svnweb.freebsd.org/changeset/base/363900

Log:
  Fix typo.
  
  Submitted by: Evgeniy Khramtsov 
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25932

Modified:
  head/sys/netinet6/in6_proto.c

Modified: head/sys/netinet6/in6_proto.c
==
--- head/sys/netinet6/in6_proto.c   Wed Aug  5 10:12:19 2020
(r363899)
+++ head/sys/netinet6/in6_proto.c   Wed Aug  5 10:27:11 2020
(r363900)
@@ -586,7 +586,7 @@ SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK
"Create a loopback route when configuring an IPv6 address");
 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO, nodeinfo,
CTLFLAG_VNET | CTLFLAG_RW, _NAME(icmp6_nodeinfo), 0,
-   "Mask of enabled RF4620 node information query types");
+   "Mask of enabled RFC4620 node information query types");
 SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO_OLDMCPREFIX,
nodeinfo_oldmcprefix, CTLFLAG_VNET | CTLFLAG_RW,
_NAME(icmp6_nodeinfo_oldmcprefix), 0,
___
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: r363895 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 09:38:02 2020
New Revision: 363895
URL: https://svnweb.freebsd.org/changeset/base/363895

Log:
  cache: don't ignore size passed to nchinittbl

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 09:27:53 2020(r363894)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 09:38:02 2020(r363895)
@@ -2070,7 +2070,7 @@ nchinittbl(u_long elements, u_long *hashmask)
struct nchashhead *hashtbl;
u_long hashsize, i;
 
-   hashsize = cache_roundup_2(desiredvnodes * 2) / 2;
+   hashsize = cache_roundup_2(elements) / 2;
 
hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), M_VFSCACHE, 
M_WAITOK);
for (i = 0; i < hashsize; i++)
___
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: r363894 - head/sys/sys

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 09:27:53 2020
New Revision: 363894
URL: https://svnweb.freebsd.org/changeset/base/363894

Log:
  Bump __FreeBSD_version after vaccess() change

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hWed Aug  5 09:27:03 2020(r363893)
+++ head/sys/sys/param.hWed Aug  5 09:27:53 2020(r363894)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300104  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300105  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r363893 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fuse fs/msdosfs fs/nfsclient fs/pseudofs fs/smbfs fs/tmpfs fs/udf kern sys ufs/ufs

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 09:27:03 2020
New Revision: 363893
URL: https://svnweb.freebsd.org/changeset/base/363893

Log:
  vfs: remove the obsolete privused argument from vaccess
  
  This brings argument count down to 6, which is passable without the
  stack on amd64.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/fs/cd9660/cd9660_vnops.c
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/fuse/fuse_internal.c
  head/sys/fs/msdosfs/msdosfs_vnops.c
  head/sys/fs/nfsclient/nfs_clvnops.c
  head/sys/fs/pseudofs/pseudofs_vnops.c
  head/sys/fs/smbfs/smbfs_vnops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/fs/udf/udf_vnops.c
  head/sys/kern/subr_acl_nfs4.c
  head/sys/kern/subr_acl_posix1e.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/uipc_sem.c
  head/sys/kern/uipc_shm.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/vnode.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 
 5 09:25:59 2020(r363892)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 
 5 09:27:03 2020(r363893)
@@ -4941,7 +4941,7 @@ zfs_freebsd_access(ap)
accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND);
if (accmode != 0) {
error = vaccess(vp->v_type, zp->z_mode, zp->z_uid,
-   zp->z_gid, accmode, ap->a_cred, NULL);
+   zp->z_gid, accmode, ap->a_cred);
}
}
 

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==
--- head/sys/fs/cd9660/cd9660_vnops.c   Wed Aug  5 09:25:59 2020
(r363892)
+++ head/sys/fs/cd9660/cd9660_vnops.c   Wed Aug  5 09:27:03 2020
(r363893)
@@ -158,7 +158,7 @@ cd9660_access(ap)
}
 
return (vaccess(vp->v_type, ip->inode.iso_mode, ip->inode.iso_uid,
-   ip->inode.iso_gid, ap->a_accmode, ap->a_cred, NULL));
+   ip->inode.iso_gid, ap->a_accmode, ap->a_cred));
 }
 
 static int

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Wed Aug  5 09:25:59 2020
(r363892)
+++ head/sys/fs/devfs/devfs_vnops.c Wed Aug  5 09:27:03 2020
(r363893)
@@ -533,7 +533,7 @@ devfs_access(struct vop_access_args *ap)
de = de->de_dir;
 
error = vaccess(vp->v_type, de->de_mode, de->de_uid, de->de_gid,
-   ap->a_accmode, ap->a_cred, NULL);
+   ap->a_accmode, ap->a_cred);
if (error == 0)
return (0);
if (error != EACCES)

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Wed Aug  5 09:25:59 2020
(r363892)
+++ head/sys/fs/ext2fs/ext2_vnops.c Wed Aug  5 09:27:03 2020
(r363893)
@@ -348,7 +348,7 @@ ext2_access(struct vop_access_args *ap)
return (EPERM);
 
error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, ip->i_gid,
-   ap->a_accmode, ap->a_cred, NULL);
+   ap->a_accmode, ap->a_cred);
return (error);
 }
 

Modified: head/sys/fs/fuse/fuse_internal.c
==
--- head/sys/fs/fuse/fuse_internal.cWed Aug  5 09:25:59 2020
(r363892)
+++ head/sys/fs/fuse/fuse_internal.cWed Aug  5 09:27:03 2020
(r363893)
@@ -208,7 +208,7 @@ fuse_internal_access(struct vnode *vp,
 
fuse_internal_getattr(vp, , cred, td);
return vaccess(vp->v_type, va.va_mode, va.va_uid,
-   va.va_gid, mode, cred, NULL);
+   va.va_gid, mode, cred);
}
 
if (mode & VADMIN) {

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Wed Aug  5 09:25:59 2020
(r363892)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Wed Aug  5 09:27:03 2020
(r363893)
@@ -250,7 +250,7 @@ msdosfs_access(struct vop_access_args *ap)
}
 
return (vaccess(vp->v_type, file_mode, pmp->pm_uid, pmp->pm_gid,
-   ap->a_accmode, ap->a_cred, NULL));
+   ap->a_accmode, ap->a_cred));
 }
 
 static int

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==
--- head/sys/fs/nfsclient/nfs_clvnops.c Wed Aug  5 09:25:59 2020
(r363892)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Wed Aug  5 09:27:03 2020
(r363893)
@@ -3393,8 +3393,8 @@ nfsspec_access(struct vop_access_args *ap)
error = VOP_GETATTR(vp, 

svn commit: r363892 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 09:25:59 2020
New Revision: 363892
URL: https://svnweb.freebsd.org/changeset/base/363892

Log:
  cache: convert the hash from LIST to SLIST
  
  This reduces struct namecache by sizeof(void *).
  
  Negative side is that we have to find the previous element (if any) when
  removing an entry, but since we normally don't expect collisions it should be
  fine.
  
  Note this adds cache_get_hash calls which can be eliminated.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 09:24:38 2020(r363891)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 09:25:59 2020(r363892)
@@ -124,7 +124,7 @@ _Static_assert(sizeof(struct negstate) <= sizeof(struc
 struct namecache {
LIST_ENTRY(namecache) nc_src;   /* source vnode list */
TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
-   CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
+   CK_SLIST_ENTRY(namecache) nc_hash;/* hash chain */
struct  vnode *nc_dvp;  /* vnode of parent of name */
union {
struct  vnode *nu_vp;   /* vnode the name refers to */
@@ -264,7 +264,7 @@ VFS_SMR_DECLARE;
  */
 #define NCHHASH(hash) \
([(hash) & nchash])
-static __read_mostly CK_LIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash 
Table */
+static __read_mostly CK_SLIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash 
Table */
 static u_long __read_mostlynchash; /* size of hash table */
 SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, , 0,
 "Size of namecache hash table");
@@ -520,6 +520,15 @@ cache_get_hash(char *name, u_char len, struct vnode *d
return (fnv_32_buf(name, len, dvp->v_nchash));
 }
 
+static inline struct nchashhead *
+NCP2BUCKET(struct namecache *ncp)
+{
+   uint32_t hash;
+
+   hash = cache_get_hash(ncp->nc_name, ncp->nc_nlen, ncp->nc_dvp);
+   return (NCHHASH(hash));
+}
+
 static inline struct rwlock *
 NCP2BUCKETLOCK(struct namecache *ncp)
 {
@@ -687,7 +696,7 @@ retry:
}
/* Scan hash tables counting entries */
for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++)
-   CK_LIST_FOREACH(ncp, ncpp, nc_hash)
+   CK_SLIST_FOREACH(ncp, ncpp, nc_hash)
cntbuf[i]++;
cache_unlock_all_buckets();
for (error = 0, i = 0; i < n_nchash; i++)
@@ -720,7 +729,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HANDLER_ARGS)
/* Scan hash tables for applicable entries */
for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) {
count = 0;
-   CK_LIST_FOREACH(ncp, ncpp, nc_hash) {
+   CK_SLIST_FOREACH(ncp, ncpp, nc_hash) {
count++;
}
if (count)
@@ -952,6 +961,7 @@ cache_negative_zap_one(void)
 static void
 cache_zap_locked(struct namecache *ncp)
 {
+   struct nchashhead *ncpp;
 
if (!(ncp->nc_flag & NCF_NEGATIVE))
cache_assert_vnode_locked(ncp->nc_vp);
@@ -963,7 +973,8 @@ cache_zap_locked(struct namecache *ncp)
 
cache_ncp_invalidate(ncp);
 
-   CK_LIST_REMOVE(ncp, nc_hash);
+   ncpp = NCP2BUCKET(ncp);
+   CK_SLIST_REMOVE(ncpp, ncp, namecache, nc_hash);
if (!(ncp->nc_flag & NCF_NEGATIVE)) {
SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp,
ncp->nc_name, ncp->nc_vp);
@@ -1122,7 +1133,7 @@ cache_zap_unlocked_bucket(struct namecache *ncp, struc
cache_sort_vnodes(, );
cache_lock_vnodes(dvlp, vlp);
rw_wlock(blp);
-   CK_LIST_FOREACH(rncp, (NCHHASH(hash)), nc_hash) {
+   CK_SLIST_FOREACH(rncp, (NCHHASH(hash)), nc_hash) {
if (rncp == ncp && rncp->nc_dvp == dvp &&
rncp->nc_nlen == cnp->cn_namelen &&
!bcmp(rncp->nc_name, cnp->cn_nameptr, rncp->nc_nlen))
@@ -1336,12 +1347,12 @@ retry_dotdot:
hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp);
blp = HASH2BUCKETLOCK(hash);
 retry:
-   if (CK_LIST_EMPTY(NCHHASH(hash)))
+   if (CK_SLIST_EMPTY(NCHHASH(hash)))
goto out_no_entry;
 
rw_wlock(blp);
 
-   CK_LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
+   CK_SLIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen &&
!bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen))
break;
@@ -1485,7 +1496,7 @@ retry_hashed:
rw_rlock(blp);
}
 
-   CK_LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
+   CK_SLIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen &&
!bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen))
break;
@@ -1932,7 +1943,7 @@ 

svn commit: r363891 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 09:24:38 2020
New Revision: 363891
URL: https://svnweb.freebsd.org/changeset/base/363891

Log:
  cache: reduce zone alignment to 8 bytes
  
  It used to be sizeof of the given struct to accomodate for 32 bit mips
  doing 64 bit loads, but the same can be achieved with requireing just
  64 bit alignment.
  
  While here reorder struct namecache so that most commonly used fields
  are closer.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 09:24:00 2020(r363890)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 09:24:38 2020(r363891)
@@ -122,9 +122,9 @@ _Static_assert(sizeof(struct negstate) <= sizeof(struc
 "the state must fit in a union with a pointer without growing it");
 
 struct namecache {
-   CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
LIST_ENTRY(namecache) nc_src;   /* source vnode list */
TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
+   CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
struct  vnode *nc_dvp;  /* vnode of parent of name */
union {
struct  vnode *nu_vp;   /* vnode the name refers to */
@@ -142,6 +142,8 @@ struct  namecache {
  * to be stored.  The nc_dotdottime field is used when a cache entry is mapping
  * both a non-dotdot directory name plus dotdot for the directory's
  * parent.
+ *
+ * See below for alignment requirement.
  */
 struct namecache_ts {
struct  timespec nc_time;   /* timespec provided by fs */
@@ -150,6 +152,14 @@ struct namecache_ts {
struct namecache nc_nc;
 };
 
+/*
+ * At least mips n32 performs 64-bit accesses to timespec as found
+ * in namecache_ts and requires them to be aligned. Since others
+ * may be in the same spot suffer a little bit and enforce the
+ * alignment for everyone. Note this is a nop for 64-bit platforms.
+ */
+#define CACHE_ZONE_ALIGNMENT   UMA_ALIGNOF(time_t)
+
 #definenc_vp   n_un.nu_vp
 #definenc_neg  n_un.nu_neg
 
@@ -2053,19 +2063,19 @@ nchinit(void *dummy __unused)
 
cache_zone_small = uma_zcreate("S VFS Cache",
sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1,
-   NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache),
+   NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT,
UMA_ZONE_ZINIT);
cache_zone_small_ts = uma_zcreate("STS VFS Cache",
sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1,
-   NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts),
+   NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT,
UMA_ZONE_ZINIT);
cache_zone_large = uma_zcreate("L VFS Cache",
sizeof(struct namecache) + NAME_MAX + 1,
-   NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache),
+   NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT,
UMA_ZONE_ZINIT);
cache_zone_large_ts = uma_zcreate("LTS VFS Cache",
sizeof(struct namecache_ts) + NAME_MAX + 1,
-   NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts),
+   NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT,
UMA_ZONE_ZINIT);
 
VFS_SMR_ZONE_SET(cache_zone_small);
___
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: r363890 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 09:24:00 2020
New Revision: 363890
URL: https://svnweb.freebsd.org/changeset/base/363890

Log:
  cache: convert ncnegnash into a macro
  
  It is a read-only var with value known at compilation time.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 09:19:41 2020(r363889)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 09:24:00 2020(r363890)
@@ -284,8 +284,8 @@ static struct neglist __read_mostly *neglists;
 static struct neglist ncneg_hot;
 static u_long numhotneg;
 
-#definenumneglists (ncneghash + 1)
-static u_int __read_mostly ncneghash;
+#define ncneghash  3
+#definenumneglists (ncneghash + 1)
 static inline struct neglist *
 NCP2NEGLIST(struct namecache *ncp)
 {
@@ -2091,7 +2091,6 @@ nchinit(void *dummy __unused)
mtx_init([i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE);
ncpurgeminvnodes = numbucketlocks * 2;
 
-   ncneghash = 3;
neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE,
M_WAITOK | M_ZERO);
for (i = 0; i < numneglists; i++) {
___
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: r363889 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2020-08-05 Thread Eugene Grosbein
Author: eugen
Date: Wed Aug  5 09:19:41 2020
New Revision: 363889
URL: https://svnweb.freebsd.org/changeset/base/363889

Log:
  bsnmptools: make it print protocol errors to stderr instead of stdout
  
  Reviewed by:  syrinx, bz
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25911

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c   Wed Aug  5 
09:16:35 2020(r363888)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c   Wed Aug  5 
09:19:41 2020(r363889)
@@ -1828,11 +1828,11 @@ snmp_output_numval(struct snmp_toolinfo *snmptoolctx, 
break;
 
case SNMP_SYNTAX_NOSUCHOBJECT:
-   fprintf(stdout, "No Such Object\n");
+   fprintf(stderr, "No Such Object\n");
return (val->syntax);
 
case SNMP_SYNTAX_NOSUCHINSTANCE:
-   fprintf(stdout, "No Such Instance\n");
+   fprintf(stderr, "No Such Instance\n");
return (val->syntax);
 
case SNMP_SYNTAX_ENDOFMIBVIEW:
@@ -1841,12 +1841,12 @@ snmp_output_numval(struct snmp_toolinfo *snmptoolctx, 
 
case SNMP_SYNTAX_NULL:
/* NOTREACHED */
-   fprintf(stdout, "agent returned NULL Syntax\n");
+   fprintf(stderr, "agent returned NULL Syntax\n");
return (val->syntax);
 
default:
/* NOTREACHED - If here - then all went completely wrong. */
-   fprintf(stdout, "agent returned unknown syntax\n");
+   fprintf(stderr, "agent returned unknown syntax\n");
return (-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: r363888 - head/sys/netpfil/ipfw/nat64

2020-08-05 Thread Andrey V. Elsukov
Author: ae
Date: Wed Aug  5 09:16:35 2020
New Revision: 363888
URL: https://svnweb.freebsd.org/changeset/base/363888

Log:
  Handle delayed checksums if needed in NAT64.
  
  Upper level protocols defer checksums calculation in hope we have
  checksums offloading in a network card. CSUM_DELAY_DATA flag is used
  to determine that checksum calculation was deferred. And IP output
  routine checks for this flag before pass mbuf to lower layer. Forwarded
  packets have not this flag.
  
  NAT64 uses checksums adjustment when it translates IP headers.
  In most cases NAT64 is used for forwarded packets, but in case when it
  handles locally originated packets we need to finish checksum calculation
  that was deferred to correctly adjust it.
  
  Add check for presence of CSUM_DELAY_DATA flag and finish checksum
  calculation before adjustment.
  
  Reported and tested by:   Evgeniy Khramtsov 
  MFC after:1 week

Modified:
  head/sys/netpfil/ipfw/nat64/nat64_translate.c

Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c
==
--- head/sys/netpfil/ipfw/nat64/nat64_translate.c   Wed Aug  5 08:31:26 
2020(r363887)
+++ head/sys/netpfil/ipfw/nat64/nat64_translate.c   Wed Aug  5 09:16:35 
2020(r363888)
@@ -1294,6 +1294,12 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *s
ip6.ip6_hlim -= IPTTLDEC;
ip6.ip6_plen = htons(plen);
ip6.ip6_nxt = (proto == IPPROTO_ICMP) ? IPPROTO_ICMPV6: proto;
+
+   /* Handle delayed checksums if needed. */
+   if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
+   in_delayed_cksum(m);
+   m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
+   }
/* Convert checksums. */
switch (proto) {
case IPPROTO_TCP:
@@ -1665,6 +1671,12 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui
return (NAT64RETURN);
}
nat64_init_ip4hdr(ip6, frag, plen, proto, );
+
+   /* Handle delayed checksums if needed. */
+   if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
+   in6_delayed_cksum(m, plen, hlen);
+   m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
+   }
/* Convert checksums. */
switch (proto) {
case IPPROTO_TCP:
___
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: r363887 - head/sys/arm/allwinner/clkng

2020-08-05 Thread Emmanuel Vadot
Author: manu
Date: Wed Aug  5 08:31:26 2020
New Revision: 363887
URL: https://svnweb.freebsd.org/changeset/base/363887

Log:
  allwinner: clk: Fix nm clock calculation
  
  Use the right factor when finding the best frequency and compare the
  absolute value of the result.
  
  Submitted by: kibab
  MFC after:3 days

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nm.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nm.cWed Aug  5 07:34:45 2020
(r363886)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.cWed Aug  5 08:31:26 2020
(r363887)
@@ -151,7 +151,7 @@ aw_clk_nm_find_best(struct aw_clk_nm_sc *sc, uint64_t 
min_n = aw_clk_factor_get_min(>n);
 
for (m = min_m; m <= max_m; ) {
-   for (n = min_m; n <= max_n; ) {
+   for (n = min_n; n <= max_n; ) {
cur = fparent / n / m;
if (abs(*fout - cur) < abs(*fout - best)) {
best = cur;
@@ -196,7 +196,7 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare
clknode_get_freq(p_clk, );
 
cur = aw_clk_nm_find_best(sc, fparent, fout, , );
-   if ((*fout - cur) < (*fout - best)) {
+   if (abs((*fout - cur)) < abs((*fout - best))) {
best = cur;
best_parent = p_idx;
best_n = n;
___
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: r363886 - head/sys/security/mac

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 07:34:45 2020
New Revision: 363886
URL: https://svnweb.freebsd.org/changeset/base/363886

Log:
  vfs: add a cheaper entry for mac_vnode_check_access

Modified:
  head/sys/security/mac/mac_framework.c
  head/sys/security/mac/mac_framework.h
  head/sys/security/mac/mac_vfs.c

Modified: head/sys/security/mac/mac_framework.c
==
--- head/sys/security/mac/mac_framework.c   Wed Aug  5 07:33:39 2020
(r363885)
+++ head/sys/security/mac/mac_framework.c   Wed Aug  5 07:34:45 2020
(r363886)
@@ -140,6 +140,7 @@ FPFLAG(vnode_check_write);
 FPFLAG(vnode_check_mmap);
 FPFLAG_RARE(vnode_check_poll);
 FPFLAG_RARE(vnode_check_rename_from);
+FPFLAG_RARE(vnode_check_access);
 
 #undef FPFLAG
 #undef FPFLAG_RARE
@@ -430,6 +431,8 @@ struct mac_policy_fastpath_elem mac_policy_fastpath_ar
.flag = _vnode_check_poll_fp_flag },
{ .offset = FPO(vnode_check_rename_from),
.flag = _vnode_check_rename_from_fp_flag },
+   { .offset = FPO(vnode_check_access),
+   .flag = _vnode_check_access_fp_flag },
 };
 
 static void

Modified: head/sys/security/mac/mac_framework.h
==
--- head/sys/security/mac/mac_framework.h   Wed Aug  5 07:33:39 2020
(r363885)
+++ head/sys/security/mac/mac_framework.h   Wed Aug  5 07:34:45 2020
(r363886)
@@ -406,8 +406,20 @@ void   mac_vnode_assert_locked(struct vnode *vp, const 
c
 
 intmac_vnode_associate_extattr(struct mount *mp, struct vnode *vp);
 void   mac_vnode_associate_singlelabel(struct mount *mp, struct vnode *vp);
-intmac_vnode_check_access(struct ucred *cred, struct vnode *vp,
+intmac_vnode_check_access_impl(struct ucred *cred, struct vnode *dvp,
accmode_t accmode);
+extern bool mac_vnode_check_access_fp_flag;
+#define mac_vnode_check_access_enabled() 
__predict_false(mac_vnode_check_access_fp_flag)
+static inline int
+mac_vnode_check_access(struct ucred *cred, struct vnode *dvp,
+accmode_t accmode)
+{
+
+   mac_vnode_assert_locked(dvp, "mac_vnode_check_access");
+   if (mac_vnode_check_access_enabled())
+return (mac_vnode_check_access_impl(cred, dvp, accmode));
+   return (0);
+}
 intmac_vnode_check_chdir(struct ucred *cred, struct vnode *dvp);
 intmac_vnode_check_chroot(struct ucred *cred, struct vnode *dvp);
 intmac_vnode_check_create(struct ucred *cred, struct vnode *dvp,

Modified: head/sys/security/mac/mac_vfs.c
==
--- head/sys/security/mac/mac_vfs.c Wed Aug  5 07:33:39 2020
(r363885)
+++ head/sys/security/mac/mac_vfs.c Wed Aug  5 07:34:45 2020
(r363886)
@@ -372,7 +372,7 @@ MAC_CHECK_PROBE_DEFINE3(vnode_check_access, "struct uc
 "struct vnode *", "accmode_t");
 
 int
-mac_vnode_check_access(struct ucred *cred, struct vnode *vp, accmode_t accmode)
+mac_vnode_check_access_impl(struct ucred *cred, struct vnode *vp, accmode_t 
accmode)
 {
int error;
 
___
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: r363885 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 07:33:39 2020
New Revision: 363885
URL: https://svnweb.freebsd.org/changeset/base/363885

Log:
  vfs: tidy up namei entry point
  
  - predict for string copy errors
  - reshuffle inititalistion of vars which are not needed

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==
--- head/sys/kern/vfs_lookup.c  Wed Aug  5 07:32:26 2020(r363884)
+++ head/sys/kern/vfs_lookup.c  Wed Aug  5 07:33:39 2020(r363885)
@@ -297,6 +297,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp,
 
startdir_used = false;
*pwdp = NULL;
+   *dpp = NULL;
 
 #ifdef CAPABILITY_MODE
/*
@@ -470,7 +471,6 @@ namei(struct nameidata *ndp)
struct iovec aiov;  /* uio for reading symbolic links */
struct componentname *cnp;
struct thread *td;
-   struct proc *p;
struct pwd *pwd;
struct uio auio;
int error, linklen;
@@ -478,23 +478,19 @@ namei(struct nameidata *ndp)
 
cnp = >ni_cnd;
td = cnp->cn_thread;
-   p = td->td_proc;
ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_thread->td_ucred;
-   KASSERT(cnp->cn_cred && p, ("namei: bad cred/proc"));
+   KASSERT(cnp->cn_cred && td->td_proc, ("namei: bad cred/proc"));
KASSERT((cnp->cn_nameiop & (~OPMASK)) == 0,
("namei: nameiop contaminated with flags"));
KASSERT((cnp->cn_flags & OPMASK) == 0,
("namei: flags contaminated with nameiops"));
MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR ||
ndp->ni_startdir->v_type == VBAD);
-   TAILQ_INIT(>ni_cap_tracker);
-   ndp->ni_lcf = 0;
-   ndp->ni_loopcnt = 0;
-   dp = NULL;
 
/* We will set this ourselves if we need it. */
cnp->cn_flags &= ~TRAILINGSLASH;
 
+   ndp->ni_lcf = 0;
ndp->ni_vp = NULL;
 
/*
@@ -510,17 +506,15 @@ namei(struct nameidata *ndp)
error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN,
>ni_pathlen);
 
-   if (error != 0) {
+   if (__predict_false(error != 0)) {
namei_cleanup_cnp(cnp);
return (error);
}
 
-   cnp->cn_nameptr = cnp->cn_pnbuf;
-
/*
 * Don't allow empty pathnames.
 */
-   if (*cnp->cn_pnbuf == '\0') {
+   if (__predict_false(*cnp->cn_pnbuf == '\0')) {
namei_cleanup_cnp(cnp);
return (ENOENT);
}
@@ -533,6 +527,8 @@ namei(struct nameidata *ndp)
}
 #endif
 
+   cnp->cn_nameptr = cnp->cn_pnbuf;
+
/*
 * First try looking up the target without locking any vnodes.
 *
@@ -546,9 +542,11 @@ namei(struct nameidata *ndp)
case CACHE_FPL_STATUS_HANDLED:
return (error);
case CACHE_FPL_STATUS_PARTIAL:
+   TAILQ_INIT(>ni_cap_tracker);
dp = ndp->ni_startdir;
break;
case CACHE_FPL_STATUS_ABORTED:
+   TAILQ_INIT(>ni_cap_tracker);
error = namei_setup(ndp, , );
if (error != 0) {
namei_cleanup_cnp(cnp);
@@ -556,6 +554,8 @@ namei(struct nameidata *ndp)
}
break;
}
+
+   ndp->ni_loopcnt = 0;
 
/*
 * Locked lookup.
___
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: r363884 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 07:32:26 2020
New Revision: 363884
URL: https://svnweb.freebsd.org/changeset/base/363884

Log:
  cache: cleanup lockless entry point
  
  - remove spurious bzero
  - assert ni_lcf, it has to be set by namei by this point

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 07:30:57 2020(r363883)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 07:32:26 2020(r363884)
@@ -3033,6 +3033,12 @@ cache_fpl_restore(struct cache_fpl *fpl, struct nameid
 #define cache_fpl_smr_assert_not_entered(fpl) do { } while (0)
 #endif
 
+#define cache_fpl_smr_enter_initial(fpl) ({\
+   struct cache_fpl *_fpl = (fpl); \
+   vfs_smr_enter();\
+   _fpl->in_smr = true;\
+})
+
 #define cache_fpl_smr_enter(fpl) ({\
struct cache_fpl *_fpl = (fpl); \
MPASS(_fpl->in_smr == false);   \
@@ -3865,7 +3871,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fp
 
error = CACHE_FPL_FAILED;
ndp = fpl->ndp;
-   ndp->ni_lcf = 0;
cnp = fpl->cnp;
 
cache_fpl_checkpoint(fpl, >snd);
@@ -4055,8 +4060,8 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_s
struct nameidata_saved orig;
int error;
 
-   *status = CACHE_FPL_STATUS_UNSET;
-   bzero(, sizeof(fpl));
+   MPASS(ndp->ni_lcf == 0);
+
fpl.status = CACHE_FPL_STATUS_UNSET;
fpl.ndp = ndp;
fpl.cnp = >ni_cnd;
@@ -4070,7 +4075,7 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_s
 
cache_fpl_checkpoint(, );
 
-   cache_fpl_smr_enter();
+   cache_fpl_smr_enter_initial();
pwd = pwd_get_smr();
fpl.pwd = pwd;
ndp->ni_rootdir = pwd->pwd_rdir;
___
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: r363883 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 07:30:57 2020
New Revision: 363883
URL: https://svnweb.freebsd.org/changeset/base/363883

Log:
  cache: stop messing with cn_lkflags
  
  See r363882.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 07:30:17 2020(r363882)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 07:30:57 2020(r363883)
@@ -3330,14 +3330,17 @@ cache_fplookup_final_child(struct cache_fpl *fpl, enum
struct componentname *cnp;
struct vnode *tvp;
seqc_t tvp_seqc;
-   int error;
+   int error, lkflags;
 
cnp = fpl->cnp;
tvp = fpl->tvp;
tvp_seqc = fpl->tvp_seqc;
 
if ((cnp->cn_flags & LOCKLEAF) != 0) {
-   error = vget_finish(tvp, cnp->cn_lkflags, tvs);
+   lkflags = LK_SHARED;
+   if ((cnp->cn_flags & LOCKSHARED) == 0)
+   lkflags = LK_EXCLUSIVE;
+   error = vget_finish(tvp, lkflags, tvs);
if (error != 0) {
return (cache_fpl_aborted(fpl));
}
@@ -3864,9 +3867,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fp
ndp = fpl->ndp;
ndp->ni_lcf = 0;
cnp = fpl->cnp;
-   cnp->cn_lkflags = LK_SHARED;
-   if ((cnp->cn_flags & LOCKSHARED) == 0)
-   cnp->cn_lkflags = LK_EXCLUSIVE;
 
cache_fpl_checkpoint(fpl, >snd);
 
___
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: r363882 - head/sys/kern

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 07:30:17 2020
New Revision: 363882
URL: https://svnweb.freebsd.org/changeset/base/363882

Log:
  cache: stop messing with cn_flags
  
  This removes flag setting/unsetting carried over from regular lookup.
  Flags still get for compatibility when falling back.
  
  Note .. and . handling can get partially folded together.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug  5 07:28:51 2020(r363881)
+++ head/sys/kern/vfs_cache.c   Wed Aug  5 07:30:17 2020(r363882)
@@ -3098,7 +3098,30 @@ cache_fpl_handled_impl(struct cache_fpl *fpl, int erro
(LOCKLEAF | LOCKPARENT | WANTPARENT | FOLLOW | LOCKSHARED | SAVENAME | \
 ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2)
 
+#define CACHE_FPL_INTERNAL_CN_FLAGS \
+   (ISDOTDOT | MAKEENTRY | ISLASTCN)
+
+_Static_assert((CACHE_FPL_SUPPORTED_CN_FLAGS & CACHE_FPL_INTERNAL_CN_FLAGS) == 
0,
+"supported and internal flags overlap");
+
 static bool
+cache_fpl_islastcn(struct nameidata *ndp)
+{
+
+   return (*ndp->ni_next == 0);
+}
+
+static bool
+cache_fpl_isdotdot(struct componentname *cnp)
+{
+
+   if (cnp->cn_namelen == 2 &&
+   cnp->cn_nameptr[1] == '.' && cnp->cn_nameptr[0] == '.')
+   return (true);
+   return (false);
+}
+
+static bool
 cache_can_fplookup(struct cache_fpl *fpl)
 {
struct nameidata *ndp;
@@ -3253,15 +3276,17 @@ out_abort:
 /*
  * The target vnode is not supported, prepare for the slow path to take over.
  */
-static int
+static int __noinline
 cache_fplookup_partial_setup(struct cache_fpl *fpl)
 {
+   struct nameidata *ndp;
struct componentname *cnp;
enum vgetstate dvs;
struct vnode *dvp;
struct pwd *pwd;
seqc_t dvp_seqc;
 
+   ndp = fpl->ndp;
cnp = fpl->cnp;
dvp = fpl->dvp;
dvp_seqc = fpl->dvp_seqc;
@@ -3287,8 +3312,15 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl)
return (cache_fpl_aborted(fpl));
}
 
-   fpl->ndp->ni_startdir = dvp;
+   cache_fpl_restore(fpl, >snd);
 
+   ndp->ni_startdir = dvp;
+   cnp->cn_flags |= MAKEENTRY;
+   if (cache_fpl_islastcn(ndp))
+   cnp->cn_flags |= ISLASTCN;
+   if (cache_fpl_isdotdot(cnp))
+   cnp->cn_flags |= ISDOTDOT;
+
return (0);
 }
 
@@ -3763,18 +3795,6 @@ cache_fplookup_parse(struct cache_fpl *fpl)
}
ndp->ni_next = cp;
 
-   cnp->cn_flags |= MAKEENTRY;
-
-   if (cnp->cn_namelen == 2 &&
-   cnp->cn_nameptr[1] == '.' && cnp->cn_nameptr[0] == '.')
-   cnp->cn_flags |= ISDOTDOT;
-   else
-   cnp->cn_flags &= ~ISDOTDOT;
-   if (*ndp->ni_next == 0)
-   cnp->cn_flags |= ISLASTCN;
-   else
-   cnp->cn_flags &= ~ISLASTCN;
-
/*
 * Check for degenerate name (e.g. / or "")
 * which is a way of talking about a directory,
@@ -3878,7 +3898,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fp
break;
}
 
-   if (__predict_false(cnp->cn_flags & ISDOTDOT)) {
+   if (__predict_false(cache_fpl_isdotdot(cnp))) {
error = cache_fplookup_dotdot(fpl);
if (__predict_false(error != 0)) {
break;
@@ -3901,7 +3921,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fp
 
VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp);
 
-   if (cnp->cn_flags & ISLASTCN) {
+   if (cache_fpl_islastcn(ndp)) {
error = cache_fplookup_final(fpl);
break;
}
@@ -4082,7 +4102,9 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_s
break;
case CACHE_FPL_STATUS_PARTIAL:
*pwdp = fpl.pwd;
-   cache_fpl_restore(, );
+   /*
+* Status restored by cache_fplookup_partial_setup.
+*/
break;
case CACHE_FPL_STATUS_ABORTED:
cache_fpl_restore(, );
___
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: r363881 - head/sys/sys

2020-08-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug  5 07:28:51 2020
New Revision: 363881
URL: https://svnweb.freebsd.org/changeset/base/363881

Log:
  vfs: prefill nameidata with garbage on debug kernels

Modified:
  head/sys/sys/namei.h

Modified: head/sys/sys/namei.h
==
--- head/sys/sys/namei.hWed Aug  5 05:58:25 2020(r363880)
+++ head/sys/sys/namei.hWed Aug  5 07:28:51 2020(r363881)
@@ -196,11 +196,21 @@ int   cache_fplookup(struct nameidata *ndp, enum 
cache_f
 #defineNDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td)  
\
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, _no_rights, 
td)
 
+/*
+ * Note the constant pattern may *hide* bugs.
+ */
+#ifdef INVARIANTS
+#define NDINIT_PREFILL(arg)memset(arg, 0xff, sizeof(*arg))
+#else
+#define NDINIT_PREFILL(arg)do { } while (0)
+#endif
+
 #define NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, startdir, rightsp, 
td)\
 do {   
\
struct nameidata *_ndp = (ndp); 
\
cap_rights_t *_rightsp = (rightsp); 
\
MPASS(_rightsp != NULL);
\
+   NDINIT_PREFILL(_ndp);   
\
_ndp->ni_cnd.cn_nameiop = op;   
\
_ndp->ni_cnd.cn_flags = flags;  
\
_ndp->ni_segflg = segflg;   
\
___
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"