svn commit: r366782 - head/sys/sys

2020-10-16 Thread Xin LI
Author: delphij
Date: Sat Oct 17 04:14:46 2020
New Revision: 366782
URL: https://svnweb.freebsd.org/changeset/base/366782

Log:
  Bump __FreeBSD_version after ptsname_r addition.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hSat Oct 17 04:14:38 2020(r366781)
+++ head/sys/sys/param.hSat Oct 17 04:14:46 2020(r366782)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300121  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300122  /* 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: r366781 - in head: include lib/libc/stdlib

2020-10-16 Thread Xin LI
Author: delphij
Date: Sat Oct 17 04:14:38 2020
New Revision: 366781
URL: https://svnweb.freebsd.org/changeset/base/366781

Log:
  Implement ptsname_r.
  
  MFC after:2 weeks
  PR:   250062
  Reviewed by:  jilles, 0mp, Ray 
  Differential Revision:https://reviews.freebsd.org/D26647

Modified:
  head/include/stdlib.h
  head/lib/libc/stdlib/Makefile.inc
  head/lib/libc/stdlib/Symbol.map
  head/lib/libc/stdlib/ptsname.3
  head/lib/libc/stdlib/ptsname.c

Modified: head/include/stdlib.h
==
--- head/include/stdlib.h   Sat Oct 17 01:06:04 2020(r366780)
+++ head/include/stdlib.h   Sat Oct 17 04:14:38 2020(r366781)
@@ -225,6 +225,7 @@ long mrand48(void);
 longnrand48(unsigned short[3]);
 int posix_openpt(int);
 char   *ptsname(int);
+int ptsname_r(int, char *, size_t);
 int putenv(char *);
 longrandom(void);
 unsigned short

Modified: head/lib/libc/stdlib/Makefile.inc
==
--- head/lib/libc/stdlib/Makefile.inc   Sat Oct 17 01:06:04 2020
(r366780)
+++ head/lib/libc/stdlib/Makefile.inc   Sat Oct 17 04:14:38 2020
(r366781)
@@ -50,7 +50,7 @@ MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3
 MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3
 MLINKS+=insque.3 remque.3
 MLINKS+=lsearch.3 lfind.3
-MLINKS+=ptsname.3 grantpt.3 ptsname.3 unlockpt.3
+MLINKS+=ptsname.3 grantpt.3 ptsname.3 ptsname_r.3 ptsname.3 unlockpt.3
 MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 qsort.3 qsort_r.3 \
qsort.3 qsort_s.3
 MLINKS+=rand.3 rand_r.3 rand.3 srand.3

Modified: head/lib/libc/stdlib/Symbol.map
==
--- head/lib/libc/stdlib/Symbol.map Sat Oct 17 01:06:04 2020
(r366780)
+++ head/lib/libc/stdlib/Symbol.map Sat Oct 17 04:14:38 2020
(r366781)
@@ -125,6 +125,7 @@ FBSD_1.6 {
qsort_s;
rand;
srand;
+   ptsname_r;
 };
 
 FBSDprivate_1.0 {

Modified: head/lib/libc/stdlib/ptsname.3
==
--- head/lib/libc/stdlib/ptsname.3  Sat Oct 17 01:06:04 2020
(r366780)
+++ head/lib/libc/stdlib/ptsname.3  Sat Oct 17 04:14:38 2020
(r366781)
@@ -31,12 +31,13 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 20, 2008
+.Dd October 17, 2020
 .Dt PTSNAME 3
 .Os
 .Sh NAME
 .Nm grantpt ,
 .Nm ptsname ,
+.Nm ptsname_r ,
 .Nm unlockpt
 .Nd pseudo-terminal access functions
 .Sh LIBRARY
@@ -47,6 +48,8 @@
 .Fn grantpt "int fildes"
 .Ft "char *"
 .Fn ptsname "int fildes"
+.Ft "int"
+.Fn ptsname_r "int fildes" "char *buffer" "size_t buflen"
 .Ft int
 .Fn unlockpt "int fildes"
 .Sh DESCRIPTION
@@ -87,12 +90,23 @@ and
 have been called.
 .Pp
 The
+.Fn ptsname_r
+function is the thread-safe version of
+.Fn ptsname .
+The caller must provide storage for the results of the full pathname of
+the slave device in the
+.Fa buffer
+and
+.Fa bufsize
+arguments.
+.Pp
+The
 .Fn unlockpt
 function clears the lock held on the pseudo-terminal pair
 for the master device specified with
 .Fa fildes .
 .Sh RETURN VALUES
-.Rv -std grantpt unlockpt
+.Rv -std grantpt ptsname_r unlockpt
 .Pp
 The
 .Fn ptsname
@@ -103,7 +117,8 @@ pointer is returned.
 .Sh ERRORS
 The
 .Fn grantpt ,
-.Fn ptsname
+.Fn ptsname ,
+.Fn ptsname_r
 and
 .Fn unlockpt
 functions may fail and set
@@ -116,6 +131,16 @@ is not a valid open file descriptor.
 .It Bq Er EINVAL
 .Fa fildes
 is not a master pseudo-terminal device.
+.El
+.Pp
+In addition, the
+.Fn ptsname_r
+function may set
+.Va errno
+to:
+.Bl -tag -width Er
+.It Bq Er ERANGE
+The buffer was too small.
 .El
 .Pp
 In addition, the

Modified: head/lib/libc/stdlib/ptsname.c
==
--- head/lib/libc/stdlib/ptsname.c  Sat Oct 17 01:06:04 2020
(r366780)
+++ head/lib/libc/stdlib/ptsname.c  Sat Oct 17 04:14:38 2020
(r366781)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include "un-namespace.h"
 
 /*
@@ -71,23 +72,46 @@ __strong_reference(__isptmaster, grantpt);
 __strong_reference(__isptmaster, unlockpt);
 
 /*
- * ptsname():  return the pathname of the slave pseudo-terminal device
- * associated with the specified master.
+ * ptsname_r(): return the pathname of the slave pseudo-terminal device
+ *  associated with the specified master.
  */
-char *
-ptsname(int fildes)
+int
+ptsname_r(int fildes, char *buffer, size_t buflen)
 {
-   static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV;
-   char *ret = NULL;
 
+   if (buflen <= sizeof(_PATH_DEV)) {
+   errno = ERANGE;
+   return (-1);
+   }
+
/* Make sure fildes points to a master device. */
if (__isptmaster(fildes) != 0)

svn commit: r366780 - in head/sys: cddl/contrib/opensolaris/common/unicode contrib/openzfs contrib/openzfs/cmd/arc_summary contrib/openzfs/cmd/dbufstat contrib/openzfs/cmd/zdb contrib/openzfs/cmd/z...

2020-10-16 Thread Matt Macy
Author: mmacy
Date: Sat Oct 17 01:06:04 2020
New Revision: 366780
URL: https://svnweb.freebsd.org/changeset/base/366780

Log:
  Update OpenZFS to 2.0.0-rc3-gfc5966
  
  - fix panic due to tqid overflow
  - Improve libzfs_error_init messages
  - Expose zfetch_max_idistance tunable
  - Make dbufstat work on FreeBSD
  - Fix EIO after resuming receive of new dataset over an existing one

Added:
  head/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/
 - copied from r366775, 
vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/acl/posix-sa/
  
head/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_004_pos.ksh
 - copied unchanged from r366775, 
vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/acl/posix/posix_004_pos.ksh
Deleted:
  head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c
Modified:
  head/sys/contrib/openzfs/CODE_OF_CONDUCT.md
  head/sys/contrib/openzfs/META
  head/sys/contrib/openzfs/README.md
  head/sys/contrib/openzfs/cmd/arc_summary/arc_summary2
  head/sys/contrib/openzfs/cmd/arc_summary/arc_summary3
  head/sys/contrib/openzfs/cmd/dbufstat/dbufstat.in
  head/sys/contrib/openzfs/cmd/zdb/zdb.c
  head/sys/contrib/openzfs/cmd/zdb/zdb_il.c
  head/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c
  head/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c
  head/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c
  head/sys/contrib/openzfs/cmd/zed/zed.c
  head/sys/contrib/openzfs/cmd/zed/zed.h
  head/sys/contrib/openzfs/cmd/zed/zed_conf.c
  head/sys/contrib/openzfs/cmd/zed/zed_conf.h
  head/sys/contrib/openzfs/cmd/zed/zed_event.c
  head/sys/contrib/openzfs/cmd/zed/zed_event.h
  head/sys/contrib/openzfs/cmd/zed/zed_exec.c
  head/sys/contrib/openzfs/cmd/zed/zed_exec.h
  head/sys/contrib/openzfs/cmd/zed/zed_file.c
  head/sys/contrib/openzfs/cmd/zed/zed_file.h
  head/sys/contrib/openzfs/cmd/zed/zed_log.c
  head/sys/contrib/openzfs/cmd/zed/zed_log.h
  head/sys/contrib/openzfs/cmd/zed/zed_strings.c
  head/sys/contrib/openzfs/cmd/zed/zed_strings.h
  head/sys/contrib/openzfs/cmd/zvol_id/Makefile.am
  head/sys/contrib/openzfs/config/kernel-bio.m4
  head/sys/contrib/openzfs/configure.ac
  head/sys/contrib/openzfs/contrib/dracut/90zfs/module-setup.sh.in
  head/sys/contrib/openzfs/contrib/pyzfs/README
  head/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/__init__.py
  head/sys/contrib/openzfs/copy-builtin
  head/sys/contrib/openzfs/etc/init.d/README.md
  head/sys/contrib/openzfs/include/os/freebsd/spl/sys/kstat.h
  head/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h
  head/sys/contrib/openzfs/include/os/freebsd/spl/sys/sunddi.h
  head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_ctldir.h
  head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_dir.h
  head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h
  head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h
  head/sys/contrib/openzfs/include/os/linux/spl/rpc/xdr.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/acl.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/atomic.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/byteorder.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/callb.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/callo.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/cmn_err.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/condvar.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/console.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/cred.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/ctype.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/disp.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/dkio.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/fcntl.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/file.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/inttypes.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/isa_defs.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/kmem.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/kmem_cache.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/kstat.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/list.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/mod_os.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/mutex.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/param.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/proc.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/processor.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/random.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/rwlock.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/shrinker.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/sid.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/signal.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/simd.h
  head/sys/contrib/openzfs/include/os/linux/spl/sys/stat.h
  

svn commit: r366779 - head/contrib/tzdata

2020-10-16 Thread Philip Paeps
Author: philip
Date: Sat Oct 17 00:44:04 2020
New Revision: 366779
URL: https://svnweb.freebsd.org/changeset/base/366779

Log:
  Import tzdata 2020c
  
  Changes: https://github.com/eggert/tz/blob/2020c/NEWS
  
  MFC after:1 day

Modified:
  head/contrib/tzdata/Makefile
  head/contrib/tzdata/NEWS
  head/contrib/tzdata/australasia
  head/contrib/tzdata/europe
  head/contrib/tzdata/version
  head/contrib/tzdata/ziguard.awk
Directory Properties:
  head/contrib/tzdata/   (props changed)

Modified: head/contrib/tzdata/Makefile
==
--- head/contrib/tzdata/MakefileSat Oct 17 00:41:40 2020
(r366778)
+++ head/contrib/tzdata/MakefileSat Oct 17 00:44:04 2020
(r366779)
@@ -1022,10 +1022,14 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-ti
done
sed '1s/$$/-rearguard/' \
  tzdata$(VERSION)-rearguard.dir/version
+   : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
+   touch -md 2020-10-12T22:53:00Z \
+ tzdata$(VERSION)-rearguard.dir/pacificnew
touch -cmr version tzdata$(VERSION)-rearguard.dir/version
LC_ALL=C && export LC_ALL && \
  (cd tzdata$(VERSION)-rearguard.dir && \
-  tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
+  tar $(TARFLAGS) -cf - \
+   $(COMMON) $(DATA) $(MISC) pacificnew | \
 gzip $(GZIPFLAGS)) >$@.out
mv $@.out $@
 

Modified: head/contrib/tzdata/NEWS
==
--- head/contrib/tzdata/NEWSSat Oct 17 00:41:40 2020(r366778)
+++ head/contrib/tzdata/NEWSSat Oct 17 00:44:04 2020(r366779)
@@ -1,5 +1,25 @@
 News for the tz database
 
+Release 2020c - 2020-10-16 11:15:53 -0700
+
+  Briefly:
+Fiji starts DST later than usual, on 2020-12-20.
+
+  Changes to future timestamps
+
+Fiji will start DST on 2020-12-20, instead of 2020-11-08 as
+previously predicted.  DST will still end on 2021-01-17.
+(Thanks to Raymond Kumar and Alan Mintz.)  Assume for now that
+the later-than-usual start date is a one-time departure from the
+recent pattern.
+
+  Changes to build procedure
+
+Rearguard tarballs now contain an empty file pacificnew.
+Some older downstream software expects this file to exist.
+(Problem reported by Mike Cullinan.)
+
+
 Release 2020b - 2020-10-06 18:35:04 -0700
 
   Briefly:

Modified: head/contrib/tzdata/australasia
==
--- head/contrib/tzdata/australasia Sat Oct 17 00:41:40 2020
(r366778)
+++ head/contrib/tzdata/australasia Sat Oct 17 00:44:04 2020
(r366779)
@@ -381,6 +381,19 @@ Zone   Indian/Cocos6:27:40 -   LMT 1900
 # From Michael Deckers (2019-08-06):
 # https://www.laws.gov.fj/LawsAsMade/downloadfile/848
 
+# From Raymond Kumar (2020-10-08):
+# [DST in Fiji] is from December 20th 2020, till 17th January 2021.
+# From Alan Mintz (2020-10-08):
+# https://www.laws.gov.fj/LawsAsMade/GetFile/1071
+# From Tim Parenti (2020-10-08):
+# 
https://www.fijivillage.com/news/Daylight-saving-from-Dec-20th-this-year-to-Jan-17th-2021-8rf4x5/
+# "Minister for Employment, Parveen Bala says they had never thought of
+# stopping daylight saving. He says it was just to decide on when it should
+# start and end.  Bala says it is a short period..."
+# Since the end date is still in line with our ongoing predictions, assume for
+# now that the later-than-usual start date is a one-time departure from the
+# recent second Sunday in November pattern.
+
 # Rule NAMEFROMTO  -   IN  ON  AT  SAVELETTER/S
 Rule   Fiji19981999-   Nov Sun>=1  2:001:00-
 Rule   Fiji19992000-   Feb lastSun 3:000   -
@@ -392,7 +405,9 @@ RuleFiji20122013-   Jan Sun>=18 
3:000   -
 Rule   Fiji2014only-   Jan Sun>=18 2:000   -
 Rule   Fiji20142018-   Nov Sun>=1  2:001:00-
 Rule   Fiji2015max -   Jan Sun>=12 3:000   -
-Rule   Fiji2019max -   Nov Sun>=8  2:001:00-
+Rule   Fiji2019only-   Nov Sun>=8  2:001:00-
+Rule   Fiji2020only-   Dec 20  2:001:00-
+Rule   Fiji2021max -   Nov Sun>=8  2:001:00-
 # Zone NAMESTDOFF  RULES   FORMAT  [UNTIL]
 Zone   Pacific/Fiji11:55:44 -  LMT 1915 Oct 26 # Suva
12:00   Fiji+12/+13

Modified: head/contrib/tzdata/europe
==
--- head/contrib/tzdata/europe  Sat Oct 17 00:41:40 2020

svn commit: r366776 - head/sys/kern

2020-10-16 Thread Mateusz Guzik
Author: mjg
Date: Sat Oct 17 00:27:26 2020
New Revision: 366776
URL: https://svnweb.freebsd.org/changeset/base/366776

Log:
  cache: add a probe reporting addition of duplicate entries

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Sat Oct 17 00:10:13 2020(r366775)
+++ head/sys/kern/vfs_cache.c   Sat Oct 17 00:27:26 2020(r366776)
@@ -82,6 +82,8 @@ __FBSDID("$FreeBSD$");
 SDT_PROVIDER_DECLARE(vfs);
 SDT_PROBE_DEFINE3(vfs, namecache, enter, done, "struct vnode *", "char *",
 "struct vnode *");
+SDT_PROBE_DEFINE3(vfs, namecache, enter, duplicate, "struct vnode *", "char *",
+"struct vnode *");
 SDT_PROBE_DEFINE2(vfs, namecache, enter_negative, done, "struct vnode *",
 "char *");
 SDT_PROBE_DEFINE2(vfs, namecache, fullpath_smr, hit, "struct vnode *",
@@ -2001,6 +2003,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
}
}
 #endif
