From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 01:38:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B510B4DD5D5; Mon, 18 Jan 2021 01:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DJvZq4f0vz4lSq; Mon, 18 Jan 2021 01:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8792333E5; Mon, 18 Jan 2021 01:38:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10I1cxu6037280; Mon, 18 Jan 2021 01:38:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10I1cxYh037279; Mon, 18 Jan 2021 01:38:59 GMT (envelope-from git) Date: Mon, 18 Jan 2021 01:38:59 GMT Message-Id: <202101180138.10I1cxYh037279@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 42ca6b642f45 - stable/12 - sbin/camcontrol: use calloc/strlcpy where appropriate. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 42ca6b642f455c9fa3d2b08033e983550741412d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 01:38:59 -0000 The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=42ca6b642f455c9fa3d2b08033e983550741412d commit 42ca6b642f455c9fa3d2b08033e983550741412d Author: Xin LI AuthorDate: 2021-01-04 06:52:28 +0000 Commit: Xin LI CommitDate: 2021-01-18 01:38:46 +0000 sbin/camcontrol: use calloc/strlcpy where appropriate. MFC after: 2 weeks (cherry picked from commit fd340a122259d44a7d01a72890ff40411f87d79c) --- sbin/camcontrol/camcontrol.c | 5 ++--- sbin/camcontrol/modeedit.c | 5 ++--- sbin/camcontrol/util.c | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 20cae4154cef..0b8b9e57fb43 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -2479,11 +2479,10 @@ atasecurity_notify(u_int8_t command, struct ata_security_password *pwd) printf("Issuing %s", ata_op_string(&cmd)); if (pwd != NULL) { + /* pwd->password may not be null terminated */ char pass[sizeof(pwd->password)+1]; - /* pwd->password may not be null terminated */ - pass[sizeof(pwd->password)] = '\0'; - strncpy(pass, pwd->password, sizeof(pwd->password)); + strlcpy(pass, pwd->password, sizeof(pass)); printf(" password='%s', user='%s'", pass, (pwd->ctrl & ATA_SECURITY_PASSWORD_MASTER) ? diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c index c35ad143e1da..15e5c6608f47 100644 --- a/sbin/camcontrol/modeedit.c +++ b/sbin/camcontrol/modeedit.c @@ -329,10 +329,9 @@ editentry_set(char *name, char *newvalue, int editonly) case 'c': /* Character array. */ case 'z': /* Null-padded string. */ - if ((cval = malloc(dest->size + 1)) == NULL) + if ((cval = calloc(1, dest->size + 1)) == NULL) err(EX_OSERR, NULL); - bzero(cval, dest->size + 1); - strncpy(cval, newvalue, dest->size); + strlcpy(cval, newvalue, dest->size + 1); if (dest->type == 'z') { /* Convert trailing spaces to nulls. */ char *convertend2; diff --git a/sbin/camcontrol/util.c b/sbin/camcontrol/util.c index c22f3a05e746..58fc93746fc7 100644 --- a/sbin/camcontrol/util.c +++ b/sbin/camcontrol/util.c @@ -126,14 +126,13 @@ arg_put(void *hook __unused, int letter, void *arg, int count, char *name) { char *p; - p = malloc(count + 1); + p = calloc(1, count + 1); if (p == NULL) { fprintf(stderr, "can't malloc memory for p\n"); exit(1); } - bzero(p, count +1); - strncpy(p, (char *)arg, count); + strlcpy(p, (char *)arg, count + 1); if (letter == 'z') { int i; From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 05:40:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52DBB4E1EF0; Mon, 18 Jan 2021 05:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DK0xX1xQsz3Ddw; Mon, 18 Jan 2021 05:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3110A6A3A; Mon, 18 Jan 2021 05:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10I5eWqp058192; Mon, 18 Jan 2021 05:40:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10I5eWb8058191; Mon, 18 Jan 2021 05:40:32 GMT (envelope-from git) Date: Mon, 18 Jan 2021 05:40:32 GMT Message-Id: <202101180540.10I5eWb8058191@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1a581d16e268 - stable/12 - libthr: wrap pdfork(2), same as fork(2). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a581d16e268f21c25a7cfa0bcdc3b35f25ff6e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 05:40:32 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1a581d16e268f21c25a7cfa0bcdc3b35f25ff6e1 commit 1a581d16e268f21c25a7cfa0bcdc3b35f25ff6e1 Author: Konstantin Belousov AuthorDate: 2021-01-10 19:22:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-18 05:09:04 +0000 libthr: wrap pdfork(2), same as fork(2). (cherry picked from commit 21f749da82e755aafab127618affeffb86cff9a5) --- lib/libc/include/libc_private.h | 2 ++ lib/libc/sys/Symbol.map | 1 + lib/libc/sys/interposing_table.c | 1 + lib/libc/sys/pdfork.c | 46 ++++++++++++++++++++++++++++ lib/libthr/thread/thr_fork.c | 66 +++++++++++++++++++++++++++++++++++----- lib/libthr/thread/thr_private.h | 1 + lib/libthr/thread/thr_syscalls.c | 1 + 7 files changed, 111 insertions(+), 7 deletions(-) diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index d3fe788e9654..8517899f56ef 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -238,6 +238,7 @@ enum { INTERPOS_fdatasync, INTERPOS_clock_nanosleep, INTERPOS_distribute_static_tls, + INTERPOS_pdfork, INTERPOS_MAX }; @@ -352,6 +353,7 @@ int __sys_msync(void *, __size_t, int); int __sys_nanosleep(const struct timespec *, struct timespec *); int __sys_open(const char *, int, ...); int __sys_openat(int, const char *, int, ...); +int __sys_pdfork(int *, int); int __sys_pselect(int, struct fd_set *, struct fd_set *, struct fd_set *, const struct timespec *, const __sigset_t *); diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 353786343b54..ba4ea515c93d 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -797,6 +797,7 @@ FBSDprivate_1.0 { __sys_openat; _pathconf; __sys_pathconf; + __sys_pdfork; _pipe; __sys_pipe; _poll; diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c index 670e9fd7dd0f..b2cfb3250cd9 100644 --- a/lib/libc/sys/interposing_table.c +++ b/lib/libc/sys/interposing_table.c @@ -82,6 +82,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = { SLOT(fdatasync, __sys_fdatasync), SLOT(clock_nanosleep, __sys_clock_nanosleep), SLOT(distribute_static_tls, __libc_distribute_static_tls), + SLOT(pdfork, __sys_pdfork), }; #undef SLOT diff --git a/lib/libc/sys/pdfork.c b/lib/libc/sys/pdfork.c new file mode 100644 index 000000000000..003262d1237d --- /dev/null +++ b/lib/libc/sys/pdfork.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 The FreeBSD Foundation. + * All rights reserved. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * 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(s), this list of conditions and the following disclaimer as + * the first lines of this file unmodified other than the possible + * addition of one or more copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "libc_private.h" + +#pragma weak pdfork +pid_t +pdfork(int *fdp, int flags) +{ + return (((pid_t (*)(int *, int))__libc_interposing[ + INTERPOS_pdfork])(fdp, flags)); +} diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c index c82342010a3e..a70ea8b2b696 100644 --- a/lib/libthr/thread/thr_fork.c +++ b/lib/libthr/thread/thr_fork.c @@ -132,10 +132,19 @@ __pthread_cxa_finalize(struct dl_phdr_info *phdr_info) _thr_sigact_unload(phdr_info); } -__weak_reference(__thr_fork, _fork); - -pid_t -__thr_fork(void) +enum thr_fork_mode { + MODE_FORK, + MODE_PDFORK, +}; + +struct thr_fork_args { + enum thr_fork_mode mode; + void *fdp; + int flags; +}; + +static pid_t +thr_fork_impl(const struct thr_fork_args *a) { struct pthread *curthread; struct pthread_atfork *af; @@ -144,8 +153,17 @@ __thr_fork(void) int was_threaded; int rtld_locks[MAX_RTLD_LOCKS]; - if (!_thr_is_inited()) - return (__sys_fork()); + if (!_thr_is_inited()) { + switch (a->mode) { + case MODE_FORK: + return (__sys_fork()); + case MODE_PDFORK: + return (__sys_pdfork(a->fdp, a->flags)); + default: + errno = EDOOFUS; + return (-1); + } + } curthread = _get_curthread(); cancelsave = curthread->no_cancel; @@ -186,7 +204,19 @@ __thr_fork(void) * indirection, the syscall symbol is resolved in * _thr_rtld_init() with side-effect free call. */ - ret = syscall(SYS_fork); + switch (a->mode) { + case MODE_FORK: + ret = syscall(SYS_fork); + break; + case MODE_PDFORK: + ret = syscall(SYS_pdfork, a->fdp, a->flags); + break; + default: + ret = -1; + errno = EDOOFUS; + break; + } + if (ret == 0) { /* Child process */ errsave = errno; @@ -272,3 +302,25 @@ __thr_fork(void) return (ret); } + +__weak_reference(__thr_fork, _fork); + +pid_t +__thr_fork(void) +{ + struct thr_fork_args a; + + a.mode = MODE_FORK; + return (thr_fork_impl(&a)); +} + +pid_t +__thr_pdfork(int *fdp, int flags) +{ + struct thr_fork_args a; + + a.mode = MODE_PDFORK; + a.fdp = fdp; + a.flags = flags; + return (thr_fork_impl(&a)); +} diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index 80ece7bdb1ee..e8a8492c0504 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -985,6 +985,7 @@ void __pthread_distribute_static_tls(size_t offset, void *src, size_t len, int *__error_threaded(void) __hidden; void __thr_interpose_libc(void) __hidden; pid_t __thr_fork(void); +pid_t __thr_pdfork(int *, int); int __thr_setcontext(const ucontext_t *ucp); int __thr_sigaction(int sig, const struct sigaction *act, struct sigaction *oact) __hidden; diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index 025dfc75fab6..c60308fcd1d2 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -687,6 +687,7 @@ __thr_interpose_libc(void) SLOT(map_stacks_exec); SLOT(fdatasync); SLOT(clock_nanosleep); + SLOT(pdfork); #undef SLOT *(__libc_interposing_slot( INTERPOS__pthread_mutex_init_calloc_cb)) = From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 05:40:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6702B4E2498; Mon, 18 Jan 2021 05:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DK0xY2Tbbz3DWS; Mon, 18 Jan 2021 05:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 487836850; Mon, 18 Jan 2021 05:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10I5eXhf058215; Mon, 18 Jan 2021 05:40:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10I5eXIn058214; Mon, 18 Jan 2021 05:40:33 GMT (envelope-from git) Date: Mon, 18 Jan 2021 05:40:33 GMT Message-Id: <202101180540.10I5eXIn058214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 20432a4fa157 - stable/12 - libthr malloc: support recursion on thr_malloc_umtx. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 20432a4fa157be15465e3aefc7977b494c812584 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 05:40:33 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=20432a4fa157be15465e3aefc7977b494c812584 commit 20432a4fa157be15465e3aefc7977b494c812584 Author: Konstantin Belousov AuthorDate: 2021-01-12 09:02:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-18 05:11:07 +0000 libthr malloc: support recursion on thr_malloc_umtx. PR: 252579 (cherry picked from commit 85d028223bc2768651f4d44881644ceb5dc2a664) --- lib/libthr/thread/thr_malloc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libthr/thread/thr_malloc.c b/lib/libthr/thread/thr_malloc.c index 2f1c81142942..80a81f9c6c27 100644 --- a/lib/libthr/thread/thr_malloc.c +++ b/lib/libthr/thread/thr_malloc.c @@ -41,6 +41,7 @@ int npagesizes; size_t *pagesizes; static size_t pagesizes_d[2]; static struct umutex thr_malloc_umtx; +static u_int thr_malloc_umtx_level; void __thr_malloc_init(void) @@ -60,11 +61,16 @@ __thr_malloc_init(void) static void thr_malloc_lock(struct pthread *curthread) { + uint32_t curtid; if (curthread == NULL) return; curthread->locklevel++; - _thr_umutex_lock(&thr_malloc_umtx, TID(curthread)); + curtid = TID(curthread); + if ((uint32_t)thr_malloc_umtx.m_owner == curtid) + thr_malloc_umtx_level++; + else + _thr_umutex_lock(&thr_malloc_umtx, curtid); } static void @@ -73,7 +79,10 @@ thr_malloc_unlock(struct pthread *curthread) if (curthread == NULL) return; - _thr_umutex_unlock(&thr_malloc_umtx, TID(curthread)); + if (thr_malloc_umtx_level > 0) + thr_malloc_umtx_level--; + else + _thr_umutex_unlock(&thr_malloc_umtx, TID(curthread)); curthread->locklevel--; _thr_ast(curthread); } From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 13:42:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C0264EC29F; Mon, 18 Jan 2021 13:42:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKCdR1jcSz4RS5; Mon, 18 Jan 2021 13:42:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DD4114E56; Mon, 18 Jan 2021 13:42:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IDgJYk086362; Mon, 18 Jan 2021 13:42:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IDgJNe086361; Mon, 18 Jan 2021 13:42:19 GMT (envelope-from git) Date: Mon, 18 Jan 2021 13:42:19 GMT Message-Id: <202101181342.10IDgJNe086361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: a45328a1daa7 - stable/12 - arm64: fix early devmap assertion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a45328a1daa7512ee90170c1599a8aa09e391772 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 13:42:19 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a45328a1daa7512ee90170c1599a8aa09e391772 commit a45328a1daa7512ee90170c1599a8aa09e391772 Author: Mitchell Horne AuthorDate: 2021-01-13 18:30:50 +0000 Commit: Mitchell Horne CommitDate: 2021-01-18 13:41:46 +0000 arm64: fix early devmap assertion PR: 25241 Reported by: gbe Sponsored by: The FreeBSD Foundation (cherry picked from commit 818390ce0ca539300dd15d7a817784f1e3f7a9b8) --- sys/kern/subr_devmap.c | 2 +- sys/riscv/include/vmparam.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c index 7dace37744e6..d94908ca010a 100644 --- a/sys/kern/subr_devmap.c +++ b/sys/kern/subr_devmap.c @@ -274,7 +274,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) if (early_boot) { akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size); va = akva_devmap_vaddr; - KASSERT(va >= VM_MAX_KERNEL_ADDRESS - L2_SIZE, + KASSERT(va >= VM_MAX_KERNEL_ADDRESS - PMAP_MAPDEV_EARLY_SIZE, ("Too many early devmap mappings")); } else #endif diff --git a/sys/riscv/include/vmparam.h b/sys/riscv/include/vmparam.h index ee03f7b09cc2..dfa3e11efbe8 100644 --- a/sys/riscv/include/vmparam.h +++ b/sys/riscv/include/vmparam.h @@ -236,5 +236,6 @@ extern vm_offset_t init_pt_va; #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ #define DEVMAP_MAX_VADDR VM_MAX_KERNEL_ADDRESS +#define PMAP_MAPDEV_EARLY_SIZE (L2_SIZE * 2) #endif /* !_MACHINE_VMPARAM_H_ */ From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 16:25:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46BDD4EF8B1; Mon, 18 Jan 2021 16:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKHG61b2yz4cc0; Mon, 18 Jan 2021 16:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24D5D17182; Mon, 18 Jan 2021 16:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IGPot5094693; Mon, 18 Jan 2021 16:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IGPo1e094692; Mon, 18 Jan 2021 16:25:50 GMT (envelope-from git) Date: Mon, 18 Jan 2021 16:25:50 GMT Message-Id: <202101181625.10IGPo1e094692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: af4ed05c3dd2 - stable/12 - xen/xenstore: remove unused functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: af4ed05c3dd25c957b657f92f953bd9f00f818a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 16:25:50 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=af4ed05c3dd25c957b657f92f953bd9f00f818a8 commit af4ed05c3dd25c957b657f92f953bd9f00f818a8 Author: Roger Pau Monné AuthorDate: 2020-11-26 08:57:47 +0000 Commit: Ed Maste CommitDate: 2021-01-18 16:25:24 +0000 xen/xenstore: remove unused functions Those helpers are not used, so remove them. No functional change. Sponsored by: Citrix Systems R&D MFC after: 3 days (cherry picked from commit 2ae75536d370c238f77ad09e5e994d2b8bdf010c) --- sys/xen/xenbus/xenbus.c | 42 ---------------------------------- sys/xen/xenbus/xenbusvar.h | 56 ---------------------------------------------- 2 files changed, 98 deletions(-) diff --git a/sys/xen/xenbus/xenbus.c b/sys/xen/xenbus/xenbus.c index c59d4aec4532..415279ec2311 100644 --- a/sys/xen/xenbus/xenbus.c +++ b/sys/xen/xenbus/xenbus.c @@ -102,48 +102,6 @@ xenbus_strstate(XenbusState state) return ((state < (XenbusStateClosed + 1)) ? name[state] : "INVALID"); } -int -xenbus_watch_path(device_t dev, char *path, struct xs_watch *watch, - xs_watch_cb_t *callback, uintptr_t callback_data) -{ - int error; - - watch->node = path; - watch->callback = callback; - watch->callback_data = callback_data; - - error = xs_register_watch(watch); - - if (error) { - watch->node = NULL; - watch->callback = NULL; - xenbus_dev_fatal(dev, error, "adding watch on %s", path); - } - - return (error); -} - -int -xenbus_watch_path2(device_t dev, const char *path, - const char *path2, struct xs_watch *watch, - xs_watch_cb_t *callback, uintptr_t callback_data) -{ - int error; - char *state = malloc(strlen(path) + 1 + strlen(path2) + 1, - M_XENBUS, M_WAITOK); - - strcpy(state, path); - strcat(state, "/"); - strcat(state, path2); - - error = xenbus_watch_path(dev, state, watch, callback, callback_data); - if (error) { - free(state,M_XENBUS); - } - - return (error); -} - void xenbus_dev_verror(device_t dev, int err, const char *fmt, va_list ap) { diff --git a/sys/xen/xenbus/xenbusvar.h b/sys/xen/xenbus/xenbusvar.h index 377d60c01590..bea65fff8e5a 100644 --- a/sys/xen/xenbus/xenbusvar.h +++ b/sys/xen/xenbus/xenbusvar.h @@ -123,62 +123,6 @@ xenbus_get_otherend_state(device_t dev) return (xenbus_read_driver_state(xenbus_get_otherend_path(dev))); } -/** - * Initialize and register a watch on the given path (client suplied storage). - * - * \param dev The XenBus device requesting the watch service. - * \param path The XenStore path of the object to be watched. The - * storage for this string must be stable for the lifetime - * of the watch. - * \param watch The watch object to use for this request. This object - * must be stable for the lifetime of the watch. - * \param callback The function to call when XenStore objects at or below - * path are modified. - * \param cb_data Client data that can be retrieved from the watch object - * during the callback. - * - * \return On success, 0. Otherwise an errno value indicating the - * type of failure. - * - * \note On error, the device 'dev' will be switched to the XenbusStateClosing - * state and the returned error is saved in the per-device error node - * for dev in the XenStore. - */ -int xenbus_watch_path(device_t dev, char *path, - struct xs_watch *watch, - xs_watch_cb_t *callback, - uintptr_t cb_data); - -/** - * Initialize and register a watch at path/path2 in the XenStore. - * - * \param dev The XenBus device requesting the watch service. - * \param path The base XenStore path of the object to be watched. - * \param path2 The tail XenStore path of the object to be watched. - * \param watch The watch object to use for this request. This object - * must be stable for the lifetime of the watch. - * \param callback The function to call when XenStore objects at or below - * path are modified. - * \param cb_data Client data that can be retrieved from the watch object - * during the callback. - * - * \return On success, 0. Otherwise an errno value indicating the - * type of failure. - * - * \note On error, \a dev will be switched to the XenbusStateClosing - * state and the returned error is saved in the per-device error node - * for \a dev in the XenStore. - * - * Similar to xenbus_watch_path, however the storage for the path to the - * watched object is allocated from the heap and filled with "path '/' path2". - * Should a call to this function succeed, it is the callers responsibility - * to free watch->node using the M_XENBUS malloc type. - */ -int xenbus_watch_path2(device_t dev, const char *path, - const char *path2, struct xs_watch *watch, - xs_watch_cb_t *callback, - uintptr_t cb_data); - /** * Grant access to the given ring_mfn to the peer of the given device. * From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 16:25:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EE344EF563; Mon, 18 Jan 2021 16:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKHG72DlRz4cFR; Mon, 18 Jan 2021 16:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F51B17183; Mon, 18 Jan 2021 16:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IGPppK094716; Mon, 18 Jan 2021 16:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IGPpmC094715; Mon, 18 Jan 2021 16:25:51 GMT (envelope-from git) Date: Mon, 18 Jan 2021 16:25:51 GMT Message-Id: <202101181625.10IGPpmC094715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 2d194dc21989 - stable/12 - xen: allow limiting the amount of duplicated pending xenstore watches MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2d194dc219892049dd03564c4083080cac1aa688 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 16:25:51 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2d194dc219892049dd03564c4083080cac1aa688 commit 2d194dc219892049dd03564c4083080cac1aa688 Author: Roger Pau Monné AuthorDate: 2020-11-25 11:34:38 +0000 Commit: Ed Maste CommitDate: 2021-01-18 16:25:31 +0000 xen: allow limiting the amount of duplicated pending xenstore watches Xenstore watches received are queued in a list and processed in a deferred thread. Such queuing was done without any checking, so a guest could potentially trigger a resource starvation against the FreeBSD kernel if such kernel is watching any user-controlled xenstore path. Allowing limiting the amount of pending events a watch can accumulate to prevent a remote guest from triggering this resource starvation issue. For the PV device backends and frontends this limitation is only applied to the other end /state node, which is limited to 1 pending event, the rest of the watched paths can still have unlimited pending watches because they are either local or controlled by a privileged domain. The xenstore user-space device gets special treatment as it's not possible for the kernel to know whether the paths being watched by user-space processes are controlled by a guest domain. For this reason watches set by the xenstore user-space device are limited to 1000 pending events. Note this can be modified using the max_pending_watch_events sysctl of the device. This is XSA-349. Sponsored by: Citrix Systems R&D MFC after: 3 days (cherry picked from commit 4e4e43dc9e1afc863670a031cc5cc75eb5e668d6) --- sys/dev/xen/balloon/balloon.c | 3 ++- sys/dev/xen/blkback/blkback.c | 6 ++++++ sys/dev/xen/control/control.c | 6 ++++++ sys/dev/xen/xenstore/xenstore.c | 14 +++++++++++--- sys/dev/xen/xenstore/xenstore_dev.c | 15 +++++++++++++++ sys/xen/xenbus/xenbusb.c | 17 +++++++++++++++++ sys/xen/xenstore/xenstorevar.h | 9 +++++++++ 7 files changed, 66 insertions(+), 4 deletions(-) diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index b832bbaf313a..bc7b0983f8d7 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -310,7 +310,8 @@ set_new_target(unsigned long target) static struct xs_watch target_watch = { - .node = "memory/target" + .node = "memory/target", + .max_pending = 1, }; /* React to a change in the target key */ diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c index ffbb4a25262f..d935ba965b00 100644 --- a/sys/dev/xen/blkback/blkback.c +++ b/sys/dev/xen/blkback/blkback.c @@ -3768,6 +3768,12 @@ xbb_attach(device_t dev) xbb->hotplug_watch.callback = xbb_attach_disk; KASSERT(xbb->hotplug_watch.node == NULL, ("watch node already setup")); xbb->hotplug_watch.node = strdup(sbuf_data(watch_path), M_XENBLOCKBACK); + /* + * We don't care about the path updated, just about the value changes + * on that single node, hence there's no need to queue more that one + * event. + */ + xbb->hotplug_watch.max_pending = 1; sbuf_delete(watch_path); error = xs_register_watch(&xbb->hotplug_watch); if (error != 0) { diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 495083e24656..a21ccecd7373 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -435,6 +435,12 @@ xctrl_attach(device_t dev) xctrl->xctrl_watch.node = "control/shutdown"; xctrl->xctrl_watch.callback = xctrl_on_watch_event; xctrl->xctrl_watch.callback_data = (uintptr_t)xctrl; + /* + * We don't care about the path updated, just about the value changes + * on that single node, hence there's no need to queue more that one + * event. + */ + xctrl->xctrl_watch.max_pending = 1; xs_register_watch(&xctrl->xctrl_watch); if (xen_pv_domain()) diff --git a/sys/dev/xen/xenstore/xenstore.c b/sys/dev/xen/xenstore/xenstore.c index f8da1c59f915..31d470eebbf6 100644 --- a/sys/dev/xen/xenstore/xenstore.c +++ b/sys/dev/xen/xenstore/xenstore.c @@ -656,12 +656,17 @@ xs_process_msg(enum xsd_sockmsg_type *type) mtx_lock(&xs.registered_watches_lock); msg->u.watch.handle = find_watch( msg->u.watch.vec[XS_WATCH_TOKEN]); - if (msg->u.watch.handle != NULL) { - mtx_lock(&xs.watch_events_lock); + mtx_lock(&xs.watch_events_lock); + if (msg->u.watch.handle != NULL && + (!msg->u.watch.handle->max_pending || + msg->u.watch.handle->pending < + msg->u.watch.handle->max_pending)) { + msg->u.watch.handle->pending++; TAILQ_INSERT_TAIL(&xs.watch_events, msg, list); wakeup(&xs.watch_events); mtx_unlock(&xs.watch_events_lock); } else { + mtx_unlock(&xs.watch_events_lock); free(msg->u.watch.vec, M_XENSTORE); free(msg, M_XENSTORE); } @@ -983,8 +988,10 @@ xenwatch_thread(void *unused) mtx_lock(&xs.watch_events_lock); msg = TAILQ_FIRST(&xs.watch_events); - if (msg) + if (msg) { TAILQ_REMOVE(&xs.watch_events, msg, list); + msg->u.watch.handle->pending--; + } mtx_unlock(&xs.watch_events_lock); if (msg != NULL) { @@ -1578,6 +1585,7 @@ xs_register_watch(struct xs_watch *watch) char token[sizeof(watch) * 2 + 1]; int error; + watch->pending = 0; sprintf(token, "%lX", (long)watch); mtx_lock(&xs.registered_watches_lock); diff --git a/sys/dev/xen/xenstore/xenstore_dev.c b/sys/dev/xen/xenstore/xenstore_dev.c index 2cd9f136ea8e..261e97657969 100644 --- a/sys/dev/xen/xenstore/xenstore_dev.c +++ b/sys/dev/xen/xenstore/xenstore_dev.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -53,6 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include +static unsigned int max_pending_watches = 1000; + struct xs_dev_transaction { LIST_ENTRY(xs_dev_transaction) list; struct xs_transaction handle; @@ -335,6 +338,7 @@ xs_dev_write(struct cdev *dev, struct uio *uio, int ioflag) watch->watch.node = strdup(wpath, M_XENSTORE); watch->watch.callback = xs_dev_watch_cb; watch->watch.callback_data = (uintptr_t)watch; + watch->watch.max_pending = max_pending_watches; watch->token = strdup(wtoken, M_XENSTORE); watch->user = u; @@ -511,6 +515,17 @@ static int xs_dev_attach(device_t dev) { struct cdev *xs_cdev; + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + + sysctl_ctx = device_get_sysctl_ctx(dev); + sysctl_tree = device_get_sysctl_tree(dev); + if (sysctl_ctx == NULL || sysctl_tree == NULL) + return (EINVAL); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "max_pending_watch_events", CTLFLAG_RW, &max_pending_watches, 0, + "maximum amount of pending watch events to be delivered"); xs_cdev = make_dev_credf(MAKEDEV_ETERNAL, &xs_dev_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, "xen/xenstore"); diff --git a/sys/xen/xenbus/xenbusb.c b/sys/xen/xenbus/xenbusb.c index 8b755e2a62c3..a7b99d46f419 100644 --- a/sys/xen/xenbus/xenbusb.c +++ b/sys/xen/xenbus/xenbusb.c @@ -702,10 +702,21 @@ xenbusb_add_device(device_t dev, const char *type, const char *id) ivars->xd_otherend_watch.node = statepath; ivars->xd_otherend_watch.callback = xenbusb_otherend_watch_cb; ivars->xd_otherend_watch.callback_data = (uintptr_t)ivars; + /* + * Other end state node watch, limit to one pending event + * to prevent frontends from queuing too many events that + * could cause resource starvation. + */ + ivars->xd_otherend_watch.max_pending = 1; ivars->xd_local_watch.node = ivars->xd_node; ivars->xd_local_watch.callback = xenbusb_local_watch_cb; ivars->xd_local_watch.callback_data = (uintptr_t)ivars; + /* + * Watch our local path, only writable by us or a privileged + * domain, no need to limit. + */ + ivars->xd_local_watch.max_pending = 0; mtx_lock(&xbs->xbs_lock); xbs->xbs_connecting_children++; @@ -764,6 +775,12 @@ xenbusb_attach(device_t dev, char *bus_node, u_int id_components) xbs->xbs_device_watch.node = bus_node; xbs->xbs_device_watch.callback = xenbusb_devices_changed; xbs->xbs_device_watch.callback_data = (uintptr_t)xbs; + /* + * Allow for unlimited pending watches, as those are local paths + * either controlled by the guest or only writable by privileged + * domains. + */ + xbs->xbs_device_watch.max_pending = 0; TASK_INIT(&xbs->xbs_probe_children, 0, xenbusb_probe_children_cb, dev); diff --git a/sys/xen/xenstore/xenstorevar.h b/sys/xen/xenstore/xenstorevar.h index 8c89e174acf2..b6e699c1fed9 100644 --- a/sys/xen/xenstore/xenstorevar.h +++ b/sys/xen/xenstore/xenstorevar.h @@ -70,6 +70,15 @@ struct xs_watch /* Callback client data untouched by the XenStore watch mechanism. */ uintptr_t callback_data; + + /* Maximum number of pending watch events to be delivered. */ + unsigned int max_pending; + + /* + * Private counter used by xenstore to keep track of the pending + * watches. Protected by xs.watch_events_lock. + */ + unsigned int pending; }; LIST_HEAD(xs_watch_list, xs_watch); From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 17:32:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2BE94F1120; Mon, 18 Jan 2021 17:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKJl858hYz4jw1; Mon, 18 Jan 2021 17:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3CED17DD3; Mon, 18 Jan 2021 17:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IHWahb085252; Mon, 18 Jan 2021 17:32:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IHWa8A085251; Mon, 18 Jan 2021 17:32:36 GMT (envelope-from git) Date: Mon, 18 Jan 2021 17:32:36 GMT Message-Id: <202101181732.10IHWa8A085251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3160b2d53b38 - stable/12 - mvneta: Fix 64-bit MIB reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3160b2d53b38224f39fc2a6d75dedde27dd9cc89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 17:32:36 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3160b2d53b38224f39fc2a6d75dedde27dd9cc89 commit 3160b2d53b38224f39fc2a6d75dedde27dd9cc89 Author: Mark Johnston AuthorDate: 2021-01-04 13:22:21 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 16:59:23 +0000 mvneta: Fix 64-bit MIB reads It appears we must read MIB values as 2 4-byte words, lower address first. A single 8-byte MIB read returns the value with the lower 4 bytes copied into the upper 4 bytes, resulting in bogus byte counter values. Reviewed by: mw Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D27870 (cherry picked from commit caf552a607191ffc798e3edb697ae99d5b15711a) --- sys/dev/neta/if_mvneta.c | 36 ++++++++++++++++++------------------ sys/dev/neta/if_mvnetavar.h | 4 +--- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index 9b0b2384d74b..ac15057445ee 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -186,6 +186,7 @@ STATIC void sysctl_mvneta_init(struct mvneta_softc *); /* MIB */ STATIC void mvneta_clear_mib(struct mvneta_softc *); +STATIC uint64_t mvneta_read_mib(struct mvneta_softc *, int); STATIC void mvneta_update_mib(struct mvneta_softc *); /* Switch */ @@ -1079,7 +1080,7 @@ STATIC int mvneta_initreg(struct ifnet *ifp) { struct mvneta_softc *sc; - int q, i; + int q; uint32_t reg; sc = ifp->if_softc; @@ -1166,14 +1167,7 @@ mvneta_initreg(struct ifnet *ifp) MVNETA_WRITE(sc, MVNETA_PXCX, reg); /* clear MIB counter registers(clear by read) */ - for (i = 0; i < nitems(mvneta_mib_list); i++) { - if (mvneta_mib_list[i].reg64) - MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum); - else - MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum); - } - MVNETA_READ(sc, MVNETA_PDFC); - MVNETA_READ(sc, MVNETA_POFC); + mvneta_clear_mib(sc); /* Set SDC register except IPGINT bits */ reg = MVNETA_SDC_RXBSZ_16_64BITWORDS; @@ -3489,6 +3483,19 @@ sysctl_mvneta_init(struct mvneta_softc *sc) /* * MIB */ +STATIC uint64_t +mvneta_read_mib(struct mvneta_softc *sc, int index) +{ + struct mvneta_mib_def *mib; + uint64_t val; + + mib = &mvneta_mib_list[index]; + val = MVNETA_READ_MIB(sc, mib->regnum); + if (mib->reg64) + val |= (uint64_t)MVNETA_READ_MIB(sc, mib->regnum + 4) << 32; + return (val); +} + STATIC void mvneta_clear_mib(struct mvneta_softc *sc) { @@ -3497,10 +3504,7 @@ mvneta_clear_mib(struct mvneta_softc *sc) KASSERT_SC_MTX(sc); for (i = 0; i < nitems(mvneta_mib_list); i++) { - if (mvneta_mib_list[i].reg64) - MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum); - else - MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum); + (void)mvneta_read_mib(sc, i); sc->sysctl_mib[i].counter = 0; } MVNETA_READ(sc, MVNETA_PDFC); @@ -3520,11 +3524,7 @@ mvneta_update_mib(struct mvneta_softc *sc) for (i = 0; i < nitems(mvneta_mib_list); i++) { - if (mvneta_mib_list[i].reg64) - val = MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum); - else - val = MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum); - + val = mvneta_read_mib(sc, i); if (val == 0) continue; diff --git a/sys/dev/neta/if_mvnetavar.h b/sys/dev/neta/if_mvnetavar.h index 8ac37fb65bfd..ab1d476ef353 100644 --- a/sys/dev/neta/if_mvnetavar.h +++ b/sys/dev/neta/if_mvnetavar.h @@ -73,10 +73,8 @@ #define MVNETA_WRITE_REGION(sc, reg, val, c) \ bus_write_region_4((sc)->res[0], (reg), (val), (c)) -#define MVNETA_READ_MIB_4(sc, reg) \ +#define MVNETA_READ_MIB(sc, reg) \ bus_read_4((sc)->res[0], MVNETA_PORTMIB_BASE + (reg)) -#define MVNETA_READ_MIB_8(sc, reg) \ - bus_read_8((sc)->res[0], MVNETA_PORTMIB_BASE + (reg)) #define MVNETA_IS_LINKUP(sc) \ (MVNETA_READ((sc), MVNETA_PSR) & MVNETA_PSR_LINKUP) From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 17:32:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AFF64F0CFD; Mon, 18 Jan 2021 17:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKJlC1D9Kz4jyb; Mon, 18 Jan 2021 17:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0980C1801E; Mon, 18 Jan 2021 17:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IHWcPE085295; Mon, 18 Jan 2021 17:32:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IHWcih085294; Mon, 18 Jan 2021 17:32:38 GMT (envelope-from git) Date: Mon, 18 Jan 2021 17:32:38 GMT Message-Id: <202101181732.10IHWcih085294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 7f1032dff07a - stable/12 - libdtrace: Format USDT symbols correctly based on symbol binding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7f1032dff07a411bb2296ac2e13ac7e1752d25e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 17:32:39 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7f1032dff07a411bb2296ac2e13ac7e1752d25e1 commit 7f1032dff07a411bb2296ac2e13ac7e1752d25e1 Author: Mark Johnston AuthorDate: 2021-01-10 22:46:32 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 17:00:40 +0000 libdtrace: Format USDT symbols correctly based on symbol binding Before we did not handle weak symbols correctly, sometimes resulting in link errors from dtrace -G when processing object files where functions with weak aliases contain USDT probes. Reported by: rlibby Sponsored by: The FreeBSD Foundation (cherry picked from commit d00431a7bd0c4b4607943baed588e58ad5ae6150) --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index d8448283b168..589b30aa8654 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -1337,18 +1337,24 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) /* * Aliases of weak symbols don't get a uniquifier. */ - if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) + if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) { len = snprintf(NULL, 0, dt_weaksymfmt, dt_symprefix, s) + 1; - else + } else { len = snprintf(NULL, 0, dt_symfmt, dt_symprefix, objkey, s) + 1; + } if ((p = dt_alloc(dtp, len)) == NULL) { dt_strtab_destroy(strtab); goto err; } - (void) snprintf(p, len, dt_symfmt, dt_symprefix, - objkey, s); + if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) { + (void) snprintf(p, len, dt_weaksymfmt, + dt_symprefix, s); + } else { + (void) snprintf(p, len, dt_symfmt, dt_symprefix, + objkey, s); + } if (dt_strtab_index(strtab, p) == -1) { /* From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 17:32:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBB344F10D6; Mon, 18 Jan 2021 17:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKJl95xFrz4jkb; Mon, 18 Jan 2021 17:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE96517ACB; Mon, 18 Jan 2021 17:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IHWb4W085270; Mon, 18 Jan 2021 17:32:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IHWbGU085269; Mon, 18 Jan 2021 17:32:37 GMT (envelope-from git) Date: Mon, 18 Jan 2021 17:32:37 GMT Message-Id: <202101181732.10IHWbGU085269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6181f2fcf6a4 - stable/12 - mvneta: Acquire the softc lock before clearing the MIB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6181f2fcf6a40a5e2e4aaf3e62e965059ae0de3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 17:32:37 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6181f2fcf6a40a5e2e4aaf3e62e965059ae0de3f commit 6181f2fcf6a40a5e2e4aaf3e62e965059ae0de3f Author: Mark Johnston AuthorDate: 2021-01-09 15:03:46 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 17:00:00 +0000 mvneta: Acquire the softc lock before clearing the MIB Reported by: Andrei Martin (cherry picked from commit 109260d202fb64be6f2efcf243c25090c1f64420) --- sys/dev/neta/if_mvneta.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index ac15057445ee..20cc36bcce3c 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -1167,7 +1167,9 @@ mvneta_initreg(struct ifnet *ifp) MVNETA_WRITE(sc, MVNETA_PXCX, reg); /* clear MIB counter registers(clear by read) */ + mvneta_sc_lock(sc); mvneta_clear_mib(sc); + mvneta_sc_unlock(sc); /* Set SDC register except IPGINT bits */ reg = MVNETA_SDC_RXBSZ_16_64BITWORDS; From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 17:32:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCEA64F1407; Mon, 18 Jan 2021 17:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKJlG5y5nz4k45; Mon, 18 Jan 2021 17:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F4D817C64; Mon, 18 Jan 2021 17:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IHWfqN085346; Mon, 18 Jan 2021 17:32:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IHWfC6085345; Mon, 18 Jan 2021 17:32:41 GMT (envelope-from git) Date: Mon, 18 Jan 2021 17:32:41 GMT Message-Id: <202101181732.10IHWfC6085345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 59f0f60327ad - stable/12 - qat: Count request allocation failures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 59f0f60327ade81a031cee81887f24f5bdf8b1d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 17:32:45 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=59f0f60327ade81a031cee81887f24f5bdf8b1d1 commit 59f0f60327ade81a031cee81887f24f5bdf8b1d1 Author: Mark Johnston AuthorDate: 2021-01-14 16:41:28 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 17:01:15 +0000 qat: Count request allocation failures This can be useful for troubleshooting performance problems. Sponsored by: Rubicon Communications, LLC (Netgate) (cherry picked from commit a33b29a0447b24a054ecc48e51355d2abf7e6b5b) --- sys/dev/qat/qat.c | 5 +++++ sys/dev/qat/qatvar.h | 1 + 2 files changed, 6 insertions(+) diff --git a/sys/dev/qat/qat.c b/sys/dev/qat/qat.c index 83c1b8fa970d..7a232b085095 100644 --- a/sys/dev/qat/qat.c +++ b/sys/dev/qat/qat.c @@ -1660,6 +1660,10 @@ qat_crypto_init(struct qat_softc *sc) SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ring_full", CTLFLAG_RD, &sc->sc_ring_full_restarts, "Requests deferred due to in-flight max reached"); + sc->sc_sym_alloc_failures = counter_u64_alloc(M_WAITOK); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "sym_alloc_failures", + CTLFLAG_RD, &sc->sc_sym_alloc_failures, + "Request allocation failures"); return 0; } @@ -2167,6 +2171,7 @@ qat_process(device_t dev, struct cryptop *crp, int hint) qsc = qat_crypto_alloc_sym_cookie(qcb); if (qsc == NULL) { + counter_u64_add(sc->sc_sym_alloc_failures, 1); error = ENOBUFS; goto fail2; } diff --git a/sys/dev/qat/qatvar.h b/sys/dev/qat/qatvar.h index b475f2eb0c0e..76b9f5106f68 100644 --- a/sys/dev/qat/qatvar.h +++ b/sys/dev/qat/qatvar.h @@ -821,6 +821,7 @@ struct qat_softc { counter_u64_t sc_gcm_aad_restarts; counter_u64_t sc_gcm_aad_updates; counter_u64_t sc_ring_full_restarts; + counter_u64_t sc_sym_alloc_failures; /* Firmware */ void *sc_fw_mof; /* mof data */ From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 17:32:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEC004F11BC; Mon, 18 Jan 2021 17:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKJlH5QwYz4k6m; Mon, 18 Jan 2021 17:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 450E117C65; Mon, 18 Jan 2021 17:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IHWgcF085369; Mon, 18 Jan 2021 17:32:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IHWgjQ085368; Mon, 18 Jan 2021 17:32:42 GMT (envelope-from git) Date: Mon, 18 Jan 2021 17:32:42 GMT Message-Id: <202101181732.10IHWgjQ085368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 94a5e942b0b6 - stable/12 - qat: Free counters during detach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 94a5e942b0b6cab83a8255d61b57a3fd1638f321 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 17:32:47 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=94a5e942b0b6cab83a8255d61b57a3fd1638f321 commit 94a5e942b0b6cab83a8255d61b57a3fd1638f321 Author: Mark Johnston AuthorDate: 2021-01-14 16:41:28 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 17:01:20 +0000 qat: Free counters during detach Sponsored by: Rubicon Communications, LLC (Netgate) (cherry picked from commit 6483fc224b1a68528a65c16e9d8e55e2b5535ee9) --- sys/dev/qat/qat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/qat/qat.c b/sys/dev/qat/qat.c index 7a232b085095..306d031c3712 100644 --- a/sys/dev/qat/qat.c +++ b/sys/dev/qat/qat.c @@ -1675,6 +1675,11 @@ qat_crypto_deinit(struct qat_softc *sc) struct qat_crypto_bank *qcb; int bank; + counter_u64_free(sc->sc_sym_alloc_failures); + counter_u64_free(sc->sc_ring_full_restarts); + counter_u64_free(sc->sc_gcm_aad_updates); + counter_u64_free(sc->sc_gcm_aad_restarts); + if (qcy->qcy_banks != NULL) { for (bank = 0; bank < qcy->qcy_num_banks; bank++) { qcb = &qcy->qcy_banks[bank]; From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 17:32:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90D7C4F0FE3; Mon, 18 Jan 2021 17:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKJlF0Gz2z4jfK; Mon, 18 Jan 2021 17:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2770C17C63; Mon, 18 Jan 2021 17:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IHWd5r085326; Mon, 18 Jan 2021 17:32:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IHWdLh085325; Mon, 18 Jan 2021 17:32:39 GMT (envelope-from git) Date: Mon, 18 Jan 2021 17:32:39 GMT Message-Id: <202101181732.10IHWdLh085325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 36dfe8cb2581 - stable/12 - qat: Fix DH895XCC firmware module autoloading MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 36dfe8cb25817259e7a563893cd4e4cc06425d9f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 17:32:45 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=36dfe8cb25817259e7a563893cd4e4cc06425d9f commit 36dfe8cb25817259e7a563893cd4e4cc06425d9f Author: Mark Johnston AuthorDate: 2021-01-14 16:41:28 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 17:00:59 +0000 qat: Fix DH895XCC firmware module autoloading Sponsored by: Rubicon Communications, LLC (Netgate) (cherry picked from commit 95ee7d9b879ce42088277c85d85e61f6c79674ad) --- sys/dev/qat/qat_dh895xccreg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/qat/qat_dh895xccreg.h b/sys/dev/qat/qat_dh895xccreg.h index 35dfb483e529..5d57d82a597e 100644 --- a/sys/dev/qat/qat_dh895xccreg.h +++ b/sys/dev/qat/qat_dh895xccreg.h @@ -109,7 +109,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_DH895XCC 0x00400000 -#define AE_FW_MOF_NAME_DH895XCC "qat_895xccfw" +#define AE_FW_MOF_NAME_DH895XCC "qat_dh895xccfw" #define AE_FW_MMP_NAME_DH895XCC "qat_895xcc_mmp" #define AE_FW_UOF_NAME_DH895XCC "icp_qat_ae.uof" From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 18:53:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F198E4F3297; Mon, 18 Jan 2021 18:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKLXl6Wf7z4qVB; Mon, 18 Jan 2021 18:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2AC518EDC; Mon, 18 Jan 2021 18:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IIrhgt089761; Mon, 18 Jan 2021 18:53:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IIrhYY089760; Mon, 18 Jan 2021 18:53:43 GMT (envelope-from git) Date: Mon, 18 Jan 2021 18:53:43 GMT Message-Id: <202101181853.10IIrhYY089760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: eebccaae3672 - stable/11 - ffs: avoid creating corrupt extattrfile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: eebccaae36722f62bc8f05e6c71b867d69faca5f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 18:53:44 -0000 The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=eebccaae36722f62bc8f05e6c71b867d69faca5f commit eebccaae36722f62bc8f05e6c71b867d69faca5f Author: Ed Maste AuthorDate: 2021-01-18 16:58:38 +0000 Commit: Ed Maste CommitDate: 2021-01-18 18:49:56 +0000 ffs: avoid creating corrupt extattrfile This is part of r312416 / e6790841f749, suggested by ml@netfence.it, and at least means we will stop creating corrupt extattr that is not handled by some later versions. PR: 244089 --- sys/ufs/ffs/ffs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index d2779489180f..9ffaf19a86d7 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1668,7 +1668,7 @@ vop_setextattr { *p++ = ap->a_attrnamespace; *p++ = eapad2; *p++ = strlen(ap->a_name); - strcpy(p, ap->a_name); + memcpy(p, ap->a_name, strlen(ap->a_name)); p += strlen(ap->a_name); bzero(p, eapad1); p += eapad1; From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 18:56:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 145C14F3148; Mon, 18 Jan 2021 18:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKLbp048kz4qb7; Mon, 18 Jan 2021 18:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E96C518DC2; Mon, 18 Jan 2021 18:56:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IIuLI3090458; Mon, 18 Jan 2021 18:56:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IIuLf5090457; Mon, 18 Jan 2021 18:56:21 GMT (envelope-from git) Date: Mon, 18 Jan 2021 18:56:21 GMT Message-Id: <202101181856.10IIuLf5090457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 720e27fff49e - stable/11 - xen/xenstore: remove unused functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 720e27fff49e896fd774d355ba029b74b63fe278 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 18:56:22 -0000 The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=720e27fff49e896fd774d355ba029b74b63fe278 commit 720e27fff49e896fd774d355ba029b74b63fe278 Author: Roger Pau Monné AuthorDate: 2020-11-26 08:57:47 +0000 Commit: Ed Maste CommitDate: 2021-01-18 18:55:40 +0000 xen/xenstore: remove unused functions Those helpers are not used, so remove them. No functional change. Sponsored by: Citrix Systems R&D MFC after: 3 days --- sys/xen/xenbus/xenbus.c | 42 ---------------------------------- sys/xen/xenbus/xenbusvar.h | 56 ---------------------------------------------- 2 files changed, 98 deletions(-) diff --git a/sys/xen/xenbus/xenbus.c b/sys/xen/xenbus/xenbus.c index c59d4aec4532..415279ec2311 100644 --- a/sys/xen/xenbus/xenbus.c +++ b/sys/xen/xenbus/xenbus.c @@ -102,48 +102,6 @@ xenbus_strstate(XenbusState state) return ((state < (XenbusStateClosed + 1)) ? name[state] : "INVALID"); } -int -xenbus_watch_path(device_t dev, char *path, struct xs_watch *watch, - xs_watch_cb_t *callback, uintptr_t callback_data) -{ - int error; - - watch->node = path; - watch->callback = callback; - watch->callback_data = callback_data; - - error = xs_register_watch(watch); - - if (error) { - watch->node = NULL; - watch->callback = NULL; - xenbus_dev_fatal(dev, error, "adding watch on %s", path); - } - - return (error); -} - -int -xenbus_watch_path2(device_t dev, const char *path, - const char *path2, struct xs_watch *watch, - xs_watch_cb_t *callback, uintptr_t callback_data) -{ - int error; - char *state = malloc(strlen(path) + 1 + strlen(path2) + 1, - M_XENBUS, M_WAITOK); - - strcpy(state, path); - strcat(state, "/"); - strcat(state, path2); - - error = xenbus_watch_path(dev, state, watch, callback, callback_data); - if (error) { - free(state,M_XENBUS); - } - - return (error); -} - void xenbus_dev_verror(device_t dev, int err, const char *fmt, va_list ap) { diff --git a/sys/xen/xenbus/xenbusvar.h b/sys/xen/xenbus/xenbusvar.h index 377d60c01590..bea65fff8e5a 100644 --- a/sys/xen/xenbus/xenbusvar.h +++ b/sys/xen/xenbus/xenbusvar.h @@ -123,62 +123,6 @@ xenbus_get_otherend_state(device_t dev) return (xenbus_read_driver_state(xenbus_get_otherend_path(dev))); } -/** - * Initialize and register a watch on the given path (client suplied storage). - * - * \param dev The XenBus device requesting the watch service. - * \param path The XenStore path of the object to be watched. The - * storage for this string must be stable for the lifetime - * of the watch. - * \param watch The watch object to use for this request. This object - * must be stable for the lifetime of the watch. - * \param callback The function to call when XenStore objects at or below - * path are modified. - * \param cb_data Client data that can be retrieved from the watch object - * during the callback. - * - * \return On success, 0. Otherwise an errno value indicating the - * type of failure. - * - * \note On error, the device 'dev' will be switched to the XenbusStateClosing - * state and the returned error is saved in the per-device error node - * for dev in the XenStore. - */ -int xenbus_watch_path(device_t dev, char *path, - struct xs_watch *watch, - xs_watch_cb_t *callback, - uintptr_t cb_data); - -/** - * Initialize and register a watch at path/path2 in the XenStore. - * - * \param dev The XenBus device requesting the watch service. - * \param path The base XenStore path of the object to be watched. - * \param path2 The tail XenStore path of the object to be watched. - * \param watch The watch object to use for this request. This object - * must be stable for the lifetime of the watch. - * \param callback The function to call when XenStore objects at or below - * path are modified. - * \param cb_data Client data that can be retrieved from the watch object - * during the callback. - * - * \return On success, 0. Otherwise an errno value indicating the - * type of failure. - * - * \note On error, \a dev will be switched to the XenbusStateClosing - * state and the returned error is saved in the per-device error node - * for \a dev in the XenStore. - * - * Similar to xenbus_watch_path, however the storage for the path to the - * watched object is allocated from the heap and filled with "path '/' path2". - * Should a call to this function succeed, it is the callers responsibility - * to free watch->node using the M_XENBUS malloc type. - */ -int xenbus_watch_path2(device_t dev, const char *path, - const char *path2, struct xs_watch *watch, - xs_watch_cb_t *callback, - uintptr_t cb_data); - /** * Grant access to the given ring_mfn to the peer of the given device. * From owner-dev-commits-src-branches@freebsd.org Mon Jan 18 19:15:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F2EC4F3B88; Mon, 18 Jan 2021 19:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKM1z1lhGz4rbM; Mon, 18 Jan 2021 19:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F3941948F; Mon, 18 Jan 2021 19:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IJFZ11017799; Mon, 18 Jan 2021 19:15:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IJFZnu017798; Mon, 18 Jan 2021 19:15:35 GMT (envelope-from git) Date: Mon, 18 Jan 2021 19:15:35 GMT Message-Id: <202101181915.10IJFZnu017798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6d0a2f9d2ffc - stable/11 - msdosfs: Fix a leak of dirent padding bytes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 6d0a2f9d2ffce3d94c9a523d7779f791355d3677 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 19:15:35 -0000 The branch stable/11 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6d0a2f9d2ffce3d94c9a523d7779f791355d3677 commit 6d0a2f9d2ffce3d94c9a523d7779f791355d3677 Author: Mark Johnston AuthorDate: 2020-12-27 21:52:30 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 19:13:44 +0000 msdosfs: Fix a leak of dirent padding bytes This was missed in r340856 / commit 6d2e2df764199f0a15fd743e79599391959cc17d. Three bytes from the kernel stack may be leaked when reading directory entries. Reported by: Syed Faraz Abrar Sponsored by: The FreeBSD Foundation (cherry picked from commit 599f90446376370eb365a0fde857ea2b5766873a) --- sys/fs/msdosfs/msdosfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index d8274f66635b..e747e47fecb5 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1701,6 +1701,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) mbnambuf_flush(&nb, &dirbuf); chksum = -1; dirbuf.d_reclen = GENERIC_DIRSIZ(&dirbuf); + dirent_terminate(&dirbuf); if (uio->uio_resid < dirbuf.d_reclen) { brelse(bp); goto out; From owner-dev-commits-src-branches@freebsd.org Tue Jan 19 02:46:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 264124DF126; Tue, 19 Jan 2021 02:46:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKY2P0XY6z3sgp; Tue, 19 Jan 2021 02:46:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0517E1EBE9; Tue, 19 Jan 2021 02:46:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J2ka7b002594; Tue, 19 Jan 2021 02:46:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J2kaV1002593; Tue, 19 Jan 2021 02:46:36 GMT (envelope-from git) Date: Tue, 19 Jan 2021 02:46:36 GMT Message-Id: <202101190246.10J2kaV1002593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 065f8cea1b8e - stable/12 - rtld: map without PROT_EXEC for relocation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 065f8cea1b8edc1e99cd247784002295c40b3760 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 02:46:37 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=065f8cea1b8edc1e99cd247784002295c40b3760 commit 065f8cea1b8edc1e99cd247784002295c40b3760 Author: Ed Maste AuthorDate: 2021-01-04 18:55:44 +0000 Commit: Ed Maste CommitDate: 2021-01-19 01:00:29 +0000 rtld: map without PROT_EXEC for relocation This makes text segment relocation work under W^X. Submitted by: Greg V (original version) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D27953 (cherry picked from commit 613a08cfa2e0fb1b99906961c7a676d527e17f05) --- libexec/rtld-elf/rtld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index b6fcf8216cef..73177fc0c931 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2954,7 +2954,8 @@ reloc_textrel_prot(Obj_Entry *obj, bool before) base = obj->relocbase + trunc_page(ph->p_vaddr); sz = round_page(ph->p_vaddr + ph->p_filesz) - trunc_page(ph->p_vaddr); - prot = convert_prot(ph->p_flags) | (before ? PROT_WRITE : 0); + prot = before ? (PROT_READ | PROT_WRITE) : + convert_prot(ph->p_flags); if (mprotect(base, sz, prot) == -1) { _rtld_error("%s: Cannot write-%sable text segment: %s", obj->path, before ? "en" : "dis", From owner-dev-commits-src-branches@freebsd.org Tue Jan 19 02:50:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2F404DF0D4; Tue, 19 Jan 2021 02:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKY6n5bnMz3syy; Tue, 19 Jan 2021 02:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8C151EF2A; Tue, 19 Jan 2021 02:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J2oPaR010562; Tue, 19 Jan 2021 02:50:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J2oPD0010561; Tue, 19 Jan 2021 02:50:25 GMT (envelope-from git) Date: Tue, 19 Jan 2021 02:50:25 GMT Message-Id: <202101190250.10J2oPD0010561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 369a4023e671 - stable/12 - elftcl: add -i flag to ignore unknown flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 369a4023e671c35390574d42b1b409b55946faf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 02:50:25 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=369a4023e671c35390574d42b1b409b55946faf8 commit 369a4023e671c35390574d42b1b409b55946faf8 Author: Ed Maste AuthorDate: 2021-01-13 03:24:52 +0000 Commit: Ed Maste CommitDate: 2021-01-19 02:49:55 +0000 elftcl: add -i flag to ignore unknown flags This may allow an identical elfctl invocation to be used on multiple FreeBSD versions, with features not implemented on older releases being silently ignored. PR: 252629 (related) Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28130 (cherry picked from commit f6d95a01103a49a94c876d5a51bb4be25c06d964) --- usr.bin/elfctl/elfctl.1 | 6 +++++- usr.bin/elfctl/elfctl.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/usr.bin/elfctl/elfctl.1 b/usr.bin/elfctl/elfctl.1 index 176c2c42b22a..f93b558fdf0d 100644 --- a/usr.bin/elfctl/elfctl.1 +++ b/usr.bin/elfctl/elfctl.1 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2020 +.Dd January 12, 2021 .Dt ELFCTL 1 .Os .Sh NAME @@ -35,6 +35,7 @@ .Sh SYNOPSIS .Nm .Op Fl h | Fl -help +.Op Fl i .Op Fl l .Op Fl e Ar featurelist .Ar @@ -47,6 +48,9 @@ The options are as follows: .Bl -tag -width indent .It Fl h | Fl -help Print a usage message and exit. +.It Fl i +Ignore unknown feature flags in +.Ar featurelist . .It Fl l List known ELF feature flags. .It Fl e Ar featurelist diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index d18d828e151c..725752375d16 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -83,7 +83,9 @@ static struct option long_opts[] = { #else #define SUPPORTED_ENDIAN ELFDATA2MSB #endif - + +static bool iflag; + int main(int argc, char **argv) { @@ -102,8 +104,11 @@ main(int argc, char **argv) if (elf_version(EV_CURRENT) == EV_NONE) errx(EXIT_FAILURE, "elf_version error"); - while ((ch = getopt_long(argc, argv, "hle:", long_opts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "hile:", long_opts, NULL)) != -1) { switch (ch) { + case 'i': + iflag = true; + break; case 'l': print_features(); lflag = true; @@ -199,6 +204,7 @@ Usage: %s [options] file...\n\ Set or display the control features for an ELF object.\n\n\ Supported options are:\n\ -l List known control features.\n\ + -i Ignore unknown features.\n\ -e [+-=]feature,list Edit features from a comma separated list.\n\ -h | --help Print a usage message and exit.\n" @@ -231,7 +237,8 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val) } if (i == len) { warnx("%s is not a valid feature", feature); - return (false); + if (!iflag) + return (false); } } From owner-dev-commits-src-branches@freebsd.org Tue Jan 19 12:25:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E69704F2AD8; Tue, 19 Jan 2021 12:25:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKnst6FtQz3N8F; Tue, 19 Jan 2021 12:25:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C94E92655A; Tue, 19 Jan 2021 12:25:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JCP6rK059966; Tue, 19 Jan 2021 12:25:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JCP6Tp059965; Tue, 19 Jan 2021 12:25:06 GMT (envelope-from git) Date: Tue, 19 Jan 2021 12:25:06 GMT Message-Id: <202101191225.10JCP6Tp059965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: c735bf1ae387 - stable/12 - unzip: Sync with NetBSD upstream. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c735bf1ae3874ce1e9cfa718b95aad628b91f030 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 12:25:07 -0000 The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=c735bf1ae3874ce1e9cfa718b95aad628b91f030 commit c735bf1ae3874ce1e9cfa718b95aad628b91f030 Author: Yoshihiro Takahashi AuthorDate: 2021-01-02 01:50:08 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-01-19 12:20:53 +0000 unzip: Sync with NetBSD upstream. - Ignore malformed directory entries as created by Dropbox ("/"). (rev 1.24) - Use libarchive 3.x interface: check result for archive_read_free() and don't call archive_read_close manually. (rev 1.23) - Always overwrite symlinks on extraction, ever if they're newer than entries in archive. - Use getline() rather than getdelim(). PR: 231827 Submitted by: ak Reviewed by: mm Obtained from: NetBSD (cherry picked from commit 0cdfa4956424dc816944a84568a4d9900b68f5e3) --- usr.bin/unzip/unzip.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index c9e53f27ed74..937176111a02 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -385,6 +385,13 @@ extract_dir(struct archive *a, struct archive_entry *e, const char *path) { int mode; + /* + * Dropbox likes to create '/' directory entries, just ignore + * such junk. + */ + if (*path == '\0') + return; + mode = archive_entry_mode(e) & 0777; if (mode == 0) mode = 0755; @@ -451,7 +458,7 @@ handle_existing_file(char **path) free(*path); *path = NULL; alen = 0; - len = getdelim(path, &alen, '\n', stdin); + len = getline(path, &alen, stdin); if ((*path)[len - 1] == '\n') (*path)[len - 1] = '\0'; return 0; @@ -601,7 +608,7 @@ recheck: if (lstat(*path, &sb) == 0) { if (u_opt || f_opt) { /* check if up-to-date */ - if ((S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) && + if (S_ISREG(sb.st_mode) && (sb.st_mtim.tv_sec > mtime.tv_sec || (sb.st_mtim.tv_sec == mtime.tv_sec && sb.st_mtim.tv_nsec >= mtime.tv_nsec))) @@ -916,8 +923,7 @@ unzip(const char *fn) } } - ac(archive_read_close(a)); - (void)archive_read_free(a); + ac(archive_read_free(a)); if (t_opt) { if (error_count > 0) { From owner-dev-commits-src-branches@freebsd.org Tue Jan 19 14:58:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 343F84F6888; Tue, 19 Jan 2021 14:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKsGJ0hDvz3ndG; Tue, 19 Jan 2021 14:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A6BC547; Tue, 19 Jan 2021 14:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JEvxTe057266; Tue, 19 Jan 2021 14:57:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JEvxdS057265; Tue, 19 Jan 2021 14:57:59 GMT (envelope-from git) Date: Tue, 19 Jan 2021 14:57:59 GMT Message-Id: <202101191457.10JEvxdS057265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: b96f027b7102 - stable/12 - bootparamd: Fix several warnings and increase warn level to 6. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b96f027b71024cccc475d4d9f69176d372956756 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 14:58:00 -0000 The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=b96f027b71024cccc475d4d9f69176d372956756 commit b96f027b71024cccc475d4d9f69176d372956756 Author: Yoshihiro Takahashi AuthorDate: 2021-01-02 03:36:09 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-01-19 14:55:16 +0000 bootparamd: Fix several warnings and increase warn level to 6. - Increase WARNS to 6. - Except -Wcast-align and -Wincompatible-pointer-types-discards-qualifiers checks. - Use ANSI C prototype. - Statically variables and functions. - Add extern declaration for global variables. - Rename local variables to resolve shadow warnings. PR: 71667 (cherry picked from commit e03764d931d820185a019334259b18df2e3f6b6c) --- usr.sbin/bootparamd/Makefile.inc | 4 +- usr.sbin/bootparamd/bootparamd/bootparamd.c | 83 +++++++++++++---------------- usr.sbin/bootparamd/bootparamd/main.c | 15 +++--- usr.sbin/bootparamd/callbootd/callbootd.c | 26 ++++----- 4 files changed, 59 insertions(+), 69 deletions(-) diff --git a/usr.sbin/bootparamd/Makefile.inc b/usr.sbin/bootparamd/Makefile.inc index 5c01215dd550..de7ed1c2f55c 100644 --- a/usr.sbin/bootparamd/Makefile.inc +++ b/usr.sbin/bootparamd/Makefile.inc @@ -3,4 +3,6 @@ BINDIR?= /usr/sbin -WARNS?= 2 +NO_WCAST_ALIGN= +CWARNFLAGS.clang+= -Wno-incompatible-pointer-types-discards-qualifiers +CWARNFLAGS.gcc+= -Wno-error=discarded-qualifiers diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.c b/usr.sbin/bootparamd/bootparamd/bootparamd.c index 9c45cf8d0f38..7cc57d2427a4 100644 --- a/usr.sbin/bootparamd/bootparamd/bootparamd.c +++ b/usr.sbin/bootparamd/bootparamd/bootparamd.c @@ -7,10 +7,8 @@ use and modify. Please send modifications and/or suggestions + bug fixes to */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); #ifdef YP #include @@ -27,26 +25,25 @@ static const char rcsid[] = #include #include #include + extern int debug, dolog; extern in_addr_t route_addr; -extern char *bootpfile; +extern const char *bootpfile; #define MAXLEN 800 -struct hostent *he; +static struct hostent *he; static char buffer[MAXLEN]; static char hostname[MAX_MACHINE_NAME]; static char askname[MAX_MACHINE_NAME]; static char path[MAX_PATH_LEN]; static char domain_name[MAX_MACHINE_NAME]; -int getthefile(char *, char *, char *, int); -int checkhost(char *, char *, int); +static int getthefile(char *, char *, char *, int); +static int checkhost(char *, char *, int); bp_whoami_res * -bootparamproc_whoami_1_svc(whoami, req) -bp_whoami_arg *whoami; -struct svc_req *req; +bootparamproc_whoami_1_svc(bp_whoami_arg *whoami, struct svc_req *req __unused) { in_addr_t haddr; static bp_whoami_res res; @@ -110,9 +107,7 @@ struct svc_req *req; bp_getfile_res * - bootparamproc_getfile_1_svc(getfile, req) -bp_getfile_arg *getfile; -struct svc_req *req; +bootparamproc_getfile_1_svc(bp_getfile_arg *getfile, struct svc_req *req __unused) { char *where; static bp_getfile_res res; @@ -177,17 +172,14 @@ struct svc_req *req; return(NULL); } -/* getthefile return 1 and fills the buffer with the information +/* getthefile return 1 and fills the buf with the information of the file, e g "host:/export/root/client" if it can be found. - If the host is in the database, but the file is not, the buffer + If the host is in the database, but the file is not, the buf will be empty. (This makes it possible to give the special empty answer for the file "dump") */ -int -getthefile(askname,fileid,buffer,blen) -char *askname; -char *fileid, *buffer; -int blen; +static int +getthefile(char *l_askname, char *fileid, char *buf, int blen) { FILE *bpf; char *where; @@ -211,11 +203,11 @@ int blen; /* XXX see comment below */ while ( fscanf(bpf, "%255s", hostname) > 0 && !match ) { if ( *hostname != '#' ) { /* comment */ - if ( ! strcmp(hostname, askname) ) { + if ( ! strcmp(hostname, l_askname) ) { match = 1; } else { he = gethostbyname(hostname); - if (he && !strcmp(he->h_name, askname)) match = 1; + if (he && !strcmp(he->h_name, l_askname)) match = 1; } } if (*hostname == '+' ) { /* NIS */ @@ -224,16 +216,16 @@ int blen; if (debug) warn("NIS"); return(0); } - if (yp_match(yp_domain, "bootparams", askname, strlen(askname), + if (yp_match(yp_domain, "bootparams", l_askname, strlen(l_askname), &result, &resultlen)) return (0); if (strstr(result, fileid) == NULL) { - buffer[0] = '\0'; + buf[0] = '\0'; } else { - snprintf(buffer, blen, + snprintf(buf, blen, "%s",strchr(strstr(result,fileid), '=') + 1); - if (strchr(buffer, ' ') != NULL) - *(char *)(strchr(buffer, ' ')) = '\0'; + if (strchr(buf, ' ') != NULL) + *(char *)(strchr(buf, ' ')) = '\0'; } if (fclose(bpf)) warnx("could not close %s", bootpfile); @@ -265,7 +257,7 @@ int blen; if (! strncmp(info, fileid, fid_len) && *(info + fid_len) == '=') { where = info + fid_len + 1; if ( isprint( *where )) { - strcpy(buffer, where); /* found file */ + strcpy(buf, where); /* found file */ res = 1; break; } } else { @@ -284,19 +276,16 @@ int blen; } } if (fclose(bpf)) { warnx("could not close %s", bootpfile); } - if ( res == -1) buffer[0] = '\0'; /* host found, file not */ + if ( res == -1) buf[0] = '\0'; /* host found, file not */ return(match); } /* checkhost puts the hostname found in the database file in - the hostname-variable and returns 1, if askname is a valid + the l_hostname-variable and returns 1, if l_askname is a valid name for a host in the database */ -int -checkhost(askname, hostname, len) -char *askname; -char *hostname; -int len; +static int +checkhost(char *l_askname, char *l_hostname, int len) { int ch, pch; FILE *bpf; @@ -315,36 +304,36 @@ int len; /* XXX there is no way in ISO C to specify the maximal length for a conversion in a variable way */ - while ( fscanf(bpf, "%254s", hostname) > 0 ) { - if ( *hostname != '#' ) { /* comment */ - if ( ! strcmp(hostname, askname) ) { - /* return true for match of hostname */ + while ( fscanf(bpf, "%254s", l_hostname) > 0 ) { + if ( *l_hostname != '#' ) { /* comment */ + if ( ! strcmp(l_hostname, l_askname) ) { + /* return true for match of l_hostname */ res = 1; break; } else { /* check the alias list */ he = NULL; - he = gethostbyname(hostname); - if (he && !strcmp(askname, he->h_name)) { + he = gethostbyname(l_hostname); + if (he && !strcmp(l_askname, he->h_name)) { res = 1; break; } } } - if (*hostname == '+' ) { /* NIS */ + if (*l_hostname == '+' ) { /* NIS */ #ifdef YP if (yp_get_default_domain(&yp_domain)) { if (debug) warn("NIS"); return(0); } - if (!yp_match(yp_domain, "bootparams", askname, strlen(askname), + if (!yp_match(yp_domain, "bootparams", l_askname, strlen(l_askname), &result, &resultlen)) { /* return true for match of hostname */ he = NULL; - he = gethostbyname(askname); - if (he && !strcmp(askname, he->h_name)) { + he = gethostbyname(l_askname); + if (he && !strcmp(l_askname, he->h_name)) { res = 1; - snprintf(hostname, len, "%s", he->h_name); + snprintf(l_hostname, len, "%s", he->h_name); } } if (fclose(bpf)) diff --git a/usr.sbin/bootparamd/bootparamd/main.c b/usr.sbin/bootparamd/bootparamd/main.c index 04f5ceffe36c..95b49f8f39a0 100644 --- a/usr.sbin/bootparamd/bootparamd/main.c +++ b/usr.sbin/bootparamd/bootparamd/main.c @@ -7,10 +7,8 @@ use and modify. Please send modifications and/or suggestions + bug fixes to */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); #include #include @@ -30,11 +28,16 @@ static const char rcsid[] = #include #include "bootparam_prot.h" +extern int debug, dolog; +extern in_addr_t route_addr; +extern const char *bootpfile; + int debug = 0; int dolog = 0; in_addr_t route_addr = -1; -struct sockaddr_in my_addr; -char *bootpfile = "/etc/bootparams"; +const char *bootpfile = "/etc/bootparams"; + +static struct sockaddr_in my_addr; static void usage(void); diff --git a/usr.sbin/bootparamd/callbootd/callbootd.c b/usr.sbin/bootparamd/callbootd/callbootd.c index fe875093c5aa..ea1432c3140a 100644 --- a/usr.sbin/bootparamd/callbootd/callbootd.c +++ b/usr.sbin/bootparamd/callbootd/callbootd.c @@ -7,10 +7,8 @@ use and modify. Please send modifications and/or suggestions + bug fixes to */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); #include "bootparam_prot.h" #include @@ -27,11 +25,11 @@ static const char rcsid[] = #include #include -int broadcast; +static int broadcast; +static char cln[MAX_MACHINE_NAME+1]; +static char dmn[MAX_MACHINE_NAME+1]; +static char path[MAX_PATH_LEN+1]; -char cln[MAX_MACHINE_NAME+1]; -char dmn[MAX_MACHINE_NAME+1]; -char path[MAX_PATH_LEN+1]; static void usage(void); int printgetfile(bp_getfile_res *); int printwhoami(bp_whoami_res *); @@ -72,8 +70,8 @@ main(int argc, char **argv) bp_getfile_res *getfile_res, stat_getfile_res; - long the_inet_addr; - CLIENT *clnt; + in_addr_t the_inet_addr; + CLIENT *clnt = NULL; /* Silence warnings */ stat_whoami_res.client_name = cln; stat_whoami_res.domain_name = dmn; @@ -151,7 +149,7 @@ main(int argc, char **argv) static void -usage() +usage(void) { fprintf(stderr, "usage: callbootd server procnum (IP-addr | host fileid)\n"); @@ -159,8 +157,7 @@ usage() } int -printwhoami(res) -bp_whoami_res *res; +printwhoami(bp_whoami_res *res) { if ( res) { printf("client_name:\t%s\ndomain_name:\t%s\n", @@ -181,8 +178,7 @@ bp_whoami_res *res; int -printgetfile(res) -bp_getfile_res *res; +printgetfile(bp_getfile_res *res) { if (res) { printf("server_name:\t%s\nserver_address:\t%s\npath:\t%s\n", From owner-dev-commits-src-branches@freebsd.org Tue Jan 19 14:58:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C4D94F65E1; Tue, 19 Jan 2021 14:58:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKsGK21THz3nGQ; Tue, 19 Jan 2021 14:58:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 354CB988; Tue, 19 Jan 2021 14:58:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JEw1jB057289; Tue, 19 Jan 2021 14:58:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JEw1SM057288; Tue, 19 Jan 2021 14:58:01 GMT (envelope-from git) Date: Tue, 19 Jan 2021 14:58:01 GMT Message-Id: <202101191458.10JEw1SM057288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: 580311ef3283 - stable/12 - bootparamd: Add missing __unused mark. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 580311ef32836ef7f4c40be59a6f12784c9d94fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 14:58:01 -0000 The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=580311ef32836ef7f4c40be59a6f12784c9d94fd commit 580311ef32836ef7f4c40be59a6f12784c9d94fd Author: Yoshihiro Takahashi AuthorDate: 2021-01-02 15:40:34 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-01-19 14:55:40 +0000 bootparamd: Add missing __unused mark. e03764d931d820185a019334259b18df2e3f6b6c did not catch all unused variables. Submitted by: otis Differential Revision: https://reviews.freebsd.org/D27894 (cherry picked from commit 8c45fe5d8ecda4be7564aadaa50712790c6c0a6f) --- usr.sbin/bootparamd/bootparamd/bootparamd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.c b/usr.sbin/bootparamd/bootparamd/bootparamd.c index 7cc57d2427a4..be885de62f55 100644 --- a/usr.sbin/bootparamd/bootparamd/bootparamd.c +++ b/usr.sbin/bootparamd/bootparamd/bootparamd.c @@ -179,7 +179,7 @@ bootparamproc_getfile_1_svc(bp_getfile_arg *getfile, struct svc_req *req __unuse empty answer for the file "dump") */ static int -getthefile(char *l_askname, char *fileid, char *buf, int blen) +getthefile(char *l_askname, char *fileid, char *buf, int blen __unused) { FILE *bpf; char *where; @@ -285,7 +285,7 @@ getthefile(char *l_askname, char *fileid, char *buf, int blen) name for a host in the database */ static int -checkhost(char *l_askname, char *l_hostname, int len) +checkhost(char *l_askname, char *l_hostname, int len __unused) { int ch, pch; FILE *bpf; From owner-dev-commits-src-branches@freebsd.org Tue Jan 19 17:42:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F6F54D97C8; Tue, 19 Jan 2021 17:42:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKwwN0SdNz4Rgd; Tue, 19 Jan 2021 17:42:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02D8C2866; Tue, 19 Jan 2021 17:42:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JHghYM078126; Tue, 19 Jan 2021 17:42:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JHghij078125; Tue, 19 Jan 2021 17:42:43 GMT (envelope-from git) Date: Tue, 19 Jan 2021 17:42:43 GMT Message-Id: <202101191742.10JHghij078125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Yoshihiro Takahashi Subject: git: 7033fd68f7ef - stable/12 - bootparamd: Fix build with GCC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7033fd68f7efbe8d249e2001e58e4e08c403f5bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 17:42:44 -0000 The branch stable/12 has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=7033fd68f7efbe8d249e2001e58e4e08c403f5bd commit 7033fd68f7efbe8d249e2001e58e4e08c403f5bd Author: Yoshihiro Takahashi AuthorDate: 2021-01-19 17:41:37 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-01-19 17:41:37 +0000 bootparamd: Fix build with GCC. Remove CWARNFLAGS for GCC because GCC 4.2.1 does not have -Wdiscarded-qualifiers option. This is direct commit to stable/12. Pointy hat to: nyan --- usr.sbin/bootparamd/Makefile.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bootparamd/Makefile.inc b/usr.sbin/bootparamd/Makefile.inc index de7ed1c2f55c..2ba4149d5ada 100644 --- a/usr.sbin/bootparamd/Makefile.inc +++ b/usr.sbin/bootparamd/Makefile.inc @@ -5,4 +5,3 @@ BINDIR?= /usr/sbin NO_WCAST_ALIGN= CWARNFLAGS.clang+= -Wno-incompatible-pointer-types-discards-qualifiers -CWARNFLAGS.gcc+= -Wno-error=discarded-qualifiers From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 11:44:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5D764F2BA7; Wed, 20 Jan 2021 11:44:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLNwv4mX7z4byX; Wed, 20 Jan 2021 11:44:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 967C1187CD; Wed, 20 Jan 2021 11:44:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KBilNw084615; Wed, 20 Jan 2021 11:44:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KBilv8084614; Wed, 20 Jan 2021 11:44:47 GMT (envelope-from git) Date: Wed, 20 Jan 2021 11:44:47 GMT Message-Id: <202101201144.10KBilv8084614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: b2649738d46e - stable/12 - Add a missing period and remove a macro from Bl's width argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b2649738d46e18fa118d7f1b0a14c9d4026d9868 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 11:44:47 -0000 The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b2649738d46e18fa118d7f1b0a14c9d4026d9868 commit b2649738d46e18fa118d7f1b0a14c9d4026d9868 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2020-11-12 16:44:56 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-20 11:44:15 +0000 Add a missing period and remove a macro from Bl's width argument (cherry picked from commit 2bbc7e74368c73d198838ee821a4b3dd75a8be6a) --- share/man/man9/VOP_RDWR.9 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9 index eb1af7842073..4719ebabd094 100644 --- a/share/man/man9/VOP_RDWR.9 +++ b/share/man/man9/VOP_RDWR.9 @@ -44,7 +44,7 @@ .Ft int .Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" .Sh DESCRIPTION -These entry points read or write the contents of a file +These entry points read or write the contents of a file. .Pp The arguments are: .Bl -tag -width ioflag @@ -66,7 +66,7 @@ read-ahead hint (in units of file system blocks) that the file system should attempt. The low 16 bits are a bit mask which can contain the following flags: -.Bl -tag -width ".Dv IO_NODELOCKED" +.Bl -tag -width "IO_NODELOCKED" .It Dv IO_UNIT Do I/O as atomic unit. .It Dv IO_APPEND From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 13:22:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64AFF4F5D46; Wed, 20 Jan 2021 13:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLR622NWMz4jmT; Wed, 20 Jan 2021 13:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 447C619D70; Wed, 20 Jan 2021 13:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KDMoKt014976; Wed, 20 Jan 2021 13:22:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KDMohq014975; Wed, 20 Jan 2021 13:22:50 GMT (envelope-from git) Date: Wed, 20 Jan 2021 13:22:50 GMT Message-Id: <202101201322.10KDMohq014975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 80e0516736c6 - stable/12 - Fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 80e0516736c6d257b39c10357c60502f97370e04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 13:22:50 -0000 The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=80e0516736c6d257b39c10357c60502f97370e04 commit 80e0516736c6d257b39c10357c60502f97370e04 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-07 14:28:29 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-20 13:22:32 +0000 Fix a typo (cherry picked from commit 0199cbf641db5f28d258153014fa8a657ae98ea6) --- usr.sbin/certctl/certctl.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.8 b/usr.sbin/certctl/certctl.8 index 7d4f98995da6..8ca2cd37dee5 100644 --- a/usr.sbin/certctl/certctl.8 +++ b/usr.sbin/certctl/certctl.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2020 +.Dd January 7, 2021 .Dt CERTCTL 8 .Os .Sh NAME @@ -65,7 +65,7 @@ Specify the path of the METALOG file (default: $DESTDIR/METALOG). .It Fl n No-Op mode, do not actually perform any actions. .It Fl v -be verbose, print details about actions before performing them. +Be verbose, print details about actions before performing them. .It Fl U Unprivileged mode, do not change the ownership of created links. Do record the ownership in the METALOG file. From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 13:40:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF2AC4F669F; Wed, 20 Jan 2021 13:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLRVd55b9z4khb; Wed, 20 Jan 2021 13:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1CA71A063; Wed, 20 Jan 2021 13:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KDefrf036485; Wed, 20 Jan 2021 13:40:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KDeffV036484; Wed, 20 Jan 2021 13:40:41 GMT (envelope-from git) Date: Wed, 20 Jan 2021 13:40:41 GMT Message-Id: <202101201340.10KDeffV036484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: e9330580fdeb - stable/12 - Improve readability of the options list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e9330580fdebdd3891b9b9dc5a2fcace1fdbff3d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 13:40:41 -0000 The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e9330580fdebdd3891b9b9dc5a2fcace1fdbff3d commit e9330580fdebdd3891b9b9dc5a2fcace1fdbff3d Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-05 14:46:56 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-20 13:36:00 +0000 Improve readability of the options list (cherry picked from commit 225afb6cad9808af42408875baaa243d6d75d92d) --- usr.bin/script/script.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index fc138d83f907..3b67c0341374 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -28,7 +28,7 @@ .\" @(#)script.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 4, 2013 +.Dd January 5, 2021 .Dt SCRIPT 1 .Os .Sh NAME @@ -66,7 +66,7 @@ will run the specified command with an optional argument vector instead of an interactive shell. .Pp The following options are available: -.Bl -tag -width indent +.Bl -tag -width "-F pipe" .It Fl a Append the output to .Ar file From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 13:40:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E07914F6639; Wed, 20 Jan 2021 13:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLRVf63mbz4kZg; Wed, 20 Jan 2021 13:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2FE91A1E0; Wed, 20 Jan 2021 13:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KDegS1036507; Wed, 20 Jan 2021 13:40:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KDegq8036506; Wed, 20 Jan 2021 13:40:42 GMT (envelope-from git) Date: Wed, 20 Jan 2021 13:40:42 GMT Message-Id: <202101201340.10KDegq8036506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 8c01699f9194 - stable/12 - Add some examples to script.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8c01699f9194cfa3805ac734ae912529a10c063a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 13:40:42 -0000 The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8c01699f9194cfa3805ac734ae912529a10c063a commit 8c01699f9194cfa3805ac734ae912529a10c063a Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-05 15:28:32 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-20 13:40:13 +0000 Add some examples to script.1 While here: - Split synopsis into two parts. The first explains how to record sessions, while the second one explains how to replay (some of) the recorded sessions. - Fix the -width argument of the environment variables list. (cherry picked from commit d41149a8e9cbb76ff89322a3363299f1b93823d2) --- usr.bin/script/script.1 | 70 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 3b67c0341374..d978c2aa2657 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -36,10 +36,14 @@ .Nd make typescript of terminal session .Sh SYNOPSIS .Nm -.Op Fl adfkpqr +.Op Fl afkqr .Op Fl F Ar pipe .Op Fl t Ar time .Op Ar file Op Ar command ... +.Nm +.Fl p +.Op Fl dq +.Op Ar file .Sh DESCRIPTION The .Nm @@ -137,7 +141,7 @@ The results are meant to emulate a hardcopy terminal, not an addressable one. .Sh ENVIRONMENT The following environment variables are utilized by .Nm : -.Bl -tag -width SHELL +.Bl -tag -width SCRIPT .It Ev SCRIPT The .Ev SCRIPT @@ -163,6 +167,68 @@ is not set, the Bourne shell is assumed. .Pq Most shells set this variable automatically . .El +.Sh EXAMPLES +Record a simple +.Xr csh 1 +session with no additional details like input, output, and timestamping: +.Bd -literal -offset indent +$ SHELL=/bin/csh script +Script started, output file is typescript +% date +Tue Jan 5 15:08:10 UTC 2021 +% exit +exit + +Script done, output file is typescript +.Ed +.Pp +Now, replay the session recorded in the previous example: +.Bd -literal -offset indent +$ cat ./typescript +Script started on Tue Jan 5 15:08:08 2021 +% date +Tue Jan 5 15:08:10 UTC 2021 +% exit +exit + +Script done on Tue Jan 5 15:08:13 2021 +.Ed +.Pp +Record a +.Xr csh 1 +session, but this time with additional details like timestamping: +.Bd -literal -offset indent +$ SHELL=/bin/csh script -r +Script started, output file is typescript +% date +Tue Jan 5 15:17:11 UTC 2021 +% exit +exit + +Script done, output file is typescript +.Ed +.Pp +In order to replay a sessions recorded with the +.Fl r +flag, it is necessary to specify +.Fl p +.Po +.Xr cat 1 +will not work because of all the aditional information stored in the session file +.Pc . +Also, let us use +.Fl d +to print the whole session at once: +.Bd -literal -offset indent +$ script -dp ./typescript +Script started on Tue Jan 5 15:17:09 2021 +% date +Tue Jan 5 15:17:11 UTC 2021 +% exit +exit + +Script done on Tue Jan 5 15:17:14 2021 +.Ed .Sh SEE ALSO .Xr csh 1 .Po From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:44:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B8544F875C; Wed, 20 Jan 2021 14:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwk0kj3z4qnP; Wed, 20 Jan 2021 14:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BFDF1B306; Wed, 20 Jan 2021 14:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEisYP019316; Wed, 20 Jan 2021 14:44:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEisCK019315; Wed, 20 Jan 2021 14:44:54 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:44:54 GMT Message-Id: <202101201444.10KEisCK019315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ef0a241c0ba4 - stable/12 - pf: Split pf_src_node into a kernel and userspace struct MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ef0a241c0ba4c594512fa5e1a243a9eb4c61b0f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:44:54 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ef0a241c0ba4c594512fa5e1a243a9eb4c61b0f6 commit ef0a241c0ba4c594512fa5e1a243a9eb4c61b0f6 Author: Kristof Provost AuthorDate: 2020-12-23 13:51:52 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:04 +0000 pf: Split pf_src_node into a kernel and userspace struct Introduce a kernel version of struct pf_src_node (pf_ksrc_node). This will allow us to improve the in-kernel data structure without breaking userspace compatibility. Reviewed by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27707 (cherry picked from commit 17ad7334ca6225e0dc5caca12d1eb5886115f7af) --- sys/net/pfvar.h | 57 +++++++++------------------------------- sys/netpfil/pf/pf.c | 34 ++++++++++++------------ sys/netpfil/pf/pf.h | 50 +++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 67 +++++++++++++++++++++++++++++++---------------- sys/netpfil/pf/pf_lb.c | 8 +++--- 5 files changed, 129 insertions(+), 87 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 24faee5d45c6..5ff47c99b457 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -54,21 +54,6 @@ #include #include -struct pf_addr { - union { - struct in_addr v4; - struct in6_addr v6; - u_int8_t addr8[16]; - u_int16_t addr16[8]; - u_int32_t addr32[4]; - } pfa; /* 128-bit address */ -#define v4 pfa.v4 -#define v6 pfa.v6 -#define addr8 pfa.addr8 -#define addr16 pfa.addr16 -#define addr32 pfa.addr32 -}; - #define PFI_AFLAG_NETWORK 0x01 #define PFI_AFLAG_BROADCAST 0x02 #define PFI_AFLAG_PEER 0x04 @@ -481,12 +466,6 @@ struct pf_osfp_ioctl { int fp_getnum; /* DIOCOSFPGET number */ }; - -union pf_rule_ptr { - struct pf_rule *ptr; - u_int32_t nr; -}; - #define PF_ANCHOR_NAME_SIZE 64 struct pf_rule { @@ -630,18 +609,9 @@ struct pf_rule { #define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ #define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ - -struct pf_threshold { - u_int32_t limit; -#define PF_THRESHOLD_MULT 1000 -#define PF_THRESHOLD_MAX 0xffffffff / PF_THRESHOLD_MULT - u_int32_t seconds; - u_int32_t count; - u_int32_t last; -}; - -struct pf_src_node { - LIST_ENTRY(pf_src_node) entry; +#ifdef _KERNEL +struct pf_ksrc_node { + LIST_ENTRY(pf_ksrc_node) entry; struct pf_addr addr; struct pf_addr raddr; union pf_rule_ptr rule; @@ -656,8 +626,7 @@ struct pf_src_node { sa_family_t af; u_int8_t ruletype; }; - -#define PFSNODE_HIWAT 10000 /* default source node table size */ +#endif struct pf_state_scrub { struct timeval pfss_last; /* time received last packet */ @@ -741,8 +710,8 @@ struct pf_state { struct pf_state_key *key[2]; /* addresses stack and wire */ struct pfi_kif *kif; struct pfi_kif *rt_kif; - struct pf_src_node *src_node; - struct pf_src_node *nat_src_node; + struct pf_ksrc_node *src_node; + struct pf_ksrc_node *nat_src_node; counter_u64_t packets[2]; counter_u64_t bytes[2]; u_int32_t creation; @@ -1572,9 +1541,9 @@ struct pf_ifspeed_v1 { #endif /* _KERNEL */ #ifdef _KERNEL -LIST_HEAD(pf_src_node_list, pf_src_node); +LIST_HEAD(pf_ksrc_node_list, pf_ksrc_node); struct pf_srchash { - struct pf_src_node_list nodes; + struct pf_ksrc_node_list nodes; struct mtx lock; }; @@ -1686,10 +1655,10 @@ pf_release_state(struct pf_state *s) extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); -extern struct pf_src_node *pf_find_src_node(struct pf_addr *, +extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_rule *, sa_family_t, int); -extern void pf_unlink_src_node(struct pf_src_node *); -extern u_int pf_free_src_nodes(struct pf_src_node_list *); +extern void pf_unlink_src_node(struct pf_ksrc_node *); +extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); extern void pf_print_state(struct pf_state *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, @@ -1881,9 +1850,9 @@ int pf_step_out_of_anchor(struct pf_anchor_stackframe *, int *, int pf_map_addr(u_int8_t, struct pf_rule *, struct pf_addr *, struct pf_addr *, - struct pf_addr *, struct pf_src_node **); + struct pf_addr *, struct pf_ksrc_node **); struct pf_rule *pf_get_translation(struct pf_pdesc *, struct mbuf *, - int, int, struct pfi_kif *, struct pf_src_node **, + int, int, struct pfi_kif *, struct pf_ksrc_node **, struct pf_state_key **, struct pf_state_key **, struct pf_addr *, struct pf_addr *, uint16_t, uint16_t, struct pf_anchor_stackframe *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 84133039eb45..7b2128da7985 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -250,7 +250,7 @@ static int pf_test_rule(struct pf_rule **, struct pf_state **, struct pf_ruleset **, struct inpcb *); static int pf_create_state(struct pf_rule *, struct pf_rule *, struct pf_rule *, struct pf_pdesc *, - struct pf_src_node *, struct pf_state_key *, + struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kif *, struct pf_state **, int, u_int16_t, u_int16_t, @@ -295,7 +295,7 @@ static struct pf_state *pf_find_state(struct pfi_kif *, struct pf_state_key_cmp *, u_int); static int pf_src_connlimit(struct pf_state **); static void pf_overload_task(void *v, int pending); -static int pf_insert_src_node(struct pf_src_node **, +static int pf_insert_src_node(struct pf_ksrc_node **, struct pf_rule *, struct pf_addr *, sa_family_t); static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); @@ -677,12 +677,12 @@ pf_overload_task(void *v, int pending) * Can return locked on failure, so that we can consistently * allocate and insert a new one. */ -struct pf_src_node * +struct pf_ksrc_node * pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, int returnlocked) { struct pf_srchash *sh; - struct pf_src_node *n; + struct pf_ksrc_node *n; counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_SEARCH], 1); @@ -703,7 +703,7 @@ pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, } static int -pf_insert_src_node(struct pf_src_node **sn, struct pf_rule *rule, +pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, struct pf_addr *src, sa_family_t af) { @@ -757,7 +757,7 @@ pf_insert_src_node(struct pf_src_node **sn, struct pf_rule *rule, } void -pf_unlink_src_node(struct pf_src_node *src) +pf_unlink_src_node(struct pf_ksrc_node *src) { PF_HASHROW_ASSERT(&V_pf_srchash[pf_hashsrc(&src->addr, src->af)]); @@ -767,9 +767,9 @@ pf_unlink_src_node(struct pf_src_node *src) } u_int -pf_free_src_nodes(struct pf_src_node_list *head) +pf_free_src_nodes(struct pf_ksrc_node_list *head) { - struct pf_src_node *sn, *tmp; + struct pf_ksrc_node *sn, *tmp; u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { @@ -845,7 +845,7 @@ pf_initialize() /* Source nodes. */ V_pf_sources_z = uma_zcreate("pf source nodes", - sizeof(struct pf_src_node), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, + sizeof(struct pf_ksrc_node), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); @@ -1594,9 +1594,9 @@ pf_state_expires(const struct pf_state *state) void pf_purge_expired_src_nodes() { - struct pf_src_node_list freelist; + struct pf_ksrc_node_list freelist; struct pf_srchash *sh; - struct pf_src_node *cur, *next; + struct pf_ksrc_node *cur, *next; int i; LIST_INIT(&freelist); @@ -1619,7 +1619,7 @@ pf_purge_expired_src_nodes() static void pf_src_tree_remove_state(struct pf_state *s) { - struct pf_src_node *sn; + struct pf_ksrc_node *sn; struct pf_srchash *sh; uint32_t timeout; @@ -3311,7 +3311,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction, sa_family_t af = pd->af; struct pf_rule *r, *a = NULL; struct pf_ruleset *ruleset = NULL; - struct pf_src_node *nsn = NULL; + struct pf_ksrc_node *nsn = NULL; struct tcphdr *th = pd->hdr.tcp; struct pf_state_key *sk = NULL, *nk = NULL; u_short reason; @@ -3676,13 +3676,13 @@ cleanup: static int pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a, - struct pf_pdesc *pd, struct pf_src_node *nsn, struct pf_state_key *nk, + struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, u_int16_t dport, int *rewrite, struct pfi_kif *kif, struct pf_state **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { struct pf_state *s = NULL; - struct pf_src_node *sn = NULL; + struct pf_ksrc_node *sn = NULL; struct tcphdr *th = pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; u_short reason; @@ -5576,7 +5576,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, struct ip *ip; struct ifnet *ifp = NULL; struct pf_addr naddr; - struct pf_src_node *sn = NULL; + struct pf_ksrc_node *sn = NULL; int error = 0; uint16_t ip_len, ip_off; @@ -5739,7 +5739,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, struct ip6_hdr *ip6; struct ifnet *ifp = NULL; struct pf_addr naddr; - struct pf_src_node *sn = NULL; + struct pf_ksrc_node *sn = NULL; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); KASSERT(dir == PF_IN || dir == PF_OUT, ("%s: invalid direction", diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 253e88049b7c..7add0877224e 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -185,6 +185,8 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define PF_TABLE_NAME_SIZE 32 #define PF_QNAME_SIZE 64 +struct pf_rule; + struct pf_status { uint64_t counters[PFRES_MAX]; uint64_t lcounters[LCNT_MAX]; @@ -202,4 +204,52 @@ struct pf_status { uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; }; +struct pf_addr { + union { + struct in_addr v4; + struct in6_addr v6; + u_int8_t addr8[16]; + u_int16_t addr16[8]; + u_int32_t addr32[4]; + } pfa; /* 128-bit address */ +#define v4 pfa.v4 +#define v6 pfa.v6 +#define addr8 pfa.addr8 +#define addr16 pfa.addr16 +#define addr32 pfa.addr32 +}; + +union pf_rule_ptr { + struct pf_rule *ptr; + u_int32_t nr; +}; + +struct pf_threshold { + u_int32_t limit; +#define PF_THRESHOLD_MULT 1000 +#define PF_THRESHOLD_MAX 0xffffffff / PF_THRESHOLD_MULT + u_int32_t seconds; + u_int32_t count; + u_int32_t last; +}; + +struct pf_src_node { + LIST_ENTRY(pf_src_node) entry; + struct pf_addr addr; + struct pf_addr raddr; + union pf_rule_ptr rule; + struct pfi_kif *kif; + u_int64_t bytes[2]; + u_int64_t packets[2]; + u_int32_t states; + u_int32_t conn; + struct pf_threshold conn_rate; + u_int32_t creation; + u_int32_t expire; + sa_family_t af; + u_int8_t ruletype; +}; + +#define PFSNODE_HIWAT 10000 /* default source node table size */ + #endif /* _NET_PF_H_ */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 65f71ad8399e..cb503f7f3e1e 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -116,6 +116,8 @@ static int pf_commit_rules(u_int32_t, int, char *); static int pf_addr_setup(struct pf_ruleset *, struct pf_addr_wrap *, sa_family_t); static void pf_addr_copyout(struct pf_addr_wrap *); +static void pf_src_node_copy(const struct pf_ksrc_node *, + struct pf_src_node *); #ifdef ALTQ static int pf_export_kaltq(struct pf_altq *, struct pfioc_altq_v1 *, size_t); @@ -191,7 +193,7 @@ struct cdev *pf_dev; */ static void pf_clear_states(void); static int pf_clear_tables(void); -static void pf_clear_srcnodes(struct pf_src_node *); +static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); static void pf_tbladdr_copyout(struct pf_addr_wrap *); @@ -1148,6 +1150,42 @@ pf_addr_copyout(struct pf_addr_wrap *addr) } } +static void +pf_src_node_copy(const struct pf_ksrc_node *in, struct pf_src_node *out) +{ + int secs = time_uptime, diff; + + bzero(out, sizeof(struct pf_src_node)); + + bcopy(&in->addr, &out->addr, sizeof(struct pf_addr)); + bcopy(&in->raddr, &out->raddr, sizeof(struct pf_addr)); + + if (in->rule.ptr != NULL) + out->rule.nr = in->rule.ptr->nr; + + bcopy(&in->bytes, &out->bytes, sizeof(u_int64_t) * 2); + bcopy(&in->packets, &out->packets, sizeof(u_int64_t) * 2); + out->states = in->states; + out->conn = in->conn; + out->af = in->af; + out->ruletype = in->ruletype; + + out->creation = secs - in->creation; + if (out->expire > secs) + out->expire -= secs; + else + out->expire = 0; + + /* Adjust the connection rate estimate. */ + diff = secs - in->conn_rate.last; + if (diff >= in->conn_rate.seconds) + out->conn_rate.count = 0; + else + out->conn_rate.count -= + in->conn_rate.count * diff / + in->conn_rate.seconds; +} + #ifdef ALTQ /* * Handle export of struct pf_kaltq to user binaries that may be using any @@ -3771,7 +3809,8 @@ DIOCCHANGEADDR_error: case DIOCGETSRCNODES: { struct pfioc_src_nodes *psn = (struct pfioc_src_nodes *)addr; struct pf_srchash *sh; - struct pf_src_node *n, *p, *pstore; + struct pf_ksrc_node *n; + struct pf_src_node *p, *pstore; uint32_t i, nr = 0; for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; @@ -3797,28 +3836,12 @@ DIOCCHANGEADDR_error: i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH(n, &sh->nodes, entry) { - int secs = time_uptime, diff; if ((nr + 1) * sizeof(*p) > (unsigned)psn->psn_len) break; - bcopy(n, p, sizeof(struct pf_src_node)); - if (n->rule.ptr != NULL) - p->rule.nr = n->rule.ptr->nr; - p->creation = secs - p->creation; - if (p->expire > secs) - p->expire -= secs; - else - p->expire = 0; + pf_src_node_copy(n, p); - /* Adjust the connection rate estimate. */ - diff = secs - n->conn_rate.last; - if (diff >= n->conn_rate.seconds) - p->conn_rate.count = 0; - else - p->conn_rate.count -= - n->conn_rate.count * diff / - n->conn_rate.seconds; p++; nr++; } @@ -4044,7 +4067,7 @@ pf_clear_tables(void) } static void -pf_clear_srcnodes(struct pf_src_node *n) +pf_clear_srcnodes(struct pf_ksrc_node *n) { struct pf_state *s; int i; @@ -4084,12 +4107,12 @@ pf_clear_srcnodes(struct pf_src_node *n) static void pf_kill_srcnodes(struct pfioc_src_node_kill *psnk) { - struct pf_src_node_list kill; + struct pf_ksrc_node_list kill; LIST_INIT(&kill); for (int i = 0; i <= pf_srchashmask; i++) { struct pf_srchash *sh = &V_pf_srchash[i]; - struct pf_src_node *sn, *tmp; + struct pf_ksrc_node *sn, *tmp; PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(sn, &sh->nodes, entry, tmp) diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 46f91f8ff3ef..294e1c9be4b9 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -64,7 +64,7 @@ static struct pf_rule *pf_match_translation(struct pf_pdesc *, struct mbuf *, uint16_t, int, struct pf_anchor_stackframe *); static int pf_get_sport(sa_family_t, uint8_t, struct pf_rule *, struct pf_addr *, uint16_t, struct pf_addr *, uint16_t, struct pf_addr *, - uint16_t *, uint16_t, uint16_t, struct pf_src_node **); + uint16_t *, uint16_t, uint16_t, struct pf_ksrc_node **); #define mix(a,b,c) \ do { \ @@ -215,7 +215,7 @@ static int pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, struct pf_addr *saddr, uint16_t sport, struct pf_addr *daddr, uint16_t dport, struct pf_addr *naddr, uint16_t *nport, uint16_t low, - uint16_t high, struct pf_src_node **sn) + uint16_t high, struct pf_ksrc_node **sn) { struct pf_state_key_cmp key; struct pf_addr init_addr; @@ -308,7 +308,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, int pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, - struct pf_addr *naddr, struct pf_addr *init_addr, struct pf_src_node **sn) + struct pf_addr *naddr, struct pf_addr *init_addr, struct pf_ksrc_node **sn) { struct pf_pool *rpool = &r->rpool; struct pf_addr *raddr = NULL, *rmask = NULL; @@ -518,7 +518,7 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, struct pf_rule * pf_get_translation(struct pf_pdesc *pd, struct mbuf *m, int off, int direction, - struct pfi_kif *kif, struct pf_src_node **sn, + struct pfi_kif *kif, struct pf_ksrc_node **sn, struct pf_state_key **skp, struct pf_state_key **nkp, struct pf_addr *saddr, struct pf_addr *daddr, uint16_t sport, uint16_t dport, struct pf_anchor_stackframe *anchor_stack) From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:44:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56DC94F8A0C; Wed, 20 Jan 2021 14:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwl22gGz4qnQ; Wed, 20 Jan 2021 14:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38F171ADC9; Wed, 20 Jan 2021 14:44:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEitZt019336; Wed, 20 Jan 2021 14:44:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEit82019335; Wed, 20 Jan 2021 14:44:55 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:44:55 GMT Message-Id: <202101201444.10KEit82019335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b55dd986a489 - stable/12 - pf: Use counter_u64 in pf_src_node MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b55dd986a4894e0705be24118bcedc1b60120d82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:44:55 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b55dd986a4894e0705be24118bcedc1b60120d82 commit b55dd986a4894e0705be24118bcedc1b60120d82 Author: Kristof Provost AuthorDate: 2020-11-13 19:31:51 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:04 +0000 pf: Use counter_u64 in pf_src_node Reviewd by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27756 (cherry picked from commit fbbf270eef271806a0a106e45356d91f5b5e1f55) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 50 ++++++++++++++++++++++++++++++++++++++--------- sys/netpfil/pf/pf_ioctl.c | 7 +++++-- 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5ff47c99b457..dd85ac5f7b9f 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -616,8 +616,8 @@ struct pf_ksrc_node { struct pf_addr raddr; union pf_rule_ptr rule; struct pfi_kif *kif; - u_int64_t bytes[2]; - u_int64_t packets[2]; + counter_u64_t bytes[2]; + counter_u64_t packets[2]; u_int32_t states; u_int32_t conn; struct pf_threshold conn_rate; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7b2128da7985..89236817e3e9 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -702,6 +702,19 @@ pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, return (n); } +static void +pf_free_src_node(struct pf_ksrc_node *sn) +{ + + for (int i = 0; i < 2; i++) { + if (sn->bytes[i]) + counter_u64_free(sn->bytes[i]); + if (sn->packets[i]) + counter_u64_free(sn->packets[i]); + } + uma_zfree(V_pf_sources_z, sn); +} + static int pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, struct pf_addr *src, sa_family_t af) @@ -730,6 +743,17 @@ pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, return (-1); } + for (int i = 0; i < 2; i++) { + (*sn)->bytes[i] = counter_u64_alloc(M_NOWAIT); + (*sn)->packets[i] = counter_u64_alloc(M_NOWAIT); + + if ((*sn)->bytes[i] == NULL || (*sn)->packets[i] == NULL) { + pf_free_src_node(*sn); + PF_HASHROW_UNLOCK(sh); + return (-1); + } + } + pf_init_threshold(&(*sn)->conn_rate, rule->max_src_conn_rate.limit, rule->max_src_conn_rate.seconds); @@ -773,7 +797,7 @@ pf_free_src_nodes(struct pf_ksrc_node_list *head) u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { - uma_zfree(V_pf_sources_z, sn); + pf_free_src_node(sn); count++; } @@ -6322,12 +6346,16 @@ done: s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; } if (s->src_node != NULL) { - s->src_node->packets[dirndx]++; - s->src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->src_node->packets[dirndx], + 1); + counter_u64_add(s->src_node->bytes[dirndx], + pd.tot_len); } if (s->nat_src_node != NULL) { - s->nat_src_node->packets[dirndx]++; - s->nat_src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_src_node->packets[dirndx], + 1); + counter_u64_add(s->nat_src_node->bytes[dirndx], + pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; counter_u64_add(s->packets[dirndx], 1); @@ -6721,12 +6749,16 @@ done: s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; } if (s->src_node != NULL) { - s->src_node->packets[dirndx]++; - s->src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->src_node->packets[dirndx], + 1); + counter_u64_add(s->src_node->bytes[dirndx], + pd.tot_len); } if (s->nat_src_node != NULL) { - s->nat_src_node->packets[dirndx]++; - s->nat_src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_src_node->packets[dirndx], + 1); + counter_u64_add(s->nat_src_node->bytes[dirndx], + pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; counter_u64_add(s->packets[dirndx], 1); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index cb503f7f3e1e..4767cfd48afd 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1163,8 +1163,11 @@ pf_src_node_copy(const struct pf_ksrc_node *in, struct pf_src_node *out) if (in->rule.ptr != NULL) out->rule.nr = in->rule.ptr->nr; - bcopy(&in->bytes, &out->bytes, sizeof(u_int64_t) * 2); - bcopy(&in->packets, &out->packets, sizeof(u_int64_t) * 2); + for (int i = 0; i < 2; i++) { + out->bytes[i] = counter_u64_fetch(in->bytes[i]); + out->packets[i] = counter_u64_fetch(in->packets[i]); + } + out->states = in->states; out->conn = in->conn; out->af = in->af; From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:44:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62B314F8B07; Wed, 20 Jan 2021 14:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwm3GQjz4r4g; Wed, 20 Jan 2021 14:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ED6C1B307; Wed, 20 Jan 2021 14:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEiuCG019357; Wed, 20 Jan 2021 14:44:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEiuFt019356; Wed, 20 Jan 2021 14:44:56 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:44:56 GMT Message-Id: <202101201444.10KEiuFt019356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e2f0a703ead7 - stable/12 - pf: Migrate pf_rule and related structs to pf.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e2f0a703ead7fa174edd63422291a3b841b18384 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:44:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e2f0a703ead7fa174edd63422291a3b841b18384 commit e2f0a703ead7fa174edd63422291a3b841b18384 Author: Kristof Provost AuthorDate: 2020-12-03 16:17:39 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:04 +0000 pf: Migrate pf_rule and related structs to pf.h As part of the split between user and kernel mode structures we're moving all user space usable definitions into pf.h. No functional change intended. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27757 (cherry picked from commit dc865dae89c34291467e0ba569a8c78fc7a5d360) --- sys/net/pfvar.h | 317 ---------------------------------------------------- sys/netpfil/pf/pf.h | 317 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 317 insertions(+), 317 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index dd85ac5f7b9f..440110e77298 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -54,31 +54,6 @@ #include #include -#define PFI_AFLAG_NETWORK 0x01 -#define PFI_AFLAG_BROADCAST 0x02 -#define PFI_AFLAG_PEER 0x04 -#define PFI_AFLAG_MODEMASK 0x07 -#define PFI_AFLAG_NOALIAS 0x08 - -struct pf_addr_wrap { - union { - struct { - struct pf_addr addr; - struct pf_addr mask; - } a; - char ifname[IFNAMSIZ]; - char tblname[PF_TABLE_NAME_SIZE]; - } v; - union { - struct pfi_dynaddr *dyn; - struct pfr_ktable *tbl; - int dyncnt; - int tblcnt; - } p; - u_int8_t type; /* PF_ADDR_* */ - u_int8_t iflags; /* PFI_AFLAG_* */ -}; - #ifdef _KERNEL SYSCTL_DECL(_net_pf); @@ -317,298 +292,6 @@ extern struct sx pf_end_lock; #define PF_ALGNMNT(off) (((off) % 2) == 0) -struct pf_rule_uid { - uid_t uid[2]; - u_int8_t op; -}; - -struct pf_rule_gid { - uid_t gid[2]; - u_int8_t op; -}; - -struct pf_rule_addr { - struct pf_addr_wrap addr; - u_int16_t port[2]; - u_int8_t neg; - u_int8_t port_op; -}; - -struct pf_pooladdr { - struct pf_addr_wrap addr; - TAILQ_ENTRY(pf_pooladdr) entries; - char ifname[IFNAMSIZ]; - struct pfi_kif *kif; -}; - -TAILQ_HEAD(pf_palist, pf_pooladdr); - -struct pf_poolhashkey { - union { - u_int8_t key8[16]; - u_int16_t key16[8]; - u_int32_t key32[4]; - } pfk; /* 128-bit hash key */ -#define key8 pfk.key8 -#define key16 pfk.key16 -#define key32 pfk.key32 -}; - -struct pf_pool { - struct pf_palist list; - struct pf_pooladdr *cur; - struct pf_poolhashkey key; - struct pf_addr counter; - int tblidx; - u_int16_t proxy_port[2]; - u_int8_t opts; -}; - - -/* A packed Operating System description for fingerprinting */ -typedef u_int32_t pf_osfp_t; -#define PF_OSFP_ANY ((pf_osfp_t)0) -#define PF_OSFP_UNKNOWN ((pf_osfp_t)-1) -#define PF_OSFP_NOMATCH ((pf_osfp_t)-2) - -struct pf_osfp_entry { - SLIST_ENTRY(pf_osfp_entry) fp_entry; - pf_osfp_t fp_os; - int fp_enflags; -#define PF_OSFP_EXPANDED 0x001 /* expanded entry */ -#define PF_OSFP_GENERIC 0x002 /* generic signature */ -#define PF_OSFP_NODETAIL 0x004 /* no p0f details */ -#define PF_OSFP_LEN 32 - char fp_class_nm[PF_OSFP_LEN]; - char fp_version_nm[PF_OSFP_LEN]; - char fp_subtype_nm[PF_OSFP_LEN]; -}; -#define PF_OSFP_ENTRY_EQ(a, b) \ - ((a)->fp_os == (b)->fp_os && \ - memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \ - memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \ - memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0) - -/* handle pf_osfp_t packing */ -#define _FP_RESERVED_BIT 1 /* For the special negative #defines */ -#define _FP_UNUSED_BITS 1 -#define _FP_CLASS_BITS 10 /* OS Class (Windows, Linux) */ -#define _FP_VERSION_BITS 10 /* OS version (95, 98, NT, 2.4.54, 3.2) */ -#define _FP_SUBTYPE_BITS 10 /* patch level (NT SP4, SP3, ECN patch) */ -#define PF_OSFP_UNPACK(osfp, class, version, subtype) do { \ - (class) = ((osfp) >> (_FP_VERSION_BITS+_FP_SUBTYPE_BITS)) & \ - ((1 << _FP_CLASS_BITS) - 1); \ - (version) = ((osfp) >> _FP_SUBTYPE_BITS) & \ - ((1 << _FP_VERSION_BITS) - 1);\ - (subtype) = (osfp) & ((1 << _FP_SUBTYPE_BITS) - 1); \ -} while(0) -#define PF_OSFP_PACK(osfp, class, version, subtype) do { \ - (osfp) = ((class) & ((1 << _FP_CLASS_BITS) - 1)) << (_FP_VERSION_BITS \ - + _FP_SUBTYPE_BITS); \ - (osfp) |= ((version) & ((1 << _FP_VERSION_BITS) - 1)) << \ - _FP_SUBTYPE_BITS; \ - (osfp) |= (subtype) & ((1 << _FP_SUBTYPE_BITS) - 1); \ -} while(0) - -/* the fingerprint of an OSes TCP SYN packet */ -typedef u_int64_t pf_tcpopts_t; -struct pf_os_fingerprint { - SLIST_HEAD(pf_osfp_enlist, pf_osfp_entry) fp_oses; /* list of matches */ - pf_tcpopts_t fp_tcpopts; /* packed TCP options */ - u_int16_t fp_wsize; /* TCP window size */ - u_int16_t fp_psize; /* ip->ip_len */ - u_int16_t fp_mss; /* TCP MSS */ - u_int16_t fp_flags; -#define PF_OSFP_WSIZE_MOD 0x0001 /* Window modulus */ -#define PF_OSFP_WSIZE_DC 0x0002 /* Window don't care */ -#define PF_OSFP_WSIZE_MSS 0x0004 /* Window multiple of MSS */ -#define PF_OSFP_WSIZE_MTU 0x0008 /* Window multiple of MTU */ -#define PF_OSFP_PSIZE_MOD 0x0010 /* packet size modulus */ -#define PF_OSFP_PSIZE_DC 0x0020 /* packet size don't care */ -#define PF_OSFP_WSCALE 0x0040 /* TCP window scaling */ -#define PF_OSFP_WSCALE_MOD 0x0080 /* TCP window scale modulus */ -#define PF_OSFP_WSCALE_DC 0x0100 /* TCP window scale dont-care */ -#define PF_OSFP_MSS 0x0200 /* TCP MSS */ -#define PF_OSFP_MSS_MOD 0x0400 /* TCP MSS modulus */ -#define PF_OSFP_MSS_DC 0x0800 /* TCP MSS dont-care */ -#define PF_OSFP_DF 0x1000 /* IPv4 don't fragment bit */ -#define PF_OSFP_TS0 0x2000 /* Zero timestamp */ -#define PF_OSFP_INET6 0x4000 /* IPv6 */ - u_int8_t fp_optcnt; /* TCP option count */ - u_int8_t fp_wscale; /* TCP window scaling */ - u_int8_t fp_ttl; /* IPv4 TTL */ -#define PF_OSFP_MAXTTL_OFFSET 40 -/* TCP options packing */ -#define PF_OSFP_TCPOPT_NOP 0x0 /* TCP NOP option */ -#define PF_OSFP_TCPOPT_WSCALE 0x1 /* TCP window scaling option */ -#define PF_OSFP_TCPOPT_MSS 0x2 /* TCP max segment size opt */ -#define PF_OSFP_TCPOPT_SACK 0x3 /* TCP SACK OK option */ -#define PF_OSFP_TCPOPT_TS 0x4 /* TCP timestamp option */ -#define PF_OSFP_TCPOPT_BITS 3 /* bits used by each option */ -#define PF_OSFP_MAX_OPTS \ - (sizeof(((struct pf_os_fingerprint *)0)->fp_tcpopts) * 8) \ - / PF_OSFP_TCPOPT_BITS - - SLIST_ENTRY(pf_os_fingerprint) fp_next; -}; - -struct pf_osfp_ioctl { - struct pf_osfp_entry fp_os; - pf_tcpopts_t fp_tcpopts; /* packed TCP options */ - u_int16_t fp_wsize; /* TCP window size */ - u_int16_t fp_psize; /* ip->ip_len */ - u_int16_t fp_mss; /* TCP MSS */ - u_int16_t fp_flags; - u_int8_t fp_optcnt; /* TCP option count */ - u_int8_t fp_wscale; /* TCP window scaling */ - u_int8_t fp_ttl; /* IPv4 TTL */ - - int fp_getnum; /* DIOCOSFPGET number */ -}; - -#define PF_ANCHOR_NAME_SIZE 64 - -struct pf_rule { - struct pf_rule_addr src; - struct pf_rule_addr dst; -#define PF_SKIP_IFP 0 -#define PF_SKIP_DIR 1 -#define PF_SKIP_AF 2 -#define PF_SKIP_PROTO 3 -#define PF_SKIP_SRC_ADDR 4 -#define PF_SKIP_SRC_PORT 5 -#define PF_SKIP_DST_ADDR 6 -#define PF_SKIP_DST_PORT 7 -#define PF_SKIP_COUNT 8 - union pf_rule_ptr skip[PF_SKIP_COUNT]; -#define PF_RULE_LABEL_SIZE 64 - char label[PF_RULE_LABEL_SIZE]; - char ifname[IFNAMSIZ]; - char qname[PF_QNAME_SIZE]; - char pqname[PF_QNAME_SIZE]; -#define PF_TAG_NAME_SIZE 64 - char tagname[PF_TAG_NAME_SIZE]; - char match_tagname[PF_TAG_NAME_SIZE]; - - char overload_tblname[PF_TABLE_NAME_SIZE]; - - TAILQ_ENTRY(pf_rule) entries; - struct pf_pool rpool; - - u_int64_t evaluations; - u_int64_t packets[2]; - u_int64_t bytes[2]; - - struct pfi_kif *kif; - struct pf_anchor *anchor; - struct pfr_ktable *overload_tbl; - - pf_osfp_t os_fingerprint; - - int rtableid; - u_int32_t timeout[PFTM_MAX]; - u_int32_t max_states; - u_int32_t max_src_nodes; - u_int32_t max_src_states; - u_int32_t max_src_conn; - struct { - u_int32_t limit; - u_int32_t seconds; - } max_src_conn_rate; - u_int32_t qid; - u_int32_t pqid; - u_int32_t rt_listid; - u_int32_t nr; - u_int32_t prob; - uid_t cuid; - pid_t cpid; - - counter_u64_t states_cur; - counter_u64_t states_tot; - counter_u64_t src_nodes; - - u_int16_t return_icmp; - u_int16_t return_icmp6; - u_int16_t max_mss; - u_int16_t tag; - u_int16_t match_tag; - u_int16_t scrub_flags; - - struct pf_rule_uid uid; - struct pf_rule_gid gid; - - u_int32_t rule_flag; - u_int8_t action; - u_int8_t direction; - u_int8_t log; - u_int8_t logif; - u_int8_t quick; - u_int8_t ifnot; - u_int8_t match_tag_not; - u_int8_t natpass; - -#define PF_STATE_NORMAL 0x1 -#define PF_STATE_MODULATE 0x2 -#define PF_STATE_SYNPROXY 0x3 - u_int8_t keep_state; - sa_family_t af; - u_int8_t proto; - u_int8_t type; - u_int8_t code; - u_int8_t flags; - u_int8_t flagset; - u_int8_t min_ttl; - u_int8_t allow_opts; - u_int8_t rt; - u_int8_t return_ttl; - u_int8_t tos; - u_int8_t set_tos; - u_int8_t anchor_relative; - u_int8_t anchor_wildcard; - -#define PF_FLUSH 0x01 -#define PF_FLUSH_GLOBAL 0x02 - u_int8_t flush; -#define PF_PRIO_ZERO 0xff /* match "prio 0" packets */ -#define PF_PRIO_MAX 7 - u_int8_t prio; - u_int8_t set_prio[2]; - - struct { - struct pf_addr addr; - u_int16_t port; - } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; -}; - -/* rule flags */ -#define PFRULE_DROP 0x0000 -#define PFRULE_RETURNRST 0x0001 -#define PFRULE_FRAGMENT 0x0002 -#define PFRULE_RETURNICMP 0x0004 -#define PFRULE_RETURN 0x0008 -#define PFRULE_NOSYNC 0x0010 -#define PFRULE_SRCTRACK 0x0020 /* track source states */ -#define PFRULE_RULESRCTRACK 0x0040 /* per rule */ -#define PFRULE_REFS 0x0080 /* rule has references */ - -/* scrub flags */ -#define PFRULE_NODF 0x0100 -#define PFRULE_RANDOMID 0x0800 -#define PFRULE_REASSEMBLE_TCP 0x1000 -#define PFRULE_SET_TOS 0x2000 - -/* rule flags again */ -#define PFRULE_IFBOUND 0x00010000 /* if-bound */ -#define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ - -#define PFSTATE_HIWAT 100000 /* default state table size */ -#define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ -#define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ - #ifdef _KERNEL struct pf_ksrc_node { LIST_ENTRY(pf_ksrc_node) entry; diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 7add0877224e..aa6409bcbaa9 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -219,11 +219,328 @@ struct pf_addr { #define addr32 pfa.addr32 }; +#define PFI_AFLAG_NETWORK 0x01 +#define PFI_AFLAG_BROADCAST 0x02 +#define PFI_AFLAG_PEER 0x04 +#define PFI_AFLAG_MODEMASK 0x07 +#define PFI_AFLAG_NOALIAS 0x08 + +struct pf_addr_wrap { + union { + struct { + struct pf_addr addr; + struct pf_addr mask; + } a; + char ifname[IFNAMSIZ]; + char tblname[PF_TABLE_NAME_SIZE]; + } v; + union { + struct pfi_dynaddr *dyn; + struct pfr_ktable *tbl; + int dyncnt; + int tblcnt; + } p; + u_int8_t type; /* PF_ADDR_* */ + u_int8_t iflags; /* PFI_AFLAG_* */ +}; + union pf_rule_ptr { struct pf_rule *ptr; u_int32_t nr; }; +struct pf_rule_uid { + uid_t uid[2]; + u_int8_t op; +}; + +struct pf_rule_gid { + uid_t gid[2]; + u_int8_t op; +}; + +struct pf_rule_addr { + struct pf_addr_wrap addr; + u_int16_t port[2]; + u_int8_t neg; + u_int8_t port_op; +}; + +struct pf_pooladdr { + struct pf_addr_wrap addr; + TAILQ_ENTRY(pf_pooladdr) entries; + char ifname[IFNAMSIZ]; + struct pfi_kif *kif; +}; + +TAILQ_HEAD(pf_palist, pf_pooladdr); + +struct pf_poolhashkey { + union { + u_int8_t key8[16]; + u_int16_t key16[8]; + u_int32_t key32[4]; + } pfk; /* 128-bit hash key */ +#define key8 pfk.key8 +#define key16 pfk.key16 +#define key32 pfk.key32 +}; + +struct pf_pool { + struct pf_palist list; + struct pf_pooladdr *cur; + struct pf_poolhashkey key; + struct pf_addr counter; + int tblidx; + u_int16_t proxy_port[2]; + u_int8_t opts; +}; + +/* A packed Operating System description for fingerprinting */ +typedef u_int32_t pf_osfp_t; +#define PF_OSFP_ANY ((pf_osfp_t)0) +#define PF_OSFP_UNKNOWN ((pf_osfp_t)-1) +#define PF_OSFP_NOMATCH ((pf_osfp_t)-2) + +struct pf_osfp_entry { + SLIST_ENTRY(pf_osfp_entry) fp_entry; + pf_osfp_t fp_os; + int fp_enflags; +#define PF_OSFP_EXPANDED 0x001 /* expanded entry */ +#define PF_OSFP_GENERIC 0x002 /* generic signature */ +#define PF_OSFP_NODETAIL 0x004 /* no p0f details */ +#define PF_OSFP_LEN 32 + char fp_class_nm[PF_OSFP_LEN]; + char fp_version_nm[PF_OSFP_LEN]; + char fp_subtype_nm[PF_OSFP_LEN]; +}; +#define PF_OSFP_ENTRY_EQ(a, b) \ + ((a)->fp_os == (b)->fp_os && \ + memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \ + memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \ + memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0) + +/* handle pf_osfp_t packing */ +#define _FP_RESERVED_BIT 1 /* For the special negative #defines */ +#define _FP_UNUSED_BITS 1 +#define _FP_CLASS_BITS 10 /* OS Class (Windows, Linux) */ +#define _FP_VERSION_BITS 10 /* OS version (95, 98, NT, 2.4.54, 3.2) */ +#define _FP_SUBTYPE_BITS 10 /* patch level (NT SP4, SP3, ECN patch) */ +#define PF_OSFP_UNPACK(osfp, class, version, subtype) do { \ + (class) = ((osfp) >> (_FP_VERSION_BITS+_FP_SUBTYPE_BITS)) & \ + ((1 << _FP_CLASS_BITS) - 1); \ + (version) = ((osfp) >> _FP_SUBTYPE_BITS) & \ + ((1 << _FP_VERSION_BITS) - 1);\ + (subtype) = (osfp) & ((1 << _FP_SUBTYPE_BITS) - 1); \ +} while(0) +#define PF_OSFP_PACK(osfp, class, version, subtype) do { \ + (osfp) = ((class) & ((1 << _FP_CLASS_BITS) - 1)) << (_FP_VERSION_BITS \ + + _FP_SUBTYPE_BITS); \ + (osfp) |= ((version) & ((1 << _FP_VERSION_BITS) - 1)) << \ + _FP_SUBTYPE_BITS; \ + (osfp) |= (subtype) & ((1 << _FP_SUBTYPE_BITS) - 1); \ +} while(0) + +/* the fingerprint of an OSes TCP SYN packet */ +typedef u_int64_t pf_tcpopts_t; +struct pf_os_fingerprint { + SLIST_HEAD(pf_osfp_enlist, pf_osfp_entry) fp_oses; /* list of matches */ + pf_tcpopts_t fp_tcpopts; /* packed TCP options */ + u_int16_t fp_wsize; /* TCP window size */ + u_int16_t fp_psize; /* ip->ip_len */ + u_int16_t fp_mss; /* TCP MSS */ + u_int16_t fp_flags; +#define PF_OSFP_WSIZE_MOD 0x0001 /* Window modulus */ +#define PF_OSFP_WSIZE_DC 0x0002 /* Window don't care */ +#define PF_OSFP_WSIZE_MSS 0x0004 /* Window multiple of MSS */ +#define PF_OSFP_WSIZE_MTU 0x0008 /* Window multiple of MTU */ +#define PF_OSFP_PSIZE_MOD 0x0010 /* packet size modulus */ +#define PF_OSFP_PSIZE_DC 0x0020 /* packet size don't care */ +#define PF_OSFP_WSCALE 0x0040 /* TCP window scaling */ +#define PF_OSFP_WSCALE_MOD 0x0080 /* TCP window scale modulus */ +#define PF_OSFP_WSCALE_DC 0x0100 /* TCP window scale dont-care */ +#define PF_OSFP_MSS 0x0200 /* TCP MSS */ +#define PF_OSFP_MSS_MOD 0x0400 /* TCP MSS modulus */ +#define PF_OSFP_MSS_DC 0x0800 /* TCP MSS dont-care */ +#define PF_OSFP_DF 0x1000 /* IPv4 don't fragment bit */ +#define PF_OSFP_TS0 0x2000 /* Zero timestamp */ +#define PF_OSFP_INET6 0x4000 /* IPv6 */ + u_int8_t fp_optcnt; /* TCP option count */ + u_int8_t fp_wscale; /* TCP window scaling */ + u_int8_t fp_ttl; /* IPv4 TTL */ +#define PF_OSFP_MAXTTL_OFFSET 40 +/* TCP options packing */ +#define PF_OSFP_TCPOPT_NOP 0x0 /* TCP NOP option */ +#define PF_OSFP_TCPOPT_WSCALE 0x1 /* TCP window scaling option */ +#define PF_OSFP_TCPOPT_MSS 0x2 /* TCP max segment size opt */ +#define PF_OSFP_TCPOPT_SACK 0x3 /* TCP SACK OK option */ +#define PF_OSFP_TCPOPT_TS 0x4 /* TCP timestamp option */ +#define PF_OSFP_TCPOPT_BITS 3 /* bits used by each option */ +#define PF_OSFP_MAX_OPTS \ + (sizeof(((struct pf_os_fingerprint *)0)->fp_tcpopts) * 8) \ + / PF_OSFP_TCPOPT_BITS + + SLIST_ENTRY(pf_os_fingerprint) fp_next; +}; + +struct pf_osfp_ioctl { + struct pf_osfp_entry fp_os; + pf_tcpopts_t fp_tcpopts; /* packed TCP options */ + u_int16_t fp_wsize; /* TCP window size */ + u_int16_t fp_psize; /* ip->ip_len */ + u_int16_t fp_mss; /* TCP MSS */ + u_int16_t fp_flags; + u_int8_t fp_optcnt; /* TCP option count */ + u_int8_t fp_wscale; /* TCP window scaling */ + u_int8_t fp_ttl; /* IPv4 TTL */ + + int fp_getnum; /* DIOCOSFPGET number */ +}; + +#define PF_ANCHOR_NAME_SIZE 64 + +struct pf_rule { + struct pf_rule_addr src; + struct pf_rule_addr dst; +#define PF_SKIP_IFP 0 +#define PF_SKIP_DIR 1 +#define PF_SKIP_AF 2 +#define PF_SKIP_PROTO 3 +#define PF_SKIP_SRC_ADDR 4 +#define PF_SKIP_SRC_PORT 5 +#define PF_SKIP_DST_ADDR 6 +#define PF_SKIP_DST_PORT 7 +#define PF_SKIP_COUNT 8 + union pf_rule_ptr skip[PF_SKIP_COUNT]; +#define PF_RULE_LABEL_SIZE 64 + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; +#define PF_TAG_NAME_SIZE 64 + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pf_rule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pf_anchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t rt_listid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + +#define PF_STATE_NORMAL 0x1 +#define PF_STATE_MODULATE 0x2 +#define PF_STATE_SYNPROXY 0x3 + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + +#define PF_FLUSH 0x01 +#define PF_FLUSH_GLOBAL 0x02 + u_int8_t flush; +#define PF_PRIO_ZERO 0xff /* match "prio 0" packets */ +#define PF_PRIO_MAX 7 + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + +/* rule flags */ +#define PFRULE_DROP 0x0000 +#define PFRULE_RETURNRST 0x0001 +#define PFRULE_FRAGMENT 0x0002 +#define PFRULE_RETURNICMP 0x0004 +#define PFRULE_RETURN 0x0008 +#define PFRULE_NOSYNC 0x0010 +#define PFRULE_SRCTRACK 0x0020 /* track source states */ +#define PFRULE_RULESRCTRACK 0x0040 /* per rule */ +#define PFRULE_REFS 0x0080 /* rule has references */ + +/* scrub flags */ +#define PFRULE_NODF 0x0100 +#define PFRULE_RANDOMID 0x0800 +#define PFRULE_REASSEMBLE_TCP 0x1000 +#define PFRULE_SET_TOS 0x2000 + +/* rule flags again */ +#define PFRULE_IFBOUND 0x00010000 /* if-bound */ +#define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ + +#define PFSTATE_HIWAT 100000 /* default state table size */ +#define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ +#define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ + + struct pf_threshold { u_int32_t limit; #define PF_THRESHOLD_MULT 1000 From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EC954F86BE; Wed, 20 Jan 2021 14:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwq5KDcz4r4y; Wed, 20 Jan 2021 14:44:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A003E1B129; Wed, 20 Jan 2021 14:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEivoE019388; Wed, 20 Jan 2021 14:44:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEivcd019387; Wed, 20 Jan 2021 14:44:57 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:44:57 GMT Message-Id: <202101201444.10KEivcd019387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3e4a92026657 - stable/12 - pf: Split pf_rule into kernel and user space versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3e4a9202665701d858e6049fe645a2e3d0ff093e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:01 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3e4a9202665701d858e6049fe645a2e3d0ff093e commit 3e4a9202665701d858e6049fe645a2e3d0ff093e Author: Kristof Provost AuthorDate: 2020-12-05 13:32:54 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:04 +0000 pf: Split pf_rule into kernel and user space versions No functional change intended. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27758 (cherry picked from commit e86bddea9fe62d5093a1942cf21950b3c5ca62e5) --- sys/net/pfvar.h | 234 +++++++++++++++++++++--------- sys/netpfil/pf/if_pflog.c | 4 +- sys/netpfil/pf/if_pfsync.c | 2 +- sys/netpfil/pf/pf.c | 124 ++++++++-------- sys/netpfil/pf/pf.h | 48 +++++++ sys/netpfil/pf/pf_if.c | 6 +- sys/netpfil/pf/pf_ioctl.c | 337 ++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_lb.c | 24 ++-- sys/netpfil/pf/pf_norm.c | 10 +- sys/netpfil/pf/pf_ruleset.c | 303 +++++++++++++++++++++++++++++++++++---- sys/netpfil/pf/pf_table.c | 36 ++--- 11 files changed, 857 insertions(+), 271 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 440110e77298..4dd2db1a34b9 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -293,11 +293,115 @@ extern struct sx pf_end_lock; #define PF_ALGNMNT(off) (((off) % 2) == 0) #ifdef _KERNEL + +union pf_krule_ptr { + struct pf_krule *ptr; + u_int32_t nr; +}; + +struct pf_krule { + struct pf_rule_addr src; + struct pf_rule_addr dst; + union pf_krule_ptr skip[PF_SKIP_COUNT]; + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pf_krule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pf_kanchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t rt_listid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + + u_int8_t flush; + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + struct pf_ksrc_node { LIST_ENTRY(pf_ksrc_node) entry; struct pf_addr addr; struct pf_addr raddr; - union pf_rule_ptr rule; + union pf_krule_ptr rule; struct pfi_kif *kif; counter_u64_t bytes[2]; counter_u64_t packets[2]; @@ -374,6 +478,15 @@ struct pf_state_cmp { u_int8_t pad[3]; }; +#define PFSTATE_ALLOWOPTS 0x01 +#define PFSTATE_SLOPPY 0x02 +/* was PFSTATE_PFLOW 0x04 */ +#define PFSTATE_NOSYNC 0x08 +#define PFSTATE_ACK 0x10 +#define PFSTATE_SETPRIO 0x0200 +#define PFSTATE_SETMASK (PFSTATE_SETPRIO) + +#ifdef _KERNEL struct pf_state { u_int64_t id; u_int32_t creatorid; @@ -386,9 +499,9 @@ struct pf_state { LIST_ENTRY(pf_state) entry; struct pf_state_peer src; struct pf_state_peer dst; - union pf_rule_ptr rule; - union pf_rule_ptr anchor; - union pf_rule_ptr nat_rule; + union pf_krule_ptr rule; + union pf_krule_ptr anchor; + union pf_krule_ptr nat_rule; struct pf_addr rt_addr; struct pf_state_key *key[2]; /* addresses stack and wire */ struct pfi_kif *kif; @@ -403,13 +516,6 @@ struct pf_state { u_int16_t tag; u_int8_t log; u_int8_t state_flags; -#define PFSTATE_ALLOWOPTS 0x01 -#define PFSTATE_SLOPPY 0x02 -/* was PFSTATE_PFLOW 0x04 */ -#define PFSTATE_NOSYNC 0x08 -#define PFSTATE_ACK 0x10 -#define PFSTATE_SETPRIO 0x0200 -#define PFSTATE_SETMASK (PFSTATE_SETPRIO) u_int8_t timeout; u_int8_t sync_state; /* PFSYNC_S_x */ @@ -417,6 +523,7 @@ struct pf_state { u_int8_t sync_updates; u_int8_t _tail[3]; }; +#endif /* * Unified state structures for pulling states out of the kernel @@ -501,11 +608,11 @@ void pfsync_state_export(struct pfsync_state *, struct pf_state *); /* pflog */ -struct pf_ruleset; +struct pf_kruleset; struct pf_pdesc; typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, - u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *, - struct pf_ruleset *, struct pf_pdesc *, int); + u_int8_t, u_int8_t, struct pf_krule *, struct pf_krule *, + struct pf_kruleset *, struct pf_pdesc *, int); extern pflog_packet_t *pflog_packet_ptr; #endif /* _KERNEL */ @@ -563,42 +670,42 @@ extern pflog_packet_t *pflog_packet_ptr; d += ntohl(s[1]); \ } while (0) -TAILQ_HEAD(pf_rulequeue, pf_rule); +TAILQ_HEAD(pf_krulequeue, pf_krule); -struct pf_anchor; +struct pf_kanchor; -struct pf_ruleset { +struct pf_kruleset { struct { - struct pf_rulequeue queues[2]; + struct pf_krulequeue queues[2]; struct { - struct pf_rulequeue *ptr; - struct pf_rule **ptr_array; + struct pf_krulequeue *ptr; + struct pf_krule **ptr_array; u_int32_t rcount; u_int32_t ticket; int open; } active, inactive; } rules[PF_RULESET_MAX]; - struct pf_anchor *anchor; + struct pf_kanchor *anchor; u_int32_t tticket; int tables; int topen; }; -RB_HEAD(pf_anchor_global, pf_anchor); -RB_HEAD(pf_anchor_node, pf_anchor); -struct pf_anchor { - RB_ENTRY(pf_anchor) entry_global; - RB_ENTRY(pf_anchor) entry_node; - struct pf_anchor *parent; - struct pf_anchor_node children; +RB_HEAD(pf_kanchor_global, pf_kanchor); +RB_HEAD(pf_kanchor_node, pf_kanchor); +struct pf_kanchor { + RB_ENTRY(pf_kanchor) entry_global; + RB_ENTRY(pf_kanchor) entry_node; + struct pf_kanchor *parent; + struct pf_kanchor_node children; char name[PF_ANCHOR_NAME_SIZE]; char path[MAXPATHLEN]; - struct pf_ruleset ruleset; + struct pf_kruleset ruleset; int refcnt; /* anchor rules */ int match; /* XXX: used for pfctl black magic */ }; -RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); +RB_PROTOTYPE(pf_kanchor_global, pf_kanchor, entry_global, pf_anchor_compare); +RB_PROTOTYPE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); #define PF_RESERVED_ANCHOR "_pf" @@ -625,7 +732,7 @@ RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); PFR_TFLAG_REFDANCHOR | \ PFR_TFLAG_COUNTERS) -struct pf_anchor_stackframe; +struct pf_kanchor_stackframe; struct pfr_table { char pfrt_anchor[MAXPATHLEN]; @@ -707,6 +814,7 @@ struct pfr_kcounters { ((kc)->pfrkc_counters + \ (dir) * PFR_OP_ADDR_MAX * PFR_TYPE_MAX + (op) * PFR_TYPE_MAX + (t)) +#ifdef _KERNEL SLIST_HEAD(pfr_kentryworkq, pfr_kentry); struct pfr_kentry { struct radix_node pfrke_node[2]; @@ -729,7 +837,7 @@ struct pfr_ktable { struct radix_node_head *pfrkt_ip6; struct pfr_ktable *pfrkt_shadow; struct pfr_ktable *pfrkt_root; - struct pf_ruleset *pfrkt_rs; + struct pf_kruleset *pfrkt_rs; long pfrkt_larg; int pfrkt_nflags; }; @@ -745,6 +853,7 @@ struct pfr_ktable { #define pfrkt_match pfrkt_kts.pfrkts_match #define pfrkt_nomatch pfrkt_kts.pfrkts_nomatch #define pfrkt_tzero pfrkt_kts.pfrkts_tzero +#endif /* keep synced with pfi_kif, used in RB_FIND */ struct pfi_kif_cmp { @@ -789,7 +898,7 @@ struct pf_pdesc { void *any; } hdr; - struct pf_rule *nat_rule; /* nat/rdr rule applied to packet */ + struct pf_krule *nat_rule; /* nat/rdr rule applied to packet */ struct pf_addr *src; /* src address */ struct pf_addr *dst; /* dst address */ u_int16_t *sport; @@ -1282,7 +1391,7 @@ VNET_DECLARE(struct pf_altqqueue *, pf_altqs_inactive); VNET_DECLARE(struct pf_altqqueue *, pf_altq_ifs_inactive); #define V_pf_altq_ifs_inactive VNET(pf_altq_ifs_inactive) -VNET_DECLARE(struct pf_rulequeue, pf_unlinked_rules); +VNET_DECLARE(struct pf_krulequeue, pf_unlinked_rules); #define V_pf_unlinked_rules VNET(pf_unlinked_rules) void pf_initialize(void); @@ -1292,7 +1401,7 @@ void pf_cleanup(void); struct pf_mtag *pf_get_mtag(struct mbuf *); -extern void pf_calc_skip_steps(struct pf_rulequeue *); +extern void pf_calc_skip_steps(struct pf_krulequeue *); #ifdef ALTQ extern void pf_altq_ifnet_event(struct ifnet *, int); #endif @@ -1339,7 +1448,7 @@ extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, - struct pf_rule *, sa_family_t, int); + struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); extern void pf_print_state(struct pf_state *); @@ -1351,11 +1460,11 @@ extern u_int16_t pf_proto_cksum_fixup(struct mbuf *, u_int16_t, VNET_DECLARE(struct ifnet *, sync_ifp); #define V_sync_ifp VNET(sync_ifp); -VNET_DECLARE(struct pf_rule, pf_default_rule); +VNET_DECLARE(struct pf_krule, pf_default_rule); #define V_pf_default_rule VNET(pf_default_rule) extern void pf_addrcpy(struct pf_addr *, struct pf_addr *, u_int8_t); -void pf_free_rule(struct pf_rule *); +void pf_free_rule(struct pf_krule *); #ifdef INET int pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *); @@ -1417,7 +1526,7 @@ void pfr_update_stats(struct pfr_ktable *, struct pf_addr *, sa_family_t, int pfr_pool_get(struct pfr_ktable *, int *, struct pf_addr *, sa_family_t); void pfr_dynaddr_update(struct pfr_ktable *, struct pfi_dynaddr *); struct pfr_ktable * - pfr_attach_table(struct pf_ruleset *, char *); + pfr_attach_table(struct pf_kruleset *, char *); void pfr_detach_table(struct pfr_ktable *); int pfr_clr_tables(struct pfr_table *, int *, int); int pfr_add_tables(struct pfr_table *, int, int *, int); @@ -1471,7 +1580,7 @@ void pfi_get_ifaces(const char *, struct pfi_kif *, int *); int pfi_set_flags(const char *, int); int pfi_clear_flags(const char *, int); -int pf_match_tag(struct mbuf *, struct pf_rule *, int *, int); +int pf_match_tag(struct mbuf *, struct pf_krule *, int *, int); int pf_tag_packet(struct mbuf *, struct pf_pdesc *, int); int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); @@ -1490,25 +1599,24 @@ VNET_DECLARE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); #endif /* _KERNEL */ #ifdef _KERNEL -VNET_DECLARE(struct pf_anchor_global, pf_anchors); +VNET_DECLARE(struct pf_kanchor_global, pf_anchors); #define V_pf_anchors VNET(pf_anchors) -VNET_DECLARE(struct pf_anchor, pf_main_anchor); +VNET_DECLARE(struct pf_kanchor, pf_main_anchor); #define V_pf_main_anchor VNET(pf_main_anchor) #define pf_main_ruleset V_pf_main_anchor.ruleset -#endif -/* these ruleset functions can be linked into userland programs (pfctl) */ int pf_get_ruleset_number(u_int8_t); -void pf_init_ruleset(struct pf_ruleset *); -int pf_anchor_setup(struct pf_rule *, - const struct pf_ruleset *, const char *); -int pf_anchor_copyout(const struct pf_ruleset *, - const struct pf_rule *, struct pfioc_rule *); -void pf_anchor_remove(struct pf_rule *); -void pf_remove_if_empty_ruleset(struct pf_ruleset *); -struct pf_ruleset *pf_find_ruleset(const char *); -struct pf_ruleset *pf_find_or_create_ruleset(const char *); +void pf_init_kruleset(struct pf_kruleset *); +int pf_kanchor_setup(struct pf_krule *, + const struct pf_kruleset *, const char *); +int pf_kanchor_copyout(const struct pf_kruleset *, + const struct pf_krule *, struct pfioc_rule *); +void pf_kanchor_remove(struct pf_krule *); +void pf_remove_if_empty_kruleset(struct pf_kruleset *); +struct pf_kruleset *pf_find_kruleset(const char *); +struct pf_kruleset *pf_find_or_create_kruleset(const char *); void pf_rs_initialize(void); +#endif /* The fingerprint functions can be linked into userland programs (tcpdump) */ int pf_osfp_add(struct pf_osfp_ioctl *); @@ -1524,21 +1632,21 @@ int pf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t); #ifdef _KERNEL void pf_print_host(struct pf_addr *, u_int16_t, u_int8_t); -void pf_step_into_anchor(struct pf_anchor_stackframe *, int *, - struct pf_ruleset **, int, struct pf_rule **, - struct pf_rule **, int *); -int pf_step_out_of_anchor(struct pf_anchor_stackframe *, int *, - struct pf_ruleset **, int, struct pf_rule **, - struct pf_rule **, int *); +void pf_step_into_anchor(struct pf_kanchor_stackframe *, int *, + struct pf_kruleset **, int, struct pf_krule **, + struct pf_krule **, int *); +int pf_step_out_of_anchor(struct pf_kanchor_stackframe *, int *, + struct pf_kruleset **, int, struct pf_krule **, + struct pf_krule **, int *); -int pf_map_addr(u_int8_t, struct pf_rule *, +int pf_map_addr(u_int8_t, struct pf_krule *, struct pf_addr *, struct pf_addr *, struct pf_addr *, struct pf_ksrc_node **); -struct pf_rule *pf_get_translation(struct pf_pdesc *, struct mbuf *, +struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *, int, int, struct pfi_kif *, struct pf_ksrc_node **, struct pf_state_key **, struct pf_state_key **, struct pf_addr *, struct pf_addr *, - uint16_t, uint16_t, struct pf_anchor_stackframe *); + uint16_t, uint16_t, struct pf_kanchor_stackframe *); struct pf_state_key *pf_state_key_setup(struct pf_pdesc *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t); diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 87e674f46942..030f75c2507e 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -202,8 +202,8 @@ pflogioctl(struct ifnet *ifp, u_long cmd, caddr_t data) static int pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, - u_int8_t reason, struct pf_rule *rm, struct pf_rule *am, - struct pf_ruleset *ruleset, struct pf_pdesc *pd, int lookupsafe) + u_int8_t reason, struct pf_krule *rm, struct pf_krule *am, + struct pf_kruleset *ruleset, struct pf_pdesc *pd, int lookupsafe) { struct ifnet *ifn; struct pfloghdr hdr; diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index a6967d2297a6..0d0e62cf1b8b 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -464,7 +464,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pfsync_state_key *kw, *ks; struct pf_state *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; - struct pf_rule *r = NULL; + struct pf_krule *r = NULL; struct pfi_kif *kif; int error; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 89236817e3e9..85a6b27d7139 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -182,7 +182,7 @@ struct pf_overload_entry { struct pf_addr addr; sa_family_t af; uint8_t dir; - struct pf_rule *rule; + struct pf_krule *rule; }; SLIST_HEAD(pf_overload_head, pf_overload_entry); @@ -197,7 +197,7 @@ MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, #define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) -VNET_DEFINE(struct pf_rulequeue, pf_unlinked_rules); +VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); @@ -231,34 +231,34 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); static void pf_send_tcp(struct mbuf *, - const struct pf_rule *, sa_family_t, + const struct pf_krule *, sa_family_t, const struct pf_addr *, const struct pf_addr *, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, u_int16_t, struct ifnet *); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, - sa_family_t, struct pf_rule *); + sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_state *); static int pf_state_key_attach(struct pf_state_key *, struct pf_state_key *, struct pf_state *); static void pf_state_key_detach(struct pf_state *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); -static int pf_test_rule(struct pf_rule **, struct pf_state **, +static int pf_test_rule(struct pf_krule **, struct pf_state **, int, struct pfi_kif *, struct mbuf *, int, - struct pf_pdesc *, struct pf_rule **, - struct pf_ruleset **, struct inpcb *); -static int pf_create_state(struct pf_rule *, struct pf_rule *, - struct pf_rule *, struct pf_pdesc *, + struct pf_pdesc *, struct pf_krule **, + struct pf_kruleset **, struct inpcb *); +static int pf_create_state(struct pf_krule *, struct pf_krule *, + struct pf_krule *, struct pf_pdesc *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kif *, struct pf_state **, int, u_int16_t, u_int16_t, int); -static int pf_test_fragment(struct pf_rule **, int, +static int pf_test_fragment(struct pf_krule **, int, struct pfi_kif *, struct mbuf *, void *, - struct pf_pdesc *, struct pf_rule **, - struct pf_ruleset **); + struct pf_pdesc *, struct pf_krule **, + struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, struct pf_state_peer *, struct pf_state **, struct pfi_kif *, struct mbuf *, int, @@ -296,20 +296,20 @@ static struct pf_state *pf_find_state(struct pfi_kif *, static int pf_src_connlimit(struct pf_state **); static void pf_overload_task(void *v, int pending); static int pf_insert_src_node(struct pf_ksrc_node **, - struct pf_rule *, struct pf_addr *, sa_family_t); + struct pf_krule *, struct pf_addr *, sa_family_t); static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); #ifdef INET -static void pf_route(struct mbuf **, struct pf_rule *, int, +static void pf_route(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_state *, struct pf_pdesc *, struct inpcb *); #endif /* INET */ #ifdef INET6 static void pf_change_a6(struct pf_addr *, u_int16_t *, struct pf_addr *, u_int8_t); -static void pf_route6(struct mbuf **, struct pf_rule *, int, +static void pf_route6(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_state *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ @@ -678,7 +678,7 @@ pf_overload_task(void *v, int pending) * allocate and insert a new one. */ struct pf_ksrc_node * -pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, +pf_find_src_node(struct pf_addr *src, struct pf_krule *rule, sa_family_t af, int returnlocked) { struct pf_srchash *sh; @@ -716,7 +716,7 @@ pf_free_src_node(struct pf_ksrc_node *sn) } static int -pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, +pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_krule *rule, struct pf_addr *src, sa_family_t af) { @@ -1805,8 +1805,8 @@ relock: static void pf_purge_unlinked_rules() { - struct pf_rulequeue tmpq; - struct pf_rule *r, *r1; + struct pf_krulequeue tmpq; + struct pf_krule *r, *r1; /* * If we have overloading task pending, then we'd @@ -2031,9 +2031,9 @@ pf_print_flags(u_int8_t f) } while (0) void -pf_calc_skip_steps(struct pf_rulequeue *rules) +pf_calc_skip_steps(struct pf_krulequeue *rules) { - struct pf_rule *cur, *prev, *head[PF_SKIP_COUNT]; + struct pf_krule *cur, *prev, *head[PF_SKIP_COUNT]; int i; cur = TAILQ_FIRST(rules); @@ -2441,7 +2441,7 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, } static void -pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, +pf_send_tcp(struct mbuf *replyto, const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, @@ -2601,7 +2601,7 @@ pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, } static void -pf_return(struct pf_rule *r, struct pf_rule *nr, struct pf_pdesc *pd, +pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, struct pf_state_key *sk, int off, struct mbuf *m, struct tcphdr *th, struct pfi_kif *kif, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen, u_short *reason) @@ -2716,7 +2716,7 @@ pf_match_ieee8021q_pcp(u_int8_t prio, struct mbuf *m) static void pf_send_icmp(struct mbuf *m, u_int8_t type, u_int8_t code, sa_family_t af, - struct pf_rule *r) + struct pf_krule *r) { struct pf_send_entry *pfse; struct mbuf *m0; @@ -2904,7 +2904,7 @@ pf_match_gid(u_int8_t op, gid_t a1, gid_t a2, gid_t g) } int -pf_match_tag(struct mbuf *m, struct pf_rule *r, int *tag, int mtag) +pf_match_tag(struct mbuf *m, struct pf_krule *r, int *tag, int mtag) { if (*tag == -1) *tag = mtag; @@ -2928,10 +2928,10 @@ pf_tag_packet(struct mbuf *m, struct pf_pdesc *pd, int tag) } #define PF_ANCHOR_STACKSIZE 32 -struct pf_anchor_stackframe { - struct pf_ruleset *rs; - struct pf_rule *r; /* XXX: + match bit */ - struct pf_anchor *child; +struct pf_kanchor_stackframe { + struct pf_kruleset *rs; + struct pf_krule *r; /* XXX: + match bit */ + struct pf_kanchor *child; }; /* @@ -2941,18 +2941,18 @@ struct pf_anchor_stackframe { #define PF_ANCHORSTACK_MASK (PF_ANCHORSTACK_MATCH) #define PF_ANCHOR_MATCH(f) ((uintptr_t)(f)->r & PF_ANCHORSTACK_MATCH) -#define PF_ANCHOR_RULE(f) (struct pf_rule *) \ +#define PF_ANCHOR_RULE(f) (struct pf_krule *) \ ((uintptr_t)(f)->r & ~PF_ANCHORSTACK_MASK) #define PF_ANCHOR_SET_MATCH(f) do { (f)->r = (void *) \ ((uintptr_t)(f)->r | PF_ANCHORSTACK_MATCH); \ } while (0) void -pf_step_into_anchor(struct pf_anchor_stackframe *stack, int *depth, - struct pf_ruleset **rs, int n, struct pf_rule **r, struct pf_rule **a, +pf_step_into_anchor(struct pf_kanchor_stackframe *stack, int *depth, + struct pf_kruleset **rs, int n, struct pf_krule **r, struct pf_krule **a, int *match) { - struct pf_anchor_stackframe *f; + struct pf_kanchor_stackframe *f; PF_RULES_RASSERT(); @@ -2969,9 +2969,9 @@ pf_step_into_anchor(struct pf_anchor_stackframe *stack, int *depth, f->rs = *rs; f->r = *r; if ((*r)->anchor_wildcard) { - struct pf_anchor_node *parent = &(*r)->anchor->children; + struct pf_kanchor_node *parent = &(*r)->anchor->children; - if ((f->child = RB_MIN(pf_anchor_node, parent)) == NULL) { + if ((f->child = RB_MIN(pf_kanchor_node, parent)) == NULL) { *r = NULL; return; } @@ -2984,12 +2984,12 @@ pf_step_into_anchor(struct pf_anchor_stackframe *stack, int *depth, } int -pf_step_out_of_anchor(struct pf_anchor_stackframe *stack, int *depth, - struct pf_ruleset **rs, int n, struct pf_rule **r, struct pf_rule **a, +pf_step_out_of_anchor(struct pf_kanchor_stackframe *stack, int *depth, + struct pf_kruleset **rs, int n, struct pf_krule **r, struct pf_krule **a, int *match) { - struct pf_anchor_stackframe *f; - struct pf_rule *fr; + struct pf_kanchor_stackframe *f; + struct pf_krule *fr; int quick = 0; PF_RULES_RASSERT(); @@ -3000,7 +3000,7 @@ pf_step_out_of_anchor(struct pf_anchor_stackframe *stack, int *depth, f = stack + *depth - 1; fr = PF_ANCHOR_RULE(f); if (f->child != NULL) { - struct pf_anchor_node *parent; + struct pf_kanchor_node *parent; /* * This block traverses through @@ -3016,7 +3016,7 @@ pf_step_out_of_anchor(struct pf_anchor_stackframe *stack, int *depth, PF_ANCHOR_SET_MATCH(f); *match = 0; } - f->child = RB_NEXT(pf_anchor_node, parent, f->child); + f->child = RB_NEXT(pf_kanchor_node, parent, f->child); if (f->child != NULL) { *rs = &f->child->ruleset; *r = TAILQ_FIRST((*rs)->rules[n].active.ptr); @@ -3325,16 +3325,16 @@ pf_tcp_iss(struct pf_pdesc *pd) } static int -pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction, +pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, struct pfi_kif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, - struct pf_rule **am, struct pf_ruleset **rsm, struct inpcb *inp) + struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { - struct pf_rule *nr = NULL; + struct pf_krule *nr = NULL; struct pf_addr * const saddr = pd->src; struct pf_addr * const daddr = pd->dst; sa_family_t af = pd->af; - struct pf_rule *r, *a = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_krule *r, *a = NULL; + struct pf_kruleset *ruleset = NULL; struct pf_ksrc_node *nsn = NULL; struct tcphdr *th = pd->hdr.tcp; struct pf_state_key *sk = NULL, *nk = NULL; @@ -3347,7 +3347,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction, u_int16_t sport = 0, dport = 0; u_int16_t bproto_sum = 0, bip_sum = 0; u_int8_t icmptype = 0, icmpcode = 0; - struct pf_anchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; + struct pf_kanchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; PF_RULES_RASSERT(); @@ -3699,7 +3699,7 @@ cleanup: } static int -pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a, +pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, u_int16_t dport, int *rewrite, struct pfi_kif *kif, struct pf_state **sm, @@ -3960,18 +3960,18 @@ csfailed: } static int -pf_test_fragment(struct pf_rule **rm, int direction, struct pfi_kif *kif, - struct mbuf *m, void *h, struct pf_pdesc *pd, struct pf_rule **am, - struct pf_ruleset **rsm) +pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, + struct mbuf *m, void *h, struct pf_pdesc *pd, struct pf_krule **am, + struct pf_kruleset **rsm) { - struct pf_rule *r, *a = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_krule *r, *a = NULL; + struct pf_kruleset *ruleset = NULL; sa_family_t af = pd->af; u_short reason; int tag = -1; int asd = 0; int match = 0; - struct pf_anchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; + struct pf_kanchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; PF_RULES_RASSERT(); @@ -5592,7 +5592,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, #ifdef INET static void -pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, +pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1; @@ -5755,7 +5755,7 @@ bad: #ifdef INET6 static void -pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, +pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0; @@ -6023,9 +6023,9 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * struct mbuf *m = *m0; struct ip *h = NULL; struct m_tag *ipfwtag; - struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; + struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_state *s = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, dirndx, pqid = 0; @@ -6318,7 +6318,7 @@ done: } if (log) { - struct pf_rule *lr; + struct pf_krule *lr; if (s != NULL && s->nat_rule.ptr != NULL && s->nat_rule.ptr->log & PF_LOG_ALL) @@ -6416,9 +6416,9 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb struct mbuf *m = *m0, *n = NULL; struct m_tag *mtag; struct ip6_hdr *h = NULL; - struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; + struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_state *s = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; @@ -6721,7 +6721,7 @@ done: printf("pf: divert(9) is not supported for IPv6\n"); if (log) { - struct pf_rule *lr; + struct pf_krule *lr; if (s != NULL && s->nat_rule.ptr != NULL && s->nat_rule.ptr->log & PF_LOG_ALL) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index aa6409bcbaa9..4e73d815aece 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -35,6 +35,8 @@ #ifndef _NET_PF_H_ #define _NET_PF_H_ +#include + #define PF_TCPS_PROXY_SRC ((TCP_NSTATES)+0) #define PF_TCPS_PROXY_DST ((TCP_NSTATES)+1) @@ -569,4 +571,50 @@ struct pf_src_node { #define PFSNODE_HIWAT 10000 /* default source node table size */ +TAILQ_HEAD(pf_rulequeue, pf_rule); + +struct pf_anchor; + +struct pf_ruleset { + struct { + struct pf_rulequeue queues[2]; + struct { + struct pf_rulequeue *ptr; + struct pf_rule **ptr_array; + u_int32_t rcount; + u_int32_t ticket; + int open; + } active, inactive; + } rules[PF_RULESET_MAX]; + struct pf_anchor *anchor; + u_int32_t tticket; + int tables; + int topen; +}; + +RB_HEAD(pf_anchor_global, pf_anchor); +RB_HEAD(pf_anchor_node, pf_anchor); +struct pf_anchor { + RB_ENTRY(pf_anchor) entry_global; + RB_ENTRY(pf_anchor) entry_node; + struct pf_anchor *parent; + struct pf_anchor_node children; + char name[PF_ANCHOR_NAME_SIZE]; + char path[MAXPATHLEN]; + struct pf_ruleset ruleset; + int refcnt; /* anchor rules */ + int match; /* XXX: used for pfctl black magic */ +}; +RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); +RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); + +/* these ruleset functions can be linked into userland programs (pfctl) */ +int pf_get_ruleset_number(u_int8_t); +void pf_init_ruleset(struct pf_ruleset *); +int pf_anchor_setup(struct pf_rule *, + const struct pf_ruleset *, const char *); +void pf_remove_if_empty_ruleset(struct pf_ruleset *); +struct pf_ruleset *pf_find_ruleset(const char *); +struct pf_ruleset *pf_find_or_create_ruleset(const char *); + #endif /* _NET_PF_H_ */ diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 9d761790c764..fa43ca292ae1 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -391,7 +391,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) { struct pfi_dynaddr *dyn; char tblname[PF_TABLE_NAME_SIZE]; - struct pf_ruleset *ruleset = NULL; + struct pf_kruleset *ruleset = NULL; struct pfi_kif *kif; int rv = 0; @@ -429,7 +429,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) if (dyn->pfid_net != 128) snprintf(tblname + strlen(tblname), sizeof(tblname) - strlen(tblname), "/%d", dyn->pfid_net); - if ((ruleset = pf_find_or_create_ruleset(PF_RESERVED_ANCHOR)) == NULL) { + if ((ruleset = pf_find_or_create_kruleset(PF_RESERVED_ANCHOR)) == NULL) { rv = ENOMEM; goto _bad; } @@ -453,7 +453,7 @@ _bad: if (dyn->pfid_kt != NULL) pfr_detach_table(dyn->pfid_kt); if (ruleset != NULL) - pf_remove_if_empty_ruleset(ruleset); + pf_remove_if_empty_kruleset(ruleset); if (dyn->pfid_kif != NULL) pfi_kif_unref(dyn->pfid_kif); free(dyn, PFI_MTYPE); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 4767cfd48afd..e928c65734a7 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -109,11 +109,11 @@ static void pf_qid_unref(u_int32_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); static int pf_rollback_rules(u_int32_t, int, char *); -static int pf_setup_pfsync_matching(struct pf_ruleset *); -static void pf_hash_rule(MD5_CTX *, struct pf_rule *); +static int pf_setup_pfsync_matching(struct pf_kruleset *); +static void pf_hash_rule(MD5_CTX *, struct pf_krule *); static void pf_hash_rule_addr(MD5_CTX *, struct pf_rule_addr *); static int pf_commit_rules(u_int32_t, int, char *); -static int pf_addr_setup(struct pf_ruleset *, +static int pf_addr_setup(struct pf_kruleset *, struct pf_addr_wrap *, sa_family_t); static void pf_addr_copyout(struct pf_addr_wrap *); static void pf_src_node_copy(const struct pf_ksrc_node *, @@ -125,7 +125,7 @@ static int pf_import_kaltq(struct pfioc_altq_v1 *, struct pf_altq *, size_t); #endif /* ALTQ */ -VNET_DEFINE(struct pf_rule, pf_default_rule); +VNET_DEFINE(struct pf_krule, pf_default_rule); #ifdef ALTQ VNET_DEFINE_STATIC(int, pf_altq_running); @@ -271,7 +271,7 @@ pfattach_vnet(void) V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; RB_INIT(&V_pf_anchors); - pf_init_ruleset(&pf_main_ruleset); + pf_init_kruleset(&pf_main_ruleset); *** 1387 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 762F94F899F; Wed, 20 Jan 2021 14:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwq3BTcz4qtC; Wed, 20 Jan 2021 14:44:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AD221AE56; Wed, 20 Jan 2021 14:44:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEiwWj019408; Wed, 20 Jan 2021 14:44:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEiwxJ019407; Wed, 20 Jan 2021 14:44:58 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:44:58 GMT Message-Id: <202101201444.10KEiwxJ019407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7ee74e43abb7 - stable/12 - pf: Remove unused fields from pf_krule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7ee74e43abb78af75cc381bafbc30c9d5340b09d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:01 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ee74e43abb78af75cc381bafbc30c9d5340b09d commit 7ee74e43abb78af75cc381bafbc30c9d5340b09d Author: Kristof Provost AuthorDate: 2020-12-05 13:38:12 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:04 +0000 pf: Remove unused fields from pf_krule The u_* counters are used only to communicate with userspace, as userspace cannot use counter_u64. As pf_krule is not passed to userspace these fields are now obsolete. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27759 (cherry picked from commit c7bdafe2f1b703fdf72489019edc3d6b9e5483da) --- sys/net/pfvar.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 4dd2db1a34b9..5b77b0a6c4e2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -391,10 +391,6 @@ struct pf_krule { struct pf_addr addr; u_int16_t port; } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; }; struct pf_ksrc_node { From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1321C4F89A1; Wed, 20 Jan 2021 14:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwt6mB5z4r2G; Wed, 20 Jan 2021 14:45:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEE4E1AFDB; Wed, 20 Jan 2021 14:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEj0RI019456; Wed, 20 Jan 2021 14:45:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEj0Wl019455; Wed, 20 Jan 2021 14:45:00 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:45:00 GMT Message-Id: <202101201445.10KEj0Wl019455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 051f0103dc19 - stable/12 - pf: Split pfi_kif into a user and kernel space structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 051f0103dc196ac29d7ec2e1f1c3f99a295cae64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=051f0103dc196ac29d7ec2e1f1c3f99a295cae64 commit 051f0103dc196ac29d7ec2e1f1c3f99a295cae64 Author: Kristof Provost AuthorDate: 2020-12-12 14:14:56 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pf: Split pfi_kif into a user and kernel space structure No functional change. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27761 (cherry picked from commit 320c11165b6b1113b34f9e156cbf85b5ed0aa5eb) --- sys/net/pfvar.h | 74 ++++++++++++++---------- sys/netpfil/pf/if_pflog.c | 2 +- sys/netpfil/pf/if_pfsync.c | 6 +- sys/netpfil/pf/pf.c | 62 ++++++++++---------- sys/netpfil/pf/pf.h | 23 ++++++++ sys/netpfil/pf/pf_if.c | 138 ++++++++++++++++++++++++++------------------- sys/netpfil/pf/pf_ioctl.c | 113 ++++++++++++++++++++++--------------- sys/netpfil/pf/pf_lb.c | 12 ++-- sys/netpfil/pf/pf_norm.c | 12 ++-- 9 files changed, 260 insertions(+), 182 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 636ea8c5e02c..a58da4e4cc46 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -66,7 +66,7 @@ struct pfi_dynaddr { struct pf_addr pfid_addr6; struct pf_addr pfid_mask6; struct pfr_ktable *pfid_kt; - struct pfi_kif *pfid_kif; + struct pfi_kkif *pfid_kif; int pfid_net; /* mask or 128 */ int pfid_acnt4; /* address count IPv4 */ int pfid_acnt6; /* address count IPv6 */ @@ -294,6 +294,25 @@ extern struct sx pf_end_lock; #ifdef _KERNEL +struct pf_kpooladdr { + struct pf_addr_wrap addr; + TAILQ_ENTRY(pf_kpooladdr) entries; + char ifname[IFNAMSIZ]; + struct pfi_kkif *kif; +}; + +TAILQ_HEAD(pf_kpalist, pf_kpooladdr); + +struct pf_kpool { + struct pf_kpalist list; + struct pf_kpooladdr *cur; + struct pf_poolhashkey key; + struct pf_addr counter; + int tblidx; + u_int16_t proxy_port[2]; + u_int8_t opts; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -313,13 +332,13 @@ struct pf_krule { char overload_tblname[PF_TABLE_NAME_SIZE]; TAILQ_ENTRY(pf_krule) entries; - struct pf_pool rpool; + struct pf_kpool rpool; counter_u64_t evaluations; counter_u64_t packets[2]; counter_u64_t bytes[2]; - struct pfi_kif *kif; + struct pfi_kkif *kif; struct pf_kanchor *anchor; struct pfr_ktable *overload_tbl; @@ -398,7 +417,7 @@ struct pf_ksrc_node { struct pf_addr addr; struct pf_addr raddr; union pf_krule_ptr rule; - struct pfi_kif *kif; + struct pfi_kkif *kif; counter_u64_t bytes[2]; counter_u64_t packets[2]; u_int32_t states; @@ -500,8 +519,8 @@ struct pf_state { union pf_krule_ptr nat_rule; struct pf_addr rt_addr; struct pf_state_key *key[2]; /* addresses stack and wire */ - struct pfi_kif *kif; - struct pfi_kif *rt_kif; + struct pfi_kkif *kif; + struct pfi_kkif *rt_kif; struct pf_ksrc_node *src_node; struct pf_ksrc_node *nat_src_node; counter_u64_t packets[2]; @@ -606,7 +625,7 @@ void pfsync_state_export(struct pfsync_state *, /* pflog */ struct pf_kruleset; struct pf_pdesc; -typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, +typedef int pflog_packet_t(struct pfi_kkif *, struct mbuf *, sa_family_t, u_int8_t, u_int8_t, struct pf_krule *, struct pf_krule *, struct pf_kruleset *, struct pf_pdesc *, int); extern pflog_packet_t *pflog_packet_ptr; @@ -851,16 +870,12 @@ struct pfr_ktable { #define pfrkt_tzero pfrkt_kts.pfrkts_tzero #endif -/* keep synced with pfi_kif, used in RB_FIND */ -struct pfi_kif_cmp { - char pfik_name[IFNAMSIZ]; -}; - -struct pfi_kif { +#ifdef _KERNEL +struct pfi_kkif { char pfik_name[IFNAMSIZ]; union { - RB_ENTRY(pfi_kif) _pfik_tree; - LIST_ENTRY(pfi_kif) _pfik_list; + RB_ENTRY(pfi_kkif) _pfik_tree; + LIST_ENTRY(pfi_kkif) _pfik_list; } _pfik_glue; #define pfik_tree _pfik_glue._pfik_tree #define pfik_list _pfik_glue._pfik_list @@ -873,6 +888,7 @@ struct pfi_kif { u_int pfik_rulerefs; TAILQ_HEAD(, pfi_dynaddr) pfik_dynaddrs; }; +#endif #define PFI_IFLAG_REFS 0x0001 /* has state references */ #define PFI_IFLAG_SKIP 0x0100 /* skip filtering on interface */ @@ -1367,7 +1383,7 @@ VNET_DECLARE(uint64_t, pf_stateid[MAXCPU]); TAILQ_HEAD(pf_altqqueue, pf_altq); VNET_DECLARE(struct pf_altqqueue, pf_altqs[4]); #define V_pf_altqs VNET(pf_altqs) -VNET_DECLARE(struct pf_palist, pf_pabuf); +VNET_DECLARE(struct pf_kpalist, pf_pabuf); #define V_pf_pabuf VNET(pf_pabuf) VNET_DECLARE(u_int32_t, ticket_altqs_active); @@ -1416,7 +1432,7 @@ extern void pf_purge_expired_src_nodes(void); extern int pf_unlink_state(struct pf_state *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 -extern int pf_state_insert(struct pfi_kif *, +extern int pf_state_insert(struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, struct pf_state *); @@ -1464,13 +1480,13 @@ void pf_free_rule(struct pf_krule *); #ifdef INET int pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *); -int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *, +int pf_normalize_ip(struct mbuf **, int, struct pfi_kkif *, u_short *, struct pf_pdesc *); #endif /* INET */ #ifdef INET6 int pf_test6(int, int, struct ifnet *, struct mbuf **, struct inpcb *); -int pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *, +int pf_normalize_ip6(struct mbuf **, int, struct pfi_kkif *, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, u_int8_t); @@ -1498,7 +1514,7 @@ int pf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t); void pf_normalize_init(void); void pf_normalize_cleanup(void); -int pf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *, +int pf_normalize_tcp(int, struct pfi_kkif *, struct mbuf *, int, int, void *, struct pf_pdesc *); void pf_normalize_tcp_cleanup(struct pf_state *); int pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, @@ -1510,7 +1526,7 @@ u_int32_t pf_state_expires(const struct pf_state *); void pf_purge_expired_fragments(void); void pf_purge_fragments(uint32_t); -int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *, +int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *, int); int pf_socket_lookup(int, struct pf_pdesc *, struct mbuf *); struct pf_state_key *pf_alloc_state_key(int); @@ -1553,19 +1569,19 @@ int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, int *, u_int32_t, int); MALLOC_DECLARE(PFI_MTYPE); -VNET_DECLARE(struct pfi_kif *, pfi_all); +VNET_DECLARE(struct pfi_kkif *, pfi_all); #define V_pfi_all VNET(pfi_all) void pfi_initialize(void); void pfi_initialize_vnet(void); void pfi_cleanup(void); void pfi_cleanup_vnet(void); -void pfi_kif_ref(struct pfi_kif *); -void pfi_kif_unref(struct pfi_kif *); -struct pfi_kif *pfi_kif_find(const char *); -struct pfi_kif *pfi_kif_attach(struct pfi_kif *, const char *); -int pfi_kif_match(struct pfi_kif *, struct pfi_kif *); -void pfi_kif_purge(void); +void pfi_kkif_ref(struct pfi_kkif *); +void pfi_kkif_unref(struct pfi_kkif *); +struct pfi_kkif *pfi_kkif_find(const char *); +struct pfi_kkif *pfi_kkif_attach(struct pfi_kkif *, const char *); +int pfi_kkif_match(struct pfi_kkif *, struct pfi_kkif *); +void pfi_kkif_purge(void); int pfi_match_addr(struct pfi_dynaddr *, struct pf_addr *, sa_family_t); int pfi_dynaddr_setup(struct pf_addr_wrap *, sa_family_t); @@ -1639,7 +1655,7 @@ int pf_map_addr(u_int8_t, struct pf_krule *, struct pf_addr *, struct pf_addr *, struct pf_addr *, struct pf_ksrc_node **); struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *, - int, int, struct pfi_kif *, struct pf_ksrc_node **, + int, int, struct pfi_kkif *, struct pf_ksrc_node **, struct pf_state_key **, struct pf_state_key **, struct pf_addr *, struct pf_addr *, uint16_t, uint16_t, struct pf_kanchor_stackframe *); diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 030f75c2507e..9eb168b9a74f 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -201,7 +201,7 @@ pflogioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static int -pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, +pflog_packet(struct pfi_kkif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, u_int8_t reason, struct pf_krule *rm, struct pf_krule *am, struct pf_kruleset *ruleset, struct pf_pdesc *pd, int lookupsafe) { diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 0d0e62cf1b8b..a9950350cb29 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -465,7 +465,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pf_state *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_krule *r = NULL; - struct pfi_kif *kif; + struct pfi_kkif *kif; int error; PF_RULES_RASSERT(); @@ -477,7 +477,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) return (EINVAL); } - if ((kif = pfi_kif_find(sp->ifname)) == NULL) { + if ((kif = pfi_kkif_find(sp->ifname)) == NULL) { if (V_pf_status.debug >= PF_DEBUG_MISC) printf("%s: unknown interface: %s\n", __func__, sp->ifname); @@ -765,7 +765,7 @@ pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) creatorid = clr[i].creatorid; if (clr[i].ifname[0] != '\0' && - pfi_kif_find(clr[i].ifname) == NULL) + pfi_kkif_find(clr[i].ifname) == NULL) continue; for (int i = 0; i <= pf_hashmask; i++) { diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c2cc2ba55196..f1c26342577f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -119,7 +119,7 @@ __FBSDID("$FreeBSD$"); /* state tables */ VNET_DEFINE(struct pf_altqqueue, pf_altqs[4]); -VNET_DEFINE(struct pf_palist, pf_pabuf); +VNET_DEFINE(struct pf_kpalist, pf_pabuf); VNET_DEFINE(struct pf_altqqueue *, pf_altqs_active); VNET_DEFINE(struct pf_altqqueue *, pf_altq_ifs_active); VNET_DEFINE(struct pf_altqqueue *, pf_altqs_inactive); @@ -245,38 +245,38 @@ static void pf_state_key_detach(struct pf_state *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); static int pf_test_rule(struct pf_krule **, struct pf_state **, - int, struct pfi_kif *, struct mbuf *, int, + int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **, struct inpcb *); static int pf_create_state(struct pf_krule *, struct pf_krule *, struct pf_krule *, struct pf_pdesc *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, - u_int16_t, u_int16_t, int *, struct pfi_kif *, + u_int16_t, u_int16_t, int *, struct pfi_kkif *, struct pf_state **, int, u_int16_t, u_int16_t, int); static int pf_test_fragment(struct pf_krule **, int, - struct pfi_kif *, struct mbuf *, void *, + struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, struct pf_state_peer *, struct pf_state **, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); static int pf_tcp_track_sloppy(struct pf_state_peer *, struct pf_state_peer *, struct pf_state **, struct pf_pdesc *, u_short *); static int pf_test_state_tcp(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_udp(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *); static int pf_test_state_icmp(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_other(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, struct pf_pdesc *); + struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, @@ -291,7 +291,7 @@ static int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); static void pf_patch_8(struct mbuf *, u_int16_t *, u_int8_t *, u_int8_t, bool, u_int8_t); -static struct pf_state *pf_find_state(struct pfi_kif *, +static struct pf_state *pf_find_state(struct pfi_kkif *, struct pf_state_key_cmp *, u_int); static int pf_src_connlimit(struct pf_state **); static void pf_overload_task(void *v, int pending); @@ -1255,7 +1255,7 @@ pf_state_key_clone(struct pf_state_key *orig) } int -pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw, +pf_state_insert(struct pfi_kkif *kif, struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) { struct pf_idhash *ih; @@ -1341,7 +1341,7 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Returns with ID hash slot locked on success. */ static struct pf_state * -pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir) +pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) { struct pf_keyhash *kh; struct pf_state_key *sk; @@ -1535,7 +1535,7 @@ pf_purge_thread(void *unused __unused) pf_purge_expired_fragments(); pf_purge_expired_src_nodes(); pf_purge_unlinked_rules(); - pfi_kif_purge(); + pfi_kkif_purge(); } CURVNET_RESTORE(); } @@ -1558,7 +1558,7 @@ pf_unload_vnet_purge(void) * raise them, and then second run frees. */ pf_purge_unlinked_rules(); - pfi_kif_purge(); + pfi_kkif_purge(); /* * Now purge everything. @@ -1572,7 +1572,7 @@ pf_unload_vnet_purge(void) * thus should be successfully freed. */ pf_purge_unlinked_rules(); - pfi_kif_purge(); + pfi_kkif_purge(); } @@ -2603,7 +2603,7 @@ pf_send_tcp(struct mbuf *replyto, const struct pf_krule *r, sa_family_t af, static void pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, struct pf_state_key *sk, int off, struct mbuf *m, struct tcphdr *th, - struct pfi_kif *kif, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen, + struct pfi_kkif *kif, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen, u_short *reason) { struct pf_addr * const saddr = pd->src; @@ -3326,7 +3326,7 @@ pf_tcp_iss(struct pf_pdesc *pd) static int pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, - struct pfi_kif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, + struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { struct pf_krule *nr = NULL; @@ -3539,7 +3539,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, while (r != NULL) { counter_u64_add(r->evaluations, 1); - if (pfi_kif_match(r->kif, kif) == r->ifnot) + if (pfi_kkif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) r = r->skip[PF_SKIP_DIR].ptr; @@ -3702,7 +3702,7 @@ static int pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, - u_int16_t dport, int *rewrite, struct pfi_kif *kif, struct pf_state **sm, + u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_state **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { struct pf_state *s = NULL; @@ -3960,7 +3960,7 @@ csfailed: } static int -pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, +pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, struct mbuf *m, void *h, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm) { @@ -3978,7 +3978,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_FILTER].active.ptr); while (r != NULL) { counter_u64_add(r->evaluations, 1); - if (pfi_kif_match(r->kif, kif) == r->ifnot) + if (pfi_kkif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) r = r->skip[PF_SKIP_DIR].ptr; @@ -4056,7 +4056,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, static int pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pfi_kif *kif, struct mbuf *m, int off, + struct pf_state **state, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, int *copyback) { struct tcphdr *th = pd->hdr.tcp; @@ -4456,7 +4456,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { @@ -4624,7 +4624,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif, } static int -pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -4691,7 +4691,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif, } static int -pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { struct pf_addr *saddr = pd->src, *daddr = pd->dst; @@ -5296,7 +5296,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, } static int -pf_test_state_other(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_other(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -5526,7 +5526,7 @@ out: #endif int -pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, +pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif, int rtableid) { #ifdef INET @@ -6018,7 +6018,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p, sa_family_t a int pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { - struct pfi_kif *kif; + struct pfi_kkif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0; struct ip *h = NULL; @@ -6038,7 +6038,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * memset(&pd, 0, sizeof(pd)); - kif = (struct pfi_kif *)ifp->if_pf_kif; + kif = (struct pfi_kkif *)ifp->if_pf_kif; if (kif == NULL) { DPFPRINTF(PF_DEBUG_URGENT, @@ -6413,7 +6413,7 @@ done: int pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { - struct pfi_kif *kif; + struct pfi_kkif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0, *n = NULL; struct m_tag *mtag; @@ -6436,7 +6436,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb if (pd.pf_mtag && pd.pf_mtag->flags & PF_TAG_GENERATED) return (PF_PASS); - kif = (struct pfi_kif *)ifp->if_pf_kif; + kif = (struct pfi_kkif *)ifp->if_pf_kif; if (kif == NULL) { DPFPRINTF(PF_DEBUG_URGENT, ("pf_test6: kif == NULL, if_xname %s\n", ifp->if_xname)); diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 4e73d815aece..511c60f5abd1 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -189,6 +189,29 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, struct pf_rule; +/* keep synced with pfi_kif, used in RB_FIND */ +struct pfi_kif_cmp { + char pfik_name[IFNAMSIZ]; +}; + +struct pfi_kif { + char pfik_name[IFNAMSIZ]; + union { + RB_ENTRY(pfi_kif) _pfik_tree; + LIST_ENTRY(pfi_kif) _pfik_list; + } _pfik_glue; +#define pfik_tree _pfik_glue._pfik_tree +#define pfik_list _pfik_glue._pfik_list + u_int64_t pfik_packets[2][2][2]; + u_int64_t pfik_bytes[2][2][2]; + u_int32_t pfik_tzero; + u_int pfik_flags; + struct ifnet *pfik_ifp; + struct ifg_group *pfik_group; + u_int pfik_rulerefs; + TAILQ_HEAD(, pfi_dynaddr) pfik_dynaddrs; +}; + struct pf_status { uint64_t counters[PFRES_MAX]; uint64_t lcounters[LCNT_MAX]; diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index fa43ca292ae1..a0148395340f 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -VNET_DEFINE(struct pfi_kif *, pfi_all); +VNET_DEFINE(struct pfi_kkif *, pfi_all); VNET_DEFINE_STATIC(long, pfi_update); #define V_pfi_update VNET(pfi_update) #define PFI_BUFFER_MAX 0x10000 @@ -79,14 +79,14 @@ eventhandler_tag pfi_ifaddr_event_cookie; static void pfi_attach_ifnet(struct ifnet *); static void pfi_attach_ifgroup(struct ifg_group *); -static void pfi_kif_update(struct pfi_kif *); +static void pfi_kkif_update(struct pfi_kkif *); static void pfi_dynaddr_update(struct pfi_dynaddr *dyn); -static void pfi_table_update(struct pfr_ktable *, struct pfi_kif *, int, +static void pfi_table_update(struct pfr_ktable *, struct pfi_kkif *, int, int); static void pfi_instance_add(struct ifnet *, int, int); static void pfi_address_add(struct sockaddr *, int, int); -static int pfi_if_compare(struct pfi_kif *, struct pfi_kif *); -static int pfi_skip_if(const char *, struct pfi_kif *); +static int pfi_kkif_compare(struct pfi_kkif *, struct pfi_kkif *); +static int pfi_skip_if(const char *, struct pfi_kkif *); static int pfi_unmask(void *); static void pfi_attach_ifnet_event(void * __unused, struct ifnet *); static void pfi_detach_ifnet_event(void * __unused, struct ifnet *); @@ -95,16 +95,16 @@ static void pfi_change_group_event(void * __unused, char *); static void pfi_detach_group_event(void * __unused, struct ifg_group *); static void pfi_ifaddr_event(void * __unused, struct ifnet *); -RB_HEAD(pfi_ifhead, pfi_kif); -static RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); -static RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); +RB_HEAD(pfi_ifhead, pfi_kkif); +static RB_PROTOTYPE(pfi_ifhead, pfi_kkif, pfik_tree, pfi_kkif_compare); +static RB_GENERATE(pfi_ifhead, pfi_kkif, pfik_tree, pfi_kkif_compare); VNET_DEFINE_STATIC(struct pfi_ifhead, pfi_ifs); #define V_pfi_ifs VNET(pfi_ifs) #define PFI_BUFFER_MAX 0x10000 MALLOC_DEFINE(PFI_MTYPE, "pf_ifnet", "pf(4) interface database"); -LIST_HEAD(pfi_list, pfi_kif); +LIST_HEAD(pfi_list, pfi_kkif); VNET_DEFINE_STATIC(struct pfi_list, pfi_unlinked_kifs); #define V_pfi_unlinked_kifs VNET(pfi_unlinked_kifs) static struct mtx pfi_unlnkdkifs_mtx; @@ -116,7 +116,7 @@ pfi_initialize_vnet(void) { struct ifg_group *ifg; struct ifnet *ifp; - struct pfi_kif *kif; + struct pfi_kkif *kif; V_pfi_buffer_max = 64; V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*V_pfi_buffer), @@ -124,7 +124,7 @@ pfi_initialize_vnet(void) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); PF_RULES_WLOCK(); - V_pfi_all = pfi_kif_attach(kif, IFG_ALL); + V_pfi_all = pfi_kkif_attach(kif, IFG_ALL); PF_RULES_WUNLOCK(); IFNET_RLOCK(); @@ -156,7 +156,7 @@ pfi_initialize(void) void pfi_cleanup_vnet(void) { - struct pfi_kif *kif; + struct pfi_kkif *kif; PF_RULES_WASSERT(); @@ -194,8 +194,8 @@ pfi_cleanup(void) EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); } -struct pfi_kif * -pfi_kif_find(const char *kif_name) +struct pfi_kkif * +pfi_kkif_find(const char *kif_name) { struct pfi_kif_cmp s; @@ -204,18 +204,18 @@ pfi_kif_find(const char *kif_name) bzero(&s, sizeof(s)); strlcpy(s.pfik_name, kif_name, sizeof(s.pfik_name)); - return (RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&s)); + return (RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kkif *)&s)); } -struct pfi_kif * -pfi_kif_attach(struct pfi_kif *kif, const char *kif_name) +struct pfi_kkif * +pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name) { - struct pfi_kif *kif1; + struct pfi_kkif *kif1; PF_RULES_WASSERT(); KASSERT(kif != NULL, ("%s: null kif", __func__)); - kif1 = pfi_kif_find(kif_name); + kif1 = pfi_kkif_find(kif_name); if (kif1 != NULL) { free(kif, PFI_MTYPE); return (kif1); @@ -239,7 +239,7 @@ pfi_kif_attach(struct pfi_kif *kif, const char *kif_name) } void -pfi_kif_ref(struct pfi_kif *kif) +pfi_kkif_ref(struct pfi_kkif *kif) { PF_RULES_WASSERT(); @@ -247,7 +247,7 @@ pfi_kif_ref(struct pfi_kif *kif) } void -pfi_kif_unref(struct pfi_kif *kif) +pfi_kkif_unref(struct pfi_kkif *kif) { PF_RULES_WASSERT(); @@ -274,9 +274,9 @@ pfi_kif_unref(struct pfi_kif *kif) } void -pfi_kif_purge(void) +pfi_kkif_purge(void) { - struct pfi_kif *kif, *kif1; + struct pfi_kkif *kif, *kif1; /* * Do naive mark-and-sweep garbage collecting of old kifs. @@ -294,7 +294,7 @@ pfi_kif_purge(void) } int -pfi_kif_match(struct pfi_kif *rule_kif, struct pfi_kif *packet_kif) +pfi_kkif_match(struct pfi_kkif *rule_kif, struct pfi_kkif *packet_kif) { struct ifg_list *p; @@ -318,33 +318,33 @@ pfi_kif_match(struct pfi_kif *rule_kif, struct pfi_kif *packet_kif) static void pfi_attach_ifnet(struct ifnet *ifp) { - struct pfi_kif *kif; + struct pfi_kkif *kif; kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); PF_RULES_WLOCK(); V_pfi_update++; - kif = pfi_kif_attach(kif, ifp->if_xname); + kif = pfi_kkif_attach(kif, ifp->if_xname); if_ref(ifp); kif->pfik_ifp = ifp; ifp->if_pf_kif = kif; - pfi_kif_update(kif); + pfi_kkif_update(kif); PF_RULES_WUNLOCK(); } static void pfi_attach_ifgroup(struct ifg_group *ifg) { - struct pfi_kif *kif; + struct pfi_kkif *kif; kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); PF_RULES_WLOCK(); V_pfi_update++; - kif = pfi_kif_attach(kif, ifg->ifg_group); + kif = pfi_kkif_attach(kif, ifg->ifg_group); kif->pfik_group = ifg; ifg->ifg_pf_kif = kif; @@ -392,7 +392,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) struct pfi_dynaddr *dyn; char tblname[PF_TABLE_NAME_SIZE]; struct pf_kruleset *ruleset = NULL; - struct pfi_kif *kif; + struct pfi_kkif *kif; int rv = 0; PF_RULES_WASSERT(); @@ -409,10 +409,10 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) } if (!strcmp(aw->v.ifname, "self")) - dyn->pfid_kif = pfi_kif_attach(kif, IFG_ALL); + dyn->pfid_kif = pfi_kkif_attach(kif, IFG_ALL); else - dyn->pfid_kif = pfi_kif_attach(kif, aw->v.ifname); - pfi_kif_ref(dyn->pfid_kif); + dyn->pfid_kif = pfi_kkif_attach(kif, aw->v.ifname); + pfi_kkif_ref(dyn->pfid_kif); dyn->pfid_net = pfi_unmask(&aw->v.a.mask); if (af == AF_INET && dyn->pfid_net == 32) @@ -445,7 +445,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) TAILQ_INSERT_TAIL(&dyn->pfid_kif->pfik_dynaddrs, dyn, entry); aw->p.dyn = dyn; - pfi_kif_update(dyn->pfid_kif); + pfi_kkif_update(dyn->pfid_kif); return (0); @@ -455,19 +455,19 @@ _bad: if (ruleset != NULL) pf_remove_if_empty_kruleset(ruleset); if (dyn->pfid_kif != NULL) - pfi_kif_unref(dyn->pfid_kif); + pfi_kkif_unref(dyn->pfid_kif); free(dyn, PFI_MTYPE); return (rv); } static void -pfi_kif_update(struct pfi_kif *kif) +pfi_kkif_update(struct pfi_kkif *kif) { struct ifg_list *ifgl; struct ifg_member *ifgm; struct pfi_dynaddr *p; - struct pfi_kif *tmpkif; + struct pfi_kkif *tmpkif; PF_RULES_WASSERT(); @@ -479,7 +479,7 @@ pfi_kif_update(struct pfi_kif *kif) if (kif->pfik_group != NULL) { CK_STAILQ_FOREACH(ifgm, &kif->pfik_group->ifg_members, ifgm_next) { - tmpkif = (struct pfi_kif *)ifgm->ifgm_ifp->if_pf_kif; + tmpkif = (struct pfi_kkif *)ifgm->ifgm_ifp->if_pf_kif; if (tmpkif == NULL) continue; @@ -491,7 +491,7 @@ pfi_kif_update(struct pfi_kif *kif) if (kif->pfik_ifp != NULL) { IF_ADDR_RLOCK(kif->pfik_ifp); CK_STAILQ_FOREACH(ifgl, &kif->pfik_ifp->if_groups, ifgl_next) - pfi_kif_update((struct pfi_kif *) + pfi_kkif_update((struct pfi_kkif *) ifgl->ifgl_group->ifg_pf_kif); IF_ADDR_RUNLOCK(kif->pfik_ifp); } @@ -500,7 +500,7 @@ pfi_kif_update(struct pfi_kif *kif) static void pfi_dynaddr_update(struct pfi_dynaddr *dyn) { - struct pfi_kif *kif; + struct pfi_kkif *kif; struct pfr_ktable *kt; PF_RULES_WASSERT(); @@ -519,7 +519,7 @@ pfi_dynaddr_update(struct pfi_dynaddr *dyn) } static void -pfi_table_update(struct pfr_ktable *kt, struct pfi_kif *kif, int net, int flags) +pfi_table_update(struct pfr_ktable *kt, struct pfi_kkif *kif, int net, int flags) { int e, size2 = 0; struct ifg_member *ifgm; @@ -663,7 +663,7 @@ pfi_dynaddr_remove(struct pfi_dynaddr *dyn) KASSERT(dyn->pfid_kt != NULL, ("%s: null pfid_kt", __func__)); TAILQ_REMOVE(&dyn->pfid_kif->pfik_dynaddrs, dyn, entry); - pfi_kif_unref(dyn->pfid_kif); + pfi_kkif_unref(dyn->pfid_kif); pfr_detach_table(dyn->pfid_kt); free(dyn, PFI_MTYPE); } @@ -681,7 +681,7 @@ pfi_dynaddr_copyout(struct pf_addr_wrap *aw) } static int -pfi_if_compare(struct pfi_kif *p, struct pfi_kif *q) +pfi_kkif_compare(struct pfi_kkif *p, struct pfi_kkif *q) { return (strncmp(p->pfik_name, q->pfik_name, IFNAMSIZ)); } @@ -689,14 +689,14 @@ pfi_if_compare(struct pfi_kif *p, struct pfi_kif *q) void pfi_update_status(const char *name, struct pf_status *pfs) { - struct pfi_kif *p; + struct pfi_kkif *p; struct pfi_kif_cmp key; struct ifg_member p_member, *ifgm; CK_STAILQ_HEAD(, ifg_member) ifg_members; int i, j, k; strlcpy(key.pfik_name, name, sizeof(key.pfik_name)); - p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&key); + p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kkif *)&key); if (p == NULL) return; @@ -717,7 +717,7 @@ pfi_update_status(const char *name, struct pf_status *pfs) CK_STAILQ_FOREACH(ifgm, &ifg_members, ifgm_next) { if (ifgm->ifgm_ifp == NULL || ifgm->ifgm_ifp->if_pf_kif == NULL) continue; - p = (struct pfi_kif *)ifgm->ifgm_ifp->if_pf_kif; + p = (struct pfi_kkif *)ifgm->ifgm_ifp->if_pf_kif; /* just clear statistics */ if (pfs == NULL) { @@ -737,10 +737,30 @@ pfi_update_status(const char *name, struct pf_status *pfs) } } +static void +pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) +{ + + bzero(kif, sizeof(*kif)); + strlcpy(kif->pfik_name, kkif->pfik_name, sizeof(kif->pfik_name)); + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + kif->pfik_packets[i][j][k] = + kkif->pfik_packets[i][j][k]; + kif->pfik_bytes[i][j][k] = + kkif->pfik_bytes[i][j][k]; + } + } + } + kif->pfik_tzero = kkif->pfik_tzero; + kif->pfik_rulerefs = kkif->pfik_rulerefs; +} + void pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size) { - struct pfi_kif *p, *nextp; + struct pfi_kkif *p, *nextp; int n = 0; for (p = RB_MIN(pfi_ifhead, &V_pfi_ifs); p; p = nextp) { @@ -751,14 +771,14 @@ pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size) break; if (!p->pfik_tzero) p->pfik_tzero = time_second; - bcopy(p, buf++, sizeof(*buf)); + pf_kkif_to_kif(p, buf++); nextp = RB_NEXT(pfi_ifhead, &V_pfi_ifs, p); } *size = n; } static int -pfi_skip_if(const char *filter, struct pfi_kif *p) +pfi_skip_if(const char *filter, struct pfi_kkif *p) { struct ifg_list *i; int n; @@ -789,13 +809,13 @@ pfi_skip_if(const char *filter, struct pfi_kif *p) int pfi_set_flags(const char *name, int flags) { - struct pfi_kif *p, *kif; + struct pfi_kkif *p, *kif; kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT); if (kif == NULL) return (ENOMEM); - kif = pfi_kif_attach(kif, name); + kif = pfi_kkif_attach(kif, name); RB_FOREACH(p, pfi_ifhead, &V_pfi_ifs) { if (pfi_skip_if(name, p)) @@ -808,7 +828,7 @@ pfi_set_flags(const char *name, int flags) int pfi_clear_flags(const char *name, int flags) { - struct pfi_kif *p, *tmp; + struct pfi_kkif *p, *tmp; RB_FOREACH_SAFE(p, pfi_ifhead, &V_pfi_ifs, tmp) { if (pfi_skip_if(name, p)) @@ -864,7 +884,7 @@ pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp) static void pfi_detach_ifnet_event(void *arg __unused, struct ifnet *ifp) { - struct pfi_kif *kif = (struct pfi_kif *)ifp->if_pf_kif; + struct pfi_kkif *kif = (struct pfi_kkif *)ifp->if_pf_kif; if (pfsync_detach_ifnet_ptr) pfsync_detach_ifnet_ptr(ifp); @@ -879,7 +899,7 @@ pfi_detach_ifnet_event(void *arg __unused, struct ifnet *ifp) PF_RULES_WLOCK(); V_pfi_update++; - pfi_kif_update(kif); + pfi_kkif_update(kif); if (kif->pfik_ifp) *** 477 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2DDE4F86C8; Wed, 20 Jan 2021 14:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwy2n0Nz4r2V; Wed, 20 Jan 2021 14:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 179B41B1A4; Wed, 20 Jan 2021 14:45:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEj4s3019519; Wed, 20 Jan 2021 14:45:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEj48R019518; Wed, 20 Jan 2021 14:45:04 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:45:04 GMT Message-Id: <202101201445.10KEj48R019518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 34b94d9ebb2d - stable/12 - pfctl: Stop sharing pf_ruleset.c with the kernel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 34b94d9ebb2d6cb9e97eade82ea5b8ace28a937d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:06 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=34b94d9ebb2d6cb9e97eade82ea5b8ace28a937d commit 34b94d9ebb2d6cb9e97eade82ea5b8ace28a937d Author: Kristof Provost AuthorDate: 2020-12-24 15:02:04 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pfctl: Stop sharing pf_ruleset.c with the kernel Now that we've split up the datastructures used by the kernel and userspace there's essentually no more overlap between the pf_ruleset.c code used by userspace and kernelspace. Copy the userspace bits to the pfctl directory and stop using the kernel file. Reviewed by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27764 (cherry picked from commit fda7daf06301beef1bdad39891232a12c6925b22) --- sbin/pfctl/Makefile | 3 - sbin/pfctl/pf_ruleset.c | 343 ++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ruleset.c | 285 +----------------------------------- 3 files changed, 348 insertions(+), 283 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 8ca3b5d86285..14dc83eb97b0 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -2,9 +2,6 @@ .include -# pf_ruleset.c is shared between kernel and pfctl -.PATH: ${SRCTOP}/sys/netpfil/pf - PACKAGE=pf CONFS= pf.os PROG= pfctl diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c new file mode 100644 index 000000000000..7c337d7a2da7 --- /dev/null +++ b/sbin/pfctl/pf_ruleset.c @@ -0,0 +1,343 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2001 Daniel Hartmeier + * Copyright (c) 2002,2003 Henning Brauer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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. + * + * Effort sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F30602-01-2-0537. + * + * $OpenBSD: pf_ruleset.c,v 1.2 2008/12/18 15:31:37 dhill Exp $ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef INET6 +#include +#endif /* INET6 */ + +#include +#include +#include +#include +#include +#define rs_malloc(x) calloc(1, x) +#define rs_free(x) free(x) + +#ifdef PFDEBUG +#include +#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) +#else +#define DPFPRINTF(format, x...) ((void)0) +#endif /* PFDEBUG */ + +struct pf_anchor_global pf_anchors; +struct pf_anchor pf_main_anchor; +#undef V_pf_anchors +#define V_pf_anchors pf_anchors +#undef pf_main_ruleset +#define pf_main_ruleset pf_main_anchor.ruleset + +static __inline int pf_anchor_compare(struct pf_anchor *, + struct pf_anchor *); +static struct pf_anchor *pf_find_anchor(const char *); + +RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); +RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); + +static __inline int +pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) +{ + int c = strcmp(a->path, b->path); + + return (c ? (c < 0 ? -1 : 1) : 0); +} + +int +pf_get_ruleset_number(u_int8_t action) +{ + switch (action) { + case PF_SCRUB: + case PF_NOSCRUB: + return (PF_RULESET_SCRUB); + break; + case PF_PASS: + case PF_DROP: + return (PF_RULESET_FILTER); + break; + case PF_NAT: + case PF_NONAT: + return (PF_RULESET_NAT); + break; + case PF_BINAT: + case PF_NOBINAT: + return (PF_RULESET_BINAT); + break; + case PF_RDR: + case PF_NORDR: + return (PF_RULESET_RDR); + break; + default: + return (PF_RULESET_MAX); + break; + } +} + +void +pf_init_ruleset(struct pf_ruleset *ruleset) +{ + int i; + + memset(ruleset, 0, sizeof(struct pf_ruleset)); + for (i = 0; i < PF_RULESET_MAX; i++) { + TAILQ_INIT(&ruleset->rules[i].queues[0]); + TAILQ_INIT(&ruleset->rules[i].queues[1]); + ruleset->rules[i].active.ptr = &ruleset->rules[i].queues[0]; + ruleset->rules[i].inactive.ptr = &ruleset->rules[i].queues[1]; + } +} + +static struct pf_anchor * +pf_find_anchor(const char *path) +{ + struct pf_anchor *key, *found; + + key = (struct pf_anchor *)rs_malloc(sizeof(*key)); + if (key == NULL) + return (NULL); + strlcpy(key->path, path, sizeof(key->path)); + found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); + rs_free(key); + return (found); +} + +struct pf_ruleset * +pf_find_ruleset(const char *path) +{ + struct pf_anchor *anchor; + + while (*path == '/') + path++; + if (!*path) + return (&pf_main_ruleset); + anchor = pf_find_anchor(path); + if (anchor == NULL) + return (NULL); + else + return (&anchor->ruleset); +} + +struct pf_ruleset * +pf_find_or_create_ruleset(const char *path) +{ + char *p, *q, *r; + struct pf_ruleset *ruleset; + struct pf_anchor *anchor = NULL, *dup, *parent = NULL; + + if (path[0] == 0) + return (&pf_main_ruleset); + while (*path == '/') + path++; + ruleset = pf_find_ruleset(path); + if (ruleset != NULL) + return (ruleset); + p = (char *)rs_malloc(MAXPATHLEN); + if (p == NULL) + return (NULL); + strlcpy(p, path, MAXPATHLEN); + while (parent == NULL && (q = strrchr(p, '/')) != NULL) { + *q = 0; + if ((ruleset = pf_find_ruleset(p)) != NULL) { + parent = ruleset->anchor; + break; + } + } + if (q == NULL) + q = p; + else + q++; + strlcpy(p, path, MAXPATHLEN); + if (!*q) { + rs_free(p); + return (NULL); + } + while ((r = strchr(q, '/')) != NULL || *q) { + if (r != NULL) + *r = 0; + if (!*q || strlen(q) >= PF_ANCHOR_NAME_SIZE || + (parent != NULL && strlen(parent->path) >= + MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1)) { + rs_free(p); + return (NULL); + } + anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); + if (anchor == NULL) { + rs_free(p); + return (NULL); + } + RB_INIT(&anchor->children); + strlcpy(anchor->name, q, sizeof(anchor->name)); + if (parent != NULL) { + strlcpy(anchor->path, parent->path, + sizeof(anchor->path)); + strlcat(anchor->path, "/", sizeof(anchor->path)); + } + strlcat(anchor->path, anchor->name, sizeof(anchor->path)); + if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != + NULL) { + printf("pf_find_or_create_ruleset: RB_INSERT1 " + "'%s' '%s' collides with '%s' '%s'\n", + anchor->path, anchor->name, dup->path, dup->name); + rs_free(anchor); + rs_free(p); + return (NULL); + } + if (parent != NULL) { + anchor->parent = parent; + if ((dup = RB_INSERT(pf_anchor_node, &parent->children, + anchor)) != NULL) { + printf("pf_find_or_create_ruleset: " + "RB_INSERT2 '%s' '%s' collides with " + "'%s' '%s'\n", anchor->path, anchor->name, + dup->path, dup->name); + RB_REMOVE(pf_anchor_global, &V_pf_anchors, + anchor); + rs_free(anchor); + rs_free(p); + return (NULL); + } + } + pf_init_ruleset(&anchor->ruleset); + anchor->ruleset.anchor = anchor; + parent = anchor; + if (r != NULL) + q = r + 1; + else + *q = 0; + } + rs_free(p); + return (&anchor->ruleset); +} + +void +pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) +{ + struct pf_anchor *parent; + int i; + + while (ruleset != NULL) { + if (ruleset == &pf_main_ruleset || ruleset->anchor == NULL || + !RB_EMPTY(&ruleset->anchor->children) || + ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || + ruleset->topen) + return; + for (i = 0; i < PF_RULESET_MAX; ++i) + if (!TAILQ_EMPTY(ruleset->rules[i].active.ptr) || + !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || + ruleset->rules[i].inactive.open) + return; + RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); + if ((parent = ruleset->anchor->parent) != NULL) + RB_REMOVE(pf_anchor_node, &parent->children, + ruleset->anchor); + rs_free(ruleset->anchor); + if (parent == NULL) + return; + ruleset = &parent->ruleset; + } +} +int +pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, + const char *name) +{ + char *p, *path; + struct pf_ruleset *ruleset; + + r->anchor = NULL; + r->anchor_relative = 0; + r->anchor_wildcard = 0; + if (!name[0]) + return (0); + path = (char *)rs_malloc(MAXPATHLEN); + if (path == NULL) + return (1); + if (name[0] == '/') + strlcpy(path, name + 1, MAXPATHLEN); + else { + /* relative path */ + r->anchor_relative = 1; + if (s->anchor == NULL || !s->anchor->path[0]) + path[0] = 0; + else + strlcpy(path, s->anchor->path, MAXPATHLEN); + while (name[0] == '.' && name[1] == '.' && name[2] == '/') { + if (!path[0]) { + printf("pf_anchor_setup: .. beyond root\n"); + rs_free(path); + return (1); + } + if ((p = strrchr(path, '/')) != NULL) + *p = 0; + else + path[0] = 0; + r->anchor_relative++; + name += 3; + } + if (path[0]) + strlcat(path, "/", MAXPATHLEN); + strlcat(path, name, MAXPATHLEN); + } + if ((p = strrchr(path, '/')) != NULL && !strcmp(p, "/*")) { + r->anchor_wildcard = 1; + *p = 0; + } + ruleset = pf_find_or_create_ruleset(path); + rs_free(path); + if (ruleset == NULL || ruleset->anchor == NULL) { + printf("pf_anchor_setup: ruleset\n"); + return (1); + } + r->anchor = ruleset->anchor; + r->anchor->refcnt++; + return (0); +} diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 9c697034649f..31a4ed879937 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef _KERNEL -# include -# include -#endif /* _KERNEL */ +#include +#include #include #include @@ -60,72 +58,26 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ +#ifndef _KERNEL +#error "Kernel only file. Please use sbin/pfctl/pf_ruleset.c instead." +#endif -#ifdef _KERNEL #define DPFPRINTF(format, x...) \ if (V_pf_status.debug >= PF_DEBUG_NOISY) \ printf(format , ##x) #define rs_malloc(x) malloc(x, M_TEMP, M_NOWAIT|M_ZERO) #define rs_free(x) free(x, M_TEMP) -#else -/* Userland equivalents so we can lend code to pfctl et al. */ - -#include -#include -#include -#include -#include -#define rs_malloc(x) calloc(1, x) -#define rs_free(x) free(x) - -#ifdef PFDEBUG -#include -#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) -#else -#define DPFPRINTF(format, x...) ((void)0) -#endif /* PFDEBUG */ -#endif /* _KERNEL */ - -#ifdef _KERNEL VNET_DEFINE(struct pf_kanchor_global, pf_anchors); VNET_DEFINE(struct pf_kanchor, pf_main_anchor); -#else /* ! _KERNEL */ -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; -#undef V_pf_anchors -#define V_pf_anchors pf_anchors -#undef pf_main_ruleset -#define pf_main_ruleset pf_main_anchor.ruleset -#endif /* _KERNEL */ - -#ifdef _KERNEL static __inline int pf_kanchor_compare(struct pf_kanchor *, struct pf_kanchor *); static struct pf_kanchor *pf_find_kanchor(const char *); RB_GENERATE(pf_kanchor_global, pf_kanchor, entry_global, pf_kanchor_compare); RB_GENERATE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); -#else -static __inline int pf_anchor_compare(struct pf_anchor *, - struct pf_anchor *); -static struct pf_anchor *pf_find_anchor(const char *); - -RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); -#endif - -#ifndef _KERNEL -static __inline int -pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) -{ - int c = strcmp(a->path, b->path); - - return (c ? (c < 0 ? -1 : 1) : 0); -} -#else static __inline int pf_kanchor_compare(struct pf_kanchor *a, struct pf_kanchor *b) { @@ -133,7 +85,6 @@ pf_kanchor_compare(struct pf_kanchor *a, struct pf_kanchor *b) return (c ? (c < 0 ? -1 : 1) : 0); } -#endif int pf_get_ruleset_number(u_int8_t action) @@ -165,35 +116,6 @@ pf_get_ruleset_number(u_int8_t action) } } -#ifndef _KERNEL -void -pf_init_ruleset(struct pf_ruleset *ruleset) -{ - int i; - - memset(ruleset, 0, sizeof(struct pf_ruleset)); - for (i = 0; i < PF_RULESET_MAX; i++) { - TAILQ_INIT(&ruleset->rules[i].queues[0]); - TAILQ_INIT(&ruleset->rules[i].queues[1]); - ruleset->rules[i].active.ptr = &ruleset->rules[i].queues[0]; - ruleset->rules[i].inactive.ptr = &ruleset->rules[i].queues[1]; - } -} - -static struct pf_anchor * -pf_find_anchor(const char *path) -{ - struct pf_anchor *key, *found; - - key = (struct pf_anchor *)rs_malloc(sizeof(*key)); - if (key == NULL) - return (NULL); - strlcpy(key->path, path, sizeof(key->path)); - found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); - rs_free(key); - return (found); -} -#else static struct pf_kanchor * pf_find_kanchor(const char *path) { @@ -221,10 +143,7 @@ pf_init_kruleset(struct pf_kruleset *ruleset) ruleset->rules[i].inactive.ptr = &ruleset->rules[i].queues[1]; } } -#endif - -#ifdef _KERNEL struct pf_kruleset * pf_find_kruleset(const char *path) { @@ -477,197 +396,3 @@ pf_kanchor_remove(struct pf_krule *r) pf_remove_if_empty_kruleset(&r->anchor->ruleset); r->anchor = NULL; } - -#else - -struct pf_ruleset * -pf_find_ruleset(const char *path) -{ - struct pf_anchor *anchor; - - while (*path == '/') - path++; - if (!*path) - return (&pf_main_ruleset); - anchor = pf_find_anchor(path); - if (anchor == NULL) - return (NULL); - else - return (&anchor->ruleset); -} - -struct pf_ruleset * -pf_find_or_create_ruleset(const char *path) -{ - char *p, *q, *r; - struct pf_ruleset *ruleset; - struct pf_anchor *anchor = NULL, *dup, *parent = NULL; - - if (path[0] == 0) - return (&pf_main_ruleset); - while (*path == '/') - path++; - ruleset = pf_find_ruleset(path); - if (ruleset != NULL) - return (ruleset); - p = (char *)rs_malloc(MAXPATHLEN); - if (p == NULL) - return (NULL); - strlcpy(p, path, MAXPATHLEN); - while (parent == NULL && (q = strrchr(p, '/')) != NULL) { - *q = 0; - if ((ruleset = pf_find_ruleset(p)) != NULL) { - parent = ruleset->anchor; - break; - } - } - if (q == NULL) - q = p; - else - q++; - strlcpy(p, path, MAXPATHLEN); - if (!*q) { - rs_free(p); - return (NULL); - } - while ((r = strchr(q, '/')) != NULL || *q) { - if (r != NULL) - *r = 0; - if (!*q || strlen(q) >= PF_ANCHOR_NAME_SIZE || - (parent != NULL && strlen(parent->path) >= - MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1)) { - rs_free(p); - return (NULL); - } - anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); - if (anchor == NULL) { - rs_free(p); - return (NULL); - } - RB_INIT(&anchor->children); - strlcpy(anchor->name, q, sizeof(anchor->name)); - if (parent != NULL) { - strlcpy(anchor->path, parent->path, - sizeof(anchor->path)); - strlcat(anchor->path, "/", sizeof(anchor->path)); - } - strlcat(anchor->path, anchor->name, sizeof(anchor->path)); - if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != - NULL) { - printf("pf_find_or_create_ruleset: RB_INSERT1 " - "'%s' '%s' collides with '%s' '%s'\n", - anchor->path, anchor->name, dup->path, dup->name); - rs_free(anchor); - rs_free(p); - return (NULL); - } - if (parent != NULL) { - anchor->parent = parent; - if ((dup = RB_INSERT(pf_anchor_node, &parent->children, - anchor)) != NULL) { - printf("pf_find_or_create_ruleset: " - "RB_INSERT2 '%s' '%s' collides with " - "'%s' '%s'\n", anchor->path, anchor->name, - dup->path, dup->name); - RB_REMOVE(pf_anchor_global, &V_pf_anchors, - anchor); - rs_free(anchor); - rs_free(p); - return (NULL); - } - } - pf_init_ruleset(&anchor->ruleset); - anchor->ruleset.anchor = anchor; - parent = anchor; - if (r != NULL) - q = r + 1; - else - *q = 0; - } - rs_free(p); - return (&anchor->ruleset); -} - -void -pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) -{ - struct pf_anchor *parent; - int i; - - while (ruleset != NULL) { - if (ruleset == &pf_main_ruleset || ruleset->anchor == NULL || - !RB_EMPTY(&ruleset->anchor->children) || - ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || - ruleset->topen) - return; - for (i = 0; i < PF_RULESET_MAX; ++i) - if (!TAILQ_EMPTY(ruleset->rules[i].active.ptr) || - !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || - ruleset->rules[i].inactive.open) - return; - RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); - if ((parent = ruleset->anchor->parent) != NULL) - RB_REMOVE(pf_anchor_node, &parent->children, - ruleset->anchor); - rs_free(ruleset->anchor); - if (parent == NULL) - return; - ruleset = &parent->ruleset; - } -} -int -pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, - const char *name) -{ - char *p, *path; - struct pf_ruleset *ruleset; - - r->anchor = NULL; - r->anchor_relative = 0; - r->anchor_wildcard = 0; - if (!name[0]) - return (0); - path = (char *)rs_malloc(MAXPATHLEN); - if (path == NULL) - return (1); - if (name[0] == '/') - strlcpy(path, name + 1, MAXPATHLEN); - else { - /* relative path */ - r->anchor_relative = 1; - if (s->anchor == NULL || !s->anchor->path[0]) - path[0] = 0; - else - strlcpy(path, s->anchor->path, MAXPATHLEN); - while (name[0] == '.' && name[1] == '.' && name[2] == '/') { - if (!path[0]) { - printf("pf_anchor_setup: .. beyond root\n"); - rs_free(path); - return (1); - } - if ((p = strrchr(path, '/')) != NULL) - *p = 0; - else - path[0] = 0; - r->anchor_relative++; - name += 3; - } - if (path[0]) - strlcat(path, "/", MAXPATHLEN); - strlcat(path, name, MAXPATHLEN); - } - if ((p = strrchr(path, '/')) != NULL && !strcmp(p, "/*")) { - r->anchor_wildcard = 1; - *p = 0; - } - ruleset = pf_find_or_create_ruleset(path); - rs_free(path); - if (ruleset == NULL || ruleset->anchor == NULL) { - printf("pf_anchor_setup: ruleset\n"); - return (1); - } - r->anchor = ruleset->anchor; - r->anchor->refcnt++; - return (0); -} -#endif From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4D224F8B0C; Wed, 20 Jan 2021 14:45:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSws5lwrz4qyq; Wed, 20 Jan 2021 14:45:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABD191AFDA; Wed, 20 Jan 2021 14:44:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEixec019428; Wed, 20 Jan 2021 14:44:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEixAe019427; Wed, 20 Jan 2021 14:44:59 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:44:59 GMT Message-Id: <202101201444.10KEixAe019427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 14d531ad3f58 - stable/12 - pf: Change pf_krule counters to use counter_u64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 14d531ad3f5880a375c0cab50ff8cc238099c4d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=14d531ad3f5880a375c0cab50ff8cc238099c4d6 commit 14d531ad3f5880a375c0cab50ff8cc238099c4d6 Author: Kristof Provost AuthorDate: 2020-12-05 20:41:42 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pf: Change pf_krule counters to use counter_u64 This improves the cache behaviour of pf and results in improved throughput. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27760 (cherry picked from commit c3adacdad4d72b045058cd932351b94579cdd543) --- sys/net/pfvar.h | 6 ++--- sys/netpfil/pf/pf.c | 32 ++++++++++++---------- sys/netpfil/pf/pf_ioctl.c | 69 +++++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_lb.c | 2 +- sys/netpfil/pf/pf_norm.c | 18 ++++++------- 5 files changed, 86 insertions(+), 41 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5b77b0a6c4e2..636ea8c5e02c 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -315,9 +315,9 @@ struct pf_krule { TAILQ_ENTRY(pf_krule) entries; struct pf_pool rpool; - u_int64_t evaluations; - u_int64_t packets[2]; - u_int64_t bytes[2]; + counter_u64_t evaluations; + counter_u64_t packets[2]; + counter_u64_t bytes[2]; struct pfi_kif *kif; struct pf_kanchor *anchor; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 85a6b27d7139..c2cc2ba55196 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3538,7 +3538,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, } while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) @@ -3977,7 +3977,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_FILTER].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) @@ -6334,16 +6334,18 @@ done: if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); - r->packets[dirndx]++; - r->bytes[dirndx] += pd.tot_len; + counter_u64_add(r->packets[dirndx], 1); + counter_u64_add(r->bytes[dirndx], pd.tot_len); if (a != NULL) { - a->packets[dirndx]++; - a->bytes[dirndx] += pd.tot_len; + counter_u64_add(a->packets[dirndx], 1); + counter_u64_add(a->bytes[dirndx], pd.tot_len); } if (s != NULL) { if (s->nat_rule.ptr != NULL) { - s->nat_rule.ptr->packets[dirndx]++; - s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_rule.ptr->packets[dirndx], + 1); + counter_u64_add(s->nat_rule.ptr->bytes[dirndx], + pd.tot_len); } if (s->src_node != NULL) { counter_u64_add(s->src_node->packets[dirndx], @@ -6737,16 +6739,18 @@ done: if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); - r->packets[dirndx]++; - r->bytes[dirndx] += pd.tot_len; + counter_u64_add(r->packets[dirndx], 1); + counter_u64_add(r->bytes[dirndx], pd.tot_len); if (a != NULL) { - a->packets[dirndx]++; - a->bytes[dirndx] += pd.tot_len; + counter_u64_add(a->packets[dirndx], 1); + counter_u64_add(a->bytes[dirndx], pd.tot_len); } if (s != NULL) { if (s->nat_rule.ptr != NULL) { - s->nat_rule.ptr->packets[dirndx]++; - s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_rule.ptr->packets[dirndx], + 1); + counter_u64_add(s->nat_rule.ptr->bytes[dirndx], + pd.tot_len); } if (s->src_node != NULL) { counter_u64_add(s->src_node->packets[dirndx], diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e928c65734a7..c6d4a163fd45 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -283,6 +283,11 @@ pfattach_vnet(void) V_pf_default_rule.nr = -1; V_pf_default_rule.rtableid = -1; + V_pf_default_rule.evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + V_pf_default_rule.packets[i] = counter_u64_alloc(M_WAITOK); + V_pf_default_rule.bytes[i] = counter_u64_alloc(M_WAITOK); + } V_pf_default_rule.states_cur = counter_u64_alloc(M_WAITOK); V_pf_default_rule.states_tot = counter_u64_alloc(M_WAITOK); V_pf_default_rule.src_nodes = counter_u64_alloc(M_WAITOK); @@ -462,6 +467,11 @@ pf_free_rule(struct pf_krule *rule) pfi_kif_unref(rule->kif); pf_kanchor_remove(rule); pf_empty_pool(&rule->rpool.list); + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } counter_u64_free(rule->states_cur); counter_u64_free(rule->states_tot); counter_u64_free(rule->src_nodes); @@ -1455,10 +1465,10 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) bcopy(&krule->rpool, &rule->rpool, sizeof(krule->rpool)); - rule->evaluations = krule->evaluations; + rule->evaluations = counter_u64_fetch(krule->evaluations); for (int i = 0; i < 2; i++) { - rule->packets[i] = krule->packets[i]; - rule->bytes[i] = krule->bytes[i]; + rule->packets[i] = counter_u64_fetch(krule->packets[i]); + rule->bytes[i] = counter_u64_fetch(krule->bytes[i]); } /* kif, anchor, overload_tbl are not copied over. */ @@ -1810,6 +1820,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td if (rule->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + rule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + rule->packets[i] = counter_u64_alloc(M_WAITOK); + rule->bytes[i] = counter_u64_alloc(M_WAITOK); + } rule->states_cur = counter_u64_alloc(M_WAITOK); rule->states_tot = counter_u64_alloc(M_WAITOK); rule->src_nodes = counter_u64_alloc(M_WAITOK); @@ -1923,8 +1938,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td } rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); - rule->evaluations = rule->packets[0] = rule->packets[1] = - rule->bytes[0] = rule->bytes[1] = 0; + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, rule, entries); ruleset->rules[rs_num].inactive.rcount++; @@ -1934,6 +1952,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td #undef ERROUT DIOCADDRULE_error: PF_RULES_WUNLOCK(); + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } counter_u64_free(rule->states_cur); counter_u64_free(rule->states_tot); counter_u64_free(rule->src_nodes); @@ -2019,9 +2042,11 @@ DIOCADDRULE_error: pf_addr_copyout(&pr->rule.dst.addr); if (pr->action == PF_GET_CLR_CNTR) { - rule->evaluations = 0; - rule->packets[0] = rule->packets[1] = 0; - rule->bytes[0] = rule->bytes[1] = 0; + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } counter_u64_zero(rule->states_tot); } PF_RULES_WUNLOCK(); @@ -2065,6 +2090,13 @@ DIOCADDRULE_error: if (newrule->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + newrule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + newrule->packets[i] = + counter_u64_alloc(M_WAITOK); + newrule->bytes[i] = + counter_u64_alloc(M_WAITOK); + } newrule->states_cur = counter_u64_alloc(M_WAITOK); newrule->states_tot = counter_u64_alloc(M_WAITOK); newrule->src_nodes = counter_u64_alloc(M_WAITOK); @@ -2178,9 +2210,6 @@ DIOCADDRULE_error: } newrule->rpool.cur = TAILQ_FIRST(&newrule->rpool.list); - newrule->evaluations = 0; - newrule->packets[0] = newrule->packets[1] = 0; - newrule->bytes[0] = newrule->bytes[1] = 0; } pf_empty_pool(&V_pf_pabuf); @@ -2240,6 +2269,11 @@ DIOCADDRULE_error: DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); if (newrule != NULL) { + counter_u64_free(newrule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(newrule->packets[i]); + counter_u64_free(newrule->bytes[i]); + } counter_u64_free(newrule->states_cur); counter_u64_free(newrule->states_tot); counter_u64_free(newrule->src_nodes); @@ -2626,9 +2660,11 @@ DIOCGETSTATES_full: PF_RULES_WLOCK(); TAILQ_FOREACH(rule, ruleset->rules[PF_RULESET_FILTER].active.ptr, entries) { - rule->evaluations = 0; - rule->packets[0] = rule->packets[1] = 0; - rule->bytes[0] = rule->bytes[1] = 0; + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } } PF_RULES_WUNLOCK(); break; @@ -4643,6 +4679,11 @@ pf_unload_vnet(void) uma_zdestroy(V_pf_tag_z); /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(V_pf_default_rule.packets[i]); + counter_u64_free(V_pf_default_rule.bytes[i]); + } counter_u64_free(V_pf_default_rule.states_cur); counter_u64_free(V_pf_default_rule.states_tot); counter_u64_free(V_pf_default_rule.src_nodes); diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index d2bdbb6d971c..ff115f64b365 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -149,7 +149,7 @@ pf_match_translation(struct pf_pdesc *pd, struct mbuf *m, int off, dst = &r->dst; } - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 456e5184d5a5..d1a8ef37d030 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -839,7 +839,7 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != dir) @@ -866,8 +866,8 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, if (r == NULL || r->action == PF_NOSCRUB) return (PF_PASS); else { - r->packets[dir == PF_OUT]++; - r->bytes[dir == PF_OUT] += pd->tot_len; + counter_u64_add(r->packets[dir == PF_OUT], 1); + counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len); } /* Check for illegal packets */ @@ -983,7 +983,7 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != dir) @@ -1009,8 +1009,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif, if (r == NULL || r->action == PF_NOSCRUB) return (PF_PASS); else { - r->packets[dir == PF_OUT]++; - r->bytes[dir == PF_OUT] += pd->tot_len; + counter_u64_add(r->packets[dir == PF_OUT], 1); + counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len); } /* Check for illegal packets */ @@ -1161,7 +1161,7 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != dir) @@ -1195,8 +1195,8 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff, if (rm == NULL || rm->action == PF_NOSCRUB) return (PF_PASS); else { - r->packets[dir == PF_OUT]++; - r->bytes[dir == PF_OUT] += pd->tot_len; + counter_u64_add(r->packets[dir == PF_OUT], 1); + counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len); } if (rm->rule_flag & PFRULE_REASSEMBLE_TCP) From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C75E54F894B; Wed, 20 Jan 2021 14:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSx12qZwz4r5f; Wed, 20 Jan 2021 14:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46D3A1B308; Wed, 20 Jan 2021 14:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEj5k8019540; Wed, 20 Jan 2021 14:45:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEj5Zr019539; Wed, 20 Jan 2021 14:45:05 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:45:05 GMT Message-Id: <202101201445.10KEj5Zr019539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4046f57601ea - stable/12 - pfctl: Fix NOCLEAN build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4046f57601eaa0bcd1ec8496e1280939b948aa46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:10 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4046f57601eaa0bcd1ec8496e1280939b948aa46 commit 4046f57601eaa0bcd1ec8496e1280939b948aa46 Author: Kristof Provost AuthorDate: 2021-01-19 12:48:31 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pfctl: Fix NOCLEAN build We've created a new pf_ruleset.c file for pfctl and no longer use the kernel vrsion, but the build system doesn't handle this dependency change correctly. Delete the dependency file if it contains the kernel version of the file. (modified from commit c38e59ce1b0a6c030a942d0814d581dbd7f67e3c) --- Makefile.inc1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 5f7462260240..ca842d182af2 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1001,6 +1001,15 @@ _cleanobj_fast_depend_hack: .PHONY ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libomp/.depend.${f}.*}; \ fi .endfor +# 20201224 2afa221f694 Stop sharing pf_ruleset.c with the kernel +.for f in pf_ruleset + @if [ -e "${OBJTOP}"/sbin/pfctl/.depend.${f}.o ] && \ + egrep -qw "sys/netpfil/pf/${f}.c" \ + "${OBJTOP}"/sbin/pfctl/.depend.${f}.o; then + echo "Removing old ${f} dependency file" + rm -rf "${OBJTOP}"/sbin/pfctl/.depend.${f}.o + fi +.endfor _worldtmp: .PHONY @echo From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C08F84F895F; Wed, 20 Jan 2021 14:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSx358Hvz4r5l; Wed, 20 Jan 2021 14:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DDE71B0BD; Wed, 20 Jan 2021 14:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEj6Pm019559; Wed, 20 Jan 2021 14:45:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEj66k019558; Wed, 20 Jan 2021 14:45:06 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:45:06 GMT Message-Id: <202101201445.10KEj66k019558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6d3ebc9bfcd8 - stable/12 - pf: Copy kif flags to userspace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6d3ebc9bfcd814be6526237ee28f46228ac6c292 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:12 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3ebc9bfcd814be6526237ee28f46228ac6c292 commit 6d3ebc9bfcd814be6526237ee28f46228ac6c292 Author: Kristof Provost AuthorDate: 2021-01-07 21:24:38 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pf: Copy kif flags to userspace This was overlooked in the pfi_kkif/pfi_kif splitup and as a result userspace could no longer tell which interfaces had the skip flag applied. MFC after: 2 weeks (cherry picked from commit 0fcb03fbaca1307175edc96355c867471db309f8) --- sys/netpfil/pf/pf_if.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 9ca404174cca..48733d351a24 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -815,6 +815,7 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) } } } + kif->pfik_flags = kkif->pfik_flags; kif->pfik_tzero = kkif->pfik_tzero; kif->pfik_rulerefs = kkif->pfik_rulerefs; } From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EA954F8A11; Wed, 20 Jan 2021 14:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwx5fpPz4r5M; Wed, 20 Jan 2021 14:45:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E63B91AE57; Wed, 20 Jan 2021 14:45:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEj10j019476; Wed, 20 Jan 2021 14:45:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEj1OL019475; Wed, 20 Jan 2021 14:45:01 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:45:01 GMT Message-Id: <202101201445.10KEj1OL019475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ce26f0988baf - stable/12 - pf: Allocate and free pfi_kkif in separate functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ce26f0988baff60505bfd4eba006abe25ee722bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:06 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ce26f0988baff60505bfd4eba006abe25ee722bf commit ce26f0988baff60505bfd4eba006abe25ee722bf Author: Kristof Provost AuthorDate: 2020-12-13 10:36:54 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pf: Allocate and free pfi_kkif in separate functions Factor out allocating and freeing pfi_kkif structures. This will be useful when we change the counters to be counter_u64, so we don't have to deal with that complexity in the multiple locations where we allocate pfi_kkif structures. No functional change. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27762 (cherry picked from commit 26c841e2a402ed43896313d1b3f00facaa9d839f) --- sys/net/pfvar.h | 3 +++ sys/netpfil/pf/pf_if.c | 37 ++++++++++++++++++++++++++++--------- sys/netpfil/pf/pf_ioctl.c | 16 ++++++++-------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index a58da4e4cc46..a28483fa9814 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1663,6 +1663,9 @@ struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *, struct pf_state_key *pf_state_key_setup(struct pf_pdesc *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t); struct pf_state_key *pf_state_key_clone(struct pf_state_key *); + +struct pfi_kkif *pf_kkif_create(int); +void pf_kkif_free(struct pfi_kkif *); #endif /* _KERNEL */ #endif /* _NET_PFVAR_H_ */ diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index a0148395340f..3230a3e424f6 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -122,7 +122,7 @@ pfi_initialize_vnet(void) V_pfi_buffer = malloc(V_pfi_buffer_max * sizeof(*V_pfi_buffer), PFI_MTYPE, M_WAITOK); - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); V_pfi_all = pfi_kkif_attach(kif, IFG_ALL); PF_RULES_WUNLOCK(); @@ -169,13 +169,13 @@ pfi_cleanup_vnet(void) if_rele(kif->pfik_ifp); kif->pfik_ifp->if_pf_kif = NULL; } - free(kif, PFI_MTYPE); + pf_kkif_free(kif); } mtx_lock(&pfi_unlnkdkifs_mtx); while ((kif = LIST_FIRST(&V_pfi_unlinked_kifs))) { LIST_REMOVE(kif, pfik_list); - free(kif, PFI_MTYPE); + pf_kkif_free(kif); } mtx_unlock(&pfi_unlnkdkifs_mtx); @@ -194,6 +194,25 @@ pfi_cleanup(void) EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); } +struct pfi_kkif* +pf_kkif_create(int flags) +{ + struct pfi_kkif *kif; + + kif = malloc(sizeof(*kif), PFI_MTYPE, flags); + + return (kif); +} + +void +pf_kkif_free(struct pfi_kkif *kif) +{ + if (! kif) + return; + + free(kif, PFI_MTYPE); +} + struct pfi_kkif * pfi_kkif_find(const char *kif_name) { @@ -217,7 +236,7 @@ pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name) kif1 = pfi_kkif_find(kif_name); if (kif1 != NULL) { - free(kif, PFI_MTYPE); + pf_kkif_free(kif); return (kif1); } @@ -286,7 +305,7 @@ pfi_kkif_purge(void) LIST_FOREACH_SAFE(kif, &V_pfi_unlinked_kifs, pfik_list, kif1) { if (!(kif->pfik_flags & PFI_IFLAG_REFS)) { LIST_REMOVE(kif, pfik_list); - free(kif, PFI_MTYPE); + pf_kkif_free(kif); } else kif->pfik_flags &= ~PFI_IFLAG_REFS; } @@ -403,7 +422,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) if ((dyn = malloc(sizeof(*dyn), PFI_MTYPE, M_NOWAIT | M_ZERO)) == NULL) return (ENOMEM); - if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT)) == NULL) { + if ((kif = pf_kkif_create(M_NOWAIT)) == NULL) { free(dyn, PFI_MTYPE); return (ENOMEM); } @@ -811,7 +830,7 @@ pfi_set_flags(const char *name, int flags) { struct pfi_kkif *p, *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT); + kif = pf_kkif_create(M_NOWAIT); if (kif == NULL) return (ENOMEM); @@ -839,7 +858,7 @@ pfi_clear_flags(const char *name, int flags) p->pfik_flags == 0 && p->pfik_rulerefs == 0) { /* Delete this kif. */ RB_REMOVE(pfi_ifhead, &V_pfi_ifs, p); - free(p, PFI_MTYPE); + pf_kkif_free(p); } } return (0); @@ -933,7 +952,7 @@ pfi_change_group_event(void *arg __unused, char *gname) return; } - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); V_pfi_update++; kif = pfi_kkif_attach(kif, gname); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index f152202c2515..866c4ebfaa3d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1838,7 +1838,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td pf_rule_to_krule(&pr->rule, rule); if (rule->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); rule->evaluations = counter_u64_alloc(M_WAITOK); for (int i = 0; i < 2; i++) { rule->packets[i] = counter_u64_alloc(M_WAITOK); @@ -1981,7 +1981,7 @@ DIOCADDRULE_error: counter_u64_free(rule->src_nodes); free(rule, M_PFRULE); if (kif) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); break; } @@ -2108,7 +2108,7 @@ DIOCADDRULE_error: pf_rule_to_krule(&pcr->rule, newrule); if (newrule->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); newrule->evaluations = counter_u64_alloc(M_WAITOK); for (int i = 0; i < 2; i++) { newrule->packets[i] = @@ -2299,7 +2299,7 @@ DIOCCHANGERULE_error: free(newrule, M_PFRULE); } if (kif != NULL) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); break; } @@ -2936,12 +2936,12 @@ DIOCGETSTATES_full: pa = malloc(sizeof(*pa), M_PFRULE, M_WAITOK); pf_pooladdr_to_kpooladdr(&pp->addr, pa); if (pa->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); if (pp->ticket != V_ticket_pabuf) { PF_RULES_WUNLOCK(); if (pa->ifname[0]) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); free(pa, M_PFRULE); error = EBUSY; break; @@ -3053,7 +3053,7 @@ DIOCGETSTATES_full: newpa = malloc(sizeof(*newpa), M_PFRULE, M_WAITOK); bcopy(&pca->addr, newpa, sizeof(struct pf_pooladdr)); if (newpa->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); newpa->kif = NULL; } @@ -3145,7 +3145,7 @@ DIOCCHANGEADDR_error: } PF_RULES_WUNLOCK(); if (kif != NULL) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); break; } From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 14:45:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C924F4F8B86; Wed, 20 Jan 2021 14:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSwy1st1z4qws; Wed, 20 Jan 2021 14:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BE0E1AFDC; Wed, 20 Jan 2021 14:45:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEj2oS019496; Wed, 20 Jan 2021 14:45:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEj2E5019495; Wed, 20 Jan 2021 14:45:02 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:45:02 GMT Message-Id: <202101201445.10KEj2E5019495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: efd9d47d0b35 - stable/12 - pf: Convert pfi_kkif to use counter_u64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: efd9d47d0b358c829bfc12fda2cc5826e73e5974 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:45:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=efd9d47d0b358c829bfc12fda2cc5826e73e5974 commit efd9d47d0b358c829bfc12fda2cc5826e73e5974 Author: Kristof Provost AuthorDate: 2020-12-13 16:20:02 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:16:05 +0000 pf: Convert pfi_kkif to use counter_u64 Improve caching behaviour by using counter_u64 rather than variables shared between cores. The result of converting all counters to counter(9) (i.e. this full patch series) is a significant improvement in throughput. As tested by olivier@, on Intel Xeon E5-2697Av4 (16Cores, 32 threads) hardware with Mellanox ConnectX-4 MCX416A-CCAT (100GBase-SR4) nics we see: x FreeBSD 20201223: inet packets-per-second + FreeBSD 20201223 with pf patches: inet packets-per-second +--------------------------------------------------------------------------+ | + | | xx + | |xxx +++| ||A| | | |A|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 5 9216962 9526356 9343902 9371057.6 116720.36 + 5 19427190 19698400 19502922 19546509 109084.92 Difference at 95.0% confidence 1.01755e+07 +/- 164756 108.584% +/- 2.9359% (Student's t, pooled s = 112967) Reviewed by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27763 (cherry picked from commit 5a3b9507d784aaa6a7ce35432b2111a7eec12cba) --- sys/net/pfvar.h | 5 ++-- sys/netpfil/pf/pf.c | 12 ++++++---- sys/netpfil/pf/pf_if.c | 65 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index a28483fa9814..dcc5bf51fdf6 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -879,8 +879,8 @@ struct pfi_kkif { } _pfik_glue; #define pfik_tree _pfik_glue._pfik_tree #define pfik_list _pfik_glue._pfik_list - u_int64_t pfik_packets[2][2][2]; - u_int64_t pfik_bytes[2][2][2]; + counter_u64_t pfik_packets[2][2][2]; + counter_u64_t pfik_bytes[2][2][2]; u_int32_t pfik_tzero; u_int pfik_flags; struct ifnet *pfik_ifp; @@ -1666,6 +1666,7 @@ struct pf_state_key *pf_state_key_clone(struct pf_state_key *); struct pfi_kkif *pf_kkif_create(int); void pf_kkif_free(struct pfi_kkif *); +void pf_kkif_zero(struct pfi_kkif *); #endif /* _KERNEL */ #endif /* _NET_PFVAR_H_ */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f1c26342577f..d4101aab9332 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6329,8 +6329,10 @@ done: (s == NULL)); } - kif->pfik_bytes[0][dir == PF_OUT][action != PF_PASS] += pd.tot_len; - kif->pfik_packets[0][dir == PF_OUT][action != PF_PASS]++; + counter_u64_add(kif->pfik_bytes[0][dir == PF_OUT][action != PF_PASS], + pd.tot_len); + counter_u64_add(kif->pfik_packets[0][dir == PF_OUT][action != PF_PASS], + 1); if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); @@ -6734,8 +6736,10 @@ done: &pd, (s == NULL)); } - kif->pfik_bytes[1][dir == PF_OUT][action != PF_PASS] += pd.tot_len; - kif->pfik_packets[1][dir == PF_OUT][action != PF_PASS]++; + counter_u64_add(kif->pfik_bytes[1][dir == PF_OUT][action != PF_PASS], + pd.tot_len); + counter_u64_add(kif->pfik_packets[1][dir == PF_OUT][action != PF_PASS], + 1); if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 3230a3e424f6..9ca404174cca 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -199,7 +199,26 @@ pf_kkif_create(int flags) { struct pfi_kkif *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, flags); + kif = malloc(sizeof(*kif), PFI_MTYPE, flags | M_ZERO); + if (! kif) + return (kif); + + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + kif->pfik_packets[i][j][k] = + counter_u64_alloc(flags); + kif->pfik_bytes[i][j][k] = + counter_u64_alloc(flags); + + if (! kif->pfik_packets[i][j][k] || + ! kif->pfik_bytes[i][j][k]) { + pf_kkif_free(kif); + return (NULL); + } + } + } + } return (kif); } @@ -210,9 +229,35 @@ pf_kkif_free(struct pfi_kkif *kif) if (! kif) return; + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + if (kif->pfik_packets[i][j][k]) + counter_u64_free(kif->pfik_packets[i][j][k]); + if (kif->pfik_bytes[i][j][k]) + counter_u64_free(kif->pfik_bytes[i][j][k]); + } + } + } + free(kif, PFI_MTYPE); } +void +pf_kkif_zero(struct pfi_kkif *kif) +{ + + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + counter_u64_zero(kif->pfik_packets[i][j][k]); + counter_u64_zero(kif->pfik_bytes[i][j][k]); + } + } + } + kif->pfik_tzero = time_second; +} + struct pfi_kkif * pfi_kkif_find(const char *kif_name) { @@ -240,7 +285,7 @@ pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name) return (kif1); } - bzero(kif, sizeof(*kif)); + pf_kkif_zero(kif); strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name)); /* * It seems that the value of time_second is in unintialzied state @@ -339,7 +384,7 @@ pfi_attach_ifnet(struct ifnet *ifp) { struct pfi_kkif *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); V_pfi_update++; @@ -359,7 +404,7 @@ pfi_attach_ifgroup(struct ifg_group *ifg) { struct pfi_kkif *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); V_pfi_update++; @@ -740,18 +785,16 @@ pfi_update_status(const char *name, struct pf_status *pfs) /* just clear statistics */ if (pfs == NULL) { - bzero(p->pfik_packets, sizeof(p->pfik_packets)); - bzero(p->pfik_bytes, sizeof(p->pfik_bytes)); - p->pfik_tzero = time_second; + pf_kkif_zero(p); continue; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) { pfs->pcounters[i][j][k] += - p->pfik_packets[i][j][k]; + counter_u64_fetch(p->pfik_packets[i][j][k]); pfs->bcounters[i][j] += - p->pfik_bytes[i][j][k]; + counter_u64_fetch(p->pfik_bytes[i][j][k]); } } } @@ -766,9 +809,9 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { kif->pfik_packets[i][j][k] = - kkif->pfik_packets[i][j][k]; + counter_u64_fetch(kkif->pfik_packets[i][j][k]); kif->pfik_bytes[i][j][k] = - kkif->pfik_bytes[i][j][k]; + counter_u64_fetch(kkif->pfik_bytes[i][j][k]); } } } From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 16:24:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C84184FB7A0; Wed, 20 Jan 2021 16:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLW7k5Fxlz3GPb; Wed, 20 Jan 2021 16:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A759B1C61B; Wed, 20 Jan 2021 16:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KGOYFI049768; Wed, 20 Jan 2021 16:24:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KGOYW0049767; Wed, 20 Jan 2021 16:24:34 GMT (envelope-from git) Date: Wed, 20 Jan 2021 16:24:34 GMT Message-Id: <202101201624.10KGOYW0049767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c325366474d9 - stable/12 - pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c325366474d9bb82f84c20f521b638a7166d9999 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 16:24:34 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c325366474d9bb82f84c20f521b638a7166d9999 commit c325366474d9bb82f84c20f521b638a7166d9999 Author: Kristof Provost AuthorDate: 2021-01-13 18:30:01 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:45:52 +0000 pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS We cannot hold a non-sleepable lock during copyin(). This means we can't safely count the table, so instead we fall back to the pf_ioctl_maxcount used in other ioctls to protect against overly large requests. Reported by: syzbot+81e380344d4a6c37d78a@syzkaller.appspotmail.com MFC after: 1 week (cherry picked from commit ea36212bf5711206bbaf5362a23ebb52c7f7e2a4) --- sys/netpfil/pf/pf_ioctl.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 866c4ebfaa3d..48f68fa249e2 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3368,36 +3368,35 @@ DIOCCHANGEADDR_error: struct pfioc_table *io = (struct pfioc_table *)addr; struct pfr_table *pfrts; size_t totlen; - int n; if (io->pfrio_esize != sizeof(struct pfr_table)) { error = ENODEV; break; } - PF_RULES_WLOCK(); - n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); - if (n < 0) { - PF_RULES_WUNLOCK(); - error = EINVAL; + if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount || + WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) { + /* We used to count tables and use the minimum required + * size, so we didn't fail on overly large requests. + * Keep doing so. */ + io->pfrio_size = pf_ioctl_maxcount; break; } - io->pfrio_size = min(io->pfrio_size, n); totlen = io->pfrio_size * sizeof(struct pfr_table); pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), M_TEMP, M_NOWAIT); if (pfrts == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); break; } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); - PF_RULES_WUNLOCK(); break; } + + PF_RULES_WLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); PF_RULES_WUNLOCK(); From owner-dev-commits-src-branches@freebsd.org Wed Jan 20 16:24:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB6E54FB5C5; Wed, 20 Jan 2021 16:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLW7l5ttjz3GGl; Wed, 20 Jan 2021 16:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD42C1C2E2; Wed, 20 Jan 2021 16:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KGOZDu049787; Wed, 20 Jan 2021 16:24:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KGOZaD049786; Wed, 20 Jan 2021 16:24:35 GMT (envelope-from git) Date: Wed, 20 Jan 2021 16:24:35 GMT Message-Id: <202101201624.10KGOZaD049786@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2cc2177bca0e - stable/12 - pf tests: pass NULL buffer to DIOCRCLRTSTATS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2cc2177bca0eb84a268c9ce36427537dc3c76822 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 16:24:36 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2cc2177bca0eb84a268c9ce36427537dc3c76822 commit 2cc2177bca0eb84a268c9ce36427537dc3c76822 Author: Kristof Provost AuthorDate: 2021-01-13 18:41:07 +0000 Commit: Kristof Provost CommitDate: 2021-01-20 14:46:00 +0000 pf tests: pass NULL buffer to DIOCRCLRTSTATS As discovered by syzcaller this used to provoke panics. MFC after: 1 week (cherry picked from commit 44117554b1ee8edd66d7383c17802d5799fd18f2) --- tests/sys/netpfil/pf/ioctl/validation.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/sys/netpfil/pf/ioctl/validation.c b/tests/sys/netpfil/pf/ioctl/validation.c index 5b1f61720f66..0d7f7631e91b 100644 --- a/tests/sys/netpfil/pf/ioctl/validation.c +++ b/tests/sys/netpfil/pf/ioctl/validation.c @@ -265,6 +265,11 @@ ATF_TC_BODY(clrtstats, tc) io.pfrio_size = 1 << 24; if (ioctl(dev, DIOCRCLRTSTATS, &io) != 0) atf_tc_fail("Request with size 1 << 24 failed"); + + io.pfrio_size = sizeof(tbl); + io.pfrio_buffer = NULL; + if (ioctl(dev, DIOCRCLRTSTATS, &io) == 0) + atf_tc_fail("Request with NULL buffer succeeded"); } ATF_TC_CLEANUP(clrtstats, tc) From owner-dev-commits-src-branches@freebsd.org Thu Jan 21 09:13:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 888C64EFC5D; Thu, 21 Jan 2021 09:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLxWd3QMVz3NCG; Thu, 21 Jan 2021 09:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6839414F8; Thu, 21 Jan 2021 09:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L9DHJI065332; Thu, 21 Jan 2021 09:13:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L9DHKn065331; Thu, 21 Jan 2021 09:13:17 GMT (envelope-from git) Date: Thu, 21 Jan 2021 09:13:17 GMT Message-Id: <202101210913.10L9DHKn065331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Roger Pau Monné Subject: git: d9bd043f93df - stable/11 - xen: allow limiting the amount of duplicated pending xenstore watches MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: d9bd043f93df1a31ef16d2198d720a0a0831357f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 09:13:17 -0000 The branch stable/11 has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=d9bd043f93df1a31ef16d2198d720a0a0831357f commit d9bd043f93df1a31ef16d2198d720a0a0831357f Author: Roger Pau Monné AuthorDate: 2020-11-25 11:34:38 +0000 Commit: Roger Pau Monné CommitDate: 2021-01-21 08:31:59 +0000 xen: allow limiting the amount of duplicated pending xenstore watches Xenstore watches received are queued in a list and processed in a deferred thread. Such queuing was done without any checking, so a guest could potentially trigger a resource starvation against the FreeBSD kernel if such kernel is watching any user-controlled xenstore path. Allowing limiting the amount of pending events a watch can accumulate to prevent a remote guest from triggering this resource starvation issue. For the PV device backends and frontends this limitation is only applied to the other end /state node, which is limited to 1 pending event, the rest of the watched paths can still have unlimited pending watches because they are either local or controlled by a privileged domain. The xenstore user-space device gets special treatment as it's not possible for the kernel to know whether the paths being watched by user-space processes are controlled by a guest domain. For this reason watches set by the xenstore user-space device are limited to 1000 pending events. Note this can be modified using the max_pending_watch_events sysctl of the device. This is XSA-349. Sponsored by: Citrix Systems R&D MFC after: 3 days (cherry picked from commit 4e4e43dc9e1afc863670a031cc5cc75eb5e668d6) Note the xenstore user-space device part of this backport is dropped, as in stable/11 the device doesn't support setting up watches. --- sys/dev/xen/balloon/balloon.c | 3 ++- sys/dev/xen/blkback/blkback.c | 6 ++++++ sys/dev/xen/control/control.c | 6 ++++++ sys/dev/xen/xenstore/xenstore.c | 14 +++++++++++--- sys/xen/xenbus/xenbusb.c | 17 +++++++++++++++++ sys/xen/xenstore/xenstorevar.h | 9 +++++++++ 6 files changed, 51 insertions(+), 4 deletions(-) diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index aefa5cdb9250..87163000d4a8 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -310,7 +310,8 @@ set_new_target(unsigned long target) static struct xs_watch target_watch = { - .node = "memory/target" + .node = "memory/target", + .max_pending = 1, }; /* React to a change in the target key */ diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c index a5f9cc101582..4b6eeb0cf62f 100644 --- a/sys/dev/xen/blkback/blkback.c +++ b/sys/dev/xen/blkback/blkback.c @@ -3767,6 +3767,12 @@ xbb_attach(device_t dev) xbb->hotplug_watch.callback = xbb_attach_disk; KASSERT(xbb->hotplug_watch.node == NULL, ("watch node already setup")); xbb->hotplug_watch.node = strdup(sbuf_data(watch_path), M_XENBLOCKBACK); + /* + * We don't care about the path updated, just about the value changes + * on that single node, hence there's no need to queue more that one + * event. + */ + xbb->hotplug_watch.max_pending = 1; sbuf_delete(watch_path); error = xs_register_watch(&xbb->hotplug_watch); if (error != 0) { diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 218a2e35cb79..e95f1e7038b7 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -431,6 +431,12 @@ xctrl_attach(device_t dev) xctrl->xctrl_watch.node = "control/shutdown"; xctrl->xctrl_watch.callback = xctrl_on_watch_event; xctrl->xctrl_watch.callback_data = (uintptr_t)xctrl; + /* + * We don't care about the path updated, just about the value changes + * on that single node, hence there's no need to queue more that one + * event. + */ + xctrl->xctrl_watch.max_pending = 1; xs_register_watch(&xctrl->xctrl_watch); if (xen_pv_domain()) diff --git a/sys/dev/xen/xenstore/xenstore.c b/sys/dev/xen/xenstore/xenstore.c index 9289adfc1a79..7cba2a55f973 100644 --- a/sys/dev/xen/xenstore/xenstore.c +++ b/sys/dev/xen/xenstore/xenstore.c @@ -668,12 +668,17 @@ xs_process_msg(enum xsd_sockmsg_type *type) mtx_lock(&xs.registered_watches_lock); msg->u.watch.handle = find_watch( msg->u.watch.vec[XS_WATCH_TOKEN]); - if (msg->u.watch.handle != NULL) { - mtx_lock(&xs.watch_events_lock); + mtx_lock(&xs.watch_events_lock); + if (msg->u.watch.handle != NULL && + (!msg->u.watch.handle->max_pending || + msg->u.watch.handle->pending < + msg->u.watch.handle->max_pending)) { + msg->u.watch.handle->pending++; TAILQ_INSERT_TAIL(&xs.watch_events, msg, list); wakeup(&xs.watch_events); mtx_unlock(&xs.watch_events_lock); } else { + mtx_unlock(&xs.watch_events_lock); free(msg->u.watch.vec, M_XENSTORE); free(msg, M_XENSTORE); } @@ -1045,8 +1050,10 @@ xenwatch_thread(void *unused) mtx_lock(&xs.watch_events_lock); msg = TAILQ_FIRST(&xs.watch_events); - if (msg) + if (msg) { TAILQ_REMOVE(&xs.watch_events, msg, list); + msg->u.watch.handle->pending--; + } mtx_unlock(&xs.watch_events_lock); if (msg != NULL) { @@ -1629,6 +1636,7 @@ xs_register_watch(struct xs_watch *watch) char token[sizeof(watch) * 2 + 1]; int error; + watch->pending = 0; sprintf(token, "%lX", (long)watch); sx_slock(&xs.suspend_mutex); diff --git a/sys/xen/xenbus/xenbusb.c b/sys/xen/xenbus/xenbusb.c index 241efaa8fb4e..f191c7f62311 100644 --- a/sys/xen/xenbus/xenbusb.c +++ b/sys/xen/xenbus/xenbusb.c @@ -702,10 +702,21 @@ xenbusb_add_device(device_t dev, const char *type, const char *id) ivars->xd_otherend_watch.node = statepath; ivars->xd_otherend_watch.callback = xenbusb_otherend_watch_cb; ivars->xd_otherend_watch.callback_data = (uintptr_t)ivars; + /* + * Other end state node watch, limit to one pending event + * to prevent frontends from queuing too many events that + * could cause resource starvation. + */ + ivars->xd_otherend_watch.max_pending = 1; ivars->xd_local_watch.node = ivars->xd_node; ivars->xd_local_watch.callback = xenbusb_local_watch_cb; ivars->xd_local_watch.callback_data = (uintptr_t)ivars; + /* + * Watch our local path, only writable by us or a privileged + * domain, no need to limit. + */ + ivars->xd_local_watch.max_pending = 0; mtx_lock(&xbs->xbs_lock); xbs->xbs_connecting_children++; @@ -764,6 +775,12 @@ xenbusb_attach(device_t dev, char *bus_node, u_int id_components) xbs->xbs_device_watch.node = bus_node; xbs->xbs_device_watch.callback = xenbusb_devices_changed; xbs->xbs_device_watch.callback_data = (uintptr_t)xbs; + /* + * Allow for unlimited pending watches, as those are local paths + * either controlled by the guest or only writable by privileged + * domains. + */ + xbs->xbs_device_watch.max_pending = 0; TASK_INIT(&xbs->xbs_probe_children, 0, xenbusb_probe_children_cb, dev); diff --git a/sys/xen/xenstore/xenstorevar.h b/sys/xen/xenstore/xenstorevar.h index 4c612b4b6881..e58d4e1d5721 100644 --- a/sys/xen/xenstore/xenstorevar.h +++ b/sys/xen/xenstore/xenstorevar.h @@ -72,6 +72,15 @@ struct xs_watch /* Callback client data untouched by the XenStore watch mechanism. */ uintptr_t callback_data; + + /* Maximum number of pending watch events to be delivered. */ + unsigned int max_pending; + + /* + * Private counter used by xenstore to keep track of the pending + * watches. Protected by xs.watch_events_lock. + */ + unsigned int pending; }; LIST_HEAD(xs_watch_list, xs_watch); From owner-dev-commits-src-branches@freebsd.org Thu Jan 21 12:47:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D83984F4490; Thu, 21 Jan 2021 12:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM2Gd5qxcz3rgD; Thu, 21 Jan 2021 12:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B089B3E65; Thu, 21 Jan 2021 12:47:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LClLTi040514; Thu, 21 Jan 2021 12:47:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LClLNT040513; Thu, 21 Jan 2021 12:47:21 GMT (envelope-from git) Date: Thu, 21 Jan 2021 12:47:21 GMT Message-Id: <202101211247.10LClLNT040513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b3daf5db761e - stable/12 - tmpfs_reclaim: detach unlinked node on dereferencing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b3daf5db761e2e32b8e4384587c593fb6c645e2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 12:47:21 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b3daf5db761e2e32b8e4384587c593fb6c645e2f commit b3daf5db761e2e32b8e4384587c593fb6c645e2f Author: Konstantin Belousov AuthorDate: 2021-01-12 16:10:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-21 12:45:32 +0000 tmpfs_reclaim: detach unlinked node on dereferencing. (cherry picked from commit 2d1e4220ebd50b9220d3266754425f025c786108) --- sys/fs/tmpfs/tmpfs_vnops.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 84134e48e83e..bfb84c508c78 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1305,10 +1305,12 @@ tmpfs_reclaim(struct vop_reclaim_args *v) struct vnode *vp; struct tmpfs_mount *tmp; struct tmpfs_node *node; + bool unlock, tm_locked; vp = v->a_vp; node = VP_TO_TMPFS_NODE(vp); tmp = VFS_TO_TMPFS(vp->v_mount); + tm_locked = false; if (vp->v_type == VREG) tmpfs_destroy_vobject(vp, node->tn_reg.tn_aobj); @@ -1318,7 +1320,15 @@ tmpfs_reclaim(struct vop_reclaim_args *v) if (tmpfs_use_nc(vp)) cache_purge(vp); +relock: TMPFS_NODE_LOCK(node); + if (!tm_locked && node->tn_links == 0 && + (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { + TMPFS_NODE_UNLOCK(node); + TMPFS_LOCK(tmp); + tm_locked = true; + goto relock; + } tmpfs_free_vp(vp); /* @@ -1328,11 +1338,18 @@ tmpfs_reclaim(struct vop_reclaim_args *v) */ if (node->tn_links == 0 && (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { + MPASS(tm_locked); node->tn_vpstate = TMPFS_VNODE_DOOMED; + unlock = !tmpfs_free_node_locked(tmp, node, true); + } else { + unlock = true; + } + + if (unlock) { TMPFS_NODE_UNLOCK(node); - tmpfs_free_node(tmp, node); - } else - TMPFS_NODE_UNLOCK(node); + if (tm_locked) + TMPFS_UNLOCK(tmp); + } MPASS(vp->v_data == NULL); return (0); @@ -1543,6 +1560,7 @@ tmpfs_vptocnp(struct vop_vptocnp_args *ap) } restart: TMPFS_LOCK(tm); +restart_locked: LIST_FOREACH_SAFE(tnp, &tm->tm_nodes_used, tn_entries, tnp1) { if (tnp->tn_type != VDIR) continue; @@ -1580,8 +1598,13 @@ restart: } else { KASSERT(tnp->tn_refcount > 0, ("node %p refcount zero", tnp)); - tnp1 = LIST_NEXT(tnp, tn_entries); - TMPFS_NODE_UNLOCK(tnp); + if (tnp->tn_attached) { + tnp1 = LIST_NEXT(tnp, tn_entries); + TMPFS_NODE_UNLOCK(tnp); + } else { + TMPFS_NODE_UNLOCK(tnp); + goto restart_locked; + } } } TMPFS_UNLOCK(tm); From owner-dev-commits-src-branches@freebsd.org Thu Jan 21 14:40:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7246D4F649D; Thu, 21 Jan 2021 14:40:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM4mr2SDZz4T0H; Thu, 21 Jan 2021 14:40:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 464E65C03; Thu, 21 Jan 2021 14:40:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LEeChE087152; Thu, 21 Jan 2021 14:40:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LEeCQq087145; Thu, 21 Jan 2021 14:40:12 GMT (envelope-from git) Date: Thu, 21 Jan 2021 14:40:12 GMT Message-Id: <202101211440.10LEeCQq087145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 920d22cca1a2 - stable/12 - iwm(4): Add support for Intel Killer(R) Wireless-AC 1550i MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 920d22cca1a2593b3751c39ce9dc250becc31a8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 14:40:12 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=920d22cca1a2593b3751c39ce9dc250becc31a8c commit 920d22cca1a2593b3751c39ce9dc250becc31a8c Author: Mark Johnston AuthorDate: 2021-01-14 16:41:28 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 14:39:50 +0000 iwm(4): Add support for Intel Killer(R) Wireless-AC 1550i PR: 252578 Submitted by: shu (cherry picked from commit 90cc8706ccb2da130c0b1a28434a9ec5d4c80d81) --- sys/dev/iwm/if_iwm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 9ab724be790c..def5e8162078 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -5873,6 +5873,7 @@ iwm_intr(void *arg) #define PCI_PRODUCT_INTEL_WL_8265_1 0x24fd #define PCI_PRODUCT_INTEL_WL_9560_1 0x9df0 #define PCI_PRODUCT_INTEL_WL_9560_2 0xa370 +#define PCI_PRODUCT_INTEL_WL_9560_3 0x31dc #define PCI_PRODUCT_INTEL_WL_9260_1 0x2526 static const struct iwm_devices { @@ -5893,6 +5894,7 @@ static const struct iwm_devices { { PCI_PRODUCT_INTEL_WL_8265_1, &iwm8265_cfg }, { PCI_PRODUCT_INTEL_WL_9560_1, &iwm9560_cfg }, { PCI_PRODUCT_INTEL_WL_9560_2, &iwm9560_cfg }, + { PCI_PRODUCT_INTEL_WL_9560_3, &iwm9560_cfg }, { PCI_PRODUCT_INTEL_WL_9260_1, &iwm9260_cfg }, }; From owner-dev-commits-src-branches@freebsd.org Thu Jan 21 17:11:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 505124D9A7D; Thu, 21 Jan 2021 17:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM87l1kMRz4d1b; Thu, 21 Jan 2021 17:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E2687B23; Thu, 21 Jan 2021 17:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LHBlqm090133; Thu, 21 Jan 2021 17:11:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LHBlcn090132; Thu, 21 Jan 2021 17:11:47 GMT (envelope-from git) Date: Thu, 21 Jan 2021 17:11:47 GMT Message-Id: <202101211711.10LHBlcn090132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: d0a78220ba99 - stable/12 - rc.conf(5): describe devmatch rc variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d0a78220ba99314fe29f819bd4c5c052948fc9fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 17:11:47 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d0a78220ba99314fe29f819bd4c5c052948fc9fa commit d0a78220ba99314fe29f819bd4c5c052948fc9fa Author: Mitchell Horne AuthorDate: 2021-01-10 20:53:59 +0000 Commit: Mitchell Horne CommitDate: 2021-01-21 17:11:34 +0000 rc.conf(5): describe devmatch rc variables Reviewed by: imp, gbe (manpages) (cherry picked from commit ef757da441b199da680bfbd24afaa9d3c16e5b55) --- share/man/man5/rc.conf.5 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 5a81e56cf7c7..25666f9810e0 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2020 +.Dd January 10, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -246,6 +246,16 @@ Configuration file for .Xr ddb 8 . Default .Pa /etc/ddb.conf . +.It Va devmatch_enable +.Pq Vt bool +If set to +.Dq Li NO , +disable auto-loading of kernel modules with +.Xr devmatch 8 . +.It Va devmatch_blacklist +.Pq Vt str +A whitespace-separated list of kernel modules to be ignored by +.Xr devmatch 8 . .It Va kld_list .Pq Vt str A list of kernel modules to load right after the local From owner-dev-commits-src-branches@freebsd.org Thu Jan 21 17:12:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08CEB4D9D66; Thu, 21 Jan 2021 17:12:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM88m6r1Yz4d8j; Thu, 21 Jan 2021 17:12:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD913775D; Thu, 21 Jan 2021 17:12:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LHCelS090953; Thu, 21 Jan 2021 17:12:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LHCeJY090952; Thu, 21 Jan 2021 17:12:40 GMT (envelope-from git) Date: Thu, 21 Jan 2021 17:12:40 GMT Message-Id: <202101211712.10LHCeJY090952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: d970a8218e16 - stable/12 - armv8crypto: print a message on probe failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d970a8218e16e3da8234f8b236d28919c1439090 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 17:12:41 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d970a8218e16e3da8234f8b236d28919c1439090 commit d970a8218e16e3da8234f8b236d28919c1439090 Author: Mitchell Horne AuthorDate: 2021-01-18 20:59:21 +0000 Commit: Mitchell Horne CommitDate: 2021-01-21 17:12:00 +0000 armv8crypto: print a message on probe failure Similar to the message printed by aesni(4), let the user know if the driver is unsupported by their CPU. PR: 252543 Reported by: gbe Sponsored by: The FreeBSD Foundation (cherry picked from commit a520f5ca580fcff34fd0d9f0d64a4c165f57eb30) --- sys/crypto/armv8/armv8_crypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index c11053cc8e17..8cfb0ec5cb9d 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -110,6 +110,9 @@ armv8_crypto_probe(device_t dev) case ID_AA64ISAR0_AES_PMULL: ret = 0; break; + case ID_AA64ISAR0_AES_NONE: + device_printf(dev, "CPU lacks AES instructions"); + break; } device_set_desc_copy(dev, "AES-CBC"); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 00:09:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 779664E4D8E; Fri, 22 Jan 2021 00:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMKPK2wGrz3PsK; Fri, 22 Jan 2021 00:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56CC2151D7; Fri, 22 Jan 2021 00:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10M099Db026280; Fri, 22 Jan 2021 00:09:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10M099XF026279; Fri, 22 Jan 2021 00:09:09 GMT (envelope-from git) Date: Fri, 22 Jan 2021 00:09:09 GMT Message-Id: <202101220009.10M099XF026279@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: bfd15705156b - stable/13 - Create the stable/13 branch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bfd15705156b0436cfe79aea11868dcc0c6e078a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 00:09:09 -0000 The branch stable/13 has been created by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd15705156b0436cfe79aea11868dcc0c6e078a commit bfd15705156b0436cfe79aea11868dcc0c6e078a Author: Glen Barber AuthorDate: 2021-01-22 00:06:26 +0000 Commit: Glen Barber CommitDate: 2021-01-22 00:08:57 +0000 Create the stable/13 branch Prune *-NODEBUG kernels. Turn off debug options. Bump to ALPHA2. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 18 ++-------- .../jemalloc/include/jemalloc/jemalloc_FreeBSD.h | 2 +- libexec/rc/rc.conf | 2 +- release/Makefile | 3 -- release/release.conf.sample | 2 +- share/mk/src.opts.mk | 4 +-- sys/amd64/conf/GENERIC | 13 -------- sys/amd64/conf/GENERIC-NODEBUG | 32 ------------------ sys/amd64/conf/MINIMAL | 10 ------ sys/arm/conf/GENERIC-NODEBUG | 32 ------------------ sys/arm/conf/std.armv6 | 12 ------- sys/arm/conf/std.armv7 | 12 ------- sys/arm64/conf/GENERIC | 11 ------- sys/arm64/conf/GENERIC-MMCCAM-NODEBUG | 13 -------- sys/arm64/conf/GENERIC-NODEBUG | 32 ------------------ sys/conf/newvers.sh | 2 +- sys/i386/conf/GENERIC | 10 ------ sys/i386/conf/GENERIC-NODEBUG | 32 ------------------ sys/i386/conf/MINIMAL | 10 ------ sys/powerpc/conf/GENERIC | 9 ----- sys/powerpc/conf/GENERIC-NODEBUG | 32 ------------------ sys/powerpc/conf/GENERIC64 | 9 ----- sys/powerpc/conf/GENERIC64-NODEBUG | 38 ---------------------- sys/powerpc/conf/GENERIC64LE | 9 ----- sys/riscv/conf/GENERIC | 11 ------- sys/riscv/conf/GENERIC-NODEBUG | 32 ------------------ 26 files changed, 9 insertions(+), 383 deletions(-) diff --git a/UPDATING b/UPDATING index cbb9000b17db..222dc6083ce7 100644 --- a/UPDATING +++ b/UPDATING @@ -1,4 +1,4 @@ - Updating Information for FreeBSD current users. + Updating Information for FreeBSD stable/13 users. This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the @@ -11,20 +11,8 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. -NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: - FreeBSD 13.x has many debugging features turned on, in both the kernel - and userland. These features attempt to detect incorrect use of - system primitives, and encourage loud failure through extra sanity - checking and fail stop semantics. They also substantially impact - system performance. If you want to do performance measurement, - benchmarking, and optimization, you'll want to turn them off. This - includes various WITNESS- related kernel options, INVARIANTS, malloc - debugging flags in userland, and various verbose features in the - kernel. Many developers choose to disable these features on build - machines to maximize performance. (To completely disable malloc - debugging, define WITH_MALLOC_PRODUCTION in /etc/src.conf and rebuild - world, or to merely disable the most expensive debugging functionality - at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210122: + The stable/13 branch has been created from main. 20210108: PC Card attachments for all devices have been removed. In the case of diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h index 6ff0ce18d5da..dfda508ea1e1 100644 --- a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h +++ b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -5,7 +5,7 @@ #undef JEMALLOC_OVERRIDE_VALLOC #ifndef MALLOC_PRODUCTION -#define JEMALLOC_DEBUG +#define MALLOC_PRODUCTION #endif #undef JEMALLOC_DSS diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index d8c24853225f..56d6bb30f811 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -625,7 +625,7 @@ lpd_flags="" # Flags to lpd (if enabled). nscd_enable="NO" # Run the nsswitch caching daemon. chkprintcap_enable="NO" # Run chkprintcap(8) before running lpd. chkprintcap_flags="-d" # Create missing directories by default. -dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). +dumpdev="NO" # Device to crashdump to (device name, AUTO, or NO). dumpon_flags="" # Options to pass to dumpon(8), followed by dumpdev. dumpdir="/var/crash" # Directory where crash dumps are to be stored savecore_enable="YES" # Extract core from dump devices if any diff --git a/release/Makefile b/release/Makefile index 3df1e461d64e..31fa254ef5e3 100644 --- a/release/Makefile +++ b/release/Makefile @@ -201,7 +201,6 @@ disc1: packagesystem ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf - echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf echo kernels_autodetect=\"NO\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc @@ -229,7 +228,6 @@ bootonly: packagesystem ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf - echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf echo kernels_autodetect=\"NO\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc @@ -254,7 +252,6 @@ dvd: packagesystem ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf - echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf echo kernels_autodetect=\"NO\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc diff --git a/release/release.conf.sample b/release/release.conf.sample index bb9c8acb1b87..3a77a6bf1fac 100644 --- a/release/release.conf.sample +++ b/release/release.conf.sample @@ -19,7 +19,7 @@ GITPORTS="ports.git" GITDOC="doc.git" ## Set the src/, ports/, and doc/ branches or tags. -SRCBRANCH="main" +SRCBRANCH="stable/13" DOCBRANCH="main" PORTBRANCH="main" diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 55d07dac42dd..d38b4a2c279b 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -131,7 +131,6 @@ __DEFAULT_YES_OPTIONS = \ LLD \ LLD_BOOTSTRAP \ LLD_IS_LD \ - LLVM_ASSERTIONS \ LLVM_COV \ LLVM_CXXFILT \ LLVM_TARGET_ALL \ @@ -166,6 +165,7 @@ __DEFAULT_YES_OPTIONS = \ QUOTAS \ RADIUS_SUPPORT \ RBOOTD \ + REPRODUCIBLE_BUILD \ RESCUE \ ROUTED \ SENDMAIL \ @@ -207,13 +207,13 @@ __DEFAULT_NO_OPTIONS = \ EXPERIMENTAL \ HESIOD \ LIBSOFT \ + LLVM_ASSERTIONS \ LOADER_FIREWIRE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ MALLOC_PRODUCTION \ OFED_EXTRA \ OPENLDAP \ - REPRODUCIBLE_BUILD \ RPCBIND_WARMSTART_SUPPORT \ SORT_THREADS \ SVN \ diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 9f55a935f8a5..56376ad9d14c 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -91,19 +91,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options BUF_TRACKING # Track buffer history -options DDB # Support DDB. -options FULL_BUF_TRACKING # Track more buffer history -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on invalidation -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel Sanitizers #options COVERAGE # Generic kernel coverage. Used by KCOV diff --git a/sys/amd64/conf/GENERIC-NODEBUG b/sys/amd64/conf/GENERIC-NODEBUG deleted file mode 100644 index 332cf85eb372..000000000000 --- a/sys/amd64/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,32 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/amd64 -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC -include "../../conf/std.nodebug" - -ident GENERIC-NODEBUG diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index 603fce8320bb..7edafe1957fe 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -83,16 +83,6 @@ options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel diff --git a/sys/arm/conf/GENERIC-NODEBUG b/sys/arm/conf/GENERIC-NODEBUG deleted file mode 100644 index 6e60deff7569..000000000000 --- a/sys/arm/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,32 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/arm -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC -include "../../conf/std.nodebug" - -ident GENERIC-NODEBUG diff --git a/sys/arm/conf/std.armv6 b/sys/arm/conf/std.armv6 index 6db6c7a16dd7..7be0f5a0d938 100644 --- a/sys/arm/conf/std.armv6 +++ b/sys/arm/conf/std.armv6 @@ -61,18 +61,6 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB -#options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence -options USB_DEBUG # Enable usb debug support code -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default - # Optional extras, never enabled by default: #options BOOTVERBOSE #options DEBUG # May result in extreme spewage diff --git a/sys/arm/conf/std.armv7 b/sys/arm/conf/std.armv7 index 0b842ad1f4e4..b15f9f9a70fa 100644 --- a/sys/arm/conf/std.armv7 +++ b/sys/arm/conf/std.armv7 @@ -61,18 +61,6 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB -#options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence -options USB_DEBUG # Enable usb debug support code -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default - # Optional extras, never enabled by default: #options BOOTVERBOSE #options DEBUG # May result in extreme spewage diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index d1ad101975de..3be3b5e7b706 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -85,17 +85,6 @@ options LINUX_BOOT_ABI # Boot using booti command from U-Boot # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel Sanitizers #options COVERAGE # Generic kernel coverage. Used by KCOV diff --git a/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG b/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG deleted file mode 100644 index 93360bea9bc0..000000000000 --- a/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG +++ /dev/null @@ -1,13 +0,0 @@ -# -# GENERIC-MMCCAM-NODEBUG -# -# Custom kernel for arm64 plus MMCCAM as opposed to the prior MMC stack. It is -# present to keep it building in tree since it wouldn't work in LINT. This -# version without debugging features. -# -# $FreeBSD$ - -include GENERIC-MMCCAP -include "../../conf/std.nodebug" - -ident GENERIC-MMCCAM-NODEBUG diff --git a/sys/arm64/conf/GENERIC-NODEBUG b/sys/arm64/conf/GENERIC-NODEBUG deleted file mode 100644 index 8b99852be971..000000000000 --- a/sys/arm64/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,32 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/arm64 -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC -include "../../conf/std.nodebug" - -ident GENERIC-NODEBUG diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 7d2ac14223b6..2afaa3a92f8e 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="ALPHA1" +BRANCH="ALPHA2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 9ce338f5a181..f54902250152 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -86,16 +86,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel dump features. options EKCD # Support for encrypted kernel dumps diff --git a/sys/i386/conf/GENERIC-NODEBUG b/sys/i386/conf/GENERIC-NODEBUG deleted file mode 100644 index d09663e1b9db..000000000000 --- a/sys/i386/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,32 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/i386 -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC -include "../../conf/std.nodebug" - -ident GENERIC-NODEBUG diff --git a/sys/i386/conf/MINIMAL b/sys/i386/conf/MINIMAL index faebfeaf99a8..9ca3ed408f9c 100644 --- a/sys/i386/conf/MINIMAL +++ b/sys/i386/conf/MINIMAL @@ -83,16 +83,6 @@ options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index dc3484d7f614..89bda03b1b21 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -91,15 +91,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB #Support DDB -#options DEADLKRES #Enable the deadlock resolver -options INVARIANTS #Enable calls of extra sanity checking -options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS #Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel dump features. options EKCD # Support for encrypted kernel dumps diff --git a/sys/powerpc/conf/GENERIC-NODEBUG b/sys/powerpc/conf/GENERIC-NODEBUG deleted file mode 100644 index b86116253d78..000000000000 --- a/sys/powerpc/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,32 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/powerpc -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC -include "../../conf/std.nodebug" - -ident GENERIC-NODEBUG diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 16a33160aa34..0e201d718b3e 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -99,15 +99,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB #Support DDB -#options DEADLKRES #Enable the deadlock resolver -options INVARIANTS #Enable calls of extra sanity checking -options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS #Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel dump features. options EKCD # Support for encrypted kernel dumps diff --git a/sys/powerpc/conf/GENERIC64-NODEBUG b/sys/powerpc/conf/GENERIC64-NODEBUG deleted file mode 100644 index da382e5e76de..000000000000 --- a/sys/powerpc/conf/GENERIC64-NODEBUG +++ /dev/null @@ -1,38 +0,0 @@ -# -# GENERIC64-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/powerpc -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC64. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC64 - -ident GENERIC64-NODEBUG - -nooptions INVARIANTS -nooptions INVARIANT_SUPPORT -nooptions WITNESS -nooptions WITNESS_SKIPSPIN -nooptions DEADLKRES -nooptions MALLOC_DEBUG_MAXZONES diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index bafa8df52f4e..93afcbfe1ef5 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -96,15 +96,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB #Support DDB -#options DEADLKRES #Enable the deadlock resolver -options INVARIANTS #Enable calls of extra sanity checking -options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS #Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel dump features. options EKCD # Support for encrypted kernel dumps diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index a04d5557c83c..63ed92a409e4 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -134,17 +134,6 @@ device axidma # Xilinx AXI DMA Controller # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -# options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -# options EARLY_PRINTF -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel dump features. options ZSTDIO # zstd-compressed kernel and user dumps diff --git a/sys/riscv/conf/GENERIC-NODEBUG b/sys/riscv/conf/GENERIC-NODEBUG deleted file mode 100644 index 9b1d9fe5a9af..000000000000 --- a/sys/riscv/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,32 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/riscv -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC -include "../../conf/std.nodebug" - -ident GENERIC-NODEBUG From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 00:28:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 236314E5887; Fri, 22 Jan 2021 00:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMKqx0Sflz3R8y; Fri, 22 Jan 2021 00:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F28E3150E3; Fri, 22 Jan 2021 00:28:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10M0Si6S052799; Fri, 22 Jan 2021 00:28:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10M0SioY052798; Fri, 22 Jan 2021 00:28:44 GMT (envelope-from git) Date: Fri, 22 Jan 2021 00:28:44 GMT Message-Id: <202101220028.10M0SioY052798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 02611ef8ee9f - stable/13 - Turn on MALLOC_PRODUCTION MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 02611ef8ee9f4572d251383560bd6f264f628fe7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 00:28:45 -0000 The branch stable/13 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=02611ef8ee9f4572d251383560bd6f264f628fe7 commit 02611ef8ee9f4572d251383560bd6f264f628fe7 Author: Glen Barber AuthorDate: 2021-01-22 00:28:07 +0000 Commit: Glen Barber CommitDate: 2021-01-22 00:28:07 +0000 Turn on MALLOC_PRODUCTION Approved by: re (implicit) Noticed by: kevans Sponsored by: Rubicon Communications, LLC ("Netgate") --- share/mk/src.opts.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index d38b4a2c279b..a088adbd91f7 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -146,6 +146,7 @@ __DEFAULT_YES_OPTIONS = \ MAIL \ MAILWRAPPER \ MAKE \ + MALLOC_PRODUCTION \ MLX5TOOL \ NDIS \ NETCAT \ @@ -211,7 +212,6 @@ __DEFAULT_NO_OPTIONS = \ LOADER_FIREWIRE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ - MALLOC_PRODUCTION \ OFED_EXTRA \ OPENLDAP \ RPCBIND_WARMSTART_SUPPORT \ From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F9334F3657; Fri, 22 Jan 2021 12:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrY1qyzz4p4k; Fri, 22 Jan 2021 12:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31E701E769; Fri, 22 Jan 2021 12:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCULjd000443; Fri, 22 Jan 2021 12:30:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCULuw000439; Fri, 22 Jan 2021 12:30:21 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:21 GMT Message-Id: <202101221230.10MCULuw000439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: e006b6a2c1b9 - stable/12 - MFC 376479200760: Fix whitespace in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e006b6a2c1b9a34e008ffbb4cabf86315f7873ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:21 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e006b6a2c1b9a34e008ffbb4cabf86315f7873ff commit e006b6a2c1b9a34e008ffbb4cabf86315f7873ff Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:44:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:08:03 +0000 MFC 376479200760: Fix whitespace in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 64b70df93f9e..e0af780f0b74 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -796,7 +796,7 @@ struct mlx5e_sq { struct mtx lock; struct mtx comp_lock; struct mlx5e_sq_stats stats; - struct callout cev_callout; + struct callout cev_callout; /* data path */ #define mlx5e_sq_zero_start dma_tag From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 730064F382C; Fri, 22 Jan 2021 12:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrZ2nzrz4pHZ; Fri, 22 Jan 2021 12:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 533DF1E76A; Fri, 22 Jan 2021 12:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUMvw000684; Fri, 22 Jan 2021 12:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUMPD000683; Fri, 22 Jan 2021 12:30:22 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:22 GMT Message-Id: <202101221230.10MCUMPD000683@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: b195e1730e51 - stable/12 - MFC 376e130b4707: Fix memory leaks in error paths in krping. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b195e1730e517cd5b43f6174efdda183163d9feb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:22 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b195e1730e517cd5b43f6174efdda183163d9feb commit b195e1730e517cd5b43f6174efdda183163d9feb Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:22:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:08:42 +0000 MFC 376e130b4707: Fix memory leaks in error paths in krping. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/contrib/rdma/krping/krping.c | 52 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index e9a379984dec..75c874411bb3 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -992,9 +992,11 @@ static void wlat_test(struct krping_cb *cb) volatile char *poll_buf = (char *) cb->start_buf; char *buf = (char *)cb->rdma_buf; struct timeval start_tv, stop_tv; - cycles_t *post_cycles_start, *post_cycles_stop; - cycles_t *poll_cycles_start, *poll_cycles_stop; - cycles_t *last_poll_cycles_start; + cycles_t *post_cycles_start = NULL; + cycles_t *post_cycles_stop = NULL; + cycles_t *poll_cycles_start = NULL; + cycles_t *poll_cycles_stop = NULL; + cycles_t *last_poll_cycles_start = NULL; cycles_t sum_poll = 0, sum_post = 0, sum_last_poll = 0; int i; int cycle_iters = 1000; @@ -1006,28 +1008,28 @@ static void wlat_test(struct krping_cb *cb) post_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } post_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } last_poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!last_poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; cb->rdma_sq_wr.rkey = cb->remote_rkey; @@ -1046,7 +1048,7 @@ static void wlat_test(struct krping_cb *cb) if (cb->state == ERROR) { printk(KERN_ERR PFX "state = ERROR, bailing\n"); - return; + goto done; } } } @@ -1061,7 +1063,7 @@ static void wlat_test(struct krping_cb *cb) printk(KERN_ERR PFX "Couldn't post send: scnt=%d\n", scnt); - return; + goto done; } if (scnt < cycle_iters) post_cycles_stop[scnt] = get_cycles(); @@ -1086,7 +1088,7 @@ static void wlat_test(struct krping_cb *cb) if (ne < 0) { printk(KERN_ERR PFX "poll CQ failed %d\n", ne); - return; + goto done; } if (wc.status != IB_WC_SUCCESS) { printk(KERN_ERR PFX @@ -1098,7 +1100,7 @@ static void wlat_test(struct krping_cb *cb) printk(KERN_ERR PFX "scnt=%d, rcnt=%d, ccnt=%d\n", scnt, rcnt, ccnt); - return; + goto done; } } } @@ -1122,6 +1124,7 @@ static void wlat_test(struct krping_cb *cb) scnt, cb->size, cycle_iters, (unsigned long long)sum_post, (unsigned long long)sum_poll, (unsigned long long)sum_last_poll); +done: kfree(post_cycles_start); kfree(post_cycles_stop); kfree(poll_cycles_start); @@ -1134,9 +1137,11 @@ static void bw_test(struct krping_cb *cb) int ccnt, scnt, rcnt; int iters=cb->count; struct timeval start_tv, stop_tv; - cycles_t *post_cycles_start, *post_cycles_stop; - cycles_t *poll_cycles_start, *poll_cycles_stop; - cycles_t *last_poll_cycles_start; + cycles_t *post_cycles_start = NULL; + cycles_t *post_cycles_stop = NULL; + cycles_t *poll_cycles_start = NULL; + cycles_t *poll_cycles_stop = NULL; + cycles_t *last_poll_cycles_start = NULL; cycles_t sum_poll = 0, sum_post = 0, sum_last_poll = 0; int i; int cycle_iters = 1000; @@ -1148,28 +1153,28 @@ static void bw_test(struct krping_cb *cb) post_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } post_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } last_poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!last_poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; cb->rdma_sq_wr.rkey = cb->remote_rkey; @@ -1190,7 +1195,7 @@ static void bw_test(struct krping_cb *cb) printk(KERN_ERR PFX "Couldn't post send: scnt=%d\n", scnt); - return; + goto done; } if (scnt < cycle_iters) post_cycles_stop[scnt] = get_cycles(); @@ -1215,7 +1220,7 @@ static void bw_test(struct krping_cb *cb) if (ne < 0) { printk(KERN_ERR PFX "poll CQ failed %d\n", ne); - return; + goto done; } if (wc.status != IB_WC_SUCCESS) { printk(KERN_ERR PFX @@ -1224,7 +1229,7 @@ static void bw_test(struct krping_cb *cb) printk(KERN_ERR PFX "Failed status %d: wr_id %d\n", wc.status, (int) wc.wr_id); - return; + goto done; } } } @@ -1248,6 +1253,7 @@ static void bw_test(struct krping_cb *cb) scnt, cb->size, cycle_iters, (unsigned long long)sum_post, (unsigned long long)sum_poll, (unsigned long long)sum_last_poll); +done: kfree(post_cycles_start); kfree(post_cycles_stop); kfree(poll_cycles_start); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7B944F38A1; Fri, 22 Jan 2021 12:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrb5XTYz4p9v; Fri, 22 Jan 2021 12:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FF9B1E91D; Fri, 22 Jan 2021 12:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUN6d000703; Fri, 22 Jan 2021 12:30:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUNAY000702; Fri, 22 Jan 2021 12:30:23 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:23 GMT Message-Id: <202101221230.10MCUNAY000702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1dd0ee9b5382 - stable/12 - MFC 480570dbb309: Fixes for SRIOV in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1dd0ee9b5382b0d9af0236587e3fe10b341f2a59 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:23 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1dd0ee9b5382b0d9af0236587e3fe10b341f2a59 commit 1dd0ee9b5382b0d9af0236587e3fe10b341f2a59 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:06:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:09:35 +0000 MFC 480570dbb309: Fixes for SRIOV in mlx5core. - call pci_iov_detach() on detaching from PCI device to take care of hang on destroying VFs after PF is down. - disable eswitch SRIOV support right after pci_iov_detach(), else the eswitch cleanup sometimes occur while the SRIOV flow table is still present. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 8f41f3b30ac7..ce3a06d2f495 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1663,6 +1663,11 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; +#ifdef PCI_IOV + pci_iov_detach(pdev->dev.bsddev); + mlx5_eswitch_disable_sriov(priv->eswitch); +#endif + if (mlx5_unload_one(dev, priv, true)) { mlx5_core_err(dev, "mlx5_unload_one() failed, leaked %lld bytes\n", (long long)(dev->priv.fw_pages * MLX5_ADAPTER_PAGE_SIZE)); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3F3B4F37A6; Fri, 22 Jan 2021 12:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrc5ch4z4pHx; Fri, 22 Jan 2021 12:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2BD91E5DC; Fri, 22 Jan 2021 12:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUOjo000721; Fri, 22 Jan 2021 12:30:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUOBK000720; Fri, 22 Jan 2021 12:30:24 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:24 GMT Message-Id: <202101221230.10MCUOBK000720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 316382e22e1b - stable/12 - MFC 50a9f8bbc1dd: Downgrade error about missing VSC to warning and make messages consistent in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 316382e22e1bea347fb11a0cca9d84a27ce54cc3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:27 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=316382e22e1bea347fb11a0cca9d84a27ce54cc3 commit 316382e22e1bea347fb11a0cca9d84a27ce54cc3 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:50:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:10:32 +0000 MFC 50a9f8bbc1dd: Downgrade error about missing VSC to warning and make messages consistent in mlx5core. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 2 +- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 622ea7ae0cdb..d633333cb80d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -72,7 +72,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, - "Failed to find vendor-specific capability, error %d\n", + "Unable to find vendor-specific capability, error %d\n", error); return; } diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index ce3a06d2f495..ed7dba29fe6a 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -936,7 +936,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) err = mlx5_vsc_find_cap(dev); if (err) - mlx5_core_err(dev, "Unable to find vendor specific capabilities\n"); + mlx5_core_warn(dev, "Unable to find vendor specific capabilities\n"); err = mlx5_query_hca_caps(dev); if (err) { From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D8E84F38A2; Fri, 22 Jan 2021 12:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrf5Z1vz4p53; Fri, 22 Jan 2021 12:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC8F71E76B; Fri, 22 Jan 2021 12:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUPm0000743; Fri, 22 Jan 2021 12:30:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUPub000742; Fri, 22 Jan 2021 12:30:25 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:25 GMT Message-Id: <202101221230.10MCUPub000742@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 76c0d2c74670 - stable/12 - MFC 82c7abe7785b: The "unsigned" type is the same like "unsigned int". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 76c0d2c74670e11a2429acb65cfc3b0d32907447 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:28 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=76c0d2c74670e11a2429acb65cfc3b0d32907447 commit 76c0d2c74670e11a2429acb65cfc3b0d32907447 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:58:10 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:11:20 +0000 MFC 82c7abe7785b: The "unsigned" type is the same like "unsigned int". Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index ed7dba29fe6a..648f3c808f3b 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -707,7 +707,7 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, if (warn_time_mili && time_after(jiffies, warn)) { mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %u s\n", - (unsigned int)(jiffies_to_msecs(end - warn) / 1000)); + (unsigned)(jiffies_to_msecs(end - warn) / 1000)); warn = jiffies + msecs_to_jiffies(warn_time_mili); } msleep(FW_INIT_WAIT_MS); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 608104F366B; Fri, 22 Jan 2021 12:30:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrl3ygMz4pJc; Fri, 22 Jan 2021 12:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36B4E1E91E; Fri, 22 Jan 2021 12:30:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUT0v000805; Fri, 22 Jan 2021 12:30:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUTcD000804; Fri, 22 Jan 2021 12:30:29 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:29 GMT Message-Id: <202101221230.10MCUTcD000804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2fadd4c723dc - stable/12 - MFC a00718e1dfcd: Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2fadd4c723dc38eaa0606d69c4e59d554b4d7def Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:33 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2fadd4c723dc38eaa0606d69c4e59d554b4d7def commit 2fadd4c723dc38eaa0606d69c4e59d554b4d7def Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:12:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:19:13 +0000 MFC a00718e1dfcd: Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 62 ++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b22f949fdb87..2940546b73cc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2727,6 +2727,31 @@ mlx5e_close_rqt(struct mlx5e_priv *priv) mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)); } +#define MLX5E_RSS_KEY_SIZE (10 * 4) /* bytes */ + +static void +mlx5e_get_rss_key(void *key_ptr) +{ +#ifdef RSS + rss_getkey(key_ptr); +#else + static const u32 rsskey[] = { + cpu_to_be32(0xD181C62C), + cpu_to_be32(0xF7F4DB5B), + cpu_to_be32(0x1983A2FC), + cpu_to_be32(0x943E1ADB), + cpu_to_be32(0xD9389E6B), + cpu_to_be32(0xD1039C2C), + cpu_to_be32(0xA74499AD), + cpu_to_be32(0x593D56D9), + cpu_to_be32(0xF3253C06), + cpu_to_be32(0x2ADC1FFC), + }; + CTASSERT(sizeof(rsskey) == MLX5E_RSS_KEY_SIZE); + memcpy(key_ptr, rsskey, MLX5E_RSS_KEY_SIZE); +#endif +} + static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) { @@ -2778,26 +2803,19 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ); hkey = (__be32 *) MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key); + + CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >= + MLX5E_RSS_KEY_SIZE); #ifdef RSS /* * The FreeBSD RSS implementation does currently not * support symmetric Toeplitz hashes: */ MLX5_SET(tirc, tirc, rx_hash_symmetric, 0); - rss_getkey((uint8_t *)hkey); #else MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); - hkey[0] = cpu_to_be32(0xD181C62C); - hkey[1] = cpu_to_be32(0xF7F4DB5B); - hkey[2] = cpu_to_be32(0x1983A2FC); - hkey[3] = cpu_to_be32(0x943E1ADB); - hkey[4] = cpu_to_be32(0xD9389E6B); - hkey[5] = cpu_to_be32(0xD1039C2C); - hkey[6] = cpu_to_be32(0xA74499AD); - hkey[7] = cpu_to_be32(0x593D56D9); - hkey[8] = cpu_to_be32(0xF3253C06); - hkey[9] = cpu_to_be32(0x2ADC1FFC); #endif + mlx5e_get_rss_key(hkey); break; } @@ -3225,6 +3243,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct ifreq *ifr; struct ifdownreason *ifdr; struct ifi2creq i2c; + struct ifrsskey *ifrk; + struct ifrsshash *ifrh; int error = 0; int mask = 0; int size_read = 0; @@ -3497,6 +3517,26 @@ err_i2c: ifdr->ifdr_reason = IFDR_REASON_MSG; break; + case SIOCGIFRSSKEY: + ifrk = (struct ifrsskey *)data; + ifrk->ifrk_func = RSS_FUNC_TOEPLITZ; + ifrk->ifrk_keylen = MLX5E_RSS_KEY_SIZE; + CTASSERT(sizeof(ifrk->ifrk_key) >= MLX5E_RSS_KEY_SIZE); + mlx5e_get_rss_key(ifrk->ifrk_key); + break; + + case SIOCGIFRSSHASH: + ifrh = (struct ifrsshash *)data; + ifrh->ifrh_func = RSS_FUNC_TOEPLITZ; + ifrh->ifrh_types = + RSS_TYPE_IPV4 | + RSS_TYPE_TCP_IPV4 | + RSS_TYPE_UDP_IPV4 | + RSS_TYPE_IPV6 | + RSS_TYPE_TCP_IPV6 | + RSS_TYPE_UDP_IPV6; + break; + default: error = ether_ioctl(ifp, command, data); break; From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79BBE4F38B1; Fri, 22 Jan 2021 12:30:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrk19Nvz4p2n; Fri, 22 Jan 2021 12:30:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 125E51E5DE; Fri, 22 Jan 2021 12:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUR7t000783; Fri, 22 Jan 2021 12:30:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCURNI000782; Fri, 22 Jan 2021 12:30:27 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:27 GMT Message-Id: <202101221230.10MCURNI000782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f6a79d4561a1 - stable/12 - MFC 89c0b4fa1172: Bump some copyrights in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f6a79d4561a17b92beff5011f2e3227d26ec4495 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:33 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f6a79d4561a17b92beff5011f2e3227d26ec4495 commit f6a79d4561a17b92beff5011f2e3227d26ec4495 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:21:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:12:19 +0000 MFC 89c0b4fa1172: Bump some copyrights in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c | 2 +- sys/dev/mlx5/mlx5_en/port_buffer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c index ebf61d521cec..f453b4759e27 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/dev/mlx5/mlx5_en/port_buffer.h b/sys/dev/mlx5/mlx5_en/port_buffer.h index 1a64749c4ee5..d16347f31a62 100644 --- a/sys/dev/mlx5/mlx5_en/port_buffer.h +++ b/sys/dev/mlx5/mlx5_en/port_buffer.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6C2D4F38B8; Fri, 22 Jan 2021 12:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrp592jz4pLB; Fri, 22 Jan 2021 12:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 889791E91F; Fri, 22 Jan 2021 12:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUVtu000847; Fri, 22 Jan 2021 12:30:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUVFN000844; Fri, 22 Jan 2021 12:30:31 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:31 GMT Message-Id: <202101221230.10MCUVFN000844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 125cdcc13b70 - stable/12 - MFC r353632: Replace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore. This reduces the number of references to VLAN_TRUNKDEV() in ibcore. Currently only VLAN is supported as a child interface in FreeBSD. Remove superfluous RCU locking. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 125cdcc13b7016b9edecba01eaf9d29a8c5fbd0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:35 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=125cdcc13b7016b9edecba01eaf9d29a8c5fbd0b commit 125cdcc13b7016b9edecba01eaf9d29a8c5fbd0b Author: Hans Petter Selasky AuthorDate: 2019-10-16 08:55:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:27:45 +0000 MFC r353632: Replace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore. This reduces the number of references to VLAN_TRUNKDEV() in ibcore. Currently only VLAN is supported as a child interface in FreeBSD. Remove superfluous RCU locking. Sponsored by: Mellanox Technologies --- sys/ofed/drivers/infiniband/core/core_priv.h | 10 ---------- sys/ofed/drivers/infiniband/core/ib_sa_query.c | 4 +--- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index bfb307e531f7..7e3401ddf90a 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -128,16 +128,6 @@ int ib_cache_setup_one(struct ib_device *device); void ib_cache_cleanup_one(struct ib_device *device); void ib_cache_release_one(struct ib_device *device); -static inline bool rdma_is_upper_dev_rcu(struct net_device *dev, - struct net_device *upper) -{ - - /* TODO: add support for LAGG */ - upper = VLAN_TRUNKDEV(upper); - - return (dev == upper); -} - int addr_init(void); void addr_cleanup(void); diff --git a/sys/ofed/drivers/infiniband/core/ib_sa_query.c b/sys/ofed/drivers/infiniband/core/ib_sa_query.c index 971cbba1833e..7b09b7a7e3f5 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sa_query.c +++ b/sys/ofed/drivers/infiniband/core/ib_sa_query.c @@ -702,12 +702,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, return -ENODEV; } ndev = ib_get_ndev_from_path(rec); - rcu_read_lock(); if ((ndev && ndev != resolved_dev) || (resolved_dev != idev && - !rdma_is_upper_dev_rcu(idev, resolved_dev))) + rdma_vlan_dev_real_dev(resolved_dev) != idev)) ret = -EHOSTUNREACH; - rcu_read_unlock(); dev_put(idev); dev_put(resolved_dev); if (ret) { From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31A954F384F; Fri, 22 Jan 2021 12:30:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrp6ny4z4p04; Fri, 22 Jan 2021 12:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD2A51E7B0; Fri, 22 Jan 2021 12:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUWfr000867; Fri, 22 Jan 2021 12:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUWTU000866; Fri, 22 Jan 2021 12:30:32 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:32 GMT Message-Id: <202101221230.10MCUWTU000866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: e1e64a0921c7 - stable/12 - MFC 9a47ae044b48: Bump driver versions for mlx5en(4) and mlx4en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e1e64a0921c792ab6a4461c88a572c022f2a5af1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:35 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e1e64a0921c792ab6a4461c88a572c022f2a5af1 commit e1e64a0921c792ab6a4461c88a572c022f2a5af1 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:45:26 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:27:46 +0000 MFC 9a47ae044b48: Bump driver versions for mlx5en(4) and mlx4en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/mlx4_core/mlx4.h | 6 ++++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_core.h | 4 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/dev/mlx4/mlx4_core/mlx4.h b/sys/dev/mlx4/mlx4_core/mlx4.h index a39bbeeff749..8b1afc2838e6 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4.h +++ b/sys/dev/mlx4/mlx4_core/mlx4.h @@ -53,8 +53,10 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " -#define DRV_VERSION "3.5.1" -#define DRV_RELDATE "April 2019" +#ifndef DRV_VERSION +#define DRV_VERSION "3.6.0" +#endif +#define DRV_RELDATE "December 2020" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 71ee6ae65229..2d628c7868cb 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.5.1" +#define DRV_VERSION "3.6.0" #endif -#define DRV_RELDATE "April 2019" +#define DRV_RELDATE "December 2020" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF diff --git a/sys/dev/mlx5/mlx5_core/mlx5_core.h b/sys/dev/mlx5/mlx5_core/mlx5_core.h index c898981f72e9..a7ce1b31641c 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_core.h +++ b/sys/dev/mlx5/mlx5_core/mlx5_core.h @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.2" +#define DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" extern int mlx5_core_debug_mask; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 2940546b73cc..79cf9d9b631d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -31,9 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.5.2" +#define ETH_DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 532223fffed7..9f891d5e9599 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.2" +#define DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B72E4F37B1; Fri, 22 Jan 2021 12:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrh1q5Yz4p2Y; Fri, 22 Jan 2021 12:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E962B1E5DD; Fri, 22 Jan 2021 12:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUQP8000765; Fri, 22 Jan 2021 12:30:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUQls000764; Fri, 22 Jan 2021 12:30:26 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:26 GMT Message-Id: <202101221230.10MCUQls000764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 72dcb4d94549 - stable/12 - MFC 87b3c8cc99f9: Fix spelling in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 72dcb4d945499fd7d8936e852bb6b3fee90a7114 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:32 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=72dcb4d945499fd7d8936e852bb6b3fee90a7114 commit 72dcb4d945499fd7d8936e852bb6b3fee90a7114 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:54:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:11:53 +0000 MFC 87b3c8cc99f9: Fix spelling in mlx5core. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_health.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_health.c b/sys/dev/mlx5/mlx5_core/mlx5_health.c index b9d89f1a552b..7df7870d006f 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_health.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_health.c @@ -492,7 +492,7 @@ static const char *hsynd_str(u8 synd) case MLX5_HEALTH_SYNDR_FFSER_ERR: return "FFSER error"; case MLX5_HEALTH_SYNDR_HIGH_TEMP: - return "High temprature"; + return "High temperature"; default: return "unrecognized error"; } From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBF514F366F; Fri, 22 Jan 2021 12:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrp3lP1z4pL9; Fri, 22 Jan 2021 12:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 552181E8E8; Fri, 22 Jan 2021 12:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUUAN000827; Fri, 22 Jan 2021 12:30:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUUom000826; Fri, 22 Jan 2021 12:30:30 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:30 GMT Message-Id: <202101221230.10MCUUom000826@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: bad1f0930326 - stable/12 - MFC daa150aaa30f: Properly handle case where firmware dump returns more registers on second pass in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bad1f09303263dec6eb29ae741a5489cdca086dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:34 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bad1f09303263dec6eb29ae741a5489cdca086dc commit bad1f09303263dec6eb29ae741a5489cdca086dc Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:52:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:19:14 +0000 MFC daa150aaa30f: Properly handle case where firmware dump returns more registers on second pass in mlx5core. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index d633333cb80d..09e8f9f7660a 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -115,11 +115,15 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) mlx5_core_warn(mdev, "no output from scan space\n"); goto unlock_vsc; } - mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), + + /* + * We add a sentinel element at the end of the array to + * terminate the read loop in mlx5_fwdump(), so allocate sz + 1. + */ + mdev->dump_rege = malloc((sz + 1) * sizeof(struct mlx5_crspace_regmap), M_MLX5_DUMP, M_WAITOK | M_ZERO); for (i = 0, addr = 0;;) { - MPASS(i < sz); mdev->dump_rege[i].cnt++; MLX5_VSC_SET(vsc_addr, &in, address, addr); pci_write_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, in, 4); @@ -137,13 +141,21 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) next_addr = MLX5_VSC_GET(vsc_addr, &out, address); if (next_addr == 0 || next_addr == addr) break; - if (next_addr != addr + 4) - mdev->dump_rege[++i].addr = next_addr; + if (next_addr != addr + 4) { + if (++i == sz) { + mlx5_core_err(mdev, + "Inconsistent hw crspace reads (1): sz %u i %u addr %#lx", + sz, i, (unsigned long)addr); + break; + } + mdev->dump_rege[i].addr = next_addr; + } addr = next_addr; } - if (i + 1 != sz) { + /* i == sz case already reported by loop above */ + if (i + 1 != sz && i != sz) { mlx5_core_err(mdev, - "Inconsistent hw crspace reads: sz %u i %u addr %#lx", + "Inconsistent hw crspace reads (2): sz %u i %u addr %#lx", sz, i, (unsigned long)addr); } From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 076C44F41C6; Fri, 22 Jan 2021 12:48:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFX6qdtz4rNm; Fri, 22 Jan 2021 12:48:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD4D01EB4D; Fri, 22 Jan 2021 12:48:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmWUK019802; Fri, 22 Jan 2021 12:48:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmWni019801; Fri, 22 Jan 2021 12:48:32 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:32 GMT Message-Id: <202101221248.10MCmWni019801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 026b14030bdf - stable/11 - MFC 376479200760: Fix whitespace in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 026b14030bdff05587c0db680bfba255b5df01b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:33 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=026b14030bdff05587c0db680bfba255b5df01b3 commit 026b14030bdff05587c0db680bfba255b5df01b3 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:44:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:31:34 +0000 MFC 376479200760: Fix whitespace in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index c9ab9ef779f4..5274d22548fa 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -790,7 +790,7 @@ struct mlx5e_sq { struct mtx lock; struct mtx comp_lock; struct mlx5e_sq_stats stats; - struct callout cev_callout; + struct callout cev_callout; /* data path */ #define mlx5e_sq_zero_start dma_tag From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 296B04F40C1; Fri, 22 Jan 2021 12:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFZ0jRPz4rSt; Fri, 22 Jan 2021 12:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF021E66E; Fri, 22 Jan 2021 12:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmXm7019823; Fri, 22 Jan 2021 12:48:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmX1h019822; Fri, 22 Jan 2021 12:48:33 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:33 GMT Message-Id: <202101221248.10MCmX1h019822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 8302e83a1c4e - stable/11 - MFC 376e130b4707: Fix memory leaks in error paths in krping. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 8302e83a1c4e9afb22afc839bb86a76f9e3dacbb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:34 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8302e83a1c4e9afb22afc839bb86a76f9e3dacbb commit 8302e83a1c4e9afb22afc839bb86a76f9e3dacbb Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:22:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:31:41 +0000 MFC 376e130b4707: Fix memory leaks in error paths in krping. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/contrib/rdma/krping/krping.c | 52 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index c734da36247f..46fa23f3a5e6 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -993,9 +993,11 @@ static void wlat_test(struct krping_cb *cb) volatile char *poll_buf = (char *) cb->start_buf; char *buf = (char *)cb->rdma_buf; struct timeval start_tv, stop_tv; - cycles_t *post_cycles_start, *post_cycles_stop; - cycles_t *poll_cycles_start, *poll_cycles_stop; - cycles_t *last_poll_cycles_start; + cycles_t *post_cycles_start = NULL; + cycles_t *post_cycles_stop = NULL; + cycles_t *poll_cycles_start = NULL; + cycles_t *poll_cycles_stop = NULL; + cycles_t *last_poll_cycles_start = NULL; cycles_t sum_poll = 0, sum_post = 0, sum_last_poll = 0; int i; int cycle_iters = 1000; @@ -1007,28 +1009,28 @@ static void wlat_test(struct krping_cb *cb) post_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } post_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } last_poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!last_poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; cb->rdma_sq_wr.rkey = cb->remote_rkey; @@ -1047,7 +1049,7 @@ static void wlat_test(struct krping_cb *cb) if (cb->state == ERROR) { printk(KERN_ERR PFX "state = ERROR, bailing\n"); - return; + goto done; } } } @@ -1062,7 +1064,7 @@ static void wlat_test(struct krping_cb *cb) printk(KERN_ERR PFX "Couldn't post send: scnt=%d\n", scnt); - return; + goto done; } if (scnt < cycle_iters) post_cycles_stop[scnt] = get_cycles(); @@ -1087,7 +1089,7 @@ static void wlat_test(struct krping_cb *cb) if (ne < 0) { printk(KERN_ERR PFX "poll CQ failed %d\n", ne); - return; + goto done; } if (wc.status != IB_WC_SUCCESS) { printk(KERN_ERR PFX @@ -1099,7 +1101,7 @@ static void wlat_test(struct krping_cb *cb) printk(KERN_ERR PFX "scnt=%d, rcnt=%d, ccnt=%d\n", scnt, rcnt, ccnt); - return; + goto done; } } } @@ -1123,6 +1125,7 @@ static void wlat_test(struct krping_cb *cb) scnt, cb->size, cycle_iters, (unsigned long long)sum_post, (unsigned long long)sum_poll, (unsigned long long)sum_last_poll); +done: kfree(post_cycles_start); kfree(post_cycles_stop); kfree(poll_cycles_start); @@ -1135,9 +1138,11 @@ static void bw_test(struct krping_cb *cb) int ccnt, scnt, rcnt; int iters=cb->count; struct timeval start_tv, stop_tv; - cycles_t *post_cycles_start, *post_cycles_stop; - cycles_t *poll_cycles_start, *poll_cycles_stop; - cycles_t *last_poll_cycles_start; + cycles_t *post_cycles_start = NULL; + cycles_t *post_cycles_stop = NULL; + cycles_t *poll_cycles_start = NULL; + cycles_t *poll_cycles_stop = NULL; + cycles_t *last_poll_cycles_start = NULL; cycles_t sum_poll = 0, sum_post = 0, sum_last_poll = 0; int i; int cycle_iters = 1000; @@ -1149,28 +1154,28 @@ static void bw_test(struct krping_cb *cb) post_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } post_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } last_poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!last_poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; cb->rdma_sq_wr.rkey = cb->remote_rkey; @@ -1191,7 +1196,7 @@ static void bw_test(struct krping_cb *cb) printk(KERN_ERR PFX "Couldn't post send: scnt=%d\n", scnt); - return; + goto done; } if (scnt < cycle_iters) post_cycles_stop[scnt] = get_cycles(); @@ -1216,7 +1221,7 @@ static void bw_test(struct krping_cb *cb) if (ne < 0) { printk(KERN_ERR PFX "poll CQ failed %d\n", ne); - return; + goto done; } if (wc.status != IB_WC_SUCCESS) { printk(KERN_ERR PFX @@ -1225,7 +1230,7 @@ static void bw_test(struct krping_cb *cb) printk(KERN_ERR PFX "Failed status %d: wr_id %d\n", wc.status, (int) wc.wr_id); - return; + goto done; } } } @@ -1249,6 +1254,7 @@ static void bw_test(struct krping_cb *cb) scnt, cb->size, cycle_iters, (unsigned long long)sum_post, (unsigned long long)sum_poll, (unsigned long long)sum_last_poll); +done: kfree(post_cycles_start); kfree(post_cycles_stop); kfree(poll_cycles_start); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2EED4F3E64; Fri, 22 Jan 2021 12:48:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFb3kKTz4rYc; Fri, 22 Jan 2021 12:48:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FFC81E7E2; Fri, 22 Jan 2021 12:48:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmZel019845; Fri, 22 Jan 2021 12:48:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmZVl019844; Fri, 22 Jan 2021 12:48:35 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:35 GMT Message-Id: <202101221248.10MCmZVl019844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a7c9b12baf7d - stable/11 - MFC 480570dbb309: Fixes for SRIOV in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: a7c9b12baf7dd834957cc88c23322f18399cac43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:36 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a7c9b12baf7dd834957cc88c23322f18399cac43 commit a7c9b12baf7dd834957cc88c23322f18399cac43 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:06:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:34:48 +0000 MFC 480570dbb309: Fixes for SRIOV in mlx5core. - call pci_iov_detach() on detaching from PCI device to take care of hang on destroying VFs after PF is down. - disable eswitch SRIOV support right after pci_iov_detach(), else the eswitch cleanup sometimes occur while the SRIOV flow table is still present. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index ff3671fd8d02..1887fcb4eeff 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1645,6 +1645,11 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; +#ifdef PCI_IOV + pci_iov_detach(pdev->dev.bsddev); + mlx5_eswitch_disable_sriov(priv->eswitch); +#endif + if (mlx5_unload_one(dev, priv, true)) { mlx5_core_err(dev, "mlx5_unload_one() failed, leaked %lld bytes\n", (long long)(dev->priv.fw_pages * MLX5_ADAPTER_PAGE_SIZE)); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF1F84F4071; Fri, 22 Jan 2021 12:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFd4q9nz4rfD; Fri, 22 Jan 2021 12:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 756F51E66F; Fri, 22 Jan 2021 12:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmbC6019885; Fri, 22 Jan 2021 12:48:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmbp7019884; Fri, 22 Jan 2021 12:48:37 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:37 GMT Message-Id: <202101221248.10MCmbp7019884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4ffbeb0414ed - stable/11 - MFC 82c7abe7785b: The "unsigned" type is the same like "unsigned int". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 4ffbeb0414ed5911a34fea0c148e001dfed29f52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:40 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4ffbeb0414ed5911a34fea0c148e001dfed29f52 commit 4ffbeb0414ed5911a34fea0c148e001dfed29f52 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:58:10 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:35:17 +0000 MFC 82c7abe7785b: The "unsigned" type is the same like "unsigned int". Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index fea904e84585..f7d6e51908cc 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -707,7 +707,7 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, if (warn_time_mili && time_after(jiffies, warn)) { mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %u s\n", - (unsigned int)(jiffies_to_msecs(end - warn) / 1000)); + (unsigned)(jiffies_to_msecs(end - warn) / 1000)); warn = jiffies + msecs_to_jiffies(warn_time_mili); } msleep(FW_INIT_WAIT_MS); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 310CC4F4316; Fri, 22 Jan 2021 12:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFc4ZvBz4rf8; Fri, 22 Jan 2021 12:48:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 604991EB4E; Fri, 22 Jan 2021 12:48:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmaIs019864; Fri, 22 Jan 2021 12:48:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmapW019863; Fri, 22 Jan 2021 12:48:36 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:36 GMT Message-Id: <202101221248.10MCmapW019863@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6187db1d915d - stable/11 - MFC 50a9f8bbc1dd: Downgrade error about missing VSC to warning and make messages consistent in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 6187db1d915da9f9729f0aa26f8d86fca50f894b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:37 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6187db1d915da9f9729f0aa26f8d86fca50f894b commit 6187db1d915da9f9729f0aa26f8d86fca50f894b Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:50:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:35:05 +0000 MFC 50a9f8bbc1dd: Downgrade error about missing VSC to warning and make messages consistent in mlx5core. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 2 +- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index cbd3c7187812..25aaf16147c1 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -72,7 +72,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, - "Failed to find vendor-specific capability, error %d\n", + "Unable to find vendor-specific capability, error %d\n", error); return; } diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 1887fcb4eeff..fea904e84585 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -936,7 +936,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) err = mlx5_vsc_find_cap(dev); if (err) - mlx5_core_err(dev, "Unable to find vendor specific capabilities\n"); + mlx5_core_warn(dev, "Unable to find vendor specific capabilities\n"); err = mlx5_query_hca_caps(dev); if (err) { From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 974E94F42B8; Fri, 22 Jan 2021 12:48:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFk2tnYz4rPL; Fri, 22 Jan 2021 12:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6D041E670; Fri, 22 Jan 2021 12:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmdjA019929; Fri, 22 Jan 2021 12:48:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmdgh019928; Fri, 22 Jan 2021 12:48:39 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:39 GMT Message-Id: <202101221248.10MCmdgh019928@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 198471ed6b15 - stable/11 - MFC 89c0b4fa1172: Bump some copyrights in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 198471ed6b15b6f0a1ed4b7ebf21d0a5c910d67e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:45 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=198471ed6b15b6f0a1ed4b7ebf21d0a5c910d67e commit 198471ed6b15b6f0a1ed4b7ebf21d0a5c910d67e Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:21:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:35:38 +0000 MFC 89c0b4fa1172: Bump some copyrights in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c | 2 +- sys/dev/mlx5/mlx5_en/port_buffer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c index ebf61d521cec..f453b4759e27 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/dev/mlx5/mlx5_en/port_buffer.h b/sys/dev/mlx5/mlx5_en/port_buffer.h index 1a64749c4ee5..d16347f31a62 100644 --- a/sys/dev/mlx5/mlx5_en/port_buffer.h +++ b/sys/dev/mlx5/mlx5_en/port_buffer.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F26454F41EA; Fri, 22 Jan 2021 12:48:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFl0V24z4rcF; Fri, 22 Jan 2021 12:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAAD71EBB1; Fri, 22 Jan 2021 12:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmfG7019971; Fri, 22 Jan 2021 12:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmfYA019970; Fri, 22 Jan 2021 12:48:41 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:41 GMT Message-Id: <202101221248.10MCmfYA019970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: f301a7de8b76 - stable/11 - MFC daa150aaa30f: Properly handle case where firmware dump returns more registers on second pass in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: f301a7de8b764923aaba16dad6814936e3c80ac5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:49 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f301a7de8b764923aaba16dad6814936e3c80ac5 commit f301a7de8b764923aaba16dad6814936e3c80ac5 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:52:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:36:20 +0000 MFC daa150aaa30f: Properly handle case where firmware dump returns more registers on second pass in mlx5core. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 25aaf16147c1..0eb816bf17fd 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -115,11 +115,15 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) mlx5_core_warn(mdev, "no output from scan space\n"); goto unlock_vsc; } - mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), + + /* + * We add a sentinel element at the end of the array to + * terminate the read loop in mlx5_fwdump(), so allocate sz + 1. + */ + mdev->dump_rege = malloc((sz + 1) * sizeof(struct mlx5_crspace_regmap), M_MLX5_DUMP, M_WAITOK | M_ZERO); for (i = 0, addr = 0;;) { - MPASS(i < sz); mdev->dump_rege[i].cnt++; MLX5_VSC_SET(vsc_addr, &in, address, addr); pci_write_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, in, 4); @@ -137,13 +141,21 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) next_addr = MLX5_VSC_GET(vsc_addr, &out, address); if (next_addr == 0 || next_addr == addr) break; - if (next_addr != addr + 4) - mdev->dump_rege[++i].addr = next_addr; + if (next_addr != addr + 4) { + if (++i == sz) { + mlx5_core_err(mdev, + "Inconsistent hw crspace reads (1): sz %u i %u addr %#lx", + sz, i, (unsigned long)addr); + break; + } + mdev->dump_rege[i].addr = next_addr; + } addr = next_addr; } - if (i + 1 != sz) { + /* i == sz case already reported by loop above */ + if (i + 1 != sz && i != sz) { mlx5_core_err(mdev, - "Inconsistent hw crspace reads: sz %u i %u addr %#lx", + "Inconsistent hw crspace reads (2): sz %u i %u addr %#lx", sz, i, (unsigned long)addr); } From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F7B04F3E68; Fri, 22 Jan 2021 12:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFg45lKz4rTQ; Fri, 22 Jan 2021 12:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B19D1ECDA; Fri, 22 Jan 2021 12:48:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmcYX019907; Fri, 22 Jan 2021 12:48:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmcsF019906; Fri, 22 Jan 2021 12:48:38 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:38 GMT Message-Id: <202101221248.10MCmcsF019906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 71c34db5ba79 - stable/11 - MFC 87b3c8cc99f9: Fix spelling in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 71c34db5ba7945dbcf84ff88f401af70c5830396 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:43 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=71c34db5ba7945dbcf84ff88f401af70c5830396 commit 71c34db5ba7945dbcf84ff88f401af70c5830396 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:54:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:35:27 +0000 MFC 87b3c8cc99f9: Fix spelling in mlx5core. Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_health.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_health.c b/sys/dev/mlx5/mlx5_core/mlx5_health.c index b9d89f1a552b..7df7870d006f 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_health.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_health.c @@ -492,7 +492,7 @@ static const char *hsynd_str(u8 synd) case MLX5_HEALTH_SYNDR_FFSER_ERR: return "FFSER error"; case MLX5_HEALTH_SYNDR_HIGH_TEMP: - return "High temprature"; + return "High temperature"; default: return "unrecognized error"; } From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7E164F4405; Fri, 22 Jan 2021 12:48:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFs1Hgmz4rlW; Fri, 22 Jan 2021 12:48:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CEFF1EB50; Fri, 22 Jan 2021 12:48:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmk88020055; Fri, 22 Jan 2021 12:48:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmk23020054; Fri, 22 Jan 2021 12:48:46 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:46 GMT Message-Id: <202101221248.10MCmk23020054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2cd3c13be316 - stable/11 - MFC r367611: mlx5en: stop ignoring pauses and flow in the media reqs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 2cd3c13be316974ac580ad55809e619ef230712f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:51 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2cd3c13be316974ac580ad55809e619ef230712f commit 2cd3c13be316974ac580ad55809e619ef230712f Author: Konstantin Belousov AuthorDate: 2020-11-19 09:16:22 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:47:15 +0000 MFC r367611: mlx5en: stop ignoring pauses and flow in the media reqs. --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 6ae7f79483ff..81d18152ece2 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4074,8 +4074,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* Set default media status */ priv->media_status_last = IFM_AVALID; - priv->media_active_last = IFM_ETHER | IFM_AUTO | - IFM_ETH_RXPAUSE | IFM_FDX; + priv->media_active_last = IFM_ETHER | IFM_AUTO | IFM_FDX; /* setup default pauseframes configuration */ mlx5e_setup_pauseframes(priv); @@ -4095,7 +4094,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_en_err(ifp, "Query port media capability failed, %d\n", err); } - ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, + ifmedia_init(&priv->media, IFM_IMASK, mlx5e_media_change, mlx5e_media_status); speeds_num = ext ? MLX5E_EXT_LINK_SPEEDS_NUMBER : MLX5E_LINK_SPEEDS_NUMBER; From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7536A4F40E8; Fri, 22 Jan 2021 12:48:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFn1Z2Mz4rlB; Fri, 22 Jan 2021 12:48:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20F751E56E; Fri, 22 Jan 2021 12:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmgpM019993; Fri, 22 Jan 2021 12:48:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmgEK019992; Fri, 22 Jan 2021 12:48:42 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:42 GMT Message-Id: <202101221248.10MCmgEK019992@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 1f1f6b4cb5ee - stable/11 - MFC r353632: Replace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore. This reduces the number of references to VLAN_TRUNKDEV() in ibcore. Currently only VLAN is supported as a child interface in FreeBSD. Remove superfluous RCU locking. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 1f1f6b4cb5eebe79c8dc5761a865e9a65d5dd034 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:50 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1f1f6b4cb5eebe79c8dc5761a865e9a65d5dd034 commit 1f1f6b4cb5eebe79c8dc5761a865e9a65d5dd034 Author: Hans Petter Selasky AuthorDate: 2019-10-16 08:55:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:36:28 +0000 MFC r353632: Replace rdma_is_upper_dev_rcu() with rdma_vlan_dev_real_dev() in ibcore. This reduces the number of references to VLAN_TRUNKDEV() in ibcore. Currently only VLAN is supported as a child interface in FreeBSD. Remove superfluous RCU locking. Sponsored by: Mellanox Technologies --- sys/ofed/drivers/infiniband/core/core_priv.h | 10 ---------- sys/ofed/drivers/infiniband/core/ib_sa_query.c | 4 +--- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/core_priv.h b/sys/ofed/drivers/infiniband/core/core_priv.h index 97ddb9e73a2a..6385afe68f9a 100644 --- a/sys/ofed/drivers/infiniband/core/core_priv.h +++ b/sys/ofed/drivers/infiniband/core/core_priv.h @@ -126,16 +126,6 @@ int ib_cache_setup_one(struct ib_device *device); void ib_cache_cleanup_one(struct ib_device *device); void ib_cache_release_one(struct ib_device *device); -static inline bool rdma_is_upper_dev_rcu(struct net_device *dev, - struct net_device *upper) -{ - - /* TODO: add support for LAGG */ - upper = VLAN_TRUNKDEV(upper); - - return (dev == upper); -} - int addr_init(void); void addr_cleanup(void); diff --git a/sys/ofed/drivers/infiniband/core/ib_sa_query.c b/sys/ofed/drivers/infiniband/core/ib_sa_query.c index 971cbba1833e..7b09b7a7e3f5 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sa_query.c +++ b/sys/ofed/drivers/infiniband/core/ib_sa_query.c @@ -702,12 +702,10 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, return -ENODEV; } ndev = ib_get_ndev_from_path(rec); - rcu_read_lock(); if ((ndev && ndev != resolved_dev) || (resolved_dev != idev && - !rdma_is_upper_dev_rcu(idev, resolved_dev))) + rdma_vlan_dev_real_dev(resolved_dev) != idev)) ret = -EHOSTUNREACH; - rcu_read_unlock(); dev_put(idev); dev_put(resolved_dev); if (ret) { From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0ED24F41DF; Fri, 22 Jan 2021 12:48:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFk2h09z4rWr; Fri, 22 Jan 2021 12:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8A201EBB0; Fri, 22 Jan 2021 12:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmeA0019949; Fri, 22 Jan 2021 12:48:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCme5s019948; Fri, 22 Jan 2021 12:48:40 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:40 GMT Message-Id: <202101221248.10MCme5s019948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 43bf82ace68d - stable/11 - MFC a00718e1dfcd: Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 43bf82ace68d9a9bb9315e829b0a548b33d2cfb3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:46 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=43bf82ace68d9a9bb9315e829b0a548b33d2cfb3 commit 43bf82ace68d9a9bb9315e829b0a548b33d2cfb3 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:12:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:36:07 +0000 MFC a00718e1dfcd: Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 62 ++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 5621145432c6..cbb5d20ed900 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2582,6 +2582,31 @@ mlx5e_close_rqt(struct mlx5e_priv *priv) mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)); } +#define MLX5E_RSS_KEY_SIZE (10 * 4) /* bytes */ + +static void +mlx5e_get_rss_key(void *key_ptr) +{ +#ifdef RSS + rss_getkey(key_ptr); +#else + static const u32 rsskey[] = { + cpu_to_be32(0xD181C62C), + cpu_to_be32(0xF7F4DB5B), + cpu_to_be32(0x1983A2FC), + cpu_to_be32(0x943E1ADB), + cpu_to_be32(0xD9389E6B), + cpu_to_be32(0xD1039C2C), + cpu_to_be32(0xA74499AD), + cpu_to_be32(0x593D56D9), + cpu_to_be32(0xF3253C06), + cpu_to_be32(0x2ADC1FFC), + }; + CTASSERT(sizeof(rsskey) == MLX5E_RSS_KEY_SIZE); + memcpy(key_ptr, rsskey, MLX5E_RSS_KEY_SIZE); +#endif +} + static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) { @@ -2633,26 +2658,19 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ); hkey = (__be32 *) MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key); + + CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >= + MLX5E_RSS_KEY_SIZE); #ifdef RSS /* * The FreeBSD RSS implementation does currently not * support symmetric Toeplitz hashes: */ MLX5_SET(tirc, tirc, rx_hash_symmetric, 0); - rss_getkey((uint8_t *)hkey); #else MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); - hkey[0] = cpu_to_be32(0xD181C62C); - hkey[1] = cpu_to_be32(0xF7F4DB5B); - hkey[2] = cpu_to_be32(0x1983A2FC); - hkey[3] = cpu_to_be32(0x943E1ADB); - hkey[4] = cpu_to_be32(0xD9389E6B); - hkey[5] = cpu_to_be32(0xD1039C2C); - hkey[6] = cpu_to_be32(0xA74499AD); - hkey[7] = cpu_to_be32(0x593D56D9); - hkey[8] = cpu_to_be32(0xF3253C06); - hkey[9] = cpu_to_be32(0x2ADC1FFC); #endif + mlx5e_get_rss_key(hkey); break; } @@ -3080,6 +3098,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct ifreq *ifr; struct ifdownreason *ifdr; struct ifi2creq i2c; + struct ifrsskey *ifrk; + struct ifrsshash *ifrh; int error = 0; int mask = 0; int size_read = 0; @@ -3342,6 +3362,26 @@ err_i2c: ifdr->ifdr_reason = IFDR_REASON_MSG; break; + case SIOCGIFRSSKEY: + ifrk = (struct ifrsskey *)data; + ifrk->ifrk_func = RSS_FUNC_TOEPLITZ; + ifrk->ifrk_keylen = MLX5E_RSS_KEY_SIZE; + CTASSERT(sizeof(ifrk->ifrk_key) >= MLX5E_RSS_KEY_SIZE); + mlx5e_get_rss_key(ifrk->ifrk_key); + break; + + case SIOCGIFRSSHASH: + ifrh = (struct ifrsshash *)data; + ifrh->ifrh_func = RSS_FUNC_TOEPLITZ; + ifrh->ifrh_types = + RSS_TYPE_IPV4 | + RSS_TYPE_TCP_IPV4 | + RSS_TYPE_UDP_IPV4 | + RSS_TYPE_IPV6 | + RSS_TYPE_TCP_IPV6 | + RSS_TYPE_UDP_IPV6; + break; + default: error = ether_ioctl(ifp, command, data); break; From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33E464F4234; Fri, 22 Jan 2021 12:48:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFw4x8xz4rcm; Fri, 22 Jan 2021 12:48:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFC7F1EBB3; Fri, 22 Jan 2021 12:48:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmmLv020095; Fri, 22 Jan 2021 12:48:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmmFL020094; Fri, 22 Jan 2021 12:48:48 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:48 GMT Message-Id: <202101221248.10MCmmFL020094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: e87e3e82f3a0 - stable/11 - MFC 9a47ae044b48: Bump driver versions for mlx5en(4) and mlx4en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: e87e3e82f3a062856118ed42751b498277eb09a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:53 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e87e3e82f3a062856118ed42751b498277eb09a5 commit e87e3e82f3a062856118ed42751b498277eb09a5 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:45:26 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:47:16 +0000 MFC 9a47ae044b48: Bump driver versions for mlx5en(4) and mlx4en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/mlx4_core/mlx4.h | 6 ++++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_core.h | 4 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/dev/mlx4/mlx4_core/mlx4.h b/sys/dev/mlx4/mlx4_core/mlx4.h index a39bbeeff749..8b1afc2838e6 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4.h +++ b/sys/dev/mlx4/mlx4_core/mlx4.h @@ -53,8 +53,10 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " -#define DRV_VERSION "3.5.1" -#define DRV_RELDATE "April 2019" +#ifndef DRV_VERSION +#define DRV_VERSION "3.6.0" +#endif +#define DRV_RELDATE "December 2020" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index cbab0c474fdc..a4b62615798c 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.5.1" +#define DRV_VERSION "3.6.0" #endif -#define DRV_RELDATE "April 2019" +#define DRV_RELDATE "December 2020" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF diff --git a/sys/dev/mlx5/mlx5_core/mlx5_core.h b/sys/dev/mlx5/mlx5_core/mlx5_core.h index c898981f72e9..a7ce1b31641c 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_core.h +++ b/sys/dev/mlx5/mlx5_core/mlx5_core.h @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.2" +#define DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" extern int mlx5_core_debug_mask; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 4ab456c4efc9..d1288ddd6f23 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -31,9 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.5.2" +#define ETH_DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index d72d445f59fd..44f6084747c5 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.2" +#define DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3080C4F4485; Fri, 22 Jan 2021 12:48:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFv50bGz4rcj; Fri, 22 Jan 2021 12:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCAE21E56F; Fri, 22 Jan 2021 12:48:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmlrv020075; Fri, 22 Jan 2021 12:48:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmlMU020074; Fri, 22 Jan 2021 12:48:47 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:47 GMT Message-Id: <202101221248.10MCmlMU020074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2695791408f5 - stable/11 - MFC r367612: mlx5en: Set ifmr_current same as ifmr_active. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 2695791408f5da6df47cdc83307f9bd2af3b6750 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:52 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2695791408f5da6df47cdc83307f9bd2af3b6750 commit 2695791408f5da6df47cdc83307f9bd2af3b6750 Author: Konstantin Belousov AuthorDate: 2020-11-19 09:17:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:47:16 +0000 MFC r367612: mlx5en: Set ifmr_current same as ifmr_active. --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 81d18152ece2..4ab456c4efc9 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -484,7 +484,7 @@ mlx5e_media_status(struct ifnet *dev, struct ifmediareq *ifmr) struct mlx5e_priv *priv = dev->if_softc; ifmr->ifm_status = priv->media_status_last; - ifmr->ifm_active = priv->media_active_last | + ifmr->ifm_current = ifmr->ifm_active = priv->media_active_last | (priv->params.rx_pauseframe_control ? IFM_ETH_RXPAUSE : 0) | (priv->params.tx_pauseframe_control ? IFM_ETH_TXPAUSE : 0); From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31FBC4F42BA; Fri, 22 Jan 2021 12:48:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFm3gr4z4rcS; Fri, 22 Jan 2021 12:48:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FB051EB4F; Fri, 22 Jan 2021 12:48:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmiFU020011; Fri, 22 Jan 2021 12:48:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmiw8020010; Fri, 22 Jan 2021 12:48:44 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:44 GMT Message-Id: <202101221248.10MCmiw8020010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c408d03b378a - stable/11 - MFC r367609: mlx5en: Refactor repeated code to register media type to mlx5e_ifm_add(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: c408d03b378aeebba1faa09fe62c1562ad34295a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:49 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c408d03b378aeebba1faa09fe62c1562ad34295a commit c408d03b378aeebba1faa09fe62c1562ad34295a Author: Konstantin Belousov AuthorDate: 2020-11-19 09:13:23 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:47:15 +0000 MFC r367609: mlx5en: Refactor repeated code to register media type to mlx5e_ifm_add(). --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index cbb5d20ed900..77ed6f78aafc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3913,6 +3913,14 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) PRIV_UNLOCK(priv); } +static void +mlx5e_ifm_add(struct mlx5e_priv *priv, int type) +{ + ifmedia_add(&priv->media, type | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); +} + static void * mlx5e_create_ifp(struct mlx5_core_dev *mdev) { @@ -4088,21 +4096,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5e_mode_table[i][j]; if (media_entry.baudrate == 0) continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) { - ifmedia_add(&priv->media, - media_entry.subtype | - IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, - media_entry.subtype | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - } + if (MLX5E_PROT_MASK(i) & eth_proto_cap) + mlx5e_ifm_add(priv, media_entry.subtype); } } - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + mlx5e_ifm_add(priv, IFM_AUTO); /* Set autoselect by default */ ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:48:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67E8F4F40E7; Fri, 22 Jan 2021 12:48:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfFn32JGz4rZK; Fri, 22 Jan 2021 12:48:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 521281EBB2; Fri, 22 Jan 2021 12:48:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCmj02020033; Fri, 22 Jan 2021 12:48:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCmj0J020032; Fri, 22 Jan 2021 12:48:45 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:48:45 GMT Message-Id: <202101221248.10MCmj0J020032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 65dd92f6043d - stable/11 - MFC r367610: mlx5en: Register all combinations of FDX/RXPAUSE/TXPAUSE as valid media types. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 65dd92f6043da77865e2900b6aab75e75cecdb4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:48:50 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=65dd92f6043da77865e2900b6aab75e75cecdb4c commit 65dd92f6043da77865e2900b6aab75e75cecdb4c Author: Konstantin Belousov AuthorDate: 2020-11-19 09:15:04 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:47:15 +0000 MFC r367610: mlx5en: Register all combinations of FDX/RXPAUSE/TXPAUSE as valid media types. --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 77ed6f78aafc..6ae7f79483ff 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3917,6 +3917,15 @@ static void mlx5e_ifm_add(struct mlx5e_priv *priv, int type) { ifmedia_add(&priv->media, type | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_ETH_TXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_TXPAUSE, 0, NULL); ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); } From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 13:59:27 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E11C4F5CE9; Fri, 22 Jan 2021 13:59:27 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMgqM14kzz3Dd7; Fri, 22 Jan 2021 13:59:27 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 1099A2CEB6; Fri, 22 Jan 2021 13:59:27 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f174.google.com with SMTP id 19so5141423qkh.3; Fri, 22 Jan 2021 05:59:27 -0800 (PST) X-Gm-Message-State: AOAM5305aP/HuYyeCCIU/Qd7M6yrEzmjhLxFywpKUenmOJMAoncVfQa9 cdHK1ZO8XQbpEVkDnOg4/h/O4ZK+Obyo2UPgtFM= X-Google-Smtp-Source: ABdhPJzVRovve2g5YeGocMziZFy5OBtX9A8PIQ8FCm8DjVaumbHInoKZI6kwVCg6eyGuRJi8xVyHzB0rQmApAKKdUpk= X-Received: by 2002:a37:a342:: with SMTP id m63mr4985169qke.120.1611323966658; Fri, 22 Jan 2021 05:59:26 -0800 (PST) MIME-Version: 1.0 References: <202101221230.10MCULuw000439@gitrepo.freebsd.org> In-Reply-To: <202101221230.10MCULuw000439@gitrepo.freebsd.org> From: Kyle Evans Date: Fri, 22 Jan 2021 07:59:13 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: e006b6a2c1b9 - stable/12 - MFC 376479200760: Fix whitespace in mlx5en(4). To: Hans Petter Selasky Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 13:59:27 -0000 On Fri, Jan 22, 2021 at 6:30 AM Hans Petter Selasky wrote: > > The branch stable/12 has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e006b6a2c1b9a34e008ffbb4cabf86315f7873ff > > commit e006b6a2c1b9a34e008ffbb4cabf86315f7873ff > Author: Hans Petter Selasky > AuthorDate: 2021-01-08 11:44:42 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-01-22 12:08:03 +0000 > > MFC 376479200760: > Fix whitespace in mlx5en(4). > > Sponsored by: Mellanox Technologies // NVIDIA Networking > --- For the record, as per [0], these should have been cherry-picked using -x which adds a " (cherry picked from commit ...)" annotation at the bottom. With the annotation in place, the leading MFC line can be dropped and the original message otherwise preserved (dropping any metadata at the bottom that makes sense, e.g. "MFC after" tags). The -x line helps at least the MFC tracker match the commit from main. Thanks, Kyle Evans [0] https://github.com/bsdimp/freebsd-git-docs/blob/main/MFC.md From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 14:19:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8ECD4F6502; Fri, 22 Jan 2021 14:19:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhGJ56H1z3FRC; Fri, 22 Jan 2021 14:19:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4D29E260206; Fri, 22 Jan 2021 15:19:13 +0100 (CET) Subject: Re: git: e006b6a2c1b9 - stable/12 - MFC 376479200760: Fix whitespace in mlx5en(4). To: Kyle Evans Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org, Warner Losh References: <202101221230.10MCULuw000439@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <30b9e294-6767-abd4-e3a3-7a2d268323f9@selasky.org> Date: Fri, 22 Jan 2021 15:19:01 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DMhGJ56H1z3FRC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:19:20 -0000 On 1/22/21 2:59 PM, Kyle Evans wrote: > For the record, as per [0], these should have been cherry-picked using > -x which adds a " (cherry picked from commit ...)" annotation at the > bottom. With the annotation in place, the leading MFC line can be > dropped and the original message otherwise preserved (dropping any > metadata at the bottom that makes sense, e.g. "MFC after" tags). The > -x line helps at least the MFC tracker match the commit from main. > > Thanks, > > Kyle Evans > > [0]https://github.com/bsdimp/freebsd-git-docs/blob/main/MFC.md Hi Kyle, Shouldn't the committers-guide be updated to reflect this is now the official way to do it? https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/ I see no problem keeping MFC at the beginning of commit e-mails. Makes it easier to sort, and it is backwards compatible! MFC rXXXXX refers to a SVN commit. MFC [0-9 A-F] indicate a GIT commit. BTW: When MFC-ing a commit which was done using SVN, should we use MFC r or refer to the git hash? --HPS From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 14:26:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4F614F6453; Fri, 22 Jan 2021 14:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhQ74H1Mz3G5Z; Fri, 22 Jan 2021 14:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85F5D1FED6; Fri, 22 Jan 2021 14:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MEQ7ok049969; Fri, 22 Jan 2021 14:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MEQ7TJ049968; Fri, 22 Jan 2021 14:26:07 GMT (envelope-from git) Date: Fri, 22 Jan 2021 14:26:07 GMT Message-Id: <202101221426.10MEQ7TJ049968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: d5bd29ed505f - stable/13 - Revert "[mips] revert r366664 - flip mips back from -O2 to -O" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d5bd29ed505f535b52673604951d018a43d72579 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:26:07 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d5bd29ed505f535b52673604951d018a43d72579 commit d5bd29ed505f535b52673604951d018a43d72579 Author: Mateusz Guzik AuthorDate: 2021-01-22 10:17:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 14:25:45 +0000 Revert "[mips] revert r366664 - flip mips back from -O2 to -O" This reverts commit bd72252aace382921840ddbceea712b96f4ad242. The commit at hand breaks the build for all mips targets and does not have a one-liner fix. make[5]: "/usr/src/share/mk/sys.mk" line 169: Malformed conditional (${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc") (cherry picked from commit bb3b6995c4d0ced1a87ec57407f216ece69ab674) --- share/mk/sys.mk | 7 ------- 1 file changed, 7 deletions(-) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 72f458397683..8f456b28593a 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -166,14 +166,7 @@ CC ?= c89 CFLAGS ?= -O .else CC ?= cc -.if ${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc" -# Note: there are currently issues generating code gcc-6.x targeting -# code for at least mips32. The system hits infinite page faults -# when starting /sbin/init if -O2 is used. -CFLAGS ?= -O -pipe -.else CFLAGS ?= -O2 -pipe -.endif .if defined(NO_STRICT_ALIASING) CFLAGS += -fno-strict-aliasing .endif From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 14:26:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27A164F679E; Fri, 22 Jan 2021 14:26:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhQ85y2Nz3Fx1; Fri, 22 Jan 2021 14:26:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEA642013D; Fri, 22 Jan 2021 14:26:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MEQ8wG049987; Fri, 22 Jan 2021 14:26:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MEQ842049986; Fri, 22 Jan 2021 14:26:08 GMT (envelope-from git) Date: Fri, 22 Jan 2021 14:26:08 GMT Message-Id: <202101221426.10MEQ842049986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 51d73a3e46cf - stable/13 - newvers.sh: restore reporting branch names MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 51d73a3e46cf9118bc0464c9c0aa99dca7aafe9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:26:09 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=51d73a3e46cf9118bc0464c9c0aa99dca7aafe9a commit 51d73a3e46cf9118bc0464c9c0aa99dca7aafe9a Author: Mateusz Guzik AuthorDate: 2021-01-22 13:00:24 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 14:25:48 +0000 newvers.sh: restore reporting branch names It got removed arguably without much discussion in the commit which added gitup support. (cherry picked from commit ace7209ce04d0e4dc0e84d5e2eb27fc762e67a01) --- sys/conf/newvers.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 2afaa3a92f8e..8739cf6fc498 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -258,6 +258,10 @@ if [ -n "$git_cmd" ] ; then git="c${git_cnt}-g${git}" fi fi + git_b=$($git_cmd rev-parse --abbrev-ref HEAD) + if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then + git="${git_b}-${git}" + fi if git_tree_modified; then git="${git}-dirty" modified=yes From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 14:26:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 703954F6459; Fri, 22 Jan 2021 14:26:22 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhQM3dwTz3GMJ; Fri, 22 Jan 2021 14:26:19 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 94F922D4FC; Fri, 22 Jan 2021 14:26:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f42.google.com with SMTP id et9so2681762qvb.10; Fri, 22 Jan 2021 06:26:15 -0800 (PST) X-Gm-Message-State: AOAM5302PIAgART+gQGRSMMVR7iUcSp9tlZFNQSLPJ+6X15OjkT+8qOX BmJY93yRzMQ+f+n1TsI7QNk0KsCRK4a2pPexo1g= X-Google-Smtp-Source: ABdhPJy1mMw2MZiT93INOkgbXNN920r5PGNm+lRYYMvU9ECwXETA5lN7GWin45ZuzZU73Zh05GvWZBM+EpcLnid+wrk= X-Received: by 2002:a0c:8601:: with SMTP id p1mr4742432qva.22.1611325575002; Fri, 22 Jan 2021 06:26:15 -0800 (PST) MIME-Version: 1.0 References: <202101221230.10MCULuw000439@gitrepo.freebsd.org> <30b9e294-6767-abd4-e3a3-7a2d268323f9@selasky.org> In-Reply-To: <30b9e294-6767-abd4-e3a3-7a2d268323f9@selasky.org> From: Kyle Evans Date: Fri, 22 Jan 2021 08:26:02 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: e006b6a2c1b9 - stable/12 - MFC 376479200760: Fix whitespace in mlx5en(4). To: Hans Petter Selasky Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org, Warner Losh Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:26:22 -0000 On Fri, Jan 22, 2021 at 8:19 AM Hans Petter Selasky wrote: > > On 1/22/21 2:59 PM, Kyle Evans wrote: > > For the record, as per [0], these should have been cherry-picked using > > -x which adds a " (cherry picked from commit ...)" annotation at the > > bottom. With the annotation in place, the leading MFC line can be > > dropped and the original message otherwise preserved (dropping any > > metadata at the bottom that makes sense, e.g. "MFC after" tags). The > > -x line helps at least the MFC tracker match the commit from main. > > > > Thanks, > > > > Kyle Evans > > > > [0]https://github.com/bsdimp/freebsd-git-docs/blob/main/MFC.md > > Hi Kyle, > > Shouldn't the committers-guide be updated to reflect this is now the > official way to do it? > > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/ > The committers guide wasn't going to be updated with the contents of Warner's freebsd-git-docs until the doc switch to a less arcane format. > I see no problem keeping MFC at the beginning of commit e-mails. Makes > it easier to sort, and it is backwards compatible! > > MFC rXXXXX refers to a SVN commit. > MFC [0-9 A-F] indicate a GIT commit. > > BTW: When MFC-ing a commit which was done using SVN, should we use MFC r > or refer to the git hash? > I can see a good argument for wanting to record the svn revision number where that's relevant, but I'd propose not prepending MFC when cherry-picking any git-originating commits so that oneline/shortlog or whatever it's called is as usable on stable as it is on main going forward. To be clear, I think the recommendation should be to: 1.) Use cherry-pick -x regardless so that the MFC tooling doesn't need to grok both going forward, and 2.) Optionally prepend an "MFC rXXXXXX" if it came from svn Thanks, Kyle Evans From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 14:30:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 753024F6A95; Fri, 22 Jan 2021 14:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhVg2ySDz3GlM; Fri, 22 Jan 2021 14:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 585271FDBA; Fri, 22 Jan 2021 14:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MEU3k6052049; Fri, 22 Jan 2021 14:30:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MEU3rW052047; Fri, 22 Jan 2021 14:30:03 GMT (envelope-from git) Date: Fri, 22 Jan 2021 14:30:03 GMT Message-Id: <202101221430.10MEU3rW052047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 62bcf61ab170 - stable/13 - powerpc: fix build without DDB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 62bcf61ab17062e1e63f55f0e993777552e5a513 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:30:03 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=62bcf61ab17062e1e63f55f0e993777552e5a513 commit 62bcf61ab17062e1e63f55f0e993777552e5a513 Author: Mateusz Guzik AuthorDate: 2021-01-22 14:29:01 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 14:29:55 +0000 powerpc: fix build without DDB (cherry picked from commit eb61de5b7871e2ee2122b31418d1cd50ae43964e) --- sys/powerpc/powerpc/machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 2bcc0ceed015..716f7e43db48 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -263,8 +263,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, char *env; void *kmdp = NULL; bool ofw_bootargs = false; - bool symbols_provided = false; #ifdef DDB + bool symbols_provided = false; vm_offset_t ksym_start; vm_offset_t ksym_end; vm_offset_t ksym_sz; From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 16:27:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30B684F86C8; Fri, 22 Jan 2021 16:27:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMl6b0sNPz3NfR; Fri, 22 Jan 2021 16:27:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 107AD21990; Fri, 22 Jan 2021 16:27:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MGRp3i006311; Fri, 22 Jan 2021 16:27:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MGRotF006310; Fri, 22 Jan 2021 16:27:50 GMT (envelope-from git) Date: Fri, 22 Jan 2021 16:27:50 GMT Message-Id: <202101221627.10MGRotF006310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 551119253819 - stable/12 - Fix dependency cleanup hack for pf_ruleset.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5511192538198cf1d5d3a9b3ab802f2af59c798e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 16:27:51 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5511192538198cf1d5d3a9b3ab802f2af59c798e commit 5511192538198cf1d5d3a9b3ab802f2af59c798e Author: Kristof Provost AuthorDate: 2021-01-22 16:24:07 +0000 Commit: Kristof Provost CommitDate: 2021-01-22 16:25:38 +0000 Fix dependency cleanup hack for pf_ruleset.c In 4046f57601eaa0bcd1ec8496e1280939b948aa46 we added a dependency cleanup to cope with the pf_ruleset.c changes. This commit failed to include '; \' at the end of the shell lines in the make target, causing build failures. PR: 252910 --- Makefile.inc1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index ca842d182af2..be0d0d2a2334 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1005,9 +1005,9 @@ _cleanobj_fast_depend_hack: .PHONY .for f in pf_ruleset @if [ -e "${OBJTOP}"/sbin/pfctl/.depend.${f}.o ] && \ egrep -qw "sys/netpfil/pf/${f}.c" \ - "${OBJTOP}"/sbin/pfctl/.depend.${f}.o; then - echo "Removing old ${f} dependency file" - rm -rf "${OBJTOP}"/sbin/pfctl/.depend.${f}.o + "${OBJTOP}"/sbin/pfctl/.depend.${f}.o; then \ + echo "Removing old ${f} dependency file"; \ + rm -rf "${OBJTOP}"/sbin/pfctl/.depend.${f}.o; \ fi .endfor From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 16:43:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27AFC4F8F30; Fri, 22 Jan 2021 16:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMlSf0ctdz3Pwv; Fri, 22 Jan 2021 16:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0821F21C54; Fri, 22 Jan 2021 16:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MGhTKR031906; Fri, 22 Jan 2021 16:43:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MGhT2f031905; Fri, 22 Jan 2021 16:43:29 GMT (envelope-from git) Date: Fri, 22 Jan 2021 16:43:29 GMT Message-Id: <202101221643.10MGhT2f031905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Kubaj Subject: git: 035f4ea71e6b - stable/13 - powerpc64le: don't enable COMPAT_* options in GENERIC64LE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 035f4ea71e6bef713c06e1fece48518f9a47441c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 16:43:30 -0000 The branch stable/13 has been updated by pkubaj (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=035f4ea71e6bef713c06e1fece48518f9a47441c commit 035f4ea71e6bef713c06e1fece48518f9a47441c Author: Piotr Kubaj AuthorDate: 2021-01-22 16:39:15 +0000 Commit: Piotr Kubaj CommitDate: 2021-01-22 16:43:13 +0000 powerpc64le: don't enable COMPAT_* options in GENERIC64LE Support for powerpc64le appeared in 13, so there's no point to enable COMPAT_* for older releases. Also disable COMPAT_FREEBSD32, since there's no powerpcle. Since that may change in the future, leave the option commented out. Approved by: bdragon, jhibbits (on IRC) --- sys/powerpc/conf/GENERIC64LE | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index 93afcbfe1ef5..fd87f22df334 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -65,14 +65,7 @@ options TMPFS #Efficient memory filesystem options GEOM_PART_APM #Apple Partition Maps. options GEOM_PART_GPT #GUID Partition Tables. options GEOM_LABEL #Provides labelization -options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpc binaries -options COMPAT_FREEBSD5 #Compatible with FreeBSD5 -options COMPAT_FREEBSD6 #Compatible with FreeBSD6 -options COMPAT_FREEBSD7 #Compatible with FreeBSD7 -options COMPAT_FREEBSD9 # Compatible with FreeBSD9 -options COMPAT_FREEBSD10 # Compatible with FreeBSD10 -options COMPAT_FREEBSD11 # Compatible with FreeBSD11 -options COMPAT_FREEBSD12 # Compatible with FreeBSD12 +#options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpc binaries options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 16:43:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41C744F911F; Fri, 22 Jan 2021 16:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMlT71P1vz3Q8k; Fri, 22 Jan 2021 16:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22C0121D51; Fri, 22 Jan 2021 16:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MGht2W032067; Fri, 22 Jan 2021 16:43:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MGht1i032066; Fri, 22 Jan 2021 16:43:55 GMT (envelope-from git) Date: Fri, 22 Jan 2021 16:43:55 GMT Message-Id: <202101221643.10MGht1i032066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: bec67897b0c5 - stable/12 - Add Intel Gemini Lake AHCI ID. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bec67897b0c501f6bc32a6f5072087e11fe5622a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 16:43:55 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bec67897b0c501f6bc32a6f5072087e11fe5622a commit bec67897b0c501f6bc32a6f5072087e11fe5622a Author: Alexander Motin AuthorDate: 2021-01-15 14:53:35 +0000 Commit: Alexander Motin CommitDate: 2021-01-22 16:43:45 +0000 Add Intel Gemini Lake AHCI ID. Submitted by: Dmitry Luhtionov (cherry picked from commit 006e2b2b8285842216ceb914a4cf828c89c2d7f7) --- sys/dev/ahci/ahci_pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 1ff0d5a873a1..ab440e0c8522 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -180,6 +180,7 @@ static const struct { {0x1f3e8086, 0x00, "Intel Avoton (RAID)", 0}, {0x1f3f8086, 0x00, "Intel Avoton (RAID)", 0}, {0x23a38086, 0x00, "Intel Coleto Creek", 0}, + {0x31e38086, 0x00, "Intel Gemini Lake", 0}, {0x5ae38086, 0x00, "Intel Apollo Lake", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 16:44:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 703BB4F9387; Fri, 22 Jan 2021 16:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMlV2626Yz3QKR; Fri, 22 Jan 2021 16:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C249721C55; Fri, 22 Jan 2021 16:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MGigms032301; Fri, 22 Jan 2021 16:44:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MGigIV032300; Fri, 22 Jan 2021 16:44:42 GMT (envelope-from git) Date: Fri, 22 Jan 2021 16:44:42 GMT Message-Id: <202101221644.10MGigIV032300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4493b69d4aa4 - stable/12 - Unify Intel CODEC naming. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4493b69d4aa4fd18d5a6d71b058a2efb74d43421 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 16:44:43 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4493b69d4aa4fd18d5a6d71b058a2efb74d43421 commit 4493b69d4aa4fd18d5a6d71b058a2efb74d43421 Author: Alexander Motin AuthorDate: 2021-01-15 14:56:15 +0000 Commit: Alexander Motin CommitDate: 2021-01-22 16:44:08 +0000 Unify Intel CODEC naming. Submitted by: Dmitry Luhtionov (cherry picked from commit 510cc421263fa807a72c9b4b8d9a4091a96d9648) --- sys/dev/sound/pci/hda/hdacc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index f15943ac7002..ecec360ebccf 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -383,16 +383,16 @@ static const struct { { HDA_CODEC_INTELKBLK, 0, "Intel Kaby Lake" }, { HDA_CODEC_INTELJLK, 0, "Intel Jasper Lake" }, { HDA_CODEC_INTELELLK, 0, "Intel Elkhart Lake" }, - { HDA_CODEC_INTELCT, 0, "Intel CedarTrail" }, + { HDA_CODEC_INTELCT, 0, "Intel Cedar Trail" }, { HDA_CODEC_INTELVV2, 0, "Intel Valleyview2" }, { HDA_CODEC_INTELBR, 0, "Intel Braswell" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, { HDA_CODEC_INTELBXTN, 0, "Intel Broxton" }, - { HDA_CODEC_INTELCNLK, 0, "Intel Cannonlake" }, - { HDA_CODEC_INTELGMLK, 0, "Intel Geminilake" }, - { HDA_CODEC_INTELGMLK1, 0, "Intel Geminilake" }, - { HDA_CODEC_INTELICLK, 0, "Intel Icelake" }, - { HDA_CODEC_INTELTGLK, 0, "Intel Tigerlake" }, + { HDA_CODEC_INTELCNLK, 0, "Intel Cannon Lake" }, + { HDA_CODEC_INTELGMLK, 0, "Intel Gemini Lake" }, + { HDA_CODEC_INTELGMLK1, 0, "Intel Gemini Lake" }, + { HDA_CODEC_INTELICLK, 0, "Intel Ice Lake" }, + { HDA_CODEC_INTELTGLK, 0, "Intel Tiger Lake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 16:45:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D22E84F913B; Fri, 22 Jan 2021 16:45:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMlVy5ZGGz3QWf; Fri, 22 Jan 2021 16:45:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id B12812EAA6; Fri, 22 Jan 2021 16:45:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f182.google.com with SMTP id e15so4527273qte.9; Fri, 22 Jan 2021 08:45:30 -0800 (PST) X-Gm-Message-State: AOAM530pKHXRi0XbOOiAslfI9ax5xe5d8V8rQlYSFx73KXGvp6C2EX65 3J979e2xZ87vN3PWzmJs9fDta9e/l7jqWUTsEAI= X-Google-Smtp-Source: ABdhPJyuDPDlS1j55PtP4f4oS1sJBZVyjZeTATXs70pfTgMlNFaYos1fwkKM6lua44F/PsBgOCghcnYE7u4RK9foEOI= X-Received: by 2002:ac8:698a:: with SMTP id o10mr5049299qtq.242.1611333930338; Fri, 22 Jan 2021 08:45:30 -0800 (PST) MIME-Version: 1.0 References: <202101221643.10MGhT2f031905@gitrepo.freebsd.org> In-Reply-To: <202101221643.10MGhT2f031905@gitrepo.freebsd.org> From: Kyle Evans Date: Fri, 22 Jan 2021 10:45:16 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 035f4ea71e6b - stable/13 - powerpc64le: don't enable COMPAT_* options in GENERIC64LE To: Piotr Kubaj Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 16:45:30 -0000 On Fri, Jan 22, 2021 at 10:43 AM Piotr Kubaj wrote: > > The branch stable/13 has been updated by pkubaj (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=035f4ea71e6bef713c06e1fece48518f9a47441c > > commit 035f4ea71e6bef713c06e1fece48518f9a47441c > Author: Piotr Kubaj > AuthorDate: 2021-01-22 16:39:15 +0000 > Commit: Piotr Kubaj > CommitDate: 2021-01-22 16:43:13 +0000 > > powerpc64le: don't enable COMPAT_* options in GENERIC64LE > > Support for powerpc64le appeared in 13, so there's no point to enable COMPAT_* for older releases. > > Also disable COMPAT_FREEBSD32, since there's no powerpcle. Since that may change in the future, leave the option commented out. > > Approved by: bdragon, jhibbits (on IRC) FYI: this should have been a cherry-pick -x to ensure the "(cherry picked from ...)" annotation was added. From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 21:08:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42EAA4FE723 for ; Fri, 22 Jan 2021 21:08:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMsLj1CPwz4R7g for ; Fri, 22 Jan 2021 21:08:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf2f.google.com with SMTP id et9so3344402qvb.10 for ; Fri, 22 Jan 2021 13:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3xhTZaMclxiRHUG0IjXVqpBEuhPMlUdn+sFpRXLJE/4=; b=yF/qGJk+7qQkv2CmR8DjN4wnYLFGmVCe/QBUt7u1YZtPJs6SKRoOobBN2EmfbANwBi qlJhMErQShhQhRkXAZFn/2oUk4EOFb5L0/AkHpNufqf/vArVEFADLUASGRSEA0gW+/8p Zln9ZzZgodXDiUF9Nk2ao8bqk3etypYQAtdB0uZhbIz4fVTAsVS1uCh+c2dqfK6QnruD M6yxBb4/Z72frZghCOYDKOByLH9gEa+aRWSZowBk1JdYT8ew/4zQ2GK+O9hIlwFS2YF4 6ZxFKvMZrcdIhym8+mpOF5VNjh2tTexcglAUP5LOYJ92zRO+QFRYeCo4Y1umCJkw00o7 0DVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3xhTZaMclxiRHUG0IjXVqpBEuhPMlUdn+sFpRXLJE/4=; b=rG1TVCwgKY1rKWSe7QWoVukbA+OKoOvJSS4Tv7y2KR9M6JKlcoPHiAQcJmn/B1us8S vEmJmW+6yaOxbwGB3HwfNwRE7NScaLpgpEjcWMNWtUyjuT17/d/Aynbx03TTS5f+0sYZ YfG9rQQgRngOnLJjuWzaXF5PacVYNlgui9gY7iZ6vsSj4y2TiYHuyueqb+e2MmwaXrJT rWLNtEqbYHEjGmRNCmaIEt3cM7zP8wEgP9Xx1crqhRapgzR+/j4Qn3pM46MfkkTOTYPt 2oB95lKAyGuy2f+WQoeheU3z3bNXDdAl/c3/dhQaD25Y5cP7HbKB9TZxewJ8nmtkjo4p LM/Q== X-Gm-Message-State: AOAM533wYWJNTlHm7844h6ap9cDNx6GzV6zP1haS6kg7iltyCRIf1PWt 9NldlDMUZxDnwfn+twJyUIUXZAHc4xl9PUZfhCEKTw== X-Google-Smtp-Source: ABdhPJw7AUlMquSst400b9p2dq/Sle2rizcZ/oxYP8BK1Uwqczlpjra7stGThiwgxGOxBy4gNNr/pTrd4WhHJ90Yiio= X-Received: by 2002:ad4:4c01:: with SMTP id bz1mr6291686qvb.62.1611349723861; Fri, 22 Jan 2021 13:08:43 -0800 (PST) MIME-Version: 1.0 References: <202101221230.10MCULuw000439@gitrepo.freebsd.org> <30b9e294-6767-abd4-e3a3-7a2d268323f9@selasky.org> In-Reply-To: From: Warner Losh Date: Fri, 22 Jan 2021 14:08:32 -0700 Message-ID: Subject: Re: git: e006b6a2c1b9 - stable/12 - MFC 376479200760: Fix whitespace in mlx5en(4). To: Kyle Evans Cc: Hans Petter Selasky , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DMsLj1CPwz4R7g X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 21:08:45 -0000 On Fri, Jan 22, 2021 at 7:26 AM Kyle Evans wrote: > On Fri, Jan 22, 2021 at 8:19 AM Hans Petter Selasky > wrote: > > > > On 1/22/21 2:59 PM, Kyle Evans wrote: > > > For the record, as per [0], these should have been cherry-picked using > > > -x which adds a " (cherry picked from commit ...)" annotation at the > > > bottom. With the annotation in place, the leading MFC line can be > > > dropped and the original message otherwise preserved (dropping any > > > metadata at the bottom that makes sense, e.g. "MFC after" tags). The > > > -x line helps at least the MFC tracker match the commit from main. > > > > > > Thanks, > > > > > > Kyle Evans > > > > > > [0]https://github.com/bsdimp/freebsd-git-docs/blob/main/MFC.md > > > > Hi Kyle, > > > > Shouldn't the committers-guide be updated to reflect this is now the > > official way to do it? > > > > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/ > > > > The committers guide wasn't going to be updated with the contents of > Warner's freebsd-git-docs until the doc switch to a less arcane > format. > It will be updated when the switch to asciidoc is done + a couple of days. For the moment, my MFC doc takes precedence over the committers guide. Warner From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 23:25:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5F174D8F2B; Fri, 22 Jan 2021 23:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMwN84kngz4YwV; Fri, 22 Jan 2021 23:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90E3326A25; Fri, 22 Jan 2021 23:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MNPCSk052507; Fri, 22 Jan 2021 23:25:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MNPCjq052506; Fri, 22 Jan 2021 23:25:12 GMT (envelope-from git) Date: Fri, 22 Jan 2021 23:25:12 GMT Message-Id: <202101222325.10MNPCjq052506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1c9891b8df63 - stable/13 - jemalloc: restore JEMALLOC_DEBUG when building WITHOUT_MALLOC_PRODUCTION MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1c9891b8df63f146bd9515e11f45384bc40d0ef4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 23:25:12 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1c9891b8df63f146bd9515e11f45384bc40d0ef4 commit 1c9891b8df63f146bd9515e11f45384bc40d0ef4 Author: Kyle Evans AuthorDate: 2021-01-22 23:13:42 +0000 Commit: Kyle Evans CommitDate: 2021-01-22 23:13:42 +0000 jemalloc: restore JEMALLOC_DEBUG when building WITHOUT_MALLOC_PRODUCTION The default for MALLOC_PRODUCTION was switched to ON in 02611ef8ee9f. This effectively reverts the jemalloc header change from bfd15705156b so that the knob behaves exactly as it does on a -CURRENT; that is, we are effectively doing: WITH_MALLOC_PRODUCTION -> -DMALLOC_PRODUCTION (default for stable/* and on) WITHOUT_MALLOC_PRODUCTION -> -DJEMALLOC_DEBUG (default for main) This allows the knob to be used for debugging on stable branches, too, which is believed to be the main reason one would want to twist it off. (direct commit) --- contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h index dfda508ea1e1..6ff0ce18d5da 100644 --- a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h +++ b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -5,7 +5,7 @@ #undef JEMALLOC_OVERRIDE_VALLOC #ifndef MALLOC_PRODUCTION -#define MALLOC_PRODUCTION +#define JEMALLOC_DEBUG #endif #undef JEMALLOC_DSS From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 23:25:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE7DA4D9181; Fri, 22 Jan 2021 23:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMwN950KVz4YgL; Fri, 22 Jan 2021 23:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D19E26D1E; Fri, 22 Jan 2021 23:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MNPD4H052530; Fri, 22 Jan 2021 23:25:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MNPDQj052529; Fri, 22 Jan 2021 23:25:13 GMT (envelope-from git) Date: Fri, 22 Jan 2021 23:25:13 GMT Message-Id: <202101222325.10MNPDQj052529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d1c39af0ec33 - stable/13 - Regenerate src.conf(5) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d1c39af0ec332ec3412e92fb4909de2a4bdfbb6c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 23:25:13 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d1c39af0ec332ec3412e92fb4909de2a4bdfbb6c commit d1c39af0ec332ec3412e92fb4909de2a4bdfbb6c Author: Kyle Evans AuthorDate: 2021-01-22 23:24:28 +0000 Commit: Kyle Evans CommitDate: 2021-01-22 23:24:28 +0000 Regenerate src.conf(5) --- share/man/man5/src.conf.5 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 5ff5b31b80be..9ac4df055194 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 20, 2021 +.Dd January 22, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -899,8 +899,8 @@ To be able to build the system, either Binutils or LLD bootstrap must be enabled unless an alternate linker is provided via XLD. .It Va WITHOUT_LLD_IS_LD Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. -.It Va WITHOUT_LLVM_ASSERTIONS -Set to disable debugging assertions in LLVM. +.It Va WITH_LLVM_ASSERTIONS +Set to enable debugging assertions in LLVM. .It Va WITHOUT_LLVM_COV Set to not build the .Xr llvm-cov 1 @@ -1097,10 +1097,10 @@ if executed as an unprivileged user. See .Xr tests 7 for more details. -.It Va WITH_MALLOC_PRODUCTION -Set to disable assertions and statistics gathering in +.It Va WITHOUT_MALLOC_PRODUCTION +Set to enable assertions and statistics gathering in .Xr malloc 3 . -It also defaults the A and J runtime options to off. +It also defaults the A and J runtime options to on. .It Va WITHOUT_MAN Set to not build manual pages. When set, these options are also in effect: From owner-dev-commits-src-branches@freebsd.org Sat Jan 23 06:35:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D89064E7FCC; Sat, 23 Jan 2021 06:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DN5ws5kvtz3JmG; Sat, 23 Jan 2021 06:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7A5D45CA; Sat, 23 Jan 2021 06:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10N6Zfj6012424; Sat, 23 Jan 2021 06:35:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10N6Zf9L012423; Sat, 23 Jan 2021 06:35:41 GMT (envelope-from git) Date: Sat, 23 Jan 2021 06:35:41 GMT Message-Id: <202101230635.10N6Zf9L012423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: f76393a6305b - stable/13 - armv8crypto: add AES-GCM support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gonzo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f76393a6305b67c0f3439ba684c5d49a2aafe2a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 06:35:41 -0000 The branch stable/13 has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=f76393a6305b67c0f3439ba684c5d49a2aafe2a0 commit f76393a6305b67c0f3439ba684c5d49a2aafe2a0 Author: Oleksandr Tymoshenko AuthorDate: 2021-01-13 06:27:10 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-01-23 06:34:37 +0000 armv8crypto: add AES-GCM support Add support for AES-GCM using OpenSSL's accelerated routines. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D27454 Sponsored by: Ampere Computing Submitted by: Klara, Inc. Approved by: re (kib) (cherry picked from commit ed9b7f4414663703e0e9581a730c4bdfaca5687f) --- sys/conf/files.arm64 | 10 ++ sys/crypto/armv8/armv8_crypto.c | 232 +++++++++++++++++++++++++++-------- sys/crypto/armv8/armv8_crypto.h | 51 ++++++-- sys/crypto/armv8/armv8_crypto_wrap.c | 208 +++++++++++++++++++++++++++++-- sys/modules/armv8crypto/Makefile | 19 ++- 5 files changed, 445 insertions(+), 75 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index fb001f95a672..f7003b1048c8 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -279,6 +279,16 @@ armv8_crypto_wrap.o optional armv8crypto \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ no-implicit-rule \ clean "armv8_crypto_wrap.o" +aesv8-armx.o optional armv8crypto \ + dependency "$S/crypto/openssl/aarch64/aesv8-armx.S" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ -I$S/crypto/openssl/crypto ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ + no-implicit-rule \ + clean "aesv8-armx.o" +ghashv8-armx.o optional armv8crypto \ + dependency "$S/crypto/openssl/aarch64/ghashv8-armx.S" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ -I$S/crypto/openssl/crypto ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ + no-implicit-rule \ + clean "ghashv8-armx.o" crypto/des/des_enc.c optional netsmb crypto/openssl/ossl_aarch64.c optional ossl crypto/openssl/aarch64/sha1-armv8.S optional ossl \ diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index f296337e6f33..be39168d50f3 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -2,6 +2,7 @@ * Copyright (c) 2005-2008 Pawel Jakub Dawidek * Copyright (c) 2010 Konstantin Belousov * Copyright (c) 2014,2016 The FreeBSD Foundation + * Copyright (c) 2020 Ampere Computing * All rights reserved. * * Portions of this software were developed by John-Mark Gurney @@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -66,6 +68,7 @@ struct armv8_crypto_softc { int dieing; int32_t cid; struct rwlock lock; + bool has_pmul; }; static struct mtx *ctx_mtx; @@ -109,16 +112,20 @@ armv8_crypto_probe(device_t dev) switch (ID_AA64ISAR0_AES_VAL(reg)) { case ID_AA64ISAR0_AES_BASE: + ret = 0; + device_set_desc(dev, "AES-CBC,AES-XTS"); + break; case ID_AA64ISAR0_AES_PMULL: ret = 0; + device_set_desc(dev, "AES-CBC,AES-XTS,AES-GCM"); + break; + default: break; case ID_AA64ISAR0_AES_NONE: device_printf(dev, "CPU lacks AES instructions"); break; } - device_set_desc_copy(dev, "AES-CBC,AES-XTS"); - /* TODO: Check more fields as we support more features */ return (ret); @@ -128,11 +135,17 @@ static int armv8_crypto_attach(device_t dev) { struct armv8_crypto_softc *sc; + uint64_t reg; int i; sc = device_get_softc(dev); sc->dieing = 0; + reg = READ_SPECIALREG(id_aa64isar0_el1); + + if (ID_AA64ISAR0_AES_VAL(reg) == ID_AA64ISAR0_AES_PMULL) + sc->has_pmul = true; + sc->cid = crypto_get_driverid(dev, sizeof(struct armv8_crypto_session), CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->cid < 0) { @@ -185,14 +198,43 @@ armv8_crypto_detach(device_t dev) return (0); } +#define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD) + static int armv8_crypto_probesession(device_t dev, const struct crypto_session_params *csp) { + struct armv8_crypto_softc *sc; + + sc = device_get_softc(dev); - if (csp->csp_flags != 0) + if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0) return (EINVAL); + switch (csp->csp_mode) { + case CSP_MODE_AEAD: + switch (csp->csp_cipher_alg) { + case CRYPTO_AES_NIST_GCM_16: + if (!sc->has_pmul) + return (EINVAL); + if (csp->csp_ivlen != AES_GCM_IV_LEN) + return (EINVAL); + if (csp->csp_auth_mlen != 0 && + csp->csp_auth_mlen != GMAC_DIGEST_LEN) + return (EINVAL); + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + return (EINVAL); + } + break; + default: + return (EINVAL); + } + break; case CSP_MODE_CIPHER: switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: @@ -228,40 +270,55 @@ armv8_crypto_probesession(device_t dev, return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); } -static void +static int armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, const struct crypto_session_params *csp, const uint8_t *key, int keylen) { - int i; + __uint128_val_t H; + struct fpu_kern_ctx *ctx; + int kt, i; if (csp->csp_cipher_alg == CRYPTO_AES_XTS) keylen /= 2; switch (keylen * 8) { case 128: - ses->rounds = AES128_ROUNDS; - break; case 192: - ses->rounds = AES192_ROUNDS; - break; case 256: - ses->rounds = AES256_ROUNDS; break; default: - panic("invalid AES key length"); + return (EINVAL); } - rijndaelKeySetupEnc(ses->enc_schedule, key, keylen * 8); - rijndaelKeySetupDec(ses->dec_schedule, key, keylen * 8); - if (csp->csp_cipher_alg == CRYPTO_AES_XTS) - rijndaelKeySetupEnc(ses->xts_schedule, key + keylen, keylen * 8); + kt = is_fpu_kern_thread(0); + if (!kt) { + AQUIRE_CTX(i, ctx); + fpu_kern_enter(curthread, ctx, + FPU_KERN_NORMAL | FPU_KERN_KTHR); + } + + aes_v8_set_encrypt_key(key, + keylen * 8, &ses->enc_schedule); + + if ((csp->csp_cipher_alg == CRYPTO_AES_XTS) || + (csp->csp_cipher_alg == CRYPTO_AES_CBC)) + aes_v8_set_decrypt_key(key, + keylen * 8, &ses->dec_schedule); + + if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) { + memset(H.c, 0, sizeof(H.c)); + aes_v8_encrypt(H.c, H.c, &ses->enc_schedule); + H.u[0] = bswap64(H.u[0]); + H.u[1] = bswap64(H.u[1]); + gcm_init_v8(ses->Htable, H.u); + } - for (i = 0; i < nitems(ses->enc_schedule); i++) { - ses->enc_schedule[i] = bswap32(ses->enc_schedule[i]); - ses->dec_schedule[i] = bswap32(ses->dec_schedule[i]); - if (csp->csp_cipher_alg == CRYPTO_AES_XTS) - ses->xts_schedule[i] = bswap32(ses->xts_schedule[i]); + if (!kt) { + fpu_kern_leave(curthread, ctx); + RELEASE_CTX(i, ctx); } + + return (0); } static int @@ -270,6 +327,7 @@ armv8_crypto_newsession(device_t dev, crypto_session_t cses, { struct armv8_crypto_softc *sc; struct armv8_crypto_session *ses; + int error; sc = device_get_softc(dev); rw_wlock(&sc->lock); @@ -279,40 +337,29 @@ armv8_crypto_newsession(device_t dev, crypto_session_t cses, } ses = crypto_get_driver_session(cses); - armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key, + error = armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key, csp->csp_cipher_klen); rw_wunlock(&sc->lock); - return (0); + return (error); } static int armv8_crypto_process(device_t dev, struct cryptop *crp, int hint __unused) { struct armv8_crypto_session *ses; - int error; - - /* We can only handle full blocks for now */ - if ((crp->crp_payload_length % AES_BLOCK_LEN) != 0) { - error = EINVAL; - goto out; - } ses = crypto_get_driver_session(crp->crp_session); - error = armv8_crypto_cipher_process(ses, crp); - -out: - crp->crp_etype = error; + crp->crp_etype = armv8_crypto_cipher_process(ses, crp); crypto_done(crp); return (0); } static uint8_t * -armv8_crypto_cipher_alloc(struct cryptop *crp, int *allocated) +armv8_crypto_cipher_alloc(struct cryptop *crp, int start, int length, int *allocated) { uint8_t *addr; - addr = crypto_contiguous_subsegment(crp, crp->crp_payload_start, - crp->crp_payload_length); + addr = crypto_contiguous_subsegment(crp, start, length); if (addr != NULL) { *allocated = 0; return (addr); @@ -320,8 +367,7 @@ armv8_crypto_cipher_alloc(struct cryptop *crp, int *allocated) addr = malloc(crp->crp_payload_length, M_ARMV8_CRYPTO, M_NOWAIT); if (addr != NULL) { *allocated = 1; - crypto_copydata(crp, crp->crp_payload_start, - crp->crp_payload_length, addr); + crypto_copydata(crp, start, length, addr); } else *allocated = 0; return (addr); @@ -333,19 +379,63 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, { const struct crypto_session_params *csp; struct fpu_kern_ctx *ctx; - uint8_t *buf; - uint8_t iv[AES_BLOCK_LEN]; - int allocated, i; + uint8_t *buf, *authbuf, *outbuf; + uint8_t iv[AES_BLOCK_LEN], tag[GMAC_DIGEST_LEN]; + int allocated, authallocated, outallocated, i; int encflag; int kt; + int error; + bool outcopy; csp = crypto_get_params(crp->crp_session); encflag = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); - buf = armv8_crypto_cipher_alloc(crp, &allocated); + allocated = 0; + outallocated = 0; + authallocated = 0; + authbuf = NULL; + kt = 1; + + buf = armv8_crypto_cipher_alloc(crp, crp->crp_payload_start, + crp->crp_payload_length, &allocated); if (buf == NULL) return (ENOMEM); + if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) { + if (crp->crp_aad != NULL) + authbuf = crp->crp_aad; + else + authbuf = armv8_crypto_cipher_alloc(crp, crp->crp_aad_start, + crp->crp_aad_length, &authallocated); + if (authbuf == NULL) { + error = ENOMEM; + goto out; + } + } + + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + outbuf = crypto_buffer_contiguous_subsegment(&crp->crp_obuf, + crp->crp_payload_output_start, crp->crp_payload_length); + if (outbuf == NULL) { + outcopy = true; + if (allocated) + outbuf = buf; + else { + outbuf = malloc(crp->crp_payload_length, + M_ARMV8_CRYPTO, M_NOWAIT); + if (outbuf == NULL) { + error = ENOMEM; + goto out; + } + outallocated = true; + } + } else + outcopy = false; + } else { + outbuf = buf; + outcopy = allocated; + } + kt = is_fpu_kern_thread(0); if (!kt) { AQUIRE_CTX(i, ctx); @@ -363,36 +453,74 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, /* Do work */ switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: + if ((crp->crp_payload_length % AES_BLOCK_LEN) != 0) { + error = EINVAL; + goto out; + } if (encflag) - armv8_aes_encrypt_cbc(ses->rounds, ses->enc_schedule, + armv8_aes_encrypt_cbc(&ses->enc_schedule, crp->crp_payload_length, buf, buf, iv); else - armv8_aes_decrypt_cbc(ses->rounds, ses->dec_schedule, + armv8_aes_decrypt_cbc(&ses->dec_schedule, crp->crp_payload_length, buf, iv); break; case CRYPTO_AES_XTS: if (encflag) - armv8_aes_encrypt_xts(ses->rounds, ses->enc_schedule, - ses->xts_schedule, crp->crp_payload_length, buf, + armv8_aes_encrypt_xts(&ses->enc_schedule, + &ses->xts_schedule.aes_key, crp->crp_payload_length, buf, buf, iv); else - armv8_aes_decrypt_xts(ses->rounds, ses->dec_schedule, - ses->xts_schedule, crp->crp_payload_length, buf, + armv8_aes_decrypt_xts(&ses->dec_schedule, + &ses->xts_schedule.aes_key, crp->crp_payload_length, buf, buf, iv); break; + case CRYPTO_AES_NIST_GCM_16: + if (encflag) { + memset(tag, 0, sizeof(tag)); + armv8_aes_encrypt_gcm(&ses->enc_schedule, + crp->crp_payload_length, + buf, outbuf, + crp->crp_aad_length, authbuf, + tag, iv, ses->Htable); + crypto_copyback(crp, crp->crp_digest_start, sizeof(tag), + tag); + } else { + crypto_copydata(crp, crp->crp_digest_start, sizeof(tag), + tag); + if (armv8_aes_decrypt_gcm(&ses->enc_schedule, + crp->crp_payload_length, + buf, outbuf, + crp->crp_aad_length, authbuf, + tag, iv, ses->Htable) != 0) { + error = EBADMSG; + goto out; + } + } + break; } - if (allocated) - crypto_copyback(crp, crp->crp_payload_start, - crp->crp_payload_length, buf); + if (outcopy) + crypto_copyback(crp, CRYPTO_HAS_OUTPUT_BUFFER(crp) ? + crp->crp_payload_output_start : crp->crp_payload_start, + crp->crp_payload_length, outbuf); + error = 0; +out: if (!kt) { fpu_kern_leave(curthread, ctx); RELEASE_CTX(i, ctx); } + if (allocated) zfree(buf, M_ARMV8_CRYPTO); - return (0); + if (authallocated) + zfree(authbuf, M_ARMV8_CRYPTO); + if (outallocated) + zfree(outbuf, M_ARMV8_CRYPTO); + explicit_bzero(iv, sizeof(iv)); + explicit_bzero(tag, sizeof(tag)); + + return (error); } static device_method_t armv8_crypto_methods[] = { diff --git a/sys/crypto/armv8/armv8_crypto.h b/sys/crypto/armv8/armv8_crypto.h index 2d0be163b072..0e4cd91e7062 100644 --- a/sys/crypto/armv8/armv8_crypto.h +++ b/sys/crypto/armv8/armv8_crypto.h @@ -32,27 +32,56 @@ #ifndef _ARMV8_CRYPTO_H_ #define _ARMV8_CRYPTO_H_ -#define AES128_ROUNDS 10 -#define AES192_ROUNDS 12 #define AES256_ROUNDS 14 #define AES_SCHED_LEN ((AES256_ROUNDS + 1) * AES_BLOCK_LEN) +typedef struct { + uint32_t aes_key[AES_SCHED_LEN/4]; + int aes_rounds; +} AES_key_t; + +typedef union { + uint64_t u[2]; + uint32_t d[4]; + uint8_t c[16]; + size_t t[16 / sizeof(size_t)]; +} __uint128_val_t; + struct armv8_crypto_session { - uint32_t enc_schedule[AES_SCHED_LEN/4]; - uint32_t dec_schedule[AES_SCHED_LEN/4]; - uint32_t xts_schedule[AES_SCHED_LEN/4]; - int algo; - int rounds; + AES_key_t enc_schedule; + AES_key_t dec_schedule; + AES_key_t xts_schedule; + __uint128_val_t Htable[16]; }; -void armv8_aes_encrypt_cbc(int, const void *, size_t, const uint8_t *, +/* Prototypes for aesv8-armx.S */ +void aes_v8_encrypt(uint8_t *in, uint8_t *out, const AES_key_t *key); +int aes_v8_set_encrypt_key(const unsigned char *userKey, const int bits, const AES_key_t *key); +int aes_v8_set_decrypt_key(const unsigned char *userKey, const int bits, const AES_key_t *key); + +/* Prototypes for ghashv8-armx.S */ +void gcm_init_v8(__uint128_val_t Htable[16], const uint64_t Xi[2]); +void gcm_gmult_v8(uint64_t Xi[2], const __uint128_val_t Htable[16]); +void gcm_ghash_v8(uint64_t Xi[2], const __uint128_val_t Htable[16], const uint8_t *inp, size_t len); + +void armv8_aes_encrypt_cbc(const AES_key_t *, size_t, const uint8_t *, uint8_t *, const uint8_t[static AES_BLOCK_LEN]); -void armv8_aes_decrypt_cbc(int, const void *, size_t, uint8_t *, +void armv8_aes_decrypt_cbc(const AES_key_t *, size_t, uint8_t *, const uint8_t[static AES_BLOCK_LEN]); +void armv8_aes_encrypt_gcm(AES_key_t *, size_t, const uint8_t *, + uint8_t *, size_t, const uint8_t*, + uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t[static AES_BLOCK_LEN], + const __uint128_val_t *); +int armv8_aes_decrypt_gcm(AES_key_t *, size_t, const uint8_t *, + uint8_t *, size_t, const uint8_t*, + const uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t[static AES_BLOCK_LEN], + const __uint128_val_t *); -void armv8_aes_encrypt_xts(int, const void *, const void *, size_t, +void armv8_aes_encrypt_xts(AES_key_t *, const void *, size_t, const uint8_t *, uint8_t *, const uint8_t[AES_BLOCK_LEN]); -void armv8_aes_decrypt_xts(int, const void *, const void *, size_t, +void armv8_aes_decrypt_xts(AES_key_t *, const void *, size_t, const uint8_t *, uint8_t *, const uint8_t[AES_BLOCK_LEN]); #endif /* _ARMV8_CRYPTO_H_ */ diff --git a/sys/crypto/armv8/armv8_crypto_wrap.c b/sys/crypto/armv8/armv8_crypto_wrap.c index 83af3fad40ef..ea93f1b9a176 100644 --- a/sys/crypto/armv8/armv8_crypto_wrap.c +++ b/sys/crypto/armv8/armv8_crypto_wrap.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation + * Copyright (c) 2020 Ampere Computing * All rights reserved. * * This software was developed by Andrew Turner under @@ -41,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -90,7 +93,7 @@ armv8_aes_dec(int rounds, const uint8x16_t *keysched, const uint8x16_t from) } void -armv8_aes_encrypt_cbc(int rounds, const void *key_schedule, size_t len, +armv8_aes_encrypt_cbc(const AES_key_t *key, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { uint8x16_t tot, ivreg, tmp; @@ -100,8 +103,8 @@ armv8_aes_encrypt_cbc(int rounds, const void *key_schedule, size_t len, ivreg = vld1q_u8(iv); for (i = 0; i < len; i++) { tmp = vld1q_u8(from); - tot = armv8_aes_enc(rounds - 1, key_schedule, - veorq_u8(tmp, ivreg)); + tot = armv8_aes_enc(key->aes_rounds - 1, + (const void*)key->aes_key, veorq_u8(tmp, ivreg)); ivreg = tot; vst1q_u8(to, tot); from += AES_BLOCK_LEN; @@ -110,7 +113,7 @@ armv8_aes_encrypt_cbc(int rounds, const void *key_schedule, size_t len, } void -armv8_aes_decrypt_cbc(int rounds, const void *key_schedule, size_t len, +armv8_aes_decrypt_cbc(const AES_key_t *key, size_t len, uint8_t *buf, const uint8_t iv[static AES_BLOCK_LEN]) { uint8x16_t ivreg, nextiv, tmp; @@ -120,7 +123,8 @@ armv8_aes_decrypt_cbc(int rounds, const void *key_schedule, size_t len, ivreg = vld1q_u8(iv); for (i = 0; i < len; i++) { nextiv = vld1q_u8(buf); - tmp = armv8_aes_dec(rounds - 1, key_schedule, nextiv); + tmp = armv8_aes_dec(key->aes_rounds - 1, + (const void*)key->aes_key, nextiv); vst1q_u8(buf, veorq_u8(tmp, ivreg)); ivreg = nextiv; buf += AES_BLOCK_LEN; @@ -200,21 +204,203 @@ armv8_aes_crypt_xts(int rounds, const uint8x16_t *data_schedule, } void -armv8_aes_encrypt_xts(int rounds, const void *data_schedule, +armv8_aes_encrypt_xts(AES_key_t *data_schedule, const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { - armv8_aes_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, - iv, 1); + armv8_aes_crypt_xts(data_schedule->aes_rounds, + (const void *)&data_schedule->aes_key, tweak_schedule, len, from, + to, iv, 1); } void -armv8_aes_decrypt_xts(int rounds, const void *data_schedule, +armv8_aes_decrypt_xts(AES_key_t *data_schedule, const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { - armv8_aes_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, - iv, 0); + armv8_aes_crypt_xts(data_schedule->aes_rounds, + (const void *)&data_schedule->aes_key, tweak_schedule, len, from, + to,iv, 0); + +} + +#define AES_INC_COUNTER(counter) \ + do { \ + for (int pos = AES_BLOCK_LEN - 1; \ + pos >= 0; pos--) \ + if (++(counter)[pos]) \ + break; \ + } while (0) + +void +armv8_aes_encrypt_gcm(AES_key_t *aes_key, size_t len, + const uint8_t *from, uint8_t *to, + size_t authdatalen, const uint8_t *authdata, + uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t iv[static AES_GCM_IV_LEN], + const __uint128_val_t *Htable) +{ + size_t i; + const uint64_t *from64; + uint64_t *to64; + uint8_t aes_counter[AES_BLOCK_LEN]; + uint8_t block[AES_BLOCK_LEN]; + size_t trailer; + __uint128_val_t EK0, EKi, Xi, lenblock; + + bzero(&aes_counter, AES_BLOCK_LEN); + memcpy(aes_counter, iv, AES_GCM_IV_LEN); + + /* Setup the counter */ + aes_counter[AES_BLOCK_LEN - 1] = 1; + + /* EK0 for a final GMAC round */ + aes_v8_encrypt(aes_counter, EK0.c, aes_key); + + /* GCM starts with 2 as counter, 1 is used for final xor of tag. */ + aes_counter[AES_BLOCK_LEN - 1] = 2; + + memset(Xi.c, 0, sizeof(Xi.c)); + memset(block, 0, sizeof(block)); + memcpy(block, authdata, min(authdatalen, sizeof(block))); + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + + from64 = (const uint64_t*)from; + to64 = (uint64_t*)to; + trailer = len % AES_BLOCK_LEN; + + for (i = 0; i < (len - trailer); i += AES_BLOCK_LEN) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + to64[0] = from64[0] ^ EKi.u[0]; + to64[1] = from64[1] ^ EKi.u[1]; + gcm_ghash_v8(Xi.u, Htable, (uint8_t*)to64, AES_BLOCK_LEN); + + to64 += 2; + from64 += 2; + } + + to += (len - trailer); + from += (len - trailer); + + if (trailer) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + for (i = 0; i < trailer; i++) { + block[i] = to[i] = from[i] ^ EKi.c[i % AES_BLOCK_LEN]; + } + + for (; i < AES_BLOCK_LEN; i++) + block[i] = 0; + + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + } + + /* Lengths block */ + lenblock.u[0] = lenblock.u[1] = 0; + lenblock.d[1] = htobe32(authdatalen * 8); + lenblock.d[3] = htobe32(len * 8); + gcm_ghash_v8(Xi.u, Htable, lenblock.c, AES_BLOCK_LEN); + + Xi.u[0] ^= EK0.u[0]; + Xi.u[1] ^= EK0.u[1]; + memcpy(tag, Xi.c, GMAC_DIGEST_LEN); + + explicit_bzero(aes_counter, sizeof(aes_counter)); + explicit_bzero(Xi.c, sizeof(Xi.c)); + explicit_bzero(EK0.c, sizeof(EK0.c)); + explicit_bzero(EKi.c, sizeof(EKi.c)); + explicit_bzero(lenblock.c, sizeof(lenblock.c)); +} + +int +armv8_aes_decrypt_gcm(AES_key_t *aes_key, size_t len, + const uint8_t *from, uint8_t *to, + size_t authdatalen, const uint8_t *authdata, + const uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t iv[static AES_GCM_IV_LEN], + const __uint128_val_t *Htable) +{ + size_t i; + const uint64_t *from64; + uint64_t *to64; + uint8_t aes_counter[AES_BLOCK_LEN]; + uint8_t block[AES_BLOCK_LEN]; + size_t trailer; + __uint128_val_t EK0, EKi, Xi, lenblock; + int error; + + error = 0; + bzero(&aes_counter, AES_BLOCK_LEN); + memcpy(aes_counter, iv, AES_GCM_IV_LEN); + + /* Setup the counter */ + aes_counter[AES_BLOCK_LEN - 1] = 1; + + /* EK0 for a final GMAC round */ + aes_v8_encrypt(aes_counter, EK0.c, aes_key); + + memset(Xi.c, 0, sizeof(Xi.c)); + memset(block, 0, sizeof(block)); + memcpy(block, authdata, min(authdatalen, sizeof(block))); + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + trailer = len % AES_BLOCK_LEN; + gcm_ghash_v8(Xi.u, Htable, from, len - trailer); + + if (trailer) { + for (i = 0; i < trailer; i++) + block[i] = from[len - trailer + i]; + for (; i < AES_BLOCK_LEN; i++) + block[i] = 0; + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + } + + /* Lengths block */ + lenblock.u[0] = lenblock.u[1] = 0; + lenblock.d[1] = htobe32(authdatalen * 8); + lenblock.d[3] = htobe32(len * 8); + gcm_ghash_v8(Xi.u, Htable, lenblock.c, AES_BLOCK_LEN); + + Xi.u[0] ^= EK0.u[0]; + Xi.u[1] ^= EK0.u[1]; + if (timingsafe_bcmp(tag, Xi.c, GMAC_DIGEST_LEN) != 0) { + error = EBADMSG; + goto out; + } + + /* GCM starts with 2 as counter, 1 is used for final xor of tag. */ + aes_counter[AES_BLOCK_LEN - 1] = 2; + + from64 = (const uint64_t*)from; + to64 = (uint64_t*)to; + + for (i = 0; i < (len - trailer); i += AES_BLOCK_LEN) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + to64[0] = from64[0] ^ EKi.u[0]; + to64[1] = from64[1] ^ EKi.u[1]; + to64 += 2; + from64 += 2; + } + + to += (len - trailer); + from += (len - trailer); + + if (trailer) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + for (i = 0; i < trailer; i++) + to[i] = from[i] ^ EKi.c[i % AES_BLOCK_LEN]; + } + +out: + explicit_bzero(aes_counter, sizeof(aes_counter)); + explicit_bzero(Xi.c, sizeof(Xi.c)); + explicit_bzero(EK0.c, sizeof(EK0.c)); + explicit_bzero(EKi.c, sizeof(EKi.c)); + explicit_bzero(lenblock.c, sizeof(lenblock.c)); + + return (error); } diff --git a/sys/modules/armv8crypto/Makefile b/sys/modules/armv8crypto/Makefile index 4b9a84c953d2..bd38fe039fc9 100644 --- a/sys/modules/armv8crypto/Makefile +++ b/sys/modules/armv8crypto/Makefile @@ -1,12 +1,13 @@ # $FreeBSD$ .PATH: ${SRCTOP}/sys/crypto/armv8 +.PATH: ${SRCTOP}/sys/crypto/openssl/aarch64 KMOD= armv8crypto SRCS= armv8_crypto.c SRCS+= device_if.h bus_if.h opt_bus.h cryptodev_if.h -OBJS+= armv8_crypto_wrap.o +OBJS+= armv8_crypto_wrap.o aesv8-armx.o ghashv8-armx.o # Remove -nostdinc so we can get the intrinsics. armv8_crypto_wrap.o: armv8_crypto_wrap.c @@ -16,6 +17,22 @@ armv8_crypto_wrap.o: armv8_crypto_wrap.c -march=armv8-a+crypto ${.IMPSRC} ${CTFCONVERT_CMD} +aesv8-armx.o: aesv8-armx.S + ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ + -I${SRCTOP}/sys/crypto/armv8 \ + -I${SRCTOP}/sys/crypto/openssl/crypto \ + ${WERROR} ${PROF} \ + -march=armv8-a+crypto ${.IMPSRC} + ${CTFCONVERT_CMD} + +ghashv8-armx.o: ghashv8-armx.S + ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ + -I${SRCTOP}/sys/crypto/armv8 \ + -I${SRCTOP}/sys/crypto/openssl/crypto \ + ${WERROR} ${PROF} \ + -march=armv8-a+crypto ${.IMPSRC} + ${CTFCONVERT_CMD} + armv8_crypto_wrap.o: armv8_crypto.h .include From owner-dev-commits-src-branches@freebsd.org Sat Jan 23 16:01:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 782484F6B9F; Sat, 23 Jan 2021 16:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNLVH32bxz4dhL; Sat, 23 Jan 2021 16:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B04D141AA; Sat, 23 Jan 2021 16:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NG1xX3053760; Sat, 23 Jan 2021 16:01:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NG1xET053759; Sat, 23 Jan 2021 16:01:59 GMT (envelope-from git) Date: Sat, 23 Jan 2021 16:01:59 GMT Message-Id: <202101231601.10NG1xET053759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 80a5b8512a2c - stable/12 - kldxref(8): Sort MDT_MODULE info first in linker.hints output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 80a5b8512a2c6193df36bd2dd885fc772633a971 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 16:01:59 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=80a5b8512a2c6193df36bd2dd885fc772633a971 commit 80a5b8512a2c6193df36bd2dd885fc772633a971 Author: Conrad Meyer AuthorDate: 2019-05-27 17:33:20 +0000 Commit: Mark Johnston CommitDate: 2021-01-23 16:01:21 +0000 kldxref(8): Sort MDT_MODULE info first in linker.hints output MDT_MODULE info is required to be ordered before any other MDT metadata for a given kld because it serves as an implicit record boundary between distinct klds for linker.hints consumers. kldxref(8) has previously relied on the assumption that MDT_MODULE was ordered relative to other module metadata in kld objects by source code ordering. However, C does not require implementations to emit file scope objects in any particular order, and it seems that GCC 6.4.0 and/or binutils 2.32 ld may reorder emitted objects with respect to source code ordering. So: just take two passes over a given .ko's module metadata, scanning for the MDT_MODULE on the first pass and the other metadata on subsequent passes. It's not super expensive and not exactly a performance-critical piece of code. This ensures MDT_MODULE is always ordered before MDT_PNP_INFO and other MDTs, regardless of compiler/linker movement. As a fringe benefit, it removes the requirement that care be taken to always order MODULE_PNP_INFO after DRIVER_MODULE in source code. Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D20405 (cherry picked from commit 9c1fa7a429145b298a012cb7b752c82a1e0b1184) --- usr.sbin/kldxref/kldxref.c | 51 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c index 4e456a05c25b..c70405962dd8 100644 --- a/usr.sbin/kldxref/kldxref.c +++ b/usr.sbin/kldxref/kldxref.c @@ -549,9 +549,9 @@ read_kld(char *filename, char *kldname) { struct mod_metadata md; struct elf_file ef; - void **p, **orgp; + void **p; int error, eftype; - long start, finish, entries; + long start, finish, entries, i; char cval[MAXMODNAME + 1]; if (verbose || dflag) @@ -575,18 +575,53 @@ read_kld(char *filename, char *kldname) &entries)); check(EF_SEG_READ_ENTRY_REL(&ef, start, sizeof(*p) * entries, (void *)&p)); - orgp = p; - while(entries--) { - check(EF_SEG_READ_REL(&ef, (Elf_Off)*p, sizeof(md), + /* + * Do a first pass to find MDT_MODULE. It is required to be + * ordered first in the output linker.hints stream because it + * serves as an implicit record boundary between distinct klds + * in the stream. Other MDTs only make sense in the context of + * a specific MDT_MODULE. + * + * Some compilers (e.g., GCC 6.4.0 xtoolchain) or binutils + * (e.g., GNU binutils 2.32 objcopy/ld.bfd) can reorder + * MODULE_METADATA set entries relative to the source ordering. + * This is permitted by the C standard; memory layout of + * file-scope objects is left implementation-defined. There is + * no requirement that source code ordering is retained. + * + * Handle that here by taking two passes to ensure MDT_MODULE + * records are emitted to linker.hints before other MDT records + * in the same kld. + */ + for (i = 0; i < entries; i++) { + check(EF_SEG_READ_REL(&ef, (Elf_Off)p[i], sizeof(md), + &md)); + check(EF_SEG_READ_STRING(&ef, (Elf_Off)md.md_cval, + sizeof(cval), cval)); + if (md.md_type == MDT_MODULE) { + parse_entry(&md, cval, &ef, kldname); + break; + } + } + if (error != 0) { + warnc(error, "error while reading %s", filename); + break; + } + + /* + * Second pass for all !MDT_MODULE entries. + */ + for (i = 0; i < entries; i++) { + check(EF_SEG_READ_REL(&ef, (Elf_Off)p[i], sizeof(md), &md)); - p++; check(EF_SEG_READ_STRING(&ef, (Elf_Off)md.md_cval, sizeof(cval), cval)); - parse_entry(&md, cval, &ef, kldname); + if (md.md_type != MDT_MODULE) + parse_entry(&md, cval, &ef, kldname); } if (error != 0) warnc(error, "error while reading %s", filename); - free(orgp); + free(p); } while(0); EF_CLOSE(&ef); return (error); From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 02:55:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 238D14E81B0; Sun, 24 Jan 2021 02:55:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNczt0Qkrz3q7x; Sun, 24 Jan 2021 02:55:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F15771C1C8; Sun, 24 Jan 2021 02:55:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O2t5Wr001037; Sun, 24 Jan 2021 02:55:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O2t5Dm001036; Sun, 24 Jan 2021 02:55:05 GMT (envelope-from git) Date: Sun, 24 Jan 2021 02:55:05 GMT Message-Id: <202101240255.10O2t5Dm001036@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 80bffc566202 - stable/12 - bectl: tests: use -R instead of specifying altroot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 80bffc56620228099986560bb385c8b3c4583ead Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 02:55:06 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=80bffc56620228099986560bb385c8b3c4583ead commit 80bffc56620228099986560bb385c8b3c4583ead Author: Kyle Evans AuthorDate: 2021-01-16 05:58:12 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 02:52:56 +0000 bectl: tests: use -R instead of specifying altroot -R is currently shorthand for cachefile=none, altroot=. This is functionally the same, but perhaps more resilient to future changes that could be necessary that may be added when -R is specified. (cherry picked from commit de661c9f8652f6a51a6ca83d404d9170404990f8) --- sbin/bectl/tests/bectl_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/bectl/tests/bectl_test.sh b/sbin/bectl/tests/bectl_test.sh index a4c3d7828acb..4a3fc78db0bc 100755 --- a/sbin/bectl/tests/bectl_test.sh +++ b/sbin/bectl/tests/bectl_test.sh @@ -51,7 +51,7 @@ bectl_create_setup() kldload -n -q zfs || atf_skip "ZFS module not loaded on the current system" atf_check mkdir -p ${mnt} atf_check truncate -s 1G ${disk} - atf_check zpool create -o altroot=${mnt} ${zpool} ${disk} + atf_check zpool create -R ${mnt} ${zpool} ${disk} atf_check zfs create -o mountpoint=none ${zpool}/ROOT atf_check zfs create -o mountpoint=/ -o canmount=noauto \ ${zpool}/ROOT/default From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 02:55:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28C654E823F; Sun, 24 Jan 2021 02:55:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNczv0fTpz3q8M; Sun, 24 Jan 2021 02:55:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07E171C34A; Sun, 24 Jan 2021 02:55:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O2t6jX001055; Sun, 24 Jan 2021 02:55:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O2t6Z8001054; Sun, 24 Jan 2021 02:55:06 GMT (envelope-from git) Date: Sun, 24 Jan 2021 02:55:06 GMT Message-Id: <202101240255.10O2t6Z8001054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 8ec319d7922c - stable/12 - certctl: replace hardcoded uses of /usr/local MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8ec319d7922c6e3e95d79882f2103768b96ee95a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 02:55:07 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8ec319d7922c6e3e95d79882f2103768b96ee95a commit 8ec319d7922c6e3e95d79882f2103768b96ee95a Author: Kyle Evans AuthorDate: 2021-01-09 04:00:41 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 02:54:50 +0000 certctl: replace hardcoded uses of /usr/local Use the new user.localbase sysctl here as well, to reduce the number of hardcoded localbase by one (1). (cherry picked from commit b799d38a2ad10ec84c8ffa4a554a1816465c0d12) --- usr.sbin/certctl/certctl.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index f317064a6dfe..b8bec6fff385 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -264,8 +264,9 @@ shift $(( $OPTIND - 1 )) : ${METALOG:=${DESTDIR}/METALOG} INSTALLFLAGS= [ $UNPRIV -eq 1 ] && INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR}" -: ${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}/usr/local/share/certs:${DESTDIR}/usr/local/etc/ssl/certs} -: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted} +: ${LOCALBASE:=/usr/local} +: ${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}${LOCALBASE}/share/certs:${DESTDIR}${LOCALBASE}/etc/ssl/certs} +: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}${LOCALBASE}/etc/ssl/blacklisted} : ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs} : ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted} From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 02:57:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D30E4E82FF; Sun, 24 Jan 2021 02:57:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNd2V0nHWz3q0J; Sun, 24 Jan 2021 02:57:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DAAC1C682; Sun, 24 Jan 2021 02:57:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O2vLKt001488; Sun, 24 Jan 2021 02:57:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O2vLQw001487; Sun, 24 Jan 2021 02:57:21 GMT (envelope-from git) Date: Sun, 24 Jan 2021 02:57:21 GMT Message-Id: <202101240257.10O2vLQw001487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 9ffee7b1eaeb - stable/12 - lualoader: use floor division to get correct type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9ffee7b1eaeb4b48acd89d7be95fe627e9626724 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 02:57:22 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9ffee7b1eaeb4b48acd89d7be95fe627e9626724 commit 9ffee7b1eaeb4b48acd89d7be95fe627e9626724 Author: Kyle Evans AuthorDate: 2021-01-15 14:15:40 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 02:57:02 +0000 lualoader: use floor division to get correct type This fixes the positioning of the "Welcome to FreeBSD" heading, which was misplaced after the recent update to Lua 5.4. The issue was previously masked by a compatibility knob in Lua 5.3 that would cause float-tagged numbers to render faithfully without the decimal component. Lua 5.4 dropped that and ensures that it always prints a decimal component, even if it has to append a ".0" to the value. Standard division produces a "float", floor division (//) can be used to guarantee an integer. Floating point operations have been completely ripped out of the liblua compiled for the bootloader, so this is a nop. This is decidedly better than trying to hack out the float tag entirely. (cherry picked from commit 994e1f40f6db059290cf4a8203c2b9eea22d9a38) --- stand/lua/drawer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index f54b9307637a..49f71c12b9d9 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -265,7 +265,7 @@ local function drawbox() end end if menu_header_x == nil then - menu_header_x = x + (w / 2) - (#menu_header / 2) + menu_header_x = x + (w // 2) - (#menu_header // 2) end screen.setcursor(menu_header_x, y) printc(menu_header) From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:05:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B9454E88B7; Sun, 24 Jan 2021 03:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNdCR5ZSLz3r15; Sun, 24 Jan 2021 03:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B236E1C4FD; Sun, 24 Jan 2021 03:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O357hQ014705; Sun, 24 Jan 2021 03:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O357eR014704; Sun, 24 Jan 2021 03:05:07 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:05:07 GMT Message-Id: <202101240305.10O357eR014704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 912086c27f9a - stable/12 - libc: regex: rework unsafe pointer arithmetic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 912086c27f9ab75253af8ae7914ae6001035a1b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:05:08 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=912086c27f9ab75253af8ae7914ae6001035a1b2 commit 912086c27f9ab75253af8ae7914ae6001035a1b2 Author: Miod Vallat AuthorDate: 2021-01-08 18:59:00 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:04:58 +0000 libc: regex: rework unsafe pointer arithmetic regcomp.c uses the "start + count < end" idiom to check that there are "count" bytes available in an array of char "start" and "end" both point to. This is fine, unless "start + count" goes beyond the last element of the array. In this case, pedantic interpretation of the C standard makes the comparison of such a pointer against "end" undefined, and optimizers from hell will happily remove as much code as possible because of this. An example of this occurs in regcomp.c's bothcases(), which defines bracket[3], sets "next" to "bracket" and "end" to "bracket + 2". Then it invokes p_bracket(), which starts with "if (p->next + 5 < p->end)"... Because bothcases() and p_bracket() are static functions in regcomp.c, there is a real risk of miscompilation if aggressive inlining happens. The following diff rewrites the "start + count < end" constructs into "end - start > count". Assuming "end" and "start" are always pointing in the array (such as "bracket[3]" above), "end - start" is well-defined and can be compared without trouble. As a bonus, MORE2() implies MORE() therefore SEETWO() can be simplified a bit. PR: 252403 (cherry picked from commit d36b5dbe28d8ebab219fa29db533734d47f0c4a3) --- lib/libc/regex/regcomp.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 00ab6a77141b..fc66ea32046a 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -177,10 +177,10 @@ static char nuls[10]; /* place to point scanner in event of error */ */ #define PEEK() (*p->next) #define PEEK2() (*(p->next+1)) -#define MORE() (p->next < p->end) -#define MORE2() (p->next+1 < p->end) +#define MORE() (p->end - p->next > 0) +#define MORE2() (p->end - p->next > 1) #define SEE(c) (MORE() && PEEK() == (c)) -#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) +#define SEETWO(a, b) (MORE2() && PEEK() == (a) && PEEK2() == (b)) #define SEESPEC(a) (p->bre ? SEETWO('\\', a) : SEE(a)) #define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) #define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) @@ -997,15 +997,17 @@ p_bracket(struct parse *p) wint_t ch; /* Dept of Truly Sickening Special-Case Kludges */ - if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { - EMIT(OBOW, 0); - NEXTn(6); - return; - } - if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { - EMIT(OEOW, 0); - NEXTn(6); - return; + if (p->end - p->next > 5) { + if (strncmp(p->next, "[:<:]]", 6) == 0) { + EMIT(OBOW, 0); + NEXTn(6); + return; + } + if (strncmp(p->next, "[:>:]]", 6) == 0) { + EMIT(OEOW, 0); + NEXTn(6); + return; + } } if ((cs = allocset(p)) == NULL) From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:07:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4214A4E8E01; Sun, 24 Jan 2021 03:07:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNdG81FRhz3rCS; Sun, 24 Jan 2021 03:07:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D8CF1C270; Sun, 24 Jan 2021 03:07:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O37SRR015163; Sun, 24 Jan 2021 03:07:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O37Sun015162; Sun, 24 Jan 2021 03:07:28 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:07:28 GMT Message-Id: <202101240307.10O37Sun015162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d9cc55ea82fa - stable/12 - lualoader: add loader_conf_dirs support (loader.conf.d) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d9cc55ea82faf6b7660d9a715b936657c6e6a8af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:07:28 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d9cc55ea82faf6b7660d9a715b936657c6e6a8af commit d9cc55ea82faf6b7660d9a715b936657c6e6a8af Author: Kyle Evans AuthorDate: 2020-07-10 01:50:15 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:07:12 +0000 lualoader: add loader_conf_dirs support (loader.conf.d) loader_conf_dirs is the supporting mechanism for the included /boot/loader.conf.d directory. When lualoader finishes processing all of the loader_conf_files it finds after walking /boot/defaults/loader.conf, it will now check any and all loader_conf_dirs and process files ending in ".conf" as if they were a loader.conf. Note that loader_conf_files may be specified in a loader.conf.d config file, but loader_conf_dirs may *not*. It will only be processed as specified in /boot/defaults/loader.conf and any loader_conf_files that were loaded from there. Relnotes: yes (cherry picked from commit 72cf7db3aaf17db412183886f19320e5074dc8b7) --- etc/mtree/BSD.root.dist | 2 ++ stand/defaults/loader.conf | 1 + stand/defaults/loader.conf.5 | 9 ++++++++- stand/lua/config.lua | 24 ++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index 41a68c27aa7a..cba3e9e73c79 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -20,6 +20,8 @@ .. firmware .. + loader.conf.d tags=package=bootloader + .. lua .. kernel diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf index 4f84281e9d2e..a1eb189db7ac 100644 --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -15,6 +15,7 @@ kernel="kernel" # /boot sub-directory containing kernel and modules bootfile="kernel" # Kernel name (possibly absolute path) kernel_options="" # Flags to be passed to the kernel loader_conf_files="/boot/device.hints /boot/loader.conf /boot/loader.conf.local" +loader_conf_dirs="/boot/loader.conf.d" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" # Set to YES for verbose loader output diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 3b31761663e3..3bd83dcc5c30 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd April 29, 2020 +.Dd December 31, 2020 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -88,6 +88,11 @@ than so its use should be avoided. Multiple instances of it will be processed independently. +.It Ar loader_conf_dirs +Space separated list of directories to process for configuration files. +The lua-based loader will process files with a +.Dq .conf +suffix that are placed in these directories. .It Ar loader_conf_files Defines additional configuration files to be processed right after the present file. @@ -253,6 +258,8 @@ The following values are accepted: Space or comma separated list of kernels to present in the boot menu. .It Va loader_conf_files .Pq Dq Pa /boot/loader.conf /boot/loader.conf.local +.It Va loader_conf_dirs +.Pq Dq Pa /boot/loader.conf.d .It Va splash_bmp_load .Pq Dq NO If set to diff --git a/stand/lua/config.lua b/stand/lua/config.lua index 5b554806fc9f..683490cfd23d 100644 --- a/stand/lua/config.lua +++ b/stand/lua/config.lua @@ -39,6 +39,7 @@ local env_changed = {} -- Values to restore env to (nil to unset) local env_restore = {} +local MSG_FAILDIR = "Failed to load conf dir '%s': not a directory" local MSG_FAILEXEC = "Failed to exec '%s'" local MSG_FAILSETENV = "Failed to '%s' with value: %s" local MSG_FAILOPENCFG = "Failed to open config: '%s'" @@ -497,6 +498,8 @@ function config.readConf(file, loaded_files) return end + -- We'll process loader_conf_dirs at the top-level readConf + local load_conf_dirs = next(loaded_files) == nil print("Loading " .. file) -- The final value of loader_conf_files is not important, so just @@ -520,6 +523,27 @@ function config.readConf(file, loaded_files) config.readConf(name, loaded_files) end end + + if load_conf_dirs then + local loader_conf_dirs = getEnv("loader_conf_dirs") + if loader_conf_dirs ~= nil then + for name in loader_conf_dirs:gmatch("[%w%p]+") do + if lfs.attributes(name, "mode") ~= "directory" then + print(MSG_FAILDIR:format(name)) + goto nextdir + end + for cfile in lfs.dir(name) do + if cfile:match(".conf$") then + local fpath = name .. "/" .. cfile + if lfs.attributes(fpath, "mode") == "file" then + config.readConf(fpath, loaded_files) + end + end + end + ::nextdir:: + end + end + end end -- other_kernel is optionally the name of a kernel to load, if not the default From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:18:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EA514E918E; Sun, 24 Jan 2021 03:18:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNdVX6Gtyz3rsw; Sun, 24 Jan 2021 03:18:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0EE81C9A2; Sun, 24 Jan 2021 03:18:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3ICOP029001; Sun, 24 Jan 2021 03:18:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3ICI9029000; Sun, 24 Jan 2021 03:18:12 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:18:12 GMT Message-Id: <202101240318.10O3ICI9029000@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: fd478d518f49 - stable/12 - kern: dup: do not assume oldfde is valid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fd478d518f49084e5bc4ff3ee0ae020c8db42b9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:18:13 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=fd478d518f49084e5bc4ff3ee0ae020c8db42b9e commit fd478d518f49084e5bc4ff3ee0ae020c8db42b9e Author: Kyle Evans AuthorDate: 2020-11-23 00:33:06 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:17:57 +0000 kern: dup: do not assume oldfde is valid oldfde may be invalidated if the table has grown due to the operation that we're performing, either via fdalloc() or a direct fdgrowtable_exp(). This was technically OK before rS367927 because the old table remained valid until the filedesc became unused, but now it may be freed immediately if it's an unshared table in a single-threaded process, so it is no longer a good assumption to make. This fixes dup/dup2 invocations that grow the file table; in the initial report, it manifested as a kernel panic in devel/gmake's configure script. (cherry picked from commit f96078b8fe55c944f32c3c82ebb9c360bc155823) --- sys/kern/kern_descrip.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 1727532a8c95..bfa67c64f265 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -821,7 +821,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) struct filedesc *fdp; struct filedescent *oldfde, *newfde; struct proc *p; - struct file *delfp; + struct file *delfp, *oldfp; u_long *oioctls, *nioctls; int error, maxfd; @@ -860,7 +860,8 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) } oldfde = &fdp->fd_ofiles[old]; - if (!fhold(oldfde->fde_file)) + oldfp = oldfde->fde_file; + if (!fhold(oldfp)) goto unlock; /* @@ -872,14 +873,14 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) case FDDUP_NORMAL: case FDDUP_FCNTL: if ((error = fdalloc(td, new, &new)) != 0) { - fdrop(oldfde->fde_file, td); + fdrop(oldfp, td); goto unlock; } break; case FDDUP_MUSTREPLACE: /* Target file descriptor must exist. */ if (fget_locked(fdp, new) == NULL) { - fdrop(oldfde->fde_file, td); + fdrop(oldfp, td); goto unlock; } break; @@ -900,7 +901,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) PROC_UNLOCK(p); if (error != 0) { error = EMFILE; - fdrop(oldfde->fde_file, td); + fdrop(oldfp, td); goto unlock; } } @@ -916,6 +917,12 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) KASSERT(old != new, ("new fd is same as old")); + /* Refetch oldfde because the table may have grown and old one freed. */ + oldfde = &fdp->fd_ofiles[old]; + KASSERT(oldfp == oldfde->fde_file, + ("fdt_ofiles shift from growth observed at fd %d", + old)); + newfde = &fdp->fd_ofiles[new]; delfp = newfde->fde_file; From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:20:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2802D4E91A8; Sun, 24 Jan 2021 03:20:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNdY10f9pz3sBC; Sun, 24 Jan 2021 03:20:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 092C81CC00; Sun, 24 Jan 2021 03:20:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3KKRH036543; Sun, 24 Jan 2021 03:20:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3KKQx036538; Sun, 24 Jan 2021 03:20:20 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:20:20 GMT Message-Id: <202101240320.10O3KKQx036538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 55850d2b5118 - stable/12 - Makefile: add a small blurb about building with gcc xtoolchain MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 55850d2b511881dc0ad88da904ffc1d0cbe9e52a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:20:21 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=55850d2b511881dc0ad88da904ffc1d0cbe9e52a commit 55850d2b511881dc0ad88da904ffc1d0cbe9e52a Author: Kyle Evans AuthorDate: 2020-10-16 15:16:23 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:19:37 +0000 Makefile: add a small blurb about building with gcc xtoolchain The key details are to install the appropriate flavor of devel/freebsd-gcc6 and pass CROSS_TOOLCHAIN while building. (cherry picked from commit 5f2aaba4532c713f74279f0e83208c97af3a3e69) (cherry picked from commit cf82304d7d5e8d9433d46cbdf2db8c2576b85edd) --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 30c162f2778a..21ce26f215c9 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,17 @@ # 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 +# install the appropriate GCC cross toolchain package: +# `pkg install ${TARGET_ARCH}-gccN` +# +# Once you have installed the necessary cross toolchain, simply pass +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gccN while building with the above steps, +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc6`. +# +# The ${TARGET_ARCH}-gccN packages are provided as flavors of the +# devel/freebsd-gccN ports. +# # See src/UPDATING `COMMON ITEMS' for more complete information. # # If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:43:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07B2E4E9E2C; Sun, 24 Jan 2021 03:43:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNf456jZrz3ttJ; Sun, 24 Jan 2021 03:43:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D79871CF98; Sun, 24 Jan 2021 03:43:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3hn7Z067611; Sun, 24 Jan 2021 03:43:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3hnZ5067610; Sun, 24 Jan 2021 03:43:49 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:43:49 GMT Message-Id: <202101240343.10O3hnZ5067610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 50da94fc7af1 - stable/12 - flua: initial support for "require" in the base system MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 50da94fc7af1b3c515cf4648fc7e3a6c9794f682 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:43:50 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=50da94fc7af1b3c515cf4648fc7e3a6c9794f682 commit 50da94fc7af1b3c515cf4648fc7e3a6c9794f682 Author: Ed Maste AuthorDate: 2020-08-13 00:19:05 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:43:19 +0000 flua: initial support for "require" in the base system Use /usr not /usr/local for base system components. Use /usr/lib/flua and /usr/share/flua (not lua) for consistency and to avoid the possibility that other software accidentally finds our base system modules. Also drop the version from the path, as flua represents an unspecified lua version that corresponds to the FreeBSD version it comes with. LUA_USE_DLOPEN is not yet enabled because some additional changes are needed wrt symbol visibility. (cherry picked from commit bceabe277e1286ec694e34c186a73e7bf2c9de4f) --- etc/mtree/BSD.usr.dist | 4 ++++ lib/liblua/luaconf.h | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index af85ef7647d5..68289fbb0544 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -68,6 +68,8 @@ .. engines .. + flua + .. i18n .. libxo @@ -370,6 +372,8 @@ .. firmware .. + flua + .. games fortune .. diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h index b24645b8915f..db6f3222f101 100644 --- a/lib/liblua/luaconf.h +++ b/lib/liblua/luaconf.h @@ -205,9 +205,9 @@ #else /* }{ */ -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_ROOT "/usr/" +#define LUA_LDIR LUA_ROOT "share/flua/" +#define LUA_CDIR LUA_ROOT "lib/flua/" #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:43:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4420D4E9DB4; Sun, 24 Jan 2021 03:43:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNf470x7Mz3tTG; Sun, 24 Jan 2021 03:43:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 117E61CF27; Sun, 24 Jan 2021 03:43:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3hole067633; Sun, 24 Jan 2021 03:43:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3hoXi067632; Sun, 24 Jan 2021 03:43:50 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:43:50 GMT Message-Id: <202101240343.10O3hoXi067632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 6a61f08108fe - stable/12 - flua: support "require" for binary objects in the base system MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6a61f08108fe863efdb1170125c69d39ec171b30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:43:51 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6a61f08108fe863efdb1170125c69d39ec171b30 commit 6a61f08108fe863efdb1170125c69d39ec171b30 Author: Ed Maste AuthorDate: 2020-08-13 23:13:05 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:43:24 +0000 flua: support "require" for binary objects in the base system Export symbols from flua, and enable dlopen. (cherry picked from commit 3bd8419597b44dc3da2b1e6ffc2c7ee9cf4aa195) --- lib/liblua/luaconf.h | 1 + libexec/flua/Makefile | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h index db6f3222f101..6226e8ab1e84 100644 --- a/lib/liblua/luaconf.h +++ b/lib/liblua/luaconf.h @@ -75,6 +75,7 @@ /* Local modifications: need io.popen */ #ifdef __FreeBSD__ #define LUA_USE_POSIX +#define LUA_USE_DLOPEN #endif /* diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile index 4b5c4ee55416..373f93cbf176 100644 --- a/libexec/flua/Makefile +++ b/libexec/flua/Makefile @@ -32,4 +32,6 @@ CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit LIBADD+= edit .endif +LDFLAGS+= -Wl,-E + .include From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:43:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EF954E9EA3; Sun, 24 Jan 2021 03:43:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNf481v6jz3tcR; Sun, 24 Jan 2021 03:43:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31A4F1D0A1; Sun, 24 Jan 2021 03:43:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3hqlx067652; Sun, 24 Jan 2021 03:43:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3hqaM067651; Sun, 24 Jan 2021 03:43:52 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:43:52 GMT Message-Id: <202101240343.10O3hqaM067651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: bd98a274d0ed - stable/12 - flua: don't allow dlopen, et al., for bootstrap flua MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bd98a274d0edbf596c40435335a37282adaebdb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:43:52 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bd98a274d0edbf596c40435335a37282adaebdb0 commit bd98a274d0edbf596c40435335a37282adaebdb0 Author: Kyle Evans AuthorDate: 2020-08-14 02:22:19 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:43:26 +0000 flua: don't allow dlopen, et al., for bootstrap flua There are some logistics issues that need to be sorted out here before we can actually allow this to work. It's not really safe to allow LUA_USE_DLOPEN with host lib paths being used. The host system could have an entirely different lua version and this could cause us to crash and burn. If we want to revive this later, we need to make sure to define c module paths inside OBJDIR that are compiled against whatever version we've bootstrapped. (cherry picked from commit c2a2b4f3cf11e770892a524df637f671f5989719) (cherry picked from commit 967fbfd9e2b7a015d5cba1491badcdf9044b28b9) --- lib/liblua/Makefile | 2 ++ lib/liblua/luaconf.h | 2 ++ libexec/flua/Makefile | 3 +-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/liblua/Makefile b/lib/liblua/Makefile index 28fc05a9aa71..e5f5e3c5960a 100644 --- a/lib/liblua/Makefile +++ b/lib/liblua/Makefile @@ -29,6 +29,8 @@ CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" .if defined(BOOTSTRAPPING) CFLAGS+= -DLUA_PATH_DEFAULT="\"/nonexistent/?.lua\"" CFLAGS+= -DLUA_CPATH_DEFAULT="\"/nonexistent/?.so\"" +# We don't support dynamic libs on bootstrap builds. +CFLAGS+= -DBOOTSTRAPPING .endif .include diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h index 6226e8ab1e84..bc7f5bb6e141 100644 --- a/lib/liblua/luaconf.h +++ b/lib/liblua/luaconf.h @@ -75,8 +75,10 @@ /* Local modifications: need io.popen */ #ifdef __FreeBSD__ #define LUA_USE_POSIX +#ifndef BOOTSTRAPPING #define LUA_USE_DLOPEN #endif +#endif /* @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile index 373f93cbf176..0cd8ca924495 100644 --- a/libexec/flua/Makefile +++ b/libexec/flua/Makefile @@ -30,8 +30,7 @@ CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" CFLAGS+= -DLUA_USE_READLINE CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit LIBADD+= edit -.endif - LDFLAGS+= -Wl,-E +.endif .include From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:43:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40CA84E9F24; Sun, 24 Jan 2021 03:43:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNf495mFNz3tX2; Sun, 24 Jan 2021 03:43:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 772C91CF99; Sun, 24 Jan 2021 03:43:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3hruo067674; Sun, 24 Jan 2021 03:43:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3hr64067673; Sun, 24 Jan 2021 03:43:53 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:43:53 GMT Message-Id: <202101240343.10O3hr64067673@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 12139a196aca - stable/12 - Fix -Wundef warnings when building liblua MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 12139a196aca6701dd096f373742e0f97735597c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:43:59 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=12139a196aca6701dd096f373742e0f97735597c commit 12139a196aca6701dd096f373742e0f97735597c Author: Alex Richardson AuthorDate: 2020-08-25 13:30:34 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:43:26 +0000 Fix -Wundef warnings when building liblua We need to define the LUA_FLOAT_INT64 macro even if we don't use it (copied from stand/luaconf.h). While touching luaconf.h.dist also sync it with the the 5.3.5 release version (matches the one in lib/liblua). (cherry picked from commit 0c54932d50a0cbffdd083bf6b2e8d587902f90c9) --- contrib/lua/src/luaconf.h.dist | 10 +++++++++- lib/liblua/luaconf.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/contrib/lua/src/luaconf.h.dist b/contrib/lua/src/luaconf.h.dist index f37bea0964bd..1b96c5443ebf 100644 --- a/contrib/lua/src/luaconf.h.dist +++ b/contrib/lua/src/luaconf.h.dist @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $ +** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -114,6 +114,7 @@ #define LUA_FLOAT_FLOAT 1 #define LUA_FLOAT_DOUBLE 2 #define LUA_FLOAT_LONGDOUBLE 3 +#define LUA_FLOAT_INT64 4 #if defined(LUA_32BITS) /* { */ /* @@ -620,6 +621,13 @@ #endif +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) + + /* @@ lua_number2strx converts a float to an hexadecimal numeric string. ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. diff --git a/lib/liblua/luaconf.h b/lib/liblua/luaconf.h index bc7f5bb6e141..d13fde35fb5a 100644 --- a/lib/liblua/luaconf.h +++ b/lib/liblua/luaconf.h @@ -122,6 +122,7 @@ #define LUA_FLOAT_FLOAT 1 #define LUA_FLOAT_DOUBLE 2 #define LUA_FLOAT_LONGDOUBLE 3 +#define LUA_FLOAT_INT64 4 #if defined(LUA_32BITS) /* { */ /* From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:49:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 049704EA0EB; Sun, 24 Jan 2021 03:49:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfBT6YL4z3vR0; Sun, 24 Jan 2021 03:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C941F1D0A6; Sun, 24 Jan 2021 03:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3nLWx068607; Sun, 24 Jan 2021 03:49:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3nLj2068606; Sun, 24 Jan 2021 03:49:21 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:49:21 GMT Message-Id: <202101240349.10O3nLj2068606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: f817905593d4 - stable/12 - flua: implement chmod MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f817905593d484861e1ffcb6c882ff7410bfe00c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:49:22 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f817905593d484861e1ffcb6c882ff7410bfe00c commit f817905593d484861e1ffcb6c882ff7410bfe00c Author: Ed Maste AuthorDate: 2020-03-13 15:40:35 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:49:11 +0000 flua: implement chmod Lua does not provide a native way to change the permission of a file. (cherry picked from commit 405e3338ac841999673056a2b5537b4c0ad677db) --- libexec/flua/linit_flua.c | 1 + libexec/flua/modules/lposix.c | 38 ++++++++++++++++++++++++++++++++++++++ libexec/flua/modules/lposix.h | 1 + 3 files changed, 40 insertions(+) diff --git a/libexec/flua/linit_flua.c b/libexec/flua/linit_flua.c index 4b4069e9ad62..99818c3b4db7 100644 --- a/libexec/flua/linit_flua.c +++ b/libexec/flua/linit_flua.c @@ -57,6 +57,7 @@ static const luaL_Reg loadedlibs[] = { #endif /* FreeBSD Extensions */ {"lfs", luaopen_lfs}, + {"posix.sys.stat", luaopen_posix_sys_stat}, {"posix.unistd", luaopen_posix_unistd}, {NULL, NULL} }; diff --git a/libexec/flua/modules/lposix.c b/libexec/flua/modules/lposix.c index 208802456fed..adf3a7bb9a1f 100644 --- a/libexec/flua/modules/lposix.c +++ b/libexec/flua/modules/lposix.c @@ -27,6 +27,10 @@ #include __FBSDID("$FreeBSD$"); +#include + +#include +#include #include #include @@ -37,6 +41,28 @@ __FBSDID("$FreeBSD$"); * Minimal implementation of luaposix needed for internal FreeBSD bits. */ +static int +lua_chmod(lua_State *L) +{ + int n; + const char *path; + mode_t mode; + + n = lua_gettop(L); + luaL_argcheck(L, n == 2, n > 2 ? 3 : n, + "chmod takes exactly two arguments"); + path = luaL_checkstring(L, 1); + mode = (mode_t)luaL_checkinteger(L, 2); + if (chmod(path, mode) == -1) { + lua_pushnil(L); + lua_pushstring(L, strerror(errno)); + lua_pushinteger(L, errno); + return 3; + } + lua_pushinteger(L, 0); + return 1; +} + static int lua_getpid(lua_State *L) { @@ -49,12 +75,24 @@ lua_getpid(lua_State *L) } #define REG_SIMPLE(n) { #n, lua_ ## n } +static const struct luaL_Reg sys_statlib[] = { + REG_SIMPLE(chmod), + { NULL, NULL }, +}; + static const struct luaL_Reg unistdlib[] = { REG_SIMPLE(getpid), { NULL, NULL }, }; #undef REG_SIMPLE +int +luaopen_posix_sys_stat(lua_State *L) +{ + luaL_newlib(L, sys_statlib); + return 1; +} + int luaopen_posix_unistd(lua_State *L) { diff --git a/libexec/flua/modules/lposix.h b/libexec/flua/modules/lposix.h index 4c771d79769f..d2d9ec0cd677 100644 --- a/libexec/flua/modules/lposix.h +++ b/libexec/flua/modules/lposix.h @@ -8,4 +8,5 @@ #include +int luaopen_posix_sys_stat(lua_State *L); int luaopen_posix_unistd(lua_State *L); From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:51:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 721224EA3B4; Sun, 24 Jan 2021 03:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfDq2n4zz3vSH; Sun, 24 Jan 2021 03:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 529401CB7F; Sun, 24 Jan 2021 03:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3pNtj077267; Sun, 24 Jan 2021 03:51:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3pNYS077266; Sun, 24 Jan 2021 03:51:23 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:51:23 GMT Message-Id: <202101240351.10O3pNYS077266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: e86393dbec72 - stable/12 - libregex: re-enable `make check` MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e86393dbec7249257ffb0d74eb907fb9f6478f7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:51:23 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e86393dbec7249257ffb0d74eb907fb9f6478f7c commit e86393dbec7249257ffb0d74eb907fb9f6478f7c Author: Kyle Evans AuthorDate: 2021-01-08 19:57:32 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:51:16 +0000 libregex: re-enable `make check` The tests are generally expected to pass, uncomment the annotation that lets `make check` work. Note that `make check` currently requires kyua from ports or an appropriate symlink into /usr/local/bin. (cherry picked from commit 04a3ba363d13cf5efaeb63f64cd3fdd6b9c71248) --- lib/libregex/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libregex/Makefile b/lib/libregex/Makefile index 186bb20088ce..5e54c3a5312a 100644 --- a/lib/libregex/Makefile +++ b/lib/libregex/Makefile @@ -14,7 +14,7 @@ WARNS?= 2 VERSION_DEF= ${.CURDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map -#HAS_TESTS= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../Makefile.inc" From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 03:54:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EA274EA6A5; Sun, 24 Jan 2021 03:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfJ83N3cz3vrB; Sun, 24 Jan 2021 03:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 583031CFF4; Sun, 24 Jan 2021 03:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O3sG1C080838; Sun, 24 Jan 2021 03:54:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O3sGle080837; Sun, 24 Jan 2021 03:54:16 GMT (envelope-from git) Date: Sun, 24 Jan 2021 03:54:16 GMT Message-Id: <202101240354.10O3sGle080837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 5ff2a3cb9e93 - stable/12 - libc: tests: hook CPUSET(9) test up to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5ff2a3cb9e93fe07d39973772926b86ec5ee73d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 03:54:16 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5ff2a3cb9e93fe07d39973772926b86ec5ee73d5 commit 5ff2a3cb9e93fe07d39973772926b86ec5ee73d5 Author: Kyle Evans AuthorDate: 2020-12-31 18:26:01 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 03:54:00 +0000 libc: tests: hook CPUSET(9) test up to the build Add shims to map NetBSD's API to CPUSET(9). Obviously the invalid input parts of these tests are relatively useless since we're just testing the shims that aren't used elsewhere, there's still some amount of value in the parts testing valid inputs. Differential Revision: https://reviews.freebsd.org/D27307 (cherry picked from commit 9e1281eabafa4aaf84828e70488c1802717b59af) --- contrib/netbsd-tests/lib/libc/gen/t_cpuset.c | 40 ++++++++++++++++++++++++++++ lib/libc/tests/gen/Makefile | 3 ++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c b/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c index 9eca03bae2b0..56ab7364af2a 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_cpuset.c @@ -36,6 +36,46 @@ __RCSID("$NetBSD: t_cpuset.c,v 1.1 2011/11/08 05:47:00 jruoho Exp $"); #include #include +#ifdef __FreeBSD__ +#include + +#include + +#define cpuset_create() calloc(1, sizeof(cpuset_t)) +#define cpuset_destroy(cs) free(cs) + +static inline int +cpuset_set(size_t i, cpuset_t *cs) +{ + + if (i > CPU_SETSIZE) + return (-1); + CPU_SET(i, cs); + return (0); +} + +static inline int +cpuset_clr(size_t i, cpuset_t *cs) +{ + + if (i > CPU_SETSIZE) + return (-1); + CPU_CLR(i, cs); + return (0); +} + +static inline int +cpuset_isset(size_t i, cpuset_t *cs) +{ + + if (i > CPU_SETSIZE) + return (-1); + return (CPU_ISSET(i, cs)); +} + +#define cpuset_size(cs) sizeof(*cs) +#endif + ATF_TC(cpuset_err); ATF_TC_HEAD(cpuset_err, tc) { diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile index 74a245779d1b..aa6a6a1179f1 100644 --- a/lib/libc/tests/gen/Makefile +++ b/lib/libc/tests/gen/Makefile @@ -20,7 +20,7 @@ ATF_TESTS_C+= realpath2_test ATF_TESTS_C+= sigsetops_test ATF_TESTS_C+= wordexp_test -# TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, +# TODO: t_closefrom, t_fmtcheck, t_randomid, # TODO: t_siginfo (fixes require further inspection) # TODO: t_sethostname_test (consistently screws up the hostname) @@ -46,6 +46,7 @@ CFLAGS+= -D__HAVE_LONG_DOUBLE NETBSD_ATF_TESTS_C= alarm_test NETBSD_ATF_TESTS_C+= assert_test NETBSD_ATF_TESTS_C+= basedirname_test +NETBSD_ATF_TESTS_C+= cpuset_test NETBSD_ATF_TESTS_C+= dir_test NETBSD_ATF_TESTS_C+= floatunditf_test NETBSD_ATF_TESTS_C+= fnmatch_test From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:00:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07CB84EA8CD; Sun, 24 Jan 2021 04:00:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfRL6TmSz3wMx; Sun, 24 Jan 2021 04:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C012D1D37A; Sun, 24 Jan 2021 04:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O40U3X089258; Sun, 24 Jan 2021 04:00:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O40UQ5089257; Sun, 24 Jan 2021 04:00:30 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:00:30 GMT Message-Id: <202101240400.10O40UQ5089257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d569ea6a4518 - stable/12 - Bump up the low range of cpuset numbers to account for the kernel cpuset. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d569ea6a4518f552817f3b59ffc66e1277d89921 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:00:31 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d569ea6a4518f552817f3b59ffc66e1277d89921 commit d569ea6a4518f552817f3b59ffc66e1277d89921 Author: Stephen J. Kiernan AuthorDate: 2019-09-05 17:48:39 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:00:02 +0000 Bump up the low range of cpuset numbers to account for the kernel cpuset. Obtained from: Juniper Networks, Inc. (cherry picked from commit d57cd5ccd38299ae9834c4f913c4b5cbe53dee1e) --- sys/kern/kern_cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 288349633614..9206ac3b5235 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -1628,7 +1628,7 @@ cpuset_thread0(void) /* * Initialize the unit allocator. 0 and 1 are allocated above. */ - cpuset_unr = new_unrhdr(2, INT_MAX, NULL); + cpuset_unr = new_unrhdr(3, INT_MAX, NULL); /* * If MD code has not initialized per-domain cpusets, place all From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:00:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2289F4EA8CE; Sun, 24 Jan 2021 04:00:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfRM6B0Rz3wQN; Sun, 24 Jan 2021 04:00:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD8881CFFA; Sun, 24 Jan 2021 04:00:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O40Vst089277; Sun, 24 Jan 2021 04:00:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O40V7H089276; Sun, 24 Jan 2021 04:00:31 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:00:31 GMT Message-Id: <202101240400.10O40V7H089276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 43e92dc0d56b - stable/12 - libc: tests: add some tests for cpuset(2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 43e92dc0d56ba57b56f807a3bade8de470e70065 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:00:32 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=43e92dc0d56ba57b56f807a3bade8de470e70065 commit 43e92dc0d56ba57b56f807a3bade8de470e70065 Author: Kyle Evans AuthorDate: 2020-12-31 18:30:43 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:00:16 +0000 libc: tests: add some tests for cpuset(2) The cpuset(2) tests should be run as root (require.user properly set) with >= 3 cpus for maximum coverage. All tests that want to modify the cpuset don't assume any particular cpu layout (i.e. the first cpu may not be 0, the last may not be first + count) and the following scenarios are tested: 1.) newset: basic execute cpuset() to grab a new cpuset, make sure the assigned cpuset then has a different ID. 2.) transient: create a new cpuset then assign the process its original cpuset, ensuring that the one we created is now gone. 3.) deadlk: test assigning an anonymous mask, then resetting the process base affinity with 1-cpu overlap w.r.t. the anonymous mask and with 0-cpu overlap w.r.t. the anonymous mask. 4.) jail_attach_newbase: process attaches to a jail with its own cpuset+mask (e.g. cpuset -c -l 1,2 jail -c path=/ command=/bin/sh) 5.) jail_attach_newbase_plain: process attaches to a jail with its own cpuset (e.g. cpuset -c jail -c path=/ command=/bin/sh) 6.) jail_attach_prevbase: process attaches to a jail with the containing jail's root cpuset (e.g. jail -c path=/ command=/bin/sh) 7.) jail_attach_plain: process attaches to a jail with the containing jail's root cpuset+mask. 8.) badparent: creates a new cpuset and modifies the anonymous thread mask, then setid's back to the original and checks that cpuset_getid() returns the expected set. (cherry picked from commit 1fc421287d5ddbcfba99412cf968ee3490383fe7) --- lib/libc/tests/sys/Makefile | 1 + lib/libc/tests/sys/cpuset_test.c | 493 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 494 insertions(+) diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index bffa9b1df70f..e01eb8c0f9f0 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -7,6 +7,7 @@ PACKAGE= tests .if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" ATF_TESTS_C+= brk_test .endif +ATF_TESTS_C+= cpuset_test ATF_TESTS_C+= queue_test ATF_TESTS_C+= sendfile_test diff --git a/lib/libc/tests/sys/cpuset_test.c b/lib/libc/tests/sys/cpuset_test.c new file mode 100644 index 000000000000..d6dd69e7e3c1 --- /dev/null +++ b/lib/libc/tests/sys/cpuset_test.c @@ -0,0 +1,493 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define SP_PARENT 0 +#define SP_CHILD 1 + +struct jail_test_info { + cpuset_t jail_tidmask; + cpusetid_t jail_cpuset; + cpusetid_t jail_child_cpuset; +}; + +struct jail_test_cb_params { + struct jail_test_info info; + cpuset_t mask; + cpusetid_t rootid; + cpusetid_t setid; +}; + +typedef void (*jail_test_cb)(struct jail_test_cb_params *); + +#define FAILURE_JAIL 42 +#define FAILURE_MASK 43 +#define FAILURE_JAILSET 44 +#define FAILURE_PIDSET 45 +#define FAILURE_SEND 46 + +static const char * +do_jail_errstr(int error) +{ + + switch (error) { + case FAILURE_JAIL: + return ("jail_set(2) failed"); + case FAILURE_MASK: + return ("Failed to get the thread cpuset mask"); + case FAILURE_JAILSET: + return ("Failed to get the jail setid"); + case FAILURE_PIDSET: + return ("Failed to get the pid setid"); + case FAILURE_SEND: + return ("Failed to send(2) cpuset information"); + default: + return (NULL); + } +} + +static void +skip_ltncpu(int ncpu, cpuset_t *mask) +{ + + CPU_ZERO(mask); + ATF_REQUIRE_EQ(0, cpuset_getaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, sizeof(*mask), mask)); + if (CPU_COUNT(mask) < ncpu) + atf_tc_skip("Test requires %d or more cores.", ncpu); +} + +ATF_TC(newset); +ATF_TC_HEAD(newset, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test cpuset(2)"); +} +ATF_TC_BODY(newset, tc) +{ + cpusetid_t nsetid, setid, qsetid; + + /* Obtain our initial set id. */ + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_TID, -1, + &setid)); + + /* Create a new one. */ + ATF_REQUIRE_EQ(0, cpuset(&nsetid)); + ATF_CHECK(nsetid != setid); + + /* Query id again, make sure it's equal to the one we just got. */ + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_TID, -1, + &qsetid)); + ATF_CHECK_EQ(nsetid, qsetid); +} + +ATF_TC(transient); +ATF_TC_HEAD(transient, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that transient cpusets are freed."); +} +ATF_TC_BODY(transient, tc) +{ + cpusetid_t isetid, scratch, setid; + + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, + &isetid)); + + ATF_REQUIRE_EQ(0, cpuset(&setid)); + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_CPUSET, + setid, &scratch)); + + /* + * Return back to our initial cpuset; the kernel should free the cpuset + * we just created. + */ + ATF_REQUIRE_EQ(0, cpuset_setid(CPU_WHICH_PID, -1, isetid)); + ATF_REQUIRE_EQ(-1, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_CPUSET, + setid, &scratch)); + ATF_CHECK_EQ(ESRCH, errno); +} + +ATF_TC(deadlk); +ATF_TC_HEAD(deadlk, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test against disjoint cpusets."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(deadlk, tc) +{ + cpusetid_t setid; + cpuset_t dismask, mask, omask; + int fcpu, i, found, ncpu, second; + + /* Make sure we have 3 cpus, so we test partial overlap. */ + skip_ltncpu(3, &omask); + + ATF_REQUIRE_EQ(0, cpuset(&setid)); + CPU_ZERO(&mask); + CPU_ZERO(&dismask); + CPU_COPY(&omask, &mask); + CPU_COPY(&omask, &dismask); + fcpu = CPU_FFS(&mask); + ncpu = CPU_COUNT(&mask); + + /* + * Turn off all but the first two for mask, turn off the first for + * dismask and turn them all off for both after the third. + */ + for (i = fcpu - 1, found = 0; i < CPU_MAXSIZE && found != ncpu; i++) { + if (CPU_ISSET(i, &omask)) { + found++; + if (found == 1) { + CPU_CLR(i, &dismask); + } else if (found == 2) { + second = i; + } else if (found >= 3) { + CPU_CLR(i, &mask); + if (found > 3) + CPU_CLR(i, &dismask); + } + } + } + + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, sizeof(mask), &mask)); + + /* Must be a strict subset! */ + ATF_REQUIRE_EQ(-1, cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(dismask), &dismask)); + ATF_REQUIRE_EQ(EINVAL, errno); + + /* + * We'll set our anonymous set to the 0,1 set that currently matches + * the process. If we then set the process to the 1,2 set that's in + * dismask, we should then personally be restricted down to the single + * overlapping CPOU. + */ + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(mask), &mask)); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, sizeof(dismask), &dismask)); + ATF_REQUIRE_EQ(0, cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(mask), &mask)); + ATF_REQUIRE_EQ(1, CPU_COUNT(&mask)); + ATF_REQUIRE(CPU_ISSET(second, &mask)); + + /* + * Finally, clearing the overlap and attempting to set the process + * cpuset to a completely disjoint mask should fail, because this + * process will then not have anything to run on. + */ + CPU_CLR(second, &dismask); + ATF_REQUIRE_EQ(-1, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, sizeof(dismask), &dismask)); + ATF_REQUIRE_EQ(EDEADLK, errno); +} + +static int +do_jail(int sock) +{ + struct jail_test_info info; + struct iovec iov[2]; + char *name; + int error; + + if (asprintf(&name, "cpuset_%d", getpid()) == -1) + _exit(42); + + iov[0].iov_base = "name"; + iov[0].iov_len = 5; + + iov[1].iov_base = name; + iov[1].iov_len = strlen(name) + 1; + + if (jail_set(iov, 2, JAIL_CREATE | JAIL_ATTACH) < 0) + return (FAILURE_JAIL); + + /* Record parameters, kick them over, then make a swift exit. */ + CPU_ZERO(&info.jail_tidmask); + error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(info.jail_tidmask), &info.jail_tidmask); + if (error != 0) + return (FAILURE_MASK); + + error = cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_TID, -1, + &info.jail_cpuset); + if (error != 0) + return (FAILURE_JAILSET); + error = cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_TID, -1, + &info.jail_child_cpuset); + if (error != 0) + return (FAILURE_PIDSET); + if (send(sock, &info, sizeof(info), 0) != sizeof(info)) + return (FAILURE_SEND); + return (0); +} + +static void +do_jail_test(int ncpu, bool newset, jail_test_cb prologue, + jail_test_cb epilogue) +{ + struct jail_test_cb_params cbp; + const char *errstr; + pid_t pid; + int error, sock, sockpair[2], status; + + memset(&cbp.info, '\0', sizeof(cbp.info)); + + skip_ltncpu(ncpu, &cbp.mask); + + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, + &cbp.rootid)); + if (newset) + ATF_REQUIRE_EQ(0, cpuset(&cbp.setid)); + else + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, &cbp.setid)); + /* Special hack for prison0; it uses cpuset 1 as the root. */ + if (cbp.rootid == 0) + cbp.rootid = 1; + + /* Not every test needs early setup. */ + if (prologue != NULL) + (*prologue)(&cbp); + + ATF_REQUIRE_EQ(0, socketpair(PF_UNIX, SOCK_STREAM, 0, sockpair)); + ATF_REQUIRE((pid = fork()) != -1); + + if (pid == 0) { + /* Child */ + close(sockpair[SP_PARENT]); + sock = sockpair[SP_CHILD]; + + _exit(do_jail(sock)); + } else { + /* Parent */ + sock = sockpair[SP_PARENT]; + close(sockpair[SP_CHILD]); + + while ((error = waitpid(pid, &status, 0)) == -1 && + errno == EINTR) { + } + + ATF_REQUIRE_EQ(sizeof(cbp.info), recv(sock, &cbp.info, + sizeof(cbp.info), 0)); + + /* Sanity check the exit info. */ + ATF_REQUIRE_EQ(pid, error); + ATF_REQUIRE(WIFEXITED(status)); + if (WEXITSTATUS(status) != 0) { + errstr = do_jail_errstr(WEXITSTATUS(status)); + if (errstr != NULL) + atf_tc_fail("%s", errstr); + else + atf_tc_fail("Unknown error '%d'", + WEXITSTATUS(status)); + } + + epilogue(&cbp); + } +} + +static void +jail_attach_mutate_pro(struct jail_test_cb_params *cbp) +{ + cpuset_t *mask; + int count; + + mask = &cbp->mask; + + /* Knock out the first cpu. */ + count = CPU_COUNT(mask); + CPU_CLR(CPU_FFS(mask) - 1, mask); + ATF_REQUIRE_EQ(count - 1, CPU_COUNT(mask)); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(*mask), mask)); +} + +static void +jail_attach_newbase_epi(struct jail_test_cb_params *cbp) +{ + struct jail_test_info *info; + cpuset_t *mask; + + info = &cbp->info; + mask = &cbp->mask; + + /* + * The rootid test has been thrown in because a bug was discovered + * where any newly derived cpuset during attach would be parented to + * the wrong cpuset. Otherwise, we should observe that a new cpuset + * has been created for this process. + */ + ATF_REQUIRE(info->jail_cpuset != cbp->rootid); + ATF_REQUIRE(info->jail_cpuset != cbp->setid); + ATF_REQUIRE(info->jail_cpuset != info->jail_child_cpuset); + ATF_REQUIRE_EQ(0, CPU_CMP(mask, &info->jail_tidmask)); +} + +ATF_TC(jail_attach_newbase); +ATF_TC_HEAD(jail_attach_newbase, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test jail attachment effect on affinity with a new base cpuset."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_attach_newbase, tc) +{ + + /* Need >= 2 cpus to test restriction. */ + do_jail_test(2, true, &jail_attach_mutate_pro, + &jail_attach_newbase_epi); +} + +ATF_TC(jail_attach_newbase_plain); +ATF_TC_HEAD(jail_attach_newbase_plain, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test jail attachment effect on affinity with a new, unmodified base cpuset."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_attach_newbase_plain, tc) +{ + + do_jail_test(2, true, NULL, &jail_attach_newbase_epi); +} + +/* + * Generic epilogue for tests that are expecting to use the jail's root cpuset + * with their own mask, whether that's been modified or not. + */ +static void +jail_attach_jset_epi(struct jail_test_cb_params *cbp) +{ + struct jail_test_info *info; + cpuset_t *mask; + + info = &cbp->info; + mask = &cbp->mask; + + ATF_REQUIRE(info->jail_cpuset != cbp->setid); + ATF_REQUIRE_EQ(info->jail_cpuset, info->jail_child_cpuset); + ATF_REQUIRE_EQ(0, CPU_CMP(mask, &info->jail_tidmask)); +} + +ATF_TC(jail_attach_prevbase); +ATF_TC_HEAD(jail_attach_prevbase, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test jail attachment effect on affinity without a new base."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_attach_prevbase, tc) +{ + + do_jail_test(2, false, &jail_attach_mutate_pro, &jail_attach_jset_epi); +} + +static void +jail_attach_plain_pro(struct jail_test_cb_params *cbp) +{ + + if (cbp->setid != cbp->rootid) + atf_tc_skip("Must be running with the root cpuset."); +} + +ATF_TC(jail_attach_plain); +ATF_TC_HEAD(jail_attach_plain, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test jail attachment effect on affinity without specialization."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_attach_plain, tc) +{ + + do_jail_test(1, false, &jail_attach_plain_pro, &jail_attach_jset_epi); +} + +ATF_TC(badparent); +ATF_TC_HEAD(badparent, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test parent assignment when assigning a new cpuset."); +} +ATF_TC_BODY(badparent, tc) +{ + cpuset_t mask; + cpusetid_t finalsetid, origsetid, setid; + + /* Need to mask off at least one CPU. */ + skip_ltncpu(2, &mask); + + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_TID, -1, + &origsetid)); + + ATF_REQUIRE_EQ(0, cpuset(&setid)); + + /* + * Mask off the first CPU, then we'll reparent ourselves to our original + * set. + */ + CPU_CLR(CPU_FFS(&mask) - 1, &mask); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, + -1, sizeof(mask), &mask)); + + ATF_REQUIRE_EQ(0, cpuset_setid(CPU_WHICH_PID, -1, origsetid)); + ATF_REQUIRE_EQ(0, cpuset_getid(CPU_LEVEL_CPUSET, CPU_WHICH_TID, -1, + &finalsetid)); + + ATF_REQUIRE_EQ(finalsetid, origsetid); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, newset); + ATF_TP_ADD_TC(tp, transient); + ATF_TP_ADD_TC(tp, deadlk); + ATF_TP_ADD_TC(tp, jail_attach_newbase); + ATF_TP_ADD_TC(tp, jail_attach_newbase_plain); + ATF_TP_ADD_TC(tp, jail_attach_prevbase); + ATF_TP_ADD_TC(tp, jail_attach_plain); + ATF_TP_ADD_TC(tp, badparent); + return (atf_no_error()); +} From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:03:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB5344EAD31; Sun, 24 Jan 2021 04:03:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfVz3Sb8z4R8d; Sun, 24 Jan 2021 04:03:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38C4A1CECC; Sun, 24 Jan 2021 04:03:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O43cnp093740; Sun, 24 Jan 2021 04:03:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O43cuf093739; Sun, 24 Jan 2021 04:03:38 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:03:38 GMT Message-Id: <202101240403.10O43cuf093739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ac6e3a14070e - stable/12 - cpuset: refcount-clean MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ac6e3a14070ec6e4a898857f1022eba3d999edba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:03:39 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ac6e3a14070ec6e4a898857f1022eba3d999edba commit ac6e3a14070ec6e4a898857f1022eba3d999edba Author: Mateusz Guzik AuthorDate: 2020-11-17 00:04:05 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:03:32 +0000 cpuset: refcount-clean (cherry picked from commit 1a7bb8962904b4eef9d968d98afda31c08612868) --- sys/kern/kern_cpuset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 9206ac3b5235..aa3f6bb70bca 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -1603,7 +1603,7 @@ cpuset_thread0(void) CPU_COPY(&all_cpus, &set->cs_mask); LIST_INIT(&set->cs_children); LIST_INSERT_HEAD(&cpuset_ids, set, cs_link); - set->cs_ref = 1; + refcount_init(&set->cs_ref, 1); set->cs_flags = CPU_SET_ROOT | CPU_SET_RDONLY; set->cs_domain = &domainset0; cpuset_zero = set; @@ -2414,7 +2414,7 @@ DB_SHOW_COMMAND(cpusets, db_show_cpusets) LIST_FOREACH(set, &cpuset_ids, cs_link) { db_printf("set=%p id=%-6u ref=%-6d flags=0x%04x parent id=%d\n", - set, set->cs_id, set->cs_ref, set->cs_flags, + set, set->cs_id, refcount_load(&set->cs_ref), set->cs_flags, (set->cs_parent != NULL) ? set->cs_parent->cs_id : 0); db_printf(" cpu mask="); ddb_display_cpuset(&set->cs_mask); From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:05:16 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 763694EA964; Sun, 24 Jan 2021 04:05:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfXr0qVcz4Qx4; Sun, 24 Jan 2021 04:05:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFD281CF77; Sun, 24 Jan 2021 04:05:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O45FrM094094; Sun, 24 Jan 2021 04:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O45FcX094093; Sun, 24 Jan 2021 04:05:15 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:05:15 GMT Message-Id: <202101240405.10O45FcX094093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 4b74a4d4e267 - stable/12 - du: tests: fix the H_flag test (primarily grep usage) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4b74a4d4e26788ae8e47ec10172ac80ce435dbb5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:05:16 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4b74a4d4e26788ae8e47ec10172ac80ce435dbb5 commit 4b74a4d4e26788ae8e47ec10172ac80ce435dbb5 Author: Kyle Evans AuthorDate: 2021-01-05 21:33:06 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:04:55 +0000 du: tests: fix the H_flag test (primarily grep usage) This test attempts to use \t (tab intended) in a grep expression. With the former /usr/bin/grep (i.e. gnugrep), this was interpreted as a literal 't'. The expression would work anyways because the tr(1) usage would ultimately replace all of the spaces with a single newline, and they would match the paths whether they were correctly fromatted or not. Current /usr/bin/grep (i.e. bsdgrep) is less-tolerant of ordinary-escapes, a property of the underlying regex(3) engine, to make it easier to identify when stuff like this happens. In-fact, this expression broke after the switch happened. This revision does the bare basics to fix the usage by using a printf to get a literal tab character to insert into the expression. It also swaps out the manual insertion of the line prefix into the grep expression by pulling that part out of $sep and reusing it for the leading path. The secondary issue was the tr(1) usage, since tr would only replace the first character of string1 with the first character of string2. This has instead been replaced by a sed expression, which similary understands \n to be a newline on all supported versions of FreeBSD. Each path now gets prefixed with the appropriate context that should be there (i.e. numeric sequence followed by a tab). PR: 252446 (cherry picked from commit 4832d2e8ae1df6f907ac00275764f8135722cb7e) --- usr.bin/du/tests/du_test.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh index 395051a0d781..4a8f11e83ff5 100755 --- a/usr.bin/du/tests/du_test.sh +++ b/usr.bin/du/tests/du_test.sh @@ -46,15 +46,16 @@ H_flag_body() { local paths1='testdir/A/B testdir/A testdir/C testdir' local paths2='testdir/A/B testdir/A testdir/C testdir' - local sep='\n[0-9]+\t' + local lineprefix="^[0-9]+$(printf "\t")" + local sep="\n${lineprefix}" atf_check mkdir testdir atf_check -x "cd testdir && mkdir A && touch A/B && ln -s A C" atf_check -o save:du.out du -aAH testdir - atf_check egrep -q "[0-9]+\t$(echo $paths1 | tr ' ' "$sep")\n" du.out + atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")" du.out atf_check -o save:du_C.out du -aAH testdir/C - atf_check egrep -q "[0-9]+\t$(echo $paths2 | tr ' ' "$sep")\n" du_C.out + atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")" du_C.out } atf_test_case I_flag From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:05:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDC2A4EAE8F; Sun, 24 Jan 2021 04:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNfXs1gTXz4RFl; Sun, 24 Jan 2021 04:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 214461CF78; Sun, 24 Jan 2021 04:05:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O45Gg8094113; Sun, 24 Jan 2021 04:05:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O45GAV094112; Sun, 24 Jan 2021 04:05:16 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:05:16 GMT Message-Id: <202101240405.10O45GAV094112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ad62ba026e4d - stable/12 - du: tests: make H_flag tests more strict about output requirements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ad62ba026e4d91f01569ca17f3b9f900a60cc08f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:05:17 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ad62ba026e4d91f01569ca17f3b9f900a60cc08f commit ad62ba026e4d91f01569ca17f3b9f900a60cc08f Author: Kyle Evans AuthorDate: 2021-01-05 21:49:46 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:05:00 +0000 du: tests: make H_flag tests more strict about output requirements The current version of this test will effectively pass as long as one of the specified paths is in the output, and it could even be a subset of one of the paths. Strengthen up the test a little bit: * Specify beginning/end anchors for each path * Add egrep -v checks to make sure we don't have any *additional* paths * Ratchet down paths2 to exactly the two paths we expect to appear (cherry picked from commit 3c5c39c7ad8f010cfa5fc0db43d15d1964b4cf16) --- usr.bin/du/tests/du_test.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh index 4a8f11e83ff5..92a26deae02b 100755 --- a/usr.bin/du/tests/du_test.sh +++ b/usr.bin/du/tests/du_test.sh @@ -45,17 +45,25 @@ H_flag_head() H_flag_body() { local paths1='testdir/A/B testdir/A testdir/C testdir' - local paths2='testdir/A/B testdir/A testdir/C testdir' + local paths2='testdir/C/B testdir/C' local lineprefix="^[0-9]+$(printf "\t")" - local sep="\n${lineprefix}" + local sep="\$\n${lineprefix}" atf_check mkdir testdir atf_check -x "cd testdir && mkdir A && touch A/B && ln -s A C" atf_check -o save:du.out du -aAH testdir - atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")" du.out + atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")$" du.out + # Check that the output doesn't contain any lines (i.e. paths) that we + # did not expect it to contain from $paths1. + atf_check -s exit:1 egrep -vq "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")$" du.out + atf_check -o save:du_C.out du -aAH testdir/C - atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")" du_C.out + atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")$" du_C.out + + # Check that the output doesn't contain any lines (i.e. paths) that we + # did not expect it to contain from $paths2. + atf_check -s exit:1 egrep -vq "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")$" du_C.out } atf_test_case I_flag From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:45:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96BD54EC07F; Sun, 24 Jan 2021 04:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNgQy3kVYz4V1K; Sun, 24 Jan 2021 04:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72E621DE0D; Sun, 24 Jan 2021 04:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O4jE4Q046155; Sun, 24 Jan 2021 04:45:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O4jE6S046154; Sun, 24 Jan 2021 04:45:14 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:45:14 GMT Message-Id: <202101240445.10O4jE6S046154@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 3cde0e743a46 - stable/12 - Partial revert of ac6e3a14070 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3cde0e743a46de20c94aeb977bfa920a7822ab18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:45:14 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3cde0e743a46de20c94aeb977bfa920a7822ab18 commit 3cde0e743a46de20c94aeb977bfa920a7822ab18 Author: Kyle Evans AuthorDate: 2021-01-24 04:43:46 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:43:46 +0000 Partial revert of ac6e3a14070 refcount_load() does not yet exist on this branch, and the path to MFC'ing it is slightly non-trivial. Back out the part that uses it -- it's a ddb command anyways, so the cost of getting it wrong is ~low. Pointy hat: kevans (did not test with DDB) (direct commit) --- sys/kern/kern_cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index aa3f6bb70bca..368acdb2be16 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -2414,7 +2414,7 @@ DB_SHOW_COMMAND(cpusets, db_show_cpusets) LIST_FOREACH(set, &cpuset_ids, cs_link) { db_printf("set=%p id=%-6u ref=%-6d flags=0x%04x parent id=%d\n", - set, set->cs_id, refcount_load(&set->cs_ref), set->cs_flags, + set, set->cs_id, set->cs_ref, set->cs_flags, (set->cs_parent != NULL) ? set->cs_parent->cs_id : 0); db_printf(" cpu mask="); ddb_display_cpuset(&set->cs_mask); From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 04:58:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8EE04ECEEB; Sun, 24 Jan 2021 04:58:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNgkb5p16z4Vjl; Sun, 24 Jan 2021 04:58:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9E2D1DBE7; Sun, 24 Jan 2021 04:58:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O4wleQ059631; Sun, 24 Jan 2021 04:58:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O4wl7I059630; Sun, 24 Jan 2021 04:58:47 GMT (envelope-from git) Date: Sun, 24 Jan 2021 04:58:47 GMT Message-Id: <202101240458.10O4wl7I059630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 3c136581b69d - stable/12 - Move stand/ofw/libofw to stand/libofw. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3c136581b69d7fbcb1e2e36add31f69487ba1b65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 04:58:47 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3c136581b69d7fbcb1e2e36add31f69487ba1b65 commit 3c136581b69d7fbcb1e2e36add31f69487ba1b65 Author: Brandon Bergren AuthorDate: 2020-01-02 04:34:22 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 04:58:40 +0000 Move stand/ofw/libofw to stand/libofw. Since rS330365, there has been no particular reason for libofw to be in a subdirectory of ofw. Move libofw up a level to make it fit in better with the other top level libraries. Also add a LIBOFWSRC to stand/defs.mk to match what all the other libraries are doing. (cherry picked from commit 475008d6ca47ccb2b4baca59a37421d95916d2ba) --- stand/Makefile | 2 +- stand/defs.mk | 1 + stand/{ofw => }/libofw/Makefile | 0 stand/{ofw => }/libofw/devicename.c | 0 stand/{ofw => }/libofw/libofw.h | 0 stand/{ofw => }/libofw/ofw_console.c | 0 stand/{ofw => }/libofw/ofw_copy.c | 0 stand/{ofw => }/libofw/ofw_disk.c | 0 stand/{ofw => }/libofw/ofw_memory.c | 0 stand/{ofw => }/libofw/ofw_module.c | 0 stand/{ofw => }/libofw/ofw_net.c | 0 stand/{ofw => }/libofw/ofw_reboot.c | 0 stand/{ofw => }/libofw/ofw_time.c | 0 stand/{ofw => }/libofw/openfirm.c | 0 stand/{ofw => }/libofw/openfirm.h | 0 stand/ofw/Makefile | 5 ----- stand/ofw/Makefile.inc | 3 --- stand/powerpc/ofw/Makefile | 4 ++-- stand/sparc64/loader/Makefile | 4 ++-- 19 files changed, 6 insertions(+), 13 deletions(-) diff --git a/stand/Makefile b/stand/Makefile index bc50e1bfb736..bacf39e26eca 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -16,7 +16,7 @@ S.${MK_FORTH}+= forth S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt -S.${MK_LOADER_OFW}+= ofw +S.${MK_LOADER_OFW}+= libofw S.yes+= defaults S.yes+= man diff --git a/stand/defs.mk b/stand/defs.mk index 6ae9069664ac..514a6c9b98dc 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -28,6 +28,7 @@ FDTSRC= ${BOOTSRC}/fdt FICLSRC= ${BOOTSRC}/ficl LDRSRC= ${BOOTSRC}/common LIBLUASRC= ${BOOTSRC}/liblua +LIBOFWSRC= ${BOOTSRC}/libofw LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys diff --git a/stand/ofw/libofw/Makefile b/stand/libofw/Makefile similarity index 100% rename from stand/ofw/libofw/Makefile rename to stand/libofw/Makefile diff --git a/stand/ofw/libofw/devicename.c b/stand/libofw/devicename.c similarity index 100% rename from stand/ofw/libofw/devicename.c rename to stand/libofw/devicename.c diff --git a/stand/ofw/libofw/libofw.h b/stand/libofw/libofw.h similarity index 100% rename from stand/ofw/libofw/libofw.h rename to stand/libofw/libofw.h diff --git a/stand/ofw/libofw/ofw_console.c b/stand/libofw/ofw_console.c similarity index 100% rename from stand/ofw/libofw/ofw_console.c rename to stand/libofw/ofw_console.c diff --git a/stand/ofw/libofw/ofw_copy.c b/stand/libofw/ofw_copy.c similarity index 100% rename from stand/ofw/libofw/ofw_copy.c rename to stand/libofw/ofw_copy.c diff --git a/stand/ofw/libofw/ofw_disk.c b/stand/libofw/ofw_disk.c similarity index 100% rename from stand/ofw/libofw/ofw_disk.c rename to stand/libofw/ofw_disk.c diff --git a/stand/ofw/libofw/ofw_memory.c b/stand/libofw/ofw_memory.c similarity index 100% rename from stand/ofw/libofw/ofw_memory.c rename to stand/libofw/ofw_memory.c diff --git a/stand/ofw/libofw/ofw_module.c b/stand/libofw/ofw_module.c similarity index 100% rename from stand/ofw/libofw/ofw_module.c rename to stand/libofw/ofw_module.c diff --git a/stand/ofw/libofw/ofw_net.c b/stand/libofw/ofw_net.c similarity index 100% rename from stand/ofw/libofw/ofw_net.c rename to stand/libofw/ofw_net.c diff --git a/stand/ofw/libofw/ofw_reboot.c b/stand/libofw/ofw_reboot.c similarity index 100% rename from stand/ofw/libofw/ofw_reboot.c rename to stand/libofw/ofw_reboot.c diff --git a/stand/ofw/libofw/ofw_time.c b/stand/libofw/ofw_time.c similarity index 100% rename from stand/ofw/libofw/ofw_time.c rename to stand/libofw/ofw_time.c diff --git a/stand/ofw/libofw/openfirm.c b/stand/libofw/openfirm.c similarity index 100% rename from stand/ofw/libofw/openfirm.c rename to stand/libofw/openfirm.c diff --git a/stand/ofw/libofw/openfirm.h b/stand/libofw/openfirm.h similarity index 100% rename from stand/ofw/libofw/openfirm.h rename to stand/libofw/openfirm.h diff --git a/stand/ofw/Makefile b/stand/ofw/Makefile deleted file mode 100644 index 3b881b780e87..000000000000 --- a/stand/ofw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR= libofw - -.include diff --git a/stand/ofw/Makefile.inc b/stand/ofw/Makefile.inc deleted file mode 100644 index 265f86d1ed55..000000000000 --- a/stand/ofw/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc" diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index de5d5e01037a..35c9d4ae546f 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -39,8 +39,8 @@ CFLAGS+= -DRELOC=${RELOC} LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc # Open Firmware standalone support library -LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a -CFLAGS+= -I${BOOTSRC}/ofw/libofw +LIBOFW= ${BOOTOBJ}/libofw/libofw.a +CFLAGS+= -I${BOOTSRC}/libofw DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} diff --git a/stand/sparc64/loader/Makefile b/stand/sparc64/loader/Makefile index 7bc2ee5aa9fa..c85093c0745a 100644 --- a/stand/sparc64/loader/Makefile +++ b/stand/sparc64/loader/Makefile @@ -47,8 +47,8 @@ LINKS= ${BINDIR}/loader ${BINDIR}/zfsloader .endif # Open Firmware standalone support library -LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a -CFLAGS+= -I${BOOTSRC}/ofw/libofw/ +LIBOFW= ${BOOTOBJ}/libofw/libofw.a +CFLAGS+= -I${BOOTSRC}/libofw DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 05:02:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 088524ED881; Sun, 24 Jan 2021 05:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNgq36sC2z4WKs; Sun, 24 Jan 2021 05:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE0E91DFD5; Sun, 24 Jan 2021 05:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O52dkp072238; Sun, 24 Jan 2021 05:02:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O52dZD072237; Sun, 24 Jan 2021 05:02:39 GMT (envelope-from git) Date: Sun, 24 Jan 2021 05:02:39 GMT Message-Id: <202101240502.10O52dZD072237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ca212d911585 - stable/12 - stand: properly declare subdir deps or .WAIT, do parallel build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ca212d9115856036f8001ba6a0c9c326479caf20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 05:02:40 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ca212d9115856036f8001ba6a0c9c326479caf20 commit ca212d9115856036f8001ba6a0c9c326479caf20 Author: Kyle Evans AuthorDate: 2020-12-31 17:15:45 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 05:02:14 +0000 stand: properly declare subdir deps or .WAIT, do parallel build buildworld already runs the stand build in parallel[1], so make it easier to identify ordering issues by properly establishing dependencies or adding .WAIT where needed. Everything in stand/ relies on libsa, either directly or indirectly, because libsa build is where the stand headers get installed and it gets linked in most places. Interpreters depend on their libs, machine dirs usually depend on top-level libs that are getting built and at least one of the interpreter flavors. For i386, order btx/libi386/libfirewire before everything else using a big-ol-.WAIT hammer. btx is the most common dependency, but the others are used sporadically. This seems to be where the race reporting on the mailing list is- AFAICT, the following sequence is happening: 1.) One of the loaders gets built based on stale btx/btxldr 2.) btx/btxldr gets rebuilt 3.) installworld triggers loader rebuild because btx was rebuilt after This seems like the most plausible explanation, as they've verified system time and timestamps. While we're here, let's switch stand/ over to a completely parallel build so we can work out these kinds of issues in isolation rather than in the middle of a larger build. (cherry picked from commit ac5f382a9d0a26685b92b49abb845d3b30ea5f91) (cherry picked from commit 8b4c3a03f933b77b65c78fdef976831d27942d9d) (cherry picked from commit e41367e3ae1246c2b086f9f920a175108aa72380) --- stand/Makefile | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- stand/Makefile.amd64 | 4 ++++ stand/Makefile.inc | 2 ++ stand/efi/Makefile | 6 +++++- stand/i386/Makefile | 13 ++++++++++--- 5 files changed, 68 insertions(+), 7 deletions(-) diff --git a/stand/Makefile b/stand/Makefile index bacf39e26eca..c5c7ca60375a 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -6,27 +6,55 @@ # others we don't. LIB32LIST is a list of libraries, which if # included, need to be built 32-bit as well. .if ${MACHINE_ARCH} == "amd64" -LIB32LIST=libsa ficl liblua +LIB32LIST=libsa +.if ${MK_FORTH} != "no" +LIB32LIST+= ficl +.endif +.if ${MK_LOADER_LUA} != "no" +LIB32LIST+= liblua +.endif .endif S.yes+= libsa +S.${MK_LOADER_OFW}+= libofw +S.${MK_FDT}+= fdt + S.${MK_FORTH}+= ficl S.${MK_FORTH}+= forth S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua -S.${MK_FDT}+= fdt -S.${MK_LOADER_OFW}+= libofw S.yes+= defaults S.yes+= man +.if ${MK_FORTH} != "no" +INTERP_DEPENDS+= forth +.endif +.if ${MK_LOADER_LUA} != "no" +INTERP_DEPENDS+= lua +.endif + .include S.${MK_EFI}+= efi S.${MK_LOADER_UBOOT}+= uboot +.if defined(LIB32LIST) +LIB32DEPENDS= ${LIB32LIST:S/$/32/} +.endif + .if exists(${.CURDIR}/${MACHINE}/.) S.yes+= ${MACHINE} +SUBDIR_DEPEND_${MACHINE}+= ${INTERP_DEPENDS} +.if ${MK_FDT} != "no" +SUBDIR_DEPEND_${MACHINE}+= fdt +.endif +.if ${MK_LOADER_UBOOT} != "no" +SUBDIR_DEPEND_${MACHINE}+= uboot +.endif +.if ${MK_LOADER_OFW} != "no" +SUBDIR_DEPEND_${MACHINE}+= libofw +.endif .endif # Build the actual subdir list from S.yes, adding in the 32-bit @@ -36,6 +64,22 @@ SUBDIR+=${_x} .if defined(LIB32LIST) && ${LIB32LIST:M${_x}} SUBDIR+=${_x}32 .endif +.if ${_x} != "libsa" +SUBDIR_DEPEND_${_x}+= libsa +SUBDIR_DEPEND_${_x}32+= libsa32 +.endif .endfor +# Remaining dependencies +SUBDIR_DEPEND_libsa32+= libsa + +SUBDIR_DEPEND_forth+= ficl +SUBDIR_DEPEND_lua+= liblua + +.if ${MK_FDT} != "no" +SUBDIR_DEPEND_efi+= fdt +.endif + +SUBDIR_PARALLEL= yes + .include diff --git a/stand/Makefile.amd64 b/stand/Makefile.amd64 index b2b918ebed5b..9ee3649071b2 100644 --- a/stand/Makefile.amd64 +++ b/stand/Makefile.amd64 @@ -2,3 +2,7 @@ S.yes+= userboot S.yes+= i386 + +SUBDIR_DEPEND_userboot+= ${INTERP_DEPENDS} +# These won't get tacked on in an amd64 build +SUBDIR_DEPEND_i386+= ${LIB32DEPENDS} ${INTERP_DEPENDS} diff --git a/stand/Makefile.inc b/stand/Makefile.inc index d7b9d228287e..aa7cfa14542f 100644 --- a/stand/Makefile.inc +++ b/stand/Makefile.inc @@ -1,3 +1,5 @@ # $FreeBSD$ +SUBDIR_PARALLEL= yes + .include "defs.mk" diff --git a/stand/efi/Makefile b/stand/efi/Makefile index 2e0daba6dab8..9ab6aa4291fb 100644 --- a/stand/efi/Makefile +++ b/stand/efi/Makefile @@ -8,8 +8,12 @@ NO_OBJ=t # than 4.5 supports it. .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 +SUBDIR.yes+= libefi SUBDIR.${MK_FDT}+= fdt -SUBDIR.yes+= libefi boot1 gptboot +SUBDIR.yes+= .WAIT + +SUBDIR.yes+= boot1 gptboot + SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.yes+= loader_simp diff --git a/stand/i386/Makefile b/stand/i386/Makefile index 2a9ead4c8e72..2b628d408d1e 100644 --- a/stand/i386/Makefile +++ b/stand/i386/Makefile @@ -4,10 +4,15 @@ NO_OBJ=t .include -SUBDIR.yes= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \ - isoboot libi386 - +# Almost everything else here relies on btxldr, so we must make sure it's built +# before everything else proceeds so we don't end up building against a stale +# btxldr and ending up with a build-during-install scenario. +SUBDIR.yes+= btx libi386 SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire +SUBDIR.yes+= .WAIT + +SUBDIR.yes+= mbr pmbr boot0 boot0sio boot2 cdboot gptboot \ + isoboot SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_LOADER_LUA}+= loader_lua @@ -22,4 +27,6 @@ SUBDIR.yes+= kgzldr SUBDIR.${MK_LOADER_ZFS}+= zfsboot gptzfsboot +SUBDIR_DEPEND_pxeldr+= loader_${LOADER_DEFAULT_INTERP} + .include From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 05:02:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D1FC4ED559; Sun, 24 Jan 2021 05:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNgq50KjKz4W1x; Sun, 24 Jan 2021 05:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F24FB1DE52; Sun, 24 Jan 2021 05:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O52e7s072260; Sun, 24 Jan 2021 05:02:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O52eBU072259; Sun, 24 Jan 2021 05:02:40 GMT (envelope-from git) Date: Sun, 24 Jan 2021 05:02:40 GMT Message-Id: <202101240502.10O52eBU072259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: e38af1933c3b - stable/12 - stand: remove bogus dependency from libsa32 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e38af1933c3bf62a6c7d8de91b87981004061df1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 05:02:41 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e38af1933c3bf62a6c7d8de91b87981004061df1 commit e38af1933c3bf62a6c7d8de91b87981004061df1 Author: Kyle Evans AuthorDate: 2021-01-07 22:02:55 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 05:02:29 +0000 stand: remove bogus dependency from libsa32 libsa32 is independent of libsa, they can build in parallel if needed. (cherry picked from commit 27e90f70e09d9d003bdea09c41be64a7ec2ece9a) --- stand/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/stand/Makefile b/stand/Makefile index c5c7ca60375a..f0a3d65e1fb8 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -71,8 +71,6 @@ SUBDIR_DEPEND_${_x}32+= libsa32 .endfor # Remaining dependencies -SUBDIR_DEPEND_libsa32+= libsa - SUBDIR_DEPEND_forth+= ficl SUBDIR_DEPEND_lua+= liblua From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 06:13:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74C5D4EFDEB; Sun, 24 Jan 2021 06:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNjP02vV9z4Ztd; Sun, 24 Jan 2021 06:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 567111EBD3; Sun, 24 Jan 2021 06:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O6De2T062809; Sun, 24 Jan 2021 06:13:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O6DeTm062808; Sun, 24 Jan 2021 06:13:40 GMT (envelope-from git) Date: Sun, 24 Jan 2021 06:13:40 GMT Message-Id: <202101240613.10O6DeTm062808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 0b97b9ae187f - stable/12 - lualoader: fix lua-lint run MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0b97b9ae187fe02348b1b4000f964aaa257b1edf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 06:13:40 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0b97b9ae187fe02348b1b4000f964aaa257b1edf commit 0b97b9ae187fe02348b1b4000f964aaa257b1edf Author: Kyle Evans AuthorDate: 2020-12-17 18:29:30 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 06:13:03 +0000 lualoader: fix lua-lint run luacheck rightfully complains that i is unused in the show-module-options loop at the end (it was used for some debugging in the process). We've added a new pager module that's compiled in, so declare that as an acceptable global. (cherry picked from commit 29842cb36e74037989b7a7f0bf38a47f342bac91) --- stand/lua/cli.lua | 2 +- tools/boot/lua-lint.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index d1947ca1021d..b7581c985a75 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -234,7 +234,7 @@ cli["show-module-options"] = function() end pager.open() - for i, v in ipairs(lines) do + for _, v in ipairs(lines) do pager.output(v .. "\n") end pager.close() diff --git a/tools/boot/lua-lint.sh b/tools/boot/lua-lint.sh index cc7a007947f2..c6bc89da3330 100755 --- a/tools/boot/lua-lint.sh +++ b/tools/boot/lua-lint.sh @@ -17,4 +17,5 @@ LUACHECK=$(which luacheck) cd $(make -V SRCTOP)/stand ${LUACHECK} . --globals loader --globals lfs --globals io.getchar \ --globals io.ischar --globals printc --globals cli_execute \ - --globals cli_execute_unparsed --globals try_include --std lua53 + --globals cli_execute_unparsed --globals try_include \ + --globals pager --std lua53 From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 10:09:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC09C4F5C6F; Sun, 24 Jan 2021 10:09:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNpcc4wQxz4mVc; Sun, 24 Jan 2021 10:09:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BC2921D1A; Sun, 24 Jan 2021 10:09:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OA940s062791; Sun, 24 Jan 2021 10:09:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OA94lt062790; Sun, 24 Jan 2021 10:09:04 GMT (envelope-from git) Date: Sun, 24 Jan 2021 10:09:04 GMT Message-Id: <202101241009.10OA94lt062790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 08f7954e1c9f - stable/12 - iflib: add assert to prevent out-of-bounds array access MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 08f7954e1c9f2e479896858f2af1ef7d568bc248 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 10:09:04 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=08f7954e1c9f2e479896858f2af1ef7d568bc248 commit 08f7954e1c9f2e479896858f2af1ef7d568bc248 Author: Vincenzo Maffione AuthorDate: 2021-01-10 13:49:51 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-24 08:45:09 +0000 iflib: add assert to prevent out-of-bounds array access The iflib_queues_alloc() allocates isc_nrxqs iflib_dma_info structs for each rxqset, and links each struct to a different free list. As a result, it must be isc_nrxqs >= isc_nfl (plus the completion queue, if present). Add an assertion to make this constraint explicit. MFC after: 2 weeks (cherry picked from commit 4ba9ad0dc316940f32065b05f24259f942c0692d) --- sys/net/iflib.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 1653fd31a7f7..6f7911a12b09 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5530,11 +5530,14 @@ iflib_queues_alloc(if_ctx_t ctx) uint8_t nrxqs = sctx->isc_nrxqs; uint8_t ntxqs = sctx->isc_ntxqs; int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; + int fl_offset = (sctx->isc_flags & IFLIB_HAS_RXCQ ? 1 : 0); caddr_t *vaddrs; uint64_t *paddrs; KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); + KASSERT(nrxqs >= fl_offset + nfree_lists, + ("there must be at least a rxq for each free list")); /* Allocate the TX ring struct memory */ if (!(ctx->ifc_txqs = @@ -5642,11 +5645,7 @@ iflib_queues_alloc(if_ctx_t ctx) } rxq->ifr_ctx = ctx; rxq->ifr_id = i; - if (sctx->isc_flags & IFLIB_HAS_RXCQ) { - rxq->ifr_fl_offset = 1; - } else { - rxq->ifr_fl_offset = 0; - } + rxq->ifr_fl_offset = fl_offset; rxq->ifr_nfl = nfree_lists; if (!(fl = (iflib_fl_t) malloc(sizeof(struct iflib_fl) * nfree_lists, M_IFLIB, M_NOWAIT | M_ZERO))) { From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 15:16:22 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4D174FECBB; Sun, 24 Jan 2021 15:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNxRB5hYmz3Ptn; Sun, 24 Jan 2021 15:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B628F25C91; Sun, 24 Jan 2021 15:16:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OFGMpB065388; Sun, 24 Jan 2021 15:16:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OFGMKu065387; Sun, 24 Jan 2021 15:16:22 GMT (envelope-from git) Date: Sun, 24 Jan 2021 15:16:22 GMT Message-Id: <202101241516.10OFGMKu065387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: d05d908d6d3c - stable/12 - tcp: fix handling of TCP RST segments missing timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d05d908d6d3c85479c84c707f931148439ae826b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 15:16:22 -0000 The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d05d908d6d3c85479c84c707f931148439ae826b commit d05d908d6d3c85479c84c707f931148439ae826b Author: Michael Tuexen AuthorDate: 2021-01-13 22:43:40 +0000 Commit: Michael Tuexen CommitDate: 2021-01-24 14:41:03 +0000 tcp: fix handling of TCP RST segments missing timestamps A TCP RST segment should be processed even it is missing TCP timestamps. Reported by: dmgk@, kevans@ Reviewed by: rscheff@, dmgk@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D28143 (cherry picked from commit cc3c34859eab1b317d0f38731355b53f7d978c97) --- sys/netinet/tcp_input.c | 21 +++++++++++++++------ sys/netinet/tcp_stacks/rack.c | 5 +++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 03b5cf389c1f..31f18c669640 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1708,16 +1708,25 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless it is a RST segment. * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "segment silently dropped\n", s, __func__); - free(s, M_TCPLOG); + if ((thflags & TH_RST) != 0) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment processed normally\n", + s, __func__); + free(s, M_TCPLOG); + } + } else { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "segment silently dropped\n", s, __func__); + free(s, M_TCPLOG); + } + goto drop; } - goto drop; } /* * If timestamps were not negotiated during SYN/ACK and a diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 652b0269003f..e46781bb01df 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6719,10 +6719,11 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless it is a RST segment. * See section 3.2 of RFC 7323. */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) && + ((thflags & TH_RST) == 0)) { way_out = 5; retval = 0; goto done_with_input; From owner-dev-commits-src-branches@freebsd.org Sun Jan 24 15:20:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F2DF4FE8F8; Sun, 24 Jan 2021 15:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNxWy00yGz3QDL; Sun, 24 Jan 2021 15:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E72F725874; Sun, 24 Jan 2021 15:20:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OFKTW2073437; Sun, 24 Jan 2021 15:20:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OFKTSB073436; Sun, 24 Jan 2021 15:20:29 GMT (envelope-from git) Date: Sun, 24 Jan 2021 15:20:29 GMT Message-Id: <202101241520.10OFKTSB073436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: e82353f84c58 - stable/12 - tcp: add sysctl to tolerate TCP segments missing timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e82353f84c58da9a5c38bd471a09936c16a5b6ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 15:20:30 -0000 The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e82353f84c58da9a5c38bd471a09936c16a5b6ea commit e82353f84c58da9a5c38bd471a09936c16a5b6ea Author: Michael Tuexen AuthorDate: 2021-01-13 21:48:17 +0000 Commit: Michael Tuexen CommitDate: 2021-01-24 14:46:12 +0000 tcp: add sysctl to tolerate TCP segments missing timestamps When timestamp support has been negotiated, TCP segements received without a timestamp should be discarded. However, there are broken TCP implementations (for example, stacks used by Omniswitch 63xx and 64xx models), which send TCP segments without timestamps although they negotiated timestamp support. This patch adds a sysctl variable which tolerates such TCP segments and allows to interoperate with broken stacks. Reviewed by: jtl@, rscheff@ Differential Revision: https://reviews.freebsd.org/D28142 Sponsored by: Netflix, Inc. PR: 252449 (cherry picked from commit d2b3ceddccac60b563f642898e3a314647666a10) --- share/man/man4/tcp.4 | 23 ++++++++++++++++++++--- sys/netinet/tcp_input.c | 5 +++-- sys/netinet/tcp_stacks/rack.c | 5 +++-- sys/netinet/tcp_subr.c | 5 +++++ sys/netinet/tcp_syncache.c | 26 +++++++++++++++++++------- sys/netinet/tcp_timewait.c | 5 +++-- sys/netinet/tcp_var.h | 2 ++ 7 files changed, 55 insertions(+), 16 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index c9458c7cbafa..e1e87afd7fd6 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd March 31, 2020 +.Dd January 14, 2021 .Dt TCP 4 .Os .Sh NAME @@ -333,8 +333,17 @@ MIB. .Bl -tag -width ".Va TCPCTL_DO_RFC1323" .It Dv TCPCTL_DO_RFC1323 .Pq Va rfc1323 -Implement the window scaling and timestamp options of RFC 1323 +Implement the window scaling and timestamp options of RFC 1323/RFC 7323 (default is true). +.It Va tolerate_missing_ts +Tolerate the missing of timestamps (RFC 1323/RFC 7323) for +.Tn TCP +segments belonging to +.Tn TCP +connections for which support of +.Tn TCP +timestamps has been negotiated. +(default is 0, i.e., the missing of timestamps is not tolerated). .It Dv TCPCTL_MSSDFLT .Pq Va mssdflt The default value used for the maximum segment size @@ -673,12 +682,20 @@ when trying to use a TCP function block that is not available; .Xr tcp_functions 9 .Rs .%A "V. Jacobson" -.%A "R. Braden" +.%A "B. Braden" .%A "D. Borman" .%T "TCP Extensions for High Performance" .%O "RFC 1323" .Re .Rs +.%A "D. Borman" +.%A "B. Braden" +.%A "V. Jacobson" +.%A "R. Scheffenegger" +.%T "TCP Extensions for High Performance" +.%O "RFC 7323" +.Re +.Rs .%A "A. Heffernan" .%T "Protection of BGP Sessions via the TCP MD5 Signature Option" .%O "RFC 2385" diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 31f18c669640..755d645d338c 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1708,11 +1708,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment, unless it is a RST segment. + * the segment, unless it is a RST segment or missing timestamps are + * tolerated. * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((thflags & TH_RST) != 0) { + if (((thflags & TH_RST) != 0) || V_tcp_tolerate_missing_ts) { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Timestamp missing, " "segment processed normally\n", diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index e46781bb01df..1d063a8a1f6f 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6719,11 +6719,12 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment, unless it is a RST segment. + * the segment, unless it is a RST segment or missing timestamps are + * tolerated. * See section 3.2 of RFC 7323. */ if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS) && - ((thflags & TH_RST) == 0)) { + ((thflags & TH_RST) == 0) && (V_tcp_tolerate_missing_ts == 0)) { way_out = 5; retval = 0; goto done_with_input; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 17996b492a96..5394a63c1a12 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -195,6 +195,11 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc1323), 0, "Enable rfc1323 (high performance TCP) extensions"); +VNET_DEFINE(int, tcp_tolerate_missing_ts) = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, tolerate_missing_ts, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_tolerate_missing_ts), 0, + "Tolerate missing TCP timestamps"); + VNET_DEFINE(int, tcp_ts_offset_per_conn) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, ts_offset_per_conn, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_ts_offset_per_conn), 0, diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index fe55eadfbcff..d06b54cffc1c 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1161,18 +1161,30 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless the missing timestamps are tolerated. * See section 3.2 of RFC 7323. */ if ((sc->sc_flags & SCF_TIMESTAMP) && !(to->to_flags & TOF_TS)) { - SCH_UNLOCK(sch); - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "segment silently dropped\n", s, __func__); - free(s, M_TCPLOG); + if (V_tcp_tolerate_missing_ts) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, + "%s; %s: Timestamp missing, " + "segment processed normally\n", + s, __func__); + free(s, M_TCPLOG); + } + } else { + SCH_UNLOCK(sch); + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, + "%s; %s: Timestamp missing, " + "segment silently dropped\n", + s, __func__); + free(s, M_TCPLOG); + } + return (-1); /* Do not send RST */ } - return (-1); /* Do not send RST */ } /* diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index a1f6226315b6..8ab87711595e 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -450,10 +450,11 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, /* * If timestamps were negotiated during SYN/ACK and a * segment without a timestamp is received, silently drop - * the segment. + * the segment, unless the missing timestamps are tolerated. * See section 3.2 of RFC 7323. */ - if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) { + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0) && + (V_tcp_tolerate_missing_ts == 0)) { goto drop; } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 4fffcb860806..965c2bf031e1 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -780,6 +780,7 @@ VNET_DECLARE(int, tcp_do_autorcvbuf); VNET_DECLARE(int, tcp_do_autosndbuf); VNET_DECLARE(int, tcp_do_ecn); VNET_DECLARE(int, tcp_do_rfc1323); +VNET_DECLARE(int, tcp_tolerate_missing_ts); VNET_DECLARE(int, tcp_do_rfc3042); VNET_DECLARE(int, tcp_do_rfc3390); VNET_DECLARE(int, tcp_do_rfc3465); @@ -815,6 +816,7 @@ VNET_DECLARE(struct inpcbinfo, tcbinfo); #define V_tcp_do_autosndbuf VNET(tcp_do_autosndbuf) #define V_tcp_do_ecn VNET(tcp_do_ecn) #define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) +#define V_tcp_tolerate_missing_ts VNET(tcp_tolerate_missing_ts) #define V_tcp_ts_offset_per_conn VNET(tcp_ts_offset_per_conn) #define V_tcp_do_rfc3042 VNET(tcp_do_rfc3042) #define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390)