svn commit: r368483 - head/usr.bin/grep

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Wed Dec  9 05:27:45 2020
New Revision: 368483
URL: https://svnweb.freebsd.org/changeset/base/368483

Log:
  grep: replace the internal queue with a ring buffer
  
  We know up front how many items we can have in the queue (-B/Bflag), so
  pay the cost of those particular allocations early on.
  
  The reduced queue maintenance overhead seemed to yield about an ~8%
  improvement for my earlier `grep -C8 -r closefrom .` test.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/grep.h
  head/usr.bin/grep/queue.c

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cWed Dec  9 05:12:04 2020(r368482)
+++ head/usr.bin/grep/grep.cWed Dec  9 05:27:45 2020(r368483)
@@ -707,6 +707,8 @@ main(int argc, char *argv[])
if ((aargc == 0 || aargc == 1) && !Hflag)
hflag = true;
 
+   initqueue();
+
if (aargc == 0 && dirbehave != DIR_RECURSE)
exit(!procfile("-"));
 

Modified: head/usr.bin/grep/grep.h
==
--- head/usr.bin/grep/grep.hWed Dec  9 05:12:04 2020(r368482)
+++ head/usr.bin/grep/grep.hWed Dec  9 05:27:45 2020(r368483)
@@ -149,6 +149,7 @@ char*grep_strdup(const char *str);
 voidgrep_printline(struct str *line, int sep);
 
 /* queue.c */
+voidinitqueue(void);
 boolenqueue(struct str *x);
 voidprintqueue(void);
 voidclearqueue(void);

Modified: head/usr.bin/grep/queue.c
==
--- head/usr.bin/grep/queue.c   Wed Dec  9 05:12:04 2020(r368482)
+++ head/usr.bin/grep/queue.c   Wed Dec  9 05:27:45 2020(r368483)
@@ -6,6 +6,7 @@
  *
  * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
  * All rights reserved.
+ * Copyright (c) 2020 Kyle Evans 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,77 +46,99 @@ __FBSDID("$FreeBSD$");
 
 #include "grep.h"
 
-struct qentry {
-   STAILQ_ENTRY(qentry)list;
-   struct str  data;
-};
+typedef struct str qentry_t;
 
-static STAILQ_HEAD(, qentry)   queue = STAILQ_HEAD_INITIALIZER(queue);
-static long long   count;
+static long long   filled;
+static qentry_t*qend, *qpool;
 
-static struct qentry   *dequeue(void);
-
 /*
- * Enqueue another line; return true if we've dequeued a line as a result
+ * qnext is the next entry to populate.  qlist is where the list actually
+ * starts, for the purposes of printing.
  */
-bool
-enqueue(struct str *x)
+static qentry_t*qlist, *qnext;
+
+void
+initqueue(void)
 {
-   struct qentry *item;
 
-   item = grep_malloc(sizeof(struct qentry));
-   item->data.dat = grep_malloc(sizeof(char) * x->len);
-   item->data.len = x->len;
-   item->data.line_no = x->line_no;
-   item->data.boff = x->boff;
-   item->data.off = x->off;
-   memcpy(item->data.dat, x->dat, x->len);
-   item->data.file = x->file;
+   qlist = qnext = qpool = grep_calloc(Bflag, sizeof(*qpool));
+   qend = qpool + (Bflag - 1);
+}
 
-   STAILQ_INSERT_TAIL(, item, list);
+static qentry_t *
+advqueue(qentry_t *itemp)
+{
 
-   if (++count > Bflag) {
-   item = dequeue();
-   free(item->data.dat);
-   free(item);
-   return (true);
-   }
-   return (false);
+   if (itemp == qend)
+   return (qpool);
+   return (itemp + 1);
 }
 