+   SDT_PROBE3(vfs, namecache, enter, duplicate, dvp, 
ncp->nc_name,
+   vp);
goto out_unlock_free;
}
}
___
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: r366766 - head

2020-10-16 Thread Konstantin Belousov
On Fri, Oct 16, 2020 at 11:53:06AM -0500, Kyle Evans wrote:
> On Fri, Oct 16, 2020 at 11:47 AM John Baldwin  wrote:
> >
> > On 10/16/20 8:16 AM, Kyle Evans wrote:
> > > Author: kevans
> > > Date: Fri Oct 16 15:16:23 2020
> > > New Revision: 366766
> > > URL: https://svnweb.freebsd.org/changeset/base/366766
> > >
> > > Log:
> > >   Makefile: add a small blurb about building with gcc xtoolchain
> > >
> > >   The key details are to install the appropriate flavor of 
> > > devel/freebsd-gcc9
> > >   and pass CROSS_TOOLCHAIN while building.
> > >
> > >   Suggested by:   kib
> > >
> > > Modified:
> > >   head/Makefile
> > >
> > > Modified: head/Makefile
> > > ==
> > > --- head/Makefile Fri Oct 16 14:28:13 2020(r366765)
> > > +++ head/Makefile Fri Oct 16 15:16:23 2020(r366766)
> > > @@ -89,6 +89,15 @@
> > >  # 10.  `reboot'
> > >  # 11.  `make delete-old-libs' (in case no 3rd party program uses them 
> > > anymore)
> > >  #
> > > +# For individuals wanting to build from source with GCC from ports, 
> > > first build
> > > +# or install an appropriate flavor of devel/freebsd-gcc9.  The packages 
> > > produced
> > > +# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all
> > > +# architectures supported by FreeBSD have an external gcc toolchain 
> > > available.
> > > +#
> > > +# Once the appropriate freebsd-gcc package is installed, simply pass
> > > +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above 
> > > steps,
> > > +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`.
> >
> > gcc9 is probably still a bit premature.  'make USE_GCC_TOOLCHAINS=yes 
> > tinderbox'
> > still uses gcc6 as I still have several open reviews for gcc9 fixes, though
> > OpenZFS regressed the build for both gcc6 and gcc9 as Adrian is finding.
> >
> > I think I would also just suggest 'pkg install ${TARGET_ARCH}-gcc6' rather 
> > than
> > building the port.  That is what 'make tinderbox' suggests.
> >
> 
> Sure, I'll wordsmith it again and throw something up for review. The
> key point I want to nail down is the package naming and how to easily
> locate in the ports tree where that's built from in case that becomes
> a relevant detail while you're cross-building.

Yes, please keep a reference to the ports origin, and how to specify flavor,
for those who runs local poudriere.
___
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: r366773 - in head/tests/sys: netinet netinet6

2020-10-16 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri Oct 16 21:51:17 2020
New Revision: 366773
URL: https://svnweb.freebsd.org/changeset/base/366773

Log:
  Try to enable multipath routing in flowid tests.

Modified:
  head/tests/sys/netinet/output.sh
  head/tests/sys/netinet6/output6.sh

Modified: head/tests/sys/netinet/output.sh
==
--- head/tests/sys/netinet/output.shFri Oct 16 20:57:41 2020
(r366772)
+++ head/tests/sys/netinet/output.shFri Oct 16 21:51:17 2020
(r366773)
@@ -223,11 +223,19 @@ output_raw_success_cleanup()
 
 mpath_check()
 {
-   if [ "`sysctl -i -n net.route.multipath`" != 1 ]; then
+   if [ `sysctl -iW net.route.multipath | wc -l` != "1" ]; then
atf_skip "This test requires ROUTE_MPATH enabled"
fi
 }
 
+mpath_enable()
+{
+   jexec $1 sysctl net.route.multipath=1
+   if [ $? != 0 ]; then
+   atf_fail "Setting multipath in jail $1 failed".
+   fi
+}
+
 atf_test_case "output_tcp_flowid_mpath_success" "cleanup"
 output_tcp_flowid_mpath_success_head()
 {
@@ -258,6 +266,7 @@ output_tcp_flowid_mpath_success_body()
lo_dst=$(vnet_mkloopback)
 
vnet_mkjail ${jname}a ${epair0}a ${epair1}a ${lo_src}
+   mpath_enable ${jname}a
# Setup transit IPv4 networks
jexec ${jname}a ifconfig ${epair0}a up
jexec ${jname}a ifconfig ${epair0}a inet 203.0.113.1/30
@@ -386,6 +395,7 @@ output_udp_flowid_mpath_success_body()
lo_dst=$(vnet_mkloopback)
 
vnet_mkjail ${jname}a ${epair0}a ${epair1}a ${lo_src}
+   mpath_enable ${jname}a
# Setup transit IPv4 networks
jexec ${jname}a ifconfig ${epair0}a up
jexec ${jname}a ifconfig ${epair0}a inet 203.0.113.1/30
@@ -509,6 +519,7 @@ output_raw_flowid_mpath_success_body()
lo_dst=$(vnet_mkloopback)
 
vnet_mkjail ${jname}a ${epair0}a ${epair1}a ${lo_src}
+   mpath_enable ${jname}a
# Setup transit IPv4 networks
jexec ${jname}a ifconfig ${epair0}a up
jexec ${jname}a ifconfig ${epair0}a inet 203.0.113.1/30

Modified: head/tests/sys/netinet6/output6.sh
==
--- head/tests/sys/netinet6/output6.sh  Fri Oct 16 20:57:41 2020
(r366772)
+++ head/tests/sys/netinet6/output6.sh  Fri Oct 16 21:51:17 2020
(r366773)
@@ -247,11 +247,20 @@ output6_raw_success_cleanup()
 
 mpath_check()
 {
-   if [ "`sysctl -i -n net.route.multipath`" != 1 ]; then
+   if [ `sysctl -iW net.route.multipath | wc -l` != "1" ]; then
atf_skip "This test requires ROUTE_MPATH enabled"
fi
 }
 
+mpath_enable()
+{
+   jexec $1 sysctl net.route.multipath=1
+   if [ $? != 0 ]; then
+   atf_fail "Setting multipath in jail $1 failed".
+   fi
+}
+
+
 atf_test_case "output6_tcp_flowid_mpath_success" "cleanup"
 output6_tcp_flowid_mpath_success_head()
 {
@@ -282,6 +291,7 @@ output6_tcp_flowid_mpath_success_body()
lo_dst=$(vnet_mkloopback)
 
vnet_mkjail ${jname}a ${epair0}a ${epair1}a ${lo_src}
+   mpath_enable ${jname}a
jls -N
# enable link-local IPv6
jexec ${jname}a ndp -i ${epair0}a -- -disabled
@@ -422,6 +432,7 @@ output6_udp_flowid_mpath_success_body()
lo_dst=$(vnet_mkloopback)
 
vnet_mkjail ${jname}a ${epair0}a ${epair1}a ${lo_src}
+   mpath_enable ${jname}a
jls -N
# enable link-local IPv6
jexec ${jname}a ndp -i ${epair0}a -- -disabled
@@ -559,6 +570,7 @@ output6_raw_flowid_mpath_success_body()
lo_dst=$(vnet_mkloopback)
 
vnet_mkjail ${jname}a ${epair0}a ${epair1}a ${lo_src}
+   mpath_enable ${jname}a
jls -N
# enable link-local IPv6
jexec ${jname}a ndp -i ${epair0}a -- -disabled
___
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: r366771 - head/usr.sbin/bhyve

2020-10-16 Thread Ryan Moeller
Author: freqlabs
Date: Fri Oct 16 20:27:20 2020
New Revision: 366771
URL: https://svnweb.freebsd.org/changeset/base/366771

Log:
  bhyve: Update TX descriptor base address and host mapping on change
  
  bhyve sometimes segfaults when using an e1000 NIC with a Windows guest.
  
  We are only updating our tdba and cached host mapping when the low address
  register is written and when tx is set enabled, but not when the high address
  or length registers are written. It is observed that Windows 10 is 
occasionally
  enabling tx first then writing the registers in the order low, high, len. This
  leaves us with a bogus base address and mapping, which causes a segfault later
  when we try to copy from a descriptor that has unpredictable garbage in a
  pointer.
  
  Updating the address and mapping when any of those registers change seems to 
fix
  that particular issue.
  
  Reviewed by:  mav, grehan (bhyve)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26798

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

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cFri Oct 16 17:51:09 2020
(r366770)
+++ head/usr.sbin/bhyve/pci_e82545.cFri Oct 16 20:27:20 2020
(r366771)
@@ -1701,18 +1701,18 @@ e82545_write_register(struct e82545_softc *sc, uint32_
break;
case E1000_TDBAL(0):
sc->esc_TDBAL = value & ~0xF;
-   if (sc->esc_tx_enabled) {
-   /* Apparently legal */
+   if (sc->esc_tx_enabled)
e82545_tx_update_tdba(sc);
-   }
break;
case E1000_TDBAH(0):
-   //assert(!sc->esc_tx_enabled);  
sc->esc_TDBAH = value;
+   if (sc->esc_tx_enabled)
+   e82545_tx_update_tdba(sc);
break;
case E1000_TDLEN(0):
-   //assert(!sc->esc_tx_enabled);
sc->esc_TDLEN = value & ~0xFFF0007F;
+   if (sc->esc_tx_enabled)
+   e82545_tx_update_tdba(sc);
break;
case E1000_TDH(0):
//assert(!sc->esc_tx_enabled);
___
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: r366770 - head/lib/libc/stdlib

2020-10-16 Thread Kyle Evans
Author: kevans
Date: Fri Oct 16 17:51:09 2020
New Revision: 366770
URL: https://svnweb.freebsd.org/changeset/base/366770

Log:
  libc: typo fix (s/involes/involves)
  
  Reported by:  Masahiko Sawada via twitter
  MFC after:3 days

Modified:
  head/lib/libc/stdlib/bsearch.c

Modified: head/lib/libc/stdlib/bsearch.c
==
--- head/lib/libc/stdlib/bsearch.c  Fri Oct 16 17:03:27 2020
(r366769)
+++ head/lib/libc/stdlib/bsearch.c  Fri Oct 16 17:51:09 2020
(r366770)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
  * is odd, moving left simply involves halving lim: e.g., when lim
  * is 5 we look at item 2, so we change lim to 2 so that we will
  * look at items 0 & 1.  If lim is even, the same applies.  If lim
- * is odd, moving right again involes halving lim, this time moving
+ * is odd, moving right again involves halving lim, this time moving
  * the base up one item past p: e.g., when lim is 5 we change base
  * to item 3 and make lim 2 so that we will look at items 3 and 4.
  * If lim is even, however, we have to shrink it by one before
___
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: r366769 - in head/contrib/lua: . doc src

2020-10-16 Thread Kyle Evans
Author: kevans
Date: Fri Oct 16 17:03:27 2020
New Revision: 366769
URL: https://svnweb.freebsd.org/changeset/base/366769

Log:
  MFC r366760: lua: update to 5.3.6
  
  This release contains some minor bugfixes; notably:
  - 2x minor Makefile fixes (not used in base)
  - Long brackets with a huge number of '=' overflow some internal buffer
arithmetic.
  - Joining an upvalue with itself can cause a use-after-free crash.
  
  See here for examples: http://www.lua.org/bugs.html#5.3.5
  
  MFC after:2 weeks

Modified:
  head/contrib/lua/Makefile
  head/contrib/lua/README
  head/contrib/lua/doc/contents.html
  head/contrib/lua/doc/manual.html
  head/contrib/lua/doc/readme.html
  head/contrib/lua/src/Makefile
  head/contrib/lua/src/lapi.c
  head/contrib/lua/src/lauxlib.c
  head/contrib/lua/src/lcode.c
  head/contrib/lua/src/ldebug.c
  head/contrib/lua/src/liolib.c
  head/contrib/lua/src/llex.c
  head/contrib/lua/src/lobject.c
  head/contrib/lua/src/lparser.c
  head/contrib/lua/src/lua.h
  head/contrib/lua/src/lundump.c
Directory Properties:
  head/contrib/lua/   (props changed)

Modified: head/contrib/lua/Makefile
==
--- head/contrib/lua/Makefile   Fri Oct 16 16:22:32 2020(r366768)
+++ head/contrib/lua/Makefile   Fri Oct 16 17:03:27 2020(r366769)
@@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1
 
 # Lua version and release.
 V= 5.3
-R= $V.4
+R= $V.6
 
 # Targets start here.
 all:   $(PLAT)

Modified: head/contrib/lua/README
==
--- head/contrib/lua/README Fri Oct 16 16:22:32 2020(r366768)
+++ head/contrib/lua/README Fri Oct 16 17:03:27 2020(r366769)
@@ -1,5 +1,5 @@
 
-This is Lua 5.3.5, released on 26 Jun 2018.
+This is Lua 5.3.6, released on 14 Sep 2020.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.

Modified: head/contrib/lua/doc/contents.html
==
--- head/contrib/lua/doc/contents.html  Fri Oct 16 16:22:32 2020
(r366768)
+++ head/contrib/lua/doc/contents.html  Fri Oct 16 17:03:27 2020
(r366769)
@@ -32,7 +32,7 @@ For a complete introduction to Lua programming, see th
 
 
 
-Copyright  20152018 Lua.org, PUC-Rio.
+Copyright  20152020 Lua.org, PUC-Rio.
 Freely available under the terms of the
 http://www.lua.org/license.html;>Lua license.
 
@@ -318,6 +318,37 @@ Freely available under the terms of the
 utf8.len
 utf8.offset
 
+metamethods
+
+__add
+__band
+__bnot
+__bor
+__bxor
+__call
+__concat
+__div
+__eq
+__gc
+__idiv
+__index
+__le
+__len
+__lt
+__metatable
+__mod
+__mode
+__mul
+__name
+__newindex
+__pairs
+__pow
+__shl
+__shr
+__sub
+__tostring
+__unm
+
 environmentvariables
 
 LUA_CPATH
@@ -609,10 +640,10 @@ Freely available under the terms of the
 
 
 Last update:
-Mon Jun 18 22:56:06 -03 2018
+Tue Aug 25 13:45:14 UTC 2020
 
 
 
 

Modified: head/contrib/lua/doc/manual.html
==
--- head/contrib/lua/doc/manual.htmlFri Oct 16 16:22:32 2020
(r366768)
+++ head/contrib/lua/doc/manual.htmlFri Oct 16 17:03:27 2020
(r366769)
@@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo,
 
 
 
-Copyright  20152018 Lua.org, PUC-Rio.
+Copyright  20152020 Lua.org, PUC-Rio.
 Freely available under the terms of the
 http://www.lua.org/license.html;>Lua license.
 
@@ -10972,10 +10972,10 @@ and LiteralString, see 3.1.)
 
 
 Last update:
-Tue Jun 26 13:16:37 -03 2018
+Tue Jul 14 10:32:39 UTC 2020
 
 
 
 

Modified: head/contrib/lua/doc/readme.html
==
--- head/contrib/lua/doc/readme.htmlFri Oct 16 16:22:32 2020
(r366768)
+++ head/contrib/lua/doc/readme.htmlFri Oct 16 17:03:27 2020
(r366769)
@@ -107,7 +107,7 @@ Here are the details.
 
 
 Open a terminal window and move to
-the top-level directory, which is named lua-5.3.5.
+the top-level directory, which is named lua-5.3.6.
 The Makefile there controls both the build process and the 
installation process.
 
 
@@ -328,7 +328,7 @@ For details, see
 http://www.lua.org/license.html;>this.
 
 
-Copyright  19942017 Lua.org, PUC-Rio.
+Copyright  19942020 Lua.org, PUC-Rio.
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -355,10 +355,10 @@ THE SOFTWARE.
 
 
 Last update:
-Mon Jun 18 22:57:33 -03 2018
+Tue Jul 14 10:33:01 UTC 2020
 
 
 
 

Modified: head/contrib/lua/src/Makefile
==
--- head/contrib/lua/src/Makefile   Fri Oct 16 16:22:32 2020
(r366768)
+++ head/contrib/lua/src/Makefile   Fri Oct 16 17:03:27 2020
(r366769)
@@ -102,7 +102,7 @@ c89:
 
 
 freebsd:
-   $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX 

Re: svn commit: r366766 - head

2020-10-16 Thread Kyle Evans
On Fri, Oct 16, 2020 at 11:47 AM John Baldwin  wrote:
>
> On 10/16/20 8:16 AM, Kyle Evans wrote:
> > Author: kevans
> > Date: Fri Oct 16 15:16:23 2020
> > New Revision: 366766
> > URL: https://svnweb.freebsd.org/changeset/base/366766
> >
> > Log:
> >   Makefile: add a small blurb about building with gcc xtoolchain
> >
> >   The key details are to install the appropriate flavor of 
> > devel/freebsd-gcc9
> >   and pass CROSS_TOOLCHAIN while building.
> >
> >   Suggested by:   kib
> >
> > Modified:
> >   head/Makefile
> >
> > Modified: head/Makefile
> > ==
> > --- head/Makefile Fri Oct 16 14:28:13 2020(r366765)
> > +++ head/Makefile Fri Oct 16 15:16:23 2020(r366766)
> > @@ -89,6 +89,15 @@
> >  # 10.  `reboot'
> >  # 11.  `make delete-old-libs' (in case no 3rd party program uses them 
> > anymore)
> >  #
> > +# For individuals wanting to build from source with GCC from ports, first 
> > build
> > +# or install an appropriate flavor of devel/freebsd-gcc9.  The packages 
> > produced
> > +# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all
> > +# architectures supported by FreeBSD have an external gcc toolchain 
> > available.
> > +#
> > +# Once the appropriate freebsd-gcc package is installed, simply pass
> > +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps,
> > +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`.
>
> gcc9 is probably still a bit premature.  'make USE_GCC_TOOLCHAINS=yes 
> tinderbox'
> still uses gcc6 as I still have several open reviews for gcc9 fixes, though
> OpenZFS regressed the build for both gcc6 and gcc9 as Adrian is finding.
>
> I think I would also just suggest 'pkg install ${TARGET_ARCH}-gcc6' rather 
> than
> building the port.  That is what 'make tinderbox' suggests.
>

Sure, I'll wordsmith it again and throw something up for review. The
key point I want to nail down is the package naming and how to easily
locate in the ports tree where that's built from in case that becomes
a relevant detail while you're cross-building.
___
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: r366766 - head

2020-10-16 Thread John Baldwin
On 10/16/20 8:16 AM, Kyle Evans wrote:
> Author: kevans
> Date: Fri Oct 16 15:16:23 2020
> New Revision: 366766
> URL: https://svnweb.freebsd.org/changeset/base/366766
> 
> Log:
>   Makefile: add a small blurb about building with gcc xtoolchain
>   
>   The key details are to install the appropriate flavor of devel/freebsd-gcc9
>   and pass CROSS_TOOLCHAIN while building.
>   
>   Suggested by:   kib
> 
> Modified:
>   head/Makefile
> 
> Modified: head/Makefile
> ==
> --- head/Makefile Fri Oct 16 14:28:13 2020(r366765)
> +++ head/Makefile Fri Oct 16 15:16:23 2020(r366766)
> @@ -89,6 +89,15 @@
>  # 10.  `reboot'
>  # 11.  `make delete-old-libs' (in case no 3rd party program uses them 
> anymore)
>  #
> +# For individuals wanting to build from source with GCC from ports, first 
> build
> +# or install an appropriate flavor of devel/freebsd-gcc9.  The packages 
> produced
> +# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all
> +# architectures supported by FreeBSD have an external gcc toolchain 
> available.
> +#
> +# Once the appropriate freebsd-gcc package is installed, simply pass
> +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps,
> +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`.

gcc9 is probably still a bit premature.  'make USE_GCC_TOOLCHAINS=yes tinderbox'
still uses gcc6 as I still have several open reviews for gcc9 fixes, though
OpenZFS regressed the build for both gcc6 and gcc9 as Adrian is finding.

I think I would also just suggest 'pkg install ${TARGET_ARCH}-gcc6' rather than
building the port.  That is what 'make tinderbox' suggests.

-- 
John Baldwin
___
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: r366768 - head/sys/amd64/include

2020-10-16 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 16 16:22:32 2020
New Revision: 366768
URL: https://svnweb.freebsd.org/changeset/base/366768

Log:
  amd64 pmap.h: explicitly provide constants values instead of relying
  on some more advanced C features.
  
  This fixes gcc-toolchain build of exception.S.
  
  Reported and tested by:   kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/include/pmap.h

Modified: head/sys/amd64/include/pmap.h
==
--- head/sys/amd64/include/pmap.h   Fri Oct 16 15:55:06 2020
(r366767)
+++ head/sys/amd64/include/pmap.h   Fri Oct 16 16:22:32 2020
(r366768)
@@ -259,8 +259,8 @@
 #definePMAP_PCID_OVERMAX_KERN  0x800
 #definePMAP_PCID_USER_PT   0x800
 
-#definePMAP_NO_CR3 (~0UL)
-#definePMAP_UCR3_NOMASK(~0UL)
+#definePMAP_NO_CR3 0x
+#definePMAP_UCR3_NOMASK0x
 
 #ifndef LOCORE
 
___
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: r366766 - head

2020-10-16 Thread Mark Linimon
On Fri, Oct 16, 2020 at 04:36:05PM +0100, Jessica Clarke wrote:
> Given GCC 10 is the latest GCC release so this is already a bit
> outdated (though perhaps GCC 9 is still the recommended version for
> FreeBSD now?)

In possibly unrelated news, there are still about 25 ports which do
not build on GCC 10 but do on GCC 9.  Almost all of them involve
fortran.  Because of this, ports GCC still defaults to 9.  We are
actively working on this:

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

mcl
___
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: r366767 - in head: share/man/man4 sys/dev/arcmsr

2020-10-16 Thread Xin LI
Author: delphij
Date: Fri Oct 16 15:55:06 2020
New Revision: 366767
URL: https://svnweb.freebsd.org/changeset/base/366767

Log:
  Update arcmsr(4) to 1.50.00.00:
  
  Add support for ARC-1886, NVMe/SAS/SATA controller.
  
  Many thanks to Areca for continuing to support FreeBSD.
  
  Submitted by:   黃清隆 
  MFC after:  2 weeks

Modified:
  head/share/man/man4/arcmsr.4
  head/sys/dev/arcmsr/arcmsr.c
  head/sys/dev/arcmsr/arcmsr.h

Modified: head/share/man/man4/arcmsr.4
==
--- head/share/man/man4/arcmsr.4Fri Oct 16 15:16:23 2020
(r366766)
+++ head/share/man/man4/arcmsr.4Fri Oct 16 15:55:06 2020
(r366767)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 8, 2017
+.Dd October 15, 2020
 .Dt ARCMSR 4
 .Os
 .Sh NAME
@@ -153,6 +153,8 @@ ARC-1882
 ARC-1883
 .It
 ARC-1884
+.It
+ARC-1886
 .El
 .Sh FILES
 .Bl -tag -width ".Pa /dev/arcmsr?" -compact

Modified: head/sys/dev/arcmsr/arcmsr.c
==
--- head/sys/dev/arcmsr/arcmsr.cFri Oct 16 15:16:23 2020
(r366766)
+++ head/sys/dev/arcmsr/arcmsr.cFri Oct 16 15:55:06 2020
(r366767)
@@ -81,6 +81,7 @@
 ** 1.30.00.00   11/30/2015  Ching Huang Added support ARC1203
 ** 1.40.00.00   07/11/2017  Ching Huang Added support ARC1884
 ** 1.40.00.01   10/30/2017  Ching Huang Fixed release memory resource
+** 1.50.00.00   09/30/2020  Ching Huang Added support ARC-1886, 
NVMe/SAS/SATA controller
 
**
 */
 
@@ -138,7 +139,7 @@ __FBSDID("$FreeBSD$");
 
 #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1);
 
-#define ARCMSR_DRIVER_VERSION  "arcmsr version 1.40.00.01 2017-10-30"
+#define ARCMSR_DRIVER_VERSION  "arcmsr version 1.50.00.00 2020-09-30"
 #include 
 /*
 **
@@ -176,6 +177,7 @@ static void arcmsr_polling_devmap(void *arg);
 static void arcmsr_srb_timeout(void *arg);
 static void arcmsr_hbd_postqueue_isr(struct AdapterControlBlock *acb);
 static void arcmsr_hbe_postqueue_isr(struct AdapterControlBlock *acb);
+static void arcmsr_hbf_postqueue_isr(struct AdapterControlBlock *acb);
 static void arcmsr_teardown_intr(device_t dev, struct AdapterControlBlock 
*acb);
 #ifdef ARCMSR_DEBUG1
 static void arcmsr_dump_data(struct AdapterControlBlock *acb);
@@ -294,19 +296,20 @@ static u_int32_t arcmsr_disable_allintr( struct Adapte
break;
case ACB_ADAPTER_TYPE_C: {
/* disable all outbound interrupt */
-   intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, 
host_int_mask); /* disable outbound message0 int */
+   intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, 
host_int_mask); /* disable outbound message0 int */
CHIP_REG_WRITE32(HBC_MessageUnit, 0, host_int_mask, 
intmask_org|ARCMSR_HBCMU_ALL_INTMASKENABLE);
}
break;
case ACB_ADAPTER_TYPE_D: {
/* disable all outbound interrupt */
-   intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, 
pcief0_int_enable); /* disable outbound message0 int */
+   intmask_org = CHIP_REG_READ32(HBD_MessageUnit, 0, 
pcief0_int_enable); /* disable outbound message0 int */
CHIP_REG_WRITE32(HBD_MessageUnit, 0, pcief0_int_enable, 
ARCMSR_HBDMU_ALL_INT_DISABLE);
}
break;
-   case ACB_ADAPTER_TYPE_E: {
+   case ACB_ADAPTER_TYPE_E:
+   case ACB_ADAPTER_TYPE_F: {
/* disable all outbound interrupt */
-   intmask_org = CHIP_REG_READ32(HBC_MessageUnit, 0, 
host_int_mask); /* disable outbound message0 int */
+   intmask_org = CHIP_REG_READ32(HBE_MessageUnit, 0, 
host_int_mask); /* disable outbound message0 int */
CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, 
intmask_org | ARCMSR_HBEMU_ALL_INTMASKENABLE);
}
break;
@@ -352,7 +355,8 @@ static void arcmsr_enable_allintr( struct AdapterContr
acb->outbound_int_enable = mask;
}
break;
-   case ACB_ADAPTER_TYPE_E: {
+   case ACB_ADAPTER_TYPE_E:
+   case ACB_ADAPTER_TYPE_F: {
/* enable outbound Post Queue, outbound doorbell 
Interrupt */
mask = ~(ARCMSR_HBEMU_OUTBOUND_DOORBELL_ISR | 
ARCMSR_HBEMU_OUTBOUND_POSTQUEUE_ISR);
CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_mask, 
intmask_org & mask);
@@ -577,7 +581,8 @@ static void arcmsr_flush_adapter_cache(struct AdapterC
arcmsr_flush_hbd_cache(acb);
}
break;
-   case 

Re: svn commit: r366766 - head

2020-10-16 Thread Kyle Evans
On Fri, Oct 16, 2020 at 10:36 AM Jessica Clarke  wrote:
>
> On 16 Oct 2020, at 16:16, Kyle Evans  wrote:
> >
> > Author: kevans
> > Date: Fri Oct 16 15:16:23 2020
> > New Revision: 366766
> > URL: https://svnweb.freebsd.org/changeset/base/366766
> >
> > Log:
> >  Makefile: add a small blurb about building with gcc xtoolchain
> >
> >  The key details are to install the appropriate flavor of devel/freebsd-gcc9
> >  and pass CROSS_TOOLCHAIN while building.
> >
> >  Suggested by:kib
> >
> > Modified:
> >  head/Makefile
> >
> > Modified: head/Makefile
> > ==
> > --- head/Makefile Fri Oct 16 14:28:13 2020(r366765)
> > +++ head/Makefile Fri Oct 16 15:16:23 2020(r366766)
> > @@ -89,6 +89,15 @@
> > # 10.  `reboot'
> > # 11.  `make delete-old-libs' (in case no 3rd party program uses them 
> > anymore)
> > #
> > +# For individuals wanting to build from source with GCC from ports, first 
> > build
> > +# or install an appropriate flavor of devel/freebsd-gcc9.  The packages 
> > produced
> > +# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all
> > +# architectures supported by FreeBSD have an external gcc toolchain 
> > available.
> > +#
> > +# Once the appropriate freebsd-gcc package is installed, simply pass
> > +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps,
> > +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`.
>
> Given GCC 10 is the latest GCC release so this is already a bit
> outdated (though perhaps GCC 9 is still the recommended version for
> FreeBSD now?), should this not avoid hard-coding a specific version and
> thus s/9/N/ (or X)?
>

Probably so, yes -- freebsd-gcc9 is still the latest and greatest as
far as cross-toolchain gcc goes, though. We still have freebsd-gcc6,
too, so at the very least once we drop freebsd-gcc6 and create
freebsd-gcc10 I'll revisit this and find some way to make it more
generic while still easy to find the port/pkg you need.
___
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: r366766 - head

2020-10-16 Thread Jessica Clarke
On 16 Oct 2020, at 16:16, Kyle Evans  wrote:
> 
> Author: kevans
> Date: Fri Oct 16 15:16:23 2020
> New Revision: 366766
> URL: https://svnweb.freebsd.org/changeset/base/366766
> 
> Log:
>  Makefile: add a small blurb about building with gcc xtoolchain
> 
>  The key details are to install the appropriate flavor of devel/freebsd-gcc9
>  and pass CROSS_TOOLCHAIN while building.
> 
>  Suggested by:kib
> 
> Modified:
>  head/Makefile
> 
> Modified: head/Makefile
> ==
> --- head/Makefile Fri Oct 16 14:28:13 2020(r366765)
> +++ head/Makefile Fri Oct 16 15:16:23 2020(r366766)
> @@ -89,6 +89,15 @@
> # 10.  `reboot'
> # 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
> #
> +# For individuals wanting to build from source with GCC from ports, first 
> build
> +# or install an appropriate flavor of devel/freebsd-gcc9.  The packages 
> produced
> +# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all
> +# architectures supported by FreeBSD have an external gcc toolchain 
> available.
> +#
> +# Once the appropriate freebsd-gcc package is installed, simply pass
> +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps,
> +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`.

Given GCC 10 is the latest GCC release so this is already a bit
outdated (though perhaps GCC 9 is still the recommended version for
FreeBSD now?), should this not avoid hard-coding a specific version and
thus s/9/N/ (or X)?

Jess

___
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: r366766 - head

2020-10-16 Thread Kyle Evans
Author: kevans
Date: Fri Oct 16 15:16:23 2020
New Revision: 366766
URL: https://svnweb.freebsd.org/changeset/base/366766

Log:
  Makefile: add a small blurb about building with gcc xtoolchain
  
  The key details are to install the appropriate flavor of devel/freebsd-gcc9
  and pass CROSS_TOOLCHAIN while building.
  
  Suggested by: kib

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Fri Oct 16 14:28:13 2020(r366765)
+++ head/Makefile   Fri Oct 16 15:16:23 2020(r366766)
@@ -89,6 +89,15 @@
 # 10.  `reboot'
 # 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
 #
+# For individuals wanting to build from source with GCC from ports, first build
+# or install an appropriate flavor of devel/freebsd-gcc9.  The packages 
produced
+# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all
+# architectures supported by FreeBSD have an external gcc toolchain available.
+#
+# Once the appropriate freebsd-gcc package is installed, simply pass
+# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps,
+# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`.
+#
 # See src/UPDATING `COMMON ITEMS' for more complete information.
 #
 # If TARGET=machine (e.g. powerpc, arm64, ...) is specified you can
___
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: r366765 - head/contrib/libgnuregex

2020-10-16 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 16 14:28:13 2020
New Revision: 366765
URL: https://svnweb.freebsd.org/changeset/base/366765

Log:
   This fixes some fun type size truncation that shows up giving errors like
  " changes value from '287948901175001088' to '0' "
  
  .. which turns out is a known issue with later gcc's.
  
  eg - https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html
  
  It was fixed up upstream corelib/gnulib in commit hash
  252b52457da7887667c036d18cc5169777615bb0
  (eg in 
https://github.com/coreutils/gnulib/commit/252b52457da7887667c036d18cc5169777615bb0)
  
  TEST PLAN
- compiled/run for gcc-6.4 on amd64
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26804

Modified:
  head/contrib/libgnuregex/regcomp.c

Modified: head/contrib/libgnuregex/regcomp.c
==
--- head/contrib/libgnuregex/regcomp.c  Fri Oct 16 13:37:58 2020
(r366764)
+++ head/contrib/libgnuregex/regcomp.c  Fri Oct 16 14:28:13 2020
(r366765)
@@ -930,26 +930,30 @@ init_word_char (re_dfa_t *dfa)
   int ch = 0;
   if (BE (dfa->map_notascii == 0, 1))
 {
-  if (sizeof (dfa->word_char[0]) == 8)
+  /* Avoid uint32_t and uint64_t as some non-GCC platforms lack
+them, an issue when this code is used in Gnulib.  */
+  bitset_word_t bits0 = 0x;
+  bitset_word_t bits1 = 0x03ff;
+  bitset_word_t bits2 = 0x87fe;
+  bitset_word_t bits3 = 0x07fe;
+
+  if (BITSET_WORD_BITS == 64)
{
-  /* The extra temporaries here avoid "implicitly truncated"
- warnings in the case when this is dead code, i.e. 32-bit.  */
-  const uint64_t wc0 = UINT64_C (0x03ff);
-  const uint64_t wc1 = UINT64_C (0x07fe87fe);
- dfa->word_char[0] = wc0;
- dfa->word_char[1] = wc1;
+  /* Pacify gcc -Woverflow on 32-bit platformns.  */
+  dfa->word_char[0] = bits1 << 31 << 1 | bits0;
+  dfa->word_char[1] = bits3 << 31 << 1 | bits2;
  i = 2;
}
-  else if (sizeof (dfa->word_char[0]) == 4)
+  else if (BITSET_WORD_BITS == 32)
{
- dfa->word_char[0] = UINT32_C (0x);
- dfa->word_char[1] = UINT32_C (0x03ff);
- dfa->word_char[2] = UINT32_C (0x87fe);
- dfa->word_char[3] = UINT32_C (0x07fe);
+  dfa->word_char[0] = bits0;
+  dfa->word_char[1] = bits1;
+  dfa->word_char[2] = bits2;
+  dfa->word_char[3] = bits3;
  i = 4;
}
   else
-   abort ();
+   goto general_case;
   ch = 128;
 
   if (BE (dfa->is_utf8, 1))
@@ -959,6 +963,7 @@ init_word_char (re_dfa_t *dfa)
}
 }
 