-static struct qentry *
-dequeue(void)
+/*
+ * Enqueue another line; return true if we've dequeued a line as a result
+ */
+bool
+enqueue(struct str *x)
 {
-   struct qentry *item;
+   qentry_t *item;
+   bool rotated;
 
-   item = STAILQ_FIRST();
-   if (item == NULL)
-   return (NULL);
+   item = qnext;
+   qnext = advqueue(qnext);
+   rotated = false;
 
-   STAILQ_REMOVE_HEAD(, list);
-   --count;
-   return (item);
+   if (filled < Bflag) {
+   filled++;
+   } else if (filled == Bflag) {
+   /* We had already filled up coming in; just rotate. */
+   qlist = advqueue(qlist);
+   rotated = true;
+   free(item->dat);
+   }
+   item->dat = grep_malloc(sizeof(char) * x->len);
+   item->len = x->len;
+   item->line_no = x->line_no;
+   item->boff = x->boff;
+   item->off = x->off;
+   memcpy(item->dat, x->dat, x->len);
+   item->file = x->file;
+
+   return (rotated);
 }
 
 void
 printqueue(void)
 {
-   struct qentry *item;
+   qentry_t *item;
 
-   while ((item = dequeue()) != NULL) {
-   grep_printline(>data, '-');
-   

svn commit: r368482 - head/usr.bin/grep/tests

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Wed Dec  9 05:12:04 2020
New Revision: 368482
URL: https://svnweb.freebsd.org/changeset/base/368482

Log:
  grep: tests: stop expecting a failure of gnuext w/ bsdgrep
  
  libregex now supports these and we no longer offer to not link against
  libregex.

Modified:
  head/usr.bin/grep/tests/grep_freebsd_test.sh

Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh
==
--- head/usr.bin/grep/tests/grep_freebsd_test.shWed Dec  9 03:24:09 
2020(r368481)
+++ head/usr.bin/grep/tests/grep_freebsd_test.shWed Dec  9 05:12:04 
2020(r368482)
@@ -87,9 +87,7 @@ gnuext_body()
 {
grep_type
_type=$?
-   if [ $_type -eq $GREP_TYPE_BSD ]; then
-   atf_expect_fail "this test requires GNU extensions in regex(3)"
-   elif [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then
+   if [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then
atf_expect_fail "\\s and \\S are known to be buggy in base 
gnugrep"
fi
 
___
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: r368481 - in head/usr.bin: kdump truss

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Wed Dec  9 03:24:09 2020
New Revision: 368481
URL: https://svnweb.freebsd.org/changeset/base/368481

Log:
  kdump/truss: decode new _umtx_op flags
  
  In both cases, print the flag bits first followed by the command.
  
  Output now looks something like this:
  
  (ktrace)
  _umtx_op(0x8605f7008,0xf,0,0,0)
  _umtx_op(0x9fffdce8,0x8003,0x1,0,0)
  
  (truss)
  _umtx_op(0x7fffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)
  _umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D27325

Modified:
  head/usr.bin/kdump/kdump.c
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Wed Dec  9 03:22:44 2020(r368480)
+++ head/usr.bin/kdump/kdump.c  Wed Dec  9 03:24:09 2020(r368481)
@@ -254,14 +254,21 @@ print_integer_arg_valid(const char *(*decoder)(int), i
}
 }
 
+static bool
+print_mask_arg_part(bool (*decoder)(FILE *, int, int *), int value, int *rem)
+{
+
+   printf("%#x<", value);
+   return (decoder(stdout, value, rem));
+}
+
 static void
 print_mask_arg(bool (*decoder)(FILE *, int, int *), int value)
 {
bool invalid;
int rem;
 
-   printf("%#x<", value);
-   invalid = !decoder(stdout, value, );
+   invalid = !print_mask_arg_part(decoder, value, );
printf(">");
if (invalid)
printf("%u", rem);
@@ -1455,10 +1462,16 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
ip++;
narg--;
break;
-   case SYS__umtx_op:
+   case SYS__umtx_op: {
+   int op;
+
print_number(ip, narg, c);
putchar(',');
-   print_integer_arg(sysdecode_umtx_op, *ip);
+   if (print_mask_arg_part(sysdecode_umtx_op_flags,
+   *ip, ))
+   putchar('|');
+   print_integer_arg(sysdecode_umtx_op, op);
+   putchar('>');
switch (*ip) {
case UMTX_OP_CV_WAIT:
ip++;
@@ -1478,6 +1491,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
ip++;
narg--;
break;
+   }
case SYS_ftruncate:
case SYS_truncate:
print_number(ip, narg, c);

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Wed Dec  9 03:22:44 2020
(r368480)
+++ head/usr.bin/truss/syscalls.c   Wed Dec  9 03:24:09 2020
(r368481)
@@ -888,12 +888,20 @@ print_integer_arg(const char *(*decoder)(int), FILE *f
fprintf(fp, "%d", value);
 }
 
+static bool
+print_mask_arg_part(bool (*decoder)(FILE *, int, int *), FILE *fp, int value,
+int *rem)
+{
+
+   return (decoder(fp, value, rem));
+}
+
 static void
 print_mask_arg(bool (*decoder)(FILE *, int, int *), FILE *fp, int value)
 {
int rem;
 
-   if (!decoder(fp, value, ))
+   if (!print_mask_arg_part(decoder, fp, value, ))
fprintf(fp, "0x%x", rem);
else if (rem != 0)
fprintf(fp, "|0x%x", rem);
@@ -2303,9 +2311,15 @@ print_arg(struct syscall_args *sc, unsigned long *args
case Procctl:
print_integer_arg(sysdecode_procctl_cmd, fp, args[sc->offset]);
break;
-   case Umtxop:
-   print_integer_arg(sysdecode_umtx_op, fp, args[sc->offset]);
+   case Umtxop: {
+   int rem;
+
+   if (print_mask_arg_part(sysdecode_umtx_op_flags, fp,
+   args[sc->offset], ))
+   fprintf(fp, "|");
+   print_integer_arg(sysdecode_umtx_op, fp, rem);
break;
+   }
case Atfd:
print_integer_arg(sysdecode_atfd, fp, args[sc->offset]);
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: r368480 - head/lib/libsysdecode

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Wed Dec  9 03:22:44 2020
New Revision: 368480
URL: https://svnweb.freebsd.org/changeset/base/368480

Log:
  libsysdecode: decode _UMTX_OP flags
  
  Assume that UMTX_OP with a double underbar following is a flag, while any
  underbar+alphanumeric combination immeiately following is an op.
  
  This was a part of D27325.
  
  Reviewed by:  kib

Modified:
  head/lib/libsysdecode/flags.c
  head/lib/libsysdecode/mktables
  head/lib/libsysdecode/sysdecode.h

Modified: head/lib/libsysdecode/flags.c
==
--- head/lib/libsysdecode/flags.c   Wed Dec  9 03:20:51 2020
(r368479)
+++ head/lib/libsysdecode/flags.c   Wed Dec  9 03:22:44 2020
(r368480)
@@ -941,6 +941,20 @@ sysdecode_umtx_op(int op)
return (lookup_value(umtxop, op));
 }
 
+bool
+sysdecode_umtx_op_flags(FILE *fp, int op, int *rem)
+{
+   uintmax_t val;
+   bool printed;
+
+   printed = false;
+   val = (unsigned)op;
+   print_mask_part(fp, umtxopflags, , );
+   if (rem != NULL)
+   *rem = val;
+   return (printed);
+}
+
 const char *
 sysdecode_vmresult(int result)
 {

Modified: head/lib/libsysdecode/mktables
==
--- head/lib/libsysdecode/mktables  Wed Dec  9 03:20:51 2020
(r368479)
+++ head/lib/libsysdecode/mktables  Wed Dec  9 03:22:44 2020
(r368480)
@@ -145,7 +145,8 @@ gen_table "sockoptudp"  "UDP_[[:alnum:]]+[[:space:
 gen_table "sockoptudplite"  "UDPLITE_[[:alnum:]_]+[[:space:]]+[0-9]+"  
"netinet/udplite.h"
 gen_table "socktype""SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*"  
"sys/socket.h"
 gen_table "thrcreateflags"  "THR_[A-Z]+[[:space:]]+0x[0-9]+"   
"sys/thr.h"
-gen_table "umtxop"  "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+"  
"sys/umtx.h"
+gen_table "umtxop"  
"UMTX_OP_[[:alnum:]][[:alnum:]_]*[[:space:]]+[0-9]+"  "sys/umtx.h"
+gen_table "umtxopflags" "UMTX_OP__[[:alnum:]_]+[[:space:]]+[0-9]+" 
   "sys/umtx.h"
 gen_table "vmprot"  
"VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)"  "vm/vm.h"
 gen_table "vmresult""KERN_[A-Z_]+[[:space:]]+[0-9]+"   
"vm/vm_param.h"
 gen_table "wait6opt""W[A-Z]+[[:space:]]+[0-9]+"
"sys/wait.h"

Modified: head/lib/libsysdecode/sysdecode.h
==
--- head/lib/libsysdecode/sysdecode.h   Wed Dec  9 03:20:51 2020
(r368479)
+++ head/lib/libsysdecode/sysdecode.h   Wed Dec  9 03:22:44 2020
(r368480)
@@ -121,6 +121,7 @@ const char *sysdecode_sysarch_number(int _number);
 bool   sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem);
 bool   sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem);
 const char *sysdecode_umtx_op(int _op);
+bool   sysdecode_umtx_op_flags(FILE *_fp, int op, int *_rem);
 bool   sysdecode_umtx_rwlock_flags(FILE *_fp, u_long _flags, u_long *_rem);
 intsysdecode_utrace(FILE *_fp, void *_buf, size_t _len);
 bool   sysdecode_vmprot(FILE *_fp, int _type, int *_rem);
___
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: r368479 - head/lib/libc/sys

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Wed Dec  9 03:20:51 2020
New Revision: 368479
URL: https://svnweb.freebsd.org/changeset/base/368479

Log:
  _umtx_op(2): document recent addition of 32bit compat flags
  
  This was part of D27325.
  
  Reviewed by:  kib

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

Modified: head/lib/libc/sys/_umtx_op.2
==
--- head/lib/libc/sys/_umtx_op.2Wed Dec  9 02:59:24 2020
(r368478)
+++ head/lib/libc/sys/_umtx_op.2Wed Dec  9 03:20:51 2020
(r368479)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 16, 2020
+.Dd November 23, 2020
 .Dt _UMTX_OP 2
 .Os
 .Sh NAME
@@ -1272,6 +1272,79 @@ See
 .Sx ROBUST UMUTEXES
 subsection for details.
 .El
+.Pp
+The
+.Fa op
+argument may be a bitwise OR of a single command from above with one or more of
+the following flags:
+.Bl -tag -width indent
+.It Dv UMTX_OP__I386
+Request i386 ABI compatibility from the native
+.Nm
+system call.
+Specifically, this implies that:
+.Bl -hang -offset indent
+.It
+.Fa obj
+arguments that point to a word, point to a 32-bit integer.
+.It
+The
+.Dv UMTX_OP_NWAKE_PRIVATE
+.Fa obj
+argument is a pointer to an array of 32-bit pointers.
+.It
+The
+.Dv m_rb_lnk
+member of
+.Vt struct umutex
+is a 32-bit pointer.
+.It
+.Vt struct timespec
+uses a 32-bit time_t.
+.El
+.Pp
+.Dv UMTX_OP__32BIT
+has no effect if this flag is set.
+This flag is valid for all architectures, but it is ignored on i386.
+.It Dv UMTX_OP__32BIT
+Request non-i386, 32-bit ABI compatibility from the native
+.Nm
+system call.
+Specifically, this implies that:
+.Bl -hang -offset indent
+.It
+.Fa obj
+arguments that point to a word, point to a 32-bit integer.
+.It
+The
+.Dv UMTX_OP_NWAKE_PRIVATE
+.Fa obj
+argument is a pointer to an array of 32-bit pointers.
+.It
+The
+.Dv m_rb_lnk
+member of
+.Vt struct umutex
+is a 32-bit pointer.
+.It
+.Vt struct timespec
+uses a 64-bit time_t.
+.El
+.Pp
+This flag has no effect if
+.Dv UMTX_OP__I386
+is set.
+This flag is valid for all architectures.
+.El
+.Pp
+Note that if any 32-bit ABI compatibility is being requested, then care must be
+taken with robust lists.
+A single thread may not mix 32-bit compatible robust lists with native
+robust lists.
+The first
+.Dv UMTX_OP_ROBUST_LISTS
+call in a given thread determines which ABI that thread will use for robust
+lists going forward.
 .Sh RETURN VALUES
 If successful,
 all requests, except
___
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: r368478 - in head/contrib/unbound: . contrib daemon dnstap doc libunbound respip services services/cache smallapp util util/data validator

2020-12-08 Thread Cy Schubert
Author: cy
Date: Wed Dec  9 02:59:24 2020
New Revision: 368478
URL: https://svnweb.freebsd.org/changeset/base/368478

Log:
  MFV r368464:
  
  Update unbound from 1.12.0 to 1.13.0
  
  MFC after:1 week
  Security: CVE-2020-28935

Added:
  head/contrib/unbound/contrib/metrics.awk
 - copied unchanged from r368464, vendor/unbound/dist/contrib/metrics.awk
Modified:
  head/contrib/unbound/config.guess
  head/contrib/unbound/config.sub
  head/contrib/unbound/configure
  head/contrib/unbound/configure.ac
  head/contrib/unbound/contrib/README
  head/contrib/unbound/contrib/unbound.service.in
  head/contrib/unbound/contrib/unbound_portable.service.in
  head/contrib/unbound/daemon/daemon.c
  head/contrib/unbound/daemon/unbound.c
  head/contrib/unbound/daemon/worker.c
  head/contrib/unbound/dnstap/dnstap.c
  head/contrib/unbound/dnstap/dtstream.c
  head/contrib/unbound/doc/Changelog
  head/contrib/unbound/doc/README
  head/contrib/unbound/doc/example.conf.in
  head/contrib/unbound/doc/libunbound.3.in
  head/contrib/unbound/doc/unbound-anchor.8.in
  head/contrib/unbound/doc/unbound-checkconf.8.in
  head/contrib/unbound/doc/unbound-control.8.in
  head/contrib/unbound/doc/unbound-host.1.in
  head/contrib/unbound/doc/unbound.8.in
  head/contrib/unbound/doc/unbound.conf.5.in
  head/contrib/unbound/libunbound/context.c
  head/contrib/unbound/libunbound/libunbound.c
  head/contrib/unbound/libunbound/libworker.c
  head/contrib/unbound/respip/respip.c
  head/contrib/unbound/services/authzone.c
  head/contrib/unbound/services/cache/infra.c
  head/contrib/unbound/services/cache/infra.h
  head/contrib/unbound/services/listen_dnsport.c
  head/contrib/unbound/services/listen_dnsport.h
  head/contrib/unbound/services/localzone.c
  head/contrib/unbound/services/mesh.c
  head/contrib/unbound/services/outside_network.c
  head/contrib/unbound/services/outside_network.h
  head/contrib/unbound/services/rpz.c
  head/contrib/unbound/smallapp/unbound-control-setup.sh.in
  head/contrib/unbound/util/config_file.c
  head/contrib/unbound/util/config_file.h
  head/contrib/unbound/util/configlexer.lex
  head/contrib/unbound/util/configparser.y
  head/contrib/unbound/util/data/msgencode.c
  head/contrib/unbound/util/data/msgreply.h
  head/contrib/unbound/util/edns.c
  head/contrib/unbound/util/edns.h
  head/contrib/unbound/util/fptr_wlist.c
  head/contrib/unbound/util/iana_ports.inc
  head/contrib/unbound/util/module.h
  head/contrib/unbound/util/netevent.c
  head/contrib/unbound/util/netevent.h
  head/contrib/unbound/util/regional.c
  head/contrib/unbound/util/regional.h
  head/contrib/unbound/validator/val_secalgo.c
Directory Properties:
  head/contrib/unbound/   (props changed)

Modified: head/contrib/unbound/config.guess
==
--- head/contrib/unbound/config.guess   Wed Dec  9 02:47:39 2020
(r368477)
+++ head/contrib/unbound/config.guess   Wed Dec  9 02:59:24 2020
(r368478)
@@ -2,7 +2,7 @@
 # Attempt to guess a canonical system name.
 #   Copyright 1992-2020 Free Software Foundation, Inc.
 
-timestamp='2020-09-19'
+timestamp='2020-11-19'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,12 +27,12 @@ timestamp='2020-09-19'
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 #
 # Please send patches to .
 
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
 
 usage="\
 Usage: $0 [OPTION]
@@ -103,7 +103,7 @@ set_cc_for_build() {
 test "$tmp" && return 0
 : "${TMPDIR=/tmp}"
 # shellcheck disable=SC2039
-{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXX") 2>/dev/null` && test -n 
"$tmp" && test -d "$tmp" ; } ||
+{ tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXX") 2>/dev/null) && test 
-n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir 
"$tmp" 2>/dev/null) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo 
"Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 
1 ; }
@@ -131,16 +131,14 @@ if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH
 fi
 
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
+UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
+UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || 

svn commit: r368476 - head/release/riscv

2020-12-08 Thread Glen Barber
Author: gjb
Date: Wed Dec  9 02:21:25 2020
New Revision: 368476
URL: https://svnweb.freebsd.org/changeset/base/368476

Log:
  Copy arm64 make-memstick.sh and mkisoimages.sh to the riscv
  directory to allow properly building *.iso and *.img files.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Added:
  head/release/riscv/make-memstick.sh
 - copied unchanged from r368474, head/release/arm64/make-memstick.sh
  head/release/riscv/mkisoimages.sh
 - copied unchanged from r368474, head/release/arm64/mkisoimages.sh

Copied: head/release/riscv/make-memstick.sh (from r368474, 
head/release/arm64/make-memstick.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/release/riscv/make-memstick.sh Wed Dec  9 02:21:25 2020
(r368476, copy of r368474, head/release/arm64/make-memstick.sh)
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# This script generates a "memstick image" (image that can be copied to a
+# USB memory stick) from a directory tree.  Note that the script does not
+# clean up after itself very well for error conditions on purpose so the
+# problem can be diagnosed (full filesystem most likely but ...).
+#
+# Usage: make-memstick.sh  
+#
+# $FreeBSD$
+#
+
+set -e
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+export PATH
+
+scriptdir=$(dirname $(realpath $0))
+. ${scriptdir}/../../tools/boot/install-boot.sh
+
+if [ $# -ne 2 ]; then
+   echo "make-memstick.sh /path/to/directory /path/to/image/file"
+   exit 1
+fi
+
+if [ ! -d ${1} ]; then
+   echo "${1} must be a directory"
+   exit 1
+fi
+
+if [ -e ${2} ]; then
+   echo "won't overwrite ${2}"
+   exit 1
+fi
+
+echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab
+echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local
+makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1}
+rm ${1}/etc/fstab
+rm ${1}/etc/rc.conf.local
+
+# Make an ESP in a file.
+espfilename=$(mktemp /tmp/efiboot.XX)
+make_esp_file ${espfilename} ${fat32min} ${1}/boot/loader.efi
+
+mkimg -s gpt \
+-p efi:=${espfilename} \
+-p freebsd-ufs:=${2}.part \
+-o ${2}
+rm ${espfilename}
+rm ${2}.part
+

Copied: head/release/riscv/mkisoimages.sh (from r368474, 
head/release/arm64/mkisoimages.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/release/riscv/mkisoimages.sh   Wed Dec  9 02:21:25 2020
(r368476, copy of r368474, head/release/arm64/mkisoimages.sh)
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# This script is used by release/Makefile to build the (optional) ISO images
+# for a FreeBSD release.  It is considered architecture dependent since each
+# platform has a slightly unique way of making bootable CDs. This script is
+# also allowed to generate any number of images since that is more of
+# publishing decision than anything else.
+#
+# Usage:
+#
+# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
+#
+# Where -b is passed if the ISO image should be made "bootable" by
+# whatever standards this architecture supports (may be unsupported),
+# image-label is the ISO image label, image-name is the filename of the
+# resulting ISO image, base-bits-dir contains the image contents and
+# extra-bits-dir, if provided, contains additional files to be merged
+# into base-bits-dir as part of making the image.
+
+set -e
+
+scriptdir=$(dirname $(realpath $0))
+. ${scriptdir}/../../tools/boot/install-boot.sh
+
+if [ -z $ETDUMP ]; then
+   ETDUMP=etdump
+fi
+
+if [ -z $MAKEFS ]; then
+   MAKEFS=makefs
+fi
+
+if [ -z $MKIMG ]; then
+   MKIMG=mkimg
+fi
+
+if [ "$1" = "-b" ]; then
+   BASEBITSDIR="$4"
+
+   # Make an EFI system partition.
+   espfilename=$(mktemp /tmp/efiboot.XX)
+   # ESP file size in KB.
+   espsize="2048"
+   make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi
+
+   bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o 
platformid=efi"
+
+   shift
+else
+   BASEBITSDIR="$3"
+   bootable=""
+fi
+
+if [ $# -lt 3 ]; then
+   echo "Usage: $0 [-b] image-label image-name base-bits-dir 
[extra-bits-dir]"
+   exit 1
+fi
+
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
+
+publisher="The FreeBSD Project.  https://www.FreeBSD.org/;
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab"
+$MAKEFS -t cd9660 $bootable -o rockridge -o label="$LABEL" -o 
publisher="$publisher" "$NAME" "$@"
+rm -f "$BASEBITSDIR/etc/fstab"
+rm -f ${espfilename}
+
+if [ "$bootable" != "" ]; then
+   # Look for the EFI System Partition image we dropped in the ISO image.
+   for entry in `$ETDUMP --format shell $NAME`; do
+   eval $entry
+   # XXX: etdump(8) returns "default" for the initial entry
+   if [ "$et_platform" = "default" 

svn commit: r368473 - head/sys/dev/mfi

2020-12-08 Thread Justin Hibbits
Author: jhibbits
Date: Wed Dec  9 02:07:01 2020
New Revision: 368473
URL: https://svnweb.freebsd.org/changeset/base/368473

Log:
  dev/mfi: Make a seemingly bogus conditional unconditional
  
  Summary:
  r358689 attempted to fix a clang warning/error by inferring the intent
  of the condition "(cdb[0] != 0x28 || cdb[0] != 0x2A)".  Unfortunately, it 
looks
  like this broke things.  Instead, fix this by making this path unconditional,
  effectively reverting to the previous state.
  
  PR:   kern/251483
  Reviewed By:  ambrisko
  MFC after:2 days
  Differential Revision: https://reviews.freebsd.org/D27515

Modified:
  head/sys/dev/mfi/mfi_tbolt.c

Modified: head/sys/dev/mfi/mfi_tbolt.c
==
--- head/sys/dev/mfi/mfi_tbolt.cWed Dec  9 02:05:14 2020
(r368472)
+++ head/sys/dev/mfi/mfi_tbolt.cWed Dec  9 02:07:01 2020
(r368473)
@@ -1104,16 +1104,12 @@ mfi_tbolt_send_frame(struct mfi_softc *sc, struct mfi_
 
if (hdr->cmd == MFI_CMD_PD_SCSI_IO) {
/* check for inquiry commands coming from CLI */
-   if (cdb[0] != 0x28 && cdb[0] != 0x2A) {
-   if ((req_desc = mfi_tbolt_build_mpt_cmd(sc, cm)) ==
-   NULL) {
-   device_printf(sc->mfi_dev, "Mapping from MFI "
-   "to MPT Failed \n");
-   return 1;
-   }
+   if ((req_desc = mfi_tbolt_build_mpt_cmd(sc, cm)) ==
+   NULL) {
+   device_printf(sc->mfi_dev, "Mapping from MFI "
+   "to MPT Failed \n");
+   return 1;
}
-   else
-   device_printf(sc->mfi_dev, "DJA NA XXX SYSPDIO\n");
} else if (hdr->cmd == MFI_CMD_LD_SCSI_IO ||
hdr->cmd == MFI_CMD_LD_READ || hdr->cmd == MFI_CMD_LD_WRITE) {
cm->cm_flags |= MFI_CMD_SCSI;
___
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: r368472 - in head: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bio crypto/openssl/crypto/chac...

2020-12-08 Thread Jung-uk Kim
Author: jkim
Date: Wed Dec  9 02:05:14 2020
New Revision: 368472
URL: https://svnweb.freebsd.org/changeset/base/368472

Log:
  Merge OpenSSL 1.1.1i.

Modified:
  head/crypto/openssl/CHANGES
  head/crypto/openssl/NEWS
  head/crypto/openssl/README
  head/crypto/openssl/apps/ca.c
  head/crypto/openssl/apps/cms.c
  head/crypto/openssl/config
  head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl
  head/crypto/openssl/crypto/armcap.c
  head/crypto/openssl/crypto/asn1/tasn_dec.c
  head/crypto/openssl/crypto/asn1/tasn_enc.c
  head/crypto/openssl/crypto/bio/b_addr.c
  head/crypto/openssl/crypto/chacha/asm/chacha-armv8.pl
  head/crypto/openssl/crypto/cms/cms_smime.c
  head/crypto/openssl/crypto/evp/bio_ok.c
  head/crypto/openssl/crypto/modes/modes_local.h
  head/crypto/openssl/crypto/pkcs7/pk7_smime.c
  head/crypto/openssl/crypto/poly1305/asm/poly1305-armv8.pl
  head/crypto/openssl/crypto/rand/rand_unix.c
  head/crypto/openssl/crypto/sha/asm/sha1-armv8.pl
  head/crypto/openssl/crypto/sha/asm/sha512-armv8.pl
  head/crypto/openssl/crypto/x509/x509_att.c
  head/crypto/openssl/crypto/x509/x509_cmp.c
  head/crypto/openssl/crypto/x509/x509_vfy.c
  head/crypto/openssl/crypto/x509v3/v3_genn.c
  head/crypto/openssl/doc/man1/verify.pod
  head/crypto/openssl/doc/man3/BN_set_bit.pod
  head/crypto/openssl/doc/man3/X509_STORE_set_verify_cb_func.pod
  head/crypto/openssl/include/openssl/opensslv.h
  head/crypto/openssl/include/openssl/x509.h
  head/crypto/openssl/ssl/record/rec_layer_d1.c
  head/crypto/openssl/ssl/s3_lib.c
  head/crypto/openssl/ssl/ssl_lib.c
  head/crypto/openssl/ssl/ssl_sess.c
  head/crypto/openssl/ssl/statem/statem_clnt.c
  head/crypto/openssl/ssl/statem/statem_srvr.c
  head/secure/lib/libcrypto/Makefile.inc
  head/secure/lib/libcrypto/man/man3/ADMISSIONS.3
  head/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3
  head/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3
  head/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3
  head/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3
  head/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3
  head/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3
  head/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3
  head/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3
  head/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3
  head/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3
  head/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3
  head/secure/lib/libcrypto/man/man3/ASYNC_start_job.3
  head/secure/lib/libcrypto/man/man3/BF_encrypt.3
  head/secure/lib/libcrypto/man/man3/BIO_ADDR.3
  head/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3
  head/secure/lib/libcrypto/man/man3/BIO_connect.3
  head/secure/lib/libcrypto/man/man3/BIO_ctrl.3
  head/secure/lib/libcrypto/man/man3/BIO_f_buffer.3
  head/secure/lib/libcrypto/man/man3/BIO_f_cipher.3
  head/secure/lib/libcrypto/man/man3/BIO_f_md.3
  head/secure/lib/libcrypto/man/man3/BIO_f_ssl.3
  head/secure/lib/libcrypto/man/man3/BIO_find_type.3
  head/secure/lib/libcrypto/man/man3/BIO_get_data.3
  head/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3
  head/secure/lib/libcrypto/man/man3/BIO_meth_new.3
  head/secure/lib/libcrypto/man/man3/BIO_new.3
  head/secure/lib/libcrypto/man/man3/BIO_parse_hostserv.3
  head/secure/lib/libcrypto/man/man3/BIO_printf.3
  head/secure/lib/libcrypto/man/man3/BIO_push.3
  head/secure/lib/libcrypto/man/man3/BIO_read.3
  head/secure/lib/libcrypto/man/man3/BIO_s_accept.3
  head/secure/lib/libcrypto/man/man3/BIO_s_bio.3
  head/secure/lib/libcrypto/man/man3/BIO_s_connect.3
  head/secure/lib/libcrypto/man/man3/BIO_s_fd.3
  head/secure/lib/libcrypto/man/man3/BIO_s_file.3
  head/secure/lib/libcrypto/man/man3/BIO_s_mem.3
  head/secure/lib/libcrypto/man/man3/BIO_s_socket.3
  head/secure/lib/libcrypto/man/man3/BIO_set_callback.3
  head/secure/lib/libcrypto/man/man3/BIO_should_retry.3
  head/secure/lib/libcrypto/man/man3/BN_BLINDING_new.3
  head/secure/lib/libcrypto/man/man3/BN_CTX_new.3
  head/secure/lib/libcrypto/man/man3/BN_CTX_start.3
  head/secure/lib/libcrypto/man/man3/BN_add.3
  head/secure/lib/libcrypto/man/man3/BN_add_word.3
  head/secure/lib/libcrypto/man/man3/BN_bn2bin.3
  head/secure/lib/libcrypto/man/man3/BN_cmp.3
  head/secure/lib/libcrypto/man/man3/BN_copy.3
  head/secure/lib/libcrypto/man/man3/BN_generate_prime.3
  head/secure/lib/libcrypto/man/man3/BN_mod_mul_montgomery.3
  head/secure/lib/libcrypto/man/man3/BN_mod_mul_reciprocal.3
  head/secure/lib/libcrypto/man/man3/BN_new.3
  head/secure/lib/libcrypto/man/man3/BN_num_bytes.3
  head/secure/lib/libcrypto/man/man3/BN_rand.3
  head/secure/lib/libcrypto/man/man3/BN_set_bit.3
  head/secure/lib/libcrypto/man/man3/BN_zero.3
  head/secure/lib/libcrypto/man/man3/BUF_MEM_new.3
  head/secure/lib/libcrypto/man/man3/CMS_add0_cert.3
  head/secure/lib/libcrypto/man/man3/CMS_add1_recipient_cert.3
  head/secure/lib/libcrypto/man/man3/CMS_add1_signer.3
  head/secure/lib/libcrypto/man/man3/CMS_get0_RecipientInfos.3
  

svn commit: r368468 - head/sys/net

2020-12-08 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  8 23:54:09 2020
New Revision: 368468
URL: https://svnweb.freebsd.org/changeset/base/368468

Log:
  Fixup r368446 with KERN_TLS.

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue Dec  8 23:38:26 2020(r368467)
+++ head/sys/net/if_lagg.c  Tue Dec  8 23:54:09 2020(r368468)
@@ -1806,11 +1806,11 @@ lagg_snd_tag_alloc(struct ifnet *ifp,
lp = lookup_snd_tag_port(ifp, params->hdr.flowid,
params->hdr.flowtype, params->hdr.numa_domain);
if (lp == NULL) {
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
return (EOPNOTSUPP);
}
if (lp->lp_ifp == NULL) {
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
return (EOPNOTSUPP);
}
lp_ifp = lp->lp_ifp;
___
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: r368467 - in head: bin/chflags bin/chmod bin/cp bin/ls bin/rm bin/setfacl contrib/mtree usr.bin/du usr.bin/grep usr.bin/gzip usr.sbin/chown usr.sbin/ckdist usr.sbin/fmtree usr.sbin/setfmac

2020-12-08 Thread Bryan Drewery
Author: bdrewery
Date: Tue Dec  8 23:38:26 2020
New Revision: 368467
URL: https://svnweb.freebsd.org/changeset/base/368467

Log:
  fts_read: Handle error from a NULL return better.
  
  This is addressing cases such as fts_read(3) encountering an [EIO]
  from fchdir(2) when FTS_NOCHDIR is not set.  That would otherwise be
  seen as a successful traversal in some of these cases while silently
  discarding expected work.
  
  As noted in r264201, fts_read() does not set errno to 0 on a successful
  EOF so it needs to be set before calling it.  Otherwise we might see
  a random error from one of the iterations.
  
  gzip is ignoring most errors and could be improved separately.
  
  Reviewed by:  vangyzen
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D27184

Modified:
  head/bin/chflags/chflags.c
  head/bin/chmod/chmod.c
  head/bin/cp/cp.c
  head/bin/ls/ls.c
  head/bin/rm/rm.c
  head/bin/setfacl/setfacl.c
  head/contrib/mtree/create.c
  head/contrib/mtree/verify.c
  head/usr.bin/du/du.c
  head/usr.bin/grep/util.c
  head/usr.bin/gzip/gzip.c
  head/usr.sbin/chown/chown.c
  head/usr.sbin/ckdist/ckdist.c
  head/usr.sbin/fmtree/create.c
  head/usr.sbin/fmtree/verify.c
  head/usr.sbin/setfmac/setfmac.c

Modified: head/bin/chflags/chflags.c
==
--- head/bin/chflags/chflags.c  Tue Dec  8 22:37:30 2020(r368466)
+++ head/bin/chflags/chflags.c  Tue Dec  8 23:38:26 2020(r368467)
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
if ((ftsp = fts_open(++argv, fts_options , 0)) == NULL)
err(1, NULL);
 
-   for (rval = 0; (p = fts_read(ftsp)) != NULL;) {
+   for (rval = 0; errno = 0, (p = fts_read(ftsp)) != NULL;) {
int atflag;
 
if ((fts_options & FTS_LOGICAL) ||

Modified: head/bin/chmod/chmod.c
==
--- head/bin/chmod/chmod.c  Tue Dec  8 22:37:30 2020(r368466)
+++ head/bin/chmod/chmod.c  Tue Dec  8 23:38:26 2020(r368467)
@@ -164,7 +164,7 @@ done:   argv += optind;
 
if ((ftsp = fts_open(++argv, fts_options, 0)) == NULL)
err(1, "fts_open");
-   for (rval = 0; (p = fts_read(ftsp)) != NULL;) {
+   for (rval = 0; errno = 0, (p = fts_read(ftsp)) != NULL;) {
int atflag;
 
if ((fts_options & FTS_LOGICAL) ||

Modified: head/bin/cp/cp.c
==
--- head/bin/cp/cp.cTue Dec  8 22:37:30 2020(r368466)
+++ head/bin/cp/cp.cTue Dec  8 23:38:26 2020(r368467)
@@ -282,7 +282,8 @@ copy(char *argv[], enum op type, int fts_options)
 
if ((ftsp = fts_open(argv, fts_options, NULL)) == NULL)
err(1, "fts_open");
-   for (badcp = rval = 0; (curr = fts_read(ftsp)) != NULL; badcp = 0) {
+   for (badcp = rval = 0; errno = 0, (curr = fts_read(ftsp)) != NULL;
+badcp = 0) {
switch (curr->fts_info) {
case FTS_NS:
case FTS_DNR:

Modified: head/bin/ls/ls.c
==
--- head/bin/ls/ls.cTue Dec  8 22:37:30 2020(r368466)
+++ head/bin/ls/ls.cTue Dec  8 23:38:26 2020(r368467)
@@ -645,7 +645,7 @@ traverse(int argc, char *argv[], int options)
ch_options = !f_recursive && !f_label &&
options & FTS_NOSTAT ? FTS_NAMEONLY : 0;
 
-   while ((p = fts_read(ftsp)) != NULL)
+   while (errno = 0, (p = fts_read(ftsp)) != NULL)
switch (p->fts_info) {
case FTS_DC:
warnx("%s: directory causes a cycle", p->fts_name);

Modified: head/bin/rm/rm.c
==
--- head/bin/rm/rm.cTue Dec  8 22:37:30 2020(r368466)
+++ head/bin/rm/rm.cTue Dec  8 23:38:26 2020(r368467)
@@ -207,7 +207,7 @@ rm_tree(char **argv)
return;
err(1, "fts_open");
}
-   while ((p = fts_read(fts)) != NULL) {
+   while (errno = 0, (p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_DNR:
if (!fflag || p->fts_errno != ENOENT) {

Modified: head/bin/setfacl/setfacl.c
==
--- head/bin/setfacl/setfacl.c  Tue Dec  8 22:37:30 2020(r368466)
+++ head/bin/setfacl/setfacl.c  Tue Dec  8 23:38:26 2020(r368467)
@@ -498,8 +498,10 @@ main(int argc, char *argv[])
/* Open all files. */
if ((ftsp = fts_open(files_list, fts_options | FTS_NOSTAT, 0)) == NULL)
err(1, "fts_open");
-   while ((file = fts_read(ftsp)) != NULL)
+   while (errno = 0, (file = fts_read(ftsp)) != NULL)
 

Re: svn commit: r368439 - head/share/mk

2020-12-08 Thread Kyle Evans
On Tue, Dec 8, 2020 at 8:05 AM Kyle Evans  wrote:
>
> Author: kevans
> Date: Tue Dec  8 14:05:25 2020
> New Revision: 368439
> URL: https://svnweb.freebsd.org/changeset/base/368439
>
> Log:
>   src.opts.mk: switch to bsdgrep as /usr/bin/grep
>
> [.. snip ...]
>
>   I have some WIP to make bsdgrep faster, but do not consider it a blocker
>   when compared to the pros of switching now (aforementioned bugs, licensing).
>
> [.. snip ...]

I was asked to collect some stats from that patch to speed up bsdgrep;
while the patch isn't ready yet, I decided to do a (really really)
rough comparison between gnugrep/bsdgrep as well to follow-up on the
speed aspect and perhaps provide a baseline.

You can view the results of those comparisons (user time(1) output),
which felt 'representative enough' of the difference, here:
https://people.freebsd.org/~kevans/stable/grep-stats.txt

Some notes, to help with interpretation:
- This hardware is not great
- All runs were doing a recursive grep from the root of a non-active
base/head checkout, -I was not specified, in search of instances of
the same pattern (but actually literal)
- ${grep}-non == ${grep} -r 'closefrom' .
- ${grep}-n == ${grep} -nr 'closefrom' .
- ${grep}-c8 == ${grep} -rC8 'closefrom' .

The sampling was low enough quality that we can probably just discard
all of this, but I found the final two comparisons (gnugrep vs.
gnugrep -n vs. gnugrep -C8 and bsdgrep vs. bsdgrep -n vs. bsdgrep -C8)
interesting enough that I decided to share this despite the quality.
Here are the key points that I find interesting:

gnugrep sees a pretty significant difference from the baseline to
either of the other two modes. This was expected to some extent- both
-n and -C8 will imply some level of line tracking when you're taking
the chunked search approach, as you need to count lines even in chunks
that don't have any matches for -n and you might even need to do the
same for -C8.

I think the much smaller difference between the gnugrep baseline and
-C8 indicates that they probably don't take the simple/slow approach
of counting all newlines to determine that you have 8 and where the
8th prior started, but instead wait for a match then start
backtracking.

The surprising part about the bsdgrep comparison was that there is
significant slowdown when we're checking context. There is almost
certainly room for improvement there.

Thanks,

Kyle Evans
___
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: r368462 - head/sys/kern

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Tue Dec  8 18:47:22 2020
New Revision: 368462
URL: https://svnweb.freebsd.org/changeset/base/368462

Log:
  cpuset_set{affinity,domain}: do not allow empty masks
  
  cpuset_modify() would not currently catch this, because it only checks that
  the new mask is a subset of the root set and circumvents the EDEADLK check
  in cpuset_testupdate().
  
  This change both directly validates the mask coming in since we can
  trivially detect an empty mask, and it updates cpuset_testupdate to catch
  stuff like this going forward by always ensuring we don't end up with an
  empty mask.
  
  The check_mask argument has been renamed because the 'check' verbiage does
  not imply to me that it's actually doing a different operation. We're either
  augmenting the existing mask, or we are replacing it entirely.
  
  Reported by:  syzbot+4e3b1009de98d2fab...@syzkaller.appspotmail.com
  Discussed with:   andrew
  Reviewed by:  andrew, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27511

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Tue Dec  8 18:45:47 2020(r368461)
+++ head/sys/kern/kern_cpuset.c Tue Dec  8 18:47:22 2020(r368462)
@@ -633,7 +633,7 @@ domainset_shadow(const struct domainset *pdomain,
  * empty as well as RDONLY flags.
  */
 static int
-cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask)
+cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int augment_mask)
 {
struct cpuset *nset;
cpuset_t newmask;
@@ -642,13 +642,14 @@ cpuset_testupdate(struct cpuset *set, cpuset_t *mask, 
mtx_assert(_lock, MA_OWNED);
if (set->cs_flags & CPU_SET_RDONLY)
return (EPERM);
-   if (check_mask) {
-   if (!CPU_OVERLAP(>cs_mask, mask))
-   return (EDEADLK);
+   if (augment_mask) {
CPU_COPY(>cs_mask, );
CPU_AND(, mask);
} else
CPU_COPY(mask, );
+
+   if (CPU_EMPTY())
+   return (EDEADLK);
error = 0;
LIST_FOREACH(nset, >cs_children, cs_siblings) 
if ((error = cpuset_testupdate(nset, , 1)) != 0)
@@ -723,7 +724,7 @@ out:
  */
 static int
 cpuset_testupdate_domain(struct cpuset *set, struct domainset *dset,
-struct domainset *orig, int *count, int check_mask)
+struct domainset *orig, int *count, int augment_mask __unused)
 {
struct cpuset *nset;
struct domainset *domain;
@@ -2001,6 +2002,10 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t 
goto out;
}
}
+   if (CPU_EMPTY(mask)) {
+   error = EDEADLK;
+   goto out;
+   }
switch (level) {
case CPU_LEVEL_ROOT:
case CPU_LEVEL_CPUSET:
@@ -2254,6 +2259,10 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le
error = EINVAL;
goto out;
}
+   }
+   if (DOMAINSET_EMPTY(mask)) {
+   error = EDEADLK;
+   goto out;
}
DOMAINSET_COPY(mask, _mask);
domain.ds_policy = policy;
___
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: r368461 - head/sys/kern

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Tue Dec  8 18:45:47 2020
New Revision: 368461
URL: https://svnweb.freebsd.org/changeset/base/368461

Log:
  kern: cpuset: resolve race between cpuset_lookup/cpuset_rel
  
  The race plays out like so between threads A and B:
  
  1. A ref's cpuset 10
  2. B does a lookup of cpuset 10, grabs the cpuset lock and searches
 cpuset_ids
  3. A rel's cpuset 10 and observes the last ref, waits on the cpuset lock
 while B is still searching and not yet ref'd
  4. B ref's cpuset 10 and drops the cpuset lock
  5. A proceeds to free the cpuset out from underneath B
  
  Resolve the race by only releasing the last reference under the cpuset lock.
  Thread A now picks up the spinlock and observes that the cpuset has been
  revived, returning immediately for B to deal with later.
  
  Reported by:  syzbot+92dff413e201164c7...@syzkaller.appspotmail.com
  Reviewed by:  markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27498

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Tue Dec  8 18:44:06 2020(r368460)
+++ head/sys/kern/kern_cpuset.c Tue Dec  8 18:45:47 2020(r368461)
@@ -207,9 +207,13 @@ cpuset_rel(struct cpuset *set)
 {
cpusetid_t id;
 
-   if (refcount_release(>cs_ref) == 0)
+   if (refcount_release_if_not_last(>cs_ref))
return;
mtx_lock_spin(_lock);
+   if (!refcount_release(>cs_ref)) {
+   mtx_unlock_spin(_lock);
+   return;
+   }
LIST_REMOVE(set, cs_siblings);
id = set->cs_id;
if (id != CPUSET_INVALID)
@@ -229,9 +233,13 @@ static void
 cpuset_rel_defer(struct setlist *head, struct cpuset *set)
 {
 
-   if (refcount_release(>cs_ref) == 0)
+   if (refcount_release_if_not_last(>cs_ref))
return;
mtx_lock_spin(_lock);
+   if (!refcount_release(>cs_ref)) {
+   mtx_unlock_spin(_lock);
+   return;
+   }
LIST_REMOVE(set, cs_siblings);
if (set->cs_id != CPUSET_INVALID)
LIST_REMOVE(set, cs_link);
___
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: r368460 - head/sys/kern

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Tue Dec  8 18:44:06 2020
New Revision: 368460
URL: https://svnweb.freebsd.org/changeset/base/368460

Log:
  kern: cpuset: plug a unr leak
  
  cpuset_rel_defer() is supposed to be functionally equivalent to
  cpuset_rel() but with anything that might sleep deferred until
  cpuset_rel_complete -- this setup is used specifically for cpuset_setproc.
  
  Add in the missing unr free to match cpuset_rel. This fixes a leak that
  was observed when I wrote a small userland application to try and debug
  another issue, which effectively did:
  
  cpuset();
  cpuset();
  
  newid gets leaked when scratch is created; it's off the list, so there's
  no mechanism for anything else to relinquish it. A more realistic reproducer
  would likely be a process that inherits some cpuset that it's the only ref
  for, but it creates a new one to modify. Alternatively, administratively
  reassigning a process' cpuset that it's the last ref for will have the same
  effect.
  
  Discovered through D27498.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Tue Dec  8 18:28:49 2020(r368459)
+++ head/sys/kern/kern_cpuset.c Tue Dec  8 18:44:06 2020(r368460)
@@ -246,9 +246,14 @@ cpuset_rel_defer(struct setlist *head, struct cpuset *
 static void
 cpuset_rel_complete(struct cpuset *set)
 {
+   cpusetid_t id;
+
+   id = set->cs_id;
LIST_REMOVE(set, cs_link);
cpuset_rel(set->cs_parent);
uma_zfree(cpuset_zone, set);
+   if (id != CPUSET_INVALID)
+   free_unr(cpuset_unr, id);
 }
 
 /*
___
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: r368458 - head/sys/arm64/linux

2020-12-08 Thread Mitchell Horne
Author: mhorne
Date: Tue Dec  8 18:24:33 2020
New Revision: 368458
URL: https://svnweb.freebsd.org/changeset/base/368458

Log:
  arm64: fix struct l_sigaction_t layout
  
  The definition was copied from amd64, but the layout of the struct
  differs slightly between these platforms. This fixes spurious
  `unsupported sigaction flag 0x` messages when executing some
  Linux binaries on arm64.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D27460

Modified:
  head/sys/arm64/linux/linux.h

Modified: head/sys/arm64/linux/linux.h
==
--- head/sys/arm64/linux/linux.hTue Dec  8 18:11:28 2020
(r368457)
+++ head/sys/arm64/linux/linux.hTue Dec  8 18:24:33 2020
(r368458)
@@ -163,9 +163,9 @@ typedef void(*l_handler_t)(l_int);
 
 typedef struct {
l_handler_t lsa_handler;
-   l_sigset_t  lsa_mask;
l_ulong lsa_flags;
l_uintptr_t lsa_restorer;
+   l_sigset_t  lsa_mask;
 } l_sigaction_t;   /* XXX */
 
 typedef struct {
___
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: r368455 - in head/sys: arm64/arm64 arm64/include cddl/dev/dtrace/aarch64 cddl/dev/fbt

2020-12-08 Thread John Baldwin
Author: jhb
Date: Tue Dec  8 18:00:58 2020
New Revision: 368455
URL: https://svnweb.freebsd.org/changeset/base/368455

Log:
  Check that the frame pointer is within the current stack.
  
  This same check is used on other architectures.  Previously this would
  permit a stack frame to unwind into any arbitrary kernel address
  (including unmapped addresses).
  
  Reviewed by:  andrew, markj
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27362

Modified:
  head/sys/arm64/arm64/db_trace.c
  head/sys/arm64/arm64/stack_machdep.c
  head/sys/arm64/arm64/unwind.c
  head/sys/arm64/include/csan.h
  head/sys/arm64/include/stack.h
  head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
  head/sys/cddl/dev/fbt/fbt.c

Modified: head/sys/arm64/arm64/db_trace.c
==
--- head/sys/arm64/arm64/db_trace.c Tue Dec  8 17:57:18 2020
(r368454)
+++ head/sys/arm64/arm64/db_trace.c Tue Dec  8 18:00:58 2020
(r368455)
@@ -65,7 +65,7 @@ db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
 }
 
 static void
-db_stack_trace_cmd(struct unwind_state *frame)
+db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
 {
c_db_sym_t sym;
const char *name;
@@ -74,10 +74,8 @@ db_stack_trace_cmd(struct unwind_state *frame)
 
while (1) {
uintptr_t pc = frame->pc;
-   int ret;
 
-   ret = unwind_frame(frame);
-   if (ret < 0)
+   if (!unwind_frame(td, frame))
break;
 
sym = db_search_symbol(pc, DB_STGY_ANY, );
@@ -112,7 +110,7 @@ db_trace_thread(struct thread *thr, int count)
frame.sp = (uintptr_t)ctx->pcb_sp;
frame.fp = (uintptr_t)ctx->pcb_x[29];
frame.pc = (uintptr_t)ctx->pcb_x[30];
-   db_stack_trace_cmd();
+   db_stack_trace_cmd(thr, );
} else
db_trace_self();
return (0);
@@ -129,5 +127,5 @@ db_trace_self(void)
frame.sp = sp;
frame.fp = (uintptr_t)__builtin_frame_address(0);
frame.pc = (uintptr_t)db_trace_self;
-   db_stack_trace_cmd();
+   db_stack_trace_cmd(curthread, );
 }

Modified: head/sys/arm64/arm64/stack_machdep.c
==
--- head/sys/arm64/arm64/stack_machdep.cTue Dec  8 17:57:18 2020
(r368454)
+++ head/sys/arm64/arm64/stack_machdep.cTue Dec  8 18:00:58 2020
(r368455)
@@ -43,15 +43,15 @@ __FBSDID("$FreeBSD$");
 #include 
 
 static void
-stack_capture(struct stack *st, struct unwind_state *frame)
+stack_capture(struct thread *td, struct stack *st, struct unwind_state *frame)
 {
 
stack_zero(st);
while (1) {
-   unwind_frame(frame);
-   if (!INKERNEL((vm_offset_t)frame->fp) ||
-!INKERNEL((vm_offset_t)frame->pc))
+   if (!unwind_frame(td, frame))
break;
+   if (!INKERNEL((vm_offset_t)frame->pc))
+   break;
if (stack_put(st, frame->pc) == -1)
break;
}
@@ -73,7 +73,7 @@ stack_save_td(struct stack *st, struct thread *td)
frame.fp = td->td_pcb->pcb_x[29];
frame.pc = td->td_pcb->pcb_x[30];
 
-   stack_capture(st, );
+   stack_capture(td, st, );
return (0);
 }
 
@@ -89,5 +89,5 @@ stack_save(struct stack *st)
frame.fp = (uintptr_t)__builtin_frame_address(0);
frame.pc = (uintptr_t)stack_save;
 
-   stack_capture(st, );
+   stack_capture(curthread, st, );
 }

Modified: head/sys/arm64/arm64/unwind.c
==
--- head/sys/arm64/arm64/unwind.c   Tue Dec  8 17:57:18 2020
(r368454)
+++ head/sys/arm64/arm64/unwind.c   Tue Dec  8 18:00:58 2020
(r368455)
@@ -30,24 +30,26 @@
 #include 
 __FBSDID("$FreeBSD$");
 #include 
+#include 
 
 #include 
 #include 
 
-int
-unwind_frame(struct unwind_state *frame)
+bool
+unwind_frame(struct thread *td, struct unwind_state *frame)
 {
uintptr_t fp;
 
fp = frame->fp;
-   if (!INKERNEL(fp))
-   return (-1);
 
+   if (!kstack_contains(td, fp, sizeof(uintptr_t) * 2))
+   return (false);
+
frame->sp = fp + sizeof(uintptr_t) * 2;
/* FP to previous frame (X29) */
frame->fp = ((uintptr_t *)fp)[0];
/* LR (X30) */
frame->pc = ((uintptr_t *)fp)[1] - 4;
 
-   return (0);
+   return (true);
 }

Modified: head/sys/arm64/include/csan.h
==
--- head/sys/arm64/include/csan.h   Tue Dec  8 17:57:18 2020
(r368454)
+++ head/sys/arm64/include/csan.h   Tue Dec  8 18:00:58 2020
(r368455)
@@ -87,9 +87,9 @@ 

svn commit: r368454 - in head/sys: cddl/dev/dtrace/riscv cddl/dev/fbt riscv/include riscv/riscv

2020-12-08 Thread John Baldwin
Author: jhb
Date: Tue Dec  8 17:57:18 2020
New Revision: 368454
URL: https://svnweb.freebsd.org/changeset/base/368454

Log:
  Stack unwinding robustness fixes for RISC-V.
  
  - Push the kstack_contains check down into unwind_frame() so that it
is honored by DDB and DTrace.
  
  - Check that the trapframe for an exception frame is contained in the
traced thread's kernel stack for DDB traces.
  
  Reviewed by:  markj
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27357

Modified:
  head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c
  head/sys/cddl/dev/fbt/fbt.c
  head/sys/riscv/include/stack.h
  head/sys/riscv/riscv/db_trace.c
  head/sys/riscv/riscv/stack_machdep.c
  head/sys/riscv/riscv/unwind.c

Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c
==
--- head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c Tue Dec  8 17:44:34 2020
(r368453)
+++ head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c Tue Dec  8 17:57:18 2020
(r368454)
@@ -90,7 +90,7 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in
state.pc = (uintptr_t)dtrace_getpcstack;
 
while (depth < pcstack_limit) {
-   if (unwind_frame())
+   if (!unwind_frame(curthread, ))
break;
 
if (!INKERNEL(state.pc) || !INKERNEL(state.fp))
@@ -259,10 +259,10 @@ dtrace_getstackdepth(int aframes)
int scp_offset;
register_t sp;
int depth;
-   int done;
+   bool done;
 
depth = 1;
-   done = 0;
+   done = false;
 
__asm __volatile("mv %0, sp" : "=" (sp));
 
@@ -271,7 +271,7 @@ dtrace_getstackdepth(int aframes)
state.pc = (uintptr_t)dtrace_getstackdepth;
 
do {
-   done = unwind_frame();
+   done = !unwind_frame(curthread, );
if (!INKERNEL(state.pc) || !INKERNEL(state.fp))
break;
depth++;

Modified: head/sys/cddl/dev/fbt/fbt.c
==
--- head/sys/cddl/dev/fbt/fbt.c Tue Dec  8 17:44:34 2020(r368453)
+++ head/sys/cddl/dev/fbt/fbt.c Tue Dec  8 17:57:18 2020(r368454)
@@ -137,6 +137,15 @@ fbt_excluded(const char *name)
return (1);
 
/*
+* Stack unwinders may be called from probe context on some
+* platforms.
+*/
+#if defined(__riscv)
+   if (strcmp(name, "unwind_frame") == 0)
+   return (1);
+#endif
+
+   /*
 * When DTrace is built into the kernel we need to exclude
 * the FBT functions from instrumentation.
 */

Modified: head/sys/riscv/include/stack.h
==
--- head/sys/riscv/include/stack.h  Tue Dec  8 17:44:34 2020
(r368453)
+++ head/sys/riscv/include/stack.h  Tue Dec  8 17:57:18 2020
(r368454)
@@ -46,6 +46,6 @@ struct unwind_state {
uintptr_t pc;
 };
 
-int unwind_frame(struct unwind_state *);
+bool unwind_frame(struct thread *, struct unwind_state *);
 
 #endif /* !_MACHINE_STACK_H_ */

Modified: head/sys/riscv/riscv/db_trace.c
==
--- head/sys/riscv/riscv/db_trace.c Tue Dec  8 17:44:34 2020
(r368453)
+++ head/sys/riscv/riscv/db_trace.c Tue Dec  8 17:57:18 2020
(r368454)
@@ -73,7 +73,7 @@ db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
 }
 
 static void
-db_stack_trace_cmd(struct unwind_state *frame)
+db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
 {
const char *name;
db_expr_t offset;
@@ -100,6 +100,11 @@ db_stack_trace_cmd(struct unwind_state *frame)
struct trapframe *tf;
 
tf = (struct trapframe *)(uintptr_t)frame->sp;
+   if (!kstack_contains(td, (vm_offset_t)tf,
+   sizeof(*tf))) {
+   db_printf("--- invalid trapframe %p\n", tf);
+   break;
+   }
 
if ((tf->tf_scause & SCAUSE_INTR) != 0)
db_printf("--- interrupt %ld\n",
@@ -119,7 +124,7 @@ db_stack_trace_cmd(struct unwind_state *frame)
if (strcmp(name, "fork_trampoline") == 0)
break;
 
-   if (unwind_frame(frame) < 0)
+   if (!unwind_frame(td, frame))
break;
}
 }
@@ -135,7 +140,7 @@ db_trace_thread(struct thread *thr, int count)
frame.sp = ctx->pcb_sp;
frame.fp = ctx->pcb_s[0];
frame.pc = ctx->pcb_ra;
-   db_stack_trace_cmd();
+   db_stack_trace_cmd(thr, );
return (0);
 }
 
@@ -150,5 +155,5 @@ db_trace_self(void)
frame.sp = sp;
frame.fp = 

svn commit: r368453 - head/etc/mtree

2020-12-08 Thread Nick Hibma
Author: n_hibma
Date: Tue Dec  8 17:44:34 2020
New Revision: 368453
URL: https://svnweb.freebsd.org/changeset/base/368453

Log:
  Missed adding netgraph to mtree in r368443:
  
New Netgraph module ng_macfilter:
  
Macfilter to route packets through different hooks based on sender MAC 
address.
  
Based on ng_macfilter written by Pekka Nikander
  
Sponsered by Retina b.v.
  
  Reviewed by:afedorov
  MFC after:  2 weeks
  Differential Revision:  https://reviews.freebsd.org/D27268

Modified:
  head/etc/mtree/BSD.tests.dist

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Dec  8 17:42:32 2020
(r368452)
+++ head/etc/mtree/BSD.tests.dist   Tue Dec  8 17:44:34 2020
(r368453)
@@ -798,6 +798,8 @@
 ..
 net
 ..
+netgraph
+..
 netinet
 ..
 netinet6
___
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: r368452 - head/etc/mtree

2020-12-08 Thread Nick Hibma
Author: n_hibma
Date: Tue Dec  8 17:42:32 2020
New Revision: 368452
URL: https://svnweb.freebsd.org/changeset/base/368452

Log:
  Fix indenting for netmap.

Modified:
  head/etc/mtree/BSD.tests.dist

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Dec  8 17:28:42 2020
(r368451)
+++ head/etc/mtree/BSD.tests.dist   Tue Dec  8 17:42:32 2020
(r368452)
@@ -808,8 +808,8 @@
 tunnel
 ..
 ..
-netmap
-..
+netmap
+..
 netpfil
 common
 ..
___
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: r368451 - head/sys/dev/ath

2020-12-08 Thread Adrian Chadd
Author: adrian
Date: Tue Dec  8 17:28:42 2020
New Revision: 368451
URL: https://svnweb.freebsd.org/changeset/base/368451

Log:
  [ath] also remove the magic size value here for the transmit antenna 
statistics.

Modified:
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_athvar.h
==
--- head/sys/dev/ath/if_athvar.hTue Dec  8 17:27:24 2020
(r368450)
+++ head/sys/dev/ath/if_athvar.hTue Dec  8 17:28:42 2020
(r368451)
@@ -780,7 +780,8 @@ struct ath_softc {
ath_bufhead sc_bbuf;/* beacon buffers */
u_int   sc_bhalq;   /* HAL q for outgoing beacons */
u_int   sc_bmisscount;  /* missed beacon transmits */
-   u_int32_t   sc_ant_tx[8];   /* recent tx frames/antenna */
+   u_int32_t   sc_ant_tx[ATH_IOCTL_STATS_NUM_TX_ANTENNA];
+   /* recent tx frames/antenna */
struct ath_txq  *sc_cabq;   /* tx q for cab frames */
struct task sc_bmisstask;   /* bmiss int processing */
struct task sc_bstucktask;  /* stuck beacon processing */
___
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: r368450 - head/sys/dev/ath

2020-12-08 Thread Adrian Chadd
Author: adrian
Date: Tue Dec  8 17:27:24 2020
New Revision: 368450
URL: https://svnweb.freebsd.org/changeset/base/368450

Log:
  [ath] Don't use hard-coded values in the sanity check.
  
  Don't use hard-coded values in the phy error and receive antenna
  checks.

Modified:
  head/sys/dev/ath/if_ath_rx.c

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cTue Dec  8 17:25:59 2020
(r368449)
+++ head/sys/dev/ath/if_ath_rx.cTue Dec  8 17:27:24 2020
(r368450)
@@ -706,8 +706,11 @@ ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status 
ath_dfs_process_phy_err(sc, m, rstamp, rs);
}
 
-   /* Be suitably paranoid about receiving phy errors out 
of the stats array bounds */
-   if (rs->rs_phyerr < 64)
+   /*
+* Be suitably paranoid about receiving phy errors
+* out of the stats array bounds
+*/
+   if (rs->rs_phyerr < ATH_IOCTL_STATS_NUM_RX_PHYERR)
sc->sc_stats.ast_rx_phy[rs->rs_phyerr]++;
goto rx_error;  /* NB: don't count in ierrors */
}
@@ -835,7 +838,7 @@ rx_accept:
 * the majority of the statistics are only valid
 * for the last frame in an aggregate.
 */
-   if (rs->rs_antenna > 7) {
+   if (rs->rs_antenna >= ATH_IOCTL_STATS_NUM_RX_ANTENNA) {
device_printf(sc->sc_dev, "%s: rs_antenna > 7 (%d)\n",
__func__, rs->rs_antenna);
 #ifdef ATH_DEBUG
___
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: r368449 - head/sys/dev/ath

2020-12-08 Thread Adrian Chadd
Author: adrian
Date: Tue Dec  8 17:25:59 2020
New Revision: 368449
URL: https://svnweb.freebsd.org/changeset/base/368449

Log:
  [ath] replace the hard-coded magic values in if_athioctl.h with constant 
defines
  
  Replace some hard-coded magic values in the ioctl stats struct with
  #defines.  I'm going to follow up with some more sanity checking in
  the receive path that also use these values so we don't do bad
  things if the hardware is (more) confused.

Modified:
  head/sys/dev/ath/if_athioctl.h

Modified: head/sys/dev/ath/if_athioctl.h
==
--- head/sys/dev/ath/if_athioctl.h  Tue Dec  8 16:46:00 2020
(r368448)
+++ head/sys/dev/ath/if_athioctl.h  Tue Dec  8 17:25:59 2020
(r368449)
@@ -48,10 +48,14 @@ struct ath_tx_aggr_stats {
u_int32_t   aggr_rts_aggr_limited;
 };
 
+#defineATH_IOCTL_INTR_NUM_SYNC_INTR32
 struct ath_intr_stats {
-   u_int32_t   sync_intr[32];
+   u_int32_t   sync_intr[ATH_IOCTL_INTR_NUM_SYNC_INTR];
 };
 
+#defineATH_IOCTL_STATS_NUM_RX_PHYERR   64
+#defineATH_IOCTL_STATS_NUM_TX_ANTENNA  8
+#defineATH_IOCTL_STATS_NUM_RX_ANTENNA  8
 struct ath_stats {
u_int32_t   ast_watchdog;   /* device reset by watchdog */
u_int32_t   ast_hardware;   /* fatal hardware error interrupts */
@@ -96,7 +100,8 @@ struct ath_stats {
u_int32_t   ast_rx_badcrypt;/* rx failed 'cuz decryption */
u_int32_t   ast_rx_badmic;  /* rx failed 'cuz MIC failure */
u_int32_t   ast_rx_phyerr;  /* rx failed 'cuz of PHY err */
-   u_int32_t   ast_rx_phy[64]; /* rx PHY error per-code counts */
+   u_int32_t   ast_rx_phy[ATH_IOCTL_STATS_NUM_RX_PHYERR];
+   /* rx PHY error per-code counts */
u_int32_t   ast_rx_tooshort;/* rx discarded 'cuz frame too short */
u_int32_t   ast_rx_toobig;  /* rx discarded 'cuz frame too large */
u_int32_t   ast_rx_packets; /* packet recv on the interface */
@@ -115,8 +120,10 @@ struct ath_stats {
u_int32_t   ast_rate_drop;  /* rate control dropped xmit rate */
u_int32_t   ast_ant_defswitch;/* rx/default antenna switches */
u_int32_t   ast_ant_txswitch;/* tx antenna switches */
-   u_int32_t   ast_ant_rx[8];  /* rx frames with antenna */
-   u_int32_t   ast_ant_tx[8];  /* tx frames with antenna */
+   u_int32_t   ast_ant_rx[ATH_IOCTL_STATS_NUM_RX_ANTENNA];
+   /* rx frames with antenna */
+   u_int32_t   ast_ant_tx[ATH_IOCTL_STATS_NUM_TX_ANTENNA];
+   /* tx frames with antenna */
u_int32_t   ast_cabq_xmit;  /* cabq frames transmitted */
u_int32_t   ast_cabq_busy;  /* cabq found busy */
u_int32_t   ast_tx_raw; /* tx frames through raw api */
___
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: r368448 - head/sys/net

2020-12-08 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  8 16:46:00 2020
New Revision: 368448
URL: https://svnweb.freebsd.org/changeset/base/368448

Log:
  The list of ports in configuration path shall be protected by locks,
  epoch shall be used only for fast path.  Thus use LAGG_XLOCK() in
  lagg_[un]register_vlan.  This fixes sleeping in epoch panic.
  
  PR:   240609

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue Dec  8 16:43:35 2020(r368447)
+++ head/sys/net/if_lagg.c  Tue Dec  8 16:46:00 2020(r368448)
@@ -471,17 +471,16 @@ lagg_proto_portreq(struct lagg_softc *sc, struct lagg_
 static void
 lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 {
-   struct epoch_tracker et;
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   NET_EPOCH_ENTER(et);
+   LAGG_XLOCK(sc);
CK_SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   NET_EPOCH_EXIT(et);
+   LAGG_XUNLOCK(sc);
 }
 
 /*
@@ -491,17 +490,16 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int
 static void
 lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 {
-   struct epoch_tracker et;
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   NET_EPOCH_ENTER(et);
+   LAGG_XLOCK(sc);
CK_SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   NET_EPOCH_EXIT(et);
+   LAGG_XUNLOCK(sc);
 }
 
 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: r368447 - in head/crypto/openssl: crypto/asn1 crypto/err crypto/x509v3 include/openssl

2020-12-08 Thread Ed Maste
Author: emaste
Date: Tue Dec  8 16:43:35 2020
New Revision: 368447
URL: https://svnweb.freebsd.org/changeset/base/368447

Log:
  OpenSSL: address CVE-2020-1971
  
  OpenSSL commit 3db2c9f3:
  Complain if we are attempting to encode with an invalid ASN.1 template
  
  OpenSSL commit 43a7033:
  Check that multi-strings/CHOICE types don't use implicit tagging
  
  OpenSSL commit f960d812:
  Correctly compare EdiPartyName in GENERAL_NAME_cmp()
  
  Obtained from:OpenSSL 3db2c9f3, 43a7033, f960d812
  Security: CVE-2020-1971

Modified:
  head/crypto/openssl/crypto/asn1/asn1_err.c
  head/crypto/openssl/crypto/asn1/tasn_dec.c
  head/crypto/openssl/crypto/asn1/tasn_enc.c
  head/crypto/openssl/crypto/err/openssl.txt
  head/crypto/openssl/crypto/x509v3/v3_genn.c
  head/crypto/openssl/include/openssl/asn1err.h

Modified: head/crypto/openssl/crypto/asn1/asn1_err.c
==
--- head/crypto/openssl/crypto/asn1/asn1_err.c  Tue Dec  8 16:36:46 2020
(r368446)
+++ head/crypto/openssl/crypto/asn1/asn1_err.c  Tue Dec  8 16:43:35 2020
(r368447)
@@ -1,6 +1,6 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -49,6 +49,7 @@ static const ERR_STRING_DATA ASN1_str_functs[] = {
  "asn1_item_embed_d2i"},
 {ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_EMBED_NEW, 0),
  "asn1_item_embed_new"},
+{ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_EX_I2D, 0), "ASN1_item_ex_i2d"},
 {ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_FLAGS_I2D, 0),
  "asn1_item_flags_i2d"},
 {ERR_PACK(ERR_LIB_ASN1, ASN1_F_ASN1_ITEM_I2D_BIO, 0), "ASN1_item_i2d_bio"},
@@ -160,6 +161,7 @@ static const ERR_STRING_DATA ASN1_str_reasons[] = {
 "asn1 sig parse error"},
 {ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_AUX_ERROR), "aux error"},
 {ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_BAD_OBJECT_HEADER), "bad object header"},
+{ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_BAD_TEMPLATE), "bad template"},
 {ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_BMPSTRING_IS_WRONG_LENGTH),
 "bmpstring is wrong length"},
 {ERR_PACK(ERR_LIB_ASN1, 0, ASN1_R_BN_LIB), "bn lib"},

Modified: head/crypto/openssl/crypto/asn1/tasn_dec.c
==
--- head/crypto/openssl/crypto/asn1/tasn_dec.c  Tue Dec  8 16:36:46 2020
(r368446)
+++ head/crypto/openssl/crypto/asn1/tasn_dec.c  Tue Dec  8 16:43:35 2020
(r368447)
@@ -182,6 +182,15 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, cons
  tag, aclass, opt, ctx);
 
 case ASN1_ITYPE_MSTRING:
+/*
+ * It never makes sense for multi-strings to have implicit tagging, so
+ * if tag != -1, then this looks like an error in the template.
+ */
+if (tag != -1) {
+ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_BAD_TEMPLATE);
+goto err;
+}
+
 p = *in;
 /* Just read in tag and class */
 ret = asn1_check_tlen(NULL, , , NULL, NULL,
@@ -199,6 +208,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, cons
 ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_MSTRING_NOT_UNIVERSAL);
 goto err;
 }
+
 /* Check tag matches bit map */
 if (!(ASN1_tag2bit(otag) & it->utype)) {
 /* If OPTIONAL, assume this is OK */
@@ -215,6 +225,15 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, cons
 return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
 
 case ASN1_ITYPE_CHOICE:
+/*
+ * It never makes sense for CHOICE types to have implicit tagging, so
+ * if tag != -1, then this looks like an error in the template.
+ */
+if (tag != -1) {
+ASN1err(ASN1_F_ASN1_ITEM_EMBED_D2I, ASN1_R_BAD_TEMPLATE);
+goto err;
+}
+
 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
 goto auxerr;
 if (*pval) {

Modified: head/crypto/openssl/crypto/asn1/tasn_enc.c
==
--- head/crypto/openssl/crypto/asn1/tasn_enc.c  Tue Dec  8 16:36:46 2020
(r368446)
+++ head/crypto/openssl/crypto/asn1/tasn_enc.c  Tue Dec  8 16:43:35 2020
(r368447)
@@ -103,9 +103,25 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char 
 return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
 
 case ASN1_ITYPE_MSTRING:
+/*
+ * It never makes sense for multi-strings to have implicit tagging, so
+ * if tag != -1, then this looks like an error in the template.
+ */
+if (tag != -1) {
+

svn commit: r368446 - head/sys/net

2020-12-08 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec  8 16:36:46 2020
New Revision: 368446
URL: https://svnweb.freebsd.org/changeset/base/368446

Log:
  Convert LAGG_RLOCK() to NET_EPOCH_ENTER(). No functional changes.

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue Dec  8 15:51:05 2020(r368445)
+++ head/sys/net/if_lagg.c  Tue Dec  8 16:36:46 2020(r368446)
@@ -84,11 +84,6 @@ __FBSDID("$FreeBSD$");
 extern voidnd6_setmtu(struct ifnet *);
 #endif
 
-#defineLAGG_RLOCK()struct epoch_tracker lagg_et; 
epoch_enter_preempt(net_epoch_preempt, _et)
-#defineLAGG_RUNLOCK()  epoch_exit_preempt(net_epoch_preempt, _et)
-#defineLAGG_RLOCK_ASSERT() NET_EPOCH_ASSERT()
-#defineLAGG_UNLOCK_ASSERT()MPASS(!in_epoch(net_epoch_preempt))
-
 #defineLAGG_SX_INIT(_sc)   sx_init(&(_sc)->sc_sx, "if_lagg sx")
 #defineLAGG_SX_DESTROY(_sc)sx_destroy(&(_sc)->sc_sx)
 #defineLAGG_XLOCK(_sc) sx_xlock(&(_sc)->sc_sx)
@@ -476,16 +471,17 @@ lagg_proto_portreq(struct lagg_softc *sc, struct lagg_
 static void
 lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 {
+   struct epoch_tracker et;
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK();
+   NET_EPOCH_ENTER(et);
CK_SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
 }
 
 /*
@@ -495,16 +491,17 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int
 static void
 lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 {
+   struct epoch_tracker et;
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK();
+   NET_EPOCH_ENTER(et);
CK_SLIST_FOREACH(lp, >sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
 }
 
 static int
@@ -1011,6 +1008,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport
 static int
 lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
+   struct epoch_tracker et;
struct lagg_reqport *rp = (struct lagg_reqport *)data;
struct lagg_softc *sc;
struct lagg_port *lp = NULL;
@@ -1035,15 +1033,15 @@ lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
break;
}
 
-   LAGG_RLOCK();
+   NET_EPOCH_ENTER(et);
if ((lp = ifp->if_lagg) == NULL || lp->lp_softc != sc) {
error = ENOENT;
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
break;
}
 
lagg_port2req(lp, rp);
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
break;
 
case SIOCSIFCAP:
@@ -1096,6 +1094,7 @@ fallback:
 static uint64_t
 lagg_get_counter(struct ifnet *ifp, ift_counter cnt)
 {
+   struct epoch_tracker et;
struct lagg_softc *sc;
struct lagg_port *lp;
struct ifnet *lpifp;
@@ -1107,7 +1106,7 @@ lagg_get_counter(struct ifnet *ifp, ift_counter cnt)
sc = (struct lagg_softc *)ifp->if_softc;
 
vsum = 0;
-   LAGG_RLOCK();
+   NET_EPOCH_ENTER(et);
CK_SLIST_FOREACH(lp, >sc_ports, lp_entries) {
/* Saved attached value */
oldval = lp->port_counters.val[cnt];
@@ -1117,7 +1116,7 @@ lagg_get_counter(struct ifnet *ifp, ift_counter cnt)
/* Calculate diff and save new */
vsum += newval - oldval;
}
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
 
/*
 * Add counter data which might be added by upper
@@ -1218,6 +1217,7 @@ lagg_port2req(struct lagg_port *lp, struct lagg_reqpor
 static void
 lagg_watchdog_infiniband(void *arg)
 {
+   struct epoch_tracker et;
struct lagg_softc *sc;
struct lagg_port *lp;
struct ifnet *ifp;
@@ -1234,7 +1234,7 @@ lagg_watchdog_infiniband(void *arg)
 * a guarantee against too frequent events. This operation
 * does not have to be atomic.
 */
-   LAGG_RLOCK();
+   NET_EPOCH_ENTER(et);
lp = lagg_link_active(sc, sc->sc_primary);
if (lp != NULL) {
ifp = sc->sc_ifp;
@@ -1248,7 +1248,7 @@ lagg_watchdog_infiniband(void *arg)
CURVNET_RESTORE();
}
}
-   LAGG_RUNLOCK();
+   NET_EPOCH_EXIT(et);
 
callout_reset(>sc_watchdog, hz, _watchdog_infiniband, arg);
 }
@@ -1314,6 +1314,7 @@ lagg_stop(struct lagg_softc *sc)
 static 

svn commit: r368445 - head/sys/arm64/arm64

2020-12-08 Thread Andrew Turner
Author: andrew
Date: Tue Dec  8 15:51:05 2020
New Revision: 368445
URL: https://svnweb.freebsd.org/changeset/base/368445

Log:
  Use a macro to find the offset of kern_ttbr0
  
  Rather than hard coding the offset of kern_ttbr0 within arm64_bootparams
  use a macro like the other fields.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/locore.S

Modified: head/sys/arm64/arm64/genassym.c
==
--- head/sys/arm64/arm64/genassym.c Tue Dec  8 15:41:18 2020
(r368444)
+++ head/sys/arm64/arm64/genassym.c Tue Dec  8 15:51:05 2020
(r368445)
@@ -45,6 +45,7 @@ ASSYM(BP_KERN_L1PT, offsetof(struct arm64_bootparams, 
 ASSYM(BP_KERN_DELTA, offsetof(struct arm64_bootparams, kern_delta));
 ASSYM(BP_KERN_STACK, offsetof(struct arm64_bootparams, kern_stack));
 ASSYM(BP_KERN_L0PT, offsetof(struct arm64_bootparams, kern_l0pt));
+ASSYM(BP_KERN_TTBR0, offsetof(struct arm64_bootparams, kern_ttbr0));
 ASSYM(BP_BOOT_EL, offsetof(struct arm64_bootparams, boot_el));
 
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Tue Dec  8 15:41:18 2020
(r368444)
+++ head/sys/arm64/arm64/locore.S   Tue Dec  8 15:51:05 2020
(r368445)
@@ -166,8 +166,8 @@ virtdone:
adr x25, initstack
str x25, [x0, #BP_KERN_STACK]
str x24, [x0, #BP_KERN_L0PT]
+   str x27, [x0, #BP_KERN_TTBR0]
str x23, [x0, #BP_BOOT_EL]
-   str x27, [x0, 40]   /* kern_ttbr0 */
 
/* trace back starts here */
mov fp, #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: r368444 - head/sys/arm64/arm64

2020-12-08 Thread Andrew Turner
Author: andrew
Date: Tue Dec  8 15:41:18 2020
New Revision: 368444
URL: https://svnweb.freebsd.org/changeset/base/368444

Log:
  Free the arm64 bootparams memory after initarm
  
  This is only needed in initarm, we can return this memory to the stack
  used by mi_startup.
  
  Sponsored by: Innivate UK

Modified:
  head/sys/arm64/arm64/locore.S

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Tue Dec  8 15:09:42 2020
(r368443)
+++ head/sys/arm64/arm64/locore.S   Tue Dec  8 15:41:18 2020
(r368444)
@@ -173,6 +173,8 @@ virtdone:
mov fp, #0
/* Branch to C code */
bl  initarm
+   /* We are done with the boot params */
+   add sp, sp, #BOOTPARAMS_SIZE
bl  mi_startup
 
/* We should not get here */
___
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: r368443 - in head: share/man/man4 sys/conf sys/modules/netgraph sys/modules/netgraph/macfilter sys/netgraph tests/sys tests/sys/netgraph

2020-12-08 Thread Nick Hibma
Author: n_hibma
Date: Tue Dec  8 15:09:42 2020
New Revision: 368443
URL: https://svnweb.freebsd.org/changeset/base/368443

Log:
  New Netgraph module ng_macfilter:
  
  Macfilter to route packets through different hooks based on sender MAC 
address.
  
  Based on ng_macfilter written by Pekka Nikander
  
  Sponsered by Retina b.v.
  
  Reviewed by:  afedorov
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D27268

Added:
  head/share/man/man4/ng_macfilter.4   (contents, props changed)
  head/sys/modules/netgraph/macfilter/
  head/sys/modules/netgraph/macfilter/Makefile   (contents, props changed)
 - copied, changed from r367755, head/sys/modules/netgraph/tag/Makefile
  head/sys/netgraph/ng_macfilter.c   (contents, props changed)
  head/sys/netgraph/ng_macfilter.h   (contents, props changed)
  head/tests/sys/netgraph/
  head/tests/sys/netgraph/Makefile   (contents, props changed)
  head/tests/sys/netgraph/ng_macfilter_test.sh   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/conf/files
  head/sys/modules/netgraph/Makefile
  head/tests/sys/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Dec  8 15:00:07 2020
(r368442)
+++ head/share/man/man4/MakefileTue Dec  8 15:09:42 2020
(r368443)
@@ -356,6 +356,7 @@ MAN=aac.4 \
ng_l2cap.4 \
ng_l2tp.4 \
ng_lmi.4 \
+   ng_macfilter.4 \
ng_mppc.4 \
ng_nat.4 \
ng_netflow.4 \

Added: head/share/man/man4/ng_macfilter.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/ng_macfilter.4  Tue Dec  8 15:09:42 2020
(r368443)
@@ -0,0 +1,222 @@
+.\" Copyright (c) 2012-2017 Pekka Nikander
+.\" Copyright (c) 2018 Retina b.v.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"may be used to endorse or promote products derived from this software
+.\"without specific prior written permission.
+.\"
+.\" 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 December 10, 2018
+.Dt NG_MACFILTER 4
+.Os
+.Sh NAME
+.Nm ng_macfilter
+.Nd packet filtering netgraph node using ethernet MAC addresses
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_macfilter.h
+.Sh DESCRIPTION
+The
+.Nm macfilter
+allows routing ethernet packets over different hooks based on the sender MAC
+address.
+.Pp
+This processing is done when traffic flows from the
+.Dq ether
+hook trough
+.Nm macfilter
+to one of the outgoing hooks.
+Outbound hooks can be added to and remove from
+.Nm macfilter
+and arbitrarily named.
+By default one hook called
+.Dq default
+is present and used for all packets which have no MAC address in the MAC table.
+By adding MAC addresses to the MAC table traffic coming from this host can be
+directed out other hooks.
+.Nm macfilter
+keeps track of packets and bytes from and to this MAC address in the MAC table.
+.Pp
+Packets are not altered in any way.
+If hooks are not connected, packets are
+dropped.
+.Sh HOOKS
+This node type by default has an
+.Dv ether
+hook, to be connected to the
+.Dv lower
+hook of the NIC, and a
+.Dv default
+hook where packets are sent if the MAC adddress is not found in the table.
+.Nm macfilter
+supports up to
+.Dv NG_MACFILTER_UPPER_NUM
+hooks to be connected to the NIC's upper hook.
+Other nodes can be inserted to provide additional processing.
+All outbound can be combined back into one by using
+.Dv ng_one2many .
+.Sh CONTROL MESSAGES

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

2020-12-08 Thread Ed Maste
Author: emaste
Date: Tue Dec  8 15:00:07 2020
New Revision: 368442
URL: https://svnweb.freebsd.org/changeset/base/368442

Log:
  regen src.conf.5 after r368441, WITHOUT_GDB default

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Tue Dec  8 14:56:15 2020
(r368441)
+++ head/share/man/man5/src.conf.5  Tue Dec  8 15:00:07 2020
(r368442)
@@ -656,18 +656,9 @@ and
 .Xr ftpd 8 .
 .It Va WITHOUT_GAMES
 Set to not build games.
-.It Va WITHOUT_GDB
-Set to not build
-.Xr gdb 1 .
-.Pp
-This is a default setting on
-arm64/aarch64, riscv/riscv64 and riscv/riscv64sf.
 .It Va WITH_GDB
 Set to build
 .Xr gdb 1 .
-.Pp
-This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mips, mips/mips64, 
powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_GH_BC
 Set to not build and install the enhanced
 .Xr bc 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: r368441 - head/share/mk

2020-12-08 Thread Ed Maste
Author: emaste
Date: Tue Dec  8 14:56:15 2020
New Revision: 368441
URL: https://svnweb.freebsd.org/changeset/base/368441

Log:
  Default to WITHOUT_GDB (GDB 6.1.1) for FreeBSD 13
  
  As discussed on -current, -stable, -toolchain, and with jhb@ and imp@,
  disable the obsolete in-tree GDB 6.1.1 by default.  This was kept only
  to provide kgdb for the crashinfo tool, but is long-obsolete, does not
  support all architectures that FreeBSD does, and held back other work
  (such as forcing the use of DWARF2 for kernel debug).
  
  Crashinfo will use kgdb from the gdb package or devel/gdb port, and will
  privde a message referencing those if no kgdb is found.
  
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation

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

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Tue Dec  8 14:05:54 2020(r368440)
+++ head/share/mk/src.opts.mk   Tue Dec  8 14:56:15 2020(r368441)
@@ -106,7 +106,6 @@ __DEFAULT_YES_OPTIONS = \
 FREEBSD_UPDATE \
 FTP \
 GAMES \
-GDB \
 GH_BC \
 GNU_DIFF \
 GNU_GREP \
@@ -208,6 +207,7 @@ __DEFAULT_NO_OPTIONS = \
 CLANG_FORMAT \
 DTRACE_TESTS \
 EXPERIMENTAL \
+GDB \
 HESIOD \
 LIBSOFT \
 LOADER_FIREWIRE \
___
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: r368440 - head/share/man/man5

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Tue Dec  8 14:05:54 2020
New Revision: 368440
URL: https://svnweb.freebsd.org/changeset/base/368440

Log:
  src.conf(5): regen after r368439 (WITH_BSD_GREP default)

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Tue Dec  8 14:05:25 2020
(r368439)
+++ head/share/man/man5/src.conf.5  Tue Dec  8 14:05:54 2020
(r368440)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd November 13, 2020
+.Dd December 8, 2020
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -222,8 +222,8 @@ and related programs.
 .It Va WITHOUT_BSD_CPIO
 Set to not build the BSD licensed version of cpio based on
 .Xr libarchive 3 .
-.It Va WITH_BSD_GREP
-Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
+.It Va WITHOUT_BSD_GREP
+Install GNU grep as '[ef]grep' instead of BSD grep.
 .It Va WITHOUT_BSNMP
 Set to not build or install
 .Xr bsnmpd 1
@@ -680,10 +680,6 @@ Set to not build GNU
 .It Va WITHOUT_GNU_GREP
 Set to not build GNU
 .Xr grep 1 .
-.It Va WITH_GNU_GREP_COMPAT
-Set this option to include GNU extensions in
-.Xr bsdgrep 1
-by linking against libgnuregex.
 .It Va WITHOUT_GOOGLETEST
 Set to neither build nor install
 .Lb libgmock ,
___
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: r368439 - head/share/mk

2020-12-08 Thread Kyle Evans
Author: kevans
Date: Tue Dec  8 14:05:25 2020
New Revision: 368439
URL: https://svnweb.freebsd.org/changeset/base/368439

Log:
  src.opts.mk: switch to bsdgrep as /usr/bin/grep
  
  This has been years in the making, and we all knew it was bound to happen
  some day. Switch to the BSDL grep implementation now that it's been a
  little more thoroughly tested and theoretically supports all of the
  extensions that gnugrep in base had with our libregex(3).
  
  Folks shouldn't really notice much from this update; bsdgrep is slower than
  gnugrep, but this is currently the price to pay for fewer bugs. Those
  dissatisfied with the speed of grep and in need of a faster implementation
  should check out what textproc/ripgrep and textproc/the_silver_searcher
  can do for them.
  
  I have some WIP to make bsdgrep faster, but do not consider it a blocker
  when compared to the pros of switching now (aforementioned bugs, licensing).
  
  PR:   228798 (exp-run)
  PR:   128645, 156704, 166842, 166862, 180937, 193835, 201650
  PR:   232565, 242308, 246000, 251081, 191086, 194397
  Relnotes: yes, please

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

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Tue Dec  8 08:20:30 2020(r368438)
+++ head/share/mk/src.opts.mk   Tue Dec  8 14:05:25 2020(r368439)
@@ -68,6 +68,7 @@ __DEFAULT_YES_OPTIONS = \
 BOOTPARAMD \
 BOOTPD \
 BSD_CPIO \
+BSD_GREP \
 BSDINSTALL \
 BSNMP \
 BZIP2 \
@@ -203,7 +204,6 @@ __DEFAULT_YES_OPTIONS = \
 __DEFAULT_NO_OPTIONS = \
 BEARSSL \
 BHYVE_SNAPSHOT \
-BSD_GREP \
 CLANG_EXTRAS \
 CLANG_FORMAT \
 DTRACE_TESTS \
___
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"