+general_case:
   for (; i < BITSET_WORDS; ++i)
 for (int j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
   if (isalnum (ch) || ch == '_')
___
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: r366764 - head/sys/arm64/arm64

2020-10-16 Thread Mitchell Horne
Author: mhorne
Date: Fri Oct 16 13:37:58 2020
New Revision: 366764
URL: https://svnweb.freebsd.org/changeset/base/366764

Log:
  arm64: export a few more HWCAPs
  
  These were missed in the previous pass. The extensions (partially)
  supported by this change are:
   - ARMv8.2-FHM, Floating-point multiplication variant
   - ARMv8.4-LSE, Large System Extensions
   - ARMv8.4-DIT, Data Independent Timing instructions
  
  Reviewed by:  andrew, markj
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26707

Modified:
  head/sys/arm64/arm64/identcpu.c

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Fri Oct 16 13:35:29 2020
(r366763)
+++ head/sys/arm64/arm64/identcpu.c Fri Oct 16 13:37:58 2020
(r366764)
@@ -883,7 +883,7 @@ static struct mrs_field_value id_aa64pfr0_el0[] = {
 static struct mrs_field id_aa64pfr0_fields[] = {
MRS_FIELD(ID_AA64PFR0, CSV3, false, MRS_EXACT, id_aa64pfr0_csv3),
MRS_FIELD(ID_AA64PFR0, CSV2, false, MRS_EXACT, id_aa64pfr0_csv2),
-   MRS_FIELD(ID_AA64PFR0, DIT, false, MRS_EXACT, id_aa64pfr0_dit),
+   MRS_FIELD(ID_AA64PFR0, DIT, false, MRS_LOWER, id_aa64pfr0_dit),
MRS_FIELD(ID_AA64PFR0, AMU, false, MRS_EXACT, id_aa64pfr0_amu),
MRS_FIELD(ID_AA64PFR0, MPAM, false, MRS_EXACT, id_aa64pfr0_mpam),
MRS_FIELD(ID_AA64PFR0, SEL2, false, MRS_EXACT, id_aa64pfr0_sel2),
@@ -1257,6 +1257,10 @@ parse_cpu_features_hwcap(void)
break;
}
 
+   if (ID_AA64ISAR0_FHM_VAL(user_cpu_desc.id_aa64isar0) ==
+   ID_AA64ISAR0_FHM_IMPL)
+   hwcap |= HWCAP_ASIMDFHM;
+
if (ID_AA64ISAR0_DP_VAL(user_cpu_desc.id_aa64isar0) ==
ID_AA64ISAR0_DP_IMPL)
hwcap |= HWCAP_ASIMDDP;
@@ -1337,6 +1341,14 @@ parse_cpu_features_hwcap(void)
if (ID_AA64ISAR1_DPB_VAL(user_cpu_desc.id_aa64isar1) ==
ID_AA64ISAR1_DPB_DCCVAP)
hwcap |= HWCAP_DCPOP;
+
+   if (ID_AA64MMFR2_AT_VAL(user_cpu_desc.id_aa64mmfr2) ==
+   ID_AA64MMFR2_AT_IMPL)
+   hwcap |= HWCAP_USCAT;
+
+   if (ID_AA64PFR0_DIT_VAL(user_cpu_desc.id_aa64pfr0) ==
+   ID_AA64PFR0_DIT_PSTATE)
+   hwcap |= HWCAP_DIT;
 
if (ID_AA64PFR0_SVE_VAL(user_cpu_desc.id_aa64pfr0) ==
ID_AA64PFR0_SVE_IMPL)
___
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: r366763 - in head/sys/arm64: arm64 include

2020-10-16 Thread Mitchell Horne
Author: mhorne
Date: Fri Oct 16 13:35:29 2020
New Revision: 366763
URL: https://svnweb.freebsd.org/changeset/base/366763

Log:
  Update the ID_AA64MMFR2_EL1 register definitions
  
  This brings these definitions in sync with the ARMv8.6 version of the
  architecture reference manual.
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26706

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Fri Oct 16 13:34:56 2020
(r366762)
+++ head/sys/arm64/arm64/identcpu.c Fri Oct 16 13:35:29 2020
(r366763)
@@ -690,6 +690,50 @@ static struct mrs_field id_aa64mmfr1_fields[] = {
 
 
 /* ID_AA64MMFR2_EL1 */
+static struct mrs_field_value id_aa64mmfr2_e0pd[] = {
+   MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, E0PD, NONE, IMPL),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_evt[] = {
+   MRS_FIELD_VALUE(ID_AA64MMFR2_EVT_NONE, ""),
+   MRS_FIELD_VALUE(ID_AA64MMFR2_EVT_8_2, "EVT-8.2"),
+   MRS_FIELD_VALUE(ID_AA64MMFR2_EVT_8_5, "EVT-8.5"),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_bbm[] = {
+   MRS_FIELD_VALUE(ID_AA64MMFR2_BBM_LEVEL0, ""),
+   MRS_FIELD_VALUE(ID_AA64MMFR2_BBM_LEVEL1, "BBM level 1"),
+   MRS_FIELD_VALUE(ID_AA64MMFR2_BBM_LEVEL2, "BBM level 2"),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_ttl[] = {
+   MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, TTL, NONE, IMPL),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_fwb[] = {
+   MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, FWB, NONE, IMPL),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_ids[] = {
+   MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, IDS, NONE, IMPL),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_at[] = {
+   MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, AT, NONE, IMPL),
+   MRS_FIELD_VALUE_END,
+};
+
+static struct mrs_field_value id_aa64mmfr2_st[] = {
+   MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, ST, NONE, IMPL),
+   MRS_FIELD_VALUE_END,
+};
+
 static struct mrs_field_value id_aa64mmfr2_nv[] = {
MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, IMPL),
MRS_FIELD_VALUE_END,
@@ -728,6 +772,14 @@ static struct mrs_field_value id_aa64mmfr2_cnp[] = {
 };
 
 static struct mrs_field id_aa64mmfr2_fields[] = {
+   MRS_FIELD(ID_AA64MMFR2, E0PD, false, MRS_EXACT, id_aa64mmfr2_e0pd),
+   MRS_FIELD(ID_AA64MMFR2, EVT, false, MRS_EXACT, id_aa64mmfr2_evt),
+   MRS_FIELD(ID_AA64MMFR2, BBM, false, MRS_EXACT, id_aa64mmfr2_bbm),
+   MRS_FIELD(ID_AA64MMFR2, TTL, false, MRS_EXACT, id_aa64mmfr2_ttl),
+   MRS_FIELD(ID_AA64MMFR2, FWB, false, MRS_EXACT, id_aa64mmfr2_fwb),
+   MRS_FIELD(ID_AA64MMFR2, IDS, false, MRS_EXACT, id_aa64mmfr2_ids),
+   MRS_FIELD(ID_AA64MMFR2, AT, false, MRS_LOWER, id_aa64mmfr2_at),
+   MRS_FIELD(ID_AA64MMFR2, ST, false, MRS_EXACT, id_aa64mmfr2_st),
MRS_FIELD(ID_AA64MMFR2, NV, false, MRS_EXACT, id_aa64mmfr2_nv),
MRS_FIELD(ID_AA64MMFR2, CCIDX, false, MRS_EXACT, id_aa64mmfr2_ccidx),
MRS_FIELD(ID_AA64MMFR2, VARange, false, MRS_EXACT,

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Fri Oct 16 13:34:56 2020
(r366762)
+++ head/sys/arm64/include/armreg.h Fri Oct 16 13:35:29 2020
(r366763)
@@ -578,6 +578,48 @@
 #defineID_AA64MMFR2_NV_VAL(x)  ((x) & ID_AA64MMFR2_NV_MASK)
 #define ID_AA64MMFR2_NV_NONE   (UL(0x0) << 
ID_AA64MMFR2_NV_SHIFT)
 #define ID_AA64MMFR2_NV_IMPL   (UL(0x1) << 
ID_AA64MMFR2_NV_SHIFT)
+#defineID_AA64MMFR2_ST_SHIFT   28
+#defineID_AA64MMFR2_ST_MASK(UL(0xf) << 
ID_AA64MMFR2_ST_SHIFT)
+#defineID_AA64MMFR2_ST_VAL(x)  ((x) & ID_AA64MMFR2_ST_MASK)
+#define ID_AA64MMFR2_ST_NONE   (UL(0x0) << 
ID_AA64MMFR2_ST_SHIFT)
+#define ID_AA64MMFR2_ST_IMPL   (UL(0x1) << 
ID_AA64MMFR2_ST_SHIFT)
+#defineID_AA64MMFR2_AT_SHIFT   32
+#defineID_AA64MMFR2_AT_MASK(UL(0xf) << 
ID_AA64MMFR2_AT_SHIFT)
+#defineID_AA64MMFR2_AT_VAL(x)  ((x) & ID_AA64MMFR2_AT_MASK)
+#define ID_AA64MMFR2_AT_NONE   (UL(0x0) << 
ID_AA64MMFR2_AT_SHIFT)
+#define ID_AA64MMFR2_AT_IMPL   (UL(0x1) << 
ID_AA64MMFR2_AT_SHIFT)
+#defineID_AA64MMFR2_IDS_SHIFT  36
+#defineID_AA64MMFR2_IDS_MASK   (UL(0xf) << 
ID_AA64MMFR2_IDS_SHIFT)
+#defineID_AA64MMFR2_IDS_VAL(x) ((x) & ID_AA64MMFR2_IDS_MASK)
+#define ID_AA64MMFR2_IDS_NONE  (UL(0x0) << 

svn commit: r366759 - head/sys/netipsec

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:27:01 2020
New Revision: 366759
URL: https://svnweb.freebsd.org/changeset/base/366759

Log:
  Trigger soft lifetime expiration on sequence number
  
  This patch adds 80% of UINT32_MAX limit on sequence number.
  When sequence number reaches limit kernel sends SADB_EXPIRE message to
  IKE daemon which is responsible to perform rekeying.
  
  Submitted by:   Patryk Duda 
  Reviewed by:ae
  Differential revision:  https://reviews.freebsd.org/D22370
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==
--- head/sys/netipsec/key.c Fri Oct 16 11:25:45 2020(r366758)
+++ head/sys/netipsec/key.c Fri Oct 16 11:27:01 2020(r366759)
@@ -101,6 +101,7 @@
 #define FULLMASK   0xff
 #define_BITS(bytes)((bytes) << 3)
 
+#defineUINT32_80PCT0x
 /*
  * Note on SA reference counting:
  * - SAs that are not in DEAD state will have (total external reference + 1)
@@ -4536,7 +4537,11 @@ key_flush_sad(time_t now)
(sav->lft_s->usetime != 0 && sav->firstused &&
now - sav->firstused > sav->lft_s->usetime) ||
(sav->lft_s->bytes != 0 && counter_u64_fetch(
-   sav->lft_c_bytes) > sav->lft_s->bytes))) {
+   sav->lft_c_bytes) > sav->lft_s->bytes) ||
+   (!(sav->flags & SADB_X_SAFLAGS_ESN) &&
+   (sav->replay != NULL) && (
+   (sav->replay->count > UINT32_80PCT) ||
+   (sav->replay->last > UINT32_80PCT) {
SECASVAR_UNLOCK(sav);
SAV_ADDREF(sav);
LIST_INSERT_HEAD(, sav, drainq);
___
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: r366758 - head/sys/netipsec

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:25:45 2020
New Revision: 366758
URL: https://svnweb.freebsd.org/changeset/base/366758

Log:
  Add support for IPsec ESN and pass relevant information to crypto layer
  
  Implement support for including IPsec ESN (Extended Sequence Number) to
  both encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined
  mode (eg. AES-GCM). Both ESP and AH protocols are updated. Additionally
  pass relevant information about ESN to crypto layer.
  
  For the ETA mode the ESN is stored in separate crp_esn buffer because
  the high-order 32 bits of the sequence number are appended after the
  Next Header (RFC 4303).
  
  For the AEAD modes the high-order 32 bits of the sequence number
  [e.g.  RFC 4106, Chapter 5 AAD Construction] are included as part of
  crp_aad (SPI + ESN (32 high order bits) + Seq nr (32 low order bits)).
  
  Submitted by:   Grzegorz Jaszczyk 
  Patryk Duda 
  Reviewed by:jhb, gnn
  Differential revision:  https://reviews.freebsd.org/D22369
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/sys/netipsec/keydb.h
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/keydb.h
==
--- head/sys/netipsec/keydb.h   Fri Oct 16 11:24:12 2020(r366757)
+++ head/sys/netipsec/keydb.h   Fri Oct 16 11:25:45 2020(r366758)
@@ -197,6 +197,8 @@ struct secasvar {
 #defineSAV_ISCTR(_sav) ((_sav)->alg_enc == SADB_X_EALG_AESCTR)
 #define SAV_ISCTRORGCM(_sav)   (SAV_ISCTR((_sav)) || SAV_ISGCM((_sav)))
 
+#defineIPSEC_SEQH_SHIFT32
+
 /* Replay prevention, protected by SECASVAR_LOCK:
  *  (m) locked by mtx
  *  (c) read only except during creation / free

Modified: head/sys/netipsec/xform_ah.c
==
--- head/sys/netipsec/xform_ah.cFri Oct 16 11:24:12 2020
(r366757)
+++ head/sys/netipsec/xform_ah.cFri Oct 16 11:25:45 2020
(r366758)
@@ -236,6 +236,10 @@ ah_init(struct secasvar *sav, struct xformsw *xsp)
 
memset(, 0, sizeof(csp));
csp.csp_mode = CSP_MODE_DIGEST;
+
+   if (sav->flags & SADB_X_SAFLAGS_ESN)
+   csp.csp_flags |= CSP_F_ESN;
+
error = ah_init0(sav, xsp, );
return error ? error :
 crypto_newsession(>tdb_cryptoid, , V_crypto_support);
@@ -654,6 +658,12 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski
crp->crp_callback = ah_input_cb;
crp->crp_opaque = xd;
 
+   if (sav->flags & SADB_X_SAFLAGS_ESN &&
+   sav->replay != NULL && sav->replay->wsize != 0) {
+   seqh = htonl(seqh);
+   memcpy(crp->crp_esn, , sizeof(seqh));
+   }
+
/* These are passed as-is to the callback. */
xd->sav = sav;
xd->nxt = hl;
@@ -834,6 +844,7 @@ ah_output(struct mbuf *m, struct secpolicy *sp, struct
uint16_t iplen;
int error, rplen, authsize, ahsize, maxpacketsize, roff;
uint8_t prot;
+   uint32_t seqh;
 
IPSEC_ASSERT(sav != NULL, ("null SA"));
ahx = sav->tdb_authalgxform;
@@ -1030,6 +1041,11 @@ ah_output(struct mbuf *m, struct secpolicy *sp, struct
crypto_use_mbuf(crp, m);
crp->crp_callback = ah_output_cb;
crp->crp_opaque = xd;
+
+   if (sav->flags & SADB_X_SAFLAGS_ESN && sav->replay != NULL) {
+   seqh = htonl((uint32_t)(sav->replay->count >> 
IPSEC_SEQH_SHIFT));
+   memcpy(crp->crp_esn, , sizeof(seqh));
+   }
 
/* These are passed as-is to the callback. */
xd->sp = sp;

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Fri Oct 16 11:24:12 2020
(r366757)
+++ head/sys/netipsec/xform_esp.c   Fri Oct 16 11:25:45 2020
(r366758)
@@ -80,6 +80,8 @@
 #include 
 #include 
 
+#define SPI_SIZE   4
+
 VNET_DEFINE(int, esp_enable) = 1;
 VNET_DEFINE_STATIC(int, esp_ctr_compatibility) = 1;
 #define V_esp_ctr_compatibility VNET(esp_ctr_compatibility)
@@ -219,9 +221,13 @@ esp_init(struct secasvar *sav, struct xformsw *xsp)
return EINVAL;
}
csp.csp_mode = CSP_MODE_AEAD;
-   } else if (sav->alg_auth != 0)
+   if (sav->flags & SADB_X_SAFLAGS_ESN)
+   csp.csp_flags |= CSP_F_SEPARATE_AAD;
+   } else if (sav->alg_auth != 0) {
csp.csp_mode = CSP_MODE_ETA;
-   else
+   if (sav->flags & SADB_X_SAFLAGS_ESN)
+   csp.csp_flags |= CSP_F_ESN;
+   } else
csp.csp_mode = CSP_MODE_CIPHER;
 
/* Initialize crypto session. */
@@ -263,6 +269,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk
crypto_session_t cryptoid;
  

svn commit: r366757 - head/sys/netipsec

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:24:12 2020
New Revision: 366757
URL: https://svnweb.freebsd.org/changeset/base/366757

Log:
  Implement anti-replay algorithm with ESN support
  
  As RFC 4304 describes there is anti-replay algorithm responsibility
  to provide appropriate value of Extended Sequence Number.
  
  This patch introduces anti-replay algorithm with ESN support based on
  RFC 4304, however to avoid performance regressions window implementation
  was based on RFC 6479, which was already implemented in FreeBSD.
  
  To keep things clean and improve code readability, implementation of window
  is kept in seperate functions.
  
  Submitted by:   Grzegorz Jaszczyk 
  Patryk Duda 
  Reviewed by:jhb
  Differential revision:  https://reviews.freebsd.org/D22367
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/sys/netipsec/ipsec.c
  head/sys/netipsec/ipsec.h
  head/sys/netipsec/key_debug.c
  head/sys/netipsec/keydb.h
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/ipsec.c
==
--- head/sys/netipsec/ipsec.c   Fri Oct 16 11:23:30 2020(r366756)
+++ head/sys/netipsec/ipsec.c   Fri Oct 16 11:24:12 2020(r366757)
@@ -1173,7 +1173,67 @@ ipsec_hdrsiz_inpcb(struct inpcb *inp)
return (sz);
 }
 
+
+#define IPSEC_BITMAP_INDEX_MASK(w) (w - 1)
+#define IPSEC_REDUNDANT_BIT_SHIFTS 5
+#define IPSEC_REDUNDANT_BITS   (1 << IPSEC_REDUNDANT_BIT_SHIFTS)
+#define IPSEC_BITMAP_LOC_MASK  (IPSEC_REDUNDANT_BITS - 1)
+
 /*
+ * Functions below are responsible for checking and updating bitmap.
+ * These are used to separate ipsec_chkreplay() and ipsec_updatereplay()
+ * from window implementation
+ *
+ * Based on RFC 6479. Blocks are 32 bits unsigned integers
+ */
+
+static inline int
+check_window(const struct secreplay *replay, uint64_t seq)
+{
+   int index, bit_location;
+
+   bit_location = seq & IPSEC_BITMAP_LOC_MASK;
+   index = (seq >> IPSEC_REDUNDANT_BIT_SHIFTS)
+   & IPSEC_BITMAP_INDEX_MASK(replay->bitmap_size);
+
+   /* This packet already seen? */
+   return ((replay->bitmap)[index] & (1 << bit_location));
+}
+
+static inline void
+advance_window(const struct secreplay *replay, uint64_t seq)
+{
+   int i;
+   uint64_t index, index_cur, diff;
+
+   index_cur = replay->last >> IPSEC_REDUNDANT_BIT_SHIFTS;
+   index = seq >> IPSEC_REDUNDANT_BIT_SHIFTS;
+   diff = index - index_cur;
+
+   if (diff > replay->bitmap_size) {
+   /* something unusual in this case */
+   diff = replay->bitmap_size;
+   }
+
+   for (i = 0; i < diff; i++) {
+   replay->bitmap[(i + index_cur + 1)
+   & IPSEC_BITMAP_INDEX_MASK(replay->bitmap_size)] = 0;
+   }
+}
+
+static inline void
+set_window(const struct secreplay *replay, uint64_t seq)
+{
+   int index, bit_location;
+
+   bit_location = seq & IPSEC_BITMAP_LOC_MASK;
+   index = (seq >> IPSEC_REDUNDANT_BIT_SHIFTS)
+   & IPSEC_BITMAP_INDEX_MASK(replay->bitmap_size);
+
+   replay->bitmap[index] |= (1 << bit_location);
+}
+
+/*
  * Check the variable replay window.
  * ipsec_chkreplay() performs replay check before ICV verification.
  * ipsec_updatereplay() updates replay bitmap.  This must be called after
@@ -1181,20 +1241,17 @@ ipsec_hdrsiz_inpcb(struct inpcb *inp)
  * beforehand).
  * 0 (zero) is returned if packet disallowed, 1 if packet permitted.
  *
- * Based on RFC 6479. Blocks are 32 bits unsigned integers
+ * Based on RFC 4303
  */
 
-#define IPSEC_BITMAP_INDEX_MASK(w) (w - 1)
-#define IPSEC_REDUNDANT_BIT_SHIFTS 5
-#define IPSEC_REDUNDANT_BITS   (1 << IPSEC_REDUNDANT_BIT_SHIFTS)
-#define IPSEC_BITMAP_LOC_MASK  (IPSEC_REDUNDANT_BITS - 1)
-
 int
-ipsec_chkreplay(uint32_t seq, struct secasvar *sav)
+ipsec_chkreplay(uint32_t seq, uint32_t *seqhigh, struct secasvar *sav)
 {
-   const struct secreplay *replay;
-   uint32_t wsizeb;/* Constant: window size. */
-   int index, bit_location;
+   char buf[128];
+   struct secreplay *replay;
+   uint32_t window;
+   uint32_t tl, th, bl;
+   uint32_t seqh;
 
IPSEC_ASSERT(sav != NULL, ("Null SA"));
IPSEC_ASSERT(sav->replay != NULL, ("Null replay state"));
@@ -1205,36 +1262,96 @@ ipsec_chkreplay(uint32_t seq, struct secasvar *sav)
if (replay->wsize == 0)
return (1);
 
-   /* Constant. */
-   wsizeb = replay->wsize << 3;
-
-   /* Sequence number of 0 is invalid. */
-   if (seq == 0)
+   /* Zero sequence number is not allowed. */
+   if (seq == 0 && replay->last == 0)
return (0);
 
-   /* First time is always okay. */
-   if (replay->count == 0)
-   return (1);
+   window = replay->wsize << 3; 

svn commit: r366756 - head/sys/compat/linux

2020-10-16 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Oct 16 11:23:30 2020
New Revision: 366756
URL: https://svnweb.freebsd.org/changeset/base/366756

Log:
  Set default stack size for Linux apps to 8MB.  This matches Linux'
  defaults, makes core files smaller, and fixes applications which use
  pthread_join(3) in a wrong way, namely Steam.
  
  This is based on a patch submitted by Jason Yang, which I've reworked
  to set the limit instead of only changing the value reported (which
  is enough to fix the bug for Linux pthreads, but could be confusing).
  
  PR:   248225
  Submitted by: Jason_YH_Yang at wistron.com (earlier version)
  Analyzed by:  Alex S 
  Reviewed by:  emaste
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26778

Modified:
  head/sys/compat/linux/linux_emul.c
  head/sys/compat/linux/linux_mib.c
  head/sys/compat/linux/linux_mib.h

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Fri Oct 16 11:22:29 2020
(r366755)
+++ head/sys/compat/linux/linux_emul.c  Fri Oct 16 11:23:30 2020
(r366756)
@@ -115,6 +115,29 @@ linux_set_default_openfiles(struct thread *td, struct 
KASSERT(error == 0, ("kern_proc_setrlimit failed"));
 }
 
+/*
+ * The default stack size limit in Linux is 8MB.
+ */
+static void
+linux_set_default_stacksize(struct thread *td, struct proc *p)
+{
+   struct rlimit rlim;
+   int error;
+
+   if (linux_default_stacksize < 0)
+   return;
+
+   PROC_LOCK(p);
+   lim_rlimit_proc(p, RLIMIT_STACK, );
+   PROC_UNLOCK(p);
+   if (rlim.rlim_cur != rlim.rlim_max ||
+   rlim.rlim_cur <= linux_default_stacksize)
+   return;
+   rlim.rlim_cur = linux_default_stacksize;
+   error = kern_proc_setrlimit(td, p, RLIMIT_STACK, );
+   KASSERT(error == 0, ("kern_proc_setrlimit failed"));
+}
+
 void
 linux_proc_init(struct thread *td, struct thread *newtd, int flags)
 {
@@ -145,6 +168,7 @@ linux_proc_init(struct thread *td, struct thread *newt
newtd->td_emuldata = em;
 
linux_set_default_openfiles(td, p);
+   linux_set_default_stacksize(td, p);
} else {
p = td->td_proc;
 

Modified: head/sys/compat/linux/linux_mib.c
==
--- head/sys/compat/linux/linux_mib.c   Fri Oct 16 11:22:29 2020
(r366755)
+++ head/sys/compat/linux/linux_mib.c   Fri Oct 16 11:23:30 2020
(r366756)
@@ -72,6 +72,11 @@ SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles,
 _default_openfiles, 0,
 "Default soft openfiles resource limit, or -1 for unlimited");
 
+int linux_default_stacksize = 8 * 1024 * 1024;
+SYSCTL_INT(_compat_linux, OID_AUTO, default_stacksize, CTLFLAG_RWTUN,
+_default_stacksize, 0,
+"Default soft stack size resource limit, or -1 for unlimited");
+
 int linux_ignore_ip_recverr = 1;
 SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN,
 _ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR");

Modified: head/sys/compat/linux/linux_mib.h
==
--- head/sys/compat/linux/linux_mib.h   Fri Oct 16 11:22:29 2020
(r366755)
+++ head/sys/compat/linux/linux_mib.h   Fri Oct 16 11:23:30 2020
(r366756)
@@ -64,6 +64,7 @@ int   linux_kernver(struct thread *td);
 
 extern int linux_debug;
 extern int linux_default_openfiles;
+extern int linux_default_stacksize;
 extern int linux_ignore_ip_recverr;
 extern int linux_preserve_vstatus;
 extern bool linux_map_sched_prio;
___
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: r366755 - head/sys/net

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:22:29 2020
New Revision: 366755
URL: https://svnweb.freebsd.org/changeset/base/366755

Log:
  Add SADB_SAFLAGS_ESN flag
  
  This flag is going to be used by IKE daemon to signal if
  Extended Sequence Number feature is going to be used.
  
  Value for this flag was taken from OpenBSD source code
  https://github.com/openbsd/src/commit/6b4cbaf181c6b60701d9fb888fd0e7a4333eecbd
  
  Submitted by:   Patryk Duda 
  Reviewed by:ae
  Differential revision:  https://reviews.freebsd.org/D22366
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/sys/net/pfkeyv2.h

Modified: head/sys/net/pfkeyv2.h
==
--- head/sys/net/pfkeyv2.h  Fri Oct 16 11:21:56 2020(r366754)
+++ head/sys/net/pfkeyv2.h  Fri Oct 16 11:22:29 2020(r366755)
@@ -348,6 +348,8 @@ _Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "
 #define SADB_SASTATE_MAX  3
 
 #define SADB_SAFLAGS_PFS  1
+/* SADB_X_SAFLAGS_ESN was defined in sys/net/pfkeyv2.h in OpenBSD sources */
+#define SADB_X_SAFLAGS_ESN0x400
 
 /*
  * Though some of these numbers (both _AALG and _EALG) appear to be
___
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: r366754 - head/sys/crypto/aesni

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:21:56 2020
New Revision: 366754
URL: https://svnweb.freebsd.org/changeset/base/366754

Log:
  Add support for ESN in AES-NI crypto driver
  
  This patch adds support for IPsec ESN (Extended Sequence Numbers) in
  encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined mode
  (eg. AES-GCM).
  
  For the encrypt and authenticate mode the ESN is stored in separate
  crp_esn buffer because the high-order 32 bits of the sequence number are
  appended after the Next Header (RFC 4303).
  
  For the combined modes the high-order 32 bits of the sequence number
  [e.g.  RFC 4106, Chapter 5 AAD Construction] are part of crp_aad
  (prepared by netipsec layer in case of ESN support enabled), therefore
  non visible diff around combined modes.
  
  Submitted by:   Grzegorz Jaszczyk 
  Patryk Duda 
  Reviewed by:jhb
  Differential revision:  https://reviews.freebsd.org/D22365
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/sys/crypto/aesni/aesni.c

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Fri Oct 16 11:18:13 2020
(r366753)
+++ head/sys/crypto/aesni/aesni.c   Fri Oct 16 11:21:56 2020
(r366754)
@@ -249,14 +249,15 @@ aesni_cipher_supported(struct aesni_softc *sc,
}
 }
 
+#define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD | CSP_F_ESN)
+
 static int
 aesni_probesession(device_t dev, const struct crypto_session_params *csp)
 {
struct aesni_softc *sc;
 
sc = device_get_softc(dev);
-   if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) !=
-   0)
+   if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0)
return (EINVAL);
switch (csp->csp_mode) {
case CSP_MODE_DIGEST:
@@ -864,6 +865,10 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
else
crypto_apply(crp, crp->crp_payload_start,
crp->crp_payload_length, ses->hash_update, );
+
+   if (csp->csp_flags & CSP_F_ESN)
+   ses->hash_update(, crp->crp_esn, 4);
+
ses->hash_finalize(res, );
 
/* Outer hash: (K ^ OPAD) || inner hash */
___
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: r366753 - head/sys/opencrypto

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:18:13 2020
New Revision: 366753
URL: https://svnweb.freebsd.org/changeset/base/366753

Log:
  Add support for ESN in cryptosoft
  
  This patch adds support for IPsec ESN (Extended Sequence Numbers) in
  encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined mode
  (eg. AES-GCM).
  
  For encrypt and authenticate mode the ESN is stored in separate crp_esn
  buffer because the high-order 32 bits of the sequence number are
  appended after the Next Header (RFC 4303).
  
  For combined modes the high-order 32 bits of the sequence number [e.g.
  RFC 4106, Chapter 5 AAD Construction] are part of crp_aad (prepared by
  netipsec layer in case of ESN support enabled), therefore non visible
  diff around combined modes.
  
  Submitted by:   Grzegorz Jaszczyk 
  Patryk Duda 
  Reviewed by:jhb
  Differential revision:  https://reviews.freebsd.org/D22364
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/sys/opencrypto/cryptosoft.c

Modified: head/sys/opencrypto/cryptosoft.c
==
--- head/sys/opencrypto/cryptosoft.cFri Oct 16 11:06:33 2020
(r366752)
+++ head/sys/opencrypto/cryptosoft.cFri Oct 16 11:18:13 2020
(r366753)
@@ -327,8 +327,8 @@ swcr_authcompute(struct swcr_session *ses, struct cryp
 
axf = sw->sw_axf;
 
+   csp = crypto_get_params(crp->crp_session);
if (crp->crp_auth_key != NULL) {
-   csp = crypto_get_params(crp->crp_session);
swcr_authprepare(axf, sw, crp->crp_auth_key,
csp->csp_auth_klen);
}
@@ -354,6 +354,9 @@ swcr_authcompute(struct swcr_session *ses, struct cryp
if (err)
goto out;
 
+   if (csp->csp_flags & CSP_F_ESN)
+   axf->Update(, crp->crp_esn, 4);
+
axf->Final(aalg, );
if (sw->sw_octx != NULL) {
bcopy(sw->sw_octx, , axf->ctxsize);
@@ -1235,12 +1238,12 @@ swcr_cipher_supported(const struct crypto_session_para
return (true);
 }
 
+#define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD | CSP_F_ESN)
+
 static int
 swcr_probesession(device_t dev, const struct crypto_session_params *csp)
 {
-
-   if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) !=
-   0)
+   if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0)
return (EINVAL);
switch (csp->csp_mode) {
case CSP_MODE_COMPRESS:
___
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: r366752 - in head: share/man/man9 sys/opencrypto

2020-10-16 Thread Marcin Wojtas
Author: mw
Date: Fri Oct 16 11:06:33 2020
New Revision: 366752
URL: https://svnweb.freebsd.org/changeset/base/366752

Log:
  Prepare crypto framework for IPsec ESN support
  
  This permits requests (netipsec ESP and AH protocol) to provide the
  IPsec ESN (Extended Sequence Numbers) in a separate buffer.
  
  As with separate output buffer and separate AAD buffer not all drivers
  support this feature. Consumer must request use of this feature via new
  session flag.
  
  Submitted by:   Grzegorz Jaszczyk 
  Patryk Duda 
  Reviewed by:jhb
  Differential revision:  https://reviews.freebsd.org/D24838
  Obtained from:  Semihalf
  Sponsored by:   Stormshield

Modified:
  head/share/man/man9/crypto_request.9
  head/share/man/man9/crypto_session.9
  head/sys/opencrypto/crypto.c
  head/sys/opencrypto/cryptodev.h

Modified: head/share/man/man9/crypto_request.9
==
--- head/share/man/man9/crypto_request.9Fri Oct 16 11:01:21 2020
(r366751)
+++ head/share/man/man9/crypto_request.9Fri Oct 16 11:06:33 2020
(r366752)
@@ -302,6 +302,24 @@ as a single buffer pointed to by
 In either case,
 .Fa crp_aad_length
 always indicates the amount of AAD in bytes.
+.Ss Request ESN
+IPsec requests may optionally include Extended Sequence Numbers (ESN).
+ESN may either be supplied in
+.Fa crp_esn
+or as part of the AAD pointed to by
+.Fa crp_aad .
+.Pp
+If the ESN is stored in
+.Fa crp_esn ,
+.Dv CSP_F_ESN
+should be set in
+.Fa csp_flags .
+This use case is dedicated for encrypt and authenticate mode, since the
+high-order 32 bits of the sequence number are appended after the Next Header
+(RFC 4303).
+.Pp
+AEAD modes supply the ESN in a separate AAD buffer (see e.g. RFC 4106, Chapter 
5
+AAD Construction).
 .Ss Request IV and/or Nonce
 Some cryptographic operations require an IV or nonce as an input.
 An IV may be stored either in the IV region of the data buffer or in

Modified: head/share/man/man9/crypto_session.9
==
--- head/share/man/man9/crypto_session.9Fri Oct 16 11:01:21 2020
(r366751)
+++ head/share/man/man9/crypto_session.9Fri Oct 16 11:06:33 2020
(r366752)
@@ -201,6 +201,15 @@ Sessions with this flag set permit requests with AAD p
 a region of the input buffer or in a single, virtually-contiguous buffer.
 Sessions without this flag only permit requests with AAD passed in as
 a region in the input buffer.
+.It Dv CSP_F_ESN
+Support requests that use a separate buffer for IPsec ESN (Extended Sequence
+Numbers).
+.Pp
+Sessions with this flag set permit requests with IPsec ESN passed in special
+buffer.
+It is required for IPsec ESN support of encrypt and authenticate mode where
+the high-order 32 bits of the sequence number are appended after the Next
+Header (RFC 4303).
 .El
 .It Fa csp_ivlen
 If either the cipher or authentication algorithms require an explicit

Modified: head/sys/opencrypto/crypto.c
==
--- head/sys/opencrypto/crypto.cFri Oct 16 11:01:21 2020
(r366751)
+++ head/sys/opencrypto/crypto.cFri Oct 16 11:06:33 2020
(r366752)
@@ -743,6 +743,8 @@ alg_is_aead(int alg)
return (alg_type(alg) == ALG_AEAD);
 }
 
+#define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD | CSP_F_ESN)
+
 /* Various sanity checks on crypto session parameters. */
 static bool
 check_csp(const struct crypto_session_params *csp)
@@ -750,8 +752,7 @@ check_csp(const struct crypto_session_params *csp)
struct auth_hash *axf;
 
/* Mode-independent checks. */
-   if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) !=
-   0)
+   if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0)
return (false);
if (csp->csp_ivlen < 0 || csp->csp_cipher_klen < 0 ||
csp->csp_auth_klen < 0 || csp->csp_auth_mlen < 0)

Modified: head/sys/opencrypto/cryptodev.h
==
--- head/sys/opencrypto/cryptodev.h Fri Oct 16 11:01:21 2020
(r366751)
+++ head/sys/opencrypto/cryptodev.h Fri Oct 16 11:06:33 2020
(r366752)
@@ -377,6 +377,7 @@ struct crypto_session_params {
 
 #defineCSP_F_SEPARATE_OUTPUT   0x0001  /* Requests can use separate 
output */
 #defineCSP_F_SEPARATE_AAD  0x0002  /* Requests can use separate 
AAD */
+#define CSP_F_ESN  0x0004  /* Requests can use seperate ESN field 
*/ 
 
int csp_ivlen;  /* IV length in bytes. */
 
@@ -485,6 +486,8 @@ struct cryptop {
void*crp_aad;   /* AAD buffer. */
int crp_aad_start;  /* Location of AAD. */
int crp_aad_length; /* 0 => no AAD. */
+   uint8_t 

svn commit: r366751 - head/sys/compat/linuxkpi/common/include/linux

2020-10-16 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct 16 11:01:21 2020
New Revision: 366751
URL: https://svnweb.freebsd.org/changeset/base/366751

Log:
  Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.
  
  Discussed with:   manu@
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Fri Oct 16 
10:44:48 2020(r366750)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Fri Oct 16 
11:01:21 2020(r366751)
@@ -135,10 +135,7 @@ extern const volatile int lkpi_build_bug_on_zero;
 #defineALIGN(x, y) roundup2((x), (y))
 #undef PTR_ALIGN
 #definePTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), 
(a)))
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 5
-/* Moved from linuxkpi_gplv2 */
 #defineIS_ALIGNED(x, a)(((x) & ((__typeof(x))(a) - 1)) == 0)
-#endif
 #defineDIV_ROUND_UP(x, n)  howmany(x, n)
 #define__KERNEL_DIV_ROUND_UP(x, n) howmany(x, n)
 #defineDIV_ROUND_UP_ULL(x, n)  DIV_ROUND_UP((unsigned long long)(x), 
(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"


Re: svn commit: r366748 - head/sys/fs/pseudofs

2020-10-16 Thread Konstantin Belousov
On Fri, Oct 16, 2020 at 09:58:11AM +, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Fri Oct 16 09:58:10 2020
> New Revision: 366748
> URL: https://svnweb.freebsd.org/changeset/base/366748
> 
> Log:
>   Bump pseudofs size limit from 128kB to 1MB.  The old limit could result
>   in process' memory maps being truncated.
New limit could as well.
___
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: r366750 - head/sys/netinet

2020-10-16 Thread Michael Tuexen
Author: tuexen
Date: Fri Oct 16 10:44:48 2020
New Revision: 366750
URL: https://svnweb.freebsd.org/changeset/base/366750

Log:
  Improve the handling of cookie life times.
  The staleness reported in an error cause is in us, not ms.
  Enforce limits on the life time via sysct; and socket options
  consistently. Update the description of the sysctl variable to
  use the right unit. Also do some minor cleanups.
  This also fixes an interger overflow issue if the peer can
  modify the cookie. This was reported by Felix Weinrank by fuzz testing
  the userland stack and in
  https://oss-fuzz.com/testcase-detail/4800394024452096
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp.h
==
--- head/sys/netinet/sctp.h Fri Oct 16 10:10:09 2020(r366749)
+++ head/sys/netinet/sctp.h Fri Oct 16 10:44:48 2020(r366750)
@@ -599,6 +599,7 @@ struct sctp_error_auth_invalid_hmac {
  */
 #define SCTP_MAX_SACK_DELAY 500/* per RFC4960 */
 #define SCTP_MAX_HB_INTERVAL 1440  /* 4 hours in ms */
+#define SCTP_MIN_COOKIE_LIFE 1000  /* 1 second in ms */
 #define SCTP_MAX_COOKIE_LIFE  360  /* 1 hour in ms */
 
 /* Types of logging/KTR tracing  that can be enabled via the

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Fri Oct 16 10:10:09 2020
(r366749)
+++ head/sys/netinet/sctp_input.c   Fri Oct 16 10:44:48 2020
(r366750)
@@ -1164,13 +1164,10 @@ sctp_handle_error(struct sctp_chunkhdr *ch,
struct sctp_error_stale_cookie *stale_cookie;
 
stale_cookie = (struct sctp_error_stale_cookie 
*)cause;
-   asoc->cookie_preserve_req = 
ntohl(stale_cookie->stale_time);
-   /* Double it to be more robust on RTX */
-   if (asoc->cookie_preserve_req <= UINT32_MAX / 
2) {
-   asoc->cookie_preserve_req *= 2;
-   } else {
-   asoc->cookie_preserve_req = UINT32_MAX;
-   }
+   /* stable_time is in usec, convert to msec. */
+   asoc->cookie_preserve_req = 
ntohl(stale_cookie->stale_time) / 1000;
+   /* Double it to be more robust on RTX. */
+   asoc->cookie_preserve_req *= 2;
asoc->stale_cookie_count++;
if (asoc->stale_cookie_count >
asoc->max_init_times) {
@@ -2254,7 +2251,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in
unsigned int sig_offset, cookie_offset;
unsigned int cookie_len;
struct timeval now;
-   struct timeval time_expires;
+   struct timeval time_entered, time_expires;
int notification = 0;
struct sctp_nets *netl;
int had_a_existing_tcb = 0;
@@ -2382,13 +2379,30 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in
return (NULL);
}
 
+   if (sctp_ticks_to_msecs(cookie->cookie_life) > SCTP_MAX_COOKIE_LIFE) {
+   SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: Invalid cookie 
lifetime\n");
+   return (NULL);
+   }
+   time_entered.tv_sec = cookie->time_entered.tv_sec;
+   time_entered.tv_usec = cookie->time_entered.tv_usec;
+   if ((time_entered.tv_sec < 0) ||
+   (time_entered.tv_usec < 0) ||
+   (time_entered.tv_usec >= 100)) {
+   /* Invalid time stamp. Cookie must have been modified. */
+   SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: Invalid time 
stamp\n");
+   return (NULL);
+   }
+   (void)SCTP_GETTIME_TIMEVAL();
+   if (timevalcmp(, _entered, <)) {
+   SCTPDBG(SCTP_DEBUG_INPUT2, "handle_cookie_echo: cookie 
generated in the future!\n");
+   return (NULL);
+   }
/*
-* check the cookie timestamps to be sure it's not stale
+* Check the cookie timestamps to be sure it's not stale.
+* cookie_life is in ticks, so we convert to seconds.
 */
-   (void)SCTP_GETTIME_TIMEVAL();
-   /* Expire time is in Ticks, so we convert to seconds */
-   time_expires.tv_sec = cookie->time_entered.tv_sec + 
sctp_ticks_to_secs(cookie->cookie_life);
-   time_expires.tv_usec = cookie->time_entered.tv_usec;
+   time_expires.tv_sec = time_entered.tv_sec + 
sctp_ticks_to_secs(cookie->cookie_life);
+   time_expires.tv_usec = time_entered.tv_usec;
if 

svn commit: r366749 - head/sys/compat/linux

2020-10-16 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Oct 16 10:10:09 2020
New Revision: 366749
URL: https://svnweb.freebsd.org/changeset/base/366749

Log:
  Make linux getrlimit(2) and prlimit(2) return something reasonable
  for linux-specific limits.  Fixes prlimit (util-linux-2.31.1-0.4ubuntu3.7).
  
  Reviewed by:  emaste
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26777

Modified:
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/linux/linux_misc.h

Modified: head/sys/compat/linux/linux_misc.c
==
--- head/sys/compat/linux/linux_misc.c  Fri Oct 16 09:58:10 2020
(r366748)
+++ head/sys/compat/linux/linux_misc.c  Fri Oct 16 10:10:09 2020
(r366749)
@@ -1373,6 +1373,28 @@ linux_getgroups(struct thread *td, struct linux_getgro
return (0);
 }
 
+static bool
+linux_get_dummy_limit(l_uint resource, struct rlimit *rlim)
+{
+
+   switch (resource) {
+   case LINUX_RLIMIT_LOCKS:
+   case LINUX_RLIMIT_SIGPENDING:
+   case LINUX_RLIMIT_MSGQUEUE:
+   case LINUX_RLIMIT_RTTIME:
+   rlim->rlim_cur = LINUX_RLIM_INFINITY;
+   rlim->rlim_max = LINUX_RLIM_INFINITY;
+   return (true);
+   case LINUX_RLIMIT_NICE:
+   case LINUX_RLIMIT_RTPRIO:
+   rlim->rlim_cur = 0;
+   rlim->rlim_max = 0;
+   return (true);
+   default:
+   return (false);
+   }
+}
+
 int
 linux_setrlimit(struct thread *td, struct linux_setrlimit_args *args)
 {
@@ -1405,6 +1427,12 @@ linux_old_getrlimit(struct thread *td, struct linux_ol
struct rlimit bsd_rlim;
u_int which;
 
+   if (linux_get_dummy_limit(args->resource, _rlim)) {
+   rlim.rlim_cur = bsd_rlim.rlim_cur;
+   rlim.rlim_max = bsd_rlim.rlim_max;
+   return (copyout(, args->rlim, sizeof(rlim)));
+   }
+
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);
 
@@ -1440,6 +1468,12 @@ linux_getrlimit(struct thread *td, struct linux_getrli
struct rlimit bsd_rlim;
u_int which;
 
+   if (linux_get_dummy_limit(args->resource, _rlim)) {
+   rlim.rlim_cur = bsd_rlim.rlim_cur;
+   rlim.rlim_max = bsd_rlim.rlim_max;
+   return (copyout(, args->rlim, sizeof(rlim)));
+   }
+
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);
 
@@ -2137,6 +2171,14 @@ linux_prlimit64(struct thread *td, struct linux_prlimi
u_int which;
int flags;
int error;
+
+   if (args->new == NULL && args->old != NULL) {
+   if (linux_get_dummy_limit(args->resource, )) {
+   lrlim.rlim_cur = rlim.rlim_cur;
+   lrlim.rlim_max = rlim.rlim_max;
+   return (copyout(, args->old, sizeof(lrlim)));
+   }
+   }
 
if (args->resource >= LINUX_RLIM_NLIMITS)
return (EINVAL);

Modified: head/sys/compat/linux/linux_misc.h
==
--- head/sys/compat/linux/linux_misc.h  Fri Oct 16 09:58:10 2020
(r366748)
+++ head/sys/compat/linux/linux_misc.h  Fri Oct 16 10:10:09 2020
(r366749)
@@ -137,12 +137,12 @@ extern int stclohz;
 #defineLINUX_P_PID 1
 #defineLINUX_P_PGID2
 
-#defineLINUX_RLIMIT_LOCKS  RLIM_NLIMITS + 1
-#defineLINUX_RLIMIT_SIGPENDING RLIM_NLIMITS + 2
-#defineLINUX_RLIMIT_MSGQUEUE   RLIM_NLIMITS + 3
-#defineLINUX_RLIMIT_NICE   RLIM_NLIMITS + 4
-#defineLINUX_RLIMIT_RTPRIO RLIM_NLIMITS + 5
-#defineLINUX_RLIMIT_RTTIME RLIM_NLIMITS + 6
+#defineLINUX_RLIMIT_LOCKS  10
+#defineLINUX_RLIMIT_SIGPENDING 11
+#defineLINUX_RLIMIT_MSGQUEUE   12
+#defineLINUX_RLIMIT_NICE   13
+#defineLINUX_RLIMIT_RTPRIO 14
+#defineLINUX_RLIMIT_RTTIME 15
 
 #defineLINUX_RLIM_INFINITY (~0UL)
 
___
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: r366748 - head/sys/fs/pseudofs

2020-10-16 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Oct 16 09:58:10 2020
New Revision: 366748
URL: https://svnweb.freebsd.org/changeset/base/366748

Log:
  Bump pseudofs size limit from 128kB to 1MB.  The old limit could result
  in process' memory maps being truncated.
  
  PR:   237883
  Submitted by: dchagin
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D20575

Modified:
  head/sys/fs/pseudofs/pseudofs_vnops.c

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==
--- head/sys/fs/pseudofs/pseudofs_vnops.c   Fri Oct 16 08:56:20 2020
(r366747)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c   Fri Oct 16 09:58:10 2020
(r366748)
@@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$");
KASSERT((pn)->pn_type == pfstype_symlink,   \
("%s(): VLNK vnode refers to non-link pfs_node", __func__))
 
+#definePFS_MAXBUFSIZ   1024 * 1024
+
 /*
  * Returns the fileno, adjusted for target pid
  */
@@ -677,8 +679,8 @@ pfs_read(struct vop_read_args *va)
goto ret;
}
buflen = uio->uio_offset + uio->uio_resid;
-   if (buflen > MAXPHYS)
-   buflen = MAXPHYS;
+   if (buflen > PFS_MAXBUFSIZ)
+   buflen = PFS_MAXBUFSIZ;
 
sb = sbuf_new(sb, NULL, buflen + 1, 0);
if (sb == NULL) {
___
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"