From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D06D650428; Mon, 5 Jul 2021 00:23: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 4GJ5yN3rtlz4t0d; Mon, 5 Jul 2021 00:23: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 6C5CA1C60D; Mon, 5 Jul 2021 00:23: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 1650Ne9M022480; Mon, 5 Jul 2021 00:23:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NeHO022479; Mon, 5 Jul 2021 00:23:40 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:40 GMT Message-Id: <202107050023.1650NeHO022479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: a2b83b59db36 - main - LinuxKPI: Allow kmem_cache_free() to be called from critical sections MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2b83b59db365255461a50ff8fa5e5e4e92e4d51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:40 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a2b83b59db365255461a50ff8fa5e5e4e92e4d51 commit a2b83b59db365255461a50ff8fa5e5e4e92e4d51 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:18:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:18:14 +0000 LinuxKPI: Allow kmem_cache_free() to be called from critical sections as it is required by i915kms driver from Linux kernel v 5.5. This is done with asynchronous freeing of requested memory areas from taskqueue thread. As memory to be freed is reused to store linked list entry, backing UMA zone item size is rounded up to pointer size. While here, make struct linux_kmem_cache private to LKPI to reduce amount of BSD headers included by linux/slab.h and switch RCU code to usage of LKPI's linux_irq_work_tq taskqueue to avoid injection of current into system-wide taskqueue_fast thread context. Submitted by: nc (initial version for drm-kmod) Reviewed by: manu, nc Differential revision: https://reviews.freebsd.org/D30760 --- sys/compat/linuxkpi/common/include/linux/slab.h | 46 +++------------ sys/compat/linuxkpi/common/src/linux_rcu.c | 50 ++++++----------- sys/compat/linuxkpi/common/src/linux_slab.c | 75 ++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 72 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 8d5eb3e85e96..ecd39d711eb4 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -31,12 +31,9 @@ #ifndef _LINUX_SLAB_H_ #define _LINUX_SLAB_H_ -#include -#include +#include #include #include -#include -#include #include #include @@ -65,8 +62,9 @@ MALLOC_DECLARE(M_KMALLOC); */ #define kmem_cache linux_kmem_cache #define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__) -#define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__) -#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) +#define kmem_cache_alloc(...) lkpi_kmem_cache_alloc(__VA_ARGS__) +#define kmem_cache_zalloc(...) lkpi_kmem_cache_zalloc(__VA_ARGS__) +#define kmem_cache_free(...) lkpi_kmem_cache_free(__VA_ARGS__) #define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) #define KMEM_CACHE(__struct, flags) \ @@ -75,12 +73,7 @@ MALLOC_DECLARE(M_KMALLOC); typedef void linux_kmem_ctor_t (void *); -struct linux_kmem_cache { - uma_zone_t cache_zone; - linux_kmem_ctor_t *cache_ctor; - unsigned cache_flags; - unsigned cache_size; -}; +struct linux_kmem_cache; #define SLAB_HWCACHE_ALIGN (1 << 0) #define SLAB_TYPESAFE_BY_RCU (1 << 1) @@ -212,32 +205,9 @@ ksize(const void *ptr) extern struct linux_kmem_cache *linux_kmem_cache_create(const char *name, size_t size, size_t align, unsigned flags, linux_kmem_ctor_t *ctor); - -static inline void * -linux_kmem_cache_alloc(struct linux_kmem_cache *c, gfp_t flags) -{ - return (uma_zalloc_arg(c->cache_zone, c, - linux_check_m_flags(flags))); -} - -static inline void * -kmem_cache_zalloc(struct linux_kmem_cache *c, gfp_t flags) -{ - return (uma_zalloc_arg(c->cache_zone, c, - linux_check_m_flags(flags | M_ZERO))); -} - -extern void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *); - -static inline void -linux_kmem_cache_free(struct linux_kmem_cache *c, void *m) -{ - if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) - linux_kmem_cache_free_rcu(c, m); - else - uma_zfree(c->cache_zone, m); -} - +extern void *lkpi_kmem_cache_alloc(struct linux_kmem_cache *, gfp_t); +extern void *lkpi_kmem_cache_zalloc(struct linux_kmem_cache *, gfp_t); +extern void lkpi_kmem_cache_free(struct linux_kmem_cache *, void *); extern void linux_kmem_cache_destroy(struct linux_kmem_cache *); void linux_kfree_async(void *); diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index 404c5cec4ae4..a39949cf5013 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include /* * By defining CONFIG_NO_RCU_SKIP LinuxKPI RCU locks and asserts will @@ -60,13 +62,15 @@ __FBSDID("$FreeBSD$"); #endif struct callback_head { - STAILQ_ENTRY(callback_head) entry; + union { + STAILQ_ENTRY(callback_head) entry; + struct llist_node node; + }; rcu_callback_t func; }; struct linux_epoch_head { - STAILQ_HEAD(, callback_head) cb_head; - struct mtx lock; + struct llist_head cb_head; struct task task; } __aligned(CACHE_LINE_SIZE); @@ -120,9 +124,8 @@ linux_rcu_runtime_init(void *arg __unused) head = &linux_epoch_head[j]; - mtx_init(&head->lock, "LRCU-HEAD", NULL, MTX_DEF); TASK_INIT(&head->task, 0, linux_rcu_cleaner_func, head); - STAILQ_INIT(&head->cb_head); + init_llist_head(&head->cb_head); CPU_FOREACH(i) { struct linux_epoch_record *record; @@ -139,37 +142,22 @@ linux_rcu_runtime_init(void *arg __unused) } SYSINIT(linux_rcu_runtime, SI_SUB_CPU, SI_ORDER_ANY, linux_rcu_runtime_init, NULL); -static void -linux_rcu_runtime_uninit(void *arg __unused) -{ - struct linux_epoch_head *head; - int j; - - for (j = 0; j != RCU_TYPE_MAX; j++) { - head = &linux_epoch_head[j]; - - mtx_destroy(&head->lock); - } -} -SYSUNINIT(linux_rcu_runtime, SI_SUB_LOCK, SI_ORDER_SECOND, linux_rcu_runtime_uninit, NULL); - static void linux_rcu_cleaner_func(void *context, int pending __unused) { - struct linux_epoch_head *head; + struct linux_epoch_head *head = context; struct callback_head *rcu; STAILQ_HEAD(, callback_head) tmp_head; + struct llist_node *node, *next; uintptr_t offset; - linux_set_current(curthread); - - head = context; - /* move current callbacks into own queue */ - mtx_lock(&head->lock); STAILQ_INIT(&tmp_head); - STAILQ_CONCAT(&tmp_head, &head->cb_head); - mtx_unlock(&head->lock); + llist_for_each_safe(node, next, llist_del_all(&head->cb_head)) { + rcu = container_of(node, struct callback_head, node); + /* re-reverse list to restore chronological order */ + STAILQ_INSERT_HEAD(&tmp_head, rcu, entry); + } /* synchronize */ linux_synchronize_rcu(head - linux_epoch_head); @@ -384,7 +372,7 @@ linux_rcu_barrier(unsigned type) head = &linux_epoch_head[type]; /* wait for callbacks to complete */ - taskqueue_drain(taskqueue_fast, &head->task); + taskqueue_drain(linux_irq_work_tq, &head->task); } void @@ -398,11 +386,9 @@ linux_call_rcu(unsigned type, struct rcu_head *context, rcu_callback_t func) rcu = (struct callback_head *)context; head = &linux_epoch_head[type]; - mtx_lock(&head->lock); rcu->func = func; - STAILQ_INSERT_TAIL(&head->cb_head, rcu, entry); - taskqueue_enqueue(taskqueue_fast, &head->task); - mtx_unlock(&head->lock); + llist_add(&rcu->node, &head->cb_head); + taskqueue_enqueue(linux_irq_work_tq, &head->task); } int diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c index 3304c34b1dee..5dbd87b66d1a 100644 --- a/sys/compat/linuxkpi/common/src/linux_slab.c +++ b/sys/compat/linuxkpi/common/src/linux_slab.c @@ -35,12 +35,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include struct linux_kmem_rcu { struct rcu_head rcu_head; struct linux_kmem_cache *cache; }; +struct linux_kmem_cache { + uma_zone_t cache_zone; + linux_kmem_ctor_t *cache_ctor; + unsigned cache_flags; + unsigned cache_size; + struct llist_head cache_items; + struct task cache_task; +}; + #define LINUX_KMEM_TO_RCU(c, m) \ ((struct linux_kmem_rcu *)((char *)(m) + \ (c)->cache_size - sizeof(struct linux_kmem_rcu))) @@ -51,6 +61,22 @@ struct linux_kmem_rcu { static LLIST_HEAD(linux_kfree_async_list); +static void lkpi_kmem_cache_free_async_fn(void *, int); + +void * +lkpi_kmem_cache_alloc(struct linux_kmem_cache *c, gfp_t flags) +{ + return (uma_zalloc_arg(c->cache_zone, c, + linux_check_m_flags(flags))); +} + +void * +lkpi_kmem_cache_zalloc(struct linux_kmem_cache *c, gfp_t flags) +{ + return (uma_zalloc_arg(c->cache_zone, c, + linux_check_m_flags(flags | M_ZERO))); +} + static int linux_kmem_ctor(void *mem, int size, void *arg, int flags) { @@ -102,6 +128,9 @@ linux_kmem_cache_create(const char *name, size_t size, size_t align, linux_kmem_ctor, NULL, NULL, NULL, align, UMA_ZONE_ZINIT); } else { + /* make room for async task list items */ + size = MAX(size, sizeof(struct llist_node)); + /* create cache_zone */ c->cache_zone = uma_zcreate(name, size, ctor ? linux_kmem_ctor : NULL, NULL, @@ -111,17 +140,56 @@ linux_kmem_cache_create(const char *name, size_t size, size_t align, c->cache_flags = flags; c->cache_ctor = ctor; c->cache_size = size; + init_llist_head(&c->cache_items); + TASK_INIT(&c->cache_task, 0, lkpi_kmem_cache_free_async_fn, c); return (c); } -void -linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m) +static inline void +lkpi_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m) { struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, m); call_rcu(&rcu->rcu_head, linux_kmem_cache_free_rcu_callback); } +static inline void +lkpi_kmem_cache_free_sync(struct linux_kmem_cache *c, void *m) +{ + uma_zfree(c->cache_zone, m); +} + +static void +lkpi_kmem_cache_free_async_fn(void *context, int pending) +{ + struct linux_kmem_cache *c = context; + struct llist_node *freed, *next; + + llist_for_each_safe(freed, next, llist_del_all(&c->cache_items)) + lkpi_kmem_cache_free_sync(c, freed); +} + +static inline void +lkpi_kmem_cache_free_async(struct linux_kmem_cache *c, void *m) +{ + if (m == NULL) + return; + + llist_add(m, &c->cache_items); + taskqueue_enqueue(linux_irq_work_tq, &c->cache_task); +} + +void +lkpi_kmem_cache_free(struct linux_kmem_cache *c, void *m) +{ + if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) + lkpi_kmem_cache_free_rcu(c, m); + else if (unlikely(curthread->td_critnest != 0)) + lkpi_kmem_cache_free_async(c, m); + else + lkpi_kmem_cache_free_sync(c, m); +} + void linux_kmem_cache_destroy(struct linux_kmem_cache *c) { @@ -130,6 +198,9 @@ linux_kmem_cache_destroy(struct linux_kmem_cache *c) rcu_barrier(); } + if (!llist_empty(&c->cache_items)) + taskqueue_enqueue(linux_irq_work_tq, &c->cache_task); + taskqueue_drain(linux_irq_work_tq, &c->cache_task); uma_zdestroy(c->cache_zone); free(c, M_KMALLOC); } From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C410C64FC5C; Mon, 5 Jul 2021 00:23: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 4GJ5yP4yqJz4tBK; Mon, 5 Jul 2021 00:23: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 8ED871C0FC; Mon, 5 Jul 2021 00:23: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 1650NfZ8022510; Mon, 5 Jul 2021 00:23:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nf6N022509; Mon, 5 Jul 2021 00:23:41 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:41 GMT Message-Id: <202107050023.1650Nf6N022509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 78a02d8b332c - main - LinuxKPI: Add #defines required by drm-kmod v5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78a02d8b332cd46e26e1a8088cd0ba5220cd1f18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:41 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=78a02d8b332cd46e26e1a8088cd0ba5220cd1f18 commit 78a02d8b332cd46e26e1a8088cd0ba5220cd1f18 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:18:47 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:18:47 +0000 LinuxKPI: Add #defines required by drm-kmod v5.5 Reviewed by: hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30767 --- sys/compat/linuxkpi/common/include/linux/pci.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 85278356dfea..4784799d82b5 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -130,6 +130,14 @@ struct pci_device_id { #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x10 /* Supported Link Speed 16.0GT/s */ +#define PCI_EXP_LNKCTL2_TLS 0x000f +#define PCI_EXP_LNKCTL2_TLS_2_5GT 0x0001 /* Supported Speed 2.5GT/s */ +#define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */ +#define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */ +#define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */ +#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005 /* Supported Speed 32GT/s */ +#define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010 /* Enter Compliance */ +#define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */ #define PCI_EXP_LNKCTL_HAWD PCIEM_LINK_CTL_HAWD #define PCI_EXP_LNKCAP_CLKPM 0x00040000 From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1AEDC65049A; Mon, 5 Jul 2021 00:23: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 4GJ5yQ73T9z4t6p; Mon, 5 Jul 2021 00:23: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 B63861C0FD; Mon, 5 Jul 2021 00:23: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 1650Ngk3022535; Mon, 5 Jul 2021 00:23:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NgF4022534; Mon, 5 Jul 2021 00:23:42 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:42 GMT Message-Id: <202107050023.1650NgF4022534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: c77ec79b57aa - main - LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsave MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c77ec79b57aa92b428b940ed550a4a14ed44da48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:43 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c77ec79b57aa92b428b940ed550a4a14ed44da48 commit c77ec79b57aa92b428b940ed550a4a14ed44da48 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:01 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:01 +0000 LinuxKPI: Change flags parameter type of atomic_dec_and_lock_irqsave On Linux atomic_dec_and_lock_irqsave is a wrapper macro which provides a reference to third parameter rather than parameter value itself to implementation routine called _atomic_dec_and_lock_irqsave [1]. While here, implement a fast path. [1] https://github.com/torvalds/linux/blob/master/include/linux/spinlock.h#L476 Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30781 --- sys/compat/linuxkpi/common/include/linux/spinlock.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index ca51fd23434c..46b1f8b9a180 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -163,15 +163,20 @@ spin_lock_destroy(spinlock_t *lock) mtx_assert(&(_l)->m, MA_OWNED); \ } while (0) +#define atomic_dec_and_lock_irqsave(cnt, lock, flags) \ + _atomic_dec_and_lock_irqsave(cnt, lock, &(flags)) static inline int -atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock, - unsigned long flags) +_atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock, + unsigned long *flags) { - spin_lock_irqsave(lock, flags); + if (atomic_add_unless(cnt, -1, 1)) + return (0); + + spin_lock_irqsave(lock, *flags); if (atomic_dec_and_test(cnt)) - return 1; - spin_unlock_irqrestore(lock, flags); - return 0; + return (1); + spin_unlock_irqrestore(lock, *flags); + return (0); } #endif /* _LINUX_SPINLOCK_H_ */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6E68565061B; Mon, 5 Jul 2021 00:23: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 4GJ5yS0LC5z4t0s; Mon, 5 Jul 2021 00:23: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 D1FD11C39D; Mon, 5 Jul 2021 00:23: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 1650NhI1022559; Mon, 5 Jul 2021 00:23:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nh6L022558; Mon, 5 Jul 2021 00:23:43 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:43 GMT Message-Id: <202107050023.1650Nh6L022558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: c0862b2b1fa9 - main - LinuxKPI: Add compiler barriers to list_for_each_entry_lockless macro MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0862b2b1fa91636d308a1a41d8dc370691d656e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:44 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c0862b2b1fa91636d308a1a41d8dc370691d656e commit c0862b2b1fa91636d308a1a41d8dc370691d656e Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:35 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:35 +0000 LinuxKPI: Add compiler barriers to list_for_each_entry_lockless macro so this list-traversal primitive may safely run concurrently with the _rcu list-mutation primitives such as list_add_rcu() as long as the traversal is guarded by rcu_read_lock(). Do it by reusing the "list_for_each_entry_rcu" macro which does the same. On Linux it implements some additional lockdep stuff which we skip. Also move the macro to linux/rculist.h where it resides on Linux. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30795 --- sys/compat/linuxkpi/common/include/linux/list.h | 2 -- sys/compat/linuxkpi/common/include/linux/rculist.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h index 93db449a4473..37b5b751d21b 100644 --- a/sys/compat/linuxkpi/common/include/linux/list.h +++ b/sys/compat/linuxkpi/common/include/linux/list.h @@ -202,8 +202,6 @@ list_del_init(struct list_head *entry) for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \ p = list_entry((p)->field.next, typeof(*p), field)) -#define list_for_each_entry_lockless(...) list_for_each_entry(__VA_ARGS__) - #define list_for_each_entry_safe(p, n, h, field) \ for (p = list_entry((h)->next, typeof(*p), field), \ n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h);\ diff --git a/sys/compat/linuxkpi/common/include/linux/rculist.h b/sys/compat/linuxkpi/common/include/linux/rculist.h index bff2f7e13184..6c21a6943f98 100644 --- a/sys/compat/linuxkpi/common/include/linux/rculist.h +++ b/sys/compat/linuxkpi/common/include/linux/rculist.h @@ -44,6 +44,9 @@ &(pos)->member != (head); \ pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) +#define list_for_each_entry_lockless(pos, head, member) \ + list_for_each_entry_rcu(pos, head, member) + static inline void linux_list_add_rcu(struct list_head *new, struct list_head *prev, struct list_head *next) From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 466F4650620; Mon, 5 Jul 2021 00:23:46 +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 4GJ5yV1Jt6z4svq; Mon, 5 Jul 2021 00:23:46 +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 123111C1E8; Mon, 5 Jul 2021 00:23: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 1650Nj7V022607; Mon, 5 Jul 2021 00:23:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NjRN022606; Mon, 5 Jul 2021 00:23:45 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:45 GMT Message-Id: <202107050023.1650NjRN022606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 864b11007ab3 - main - LinuxKPI: Implement irq_work_sync() routine. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 864b11007ab3de9f65f28b730507225396c38b9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:46 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=864b11007ab3de9f65f28b730507225396c38b9e commit 864b11007ab3de9f65f28b730507225396c38b9e Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:06 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:06 +0000 LinuxKPI: Implement irq_work_sync() routine. irq_work_sync() performs draining of irq_work task. Required by drm-kmod. Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30818 --- sys/compat/linuxkpi/common/include/linux/irq_work.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/irq_work.h b/sys/compat/linuxkpi/common/include/linux/irq_work.h index eb1798a4e450..1b376b829818 100644 --- a/sys/compat/linuxkpi/common/include/linux/irq_work.h +++ b/sys/compat/linuxkpi/common/include/linux/irq_work.h @@ -64,4 +64,10 @@ irq_work_queue(struct irq_work *irqw) taskqueue_enqueue(linux_irq_work_tq, &irqw->irq_task); } +static inline void +irq_work_sync(struct irq_work *irqw) +{ + taskqueue_drain(linux_irq_work_tq, &irqw->irq_task); +} + #endif /* __LINUX_IRQ_WORK_H__ */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C8306504B5; Mon, 5 Jul 2021 00:23: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 4GJ5yT0c7Qz4tBX; Mon, 5 Jul 2021 00:23: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 E4D8B1C31A; Mon, 5 Jul 2021 00:23: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 1650NimU022583; Mon, 5 Jul 2021 00:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Ni4I022582; Mon, 5 Jul 2021 00:23:44 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:44 GMT Message-Id: <202107050023.1650Ni4I022582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 1ab61a193241 - main - LinuxKPI: Do not wait for a grace period in rcu_barrier() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ab61a193241f832e63f97ca37880b010469cb38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:45 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=1ab61a193241f832e63f97ca37880b010469cb38 commit 1ab61a193241f832e63f97ca37880b010469cb38 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:50 +0000 LinuxKPI: Do not wait for a grace period in rcu_barrier() Linux docs explicitly state that this is not required [1]: "Important note: The rcu_barrier() function is not, repeat, not, obligated to wait for a grace period. It is instead only required to wait for RCU callbacks that have already been posted. Therefore, if there are no RCU callbacks posted anywhere in the system, rcu_barrier() is within its rights to return immediately. Even if there are callbacks posted, rcu_barrier() does not necessarily need to wait for a grace period." [1] https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html Reviewed by: emaste, hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30809 --- sys/compat/linuxkpi/common/src/linux_rcu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index a39949cf5013..2179faa2c05e 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -367,8 +367,12 @@ linux_rcu_barrier(unsigned type) MPASS(type < RCU_TYPE_MAX); - linux_synchronize_rcu(type); - + /* + * This function is not obligated to wait for a grace period. + * It only waits for RCU callbacks that have already been posted. + * If there are no RCU callbacks posted, rcu_barrier() can return + * immediately. + */ head = &linux_epoch_head[type]; /* wait for callbacks to complete */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F186B6504B9; Mon, 5 Jul 2021 00:23: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 4GJ5yW563Yz4t82; Mon, 5 Jul 2021 00:23: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 38FB21C0FE; Mon, 5 Jul 2021 00:23: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 1650NlPn022633; Mon, 5 Jul 2021 00:23:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nlil022632; Mon, 5 Jul 2021 00:23:47 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:47 GMT Message-Id: <202107050023.1650Nlil022632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 98a6984a9e10 - main - LinuxKPI: Use macro for implementation of some dma_map_* functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98a6984a9e10c5c1677643eb4d9a758e3af131da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:48 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=98a6984a9e10c5c1677643eb4d9a758e3af131da commit 98a6984a9e10c5c1677643eb4d9a758e3af131da Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:23 +0000 LinuxKPI: Use macro for implementation of some dma_map_* functions This allows to remove unimplemented attrs parameter which type differs between Linux kernel versions and to compile both drm-kmod and ofed callers unmodified. Also convert it to 'unsigned long' type to match modern Linuxes. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30932 --- .../linuxkpi/common/include/linux/dma-mapping.h | 59 ++++++++-------------- sys/compat/linuxkpi/common/src/linux_pci.c | 5 +- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index d074b563cd41..5b5bc9e90815 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -63,13 +63,13 @@ struct dma_map_ops { void *vaddr, dma_addr_t dma_handle); dma_addr_t (*map_page)(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs); + unsigned long attrs); void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, - size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); + size_t size, enum dma_data_direction dir, unsigned long attrs); int (*map_sg)(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs); + int nents, enum dma_data_direction dir, unsigned long attrs); void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs); + enum dma_data_direction dir, unsigned long attrs); void (*sync_single_for_cpu)(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir); void (*sync_single_for_device)(struct device *dev, @@ -97,9 +97,11 @@ void *linux_dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len); void linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t size); int linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs); + int nents, enum dma_data_direction dir __unused, + unsigned long attrs __unused); void linux_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs); + int nents __unused, enum dma_data_direction dir __unused, + unsigned long attrs __unused); static inline int dma_supported(struct device *dev, u64 mask) @@ -164,21 +166,11 @@ dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, kmem_free((vm_offset_t)cpu_addr, size); } -static inline dma_addr_t -dma_map_single_attrs(struct device *dev, void *ptr, size_t size, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ +#define dma_map_single_attrs(dev, ptr, size, dir, attrs) \ + linux_dma_map_phys(dev, vtophys(ptr), size) - return (linux_dma_map_phys(dev, vtophys(ptr), size)); -} - -static inline void -dma_unmap_single_attrs(struct device *dev, dma_addr_t dma_addr, size_t size, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - - linux_dma_unmap(dev, dma_addr, size); -} +#define dma_unmap_single_attrs(dev, dma_addr, size, dir, attrs) \ + linux_dma_unmap(dev, dma_addr, size) static inline dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page, size_t offset, @@ -188,21 +180,12 @@ dma_map_page_attrs(struct device *dev, struct page *page, size_t offset, return (linux_dma_map_phys(dev, VM_PAGE_TO_PHYS(page) + offset, size)); } -static inline int -dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - - return (linux_dma_map_sg_attrs(dev, sgl, nents, dir, attrs)); -} +/* linux_dma_(un)map_sg_attrs does not support attrs yet */ +#define dma_map_sg_attrs(dev, sgl, nents, dir, attrs) \ + linux_dma_map_sg_attrs(dev, sgl, nents, dir, 0) -static inline void -dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - - linux_dma_unmap_sg_attrs(dev, sg, nents, dir, attrs); -} +#define dma_unmap_sg_attrs(dev, sg, nents, dir, attrs) \ + linux_dma_unmap_sg_attrs(dev, sg, nents, dir, 0) static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, @@ -276,10 +259,10 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev, return (0); } -#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) -#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL) -#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) -#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) +#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, 0) +#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, 0) +#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, 0) +#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, 0) #define DEFINE_DMA_UNMAP_ADDR(name) dma_addr_t name #define DEFINE_DMA_UNMAP_LEN(name) __u32 name diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index c35d259a45be..ae45df9c6514 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -881,7 +881,7 @@ linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t len) int linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) + enum dma_data_direction dir __unused, unsigned long attrs __unused) { struct linux_dma_priv *priv; struct scatterlist *sg; @@ -921,7 +921,8 @@ linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents, void linux_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sgl, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs) + int nents __unused, enum dma_data_direction dir __unused, + unsigned long attrs __unused) { struct linux_dma_priv *priv; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D0ED4650151; Mon, 5 Jul 2021 00:23:48 +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 4GJ5yX4Czlz4tGy; Mon, 5 Jul 2021 00:23:48 +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 5B4FD1C1E9; Mon, 5 Jul 2021 00:23: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 1650NmMi022661; Mon, 5 Jul 2021 00:23:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nmn3022660; Mon, 5 Jul 2021 00:23:48 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:48 GMT Message-Id: <202107050023.1650Nmn3022660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 019391bf8527 - main - LinuxKPI: Implement strscpy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 019391bf852771070cb739900f9e20ae6c41c746 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:48 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=019391bf852771070cb739900f9e20ae6c41c746 commit 019391bf852771070cb739900f9e20ae6c41c746 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:42 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:42 +0000 LinuxKPI: Implement strscpy strscpy copies the src string, or as much of it as fits, into the dst buffer. The dst buffer is always NUL terminated, unless it's zero-sized. strscpy returns the number of characters copied (not including the trailing NUL) or -E2BIG if len is 0 or src was truncated. Currently drm-kmod replaces strscpy with strncpy that is not quite correct as strncpy does not NUL-terminate truncated strings and returns different values on exit. Reviewed by: hselasky, imp, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31005 --- sys/compat/linuxkpi/common/include/linux/string.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 39201e203162..659a48d93596 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -167,4 +167,20 @@ str_has_prefix(const char *str, const char *prefix) return (strncmp(str, prefix, len) == 0 ? len : 0); } +static inline ssize_t +strscpy(char* dst, const char* src, size_t len) +{ + size_t i; + + if (len <= INT_MAX) { + for (i = 0; i < len; i++) + if ('\0' == (dst[i] = src[i])) + return ((ssize_t)i); + if (i != 0) + dst[--i] = '\0'; + } + + return (-E2BIG); +} + #endif /* _LINUX_STRING_H_ */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4DA096504BC; Mon, 5 Jul 2021 00:23: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 4GJ5yZ083Hz4t14; Mon, 5 Jul 2021 00:23: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 7D09C1C168; Mon, 5 Jul 2021 00:23: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 1650Nn0a022685; Mon, 5 Jul 2021 00:23:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Nn2O022684; Mon, 5 Jul 2021 00:23:49 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:49 GMT Message-Id: <202107050023.1650Nn2O022684@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 8b33cb8303d3 - main - LinuxKPI: Implement sequence counters and sequential locks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b33cb8303d3d7ff12e34327a872ef9fdb29eab9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8b33cb8303d3d7ff12e34327a872ef9fdb29eab9 commit 8b33cb8303d3d7ff12e34327a872ef9fdb29eab9 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:20:55 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:20:55 +0000 LinuxKPI: Implement sequence counters and sequential locks as a thin wrapper around native version found in sys/seqc.h. This replaces out-of-base GPLv2-licensed code used by drm-kmod. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D31006 --- sys/compat/linuxkpi/common/include/linux/seqlock.h | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/seqlock.h b/sys/compat/linuxkpi/common/include/linux/seqlock.h new file mode 100644 index 000000000000..b7ae6e32ae69 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/seqlock.h @@ -0,0 +1,137 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Vladimir Kondratyev + * + * 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. + */ + +#ifndef _LINUX_SEQLOCK_H__ +#define _LINUX_SEQLOCK_H__ + +#include +#include +#include +#include + +struct lock_class_key; + +struct seqcount { + seqc_t seqc; +}; +typedef struct seqcount seqcount_t; + +struct seqlock { + struct mtx seql_lock; + struct seqcount seql_count; +}; +typedef struct seqlock seqlock_t; + +static inline void +__seqcount_init(struct seqcount *seqcount, const char *name __unused, + struct lock_class_key *key __unused) +{ + seqcount->seqc = 0; +} +#define seqcount_init(seqcount) __seqcount_init(seqcount, NULL, NULL) + +static inline void +write_seqcount_begin(struct seqcount *seqcount) +{ + seqc_sleepable_write_begin(&seqcount->seqc); +} + +static inline void +write_seqcount_end(struct seqcount *seqcount) +{ + seqc_sleepable_write_end(&seqcount->seqc); +} + +/* + * XXX: Are predicts from inline functions still not honored by clang? + */ +#define __read_seqcount_retry(seqcount, gen) \ + (!seqc_consistent_nomb(&(seqcount)->seqc, gen)) +#define read_seqcount_retry(seqcount, gen) \ + (!seqc_consistent(&(seqcount)->seqc, gen)) + +static inline unsigned +read_seqcount_begin(const struct seqcount *seqcount) +{ + return (seqc_read(&seqcount->seqc)); +} + +static inline unsigned +raw_read_seqcount(const struct seqcount *seqcount) +{ + return (seqc_read_any(&seqcount->seqc)); +} + +static inline void +seqlock_init(struct seqlock *seqlock) +{ + /* + * Don't enroll to witness(4) to avoid orphaned references after struct + * seqlock has been freed. There is no seqlock destructor exists so we + * can't expect automatic mtx_destroy() execution before free(). + */ + mtx_init(&seqlock->seql_lock, "seqlock", NULL, MTX_DEF|MTX_NOWITNESS); + seqcount_init(&seqlock->seql_count); +} + +static inline void +write_seqlock(struct seqlock *seqlock) +{ + mtx_lock(&seqlock->seql_lock); + write_seqcount_begin(&seqlock->seql_count); +} + +static inline void +write_sequnlock(struct seqlock *seqlock) +{ + write_seqcount_end(&seqlock->seql_count); + mtx_unlock(&seqlock->seql_lock); +} + +#define write_seqlock_irqsave(seqlock, flags) do { \ + (flags) = 0; \ + write_seqlock(seqlock); \ +} while (0) + +static inline void +write_sequnlock_irqrestore(struct seqlock *seqlock, + unsigned long flags __unused) +{ + write_sequnlock(seqlock); +} + +static inline unsigned +read_seqbegin(const struct seqlock *seqlock) +{ + return (read_seqcount_begin(&seqlock->seql_count)); +} + +#define read_seqretry(seqlock, gen) \ + read_seqcount_retry(&(seqlock)->seql_count, gen) + +#endif /* _LINUX_SEQLOCK_H__ */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 177C865070B; Mon, 5 Jul 2021 00:23: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 4GJ5yb017Mz4t8G; Mon, 5 Jul 2021 00:23: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 AFE8D1C39E; Mon, 5 Jul 2021 00:23: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 1650NonI022709; Mon, 5 Jul 2021 00:23:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650NoQg022708; Mon, 5 Jul 2021 00:23:50 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:50 GMT Message-Id: <202107050023.1650NoQg022708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5fa1eb1cd927 - main - Bump __FreeBSD_version to 1400025 for LinuxKPI change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fa1eb1cd927219070b5753b64114a9240d76bf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5fa1eb1cd927219070b5753b64114a9240d76bf8 commit 5fa1eb1cd927219070b5753b64114a9240d76bf8 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:22:19 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:22:19 +0000 Bump __FreeBSD_version to 1400025 for LinuxKPI change. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 90a3a2cfac89..96538a949c3f 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400024 +#define __FreeBSD_version 1400025 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Mon Jul 5 02:16:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C64EB651354; Mon, 5 Jul 2021 02:16:11 +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 4GJ8SC52RBz3J1S; Mon, 5 Jul 2021 02:16: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 90D631D9D5; Mon, 5 Jul 2021 02:16:11 +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 1652GBlx068980; Mon, 5 Jul 2021 02:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1652GBNe068979; Mon, 5 Jul 2021 02:16:11 GMT (envelope-from git) Date: Mon, 5 Jul 2021 02:16:11 GMT Message-Id: <202107050216.1652GBNe068979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 167897510919 - main - freebsd-tips: Fix the description of fetch(1) to match the command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 167897510919a76740eca0d79713abbd088660fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 02:16:11 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=167897510919a76740eca0d79713abbd088660fe commit 167897510919a76740eca0d79713abbd088660fe Author: Li-Wen Hsu AuthorDate: 2021-07-05 02:14:25 +0000 Commit: Li-Wen Hsu CommitDate: 2021-07-05 02:14:25 +0000 freebsd-tips: Fix the description of fetch(1) to match the command Reported by: jrtc27 MFC with: ffe6afc4f0121f1909f2fa88694228f771dd3fcb --- usr.bin/fortune/datfiles/freebsd-tips | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index c747c689791b..c974f74dfda3 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -441,7 +441,7 @@ You can use the 'fetch' command to retrieve files over ftp, http or https. fetch https://www.FreeBSD.org/images/beastie.png -will download the front page of the FreeBSD web site. +will download the beastie image from the FreeBSD web site. % You can use "whereis" to search standard binary, manual page and source directories for the specified programs. This can be particularly handy From owner-dev-commits-src-all@freebsd.org Mon Jul 5 02:17:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5463965193D; Mon, 5 Jul 2021 02:17:44 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4GJ8V01vMFz3HsD; Mon, 5 Jul 2021 02:17:44 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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: lwhsu/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 248BF26C04; Mon, 5 Jul 2021 02:17:44 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by mail-yb1-f178.google.com with SMTP id m9so26648659ybp.8; Sun, 04 Jul 2021 19:17:44 -0700 (PDT) X-Gm-Message-State: AOAM530UA70Fphs9ZiwlFTfxaMP83uVplk+PP0OU6/Lcx1svpmaP6zEE Mt2So1H5O1J9Pml57QrfmbKJDR4tnWXBTWcYtLM= X-Google-Smtp-Source: ABdhPJwbLYew0Y5OfRAmTnYOC3cqWQZ7BlNSTcERcwS/uydHGQr+QdJ0AJ9iCMxzEM3oksiSnVqlDgWRwDjxg2PQd/o= X-Received: by 2002:a25:38c6:: with SMTP id f189mr8444644yba.110.1625451463669; Sun, 04 Jul 2021 19:17:43 -0700 (PDT) MIME-Version: 1.0 References: <202107041401.164E1KXH094610@gitrepo.freebsd.org> <03B758C5-2243-4ACF-9574-D984B283B407@freebsd.org> In-Reply-To: <03B758C5-2243-4ACF-9574-D984B283B407@freebsd.org> From: Li-Wen Hsu Date: Mon, 5 Jul 2021 10:17:32 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: ffe6afc4f012 - main - freebsd-tips: Use a fetchable URL as example To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 02:17:44 -0000 On Sun, Jul 4, 2021 at 10:52 PM Jessica Clarke wrote: > > Hi, > > On 4 Jul 2021, at 15:01, Li-Wen Hsu wrote: > > > > The branch main has been updated by lwhsu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ffe6afc4f0121f1909f2fa88694228f771dd3fcb > > > > commit ffe6afc4f0121f1909f2fa88694228f771dd3fcb > > Author: Li-Wen Hsu > > AuthorDate: 2021-07-04 14:00:46 +0000 > > Commit: Li-Wen Hsu > > CommitDate: 2021-07-04 14:00:46 +0000 > > > > freebsd-tips: Use a fetchable URL as example > > > > MFC after: 3 days > > --- > > usr.bin/fortune/datfiles/freebsd-tips | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips > > index cbbaff9eb84f..c747c689791b 100644 > > --- a/usr.bin/fortune/datfiles/freebsd-tips > > +++ b/usr.bin/fortune/datfiles/freebsd-tips > > @@ -439,7 +439,7 @@ You can use "pkg info" to see a list of packages you have installed. > > % > > You can use the 'fetch' command to retrieve files over ftp, http or https. > > > > - fetch https://www.FreeBSD.org/index.html > > + fetch https://www.FreeBSD.org/images/beastie.png > > > > will download the front page of the FreeBSD web site. > > This description no longer matches. Thanks for catching this! Fixed in 167897510919a76740eca0d79713abbd088660fe. Best, Li-Wen From owner-dev-commits-src-all@freebsd.org Mon Jul 5 05:59:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 08F366542B8; Mon, 5 Jul 2021 05:59: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 4GJFPJ6r35z3rdQ; Mon, 5 Jul 2021 05:59: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 CF4862093F; Mon, 5 Jul 2021 05:59: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 1655x0pG062813; Mon, 5 Jul 2021 05:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1655x01s062812; Mon, 5 Jul 2021 05:59:00 GMT (envelope-from git) Date: Mon, 5 Jul 2021 05:59:00 GMT Message-Id: <202107050559.1655x01s062812@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: dc42a0503bc9 - stable/13 - tests/libalias: Bugfix in used variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dc42a0503bc97fbf56036458b5616185e0abda37 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 05:59:01 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=dc42a0503bc97fbf56036458b5616185e0abda37 commit dc42a0503bc97fbf56036458b5616185e0abda37 Author: Lutz Donnerhacke AuthorDate: 2021-07-02 21:58:16 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-05 05:58:02 +0000 tests/libalias: Bugfix in used variables Fix two copy and waste errors (referencing the wrong variable). (cherry picked from commit b3dc6f137b8d626c4415a5fa9c9874ac4ca78658) --- tests/sys/netinet/libalias/3_natin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netinet/libalias/3_natin.c b/tests/sys/netinet/libalias/3_natin.c index e8e5257e4baa..3bc088ce3da9 100644 --- a/tests/sys/netinet/libalias/3_natin.c +++ b/tests/sys/netinet/libalias/3_natin.c @@ -112,7 +112,7 @@ ATF_TC_BODY(1_portforward, dummy) LibAliasSetAddress(la, masq); /* delete and try again */ - LibAliasRedirectDelete(la, pf2); + LibAliasRedirectDelete(la, pf3); UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); /* @@ -133,7 +133,7 @@ ATF_TC_BODY(1_portforward, dummy) LibAliasSetAddress(la, masq); /* delete and try again */ - LibAliasRedirectDelete(la, pf2); + LibAliasRedirectDelete(la, pf4); UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); free(p); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 06:01:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BDB1D6542DF; Mon, 5 Jul 2021 06:01: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 4GJFSB55Smz3rlW; Mon, 5 Jul 2021 06:01: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 97C2C2047C; Mon, 5 Jul 2021 06:01: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 16561UWY075988; Mon, 5 Jul 2021 06:01:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16561UFa075987; Mon, 5 Jul 2021 06:01:30 GMT (envelope-from git) Date: Mon, 5 Jul 2021 06:01:30 GMT Message-Id: <202107050601.16561UFa075987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 884da892b634 - stable/12 - tests/libalias: Bugfix in used variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 884da892b634224bebbeb12deaa0b00442e14c87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 06:01:30 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=884da892b634224bebbeb12deaa0b00442e14c87 commit 884da892b634224bebbeb12deaa0b00442e14c87 Author: Lutz Donnerhacke AuthorDate: 2021-07-02 21:58:16 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-05 06:01:06 +0000 tests/libalias: Bugfix in used variables Fix two copy and waste errors (referencing the wrong variable). (cherry picked from commit b3dc6f137b8d626c4415a5fa9c9874ac4ca78658) --- tests/sys/netinet/libalias/3_natin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netinet/libalias/3_natin.c b/tests/sys/netinet/libalias/3_natin.c index e8e5257e4baa..3bc088ce3da9 100644 --- a/tests/sys/netinet/libalias/3_natin.c +++ b/tests/sys/netinet/libalias/3_natin.c @@ -112,7 +112,7 @@ ATF_TC_BODY(1_portforward, dummy) LibAliasSetAddress(la, masq); /* delete and try again */ - LibAliasRedirectDelete(la, pf2); + LibAliasRedirectDelete(la, pf3); UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); /* @@ -133,7 +133,7 @@ ATF_TC_BODY(1_portforward, dummy) LibAliasSetAddress(la, masq); /* delete and try again */ - LibAliasRedirectDelete(la, pf2); + LibAliasRedirectDelete(la, pf4); UDP_UNNAT_FAIL(p, u, ext, 0x5678, masq, 0xabcd); free(p); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 07:15:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 021AB655346; Mon, 5 Jul 2021 07:15:38 +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 4GJH5j6gFwz4SK7; Mon, 5 Jul 2021 07:15: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 CD7DA21C9C; Mon, 5 Jul 2021 07:15: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 1657Fbr7070433; Mon, 5 Jul 2021 07:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1657FbIm070432; Mon, 5 Jul 2021 07:15:37 GMT (envelope-from git) Date: Mon, 5 Jul 2021 07:15:37 GMT Message-Id: <202107050715.1657FbIm070432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 7ebe83ddb788 - main - stress2: Limit scope of rm(1) wildcard in cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ebe83ddb788568181aa0916b23284cdce639b3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 07:15:38 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=7ebe83ddb788568181aa0916b23284cdce639b3c commit 7ebe83ddb788568181aa0916b23284cdce639b3c Author: Peter Holm AuthorDate: 2021-07-05 07:14:05 +0000 Commit: Peter Holm CommitDate: 2021-07-05 07:14:05 +0000 stress2: Limit scope of rm(1) wildcard in cleanup. Reviewed by: rgrimes --- tools/test/stress2/misc/mmap3.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/mmap3.sh b/tools/test/stress2/misc/mmap3.sh index 9175b77842f3..8a319377070f 100755 --- a/tools/test/stress2/misc/mmap3.sh +++ b/tools/test/stress2/misc/mmap3.sh @@ -42,12 +42,13 @@ while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do ./mmap3 done echo "Expect Segmentation faults" -trap "rm -f /tmp/mmap3.0*" EXIT INT +trap "ls /tmp/mmap3* | grep -E 'mmap3\.[0-9]{6}\.[0-9]{4}$' | xargs rm -v" \ + EXIT INT start=`date '+%s'` while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do ./mmap3 random done -rm -f mmap3 mmap3.core /tmp/mmap3.0* +rm -f mmap3 mmap3.core exit EOF From owner-dev-commits-src-all@freebsd.org Mon Jul 5 07:18:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EE85E655365; Mon, 5 Jul 2021 07:18: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 4GJH8X6SLpz4SMr; Mon, 5 Jul 2021 07:18: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 C69D721A2D; Mon, 5 Jul 2021 07:18: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 1657I46X070802; Mon, 5 Jul 2021 07:18:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1657I4EY070801; Mon, 5 Jul 2021 07:18:04 GMT (envelope-from git) Date: Mon, 5 Jul 2021 07:18:04 GMT Message-Id: <202107050718.1657I4EY070801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: c5d6dd80b54b - main - stress2: Wait for the "swap" program to terminate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5d6dd80b54b61fcebbd2914de79d04d12d5b8f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 07:18:05 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=c5d6dd80b54b61fcebbd2914de79d04d12d5b8f8 commit c5d6dd80b54b61fcebbd2914de79d04d12d5b8f8 Author: Peter Holm AuthorDate: 2021-07-05 07:16:32 +0000 Commit: Peter Holm CommitDate: 2021-07-05 07:16:32 +0000 stress2: Wait for the "swap" program to terminate --- tools/test/stress2/misc/syzkaller20.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test/stress2/misc/syzkaller20.sh b/tools/test/stress2/misc/syzkaller20.sh index 43c961983bf1..15a16bf41fd0 100755 --- a/tools/test/stress2/misc/syzkaller20.sh +++ b/tools/test/stress2/misc/syzkaller20.sh @@ -102,6 +102,7 @@ mycc -o /tmp/syzkaller20 -Wall -Wextra -O2 /tmp/syzkaller20.c -lpthread || (cd /tmp; ./syzkaller20) & sleep 60 pkill -9 syzkaller20 swap +while pgrep -q swap; do pkill swap; done wait rm -f /tmp/syzkaller20 /tmp/syzkaller20.c /tmp/syzkaller20.core From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:23:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF9F36580BA; Mon, 5 Jul 2021 09:23: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 4GJKwm6SvLz4hFV; Mon, 5 Jul 2021 09:23: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 C630722F6B; Mon, 5 Jul 2021 09:23: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 1659N4pD043924; Mon, 5 Jul 2021 09:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659N4lV043923; Mon, 5 Jul 2021 09:23:04 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:23:04 GMT Message-Id: <202107050923.1659N4lV043923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f92c21a28cd8 - main - pf: depessimize table handling 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/main X-Git-Reftype: branch X-Git-Commit: f92c21a28cd856834249a008771b2f002e477a39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:23:05 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f92c21a28cd856834249a008771b2f002e477a39 commit f92c21a28cd856834249a008771b2f002e477a39 Author: Mateusz Guzik AuthorDate: 2021-07-02 11:19:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 08:42:01 +0000 pf: depessimize table handling Creating tables and zeroing their counters induces excessive IPIs (14 per table), which in turns kills single- and multi-threaded performance. Work around the problem by extending per-CPU counters with a general counter populated on "zeroing" requests -- it stores the currently found sum. Then requests to report the current value are the sum of per-CPU counters subtracted by the saved value. Sample timings when loading a config with 100k tables on a 104-way box: stock: pfctl -f tables100000.conf 0.39s user 69.37s system 99% cpu 1:09.76 total pfctl -f tables100000.conf 0.40s user 68.14s system 99% cpu 1:08.54 total patched: pfctl -f tables100000.conf 0.35s user 6.41s system 99% cpu 6.771 total pfctl -f tables100000.conf 0.48s user 6.47s system 99% cpu 6.949 total Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 62 ++++++++++++++++++++++++++++++++++++++++++++--- sys/netpfil/pf/pf_table.c | 58 +++++++++++++++++++++----------------------- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index c97fffea845f..515953c09f53 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -817,16 +817,70 @@ struct pfr_tstats { int pfrts_refcnt[PFR_REFCNT_MAX]; }; +#ifdef _KERNEL + +struct pfr_kstate_counter { + counter_u64_t pkc_pcpu; + u_int64_t pkc_zero; +}; + +static inline int +pfr_kstate_counter_init(struct pfr_kstate_counter *pfrc, int flags) +{ + + pfrc->pkc_zero = 0; + pfrc->pkc_pcpu = counter_u64_alloc(flags); + if (pfrc->pkc_pcpu == NULL) + return (ENOMEM); + return (0); +} + +static inline void +pfr_kstate_counter_deinit(struct pfr_kstate_counter *pfrc) +{ + + counter_u64_free(pfrc->pkc_pcpu); +} + +static inline u_int64_t +pfr_kstate_counter_fetch(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + c -= pfrc->pkc_zero; + return (c); +} + +static inline void +pfr_kstate_counter_zero(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + pfrc->pkc_zero = c; +} + +static inline void +pfr_kstate_counter_add(struct pfr_kstate_counter *pfrc, int64_t n) +{ + + counter_u64_add(pfrc->pkc_pcpu, n); +} + struct pfr_ktstats { struct pfr_table pfrts_t; - counter_u64_t pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_t pfrkts_match; - counter_u64_t pfrkts_nomatch; + struct pfr_kstate_counter pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_match; + struct pfr_kstate_counter pfrkts_nomatch; long pfrkts_tzero; int pfrkts_cnt; int pfrkts_refcnt[PFR_REFCNT_MAX]; }; + +#endif /* _KERNEL */ + #define pfrts_name pfrts_t.pfrt_name #define pfrts_flags pfrts_t.pfrt_flags diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index f643790ff620..cd7d96eacd13 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1326,15 +1326,15 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { tbl->pfrts_packets[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_packets[pfr_dir][pfr_op]); tbl->pfrts_bytes[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_bytes[pfr_dir][pfr_op]); } } - tbl->pfrts_match = counter_u64_fetch(p->pfrkt_match); - tbl->pfrts_nomatch = counter_u64_fetch(p->pfrkt_nomatch); + tbl->pfrts_match = pfr_kstate_counter_fetch(&p->pfrkt_match); + tbl->pfrts_nomatch = pfr_kstate_counter_fetch(&p->pfrkt_nomatch); tbl->pfrts_tzero = p->pfrkt_tzero; tbl->pfrts_cnt = p->pfrkt_cnt; for (pfr_op = 0; pfr_op < PFR_REFCNT_MAX; pfr_op++) @@ -1870,12 +1870,12 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_zero(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_zero(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_zero(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_zero(kt->pfrkt_match); - counter_u64_zero(kt->pfrkt_nomatch); + pfr_kstate_counter_zero(&kt->pfrkt_match); + pfr_kstate_counter_zero(&kt->pfrkt_nomatch); kt->pfrkt_tzero = tzero; } @@ -1905,28 +1905,24 @@ pfr_create_ktable(struct pfr_table *tbl, long tzero, int attachruleset) for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - kt->pfrkt_packets[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_packets[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_packets[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_bytes[pfr_dir][pfr_op] = - counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_bytes[pfr_dir][pfr_op]) { + if (pfr_kstate_counter_init( + &kt->pfrkt_bytes[pfr_dir][pfr_op], M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } } } - kt->pfrkt_match = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_match) { + if (pfr_kstate_counter_init(&kt->pfrkt_match, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } - kt->pfrkt_nomatch = counter_u64_alloc(M_NOWAIT); - if (! kt->pfrkt_nomatch) { + if (pfr_kstate_counter_init(&kt->pfrkt_nomatch, M_NOWAIT) != 0) { pfr_destroy_ktable(kt, 0); return (NULL); } @@ -1977,12 +1973,12 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr) } for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { - counter_u64_free(kt->pfrkt_packets[pfr_dir][pfr_op]); - counter_u64_free(kt->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_deinit(&kt->pfrkt_bytes[pfr_dir][pfr_op]); } } - counter_u64_free(kt->pfrkt_match); - counter_u64_free(kt->pfrkt_nomatch); + pfr_kstate_counter_deinit(&kt->pfrkt_match); + pfr_kstate_counter_deinit(&kt->pfrkt_nomatch); free(kt, M_PFTABLE); } @@ -2052,9 +2048,9 @@ pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af) } match = (ke && !ke->pfrke_not); if (match) - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); else - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (match); } @@ -2109,8 +2105,8 @@ pfr_update_stats(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af, ("pfr_update_stats: assertion failed.\n")); op_pass = PFR_OP_XPASS; } - counter_u64_add(kt->pfrkt_packets[dir_out][op_pass], 1); - counter_u64_add(kt->pfrkt_bytes[dir_out][op_pass], len); + pfr_kstate_counter_add(&kt->pfrkt_packets[dir_out][op_pass], 1); + pfr_kstate_counter_add(&kt->pfrkt_bytes[dir_out][op_pass], len); if (ke != NULL && op_pass != PFR_OP_XPASS && (kt->pfrkt_flags & PFR_TFLAG_COUNTERS)) { counter_u64_add(pfr_kentry_counter(&ke->pfrke_counters, @@ -2206,7 +2202,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, _next_block: ke = pfr_kentry_byidx(kt, idx, af); if (ke == NULL) { - counter_u64_add(kt->pfrkt_nomatch, 1); + pfr_kstate_counter_add(&kt->pfrkt_nomatch, 1); return (1); } pfr_prepare_network(&umask, af, ke->pfrke_net); @@ -2231,7 +2227,7 @@ _next_block: /* this is a single IP address - no possible nested block */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } for (;;) { @@ -2251,7 +2247,7 @@ _next_block: /* lookup return the same block - perfect */ PF_ACPY(counter, addr, af); *pidx = idx; - counter_u64_add(kt->pfrkt_match, 1); + pfr_kstate_counter_add(&kt->pfrkt_match, 1); return (0); } From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:23:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 249CB658404; Mon, 5 Jul 2021 09:23: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 4GJKwp0P1Tz4hRX; Mon, 5 Jul 2021 09:23: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 EB084233F6; Mon, 5 Jul 2021 09:23: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 1659N5hu043950; Mon, 5 Jul 2021 09:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659N5XD043947; Mon, 5 Jul 2021 09:23:05 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:23:05 GMT Message-Id: <202107050923.1659N5XD043947@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: dc1ab04e4c9e - main - pf: allow table stats clearing and reading with ruleset rlock 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/main X-Git-Reftype: branch X-Git-Commit: dc1ab04e4c9ede3606985e0cce1200e3060ac166 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:23:06 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dc1ab04e4c9ede3606985e0cce1200e3060ac166 commit dc1ab04e4c9ede3606985e0cce1200e3060ac166 Author: Mateusz Guzik AuthorDate: 2021-07-02 12:55:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 08:42:01 +0000 pf: allow table stats clearing and reading with ruleset rlock Instead serialize against these operations with a dedicated lock. Prior to the change, When pushing 17 mln pps of traffic, calling DIOCRGETTSTATS in a loop would restrict throughput to about 7 mln. With the change there is no slowdown. Reviewed by: kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 7 +++++++ sys/netpfil/pf/pf.c | 4 ++++ sys/netpfil/pf/pf_ioctl.c | 18 ++++++++++++------ sys/netpfil/pf/pf_table.c | 2 ++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 515953c09f53..8ed998be0d78 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -131,10 +131,17 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) #define PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) #define PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define PF_RULES_WOWNED() rm_wowned(&pf_rules_lock) #define PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) +extern struct mtx pf_table_stats_lock; +#define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) +#define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) +#define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) +#define PF_TABLE_STATS_ASSERT() mtx_assert(&pf_rules_lock, MA_OWNED) + extern struct sx pf_end_lock; #define PF_MODVER 1 diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 39b032962e84..b05ea1c12285 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -211,6 +211,10 @@ struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); +struct mtx pf_table_stats_lock; +MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", + MTX_DEF); + VNET_DEFINE_STATIC(uma_zone_t, pf_sources_z); #define V_pf_sources_z VNET(pf_sources_z) uma_zone_t pf_mtag_z; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 9acfe56b7208..51781d488763 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3725,10 +3725,12 @@ DIOCCHANGEADDR_error: error = ENODEV; break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); if (n < 0) { - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); error = EINVAL; break; } @@ -3739,12 +3741,14 @@ DIOCCHANGEADDR_error: sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); if (pfrtstats == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); break; } error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); if (error == 0) error = copyout(pfrtstats, io->pfrio_buffer, totlen); free(pfrtstats, M_TEMP); @@ -3779,10 +3783,12 @@ DIOCCHANGEADDR_error: break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); free(pfrts, M_TEMP); break; } diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index cd7d96eacd13..5afc90e54d7c 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1864,6 +1864,8 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse) struct pfr_kentryworkq addrq; int pfr_dir, pfr_op; + MPASS(PF_TABLE_STATS_OWNED() || PF_RULES_WOWNED()); + if (recurse) { pfr_enqueue_addrs(kt, &addrq, NULL, 0); pfr_clstats_kentries(kt, &addrq, tzero, 0); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:39:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 48E48658537; Mon, 5 Jul 2021 09:39: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 4GJLJ31GY1z4jHJ; Mon, 5 Jul 2021 09:39: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 0FE0E237CA; Mon, 5 Jul 2021 09:39: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 1659dkr1057991; Mon, 5 Jul 2021 09:39:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659dkdh057990; Mon, 5 Jul 2021 09:39:46 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:39:46 GMT Message-Id: <202107050939.1659dkdh057990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 48687f733fdb - main - armv7: allwinner: Add aw_r_intc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48687f733fdbbe4b7085aa88a70194c39b44bd9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:39:47 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=48687f733fdbbe4b7085aa88a70194c39b44bd9b commit 48687f733fdbbe4b7085aa88a70194c39b44bd9b Author: Emmanuel Vadot AuthorDate: 2021-07-05 09:38:23 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-05 09:38:23 +0000 armv7: allwinner: Add aw_r_intc driver This is also needed after the 5.13 dts update. Sponsored by: Diablotin Systems Reported by: Mark Millard --- sys/arm/allwinner/files.allwinner | 1 + sys/arm/conf/GENERIC | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/arm/allwinner/files.allwinner b/sys/arm/allwinner/files.allwinner index 55519fc78026..57e27a962ec0 100644 --- a/sys/arm/allwinner/files.allwinner +++ b/sys/arm/allwinner/files.allwinner @@ -11,6 +11,7 @@ arm/allwinner/aw_machdep.c standard arm/allwinner/aw_mmc.c optional mmc | mmccam arm/allwinner/aw_mp.c optional smp arm/allwinner/aw_nmi.c standard +arm/allwinner/aw_r_intc.c optional aw_r_intc arm/allwinner/aw_rsb.c optional rsb | p2wi arm/allwinner/aw_rtc.c optional aw_rtc arm/allwinner/aw_syscon.c optional ext_resources syscon diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index dc6e2657779d..427f354d1f93 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -83,6 +83,7 @@ device cpufreq # Interrupt controller device gic +device aw_r_intc # PMU support (for CCNT). device pmu From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8E866658980; Mon, 5 Jul 2021 09:47:02 +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 4GJLSQ3cPFz4k5d; Mon, 5 Jul 2021 09:47: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 64BD223C02; Mon, 5 Jul 2021 09:47:02 +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 1659l2pc071430; Mon, 5 Jul 2021 09:47:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l2le071429; Mon, 5 Jul 2021 09:47:02 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:02 GMT Message-Id: <202107050947.1659l2le071429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: a259db87edfe - stable/13 - usr.sbin/pkg: Don't re-define roundup2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a259db87edfe054f51615d7bd08464c575027738 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:02 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=a259db87edfe054f51615d7bd08464c575027738 commit a259db87edfe054f51615d7bd08464c575027738 Author: Alex Richardson AuthorDate: 2021-01-28 17:25:50 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:11 +0000 usr.sbin/pkg: Don't re-define roundup2 The file already includes sys/param.h and should use that definition. I found this while testing D28332. Reviewed By: bapt Differential Revision: https://reviews.freebsd.org/D28331 (cherry picked from commit 9a0a48b12d3d85f0f00b99439e6a8779f5f1abb6) --- usr.sbin/pkg/config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 97983ea1f58a..08e206b93511 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include "config.h" -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ - struct config_value { char *value; STAILQ_ENTRY(config_value) next; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C268F65886D; Mon, 5 Jul 2021 09:47: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 4GJLSR4wYtz4kG1; Mon, 5 Jul 2021 09:47: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 7D0DE237F5; Mon, 5 Jul 2021 09:47: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 1659l3kA071460; Mon, 5 Jul 2021 09:47:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l3vr071459; Mon, 5 Jul 2021 09:47:03 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:03 GMT Message-Id: <202107050947.1659l3vr071459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 0a55a5bf6170 - stable/13 - if_vtnet: Fix pointer-sign and used parameter warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a55a5bf61707c87b3976eaf203ef4f988c4c396 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:03 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0a55a5bf61707c87b3976eaf203ef4f988c4c396 commit 0a55a5bf61707c87b3976eaf203ef4f988c4c396 Author: Alex Richardson AuthorDate: 2021-02-22 17:26:21 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:11 +0000 if_vtnet: Fix pointer-sign and used parameter warnings Reviewed By: grehan Differential Revision: https://reviews.freebsd.org/D28726 (cherry picked from commit c1b554c868195ed10ac1eb25fa9ca4a5baae4638) --- sys/dev/virtio/network/if_vtnet.c | 42 ++++++++++++++++++------------------ sys/dev/virtio/network/if_vtnetvar.h | 6 +++--- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 7aee77839bf3..3650d19fbe0e 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -113,7 +113,7 @@ static void vtnet_free_rx_filters(struct vtnet_softc *); static int vtnet_alloc_virtqueues(struct vtnet_softc *); static int vtnet_alloc_interface(struct vtnet_softc *); static int vtnet_setup_interface(struct vtnet_softc *); -static int vtnet_ioctl_mtu(struct vtnet_softc *, int); +static int vtnet_ioctl_mtu(struct vtnet_softc *, u_int); static int vtnet_ioctl_ifflags(struct vtnet_softc *); static int vtnet_ioctl_multi(struct vtnet_softc *); static int vtnet_ioctl_ifcap(struct vtnet_softc *, struct ifreq *); @@ -206,9 +206,9 @@ static void vtnet_exec_ctrl_cmd(struct vtnet_softc *, void *, static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); static int vtnet_ctrl_guest_offloads(struct vtnet_softc *, uint64_t); static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_t); -static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, int); -static int vtnet_set_promisc(struct vtnet_softc *, int); -static int vtnet_set_allmulti(struct vtnet_softc *, int); +static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, bool); +static int vtnet_set_promisc(struct vtnet_softc *, bool); +static int vtnet_set_allmulti(struct vtnet_softc *, bool); static void vtnet_rx_filter(struct vtnet_softc *); static void vtnet_rx_filter_mac(struct vtnet_softc *); static int vtnet_exec_vlan_filter(struct vtnet_softc *, int, uint16_t); @@ -373,7 +373,7 @@ MODULE_DEPEND(vtnet, netmap, 1, 1, 1); VIRTIO_SIMPLE_PNPINFO(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter"); static int -vtnet_modevent(module_t mod, int type, void *unused) +vtnet_modevent(module_t mod __unused, int type, void *unused __unused) { int error = 0; static int loaded = 0; @@ -1247,7 +1247,7 @@ vtnet_rx_cluster_size(struct vtnet_softc *sc, int mtu) } static int -vtnet_ioctl_mtu(struct vtnet_softc *sc, int mtu) +vtnet_ioctl_mtu(struct vtnet_softc *sc, u_int mtu) { struct ifnet *ifp; int clustersz; @@ -1808,7 +1808,7 @@ vtnet_rxq_csum_needs_csum(struct vtnet_rxq *rxq, struct mbuf *m, uint16_t etype, static int vtnet_rxq_csum_data_valid(struct vtnet_rxq *rxq, struct mbuf *m, - uint16_t etype, int hoff, struct virtio_net_hdr *hdr) + uint16_t etype, int hoff, struct virtio_net_hdr *hdr __unused) { struct vtnet_softc *sc; int protocol; @@ -1928,7 +1928,7 @@ vtnet_rxq_merged_eof(struct vtnet_rxq *rxq, struct mbuf *m_head, int nbufs) while (--nbufs > 0) { struct mbuf *m; - int len; + uint32_t len; m = virtqueue_dequeue(vq, &len); if (m == NULL) { @@ -2058,7 +2058,7 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) while (count-- > 0) { struct mbuf *m; - int len, nbufs, adjsz; + uint32_t len, nbufs, adjsz; m = virtqueue_dequeue(vq, &len); if (m == NULL) @@ -2158,7 +2158,7 @@ vtnet_rx_vq_process(struct vtnet_rxq *rxq, int tries) { struct vtnet_softc *sc; struct ifnet *ifp; - int more; + u_int more; #ifdef DEV_NETMAP int nmirq; #endif /* DEV_NETMAP */ @@ -2232,7 +2232,7 @@ vtnet_rx_vq_intr(void *xrxq) } static void -vtnet_rxq_tq_intr(void *xrxq, int pending) +vtnet_rxq_tq_intr(void *xrxq, int pending __unused) { struct vtnet_rxq *rxq; @@ -2749,7 +2749,7 @@ vtnet_txq_mq_start(struct ifnet *ifp, struct mbuf *m) } static void -vtnet_txq_tq_deferred(void *xtxq, int pending) +vtnet_txq_tq_deferred(void *xtxq, int pending __unused) { struct vtnet_softc *sc; struct vtnet_txq *txq; @@ -2784,7 +2784,7 @@ vtnet_txq_start(struct vtnet_txq *txq) } static void -vtnet_txq_tq_intr(void *xtxq, int pending) +vtnet_txq_tq_intr(void *xtxq, int pending __unused) { struct vtnet_softc *sc; struct vtnet_txq *txq; @@ -3619,7 +3619,7 @@ vtnet_ctrl_mq_cmd(struct vtnet_softc *sc, uint16_t npairs) } static int -vtnet_ctrl_rx_cmd(struct vtnet_softc *sc, uint8_t cmd, int on) +vtnet_ctrl_rx_cmd(struct vtnet_softc *sc, uint8_t cmd, bool on) { struct sglist_seg segs[3]; struct sglist sg; @@ -3637,7 +3637,7 @@ vtnet_ctrl_rx_cmd(struct vtnet_softc *sc, uint8_t cmd, int on) s.hdr.class = VIRTIO_NET_CTRL_RX; s.hdr.cmd = cmd; - s.onoff = !!on; + s.onoff = on; s.ack = VIRTIO_NET_ERR; sglist_init(&sg, nitems(segs), segs); @@ -3653,13 +3653,13 @@ vtnet_ctrl_rx_cmd(struct vtnet_softc *sc, uint8_t cmd, int on) } static int -vtnet_set_promisc(struct vtnet_softc *sc, int on) +vtnet_set_promisc(struct vtnet_softc *sc, bool on) { return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_PROMISC, on)); } static int -vtnet_set_allmulti(struct vtnet_softc *sc, int on) +vtnet_set_allmulti(struct vtnet_softc *sc, bool on) { return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_ALLMULTI, on)); } @@ -3781,9 +3781,9 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) if_printf(ifp, "error setting host MAC filter table\n"); out: - if (promisc != 0 && vtnet_set_promisc(sc, 1) != 0) + if (promisc != 0 && vtnet_set_promisc(sc, true) != 0) if_printf(ifp, "cannot enable promiscuous mode\n"); - if (allmulti != 0 && vtnet_set_allmulti(sc, 1) != 0) + if (allmulti != 0 && vtnet_set_allmulti(sc, true) != 0) if_printf(ifp, "cannot enable all-multicast mode\n"); } @@ -3912,7 +3912,7 @@ vtnet_update_speed_duplex(struct vtnet_softc *sc) /* BMV: Ignore duplex. */ speed = virtio_read_dev_config_4(sc->vtnet_dev, offsetof(struct virtio_net_config, speed)); - if (speed != -1) + if (speed != UINT32_MAX) ifp->if_baudrate = IF_Mbps(speed); } @@ -3952,7 +3952,7 @@ vtnet_update_link_status(struct vtnet_softc *sc) } static int -vtnet_ifmedia_upd(struct ifnet *ifp) +vtnet_ifmedia_upd(struct ifnet *ifp __unused) { return (EOPNOTSUPP); } diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index d26f7240a67a..55e8a7267499 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -161,7 +161,7 @@ struct vtnet_softc { #define VTNET_FLAG_FIXUP_NEEDS_CSUM 0x2000 #define VTNET_FLAG_SW_LRO 0x4000 - int vtnet_hdr_size; + u_int vtnet_hdr_size; int vtnet_rx_nmbufs; int vtnet_rx_clustersz; int vtnet_rx_nsegs; @@ -172,7 +172,7 @@ struct vtnet_softc { int vtnet_max_vq_pairs; int vtnet_tx_nsegs; int vtnet_if_flags; - int vtnet_max_mtu; + u_int vtnet_max_mtu; int vtnet_lro_entry_count; int vtnet_lro_mbufq_depth; @@ -189,7 +189,7 @@ struct vtnet_softc { struct mtx vtnet_mtx; char vtnet_mtx_name[16]; - char vtnet_hwaddr[ETHER_ADDR_LEN]; + uint8_t vtnet_hwaddr[ETHER_ADDR_LEN]; }; static bool From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2506A658636; Mon, 5 Jul 2021 09:47: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 4GJLSS734gz4k3W; Mon, 5 Jul 2021 09:47: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 C7554238D2; Mon, 5 Jul 2021 09:47: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 1659l4CC071485; Mon, 5 Jul 2021 09:47:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l4H9071484; Mon, 5 Jul 2021 09:47:04 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:04 GMT Message-Id: <202107050947.1659l4H9071484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: ae0219c10fe3 - stable/13 - fwohci: Cast bitfield to uint32_t before passing it to roundup2(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ae0219c10fe3a2ea9caa7bc88ddc7d0a7e988efd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:05 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ae0219c10fe3a2ea9caa7bc88ddc7d0a7e988efd commit ae0219c10fe3a2ea9caa7bc88ddc7d0a7e988efd Author: John Baldwin AuthorDate: 2021-02-17 21:12:06 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:11 +0000 fwohci: Cast bitfield to uint32_t before passing it to roundup2(). The fallback for __align_up() used by roundup2() uses __typeof__() which doesn't work for bitfields. This fixes the build on GCC which uses the fallback. Reviewed by: arichardson, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D28599 (cherry picked from commit 50a61f8db532676d7dc37410540fff7209b7c072) --- sys/dev/firewire/fwohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 30eca83900e7..634c78e6afe8 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -2696,7 +2696,7 @@ fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt info = &tinfo[fp->mode.common.tcode]; r = info->hdr_len + sizeof(uint32_t); if ((info->flag & FWTI_BLOCK_ASY) != 0) - r += roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); + r += roundup2((uint32_t)fp->mode.wreqb.len, sizeof(uint32_t)); if (r == sizeof(uint32_t)) { /* XXX */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 49C82658879; Mon, 5 Jul 2021 09:47: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 4GJLSW0ZVmz4k5w; Mon, 5 Jul 2021 09:47: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 E3A6323C03; Mon, 5 Jul 2021 09:47: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 1659l6P9071533; Mon, 5 Jul 2021 09:47:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l6Zl071532; Mon, 5 Jul 2021 09:47:06 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:06 GMT Message-Id: <202107050947.1659l6Zl071532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: c89f104c12e1 - stable/13 - vis(3): avoid out-of-bounds stack buffer reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c89f104c12e196a86dac2aa6d9119ebb8e4aabe4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:07 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c89f104c12e196a86dac2aa6d9119ebb8e4aabe4 commit c89f104c12e196a86dac2aa6d9119ebb8e4aabe4 Author: Alex Richardson AuthorDate: 2021-06-16 15:27:13 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:11 +0000 vis(3): avoid out-of-bounds stack buffer reads I found this while running kdump(1) on a CheriBSD system due to a capability length violation when printing the /etc/libmap.conf read() system call: it crashed immediately after printing the first line. Found by: CHERI Reviewed By: jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30771 (cherry picked from commit 1a2f06d0f2905c9a18340b377cbbe772f2ca6844) --- contrib/libc-vis/vis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/libc-vis/vis.c b/contrib/libc-vis/vis.c index 21c07b70619d..c43186a44b51 100644 --- a/contrib/libc-vis/vis.c +++ b/contrib/libc-vis/vis.c @@ -465,7 +465,8 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength, while (mbslength > 0) { /* Convert one multibyte character to wchar_t. */ if (!cerr) - clen = mbrtowc(src, mbsrc, MB_LEN_MAX, &mbstate); + clen = mbrtowc(src, mbsrc, MIN(mbslength, MB_LEN_MAX), + &mbstate); if (cerr || clen < 0) { /* Conversion error, process as a byte instead. */ *src = (wint_t)(u_char)*mbsrc; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F06B36585AF; Mon, 5 Jul 2021 09:47: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 4GJLST676rz4k9M; Mon, 5 Jul 2021 09:47: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 B9E0D23BEE; Mon, 5 Jul 2021 09:47: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 1659l5af071509; Mon, 5 Jul 2021 09:47:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l59a071508; Mon, 5 Jul 2021 09:47:05 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:05 GMT Message-Id: <202107050947.1659l59a071508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: f42db652c3d2 - stable/13 - Expose clang's alignment builtins and use them for roundup2/rounddown2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f42db652c3d2e55ce4bf9d2af4bb20e533f0ab83 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:06 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=f42db652c3d2e55ce4bf9d2af4bb20e533f0ab83 commit f42db652c3d2e55ce4bf9d2af4bb20e533f0ab83 Author: Alex Richardson AuthorDate: 2021-02-03 15:27:17 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:11 +0000 Expose clang's alignment builtins and use them for roundup2/rounddown2 This makes roundup2/rounddown2 type- and const-preserving and allows using it on pointer types without casting to uintptr_t first. Not performing pointer-to-integer conversions also helps the compiler's optimization passes and can therefore result in better code generation. When using it with integer values there should be no change other than the compiler checking that the alignment value is a valid power-of-two. I originally implemented these builtins for CHERI a few years ago and they have been very useful for CheriBSD. However, they are also useful for non-CHERI code so I was able to upstream them for Clang 10.0. Rationale from the clang documentation: Clang provides builtins to support checking and adjusting alignment of pointers and integers. These builtins can be used to avoid relying on implementation-defined behavior of arithmetic on integers derived from pointers. Additionally, these builtins retain type information and, unlike bitwise arithmetic, they can perform semantic checking on the alignment value. There is also a feature request for GCC, so GCC may also support it in the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641 Reviewed By: brooks, jhb, imp Differential Revision: https://reviews.freebsd.org/D28332 (cherry picked from commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4) --- sys/sys/cdefs.h | 19 +++++++++++++++++++ sys/sys/param.h | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 3acb165dad05..ff461db9ec2e 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -879,4 +879,23 @@ #define __guarded_by(x) __lock_annotate(guarded_by(x)) #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) +/* Alignment builtins for better type checking and improved code generation. */ +/* Provide fallback versions for other compilers (GCC/Clang < 10): */ +#if !__has_builtin(__builtin_is_aligned) +#define __builtin_is_aligned(x, align) \ + (((__uintptr_t)x & ((align) - 1)) == 0) +#endif +#if !__has_builtin(__builtin_align_up) +#define __builtin_align_up(x, align) \ + ((__typeof__(x))(((__uintptr_t)(x)+((align)-1))&(~((align)-1)))) +#endif +#if !__has_builtin(__builtin_align_down) +#define __builtin_align_down(x, align) \ + ((__typeof__(x))((x)&(~((align)-1)))) +#endif + +#define __align_up(x, y) __builtin_align_up(x, y) +#define __align_down(x, y) __builtin_align_down(x, y) +#define __is_aligned(x, y) __builtin_is_aligned(x, y) + #endif /* !_SYS_CDEFS_H_ */ diff --git a/sys/sys/param.h b/sys/sys/param.h index 6e75123fca77..41db9a1675f7 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -305,9 +305,9 @@ #endif #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #define rounddown(x, y) (((x)/(y))*(y)) -#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ +#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ +#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ #define powerof2(x) ((((x)-1)&(x))==0) /* Macros for min/max. */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A632165898E; Mon, 5 Jul 2021 09:47: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 4GJLSX2FSzz4kGC; Mon, 5 Jul 2021 09:47: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 0D597237F6; Mon, 5 Jul 2021 09:47: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 1659l74b071557; Mon, 5 Jul 2021 09:47:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l7v1071556; Mon, 5 Jul 2021 09:47:07 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:07 GMT Message-Id: <202107050947.1659l7v1071556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 5694f4af7916 - stable/13 - kdump: use VIS_NOLOCALE when printing output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5694f4af7916110bc2f71bb150ecad863a46379d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:08 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=5694f4af7916110bc2f71bb150ecad863a46379d commit 5694f4af7916110bc2f71bb150ecad863a46379d Author: Alex Richardson AuthorDate: 2021-06-16 15:28:27 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:11 +0000 kdump: use VIS_NOLOCALE when printing output Attempting to parse the output as UTF-8 exposed an out-of-bounds read in vis(3) (see https://reviews.freebsd.org/D30771). However, I don't think it makes much sense to decode this output at all. Additionally, passing one byte at a time will almost certainly result in incorrect output for multi-byte characters. Reviewed By: brooks MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30772 (cherry picked from commit 1a3a57d74590bb44e96629aec35897b475bd69fa) --- usr.bin/kdump/kdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 05988f43133e..d863fffea774 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1638,7 +1638,7 @@ visdump(char *dp, int datalen, int screenwidth) printf(" \""); col = 8; for (;datalen > 0; datalen--, dp++) { - vis(visbuf, *dp, VIS_CSTYLE, *(dp+1)); + vis(visbuf, *dp, VIS_CSTYLE | VIS_NOLOCALE, *(dp+1)); cp = visbuf; /* * Keep track of printables and From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 82F46658951; Mon, 5 Jul 2021 09:47: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 4GJLSY2r4xz4k7h; Mon, 5 Jul 2021 09:47: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 31814238D3; Mon, 5 Jul 2021 09:47: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 1659l9Rc071583; Mon, 5 Jul 2021 09:47:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659l9hY071582; Mon, 5 Jul 2021 09:47:09 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:09 GMT Message-Id: <202107050947.1659l9hY071582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: ed1563aba95b - stable/13 - truss: fix handling of 64-bit arguments/return values for compat32 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed1563aba95bd76cd316067dee2f5e6ab4f25561 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:09 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ed1563aba95bd76cd316067dee2f5e6ab4f25561 commit ed1563aba95bd76cd316067dee2f5e6ab4f25561 Author: Alex Richardson AuthorDate: 2021-06-16 15:29:57 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:12 +0000 truss: fix handling of 64-bit arguments/return values for compat32 Deciding whether to combine two values to a 64-bit one should be based on the process ABI, and not dependent on whether truss is compiled for an LP64 ABI. This is a follow-up cleanup for D27625. I found this while looking for uses of the `__LP64__` macro (since using this is wrong for CHERI systems). Test Plan: truss still works. Since I tested on AMD64 and all syscalls in the trace have their quad argument last there was no difference in the output. Should fix output for compat32 on MIPS64 though. Reviewed By: jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D27637 (cherry picked from commit 8ba2e89e987c7ae171c5f099e59d599294d626b7) --- usr.bin/truss/syscalls.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index a8eed9eed355..b8022a3a395b 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -1908,32 +1908,29 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval, fputs(" ]", fp); break; } -#ifdef __LP64__ - case Quad: - fprintf(fp, "%ld", args[sc->offset]); - break; - case QuadHex: - fprintf(fp, "0x%lx", args[sc->offset]); - break; -#else case Quad: case QuadHex: { - unsigned long long ll; + uint64_t value; + size_t pointer_size = + trussinfo->curthread->proc->abi->pointer_size; + if (pointer_size == 4) { #if _BYTE_ORDER == _LITTLE_ENDIAN - ll = (unsigned long long)args[sc->offset + 1] << 32 | - args[sc->offset]; + value = (uint64_t)args[sc->offset + 1] << 32 | + args[sc->offset]; #else - ll = (unsigned long long)args[sc->offset] << 32 | - args[sc->offset + 1]; + value = (uint64_t)args[sc->offset] << 32 | + args[sc->offset + 1]; #endif + } else { + value = (uint64_t)args[sc->offset]; + } if ((sc->type & ARG_MASK) == Quad) - fprintf(fp, "%lld", ll); + fprintf(fp, "%jd", (intmax_t)value); else - fprintf(fp, "0x%llx", ll); + fprintf(fp, "0x%jx", (intmax_t)value); break; } -#endif case PQuadHex: { uint64_t val; @@ -3015,11 +3012,9 @@ print_syscall_ret(struct trussinfo *trussinfo, int error, register_t *retval) fprintf(trussinfo->outfile, " ERR#%d '%s'\n", sysdecode_freebsd_to_abi_errno(t->proc->abi->abi, error), strerror(error)); - } -#ifndef __LP64__ - else if (sc->decode.ret_type == 2) { + } else if (sc->decode.ret_type == 2 && + t->proc->abi->pointer_size == 4) { off_t off; - #if _BYTE_ORDER == _LITTLE_ENDIAN off = (off_t)retval[1] << 32 | retval[0]; #else @@ -3027,11 +3022,10 @@ print_syscall_ret(struct trussinfo *trussinfo, int error, register_t *retval) #endif fprintf(trussinfo->outfile, " = %jd (0x%jx)\n", (intmax_t)off, (intmax_t)off); - } -#endif - else + } else { fprintf(trussinfo->outfile, " = %jd (0x%jx)\n", (intmax_t)retval[0], (intmax_t)retval[0]); + } } void From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 888FD658992; Mon, 5 Jul 2021 09:47:10 +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 4GJLSZ38djz4kRt; Mon, 5 Jul 2021 09:47:10 +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 4D8CA23A15; Mon, 5 Jul 2021 09:47:10 +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 1659lAhb071611; Mon, 5 Jul 2021 09:47:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659lAvS071610; Mon, 5 Jul 2021 09:47:10 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:10 GMT Message-Id: <202107050947.1659lAvS071610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 6e2b0498aa70 - stable/13 - truss: minor cleanup and pedantic warning fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6e2b0498aa702bace3859273c36bd27d7dff85c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:10 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6e2b0498aa702bace3859273c36bd27d7dff85c3 commit 6e2b0498aa702bace3859273c36bd27d7dff85c3 Author: Alex Richardson AuthorDate: 2021-06-16 15:35:55 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:12 +0000 truss: minor cleanup and pedantic warning fixes Noticed while porting the recent truss compat32 changes to CheriBSD. This also fixes i386 tracing by zero-extending user addresses instead of sign-extending them. Reviewed By: jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30211 (cherry picked from commit 31dddc6a19042bad303cb3d3aa8f52a2cb22dd77) --- usr.bin/truss/main.c | 5 ++-- usr.bin/truss/syscalls.c | 69 ++++++++++++++++++++++++++++-------------------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 1a3aae75be88..942f98008071 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" #include "syscall.h" -static void +static __dead2 void usage(void) { fprintf(stderr, "%s\n%s\n", @@ -118,7 +118,8 @@ main(int ac, char **av) fname = optarg; break; case 's': /* Specified string size */ - trussinfo->strsize = strtonum(optarg, 0, INT_MAX, &errstr); + trussinfo->strsize = (int)strtonum(optarg, 0, INT_MAX, + &errstr); if (errstr) errx(1, "maximum string size is %s: %s", errstr, optarg); break; diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index b8022a3a395b..6740ab21ff2c 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -863,18 +864,17 @@ lookup(struct xlat *xlat, int val, int base) if (xlat->val == val) return (xlat->str); switch (base) { - case 8: - sprintf(tmp, "0%o", val); - break; - case 16: - sprintf(tmp, "0x%x", val); - break; - case 10: - sprintf(tmp, "%u", val); - break; - default: - errx(1,"Unknown lookup base"); - break; + case 8: + sprintf(tmp, "0%o", val); + break; + case 16: + sprintf(tmp, "0x%x", val); + break; + case 10: + sprintf(tmp, "%u", val); + break; + default: + errx(1, "Unknown lookup base"); } return (tmp); } @@ -1116,12 +1116,12 @@ get_syscall(struct threadinfo *t, u_int number, u_int nargs) * Copy a fixed amount of bytes from the process. */ static int -get_struct(pid_t pid, uintptr_t offset, void *buf, int len) +get_struct(pid_t pid, psaddr_t offset, void *buf, size_t len) { struct ptrace_io_desc iorequest; iorequest.piod_op = PIOD_READ_D; - iorequest.piod_offs = (void *)offset; + iorequest.piod_offs = (void *)(uintptr_t)offset; iorequest.piod_addr = buf; iorequest.piod_len = len; if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) @@ -1137,7 +1137,7 @@ get_struct(pid_t pid, uintptr_t offset, void *buf, int len) * only get that much. */ static char * -get_string(pid_t pid, uintptr_t addr, int max) +get_string(pid_t pid, psaddr_t addr, int max) { struct ptrace_io_desc iorequest; char *buf, *nbuf; @@ -1148,7 +1148,7 @@ get_string(pid_t pid, uintptr_t addr, int max) size = max + 1; else { /* Read up to the end of the current page. */ - size = PAGE_SIZE - ((uintptr_t)addr % PAGE_SIZE); + size = PAGE_SIZE - (addr % PAGE_SIZE); if (size > MAXSIZE) size = MAXSIZE; } @@ -1158,7 +1158,7 @@ get_string(pid_t pid, uintptr_t addr, int max) return (NULL); for (;;) { iorequest.piod_op = PIOD_READ_D; - iorequest.piod_offs = (void *)(addr + offset); + iorequest.piod_offs = (void *)((uintptr_t)addr + offset); iorequest.piod_addr = buf + offset; iorequest.piod_len = size; if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) { @@ -1718,6 +1718,20 @@ print_sysctl(FILE *fp, int *oid, size_t len) fprintf(fp, "%s", name); } +/* + * Convert a 32-bit user-space pointer to psaddr_t. Currently, this + * sign-extends on MIPS and zero-extends on all other architectures. + */ +static psaddr_t +user_ptr32_to_psaddr(int32_t user_pointer) +{ +#if defined(__mips__) + return ((psaddr_t)(intptr_t)user_pointer); +#else + return ((psaddr_t)(uintptr_t)user_pointer); +#endif +} + /* * Converts a syscall argument into a string. Said string is * allocated via malloc(), so needs to be free()'d. sc is @@ -1769,7 +1783,7 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval, break; case ShmName: /* Handle special SHM_ANON value. */ - if ((char *)args[sc->offset] == SHM_ANON) { + if ((char *)(uintptr_t)args[sc->offset] == SHM_ANON) { fprintf(fp, "SHM_ANON"); break; } @@ -1829,7 +1843,7 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval, case ExecArgs: case ExecEnv: case StringArray: { - uintptr_t addr; + psaddr_t addr; union { int32_t strarray32[PAGE_SIZE / sizeof(int32_t)]; int64_t strarray64[PAGE_SIZE / sizeof(int64_t)]; @@ -1859,7 +1873,7 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval, * a partial page. */ addr = args[sc->offset]; - if (addr % pointer_size != 0) { + if (!__is_aligned(addr, pointer_size)) { print_pointer(fp, args[sc->offset]); break; } @@ -1875,20 +1889,19 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval, first = 1; i = 0; for (;;) { - uintptr_t straddr; + psaddr_t straddr; if (pointer_size == 4) { - if (u.strarray32[i] == 0) - break; - /* sign-extend 32-bit pointers */ - straddr = (intptr_t)u.strarray32[i]; + straddr = user_ptr32_to_psaddr(u.strarray32[i]); } else if (pointer_size == 8) { - if (u.strarray64[i] == 0) - break; - straddr = (intptr_t)u.strarray64[i]; + straddr = (psaddr_t)u.strarray64[i]; } else { errx(1, "Unsupported pointer size: %zu", pointer_size); } + + /* Stop once we read the first NULL pointer. */ + if (straddr == 0) + break; string = get_string(pid, straddr, 0); fprintf(fp, "%s \"%s\"", first ? "" : ",", string); free(string); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:47:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D4194658955; Mon, 5 Jul 2021 09:47:11 +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 4GJLSb4NFrz4kGN; Mon, 5 Jul 2021 09:47: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 62C0F23BEF; Mon, 5 Jul 2021 09:47:11 +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 1659lBW9071635; Mon, 5 Jul 2021 09:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659lBaj071634; Mon, 5 Jul 2021 09:47:11 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:47:11 GMT Message-Id: <202107050947.1659lBaj071634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 58137266b6ea - stable/13 - rtld-elf: Check the return value of obj_enforce_relro() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 58137266b6eab0a117878cb40f58bd693ea2396d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:47:12 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=58137266b6eab0a117878cb40f58bd693ea2396d commit 58137266b6eab0a117878cb40f58bd693ea2396d Author: Alex Richardson AuthorDate: 2021-06-22 08:09:44 +0000 Commit: Alex Richardson CommitDate: 2021-07-05 09:46:12 +0000 rtld-elf: Check the return value of obj_enforce_relro() The mprotect() call was failing on CheriBSD when changing rtld's relro page permissions due to missing CHERI capability permissions on the mprotect() argument but did not report an error since the return value was being ignored. It should never fail on any supported FreeBSD architecture, but checking the return value seems like a good sanity check to me. Reviewed By: kib, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30820 (cherry picked from commit e3be51b2bc7cb41eb9a238cced2ee650d9bb2d41) --- 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 34c42969c779..42abd8391386 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2280,7 +2280,8 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) obj_rtld.path = xstrdup(ld_path_rtld); parse_rtld_phdr(&obj_rtld); - obj_enforce_relro(&obj_rtld); + if (obj_enforce_relro(&obj_rtld) == -1) + rtld_die(); r_debug.r_version = R_DEBUG_VERSION; r_debug.r_brk = r_debug_state; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 09:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9F466658DBB; Mon, 5 Jul 2021 09:57: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 4GJLhx3FXnz4lNT; Mon, 5 Jul 2021 09:57: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 4DF5023EF6; Mon, 5 Jul 2021 09:57: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 1659vrfN084913; Mon, 5 Jul 2021 09:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1659vrDh084912; Mon, 5 Jul 2021 09:57:53 GMT (envelope-from git) Date: Mon, 5 Jul 2021 09:57:53 GMT Message-Id: <202107050957.1659vrDh084912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f649cff58721 - main - pf: padalign global locks found in pf.c 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/main X-Git-Reftype: branch X-Git-Commit: f649cff58721f493f218a4d1fb88a12255945472 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 09:57:53 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f649cff58721f493f218a4d1fb88a12255945472 commit f649cff58721f493f218a4d1fb88a12255945472 Author: Mateusz Guzik AuthorDate: 2021-07-05 09:26:29 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 09:56:54 +0000 pf: padalign global locks found in pf.c Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 8ed998be0d78..1840c23bc937 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -121,7 +121,7 @@ struct pfi_dynaddr { #define PF_STATE_LOCK_ASSERT(s) do {} while (0) #endif /* INVARIANTS */ -extern struct mtx pf_unlnkdrules_mtx; +extern struct mtx_padalign pf_unlnkdrules_mtx; #define PF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #define PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) @@ -136,7 +136,7 @@ extern struct rmlock pf_rules_lock; #define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) -extern struct mtx pf_table_stats_lock; +extern struct mtx_padalign pf_table_stats_lock; #define PF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) #define PF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) #define PF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index b05ea1c12285..ed273e6e0b6a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -178,7 +178,7 @@ STAILQ_HEAD(pf_send_head, pf_send_entry); VNET_DEFINE_STATIC(struct pf_send_head, pf_sendqueue); #define V_pf_sendqueue VNET(pf_sendqueue) -static struct mtx pf_sendqueue_mtx; +static struct mtx_padalign pf_sendqueue_mtx; MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF); #define PF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) #define PF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) @@ -200,18 +200,18 @@ VNET_DEFINE_STATIC(struct pf_overload_head, pf_overloadqueue); VNET_DEFINE_STATIC(struct task, pf_overloadtask); #define V_pf_overloadtask VNET(pf_overloadtask) -static struct mtx pf_overloadqueue_mtx; +static struct mtx_padalign pf_overloadqueue_mtx; MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, "pf overload/flush queue", MTX_DEF); #define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); -struct mtx pf_unlnkdrules_mtx; +struct mtx_padalign pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); -struct mtx pf_table_stats_lock; +struct mtx_padalign pf_table_stats_lock; MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", MTX_DEF); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AE4FB65AD28; Mon, 5 Jul 2021 11:33: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 4GJNqb4c5kz4sHH; Mon, 5 Jul 2021 11:33: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 866FC25167; Mon, 5 Jul 2021 11:33: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 165BXljU017953; Mon, 5 Jul 2021 11:33:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXlNf017952; Mon, 5 Jul 2021 11:33:47 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:47 GMT Message-Id: <202107051133.165BXlNf017952@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: 3ec1b75a0ddd - stable/13 - pf: add pf_release_staten and use it in pf_unlink_state 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: 3ec1b75a0ddd043abc0bf726127e84318de41699 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:47 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3ec1b75a0ddd043abc0bf726127e84318de41699 commit 3ec1b75a0ddd043abc0bf726127e84318de41699 Author: Mateusz Guzik AuthorDate: 2021-06-28 12:18:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:10 +0000 pf: add pf_release_staten and use it in pf_unlink_state Saves one atomic op. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit d09388d013300fc4aa1ee1a6bc24260cd400aff3) --- sys/net/pfvar.h | 11 +++++++++++ sys/netpfil/pf/pf.c | 7 ++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0d23607a168a..9e6dad5ca2ac 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1507,6 +1507,17 @@ pf_release_state(struct pf_state *s) return (0); } +static __inline int +pf_release_staten(struct pf_state *s, u_int n) +{ + + if (refcount_releasen(&s->refs, n)) { + pf_free_state(s); + return (1); + } else + return (0); +} + 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 *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 1b8181b7e1cf..8e0c51238f32 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1732,11 +1732,8 @@ pf_unlink_state(struct pf_state *s, u_int flags) PF_HASHROW_UNLOCK(ih); pf_detach_state(s); - /* pf_state_insert() initialises refs to 2, so we can never release the - * last reference here, only in pf_release_state(). */ - (void)refcount_release(&s->refs); - - return (pf_release_state(s)); + /* pf_state_insert() initialises refs to 2 */ + return (pf_release_staten(s, 2)); } void From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5AD1665AA99; Mon, 5 Jul 2021 11:33: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 4GJNqc5lHNz4sVs; Mon, 5 Jul 2021 11:33:48 +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 ABD1F25258; Mon, 5 Jul 2021 11:33: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 165BXmrx017983; Mon, 5 Jul 2021 11:33:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXmla017982; Mon, 5 Jul 2021 11:33:48 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:48 GMT Message-Id: <202107051133.165BXmla017982@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: 0e3ee7e3a674 - stable/13 - pf: factor out state allocation into pf_alloc_state 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: 0e3ee7e3a6744e30f78ed2756f0060367f340179 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:49 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0e3ee7e3a6744e30f78ed2756f0060367f340179 commit 0e3ee7e3a6744e30f78ed2756f0060367f340179 Author: Mateusz Guzik AuthorDate: 2021-06-28 12:22:31 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:10 +0000 pf: factor out state allocation into pf_alloc_state Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit ccb17a21041e9206b80fa9f64b6ec20233df6403) --- sys/netpfil/pf/pf.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8e0c51238f32..53489f5f0113 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1736,6 +1736,28 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } +static struct pf_state * +pf_alloc_state(int flags) +{ + struct pf_state *s; + + s = uma_zalloc(V_pf_state_z, flags | M_ZERO); + if (__predict_false(s == NULL)) + return (NULL); + + for (int i = 0; i < 2; i++) { + s->bytes[i] = counter_u64_alloc(M_NOWAIT); + s->packets[i] = counter_u64_alloc(M_NOWAIT); + + if (s->bytes[i] == NULL || s->packets[i] == NULL) { + pf_free_state(s); + return (NULL); + } + } + + return (s); +} + void pf_free_state(struct pf_state *cur) { @@ -3730,21 +3752,11 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, REASON_SET(&reason, PFRES_SRCLIMIT); goto csfailed; } - s = uma_zalloc(V_pf_state_z, M_NOWAIT | M_ZERO); + s = pf_alloc_state(M_NOWAIT); if (s == NULL) { REASON_SET(&reason, PFRES_MEMORY); goto csfailed; } - for (int i = 0; i < 2; i++) { - s->bytes[i] = counter_u64_alloc(M_NOWAIT); - s->packets[i] = counter_u64_alloc(M_NOWAIT); - - if (s->bytes[i] == NULL || s->packets[i] == NULL) { - pf_free_state(s); - REASON_SET(&reason, PFRES_MEMORY); - goto csfailed; - } - } s->rule.ptr = r; s->nat_rule.ptr = nr; s->anchor.ptr = a; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 47E9165ABC1; Mon, 5 Jul 2021 11:33: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 4GJNqd6lsTz4sQW; Mon, 5 Jul 2021 11:33: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 CBCAD25168; Mon, 5 Jul 2021 11:33: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 165BXnRF018008; Mon, 5 Jul 2021 11:33:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXnnK018007; Mon, 5 Jul 2021 11:33:49 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:49 GMT Message-Id: <202107051133.165BXnnK018007@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: f75b6fce91b1 - stable/13 - pf: assert that sizeof(struct pf_state) <= 312 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: f75b6fce91b12df3494a13075a809a1386bfd9db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:50 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f75b6fce91b12df3494a13075a809a1386bfd9db commit f75b6fce91b12df3494a13075a809a1386bfd9db Author: Mateusz Guzik AuthorDate: 2021-06-28 12:49:40 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:11 +0000 pf: assert that sizeof(struct pf_state) <= 312 To prevent accidentally going over a threshold which makes UMA fit only 12 objects per page instead of 13. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit e6dd0e2e8d4f59275fb576a9ccb9d356d36457bb) --- sys/net/pfvar.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 9e6dad5ca2ac..e0eb4e55a46f 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -548,6 +548,11 @@ struct pf_state { u_int8_t sync_updates; u_int8_t _tail[3]; }; + +/* + * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. + */ +_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); #endif /* From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3749965AA9B; Mon, 5 Jul 2021 11:33: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 4GJNqg0mVkz4sb0; Mon, 5 Jul 2021 11:33: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 F2453253AA; Mon, 5 Jul 2021 11:33: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 165BXob8018032; Mon, 5 Jul 2021 11:33:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXoBc018031; Mon, 5 Jul 2021 11:33:50 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:50 GMT Message-Id: <202107051133.165BXoBc018031@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: 3fbf56f319f5 - stable/13 - pf: fix error-case leaks in pf_create_state 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: 3fbf56f319f5cf01a6ed0a904499e996d7660f5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:51 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3fbf56f319f5cf01a6ed0a904499e996d7660f5d commit 3fbf56f319f5cf01a6ed0a904499e996d7660f5d Author: Mateusz Guzik AuthorDate: 2021-06-28 18:29:58 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:11 +0000 pf: fix error-case leaks in pf_create_state The hand-rolled clean up failed to free counters. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 7f025db57c7879bfa43ac74ecd95903439fdd1d0) --- sys/netpfil/pf/pf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 53489f5f0113..3afb54dbab17 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3827,7 +3827,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, REASON_SET(&reason, PFRES_MAPFAILED); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); goto csfailed; } s->rt_kif = r->rpool.cur->kif; @@ -3849,7 +3849,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, REASON_SET(&reason, PFRES_MEMORY); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); return (PF_DROP); } if ((pd->flags & PFDESC_TCP_NORM) && s->src.scrub && @@ -3859,10 +3859,9 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, DPFPRINTF(PF_DEBUG_URGENT, ("pf_normalize_tcp_stateful failed on first " "pkt\n")); - pf_normalize_tcp_cleanup(s); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); return (PF_DROP); } } @@ -3886,12 +3885,10 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, if (pf_state_insert(BOUND_IFACE(r, kif), kif, (pd->dir == PF_IN) ? sk : nk, (pd->dir == PF_IN) ? nk : sk, s)) { - if (pd->proto == IPPROTO_TCP) - pf_normalize_tcp_cleanup(s); REASON_SET(&reason, PFRES_STATEINS); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); return (PF_DROP); } else *sm = s; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC0D065A9A6; Mon, 5 Jul 2021 11:33: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 4GJNqh3m7Rz4sYP; Mon, 5 Jul 2021 11:33: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 2135A2525A; Mon, 5 Jul 2021 11:33: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 165BXqe9018056; Mon, 5 Jul 2021 11:33:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXq7X018055; Mon, 5 Jul 2021 11:33:52 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:52 GMT Message-Id: <202107051133.165BXq7X018055@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: 0e69786dae2b - stable/13 - pf: deduplicate V_pf_state_z handling with pfsync 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: 0e69786dae2bce1496cb3017f679e1e3385a3d0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:53 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0e69786dae2bce1496cb3017f679e1e3385a3d0a commit 0e69786dae2bce1496cb3017f679e1e3385a3d0a Author: Mateusz Guzik AuthorDate: 2021-06-28 18:18:26 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:12 +0000 pf: deduplicate V_pf_state_z handling with pfsync Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 803dfe3da0e30520227a791ba5c2b93da16e1cf5) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/if_pfsync.c | 20 +++----------------- sys/netpfil/pf/pf.c | 2 +- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e0eb4e55a46f..12ac791e3c72 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1492,6 +1492,7 @@ extern int pf_state_insert(struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, struct pf_state *); +extern struct pf_state *pf_alloc_state(int); extern void pf_free_state(struct pf_state *); static __inline void diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 3514c922c361..16878fe87750 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -504,16 +504,10 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) /* * XXXGL: consider M_WAITOK in ioctl path after. */ - if ((st = uma_zalloc(V_pf_state_z, M_NOWAIT | M_ZERO)) == NULL) + st = pf_alloc_state(M_NOWAIT); + if (__predict_false(st == NULL)) goto cleanup; - for (int i = 0; i < 2; i++) { - st->packets[i] = counter_u64_alloc(M_NOWAIT); - st->bytes[i] = counter_u64_alloc(M_NOWAIT); - if (st->packets[i] == NULL || st->bytes[i] == NULL) - goto cleanup; - } - if ((skw = uma_zalloc(V_pf_state_key_z, M_NOWAIT)) == NULL) goto cleanup; @@ -623,15 +617,7 @@ cleanup: cleanup_state: /* pf_state_insert() frees the state keys. */ if (st) { - for (int i = 0; i < 2; i++) { - counter_u64_free(st->packets[i]); - counter_u64_free(st->bytes[i]); - } - if (st->dst.scrub) - uma_zfree(V_pf_state_scrub_z, st->dst.scrub); - if (st->src.scrub) - uma_zfree(V_pf_state_scrub_z, st->src.scrub); - uma_zfree(V_pf_state_z, st); + pf_free_state(st); } return (error); } diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3afb54dbab17..92e93b62e85f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1736,7 +1736,7 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } -static struct pf_state * +struct pf_state * pf_alloc_state(int flags) { struct pf_state *s; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 67E3665AD95; Mon, 5 Jul 2021 11:33: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 4GJNqj5yBRz4sb9; Mon, 5 Jul 2021 11:33: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 3EABE2542C; Mon, 5 Jul 2021 11:33: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 165BXrdS018080; Mon, 5 Jul 2021 11:33:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXrt1018079; Mon, 5 Jul 2021 11:33:53 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:53 GMT Message-Id: <202107051133.165BXrt1018079@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: dfcf1bd2e10e - stable/13 - pf: make sure the dtrace probe has safe access to state 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: dfcf1bd2e10e6d2fe32977862bc13f4ff74e3d76 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:54 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dfcf1bd2e10e6d2fe32977862bc13f4ff74e3d76 commit dfcf1bd2e10e6d2fe32977862bc13f4ff74e3d76 Author: Mateusz Guzik AuthorDate: 2021-06-28 19:32:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:13 +0000 pf: make sure the dtrace probe has safe access to state Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit d26ef5c7ac830812f07a02787f25fed5d6f8609e) --- sys/netpfil/pf/pf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 92e93b62e85f..3846e5335a2a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6318,11 +6318,12 @@ done: } break; } - if (s) - PF_STATE_UNLOCK(s); SDT_PROBE4(pf, ip, test, done, action, reason, r, s); + if (s) + PF_STATE_UNLOCK(s); + return (action); } #endif /* INET */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B08265A95E; Mon, 5 Jul 2021 11:33: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 4GJNqk5lPGz4sDt; Mon, 5 Jul 2021 11:33: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 5EF7B2542D; Mon, 5 Jul 2021 11:33: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 165BXsxf018104; Mon, 5 Jul 2021 11:33:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXsMM018103; Mon, 5 Jul 2021 11:33:54 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:54 GMT Message-Id: <202107051133.165BXsMM018103@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: aa9d233aadd8 - stable/13 - pf: revert: Use counter(9) for pf_state byte/packet tracking 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: aa9d233aadd840e4d671d352faf5bfc82ef8fbe7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:55 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=aa9d233aadd840e4d671d352faf5bfc82ef8fbe7 commit aa9d233aadd840e4d671d352faf5bfc82ef8fbe7 Author: Mateusz Guzik AuthorDate: 2021-06-28 18:50:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:13 +0000 pf: revert: Use counter(9) for pf_state byte/packet tracking stats are not shared and consequently per-CPU counters only waste memory. No slowdown was measured when passing over 20M pps. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 55cc305dfcad0ad7c4f528fa47f7473927e8223a) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 39 +++++++++------------------------------ sys/netpfil/pf/pf_ioctl.c | 10 ++++------ sys/netpfil/pf/pf_nv.c | 4 ++-- 4 files changed, 17 insertions(+), 40 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 12ac791e3c72..b63f22e84bc0 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -533,8 +533,8 @@ struct pf_state { struct pfi_kkif *rt_kif; struct pf_ksrc_node *src_node; struct pf_ksrc_node *nat_src_node; - counter_u64_t packets[2]; - counter_u64_t bytes[2]; + u_int64_t packets[2]; + u_int64_t bytes[2]; u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3846e5335a2a..6ac19c9ad5d3 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1739,23 +1739,8 @@ pf_unlink_state(struct pf_state *s, u_int flags) struct pf_state * pf_alloc_state(int flags) { - struct pf_state *s; - - s = uma_zalloc(V_pf_state_z, flags | M_ZERO); - if (__predict_false(s == NULL)) - return (NULL); - - for (int i = 0; i < 2; i++) { - s->bytes[i] = counter_u64_alloc(M_NOWAIT); - s->packets[i] = counter_u64_alloc(M_NOWAIT); - - if (s->bytes[i] == NULL || s->packets[i] == NULL) { - pf_free_state(s); - return (NULL); - } - } - return (s); + return (uma_zalloc(V_pf_state_z, flags | M_ZERO)); } void @@ -1766,11 +1751,6 @@ pf_free_state(struct pf_state *cur) KASSERT(cur->timeout == PFTM_UNLINKED, ("%s: timeout %u", __func__, cur->timeout)); - for (int i = 0; i < 2; i++) { - counter_u64_free(cur->bytes[i]); - counter_u64_free(cur->packets[i]); - } - pf_normalize_tcp_cleanup(cur); uma_zfree(V_pf_state_z, cur); counter_u64_add(V_pf_status.fcounters[FCNT_STATE_REMOVALS], 1); @@ -4313,9 +4293,8 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, pf_print_flags(th->th_flags); printf(" seq=%u (%u) ack=%u len=%u ackskew=%d " "pkts=%llu:%llu dir=%s,%s\n", seq, orig_seq, ack, - pd->p_len, ackskew, - (unsigned long long)counter_u64_fetch((*state)->packets[0]), - (unsigned long long)counter_u64_fetch((*state)->packets[1]), + pd->p_len, ackskew, (unsigned long long)(*state)->packets[0], + (unsigned long long)(*state)->packets[1], pd->dir == PF_IN ? "in" : "out", pd->dir == (*state)->direction ? "fwd" : "rev"); } @@ -4370,8 +4349,8 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, printf(" seq=%u (%u) ack=%u len=%u ackskew=%d " "pkts=%llu:%llu dir=%s,%s\n", seq, orig_seq, ack, pd->p_len, ackskew, - (unsigned long long)counter_u64_fetch((*state)->packets[0]), - (unsigned long long)counter_u64_fetch((*state)->packets[1]), + (unsigned long long)(*state)->packets[0], + (unsigned long long)(*state)->packets[1], pd->dir == PF_IN ? "in" : "out", pd->dir == (*state)->direction ? "fwd" : "rev"); printf("pf: State failure on: %c %c %c %c | %c %c\n", @@ -6276,8 +6255,8 @@ done: pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; - counter_u64_add(s->packets[dirndx], 1); - counter_u64_add(s->bytes[dirndx], pd.tot_len); + s->packets[dirndx]++; + s->bytes[dirndx] += pd.tot_len; } tr = r; nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule; @@ -6674,8 +6653,8 @@ done: pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; - counter_u64_add(s->packets[dirndx], 1); - counter_u64_add(s->bytes[dirndx], pd.tot_len); + s->packets[dirndx]++; + s->bytes[dirndx] += pd.tot_len; } tr = r; nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 657c0e1945d3..49d5b2d216d2 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4585,12 +4585,10 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_state *st) else sp->nat_rule = htonl(st->nat_rule.ptr->nr); - pf_state_counter_hton(counter_u64_fetch(st->packets[0]), - sp->packets[0]); - pf_state_counter_hton(counter_u64_fetch(st->packets[1]), - sp->packets[1]); - pf_state_counter_hton(counter_u64_fetch(st->bytes[0]), sp->bytes[0]); - pf_state_counter_hton(counter_u64_fetch(st->bytes[1]), sp->bytes[1]); + pf_state_counter_hton(st->packets[0], sp->packets[0]); + pf_state_counter_hton(st->packets[1], sp->packets[1]); + pf_state_counter_hton(st->bytes[0], sp->bytes[0]); + pf_state_counter_hton(st->bytes[1], sp->bytes[1]); } diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 31943ba69687..553290c88586 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -982,9 +982,9 @@ pf_state_to_nvstate(const struct pf_state *s) for (int i = 0; i < 2; i++) { nvlist_append_number_array(nvl, "packets", - counter_u64_fetch(s->packets[i])); + s->packets[i]); nvlist_append_number_array(nvl, "bytes", - counter_u64_fetch(s->bytes[i])); + s->bytes[i]); } nvlist_add_number(nvl, "creatorid", s->creatorid); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D195065A9BD; Mon, 5 Jul 2021 11:33: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 4GJNql4sHbz4sWW; Mon, 5 Jul 2021 11:33: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 8B0AF2525E; Mon, 5 Jul 2021 11:33: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 165BXt5J018134; Mon, 5 Jul 2021 11:33:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXtAo018133; Mon, 5 Jul 2021 11:33:55 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:55 GMT Message-Id: <202107051133.165BXtAo018133@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: 7b78b57f4b6c - stable/13 - mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit 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: 7b78b57f4b6c9fabea6dd20765bc99dba7492f60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:56 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7b78b57f4b6c9fabea6dd20765bc99dba7492f60 commit 7b78b57f4b6c9fabea6dd20765bc99dba7492f60 Author: Mateusz Guzik AuthorDate: 2021-06-29 12:56:19 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:14 +0000 mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f77697dd9f31df85cd86370888606c81833f7c8a) --- sys/security/mac/mac_framework.c | 6 ++++++ sys/security/mac/mac_framework.h | 34 ++++++++++++++++++++++++++++++++-- sys/security/mac/mac_net.c | 10 ++-------- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index f0b4f89db7ca..e773a3840464 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -145,6 +145,8 @@ FPFLAG_RARE(vnode_check_access); FPFLAG_RARE(vnode_check_readlink); FPFLAG_RARE(pipe_check_stat); FPFLAG_RARE(pipe_check_poll); +FPFLAG_RARE(ifnet_create_mbuf); +FPFLAG_RARE(ifnet_check_transmit); #undef FPFLAG #undef FPFLAG_RARE @@ -445,6 +447,10 @@ struct mac_policy_fastpath_elem mac_policy_fastpath_array[] = { .flag = &mac_pipe_check_stat_fp_flag }, { .offset = FPO(pipe_check_poll), .flag = &mac_pipe_check_poll_fp_flag }, + { .offset = FPO(ifnet_create_mbuf), + .flag = &mac_ifnet_create_mbuf_fp_flag }, + { .offset = FPO(ifnet_check_transmit), + .flag = &mac_ifnet_check_transmit_fp_flag }, }; static void diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h index 481f90a04801..7a46fbedb28d 100644 --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -143,9 +143,39 @@ void mac_devfs_update(struct mount *mp, struct devfs_dirent *de, void mac_devfs_vnode_associate(struct mount *mp, struct devfs_dirent *de, struct vnode *vp); -int mac_ifnet_check_transmit(struct ifnet *ifp, struct mbuf *m); +int mac_ifnet_check_transmit_impl(struct ifnet *ifp, struct mbuf *m); +#ifdef MAC +extern bool mac_ifnet_check_transmit_fp_flag; +#else +#define mac_ifnet_check_transmit_fp_flag 0 +#endif +#define mac_ifnet_check_transmit_enabled() __predict_false(mac_ifnet_check_transmit_fp_flag) +static inline int +mac_ifnet_check_transmit(struct ifnet *ifp, struct mbuf *m) +{ + + if (mac_ifnet_check_transmit_enabled()) + return (mac_ifnet_check_transmit_impl(ifp, m)); + return (0); +} + void mac_ifnet_create(struct ifnet *ifp); -void mac_ifnet_create_mbuf(struct ifnet *ifp, struct mbuf *m); + +void mac_ifnet_create_mbuf_impl(struct ifnet *ifp, struct mbuf *m); +#ifdef MAC +extern bool mac_ifnet_create_mbuf_fp_flag; +#else +#define mac_ifnet_create_mbuf_fp_flag 0 +#endif +#define mac_ifnet_create_mbuf_enabled() __predict_false(mac_ifnet_create_mbuf_fp_flag) +static inline void +mac_ifnet_create_mbuf(struct ifnet *ifp, struct mbuf *m) +{ + + if (mac_ifnet_create_mbuf_enabled()) + mac_ifnet_create_mbuf_impl(ifp, m); +} + void mac_ifnet_destroy(struct ifnet *); void mac_ifnet_init(struct ifnet *); int mac_ifnet_ioctl_get(struct ucred *cred, struct ifreq *ifr, diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index 161040edf84f..372619c7b583 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.c @@ -337,14 +337,11 @@ mac_bpfdesc_create_mbuf(struct bpf_d *d, struct mbuf *m) } void -mac_ifnet_create_mbuf(struct ifnet *ifp, struct mbuf *m) +mac_ifnet_create_mbuf_impl(struct ifnet *ifp, struct mbuf *m) { struct label *label; int locked; - if (mac_policy_count == 0) - return; - label = mac_mbuf_to_label(m); MAC_IFNET_LOCK(ifp, locked); @@ -380,16 +377,13 @@ MAC_CHECK_PROBE_DEFINE2(ifnet_check_transmit, "struct ifnet *", "struct mbuf *"); int -mac_ifnet_check_transmit(struct ifnet *ifp, struct mbuf *m) +mac_ifnet_check_transmit_impl(struct ifnet *ifp, struct mbuf *m) { struct label *label; int error, locked; M_ASSERTPKTHDR(m); - if (mac_policy_count == 0) - return (0); - label = mac_mbuf_to_label(m); MAC_IFNET_LOCK(ifp, locked); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5274E65A9C5; Mon, 5 Jul 2021 11:33: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 4GJNqm6HnSz4sYg; Mon, 5 Jul 2021 11:33: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 A8B7824FCD; Mon, 5 Jul 2021 11:33: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 165BXui5018158; Mon, 5 Jul 2021 11:33:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXut8018157; Mon, 5 Jul 2021 11:33:56 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:56 GMT Message-Id: <202107051133.165BXut8018157@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: d5fe617b09b2 - stable/13 - pfctl: cache getprotobynumber results 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: d5fe617b09b2988676dcc0e323b6a88fd821fd41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:57 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d5fe617b09b2988676dcc0e323b6a88fd821fd41 commit d5fe617b09b2988676dcc0e323b6a88fd821fd41 Author: Mateusz Guzik AuthorDate: 2021-07-01 19:25:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:14 +0000 pfctl: cache getprotobynumber results As for example pfctl -ss keeps calling it, it saves a lot of overhead from elided parsing of /etc/nsswitch.conf and /etc/protocols. Sample result when running a pre-nvlist binary with nfs root and dumping 7 mln states: before: 24.817u 62.993s 1:28.52 99.1% after: 8.064u 1.117s 0:18.87 48.5% Idea by Jim Thompson Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 858937bea4599d254a97ee6321683f8629604e15) --- sbin/pfctl/parse.y | 8 ++++---- sbin/pfctl/pf_print_state.c | 6 +++--- sbin/pfctl/pfctl.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sbin/pfctl/pfctl.h | 2 ++ sbin/pfctl/pfctl_parser.c | 6 +++--- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 4448a8255ce1..acd90e280b53 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5017,13 +5017,13 @@ expand_label_port(const char *name, char *label, size_t len, void expand_label_proto(const char *name, char *label, size_t len, u_int8_t proto) { - struct protoent *pe; + const char *protoname; char n[4]; if (strstr(label, name) != NULL) { - pe = getprotobynumber(proto); - if (pe != NULL) - expand_label_str(label, len, name, pe->p_name); + protoname = pfctl_proto2name(proto); + if (protoname != NULL) + expand_label_str(label, len, name, protoname); else { snprintf(n, sizeof(n), "%u", proto); expand_label_str(label, len, name, n); diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index b1f0079154cf..b66a296d6080 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -211,7 +211,7 @@ print_state(struct pfctl_state *s, int opts) { struct pfctl_state_peer *src, *dst; struct pfctl_state_key *key, *sk, *nk; - struct protoent *p; + const char *protoname; int min, sec; sa_family_t af; uint8_t proto; @@ -243,8 +243,8 @@ print_state(struct pfctl_state *s, int opts) sk->port[1] = nk->port[1]; } printf("%s ", s->ifname); - if ((p = getprotobynumber(proto)) != NULL) - printf("%s ", p->p_name); + if ((protoname = pfctl_proto2name(proto)) != NULL) + printf("%s ", protoname); else printf("%u ", proto); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index f82d75198d61..14b7f3a01657 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -254,6 +254,49 @@ usage(void) exit(1); } +/* + * Cache protocol number to name translations. + * + * Translation is performed a lot e.g., when dumping states and + * getprotobynumber is incredibly expensive. + * + * Note from the getprotobynumber(3) manpage: + * + * These functions use a thread-specific data space; if the data is needed + * for future use, it should be copied before any subsequent calls overwrite + * it. Only the Internet protocols are currently understood. + * + * + * Consequently we only cache the name and strdup it for safety. + * + * At the time of writing this comment the last entry in /etc/protocols is: + * divert 258 DIVERT # Divert pseudo-protocol [non IANA] + */ +const char * +pfctl_proto2name(int proto) +{ + static const char *pfctl_proto_cache[259]; + struct protoent *p; + + if (proto >= nitems(pfctl_proto_cache)) { + p = getprotobynumber(proto); + if (p == NULL) { + return (NULL); + } + return (p->p_name); + } + + if (pfctl_proto_cache[proto] == NULL) { + p = getprotobynumber(proto); + if (p == NULL) { + return (NULL); + } + pfctl_proto_cache[proto] = strdup(p->p_name); + } + + return (pfctl_proto_cache[proto]); +} + int pfctl_enable(int dev, int opts) { diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index f8ff5012e01b..80ef184fa90f 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -138,4 +138,6 @@ void pf_remove_if_empty_ruleset(struct pfctl_ruleset *); struct pfctl_ruleset *pf_find_ruleset(const char *); struct pfctl_ruleset *pf_find_or_create_ruleset(const char *); +const char *pfctl_proto2name(int); + #endif /* _PFCTL_H_ */ diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index ce460ab691ca..b4a1cde967bd 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -812,10 +812,10 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer printf(" inet6"); } if (r->proto) { - struct protoent *p; + const char *protoname; - if ((p = getprotobynumber(r->proto)) != NULL) - printf(" proto %s", p->p_name); + if ((protoname = pfctl_proto2name(r->proto)) != NULL) + printf(" proto %s", protoname); else printf(" proto %u", r->proto); } From owner-dev-commits-src-all@freebsd.org Mon Jul 5 11:33:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5A1D465ABE3; Mon, 5 Jul 2021 11:33:58 +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 4GJNqp0PGnz4sYn; Mon, 5 Jul 2021 11:33:58 +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 D53782525F; Mon, 5 Jul 2021 11:33: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 165BXvRJ018182; Mon, 5 Jul 2021 11:33:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165BXvYt018181; Mon, 5 Jul 2021 11:33:57 GMT (envelope-from git) Date: Mon, 5 Jul 2021 11:33:57 GMT Message-Id: <202107051133.165BXvYt018181@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: b501c72ad305 - stable/13 - pf: make DIOCGETSTATESNV iterations killable 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: b501c72ad3054b6043c23fdcb7f95d7f26abe39c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 11:33:59 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b501c72ad3054b6043c23fdcb7f95d7f26abe39c commit b501c72ad3054b6043c23fdcb7f95d7f26abe39c Author: Mateusz Guzik AuthorDate: 2021-07-02 07:28:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:32:15 +0000 pf: make DIOCGETSTATESNV iterations killable Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 48d5b86364fa8e86318805d0078ccf9066e94ae8) --- sys/netpfil/pf/pf_ioctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 49d5b2d216d2..0097d8b0f6b6 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5060,6 +5060,11 @@ pf_getstates(struct pfioc_nv *nv) if (s->timeout == PFTM_UNLINKED) continue; + if (SIGPENDING(curthread)) { + PF_HASHROW_UNLOCK(ih); + ERROUT(EINTR); + } + nvls = pf_state_to_nvstate(s); if (nvls == NULL) { PF_HASHROW_UNLOCK(ih); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:01:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 51C0065B9F0; Mon, 5 Jul 2021 12:01: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 4GJPS31nc8z3Cwb; Mon, 5 Jul 2021 12:01: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 25EBA25B3B; Mon, 5 Jul 2021 12:01: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 165C1t0l054571; Mon, 5 Jul 2021 12:01:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C1t6V054570; Mon, 5 Jul 2021 12:01:55 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:01:55 GMT Message-Id: <202107051201.165C1t6V054570@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: 5372a43bf746 - stable/12 - pf: Add endline to all DPFPRINTF() 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/12 X-Git-Reftype: branch X-Git-Commit: 5372a43bf746fec62e8b9312ce96dd703891d187 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:01:55 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=5372a43bf746fec62e8b9312ce96dd703891d187 commit 5372a43bf746fec62e8b9312ce96dd703891d187 Author: Kristof Provost AuthorDate: 2019-11-24 13:53:36 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:37:43 +0000 pf: Add endline to all DPFPRINTF() DPFPRINTF() doesn't automatically add an endline, so be consistent and always add it. (cherry picked from commit 492f3a312a2617899809285cdb6a32baf6836b13) --- sys/netpfil/pf/pf.c | 3 ++- sys/netpfil/pf/pf_norm.c | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 57bbd355e2fb..544c262a96f0 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3849,7 +3849,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, &s->src, &s->dst, rewrite)) { /* This really shouldn't happen!!! */ DPFPRINTF(PF_DEBUG_URGENT, - ("pf_normalize_tcp_stateful failed on first pkt")); + ("pf_normalize_tcp_stateful failed on first " + "pkt\n")); pf_normalize_tcp_cleanup(s); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index b6e7fd5f1e1c..222e8231ac60 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -551,25 +551,25 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, /* No empty fragments. */ if (frent->fe_len == 0) { - DPFPRINTF(("bad fragment: len 0")); + DPFPRINTF(("bad fragment: len 0\n")); goto bad_fragment; } /* All fragments are 8 byte aligned. */ if (frent->fe_mff && (frent->fe_len & 0x7)) { - DPFPRINTF(("bad fragment: mff and len %d", frent->fe_len)); + DPFPRINTF(("bad fragment: mff and len %d\n", frent->fe_len)); goto bad_fragment; } /* Respect maximum length, IP_MAXPACKET == IPV6_MAXPACKET. */ if (frent->fe_off + frent->fe_len > IP_MAXPACKET) { - DPFPRINTF(("bad fragment: max packet %d", + DPFPRINTF(("bad fragment: max packet %d\n", frent->fe_off + frent->fe_len)); goto bad_fragment; } DPFPRINTF((key->frc_af == AF_INET ? - "reass frag %d @ %d-%d" : "reass frag %#08x @ %d-%d", + "reass frag %d @ %d-%d\n" : "reass frag %#08x @ %d-%d\n", key->frc_id, frent->fe_off, frent->fe_off + frent->fe_len)); /* Fully buffer all of the fragments in this fragment queue. */ @@ -643,7 +643,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, precut = prev->fe_off + prev->fe_len - frent->fe_off; if (precut >= frent->fe_len) goto bad_fragment; - DPFPRINTF(("overlap -%d", precut)); + DPFPRINTF(("overlap -%d\n", precut)); m_adj(frent->fe_m, precut); frent->fe_off += precut; frent->fe_len -= precut; @@ -654,7 +654,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, uint16_t aftercut; aftercut = frent->fe_off + frent->fe_len - after->fe_off; - DPFPRINTF(("adjust overlap %d", aftercut)); + DPFPRINTF(("adjust overlap %d\n", aftercut)); if (aftercut < after->fe_len) { m_adj(after->fe_m, aftercut); old_index = pf_frent_index(after); @@ -693,7 +693,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, /* If part of the queue gets too long, there is not way to recover. */ if (pf_frent_insert(frag, frent, prev)) { - DPFPRINTF(("fragment queue limit exceeded")); + DPFPRINTF(("fragment queue limit exceeded\n")); goto bad_fragment; } @@ -767,7 +767,7 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) m = *m0 = NULL; if (frag->fr_holes) { - DPFPRINTF(("frag %d, holes %d", frag->fr_id, frag->fr_holes)); + DPFPRINTF(("frag %d, holes %d\n", frag->fr_id, frag->fr_holes)); return (PF_PASS); /* drop because *m0 is NULL, no error */ } @@ -798,7 +798,7 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) ip->ip_off &= ~(IP_MF|IP_OFFMASK); if (hdrlen + total > IP_MAXPACKET) { - DPFPRINTF(("drop: too big: %d", total)); + DPFPRINTF(("drop: too big: %d\n", total)); ip->ip_len = 0; REASON_SET(reason, PFRES_SHORT); /* PF_DROP requires a valid mbuf *m0 in pf_test() */ @@ -857,7 +857,8 @@ pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr, m = *m0 = NULL; if (frag->fr_holes) { - DPFPRINTF(("frag %d, holes %d", frag->fr_id, frag->fr_holes)); + DPFPRINTF(("frag %d, holes %d\n", frag->fr_id, + frag->fr_holes)); PF_FRAG_UNLOCK(); return (PF_PASS); /* Drop because *m0 is NULL, no error. */ } @@ -918,14 +919,14 @@ pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr, ip6->ip6_nxt = proto; if (hdrlen - sizeof(struct ip6_hdr) + total > IPV6_MAXPACKET) { - DPFPRINTF(("drop: too big: %d", total)); + DPFPRINTF(("drop: too big: %d\n", total)); ip6->ip6_plen = 0; REASON_SET(reason, PFRES_SHORT); /* PF_DROP requires a valid mbuf *m0 in pf_test6(). */ return (PF_DROP); } - DPFPRINTF(("complete: %p(%d)", m, ntohs(ip6->ip6_plen))); + DPFPRINTF(("complete: %p(%d)\n", m, ntohs(ip6->ip6_plen))); return (PF_PASS); fail: @@ -994,7 +995,7 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag) action = PF_PASS; } else { /* Drop expects an mbuf to free. */ - DPFPRINTF(("refragment error %d", error)); + DPFPRINTF(("refragment error %d\n", error)); action = PF_DROP; } for (t = m; m; m = t) { @@ -1626,7 +1627,7 @@ pf_normalize_tcp_stateful(struct mbuf *m, int off, struct pf_pdesc *pd, if (got_ts) { /* Huh? Multiple timestamps!? */ if (V_pf_status.debug >= PF_DEBUG_MISC) { - DPFPRINTF(("multiple TS??")); + DPFPRINTF(("multiple TS??\n")); pf_print_state(state); printf("\n"); } From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:01:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6EF9865BA7C; Mon, 5 Jul 2021 12:01:56 +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 4GJPS42mhYz3CkJ; Mon, 5 Jul 2021 12:01: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 47C9025B3C; Mon, 5 Jul 2021 12:01: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 165C1u5v054595; Mon, 5 Jul 2021 12:01:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C1ulI054594; Mon, 5 Jul 2021 12:01:56 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:01:56 GMT Message-Id: <202107051201.165C1ulI054594@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: f4e50b36e208 - stable/12 - pf: add pf_release_staten and use it in pf_unlink_state 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/12 X-Git-Reftype: branch X-Git-Commit: f4e50b36e208807371c568382399e60e2f6ceee8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:01:56 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f4e50b36e208807371c568382399e60e2f6ceee8 commit f4e50b36e208807371c568382399e60e2f6ceee8 Author: Mateusz Guzik AuthorDate: 2021-06-28 12:18:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:37:50 +0000 pf: add pf_release_staten and use it in pf_unlink_state Saves one atomic op. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit d09388d013300fc4aa1ee1a6bc24260cd400aff3) --- sys/net/pfvar.h | 11 +++++++++++ sys/netpfil/pf/pf.c | 7 ++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7e16e40ccc45..da7a6731150e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1508,6 +1508,17 @@ pf_release_state(struct pf_state *s) return (0); } +static __inline int +pf_release_staten(struct pf_state *s, u_int n) +{ + + if (refcount_releasen(&s->refs, n)) { + pf_free_state(s); + return (1); + } else + return (0); +} + 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 *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 544c262a96f0..672727293032 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1730,11 +1730,8 @@ pf_unlink_state(struct pf_state *s, u_int flags) PF_HASHROW_UNLOCK(ih); pf_detach_state(s); - /* pf_state_insert() initialises refs to 2, so we can never release the - * last reference here, only in pf_release_state(). */ - (void)refcount_release(&s->refs); - - return (pf_release_state(s)); + /* pf_state_insert() initialises refs to 2 */ + return (pf_release_staten(s, 2)); } void From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:01:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D8ADF65B5BE; Mon, 5 Jul 2021 12:01: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 4GJPS55405z3CxF; Mon, 5 Jul 2021 12:01:57 +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 6F96925965; Mon, 5 Jul 2021 12:01: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 165C1vDJ054619; Mon, 5 Jul 2021 12:01:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C1vpg054618; Mon, 5 Jul 2021 12:01:57 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:01:57 GMT Message-Id: <202107051201.165C1vpg054618@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: 47a2d55f00ee - stable/12 - pf: factor out state allocation into pf_alloc_state 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/12 X-Git-Reftype: branch X-Git-Commit: 47a2d55f00eef32f9cb765eaf094b18ce2da78f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:01:58 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=47a2d55f00eef32f9cb765eaf094b18ce2da78f0 commit 47a2d55f00eef32f9cb765eaf094b18ce2da78f0 Author: Mateusz Guzik AuthorDate: 2021-06-28 12:22:31 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:37:53 +0000 pf: factor out state allocation into pf_alloc_state Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit ccb17a21041e9206b80fa9f64b6ec20233df6403) --- sys/netpfil/pf/pf.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 672727293032..ec27b6ee0ace 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1734,6 +1734,28 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } +static struct pf_state * +pf_alloc_state(int flags) +{ + struct pf_state *s; + + s = uma_zalloc(V_pf_state_z, flags | M_ZERO); + if (__predict_false(s == NULL)) + return (NULL); + + for (int i = 0; i < 2; i++) { + s->bytes[i] = counter_u64_alloc(M_NOWAIT); + s->packets[i] = counter_u64_alloc(M_NOWAIT); + + if (s->bytes[i] == NULL || s->packets[i] == NULL) { + pf_free_state(s); + return (NULL); + } + } + + return (s); +} + void pf_free_state(struct pf_state *cur) { @@ -3731,21 +3753,11 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, REASON_SET(&reason, PFRES_SRCLIMIT); goto csfailed; } - s = uma_zalloc(V_pf_state_z, M_NOWAIT | M_ZERO); + s = pf_alloc_state(M_NOWAIT); if (s == NULL) { REASON_SET(&reason, PFRES_MEMORY); goto csfailed; } - for (int i = 0; i < 2; i++) { - s->bytes[i] = counter_u64_alloc(M_NOWAIT); - s->packets[i] = counter_u64_alloc(M_NOWAIT); - - if (s->bytes[i] == NULL || s->packets[i] == NULL) { - pf_free_state(s); - REASON_SET(&reason, PFRES_MEMORY); - goto csfailed; - } - } s->rule.ptr = r; s->nat_rule.ptr = nr; s->anchor.ptr = a; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:01:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E036B65BA80; Mon, 5 Jul 2021 12:01:58 +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 4GJPS64pLQz3Cqk; Mon, 5 Jul 2021 12:01:58 +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 8B04D25A18; Mon, 5 Jul 2021 12:01: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 165C1wh3054646; Mon, 5 Jul 2021 12:01:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C1wp4054644; Mon, 5 Jul 2021 12:01:58 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:01:58 GMT Message-Id: <202107051201.165C1wp4054644@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: e331b1d19f6b - stable/12 - pf: assert that sizeof(struct pf_state) <= 312 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/12 X-Git-Reftype: branch X-Git-Commit: e331b1d19f6bc28b1e64758357f4a408f058a8a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:01:59 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e331b1d19f6bc28b1e64758357f4a408f058a8a6 commit e331b1d19f6bc28b1e64758357f4a408f058a8a6 Author: Mateusz Guzik AuthorDate: 2021-06-28 12:49:40 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:37:56 +0000 pf: assert that sizeof(struct pf_state) <= 312 To prevent accidentally going over a threshold which makes UMA fit only 12 objects per page instead of 13. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit e6dd0e2e8d4f59275fb576a9ccb9d356d36457bb) --- sys/net/pfvar.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index da7a6731150e..7d7e7b20ab6f 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -548,6 +548,11 @@ struct pf_state { u_int8_t sync_updates; u_int8_t _tail[3]; }; + +/* + * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. + */ +_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); #endif /* From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:02:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 43A7665BB02; Mon, 5 Jul 2021 12:02: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 4GJPS76nffz3CxV; Mon, 5 Jul 2021 12: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 B296225966; Mon, 5 Jul 2021 12: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 165C1xOb054674; Mon, 5 Jul 2021 12: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 165C1xj7054673; Mon, 5 Jul 2021 12:01:59 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:01:59 GMT Message-Id: <202107051201.165C1xj7054673@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: c5c7dd3971bb - stable/12 - pf: fix error-case leaks in pf_create_state 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/12 X-Git-Reftype: branch X-Git-Commit: c5c7dd3971bb88e75ae4e13e7d2df4f935e6b4f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:02:00 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c5c7dd3971bb88e75ae4e13e7d2df4f935e6b4f1 commit c5c7dd3971bb88e75ae4e13e7d2df4f935e6b4f1 Author: Mateusz Guzik AuthorDate: 2021-06-28 18:29:58 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:37:59 +0000 pf: fix error-case leaks in pf_create_state The hand-rolled clean up failed to free counters. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 7f025db57c7879bfa43ac74ecd95903439fdd1d0) --- sys/netpfil/pf/pf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index ec27b6ee0ace..c131e9493ea8 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3828,7 +3828,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, REASON_SET(&reason, PFRES_MAPFAILED); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); goto csfailed; } s->rt_kif = r->rpool.cur->kif; @@ -3850,7 +3850,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, REASON_SET(&reason, PFRES_MEMORY); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); return (PF_DROP); } if ((pd->flags & PFDESC_TCP_NORM) && s->src.scrub && @@ -3860,10 +3860,9 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, DPFPRINTF(PF_DEBUG_URGENT, ("pf_normalize_tcp_stateful failed on first " "pkt\n")); - pf_normalize_tcp_cleanup(s); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); return (PF_DROP); } } @@ -3887,12 +3886,10 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, if (pf_state_insert(BOUND_IFACE(r, kif), kif, (pd->dir == PF_IN) ? sk : nk, (pd->dir == PF_IN) ? nk : sk, s)) { - if (pd->proto == IPPROTO_TCP) - pf_normalize_tcp_cleanup(s); REASON_SET(&reason, PFRES_STATEINS); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); - uma_zfree(V_pf_state_z, s); + pf_free_state(s); return (PF_DROP); } else *sm = s; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:02:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5401665BB82; Mon, 5 Jul 2021 12:02: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 4GJPS90fWyz3Cfv; Mon, 5 Jul 2021 12:02: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 D6146259AC; Mon, 5 Jul 2021 12:02: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 165C202u054698; Mon, 5 Jul 2021 12:02:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C20qF054697; Mon, 5 Jul 2021 12:02:00 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:02:00 GMT Message-Id: <202107051202.165C20qF054697@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: c547f51943d3 - stable/12 - pf: deduplicate V_pf_state_z handling with pfsync 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/12 X-Git-Reftype: branch X-Git-Commit: c547f51943d35555ddccddbe4237127446d9a5c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:02:01 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c547f51943d35555ddccddbe4237127446d9a5c3 commit c547f51943d35555ddccddbe4237127446d9a5c3 Author: Mateusz Guzik AuthorDate: 2021-06-28 18:18:26 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:38:02 +0000 pf: deduplicate V_pf_state_z handling with pfsync Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 803dfe3da0e30520227a791ba5c2b93da16e1cf5) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/if_pfsync.c | 20 +++----------------- sys/netpfil/pf/pf.c | 2 +- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7d7e7b20ab6f..4f11ff9137d8 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1493,6 +1493,7 @@ extern int pf_state_insert(struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, struct pf_state *); +extern struct pf_state *pf_alloc_state(int); extern void pf_free_state(struct pf_state *); static __inline void diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 528195bddec1..fe50b9b270d2 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -505,16 +505,10 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) /* * XXXGL: consider M_WAITOK in ioctl path after. */ - if ((st = uma_zalloc(V_pf_state_z, M_NOWAIT | M_ZERO)) == NULL) + st = pf_alloc_state(M_NOWAIT); + if (__predict_false(st == NULL)) goto cleanup; - for (int i = 0; i < 2; i++) { - st->packets[i] = counter_u64_alloc(M_NOWAIT); - st->bytes[i] = counter_u64_alloc(M_NOWAIT); - if (st->packets[i] == NULL || st->bytes[i] == NULL) - goto cleanup; - } - if ((skw = uma_zalloc(V_pf_state_key_z, M_NOWAIT)) == NULL) goto cleanup; @@ -624,15 +618,7 @@ cleanup: cleanup_state: /* pf_state_insert() frees the state keys. */ if (st) { - for (int i = 0; i < 2; i++) { - counter_u64_free(st->packets[i]); - counter_u64_free(st->bytes[i]); - } - if (st->dst.scrub) - uma_zfree(V_pf_state_scrub_z, st->dst.scrub); - if (st->src.scrub) - uma_zfree(V_pf_state_scrub_z, st->src.scrub); - uma_zfree(V_pf_state_z, st); + pf_free_state(st); } return (error); } diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c131e9493ea8..4f45f5b8ea96 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1734,7 +1734,7 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } -static struct pf_state * +struct pf_state * pf_alloc_state(int flags) { struct pf_state *s; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:02:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C608565BA88; Mon, 5 Jul 2021 12:02: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 4GJPSC2GLKz3D85; Mon, 5 Jul 2021 12:02: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 06834258D7; Mon, 5 Jul 2021 12:02:02 +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 165C218r054722; Mon, 5 Jul 2021 12:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C21cl054721; Mon, 5 Jul 2021 12:02:01 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:02:01 GMT Message-Id: <202107051202.165C21cl054721@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: 838edd2c9dc6 - stable/12 - pf: make sure the dtrace probe has safe access to state 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/12 X-Git-Reftype: branch X-Git-Commit: 838edd2c9dc6e7920c8fd9629d3ee6111c1db189 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:02:04 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=838edd2c9dc6e7920c8fd9629d3ee6111c1db189 commit 838edd2c9dc6e7920c8fd9629d3ee6111c1db189 Author: Mateusz Guzik AuthorDate: 2021-06-28 19:32:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:38:05 +0000 pf: make sure the dtrace probe has safe access to state Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit d26ef5c7ac830812f07a02787f25fed5d6f8609e) --- sys/netpfil/pf/pf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 4f45f5b8ea96..c76207d1e7f1 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6405,11 +6405,12 @@ done: } break; } - if (s) - PF_STATE_UNLOCK(s); SDT_PROBE4(pf, ip, test, done, action, reason, r, s); + if (s) + PF_STATE_UNLOCK(s); + return (action); } #endif /* INET */ From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:02:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A005D65B8D8; Mon, 5 Jul 2021 12:02: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 4GJPSC2NCwz3D39; Mon, 5 Jul 2021 12:02: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 1AB7E25B92; Mon, 5 Jul 2021 12:02: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 165C22Vj055547; Mon, 5 Jul 2021 12:02:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C22vf055522; Mon, 5 Jul 2021 12:02:02 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:02:02 GMT Message-Id: <202107051202.165C22vf055522@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: 3f136d9fea86 - stable/12 - pf: revert: Use counter(9) for pf_state byte/packet tracking 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/12 X-Git-Reftype: branch X-Git-Commit: 3f136d9fea869515900bcda1ef6533f5804d819c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:02:03 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3f136d9fea869515900bcda1ef6533f5804d819c commit 3f136d9fea869515900bcda1ef6533f5804d819c Author: Mateusz Guzik AuthorDate: 2021-06-28 18:50:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:38:08 +0000 pf: revert: Use counter(9) for pf_state byte/packet tracking stats are not shared and consequently per-CPU counters only waste memory. No slowdown was measured when passing over 20M pps. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 55cc305dfcad0ad7c4f528fa47f7473927e8223a) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 39 +++++++++------------------------------ sys/netpfil/pf/pf_ioctl.c | 10 ++++------ sys/netpfil/pf/pf_nv.c | 4 ++-- 4 files changed, 17 insertions(+), 40 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 4f11ff9137d8..c11455837072 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -533,8 +533,8 @@ struct pf_state { struct pfi_kkif *rt_kif; struct pf_ksrc_node *src_node; struct pf_ksrc_node *nat_src_node; - counter_u64_t packets[2]; - counter_u64_t bytes[2]; + u_int64_t packets[2]; + u_int64_t bytes[2]; u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c76207d1e7f1..6edbd60b8d07 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1737,23 +1737,8 @@ pf_unlink_state(struct pf_state *s, u_int flags) struct pf_state * pf_alloc_state(int flags) { - struct pf_state *s; - - s = uma_zalloc(V_pf_state_z, flags | M_ZERO); - if (__predict_false(s == NULL)) - return (NULL); - - for (int i = 0; i < 2; i++) { - s->bytes[i] = counter_u64_alloc(M_NOWAIT); - s->packets[i] = counter_u64_alloc(M_NOWAIT); - - if (s->bytes[i] == NULL || s->packets[i] == NULL) { - pf_free_state(s); - return (NULL); - } - } - return (s); + return (uma_zalloc(V_pf_state_z, flags | M_ZERO)); } void @@ -1764,11 +1749,6 @@ pf_free_state(struct pf_state *cur) KASSERT(cur->timeout == PFTM_UNLINKED, ("%s: timeout %u", __func__, cur->timeout)); - for (int i = 0; i < 2; i++) { - counter_u64_free(cur->bytes[i]); - counter_u64_free(cur->packets[i]); - } - pf_normalize_tcp_cleanup(cur); uma_zfree(V_pf_state_z, cur); counter_u64_add(V_pf_status.fcounters[FCNT_STATE_REMOVALS], 1); @@ -4317,9 +4297,8 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, pf_print_flags(th->th_flags); printf(" seq=%u (%u) ack=%u len=%u ackskew=%d " "pkts=%llu:%llu dir=%s,%s\n", seq, orig_seq, ack, - pd->p_len, ackskew, - (unsigned long long)counter_u64_fetch((*state)->packets[0]), - (unsigned long long)counter_u64_fetch((*state)->packets[1]), + pd->p_len, ackskew, (unsigned long long)(*state)->packets[0], + (unsigned long long)(*state)->packets[1], pd->dir == PF_IN ? "in" : "out", pd->dir == (*state)->direction ? "fwd" : "rev"); } @@ -4374,8 +4353,8 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, printf(" seq=%u (%u) ack=%u len=%u ackskew=%d " "pkts=%llu:%llu dir=%s,%s\n", seq, orig_seq, ack, pd->p_len, ackskew, - (unsigned long long)counter_u64_fetch((*state)->packets[0]), - (unsigned long long)counter_u64_fetch((*state)->packets[1]), + (unsigned long long)(*state)->packets[0], + (unsigned long long)(*state)->packets[1], pd->dir == PF_IN ? "in" : "out", pd->dir == (*state)->direction ? "fwd" : "rev"); printf("pf: State failure on: %c %c %c %c | %c %c\n", @@ -6363,8 +6342,8 @@ done: pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; - counter_u64_add(s->packets[dirndx], 1); - counter_u64_add(s->bytes[dirndx], pd.tot_len); + s->packets[dirndx]++; + s->bytes[dirndx] += pd.tot_len; } tr = r; nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule; @@ -6764,8 +6743,8 @@ done: pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; - counter_u64_add(s->packets[dirndx], 1); - counter_u64_add(s->bytes[dirndx], pd.tot_len); + s->packets[dirndx]++; + s->bytes[dirndx] += pd.tot_len; } tr = r; nr = (s != NULL) ? s->nat_rule.ptr : pd.nat_rule; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 3d5ae03b5a11..ce7a8d1dc582 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4652,12 +4652,10 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_state *st) else sp->nat_rule = htonl(st->nat_rule.ptr->nr); - pf_state_counter_hton(counter_u64_fetch(st->packets[0]), - sp->packets[0]); - pf_state_counter_hton(counter_u64_fetch(st->packets[1]), - sp->packets[1]); - pf_state_counter_hton(counter_u64_fetch(st->bytes[0]), sp->bytes[0]); - pf_state_counter_hton(counter_u64_fetch(st->bytes[1]), sp->bytes[1]); + pf_state_counter_hton(st->packets[0], sp->packets[0]); + pf_state_counter_hton(st->packets[1], sp->packets[1]); + pf_state_counter_hton(st->bytes[0], sp->bytes[0]); + pf_state_counter_hton(st->bytes[1], sp->bytes[1]); } diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 31943ba69687..553290c88586 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -982,9 +982,9 @@ pf_state_to_nvstate(const struct pf_state *s) for (int i = 0; i < 2; i++) { nvlist_append_number_array(nvl, "packets", - counter_u64_fetch(s->packets[i])); + s->packets[i]); nvlist_append_number_array(nvl, "bytes", - counter_u64_fetch(s->bytes[i])); + s->bytes[i]); } nvlist_add_number(nvl, "creatorid", s->creatorid); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:02:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5AA2865BA8B; Mon, 5 Jul 2021 12:02: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 4GJPSD2pcXz3D0h; Mon, 5 Jul 2021 12:02: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 3D75D25B93; Mon, 5 Jul 2021 12:02: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 165C246A055641; Mon, 5 Jul 2021 12:02:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C24KD055640; Mon, 5 Jul 2021 12:02:04 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:02:04 GMT Message-Id: <202107051202.165C24KD055640@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: 98fd94dc8331 - stable/12 - pfctl: cache getprotobynumber results 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/12 X-Git-Reftype: branch X-Git-Commit: 98fd94dc83319db1b6bfc9f741245eefb0af7911 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:02:05 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=98fd94dc83319db1b6bfc9f741245eefb0af7911 commit 98fd94dc83319db1b6bfc9f741245eefb0af7911 Author: Mateusz Guzik AuthorDate: 2021-07-01 19:25:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:38:58 +0000 pfctl: cache getprotobynumber results As for example pfctl -ss keeps calling it, it saves a lot of overhead from elided parsing of /etc/nsswitch.conf and /etc/protocols. Sample result when running a pre-nvlist binary with nfs root and dumping 7 mln states: before: 24.817u 62.993s 1:28.52 99.1% after: 8.064u 1.117s 0:18.87 48.5% Idea by Jim Thompson Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 858937bea4599d254a97ee6321683f8629604e15) --- sbin/pfctl/parse.y | 8 ++++---- sbin/pfctl/pf_print_state.c | 6 +++--- sbin/pfctl/pfctl.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sbin/pfctl/pfctl.h | 2 ++ sbin/pfctl/pfctl_parser.c | 6 +++--- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 06d972556195..1083666e00ce 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5009,13 +5009,13 @@ expand_label_port(const char *name, char *label, size_t len, void expand_label_proto(const char *name, char *label, size_t len, u_int8_t proto) { - struct protoent *pe; + const char *protoname; char n[4]; if (strstr(label, name) != NULL) { - pe = getprotobynumber(proto); - if (pe != NULL) - expand_label_str(label, len, name, pe->p_name); + protoname = pfctl_proto2name(proto); + if (protoname != NULL) + expand_label_str(label, len, name, protoname); else { snprintf(n, sizeof(n), "%u", proto); expand_label_str(label, len, name, n); diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index b1f0079154cf..b66a296d6080 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -211,7 +211,7 @@ print_state(struct pfctl_state *s, int opts) { struct pfctl_state_peer *src, *dst; struct pfctl_state_key *key, *sk, *nk; - struct protoent *p; + const char *protoname; int min, sec; sa_family_t af; uint8_t proto; @@ -243,8 +243,8 @@ print_state(struct pfctl_state *s, int opts) sk->port[1] = nk->port[1]; } printf("%s ", s->ifname); - if ((p = getprotobynumber(proto)) != NULL) - printf("%s ", p->p_name); + if ((protoname = pfctl_proto2name(proto)) != NULL) + printf("%s ", protoname); else printf("%u ", proto); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index f82d75198d61..14b7f3a01657 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -254,6 +254,49 @@ usage(void) exit(1); } +/* + * Cache protocol number to name translations. + * + * Translation is performed a lot e.g., when dumping states and + * getprotobynumber is incredibly expensive. + * + * Note from the getprotobynumber(3) manpage: + * + * These functions use a thread-specific data space; if the data is needed + * for future use, it should be copied before any subsequent calls overwrite + * it. Only the Internet protocols are currently understood. + * + * + * Consequently we only cache the name and strdup it for safety. + * + * At the time of writing this comment the last entry in /etc/protocols is: + * divert 258 DIVERT # Divert pseudo-protocol [non IANA] + */ +const char * +pfctl_proto2name(int proto) +{ + static const char *pfctl_proto_cache[259]; + struct protoent *p; + + if (proto >= nitems(pfctl_proto_cache)) { + p = getprotobynumber(proto); + if (p == NULL) { + return (NULL); + } + return (p->p_name); + } + + if (pfctl_proto_cache[proto] == NULL) { + p = getprotobynumber(proto); + if (p == NULL) { + return (NULL); + } + pfctl_proto_cache[proto] = strdup(p->p_name); + } + + return (pfctl_proto_cache[proto]); +} + int pfctl_enable(int dev, int opts) { diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index f8ff5012e01b..80ef184fa90f 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -138,4 +138,6 @@ void pf_remove_if_empty_ruleset(struct pfctl_ruleset *); struct pfctl_ruleset *pf_find_ruleset(const char *); struct pfctl_ruleset *pf_find_or_create_ruleset(const char *); +const char *pfctl_proto2name(int); + #endif /* _PFCTL_H_ */ diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index ee0f9f8318a9..c38411a145e7 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -812,10 +812,10 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer printf(" inet6"); } if (r->proto) { - struct protoent *p; + const char *protoname; - if ((p = getprotobynumber(r->proto)) != NULL) - printf(" proto %s", p->p_name); + if ((protoname = pfctl_proto2name(r->proto)) != NULL) + printf(" proto %s", protoname); else printf(" proto %u", r->proto); } From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:02:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0493965BB10; Mon, 5 Jul 2021 12:02: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 4GJPSF4mY6z3D0k; Mon, 5 Jul 2021 12:02: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 5D01F257BF; Mon, 5 Jul 2021 12:02: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 165C25XZ055671; Mon, 5 Jul 2021 12:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C251t055670; Mon, 5 Jul 2021 12:02:05 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:02:05 GMT Message-Id: <202107051202.165C251t055670@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: 98b05b41e8c6 - stable/12 - pf: make DIOCGETSTATESNV iterations killable 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/12 X-Git-Reftype: branch X-Git-Commit: 98b05b41e8c69e6c737759ad33fa0117d89aedee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:02:06 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=98b05b41e8c69e6c737759ad33fa0117d89aedee commit 98b05b41e8c69e6c737759ad33fa0117d89aedee Author: Mateusz Guzik AuthorDate: 2021-07-02 07:28:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 11:39:06 +0000 pf: make DIOCGETSTATESNV iterations killable Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 48d5b86364fa8e86318805d0078ccf9066e94ae8) --- sys/netpfil/pf/pf_ioctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index ce7a8d1dc582..0ce39db05c15 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5127,6 +5127,11 @@ pf_getstates(struct pfioc_nv *nv) if (s->timeout == PFTM_UNLINKED) continue; + if (SIGPENDING(curthread)) { + PF_HASHROW_UNLOCK(ih); + ERROUT(EINTR); + } + nvls = pf_state_to_nvstate(s); if (nvls == NULL) { PF_HASHROW_UNLOCK(ih); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:05:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1028565C08C; Mon, 5 Jul 2021 12:05:10 +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 4GJPWn6y03z3DlM; Mon, 5 Jul 2021 12:05: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 D6C5825A2C; Mon, 5 Jul 2021 12:05: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 165C59Eb059030; Mon, 5 Jul 2021 12:05:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C59tl059029; Mon, 5 Jul 2021 12:05:09 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:05:09 GMT Message-Id: <202107051205.165C59tl059029@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: f1c39eb170dd - stable/13 - mbuf: add m_free_raw to be used instead of directly calling uma_zfree 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: f1c39eb170ddeca5137edb706d89216f5a1a1d4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:05:10 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f1c39eb170ddeca5137edb706d89216f5a1a1d4f commit f1c39eb170ddeca5137edb706d89216f5a1a1d4f Author: Mateusz Guzik AuthorDate: 2021-06-30 14:15:25 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 12:04:59 +0000 mbuf: add m_free_raw to be used instead of directly calling uma_zfree The intent is to remove all direct zone_mbuf consumers so that ctor/dtor from that zone can be reimplemented as wrappers around uma, avoiding an indirect function call. Reviewed by: kbowling Discussed with: gallatin Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30959 (cherry picked from commit 05462babd424124762375dca186802d7355af566) --- sys/kern/kern_mbuf.c | 10 ++++++++++ sys/sys/mbuf.h | 1 + 2 files changed, 11 insertions(+) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index a46c576bad90..3b202bf3aab7 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1525,6 +1525,16 @@ m_freem(struct mbuf *mb) mb = m_free(mb); } +/* + * Temporary primitive to allow freeing without going through m_free. + */ +void +m_free_raw(struct mbuf *mb) +{ + + uma_zfree(zone_mbuf, mb); +} + int m_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **mstp) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 729653fa1e55..bb6bf9f62b7a 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -827,6 +827,7 @@ void m_extadd(struct mbuf *, char *, u_int, m_ext_free_t, u_int m_fixhdr(struct mbuf *); struct mbuf *m_fragment(struct mbuf *, int, int); void m_freem(struct mbuf *); +void m_free_raw(struct mbuf *); struct mbuf *m_get2(int, int, short, int); struct mbuf *m_getjcl(int, short, int, int); struct mbuf *m_getm2(struct mbuf *, int, int, short, int); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:05:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 83A7D65BEF3; Mon, 5 Jul 2021 12:05:11 +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 4GJPWq1dKKz3Dc2; Mon, 5 Jul 2021 12:05: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 15A2B256ED; Mon, 5 Jul 2021 12:05:11 +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 165C5Acj059054; Mon, 5 Jul 2021 12:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C5A7o059053; Mon, 5 Jul 2021 12:05:10 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:05:10 GMT Message-Id: <202107051205.165C5A7o059053@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: eae6de040612 - stable/13 - iflib: switch bare zone_mbuf use to m_free_raw 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: eae6de040612845aa2f0582d1f84914ed8aa1a4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:05:11 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=eae6de040612845aa2f0582d1f84914ed8aa1a4a commit eae6de040612845aa2f0582d1f84914ed8aa1a4a Author: Mateusz Guzik AuthorDate: 2021-06-30 14:17:29 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 12:05:00 +0000 iflib: switch bare zone_mbuf use to m_free_raw Reviewed by: kbowling Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30961 (cherry picked from commit bad5f0b6c2944453db2d70a982e8abf203f21669) --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 788cc51822a1..a71c48e772e5 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2219,7 +2219,7 @@ iflib_fl_bufs_free(iflib_fl_t fl) *sd_cl = NULL; if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); - uma_zfree(zone_mbuf, *sd_m); + m_free_raw(*sd_m); *sd_m = NULL; } } else { From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:05:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CACC865C04A; Mon, 5 Jul 2021 12:05: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 4GJPWr3Qnbz3DhQ; Mon, 5 Jul 2021 12:05: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 334AA2596E; Mon, 5 Jul 2021 12:05: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 165C5CtV059078; Mon, 5 Jul 2021 12:05:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165C5CQa059077; Mon, 5 Jul 2021 12:05:12 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:05:12 GMT Message-Id: <202107051205.165C5CQa059077@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: 8413d2a78665 - stable/13 - ktls: switch bare zone_mbuf use to m_free_raw 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: 8413d2a786655005140c75060b7cba321079a5dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:05:12 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8413d2a786655005140c75060b7cba321079a5dd commit 8413d2a786655005140c75060b7cba321079a5dd Author: Mateusz Guzik AuthorDate: 2021-06-30 13:02:45 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 12:05:01 +0000 ktls: switch bare zone_mbuf use to m_free_raw Reviewed by: gallatin Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30955 (cherry picked from commit 904a08f3427c8ae42b667c1f5dc3e441b48a8e84) --- sys/kern/uipc_ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index a648d37cd60f..0f5cc7c1b28f 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2140,7 +2140,7 @@ ktls_work_thread(void *ctx) STAILQ_FOREACH_SAFE(m, &local_m_head, m_epg_stailq, n) { if (m->m_epg_flags & EPG_FLAG_2FREE) { ktls_free(m->m_epg_tls); - uma_zfree(zone_mbuf, m); + m_free_raw(m); } else { ktls_encrypt(m); counter_u64_add(ktls_cnt_tx_queued, -1); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 12:48:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A23B365C833; Mon, 5 Jul 2021 12:48:56 +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 4GJQVJ4FXDz3Jsl; Mon, 5 Jul 2021 12:48: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 7ACC22648C; Mon, 5 Jul 2021 12:48: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 165CmuGT012045; Mon, 5 Jul 2021 12:48:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165CmuV7012044; Mon, 5 Jul 2021 12:48:56 GMT (envelope-from git) Date: Mon, 5 Jul 2021 12:48:56 GMT Message-Id: <202107051248.165CmuV7012044@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: 2f6dd4a29198 - stable/12 - refcount: add refcount_releasen 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/12 X-Git-Reftype: branch X-Git-Commit: 2f6dd4a29198ab82ab013e15b4eb2fa6de25d5bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 12:48:56 -0000 The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2f6dd4a29198ab82ab013e15b4eb2fa6de25d5bf commit 2f6dd4a29198ab82ab013e15b4eb2fa6de25d5bf Author: Mateusz Guzik AuthorDate: 2021-07-05 12:45:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-05 12:48:23 +0000 refcount: add refcount_releasen This is a direct commit as the routine in main was added as a side effect of functionality which later got reverted. --- sys/sys/refcount.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/sys/refcount.h b/sys/sys/refcount.h index 44edbdf953a0..19a8f38772a0 100644 --- a/sys/sys/refcount.h +++ b/sys/sys/refcount.h @@ -70,26 +70,33 @@ refcount_acquire_checked(volatile u_int *count) } static __inline bool -refcount_release(volatile u_int *count) +refcount_releasen(volatile u_int *count, u_int n) { u_int old; atomic_thread_fence_rel(); - old = atomic_fetchadd_int(count, -1); + old = atomic_fetchadd_int(count, -n); KASSERT(old > 0, ("refcount %p is zero", count)); - if (old > 1) + if (old > n) return (false); /* * Last reference. Signal the user to call the destructor. * - * Ensure that the destructor sees all updates. The fence_rel - * at the start of the function synchronized with this fence. + * Ensure that the destructor sees all updates. This synchronizes with + * release fences from all routines which drop the count. */ atomic_thread_fence_acq(); return (true); } +static __inline bool +refcount_release(volatile u_int *count) +{ + + return (refcount_releasen(count, 1)); +} + /* * This functions returns non-zero if the refcount was * incremented. Else zero is returned. From owner-dev-commits-src-all@freebsd.org Mon Jul 5 13:53:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A921365D270; Mon, 5 Jul 2021 13:53:20 +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 4GJRwc4KqBz3jbb; Mon, 5 Jul 2021 13:53:20 +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 7D187270B6; Mon, 5 Jul 2021 13:53:20 +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 165DrK05004896; Mon, 5 Jul 2021 13:53:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165DrKCQ004895; Mon, 5 Jul 2021 13:53:20 GMT (envelope-from git) Date: Mon, 5 Jul 2021 13:53:20 GMT Message-Id: <202107051353.165DrKCQ004895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b464c459eaf4 - main - loader: Fix dtb loading MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 13:53:20 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e commit b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e Author: Emmanuel Vadot AuthorDate: 2021-07-05 13:50:39 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-05 13:53:08 +0000 loader: Fix dtb loading When calling file_findfile with only a type it returns the first file matching the type. But in fdt_apply_overlays we then iterate on the next files and try loading them as dtb overlays. Fix this by checking the type one more time. Sponsored by: Diablotin Systems Reported by: Mark Millard --- stand/fdt/fdt_loader_cmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/fdt/fdt_loader_cmd.c b/stand/fdt/fdt_loader_cmd.c index 7580eceedb05..c14b99768d70 100644 --- a/stand/fdt/fdt_loader_cmd.c +++ b/stand/fdt/fdt_loader_cmd.c @@ -466,6 +466,8 @@ fdt_apply_overlays() current_fdtp_size = fdtp_size; overlays_applied = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + if (strcmp(fp->f_type, "dtbo") != 0) + continue; COPYOUT(fp->f_addr, overlay, fp->f_size); /* Check compatible first to avoid unnecessary allocation */ rv = fdt_check_overlay_compatible(current_fdtp, overlay); From owner-dev-commits-src-all@freebsd.org Mon Jul 5 14:38:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6185C65DF4C; Mon, 5 Jul 2021 14:38:20 +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 4GJSwX2Jvjz3sMF; Mon, 5 Jul 2021 14:38:20 +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 32B1B27A2D; Mon, 5 Jul 2021 14:38:20 +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 165EcK6u058401; Mon, 5 Jul 2021 14:38:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165EcKWh058400; Mon, 5 Jul 2021 14:38:20 GMT (envelope-from git) Date: Mon, 5 Jul 2021 14:38:20 GMT Message-Id: <202107051438.165EcKWh058400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: 0a4ad905bf44 - stable/13 - genet: Fix potential crash during attach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a4ad905bf44d5286ae8e1c4c9693c98fca43183 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 14:38:20 -0000 The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=0a4ad905bf44d5286ae8e1c4c9693c98fca43183 commit 0a4ad905bf44d5286ae8e1c4c9693c98fca43183 Author: Mike Karels AuthorDate: 2021-06-20 16:10:26 +0000 Commit: Mike Karels CommitDate: 2021-07-05 14:12:09 +0000 genet: Fix potential crash during attach As pointed out in the bug, the genet driver (RPi4 Ethernet) was attaching the interrupts before the data structures were fully initialized, causing a crash if an interrupt came in during the attach. Fix by reordering code blocks. PR: 256334 Reported by: < ghuckriede at blackberry.com > Reviewed by: < ghuckriede at blackberry.com > (informally) (cherry picked from commit 13604fb0fd43c85e6bb3a0ad6400a684f150bdea) --- sys/arm64/broadcom/genet/if_genet.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index d0fe2b0d5e71..5d70c7075c3a 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -279,21 +279,6 @@ gen_attach(device_t dev) goto fail; } - /* Install interrupt handlers */ - error = bus_setup_intr(dev, sc->res[_RES_IRQ1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, gen_intr, sc, &sc->ih); - if (error != 0) { - device_printf(dev, "cannot setup interrupt handler1\n"); - goto fail; - } - - error = bus_setup_intr(dev, sc->res[_RES_IRQ2], - INTR_TYPE_NET | INTR_MPSAFE, NULL, gen_intr2, sc, &sc->ih2); - if (error != 0) { - device_printf(dev, "cannot setup interrupt handler2\n"); - goto fail; - } - /* Setup ethernet interface */ sc->ifp = if_alloc(IFT_ETHER); if_setsoftc(sc->ifp, sc); @@ -310,6 +295,21 @@ gen_attach(device_t dev) IFCAP_HWCSUM_IPV6); if_setcapenable(sc->ifp, if_getcapabilities(sc->ifp)); + /* Install interrupt handlers */ + error = bus_setup_intr(dev, sc->res[_RES_IRQ1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, gen_intr, sc, &sc->ih); + if (error != 0) { + device_printf(dev, "cannot setup interrupt handler1\n"); + goto fail; + } + + error = bus_setup_intr(dev, sc->res[_RES_IRQ2], + INTR_TYPE_NET | INTR_MPSAFE, NULL, gen_intr2, sc, &sc->ih2); + if (error != 0) { + device_printf(dev, "cannot setup interrupt handler2\n"); + goto fail; + } + /* Attach MII driver */ mii_flags = 0; switch (sc->phy_mode) From owner-dev-commits-src-all@freebsd.org Mon Jul 5 14:41:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3512165DFC0; Mon, 5 Jul 2021 14:41:46 +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 4GJT0V0qPkz3skV; Mon, 5 Jul 2021 14:41:46 +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 04D3D27C6A; Mon, 5 Jul 2021 14:41: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 165EfjeV069932; Mon, 5 Jul 2021 14:41:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165EfjH9069931; Mon, 5 Jul 2021 14:41:45 GMT (envelope-from git) Date: Mon, 5 Jul 2021 14:41:45 GMT Message-Id: <202107051441.165EfjH9069931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: 2ecf3f2c5774 - stable/13 - genet: pullup minimum header amount for IPv4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2ecf3f2c57749f9968a50a1ce2c2cc29c6f17823 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 14:41:46 -0000 The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=2ecf3f2c57749f9968a50a1ce2c2cc29c6f17823 commit 2ecf3f2c57749f9968a50a1ce2c2cc29c6f17823 Author: Mike Karels AuthorDate: 2021-06-20 17:50:31 +0000 Commit: Mike Karels CommitDate: 2021-07-05 14:39:48 +0000 genet: pullup minimum header amount for IPv4 The genet driver (RPi4 Ethernet) had code to pull headers into the first mbuf if there was only an Ethernet header there. This was originally needed for ICMPv6 replies, then for forwarded IPv6/TCP. Now a situation has been found where it is needed for IPv4, when using NAT with IPFW. Generalize to do this for all protocols. Rather than using an IPv6-related definition for the length, move the length to a variable that can be set with sysctl (hw.genet.tx_hdr_min). Move an old tunable to a new RDTUN variable with a better name. PR: 25607 Reviewers: emaste Differential Revision: https://reviews.freebsd.org/D30831 (cherry picked from commit 184291b0a56a68f2c0dc4388419b0f7d85a08cf4) --- sys/arm64/broadcom/genet/if_genet.c | 53 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 5d70c7075c3a..31fab0f9cf09 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -97,9 +98,27 @@ __FBSDID("$FreeBSD$"); #define TX_MAX_SEGS 20 -/* Maximum number of mbufs to send to if_input */ +static SYSCTL_NODE(_hw, OID_AUTO, genet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "genet driver parameters"); + +/* Maximum number of mbufs to pass per call to if_input */ static int gen_rx_batch = 16 /* RX_BATCH_DEFAULT */; -TUNABLE_INT("hw.gen.rx_batch", &gen_rx_batch); +SYSCTL_INT(_hw_genet, OID_AUTO, rx_batch, CTLFLAG_RDTUN, + &gen_rx_batch, 0, "max mbufs per call to if_input"); + +TUNABLE_INT("hw.gen.rx_batch", &gen_rx_batch); /* old name/interface */ + +/* + * Transmitting packets with only an Ethernet header in the first mbuf + * fails. Examples include reflected ICMPv6 packets, e.g. echo replies; + * forwarded IPv6/TCP packets; and forwarded IPv4/TCP packets that use NAT + * with IPFW. Pulling up the sizes of ether_header + ip6_hdr + icmp6_hdr + * seems to work for both ICMPv6 and TCP over IPv6, as well as the IPv4/TCP + * case. + */ +static int gen_tx_hdr_min = 56; /* ether_header + ip6_hdr + icmp6_hdr */ +SYSCTL_INT(_hw_genet, OID_AUTO, tx_hdr_min, CTLFLAG_RW, + &gen_tx_hdr_min, 0, "header to add to packets with ether header only"); static struct ofw_compat_data compat_data[] = { { "brcm,genet-v1", 1 }, @@ -995,31 +1014,19 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp) m = *mp; /* - * Reflected ICMPv6 packets, e.g. echo replies, tend to get laid - * out with only the Ethernet header in the first mbuf, and this - * doesn't seem to work. Forwarded TCP packets over IPv6 also - * fail if laid out with only the Ethernet header in the first mbuf. - * For now, pull up any IPv6 packet with that layout. Maybe IPv4 - * needs it but we haven't run into it. Pulling up the sizes of - * ether_header + ip6_header + icmp6_hdr seems to work for both - * ICMPv6 and TCP over IPv6. + * Don't attempt to send packets with only an Ethernet header in + * first mbuf; see comment above with gen_tx_hdr_min. */ -#define IP6_PULLUP_LEN (sizeof(struct ether_header) + \ - sizeof(struct ip6_hdr) + 8) if (m->m_len == sizeof(struct ether_header)) { - int ether_type = mtod(m, struct ether_header *)->ether_type; - if (ntohs(ether_type) == ETHERTYPE_IPV6) { - m = m_pullup(m, MIN(m->m_pkthdr.len, IP6_PULLUP_LEN)); - if (m == NULL) { - if (sc->ifp->if_flags & IFF_DEBUG) - device_printf(sc->dev, - "IPV6 pullup fail\n"); - *mp = NULL; - return (ENOMEM); - } + m = m_pullup(m, MIN(m->m_pkthdr.len, gen_tx_hdr_min)); + if (m == NULL) { + if (sc->ifp->if_flags & IFF_DEBUG) + device_printf(sc->dev, + "header pullup fail\n"); + *mp = NULL; + return (ENOMEM); } } -#undef IP6_PULLUP_LEN if ((if_getcapenable(sc->ifp) & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) { From owner-dev-commits-src-all@freebsd.org Mon Jul 5 15:17:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6B0EE65E82E; Mon, 5 Jul 2021 15:17: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 4GJTp92QBFz4VR8; Mon, 5 Jul 2021 15:17: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 37DDB5A2; Mon, 5 Jul 2021 15:17: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 165FHrpn012489; Mon, 5 Jul 2021 15:17:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHrLJ012488; Mon, 5 Jul 2021 15:17:53 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:53 GMT Message-Id: <202107051517.165FHrLJ012488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 55c57a7811ec - main - rman: Remove an outdated comment that no longer applies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55c57a7811ec3c2dfcbfd69216a8eaad4e9be8bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:53 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=55c57a7811ec3c2dfcbfd69216a8eaad4e9be8bc commit 55c57a7811ec3c2dfcbfd69216a8eaad4e9be8bc Author: Jessica Clarke AuthorDate: 2021-07-05 15:15:03 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:15:03 +0000 rman: Remove an outdated comment that no longer applies Since commit 2dd1bdf1834c in 2016 the r_start and r_end fields have been rman_res_t, which was briefly unsigned long, but commit da1b038af9f9 changed the typedef to be uintmax_t instead. C99 is also something we assume these days. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30808 --- sys/kern/subr_rman.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index a76dbf020ee3..a8f5188e7f54 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -79,11 +79,7 @@ __FBSDID("$FreeBSD$"); /* * We use a linked list rather than a bitmap because we need to be able to * represent potentially huge objects (like all of a processor's physical - * address space). That is also why the indices are defined to have type - * `unsigned long' -- that being the largest integral type in ISO C (1990). - * The 1999 version of C allows `long long'; we may need to switch to that - * at some point in the future, particularly if we want to support 36-bit - * addresses on IA32 hardware. + * address space). */ struct resource_i { struct resource r_r; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 15:17:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 97C1C65E830; Mon, 5 Jul 2021 15:17: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 4GJTpB3DQ3z4Vdh; Mon, 5 Jul 2021 15:17: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 50B0B160; Mon, 5 Jul 2021 15:17: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 165FHsNu012513; Mon, 5 Jul 2021 15:17:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHsfD012512; Mon, 5 Jul 2021 15:17:54 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:54 GMT Message-Id: <202107051517.165FHsfD012512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af433832f7520840c22edd1fe1266c1a5cb781ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:54 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c1a5cb781ad commit af433832f7520840c22edd1fe1266c1a5cb781ad Author: Jessica Clarke AuthorDate: 2021-07-05 15:15:32 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:15:32 +0000 geom_label: Remove an old sysinstall(8) workaround We removed sysinstall(8) back in 2011, so this workaround should be long since unnecessary. This workaround can end up breaking cases that are hit in the real world, such as dd'ing a small pre-built disk image to a large partition that you intend to grow on first boot and uses a UFS disk label for / in its /etc/fstab (as the only reliable thing a raw UFS image can reference). Reviewed by: imp, mckusick Differential Revision: https://reviews.freebsd.org/D30825 --- sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c index ababbaa4b43a..70d59488d7b6 100644 --- a/sys/geom/label/g_label_ufs.c +++ b/sys/geom/label/g_label_ufs.c @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); #define G_LABEL_UFS_ID 1 /* - * G_LABEL_UFS_CMP returns true if difference between provider mediasize - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors - */ -#define G_LABEL_UFS_CMP(prov, fsys, size) \ - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ - < G_LABEL_UFS_MAXDIFF ) -#define G_LABEL_UFS_MAXDIFF 0x100 - -/* - * Try to find a superblock on the provider. If successful, then - * check that the size in the superblock corresponds to the size - * of the underlying provider. Finally, look for a volume label - * and create an appropriate provider based on that. + * Try to find a superblock on the provider. If successful, look for a volume + * label and create an appropriate provider based on that. */ static void g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int what) @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int wh return; } - /* - * Check for magic. We also need to check if file system size - * is almost equal to providers size, because sysinstall(8) - * used to bogusly put first partition at offset 0 - * instead of 16, and glabel/ufs would find file system on slice - * instead of partition. - * - * In addition, media size can be a bit bigger than file system - * size. For instance, mkuzip can append bytes to align data - * to large sector size (it improves compression rates). - */ - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { + /* Check for magic. */ + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { /* Valid UFS1. */ - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && - ( G_LABEL_UFS_CMP(pp, fs, fs_size) - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { /* Valid UFS2. */ } else { goto out; From owner-dev-commits-src-all@freebsd.org Mon Jul 5 15:17:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED2D765E90B; Mon, 5 Jul 2021 15:17: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 4GJTpC5ttnz4Vbx; Mon, 5 Jul 2021 15:17: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 8591327CF9; Mon, 5 Jul 2021 15:17: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 165FHtOX012537; Mon, 5 Jul 2021 15:17:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHt4e012536; Mon, 5 Jul 2021 15:17:55 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:55 GMT Message-Id: <202107051517.165FHt4e012536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 348c41d1815d - main - riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 348c41d1815dc2e872a1deba1f4bf760caaa1094 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:56 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=348c41d1815dc2e872a1deba1f4bf760caaa1094 commit 348c41d1815dc2e872a1deba1f4bf760caaa1094 Author: Jessica Clarke AuthorDate: 2021-07-05 15:16:53 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:16:53 +0000 riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep PR: 256905 Reviewed by: arichardson, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30963 --- lib/libc/riscv/sys/Makefile.inc | 2 +- lib/libc/riscv/sys/__vdso_gettc.c | 56 +++++++++++++++++++++++++++++++++++++++ sys/riscv/include/vdso.h | 2 ++ sys/riscv/riscv/elf_machdep.c | 4 +-- sys/riscv/riscv/timer.c | 14 ++++++++++ 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/lib/libc/riscv/sys/Makefile.inc b/lib/libc/riscv/sys/Makefile.inc index 0e94e6652645..b322cece382c 100644 --- a/lib/libc/riscv/sys/Makefile.inc +++ b/lib/libc/riscv/sys/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c MDASM= cerror.S \ syscall.S \ diff --git a/lib/libc/riscv/sys/__vdso_gettc.c b/lib/libc/riscv/sys/__vdso_gettc.c new file mode 100644 index 000000000000..20e69a791bb5 --- /dev/null +++ b/lib/libc/riscv/sys/__vdso_gettc.c @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2021 Jessica Clarke + * + * 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 "libc_private.h" + +#pragma weak __vdso_gettc +int +__vdso_gettc(const struct vdso_timehands *th, u_int *tc) +{ + if (th->th_algo != VDSO_TH_ALGO_RISCV_RDTIME) + return (ENOSYS); + + *tc = csr_read(time); + return (0); +} + +#pragma weak __vdso_gettimekeep +int +__vdso_gettimekeep(struct vdso_timekeep **tk) +{ + return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk))); +} diff --git a/sys/riscv/include/vdso.h b/sys/riscv/include/vdso.h index 5a8f7f555b50..175c52eedcef 100644 --- a/sys/riscv/include/vdso.h +++ b/sys/riscv/include/vdso.h @@ -31,4 +31,6 @@ #define VDSO_TIMEHANDS_MD \ uint32_t th_res[8]; +#define VDSO_TH_ALGO_RISCV_RDTIME VDSO_TH_ALGO_1 + #endif /* !_MACHINE_VDSO_H_ */ diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index ee80e04e8c31..2a355a977800 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -87,8 +87,8 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR | - SV_RNG_SEED_VER, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP | + SV_ASLR | SV_RNG_SEED_VER, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index 845a2fbed2ff..c75350f4aac5 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -78,6 +79,9 @@ struct riscv_timer_softc { static struct riscv_timer_softc *riscv_timer_sc = NULL; +static uint32_t riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc); + static timecounter_get_t riscv_timer_get_timecount; static struct timecounter riscv_timer_timecount = { @@ -87,6 +91,7 @@ static struct timecounter riscv_timer_timecount = { .tc_counter_mask = ~0u, .tc_frequency = 0, .tc_quality = 1000, + .tc_fill_vdso_timehands = riscv_timer_fill_vdso_timehands, }; static inline uint64_t @@ -301,3 +306,12 @@ DELAY(int usec) } TSEXIT(); } + +static uint32_t +riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc) +{ + vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME; + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (1); +} From owner-dev-commits-src-all@freebsd.org Mon Jul 5 18:36:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6076866162F; Mon, 5 Jul 2021 18:36:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZCt1LvCz3KVB; Mon, 5 Jul 2021 18:36:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id 0SqbmKHBE4bIn0TSjmZg4X; Mon, 05 Jul 2021 18:36:57 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id 0TShmNLip3DJA0TSimRGdG; Mon, 05 Jul 2021 18:36:57 +0000 X-Authority-Analysis: v=2.4 cv=FMjee8ks c=1 sm=1 tr=0 ts=60e35149 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=6fEmDOBOFkKXxzvScQIA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 7974E14F; Mon, 5 Jul 2021 11:36:54 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 165IaspD003460; Mon, 5 Jul 2021 11:36:54 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202107051836.165IaspD003460@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround In-reply-to: <202107051517.165FHsfD012512@gitrepo.freebsd.org> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> Comments: In-reply-to Jessica Clarke message dated "Mon, 05 Jul 2021 15:17:54 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Jul 2021 11:36:54 -0700 X-CMAE-Envelope: MS4xfJ0JJBKb5LT/s+kPTC/Tn7RgX2SelufE2Al/LrG+DG+Sj50k/jKMJ65bqI12LPVtbfgrUE+28tUpXH+maz3GzLsYLrNEJwb2UyXIhl3XPwjzTDxdgGr6 nl8xCRF8RgeNYEVQjSGQAKgC+8Mn8tfI4do6jYMcx5tRMS7x0Uk5NVwiNHlKirkkoJ4kfWwnlDWzq76fUZJUYxAbEjqR6rhqPm8qiWJttFpZU/Cir0K5/uVe kDOu4+3zKmQT3fm81c59OoTpZY/hI2wFQBc4aalyEfwin6W+EsLqtQyXkL7L44zpFqZY64bFyoJuFpwDU+x05XKJAhJq7cLpexwyhUqNylw= X-Rspamd-Queue-Id: 4GJZCt1LvCz3KVB 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:36:58 -0000 In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica Clarke wr ites: > The branch main has been updated by jrtc27: > > URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c1a > 5cb781ad > > commit af433832f7520840c22edd1fe1266c1a5cb781ad > Author: Jessica Clarke > AuthorDate: 2021-07-05 15:15:32 +0000 > Commit: Jessica Clarke > CommitDate: 2021-07-05 15:15:32 +0000 > > geom_label: Remove an old sysinstall(8) workaround > > We removed sysinstall(8) back in 2011, so this workaround should be long > since unnecessary. This workaround can end up breaking cases that are > hit in the real world, such as dd'ing a small pre-built disk image to a > large partition that you intend to grow on first boot and uses a UFS > disk label for / in its /etc/fstab (as the only reliable thing a raw UFS > image can reference). > > Reviewed by: imp, mckusick > Differential Revision: https://reviews.freebsd.org/D30825 > --- > sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ > 1 file changed, 5 insertions(+), 30 deletions(-) > > diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c > index ababbaa4b43a..70d59488d7b6 100644 > --- a/sys/geom/label/g_label_ufs.c > +++ b/sys/geom/label/g_label_ufs.c > @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); > #define G_LABEL_UFS_ID 1 > > /* > - * G_LABEL_UFS_CMP returns true if difference between provider mediasize > - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors > - */ > -#define G_LABEL_UFS_CMP(prov, fsys, size) > \ > - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ > - < G_LABEL_UFS_MAXDIFF ) > -#define G_LABEL_UFS_MAXDIFF 0x100 > - > -/* > - * Try to find a superblock on the provider. If successful, then > - * check that the size in the superblock corresponds to the size > - * of the underlying provider. Finally, look for a volume label > - * and create an appropriate provider based on that. > + * Try to find a superblock on the provider. If successful, look for a volum > e > + * label and create an appropriate provider based on that. > */ > static void > g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, in > t what) > @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *lab > el, size_t size, int wh > return; > } > > - /* > - * Check for magic. We also need to check if file system size > - * is almost equal to providers size, because sysinstall(8) > - * used to bogusly put first partition at offset 0 > - * instead of 16, and glabel/ufs would find file system on slice > - * instead of partition. > - * > - * In addition, media size can be a bit bigger than file system > - * size. For instance, mkuzip can append bytes to align data > - * to large sector size (it improves compression rates). > - */ > - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && > - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > + /* Check for magic. */ > + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { > /* Valid UFS1. */ > - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && > - ( G_LABEL_UFS_CMP(pp, fs, fs_size) > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { > /* Valid UFS2. */ > } else { > goto out; > On one of my machines which uses UFS filesystems (sandbox) also fails: bob# ls /dev/ufs s10-amd64 s13-amd64 s13-amd64e test s11-amd64 s13-amd64a s13-amd64f testa s12-amd64 s13-amd64d s13-i386 bob# mount /alt/s11-amd64/root bob# ls /dev/ufs s10-amd64 s12-amd64 test s11-amd64 s13-i386 testa bob# After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* filesystems become unavailble They share the same fdisk slice, using different bsdlabel partitions within the slice. My laptop zfs pool is on a partition in the same slice as its UFS filesystems. Looks like once a filesystem on a slice has been mounted, the other partitions within the slice are no longer available following this commit. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Jul 5 18:48:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 69765661A4B for ; Mon, 5 Jul 2021 18:48:27 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 4GJZT649G9z3LbQ for ; Mon, 5 Jul 2021 18:48:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f46.google.com with SMTP id i94so23183636wri.4 for ; Mon, 05 Jul 2021 11:48:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=sFmkivGKl9i7qvrYWIG/5lojULGmeZxSGPgkNwQ/BkQ=; b=fWiycStqmPRkFl4GiL0UGjxnT1xO5VPIoLac6KUlGyxqLbv4JAleRb82YpO7ZaVeM0 MY3bPu70MrE0Kp9j0x/edf2mdu4trWbnVeGafsVG3iCJxQuoY3jIp+JWILHuymzYCVAQ LD9/KNj/tNRckeRAz59bQ+06qNPLTH5SJ0ZnRg3ie05lBbJ8Dl9+f8Njt/AsotGSxxYY dzpaHNkHW5NVeEOlXb8jiqHdYn2lpYFmA7tQzf7YDtXqcAs+oA/+rg7w/mEShjN3l6jk nRKwi4w6fWFFU/XFBZt5Z86BToRN0z0MP/+c8LtXkwBnlyBsljC/ucf2KXTut92x3gyQ DNZg== X-Gm-Message-State: AOAM533wKsUxxeogFbITXzAp8rPMzsMEsibMOc3VwVuXmX5Wvp19QIqJ mhfmA0WTWbfckRESX4o5HPsOHA== X-Google-Smtp-Source: ABdhPJwN6BtwZ9uAM8J54DUFEMK7et/3dFBSemQt3maXiB16N/NQrvIhhmeFjZ4Onz5enUAcOCSKvQ== X-Received: by 2002:a5d:64c2:: with SMTP id f2mr5459564wri.158.1625510904458; Mon, 05 Jul 2021 11:48:24 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id d3sm5946136wrx.77.2021.07.05.11.48.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jul 2021 11:48:24 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround From: Jessica Clarke In-Reply-To: <202107051836.165IaspD003460@slippy.cwsent.com> Date: Mon, 5 Jul 2021 19:48:23 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GJZT649G9z3LbQ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.48 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.98)[-0.979]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.221.46:from]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.221.46:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.46:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.46:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:48:27 -0000 On 5 Jul 2021, at 19:36, Cy Schubert wrote: >=20 > In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica=20= > Clarke wr > ites: >> The branch main has been updated by jrtc27: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf433832f7520840c22edd1fe1266c1a= >> 5cb781ad >>=20 >> commit af433832f7520840c22edd1fe1266c1a5cb781ad >> Author: Jessica Clarke >> AuthorDate: 2021-07-05 15:15:32 +0000 >> Commit: Jessica Clarke >> CommitDate: 2021-07-05 15:15:32 +0000 >>=20 >> geom_label: Remove an old sysinstall(8) workaround >>=20 >> We removed sysinstall(8) back in 2011, so this workaround should = be long >> since unnecessary. This workaround can end up breaking cases that = are >> hit in the real world, such as dd'ing a small pre-built disk image = to a >> large partition that you intend to grow on first boot and uses a = UFS >> disk label for / in its /etc/fstab (as the only reliable thing a = raw UFS >> image can reference). >>=20 >> Reviewed by: imp, mckusick >> Differential Revision: https://reviews.freebsd.org/D30825 >> --- >> sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ >> 1 file changed, 5 insertions(+), 30 deletions(-) >>=20 >> diff --git a/sys/geom/label/g_label_ufs.c = b/sys/geom/label/g_label_ufs.c >> index ababbaa4b43a..70d59488d7b6 100644 >> --- a/sys/geom/label/g_label_ufs.c >> +++ b/sys/geom/label/g_label_ufs.c >> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); >> #define G_LABEL_UFS_ID 1 >>=20 >> /* >> - * G_LABEL_UFS_CMP returns true if difference between provider = mediasize >> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors >> - */ >> -#define G_LABEL_UFS_CMP(prov, fsys, size) =09 >> \ >> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize = )) \ >> - < G_LABEL_UFS_MAXDIFF ) >> -#define G_LABEL_UFS_MAXDIFF 0x100 >> - >> -/* >> - * Try to find a superblock on the provider. If successful, then >> - * check that the size in the superblock corresponds to the size >> - * of the underlying provider. Finally, look for a volume label >> - * and create an appropriate provider based on that. >> + * Try to find a superblock on the provider. If successful, look for = a volum >> e >> + * label and create an appropriate provider based on that. >> */ >> static void >> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t = size, in >> t what) >> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, = char *lab >> el, size_t size, int wh >> return; >> } >>=20 >> - /* >> - * Check for magic. We also need to check if file system size >> - * is almost equal to providers size, because sysinstall(8) >> - * used to bogusly put first partition at offset 0 >> - * instead of 16, and glabel/ufs would find file system on slice >> - * instead of partition. >> - * >> - * In addition, media size can be a bit bigger than file system >> - * size. For instance, mkuzip can append bytes to align data >> - * to large sector size (it improves compression rates). >> - */ >> - if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0 && >> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >> + /* Check for magic. */ >> + if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0) { >> /* Valid UFS1. */ >> - } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > 0 = && >> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >> + } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > = 0) { >> /* Valid UFS2. */ >> } else { >> goto out; >>=20 >=20 > On one of my machines which uses UFS filesystems (sandbox) also fails: >=20 > bob# ls /dev/ufs > s10-amd64 s13-amd64 s13-amd64e test > s11-amd64 s13-amd64a s13-amd64f testa > s12-amd64 s13-amd64d s13-i386 > bob# mount /alt/s11-amd64/root > bob# ls /dev/ufs > s10-amd64 s12-amd64 test > s11-amd64 s13-i386 testa > bob#=20 >=20 > After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* = filesystems=20 > become unavailble They share the same fdisk slice, using different=20 > bsdlabel partitions within the slice. >=20 > My laptop zfs pool is on a partition in the same slice as its UFS=20 > filesystems. Looks like once a filesystem on a slice has been mounted, = the=20 > other partitions within the slice are no longer available following = this=20 > commit. Hm, what does bsdlabel on the disk say? My guess is your disk is set up in the bogus manner mentioned in that comment. Is it an old machine installed by sysinstall(8)? Jess From owner-dev-commits-src-all@freebsd.org Mon Jul 5 18:51:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65D5B661B8B; Mon, 5 Jul 2021 18:51:55 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZY63cXGz3Lp4; Mon, 5 Jul 2021 18:51:54 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id 0Pp9m7Q4gFRDp0Th6mXpxM; Mon, 05 Jul 2021 18:51:48 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id 0Th5mNROR3DJA0Th6mRJWy; Mon, 05 Jul 2021 18:51:48 +0000 X-Authority-Analysis: v=2.4 cv=FMjee8ks c=1 sm=1 tr=0 ts=60e354c4 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=yHHbRozUl0hyjb4n39YA:9 a=CjuIK1q_8ugA:10 a=3OlYsrKNJUQA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0BE2315E; Mon, 5 Jul 2021 11:51:47 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 165IpkRs003653; Mon, 5 Jul 2021 11:51:46 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202107051851.165IpkRs003653@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: Jessica Clarke , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround In-reply-to: <202107051836.165IaspD003460@slippy.cwsent.com> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Mon, 05 Jul 2021 11:36:54 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Jul 2021 11:51:46 -0700 X-CMAE-Envelope: MS4xfK0IEFKCTr+qxpY3Lqqs8JPKz5zYQ3xZCc/OmIoDrjrAv1A3MkihXW9hZbek5MNSTIQ95GCSXnF6QYuBJyX7EVkkIYQaibva41cVAjC9PVeCqPTE8JG6 HF3rhv956eHVn+9RWeTk/Lt1nyjnZKiA44QBNbsCuaB9dPDvhP42ewpo+httaHzfEUtpkV6D1qi+mqZERvbjxNRbgmALgGfL/f+2xSr/5DVSEDKgPD0Umevc wt29yP11xneNi8mAoROOVVWN5RSMVkUPDF62EfolsUD99uGj+iTWNP0sxXQ31szF/kD4iOq4OqWQ8yN4oNExlg9oDheD5n46B8vMN1etFxk= X-Rspamd-Queue-Id: 4GJZY63cXGz3Lp4 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 3.97.99.32) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-0.51 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_SHORT(-0.41)[-0.412]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[3.97.99.32:from]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; R_DKIM_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[70.66.148.124:received]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998]; RCVD_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.50)[-0.504]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[3.97.99.32:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:51:55 -0000 In message <202107051836.165IaspD003460@slippy.cwsent.com>, Cy Schubert writes: > In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica > Clarke wr > ites: > > The branch main has been updated by jrtc27: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c > 1a > > 5cb781ad > > > > commit af433832f7520840c22edd1fe1266c1a5cb781ad > > Author: Jessica Clarke > > AuthorDate: 2021-07-05 15:15:32 +0000 > > Commit: Jessica Clarke > > CommitDate: 2021-07-05 15:15:32 +0000 > > > > geom_label: Remove an old sysinstall(8) workaround > > > > We removed sysinstall(8) back in 2011, so this workaround should be lon > g > > since unnecessary. This workaround can end up breaking cases that are > > hit in the real world, such as dd'ing a small pre-built disk image to a > > large partition that you intend to grow on first boot and uses a UFS > > disk label for / in its /etc/fstab (as the only reliable thing a raw UF > S > > image can reference). > > > > Reviewed by: imp, mckusick > > Differential Revision: https://reviews.freebsd.org/D30825 > > --- > > sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ > > 1 file changed, 5 insertions(+), 30 deletions(-) > > > > diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c > > index ababbaa4b43a..70d59488d7b6 100644 > > --- a/sys/geom/label/g_label_ufs.c > > +++ b/sys/geom/label/g_label_ufs.c > > @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); > > #define G_LABEL_UFS_ID 1 > > > > /* > > - * G_LABEL_UFS_CMP returns true if difference between provider mediasize > > - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors > > - */ > > -#define G_LABEL_UFS_CMP(prov, fsys, size) > > \ > > - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ > > - < G_LABEL_UFS_MAXDIFF ) > > -#define G_LABEL_UFS_MAXDIFF 0x100 > > - > > -/* > > - * Try to find a superblock on the provider. If successful, then > > - * check that the size in the superblock corresponds to the size > > - * of the underlying provider. Finally, look for a volume label > > - * and create an appropriate provider based on that. > > + * Try to find a superblock on the provider. If successful, look for a vol > um > > e > > + * label and create an appropriate provider based on that. > > */ > > static void > > g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, > in > > t what) > > @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *l > ab > > el, size_t size, int wh > > return; > > } > > > > - /* > > - * Check for magic. We also need to check if file system size > > - * is almost equal to providers size, because sysinstall(8) > > - * used to bogusly put first partition at offset 0 > > - * instead of 16, and glabel/ufs would find file system on slice > > - * instead of partition. > > - * > > - * In addition, media size can be a bit bigger than file system > > - * size. For instance, mkuzip can append bytes to align data > > - * to large sector size (it improves compression rates). > > - */ > > - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && > > - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) > > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > > + /* Check for magic. */ > > + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { > > /* Valid UFS1. */ > > - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && > > - ( G_LABEL_UFS_CMP(pp, fs, fs_size) > > - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > > + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { > > /* Valid UFS2. */ > > } else { > > goto out; > > > > On one of my machines which uses UFS filesystems (sandbox) also fails: > > bob# ls /dev/ufs > s10-amd64 s13-amd64 s13-amd64e test > s11-amd64 s13-amd64a s13-amd64f testa > s12-amd64 s13-amd64d s13-i386 > bob# mount /alt/s11-amd64/root > bob# ls /dev/ufs > s10-amd64 s12-amd64 test > s11-amd64 s13-i386 testa > bob# > > After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* filesystems > become unavailble They share the same fdisk slice, using different > bsdlabel partitions within the slice. > > My laptop zfs pool is on a partition in the same slice as its UFS > filesystems. Looks like once a filesystem on a slice has been mounted, the > other partitions within the slice are no longer available following this > commit. Ok, I see the problem. The two affected machines have UFS partitions at offset 0 of their respective slices. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Jul 5 18:56:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1D2E7661DEA; Mon, 5 Jul 2021 18:56:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJZfm5Sscz3N91; Mon, 5 Jul 2021 18:56:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id 0Ovcm7MkLFRDp0TlwmXrHt; Mon, 05 Jul 2021 18:56:48 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id 0TlumNTfH3DJA0TlvmRKWQ; Mon, 05 Jul 2021 18:56:48 +0000 X-Authority-Analysis: v=2.4 cv=FMjee8ks c=1 sm=1 tr=0 ts=60e355f0 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=e_q4qTt1xDgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=r3DTfxH57WFLSE7fR2kA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 60171170; Mon, 5 Jul 2021 11:56:46 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 165IukLl003702; Mon, 5 Jul 2021 11:56:46 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202107051856.165IukLl003702@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: Cy Schubert , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround In-reply-to: References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> Comments: In-reply-to Jessica Clarke message dated "Mon, 05 Jul 2021 19:48:23 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 05 Jul 2021 11:56:46 -0700 X-CMAE-Envelope: MS4xfJwRtzIMW1f5a0PeIJnSlZDQ0MPDEVMr+cEDuhbNWxRxdXWfMdBJ6Ru3B/wcDj5m1zhSYyTe30expSvuHHSklySSZhQ5p864l0BRapd5Wnux+4uEkn8Q kxeoF46qjy2BQaKUA/jyXowH5zFpLU06132S2OMzwDRLYGH0yE23E7sefVVaU/fy01RbdG8SmV9j4+IYNdqX45yfd44REN1j9ake3+Z0SL3NdzNBi5Gswdqw 7OMvBKZSE28CrPuqYQPtJtuMpa4BWK/8oi7Xk/g3BXTQb1sFsoJRDif81Fas3X2fRi5dtEJATEbWo8I9IPtIoWNSwezd5tv7Ia92QpVWmoM= X-Rspamd-Queue-Id: 4GJZfm5Sscz3N91 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 18:56:49 -0000 In message , Jessica Clarke w rites: > On 5 Jul 2021, at 19:36, Cy Schubert wrote: > > > > In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, Jessica > > Clarke wr > > ites: > >> The branch main has been updated by jrtc27: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266 > c1a > >> 5cb781ad > >> > >> commit af433832f7520840c22edd1fe1266c1a5cb781ad > >> Author: Jessica Clarke > >> AuthorDate: 2021-07-05 15:15:32 +0000 > >> Commit: Jessica Clarke > >> CommitDate: 2021-07-05 15:15:32 +0000 > >> > >> geom_label: Remove an old sysinstall(8) workaround > >> > >> We removed sysinstall(8) back in 2011, so this workaround should be lon > g > >> since unnecessary. This workaround can end up breaking cases that are > >> hit in the real world, such as dd'ing a small pre-built disk image to a > >> large partition that you intend to grow on first boot and uses a UFS > >> disk label for / in its /etc/fstab (as the only reliable thing a raw UF > S > >> image can reference). > >> > >> Reviewed by: imp, mckusick > >> Differential Revision: https://reviews.freebsd.org/D30825 > >> --- > >> sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ > >> 1 file changed, 5 insertions(+), 30 deletions(-) > >> > >> diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c > >> index ababbaa4b43a..70d59488d7b6 100644 > >> --- a/sys/geom/label/g_label_ufs.c > >> +++ b/sys/geom/label/g_label_ufs.c > >> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); > >> #define G_LABEL_UFS_ID 1 > >> > >> /* > >> - * G_LABEL_UFS_CMP returns true if difference between provider mediasize > >> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors > >> - */ > >> -#define G_LABEL_UFS_CMP(prov, fsys, size) > >> \ > >> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ > >> - < G_LABEL_UFS_MAXDIFF ) > >> -#define G_LABEL_UFS_MAXDIFF 0x100 > >> - > >> -/* > >> - * Try to find a superblock on the provider. If successful, then > >> - * check that the size in the superblock corresponds to the size > >> - * of the underlying provider. Finally, look for a volume label > >> - * and create an appropriate provider based on that. > >> + * Try to find a superblock on the provider. If successful, look for a vo > lum > >> e > >> + * label and create an appropriate provider based on that. > >> */ > >> static void > >> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, > in > >> t what) > >> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * > lab > >> el, size_t size, int wh > >> return; > >> } > >> > >> - /* > >> - * Check for magic. We also need to check if file system size > >> - * is almost equal to providers size, because sysinstall(8) > >> - * used to bogusly put first partition at offset 0 > >> - * instead of 16, and glabel/ufs would find file system on slice > >> - * instead of partition. > >> - * > >> - * In addition, media size can be a bit bigger than file system > >> - * size. For instance, mkuzip can append bytes to align data > >> - * to large sector size (it improves compression rates). > >> - */ > >> - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && > >> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) > >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > >> + /* Check for magic. */ > >> + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { > >> /* Valid UFS1. */ > >> - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && > >> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) > >> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { > >> + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { > >> /* Valid UFS2. */ > >> } else { > >> goto out; > >> > > > > On one of my machines which uses UFS filesystems (sandbox) also fails: > > > > bob# ls /dev/ufs > > s10-amd64 s13-amd64 s13-amd64e test > > s11-amd64 s13-amd64a s13-amd64f testa > > s12-amd64 s13-amd64d s13-i386 > > bob# mount /alt/s11-amd64/root > > bob# ls /dev/ufs > > s10-amd64 s12-amd64 test > > s11-amd64 s13-i386 testa > > bob# > > > > After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* filesystems > > become unavailble They share the same fdisk slice, using different > > bsdlabel partitions within the slice. > > > > My laptop zfs pool is on a partition in the same slice as its UFS > > filesystems. Looks like once a filesystem on a slice has been mounted, the > > other partitions within the slice are no longer available following this > > commit. > > Hm, what does bsdlabel on the disk say? My guess is your disk is set up > in the bogus manner mentioned in that comment. Is it an old machine > installed by sysinstall(8)? A little more investigation shows that on the two affected machines, UFS partitions are at offset 0 of their respective slices. For legacy environments this will require some kind of workaround or boot off a rescue disk (which I do have) to dump/recreate/restore the partitions at an offset that is not zero. The problem is quite logical. Doing the work to recreate the partitions doesn't bother me but other people may trip across this. Your call. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Jul 5 19:58:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3FBB96626A3 for ; Mon, 5 Jul 2021 19:58:58 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 4GJc2T1PZ5z3mLF for ; Mon, 5 Jul 2021 19:58:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f41.google.com with SMTP id t15so19992516wry.11 for ; Mon, 05 Jul 2021 12:58:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=OXc8QeWAZNBwt896YzoLowptHdApb19pMW2mxtEV8mg=; b=Lo0NKNjchetoN3jR4FdjBgEXgNycTiST0OkgC7qP7HbmjrShiq1jReJXA5oGtRf915 qijG5BilVHFpdHlaGAeKyH3q+C+UOYTHuc/LyNgOkvEJop03q16fzAuNQvFpwdkokwyX FfFkVKFhK0bE5nd6xfair9O0hVhHY9SezTsD/qTC3B86VA4A38EEygZED8fEcN2Ti4cS /K5R6lNmwVLZHN79wf1xMGg+FFb8GoINdt9xqFMrZuxAIA/KaC1hZ9dRhyttyjQZJFsP grC9Q+SEB87R1QyZl04va4LB8jCe82lDcyEoHFp6UNNSakQrUL8H30PxcAJ9j544ZG2a ZTJQ== X-Gm-Message-State: AOAM53167W3ydY52QKYj10B1Erp0cyGW+z4zvlCKNwLsFRnVuxoxnsLu xRkZFPJNjsg2lKLLV2y1xj0Oj/crsYl8sg== X-Google-Smtp-Source: ABdhPJwBA5dl97ixRn90rtzZY99flgTDm5a8H8BqwYZGHMao6n3GjVr2Y0Sa2+UGxuqV3DeGS0PAaw== X-Received: by 2002:adf:de92:: with SMTP id w18mr6830300wrl.42.1625515135755; Mon, 05 Jul 2021 12:58:55 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id f1sm4736826wri.74.2021.07.05.12.58.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jul 2021 12:58:55 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround From: Jessica Clarke In-Reply-To: <202107051856.165IukLl003702@slippy.cwsent.com> Date: Mon, 5 Jul 2021 20:58:53 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <11BB2019-EAE3-40A6-A3B1-EA3241AA91BF@freebsd.org> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> <202107051856.165IukLl003702@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GJc2T1PZ5z3mLF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.46 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.96)[-0.963]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.221.41:from]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.221.41:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.41:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.41:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 19:58:58 -0000 On 5 Jul 2021, at 19:56, Cy Schubert wrote: >=20 > In message , Jessica=20= > Clarke w > rites: >> On 5 Jul 2021, at 19:36, Cy Schubert = wrote: >>>=20 >>> In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, = Jessica=20 >>> Clarke wr >>> ites: >>>> The branch main has been updated by jrtc27: >>>>=20 >>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf433832f7520840c22edd1fe1266 >> c1a >>>> 5cb781ad >>>>=20 >>>> commit af433832f7520840c22edd1fe1266c1a5cb781ad >>>> Author: Jessica Clarke >>>> AuthorDate: 2021-07-05 15:15:32 +0000 >>>> Commit: Jessica Clarke >>>> CommitDate: 2021-07-05 15:15:32 +0000 >>>>=20 >>>> geom_label: Remove an old sysinstall(8) workaround >>>>=20 >>>> We removed sysinstall(8) back in 2011, so this workaround should = be lon >> g >>>> since unnecessary. This workaround can end up breaking cases that = are >>>> hit in the real world, such as dd'ing a small pre-built disk = image to a >>>> large partition that you intend to grow on first boot and uses a = UFS >>>> disk label for / in its /etc/fstab (as the only reliable thing a = raw UF >> S >>>> image can reference). >>>>=20 >>>> Reviewed by: imp, mckusick >>>> Differential Revision: https://reviews.freebsd.org/D30825 >>>> --- >>>> sys/geom/label/g_label_ufs.c | 35 = +++++------------------------------ >>>> 1 file changed, 5 insertions(+), 30 deletions(-) >>>>=20 >>>> diff --git a/sys/geom/label/g_label_ufs.c = b/sys/geom/label/g_label_ufs.c >>>> index ababbaa4b43a..70d59488d7b6 100644 >>>> --- a/sys/geom/label/g_label_ufs.c >>>> +++ b/sys/geom/label/g_label_ufs.c >>>> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); >>>> #define G_LABEL_UFS_ID 1 >>>>=20 >>>> /* >>>> - * G_LABEL_UFS_CMP returns true if difference between provider = mediasize >>>> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors >>>> - */ >>>> -#define G_LABEL_UFS_CMP(prov, fsys, size) =09 >>>> \ >>>> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize = )) \ >>>> - < G_LABEL_UFS_MAXDIFF ) >>>> -#define G_LABEL_UFS_MAXDIFF 0x100 >>>> - >>>> -/* >>>> - * Try to find a superblock on the provider. If successful, then >>>> - * check that the size in the superblock corresponds to the size >>>> - * of the underlying provider. Finally, look for a volume label >>>> - * and create an appropriate provider based on that. >>>> + * Try to find a superblock on the provider. If successful, look = for a vo >> lum >>>> e >>>> + * label and create an appropriate provider based on that. >>>> */ >>>> static void >>>> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t = size,=20 >> in >>>> t what) >>>> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, = char * >> lab >>>> el, size_t size, int wh >>>> return; >>>> } >>>>=20 >>>> - /* >>>> - * Check for magic. We also need to check if file system size >>>> - * is almost equal to providers size, because sysinstall(8) >>>> - * used to bogusly put first partition at offset 0 >>>> - * instead of 16, and glabel/ufs would find file system on slice >>>> - * instead of partition. >>>> - * >>>> - * In addition, media size can be a bit bigger than file system >>>> - * size. For instance, mkuzip can append bytes to align data >>>> - * to large sector size (it improves compression rates). >>>> - */ >>>> - if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0 && >>>> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) >>>> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >>>> + /* Check for magic. */ >>>> + if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0) { >>>> /* Valid UFS1. */ >>>> - } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > 0 = && >>>> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) >>>> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >>>> + } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > = 0) { >>>> /* Valid UFS2. */ >>>> } else { >>>> goto out; >>>>=20 >>>=20 >>> On one of my machines which uses UFS filesystems (sandbox) also = fails: >>>=20 >>> bob# ls /dev/ufs >>> s10-amd64 s13-amd64 s13-amd64e test >>> s11-amd64 s13-amd64a s13-amd64f testa >>> s12-amd64 s13-amd64d s13-i386 >>> bob# mount /alt/s11-amd64/root >>> bob# ls /dev/ufs >>> s10-amd64 s12-amd64 test >>> s11-amd64 s13-i386 testa >>> bob#=20 >>>=20 >>> After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* = filesystems=20 >>> become unavailble They share the same fdisk slice, using different=20= >>> bsdlabel partitions within the slice. >>>=20 >>> My laptop zfs pool is on a partition in the same slice as its UFS=20 >>> filesystems. Looks like once a filesystem on a slice has been = mounted, the=20 >>> other partitions within the slice are no longer available following = this=20 >>> commit. >>=20 >> Hm, what does bsdlabel on the disk say? My guess is your disk is set = up >> in the bogus manner mentioned in that comment. Is it an old machine >> installed by sysinstall(8)? >=20 > A little more investigation shows that on the two affected machines, = UFS=20 > partitions are at offset 0 of their respective slices. For legacy=20 > environments this will require some kind of workaround or boot off a = rescue=20 > disk (which I do have) to dump/recreate/restore the partitions at an = offset=20 > that is not zero. The problem is quite logical. >=20 > Doing the work to recreate the partitions doesn't bother me but other=20= > people may trip across this. Your call. How about something like D31068? Jess From owner-dev-commits-src-all@freebsd.org Tue Jul 6 02:09:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0B27466E670; Tue, 6 Jul 2021 02:09: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 4GJmGV6j13z3H8s; Tue, 6 Jul 2021 02:09: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 CAF9011167; Tue, 6 Jul 2021 02:09: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 16629sUG076821; Tue, 6 Jul 2021 02:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16629sEk076820; Tue, 6 Jul 2021 02:09:54 GMT (envelope-from git) Date: Tue, 6 Jul 2021 02:09:54 GMT Message-Id: <202107060209.16629sEk076820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: e41fde3ed71c - main - On a failed fcmpset don't pointlessly repeat tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e41fde3ed71c1e4fce81eac002c9f5b0926e6c49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 02:09:55 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=e41fde3ed71c1e4fce81eac002c9f5b0926e6c49 commit e41fde3ed71c1e4fce81eac002c9f5b0926e6c49 Author: Alan Cox AuthorDate: 2021-07-04 05:20:42 +0000 Commit: Alan Cox CommitDate: 2021-07-06 02:07:40 +0000 On a failed fcmpset don't pointlessly repeat tests In a few places, on a failed compare-and-set, both the amd64 pmap and the arm64 pmap repeat tests on bits that won't change state while the pmap is locked. Eliminate some of these unnecessary tests. Reviewed by: andrew, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31014 --- sys/amd64/amd64/pmap.c | 11 +++++------ sys/arm64/arm64/pmap.c | 15 ++++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index ea017b8a61a8..5e0b6d76ae0a 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -8459,7 +8459,7 @@ pmap_remove_write(vm_page_t m) pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(VM_PAGE_TO_PHYS(m)); rw_wlock(lock); -retry_pv_loop: +retry: TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -8469,7 +8469,7 @@ retry_pv_loop: rw_wlock(lock); if (pvh_gen != pvh->pv_gen) { PMAP_UNLOCK(pmap); - goto retry_pv_loop; + goto retry; } } PG_RW = pmap_rw_bit(pmap); @@ -8493,7 +8493,7 @@ retry_pv_loop: if (pvh_gen != pvh->pv_gen || md_gen != m->md.pv_gen) { PMAP_UNLOCK(pmap); - goto retry_pv_loop; + goto retry; } } PG_M = pmap_modified_bit(pmap); @@ -8503,12 +8503,11 @@ retry_pv_loop: ("pmap_remove_write: found a 2mpage in page %p's pv list", m)); pte = pmap_pde_to_pte(pde, pv->pv_va); -retry: oldpte = *pte; if (oldpte & PG_RW) { - if (!atomic_cmpset_long(pte, oldpte, oldpte & + while (!atomic_fcmpset_long(pte, &oldpte, oldpte & ~(PG_RW | PG_M))) - goto retry; + cpu_spinwait(); if ((oldpte & PG_M) != 0) vm_page_dirty(m); pmap_invalidate_page(pmap, pv->pv_va); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 79b9d20231aa..bf476490b6be 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3223,10 +3223,12 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pt_entry_t mask, * Return if the L2 entry already has the desired access restrictions * in place. */ -retry: if ((old_l2 & mask) == nbits) return; + while (!atomic_fcmpset_64(l2, &old_l2, (old_l2 & ~mask) | nbits)) + cpu_spinwait(); + /* * When a dirty read/write superpage mapping is write protected, * update the dirty field of each of the superpage's constituent 4KB @@ -3240,9 +3242,6 @@ retry: vm_page_dirty(mt); } - if (!atomic_fcmpset_64(l2, &old_l2, (old_l2 & ~mask) | nbits)) - goto retry; - /* * Since a promotion must break the 4KB page mappings before making * the 2MB page mapping, a pmap_invalidate_page() suffices. @@ -3334,7 +3333,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) for (l3p = pmap_l2_to_l3(l2, sva); sva != va_next; l3p++, sva += L3_SIZE) { l3 = pmap_load(l3p); -retry: + /* * Go to the next L3 entry if the current one is * invalid or already has the desired access @@ -3351,6 +3350,10 @@ retry: continue; } + while (!atomic_fcmpset_64(l3p, &l3, (l3 & ~mask) | + nbits)) + cpu_spinwait(); + /* * When a dirty read/write mapping is write protected, * update the page's dirty field. @@ -3360,8 +3363,6 @@ retry: pmap_pte_dirty(pmap, l3)) vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); - if (!atomic_fcmpset_64(l3p, &l3, (l3 & ~mask) | nbits)) - goto retry; if (va == va_next) va = sva; } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 03:13:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C2F8766F038; Tue, 6 Jul 2021 03:13: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 4GJngk55BCz3PJQ; Tue, 6 Jul 2021 03:13: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 959B711CED; Tue, 6 Jul 2021 03:13: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 1663DMrH070036; Tue, 6 Jul 2021 03:13:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1663DMSJ070035; Tue, 6 Jul 2021 03:13:22 GMT (envelope-from git) Date: Tue, 6 Jul 2021 03:13:22 GMT Message-Id: <202107060313.1663DMSJ070035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: e3bcd07d834d - main - nvme(4): Report NPWA before NPWG as stripesize. 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/main X-Git-Reftype: branch X-Git-Commit: e3bcd07d834def94dcf570ac7350ca2c454ebf10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 03:13:22 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e3bcd07d834def94dcf570ac7350ca2c454ebf10 commit e3bcd07d834def94dcf570ac7350ca2c454ebf10 Author: Alexander Motin AuthorDate: 2021-07-06 02:19:48 +0000 Commit: Alexander Motin CommitDate: 2021-07-06 03:13:15 +0000 nvme(4): Report NPWA before NPWG as stripesize. New Samsung 980 SSDs report Namespace Preferred Write Alignment of 8 (4KB) and Namespace Preferred Write Granularity of 32 (16KB). My quick tests show that 16KB is a minimal sequential write size when the SSD reaches peak IOPS, so writing much less is very slow. But writing slightly less or slightly more does not change much, so it seems not so much a size granularity as minimum I/O size. Thinking about different stripesize consumers: - Partition alignment should be based on NPWA by definition. - ZFS ashift in part of forcing alignment of all I/Os should also be based on NPWA. In part of forcing size granularity, if really needed, it may be set to NPWG, but too big value can make ZFS too space-inefficient, and the 16KB is actually the biggest supported value there now. - ZFS recordsize/volblocksize could potentially be tuned up toward NPWG to work as I/O size granularity, but enabled compression makes it too fuzzy. And those are normally user-configurable things. - ZFS I/O aggregation code could definitely use Optimal Write Size value and may be NPWG, but we don't have fields in GEOM now to report the minimal and optimal I/O sizes, and even maximal is not reported outside GEOM DISK to be used by ZFS. MFC after: 1 week --- sys/dev/nvme/nvme_ns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 82ab48efa826..8f97b08b88f4 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -231,10 +231,15 @@ nvme_ns_get_data(struct nvme_namespace *ns) uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns) { + uint32_t ss; if (((ns->data.nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & - NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && ns->data.npwg != 0) { - return ((ns->data.npwg + 1) * nvme_ns_get_sector_size(ns)); + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0) { + ss = nvme_ns_get_sector_size(ns); + if (ns->data.npwa != 0) + return ((ns->data.npwa + 1) * ss); + else if (ns->data.npwg != 0) + return ((ns->data.npwg + 1) * ss); } return (ns->boundary); } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 06:56:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8778A65105A; Tue, 6 Jul 2021 06:56: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 4GJtdF3Jfwz4Xm0; Tue, 6 Jul 2021 06:56: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 5907D1522D; Tue, 6 Jul 2021 06:56: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 1666uXuv062909; Tue, 6 Jul 2021 06:56:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1666uX0s062908; Tue, 6 Jul 2021 06:56:33 GMT (envelope-from git) Date: Tue, 6 Jul 2021 06:56:33 GMT Message-Id: <202107060656.1666uX0s062908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 3423d44cd152 - stable/13 - libalias: tidy up housekeeping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3423d44cd152da8e55763f5c6a8b88070316f8e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 06:56:33 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=3423d44cd152da8e55763f5c6a8b88070316f8e4 commit 3423d44cd152da8e55763f5c6a8b88070316f8e4 Author: Lutz Donnerhacke AuthorDate: 2021-05-15 15:35:36 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 06:55:52 +0000 libalias: tidy up housekeeping Replace current expensive, but sparsly called housekeeping by a single, repetive action. This is part of a larger restructure of libalias in order to switch to more efficient data structures. The whole restructure process is split into 15 reviews to ease reviewing. All those steps will be squashed into a single commit for MFC in order to hide the intermediate states from production systems. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30277 (cherry picked from commit 294799c6b081faece556a5010a4f51552e131c2f) --- sys/netinet/libalias/alias_db.c | 104 ++++++++++++++++--------------------- sys/netinet/libalias/alias_local.h | 6 +-- 2 files changed, 47 insertions(+), 63 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 0273cc84773d..1b1cddc0b6fd 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -182,11 +182,6 @@ static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); near relevant functions or structs) */ -/* Parameters used for cleanup of expired links */ -/* NOTE: ALIAS_CLEANUP_INTERVAL_SECS must be less then LINK_TABLE_OUT_SIZE */ -#define ALIAS_CLEANUP_INTERVAL_SECS 64 -#define ALIAS_CLEANUP_MAX_SPOKES (LINK_TABLE_OUT_SIZE/5) - /* Timeouts (in seconds) for different link types */ #define ICMP_EXPIRE_TIME 60 #define UDP_EXPIRE_TIME 60 @@ -329,6 +324,7 @@ struct alias_link { /* Linked list of pointers for input and output lookup tables */ LIST_ENTRY (alias_link) list_out; LIST_ENTRY (alias_link) list_in; + TAILQ_ENTRY (alias_link) list_expire; /* Auxiliary data */ union { char *frag_ptr; @@ -510,7 +506,7 @@ Port Allocation: Link creation and deletion: CleanupAliasData() - remove all link chains from lookup table - IncrementalCleanup() - look for stale links in a single chain + CleanupLink() - look for a stale link DeleteLink() - remove link AddLink() - add link ReLink() - change link @@ -529,8 +525,8 @@ static int GetNewPort(struct libalias *, struct alias_link *, int); static u_short GetSocket(struct libalias *, u_short, int *, int); #endif static void CleanupAliasData(struct libalias *); -static void IncrementalCleanup(struct libalias *); -static void DeleteLink(struct alias_link *); +static void CleanupLink(struct libalias *, struct alias_link **); +static void DeleteLink(struct alias_link **); static struct alias_link * ReLink(struct alias_link *, @@ -807,41 +803,38 @@ FindNewPortGroup(struct libalias *la, static void CleanupAliasData(struct libalias *la) { - struct alias_link *lnk; - int i; + struct alias_link *lnk, *lnk_tmp; LIBALIAS_LOCK_ASSERT(la); - for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) { - lnk = LIST_FIRST(&la->linkTableOut[i]); - while (lnk != NULL) { - struct alias_link *link_next = LIST_NEXT(lnk, list_out); - DeleteLink(lnk); - lnk = link_next; - } - } - la->cleanupIndex = 0; + /* permanent entries may stay */ + TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, list_expire, lnk_tmp) + DeleteLink(&lnk); } static void -IncrementalCleanup(struct libalias *la) +CleanupLink(struct libalias *la, struct alias_link **lnk) { - struct alias_link *lnk, *lnk_tmp; - LIBALIAS_LOCK_ASSERT(la); - LIST_FOREACH_SAFE(lnk, &la->linkTableOut[la->cleanupIndex++], - list_out, lnk_tmp) { - if (la->timeStamp - lnk->timestamp > lnk->expire_time) - DeleteLink(lnk); + + if (lnk == NULL || *lnk == NULL) + return; + + if (la->timeStamp - (*lnk)->timestamp > (*lnk)->expire_time) { + DeleteLink(lnk); + if ((*lnk) == NULL) + return; } - if (la->cleanupIndex == LINK_TABLE_OUT_SIZE) - la->cleanupIndex = 0; + /* move to end, swap may fail on a single entry list */ + TAILQ_REMOVE(&la->checkExpire, (*lnk), list_expire); + TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), list_expire); } static void -DeleteLink(struct alias_link *lnk) +DeleteLink(struct alias_link **plnk) { + struct alias_link *lnk = *plnk; struct libalias *la = lnk->la; LIBALIAS_LOCK_ASSERT(la); @@ -869,6 +862,10 @@ DeleteLink(struct alias_link *lnk) /* Adjust input table pointers */ LIST_REMOVE(lnk, list_in); + + /* remove from housekeeping */ + TAILQ_REMOVE(&la->checkExpire, lnk, list_expire); + #ifndef NO_USE_SOCKETS /* Close socket, if one has been allocated */ if (lnk->sockfd != -1) { @@ -908,6 +905,7 @@ DeleteLink(struct alias_link *lnk) /* Free memory */ free(lnk); + *plnk = NULL; /* Write statistics, if logging enabled */ if (la->packetAliasMode & PKT_ALIAS_LOG) { @@ -1039,6 +1037,9 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, /* Set up pointers for input lookup table */ start_point = StartPointIn(alias_addr, lnk->alias_port, link_type); LIST_INSERT_HEAD(&la->linkTableIn[start_point], lnk, list_in); + + /* Include the element into the housekeeping list */ + TAILQ_INSERT_TAIL(&la->checkExpire, lnk, list_expire); } else { #ifdef LIBALIAS_DEBUG fprintf(stderr, "PacketAlias/AddLink(): "); @@ -1079,7 +1080,7 @@ ReLink(struct alias_link *old_lnk, PunchFWHole(new_lnk); } #endif - DeleteLink(old_lnk); + DeleteLink(&old_lnk); return (new_lnk); } @@ -1102,12 +1103,14 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, lnk->src_port == src_port && lnk->dst_port == dst_port && lnk->link_type == link_type && - lnk->server == NULL) { - lnk->timestamp = la->timeStamp; + lnk->server == NULL) break; - } } + CleanupLink(la, &lnk); + if (lnk != NULL) + lnk->timestamp = la->timeStamp; + /* Search for partially specified links. */ if (lnk == NULL && replace_partial_links) { if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY) { @@ -1235,6 +1238,7 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, } } + CleanupLink(la, &lnk_fully_specified); if (lnk_fully_specified != NULL) { lnk_fully_specified->timestamp = la->timeStamp; lnk = lnk_fully_specified; @@ -1572,6 +1576,7 @@ FindPptpOutByCallId(struct libalias *la, struct in_addr src_addr, lnk->src_port == src_call_id) break; + CleanupLink(la, &lnk); return (lnk); } @@ -1592,6 +1597,7 @@ FindPptpOutByPeerCallId(struct libalias *la, struct in_addr src_addr, lnk->dst_port == dst_call_id) break; + CleanupLink(la, &lnk); return (lnk); } @@ -1612,6 +1618,7 @@ FindPptpInByCallId(struct libalias *la, struct in_addr dst_addr, lnk->dst_port == dst_call_id) break; + CleanupLink(la, &lnk); return (lnk); } @@ -2038,7 +2045,7 @@ SetExpire(struct alias_link *lnk, int expire) { if (expire == 0) { lnk->flags &= ~LINK_PERMANENT; - DeleteLink(lnk); + DeleteLink(&lnk); } else if (expire == -1) { lnk->flags |= LINK_PERMANENT; } else if (expire > 0) { @@ -2094,7 +2101,7 @@ SetDestCallId(struct alias_link *lnk, u_int16_t cid) void HouseKeeping(struct libalias *la) { - int i, n; + struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); #ifndef _KERNEL struct timeval tv; #endif @@ -2111,25 +2118,7 @@ HouseKeeping(struct libalias *la) gettimeofday(&tv, NULL); la->timeStamp = tv.tv_sec; #endif - - /* Compute number of spokes (output table link chains) to cover */ - n = LINK_TABLE_OUT_SIZE * (la->timeStamp - la->lastCleanupTime); - n /= ALIAS_CLEANUP_INTERVAL_SECS; - - /* Handle different cases */ - if (n > 0) { - if (n > ALIAS_CLEANUP_MAX_SPOKES) - n = ALIAS_CLEANUP_MAX_SPOKES; - la->lastCleanupTime = la->timeStamp; - for (i = 0; i < n; i++) - IncrementalCleanup(la); - } else if (n < 0) { -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/HouseKeeping(): "); - fprintf(stderr, "something unexpected in time values\n"); -#endif - la->lastCleanupTime = la->timeStamp; - } + CleanupLink(la, &lnk); } /* Init the log file and enable logging */ @@ -2356,7 +2345,7 @@ LibAliasRedirectDelete(struct libalias *la, struct alias_link *lnk) { LIBALIAS_LOCK(la); la->deleteAllLinks = 1; - DeleteLink(lnk); + DeleteLink(&lnk); la->deleteAllLinks = 0; LIBALIAS_UNLOCK(la); } @@ -2426,17 +2415,16 @@ LibAliasInit(struct libalias *la) #ifdef _KERNEL la->timeStamp = time_uptime; - la->lastCleanupTime = time_uptime; #else gettimeofday(&tv, NULL); la->timeStamp = tv.tv_sec; - la->lastCleanupTime = tv.tv_sec; #endif for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) LIST_INIT(&la->linkTableOut[i]); for (i = 0; i < LINK_TABLE_IN_SIZE; i++) LIST_INIT(&la->linkTableIn[i]); + TAILQ_INIT(&la->checkExpire); #ifdef _KERNEL AliasSctpInit(la); #endif @@ -2466,8 +2454,6 @@ LibAliasInit(struct libalias *la) la->fragmentPtrLinkCount = 0; la->sockCount = 0; - la->cleanupIndex = 0; - la->packetAliasMode = PKT_ALIAS_SAME_PORTS #ifndef NO_USE_SOCKETS | PKT_ALIAS_USE_SOCKETS diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index 61cd30737ce5..fcdaa1690470 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -94,6 +94,8 @@ struct libalias { * output lookup tables. */ LIST_HEAD (, alias_link) linkTableOut[LINK_TABLE_OUT_SIZE]; LIST_HEAD (, alias_link) linkTableIn[LINK_TABLE_IN_SIZE]; + /* HouseKeeping */ + TAILQ_HEAD (, alias_link) checkExpire; /* Link statistics */ int icmpLinkCount; int udpLinkCount; @@ -103,12 +105,8 @@ struct libalias { int fragmentIdLinkCount; int fragmentPtrLinkCount; int sockCount; - /* Index to chain of link table being inspected for old links */ - int cleanupIndex; /* System time in seconds for current packet */ int timeStamp; - /* Last time IncrementalCleanup() was called */ - int lastCleanupTime; /* If equal to zero, DeleteLink() * will not remove permanent links */ int deleteAllLinks; From owner-dev-commits-src-all@freebsd.org Tue Jul 6 06:56:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE5F765148A; Tue, 6 Jul 2021 06:56: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 4GJtdG40QGz4XpF; Tue, 6 Jul 2021 06:56: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 71A251522E; Tue, 6 Jul 2021 06:56: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 1666uYL5062933; Tue, 6 Jul 2021 06:56:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1666uYMm062932; Tue, 6 Jul 2021 06:56:34 GMT (envelope-from git) Date: Tue, 6 Jul 2021 06:56:34 GMT Message-Id: <202107060656.1666uYMm062932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 69965155a5c2 - stable/13 - libalias: Stats are unsigned MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 69965155a5c24c7794e61fc5a91ca3ba23468f50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 06:56:34 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=69965155a5c24c7794e61fc5a91ca3ba23468f50 commit 69965155a5c24c7794e61fc5a91ca3ba23468f50 Author: Lutz Donnerhacke AuthorDate: 2021-05-31 22:08:24 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 06:55:52 +0000 libalias: Stats are unsigned Stats counters are used as unsigned valued (i.e. printf("%u")) but are defined as signed int. This causes trouble later, so fix it early. Differential Revision: https://reviews.freebsd.org/D30587 (cherry picked from commit 3fd20a79e7b55d135bbc5fa197980fe0e9ee0f14) --- sys/netinet/libalias/alias_local.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index fcdaa1690470..8e2fe88fe620 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -97,14 +97,14 @@ struct libalias { /* HouseKeeping */ TAILQ_HEAD (, alias_link) checkExpire; /* Link statistics */ - int icmpLinkCount; - int udpLinkCount; - int tcpLinkCount; - int pptpLinkCount; - int protoLinkCount; - int fragmentIdLinkCount; - int fragmentPtrLinkCount; - int sockCount; + unsigned int icmpLinkCount; + unsigned int udpLinkCount; + unsigned int tcpLinkCount; + unsigned int pptpLinkCount; + unsigned int protoLinkCount; + unsigned int fragmentIdLinkCount; + unsigned int fragmentPtrLinkCount; + unsigned int sockCount; /* System time in seconds for current packet */ int timeStamp; /* If equal to zero, DeleteLink() From owner-dev-commits-src-all@freebsd.org Tue Jul 6 06:56:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E7A416512DB; Tue, 6 Jul 2021 06:56: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 4GJtdH4xF7z4Xdg; Tue, 6 Jul 2021 06:56: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 8F53D15328; Tue, 6 Jul 2021 06:56: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 1666uZNZ062957; Tue, 6 Jul 2021 06:56:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1666uZ3k062956; Tue, 6 Jul 2021 06:56:35 GMT (envelope-from git) Date: Tue, 6 Jul 2021 06:56:35 GMT Message-Id: <202107060656.1666uZ3k062956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 390866d47eff - stable/13 - libalias: Promote per instance global variable timeStamp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 390866d47effe8f5a11f3f852ae891f14dd4d15c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 06:56:36 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=390866d47effe8f5a11f3f852ae891f14dd4d15c commit 390866d47effe8f5a11f3f852ae891f14dd4d15c Author: Lutz Donnerhacke AuthorDate: 2021-05-25 07:07:21 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 06:55:53 +0000 libalias: Promote per instance global variable timeStamp Summary: - Use LibAliasTime as a real global variable for central timekeeping. - Reduce number of syscalls in user space considerably. - Dynamically adjust the packet counters to match the second resolution. - Only check the first few packets after a time increase for expiry. Discussed with: hselasky Differential Revision: https://reviews.freebsd.org/D30566 (cherry picked from commit ef828d39be8e4b6d922db080ed41611702dec56d) --- sys/netinet/libalias/alias_db.c | 60 +++++++++++++++++++++++++------------- sys/netinet/libalias/alias_local.h | 5 ++-- sys/netinet/libalias/alias_sctp.c | 16 +++++----- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 1b1cddc0b6fd..d42948efad8d 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -176,6 +176,7 @@ __FBSDID("$FreeBSD$"); #endif static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); +int LibAliasTime; /* Constants (note: constants are also defined @@ -820,7 +821,7 @@ CleanupLink(struct libalias *la, struct alias_link **lnk) if (lnk == NULL || *lnk == NULL) return; - if (la->timeStamp - (*lnk)->timestamp > (*lnk)->expire_time) { + if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire_time) { DeleteLink(lnk); if ((*lnk) == NULL) return; @@ -940,7 +941,7 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, #endif lnk->flags = 0; lnk->pflags = 0; - lnk->timestamp = la->timeStamp; + lnk->timestamp = LibAliasTime; /* Expiration time */ switch (link_type) { @@ -1109,7 +1110,7 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, CleanupLink(la, &lnk); if (lnk != NULL) - lnk->timestamp = la->timeStamp; + lnk->timestamp = LibAliasTime; /* Search for partially specified links. */ if (lnk == NULL && replace_partial_links) { @@ -1240,7 +1241,7 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, CleanupLink(la, &lnk_fully_specified); if (lnk_fully_specified != NULL) { - lnk_fully_specified->timestamp = la->timeStamp; + lnk_fully_specified->timestamp = LibAliasTime; lnk = lnk_fully_specified; } else if (lnk_unknown_dst_port != NULL) lnk = lnk_unknown_dst_port; @@ -2101,24 +2102,45 @@ SetDestCallId(struct alias_link *lnk, u_int16_t cid) void HouseKeeping(struct libalias *la) { - struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); -#ifndef _KERNEL - struct timeval tv; -#endif + static unsigned int packets = 0; + static unsigned int packet_limit = 1000; LIBALIAS_LOCK_ASSERT(la); + packets++; + /* - * Save system time (seconds) in global variable timeStamp for use - * by other functions. This is done so as not to unnecessarily - * waste timeline by making system calls. + * User space time/gettimeofday/... is very expensive. + * Kernel space cache trashing is unnecessary. + * + * Save system time (seconds) in global variable LibAliasTime + * for use by other functions. This is done so as not to + * unnecessarily waste timeline by making system calls. + * + * Reduce the amount of house keeping work substantially by + * sampling over the packets. */ + if (packets % packet_limit == 0) { + time_t now; + #ifdef _KERNEL - la->timeStamp = time_uptime; + now = time_uptime; #else - gettimeofday(&tv, NULL); - la->timeStamp = tv.tv_sec; + now = time(NULL); #endif - CleanupLink(la, &lnk); + if (now != LibAliasTime) { + /* retry three times a second */ + packet_limit = packets / 3; + packets = 0; + LibAliasTime = now; + } + + } + /* Do a cleanup for the first packets of the new second only */ + if (packets < (la->udpLinkCount + la->tcpLinkCount)) { + struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); + + CleanupLink(la, &lnk); + } } /* Init the log file and enable logging */ @@ -2392,9 +2414,6 @@ struct libalias * LibAliasInit(struct libalias *la) { int i; -#ifndef _KERNEL - struct timeval tv; -#endif if (la == NULL) { #ifdef _KERNEL @@ -2414,10 +2433,9 @@ LibAliasInit(struct libalias *la) LIST_INSERT_HEAD(&instancehead, la, instancelist); #ifdef _KERNEL - la->timeStamp = time_uptime; + LibAliasTime = time_uptime; #else - gettimeofday(&tv, NULL); - la->timeStamp = tv.tv_sec; + LibAliasTime = time(NULL); #endif for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index 8e2fe88fe620..f1b40f0438da 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -105,8 +105,6 @@ struct libalias { unsigned int fragmentIdLinkCount; unsigned int fragmentPtrLinkCount; unsigned int sockCount; - /* System time in seconds for current packet */ - int timeStamp; /* If equal to zero, DeleteLink() * will not remove permanent links */ int deleteAllLinks; @@ -206,6 +204,9 @@ struct libalias { /* Prototypes */ +/* System time in seconds for current packet */ +extern int LibAliasTime; + /* * SctpFunction prototypes * diff --git a/sys/netinet/libalias/alias_sctp.c b/sys/netinet/libalias/alias_sctp.c index 719af1512a05..b88ad2b28ca8 100644 --- a/sys/netinet/libalias/alias_sctp.c +++ b/sys/netinet/libalias/alias_sctp.c @@ -298,10 +298,10 @@ static MALLOC_DEFINE(M_SCTPNAT, "sctpnat", "sctp nat dbs"); #define SN_MAX_TIMER 600 #define SN_TIMER_QUEUE_SIZE SN_MAX_TIMER+2 -#define SN_I_T(la) (la->timeStamp + sysctl_init_timer) /**< INIT State expiration time in seconds */ -#define SN_U_T(la) (la->timeStamp + sysctl_up_timer) /**< UP State expiration time in seconds */ -#define SN_C_T(la) (la->timeStamp + sysctl_shutdown_timer) /**< CL State expiration time in seconds */ -#define SN_X_T(la) (la->timeStamp + sysctl_holddown_timer) /**< Wait after a shutdown complete in seconds */ +#define SN_I_T(la) (LibAliasTime + sysctl_init_timer) /**< INIT State expiration time in seconds */ +#define SN_U_T(la) (LibAliasTime + sysctl_up_timer) /**< UP State expiration time in seconds */ +#define SN_C_T(la) (LibAliasTime + sysctl_shutdown_timer) /**< CL State expiration time in seconds */ +#define SN_X_T(la) (LibAliasTime + sysctl_holddown_timer) /**< Wait after a shutdown complete in seconds */ /** @} * @defgroup sysctl SysCtl Variable and callback function declarations * @@ -667,9 +667,9 @@ AliasSctpInit(struct libalias *la) for (i = 0; i < SN_TIMER_QUEUE_SIZE; i++) LIST_INIT(&la->sctpNatTimer.TimerQ[i]); #ifdef _KERNEL - la->sctpNatTimer.loc_time=time_uptime; /* la->timeStamp is not set yet */ + la->sctpNatTimer.loc_time=time_uptime; /* LibAliasTime is not set yet */ #else - la->sctpNatTimer.loc_time=la->timeStamp; + la->sctpNatTimer.loc_time=LibAliasTime; #endif la->sctpNatTimer.cur_loc = 0; la->sctpLinkCount = 0; @@ -2493,12 +2493,12 @@ sctp_CheckTimers(struct libalias *la) struct sctp_nat_assoc *assoc; LIBALIAS_LOCK_ASSERT(la); - while(la->timeStamp >= la->sctpNatTimer.loc_time) { + while(LibAliasTime >= la->sctpNatTimer.loc_time) { while (!LIST_EMPTY(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc])) { assoc = LIST_FIRST(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc]); //SLIST_REMOVE_HEAD(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc], timer_Q); LIST_REMOVE(assoc, timer_Q); - if (la->timeStamp >= assoc->exp) { /* state expired */ + if (LibAliasTime >= assoc->exp) { /* state expired */ SN_LOG(((assoc->state == SN_CL) ? (SN_LOG_DEBUG) : (SN_LOG_INFO)), logsctperror("Timer Expired", assoc->g_vtag, assoc->state, SN_TO_NODIR)); RmSctpAssoc(la, assoc); From owner-dev-commits-src-all@freebsd.org Tue Jul 6 06:56:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1999B65135A; Tue, 6 Jul 2021 06:56: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 4GJtdJ5plJz4Xdn; Tue, 6 Jul 2021 06:56: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 AD7AF15453; Tue, 6 Jul 2021 06:56: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 1666uax7062988; Tue, 6 Jul 2021 06:56:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1666uacA062987; Tue, 6 Jul 2021 06:56:36 GMT (envelope-from git) Date: Tue, 6 Jul 2021 06:56:36 GMT Message-Id: <202107060656.1666uacA062987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 78d515b2225e - stable/13 - libalias: Restructure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 78d515b2225ea33aed2d2dc5976ccf4f44cc6a3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 06:56:37 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=78d515b2225ea33aed2d2dc5976ccf4f44cc6a3c commit 78d515b2225ea33aed2d2dc5976ccf4f44cc6a3c Author: Lutz Donnerhacke AuthorDate: 2021-05-25 13:03:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 06:55:53 +0000 libalias: Restructure Clean up the database handling in order to switch to more efficient data structures. The development of this patch was artificially split in to many small steps to ease reviewing. - Common search terms - Separate fully qualified search - Separate table for partial links - Cleanup _FindLinkIn - Factor out the outgoing search function - Factor out a common idiom to return found links - Reorder incoming links by grouping of common search terms - Remove LSNAT from outgoing search - Group internal structure semantically - Separate table for PPTP - Use AliasRange instead of PORT_BASE - Remove temporary state deleteAllLinks from global struct - Avoid uninitialized expiration Discussed with: Dimitry Luhtionov Differential Revision: https://reviews.freebsd.org/D30568 Differential Revision: https://reviews.freebsd.org/D30569 Differential Revision: https://reviews.freebsd.org/D30570 Differential Revision: https://reviews.freebsd.org/D30571 Differential Revision: https://reviews.freebsd.org/D30572 Differential Revision: https://reviews.freebsd.org/D30573 Differential Revision: https://reviews.freebsd.org/D30574 Differential Revision: https://reviews.freebsd.org/D30575 Differential Revision: https://reviews.freebsd.org/D30580 Differential Revision: https://reviews.freebsd.org/D30581 Differential Revision: https://reviews.freebsd.org/D30604 Differential Revision: https://reviews.freebsd.org/D30582 (cherry picked from commit d41044ddfdbc2a026570cae11d5fc2e18f5e4b92) (cherry picked from commit 32f9c2ceb3ec8266e48ec0f6d1556fd98ef12db6) (cherry picked from commit cac129e6030095c33e95c5ce1cdcb9c5c21efce9) (cherry picked from commit 19dcc4f2250b3850991366e3058ca8a64b2f135d) (cherry picked from commit d5419034381d0e8e8c99f0f678118b197144bfff) (cherry picked from commit d4ab07d2aeb13b1aae9ad5d73e5fe77131f2350c) (cherry picked from commit 492d3b7109b45ff30fd199b7eeed797447746e42) (cherry picked from commit 7b44ff4c52ce9e7a89e772566a249e5481fe0ac4) (cherry picked from commit 1178dda53d10b096e0b99e356d15b7c24390e099) (cherry picked from commit 9efcad61d8309ecad3c15392b277fd329a1e45e4) (cherry picked from commit fe83900f9fa931e3d0942ec9c0709896b887c3d7) (cherry picked from commit d989935b5bcd880353f0de89eda958c45e7e3342) (cherry picked from commit b50a4dce185481bebf8096c27588ae04a4a2fd7c) (cherry picked from commit f28455344483310cfd1aa5c0bdd4d014810c0e32) --- sys/netinet/libalias/HISTORY | 4 + sys/netinet/libalias/alias_db.c | 897 ++++++++++++++++++++----------------- sys/netinet/libalias/alias_local.h | 16 +- 3 files changed, 497 insertions(+), 420 deletions(-) diff --git a/sys/netinet/libalias/HISTORY b/sys/netinet/libalias/HISTORY index c5bca59cac1f..8965290a4f27 100644 --- a/sys/netinet/libalias/HISTORY +++ b/sys/netinet/libalias/HISTORY @@ -143,3 +143,7 @@ Version 3.1: May, 2000 (Erik Salander, erik@whistle.com) Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and Junichi Satoh, junichi@junichi.org) - Added support for streaming media (RTSP and PNA) aliasing. + +Version 3.3: May 2021 (donner) + - Dropped LibAliasCheckNewLink + - Refactor the database handling, perfomance improvements. diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index d42948efad8d..b056f55b56a5 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -318,14 +318,23 @@ struct alias_link { #define LINK_UNFIREWALLED 0x08 int timestamp; /* Time link was last accessed */ - int expire_time; /* Expire time for link */ #ifndef NO_USE_SOCKETS int sockfd; /* socket descriptor */ #endif /* Linked list of pointers for input and output lookup tables */ - LIST_ENTRY (alias_link) list_out; - LIST_ENTRY (alias_link) list_in; - TAILQ_ENTRY (alias_link) list_expire; + union { + struct { + LIST_ENTRY(alias_link) in; + LIST_ENTRY(alias_link) out; + } all; + struct { + LIST_ENTRY(alias_link) list; + } pptp; + }; + struct { + TAILQ_ENTRY(alias_link) list; + int time; /* Expire time for link */ + } expire; /* Auxiliary data */ union { char *frag_ptr; @@ -378,12 +387,10 @@ Miscellaneous: */ /* Local prototypes */ -static u_int StartPointIn(struct in_addr, u_short, int); - -static u_int -StartPointOut(struct in_addr, struct in_addr, - u_short, u_short, int); - +static struct group_in * +StartPointIn(struct libalias *, struct in_addr, u_short, int, int); +static u_int +StartPointOut(struct in_addr, struct in_addr, u_short, u_short, int); static int SeqDiff(u_long, u_long); #ifndef NO_FW_PUNCH @@ -401,19 +408,46 @@ static void UninitPacketAliasLog(struct libalias *); void SctpShowAliasStats(struct libalias *la); -static u_int -StartPointIn(struct in_addr alias_addr, - u_short alias_port, - int link_type) +#define INGUARD \ + if (grp->alias_port != alias_port || \ + grp->link_type != link_type || \ + grp->alias_addr.s_addr != alias_addr.s_addr) \ + continue; + +static struct group_in * +StartPointIn(struct libalias *la, + struct in_addr alias_addr, u_short alias_port, int link_type, + int create) { u_int n; + struct group_in *grp, *tmp; n = alias_addr.s_addr; - if (link_type != LINK_PPTP) - n += alias_port; + n += alias_port; n += link_type; - return (n % LINK_TABLE_IN_SIZE); -} + n %= LINK_TABLE_IN_SIZE; + + LIST_FOREACH_SAFE(grp, &la->groupTableIn[n], group_in, tmp) { + /* Auto cleanup */ + if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { + LIST_REMOVE(grp, group_in); + free(grp); + } else { + INGUARD; + return (grp); + } + } + if (!create || (grp = malloc(sizeof(*grp))) == NULL) + return (grp); + grp->alias_addr = alias_addr; + grp->alias_port = alias_port; + grp->link_type = link_type; + LIST_INIT(&grp->full); + LIST_INIT(&grp->partial); + LIST_INSERT_HEAD(&la->groupTableIn[n], grp, group_in); + return (grp); +} +#undef INGUARD static u_int StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, @@ -423,10 +457,8 @@ StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, n = src_addr.s_addr; n += dst_addr.s_addr; - if (link_type != LINK_PPTP) { - n += src_port; - n += dst_port; - } + n += src_port; + n += dst_port; n += link_type; return (n % LINK_TABLE_OUT_SIZE); @@ -525,14 +557,16 @@ static int GetNewPort(struct libalias *, struct alias_link *, int); #ifndef NO_USE_SOCKETS static u_short GetSocket(struct libalias *, u_short, int *, int); #endif -static void CleanupAliasData(struct libalias *); -static void CleanupLink(struct libalias *, struct alias_link **); -static void DeleteLink(struct alias_link **); +static void CleanupAliasData(struct libalias *, int); +static void CleanupLink(struct libalias *, struct alias_link **, int); +static void DeleteLink(struct alias_link **, int); +static struct alias_link * +UseLink(struct libalias *, struct alias_link *); static struct alias_link * ReLink(struct alias_link *, struct in_addr, struct in_addr, struct in_addr, - u_short, u_short, int, int); + u_short, u_short, int, int, int); static struct alias_link * FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); @@ -540,12 +574,20 @@ FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, static struct alias_link * FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); -#define ALIAS_PORT_BASE 0x08000 -#define ALIAS_PORT_MASK 0x07fff -#define ALIAS_PORT_MASK_EVEN 0x07ffe +static u_short _RandomPort(struct libalias *la); + #define GET_NEW_PORT_MAX_ATTEMPTS 20 -#define FIND_EVEN_ALIAS_BASE 1 +/* get random port in network byte order */ +static u_short +_RandomPort(struct libalias *la) { + u_short port; + + port = la->aliasPortLower + + arc4random_uniform(la->aliasPortLength); + + return ntohs(port); +} /* GetNewPort() allocates port numbers. Note that if a port number is already in use, that does not mean that it cannot be used by @@ -557,8 +599,7 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) { int i; int max_trials; - u_short port_sys; - u_short port_net; + u_short port; LIBALIAS_LOCK_ASSERT(la); /* @@ -566,41 +607,18 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) * this parameter is zero or positive, it precisely specifies * the port number. GetNewPort() will return this number * without check that it is in use. - + * + * The aliasing port is automatically selected by one of + * two methods below: + * * When this parameter is GET_ALIAS_PORT, it indicates to get * a randomly selected port number. */ - if (alias_port_param == GET_ALIAS_PORT) { - /* - * The aliasing port is automatically selected by one of - * two methods below: - */ - max_trials = GET_NEW_PORT_MAX_ATTEMPTS; - - if (la->packetAliasMode & PKT_ALIAS_SAME_PORTS) { - /* - * When the PKT_ALIAS_SAME_PORTS option is chosen, - * the first try will be the actual source port. If - * this is already in use, the remainder of the - * trials will be random. - */ - port_net = lnk->src_port; - port_sys = ntohs(port_net); - } else if (la->aliasPortLower) { - /* First trial is a random port in the aliasing range. */ - port_sys = la->aliasPortLower + - (arc4random() % la->aliasPortLength); - port_net = htons(port_sys); - } else { - /* First trial and all subsequent are random. */ - port_sys = arc4random() & ALIAS_PORT_MASK; - port_sys += ALIAS_PORT_BASE; - port_net = htons(port_sys); - } - } else if (alias_port_param >= 0 && alias_port_param < 0x10000) { + if (alias_port_param >= 0 && alias_port_param < 0x10000) { lnk->alias_port = (u_short) alias_port_param; return (0); - } else { + } + if (alias_port_param != GET_ALIAS_PORT) { #ifdef LIBALIAS_DEBUG fprintf(stderr, "PacketAlias/GetNewPort(): "); fprintf(stderr, "input parameter error\n"); @@ -608,58 +626,57 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) return (-1); } + max_trials = GET_NEW_PORT_MAX_ATTEMPTS; + + /* + * When the PKT_ALIAS_SAME_PORTS option is chosen, + * the first try will be the actual source port. If + * this is already in use, the remainder of the + * trials will be random. + */ + port = (la->packetAliasMode & PKT_ALIAS_SAME_PORTS) + ? lnk->src_port + : _RandomPort(la); + /* Port number search */ - for (i = 0; i < max_trials; i++) { - int go_ahead; + for (i = 0; i < max_trials; i++, port = _RandomPort(la)) { + struct group_in *grp; struct alias_link *search_result; - search_result = FindLinkIn(la, lnk->dst_addr, lnk->alias_addr, - lnk->dst_port, port_net, - lnk->link_type, 0); + grp = StartPointIn(la, lnk->alias_addr, port, lnk->link_type, 0); + if (grp == NULL) + break; + LIST_FOREACH(search_result, &grp->full, all.in) { + if (lnk->dst_addr.s_addr == search_result->dst_addr.s_addr && + lnk->dst_port == search_result->dst_port) + break; /* found match */ + } if (search_result == NULL) - go_ahead = 1; - else if (!(lnk->flags & LINK_PARTIALLY_SPECIFIED) - && (search_result->flags & LINK_PARTIALLY_SPECIFIED)) - go_ahead = 1; - else - go_ahead = 0; + break; + } - if (go_ahead) { -#ifndef NO_USE_SOCKETS - if ((la->packetAliasMode & PKT_ALIAS_USE_SOCKETS) - && (lnk->flags & LINK_PARTIALLY_SPECIFIED) - && ((lnk->link_type == LINK_TCP) || - (lnk->link_type == LINK_UDP))) { - if (GetSocket(la, port_net, &lnk->sockfd, lnk->link_type)) { - lnk->alias_port = port_net; - return (0); - } - } else { + if (i >= max_trials) { +#ifdef LIBALIAS_DEBUG + fprintf(stderr, "PacketAlias/GetNewPort(): "); + fprintf(stderr, "could not find free port\n"); #endif - lnk->alias_port = port_net; - return (0); + return (-1); + } + #ifndef NO_USE_SOCKETS - } -#endif - } - if (la->aliasPortLower) { - port_sys = la->aliasPortLower + - (arc4random() % la->aliasPortLength); - port_net = htons(port_sys); - } else { - port_sys = arc4random() & ALIAS_PORT_MASK; - port_sys += ALIAS_PORT_BASE; - port_net = htons(port_sys); + if ((la->packetAliasMode & PKT_ALIAS_USE_SOCKETS) && + (lnk->flags & LINK_PARTIALLY_SPECIFIED) && + ((lnk->link_type == LINK_TCP) || + (lnk->link_type == LINK_UDP))) { + if (!GetSocket(la, port, &lnk->sockfd, lnk->link_type)) { + return (-1); } } - -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/GetNewPort(): "); - fprintf(stderr, "could not find free port\n"); #endif + lnk->alias_port = port; - return (-1); + return (0); } #ifndef NO_USE_SOCKETS @@ -726,7 +743,7 @@ FindNewPortGroup(struct libalias *la, { int i, j; int max_trials; - u_short port_sys; + u_short port; int link_type; LIBALIAS_LOCK_ASSERT(la); @@ -758,39 +775,31 @@ FindNewPortGroup(struct libalias *la, * try will be the actual source port. If this is already * in use, the remainder of the trials will be random. */ - port_sys = ntohs(src_port); + port = src_port; } else { - /* First trial and all subsequent are random. */ - if (align == FIND_EVEN_ALIAS_BASE) - port_sys = arc4random() & ALIAS_PORT_MASK_EVEN; - else - port_sys = arc4random() & ALIAS_PORT_MASK; - - port_sys += ALIAS_PORT_BASE; + port = _RandomPort(la); } /* Port number search */ - for (i = 0; i < max_trials; i++) { + for (i = 0; i < max_trials; i++, port = _RandomPort(la)) { struct alias_link *search_result; - for (j = 0; j < port_count; j++) + if (align) + port &= htons(0xfffe); + + for (j = 0; j < port_count; j++) { + u_short port_j = ntohs(port) + j; + if ((search_result = FindLinkIn(la, dst_addr, - alias_addr, dst_port, htons(port_sys + j), + alias_addr, dst_port, htons(port_j), link_type, 0)) != NULL) break; + } /* Found a good range, return base */ if (j == port_count) - return (htons(port_sys)); - - /* Find a new base to try */ - if (align == FIND_EVEN_ALIAS_BASE) - port_sys = arc4random() & ALIAS_PORT_MASK_EVEN; - else - port_sys = arc4random() & ALIAS_PORT_MASK; - - port_sys += ALIAS_PORT_BASE; + return (port); } #ifdef LIBALIAS_DEBUG @@ -802,45 +811,65 @@ FindNewPortGroup(struct libalias *la, } static void -CleanupAliasData(struct libalias *la) +CleanupAliasData(struct libalias *la, int deletePermanent) { struct alias_link *lnk, *lnk_tmp; + u_int i; LIBALIAS_LOCK_ASSERT(la); /* permanent entries may stay */ - TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, list_expire, lnk_tmp) - DeleteLink(&lnk); + TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, expire.list, lnk_tmp) + DeleteLink(&lnk, deletePermanent); + + for (i = 0; i < LINK_TABLE_IN_SIZE; i++) { + struct group_in *grp, *grp_tmp; + + LIST_FOREACH_SAFE(grp, &la->groupTableIn[i], group_in, grp_tmp) + if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { + LIST_REMOVE(grp, group_in); + free(grp); + } + } } static void -CleanupLink(struct libalias *la, struct alias_link **lnk) +CleanupLink(struct libalias *la, struct alias_link **lnk, int deletePermanent) { LIBALIAS_LOCK_ASSERT(la); if (lnk == NULL || *lnk == NULL) return; - if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire_time) { - DeleteLink(lnk); + if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire.time) { + DeleteLink(lnk, deletePermanent); if ((*lnk) == NULL) return; } /* move to end, swap may fail on a single entry list */ - TAILQ_REMOVE(&la->checkExpire, (*lnk), list_expire); - TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), list_expire); + TAILQ_REMOVE(&la->checkExpire, (*lnk), expire.list); + TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), expire.list); +} + +static struct alias_link * +UseLink(struct libalias *la, struct alias_link *lnk) +{ + CleanupLink(la, &lnk, 0); + if (lnk != NULL) + lnk->timestamp = LibAliasTime; + return (lnk); } static void -DeleteLink(struct alias_link **plnk) +DeleteLink(struct alias_link **plnk, int deletePermanent) { struct alias_link *lnk = *plnk; struct libalias *la = lnk->la; LIBALIAS_LOCK_ASSERT(la); /* Don't do anything if the link is marked permanent */ - if (la->deleteAllLinks == 0 && lnk->flags & LINK_PERMANENT) + if (!deletePermanent && (lnk->flags & LINK_PERMANENT)) return; #ifndef NO_FW_PUNCH @@ -848,24 +877,32 @@ DeleteLink(struct alias_link **plnk) ClearFWHole(lnk); #endif - /* Free memory allocated for LSNAT server pool */ - if (lnk->server != NULL) { - struct server *head, *curr, *next; + switch (lnk->link_type) { + case LINK_PPTP: + LIST_REMOVE(lnk, pptp.list); + break; + default: + /* Free memory allocated for LSNAT server pool */ + if (lnk->server != NULL) { + struct server *head, *curr, *next; + + head = curr = lnk->server; + do { + next = curr->next; + free(curr); + } while ((curr = next) != head); + } else { + /* Adjust output table pointers */ + LIST_REMOVE(lnk, all.out); + } - head = curr = lnk->server; - do { - next = curr->next; - free(curr); - } while ((curr = next) != head); + /* Adjust input table pointers */ + LIST_REMOVE(lnk, all.in); + break; } - /* Adjust output table pointers */ - LIST_REMOVE(lnk, list_out); - - /* Adjust input table pointers */ - LIST_REMOVE(lnk, list_in); /* remove from housekeeping */ - TAILQ_REMOVE(&la->checkExpire, lnk, list_expire); + TAILQ_REMOVE(&la->checkExpire, lnk, expire.list); #ifndef NO_USE_SOCKETS /* Close socket, if one has been allocated */ @@ -923,133 +960,148 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); + lnk = malloc(sizeof(struct alias_link)); - if (lnk != NULL) { - /* Basic initialization */ - lnk->la = la; - lnk->src_addr = src_addr; - lnk->dst_addr = dst_addr; - lnk->alias_addr = alias_addr; - lnk->proxy_addr.s_addr = INADDR_ANY; - lnk->src_port = src_port; - lnk->dst_port = dst_port; - lnk->proxy_port = 0; - lnk->server = NULL; - lnk->link_type = link_type; + if (lnk == NULL) { +#ifdef LIBALIAS_DEBUG + fprintf(stderr, "PacketAlias/AddLink(): "); + fprintf(stderr, "malloc() call failed.\n"); +#endif + return (NULL); + } + /* Basic initialization */ + lnk->la = la; + lnk->src_addr = src_addr; + lnk->dst_addr = dst_addr; + lnk->alias_addr = alias_addr; + lnk->proxy_addr.s_addr = INADDR_ANY; + lnk->src_port = src_port; + lnk->dst_port = dst_port; + lnk->proxy_port = 0; + lnk->server = NULL; + lnk->link_type = link_type; #ifndef NO_USE_SOCKETS - lnk->sockfd = -1; + lnk->sockfd = -1; #endif - lnk->flags = 0; - lnk->pflags = 0; - lnk->timestamp = LibAliasTime; + lnk->flags = 0; + lnk->pflags = 0; + lnk->timestamp = LibAliasTime; - /* Expiration time */ - switch (link_type) { - case LINK_ICMP: - lnk->expire_time = ICMP_EXPIRE_TIME; - break; - case LINK_UDP: - lnk->expire_time = UDP_EXPIRE_TIME; - break; - case LINK_TCP: - lnk->expire_time = TCP_EXPIRE_INITIAL; - break; - case LINK_PPTP: - lnk->flags |= LINK_PERMANENT; /* no timeout. */ - break; - case LINK_FRAGMENT_ID: - lnk->expire_time = FRAGMENT_ID_EXPIRE_TIME; - break; - case LINK_FRAGMENT_PTR: - lnk->expire_time = FRAGMENT_PTR_EXPIRE_TIME; - break; - case LINK_ADDR: - break; - default: - lnk->expire_time = PROTO_EXPIRE_TIME; - break; - } + /* Expiration time */ + switch (link_type) { + case LINK_ICMP: + lnk->expire.time = ICMP_EXPIRE_TIME; + break; + case LINK_UDP: + lnk->expire.time = UDP_EXPIRE_TIME; + break; + case LINK_TCP: + lnk->expire.time = TCP_EXPIRE_INITIAL; + break; + case LINK_FRAGMENT_ID: + lnk->expire.time = FRAGMENT_ID_EXPIRE_TIME; + break; + case LINK_FRAGMENT_PTR: + lnk->expire.time = FRAGMENT_PTR_EXPIRE_TIME; + break; + default: + lnk->expire.time = PROTO_EXPIRE_TIME; + break; + } + + /* Determine alias flags */ + if (dst_addr.s_addr == INADDR_ANY) + lnk->flags |= LINK_UNKNOWN_DEST_ADDR; + if (dst_port == 0) + lnk->flags |= LINK_UNKNOWN_DEST_PORT; - /* Determine alias flags */ - if (dst_addr.s_addr == INADDR_ANY) - lnk->flags |= LINK_UNKNOWN_DEST_ADDR; - if (dst_port == 0) - lnk->flags |= LINK_UNKNOWN_DEST_PORT; + /* Determine alias port */ + if (GetNewPort(la, lnk, alias_port_param) != 0) { + free(lnk); + return (NULL); + } + /* Link-type dependent initialization */ + switch (link_type) { + case LINK_ICMP: + la->icmpLinkCount++; + break; + case LINK_UDP: + la->udpLinkCount++; + break; + case LINK_TCP: { + struct tcp_dat *aux_tcp; + int i; - /* Determine alias port */ - if (GetNewPort(la, lnk, alias_port_param) != 0) { + aux_tcp = malloc(sizeof(struct tcp_dat)); + if (aux_tcp == NULL) { +#ifdef LIBALIAS_DEBUG + fprintf(stderr, "PacketAlias/AddLink: "); + fprintf(stderr, " cannot allocate auxiliary TCP data\n"); +#endif free(lnk); return (NULL); } - /* Link-type dependent initialization */ - switch (link_type) { - struct tcp_dat *aux_tcp; - case LINK_ICMP: - la->icmpLinkCount++; - break; - case LINK_UDP: - la->udpLinkCount++; - break; - case LINK_TCP: - aux_tcp = malloc(sizeof(struct tcp_dat)); - if (aux_tcp != NULL) { - int i; - - la->tcpLinkCount++; - aux_tcp->state.in = ALIAS_TCP_STATE_NOT_CONNECTED; - aux_tcp->state.out = ALIAS_TCP_STATE_NOT_CONNECTED; - aux_tcp->state.index = 0; - aux_tcp->state.ack_modified = 0; - for (i = 0; i < N_LINK_TCP_DATA; i++) - aux_tcp->ack[i].active = 0; - aux_tcp->fwhole = -1; - lnk->data.tcp = aux_tcp; - } else { -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/AddLink: "); - fprintf(stderr, " cannot allocate auxiliary TCP data\n"); -#endif - free(lnk); - return (NULL); - } - break; - case LINK_PPTP: - la->pptpLinkCount++; - break; - case LINK_FRAGMENT_ID: - la->fragmentIdLinkCount++; - break; - case LINK_FRAGMENT_PTR: - la->fragmentPtrLinkCount++; - break; - case LINK_ADDR: - break; - default: - la->protoLinkCount++; - break; + la->tcpLinkCount++; + aux_tcp->state.in = ALIAS_TCP_STATE_NOT_CONNECTED; + aux_tcp->state.out = ALIAS_TCP_STATE_NOT_CONNECTED; + aux_tcp->state.index = 0; + aux_tcp->state.ack_modified = 0; + for (i = 0; i < N_LINK_TCP_DATA; i++) + aux_tcp->ack[i].active = 0; + aux_tcp->fwhole = -1; + lnk->data.tcp = aux_tcp; + } + break; + case LINK_PPTP: + la->pptpLinkCount++; + break; + case LINK_FRAGMENT_ID: + la->fragmentIdLinkCount++; + break; + case LINK_FRAGMENT_PTR: + la->fragmentPtrLinkCount++; + break; + case LINK_ADDR: + break; + default: + la->protoLinkCount++; + break; + } + + switch (link_type) { + case LINK_PPTP: + LIST_INSERT_HEAD(&la->pptpList, lnk, pptp.list); + break; + default: { + struct group_in *grp; + + grp = StartPointIn(la, alias_addr, lnk->alias_port, link_type, 1); + if (grp == NULL) { + free(lnk); + return (NULL); } /* Set up pointers for output lookup table */ start_point = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); - LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, list_out); + LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, all.out); /* Set up pointers for input lookup table */ - start_point = StartPointIn(alias_addr, lnk->alias_port, link_type); - LIST_INSERT_HEAD(&la->linkTableIn[start_point], lnk, list_in); - - /* Include the element into the housekeeping list */ - TAILQ_INSERT_TAIL(&la->checkExpire, lnk, list_expire); - } else { -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/AddLink(): "); - fprintf(stderr, "malloc() call failed.\n"); -#endif + if (lnk->flags & LINK_PARTIALLY_SPECIFIED) + LIST_INSERT_HEAD(&grp->partial, lnk, all.in); + else + LIST_INSERT_HEAD(&grp->full, lnk, all.in); } - if (la->packetAliasMode & PKT_ALIAS_LOG) { - ShowAliasStats(la); + break; } + + /* Include the element into the housekeeping list */ + TAILQ_INSERT_TAIL(&la->checkExpire, lnk, expire.list); + + if (la->packetAliasMode & PKT_ALIAS_LOG) + ShowAliasStats(la); + return (lnk); } @@ -1065,7 +1117,8 @@ ReLink(struct alias_link *old_lnk, u_short src_port, u_short dst_port, int alias_port_param, - int link_type) + int link_type, + int deletePermanent) { struct alias_link *new_lnk; struct libalias *la = old_lnk->la; @@ -1081,10 +1134,39 @@ ReLink(struct alias_link *old_lnk, PunchFWHole(new_lnk); } #endif - DeleteLink(&old_lnk); + DeleteLink(&old_lnk, deletePermanent); return (new_lnk); } + +#define OUTGUARD \ + if (lnk->src_port != src_port || \ + lnk->src_addr.s_addr != src_addr.s_addr || \ + lnk->dst_addr.s_addr != dst_addr.s_addr || \ + lnk->dst_port != dst_port || \ + lnk->link_type != link_type) \ + continue; + +static struct alias_link * +_SearchLinkOut(struct libalias *la, struct in_addr src_addr, + struct in_addr dst_addr, + u_short src_port, + u_short dst_port, + int link_type) { + u_int i; + struct alias_link *lnk; + + i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); + LIST_FOREACH(lnk, &la->linkTableOut[i], all.out) { + OUTGUARD; + return (UseLink(la, lnk)); + } + + return (NULL); +} + +#undef OUTGUARD + static struct alias_link * _FindLinkOut(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, @@ -1093,45 +1175,31 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, int link_type, int replace_partial_links) { - u_int i; struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); - LIST_FOREACH(lnk, &la->linkTableOut[i], list_out) { - if (lnk->dst_addr.s_addr == dst_addr.s_addr && - lnk->src_addr.s_addr == src_addr.s_addr && - lnk->src_port == src_port && - lnk->dst_port == dst_port && - lnk->link_type == link_type && - lnk->server == NULL) - break; - } - - CleanupLink(la, &lnk); - if (lnk != NULL) - lnk->timestamp = LibAliasTime; + lnk = _SearchLinkOut(la, src_addr, dst_addr, src_port, dst_port, link_type); + if (lnk != NULL || !replace_partial_links) + return (lnk); /* Search for partially specified links. */ - if (lnk == NULL && replace_partial_links) { - if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY) { - lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, 0, - link_type, 0); - if (lnk == NULL) - lnk = _FindLinkOut(la, src_addr, ANY_ADDR, src_port, - dst_port, link_type, 0); - } - if (lnk == NULL && - (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { - lnk = _FindLinkOut(la, src_addr, ANY_ADDR, src_port, 0, - link_type, 0); - } - if (lnk != NULL) { - lnk = ReLink(lnk, - src_addr, dst_addr, lnk->alias_addr, - src_port, dst_port, lnk->alias_port, - link_type); - } + if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY) { + lnk = _SearchLinkOut(la, src_addr, dst_addr, src_port, 0, + link_type); + if (lnk == NULL) + lnk = _SearchLinkOut(la, src_addr, ANY_ADDR, src_port, + dst_port, link_type); + } + if (lnk == NULL && + (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { + lnk = _SearchLinkOut(la, src_addr, ANY_ADDR, src_port, 0, + link_type); + } + if (lnk != NULL) { + lnk = ReLink(lnk, + src_addr, dst_addr, lnk->alias_addr, + src_port, dst_port, lnk->alias_port, + link_type, 0); } return (lnk); } @@ -1175,16 +1243,16 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, int replace_partial_links) { int flags_in; - u_int start_point; + struct group_in *grp; struct alias_link *lnk; - struct alias_link *lnk_fully_specified; struct alias_link *lnk_unknown_all; struct alias_link *lnk_unknown_dst_addr; struct alias_link *lnk_unknown_dst_port; + struct in_addr src_addr; + u_short src_port; LIBALIAS_LOCK_ASSERT(la); /* Initialize pointers */ - lnk_fully_specified = NULL; lnk_unknown_all = NULL; lnk_unknown_dst_addr = NULL; lnk_unknown_dst_port = NULL; @@ -1198,83 +1266,82 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, flags_in |= LINK_UNKNOWN_DEST_PORT; /* Search loop */ - start_point = StartPointIn(alias_addr, alias_port, link_type); - LIST_FOREACH(lnk, &la->linkTableIn[start_point], list_in) { - int flags; - - flags = flags_in | lnk->flags; - if (!(flags & LINK_PARTIALLY_SPECIFIED)) { - if (lnk->alias_addr.s_addr == alias_addr.s_addr - && lnk->alias_port == alias_port - && lnk->dst_addr.s_addr == dst_addr.s_addr *** 448 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jul 6 06:56:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CCE2265149A; Tue, 6 Jul 2021 06:56:38 +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 4GJtdK7307z4XmF; Tue, 6 Jul 2021 06:56: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 CEEB514DDF; Tue, 6 Jul 2021 06:56: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 1666ubEX063012; Tue, 6 Jul 2021 06:56:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1666ubcW063011; Tue, 6 Jul 2021 06:56:37 GMT (envelope-from git) Date: Tue, 6 Jul 2021 06:56:37 GMT Message-Id: <202107060656.1666ubcW063011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 3a96a25da861 - stable/13 - libalias: Switch to SPLAY trees MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a96a25da8614d27f717ba8d29d32bafb04a70e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 06:56:39 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=3a96a25da8614d27f717ba8d29d32bafb04a70e8 commit 3a96a25da8614d27f717ba8d29d32bafb04a70e8 Author: Lutz Donnerhacke AuthorDate: 2021-05-27 21:42:54 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 06:55:53 +0000 libalias: Switch to SPLAY trees Current data structure is using a hash of unordered lists. Those unordered lists are quite efficient, because the least recently inserted entries are most likely to be used again. In order to avoid long search times in other cases, the lists are hashed into many buckets. Unfortunatly a search for a miss needs an exhaustive inspection and a careful definition of the hash. Splay trees offer a similar feature - almost O(1) for access of the least recently used entries), and amortized O(ln(n) - for almost all other cases. Get rid of the hash. Now the data structure should able to quickly react to external packets without eating CPU cycles for breakfast, preventing a DoS. PR: 192888 Discussed with: Dimitry Luhtionov Differential Revision: https://reviews.freebsd.org/D30516 Differential Revision: https://reviews.freebsd.org/D30536 Differential Revision: https://reviews.freebsd.org/D30844 (cherry picked from commit 935fc93af157dee352eb4b6c83f8a2a9e7fd9a4e) (cherry picked from commit d261e57deacb0d00d9e827447f235df83dda3e3a) (cherry picked from commit f70c98a2f5d993dc518efd606aa341eda99400ef) (cherry picked from commit 25392fac9488bcae5c451500df2e2945430484a6) (cherry picked from commit 2f4d91f9cb22fc65eb65407e8118b433a5d71976) (cherry picked from commit 4060e77f49d1b9fd2254f3f4da94fd64fce83f72) --- sys/netinet/libalias/HISTORY | 3 +- sys/netinet/libalias/alias_db.c | 502 +++---------------------------------- sys/netinet/libalias/alias_db.h | 443 ++++++++++++++++++++++++++++++++ sys/netinet/libalias/alias_local.h | 10 +- 4 files changed, 489 insertions(+), 469 deletions(-) diff --git a/sys/netinet/libalias/HISTORY b/sys/netinet/libalias/HISTORY index 8965290a4f27..87d5b6f8ed76 100644 --- a/sys/netinet/libalias/HISTORY +++ b/sys/netinet/libalias/HISTORY @@ -146,4 +146,5 @@ Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and Version 3.3: May 2021 (donner) - Dropped LibAliasCheckNewLink - - Refactor the database handling, perfomance improvements. + - Refactor the database handling + - Switch to more effienct SPLAY trees diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index b056f55b56a5..783a8ca3baa8 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -29,120 +29,6 @@ #include __FBSDID("$FreeBSD$"); -/* - Alias_db.c encapsulates all data structures used for storing - packet aliasing data. Other parts of the aliasing software - access data through functions provided in this file. - - Data storage is based on the notion of a "link", which is - established for ICMP echo/reply packets, UDP datagrams and - TCP stream connections. A link stores the original source - and destination addresses. For UDP and TCP, it also stores - source and destination port numbers, as well as an alias - port number. Links are also used to store information about - fragments. - - There is a facility for sweeping through and deleting old - links as new packets are sent through. A simple timeout is - used for ICMP and UDP links. TCP links are left alone unless - there is an incomplete connection, in which case the link - can be deleted after a certain amount of time. - - Initial version: August, 1996 (cjm) - - Version 1.4: September 16, 1996 (cjm) - Facility for handling incoming links added. - - Version 1.6: September 18, 1996 (cjm) - ICMP data handling simplified. - - Version 1.7: January 9, 1997 (cjm) - Fragment handling simplified. - Saves pointers for unresolved fragments. - Permits links for unspecified remote ports - or unspecified remote addresses. - Fixed bug which did not properly zero port - table entries after a link was deleted. - Cleaned up some obsolete comments. - - Version 1.8: January 14, 1997 (cjm) - Fixed data type error in StartPoint(). - (This error did not exist prior to v1.7 - and was discovered and fixed by Ari Suutari) - - Version 1.9: February 1, 1997 - Optionally, connections initiated from packet aliasing host - machine will will not have their port number aliased unless it - conflicts with an aliasing port already being used. (cjm) - - All options earlier being #ifdef'ed are now available through - a new interface, SetPacketAliasMode(). This allows run time - control (which is now available in PPP+pktAlias through the - 'alias' keyword). (ee) - - Added ability to create an alias port without - either destination address or port specified. - port type = ALIAS_PORT_UNKNOWN_DEST_ALL (ee) - - Removed K&R style function headers - and general cleanup. (ee) - - Added packetAliasMode to replace compiler #defines's (ee) - - Allocates sockets for partially specified - ports if ALIAS_USE_SOCKETS defined. (cjm) - - Version 2.0: March, 1997 - SetAliasAddress() will now clean up alias links - if the aliasing address is changed. (cjm) - - PacketAliasPermanentLink() function added to support permanent - links. (J. Fortes suggested the need for this.) - Examples: - - (192.168.0.1, port 23) <-> alias port 6002, unknown dest addr/port - - (192.168.0.2, port 21) <-> alias port 3604, known dest addr - unknown dest port - - These permanent links allow for incoming connections to - machines on the local network. They can be given with a - user-chosen amount of specificity, with increasing specificity - meaning more security. (cjm) - - Quite a bit of rework to the basic engine. The portTable[] - array, which kept track of which ports were in use was replaced - by a table/linked list structure. (cjm) - - SetExpire() function added. (cjm) - - DeleteLink() no longer frees memory association with a pointer - to a fragment (this bug was first recognized by E. Eklund in - v1.9). - - Version 2.1: May, 1997 (cjm) - Packet aliasing engine reworked so that it can handle - multiple external addresses rather than just a single - host address. - - PacketAliasRedirectPort() and PacketAliasRedirectAddr() - added to the API. The first function is a more generalized - version of PacketAliasPermanentLink(). The second function - implements static network address translation. - - Version 3.2: July, 2000 (salander and satoh) - Added FindNewPortGroup to get contiguous range of port values. - - Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing - link but not actually add one. - - Added FindRtspOut, which is closely derived from FindUdpTcpOut, - except that the alias port (from FindNewPortGroup) is provided - as input. - - See HISTORY file for additional revisions. -*/ - #ifdef _KERNEL #include #include @@ -175,177 +61,11 @@ __FBSDID("$FreeBSD$"); #include "alias_mod.h" #endif +#include "alias_db.h" + static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); int LibAliasTime; -/* - Constants (note: constants are also defined - near relevant functions or structs) -*/ - -/* Timeouts (in seconds) for different link types */ -#define ICMP_EXPIRE_TIME 60 -#define UDP_EXPIRE_TIME 60 -#define PROTO_EXPIRE_TIME 60 -#define FRAGMENT_ID_EXPIRE_TIME 10 -#define FRAGMENT_PTR_EXPIRE_TIME 30 - -/* TCP link expire time for different cases */ -/* When the link has been used and closed - minimal grace time to - allow ACKs and potential re-connect in FTP (XXX - is this allowed?) */ -#ifndef TCP_EXPIRE_DEAD -#define TCP_EXPIRE_DEAD 10 -#endif - -/* When the link has been used and closed on one side - the other side - is allowed to still send data */ -#ifndef TCP_EXPIRE_SINGLEDEAD -#define TCP_EXPIRE_SINGLEDEAD 90 -#endif - -/* When the link isn't yet up */ -#ifndef TCP_EXPIRE_INITIAL -#define TCP_EXPIRE_INITIAL 300 -#endif - -/* When the link is up */ -#ifndef TCP_EXPIRE_CONNECTED -#define TCP_EXPIRE_CONNECTED 86400 -#endif - -/* Dummy port number codes used for FindLinkIn/Out() and AddLink(). - These constants can be anything except zero, which indicates an - unknown port number. */ - -#define NO_DEST_PORT 1 -#define NO_SRC_PORT 1 - -/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ -static struct in_addr const ANY_ADDR = { INADDR_ANY }; - -/* Data Structures - - The fundamental data structure used in this program is - "struct alias_link". Whenever a TCP connection is made, - a UDP datagram is sent out, or an ICMP echo request is made, - a link record is made (if it has not already been created). - The link record is identified by the source address/port - and the destination address/port. In the case of an ICMP - echo request, the source port is treated as being equivalent - with the 16-bit ID number of the ICMP packet. - - The link record also can store some auxiliary data. For - TCP connections that have had sequence and acknowledgment - modifications, data space is available to track these changes. - A state field is used to keep track in changes to the TCP - connection state. ID numbers of fragments can also be - stored in the auxiliary space. Pointers to unresolved - fragments can also be stored. - - The link records support two independent chainings. Lookup - tables for input and out tables hold the initial pointers - the link chains. On input, the lookup table indexes on alias - port and link type. On output, the lookup table indexes on - source address, destination address, source port, destination - port and link type. -*/ - -/* used to save changes to ACK/sequence numbers */ -struct ack_data_record { - u_long ack_old; - u_long ack_new; - int delta; - int active; -}; - -/* Information about TCP connection */ -struct tcp_state { - int in; /* State for outside -> inside */ - int out; /* State for inside -> outside */ - int index; /* Index to ACK data array */ - /* Indicates whether ACK and sequence numbers been modified */ - int ack_modified; -}; - -/* Number of distinct ACK number changes - * saved for a modified TCP stream */ -#define N_LINK_TCP_DATA 3 -struct tcp_dat { - struct tcp_state state; - struct ack_data_record ack[N_LINK_TCP_DATA]; - /* Which firewall record is used for this hole? */ - int fwhole; -}; - -/* LSNAT server pool (circular list) */ -struct server { - struct in_addr addr; - u_short port; - struct server *next; -}; - -/* Main data structure */ -struct alias_link { - struct libalias *la; - /* Address and port information */ - struct in_addr src_addr; - struct in_addr dst_addr; - struct in_addr alias_addr; - struct in_addr proxy_addr; - u_short src_port; - u_short dst_port; - u_short alias_port; - u_short proxy_port; - struct server *server; - /* Type of link: TCP, UDP, ICMP, proto, frag */ - int link_type; -/* values for link_type */ -#define LINK_ICMP IPPROTO_ICMP -#define LINK_UDP IPPROTO_UDP -#define LINK_TCP IPPROTO_TCP -#define LINK_FRAGMENT_ID (IPPROTO_MAX + 1) -#define LINK_FRAGMENT_PTR (IPPROTO_MAX + 2) -#define LINK_ADDR (IPPROTO_MAX + 3) -#define LINK_PPTP (IPPROTO_MAX + 4) - - int flags; /* indicates special characteristics */ - int pflags; /* protocol-specific flags */ -/* flag bits */ -#define LINK_UNKNOWN_DEST_PORT 0x01 -#define LINK_UNKNOWN_DEST_ADDR 0x02 -#define LINK_PERMANENT 0x04 -#define LINK_PARTIALLY_SPECIFIED 0x03 /* logical-or of first two bits */ -#define LINK_UNFIREWALLED 0x08 - - int timestamp; /* Time link was last accessed */ -#ifndef NO_USE_SOCKETS - int sockfd; /* socket descriptor */ -#endif - /* Linked list of pointers for input and output lookup tables */ - union { - struct { - LIST_ENTRY(alias_link) in; - LIST_ENTRY(alias_link) out; - } all; - struct { - LIST_ENTRY(alias_link) list; - } pptp; - }; - struct { - TAILQ_ENTRY(alias_link) list; - int time; /* Expire time for link */ - } expire; - /* Auxiliary data */ - union { - char *frag_ptr; - struct in_addr frag_addr; - struct tcp_dat *tcp; - } data; -}; - -/* Clean up procedure. */ -static void finishoff(void); - /* Kernel module definition. */ #ifdef _KERNEL MALLOC_DEFINE(M_ALIAS, "libalias", "packet aliasing"); @@ -373,96 +93,32 @@ static moduledata_t alias_mod = { DECLARE_MODULE(alias, alias_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND); #endif -/* Internal utility routines (used only in alias_db.c) - -Lookup table starting points: - StartPointIn() -- link table initial search point for - incoming packets - StartPointOut() -- link table initial search point for - outgoing packets - -Miscellaneous: - SeqDiff() -- difference between two TCP sequences - ShowAliasStats() -- send alias statistics to a monitor file -*/ - -/* Local prototypes */ -static struct group_in * -StartPointIn(struct libalias *, struct in_addr, u_short, int, int); -static u_int -StartPointOut(struct in_addr, struct in_addr, u_short, u_short, int); -static int SeqDiff(u_long, u_long); - -#ifndef NO_FW_PUNCH -/* Firewall control */ -static void InitPunchFW(struct libalias *); -static void UninitPunchFW(struct libalias *); -static void ClearFWHole(struct alias_link *); - -#endif - -/* Log file control */ -static void ShowAliasStats(struct libalias *); -static int InitPacketAliasLog(struct libalias *); -static void UninitPacketAliasLog(struct libalias *); - -void SctpShowAliasStats(struct libalias *la); - -#define INGUARD \ - if (grp->alias_port != alias_port || \ - grp->link_type != link_type || \ - grp->alias_addr.s_addr != alias_addr.s_addr) \ - continue; +SPLAY_GENERATE(splay_out, alias_link, all.out, cmp_out); +SPLAY_GENERATE(splay_in, group_in, in, cmp_in); static struct group_in * StartPointIn(struct libalias *la, struct in_addr alias_addr, u_short alias_port, int link_type, int create) { - u_int n; - struct group_in *grp, *tmp; - - n = alias_addr.s_addr; - n += alias_port; - n += link_type; - n %= LINK_TABLE_IN_SIZE; + struct group_in *grp; + struct group_in needle = { + .alias_addr = alias_addr, + .alias_port = alias_port, + .link_type = link_type + }; - LIST_FOREACH_SAFE(grp, &la->groupTableIn[n], group_in, tmp) { - /* Auto cleanup */ - if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { - LIST_REMOVE(grp, group_in); - free(grp); - } else { - INGUARD; - return (grp); - } - } - if (!create || (grp = malloc(sizeof(*grp))) == NULL) + grp = SPLAY_FIND(splay_in, &la->linkSplayIn, &needle); + if (grp != NULL || !create || (grp = malloc(sizeof(*grp))) == NULL) return (grp); grp->alias_addr = alias_addr; grp->alias_port = alias_port; grp->link_type = link_type; LIST_INIT(&grp->full); LIST_INIT(&grp->partial); - LIST_INSERT_HEAD(&la->groupTableIn[n], grp, group_in); + SPLAY_INSERT(splay_in, &la->linkSplayIn, grp); return (grp); } -#undef INGUARD - -static u_int -StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, - u_short src_port, u_short dst_port, int link_type) -{ - u_int n; - - n = src_addr.s_addr; - n += dst_addr.s_addr; - n += src_port; - n += dst_port; - n += link_type; - - return (n % LINK_TABLE_OUT_SIZE); -} static int SeqDiff(u_long x, u_long y) @@ -531,53 +187,6 @@ void SctpShowAliasStats(struct libalias *la) ShowAliasStats(la); } -/* Internal routines for finding, deleting and adding links - -Port Allocation: - GetNewPort() -- find and reserve new alias port number - GetSocket() -- try to allocate a socket for a given port - -Link creation and deletion: - CleanupAliasData() - remove all link chains from lookup table - CleanupLink() - look for a stale link - DeleteLink() - remove link - AddLink() - add link - ReLink() - change link - -Link search: - FindLinkOut() - find link for outgoing packets - FindLinkIn() - find link for incoming packets - -Port search: - FindNewPortGroup() - find an available group of ports -*/ - -/* Local prototypes */ -static int GetNewPort(struct libalias *, struct alias_link *, int); -#ifndef NO_USE_SOCKETS -static u_short GetSocket(struct libalias *, u_short, int *, int); -#endif -static void CleanupAliasData(struct libalias *, int); -static void CleanupLink(struct libalias *, struct alias_link **, int); -static void DeleteLink(struct alias_link **, int); -static struct alias_link * -UseLink(struct libalias *, struct alias_link *); - -static struct alias_link * -ReLink(struct alias_link *, - struct in_addr, struct in_addr, struct in_addr, - u_short, u_short, int, int, int); - -static struct alias_link * -FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); - -static struct alias_link * -FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); - -static u_short _RandomPort(struct libalias *la); - -#define GET_NEW_PORT_MAX_ATTEMPTS 20 - /* get random port in network byte order */ static u_short _RandomPort(struct libalias *la) { @@ -814,25 +423,13 @@ static void CleanupAliasData(struct libalias *la, int deletePermanent) { struct alias_link *lnk, *lnk_tmp; - u_int i; LIBALIAS_LOCK_ASSERT(la); /* permanent entries may stay */ TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, expire.list, lnk_tmp) DeleteLink(&lnk, deletePermanent); - - for (i = 0; i < LINK_TABLE_IN_SIZE; i++) { - struct group_in *grp, *grp_tmp; - - LIST_FOREACH_SAFE(grp, &la->groupTableIn[i], group_in, grp_tmp) - if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { - LIST_REMOVE(grp, group_in); - free(grp); - } - } } - static void CleanupLink(struct libalias *la, struct alias_link **lnk, int deletePermanent) { @@ -881,7 +478,9 @@ DeleteLink(struct alias_link **plnk, int deletePermanent) case LINK_PPTP: LIST_REMOVE(lnk, pptp.list); break; - default: + default: { + struct group_in *grp; + /* Free memory allocated for LSNAT server pool */ if (lnk->server != NULL) { struct server *head, *curr, *next; @@ -893,11 +492,21 @@ DeleteLink(struct alias_link **plnk, int deletePermanent) } while ((curr = next) != head); } else { /* Adjust output table pointers */ - LIST_REMOVE(lnk, all.out); + SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); } /* Adjust input table pointers */ LIST_REMOVE(lnk, all.in); + + /* Remove intermediate node, if empty */ + grp = StartPointIn(la, lnk->alias_addr, lnk->alias_port, lnk->link_type, 0); + if (grp != NULL && + LIST_EMPTY(&grp->full) && + LIST_EMPTY(&grp->partial)) { + SPLAY_REMOVE(splay_in, &la->linkSplayIn, grp); + free(grp); + } + } break; } @@ -956,7 +565,6 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, struct in_addr alias_addr, u_short src_port, u_short dst_port, int alias_port_param, int link_type) { - u_int start_point; struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); @@ -1083,9 +691,7 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, } /* Set up pointers for output lookup table */ - start_point = StartPointOut(src_addr, dst_addr, - src_port, dst_port, link_type); - LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, all.out); + SPLAY_INSERT(splay_out, &la->linkSplayOut, lnk); /* Set up pointers for input lookup table */ if (lnk->flags & LINK_PARTIALLY_SPECIFIED) @@ -1138,35 +744,25 @@ ReLink(struct alias_link *old_lnk, return (new_lnk); } - -#define OUTGUARD \ - if (lnk->src_port != src_port || \ - lnk->src_addr.s_addr != src_addr.s_addr || \ - lnk->dst_addr.s_addr != dst_addr.s_addr || \ - lnk->dst_port != dst_port || \ - lnk->link_type != link_type) \ - continue; - static struct alias_link * _SearchLinkOut(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, u_short src_port, u_short dst_port, int link_type) { - u_int i; struct alias_link *lnk; + struct alias_link needle = { + .src_addr = src_addr, + .dst_addr = dst_addr, + .src_port = src_port, + .dst_port = dst_port, + .link_type = link_type + }; - i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); - LIST_FOREACH(lnk, &la->linkTableOut[i], all.out) { - OUTGUARD; - return (UseLink(la, lnk)); - } - - return (NULL); + lnk = SPLAY_FIND(splay_out, &la->linkSplayOut, &needle); + return (UseLink(la, lnk)); } -#undef OUTGUARD - static struct alias_link * _FindLinkOut(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, @@ -2331,7 +1927,7 @@ LibAliasAddServer(struct libalias *la, struct alias_link *lnk, struct in_addr ad if (head == NULL) { server->next = server; /* not usable for outgoing connections */ - LIST_REMOVE(lnk, all.out); + SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); } else { struct server *s; @@ -2481,8 +2077,6 @@ finishoff(void) struct libalias * LibAliasInit(struct libalias *la) { - int i; - if (la == NULL) { #ifdef _KERNEL #undef malloc /* XXX: ugly */ @@ -2506,10 +2100,8 @@ LibAliasInit(struct libalias *la) LibAliasTime = time(NULL); #endif - for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) - LIST_INIT(&la->linkTableOut[i]); - for (i = 0; i < LINK_TABLE_IN_SIZE; i++) - LIST_INIT(&la->groupTableIn[i]); + SPLAY_INIT(&la->linkSplayIn); + SPLAY_INIT(&la->linkSplayOut); LIST_INIT(&la->pptpList); TAILQ_INIT(&la->checkExpire); #ifdef _KERNEL @@ -2702,20 +2294,6 @@ fill_rule(void *buf, int bufsize, int rulenum, return ((char *)cmd - (char *)buf); } -static void ClearAllFWHoles(struct libalias *la); - -#define fw_setfield(la, field, num) \ -do { \ - (field)[(num) - la->fireWallBaseNum] = 1; \ -} /*lint -save -e717 */ while(0)/* lint -restore */ - -#define fw_clrfield(la, field, num) \ -do { \ - (field)[(num) - la->fireWallBaseNum] = 0; \ -} /*lint -save -e717 */ while(0)/* lint -restore */ - -#define fw_tstfield(la, field, num) ((field)[(num) - la->fireWallBaseNum]) - static void InitPunchFW(struct libalias *la) { diff --git a/sys/netinet/libalias/alias_db.h b/sys/netinet/libalias/alias_db.h new file mode 100644 index 000000000000..971ca305c1a6 --- /dev/null +++ b/sys/netinet/libalias/alias_db.h @@ -0,0 +1,443 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Charles Mott + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 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. + */ + +/* + Alias_db.c encapsulates all data structures used for storing + packet aliasing data. Other parts of the aliasing software + access data through functions provided in this file. + + Data storage is based on the notion of a "link", which is + established for ICMP echo/reply packets, UDP datagrams and + TCP stream connections. A link stores the original source + and destination addresses. For UDP and TCP, it also stores + source and destination port numbers, as well as an alias + port number. Links are also used to store information about + fragments. + + There is a facility for sweeping through and deleting old + links as new packets are sent through. A simple timeout is + used for ICMP and UDP links. TCP links are left alone unless + there is an incomplete connection, in which case the link + can be deleted after a certain amount of time. + + Initial version: August, 1996 (cjm) + + Version 1.4: September 16, 1996 (cjm) + Facility for handling incoming links added. + + Version 1.6: September 18, 1996 (cjm) + ICMP data handling simplified. + + Version 1.7: January 9, 1997 (cjm) + Fragment handling simplified. + Saves pointers for unresolved fragments. + Permits links for unspecified remote ports + or unspecified remote addresses. + Fixed bug which did not properly zero port + table entries after a link was deleted. + Cleaned up some obsolete comments. + + Version 1.8: January 14, 1997 (cjm) + Fixed data type error in StartPoint(). + (This error did not exist prior to v1.7 + and was discovered and fixed by Ari Suutari) + + Version 1.9: February 1, 1997 + Optionally, connections initiated from packet aliasing host + machine will will not have their port number aliased unless it + conflicts with an aliasing port already being used. (cjm) + + All options earlier being #ifdef'ed are now available through + a new interface, SetPacketAliasMode(). This allows run time + control (which is now available in PPP+pktAlias through the + 'alias' keyword). (ee) + + Added ability to create an alias port without + either destination address or port specified. + port type = ALIAS_PORT_UNKNOWN_DEST_ALL (ee) + + Removed K&R style function headers + and general cleanup. (ee) + + Added packetAliasMode to replace compiler #defines's (ee) + + Allocates sockets for partially specified + ports if ALIAS_USE_SOCKETS defined. (cjm) + + Version 2.0: March, 1997 + SetAliasAddress() will now clean up alias links + if the aliasing address is changed. (cjm) + + PacketAliasPermanentLink() function added to support permanent + links. (J. Fortes suggested the need for this.) + Examples: + + (192.168.0.1, port 23) <-> alias port 6002, unknown dest addr/port + + (192.168.0.2, port 21) <-> alias port 3604, known dest addr + unknown dest port + + These permanent links allow for incoming connections to + machines on the local network. They can be given with a + user-chosen amount of specificity, with increasing specificity + meaning more security. (cjm) + + Quite a bit of rework to the basic engine. The portTable[] + array, which kept track of which ports were in use was replaced + by a table/linked list structure. (cjm) + + SetExpire() function added. (cjm) + + DeleteLink() no longer frees memory association with a pointer + to a fragment (this bug was first recognized by E. Eklund in + v1.9). + + Version 2.1: May, 1997 (cjm) + Packet aliasing engine reworked so that it can handle + multiple external addresses rather than just a single + host address. + + PacketAliasRedirectPort() and PacketAliasRedirectAddr() + added to the API. The first function is a more generalized + version of PacketAliasPermanentLink(). The second function + implements static network address translation. + + Version 3.2: July, 2000 (salander and satoh) + Added FindNewPortGroup to get contiguous range of port values. + + Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing + link but not actually add one. + + Added FindRtspOut, which is closely derived from FindUdpTcpOut, + except that the alias port (from FindNewPortGroup) is provided + as input. + + See HISTORY file for additional revisions. +*/ + +#ifndef _ALIAS_DB_H_ +#define _ALIAS_DB_H_ + + +/* + Constants (note: constants are also defined + near relevant functions or structs) +*/ + +/* Timeouts (in seconds) for different link types */ +#define ICMP_EXPIRE_TIME 60 +#define UDP_EXPIRE_TIME 60 +#define PROTO_EXPIRE_TIME 60 +#define FRAGMENT_ID_EXPIRE_TIME 10 +#define FRAGMENT_PTR_EXPIRE_TIME 30 + +/* TCP link expire time for different cases */ +/* When the link has been used and closed - minimal grace time to + allow ACKs and potential re-connect in FTP (XXX - is this allowed?) */ +#ifndef TCP_EXPIRE_DEAD +#define TCP_EXPIRE_DEAD 10 +#endif + +/* When the link has been used and closed on one side - the other side + is allowed to still send data */ +#ifndef TCP_EXPIRE_SINGLEDEAD +#define TCP_EXPIRE_SINGLEDEAD 90 +#endif + +/* When the link isn't yet up */ +#ifndef TCP_EXPIRE_INITIAL +#define TCP_EXPIRE_INITIAL 300 +#endif + +/* When the link is up */ +#ifndef TCP_EXPIRE_CONNECTED +#define TCP_EXPIRE_CONNECTED 86400 +#endif + +/* Dummy port number codes used for FindLinkIn/Out() and AddLink(). + These constants can be anything except zero, which indicates an + unknown port number. */ + +#define NO_DEST_PORT 1 +#define NO_SRC_PORT 1 + +/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ +static struct in_addr const ANY_ADDR = { INADDR_ANY }; + +/* Data Structures + + The fundamental data structure used in this program is + "struct alias_link". Whenever a TCP connection is made, + a UDP datagram is sent out, or an ICMP echo request is made, + a link record is made (if it has not already been created). + The link record is identified by the source address/port + and the destination address/port. In the case of an ICMP + echo request, the source port is treated as being equivalent + with the 16-bit ID number of the ICMP packet. + + The link record also can store some auxiliary data. For + TCP connections that have had sequence and acknowledgment + modifications, data space is available to track these changes. + A state field is used to keep track in changes to the TCP + connection state. ID numbers of fragments can also be + stored in the auxiliary space. Pointers to unresolved + fragments can also be stored. + + The link records support two independent chainings. Lookup + tables for input and out tables hold the initial pointers + the link chains. On input, the lookup table indexes on alias + port and link type. On output, the lookup table indexes on + source address, destination address, source port, destination + port and link type. +*/ + +/* used to save changes to ACK/sequence numbers */ +struct ack_data_record { + u_long ack_old; + u_long ack_new; + int delta; + int active; +}; + +/* Information about TCP connection */ +struct tcp_state { + int in; /* State for outside -> inside */ + int out; /* State for inside -> outside */ + int index; /* Index to ACK data array */ + /* Indicates whether ACK and sequence numbers been modified */ + int ack_modified; +}; + +/* Number of distinct ACK number changes + * saved for a modified TCP stream */ +#define N_LINK_TCP_DATA 3 +struct tcp_dat { + struct tcp_state state; + struct ack_data_record ack[N_LINK_TCP_DATA]; + /* Which firewall record is used for this hole? */ + int fwhole; +}; + +/* LSNAT server pool (circular list) */ +struct server { + struct in_addr addr; + u_short port; + struct server *next; +}; + +/* Main data structure */ +struct alias_link { + struct libalias *la; + /* Address and port information */ + struct in_addr src_addr; + struct in_addr dst_addr; + struct in_addr alias_addr; + struct in_addr proxy_addr; + u_short src_port; + u_short dst_port; + u_short alias_port; + u_short proxy_port; + struct server *server; + /* Type of link: TCP, UDP, ICMP, proto, frag */ + int link_type; +/* values for link_type */ +#define LINK_ICMP IPPROTO_ICMP +#define LINK_UDP IPPROTO_UDP +#define LINK_TCP IPPROTO_TCP +#define LINK_FRAGMENT_ID (IPPROTO_MAX + 1) +#define LINK_FRAGMENT_PTR (IPPROTO_MAX + 2) +#define LINK_ADDR (IPPROTO_MAX + 3) +#define LINK_PPTP (IPPROTO_MAX + 4) + + int flags; /* indicates special characteristics */ + int pflags; /* protocol-specific flags */ +/* flag bits */ +#define LINK_UNKNOWN_DEST_PORT 0x01 +#define LINK_UNKNOWN_DEST_ADDR 0x02 +#define LINK_PERMANENT 0x04 *** 203 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jul 6 07:02:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AD61C651A9B; Tue, 6 Jul 2021 07:02: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 4GJtmL4Zj5z4YQw; Tue, 6 Jul 2021 07:02: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 85148155D7; Tue, 6 Jul 2021 07:02: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 16672gle076530; Tue, 6 Jul 2021 07:02:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16672gE0076529; Tue, 6 Jul 2021 07:02:42 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:02:42 GMT Message-Id: <202107060702.16672gE0076529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 382376f39863 - main - enetc: Add support for 2.5G fixed-link speed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 382376f39863d553808f96527bc53bf7149780fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:02:42 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=382376f39863d553808f96527bc53bf7149780fe commit 382376f39863d553808f96527bc53bf7149780fe Author: Wojciech Macek AuthorDate: 2021-07-06 07:01:30 +0000 Commit: Wojciech Macek CommitDate: 2021-07-06 07:01:30 +0000 enetc: Add support for 2.5G fixed-link speed With the v5.13 device-tree update speed of the CPU switch port was changed to 2.5G. Reflect that in the driver. Submitted by: Kornel Duleba Obtained from: Semihalf Sponsored by: Alstom Group --- sys/dev/enetc/if_enetc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c index 03bd7462a062..54cdc6ea9ad4 100644 --- a/sys/dev/enetc/if_enetc.c +++ b/sys/dev/enetc/if_enetc.c @@ -287,6 +287,9 @@ enetc_setup_fixed(struct enetc_softc *sc, phandle_t node) case 1000: speed = IFM_1000_T; break; + case 2500: + speed = IFM_2500_T; + break; default: device_printf(sc->dev, "Unsupported link speed value of %d\n", speed); From owner-dev-commits-src-all@freebsd.org Tue Jul 6 07:11:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A8C5F6517BC; Tue, 6 Jul 2021 07:11: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 4GJtyv4BP6z4ZcM; Tue, 6 Jul 2021 07:11: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 77E041579E; Tue, 6 Jul 2021 07:11: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 1667BpeB089644; Tue, 6 Jul 2021 07:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1667BpB7089643; Tue, 6 Jul 2021 07:11:51 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:11:51 GMT Message-Id: <202107060711.1667BpB7089643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: c207bb80909f - stable/12 - libalias: tidy up housekeeping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c207bb80909f437c95a84e3e4e9318d15de444f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:11:51 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=c207bb80909f437c95a84e3e4e9318d15de444f1 commit c207bb80909f437c95a84e3e4e9318d15de444f1 Author: Lutz Donnerhacke AuthorDate: 2021-05-15 15:35:36 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 07:07:43 +0000 libalias: tidy up housekeeping Replace current expensive, but sparsly called housekeeping by a single, repetive action. This is part of a larger restructure of libalias in order to switch to more efficient data structures. The whole restructure process is split into 15 reviews to ease reviewing. All those steps will be squashed into a single commit for MFC in order to hide the intermediate states from production systems. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30277 (cherry picked from commit 294799c6b081faece556a5010a4f51552e131c2f) --- sys/netinet/libalias/alias_db.c | 104 ++++++++++++++++--------------------- sys/netinet/libalias/alias_local.h | 6 +-- 2 files changed, 47 insertions(+), 63 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 7c2faa62f7fc..d3018a400022 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -182,11 +182,6 @@ static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); near relevant functions or structs) */ -/* Parameters used for cleanup of expired links */ -/* NOTE: ALIAS_CLEANUP_INTERVAL_SECS must be less then LINK_TABLE_OUT_SIZE */ -#define ALIAS_CLEANUP_INTERVAL_SECS 64 -#define ALIAS_CLEANUP_MAX_SPOKES (LINK_TABLE_OUT_SIZE/5) - /* Timeouts (in seconds) for different link types */ #define ICMP_EXPIRE_TIME 60 #define UDP_EXPIRE_TIME 60 @@ -329,6 +324,7 @@ struct alias_link { /* Linked list of pointers for input and output lookup tables */ LIST_ENTRY (alias_link) list_out; LIST_ENTRY (alias_link) list_in; + TAILQ_ENTRY (alias_link) list_expire; /* Auxiliary data */ union { char *frag_ptr; @@ -510,7 +506,7 @@ Port Allocation: Link creation and deletion: CleanupAliasData() - remove all link chains from lookup table - IncrementalCleanup() - look for stale links in a single chain + CleanupLink() - look for a stale link DeleteLink() - remove link AddLink() - add link ReLink() - change link @@ -529,8 +525,8 @@ static int GetNewPort(struct libalias *, struct alias_link *, int); static u_short GetSocket(struct libalias *, u_short, int *, int); #endif static void CleanupAliasData(struct libalias *); -static void IncrementalCleanup(struct libalias *); -static void DeleteLink(struct alias_link *); +static void CleanupLink(struct libalias *, struct alias_link **); +static void DeleteLink(struct alias_link **); static struct alias_link * ReLink(struct alias_link *, @@ -807,41 +803,38 @@ FindNewPortGroup(struct libalias *la, static void CleanupAliasData(struct libalias *la) { - struct alias_link *lnk; - int i; + struct alias_link *lnk, *lnk_tmp; LIBALIAS_LOCK_ASSERT(la); - for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) { - lnk = LIST_FIRST(&la->linkTableOut[i]); - while (lnk != NULL) { - struct alias_link *link_next = LIST_NEXT(lnk, list_out); - DeleteLink(lnk); - lnk = link_next; - } - } - la->cleanupIndex = 0; + /* permanent entries may stay */ + TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, list_expire, lnk_tmp) + DeleteLink(&lnk); } static void -IncrementalCleanup(struct libalias *la) +CleanupLink(struct libalias *la, struct alias_link **lnk) { - struct alias_link *lnk, *lnk_tmp; - LIBALIAS_LOCK_ASSERT(la); - LIST_FOREACH_SAFE(lnk, &la->linkTableOut[la->cleanupIndex++], - list_out, lnk_tmp) { - if (la->timeStamp - lnk->timestamp > lnk->expire_time) - DeleteLink(lnk); + + if (lnk == NULL || *lnk == NULL) + return; + + if (la->timeStamp - (*lnk)->timestamp > (*lnk)->expire_time) { + DeleteLink(lnk); + if ((*lnk) == NULL) + return; } - if (la->cleanupIndex == LINK_TABLE_OUT_SIZE) - la->cleanupIndex = 0; + /* move to end, swap may fail on a single entry list */ + TAILQ_REMOVE(&la->checkExpire, (*lnk), list_expire); + TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), list_expire); } static void -DeleteLink(struct alias_link *lnk) +DeleteLink(struct alias_link **plnk) { + struct alias_link *lnk = *plnk; struct libalias *la = lnk->la; LIBALIAS_LOCK_ASSERT(la); @@ -869,6 +862,10 @@ DeleteLink(struct alias_link *lnk) /* Adjust input table pointers */ LIST_REMOVE(lnk, list_in); + + /* remove from housekeeping */ + TAILQ_REMOVE(&la->checkExpire, lnk, list_expire); + #ifndef NO_USE_SOCKETS /* Close socket, if one has been allocated */ if (lnk->sockfd != -1) { @@ -908,6 +905,7 @@ DeleteLink(struct alias_link *lnk) /* Free memory */ free(lnk); + *plnk = NULL; /* Write statistics, if logging enabled */ if (la->packetAliasMode & PKT_ALIAS_LOG) { @@ -1039,6 +1037,9 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, /* Set up pointers for input lookup table */ start_point = StartPointIn(alias_addr, lnk->alias_port, link_type); LIST_INSERT_HEAD(&la->linkTableIn[start_point], lnk, list_in); + + /* Include the element into the housekeeping list */ + TAILQ_INSERT_TAIL(&la->checkExpire, lnk, list_expire); } else { #ifdef LIBALIAS_DEBUG fprintf(stderr, "PacketAlias/AddLink(): "); @@ -1079,7 +1080,7 @@ ReLink(struct alias_link *old_lnk, PunchFWHole(new_lnk); } #endif - DeleteLink(old_lnk); + DeleteLink(&old_lnk); return (new_lnk); } @@ -1102,12 +1103,14 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, lnk->src_port == src_port && lnk->dst_port == dst_port && lnk->link_type == link_type && - lnk->server == NULL) { - lnk->timestamp = la->timeStamp; + lnk->server == NULL) break; - } } + CleanupLink(la, &lnk); + if (lnk != NULL) + lnk->timestamp = la->timeStamp; + /* Search for partially specified links. */ if (lnk == NULL && replace_partial_links) { if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY) { @@ -1235,6 +1238,7 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, } } + CleanupLink(la, &lnk_fully_specified); if (lnk_fully_specified != NULL) { lnk_fully_specified->timestamp = la->timeStamp; lnk = lnk_fully_specified; @@ -1572,6 +1576,7 @@ FindPptpOutByCallId(struct libalias *la, struct in_addr src_addr, lnk->src_port == src_call_id) break; + CleanupLink(la, &lnk); return (lnk); } @@ -1592,6 +1597,7 @@ FindPptpOutByPeerCallId(struct libalias *la, struct in_addr src_addr, lnk->dst_port == dst_call_id) break; + CleanupLink(la, &lnk); return (lnk); } @@ -1612,6 +1618,7 @@ FindPptpInByCallId(struct libalias *la, struct in_addr dst_addr, lnk->dst_port == dst_call_id) break; + CleanupLink(la, &lnk); return (lnk); } @@ -2038,7 +2045,7 @@ SetExpire(struct alias_link *lnk, int expire) { if (expire == 0) { lnk->flags &= ~LINK_PERMANENT; - DeleteLink(lnk); + DeleteLink(&lnk); } else if (expire == -1) { lnk->flags |= LINK_PERMANENT; } else if (expire > 0) { @@ -2094,7 +2101,7 @@ SetDestCallId(struct alias_link *lnk, u_int16_t cid) void HouseKeeping(struct libalias *la) { - int i, n; + struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); #ifndef _KERNEL struct timeval tv; #endif @@ -2111,25 +2118,7 @@ HouseKeeping(struct libalias *la) gettimeofday(&tv, NULL); la->timeStamp = tv.tv_sec; #endif - - /* Compute number of spokes (output table link chains) to cover */ - n = LINK_TABLE_OUT_SIZE * (la->timeStamp - la->lastCleanupTime); - n /= ALIAS_CLEANUP_INTERVAL_SECS; - - /* Handle different cases */ - if (n > 0) { - if (n > ALIAS_CLEANUP_MAX_SPOKES) - n = ALIAS_CLEANUP_MAX_SPOKES; - la->lastCleanupTime = la->timeStamp; - for (i = 0; i < n; i++) - IncrementalCleanup(la); - } else if (n < 0) { -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/HouseKeeping(): "); - fprintf(stderr, "something unexpected in time values\n"); -#endif - la->lastCleanupTime = la->timeStamp; - } + CleanupLink(la, &lnk); } /* Init the log file and enable logging */ @@ -2356,7 +2345,7 @@ LibAliasRedirectDelete(struct libalias *la, struct alias_link *lnk) { LIBALIAS_LOCK(la); la->deleteAllLinks = 1; - DeleteLink(lnk); + DeleteLink(&lnk); la->deleteAllLinks = 0; LIBALIAS_UNLOCK(la); } @@ -2426,17 +2415,16 @@ LibAliasInit(struct libalias *la) #ifdef _KERNEL la->timeStamp = time_uptime; - la->lastCleanupTime = time_uptime; #else gettimeofday(&tv, NULL); la->timeStamp = tv.tv_sec; - la->lastCleanupTime = tv.tv_sec; #endif for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) LIST_INIT(&la->linkTableOut[i]); for (i = 0; i < LINK_TABLE_IN_SIZE; i++) LIST_INIT(&la->linkTableIn[i]); + TAILQ_INIT(&la->checkExpire); #ifdef _KERNEL AliasSctpInit(la); #endif @@ -2466,8 +2454,6 @@ LibAliasInit(struct libalias *la) la->fragmentPtrLinkCount = 0; la->sockCount = 0; - la->cleanupIndex = 0; - la->packetAliasMode = PKT_ALIAS_SAME_PORTS #ifndef NO_USE_SOCKETS | PKT_ALIAS_USE_SOCKETS diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index 61cd30737ce5..fcdaa1690470 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -94,6 +94,8 @@ struct libalias { * output lookup tables. */ LIST_HEAD (, alias_link) linkTableOut[LINK_TABLE_OUT_SIZE]; LIST_HEAD (, alias_link) linkTableIn[LINK_TABLE_IN_SIZE]; + /* HouseKeeping */ + TAILQ_HEAD (, alias_link) checkExpire; /* Link statistics */ int icmpLinkCount; int udpLinkCount; @@ -103,12 +105,8 @@ struct libalias { int fragmentIdLinkCount; int fragmentPtrLinkCount; int sockCount; - /* Index to chain of link table being inspected for old links */ - int cleanupIndex; /* System time in seconds for current packet */ int timeStamp; - /* Last time IncrementalCleanup() was called */ - int lastCleanupTime; /* If equal to zero, DeleteLink() * will not remove permanent links */ int deleteAllLinks; From owner-dev-commits-src-all@freebsd.org Tue Jul 6 07:11:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 34A7C651A57; Tue, 6 Jul 2021 07:11: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 4GJtyw5Qnrz4Zqf; Tue, 6 Jul 2021 07:11: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 A05C3157A0; Tue, 6 Jul 2021 07:11: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 1667BqmS089668; Tue, 6 Jul 2021 07:11:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1667Bq7d089667; Tue, 6 Jul 2021 07:11:52 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:11:52 GMT Message-Id: <202107060711.1667Bq7d089667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: e3c21cc51bec - stable/12 - libalias: Stats are unsigned MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e3c21cc51becd4162b766dd102eef7454891821d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:11:53 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=e3c21cc51becd4162b766dd102eef7454891821d commit e3c21cc51becd4162b766dd102eef7454891821d Author: Lutz Donnerhacke AuthorDate: 2021-05-31 22:08:24 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 07:07:46 +0000 libalias: Stats are unsigned Stats counters are used as unsigned valued (i.e. printf("%u")) but are defined as signed int. This causes trouble later, so fix it early. Differential Revision: https://reviews.freebsd.org/D30587 (cherry picked from commit 3fd20a79e7b55d135bbc5fa197980fe0e9ee0f14) --- sys/netinet/libalias/alias_local.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index fcdaa1690470..8e2fe88fe620 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -97,14 +97,14 @@ struct libalias { /* HouseKeeping */ TAILQ_HEAD (, alias_link) checkExpire; /* Link statistics */ - int icmpLinkCount; - int udpLinkCount; - int tcpLinkCount; - int pptpLinkCount; - int protoLinkCount; - int fragmentIdLinkCount; - int fragmentPtrLinkCount; - int sockCount; + unsigned int icmpLinkCount; + unsigned int udpLinkCount; + unsigned int tcpLinkCount; + unsigned int pptpLinkCount; + unsigned int protoLinkCount; + unsigned int fragmentIdLinkCount; + unsigned int fragmentPtrLinkCount; + unsigned int sockCount; /* System time in seconds for current packet */ int timeStamp; /* If equal to zero, DeleteLink() From owner-dev-commits-src-all@freebsd.org Tue Jul 6 07:11:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 29023651C33; Tue, 6 Jul 2021 07:11: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 4GJtyx6N6rz4ZcS; Tue, 6 Jul 2021 07:11: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 BB0ED15900; Tue, 6 Jul 2021 07:11: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 1667BrNG089692; Tue, 6 Jul 2021 07:11:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1667Brd7089691; Tue, 6 Jul 2021 07:11:53 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:11:53 GMT Message-Id: <202107060711.1667Brd7089691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 8b7b86fa6fe0 - stable/12 - libalias: Promote per instance global variable timeStamp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8b7b86fa6fe0761b7a7dc7034c078fdbfa58c4d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:11:54 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=8b7b86fa6fe0761b7a7dc7034c078fdbfa58c4d9 commit 8b7b86fa6fe0761b7a7dc7034c078fdbfa58c4d9 Author: Lutz Donnerhacke AuthorDate: 2021-05-25 07:07:21 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 07:07:50 +0000 libalias: Promote per instance global variable timeStamp Summary: - Use LibAliasTime as a real global variable for central timekeeping. - Reduce number of syscalls in user space considerably. - Dynamically adjust the packet counters to match the second resolution. - Only check the first few packets after a time increase for expiry. Discussed with: hselasky Differential Revision: https://reviews.freebsd.org/D30566 (cherry picked from commit ef828d39be8e4b6d922db080ed41611702dec56d) --- sys/netinet/libalias/alias_db.c | 60 +++++++++++++++++++++++++------------- sys/netinet/libalias/alias_local.h | 5 ++-- sys/netinet/libalias/alias_sctp.c | 16 +++++----- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index d3018a400022..2759c5170b27 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -176,6 +176,7 @@ __FBSDID("$FreeBSD$"); #endif static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); +int LibAliasTime; /* Constants (note: constants are also defined @@ -820,7 +821,7 @@ CleanupLink(struct libalias *la, struct alias_link **lnk) if (lnk == NULL || *lnk == NULL) return; - if (la->timeStamp - (*lnk)->timestamp > (*lnk)->expire_time) { + if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire_time) { DeleteLink(lnk); if ((*lnk) == NULL) return; @@ -940,7 +941,7 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, #endif lnk->flags = 0; lnk->pflags = 0; - lnk->timestamp = la->timeStamp; + lnk->timestamp = LibAliasTime; /* Expiration time */ switch (link_type) { @@ -1109,7 +1110,7 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, CleanupLink(la, &lnk); if (lnk != NULL) - lnk->timestamp = la->timeStamp; + lnk->timestamp = LibAliasTime; /* Search for partially specified links. */ if (lnk == NULL && replace_partial_links) { @@ -1240,7 +1241,7 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, CleanupLink(la, &lnk_fully_specified); if (lnk_fully_specified != NULL) { - lnk_fully_specified->timestamp = la->timeStamp; + lnk_fully_specified->timestamp = LibAliasTime; lnk = lnk_fully_specified; } else if (lnk_unknown_dst_port != NULL) lnk = lnk_unknown_dst_port; @@ -2101,24 +2102,45 @@ SetDestCallId(struct alias_link *lnk, u_int16_t cid) void HouseKeeping(struct libalias *la) { - struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); -#ifndef _KERNEL - struct timeval tv; -#endif + static unsigned int packets = 0; + static unsigned int packet_limit = 1000; LIBALIAS_LOCK_ASSERT(la); + packets++; + /* - * Save system time (seconds) in global variable timeStamp for use - * by other functions. This is done so as not to unnecessarily - * waste timeline by making system calls. + * User space time/gettimeofday/... is very expensive. + * Kernel space cache trashing is unnecessary. + * + * Save system time (seconds) in global variable LibAliasTime + * for use by other functions. This is done so as not to + * unnecessarily waste timeline by making system calls. + * + * Reduce the amount of house keeping work substantially by + * sampling over the packets. */ + if (packets % packet_limit == 0) { + time_t now; + #ifdef _KERNEL - la->timeStamp = time_uptime; + now = time_uptime; #else - gettimeofday(&tv, NULL); - la->timeStamp = tv.tv_sec; + now = time(NULL); #endif - CleanupLink(la, &lnk); + if (now != LibAliasTime) { + /* retry three times a second */ + packet_limit = packets / 3; + packets = 0; + LibAliasTime = now; + } + + } + /* Do a cleanup for the first packets of the new second only */ + if (packets < (la->udpLinkCount + la->tcpLinkCount)) { + struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); + + CleanupLink(la, &lnk); + } } /* Init the log file and enable logging */ @@ -2392,9 +2414,6 @@ struct libalias * LibAliasInit(struct libalias *la) { int i; -#ifndef _KERNEL - struct timeval tv; -#endif if (la == NULL) { #ifdef _KERNEL @@ -2414,10 +2433,9 @@ LibAliasInit(struct libalias *la) LIST_INSERT_HEAD(&instancehead, la, instancelist); #ifdef _KERNEL - la->timeStamp = time_uptime; + LibAliasTime = time_uptime; #else - gettimeofday(&tv, NULL); - la->timeStamp = tv.tv_sec; + LibAliasTime = time(NULL); #endif for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index 8e2fe88fe620..f1b40f0438da 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -105,8 +105,6 @@ struct libalias { unsigned int fragmentIdLinkCount; unsigned int fragmentPtrLinkCount; unsigned int sockCount; - /* System time in seconds for current packet */ - int timeStamp; /* If equal to zero, DeleteLink() * will not remove permanent links */ int deleteAllLinks; @@ -206,6 +204,9 @@ struct libalias { /* Prototypes */ +/* System time in seconds for current packet */ +extern int LibAliasTime; + /* * SctpFunction prototypes * diff --git a/sys/netinet/libalias/alias_sctp.c b/sys/netinet/libalias/alias_sctp.c index 2dd57e496f7e..96a0718eae1f 100644 --- a/sys/netinet/libalias/alias_sctp.c +++ b/sys/netinet/libalias/alias_sctp.c @@ -297,10 +297,10 @@ static MALLOC_DEFINE(M_SCTPNAT, "sctpnat", "sctp nat dbs"); #define SN_MAX_TIMER 600 #define SN_TIMER_QUEUE_SIZE SN_MAX_TIMER+2 -#define SN_I_T(la) (la->timeStamp + sysctl_init_timer) /**< INIT State expiration time in seconds */ -#define SN_U_T(la) (la->timeStamp + sysctl_up_timer) /**< UP State expiration time in seconds */ -#define SN_C_T(la) (la->timeStamp + sysctl_shutdown_timer) /**< CL State expiration time in seconds */ -#define SN_X_T(la) (la->timeStamp + sysctl_holddown_timer) /**< Wait after a shutdown complete in seconds */ +#define SN_I_T(la) (LibAliasTime + sysctl_init_timer) /**< INIT State expiration time in seconds */ +#define SN_U_T(la) (LibAliasTime + sysctl_up_timer) /**< UP State expiration time in seconds */ +#define SN_C_T(la) (LibAliasTime + sysctl_shutdown_timer) /**< CL State expiration time in seconds */ +#define SN_X_T(la) (LibAliasTime + sysctl_holddown_timer) /**< Wait after a shutdown complete in seconds */ /** @} * @defgroup sysctl SysCtl Variable and callback function declarations * @@ -642,9 +642,9 @@ AliasSctpInit(struct libalias *la) for (i = 0; i < SN_TIMER_QUEUE_SIZE; i++) LIST_INIT(&la->sctpNatTimer.TimerQ[i]); #ifdef _KERNEL - la->sctpNatTimer.loc_time=time_uptime; /* la->timeStamp is not set yet */ + la->sctpNatTimer.loc_time=time_uptime; /* LibAliasTime is not set yet */ #else - la->sctpNatTimer.loc_time=la->timeStamp; + la->sctpNatTimer.loc_time=LibAliasTime; #endif la->sctpNatTimer.cur_loc = 0; la->sctpLinkCount = 0; @@ -2468,12 +2468,12 @@ sctp_CheckTimers(struct libalias *la) struct sctp_nat_assoc *assoc; LIBALIAS_LOCK_ASSERT(la); - while(la->timeStamp >= la->sctpNatTimer.loc_time) { + while(LibAliasTime >= la->sctpNatTimer.loc_time) { while (!LIST_EMPTY(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc])) { assoc = LIST_FIRST(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc]); //SLIST_REMOVE_HEAD(&la->sctpNatTimer.TimerQ[la->sctpNatTimer.cur_loc], timer_Q); LIST_REMOVE(assoc, timer_Q); - if (la->timeStamp >= assoc->exp) { /* state expired */ + if (LibAliasTime >= assoc->exp) { /* state expired */ SN_LOG(((assoc->state == SN_CL) ? (SN_LOG_DEBUG) : (SN_LOG_INFO)), logsctperror("Timer Expired", assoc->g_vtag, assoc->state, SN_TO_NODIR)); RmSctpAssoc(la, assoc); From owner-dev-commits-src-all@freebsd.org Tue Jul 6 07:11:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2FD6465187E; Tue, 6 Jul 2021 07:11: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 4GJtyz0By9z4Zw0; Tue, 6 Jul 2021 07:11: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 DF67A15744; Tue, 6 Jul 2021 07:11: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 1667Bs2T089716; Tue, 6 Jul 2021 07:11:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1667BsOH089715; Tue, 6 Jul 2021 07:11:54 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:11:54 GMT Message-Id: <202107060711.1667BsOH089715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: e0a40dc22771 - stable/12 - libalias: Restructure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e0a40dc227718f4bc62f279073baa5b6b2cd6a57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:11:55 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=e0a40dc227718f4bc62f279073baa5b6b2cd6a57 commit e0a40dc227718f4bc62f279073baa5b6b2cd6a57 Author: Lutz Donnerhacke AuthorDate: 2021-05-25 13:03:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 07:09:53 +0000 libalias: Restructure Clean up the database handling in order to switch to more efficient data structures. The development of this patch was artificially split in to many small steps to ease reviewing. - Common search terms - Separate fully qualified search - Separate table for partial links - Cleanup _FindLinkIn - Factor out the outgoing search function - Factor out a common idiom to return found links - Reorder incoming links by grouping of common search terms - Remove LSNAT from outgoing search - Group internal structure semantically - Separate table for PPTP - Use AliasRange instead of PORT_BASE - Remove temporary state deleteAllLinks from global struct - Avoid uninitialized expiration Discussed with: Dimitry Luhtionov Differential Revision: https://reviews.freebsd.org/D30568 Differential Revision: https://reviews.freebsd.org/D30569 Differential Revision: https://reviews.freebsd.org/D30570 Differential Revision: https://reviews.freebsd.org/D30571 Differential Revision: https://reviews.freebsd.org/D30572 Differential Revision: https://reviews.freebsd.org/D30573 Differential Revision: https://reviews.freebsd.org/D30574 Differential Revision: https://reviews.freebsd.org/D30575 Differential Revision: https://reviews.freebsd.org/D30580 Differential Revision: https://reviews.freebsd.org/D30581 Differential Revision: https://reviews.freebsd.org/D30604 Differential Revision: https://reviews.freebsd.org/D30582 (cherry picked from commit d41044ddfdbc2a026570cae11d5fc2e18f5e4b92) (cherry picked from commit 32f9c2ceb3ec8266e48ec0f6d1556fd98ef12db6) (cherry picked from commit cac129e6030095c33e95c5ce1cdcb9c5c21efce9) (cherry picked from commit 19dcc4f2250b3850991366e3058ca8a64b2f135d) (cherry picked from commit d5419034381d0e8e8c99f0f678118b197144bfff) (cherry picked from commit d4ab07d2aeb13b1aae9ad5d73e5fe77131f2350c) (cherry picked from commit 492d3b7109b45ff30fd199b7eeed797447746e42) (cherry picked from commit 7b44ff4c52ce9e7a89e772566a249e5481fe0ac4) (cherry picked from commit 1178dda53d10b096e0b99e356d15b7c24390e099) (cherry picked from commit 9efcad61d8309ecad3c15392b277fd329a1e45e4) (cherry picked from commit fe83900f9fa931e3d0942ec9c0709896b887c3d7) (cherry picked from commit d989935b5bcd880353f0de89eda958c45e7e3342) (cherry picked from commit b50a4dce185481bebf8096c27588ae04a4a2fd7c) (cherry picked from commit f28455344483310cfd1aa5c0bdd4d014810c0e32) --- sys/netinet/libalias/HISTORY | 4 + sys/netinet/libalias/alias_db.c | 897 ++++++++++++++++++++----------------- sys/netinet/libalias/alias_local.h | 16 +- 3 files changed, 497 insertions(+), 420 deletions(-) diff --git a/sys/netinet/libalias/HISTORY b/sys/netinet/libalias/HISTORY index c5bca59cac1f..8965290a4f27 100644 --- a/sys/netinet/libalias/HISTORY +++ b/sys/netinet/libalias/HISTORY @@ -143,3 +143,7 @@ Version 3.1: May, 2000 (Erik Salander, erik@whistle.com) Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and Junichi Satoh, junichi@junichi.org) - Added support for streaming media (RTSP and PNA) aliasing. + +Version 3.3: May 2021 (donner) + - Dropped LibAliasCheckNewLink + - Refactor the database handling, perfomance improvements. diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 2759c5170b27..b056f55b56a5 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -318,14 +318,23 @@ struct alias_link { #define LINK_UNFIREWALLED 0x08 int timestamp; /* Time link was last accessed */ - int expire_time; /* Expire time for link */ #ifndef NO_USE_SOCKETS int sockfd; /* socket descriptor */ #endif /* Linked list of pointers for input and output lookup tables */ - LIST_ENTRY (alias_link) list_out; - LIST_ENTRY (alias_link) list_in; - TAILQ_ENTRY (alias_link) list_expire; + union { + struct { + LIST_ENTRY(alias_link) in; + LIST_ENTRY(alias_link) out; + } all; + struct { + LIST_ENTRY(alias_link) list; + } pptp; + }; + struct { + TAILQ_ENTRY(alias_link) list; + int time; /* Expire time for link */ + } expire; /* Auxiliary data */ union { char *frag_ptr; @@ -378,12 +387,10 @@ Miscellaneous: */ /* Local prototypes */ -static u_int StartPointIn(struct in_addr, u_short, int); - -static u_int -StartPointOut(struct in_addr, struct in_addr, - u_short, u_short, int); - +static struct group_in * +StartPointIn(struct libalias *, struct in_addr, u_short, int, int); +static u_int +StartPointOut(struct in_addr, struct in_addr, u_short, u_short, int); static int SeqDiff(u_long, u_long); #ifndef NO_FW_PUNCH @@ -401,19 +408,46 @@ static void UninitPacketAliasLog(struct libalias *); void SctpShowAliasStats(struct libalias *la); -static u_int -StartPointIn(struct in_addr alias_addr, - u_short alias_port, - int link_type) +#define INGUARD \ + if (grp->alias_port != alias_port || \ + grp->link_type != link_type || \ + grp->alias_addr.s_addr != alias_addr.s_addr) \ + continue; + +static struct group_in * +StartPointIn(struct libalias *la, + struct in_addr alias_addr, u_short alias_port, int link_type, + int create) { u_int n; + struct group_in *grp, *tmp; n = alias_addr.s_addr; - if (link_type != LINK_PPTP) - n += alias_port; + n += alias_port; n += link_type; - return (n % LINK_TABLE_IN_SIZE); -} + n %= LINK_TABLE_IN_SIZE; + + LIST_FOREACH_SAFE(grp, &la->groupTableIn[n], group_in, tmp) { + /* Auto cleanup */ + if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { + LIST_REMOVE(grp, group_in); + free(grp); + } else { + INGUARD; + return (grp); + } + } + if (!create || (grp = malloc(sizeof(*grp))) == NULL) + return (grp); + grp->alias_addr = alias_addr; + grp->alias_port = alias_port; + grp->link_type = link_type; + LIST_INIT(&grp->full); + LIST_INIT(&grp->partial); + LIST_INSERT_HEAD(&la->groupTableIn[n], grp, group_in); + return (grp); +} +#undef INGUARD static u_int StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, @@ -423,10 +457,8 @@ StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, n = src_addr.s_addr; n += dst_addr.s_addr; - if (link_type != LINK_PPTP) { - n += src_port; - n += dst_port; - } + n += src_port; + n += dst_port; n += link_type; return (n % LINK_TABLE_OUT_SIZE); @@ -525,14 +557,16 @@ static int GetNewPort(struct libalias *, struct alias_link *, int); #ifndef NO_USE_SOCKETS static u_short GetSocket(struct libalias *, u_short, int *, int); #endif -static void CleanupAliasData(struct libalias *); -static void CleanupLink(struct libalias *, struct alias_link **); -static void DeleteLink(struct alias_link **); +static void CleanupAliasData(struct libalias *, int); +static void CleanupLink(struct libalias *, struct alias_link **, int); +static void DeleteLink(struct alias_link **, int); +static struct alias_link * +UseLink(struct libalias *, struct alias_link *); static struct alias_link * ReLink(struct alias_link *, struct in_addr, struct in_addr, struct in_addr, - u_short, u_short, int, int); + u_short, u_short, int, int, int); static struct alias_link * FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); @@ -540,12 +574,20 @@ FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, static struct alias_link * FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); -#define ALIAS_PORT_BASE 0x08000 -#define ALIAS_PORT_MASK 0x07fff -#define ALIAS_PORT_MASK_EVEN 0x07ffe +static u_short _RandomPort(struct libalias *la); + #define GET_NEW_PORT_MAX_ATTEMPTS 20 -#define FIND_EVEN_ALIAS_BASE 1 +/* get random port in network byte order */ +static u_short +_RandomPort(struct libalias *la) { + u_short port; + + port = la->aliasPortLower + + arc4random_uniform(la->aliasPortLength); + + return ntohs(port); +} /* GetNewPort() allocates port numbers. Note that if a port number is already in use, that does not mean that it cannot be used by @@ -557,8 +599,7 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) { int i; int max_trials; - u_short port_sys; - u_short port_net; + u_short port; LIBALIAS_LOCK_ASSERT(la); /* @@ -566,41 +607,18 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) * this parameter is zero or positive, it precisely specifies * the port number. GetNewPort() will return this number * without check that it is in use. - + * + * The aliasing port is automatically selected by one of + * two methods below: + * * When this parameter is GET_ALIAS_PORT, it indicates to get * a randomly selected port number. */ - if (alias_port_param == GET_ALIAS_PORT) { - /* - * The aliasing port is automatically selected by one of - * two methods below: - */ - max_trials = GET_NEW_PORT_MAX_ATTEMPTS; - - if (la->packetAliasMode & PKT_ALIAS_SAME_PORTS) { - /* - * When the PKT_ALIAS_SAME_PORTS option is chosen, - * the first try will be the actual source port. If - * this is already in use, the remainder of the - * trials will be random. - */ - port_net = lnk->src_port; - port_sys = ntohs(port_net); - } else if (la->aliasPortLower) { - /* First trial is a random port in the aliasing range. */ - port_sys = la->aliasPortLower + - (arc4random() % la->aliasPortLength); - port_net = htons(port_sys); - } else { - /* First trial and all subsequent are random. */ - port_sys = arc4random() & ALIAS_PORT_MASK; - port_sys += ALIAS_PORT_BASE; - port_net = htons(port_sys); - } - } else if (alias_port_param >= 0 && alias_port_param < 0x10000) { + if (alias_port_param >= 0 && alias_port_param < 0x10000) { lnk->alias_port = (u_short) alias_port_param; return (0); - } else { + } + if (alias_port_param != GET_ALIAS_PORT) { #ifdef LIBALIAS_DEBUG fprintf(stderr, "PacketAlias/GetNewPort(): "); fprintf(stderr, "input parameter error\n"); @@ -608,58 +626,57 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) return (-1); } + max_trials = GET_NEW_PORT_MAX_ATTEMPTS; + + /* + * When the PKT_ALIAS_SAME_PORTS option is chosen, + * the first try will be the actual source port. If + * this is already in use, the remainder of the + * trials will be random. + */ + port = (la->packetAliasMode & PKT_ALIAS_SAME_PORTS) + ? lnk->src_port + : _RandomPort(la); + /* Port number search */ - for (i = 0; i < max_trials; i++) { - int go_ahead; + for (i = 0; i < max_trials; i++, port = _RandomPort(la)) { + struct group_in *grp; struct alias_link *search_result; - search_result = FindLinkIn(la, lnk->dst_addr, lnk->alias_addr, - lnk->dst_port, port_net, - lnk->link_type, 0); + grp = StartPointIn(la, lnk->alias_addr, port, lnk->link_type, 0); + if (grp == NULL) + break; + LIST_FOREACH(search_result, &grp->full, all.in) { + if (lnk->dst_addr.s_addr == search_result->dst_addr.s_addr && + lnk->dst_port == search_result->dst_port) + break; /* found match */ + } if (search_result == NULL) - go_ahead = 1; - else if (!(lnk->flags & LINK_PARTIALLY_SPECIFIED) - && (search_result->flags & LINK_PARTIALLY_SPECIFIED)) - go_ahead = 1; - else - go_ahead = 0; + break; + } - if (go_ahead) { -#ifndef NO_USE_SOCKETS - if ((la->packetAliasMode & PKT_ALIAS_USE_SOCKETS) - && (lnk->flags & LINK_PARTIALLY_SPECIFIED) - && ((lnk->link_type == LINK_TCP) || - (lnk->link_type == LINK_UDP))) { - if (GetSocket(la, port_net, &lnk->sockfd, lnk->link_type)) { - lnk->alias_port = port_net; - return (0); - } - } else { + if (i >= max_trials) { +#ifdef LIBALIAS_DEBUG + fprintf(stderr, "PacketAlias/GetNewPort(): "); + fprintf(stderr, "could not find free port\n"); #endif - lnk->alias_port = port_net; - return (0); + return (-1); + } + #ifndef NO_USE_SOCKETS - } -#endif - } - if (la->aliasPortLower) { - port_sys = la->aliasPortLower + - (arc4random() % la->aliasPortLength); - port_net = htons(port_sys); - } else { - port_sys = arc4random() & ALIAS_PORT_MASK; - port_sys += ALIAS_PORT_BASE; - port_net = htons(port_sys); + if ((la->packetAliasMode & PKT_ALIAS_USE_SOCKETS) && + (lnk->flags & LINK_PARTIALLY_SPECIFIED) && + ((lnk->link_type == LINK_TCP) || + (lnk->link_type == LINK_UDP))) { + if (!GetSocket(la, port, &lnk->sockfd, lnk->link_type)) { + return (-1); } } - -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/GetnewPort(): "); - fprintf(stderr, "could not find free port\n"); #endif + lnk->alias_port = port; - return (-1); + return (0); } #ifndef NO_USE_SOCKETS @@ -726,7 +743,7 @@ FindNewPortGroup(struct libalias *la, { int i, j; int max_trials; - u_short port_sys; + u_short port; int link_type; LIBALIAS_LOCK_ASSERT(la); @@ -758,39 +775,31 @@ FindNewPortGroup(struct libalias *la, * try will be the actual source port. If this is already * in use, the remainder of the trials will be random. */ - port_sys = ntohs(src_port); + port = src_port; } else { - /* First trial and all subsequent are random. */ - if (align == FIND_EVEN_ALIAS_BASE) - port_sys = arc4random() & ALIAS_PORT_MASK_EVEN; - else - port_sys = arc4random() & ALIAS_PORT_MASK; - - port_sys += ALIAS_PORT_BASE; + port = _RandomPort(la); } /* Port number search */ - for (i = 0; i < max_trials; i++) { + for (i = 0; i < max_trials; i++, port = _RandomPort(la)) { struct alias_link *search_result; - for (j = 0; j < port_count; j++) + if (align) + port &= htons(0xfffe); + + for (j = 0; j < port_count; j++) { + u_short port_j = ntohs(port) + j; + if ((search_result = FindLinkIn(la, dst_addr, - alias_addr, dst_port, htons(port_sys + j), + alias_addr, dst_port, htons(port_j), link_type, 0)) != NULL) break; + } /* Found a good range, return base */ if (j == port_count) - return (htons(port_sys)); - - /* Find a new base to try */ - if (align == FIND_EVEN_ALIAS_BASE) - port_sys = arc4random() & ALIAS_PORT_MASK_EVEN; - else - port_sys = arc4random() & ALIAS_PORT_MASK; - - port_sys += ALIAS_PORT_BASE; + return (port); } #ifdef LIBALIAS_DEBUG @@ -802,45 +811,65 @@ FindNewPortGroup(struct libalias *la, } static void -CleanupAliasData(struct libalias *la) +CleanupAliasData(struct libalias *la, int deletePermanent) { struct alias_link *lnk, *lnk_tmp; + u_int i; LIBALIAS_LOCK_ASSERT(la); /* permanent entries may stay */ - TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, list_expire, lnk_tmp) - DeleteLink(&lnk); + TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, expire.list, lnk_tmp) + DeleteLink(&lnk, deletePermanent); + + for (i = 0; i < LINK_TABLE_IN_SIZE; i++) { + struct group_in *grp, *grp_tmp; + + LIST_FOREACH_SAFE(grp, &la->groupTableIn[i], group_in, grp_tmp) + if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { + LIST_REMOVE(grp, group_in); + free(grp); + } + } } static void -CleanupLink(struct libalias *la, struct alias_link **lnk) +CleanupLink(struct libalias *la, struct alias_link **lnk, int deletePermanent) { LIBALIAS_LOCK_ASSERT(la); if (lnk == NULL || *lnk == NULL) return; - if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire_time) { - DeleteLink(lnk); + if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire.time) { + DeleteLink(lnk, deletePermanent); if ((*lnk) == NULL) return; } /* move to end, swap may fail on a single entry list */ - TAILQ_REMOVE(&la->checkExpire, (*lnk), list_expire); - TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), list_expire); + TAILQ_REMOVE(&la->checkExpire, (*lnk), expire.list); + TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), expire.list); +} + +static struct alias_link * +UseLink(struct libalias *la, struct alias_link *lnk) +{ + CleanupLink(la, &lnk, 0); + if (lnk != NULL) + lnk->timestamp = LibAliasTime; + return (lnk); } static void -DeleteLink(struct alias_link **plnk) +DeleteLink(struct alias_link **plnk, int deletePermanent) { struct alias_link *lnk = *plnk; struct libalias *la = lnk->la; LIBALIAS_LOCK_ASSERT(la); /* Don't do anything if the link is marked permanent */ - if (la->deleteAllLinks == 0 && lnk->flags & LINK_PERMANENT) + if (!deletePermanent && (lnk->flags & LINK_PERMANENT)) return; #ifndef NO_FW_PUNCH @@ -848,24 +877,32 @@ DeleteLink(struct alias_link **plnk) ClearFWHole(lnk); #endif - /* Free memory allocated for LSNAT server pool */ - if (lnk->server != NULL) { - struct server *head, *curr, *next; + switch (lnk->link_type) { + case LINK_PPTP: + LIST_REMOVE(lnk, pptp.list); + break; + default: + /* Free memory allocated for LSNAT server pool */ + if (lnk->server != NULL) { + struct server *head, *curr, *next; + + head = curr = lnk->server; + do { + next = curr->next; + free(curr); + } while ((curr = next) != head); + } else { + /* Adjust output table pointers */ + LIST_REMOVE(lnk, all.out); + } - head = curr = lnk->server; - do { - next = curr->next; - free(curr); - } while ((curr = next) != head); + /* Adjust input table pointers */ + LIST_REMOVE(lnk, all.in); + break; } - /* Adjust output table pointers */ - LIST_REMOVE(lnk, list_out); - - /* Adjust input table pointers */ - LIST_REMOVE(lnk, list_in); /* remove from housekeeping */ - TAILQ_REMOVE(&la->checkExpire, lnk, list_expire); + TAILQ_REMOVE(&la->checkExpire, lnk, expire.list); #ifndef NO_USE_SOCKETS /* Close socket, if one has been allocated */ @@ -923,133 +960,148 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); + lnk = malloc(sizeof(struct alias_link)); - if (lnk != NULL) { - /* Basic initialization */ - lnk->la = la; - lnk->src_addr = src_addr; - lnk->dst_addr = dst_addr; - lnk->alias_addr = alias_addr; - lnk->proxy_addr.s_addr = INADDR_ANY; - lnk->src_port = src_port; - lnk->dst_port = dst_port; - lnk->proxy_port = 0; - lnk->server = NULL; - lnk->link_type = link_type; + if (lnk == NULL) { +#ifdef LIBALIAS_DEBUG + fprintf(stderr, "PacketAlias/AddLink(): "); + fprintf(stderr, "malloc() call failed.\n"); +#endif + return (NULL); + } + /* Basic initialization */ + lnk->la = la; + lnk->src_addr = src_addr; + lnk->dst_addr = dst_addr; + lnk->alias_addr = alias_addr; + lnk->proxy_addr.s_addr = INADDR_ANY; + lnk->src_port = src_port; + lnk->dst_port = dst_port; + lnk->proxy_port = 0; + lnk->server = NULL; + lnk->link_type = link_type; #ifndef NO_USE_SOCKETS - lnk->sockfd = -1; + lnk->sockfd = -1; #endif - lnk->flags = 0; - lnk->pflags = 0; - lnk->timestamp = LibAliasTime; + lnk->flags = 0; + lnk->pflags = 0; + lnk->timestamp = LibAliasTime; - /* Expiration time */ - switch (link_type) { - case LINK_ICMP: - lnk->expire_time = ICMP_EXPIRE_TIME; - break; - case LINK_UDP: - lnk->expire_time = UDP_EXPIRE_TIME; - break; - case LINK_TCP: - lnk->expire_time = TCP_EXPIRE_INITIAL; - break; - case LINK_PPTP: - lnk->flags |= LINK_PERMANENT; /* no timeout. */ - break; - case LINK_FRAGMENT_ID: - lnk->expire_time = FRAGMENT_ID_EXPIRE_TIME; - break; - case LINK_FRAGMENT_PTR: - lnk->expire_time = FRAGMENT_PTR_EXPIRE_TIME; - break; - case LINK_ADDR: - break; - default: - lnk->expire_time = PROTO_EXPIRE_TIME; - break; - } + /* Expiration time */ + switch (link_type) { + case LINK_ICMP: + lnk->expire.time = ICMP_EXPIRE_TIME; + break; + case LINK_UDP: + lnk->expire.time = UDP_EXPIRE_TIME; + break; + case LINK_TCP: + lnk->expire.time = TCP_EXPIRE_INITIAL; + break; + case LINK_FRAGMENT_ID: + lnk->expire.time = FRAGMENT_ID_EXPIRE_TIME; + break; + case LINK_FRAGMENT_PTR: + lnk->expire.time = FRAGMENT_PTR_EXPIRE_TIME; + break; + default: + lnk->expire.time = PROTO_EXPIRE_TIME; + break; + } + + /* Determine alias flags */ + if (dst_addr.s_addr == INADDR_ANY) + lnk->flags |= LINK_UNKNOWN_DEST_ADDR; + if (dst_port == 0) + lnk->flags |= LINK_UNKNOWN_DEST_PORT; - /* Determine alias flags */ - if (dst_addr.s_addr == INADDR_ANY) - lnk->flags |= LINK_UNKNOWN_DEST_ADDR; - if (dst_port == 0) - lnk->flags |= LINK_UNKNOWN_DEST_PORT; + /* Determine alias port */ + if (GetNewPort(la, lnk, alias_port_param) != 0) { + free(lnk); + return (NULL); + } + /* Link-type dependent initialization */ + switch (link_type) { + case LINK_ICMP: + la->icmpLinkCount++; + break; + case LINK_UDP: + la->udpLinkCount++; + break; + case LINK_TCP: { + struct tcp_dat *aux_tcp; + int i; - /* Determine alias port */ - if (GetNewPort(la, lnk, alias_port_param) != 0) { + aux_tcp = malloc(sizeof(struct tcp_dat)); + if (aux_tcp == NULL) { +#ifdef LIBALIAS_DEBUG + fprintf(stderr, "PacketAlias/AddLink: "); + fprintf(stderr, " cannot allocate auxiliary TCP data\n"); +#endif free(lnk); return (NULL); } - /* Link-type dependent initialization */ - switch (link_type) { - struct tcp_dat *aux_tcp; - case LINK_ICMP: - la->icmpLinkCount++; - break; - case LINK_UDP: - la->udpLinkCount++; - break; - case LINK_TCP: - aux_tcp = malloc(sizeof(struct tcp_dat)); - if (aux_tcp != NULL) { - int i; - - la->tcpLinkCount++; - aux_tcp->state.in = ALIAS_TCP_STATE_NOT_CONNECTED; - aux_tcp->state.out = ALIAS_TCP_STATE_NOT_CONNECTED; - aux_tcp->state.index = 0; - aux_tcp->state.ack_modified = 0; - for (i = 0; i < N_LINK_TCP_DATA; i++) - aux_tcp->ack[i].active = 0; - aux_tcp->fwhole = -1; - lnk->data.tcp = aux_tcp; - } else { -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/AddLink: "); - fprintf(stderr, " cannot allocate auxiliary TCP data\n"); -#endif - free(lnk); - return (NULL); - } - break; - case LINK_PPTP: - la->pptpLinkCount++; - break; - case LINK_FRAGMENT_ID: - la->fragmentIdLinkCount++; - break; - case LINK_FRAGMENT_PTR: - la->fragmentPtrLinkCount++; - break; - case LINK_ADDR: - break; - default: - la->protoLinkCount++; - break; + la->tcpLinkCount++; + aux_tcp->state.in = ALIAS_TCP_STATE_NOT_CONNECTED; + aux_tcp->state.out = ALIAS_TCP_STATE_NOT_CONNECTED; + aux_tcp->state.index = 0; + aux_tcp->state.ack_modified = 0; + for (i = 0; i < N_LINK_TCP_DATA; i++) + aux_tcp->ack[i].active = 0; + aux_tcp->fwhole = -1; + lnk->data.tcp = aux_tcp; + } + break; + case LINK_PPTP: + la->pptpLinkCount++; + break; + case LINK_FRAGMENT_ID: + la->fragmentIdLinkCount++; + break; + case LINK_FRAGMENT_PTR: + la->fragmentPtrLinkCount++; + break; + case LINK_ADDR: + break; + default: + la->protoLinkCount++; + break; + } + + switch (link_type) { + case LINK_PPTP: + LIST_INSERT_HEAD(&la->pptpList, lnk, pptp.list); + break; + default: { + struct group_in *grp; + + grp = StartPointIn(la, alias_addr, lnk->alias_port, link_type, 1); + if (grp == NULL) { + free(lnk); + return (NULL); } /* Set up pointers for output lookup table */ start_point = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); - LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, list_out); + LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, all.out); /* Set up pointers for input lookup table */ - start_point = StartPointIn(alias_addr, lnk->alias_port, link_type); - LIST_INSERT_HEAD(&la->linkTableIn[start_point], lnk, list_in); - - /* Include the element into the housekeeping list */ - TAILQ_INSERT_TAIL(&la->checkExpire, lnk, list_expire); - } else { -#ifdef LIBALIAS_DEBUG - fprintf(stderr, "PacketAlias/AddLink(): "); - fprintf(stderr, "malloc() call failed.\n"); -#endif + if (lnk->flags & LINK_PARTIALLY_SPECIFIED) + LIST_INSERT_HEAD(&grp->partial, lnk, all.in); + else + LIST_INSERT_HEAD(&grp->full, lnk, all.in); } - if (la->packetAliasMode & PKT_ALIAS_LOG) { - ShowAliasStats(la); + break; } + + /* Include the element into the housekeeping list */ + TAILQ_INSERT_TAIL(&la->checkExpire, lnk, expire.list); + + if (la->packetAliasMode & PKT_ALIAS_LOG) + ShowAliasStats(la); + return (lnk); } @@ -1065,7 +1117,8 @@ ReLink(struct alias_link *old_lnk, u_short src_port, u_short dst_port, int alias_port_param, - int link_type) + int link_type, + int deletePermanent) { struct alias_link *new_lnk; struct libalias *la = old_lnk->la; @@ -1081,10 +1134,39 @@ ReLink(struct alias_link *old_lnk, PunchFWHole(new_lnk); } #endif - DeleteLink(&old_lnk); + DeleteLink(&old_lnk, deletePermanent); return (new_lnk); } + +#define OUTGUARD \ + if (lnk->src_port != src_port || \ + lnk->src_addr.s_addr != src_addr.s_addr || \ + lnk->dst_addr.s_addr != dst_addr.s_addr || \ + lnk->dst_port != dst_port || \ + lnk->link_type != link_type) \ + continue; + +static struct alias_link * +_SearchLinkOut(struct libalias *la, struct in_addr src_addr, + struct in_addr dst_addr, + u_short src_port, + u_short dst_port, + int link_type) { + u_int i; + struct alias_link *lnk; + + i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); + LIST_FOREACH(lnk, &la->linkTableOut[i], all.out) { + OUTGUARD; + return (UseLink(la, lnk)); + } + + return (NULL); +} + +#undef OUTGUARD + static struct alias_link * _FindLinkOut(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, @@ -1093,45 +1175,31 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, int link_type, int replace_partial_links) { - u_int i; struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); - LIST_FOREACH(lnk, &la->linkTableOut[i], list_out) { - if (lnk->dst_addr.s_addr == dst_addr.s_addr && - lnk->src_addr.s_addr == src_addr.s_addr && - lnk->src_port == src_port && - lnk->dst_port == dst_port && - lnk->link_type == link_type && - lnk->server == NULL) - break; - } - - CleanupLink(la, &lnk); - if (lnk != NULL) - lnk->timestamp = LibAliasTime; + lnk = _SearchLinkOut(la, src_addr, dst_addr, src_port, dst_port, link_type); + if (lnk != NULL || !replace_partial_links) + return (lnk); /* Search for partially specified links. */ - if (lnk == NULL && replace_partial_links) { - if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY) { - lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, 0, - link_type, 0); - if (lnk == NULL) - lnk = _FindLinkOut(la, src_addr, ANY_ADDR, src_port, - dst_port, link_type, 0); - } - if (lnk == NULL && - (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { - lnk = _FindLinkOut(la, src_addr, ANY_ADDR, src_port, 0, - link_type, 0); - } - if (lnk != NULL) { - lnk = ReLink(lnk, - src_addr, dst_addr, lnk->alias_addr, - src_port, dst_port, lnk->alias_port, - link_type); - } + if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY) { + lnk = _SearchLinkOut(la, src_addr, dst_addr, src_port, 0, + link_type); + if (lnk == NULL) + lnk = _SearchLinkOut(la, src_addr, ANY_ADDR, src_port, + dst_port, link_type); + } + if (lnk == NULL && + (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { + lnk = _SearchLinkOut(la, src_addr, ANY_ADDR, src_port, 0, + link_type); + } + if (lnk != NULL) { + lnk = ReLink(lnk, + src_addr, dst_addr, lnk->alias_addr, + src_port, dst_port, lnk->alias_port, + link_type, 0); } return (lnk); } @@ -1175,16 +1243,16 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, int replace_partial_links) { int flags_in; - u_int start_point; + struct group_in *grp; struct alias_link *lnk; - struct alias_link *lnk_fully_specified; struct alias_link *lnk_unknown_all; struct alias_link *lnk_unknown_dst_addr; struct alias_link *lnk_unknown_dst_port; + struct in_addr src_addr; + u_short src_port; LIBALIAS_LOCK_ASSERT(la); /* Initialize pointers */ - lnk_fully_specified = NULL; lnk_unknown_all = NULL; lnk_unknown_dst_addr = NULL; lnk_unknown_dst_port = NULL; @@ -1198,83 +1266,82 @@ _FindLinkIn(struct libalias *la, struct in_addr dst_addr, flags_in |= LINK_UNKNOWN_DEST_PORT; /* Search loop */ - start_point = StartPointIn(alias_addr, alias_port, link_type); - LIST_FOREACH(lnk, &la->linkTableIn[start_point], list_in) { - int flags; - - flags = flags_in | lnk->flags; - if (!(flags & LINK_PARTIALLY_SPECIFIED)) { - if (lnk->alias_addr.s_addr == alias_addr.s_addr - && lnk->alias_port == alias_port - && lnk->dst_addr.s_addr == dst_addr.s_addr *** 448 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jul 6 07:11:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ACED1651F21; Tue, 6 Jul 2021 07:11:56 +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 4GJtz01HKvz4Zt1; Tue, 6 Jul 2021 07:11: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 0519515803; Tue, 6 Jul 2021 07:11: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 1667BthX089740; Tue, 6 Jul 2021 07:11:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1667Btd5089739; Tue, 6 Jul 2021 07:11:55 GMT (envelope-from git) Date: Tue, 6 Jul 2021 07:11:55 GMT Message-Id: <202107060711.1667Btd5089739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 1883127de488 - stable/12 - libalias: Switch to SPLAY trees MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1883127de4888b2a30a6cb51e8fb4bdf33b7f411 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 07:11:56 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=1883127de4888b2a30a6cb51e8fb4bdf33b7f411 commit 1883127de4888b2a30a6cb51e8fb4bdf33b7f411 Author: Lutz Donnerhacke AuthorDate: 2021-05-27 21:42:54 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-07-06 07:10:02 +0000 libalias: Switch to SPLAY trees Current data structure is using a hash of unordered lists. Those unordered lists are quite efficient, because the least recently inserted entries are most likely to be used again. In order to avoid long search times in other cases, the lists are hashed into many buckets. Unfortunatly a search for a miss needs an exhaustive inspection and a careful definition of the hash. Splay trees offer a similar feature - almost O(1) for access of the least recently used entries), and amortized O(ln(n) - for almost all other cases. Get rid of the hash. Now the data structure should able to quickly react to external packets without eating CPU cycles for breakfast, preventing a DoS. PR: 192888 Discussed with: Dimitry Luhtionov Differential Revision: https://reviews.freebsd.org/D30516 Differential Revision: https://reviews.freebsd.org/D30536 Differential Revision: https://reviews.freebsd.org/D30844 (cherry picked from commit 935fc93af157dee352eb4b6c83f8a2a9e7fd9a4e) (cherry picked from commit d261e57deacb0d00d9e827447f235df83dda3e3a) (cherry picked from commit f70c98a2f5d993dc518efd606aa341eda99400ef) (cherry picked from commit 25392fac9488bcae5c451500df2e2945430484a6) (cherry picked from commit 2f4d91f9cb22fc65eb65407e8118b433a5d71976) (cherry picked from commit 4060e77f49d1b9fd2254f3f4da94fd64fce83f72) --- sys/netinet/libalias/HISTORY | 3 +- sys/netinet/libalias/alias_db.c | 502 +++---------------------------------- sys/netinet/libalias/alias_db.h | 443 ++++++++++++++++++++++++++++++++ sys/netinet/libalias/alias_local.h | 10 +- 4 files changed, 489 insertions(+), 469 deletions(-) diff --git a/sys/netinet/libalias/HISTORY b/sys/netinet/libalias/HISTORY index 8965290a4f27..87d5b6f8ed76 100644 --- a/sys/netinet/libalias/HISTORY +++ b/sys/netinet/libalias/HISTORY @@ -146,4 +146,5 @@ Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and Version 3.3: May 2021 (donner) - Dropped LibAliasCheckNewLink - - Refactor the database handling, perfomance improvements. + - Refactor the database handling + - Switch to more effienct SPLAY trees diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index b056f55b56a5..783a8ca3baa8 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -29,120 +29,6 @@ #include __FBSDID("$FreeBSD$"); -/* - Alias_db.c encapsulates all data structures used for storing - packet aliasing data. Other parts of the aliasing software - access data through functions provided in this file. - - Data storage is based on the notion of a "link", which is - established for ICMP echo/reply packets, UDP datagrams and - TCP stream connections. A link stores the original source - and destination addresses. For UDP and TCP, it also stores - source and destination port numbers, as well as an alias - port number. Links are also used to store information about - fragments. - - There is a facility for sweeping through and deleting old - links as new packets are sent through. A simple timeout is - used for ICMP and UDP links. TCP links are left alone unless - there is an incomplete connection, in which case the link - can be deleted after a certain amount of time. - - Initial version: August, 1996 (cjm) - - Version 1.4: September 16, 1996 (cjm) - Facility for handling incoming links added. - - Version 1.6: September 18, 1996 (cjm) - ICMP data handling simplified. - - Version 1.7: January 9, 1997 (cjm) - Fragment handling simplified. - Saves pointers for unresolved fragments. - Permits links for unspecified remote ports - or unspecified remote addresses. - Fixed bug which did not properly zero port - table entries after a link was deleted. - Cleaned up some obsolete comments. - - Version 1.8: January 14, 1997 (cjm) - Fixed data type error in StartPoint(). - (This error did not exist prior to v1.7 - and was discovered and fixed by Ari Suutari) - - Version 1.9: February 1, 1997 - Optionally, connections initiated from packet aliasing host - machine will will not have their port number aliased unless it - conflicts with an aliasing port already being used. (cjm) - - All options earlier being #ifdef'ed are now available through - a new interface, SetPacketAliasMode(). This allows run time - control (which is now available in PPP+pktAlias through the - 'alias' keyword). (ee) - - Added ability to create an alias port without - either destination address or port specified. - port type = ALIAS_PORT_UNKNOWN_DEST_ALL (ee) - - Removed K&R style function headers - and general cleanup. (ee) - - Added packetAliasMode to replace compiler #defines's (ee) - - Allocates sockets for partially specified - ports if ALIAS_USE_SOCKETS defined. (cjm) - - Version 2.0: March, 1997 - SetAliasAddress() will now clean up alias links - if the aliasing address is changed. (cjm) - - PacketAliasPermanentLink() function added to support permanent - links. (J. Fortes suggested the need for this.) - Examples: - - (192.168.0.1, port 23) <-> alias port 6002, unknown dest addr/port - - (192.168.0.2, port 21) <-> alias port 3604, known dest addr - unknown dest port - - These permanent links allow for incoming connections to - machines on the local network. They can be given with a - user-chosen amount of specificity, with increasing specificity - meaning more security. (cjm) - - Quite a bit of rework to the basic engine. The portTable[] - array, which kept track of which ports were in use was replaced - by a table/linked list structure. (cjm) - - SetExpire() function added. (cjm) - - DeleteLink() no longer frees memory association with a pointer - to a fragment (this bug was first recognized by E. Eklund in - v1.9). - - Version 2.1: May, 1997 (cjm) - Packet aliasing engine reworked so that it can handle - multiple external addresses rather than just a single - host address. - - PacketAliasRedirectPort() and PacketAliasRedirectAddr() - added to the API. The first function is a more generalized - version of PacketAliasPermanentLink(). The second function - implements static network address translation. - - Version 3.2: July, 2000 (salander and satoh) - Added FindNewPortGroup to get contiguous range of port values. - - Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing - link but not actually add one. - - Added FindRtspOut, which is closely derived from FindUdpTcpOut, - except that the alias port (from FindNewPortGroup) is provided - as input. - - See HISTORY file for additional revisions. -*/ - #ifdef _KERNEL #include #include @@ -175,177 +61,11 @@ __FBSDID("$FreeBSD$"); #include "alias_mod.h" #endif +#include "alias_db.h" + static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); int LibAliasTime; -/* - Constants (note: constants are also defined - near relevant functions or structs) -*/ - -/* Timeouts (in seconds) for different link types */ -#define ICMP_EXPIRE_TIME 60 -#define UDP_EXPIRE_TIME 60 -#define PROTO_EXPIRE_TIME 60 -#define FRAGMENT_ID_EXPIRE_TIME 10 -#define FRAGMENT_PTR_EXPIRE_TIME 30 - -/* TCP link expire time for different cases */ -/* When the link has been used and closed - minimal grace time to - allow ACKs and potential re-connect in FTP (XXX - is this allowed?) */ -#ifndef TCP_EXPIRE_DEAD -#define TCP_EXPIRE_DEAD 10 -#endif - -/* When the link has been used and closed on one side - the other side - is allowed to still send data */ -#ifndef TCP_EXPIRE_SINGLEDEAD -#define TCP_EXPIRE_SINGLEDEAD 90 -#endif - -/* When the link isn't yet up */ -#ifndef TCP_EXPIRE_INITIAL -#define TCP_EXPIRE_INITIAL 300 -#endif - -/* When the link is up */ -#ifndef TCP_EXPIRE_CONNECTED -#define TCP_EXPIRE_CONNECTED 86400 -#endif - -/* Dummy port number codes used for FindLinkIn/Out() and AddLink(). - These constants can be anything except zero, which indicates an - unknown port number. */ - -#define NO_DEST_PORT 1 -#define NO_SRC_PORT 1 - -/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ -static struct in_addr const ANY_ADDR = { INADDR_ANY }; - -/* Data Structures - - The fundamental data structure used in this program is - "struct alias_link". Whenever a TCP connection is made, - a UDP datagram is sent out, or an ICMP echo request is made, - a link record is made (if it has not already been created). - The link record is identified by the source address/port - and the destination address/port. In the case of an ICMP - echo request, the source port is treated as being equivalent - with the 16-bit ID number of the ICMP packet. - - The link record also can store some auxiliary data. For - TCP connections that have had sequence and acknowledgment - modifications, data space is available to track these changes. - A state field is used to keep track in changes to the TCP - connection state. ID numbers of fragments can also be - stored in the auxiliary space. Pointers to unresolved - fragments can also be stored. - - The link records support two independent chainings. Lookup - tables for input and out tables hold the initial pointers - the link chains. On input, the lookup table indexes on alias - port and link type. On output, the lookup table indexes on - source address, destination address, source port, destination - port and link type. -*/ - -/* used to save changes to ACK/sequence numbers */ -struct ack_data_record { - u_long ack_old; - u_long ack_new; - int delta; - int active; -}; - -/* Information about TCP connection */ -struct tcp_state { - int in; /* State for outside -> inside */ - int out; /* State for inside -> outside */ - int index; /* Index to ACK data array */ - /* Indicates whether ACK and sequence numbers been modified */ - int ack_modified; -}; - -/* Number of distinct ACK number changes - * saved for a modified TCP stream */ -#define N_LINK_TCP_DATA 3 -struct tcp_dat { - struct tcp_state state; - struct ack_data_record ack[N_LINK_TCP_DATA]; - /* Which firewall record is used for this hole? */ - int fwhole; -}; - -/* LSNAT server pool (circular list) */ -struct server { - struct in_addr addr; - u_short port; - struct server *next; -}; - -/* Main data structure */ -struct alias_link { - struct libalias *la; - /* Address and port information */ - struct in_addr src_addr; - struct in_addr dst_addr; - struct in_addr alias_addr; - struct in_addr proxy_addr; - u_short src_port; - u_short dst_port; - u_short alias_port; - u_short proxy_port; - struct server *server; - /* Type of link: TCP, UDP, ICMP, proto, frag */ - int link_type; -/* values for link_type */ -#define LINK_ICMP IPPROTO_ICMP -#define LINK_UDP IPPROTO_UDP -#define LINK_TCP IPPROTO_TCP -#define LINK_FRAGMENT_ID (IPPROTO_MAX + 1) -#define LINK_FRAGMENT_PTR (IPPROTO_MAX + 2) -#define LINK_ADDR (IPPROTO_MAX + 3) -#define LINK_PPTP (IPPROTO_MAX + 4) - - int flags; /* indicates special characteristics */ - int pflags; /* protocol-specific flags */ -/* flag bits */ -#define LINK_UNKNOWN_DEST_PORT 0x01 -#define LINK_UNKNOWN_DEST_ADDR 0x02 -#define LINK_PERMANENT 0x04 -#define LINK_PARTIALLY_SPECIFIED 0x03 /* logical-or of first two bits */ -#define LINK_UNFIREWALLED 0x08 - - int timestamp; /* Time link was last accessed */ -#ifndef NO_USE_SOCKETS - int sockfd; /* socket descriptor */ -#endif - /* Linked list of pointers for input and output lookup tables */ - union { - struct { - LIST_ENTRY(alias_link) in; - LIST_ENTRY(alias_link) out; - } all; - struct { - LIST_ENTRY(alias_link) list; - } pptp; - }; - struct { - TAILQ_ENTRY(alias_link) list; - int time; /* Expire time for link */ - } expire; - /* Auxiliary data */ - union { - char *frag_ptr; - struct in_addr frag_addr; - struct tcp_dat *tcp; - } data; -}; - -/* Clean up procedure. */ -static void finishoff(void); - /* Kernel module definition. */ #ifdef _KERNEL MALLOC_DEFINE(M_ALIAS, "libalias", "packet aliasing"); @@ -373,96 +93,32 @@ static moduledata_t alias_mod = { DECLARE_MODULE(alias, alias_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND); #endif -/* Internal utility routines (used only in alias_db.c) - -Lookup table starting points: - StartPointIn() -- link table initial search point for - incoming packets - StartPointOut() -- link table initial search point for - outgoing packets - -Miscellaneous: - SeqDiff() -- difference between two TCP sequences - ShowAliasStats() -- send alias statistics to a monitor file -*/ - -/* Local prototypes */ -static struct group_in * -StartPointIn(struct libalias *, struct in_addr, u_short, int, int); -static u_int -StartPointOut(struct in_addr, struct in_addr, u_short, u_short, int); -static int SeqDiff(u_long, u_long); - -#ifndef NO_FW_PUNCH -/* Firewall control */ -static void InitPunchFW(struct libalias *); -static void UninitPunchFW(struct libalias *); -static void ClearFWHole(struct alias_link *); - -#endif - -/* Log file control */ -static void ShowAliasStats(struct libalias *); -static int InitPacketAliasLog(struct libalias *); -static void UninitPacketAliasLog(struct libalias *); - -void SctpShowAliasStats(struct libalias *la); - -#define INGUARD \ - if (grp->alias_port != alias_port || \ - grp->link_type != link_type || \ - grp->alias_addr.s_addr != alias_addr.s_addr) \ - continue; +SPLAY_GENERATE(splay_out, alias_link, all.out, cmp_out); +SPLAY_GENERATE(splay_in, group_in, in, cmp_in); static struct group_in * StartPointIn(struct libalias *la, struct in_addr alias_addr, u_short alias_port, int link_type, int create) { - u_int n; - struct group_in *grp, *tmp; - - n = alias_addr.s_addr; - n += alias_port; - n += link_type; - n %= LINK_TABLE_IN_SIZE; + struct group_in *grp; + struct group_in needle = { + .alias_addr = alias_addr, + .alias_port = alias_port, + .link_type = link_type + }; - LIST_FOREACH_SAFE(grp, &la->groupTableIn[n], group_in, tmp) { - /* Auto cleanup */ - if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { - LIST_REMOVE(grp, group_in); - free(grp); - } else { - INGUARD; - return (grp); - } - } - if (!create || (grp = malloc(sizeof(*grp))) == NULL) + grp = SPLAY_FIND(splay_in, &la->linkSplayIn, &needle); + if (grp != NULL || !create || (grp = malloc(sizeof(*grp))) == NULL) return (grp); grp->alias_addr = alias_addr; grp->alias_port = alias_port; grp->link_type = link_type; LIST_INIT(&grp->full); LIST_INIT(&grp->partial); - LIST_INSERT_HEAD(&la->groupTableIn[n], grp, group_in); + SPLAY_INSERT(splay_in, &la->linkSplayIn, grp); return (grp); } -#undef INGUARD - -static u_int -StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, - u_short src_port, u_short dst_port, int link_type) -{ - u_int n; - - n = src_addr.s_addr; - n += dst_addr.s_addr; - n += src_port; - n += dst_port; - n += link_type; - - return (n % LINK_TABLE_OUT_SIZE); -} static int SeqDiff(u_long x, u_long y) @@ -531,53 +187,6 @@ void SctpShowAliasStats(struct libalias *la) ShowAliasStats(la); } -/* Internal routines for finding, deleting and adding links - -Port Allocation: - GetNewPort() -- find and reserve new alias port number - GetSocket() -- try to allocate a socket for a given port - -Link creation and deletion: - CleanupAliasData() - remove all link chains from lookup table - CleanupLink() - look for a stale link - DeleteLink() - remove link - AddLink() - add link - ReLink() - change link - -Link search: - FindLinkOut() - find link for outgoing packets - FindLinkIn() - find link for incoming packets - -Port search: - FindNewPortGroup() - find an available group of ports -*/ - -/* Local prototypes */ -static int GetNewPort(struct libalias *, struct alias_link *, int); -#ifndef NO_USE_SOCKETS -static u_short GetSocket(struct libalias *, u_short, int *, int); -#endif -static void CleanupAliasData(struct libalias *, int); -static void CleanupLink(struct libalias *, struct alias_link **, int); -static void DeleteLink(struct alias_link **, int); -static struct alias_link * -UseLink(struct libalias *, struct alias_link *); - -static struct alias_link * -ReLink(struct alias_link *, - struct in_addr, struct in_addr, struct in_addr, - u_short, u_short, int, int, int); - -static struct alias_link * -FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); - -static struct alias_link * -FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); - -static u_short _RandomPort(struct libalias *la); - -#define GET_NEW_PORT_MAX_ATTEMPTS 20 - /* get random port in network byte order */ static u_short _RandomPort(struct libalias *la) { @@ -814,25 +423,13 @@ static void CleanupAliasData(struct libalias *la, int deletePermanent) { struct alias_link *lnk, *lnk_tmp; - u_int i; LIBALIAS_LOCK_ASSERT(la); /* permanent entries may stay */ TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, expire.list, lnk_tmp) DeleteLink(&lnk, deletePermanent); - - for (i = 0; i < LINK_TABLE_IN_SIZE; i++) { - struct group_in *grp, *grp_tmp; - - LIST_FOREACH_SAFE(grp, &la->groupTableIn[i], group_in, grp_tmp) - if (LIST_EMPTY(&grp->full) && LIST_EMPTY(&grp->partial)) { - LIST_REMOVE(grp, group_in); - free(grp); - } - } } - static void CleanupLink(struct libalias *la, struct alias_link **lnk, int deletePermanent) { @@ -881,7 +478,9 @@ DeleteLink(struct alias_link **plnk, int deletePermanent) case LINK_PPTP: LIST_REMOVE(lnk, pptp.list); break; - default: + default: { + struct group_in *grp; + /* Free memory allocated for LSNAT server pool */ if (lnk->server != NULL) { struct server *head, *curr, *next; @@ -893,11 +492,21 @@ DeleteLink(struct alias_link **plnk, int deletePermanent) } while ((curr = next) != head); } else { /* Adjust output table pointers */ - LIST_REMOVE(lnk, all.out); + SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); } /* Adjust input table pointers */ LIST_REMOVE(lnk, all.in); + + /* Remove intermediate node, if empty */ + grp = StartPointIn(la, lnk->alias_addr, lnk->alias_port, lnk->link_type, 0); + if (grp != NULL && + LIST_EMPTY(&grp->full) && + LIST_EMPTY(&grp->partial)) { + SPLAY_REMOVE(splay_in, &la->linkSplayIn, grp); + free(grp); + } + } break; } @@ -956,7 +565,6 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, struct in_addr alias_addr, u_short src_port, u_short dst_port, int alias_port_param, int link_type) { - u_int start_point; struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); @@ -1083,9 +691,7 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, } /* Set up pointers for output lookup table */ - start_point = StartPointOut(src_addr, dst_addr, - src_port, dst_port, link_type); - LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, all.out); + SPLAY_INSERT(splay_out, &la->linkSplayOut, lnk); /* Set up pointers for input lookup table */ if (lnk->flags & LINK_PARTIALLY_SPECIFIED) @@ -1138,35 +744,25 @@ ReLink(struct alias_link *old_lnk, return (new_lnk); } - -#define OUTGUARD \ - if (lnk->src_port != src_port || \ - lnk->src_addr.s_addr != src_addr.s_addr || \ - lnk->dst_addr.s_addr != dst_addr.s_addr || \ - lnk->dst_port != dst_port || \ - lnk->link_type != link_type) \ - continue; - static struct alias_link * _SearchLinkOut(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, u_short src_port, u_short dst_port, int link_type) { - u_int i; struct alias_link *lnk; + struct alias_link needle = { + .src_addr = src_addr, + .dst_addr = dst_addr, + .src_port = src_port, + .dst_port = dst_port, + .link_type = link_type + }; - i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); - LIST_FOREACH(lnk, &la->linkTableOut[i], all.out) { - OUTGUARD; - return (UseLink(la, lnk)); - } - - return (NULL); + lnk = SPLAY_FIND(splay_out, &la->linkSplayOut, &needle); + return (UseLink(la, lnk)); } -#undef OUTGUARD - static struct alias_link * _FindLinkOut(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, @@ -2331,7 +1927,7 @@ LibAliasAddServer(struct libalias *la, struct alias_link *lnk, struct in_addr ad if (head == NULL) { server->next = server; /* not usable for outgoing connections */ - LIST_REMOVE(lnk, all.out); + SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); } else { struct server *s; @@ -2481,8 +2077,6 @@ finishoff(void) struct libalias * LibAliasInit(struct libalias *la) { - int i; - if (la == NULL) { #ifdef _KERNEL #undef malloc /* XXX: ugly */ @@ -2506,10 +2100,8 @@ LibAliasInit(struct libalias *la) LibAliasTime = time(NULL); #endif - for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) - LIST_INIT(&la->linkTableOut[i]); - for (i = 0; i < LINK_TABLE_IN_SIZE; i++) - LIST_INIT(&la->groupTableIn[i]); + SPLAY_INIT(&la->linkSplayIn); + SPLAY_INIT(&la->linkSplayOut); LIST_INIT(&la->pptpList); TAILQ_INIT(&la->checkExpire); #ifdef _KERNEL @@ -2702,20 +2294,6 @@ fill_rule(void *buf, int bufsize, int rulenum, return ((char *)cmd - (char *)buf); } -static void ClearAllFWHoles(struct libalias *la); - -#define fw_setfield(la, field, num) \ -do { \ - (field)[(num) - la->fireWallBaseNum] = 1; \ -} /*lint -save -e717 */ while(0)/* lint -restore */ - -#define fw_clrfield(la, field, num) \ -do { \ - (field)[(num) - la->fireWallBaseNum] = 0; \ -} /*lint -save -e717 */ while(0)/* lint -restore */ - -#define fw_tstfield(la, field, num) ((field)[(num) - la->fireWallBaseNum]) - static void InitPunchFW(struct libalias *la) { diff --git a/sys/netinet/libalias/alias_db.h b/sys/netinet/libalias/alias_db.h new file mode 100644 index 000000000000..971ca305c1a6 --- /dev/null +++ b/sys/netinet/libalias/alias_db.h @@ -0,0 +1,443 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Charles Mott + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 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. + */ + +/* + Alias_db.c encapsulates all data structures used for storing + packet aliasing data. Other parts of the aliasing software + access data through functions provided in this file. + + Data storage is based on the notion of a "link", which is + established for ICMP echo/reply packets, UDP datagrams and + TCP stream connections. A link stores the original source + and destination addresses. For UDP and TCP, it also stores + source and destination port numbers, as well as an alias + port number. Links are also used to store information about + fragments. + + There is a facility for sweeping through and deleting old + links as new packets are sent through. A simple timeout is + used for ICMP and UDP links. TCP links are left alone unless + there is an incomplete connection, in which case the link + can be deleted after a certain amount of time. + + Initial version: August, 1996 (cjm) + + Version 1.4: September 16, 1996 (cjm) + Facility for handling incoming links added. + + Version 1.6: September 18, 1996 (cjm) + ICMP data handling simplified. + + Version 1.7: January 9, 1997 (cjm) + Fragment handling simplified. + Saves pointers for unresolved fragments. + Permits links for unspecified remote ports + or unspecified remote addresses. + Fixed bug which did not properly zero port + table entries after a link was deleted. + Cleaned up some obsolete comments. + + Version 1.8: January 14, 1997 (cjm) + Fixed data type error in StartPoint(). + (This error did not exist prior to v1.7 + and was discovered and fixed by Ari Suutari) + + Version 1.9: February 1, 1997 + Optionally, connections initiated from packet aliasing host + machine will will not have their port number aliased unless it + conflicts with an aliasing port already being used. (cjm) + + All options earlier being #ifdef'ed are now available through + a new interface, SetPacketAliasMode(). This allows run time + control (which is now available in PPP+pktAlias through the + 'alias' keyword). (ee) + + Added ability to create an alias port without + either destination address or port specified. + port type = ALIAS_PORT_UNKNOWN_DEST_ALL (ee) + + Removed K&R style function headers + and general cleanup. (ee) + + Added packetAliasMode to replace compiler #defines's (ee) + + Allocates sockets for partially specified + ports if ALIAS_USE_SOCKETS defined. (cjm) + + Version 2.0: March, 1997 + SetAliasAddress() will now clean up alias links + if the aliasing address is changed. (cjm) + + PacketAliasPermanentLink() function added to support permanent + links. (J. Fortes suggested the need for this.) + Examples: + + (192.168.0.1, port 23) <-> alias port 6002, unknown dest addr/port + + (192.168.0.2, port 21) <-> alias port 3604, known dest addr + unknown dest port + + These permanent links allow for incoming connections to + machines on the local network. They can be given with a + user-chosen amount of specificity, with increasing specificity + meaning more security. (cjm) + + Quite a bit of rework to the basic engine. The portTable[] + array, which kept track of which ports were in use was replaced + by a table/linked list structure. (cjm) + + SetExpire() function added. (cjm) + + DeleteLink() no longer frees memory association with a pointer + to a fragment (this bug was first recognized by E. Eklund in + v1.9). + + Version 2.1: May, 1997 (cjm) + Packet aliasing engine reworked so that it can handle + multiple external addresses rather than just a single + host address. + + PacketAliasRedirectPort() and PacketAliasRedirectAddr() + added to the API. The first function is a more generalized + version of PacketAliasPermanentLink(). The second function + implements static network address translation. + + Version 3.2: July, 2000 (salander and satoh) + Added FindNewPortGroup to get contiguous range of port values. + + Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing + link but not actually add one. + + Added FindRtspOut, which is closely derived from FindUdpTcpOut, + except that the alias port (from FindNewPortGroup) is provided + as input. + + See HISTORY file for additional revisions. +*/ + +#ifndef _ALIAS_DB_H_ +#define _ALIAS_DB_H_ + + +/* + Constants (note: constants are also defined + near relevant functions or structs) +*/ + +/* Timeouts (in seconds) for different link types */ +#define ICMP_EXPIRE_TIME 60 +#define UDP_EXPIRE_TIME 60 +#define PROTO_EXPIRE_TIME 60 +#define FRAGMENT_ID_EXPIRE_TIME 10 +#define FRAGMENT_PTR_EXPIRE_TIME 30 + +/* TCP link expire time for different cases */ +/* When the link has been used and closed - minimal grace time to + allow ACKs and potential re-connect in FTP (XXX - is this allowed?) */ +#ifndef TCP_EXPIRE_DEAD +#define TCP_EXPIRE_DEAD 10 +#endif + +/* When the link has been used and closed on one side - the other side + is allowed to still send data */ +#ifndef TCP_EXPIRE_SINGLEDEAD +#define TCP_EXPIRE_SINGLEDEAD 90 +#endif + +/* When the link isn't yet up */ +#ifndef TCP_EXPIRE_INITIAL +#define TCP_EXPIRE_INITIAL 300 +#endif + +/* When the link is up */ +#ifndef TCP_EXPIRE_CONNECTED +#define TCP_EXPIRE_CONNECTED 86400 +#endif + +/* Dummy port number codes used for FindLinkIn/Out() and AddLink(). + These constants can be anything except zero, which indicates an + unknown port number. */ + +#define NO_DEST_PORT 1 +#define NO_SRC_PORT 1 + +/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ +static struct in_addr const ANY_ADDR = { INADDR_ANY }; + +/* Data Structures + + The fundamental data structure used in this program is + "struct alias_link". Whenever a TCP connection is made, + a UDP datagram is sent out, or an ICMP echo request is made, + a link record is made (if it has not already been created). + The link record is identified by the source address/port + and the destination address/port. In the case of an ICMP + echo request, the source port is treated as being equivalent + with the 16-bit ID number of the ICMP packet. + + The link record also can store some auxiliary data. For + TCP connections that have had sequence and acknowledgment + modifications, data space is available to track these changes. + A state field is used to keep track in changes to the TCP + connection state. ID numbers of fragments can also be + stored in the auxiliary space. Pointers to unresolved + fragments can also be stored. + + The link records support two independent chainings. Lookup + tables for input and out tables hold the initial pointers + the link chains. On input, the lookup table indexes on alias + port and link type. On output, the lookup table indexes on + source address, destination address, source port, destination + port and link type. +*/ + +/* used to save changes to ACK/sequence numbers */ +struct ack_data_record { + u_long ack_old; + u_long ack_new; + int delta; + int active; +}; + +/* Information about TCP connection */ +struct tcp_state { + int in; /* State for outside -> inside */ + int out; /* State for inside -> outside */ + int index; /* Index to ACK data array */ + /* Indicates whether ACK and sequence numbers been modified */ + int ack_modified; +}; + +/* Number of distinct ACK number changes + * saved for a modified TCP stream */ +#define N_LINK_TCP_DATA 3 +struct tcp_dat { + struct tcp_state state; + struct ack_data_record ack[N_LINK_TCP_DATA]; + /* Which firewall record is used for this hole? */ + int fwhole; +}; + +/* LSNAT server pool (circular list) */ +struct server { + struct in_addr addr; + u_short port; + struct server *next; +}; + +/* Main data structure */ +struct alias_link { + struct libalias *la; + /* Address and port information */ + struct in_addr src_addr; + struct in_addr dst_addr; + struct in_addr alias_addr; + struct in_addr proxy_addr; + u_short src_port; + u_short dst_port; + u_short alias_port; + u_short proxy_port; + struct server *server; + /* Type of link: TCP, UDP, ICMP, proto, frag */ + int link_type; +/* values for link_type */ +#define LINK_ICMP IPPROTO_ICMP +#define LINK_UDP IPPROTO_UDP +#define LINK_TCP IPPROTO_TCP +#define LINK_FRAGMENT_ID (IPPROTO_MAX + 1) +#define LINK_FRAGMENT_PTR (IPPROTO_MAX + 2) +#define LINK_ADDR (IPPROTO_MAX + 3) +#define LINK_PPTP (IPPROTO_MAX + 4) + + int flags; /* indicates special characteristics */ + int pflags; /* protocol-specific flags */ +/* flag bits */ +#define LINK_UNKNOWN_DEST_PORT 0x01 +#define LINK_UNKNOWN_DEST_ADDR 0x02 +#define LINK_PERMANENT 0x04 *** 203 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jul 6 08:54:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E6114653BBC; Tue, 6 Jul 2021 08:54: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 4GJxFX62dZz4mRX; Tue, 6 Jul 2021 08:54: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 B69BF16E06; Tue, 6 Jul 2021 08:54: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 1668seIO023704; Tue, 6 Jul 2021 08:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1668seVc023703; Tue, 6 Jul 2021 08:54:40 GMT (envelope-from git) Date: Tue, 6 Jul 2021 08:54:40 GMT Message-Id: <202107060854.1668seVc023703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 13aa56fcd596 - main - cam(4): preserve alloc_flags when copying CCBs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13aa56fcd59674cd65afc8e9d6b0c15d32bf9f81 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 08:54:41 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=13aa56fcd59674cd65afc8e9d6b0c15d32bf9f81 commit 13aa56fcd59674cd65afc8e9d6b0c15d32bf9f81 Author: Edward Tomasz Napierala AuthorDate: 2021-07-06 08:23:25 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-06 08:27:22 +0000 cam(4): preserve alloc_flags when copying CCBs Before UMA CCBs, all CCBs were of the same size, and could be trivially copied using bcopy(9). Now we have to preserve alloc_flags, otherwise we might end up attempting to free stack-allocated CCB to UMA; we also need to take CCB size into account. This fixes kernel panic which would occur when trying to access a stopped (as in, SCSI START STOP, also "ctladm stop") SCSI device. Reported By: Gary Jennejohn Tested By: Gary Jennejohn Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31054 --- sys/cam/cam_periph.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 3e1a19936825..90ddf261cb12 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -1354,6 +1354,7 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb) cam_status status; struct scsi_start_stop_unit *scsi_cmd; int error = 0, error_code, sense_key, asc, ascq; + u_int16_t done_flags; scsi_cmd = (struct scsi_start_stop_unit *) &done_ccb->csio.cdb_io.cdb_bytes; @@ -1422,8 +1423,21 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb) * blocking by that also any new recovery attempts for this CCB, * and the result will be the final one returned to the CCB owher. */ + + /* + * Copy the CCB back, preserving the alloc_flags field. Things + * will crash horribly if the CCBs are not of the same size. + */ saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; - bcopy(saved_ccb, done_ccb, sizeof(*done_ccb)); + KASSERT(saved_ccb->ccb_h.func_code == XPT_SCSI_IO, + ("%s: saved_ccb func_code %#x != XPT_SCSI_IO", + __func__, saved_ccb->ccb_h.func_code)); + KASSERT(done_ccb->ccb_h.func_code == XPT_SCSI_IO, + ("%s: done_ccb func_code %#x != XPT_SCSI_IO", + __func__, done_ccb->ccb_h.func_code)); + done_flags = done_ccb->ccb_h.alloc_flags; + bcopy(saved_ccb, done_ccb, sizeof(struct ccb_scsiio)); + done_ccb->ccb_h.alloc_flags = done_flags; xpt_free_ccb(saved_ccb); if (done_ccb->ccb_h.cbfcnp != camperiphdone) periph->flags &= ~CAM_PERIPH_RECOVERY_INPROG; @@ -1619,6 +1633,7 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig, struct cam_periph *periph; union ccb *orig_ccb = ccb; int error, recoveryccb; + u_int16_t flags; #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) if (ccb->ccb_h.func_code == XPT_SCSI_IO && ccb->csio.bio != NULL) @@ -1713,7 +1728,13 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig, * this freeze will be dropped as part of ERESTART. */ ccb->ccb_h.status &= ~CAM_DEV_QFRZN; - bcopy(ccb, orig_ccb, sizeof(*orig_ccb)); + + KASSERT(ccb->ccb_h.func_code == XPT_SCSI_IO, + ("%s: ccb func_code %#x != XPT_SCSI_IO", + __func__, ccb->ccb_h.func_code)); + flags = orig_ccb->ccb_h.alloc_flags; + bcopy(ccb, orig_ccb, sizeof(struct ccb_scsiio)); + orig_ccb->ccb_h.alloc_flags = flags; } switch (err_action & SS_MASK) { From owner-dev-commits-src-all@freebsd.org Tue Jul 6 09:03:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B808653BF6; Tue, 6 Jul 2021 09:03:14 +0000 (UTC) (envelope-from bapt@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 4GJxRQ1FtNz4mrX; Tue, 6 Jul 2021 09:03:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id EF932554F; Tue, 6 Jul 2021 09:03:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 3F5713AA12; Tue, 6 Jul 2021 11:03:11 +0200 (CEST) Date: Tue, 6 Jul 2021 11:03:11 +0200 From: Baptiste Daroussin To: Fernando =?utf-8?Q?Apestegu=C3=ADa?= Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0a0f7486413c - main - man: Build manpages for all architectures Message-ID: <20210706090311.aomxh4n45tkpktdc@aniel.nours.eu> References: <202106300806.15U86pGq037942@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202106300806.15U86pGq037942@gitrepo.freebsd.org> X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 09:03:14 -0000 On Wed, Jun 30, 2021 at 08:06:51AM +0000, Fernando Apesteguía wrote: > The branch main has been updated by fernape (doc, ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=0a0f7486413c147d56808b38055c40c64cff61f5 > > commit 0a0f7486413c147d56808b38055c40c64cff61f5 > Author: Fernando Apesteguía > AuthorDate: 2021-06-09 10:58:04 +0000 > Commit: Fernando Apesteguía > CommitDate: 2021-06-30 07:57:51 +0000 > > man: Build manpages for all architectures > > Building and installing architecture-specific man pages only raises a number of > problems: > > * The https://www.freebsd.org/cgi/man.cgi is incomplete. As an > example, it does not show results for pae(4). The reason for this is > that the cgi interface runs on FreeBSD amd64. > > * In FreeBSD amd64 some manual pages have broken X-refs. See hptrr(4) > for an example. > > * Also, we have broken links in our Release Notes. This is a > consequence of the first point. See > https://www.freebsd.org/releases/13.0R/hardware/#proc-i386. > > Make MAN_ARCH default to 'all' so we build all the man pages for all the > architectures. The difference in disk space is negligible. Also link > architecture-specific man pages to their own section while keeping their own > namespace. > > PR: 212290 > Reported by: mj@bsdops.com > Approved by: ceri@, wosch@ > MFC after: 4 weeks > --- > sbin/Makefile | 6 ++++++ > share/man/man4/Makefile | 4 +--- > share/man/man4/man4.aarch64/Makefile | 5 +++++ > share/man/man4/man4.arm/Makefile | 5 +++++ > share/man/man4/man4.i386/Makefile | 5 +++++ > share/man/man4/man4.powerpc/Makefile | 5 +++++ > share/man/man5/make.conf.5 | 2 +- > usr.sbin/Makefile | 7 +++++++ > usr.sbin/apm/Makefile | 4 ++++ > 9 files changed, 39 insertions(+), 4 deletions(-) > > diff --git a/sbin/Makefile b/sbin/Makefile > index 64840bae82bb..f53e2f037ebe 100644 > --- a/sbin/Makefile > +++ b/sbin/Makefile > @@ -90,6 +90,12 @@ SUBDIR.${MK_ZFS}+= zfsbootcfg > > SUBDIR.${MK_TESTS}+= tests > > +# Add architecture-specific manpages > +# to be included anyway > +MAN= sconfig/sconfig.8 > + > +.include > + > .include > > SUBDIR_PARALLEL= > diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile > index 5051470edc71..9027fe7df841 100644 > --- a/share/man/man4/Makefile > +++ b/share/man/man4/Makefile > @@ -895,9 +895,7 @@ _cgem.4= cgem.4 > MLINKS+=cgem.4 if_cgem.4 > .endif > > -.if empty(MAN_ARCH) > -__arches= ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH} > -.elif ${MAN_ARCH} == "all" > +.if empty(MAN_ARCH) || ${MAN_ARCH} == "all" > __arches= ${:!/bin/sh -c "/bin/ls -d ${.CURDIR}/man4.*"!:E} > .else > __arches= ${MAN_ARCH} > diff --git a/share/man/man4/man4.aarch64/Makefile b/share/man/man4/man4.aarch64/Makefile > index 6714a47011ef..ef5fcd84ccd4 100644 > --- a/share/man/man4/man4.aarch64/Makefile > +++ b/share/man/man4/man4.aarch64/Makefile > @@ -17,6 +17,11 @@ MAN= \ > rk_i2c.4 \ > rk_pinctrl.4 \ > > +# Link files to the parent directory > +.for _manpage in ${MAN} > +MLINKS+=${_manpage} ../${_manpage} > +.endfor This breaks make -DNO_ROOT in a subtle manner and so likely pkgbase. The right way to do it is to add something that uses INSTALL_RSYMLINK or alike. Best regards, Bapt From owner-dev-commits-src-all@freebsd.org Tue Jul 6 09:35:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 76705654C55; Tue, 6 Jul 2021 09:35:20 +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 4GJy8S2w0nz4qpM; Tue, 6 Jul 2021 09:35:20 +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 4C15317343; Tue, 6 Jul 2021 09:35:20 +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 1669ZKtc076990; Tue, 6 Jul 2021 09:35:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1669ZKWq076989; Tue, 6 Jul 2021 09:35:20 GMT (envelope-from git) Date: Tue, 6 Jul 2021 09:35:20 GMT Message-Id: <202107060935.1669ZKWq076989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: a081a943a0ec - main - cam: drop unused 'saved_ccb' field from softcs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a081a943a0ece20cf4ed28681ec3e01baa94ca2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 09:35:20 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=a081a943a0ece20cf4ed28681ec3e01baa94ca2e commit a081a943a0ece20cf4ed28681ec3e01baa94ca2e Author: Edward Tomasz Napierala AuthorDate: 2021-07-06 09:04:09 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-06 09:04:38 +0000 cam: drop unused 'saved_ccb' field from softcs No functional changes. Do not MFC this, it changes kernel ABI. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30698 --- sys/cam/mmc/mmc_xpt.c | 1 - sys/cam/scsi/scsi_cd.c | 1 - sys/cam/scsi/scsi_ch.c | 1 - sys/cam/scsi/scsi_da.c | 1 - sys/cam/scsi/scsi_enc_internal.h | 1 - sys/cam/scsi/scsi_pass.c | 1 - sys/cam/scsi/scsi_pt.c | 1 - sys/cam/scsi/scsi_sa.c | 1 - sys/cam/scsi/scsi_sg.c | 1 - sys/cam/scsi/scsi_xpt.c | 1 - 10 files changed, 10 deletions(-) diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index a649946f096f..6a3ba02acecb 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -176,7 +176,6 @@ CAM_XPT_PROTO(mmc_proto); typedef struct { probe_action action; int restart; - union ccb saved_ccb; uint32_t host_ocr; uint32_t flags; #define PROBE_FLAG_ACMD_SENT 0x1 /* CMD55 is sent, card expects ACMD */ diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 91d91a6a8e78..e790b0c89d02 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -164,7 +164,6 @@ struct cd_softc { struct bio_queue_head bio_queue; LIST_HEAD(, ccb_hdr) pending_ccbs; struct cd_params params; - union ccb saved_ccb; cd_quirks quirks; struct cam_periph *periph; int minimum_command_size; diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 64b0947eaf8d..d440526a7913 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -145,7 +145,6 @@ struct ch_softc { ch_flags flags; ch_state state; ch_quirks quirks; - union ccb saved_ccb; struct devstat *device_stats; struct cdev *dev; int open_count; diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index cf6e2e17e410..ad4c2611333a 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -373,7 +373,6 @@ struct da_softc { int p_type; struct disk_params params; struct disk *disk; - union ccb saved_ccb; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; diff --git a/sys/cam/scsi/scsi_enc_internal.h b/sys/cam/scsi/scsi_enc_internal.h index ed00dee1578c..61696a89b4ee 100644 --- a/sys/cam/scsi/scsi_enc_internal.h +++ b/sys/cam/scsi/scsi_enc_internal.h @@ -143,7 +143,6 @@ struct enc_softc { #define ENC_FLAG_INVALID 0x01 #define ENC_FLAG_INITIALIZED 0x02 #define ENC_FLAG_SHUTDOWN 0x04 - union ccb saved_ccb; struct cdev *enc_dev; struct cam_periph *periph; int open_count; diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 146ff8f26700..e7d9d755c8cc 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -129,7 +129,6 @@ struct pass_softc { pass_state state; pass_flags flags; u_int8_t pd_type; - union ccb saved_ccb; int open_count; u_int maxio; struct devstat *device_stats; diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 50ac160db6e9..4e7ce9566c59 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -82,7 +82,6 @@ struct pt_softc { LIST_HEAD(, ccb_hdr) pending_ccbs; pt_state state; pt_flags flags; - union ccb saved_ccb; int io_timeout; struct cdev *dev; }; diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 6c7e20df9f6d..d53fd06b2377 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -351,7 +351,6 @@ struct sa_softc { u_int8_t dsreg; /* mtio mt_dsreg, redux */ int buffer_mode; int filemarks; - union ccb saved_ccb; int last_resid_was_io; uint8_t density_type_bits[SA_DENSITY_TYPES]; int density_info_valid[SA_DENSITY_TYPES]; diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c index 6b6e65a39f75..c2be014b118b 100644 --- a/sys/cam/scsi/scsi_sg.c +++ b/sys/cam/scsi/scsi_sg.c @@ -106,7 +106,6 @@ struct sg_softc { int sg_timeout; int sg_user_timeout; uint8_t pd_type; - union ccb saved_ccb; }; static d_open_t sgopen; diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index b88e1869b880..6b77d50b25c3 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -189,7 +189,6 @@ typedef enum { typedef struct { TAILQ_HEAD(, ccb_hdr) request_ccbs; probe_action action; - union ccb saved_ccb; probe_flags flags; MD5_CTX context; u_int8_t digest[16]; From owner-dev-commits-src-all@freebsd.org Tue Jul 6 10:07:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2F74E6553A4 for ; Tue, 6 Jul 2021 10:07:18 +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 4GJysL0pn0z4tcG; Tue, 6 Jul 2021 10:07:18 +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 ECC0317641; Tue, 6 Jul 2021 10:07: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 166A7HKp018200; Tue, 6 Jul 2021 10:07:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7HVD018199; Tue, 6 Jul 2021 10:07:17 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:17 GMT Message-Id: <202107061007.166A7HVD018199@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Alex Richardson Subject: git: f9f37c002ab5 - vendor/arm-optimized-routines - vendor branch created MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/vendor/arm-optimized-routines X-Git-Reftype: branch X-Git-Commit: f9f37c002ab5a580accfe26b731eef45e798b435 X-Git-Oldrev: 0000000000000000000000000000000000000000 X-Git-Newrev: f9f37c002ab5a580accfe26b731eef45e798b435 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:18 -0000 The branch vendor/arm-optimized-routines has been created by arichardson: URL: https://cgit.FreeBSD.org/src/log/?id=f9f37c002ab5 f9f37c002ab5 Import Arm Optimized Routines v21.02 From owner-dev-commits-src-all@freebsd.org Tue Jul 6 10:07:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3A0556550D2 for ; Tue, 6 Jul 2021 10:07:18 +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 4GJysL1Bzhz4th2; Tue, 6 Jul 2021 10:07:18 +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 0ECD117642; Tue, 6 Jul 2021 10:07:18 +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 166A7HpQ018224; Tue, 6 Jul 2021 10:07:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7Hm4018223; Tue, 6 Jul 2021 10:07:17 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:17 GMT Message-Id: <202107061007.166A7Hm4018223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Alex Richardson Subject: git: 253862e5c0bb - Create tag vendor/arm-optimized-routines/v21.02 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/tags/vendor/arm-optimized-routines/v21.02 X-Git-Reftype: annotated tag X-Git-Commit: 253862e5c0bbbe6d64e9c0ce9d06f4c85cdc48dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:18 -0000 The annotated tag vendor/arm-optimized-routines/v21.02 has been created by arichardson: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/arm-optimized-routines/v21.02 tag vendor/arm-optimized-routines/v21.02 Tagger: Alex Richardson TaggerDate: 2021-02-22 11:59:46 +0000 Import Arm Optimized Routines v21.02 commit f9f37c002ab5a580accfe26b731eef45e798b435 Author: Alex Richardson AuthorDate: 2021-02-22 11:59:12 +0000 Commit: Alex Richardson CommitDate: 2021-02-22 11:59:12 +0000 Import Arm Optimized Routines v21.02 We already have copies of some of these files in the repository without a vendor import and we should really be using contrib/ instead. We should also be able to use some of the math functions to allow the tests to pass on AArch64 (and other architectures) instead of just x86. We should also be able to reuse some of the tests for the kyua testsuite. Imported using ``` curl -L https://github.com/ARM-software/optimized-routines/tarball/e823e3abf5f89ecba58a10fc0fd82c13d9984b6b | tar --strip-components=1 -xvzf - git add . ``` From owner-dev-commits-src-all@freebsd.org Tue Jul 6 10:07:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 64F046551C6; Tue, 6 Jul 2021 10:07: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 4GJysR2RTVz4tKJ; Tue, 6 Jul 2021 10:07: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 3D1A1178EE; Tue, 6 Jul 2021 10:07: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 166A7N2P018361; Tue, 6 Jul 2021 10:07:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7NSD018360; Tue, 6 Jul 2021 10:07:23 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:23 GMT Message-Id: <202107061007.166A7NSD018360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d053fb22f6d3 - main - usr.bin/sort: Avoid UBSan errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:23 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32 commit d053fb22f6d3b6bb0f4e47e4507fefc20cbe0e32 Author: Alex Richardson AuthorDate: 2021-07-05 13:32:48 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 09:51:05 +0000 usr.bin/sort: Avoid UBSan errors UBSan complains about out-of-bounds accesses for zero-length arrays. To avoid this we can use flexible array members. However, the C standard does not allow for structures that only contain flexible array members, so we move the length parameters into that structure too. Split out from D28233. Reviewed By: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31009 --- usr.bin/sort/Makefile | 2 +- usr.bin/sort/bwstring.c | 267 ++++++++++++++++++++++++------------------------ usr.bin/sort/bwstring.h | 31 +++--- 3 files changed, 155 insertions(+), 145 deletions(-) diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile index d38e036b90c0..3f7b607a177a 100644 --- a/usr.bin/sort/Makefile +++ b/usr.bin/sort/Makefile @@ -3,8 +3,8 @@ .include PROG= sort - SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c +CSTD= c11 sort.1: sort.1.in sed ${MAN_SUB} ${.ALLSRC} >${.TARGET} diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index f6200c53c83e..c31cb859cb37 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -113,7 +113,7 @@ initialise_months(void) static int wide_str_coll(const wchar_t *s1, const wchar_t *s2) { - int ret = 0; + int ret; errno = 0; ret = wcscoll(s1, s2); @@ -144,41 +144,44 @@ bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) { if (mb_cur_max == 1) - fprintf(f, "%s%s%s", prefix, bws->data.cstr, suffix); + fprintf(f, "%s%s%s", prefix, bws->cdata.str, suffix); else - fprintf(f, "%s%S%s", prefix, bws->data.wstr, suffix); + fprintf(f, "%s%S%s", prefix, bws->wdata.str, suffix); } const void* bwsrawdata(const struct bwstring *bws) { - return (&(bws->data)); + return (&(bws->wdata)); } size_t bwsrawlen(const struct bwstring *bws) { - return ((mb_cur_max == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); + return ((mb_cur_max == 1) ? bws->cdata.len : + SIZEOF_WCHAR_STRING(bws->wdata.len)); } size_t bws_memsize(const struct bwstring *bws) { - return ((mb_cur_max == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : - (SIZEOF_WCHAR_STRING(bws->len + 1) + sizeof(struct bwstring))); + return ((mb_cur_max == 1) ? + (bws->cdata.len + 2 + sizeof(struct bwstring)) : + (SIZEOF_WCHAR_STRING(bws->wdata.len + 1) + sizeof(struct bwstring))); } void bws_setlen(struct bwstring *bws, size_t newlen) { - if (bws && newlen != bws->len && newlen <= bws->len) { - bws->len = newlen; - if (mb_cur_max == 1) - bws->data.cstr[newlen] = '\0'; - else - bws->data.wstr[newlen] = L'\0'; + if (mb_cur_max == 1 && bws && newlen != bws->cdata.len && + newlen <= bws->cdata.len) { + bws->cdata.len = newlen; + bws->cdata.str[newlen] = '\0'; + } else if (bws && newlen != bws->wdata.len && newlen <= bws->wdata.len) { + bws->wdata.len = newlen; + bws->wdata.str[newlen] = L'\0'; } } @@ -190,17 +193,16 @@ bwsalloc(size_t sz) { struct bwstring *ret; - if (mb_cur_max == 1) + if (mb_cur_max == 1) { ret = sort_malloc(sizeof(struct bwstring) + 1 + sz); - else - ret = sort_malloc(sizeof(struct bwstring) + - SIZEOF_WCHAR_STRING(sz + 1)); - ret->len = sz; - - if (mb_cur_max == 1) - ret->data.cstr[ret->len] = '\0'; - else - ret->data.wstr[ret->len] = L'\0'; + ret->cdata.len = sz; + ret->cdata.str[sz] = '\0'; + } else { + ret = sort_malloc( + sizeof(struct bwstring) + SIZEOF_WCHAR_STRING(sz + 1)); + ret->wdata.len = sz; + ret->wdata.str[sz] = L'\0'; + } return (ret); } @@ -216,13 +218,13 @@ bwsdup(const struct bwstring *s) if (s == NULL) return (NULL); else { - struct bwstring *ret = bwsalloc(s->len); + struct bwstring *ret = bwsalloc(BWSLEN(s)); if (mb_cur_max == 1) - memcpy(ret->data.cstr, s->data.cstr, (s->len)); + memcpy(ret->cdata.str, s->cdata.str, (s->cdata.len)); else - memcpy(ret->data.wstr, s->data.wstr, - SIZEOF_WCHAR_STRING(s->len)); + memcpy(ret->wdata.str, s->wdata.str, + SIZEOF_WCHAR_STRING(s->wdata.len)); return (ret); } @@ -244,9 +246,9 @@ bwssbdup(const wchar_t *str, size_t len) if (mb_cur_max == 1) for (size_t i = 0; i < len; ++i) - ret->data.cstr[i] = (unsigned char) str[i]; + ret->cdata.str[i] = (char)str[i]; else - memcpy(ret->data.wstr, str, SIZEOF_WCHAR_STRING(len)); + memcpy(ret->wdata.str, str, SIZEOF_WCHAR_STRING(len)); return (ret); } @@ -264,7 +266,7 @@ bwscsbdup(const unsigned char *str, size_t len) if (str) { if (mb_cur_max == 1) - memcpy(ret->data.cstr, str, len); + memcpy(ret->cdata.str, str, len); else { mbstate_t mbs; const char *s; @@ -288,12 +290,12 @@ bwscsbdup(const unsigned char *str, size_t len) case (size_t) -1: /* FALLTHROUGH */ case (size_t) -2: - ret->data.wstr[chars++] = + ret->wdata.str[chars++] = (unsigned char) s[cptr]; ++cptr; break; default: - n = mbrtowc(ret->data.wstr + (chars++), + n = mbrtowc(ret->wdata.str + (chars++), s + cptr, charlen, &mbs); if ((n == (size_t)-1) || (n == (size_t)-2)) /* NOTREACHED */ @@ -302,8 +304,8 @@ bwscsbdup(const unsigned char *str, size_t len) } } - ret->len = chars; - ret->data.wstr[ret->len] = L'\0'; + ret->wdata.len = chars; + ret->wdata.str[ret->wdata.len] = L'\0'; } } return (ret); @@ -328,19 +330,20 @@ bwsfree(const struct bwstring *s) size_t bwscpy(struct bwstring *dst, const struct bwstring *src) { - size_t nums = src->len; + size_t nums = BWSLEN(src); - if (nums > dst->len) - nums = dst->len; - dst->len = nums; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr, nums); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str, nums); + dst->cdata.len = nums; + dst->cdata.str[dst->cdata.len] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr, - SIZEOF_WCHAR_STRING(nums + 1)); - dst->data.wstr[dst->len] = L'\0'; + memcpy(dst->wdata.str, src->wdata.str, + SIZEOF_WCHAR_STRING(nums)); + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } return (nums); @@ -355,21 +358,22 @@ bwscpy(struct bwstring *dst, const struct bwstring *src) struct bwstring * bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size) { - size_t nums = src->len; + size_t nums = BWSLEN(src); - if (nums > dst->len) - nums = dst->len; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (nums > size) nums = size; - dst->len = nums; if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr, nums); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str, nums); + dst->cdata.len = nums; + dst->cdata.str[nums] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr, - SIZEOF_WCHAR_STRING(nums + 1)); - dst->data.wstr[dst->len] = L'\0'; + memcpy(dst->wdata.str, src->wdata.str, + SIZEOF_WCHAR_STRING(nums)); + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } return (dst); @@ -387,25 +391,24 @@ bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset, size_t size) { - if (offset >= src->len) { - dst->data.wstr[0] = 0; - dst->len = 0; + if (offset >= BWSLEN(src)) { + bws_setlen(dst, 0); } else { - size_t nums = src->len - offset; + size_t nums = BWSLEN(src) - offset; - if (nums > dst->len) - nums = dst->len; + if (nums > BWSLEN(dst)) + nums = BWSLEN(dst); if (nums > size) nums = size; - dst->len = nums; if (mb_cur_max == 1) { - memcpy(dst->data.cstr, src->data.cstr + offset, - (nums)); - dst->data.cstr[dst->len] = '\0'; + memcpy(dst->cdata.str, src->cdata.str + offset, nums); + dst->cdata.len = nums; + dst->cdata.str[nums] = '\0'; } else { - memcpy(dst->data.wstr, src->data.wstr + offset, + memcpy(dst->wdata.str, src->wdata.str + offset, SIZEOF_WCHAR_STRING(nums)); - dst->data.wstr[dst->len] = L'\0'; + dst->wdata.len = nums; + dst->wdata.str[nums] = L'\0'; } } return (dst); @@ -421,16 +424,16 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) { if (mb_cur_max == 1) { - size_t len = bws->len; + size_t len = bws->cdata.len; if (!zero_ended) { - bws->data.cstr[len] = '\n'; + bws->cdata.str[len] = '\n'; - if (fwrite(bws->data.cstr, len + 1, 1, f) < 1) + if (fwrite(bws->cdata.str, len + 1, 1, f) < 1) err(2, NULL); - bws->data.cstr[len] = '\0'; - } else if (fwrite(bws->data.cstr, len + 1, 1, f) < 1) + bws->cdata.str[len] = '\0'; + } else if (fwrite(bws->cdata.str, len + 1, 1, f) < 1) err(2, NULL); return (len + 1); @@ -442,7 +445,7 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) eols = zero_ended ? btowc('\0') : btowc('\n'); while (printed < BWSLEN(bws)) { - const wchar_t *s = bws->data.wstr + printed; + const wchar_t *s = bws->wdata.str + printed; if (*s == L'\0') { int nums; @@ -508,7 +511,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) if (ret[*len - 1] == '\n') --(*len); } - return (bwscsbdup((unsigned char*)ret, *len)); + return (bwscsbdup((unsigned char *)ret, *len)); } else { *len = 0; @@ -548,7 +551,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } else while (!feof(f)) { - wint_t c = 0; + wint_t c; c = fgetwc(f); @@ -581,10 +584,10 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset, size_t len) { size_t cmp_len, len1, len2; - int res = 0; + int res; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); if (len1 <= offset) { return ((len2 <= offset) ? 0 : -1); @@ -604,18 +607,18 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, cmp_len = len; if (mb_cur_max == 1) { - const unsigned char *s1, *s2; + const char *s1, *s2; - s1 = bws1->data.cstr + offset; - s2 = bws2->data.cstr + offset; + s1 = bws1->cdata.str + offset; + s2 = bws2->cdata.str + offset; res = memcmp(s1, s2, cmp_len); } else { const wchar_t *s1, *s2; - s1 = bws1->data.wstr + offset; - s2 = bws2->data.wstr + offset; + s1 = bws1->wdata.str + offset; + s2 = bws2->wdata.str + offset; res = memcmp(s1, s2, SIZEOF_WCHAR_STRING(cmp_len)); } @@ -638,8 +641,8 @@ bwscmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) size_t len1, len2, cmp_len; int res; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); len1 -= offset; len2 -= offset; @@ -665,7 +668,7 @@ int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len) { wchar_t c1, c2; - size_t i = 0; + size_t i; for (i = 0; i < len; ++i) { c1 = bws_get_iter_value(iter1); @@ -684,8 +687,8 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) { size_t len1, len2; - len1 = bws1->len; - len2 = bws2->len; + len1 = BWSLEN(bws1); + len2 = BWSLEN(bws2); if (len1 <= offset) return ((len2 <= offset) ? 0 : -1); @@ -697,13 +700,13 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) len2 -= offset; if (mb_cur_max == 1) { - const unsigned char *s1, *s2; + const char *s1, *s2; - s1 = bws1->data.cstr + offset; - s2 = bws2->data.cstr + offset; + s1 = bws1->cdata.str + offset; + s2 = bws2->cdata.str + offset; if (byte_sort) { - int res = 0; + int res; if (len1 > len2) { res = memcmp(s1, s2, len2); @@ -719,7 +722,7 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) return (res); } else { - int res = 0; + int res; size_t i, maxlen; i = 0; @@ -780,10 +783,10 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) } else { const wchar_t *s1, *s2; size_t i, maxlen; - int res = 0; + int res; - s1 = bws1->data.wstr + offset; - s2 = bws2->data.wstr + offset; + s1 = bws1->wdata.str + offset; + s2 = bws2->wdata.str + offset; i = 0; maxlen = len1; @@ -850,14 +853,14 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) double bwstod(struct bwstring *s0, bool *empty) { - double ret = 0; + double ret; if (mb_cur_max == 1) { - unsigned char *end, *s; + char *end, *s; char *ep; - s = s0->data.cstr; - end = s + s0->len; + s = s0->cdata.str; + end = s + s0->cdata.len; ep = NULL; while (isblank(*s) && s < end) @@ -869,15 +872,15 @@ bwstod(struct bwstring *s0, bool *empty) } ret = strtod((char*)s, &ep); - if ((unsigned char*) ep == s) { + if (ep == s) { *empty = true; return (0); } } else { wchar_t *end, *ep, *s; - s = s0->data.wstr; - end = s + s0->len; + s = s0->wdata.str; + end = s + s0->wdata.len; ep = NULL; while (iswblank(*s) && s < end) @@ -910,25 +913,25 @@ bws_month_score(const struct bwstring *s0) { if (mb_cur_max == 1) { - const unsigned char *end, *s; + const char *end, *s; - s = s0->data.cstr; - end = s + s0->len; + s = s0->cdata.str; + end = s + s0->cdata.len; while (isblank(*s) && s < end) ++s; for (int i = 11; i >= 0; --i) { if (cmonths[i] && - (s == (unsigned char*)strstr((const char*)s, (char*)(cmonths[i])))) + (s == strstr(s, cmonths[i]))) return (i); } } else { const wchar_t *end, *s; - s = s0->data.wstr; - end = s + s0->len; + s = s0->wdata.str; + end = s + s0->wdata.len; while (iswblank(*s) && s < end) ++s; @@ -950,11 +953,11 @@ ignore_leading_blanks(struct bwstring *str) { if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; + char *dst, *end, *src; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end && isblank(*src)) ++src; @@ -974,9 +977,9 @@ ignore_leading_blanks(struct bwstring *str) } else { wchar_t *dst, *end, *src; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end && iswblank(*src)) ++src; @@ -1003,15 +1006,15 @@ ignore_leading_blanks(struct bwstring *str) struct bwstring * ignore_nonprinting(struct bwstring *str) { - size_t newlen = str->len; + size_t newlen = BWSLEN(str); if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; - unsigned char c; + char *dst, *end, *src; + char c; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end) { c = *src; @@ -1028,9 +1031,9 @@ ignore_nonprinting(struct bwstring *str) wchar_t *dst, *end, *src; wchar_t c; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end) { c = *src; @@ -1056,15 +1059,15 @@ ignore_nonprinting(struct bwstring *str) struct bwstring * dictionary_order(struct bwstring *str) { - size_t newlen = str->len; + size_t newlen = BWSLEN(str); if (mb_cur_max == 1) { - unsigned char *dst, *end, *src; - unsigned char c; + char *dst, *end, *src; + char c; - src = str->data.cstr; + src = str->cdata.str; dst = src; - end = src + str->len; + end = src + str->cdata.len; while (src < end) { c = *src; @@ -1081,9 +1084,9 @@ dictionary_order(struct bwstring *str) wchar_t *dst, *end, *src; wchar_t c; - src = str->data.wstr; + src = str->wdata.str; dst = src; - end = src + str->len; + end = src + str->wdata.len; while (src < end) { c = *src; @@ -1110,10 +1113,10 @@ ignore_case(struct bwstring *str) { if (mb_cur_max == 1) { - unsigned char *end, *s; + char *end, *s; - s = str->data.cstr; - end = s + str->len; + s = str->cdata.str; + end = s + str->cdata.len; while (s < end) { *s = toupper(*s); @@ -1122,8 +1125,8 @@ ignore_case(struct bwstring *str) } else { wchar_t *end, *s; - s = str->data.wstr; - end = s + str->len; + s = str->wdata.str; + end = s + str->wdata.len; while (s < end) { *s = towupper(*s); @@ -1138,7 +1141,7 @@ bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos) { if (mb_cur_max == 1) - warnx("%s:%zu: disorder: %s", fn, pos + 1, s->data.cstr); + warnx("%s:%zu: disorder: %s", fn, pos + 1, s->cdata.str); else - warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->data.wstr); + warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->wdata.str); } diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h index b63bb97ab93f..09a0dbf2fac2 100644 --- a/usr.bin/sort/bwstring.h +++ b/usr.bin/sort/bwstring.h @@ -46,17 +46,25 @@ extern bool byte_sort; /* wchar_t is of 4 bytes: */ #define SIZEOF_WCHAR_STRING(LEN) ((LEN)*sizeof(wchar_t)) +struct wstr { + size_t len; + wchar_t str[]; +}; + +struct cstr { + size_t len; + char str[]; +}; + /* * Binary "wide" string */ struct bwstring { - size_t len; - union - { - wchar_t wstr[0]; - unsigned char cstr[0]; - } data; + union { + struct wstr wdata; + struct cstr cdata; + }; }; struct reader_buffer @@ -67,8 +75,7 @@ struct reader_buffer typedef void *bwstring_iterator; -#define BWSLEN(s) ((s)->len) - +#define BWSLEN(s) ((mb_cur_max == 1) ? (s)->cdata.len : (s)->wdata.len) struct bwstring *bwsalloc(size_t sz); size_t bwsrawlen(const struct bwstring *bws); @@ -103,7 +110,7 @@ static inline bwstring_iterator bws_begin(struct bwstring *bws) { - return (bwstring_iterator) (&(bws->data)); + return ((bwstring_iterator)bws->wdata.str); } static inline bwstring_iterator @@ -111,8 +118,8 @@ bws_end(struct bwstring *bws) { return ((mb_cur_max == 1) ? - (bwstring_iterator) (bws->data.cstr + bws->len) : - (bwstring_iterator) (bws->data.wstr + bws->len)); + (bwstring_iterator) (bws->cdata.str + bws->cdata.len) : + (bwstring_iterator) (bws->wdata.str + bws->wdata.len)); } static inline bwstring_iterator @@ -138,7 +145,7 @@ bws_get_iter_value(bwstring_iterator iter) int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len); -#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) +#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? (bws->cdata.str[(pos)]) : bws->wdata.str[(pos)]) void initialise_months(void); From owner-dev-commits-src-all@freebsd.org Tue Jul 6 10:07:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 88EC7655491; Tue, 6 Jul 2021 10:07:24 +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 4GJysS3RB4z4ts7; Tue, 6 Jul 2021 10:07: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 5E39517C9E; Tue, 6 Jul 2021 10:07: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 166A7OfK018385; Tue, 6 Jul 2021 10:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7ORD018384; Tue, 6 Jul 2021 10:07:24 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:24 GMT Message-Id: <202107061007.166A7ORD018384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 4d552825eceb - main - usr.bin/login: send errors to console if syslog isn't running MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d552825ecebecd6c95a995c0b314b09936121b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:24 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4d552825ecebecd6c95a995c0b314b09936121b5 commit 4d552825ecebecd6c95a995c0b314b09936121b5 Author: Alex Richardson AuthorDate: 2021-07-06 09:50:05 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 09:51:16 +0000 usr.bin/login: send errors to console if syslog isn't running I was debugging why login(1) wasn't working as expected on a minimal MFS_ROOT disk image. This image doesn't have syslogd running so the warnings were lost and I had to use GDB to find out why login(1) was failing (missing PAM libraries) instead of being able to see it in the console output. MFC after: 1 week Reviewed By: pfg Differential Revision: https://reviews.freebsd.org/D30892 --- usr.bin/login/login.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 510712a15491..2ac0d9324c26 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -199,7 +199,7 @@ main(int argc, char *argv[]) (void)alarm(timeout); (void)setpriority(PRIO_PROCESS, 0, 0); - openlog("login", 0, LOG_AUTH); + openlog("login", LOG_CONS, LOG_AUTH); uid = getuid(); euid = geteuid(); From owner-dev-commits-src-all@freebsd.org Tue Jul 6 10:07:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3A5236551CD; Tue, 6 Jul 2021 10:07: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 4GJysT6jNlz4tsG; Tue, 6 Jul 2021 10:07: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 9E80B17976; Tue, 6 Jul 2021 10:07: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 166A7PGq018409; Tue, 6 Jul 2021 10:07:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7PmD018408; Tue, 6 Jul 2021 10:07:25 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:25 GMT Message-Id: <202107061007.166A7PmD018408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: e34c713b0e66 - main - rtld/tests: Avoid function name conflict with libc opendir() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e34c713b0e660a49b57fafc02c9eccb26b938220 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:26 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e34c713b0e660a49b57fafc02c9eccb26b938220 commit e34c713b0e660a49b57fafc02c9eccb26b938220 Author: Alex Richardson AuthorDate: 2021-07-06 09:51:57 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 09:51:57 +0000 rtld/tests: Avoid function name conflict with libc opendir() This prevents these tests from being compiled with ASAN since the asan interceptors also define opendir() but matching the libc function. Reviewed By: oshogbo, kib, markj Differential Revision: https://reviews.freebsd.org/D31038 --- libexec/rtld-elf/tests/common.c | 2 +- libexec/rtld-elf/tests/common.h | 2 +- libexec/rtld-elf/tests/ld_library_pathfds.c | 4 ++-- libexec/rtld-elf/tests/ld_preload_fds.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/rtld-elf/tests/common.c b/libexec/rtld-elf/tests/common.c index 6eb3edfbc14c..82dd5180b582 100644 --- a/libexec/rtld-elf/tests/common.c +++ b/libexec/rtld-elf/tests/common.c @@ -67,7 +67,7 @@ try_to_run(int binary, int exit_status, char * const *env, } int -opendir(const char *name) +opendir_fd(const char *name) { return open(name, O_RDONLY | O_DIRECTORY); diff --git a/libexec/rtld-elf/tests/common.h b/libexec/rtld-elf/tests/common.h index d5bf2050dcfd..12a9eec36eb5 100644 --- a/libexec/rtld-elf/tests/common.h +++ b/libexec/rtld-elf/tests/common.h @@ -37,7 +37,7 @@ void expect_missing_library(int binary, char *senv); void try_to_run(int binary, int expected_exit_status, char * const *env, const char *expected_out, const char *expected_err); -int opendir(const char *name); +int opendir_fd(const char *name); int opendirat(int parent, const char *name); #endif /* _LD_COMMON_H_ */ diff --git a/libexec/rtld-elf/tests/ld_library_pathfds.c b/libexec/rtld-elf/tests/ld_library_pathfds.c index bc0627d4c3d5..ed9f51c175fa 100644 --- a/libexec/rtld-elf/tests/ld_library_pathfds.c +++ b/libexec/rtld-elf/tests/ld_library_pathfds.c @@ -159,12 +159,12 @@ static void setup(struct descriptors *dp, const atf_tc_t *tc) { - dp->testdir = opendir(atf_tc_get_config_var(tc, "srcdir")); + dp->testdir = opendir_fd(atf_tc_get_config_var(tc, "srcdir")); ATF_REQUIRE(dp->testdir >= 0); ATF_REQUIRE( (dp->binary = openat(dp->testdir, TARGET_ELF_NAME, O_RDONLY)) >= 0); - ATF_REQUIRE((dp->root = opendir("/")) >= 0); + ATF_REQUIRE((dp->root = opendir_fd("/")) >= 0); ATF_REQUIRE((dp->etc = opendirat(dp->root, "etc")) >= 0); ATF_REQUIRE((dp->usr = opendirat(dp->root, "usr")) >= 0); } diff --git a/libexec/rtld-elf/tests/ld_preload_fds.c b/libexec/rtld-elf/tests/ld_preload_fds.c index 3a220b009bb6..99378b549de5 100644 --- a/libexec/rtld-elf/tests/ld_preload_fds.c +++ b/libexec/rtld-elf/tests/ld_preload_fds.c @@ -39,7 +39,7 @@ setup(const atf_tc_t *tc) { int testdir; - testdir = opendir(atf_tc_get_config_var(tc, "srcdir")); + testdir = opendir_fd(atf_tc_get_config_var(tc, "srcdir")); ATF_REQUIRE(testdir >= 0); binaryfd = openat(testdir, TARGET_ELF_NAME, O_RDONLY); From owner-dev-commits-src-all@freebsd.org Tue Jul 6 10:07:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 86D20655521; Tue, 6 Jul 2021 10:07:27 +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 4GJysW2Djvz4thg; Tue, 6 Jul 2021 10:07:27 +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 1257817A5A; Tue, 6 Jul 2021 10:07:27 +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 166A7QwD018433; Tue, 6 Jul 2021 10:07:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166A7QQu018432; Tue, 6 Jul 2021 10:07:26 GMT (envelope-from git) Date: Tue, 6 Jul 2021 10:07:26 GMT Message-Id: <202107061007.166A7QQu018432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 31914882fca5 - main - Import Arm Optimized Routines v21.02 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31914882fca502069810b9e9ddea4bcd8136a4f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 10:07:27 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=31914882fca502069810b9e9ddea4bcd8136a4f4 commit 31914882fca502069810b9e9ddea4bcd8136a4f4 Merge: e34c713b0e66 f9f37c002ab5 Author: Alex Richardson AuthorDate: 2021-07-06 10:02:44 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 10:05:34 +0000 Import Arm Optimized Routines v21.02 This is the new replacement for the existing cortex-strings code which will be replaced in a follow-up commit. We should also be able to use some of the math functions to allow the tests to pass on AArch64 (and other architectures) instead of just x86. We might also be able to reuse some of the tests for the kyua testsuite. Imported using ``` curl -L https://github.com/ARM-software/optimized-routines/tarball/e823e3abf5f89ecba58a10fc0fd82c13d9984b6b | tar --strip-components=1 -xvzf - git add . ``` Differential Revision: https://reviews.freebsd.org/D29035 git-subtree-dir: contrib/arm-optimized-routines git-subtree-mainline: e34c713b0e660a49b57fafc02c9eccb26b938220 git-subtree-split: f9f37c002ab5a580accfe26b731eef45e798b435 contrib/arm-optimized-routines/.gitignore | 3 + contrib/arm-optimized-routines/LICENSE | 21 + contrib/arm-optimized-routines/Makefile | 89 + contrib/arm-optimized-routines/README | 56 + contrib/arm-optimized-routines/config.mk.dist | 73 + .../contributor-agreement.pdf | Bin 0 -> 104680 bytes contrib/arm-optimized-routines/math/Dir.mk | 110 + contrib/arm-optimized-routines/math/cosf.c | 63 + contrib/arm-optimized-routines/math/erf.c | 244 + contrib/arm-optimized-routines/math/erf_data.c | 85 + contrib/arm-optimized-routines/math/erff.c | 104 + contrib/arm-optimized-routines/math/erff_data.c | 22 + contrib/arm-optimized-routines/math/exp.c | 176 + contrib/arm-optimized-routines/math/exp2.c | 143 + contrib/arm-optimized-routines/math/exp2f.c | 80 + contrib/arm-optimized-routines/math/exp2f_data.c | 78 + contrib/arm-optimized-routines/math/exp_data.c | 1120 + contrib/arm-optimized-routines/math/expf.c | 91 + .../arm-optimized-routines/math/include/mathlib.h | 100 + contrib/arm-optimized-routines/math/log.c | 162 + contrib/arm-optimized-routines/math/log2.c | 141 + contrib/arm-optimized-routines/math/log2_data.c | 209 + contrib/arm-optimized-routines/math/log2f.c | 80 + contrib/arm-optimized-routines/math/log2f_data.c | 33 + contrib/arm-optimized-routines/math/log_data.c | 511 + contrib/arm-optimized-routines/math/logf.c | 79 + contrib/arm-optimized-routines/math/logf_data.c | 33 + contrib/arm-optimized-routines/math/math_config.h | 462 + contrib/arm-optimized-routines/math/math_err.c | 80 + contrib/arm-optimized-routines/math/math_errf.c | 80 + contrib/arm-optimized-routines/math/pow.c | 380 + contrib/arm-optimized-routines/math/pow_log_data.c | 184 + contrib/arm-optimized-routines/math/powf.c | 221 + .../arm-optimized-routines/math/powf_log2_data.c | 34 + contrib/arm-optimized-routines/math/s_cos.c | 6 + contrib/arm-optimized-routines/math/s_cosf.c | 6 + contrib/arm-optimized-routines/math/s_exp.c | 6 + contrib/arm-optimized-routines/math/s_exp2f.c | 6 + contrib/arm-optimized-routines/math/s_exp2f_1u.c | 6 + contrib/arm-optimized-routines/math/s_expf.c | 6 + contrib/arm-optimized-routines/math/s_expf_1u.c | 6 + contrib/arm-optimized-routines/math/s_log.c | 6 + contrib/arm-optimized-routines/math/s_logf.c | 6 + contrib/arm-optimized-routines/math/s_pow.c | 6 + contrib/arm-optimized-routines/math/s_powf.c | 6 + contrib/arm-optimized-routines/math/s_sin.c | 6 + contrib/arm-optimized-routines/math/s_sinf.c | 6 + contrib/arm-optimized-routines/math/sincosf.c | 79 + contrib/arm-optimized-routines/math/sincosf.h | 153 + contrib/arm-optimized-routines/math/sincosf_data.c | 63 + contrib/arm-optimized-routines/math/sinf.c | 67 + .../arm-optimized-routines/math/test/mathbench.c | 773 + .../arm-optimized-routines/math/test/mathtest.c | 1701 + .../math/test/rtest/dotest.c | 2167 ++ .../math/test/rtest/intern.h | 91 + .../arm-optimized-routines/math/test/rtest/main.c | 334 + .../math/test/rtest/random.c | 99 + .../math/test/rtest/random.h | 12 + .../arm-optimized-routines/math/test/rtest/semi.c | 905 + .../arm-optimized-routines/math/test/rtest/semi.h | 53 + .../arm-optimized-routines/math/test/rtest/types.h | 25 + .../math/test/rtest/wrappers.c | 261 + .../math/test/rtest/wrappers.h | 114 + contrib/arm-optimized-routines/math/test/runulp.sh | 315 + .../math/test/testcases/directed/cosf.tst | 25 + .../math/test/testcases/directed/erf.tst | 17 + .../math/test/testcases/directed/erff.tst | 17 + .../math/test/testcases/directed/exp.tst | 31 + .../math/test/testcases/directed/exp2.tst | 30 + .../math/test/testcases/directed/exp2f.tst | 25 + .../math/test/testcases/directed/expf.tst | 23 + .../math/test/testcases/directed/log.tst | 21 + .../math/test/testcases/directed/log2.tst | 21 + .../math/test/testcases/directed/log2f.tst | 27 + .../math/test/testcases/directed/logf.tst | 69 + .../math/test/testcases/directed/pow.tst | 1418 + .../math/test/testcases/directed/powf.tst | 246 + .../math/test/testcases/directed/sincosf.tst | 51 + .../math/test/testcases/directed/sinf.tst | 28 + .../math/test/testcases/random/double.tst | 10 + .../math/test/testcases/random/float.tst | 15 + .../math/test/traces/exp.txt | 16000 ++++++++++ .../math/test/traces/sincosf.txt | 31999 +++++++++++++++++++ contrib/arm-optimized-routines/math/test/ulp.c | 853 + contrib/arm-optimized-routines/math/test/ulp.h | 362 + .../arm-optimized-routines/math/tools/cos.sollya | 31 + .../arm-optimized-routines/math/tools/exp.sollya | 35 + .../arm-optimized-routines/math/tools/exp2.sollya | 48 + .../arm-optimized-routines/math/tools/log.sollya | 35 + .../arm-optimized-routines/math/tools/log2.sollya | 42 + .../math/tools/log2_abs.sollya | 41 + .../math/tools/log_abs.sollya | 35 + contrib/arm-optimized-routines/math/tools/plot.py | 61 + contrib/arm-optimized-routines/math/tools/remez.jl | 1334 + .../arm-optimized-routines/math/tools/sin.sollya | 37 + .../arm-optimized-routines/math/tools/v_exp.sollya | 30 + .../arm-optimized-routines/math/tools/v_log.sollya | 34 + .../arm-optimized-routines/math/tools/v_sin.sollya | 36 + contrib/arm-optimized-routines/math/v_cos.c | 87 + contrib/arm-optimized-routines/math/v_cosf.c | 76 + contrib/arm-optimized-routines/math/v_exp.c | 94 + contrib/arm-optimized-routines/math/v_exp.h | 14 + contrib/arm-optimized-routines/math/v_exp2f.c | 78 + contrib/arm-optimized-routines/math/v_exp2f_1u.c | 75 + contrib/arm-optimized-routines/math/v_exp_data.c | 403 + contrib/arm-optimized-routines/math/v_expf.c | 83 + contrib/arm-optimized-routines/math/v_expf_1u.c | 80 + contrib/arm-optimized-routines/math/v_log.c | 104 + contrib/arm-optimized-routines/math/v_log.h | 18 + contrib/arm-optimized-routines/math/v_log_data.c | 158 + contrib/arm-optimized-routines/math/v_logf.c | 73 + contrib/arm-optimized-routines/math/v_math.h | 641 + contrib/arm-optimized-routines/math/v_pow.c | 27 + contrib/arm-optimized-routines/math/v_powf.c | 235 + contrib/arm-optimized-routines/math/v_sin.c | 86 + contrib/arm-optimized-routines/math/v_sinf.c | 75 + contrib/arm-optimized-routines/math/vn_cos.c | 12 + contrib/arm-optimized-routines/math/vn_cosf.c | 12 + contrib/arm-optimized-routines/math/vn_exp.c | 12 + contrib/arm-optimized-routines/math/vn_exp2f.c | 12 + contrib/arm-optimized-routines/math/vn_exp2f_1u.c | 11 + contrib/arm-optimized-routines/math/vn_expf.c | 12 + contrib/arm-optimized-routines/math/vn_expf_1u.c | 11 + contrib/arm-optimized-routines/math/vn_log.c | 12 + contrib/arm-optimized-routines/math/vn_logf.c | 12 + contrib/arm-optimized-routines/math/vn_pow.c | 12 + contrib/arm-optimized-routines/math/vn_powf.c | 12 + contrib/arm-optimized-routines/math/vn_sin.c | 12 + contrib/arm-optimized-routines/math/vn_sinf.c | 12 + contrib/arm-optimized-routines/networking/Dir.mk | 76 + .../networking/aarch64/chksum_simd.c | 146 + .../networking/arm/chksum_simd.c | 149 + contrib/arm-optimized-routines/networking/chksum.c | 81 + .../networking/chksum_common.h | 132 + .../networking/include/networking.h | 14 + .../networking/test/chksum.c | 381 + contrib/arm-optimized-routines/string/Dir.mk | 113 + .../string/aarch64/__mtag_tag_region.S | 100 + .../string/aarch64/__mtag_tag_zero_region.S | 100 + .../string/aarch64/check-arch.S | 13 + .../string/aarch64/memchr-mte.S | 116 + .../string/aarch64/memchr-sve.S | 64 + .../arm-optimized-routines/string/aarch64/memchr.S | 146 + .../string/aarch64/memcmp-sve.S | 51 + .../arm-optimized-routines/string/aarch64/memcmp.S | 137 + .../string/aarch64/memcpy-advsimd.S | 206 + .../arm-optimized-routines/string/aarch64/memcpy.S | 243 + .../string/aarch64/memrchr.S | 117 + .../arm-optimized-routines/string/aarch64/memset.S | 117 + .../string/aarch64/stpcpy-mte.S | 10 + .../string/aarch64/stpcpy-sve.S | 10 + .../arm-optimized-routines/string/aarch64/stpcpy.S | 10 + .../string/aarch64/strchr-mte.S | 105 + .../string/aarch64/strchr-sve.S | 70 + .../arm-optimized-routines/string/aarch64/strchr.S | 126 + .../string/aarch64/strchrnul-mte.S | 84 + .../string/aarch64/strchrnul-sve.S | 9 + .../string/aarch64/strchrnul.S | 114 + .../string/aarch64/strcmp-mte.S | 189 + .../string/aarch64/strcmp-sve.S | 59 + .../arm-optimized-routines/string/aarch64/strcmp.S | 173 + .../string/aarch64/strcpy-mte.S | 161 + .../string/aarch64/strcpy-sve.S | 71 + .../arm-optimized-routines/string/aarch64/strcpy.S | 311 + .../string/aarch64/strlen-mte.S | 80 + .../string/aarch64/strlen-sve.S | 55 + .../arm-optimized-routines/string/aarch64/strlen.S | 200 + .../string/aarch64/strncmp-mte.S | 307 + .../string/aarch64/strncmp-sve.S | 69 + .../string/aarch64/strncmp.S | 260 + .../string/aarch64/strnlen-sve.S | 74 + .../string/aarch64/strnlen.S | 112 + .../string/aarch64/strrchr-mte.S | 127 + .../string/aarch64/strrchr-sve.S | 84 + .../string/aarch64/strrchr.S | 149 + .../arm-optimized-routines/string/arm/check-arch.S | 10 + contrib/arm-optimized-routines/string/arm/memchr.S | 132 + contrib/arm-optimized-routines/string/arm/memcpy.S | 587 + contrib/arm-optimized-routines/string/arm/memset.S | 98 + .../string/arm/strcmp-armv6m.S | 117 + contrib/arm-optimized-routines/string/arm/strcmp.S | 475 + contrib/arm-optimized-routines/string/arm/strcpy.c | 133 + .../string/arm/strlen-armv6t2.S | 124 + contrib/arm-optimized-routines/string/asmdefs.h | 98 + .../arm-optimized-routines/string/bench/memcpy.c | 260 + .../arm-optimized-routines/string/bench/strlen.c | 221 + .../string/include/benchlib.h | 33 + .../string/include/stringlib.h | 69 + .../string/test/__mtag_tag_region.c | 147 + .../string/test/__mtag_tag_zero_region.c | 147 + .../arm-optimized-routines/string/test/memchr.c | 110 + .../arm-optimized-routines/string/test/memcmp.c | 125 + .../arm-optimized-routines/string/test/memcpy.c | 120 + .../arm-optimized-routines/string/test/memmove.c | 164 + .../arm-optimized-routines/string/test/memrchr.c | 106 + .../arm-optimized-routines/string/test/memset.c | 129 + contrib/arm-optimized-routines/string/test/mte.h | 142 + .../arm-optimized-routines/string/test/stpcpy.c | 125 + .../arm-optimized-routines/string/test/strchr.c | 121 + .../arm-optimized-routines/string/test/strchrnul.c | 126 + .../arm-optimized-routines/string/test/strcmp.c | 132 + .../arm-optimized-routines/string/test/strcpy.c | 123 + .../string/test/stringtest.h | 55 + .../arm-optimized-routines/string/test/strlen.c | 103 + .../arm-optimized-routines/string/test/strncmp.c | 139 + .../arm-optimized-routines/string/test/strnlen.c | 109 + .../arm-optimized-routines/string/test/strrchr.c | 121 + .../string/x86_64/check-arch.S | 10 + 208 files changed, 78517 insertions(+) diff --cc contrib/arm-optimized-routines/.gitignore index 000000000000,000000000000..a814c1418935 new file mode 100644 --- /dev/null +++ b/contrib/arm-optimized-routines/.gitignore @@@ -1,0 -1,0 +1,3 @@@ ++build/ ++.DS_Store ++config.mk diff --cc contrib/arm-optimized-routines/LICENSE index 000000000000,2543b82ed92d..2543b82ed92d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/LICENSE +++ b/contrib/arm-optimized-routines/LICENSE diff --cc contrib/arm-optimized-routines/Makefile index 000000000000,000000000000..169f89e2c9d6 new file mode 100644 --- /dev/null +++ b/contrib/arm-optimized-routines/Makefile @@@ -1,0 -1,0 +1,89 @@@ ++# Makefile - requires GNU make ++# ++# Copyright (c) 2018-2020, Arm Limited. ++# SPDX-License-Identifier: MIT ++ ++srcdir = . ++prefix = /usr ++bindir = $(prefix)/bin ++libdir = $(prefix)/lib ++includedir = $(prefix)/include ++ ++# Configure these in config.mk, do not make changes in this file. ++SUBS = math string networking ++HOST_CC = cc ++HOST_CFLAGS = -std=c99 -O2 ++HOST_LDFLAGS = ++HOST_LDLIBS = ++EMULATOR = ++CPPFLAGS = ++CFLAGS = -std=c99 -O2 ++CFLAGS_SHARED = -fPIC ++CFLAGS_ALL = -Ibuild/include $(CPPFLAGS) $(CFLAGS) ++LDFLAGS = ++LDLIBS = ++AR = $(CROSS_COMPILE)ar ++RANLIB = $(CROSS_COMPILE)ranlib ++INSTALL = install ++ ++all: ++ ++-include config.mk ++ ++$(foreach sub,$(SUBS),$(eval include $(srcdir)/$(sub)/Dir.mk)) ++ ++# Required targets of subproject foo: ++# all-foo ++# check-foo ++# clean-foo ++# install-foo ++# Required make variables of subproject foo: ++# foo-files: Built files (all in build/). ++# Make variables used by subproject foo: ++# foo-...: Variables defined in foo/Dir.mk or by config.mk. ++ ++all: $(SUBS:%=all-%) ++ ++ALL_FILES = $(foreach sub,$(SUBS),$($(sub)-files)) ++DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_FILES)))) ++$(ALL_FILES): | $(DIRS) ++$(DIRS): ++ mkdir -p $@ ++ ++$(filter %.os,$(ALL_FILES)): CFLAGS_ALL += $(CFLAGS_SHARED) ++ ++build/%.o: $(srcdir)/%.S ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++build/%.o: $(srcdir)/%.c ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++build/%.os: $(srcdir)/%.S ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++build/%.os: $(srcdir)/%.c ++ $(CC) $(CFLAGS_ALL) -c -o $@ $< ++ ++clean: $(SUBS:%=clean-%) ++ rm -rf build ++ ++distclean: clean ++ rm -f config.mk ++ ++$(DESTDIR)$(bindir)/%: build/bin/% ++ $(INSTALL) -D $< $@ ++ ++$(DESTDIR)$(libdir)/%.so: build/lib/%.so ++ $(INSTALL) -D $< $@ ++ ++$(DESTDIR)$(libdir)/%: build/lib/% ++ $(INSTALL) -m 644 -D $< $@ ++ ++$(DESTDIR)$(includedir)/%: build/include/% ++ $(INSTALL) -m 644 -D $< $@ ++ ++install: $(SUBS:%=install-%) ++ ++check: $(SUBS:%=check-%) ++ ++.PHONY: all clean distclean install check diff --cc contrib/arm-optimized-routines/README index 000000000000,ae465e93fea7..ae465e93fea7 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/README +++ b/contrib/arm-optimized-routines/README diff --cc contrib/arm-optimized-routines/config.mk.dist index 000000000000,177e1ac4f53a..177e1ac4f53a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/config.mk.dist +++ b/contrib/arm-optimized-routines/config.mk.dist diff --cc contrib/arm-optimized-routines/contributor-agreement.pdf index 000000000000,f42c3ae975d9..f42c3ae975d9 mode 000000,100644..100644 Binary files differ diff --cc contrib/arm-optimized-routines/math/Dir.mk index 000000000000,3b841ab71955..3b841ab71955 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/Dir.mk +++ b/contrib/arm-optimized-routines/math/Dir.mk diff --cc contrib/arm-optimized-routines/math/cosf.c index 000000000000,f29f19474e23..f29f19474e23 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/cosf.c +++ b/contrib/arm-optimized-routines/math/cosf.c diff --cc contrib/arm-optimized-routines/math/erf.c index 000000000000,12d7e5160df7..12d7e5160df7 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erf.c +++ b/contrib/arm-optimized-routines/math/erf.c diff --cc contrib/arm-optimized-routines/math/erf_data.c index 000000000000,807875bdd7f5..807875bdd7f5 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erf_data.c +++ b/contrib/arm-optimized-routines/math/erf_data.c diff --cc contrib/arm-optimized-routines/math/erff.c index 000000000000,a58e82565dc3..a58e82565dc3 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erff.c +++ b/contrib/arm-optimized-routines/math/erff.c diff --cc contrib/arm-optimized-routines/math/erff_data.c index 000000000000,fa6b1ef4dedb..fa6b1ef4dedb mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/erff_data.c +++ b/contrib/arm-optimized-routines/math/erff_data.c diff --cc contrib/arm-optimized-routines/math/exp.c index 000000000000,7f5024cd8792..7f5024cd8792 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp.c +++ b/contrib/arm-optimized-routines/math/exp.c diff --cc contrib/arm-optimized-routines/math/exp2.c index 000000000000,35ab39f22ed5..35ab39f22ed5 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp2.c +++ b/contrib/arm-optimized-routines/math/exp2.c diff --cc contrib/arm-optimized-routines/math/exp2f.c index 000000000000,94b32538aa0d..94b32538aa0d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp2f.c +++ b/contrib/arm-optimized-routines/math/exp2f.c diff --cc contrib/arm-optimized-routines/math/exp2f_data.c index 000000000000,3fb0ad11b15a..3fb0ad11b15a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp2f_data.c +++ b/contrib/arm-optimized-routines/math/exp2f_data.c diff --cc contrib/arm-optimized-routines/math/exp_data.c index 000000000000,cba76832566f..cba76832566f mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/exp_data.c +++ b/contrib/arm-optimized-routines/math/exp_data.c diff --cc contrib/arm-optimized-routines/math/expf.c index 000000000000,9b2f0c3d8c56..9b2f0c3d8c56 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/expf.c +++ b/contrib/arm-optimized-routines/math/expf.c diff --cc contrib/arm-optimized-routines/math/include/mathlib.h index 000000000000,279d829d8ea1..279d829d8ea1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/include/mathlib.h +++ b/contrib/arm-optimized-routines/math/include/mathlib.h diff --cc contrib/arm-optimized-routines/math/log.c index 000000000000,d3b7bc60747c..d3b7bc60747c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log.c +++ b/contrib/arm-optimized-routines/math/log.c diff --cc contrib/arm-optimized-routines/math/log2.c index 000000000000,55102b772969..55102b772969 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2.c +++ b/contrib/arm-optimized-routines/math/log2.c diff --cc contrib/arm-optimized-routines/math/log2_data.c index 000000000000,3fc9b47c1f03..3fc9b47c1f03 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2_data.c +++ b/contrib/arm-optimized-routines/math/log2_data.c diff --cc contrib/arm-optimized-routines/math/log2f.c index 000000000000,acb629e6846c..acb629e6846c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2f.c +++ b/contrib/arm-optimized-routines/math/log2f.c diff --cc contrib/arm-optimized-routines/math/log2f_data.c index 000000000000,f3546d730aba..f3546d730aba mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log2f_data.c +++ b/contrib/arm-optimized-routines/math/log2f_data.c diff --cc contrib/arm-optimized-routines/math/log_data.c index 000000000000,96a098d42c16..96a098d42c16 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/log_data.c +++ b/contrib/arm-optimized-routines/math/log_data.c diff --cc contrib/arm-optimized-routines/math/logf.c index 000000000000,cfbaee12df10..cfbaee12df10 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/logf.c +++ b/contrib/arm-optimized-routines/math/logf.c diff --cc contrib/arm-optimized-routines/math/logf_data.c index 000000000000,e8973ce4fedc..e8973ce4fedc mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/logf_data.c +++ b/contrib/arm-optimized-routines/math/logf_data.c diff --cc contrib/arm-optimized-routines/math/math_config.h index 000000000000,e85104337048..e85104337048 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/math_config.h +++ b/contrib/arm-optimized-routines/math/math_config.h diff --cc contrib/arm-optimized-routines/math/math_err.c index 000000000000,1bf9538a1ab1..1bf9538a1ab1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/math_err.c +++ b/contrib/arm-optimized-routines/math/math_err.c diff --cc contrib/arm-optimized-routines/math/math_errf.c index 000000000000,d5350b819ab1..d5350b819ab1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/math_errf.c +++ b/contrib/arm-optimized-routines/math/math_errf.c diff --cc contrib/arm-optimized-routines/math/pow.c index 000000000000,86842c6abacd..86842c6abacd mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/pow.c +++ b/contrib/arm-optimized-routines/math/pow.c diff --cc contrib/arm-optimized-routines/math/pow_log_data.c index 000000000000,45569c5cc064..45569c5cc064 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/pow_log_data.c +++ b/contrib/arm-optimized-routines/math/pow_log_data.c diff --cc contrib/arm-optimized-routines/math/powf.c index 000000000000,6ba45d3852a5..6ba45d3852a5 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/powf.c +++ b/contrib/arm-optimized-routines/math/powf.c diff --cc contrib/arm-optimized-routines/math/powf_log2_data.c index 000000000000,97e0d98cdbab..97e0d98cdbab mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/powf_log2_data.c +++ b/contrib/arm-optimized-routines/math/powf_log2_data.c diff --cc contrib/arm-optimized-routines/math/s_cos.c index 000000000000,53a95b0adfde..53a95b0adfde mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_cos.c +++ b/contrib/arm-optimized-routines/math/s_cos.c diff --cc contrib/arm-optimized-routines/math/s_cosf.c index 000000000000,914c02eba651..914c02eba651 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_cosf.c +++ b/contrib/arm-optimized-routines/math/s_cosf.c diff --cc contrib/arm-optimized-routines/math/s_exp.c index 000000000000,ac7246b2c100..ac7246b2c100 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_exp.c +++ b/contrib/arm-optimized-routines/math/s_exp.c diff --cc contrib/arm-optimized-routines/math/s_exp2f.c index 000000000000,df7dfd680ff4..df7dfd680ff4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_exp2f.c +++ b/contrib/arm-optimized-routines/math/s_exp2f.c diff --cc contrib/arm-optimized-routines/math/s_exp2f_1u.c index 000000000000,5e3852b41d83..5e3852b41d83 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_exp2f_1u.c +++ b/contrib/arm-optimized-routines/math/s_exp2f_1u.c diff --cc contrib/arm-optimized-routines/math/s_expf.c index 000000000000,3492c460733d..3492c460733d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_expf.c +++ b/contrib/arm-optimized-routines/math/s_expf.c diff --cc contrib/arm-optimized-routines/math/s_expf_1u.c index 000000000000,eb7bbcba5566..eb7bbcba5566 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_expf_1u.c +++ b/contrib/arm-optimized-routines/math/s_expf_1u.c diff --cc contrib/arm-optimized-routines/math/s_log.c index 000000000000,23289cf948ec..23289cf948ec mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_log.c +++ b/contrib/arm-optimized-routines/math/s_log.c diff --cc contrib/arm-optimized-routines/math/s_logf.c index 000000000000,9399350fc1ee..9399350fc1ee mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_logf.c +++ b/contrib/arm-optimized-routines/math/s_logf.c diff --cc contrib/arm-optimized-routines/math/s_pow.c index 000000000000,2e34c9f896d6..2e34c9f896d6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_pow.c +++ b/contrib/arm-optimized-routines/math/s_pow.c diff --cc contrib/arm-optimized-routines/math/s_powf.c index 000000000000,6d91a4a72b37..6d91a4a72b37 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_powf.c +++ b/contrib/arm-optimized-routines/math/s_powf.c diff --cc contrib/arm-optimized-routines/math/s_sin.c index 000000000000,06982c2018c6..06982c2018c6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_sin.c +++ b/contrib/arm-optimized-routines/math/s_sin.c diff --cc contrib/arm-optimized-routines/math/s_sinf.c index 000000000000,68ca90853736..68ca90853736 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/s_sinf.c +++ b/contrib/arm-optimized-routines/math/s_sinf.c diff --cc contrib/arm-optimized-routines/math/sincosf.c index 000000000000,9746f1c22e6c..9746f1c22e6c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sincosf.c +++ b/contrib/arm-optimized-routines/math/sincosf.c diff --cc contrib/arm-optimized-routines/math/sincosf.h index 000000000000,1e80fc9ba8e1..1e80fc9ba8e1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sincosf.h +++ b/contrib/arm-optimized-routines/math/sincosf.h diff --cc contrib/arm-optimized-routines/math/sincosf_data.c index 000000000000,ab4ac4710fef..ab4ac4710fef mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sincosf_data.c +++ b/contrib/arm-optimized-routines/math/sincosf_data.c diff --cc contrib/arm-optimized-routines/math/sinf.c index 000000000000,ddbc1daf74a9..ddbc1daf74a9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/sinf.c +++ b/contrib/arm-optimized-routines/math/sinf.c diff --cc contrib/arm-optimized-routines/math/test/mathbench.c index 000000000000,0c17826e5296..0c17826e5296 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/mathbench.c +++ b/contrib/arm-optimized-routines/math/test/mathbench.c diff --cc contrib/arm-optimized-routines/math/test/mathtest.c index 000000000000,310896738e47..310896738e47 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/mathtest.c +++ b/contrib/arm-optimized-routines/math/test/mathtest.c diff --cc contrib/arm-optimized-routines/math/test/rtest/dotest.c index 000000000000,6be79e1df0d1..6be79e1df0d1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/dotest.c +++ b/contrib/arm-optimized-routines/math/test/rtest/dotest.c diff --cc contrib/arm-optimized-routines/math/test/rtest/intern.h index 000000000000,12a9c749e18e..12a9c749e18e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/intern.h +++ b/contrib/arm-optimized-routines/math/test/rtest/intern.h diff --cc contrib/arm-optimized-routines/math/test/rtest/main.c index 000000000000,0d8ead891320..0d8ead891320 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/main.c +++ b/contrib/arm-optimized-routines/math/test/rtest/main.c diff --cc contrib/arm-optimized-routines/math/test/rtest/random.c index 000000000000,56123966b8c4..56123966b8c4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/random.c +++ b/contrib/arm-optimized-routines/math/test/rtest/random.c diff --cc contrib/arm-optimized-routines/math/test/rtest/random.h index 000000000000,b4b22df82a3d..b4b22df82a3d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/random.h +++ b/contrib/arm-optimized-routines/math/test/rtest/random.h diff --cc contrib/arm-optimized-routines/math/test/rtest/semi.c index 000000000000,c9f0daf76508..c9f0daf76508 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/semi.c +++ b/contrib/arm-optimized-routines/math/test/rtest/semi.c diff --cc contrib/arm-optimized-routines/math/test/rtest/semi.h index 000000000000,17dc4158fb51..17dc4158fb51 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/semi.h +++ b/contrib/arm-optimized-routines/math/test/rtest/semi.h diff --cc contrib/arm-optimized-routines/math/test/rtest/types.h index 000000000000,53cd557fa4cf..53cd557fa4cf mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/types.h +++ b/contrib/arm-optimized-routines/math/test/rtest/types.h diff --cc contrib/arm-optimized-routines/math/test/rtest/wrappers.c index 000000000000,de45ac5768d0..de45ac5768d0 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/wrappers.c +++ b/contrib/arm-optimized-routines/math/test/rtest/wrappers.c diff --cc contrib/arm-optimized-routines/math/test/rtest/wrappers.h index 000000000000,7b09c85a59f1..7b09c85a59f1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/rtest/wrappers.h +++ b/contrib/arm-optimized-routines/math/test/rtest/wrappers.h diff --cc contrib/arm-optimized-routines/math/test/runulp.sh index 000000000000,0190d9ab27fb..0190d9ab27fb mode 000000,100755..100755 --- a/contrib/arm-optimized-routines/math/test/runulp.sh +++ b/contrib/arm-optimized-routines/math/test/runulp.sh diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/cosf.tst index 000000000000,79160443f099..79160443f099 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/cosf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/cosf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/erf.tst index 000000000000,7fa4d1868c0e..7fa4d1868c0e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/erf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/erf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/erff.tst index 000000000000,d05b7b1119c4..d05b7b1119c4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/erff.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/erff.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/exp.tst index 000000000000,85d556cd1e00..85d556cd1e00 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/exp.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/exp.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/exp2.tst index 000000000000,fa56c9f8be4b..fa56c9f8be4b mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/exp2.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/exp2.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/exp2f.tst index 000000000000,38cfc3f78ac6..38cfc3f78ac6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/exp2f.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/exp2f.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/expf.tst index 000000000000,ff0f671c2656..ff0f671c2656 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/expf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/expf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/log.tst index 000000000000,a0aa398cbf73..a0aa398cbf73 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/log.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/log.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/log2.tst index 000000000000,ff1286cbd53e..ff1286cbd53e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/log2.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/log2.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/log2f.tst index 000000000000,5832c4f08f1e..5832c4f08f1e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/log2f.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/log2f.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/logf.tst index 000000000000,6e68a36e0f6a..6e68a36e0f6a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/logf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/logf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/pow.tst index 000000000000,19665817153d..19665817153d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/pow.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/pow.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/powf.tst index 000000000000,3fa8b110f8bc..3fa8b110f8bc mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/powf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/powf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/sincosf.tst index 000000000000,4b33d2291c66..4b33d2291c66 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/sincosf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/sincosf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/directed/sinf.tst index 000000000000,ded80b1598c6..ded80b1598c6 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/directed/sinf.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/directed/sinf.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/random/double.tst index 000000000000,c24ff80d5d95..c24ff80d5d95 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/random/double.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/random/double.tst diff --cc contrib/arm-optimized-routines/math/test/testcases/random/float.tst index 000000000000,d02a22750abe..d02a22750abe mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/testcases/random/float.tst +++ b/contrib/arm-optimized-routines/math/test/testcases/random/float.tst diff --cc contrib/arm-optimized-routines/math/test/traces/exp.txt index 000000000000,cb067d5174b9..cb067d5174b9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/traces/exp.txt +++ b/contrib/arm-optimized-routines/math/test/traces/exp.txt diff --cc contrib/arm-optimized-routines/math/test/traces/sincosf.txt index 000000000000,33de0c7ab9e3..33de0c7ab9e3 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/traces/sincosf.txt +++ b/contrib/arm-optimized-routines/math/test/traces/sincosf.txt diff --cc contrib/arm-optimized-routines/math/test/ulp.c index 000000000000,51479b87a0fd..51479b87a0fd mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/ulp.c +++ b/contrib/arm-optimized-routines/math/test/ulp.c diff --cc contrib/arm-optimized-routines/math/test/ulp.h index 000000000000,a0c301664321..a0c301664321 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/test/ulp.h +++ b/contrib/arm-optimized-routines/math/test/ulp.h diff --cc contrib/arm-optimized-routines/math/tools/cos.sollya index 000000000000,bd72d6b74820..bd72d6b74820 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/cos.sollya +++ b/contrib/arm-optimized-routines/math/tools/cos.sollya diff --cc contrib/arm-optimized-routines/math/tools/exp.sollya index 000000000000,b7a462cda5a4..b7a462cda5a4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/exp.sollya +++ b/contrib/arm-optimized-routines/math/tools/exp.sollya diff --cc contrib/arm-optimized-routines/math/tools/exp2.sollya index 000000000000,e760769601d4..e760769601d4 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/exp2.sollya +++ b/contrib/arm-optimized-routines/math/tools/exp2.sollya diff --cc contrib/arm-optimized-routines/math/tools/log.sollya index 000000000000,6df4db44b6f3..6df4db44b6f3 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log.sollya +++ b/contrib/arm-optimized-routines/math/tools/log.sollya diff --cc contrib/arm-optimized-routines/math/tools/log2.sollya index 000000000000,4a364c0f111f..4a364c0f111f mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log2.sollya +++ b/contrib/arm-optimized-routines/math/tools/log2.sollya diff --cc contrib/arm-optimized-routines/math/tools/log2_abs.sollya index 000000000000,82c4dac26fa1..82c4dac26fa1 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log2_abs.sollya +++ b/contrib/arm-optimized-routines/math/tools/log2_abs.sollya diff --cc contrib/arm-optimized-routines/math/tools/log_abs.sollya index 000000000000,a2ac190fc497..a2ac190fc497 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/log_abs.sollya +++ b/contrib/arm-optimized-routines/math/tools/log_abs.sollya diff --cc contrib/arm-optimized-routines/math/tools/plot.py index 000000000000,6c8b89ff284b..6c8b89ff284b mode 000000,100755..100755 --- a/contrib/arm-optimized-routines/math/tools/plot.py +++ b/contrib/arm-optimized-routines/math/tools/plot.py diff --cc contrib/arm-optimized-routines/math/tools/remez.jl index 000000000000,2ff436f5287f..2ff436f5287f mode 000000,100755..100755 --- a/contrib/arm-optimized-routines/math/tools/remez.jl +++ b/contrib/arm-optimized-routines/math/tools/remez.jl diff --cc contrib/arm-optimized-routines/math/tools/sin.sollya index 000000000000,a6e851145c11..a6e851145c11 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/sin.sollya +++ b/contrib/arm-optimized-routines/math/tools/sin.sollya diff --cc contrib/arm-optimized-routines/math/tools/v_exp.sollya index 000000000000,c0abb63fb642..c0abb63fb642 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/v_exp.sollya +++ b/contrib/arm-optimized-routines/math/tools/v_exp.sollya diff --cc contrib/arm-optimized-routines/math/tools/v_log.sollya index 000000000000,cc3d2c4ae72a..cc3d2c4ae72a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/v_log.sollya +++ b/contrib/arm-optimized-routines/math/tools/v_log.sollya diff --cc contrib/arm-optimized-routines/math/tools/v_sin.sollya index 000000000000,65cc9957c624..65cc9957c624 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/tools/v_sin.sollya +++ b/contrib/arm-optimized-routines/math/tools/v_sin.sollya diff --cc contrib/arm-optimized-routines/math/v_cos.c index 000000000000,20ba6bd0d0d9..20ba6bd0d0d9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_cos.c +++ b/contrib/arm-optimized-routines/math/v_cos.c diff --cc contrib/arm-optimized-routines/math/v_cosf.c index 000000000000,150294b8845e..150294b8845e mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_cosf.c +++ b/contrib/arm-optimized-routines/math/v_cosf.c diff --cc contrib/arm-optimized-routines/math/v_exp.c index 000000000000,e459d53fddd2..e459d53fddd2 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp.c +++ b/contrib/arm-optimized-routines/math/v_exp.c diff --cc contrib/arm-optimized-routines/math/v_exp.h index 000000000000,305da19c0a53..305da19c0a53 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp.h +++ b/contrib/arm-optimized-routines/math/v_exp.h diff --cc contrib/arm-optimized-routines/math/v_exp2f.c index 000000000000,e3ea5af3414d..e3ea5af3414d mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp2f.c +++ b/contrib/arm-optimized-routines/math/v_exp2f.c diff --cc contrib/arm-optimized-routines/math/v_exp2f_1u.c index 000000000000,1caa14d9bfff..1caa14d9bfff mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp2f_1u.c +++ b/contrib/arm-optimized-routines/math/v_exp2f_1u.c diff --cc contrib/arm-optimized-routines/math/v_exp_data.c index 000000000000,365355497e95..365355497e95 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_exp_data.c +++ b/contrib/arm-optimized-routines/math/v_exp_data.c diff --cc contrib/arm-optimized-routines/math/v_expf.c index 000000000000,d403e00534f0..d403e00534f0 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_expf.c +++ b/contrib/arm-optimized-routines/math/v_expf.c diff --cc contrib/arm-optimized-routines/math/v_expf_1u.c index 000000000000,023bd248c9ac..023bd248c9ac mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_expf_1u.c +++ b/contrib/arm-optimized-routines/math/v_expf_1u.c diff --cc contrib/arm-optimized-routines/math/v_log.c index 000000000000,d84c740d2b6b..d84c740d2b6b mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_log.c +++ b/contrib/arm-optimized-routines/math/v_log.c diff --cc contrib/arm-optimized-routines/math/v_log.h index 000000000000,bcc2fa6fa930..bcc2fa6fa930 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_log.h +++ b/contrib/arm-optimized-routines/math/v_log.h diff --cc contrib/arm-optimized-routines/math/v_log_data.c index 000000000000,97ee5b09c6a9..97ee5b09c6a9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_log_data.c +++ b/contrib/arm-optimized-routines/math/v_log_data.c diff --cc contrib/arm-optimized-routines/math/v_logf.c index 000000000000,7373192f03fa..7373192f03fa mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_logf.c +++ b/contrib/arm-optimized-routines/math/v_logf.c diff --cc contrib/arm-optimized-routines/math/v_math.h index 000000000000,f2cc4670bb9b..f2cc4670bb9b mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_math.h +++ b/contrib/arm-optimized-routines/math/v_math.h diff --cc contrib/arm-optimized-routines/math/v_pow.c index 000000000000,a209d57f41ce..a209d57f41ce mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_pow.c +++ b/contrib/arm-optimized-routines/math/v_pow.c diff --cc contrib/arm-optimized-routines/math/v_powf.c index 000000000000,fb80fa6f1846..fb80fa6f1846 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_powf.c +++ b/contrib/arm-optimized-routines/math/v_powf.c diff --cc contrib/arm-optimized-routines/math/v_sin.c index 000000000000,2b9ed059189c..2b9ed059189c mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_sin.c +++ b/contrib/arm-optimized-routines/math/v_sin.c diff --cc contrib/arm-optimized-routines/math/v_sinf.c index 000000000000,e66bfce6d8aa..e66bfce6d8aa mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/v_sinf.c +++ b/contrib/arm-optimized-routines/math/v_sinf.c diff --cc contrib/arm-optimized-routines/math/vn_cos.c index 000000000000,b57a549eba68..b57a549eba68 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_cos.c +++ b/contrib/arm-optimized-routines/math/vn_cos.c diff --cc contrib/arm-optimized-routines/math/vn_cosf.c index 000000000000,6321d4620fa7..6321d4620fa7 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_cosf.c +++ b/contrib/arm-optimized-routines/math/vn_cosf.c diff --cc contrib/arm-optimized-routines/math/vn_exp.c index 000000000000,06e269d41766..06e269d41766 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_exp.c +++ b/contrib/arm-optimized-routines/math/vn_exp.c diff --cc contrib/arm-optimized-routines/math/vn_exp2f.c index 000000000000,db9707e86f16..db9707e86f16 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_exp2f.c +++ b/contrib/arm-optimized-routines/math/vn_exp2f.c diff --cc contrib/arm-optimized-routines/math/vn_exp2f_1u.c index 000000000000,17bd0abd7a60..17bd0abd7a60 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_exp2f_1u.c +++ b/contrib/arm-optimized-routines/math/vn_exp2f_1u.c diff --cc contrib/arm-optimized-routines/math/vn_expf.c index 000000000000,0652907225d9..0652907225d9 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_expf.c +++ b/contrib/arm-optimized-routines/math/vn_expf.c diff --cc contrib/arm-optimized-routines/math/vn_expf_1u.c index 000000000000,3be776814822..3be776814822 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_expf_1u.c +++ b/contrib/arm-optimized-routines/math/vn_expf_1u.c diff --cc contrib/arm-optimized-routines/math/vn_log.c index 000000000000,b58fe8ff820a..b58fe8ff820a mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_log.c +++ b/contrib/arm-optimized-routines/math/vn_log.c diff --cc contrib/arm-optimized-routines/math/vn_logf.c index 000000000000,cc5b8ae3ed55..cc5b8ae3ed55 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_logf.c +++ b/contrib/arm-optimized-routines/math/vn_logf.c diff --cc contrib/arm-optimized-routines/math/vn_pow.c index 000000000000,260950113b04..260950113b04 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_pow.c +++ b/contrib/arm-optimized-routines/math/vn_pow.c diff --cc contrib/arm-optimized-routines/math/vn_powf.c index 000000000000,095d07e337ad..095d07e337ad mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_powf.c +++ b/contrib/arm-optimized-routines/math/vn_powf.c diff --cc contrib/arm-optimized-routines/math/vn_sin.c index 000000000000,905c79623350..905c79623350 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_sin.c +++ b/contrib/arm-optimized-routines/math/vn_sin.c diff --cc contrib/arm-optimized-routines/math/vn_sinf.c index 000000000000,1214e1a55638..1214e1a55638 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/math/vn_sinf.c +++ b/contrib/arm-optimized-routines/math/vn_sinf.c diff --cc contrib/arm-optimized-routines/networking/Dir.mk index 000000000000,b49610341171..b49610341171 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/networking/Dir.mk +++ b/contrib/arm-optimized-routines/networking/Dir.mk diff --cc contrib/arm-optimized-routines/networking/aarch64/chksum_simd.c index 000000000000,6d5be58b1f32..6d5be58b1f32 mode 000000,100644..100644 --- a/contrib/arm-optimized-routines/networking/aarch64/chksum_simd.c *** 386 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jul 6 13:29:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B868E6571BE; Tue, 6 Jul 2021 13:29:27 +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 4GK3Lb4kyzz4jjw; Tue, 6 Jul 2021 13:29:27 +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 86B4B1A702; Tue, 6 Jul 2021 13:29:27 +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 166DTRxh084356; Tue, 6 Jul 2021 13:29:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166DTRNj084355; Tue, 6 Jul 2021 13:29:27 GMT (envelope-from git) Date: Tue, 6 Jul 2021 13:29:27 GMT Message-Id: <202107061329.166DTRNj084355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: c78f449d85e0 - main - usr.bin/diff: fix UBSan error in readhash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c78f449d85e0b292fe5d942cca99f11c1cd430fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 13:29:27 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c78f449d85e0b292fe5d942cca99f11c1cd430fa commit c78f449d85e0b292fe5d942cca99f11c1cd430fa Author: Alex Richardson AuthorDate: 2021-07-06 11:16:40 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 11:16:40 +0000 usr.bin/diff: fix UBSan error in readhash UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since that can overflow an `int`. Use `unsigned int` instead to ensure that overflow is well-defined. Reviewed By: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31075 --- usr.bin/diff/diffreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 1b28281024c6..651ec88df909 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1345,7 +1345,7 @@ static int readhash(FILE *f, int flags) { int i, t, space; - int sum; + unsigned sum; sum = 1; space = 0; From owner-dev-commits-src-all@freebsd.org Tue Jul 6 13:29:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC99F657CDD; Tue, 6 Jul 2021 13:29: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 4GK3Lc5j3Fz4jZh; Tue, 6 Jul 2021 13:29: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 A40751A32D; Tue, 6 Jul 2021 13:29: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 166DTSQI084381; Tue, 6 Jul 2021 13:29:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166DTS4v084380; Tue, 6 Jul 2021 13:29:28 GMT (envelope-from git) Date: Tue, 6 Jul 2021 13:29:28 GMT Message-Id: <202107061329.166DTS4v084380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 2eefc1d92643 - main - Fix building rescue/rescue when sanitizers are enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2eefc1d926430dbba83128d27f8bed3c34199159 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 13:29:29 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2eefc1d926430dbba83128d27f8bed3c34199159 commit 2eefc1d926430dbba83128d27f8bed3c34199159 Author: Alex Richardson AuthorDate: 2021-07-06 11:18:29 +0000 Commit: Alex Richardson CommitDate: 2021-07-06 11:18:30 +0000 Fix building rescue/rescue when sanitizers are enabled We have to ensure that we don't link any instrumented object files into rescue as it is a static executable and static binaries can't use the sanitizer runtime. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D31044 --- rescue/rescue/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 7352828a822c..f2aa614f1dfc 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -6,7 +6,12 @@ PACKAGE=rescue MAN= MK_SSP= no +# Static-PIE is not supported so we should not be linking against _pie.a libs. +# This is also needed to avoid linking against sanitizer-instrumented libraries +# since MK_ASAN/MK_UBSAN will instrument the .pieo object files. +MK_PIE= no NO_SHARED= yes +CRUNCH_BUILDOPTS+= MK_PIE=no NO_SHARED=yes PROG= rescue BINDIR?=/rescue From owner-dev-commits-src-all@freebsd.org Tue Jul 6 13:47:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D3F3565840D; Tue, 6 Jul 2021 13:47: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 4GK3lH5blHz4n5m; Tue, 6 Jul 2021 13:47: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 A6D5D1AABA; Tue, 6 Jul 2021 13:47: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 166DlNj0010995; Tue, 6 Jul 2021 13:47:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166DlNuD010994; Tue, 6 Jul 2021 13:47:23 GMT (envelope-from git) Date: Tue, 6 Jul 2021 13:47:23 GMT Message-Id: <202107061347.166DlNuD010994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c9144ec14d2a - main - Skip netgraph tests when WITHOUT_NETGRAPH is set 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/main X-Git-Reftype: branch X-Git-Commit: c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 13:47:23 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 commit c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 Author: Ed Maste AuthorDate: 2021-07-06 13:44:15 +0000 Commit: Ed Maste CommitDate: 2021-07-06 13:45:34 +0000 Skip netgraph tests when WITHOUT_NETGRAPH is set PR: 256986 Reported by: John Marshall MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 4ba885405ce7..2781f7fb4ded 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -20,7 +20,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= net -TESTS_SUBDIRS+= netgraph +TESTS_SUBDIRS+= ${_netgraph} TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec @@ -40,6 +40,10 @@ _audit= audit _cddl= cddl .endif +.if ${MK_NETGRAPH} != "no" +_netgraph= netgraph +.endif + # Items not integrated into kyua runs by default SUBDIR+= pjdfstest From owner-dev-commits-src-all@freebsd.org Tue Jul 6 14:29:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8FE21658A40; Tue, 6 Jul 2021 14:29:29 +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 4GK4gs3Ppmz3F8H; Tue, 6 Jul 2021 14:29: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 5DFBB1B234; Tue, 6 Jul 2021 14:29: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 166ETTin064438; Tue, 6 Jul 2021 14:29:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166ETTEn064437; Tue, 6 Jul 2021 14:29:29 GMT (envelope-from git) Date: Tue, 6 Jul 2021 14:29:29 GMT Message-Id: <202107061429.166ETTEn064437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 28d0a740dd9a - main - ktls: auto-disable ifnet (inline hw) kTLS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 14:29:29 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 commit 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 Author: Andrew Gallatin AuthorDate: 2021-07-06 14:17:33 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-06 14:28:32 +0000 ktls: auto-disable ifnet (inline hw) kTLS Ifnet (inline) hw kTLS NICs typically keep state within a TLS record, so that when transmitting in-order, they can continue encryption on each segment sent without DMA'ing extra state from the host. This breaks down when transmits are out of order (eg, TCP retransmits). In this case, the NIC must re-DMA the entire TLS record up to and including the segment being retransmitted. This means that when re-transmitting the last 1448 byte segment of a TLS record, the NIC will have to re-DMA the entire 16KB TLS record. This can lead to the NIC running out of PCIe bus bandwidth well before it saturates the network link if a lot of TCP connections have a high retransmoit rate. This change introduces a new sysctl (kern.ipc.tls.ifnet_max_rexmit_pct), where TCP connections with higher retransmit rate will be switched to SW kTLS so as to conserve PCIe bandwidth. Reviewed by: hselasky, markj, rrs Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30908 --- sys/kern/uipc_ktls.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ sys/netinet/tcp_var.h | 13 +++++- sys/sys/ktls.h | 15 ++++++- 3 files changed, 133 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 7e87e7c740e3..88e29157289d 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_kern_tls.h" #include "opt_ratelimit.h" #include "opt_rss.h" @@ -121,6 +122,11 @@ SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, CTLFLAG_RD, &ktls_number_threads, 0, "Number of TLS threads in thread-pool"); +unsigned int ktls_ifnet_max_rexmit_pct = 2; +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, ifnet_max_rexmit_pct, CTLFLAG_RWTUN, + &ktls_ifnet_max_rexmit_pct, 2, + "Max percent bytes retransmitted before ifnet TLS is disabled"); + static bool ktls_offload_enable; SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RWTUN, &ktls_offload_enable, 0, @@ -184,6 +190,14 @@ static COUNTER_U64_DEFINE_EARLY(ktls_switch_failed); SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, CTLFLAG_RD, &ktls_switch_failed, "TLS sessions unable to switch between SW and ifnet"); +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_fail); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_failed, CTLFLAG_RD, + &ktls_ifnet_disable_fail, "TLS sessions unable to switch to SW from ifnet"); + +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_ok); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_ok, CTLFLAG_RD, + &ktls_ifnet_disable_ok, "TLS sessions able to switch to SW from ifnet"); + SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Software TLS session stats"); SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -2187,3 +2201,96 @@ ktls_work_thread(void *ctx) } } } + +static void +ktls_disable_ifnet_help(void *context, int pending __unused) +{ + struct ktls_session *tls; + struct inpcb *inp; + struct tcpcb *tp; + struct socket *so; + int err; + + tls = context; + inp = tls->inp; + if (inp == NULL) + return; + INP_WLOCK(inp); + so = inp->inp_socket; + MPASS(so != NULL); + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || + (inp->inp_flags2 & INP_FREED)) { + goto out; + } + + if (so->so_snd.sb_tls_info != NULL) + err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); + else + err = ENXIO; + if (err == 0) { + counter_u64_add(ktls_ifnet_disable_ok, 1); + /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && + (inp->inp_flags2 & INP_FREED) == 0 && + (tp = intotcpcb(inp)) != NULL && + tp->t_fb->tfb_hwtls_change != NULL) + (*tp->t_fb->tfb_hwtls_change)(tp, 0); + } else { + counter_u64_add(ktls_ifnet_disable_fail, 1); + } + +out: + SOCK_LOCK(so); + sorele(so); + if (!in_pcbrele_wlocked(inp)) + INP_WUNLOCK(inp); + ktls_free(tls); +} + +/* + * Called when re-transmits are becoming a substantial portion of the + * sends on this connection. When this happens, we transition the + * connection to software TLS. This is needed because most inline TLS + * NICs keep crypto state only for in-order transmits. This means + * that to handle a TCP rexmit (which is out-of-order), the NIC must + * re-DMA the entire TLS record up to and including the current + * segment. This means that when re-transmitting the last ~1448 byte + * segment of a 16KB TLS record, we could wind up re-DMA'ing an order + * of magnitude more data than we are sending. This can cause the + * PCIe link to saturate well before the network, which can cause + * output drops, and a general loss of capacity. + */ +void +ktls_disable_ifnet(void *arg) +{ + struct tcpcb *tp; + struct inpcb *inp; + struct socket *so; + struct ktls_session *tls; + + tp = arg; + inp = tp->t_inpcb; + INP_WLOCK_ASSERT(inp); + so = inp->inp_socket; + SOCK_LOCK(so); + tls = so->so_snd.sb_tls_info; + if (tls->disable_ifnet_pending) { + SOCK_UNLOCK(so); + return; + } + + /* + * note that disable_ifnet_pending is never cleared; disabling + * ifnet can only be done once per session, so we never want + * to do it again + */ + + (void)ktls_hold(tls); + in_pcbref(inp); + soref(so); + tls->disable_ifnet_pending = true; + tls->inp = inp; + SOCK_UNLOCK(so); + TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); + (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); +} diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index dd30f89896d2..3f72a821e71f 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -39,8 +39,10 @@ #include #ifdef _KERNEL +#include "opt_kern_tls.h" #include #include +#include #endif #define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information array" */ @@ -1139,8 +1141,10 @@ tcp_fields_to_net(struct tcphdr *th) static inline void tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, - uint8_t is_tlp, int hw_tls __unused) + uint8_t is_tlp, int hw_tls) { + uint64_t rexmit_percent; + if (is_tlp) { tp->t_sndtlppack++; tp->t_sndtlpbyte += len; @@ -1150,6 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, tp->t_snd_rxt_bytes += len; else tp->t_sndbytes += len; + + if (hw_tls && is_rxt) { + rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * (tp->t_snd_rxt_bytes + tp->t_sndbytes)); + if (rexmit_percent > ktls_ifnet_max_rexmit_pct) + ktls_disable_ifnet(tp); + } + } #endif /* _KERNEL */ diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index b28c94965c97..7fd8831878b4 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -189,10 +189,12 @@ struct ktls_session { u_int wq_index; volatile u_int refcount; int mode; - bool reset_pending; struct task reset_tag_task; + struct task disable_ifnet_task; struct inpcb *inp; + bool reset_pending; + bool disable_ifnet_pending; } __aligned(CACHE_LINE_SIZE); void ktls_check_rx(struct sockbuf *sb); @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) ktls_destroy(tls); } +#ifdef KERN_TLS +extern unsigned int ktls_ifnet_max_rexmit_pct; +void ktls_disable_ifnet(void *arg); +#else +#define ktls_ifnet_max_rexmit_pct 1 +inline void +ktls_disable_ifnet(void *arg __unused) +{ +} +#endif + #endif /* !_KERNEL */ #endif /* !_SYS_KTLS_H_ */ From owner-dev-commits-src-all@freebsd.org Tue Jul 6 14:56:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 303EA659407; Tue, 6 Jul 2021 14:56: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 4GK5H60Gdlz3J5w; Tue, 6 Jul 2021 14:56: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 E5B911BA90; Tue, 6 Jul 2021 14:56: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 166EuXKj003394; Tue, 6 Jul 2021 14:56:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166EuXsa003393; Tue, 6 Jul 2021 14:56:33 GMT (envelope-from git) Date: Tue, 6 Jul 2021 14:56:33 GMT Message-Id: <202107061456.166EuXsa003393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 185dcb1072e3 - stable/13 - md5: Improve compatibility with coreutils and format fix MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 185dcb1072e3ce627df787ecc99671bded1fb922 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 14:56:34 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=185dcb1072e3ce627df787ecc99671bded1fb922 commit 185dcb1072e3ce627df787ecc99671bded1fb922 Author: Stefan Eßer AuthorDate: 2021-06-29 07:01:13 +0000 Commit: Stefan Eßer CommitDate: 2021-07-06 14:56:06 +0000 md5: Improve compatibility with coreutils and format fix The previous changes that added support for the coreutils -c option modified the output generated by passing -r to match that of the coreutils versions. The difference is that coreutils separates the hash from the file name by two blanks " " (or a blank followed by an asterisk " *" with the -b option denoting). While most scripts or users will not notice the difference, it might be considered a violation of POLA and this commit reverts the change for the non-sum programs. These will print a single blank " " as the separator, as they die before the previous commit. In order to still generate output that is identical to that of the coreutils programs, this commit generates the " " or " *" separator used by them for the -sum versions, depending on the presence of the -b option. (cherry picked from commit b33d1898c1b0e6d76b52eb48078260588802dc95) --- sbin/md5/md5.1 | 25 ++++++++++++++++--------- sbin/md5/md5.c | 10 +++++++++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index da034d1298c5..2b1da85c080f 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd June 24, 2021 +.Dd June 29, 2021 .Dt MD5 1 .Os .Sh NAME @@ -77,9 +77,11 @@ The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent .It Fl b -Ignored for compatibility with the coreutils +Make the .Nm -sum -programs. +programs separate hash and digest with a blank followed by an asterisk instead +of by 2 blank characters for full compatibility with the output generated by the +coreutils versions of these programs. .It Fl c Ar string If the program was called with a name that does not end in .Nm sum , @@ -88,13 +90,13 @@ compare the digest of the file against this string. .It Fl c Ar file If the program was called with a name that does end in .Nm sum , -the file passed as argument must contain digest lines generated by the same digest algorithm -with or without the +the file passed as argument must contain digest lines generated by the same +digest algorithm with or without the .Fl r option .Pq i.e. in either classical BSD format or in GNU coreutils format . -A line with file name followed by -.Dq : +A line with the file name followed by a colon +.Dq ":" and either OK or FAILED is written for each well-formed line in the digest file. If applicable, the number of failed comparisons and the number of lines that were skipped since they were not well-formed are printed at the end. @@ -157,8 +159,13 @@ $ echo -n Hello | md5 Calculate the checksum of multiple files reversing the output: .Bd -literal -offset indent $ md5 -r /boot/loader.conf /etc/rc.conf -ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf -d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf +ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf +d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf +.Pd +The +.Nm -sum +variants put 2 blank characters between hash and file name for full compatibilty +with the coreutils versions of these commands. .Ed .Pp Write the digest for diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 43a76227a9d2..7235e6e0a39f 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #define TEST_BLOCK_COUNT 100000 #define MDTESTCOUNT 8 +static int bflag; static int cflag; static int pflag; static int qflag; @@ -301,6 +302,7 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "bc:pqrs:tx")) != -1) switch (ch) { case 'b': + bflag = 1; break; case 'c': cflag = 1; @@ -436,7 +438,13 @@ MDOutput(const Algorithm_t *alg, char *p, char *argv[]) printf("%s\n", p); } else { if (rflag) - printf("%s %s", p, *argv); + if (gnu_emu) + if (bflag) + printf("%s *%s", p, *argv); + else + printf("%s %s", p, *argv); + else + printf("%s %s", p, *argv); else printf("%s (%s) = %s", alg->name, *argv, p); if (checkAgainst) { From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:00:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 624FE658EC8; Tue, 6 Jul 2021 15:00: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 4GK5MN2J2xz3JK8; Tue, 6 Jul 2021 15:00: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 3701B1B87D; Tue, 6 Jul 2021 15:00: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 166F0G7D010498; Tue, 6 Jul 2021 15:00:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166F0G20010490; Tue, 6 Jul 2021 15:00:16 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:00:16 GMT Message-Id: <202107061500.166F0G20010490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c76616f496ee - main - etc/ttys: merge ttys file down to single file 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/main X-Git-Reftype: branch X-Git-Commit: c76616f496ee7e6b0a4ed9444fad56418f137a5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:00:16 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c76616f496ee7e6b0a4ed9444fad56418f137a5a commit c76616f496ee7e6b0a4ed9444fad56418f137a5a Author: Elliott Mitchell AuthorDate: 2021-05-13 06:58:00 +0000 Commit: Mitchell Horne CommitDate: 2021-07-06 14:53:10 +0000 etc/ttys: merge ttys file down to single file The tty lists were already pretty similar and there hadn't been any real need for them to remain distinct for some time. As such, merge to a single file. The RISC-V console is preserved. For systems where it doesn't exist, its presence in /etc/ttys is harmless. The uncommented version of the ttyv8/XDM line from ttys.amd64 was the one chosen. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30256 --- sbin/init/Makefile | 10 +-------- sbin/init/{ttys.riscv => ttys} | 2 +- sbin/init/ttys.aarch64 | 49 ------------------------------------------ sbin/init/ttys.amd64 | 49 ------------------------------------------ sbin/init/ttys.arm | 49 ------------------------------------------ sbin/init/ttys.i386 | 49 ------------------------------------------ sbin/init/ttys.mips | 36 ------------------------------- sbin/init/ttys.powerpc | 49 ------------------------------------------ 8 files changed, 2 insertions(+), 291 deletions(-) diff --git a/sbin/init/Makefile b/sbin/init/Makefile index 3c242617fe7a..3a914dc7acef 100644 --- a/sbin/init/Makefile +++ b/sbin/init/Makefile @@ -12,15 +12,7 @@ CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT LIBADD= util crypt CONFTTYSNAME= ttys -.if exists(${.CURDIR}/ttys.${MACHINE}) -CONFTTYS+= ttys.${MACHINE} -.elif exists(${.CURDIR}/ttys.${MACHINE_ARCH}) -CONFTTYS+= ttys.${MACHINE_ARCH} -.elif exists(${.CURDIR}/ttys.${MACHINE_CPUARCH}) -CONFTTYS+= ttys.${MACHINE_CPUARCH} -.else -.error MACHINE.ttys missing -.endif +CONFTTYS+= ttys # Needed for getmntopts.c MOUNT= ${SRCTOP}/sbin/mount diff --git a/sbin/init/ttys.riscv b/sbin/init/ttys similarity index 97% rename from sbin/init/ttys.riscv rename to sbin/init/ttys index 4e49b7a83bd8..4a5ee50dba59 100644 --- a/sbin/init/ttys.riscv +++ b/sbin/init/ttys @@ -38,7 +38,7 @@ ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure +ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure diff --git a/sbin/init/ttys.aarch64 b/sbin/init/ttys.aarch64 deleted file mode 100644 index 8a2376e799a1..000000000000 --- a/sbin/init/ttys.aarch64 +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.amd64 b/sbin/init/ttys.amd64 deleted file mode 100644 index b8392780ac9a..000000000000 --- a/sbin/init/ttys.amd64 +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.arm b/sbin/init/ttys.arm deleted file mode 100644 index b0722e4522dd..000000000000 --- a/sbin/init/ttys.arm +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.i386 b/sbin/init/ttys.i386 deleted file mode 100644 index b8392780ac9a..000000000000 --- a/sbin/init/ttys.i386 +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/sbin/init/ttys.mips b/sbin/init/ttys.mips deleted file mode 100644 index 21bb9325f3bf..000000000000 --- a/sbin/init/ttys.mips +++ /dev/null @@ -1,36 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure diff --git a/sbin/init/ttys.powerpc b/sbin/init/ttys.powerpc deleted file mode 100644 index b0722e4522dd..000000000000 --- a/sbin/init/ttys.powerpc +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically xterm. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure -ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure -#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:00:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7DEF1659504; Tue, 6 Jul 2021 15:00: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 4GK5MP338Hz3JZ0; Tue, 6 Jul 2021 15:00: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 52B281B87E; Tue, 6 Jul 2021 15:00: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 166F0HYV010996; Tue, 6 Jul 2021 15:00:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166F0HAN010990; Tue, 6 Jul 2021 15:00:17 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:00:17 GMT Message-Id: <202107061500.166F0HAN010990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 2b2c460d7bb8 - main - etc/ttys: add xen console 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/main X-Git-Reftype: branch X-Git-Commit: 2b2c460d7bb856a069047583a55a60976cd375a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:00:17 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=2b2c460d7bb856a069047583a55a60976cd375a4 commit 2b2c460d7bb856a069047583a55a60976cd375a4 Author: Julien Grall AuthorDate: 2015-10-29 14:22:35 +0000 Commit: Mitchell Horne CommitDate: 2021-07-06 14:53:10 +0000 etc/ttys: add xen console Xen VMs get a simulated serial device meant for use as a console. Often an xterm or other advanced terminal is used, so use xterm as the type. Depending on configuration, FreeBSD on Xen for amd64 may instead use an emulated serial port, but the virtual console may also be available. Submitted by: Elliott Mitchell Reviewed by: imp (slightly earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29873 --- sbin/init/ttys | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/init/ttys b/sbin/init/ttys index 4a5ee50dba59..a2f5b8975ecd 100644 --- a/sbin/init/ttys +++ b/sbin/init/ttys @@ -47,5 +47,7 @@ ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure +# Xen Virtual console +xc0 "/usr/libexec/getty Pc" xterm onifconsole secure # RISC-V HTIF console rcons "/usr/libexec/getty std.9600" vt100 onifconsole secure From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:14:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0047F65C048; Tue, 6 Jul 2021 15:14:13 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GK5gS4MCBz3PD9; Tue, 6 Jul 2021 15:14:12 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 166FClRO002156 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 6 Jul 2021 17:12:47 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 166FClTT011818; Tue, 6 Jul 2021 17:12:47 +0200 Date: Tue, 6 Jul 2021 17:12:47 +0200 From: Lutz Donnerhacke To: Ed Maste Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: c9144ec14d2a - main - Skip netgraph tests when WITHOUT_NETGRAPH is set Message-ID: <20210706151247.GA11784@belenus.iks-jena.de> References: <202107061347.166DlNuD010994@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202107061347.166DlNuD010994@gitrepo.freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4GK5gS4MCBz3PD9 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:14:13 -0000 On Tue, Jul 06, 2021 at 01:47:23PM +0000, Ed Maste wrote: > Skip netgraph tests when WITHOUT_NETGRAPH is set Thank you. I missed this case. From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:28:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1677A65C547; Tue, 6 Jul 2021 15:28: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 4GK5zh05L5z3QGV; Tue, 6 Jul 2021 15:28: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 E03401BFD7; Tue, 6 Jul 2021 15:28: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 166FSFp4051637; Tue, 6 Jul 2021 15:28:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166FSF8s051636; Tue, 6 Jul 2021 15:28:15 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:28:15 GMT Message-Id: <202107061528.166FSF8s051636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 546cc4ae8586 - stable/12 - sbin/md5: Create /usr/tests/sbin/md5 directory for placing tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 546cc4ae8586dcf052c9d8b17a1bc1d09d87b3b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:28:16 -0000 The branch stable/12 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=546cc4ae8586dcf052c9d8b17a1bc1d09d87b3b7 commit 546cc4ae8586dcf052c9d8b17a1bc1d09d87b3b7 Author: Li-Wen Hsu AuthorDate: 2021-06-25 10:29:46 +0000 Commit: Stefan Eßer CommitDate: 2021-07-06 15:26:18 +0000 sbin/md5: Create /usr/tests/sbin/md5 directory for placing tests Author: Li-Wen Hsu Sponsored by: The FreeBSD Foundation (cherry picked from commit cb194afef50dc4e1473413a69462aaf03cfe0ce4) sbin/md5: add tests While the correctness of the supported hash algorithms can be tested with the built-in self-test feature, these test cases are meant to detect changes in the output format. A follow-up commit will improve the compatibility with the coreutils versions of the hash programs, and these tests should detect any unintended side-effects of such a change on existing functionality. (cherry picked from commit 884fc5527a3ffd9830b941cbec328de1623044cc) sbin/md5: fix test case to not write outside temp directory The bsd-p-test did create files 1.out .. 8.out in the test directory. This has been fixed and the temporary output files are now written to the temporary directory. (cherry picked from commit 95d3044bbdadfca6120a3e7c61c9ebb9a476f369) --- etc/mtree/BSD.tests.dist | 2 ++ sbin/md5/Makefile | 5 ++++ sbin/md5/tests/1.inp | 0 sbin/md5/tests/1.sha512-p.chk | 1 + sbin/md5/tests/1.sha512sum-p.chk | 1 + sbin/md5/tests/2.inp | 1 + sbin/md5/tests/2.sha512-p.chk | 1 + sbin/md5/tests/2.sha512sum-p.chk | 1 + sbin/md5/tests/3.inp | 1 + sbin/md5/tests/3.sha512-p.chk | 1 + sbin/md5/tests/3.sha512sum-p.chk | 1 + sbin/md5/tests/4.inp | 1 + sbin/md5/tests/4.sha512-p.chk | 1 + sbin/md5/tests/4.sha512sum-p.chk | 1 + sbin/md5/tests/5.inp | 1 + sbin/md5/tests/5.sha512-p.chk | 1 + sbin/md5/tests/5.sha512sum-p.chk | 1 + sbin/md5/tests/6.inp | 1 + sbin/md5/tests/6.sha512-p.chk | 1 + sbin/md5/tests/6.sha512sum-p.chk | 1 + sbin/md5/tests/7.inp | 1 + sbin/md5/tests/7.sha512-p.chk | 1 + sbin/md5/tests/7.sha512sum-p.chk | 1 + sbin/md5/tests/8.inp | 1 + sbin/md5/tests/8.sha512-p.chk | 1 + sbin/md5/tests/8.sha512sum-p.chk | 1 + sbin/md5/tests/Makefile | 41 +++++++++++++++++++++++++++++++++ sbin/md5/tests/algorithms.txt | 11 +++++++++ sbin/md5/tests/bsd-c-test.SH | 23 ++++++++++++++++++ sbin/md5/tests/bsd-p-test.SH | 24 +++++++++++++++++++ sbin/md5/tests/bsd-s-test.SH | 30 ++++++++++++++++++++++++ sbin/md5/tests/md5.digest | 8 +++++++ sbin/md5/tests/md5sum.digest | 8 +++++++ sbin/md5/tests/rmd160.digest | 8 +++++++ sbin/md5/tests/rmd160sum.digest | 8 +++++++ sbin/md5/tests/self-test.SH | 8 +++++++ sbin/md5/tests/self-test.md5.chk | 9 ++++++++ sbin/md5/tests/self-test.rmd160.chk | 9 ++++++++ sbin/md5/tests/self-test.sh_inp | 8 +++++++ sbin/md5/tests/self-test.sha1.chk | 9 ++++++++ sbin/md5/tests/self-test.sha224.chk | 9 ++++++++ sbin/md5/tests/self-test.sha256.chk | 9 ++++++++ sbin/md5/tests/self-test.sha384.chk | 9 ++++++++ sbin/md5/tests/self-test.sha512.chk | 9 ++++++++ sbin/md5/tests/self-test.sha512t256.chk | 9 ++++++++ sbin/md5/tests/self-test.skein1024.chk | 9 ++++++++ sbin/md5/tests/self-test.skein256.chk | 9 ++++++++ sbin/md5/tests/self-test.skein512.chk | 9 ++++++++ sbin/md5/tests/sha1.digest | 8 +++++++ sbin/md5/tests/sha1sum.digest | 8 +++++++ sbin/md5/tests/sha224.digest | 8 +++++++ sbin/md5/tests/sha224sum.digest | 8 +++++++ sbin/md5/tests/sha256.digest | 8 +++++++ sbin/md5/tests/sha256sum.digest | 8 +++++++ sbin/md5/tests/sha384.digest | 8 +++++++ sbin/md5/tests/sha384sum.digest | 8 +++++++ sbin/md5/tests/sha512.digest | 8 +++++++ sbin/md5/tests/sha512sum.digest | 8 +++++++ sbin/md5/tests/sha512t256.digest | 8 +++++++ sbin/md5/tests/sha512t256sum.digest | 8 +++++++ sbin/md5/tests/skein1024.digest | 8 +++++++ sbin/md5/tests/skein1024sum.digest | 8 +++++++ sbin/md5/tests/skein256.digest | 8 +++++++ sbin/md5/tests/skein256sum.digest | 8 +++++++ sbin/md5/tests/skein512.digest | 8 +++++++ sbin/md5/tests/skein512sum.digest | 8 +++++++ 66 files changed, 450 insertions(+) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index df03a6375779..4997d67296ba 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -432,6 +432,8 @@ .. ifconfig .. + md5 + .. mdconfig .. nvmecontrol diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index dcbd94dcd381..6e29d94eb92a 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -36,4 +36,9 @@ LIBADD= md CFLAGS+=-DHAVE_CAPSICUM .endif +.include + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include diff --git a/sbin/md5/tests/1.inp b/sbin/md5/tests/1.inp new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sbin/md5/tests/1.sha512-p.chk b/sbin/md5/tests/1.sha512-p.chk new file mode 100644 index 000000000000..c2f1924ca315 --- /dev/null +++ b/sbin/md5/tests/1.sha512-p.chk @@ -0,0 +1 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e diff --git a/sbin/md5/tests/1.sha512sum-p.chk b/sbin/md5/tests/1.sha512sum-p.chk new file mode 100644 index 000000000000..c2f1924ca315 --- /dev/null +++ b/sbin/md5/tests/1.sha512sum-p.chk @@ -0,0 +1 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e diff --git a/sbin/md5/tests/2.inp b/sbin/md5/tests/2.inp new file mode 100644 index 000000000000..2e65efe2a145 --- /dev/null +++ b/sbin/md5/tests/2.inp @@ -0,0 +1 @@ +a \ No newline at end of file diff --git a/sbin/md5/tests/2.sha512-p.chk b/sbin/md5/tests/2.sha512-p.chk new file mode 100644 index 000000000000..be4d8addd112 --- /dev/null +++ b/sbin/md5/tests/2.sha512-p.chk @@ -0,0 +1 @@ +a1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 diff --git a/sbin/md5/tests/2.sha512sum-p.chk b/sbin/md5/tests/2.sha512sum-p.chk new file mode 100644 index 000000000000..be4d8addd112 --- /dev/null +++ b/sbin/md5/tests/2.sha512sum-p.chk @@ -0,0 +1 @@ +a1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 diff --git a/sbin/md5/tests/3.inp b/sbin/md5/tests/3.inp new file mode 100644 index 000000000000..f2ba8f84ab5c --- /dev/null +++ b/sbin/md5/tests/3.inp @@ -0,0 +1 @@ +abc \ No newline at end of file diff --git a/sbin/md5/tests/3.sha512-p.chk b/sbin/md5/tests/3.sha512-p.chk new file mode 100644 index 000000000000..3971db2fddea --- /dev/null +++ b/sbin/md5/tests/3.sha512-p.chk @@ -0,0 +1 @@ +abcddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f diff --git a/sbin/md5/tests/3.sha512sum-p.chk b/sbin/md5/tests/3.sha512sum-p.chk new file mode 100644 index 000000000000..3971db2fddea --- /dev/null +++ b/sbin/md5/tests/3.sha512sum-p.chk @@ -0,0 +1 @@ +abcddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f diff --git a/sbin/md5/tests/4.inp b/sbin/md5/tests/4.inp new file mode 100644 index 000000000000..e407fe0e6143 --- /dev/null +++ b/sbin/md5/tests/4.inp @@ -0,0 +1 @@ +message digest \ No newline at end of file diff --git a/sbin/md5/tests/4.sha512-p.chk b/sbin/md5/tests/4.sha512-p.chk new file mode 100644 index 000000000000..cd5bad00b50d --- /dev/null +++ b/sbin/md5/tests/4.sha512-p.chk @@ -0,0 +1 @@ +message digest107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c diff --git a/sbin/md5/tests/4.sha512sum-p.chk b/sbin/md5/tests/4.sha512sum-p.chk new file mode 100644 index 000000000000..cd5bad00b50d --- /dev/null +++ b/sbin/md5/tests/4.sha512sum-p.chk @@ -0,0 +1 @@ +message digest107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c diff --git a/sbin/md5/tests/5.inp b/sbin/md5/tests/5.inp new file mode 100644 index 000000000000..e85d5b45283a --- /dev/null +++ b/sbin/md5/tests/5.inp @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz \ No newline at end of file diff --git a/sbin/md5/tests/5.sha512-p.chk b/sbin/md5/tests/5.sha512-p.chk new file mode 100644 index 000000000000..77f97a5a0117 --- /dev/null +++ b/sbin/md5/tests/5.sha512-p.chk @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 diff --git a/sbin/md5/tests/5.sha512sum-p.chk b/sbin/md5/tests/5.sha512sum-p.chk new file mode 100644 index 000000000000..77f97a5a0117 --- /dev/null +++ b/sbin/md5/tests/5.sha512sum-p.chk @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 diff --git a/sbin/md5/tests/6.inp b/sbin/md5/tests/6.inp new file mode 100644 index 000000000000..9f75c3756298 --- /dev/null +++ b/sbin/md5/tests/6.inp @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \ No newline at end of file diff --git a/sbin/md5/tests/6.sha512-p.chk b/sbin/md5/tests/6.sha512-p.chk new file mode 100644 index 000000000000..d14aad405215 --- /dev/null +++ b/sbin/md5/tests/6.sha512-p.chk @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567891e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 diff --git a/sbin/md5/tests/6.sha512sum-p.chk b/sbin/md5/tests/6.sha512sum-p.chk new file mode 100644 index 000000000000..d14aad405215 --- /dev/null +++ b/sbin/md5/tests/6.sha512sum-p.chk @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567891e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 diff --git a/sbin/md5/tests/7.inp b/sbin/md5/tests/7.inp new file mode 100644 index 000000000000..15e0acf537d8 --- /dev/null +++ b/sbin/md5/tests/7.inp @@ -0,0 +1 @@ +12345678901234567890123456789012345678901234567890123456789012345678901234567890 \ No newline at end of file diff --git a/sbin/md5/tests/7.sha512-p.chk b/sbin/md5/tests/7.sha512-p.chk new file mode 100644 index 000000000000..efd5828f95ff --- /dev/null +++ b/sbin/md5/tests/7.sha512-p.chk @@ -0,0 +1 @@ +1234567890123456789012345678901234567890123456789012345678901234567890123456789072ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 diff --git a/sbin/md5/tests/7.sha512sum-p.chk b/sbin/md5/tests/7.sha512sum-p.chk new file mode 100644 index 000000000000..efd5828f95ff --- /dev/null +++ b/sbin/md5/tests/7.sha512sum-p.chk @@ -0,0 +1 @@ +1234567890123456789012345678901234567890123456789012345678901234567890123456789072ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 diff --git a/sbin/md5/tests/8.inp b/sbin/md5/tests/8.inp new file mode 100644 index 000000000000..689a689eceea --- /dev/null +++ b/sbin/md5/tests/8.inp @@ -0,0 +1 @@ +MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt \ No newline at end of file diff --git a/sbin/md5/tests/8.sha512-p.chk b/sbin/md5/tests/8.sha512-p.chk new file mode 100644 index 000000000000..d53bfc56d752 --- /dev/null +++ b/sbin/md5/tests/8.sha512-p.chk @@ -0,0 +1 @@ +MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubte8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 diff --git a/sbin/md5/tests/8.sha512sum-p.chk b/sbin/md5/tests/8.sha512sum-p.chk new file mode 100644 index 000000000000..d53bfc56d752 --- /dev/null +++ b/sbin/md5/tests/8.sha512sum-p.chk @@ -0,0 +1 @@ +MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubte8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 diff --git a/sbin/md5/tests/Makefile b/sbin/md5/tests/Makefile new file mode 100644 index 000000000000..b37332aa9894 --- /dev/null +++ b/sbin/md5/tests/Makefile @@ -0,0 +1,41 @@ +# $FreeBSD$ + +.include + +PACKAGE= tests + +TEST_DIR= ${SRCTOP}/sbin/md5/tests + +.PATH: ${TEST_DIR} + +FILESGROUPS+= FILESinputs +FILESinputsPACKAGE= ${PACKAGE} +FILESinputsDIR= ${TESTSDIR} +FILESinputs!= echo ${TEST_DIR}/*.inp + +FILESGROUPS+= FILESchkfiles +FILESchkfilesPACKAGE= ${PACKAGE} +FILESchkfilesDIR= ${TESTSDIR} +FILESchkfiles!= echo ${TEST_DIR}/*.chk + +FILESGROUPS+= FILESdigests +FILESdigestsPACKAGE= ${PACKAGE} +FILESdigestsDIR= ${TESTSDIR} +FILESdigests!= echo ${TEST_DIR}/*.digest + +FILESGROUPS+= FILESparam +FILESparamPACKAGE= ${PACKAGE} +FILESparamDIR= ${TESTSDIR} +FILESparam!= echo ${TEST_DIR}/*.txt + +PLAIN_TESTS_SH+= self-test +PLAIN_TESTS_SH+= bsd-c-test +PLAIN_TESTS_SH+= bsd-p-test +PLAIN_TESTS_SH+= bsd-s-test + +.SUFFIXES: .SH + +.SH.sh: + sed 's|%%TESTSBASE%%|${TESTSBASE}|g' ${.ALLSRC} > ${.TARGET} + +.include diff --git a/sbin/md5/tests/algorithms.txt b/sbin/md5/tests/algorithms.txt new file mode 100644 index 000000000000..88f0ff5b783a --- /dev/null +++ b/sbin/md5/tests/algorithms.txt @@ -0,0 +1,11 @@ +md5 +rmd160 +sha1 +sha224 +sha256 +sha384 +sha512 +sha512t256 +skein1024 +skein256 +skein512 diff --git a/sbin/md5/tests/bsd-c-test.SH b/sbin/md5/tests/bsd-c-test.SH new file mode 100644 index 000000000000..0327b95f0c0e --- /dev/null +++ b/sbin/md5/tests/bsd-c-test.SH @@ -0,0 +1,23 @@ +#!/bin/sh + +exitcode=0 + +testloop () { + opt=$1 + + while read algorithm; do + n=0 + for f in %%TESTSBASE%%/sbin/md5/*.inp; do + n=$((n + 1)) + expected=$(head -$n %%TESTSBASE%%/sbin/md5/$algorithm.digest | tail -1 | cut -w -f4) + hash=$($algorithm $opt -c "$expected" $f) || exitcode=1 + done + done < %%TESTSBASE%%/sbin/md5/algorithms.txt +} + +testloop "" +testloop -q +testloop -r +testloop -qr + +exit $exitcode diff --git a/sbin/md5/tests/bsd-p-test.SH b/sbin/md5/tests/bsd-p-test.SH new file mode 100644 index 000000000000..77a725377e2c --- /dev/null +++ b/sbin/md5/tests/bsd-p-test.SH @@ -0,0 +1,24 @@ +#!/bin/sh + +exitcode=0 + +testloop () { + opt=$1 + sum=$2 + + for algorithm in sha512; do + for f in %%TESTSBASE%%/sbin/md5/*.inp; do + outbase=$(basename $f .inp) + $algorithm$sum $opt -p < $f > $outbase.out + diff %%TESTSBASE%%/sbin/md5/$outbase.$algorithm$sum-p.chk $outbase.out || exitcode=1 + done + done +} + +testloop "" "" +testloop -q "" +testloop -qr "" +testloop "" sum +testloop -q sum + +exit $exitcode diff --git a/sbin/md5/tests/bsd-s-test.SH b/sbin/md5/tests/bsd-s-test.SH new file mode 100644 index 000000000000..83267711137f --- /dev/null +++ b/sbin/md5/tests/bsd-s-test.SH @@ -0,0 +1,30 @@ +#!/bin/sh + +exitcode=0 + +testloop () { + opt=$1 + sum=$2 + field=$3 + + while read algorithm; do + n=0 + for f in %%TESTSBASE%%/sbin/md5/*.inp; do + n=$((n + 1)) + read text < $f + hash=$($algorithm$sum $opt -s "$text" | cut -d= -f$field) + hash=$(echo $hash | cut -w -f1) + expected=$(head -$n %%TESTSBASE%%/sbin/md5/$algorithm.digest | tail -1 | cut -w -f4) + [ "$hash" = "$expected" ] || exitcode=1 + done + done < %%TESTSBASE%%/sbin/md5/algorithms.txt +} + +testloop "" "" 2 +testloop -q "" 1 +testloop -r "" 1 +testloop -qr "" 1 +testloop "" sum 1 +testloop -q sum 1 + +exit $exitcode diff --git a/sbin/md5/tests/md5.digest b/sbin/md5/tests/md5.digest new file mode 100644 index 000000000000..38b8dcb6e705 --- /dev/null +++ b/sbin/md5/tests/md5.digest @@ -0,0 +1,8 @@ +MD5 (1.inp) = d41d8cd98f00b204e9800998ecf8427e +MD5 (2.inp) = 0cc175b9c0f1b6a831c399e269772661 +MD5 (3.inp) = 900150983cd24fb0d6963f7d28e17f72 +MD5 (4.inp) = f96b697d7cb7938d525a2f31aaf161d0 +MD5 (5.inp) = c3fcd3d76192e4007dfb496cca67e13b +MD5 (6.inp) = d174ab98d277d9f5a5611c2c9f419d9f +MD5 (7.inp) = 57edf4a22be3c955ac49da2e2107b67a +MD5 (8.inp) = b50663f41d44d92171cb9976bc118538 diff --git a/sbin/md5/tests/md5sum.digest b/sbin/md5/tests/md5sum.digest new file mode 100644 index 000000000000..c560afa0d7f0 --- /dev/null +++ b/sbin/md5/tests/md5sum.digest @@ -0,0 +1,8 @@ +d41d8cd98f00b204e9800998ecf8427e 1.inp +0cc175b9c0f1b6a831c399e269772661 2.inp +900150983cd24fb0d6963f7d28e17f72 3.inp +f96b697d7cb7938d525a2f31aaf161d0 4.inp +c3fcd3d76192e4007dfb496cca67e13b 5.inp +d174ab98d277d9f5a5611c2c9f419d9f 6.inp +57edf4a22be3c955ac49da2e2107b67a 7.inp +b50663f41d44d92171cb9976bc118538 8.inp diff --git a/sbin/md5/tests/rmd160.digest b/sbin/md5/tests/rmd160.digest new file mode 100644 index 000000000000..b2ffd3c0ce45 --- /dev/null +++ b/sbin/md5/tests/rmd160.digest @@ -0,0 +1,8 @@ +RMD160 (1.inp) = 9c1185a5c5e9fc54612808977ee8f548b2258d31 +RMD160 (2.inp) = 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe +RMD160 (3.inp) = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc +RMD160 (4.inp) = 5d0689ef49d2fae572b881b123a85ffa21595f36 +RMD160 (5.inp) = f71c27109c692c1b56bbdceb5b9d2865b3708dbc +RMD160 (6.inp) = b0e20b6e3116640286ed3a87a5713079b21f5189 +RMD160 (7.inp) = 9b752e45573d4b39f4dbd3323cab82bf63326bfb +RMD160 (8.inp) = 5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32 diff --git a/sbin/md5/tests/rmd160sum.digest b/sbin/md5/tests/rmd160sum.digest new file mode 100644 index 000000000000..4864ff39e050 --- /dev/null +++ b/sbin/md5/tests/rmd160sum.digest @@ -0,0 +1,8 @@ +9c1185a5c5e9fc54612808977ee8f548b2258d31 1.inp +0bdc9d2d256b3ee9daae347be6f4dc835a467ffe 2.inp +8eb208f7e05d987a9b044a8e98c6b087f15a0bfc 3.inp +5d0689ef49d2fae572b881b123a85ffa21595f36 4.inp +f71c27109c692c1b56bbdceb5b9d2865b3708dbc 5.inp +b0e20b6e3116640286ed3a87a5713079b21f5189 6.inp +9b752e45573d4b39f4dbd3323cab82bf63326bfb 7.inp +5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32 8.inp diff --git a/sbin/md5/tests/self-test.SH b/sbin/md5/tests/self-test.SH new file mode 100644 index 000000000000..33bd5569c23c --- /dev/null +++ b/sbin/md5/tests/self-test.SH @@ -0,0 +1,8 @@ +#!/bin/sh + +while read algorithm; do + $algorithm -x > self-test.$algorithm.out || exitcode=$? + diff %%TESTSBASE%%/sbin/md5/self-test.$algorithm.chk self-test.$algorithm.out +done < %%TESTSBASE%%/sbin/md5/algorithms.txt + +exit $exitcode diff --git a/sbin/md5/tests/self-test.md5.chk b/sbin/md5/tests/self-test.md5.chk new file mode 100644 index 000000000000..d4eb05560b53 --- /dev/null +++ b/sbin/md5/tests/self-test.md5.chk @@ -0,0 +1,9 @@ +MD5 test suite: +MD5 ("") = d41d8cd98f00b204e9800998ecf8427e - verified correct +MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 - verified correct +MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 - verified correct +MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 - verified correct +MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b - verified correct +MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f - verified correct +MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a - verified correct +MD5 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = b50663f41d44d92171cb9976bc118538 - verified correct diff --git a/sbin/md5/tests/self-test.rmd160.chk b/sbin/md5/tests/self-test.rmd160.chk new file mode 100644 index 000000000000..a0680ac7f647 --- /dev/null +++ b/sbin/md5/tests/self-test.rmd160.chk @@ -0,0 +1,9 @@ +RMD160 test suite: +RMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31 - verified correct +RMD160 ("a") = 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe - verified correct +RMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc - verified correct +RMD160 ("message digest") = 5d0689ef49d2fae572b881b123a85ffa21595f36 - verified correct +RMD160 ("abcdefghijklmnopqrstuvwxyz") = f71c27109c692c1b56bbdceb5b9d2865b3708dbc - verified correct +RMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = b0e20b6e3116640286ed3a87a5713079b21f5189 - verified correct +RMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 9b752e45573d4b39f4dbd3323cab82bf63326bfb - verified correct +RMD160 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32 - verified correct diff --git a/sbin/md5/tests/self-test.sh_inp b/sbin/md5/tests/self-test.sh_inp new file mode 100644 index 000000000000..33bd5569c23c --- /dev/null +++ b/sbin/md5/tests/self-test.sh_inp @@ -0,0 +1,8 @@ +#!/bin/sh + +while read algorithm; do + $algorithm -x > self-test.$algorithm.out || exitcode=$? + diff %%TESTSBASE%%/sbin/md5/self-test.$algorithm.chk self-test.$algorithm.out +done < %%TESTSBASE%%/sbin/md5/algorithms.txt + +exit $exitcode diff --git a/sbin/md5/tests/self-test.sha1.chk b/sbin/md5/tests/self-test.sha1.chk new file mode 100644 index 000000000000..e463947feb36 --- /dev/null +++ b/sbin/md5/tests/self-test.sha1.chk @@ -0,0 +1,9 @@ +SHA1 test suite: +SHA1 ("") = da39a3ee5e6b4b0d3255bfef95601890afd80709 - verified correct +SHA1 ("a") = 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 - verified correct +SHA1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d - verified correct +SHA1 ("message digest") = c12252ceda8be8994d5fa0290a47231c1d16aae3 - verified correct +SHA1 ("abcdefghijklmnopqrstuvwxyz") = 32d10c7b8cf96570ca04ce37f2a19d84240d3a89 - verified correct +SHA1 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 761c457bf73b14d27e9e9265c46f4b4dda11f940 - verified correct +SHA1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 50abf5706a150990a08b2c5ea40fa0e585554732 - verified correct +SHA1 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 18eca4333979c4181199b7b4fab8786d16cf2846 - verified correct diff --git a/sbin/md5/tests/self-test.sha224.chk b/sbin/md5/tests/self-test.sha224.chk new file mode 100644 index 000000000000..e74cccafa6d7 --- /dev/null +++ b/sbin/md5/tests/self-test.sha224.chk @@ -0,0 +1,9 @@ +SHA224 test suite: +SHA224 ("") = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f - verified correct +SHA224 ("a") = abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 - verified correct +SHA224 ("abc") = 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 - verified correct +SHA224 ("message digest") = 2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb - verified correct +SHA224 ("abcdefghijklmnopqrstuvwxyz") = 45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 - verified correct +SHA224 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 - verified correct +SHA224 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e - verified correct +SHA224 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470 - verified correct diff --git a/sbin/md5/tests/self-test.sha256.chk b/sbin/md5/tests/self-test.sha256.chk new file mode 100644 index 000000000000..ba640b6a9217 --- /dev/null +++ b/sbin/md5/tests/self-test.sha256.chk @@ -0,0 +1,9 @@ +SHA256 test suite: +SHA256 ("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - verified correct +SHA256 ("a") = ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb - verified correct +SHA256 ("abc") = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad - verified correct +SHA256 ("message digest") = f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 - verified correct +SHA256 ("abcdefghijklmnopqrstuvwxyz") = 71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 - verified correct +SHA256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0 - verified correct +SHA256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e - verified correct +SHA256 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f - verified correct diff --git a/sbin/md5/tests/self-test.sha384.chk b/sbin/md5/tests/self-test.sha384.chk new file mode 100644 index 000000000000..a493cadc1964 --- /dev/null +++ b/sbin/md5/tests/self-test.sha384.chk @@ -0,0 +1,9 @@ +SHA384 test suite: +SHA384 ("") = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b - verified correct +SHA384 ("a") = 54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 - verified correct +SHA384 ("abc") = cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 - verified correct +SHA384 ("message digest") = 473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 - verified correct +SHA384 ("abcdefghijklmnopqrstuvwxyz") = feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 - verified correct +SHA384 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 - verified correct +SHA384 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 - verified correct +SHA384 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb - verified correct diff --git a/sbin/md5/tests/self-test.sha512.chk b/sbin/md5/tests/self-test.sha512.chk new file mode 100644 index 000000000000..f36e455cdaa5 --- /dev/null +++ b/sbin/md5/tests/self-test.sha512.chk @@ -0,0 +1,9 @@ +SHA512 test suite: +SHA512 ("") = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - verified correct +SHA512 ("a") = 1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 - verified correct +SHA512 ("abc") = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f - verified correct +SHA512 ("message digest") = 107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c - verified correct +SHA512 ("abcdefghijklmnopqrstuvwxyz") = 4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 - verified correct +SHA512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 - verified correct +SHA512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 - verified correct +SHA512 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 - verified correct diff --git a/sbin/md5/tests/self-test.sha512t256.chk b/sbin/md5/tests/self-test.sha512t256.chk new file mode 100644 index 000000000000..25612ace484a --- /dev/null +++ b/sbin/md5/tests/self-test.sha512t256.chk @@ -0,0 +1,9 @@ +SHA512t256 test suite: +SHA512t256 ("") = c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a - verified correct +SHA512t256 ("a") = 455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8 - verified correct +SHA512t256 ("abc") = 53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 - verified correct +SHA512t256 ("message digest") = 0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb - verified correct +SHA512t256 ("abcdefghijklmnopqrstuvwxyz") = fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26 - verified correct +SHA512t256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8 - verified correct +SHA512t256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148 - verified correct +SHA512t256 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736 - verified correct diff --git a/sbin/md5/tests/self-test.skein1024.chk b/sbin/md5/tests/self-test.skein1024.chk new file mode 100644 index 000000000000..8cfc5997afde --- /dev/null +++ b/sbin/md5/tests/self-test.skein1024.chk @@ -0,0 +1,9 @@ +Skein1024 test suite: +Skein1024 ("") = 0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6 - verified correct +Skein1024 ("a") = 6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97 - verified correct +Skein1024 ("abc") = 35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f - verified correct +Skein1024 ("message digest") = ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458 - verified correct +Skein1024 ("abcdefghijklmnopqrstuvwxyz") = f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f - verified correct +Skein1024 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469 - verified correct +Skein1024 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a - verified correct +Skein1024 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138 - verified correct diff --git a/sbin/md5/tests/self-test.skein256.chk b/sbin/md5/tests/self-test.skein256.chk new file mode 100644 index 000000000000..41d1fdcb8cc8 --- /dev/null +++ b/sbin/md5/tests/self-test.skein256.chk @@ -0,0 +1,9 @@ +Skein256 test suite: +Skein256 ("") = c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba - verified correct +Skein256 ("a") = 7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635 - verified correct +Skein256 ("abc") = 258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870 - verified correct +Skein256 ("message digest") = 4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488 - verified correct +Skein256 ("abcdefghijklmnopqrstuvwxyz") = 46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82 - verified correct +Skein256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2 - verified correct +Skein256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d - verified correct +Skein256 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126 - verified correct diff --git a/sbin/md5/tests/self-test.skein512.chk b/sbin/md5/tests/self-test.skein512.chk new file mode 100644 index 000000000000..437220e17adb --- /dev/null +++ b/sbin/md5/tests/self-test.skein512.chk @@ -0,0 +1,9 @@ +Skein512 test suite: +Skein512 ("") = bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a - verified correct +Skein512 ("a") = b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce - verified correct +Skein512 ("abc") = 8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75 - verified correct +Skein512 ("message digest") = 15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc - verified correct +Skein512 ("abcdefghijklmnopqrstuvwxyz") = 23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c - verified correct +Skein512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c - verified correct +Skein512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce - verified correct +Skein512 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125 - verified correct diff --git a/sbin/md5/tests/sha1.digest b/sbin/md5/tests/sha1.digest new file mode 100644 index 000000000000..10ce642c0883 --- /dev/null +++ b/sbin/md5/tests/sha1.digest @@ -0,0 +1,8 @@ +SHA1 (1.inp) = da39a3ee5e6b4b0d3255bfef95601890afd80709 +SHA1 (2.inp) = 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 +SHA1 (3.inp) = a9993e364706816aba3e25717850c26c9cd0d89d +SHA1 (4.inp) = c12252ceda8be8994d5fa0290a47231c1d16aae3 +SHA1 (5.inp) = 32d10c7b8cf96570ca04ce37f2a19d84240d3a89 +SHA1 (6.inp) = 761c457bf73b14d27e9e9265c46f4b4dda11f940 +SHA1 (7.inp) = 50abf5706a150990a08b2c5ea40fa0e585554732 +SHA1 (8.inp) = 18eca4333979c4181199b7b4fab8786d16cf2846 diff --git a/sbin/md5/tests/sha1sum.digest b/sbin/md5/tests/sha1sum.digest new file mode 100644 index 000000000000..d82d2889ff5d --- /dev/null +++ b/sbin/md5/tests/sha1sum.digest @@ -0,0 +1,8 @@ +da39a3ee5e6b4b0d3255bfef95601890afd80709 1.inp +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 2.inp +a9993e364706816aba3e25717850c26c9cd0d89d 3.inp +c12252ceda8be8994d5fa0290a47231c1d16aae3 4.inp +32d10c7b8cf96570ca04ce37f2a19d84240d3a89 5.inp +761c457bf73b14d27e9e9265c46f4b4dda11f940 6.inp +50abf5706a150990a08b2c5ea40fa0e585554732 7.inp +18eca4333979c4181199b7b4fab8786d16cf2846 8.inp diff --git a/sbin/md5/tests/sha224.digest b/sbin/md5/tests/sha224.digest new file mode 100644 index 000000000000..a1007511a978 --- /dev/null +++ b/sbin/md5/tests/sha224.digest @@ -0,0 +1,8 @@ +SHA224 (1.inp) = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f +SHA224 (2.inp) = abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 +SHA224 (3.inp) = 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 +SHA224 (4.inp) = 2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb +SHA224 (5.inp) = 45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 +SHA224 (6.inp) = bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 +SHA224 (7.inp) = b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e +SHA224 (8.inp) = 5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470 diff --git a/sbin/md5/tests/sha224sum.digest b/sbin/md5/tests/sha224sum.digest new file mode 100644 index 000000000000..37fd833032fb --- /dev/null +++ b/sbin/md5/tests/sha224sum.digest @@ -0,0 +1,8 @@ +d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f 1.inp +abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 2.inp +23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 3.inp +2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb 4.inp +45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 5.inp +bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 6.inp +b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e 7.inp +5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470 8.inp diff --git a/sbin/md5/tests/sha256.digest b/sbin/md5/tests/sha256.digest new file mode 100644 index 000000000000..b6c4411261a8 --- /dev/null +++ b/sbin/md5/tests/sha256.digest @@ -0,0 +1,8 @@ +SHA256 (1.inp) = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 +SHA256 (2.inp) = ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb +SHA256 (3.inp) = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad +SHA256 (4.inp) = f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 +SHA256 (5.inp) = 71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 +SHA256 (6.inp) = db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0 +SHA256 (7.inp) = f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e +SHA256 (8.inp) = e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f diff --git a/sbin/md5/tests/sha256sum.digest b/sbin/md5/tests/sha256sum.digest new file mode 100644 index 000000000000..35ce99a0c6c1 --- /dev/null +++ b/sbin/md5/tests/sha256sum.digest @@ -0,0 +1,8 @@ +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 1.inp +ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb 2.inp +ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 3.inp +f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 4.inp +71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 5.inp +db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0 6.inp +f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e 7.inp +e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f 8.inp diff --git a/sbin/md5/tests/sha384.digest b/sbin/md5/tests/sha384.digest new file mode 100644 index 000000000000..b56ef8b708e4 --- /dev/null +++ b/sbin/md5/tests/sha384.digest @@ -0,0 +1,8 @@ +SHA384 (1.inp) = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b +SHA384 (2.inp) = 54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 +SHA384 (3.inp) = cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 +SHA384 (4.inp) = 473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 +SHA384 (5.inp) = feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 +SHA384 (6.inp) = 1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 +SHA384 (7.inp) = b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 +SHA384 (8.inp) = 99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb diff --git a/sbin/md5/tests/sha384sum.digest b/sbin/md5/tests/sha384sum.digest new file mode 100644 index 000000000000..7d669e0dda08 --- /dev/null +++ b/sbin/md5/tests/sha384sum.digest @@ -0,0 +1,8 @@ +38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b 1.inp +54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 2.inp +cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 3.inp +473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 4.inp +feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 5.inp +1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 6.inp +b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 7.inp +99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb 8.inp diff --git a/sbin/md5/tests/sha512.digest b/sbin/md5/tests/sha512.digest new file mode 100644 index 000000000000..dd82845b8131 --- /dev/null +++ b/sbin/md5/tests/sha512.digest @@ -0,0 +1,8 @@ +SHA512 (1.inp) = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e +SHA512 (2.inp) = 1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 +SHA512 (3.inp) = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f +SHA512 (4.inp) = 107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c +SHA512 (5.inp) = 4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 +SHA512 (6.inp) = 1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 +SHA512 (7.inp) = 72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 +SHA512 (8.inp) = e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 diff --git a/sbin/md5/tests/sha512sum.digest b/sbin/md5/tests/sha512sum.digest new file mode 100644 index 000000000000..55bbd509e4df --- /dev/null +++ b/sbin/md5/tests/sha512sum.digest @@ -0,0 +1,8 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 1.inp +1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 2.inp +ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f 3.inp +107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c 4.inp +4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 5.inp +1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 6.inp +72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 7.inp +e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 8.inp diff --git a/sbin/md5/tests/sha512t256.digest b/sbin/md5/tests/sha512t256.digest new file mode 100644 index 000000000000..3e7df9eb98db --- /dev/null +++ b/sbin/md5/tests/sha512t256.digest @@ -0,0 +1,8 @@ +SHA512t256 (1.inp) = c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a +SHA512t256 (2.inp) = 455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8 +SHA512t256 (3.inp) = 53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 +SHA512t256 (4.inp) = 0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb +SHA512t256 (5.inp) = fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26 +SHA512t256 (6.inp) = cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8 +SHA512t256 (7.inp) = 2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148 +SHA512t256 (8.inp) = dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736 diff --git a/sbin/md5/tests/sha512t256sum.digest b/sbin/md5/tests/sha512t256sum.digest new file mode 100644 index 000000000000..425e31006d6e --- /dev/null +++ b/sbin/md5/tests/sha512t256sum.digest @@ -0,0 +1,8 @@ +c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a 1.inp +455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8 2.inp +53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 3.inp +0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb 4.inp +fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26 5.inp +cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8 6.inp +2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148 7.inp +dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736 8.inp diff --git a/sbin/md5/tests/skein1024.digest b/sbin/md5/tests/skein1024.digest new file mode 100644 index 000000000000..dea354221b26 --- /dev/null +++ b/sbin/md5/tests/skein1024.digest @@ -0,0 +1,8 @@ +Skein1024 (1.inp) = 0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6 +Skein1024 (2.inp) = 6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97 +Skein1024 (3.inp) = 35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f +Skein1024 (4.inp) = ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458 +Skein1024 (5.inp) = f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f +Skein1024 (6.inp) = cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469 +Skein1024 (7.inp) = cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a +Skein1024 (8.inp) = e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138 diff --git a/sbin/md5/tests/skein1024sum.digest b/sbin/md5/tests/skein1024sum.digest new file mode 100644 index 000000000000..dca058ab55b7 --- /dev/null +++ b/sbin/md5/tests/skein1024sum.digest @@ -0,0 +1,8 @@ +0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6 1.inp +6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97 2.inp +35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f 3.inp +ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458 4.inp +f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f 5.inp +cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469 6.inp +cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a 7.inp +e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138 8.inp diff --git a/sbin/md5/tests/skein256.digest b/sbin/md5/tests/skein256.digest new file mode 100644 index 000000000000..ee17f8df1532 --- /dev/null +++ b/sbin/md5/tests/skein256.digest @@ -0,0 +1,8 @@ +Skein256 (1.inp) = c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba +Skein256 (2.inp) = 7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635 +Skein256 (3.inp) = 258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870 +Skein256 (4.inp) = 4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488 +Skein256 (5.inp) = 46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82 +Skein256 (6.inp) = 7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2 +Skein256 (7.inp) = 4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d +Skein256 (8.inp) = d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126 diff --git a/sbin/md5/tests/skein256sum.digest b/sbin/md5/tests/skein256sum.digest new file mode 100644 index 000000000000..2e1c8d1bc60d --- /dev/null +++ b/sbin/md5/tests/skein256sum.digest @@ -0,0 +1,8 @@ +c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba 1.inp +7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635 2.inp +258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870 3.inp +4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488 4.inp +46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82 5.inp +7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2 6.inp +4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d 7.inp +d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126 8.inp diff --git a/sbin/md5/tests/skein512.digest b/sbin/md5/tests/skein512.digest new file mode 100644 index 000000000000..6b2e9ad0f723 --- /dev/null +++ b/sbin/md5/tests/skein512.digest @@ -0,0 +1,8 @@ +Skein512 (1.inp) = bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a +Skein512 (2.inp) = b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce +Skein512 (3.inp) = 8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75 +Skein512 (4.inp) = 15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc +Skein512 (5.inp) = 23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c +Skein512 (6.inp) = 0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c +Skein512 (7.inp) = 2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce +Skein512 (8.inp) = 1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125 diff --git a/sbin/md5/tests/skein512sum.digest b/sbin/md5/tests/skein512sum.digest new file mode 100644 index 000000000000..3ee9b67038ad --- /dev/null +++ b/sbin/md5/tests/skein512sum.digest @@ -0,0 +1,8 @@ +bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a 1.inp +b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce 2.inp +8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75 3.inp +15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc 4.inp +23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c 5.inp +0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c 6.inp +2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce 7.inp +1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125 8.inp From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:38:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7770665C967; Tue, 6 Jul 2021 15:38:48 +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 4GK6Cr2xx5z3h01; Tue, 6 Jul 2021 15:38:48 +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 498301C159; Tue, 6 Jul 2021 15:38: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 166FcmOw065467; Tue, 6 Jul 2021 15:38:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166FcmPq065466; Tue, 6 Jul 2021 15:38:48 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:38:48 GMT Message-Id: <202107061538.166FcmPq065466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 5f13ee9179e1 - stable/12 - md5: Create md5sum, etc compatible programs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5f13ee9179e15702129d5ea330c599ae9a3b871f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:38:48 -0000 The branch stable/12 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=5f13ee9179e15702129d5ea330c599ae9a3b871f commit 5f13ee9179e15702129d5ea330c599ae9a3b871f Author: Warner Losh AuthorDate: 2021-05-19 17:26:20 +0000 Commit: Stefan Eßer CommitDate: 2021-07-06 15:37:24 +0000 md5: Create md5sum, etc compatible programs On Linux, there's a similar set of programs to ours, but that end in the letters 'sum'. These act basically like FreeBSD versions run with the -r option. Add code so that when the program ends in 'sum' you get the linux -r behavior. This is enough to make most things that use sha*sum work correctly (the -c / --check options, as well as the long args are not implemented). When running with the -sum programs, ignore -t instead of running internal speed tests and make -c an error. Reviewed by: sef, and kp and allanjude (earlier version) Relnotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30309 --- sbin/md5/Makefile | 30 ++++++++++++++++++++++++++---- sbin/md5/md5.1 | 32 +++++++++++++++++++++++++++++++- sbin/md5/md5.c | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index 6e29d94eb92a..e499967d23d5 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -4,27 +4,49 @@ PACKAGE=runtime PROG= md5 -LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ +LINKS= ${BINDIR}/md5 ${BINDIR}/md5sum \ + ${BINDIR}/md5 ${BINDIR}/rmd160 \ + ${BINDIR}/md5 ${BINDIR}/rmd160sum \ ${BINDIR}/md5 ${BINDIR}/sha1 \ + ${BINDIR}/md5 ${BINDIR}/sha1sum \ ${BINDIR}/md5 ${BINDIR}/sha224 \ + ${BINDIR}/md5 ${BINDIR}/sha224sum \ ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha256sum \ ${BINDIR}/md5 ${BINDIR}/sha384 \ + ${BINDIR}/md5 ${BINDIR}/sha384sum \ ${BINDIR}/md5 ${BINDIR}/sha512 \ + ${BINDIR}/md5 ${BINDIR}/sha512sum \ ${BINDIR}/md5 ${BINDIR}/sha512t256 \ + ${BINDIR}/md5 ${BINDIR}/sha512t256sum \ ${BINDIR}/md5 ${BINDIR}/skein256 \ + ${BINDIR}/md5 ${BINDIR}/skein256sum \ ${BINDIR}/md5 ${BINDIR}/skein512 \ - ${BINDIR}/md5 ${BINDIR}/skein1024 + ${BINDIR}/md5 ${BINDIR}/skein512sum \ + ${BINDIR}/md5 ${BINDIR}/skein1024 \ + ${BINDIR}/md5 ${BINDIR}/skein1024sum -MLINKS= md5.1 rmd160.1 \ +MLINKS= md5.1 md5sum.1 \ + md5.1 rmd160.1 \ + md5.1 rmd160sum.1 \ md5.1 sha1.1 \ + md5.1 sha1sum.1 \ md5.1 sha224.1 \ + md5.1 sha224sum.1 \ md5.1 sha256.1 \ + md5.1 sha256sum.1 \ md5.1 sha384.1 \ + md5.1 sha384sum.1 \ md5.1 sha512.1 \ + md5.1 sha512sum.1 \ md5.1 sha512t256.1 \ + md5.1 sha512t256sum.1 \ md5.1 skein256.1 \ + md5.1 skein256sum.1 \ md5.1 skein512.1 \ - md5.1 skein1024.1 + md5.1 skein512sum.1 \ + md5.1 skein1024.1 \ + md5.1 skein1024sum.1 LIBADD= md diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index 1cf0db333b74..af4e606b62e7 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -4,7 +4,9 @@ .Os .Sh NAME .Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , -.Nm skein256 , skein512 , skein1024 +.Nm skein256 , skein512 , skein1024 , +.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , +.Nm sha512t256sum , rmd160sum , skein256sum , skein512sum , skein1024sum .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm @@ -26,6 +28,15 @@ output a or .Dq message digest of the input. +The +.Nm md5sum , sha1sum , sha224sum , sha256sum , sha384sum , sha512sum , +.Nm sha512t256sum , rmd160sum , skein256sum , skein512sum , +and +.Nm skein1024sum +utilities do the same, but default to the reversed format of +the +.Fl r +flag. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. @@ -73,9 +84,18 @@ precede any files named on the command line. The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl b +Ignored for compatibility with the coreutils +.Nm -sum +programs. .It Fl c Ar string Compare the digest of the file against this string. .Pq Note that this option is not yet useful if multiple files are specified. +This option causes an error in for the +.Nm -sum +programs because it check the checksums listed in a file for the coreutils +.Nm -sum +programs that is not yet implemented. .It Fl s Ar string Print a checksum of the given .Ar string . @@ -95,6 +115,9 @@ when combined with the options. .It Fl t Run a built-in time trial. +For the +.Nm -sum +versions, this is a nop for compatibility with coreutils. .It Fl x Run a built-in test script. .El @@ -144,6 +167,13 @@ Secure Hash Standard (SHS): .Pp The RIPEMD-160 page: .Pa http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html . +.Sh BUGS +All of the utilities that end in +.Sq sum +are intended to be compatible with the GNU coreutils programs. +However, the long arguments and the +.Fl -check +functionality are not provided. .Sh ACKNOWLEDGMENTS This program is placed in the public domain for free general use by RSA Data Security. diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 96dfcede9711..4381ef124c7b 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -177,13 +177,32 @@ main(int argc, char *argv[]) char buf[HEX_DIGEST_LENGTH]; size_t len; unsigned digest; - const char* progname; + char *progname; + bool gnu_emu = false; if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else progname++; + /* + * GNU coreutils has a number of programs named *sum. These produce + * similar results to the BSD version, but in a different format, + * similar to BSD's -r flag. We install links to this program with + * ending 'sum' to provide this compatibility. Check here to see if the + * name of the program ends in 'sum', set the flag and drop the 'sum' so + * the digest lookup works. Also, make -t a nop when running in this mode + * since that means 'text file' there (though it's a nop in coreutils + * on unix-like systems). The -c flag conflicts, so it's just disabled + * in this mode (though in the future it might be implemented). + */ + len = strlen(progname); + if (len > 3 && strcmp(progname + len - 3, "sum") == 0) { + progname[len - 3] = '\0'; + rflag = 1; + gnu_emu = true; + } + for (digest = 0; digest < sizeof(Algorithm)/sizeof(*Algorithm); digest++) if (strcasecmp(Algorithm[digest].progname, progname) == 0) break; @@ -195,9 +214,13 @@ main(int argc, char *argv[]) checkAgainst = NULL; checksFailed = 0; skip = 0; - while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) + while ((ch = getopt(argc, argv, "bc:pqrs:tx")) != -1) switch (ch) { + case 'b': + break; case 'c': + if (gnu_emu) + errx(1, "-c check option not supported"); checkAgainst = optarg; break; case 'p': @@ -214,8 +237,10 @@ main(int argc, char *argv[]) string = optarg; break; case 't': - MDTimeTrial(&Algorithm[digest]); - skip = 1; + if (!gnu_emu) { + MDTimeTrial(&Algorithm[digest]); + skip = 1; + } /* else: text mode is a nop */ break; case 'x': MDTestSuite(&Algorithm[digest]); @@ -348,7 +373,7 @@ MDTimeTrial(const Algorithm_t *alg) printf(" done\n"); printf("Digest = %s", p); printf("\nTime = %f seconds\n", seconds); - printf("Speed = %f MiB/second\n", (float) TEST_BLOCK_LEN * + printf("Speed = %f MiB/second\n", (float) TEST_BLOCK_LEN * (float) TEST_BLOCK_COUNT / seconds / (1 << 20)); } /* From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:38:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9A13865CC93; Tue, 6 Jul 2021 15:38: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 4GK6Cs3dLTz3h55; Tue, 6 Jul 2021 15:38: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 61BA01C500; Tue, 6 Jul 2021 15:38: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 166FcnHO065499; Tue, 6 Jul 2021 15:38:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166FcnVo065498; Tue, 6 Jul 2021 15:38:49 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:38:49 GMT Message-Id: <202107061538.166FcnVo065498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 04beb393e366 - stable/12 - md5: portability fix -- include stdbool.h explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 04beb393e36691f415fbaf1746d4b981784ab734 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:38:49 -0000 The branch stable/12 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=04beb393e36691f415fbaf1746d4b981784ab734 commit 04beb393e36691f415fbaf1746d4b981784ab734 Author: Warner Losh AuthorDate: 2021-05-20 17:26:46 +0000 Commit: Stefan Eßer CommitDate: 2021-07-06 15:38:03 +0000 md5: portability fix -- include stdbool.h explicitly stdbool.h needs to be included to use type bool variables. Due to namespace pollution, this gets brought in on FreeBSD, but not on other systems. Include it explicilty. Noticed by: arichards@ Sponsored by: Netflix --- sbin/md5/md5.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 4381ef124c7b..e553d4c56e85 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:47:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E6D865CAEF; Tue, 6 Jul 2021 15:47:27 +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 4GK6Pq0nDzz3hs1; Tue, 6 Jul 2021 15:47:27 +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 02D9E1C5C0; Tue, 6 Jul 2021 15:47:27 +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 166FlQAR078704; Tue, 6 Jul 2021 15:47:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166FlQsD078703; Tue, 6 Jul 2021 15:47:26 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:47:26 GMT Message-Id: <202107061547.166FlQsD078703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: b7c17fd730ca - stable/12 - sbin/md5: add md5sum to synopsis in the man-page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b7c17fd730ca4e8806a506b617ad32218aa0b826 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:47:27 -0000 The branch stable/12 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=b7c17fd730ca4e8806a506b617ad32218aa0b826 commit b7c17fd730ca4e8806a506b617ad32218aa0b826 Author: Stefan Eßer AuthorDate: 2021-06-19 11:27:16 +0000 Commit: Stefan Eßer CommitDate: 2021-07-06 15:44:14 +0000 sbin/md5: add md5sum to synopsis in the man-page When invoked with "sum" following the hash name, the -c option takes a file argument, not a string argument. (cherry picked from commit 84f35b6f86efd004a8f25ef6eecea0f5d02733c4) sbin/md5: improve compatibility with coreutils -c option The -c option expects a digest file in either BSD or coreutils format. The output for matched and mismatched files is identical to that of the coreutils version. The review of these changes included test cases that have already been committed for the functionality that existed before. Another test script is added to cover the coreutils compatible extension implemented by this patch. This commit contains a tests/Makefile that has been cleaned up compared to the review version, using an implicit rule to apply the TESTBASE path at build time (and the scripts have been renamed to have an extension of .SH instead of .sh to trigger this rule). Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30812 (cherry picked from commit b33d1898c1b0e6d76b52eb48078260588802dc95) md5: Improve compatibility with coreutils and format fix The previous changes that added support for the coreutils -c option modified the output generated by passing -r to match that of the coreutils versions. The difference is that coreutils separates the hash from the file name by two blanks " " (or a blank followed by an asterisk " *" with the -b option denoting). While most scripts or users will not notice the difference, it might be considered a violation of POLA and this commit reverts the change for the non-sum programs. These will print a single blank " " as the separator, as they die before the previous commit. In order to still generate output that is identical to that of the coreutils programs, this commit generates the " " or " *" separator used by them for the -sum versions, depending on the presence of the -b option. (cherry picked from commit b33d1898c1b0e6d76b52eb48078260588802dc95) md5: Fix cross-build after c2870e576bd2 On macOS and Linux the current set of headers do not end up pulling in sys/param.h, causing MAXPATHLEN to not be defined and the build to fail. (cherry picked from commit cab31e0e216c7defefd4aba14693ba2252ea7308) --- sbin/md5/md5.1 | 114 ++++++++++++++++++++++--- sbin/md5/md5.c | 171 ++++++++++++++++++++++++++++++++----- sbin/md5/tests/Makefile | 1 + sbin/md5/tests/coreutils-c-test.SH | 21 +++++ 4 files changed, 274 insertions(+), 33 deletions(-) diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index af4e606b62e7..f91e0b759dc7 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -15,6 +15,12 @@ .Op Fl s Ar string .Op Ar .Pp +.Nm md5sum +.Op Fl pqrtx +.Op Fl c Ar file +.Op Fl s Ar string +.Op Ar +.Pp (All other hashes have the same options and usage.) .Sh DESCRIPTION The @@ -85,17 +91,34 @@ The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent .It Fl b -Ignored for compatibility with the coreutils +Make the .Nm -sum -programs. +programs separate hash and digest with a blank followed by an asterisk instead +of by 2 blank characters for full compatibility with the output generated by the +coreutils versions of these programs. .It Fl c Ar string -Compare the digest of the file against this string. +If the program was called with a name that does not end in +.Nm sum , +compare the digest of the file against this string. .Pq Note that this option is not yet useful if multiple files are specified. -This option causes an error in for the -.Nm -sum -programs because it check the checksums listed in a file for the coreutils -.Nm -sum -programs that is not yet implemented. +.It Fl c Ar file +If the program was called with a name that does end in +.Nm sum , +the file passed as argument must contain digest lines generated by the same +digest algorithm with or without the +.Fl r +option +.Pq i.e. in either classical BSD format or in GNU coreutils format . +A line with the file name followed by a colon +.Dq ":" +and either OK or FAILED is written for each well-formed line in the digest file. +If applicable, the number of failed comparisons and the number of lines that were +skipped since they were not well-formed are printed at the end. +The +.Fl q +option can be used to quiesce the output unless there are mismatched entries in +the digest. +.Pp .It Fl s Ar string Print a checksum of the given .Ar string . @@ -132,6 +155,77 @@ utilities exit 0 on success, and 2 if at least one file does not have the same hash as the .Fl c option. +<<<<<<< HEAD +======= +.Sh EXAMPLES +Calculate the MD5 checksum of the string +.Dq Hello . +.Bd -literal -offset indent +$ md5 -s Hello +MD5 ("Hello") = 8b1a9953c4611296a827abf8c47804d7 +.Ed +.Pp +Same as above, but note the absence of the newline character in the input +string: +.Bd -literal -offset indent +$ echo -n Hello | md5 +8b1a9953c4611296a827abf8c47804d7 +.Ed +.Pp +Calculate the checksum of multiple files reversing the output: +.Bd -literal -offset indent +$ md5 -r /boot/loader.conf /etc/rc.conf +ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf +d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf +.Pd +The +.Nm -sum +variants put 2 blank characters between hash and file name for full compatibilty +with the coreutils versions of these commands. +.Ed +.Pp +Write the digest for +.Pa /boot/loader.conf +in a file named +.Pa digest . +Then calculate the checksum again and validate it against the checksum string +extracted from the +.Pa digest +file: +.Bd -literal -offset indent +$ md5 /boot/loader.conf > digest && md5 -c $(cut -f2 -d= digest) /boot/loader.conf +MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 +.Ed +.Pp +Same as above but comparing the digest against an invalid string +.Pq Dq randomstring , +which results in a failure. +.Bd -literal -offset indent +$ md5 -c randomstring /boot/loader.conf +MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ] +.Ed +.Pp +If invoked with a name ending in +.Nm -sum +the +.Fl c +option does not compare against a hash string passed as parameter. +Instead, it expects a digest file, as created under the name +.Pa digest +for +.Pa /boot/loader.conf +in the example above. +.Bd -literal -offset indent +$ md5 -c digest /boot/loader.conf +/boot/loader.conf: OK +.Ed +.Pp +The digest file may contain any number of lines in the format generated with or without the +.Fl r +option +.Pq i.e. in either classical BSD format or in GNU coreutils format . +If a hash value does not match the file, FAILED is printed instead of OK. +>>>>>>> c2870e576bd2 (sbin/md5: improve compatibility with coreutils -c option) .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , @@ -171,9 +265,7 @@ The RIPEMD-160 page: All of the utilities that end in .Sq sum are intended to be compatible with the GNU coreutils programs. -However, the long arguments and the -.Fl -check -functionality are not provided. +However, the long option functionality is not provided. .Sh ACKNOWLEDGMENTS This program is placed in the public domain for free general use by RSA Data Security. diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index e553d4c56e85..7235e6e0a39f 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -21,6 +21,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -53,6 +54,8 @@ __FBSDID("$FreeBSD$"); #define TEST_BLOCK_COUNT 100000 #define MDTESTCOUNT 8 +static int bflag; +static int cflag; static int pflag; static int qflag; static int rflag; @@ -152,12 +155,93 @@ static const struct Algorithm_t Algorithm[] = { (DIGEST_End*)&SKEIN1024_End, &SKEIN1024_Data, &SKEIN1024_Fd } }; +static unsigned digest; +static unsigned malformed; +static bool gnu_emu = false; + static void MD5_Update(MD5_CTX *c, const unsigned char *data, size_t len) { MD5Update(c, data, len); } +struct chksumrec { + char *filename; + char *chksum; + struct chksumrec *next; +}; + +static struct chksumrec *head = NULL; +static struct chksumrec **next = &head; + +#define PADDING 7 /* extra padding for "SHA512t256 (...) = ...\n" style */ +#define CHKFILELINELEN (HEX_DIGEST_LENGTH + MAXPATHLEN + PADDING) + +static int gnu_check(const char *checksumsfile) +{ + FILE *inp; + char linebuf[CHKFILELINELEN]; + int linelen; + int lineno; + char *filename; + char *hashstr; + struct chksumrec *rec; + const char *digestname; + int digestnamelen; + int hashstrlen; + + if ((inp = fopen(checksumsfile, "r")) == NULL) + err(1, "%s", checksumsfile); + digestname = Algorithm[digest].name; + digestnamelen = strlen(digestname); + hashstrlen = strlen(*(Algorithm[digest].TestOutput[0])); + lineno = 1; + while (fgets(linebuf, sizeof(linebuf), inp) != NULL) { + linelen = strlen(linebuf) - 1; + if (linelen <= 0) + break; + if (linebuf[linelen] != '\n') + errx(1, "malformed input line %d (len=%d)", lineno, linelen); + linebuf[linelen] = '\0'; + filename = linebuf + digestnamelen + 2; + hashstr = linebuf + linelen - hashstrlen; + /* + * supported formats: + * BSD: (): + * GNU: [ *] + */ + if (linelen >= digestnamelen + hashstrlen + 6 && + strncmp(linebuf, digestname, digestnamelen) == 0 && + strncmp(filename - 2, " (", 2) == 0 && + strncmp(hashstr - 4, ") = ", 4) == 0) { + *(hashstr - 4) = '\0'; + } else if (linelen >= hashstrlen + 3 && + linebuf[hashstrlen] == ' ') { + linebuf[hashstrlen] = '\0'; + hashstr = linebuf; + filename = linebuf + hashstrlen + 1; + if (*filename == ' ' || *filename == '*') + filename++; + } else { + malformed++; + continue; + } + rec = malloc(sizeof (*rec)); + if (rec == NULL) + errx(1, "malloc failed"); + rec->chksum = strdup(hashstr); + rec->filename = strdup(filename); + if (rec->chksum == NULL || rec->filename == NULL) + errx(1, "malloc failed"); + rec->next = NULL; + *next = rec; + next = &rec->next; + lineno++; + } + fclose(inp); + return (lineno - 1); +} + /* Main driver. Arguments (may be any combination): @@ -177,9 +261,9 @@ main(int argc, char *argv[]) char *p, *string; char buf[HEX_DIGEST_LENGTH]; size_t len; - unsigned digest; char *progname; - bool gnu_emu = false; + struct chksumrec *rec; + int numrecs; if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; @@ -199,13 +283,13 @@ main(int argc, char *argv[]) */ len = strlen(progname); if (len > 3 && strcmp(progname + len - 3, "sum") == 0) { - progname[len - 3] = '\0'; + len -= 3; rflag = 1; gnu_emu = true; } for (digest = 0; digest < sizeof(Algorithm)/sizeof(*Algorithm); digest++) - if (strcasecmp(Algorithm[digest].progname, progname) == 0) + if (strncasecmp(Algorithm[digest].progname, progname, len) == 0) break; if (digest == sizeof(Algorithm)/sizeof(*Algorithm)) @@ -218,11 +302,14 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "bc:pqrs:tx")) != -1) switch (ch) { case 'b': + bflag = 1; break; case 'c': + cflag = 1; if (gnu_emu) - errx(1, "-c check option not supported"); - checkAgainst = optarg; + numrecs = gnu_check(optarg); + else + checkAgainst = optarg; break; case 'p': pflag = 1; @@ -258,6 +345,20 @@ main(int argc, char *argv[]) err(1, "unable to limit rights for stdio"); #endif + if (cflag && gnu_emu) { + /* + * Replace argv by an array of filenames from the digest file + */ + argc = 0; + argv = (char**)calloc(sizeof(char *), numrecs + 1); + for (rec = head; rec != NULL; rec = rec->next) { + argv[argc] = rec->filename; + argc++; + } + argv[argc] = NULL; + rec = head; + } + if (*argv) { do { if ((fd = open(*argv, O_RDONLY)) < 0) { @@ -279,11 +380,15 @@ main(int argc, char *argv[]) err(1, "capsicum"); #endif } + if (cflag && gnu_emu) { + checkAgainst = rec->chksum; + rec = rec->next; + } p = Algorithm[digest].Fd(fd, buf); (void)close(fd); MDOutput(&Algorithm[digest], p, argv); } while (*++argv); - } else if (!sflag && !skip) { + } else if (!cflag && !sflag && !skip) { #ifdef HAVE_CAPSICUM if (caph_limit_stdin() < 0 || caph_enter() < 0) err(1, "capsicum"); @@ -295,7 +400,12 @@ main(int argc, char *argv[]) p = Algorithm[digest].Data(string, len, buf); MDOutput(&Algorithm[digest], p, &string); } - + if (gnu_emu) { + if (malformed > 0) + warnx("WARNING: %d lines are improperly formatted", malformed); + if (checksFailed > 0) + warnx("WARNING: %d computed checksums did NOT match", checksFailed); + } if (failed != 0) return (1); if (checksFailed != 0) @@ -310,6 +420,8 @@ main(int argc, char *argv[]) static void MDOutput(const Algorithm_t *alg, char *p, char *argv[]) { + bool checkfailed = false; + if (p == NULL) { warn("%s", *argv); failed++; @@ -318,21 +430,33 @@ MDOutput(const Algorithm_t *alg, char *p, char *argv[]) * If argv is NULL we are reading from stdin, where the output * format has always been just the hash. */ - if (qflag || argv == NULL) - printf("%s", p); - else if (rflag) - printf("%s %s", p, *argv); - else - printf("%s (%s) = %s", - alg->name, *argv, p); - if (checkAgainst && strcasecmp(checkAgainst, p) != 0) - { - checksFailed++; - if (!qflag) - printf(" [ Failed ]"); + if (cflag && gnu_emu) { + checkfailed = strcasecmp(checkAgainst, p) != 0; + if (!qflag || checkfailed) + printf("%s: %s\n", *argv, checkfailed ? "FAILED" : "OK"); + } else if (qflag || argv == NULL) { + printf("%s\n", p); + } else { + if (rflag) + if (gnu_emu) + if (bflag) + printf("%s *%s", p, *argv); + else + printf("%s %s", p, *argv); + else + printf("%s %s", p, *argv); + else + printf("%s (%s) = %s", alg->name, *argv, p); + if (checkAgainst) { + checkfailed = strcasecmp(checkAgainst, p) != 0; + if (!qflag && checkfailed) + printf(" [ Failed ]"); + } + printf("\n"); } - printf("\n"); } + if (checkfailed) + checksFailed++; } /* @@ -559,6 +683,9 @@ static void usage(const Algorithm_t *alg) { - fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname); + if (gnu_emu) + fprintf(stderr, "usage: %ssum [-pqrtx] [-c file] [-s string] [files ...]\n", alg->progname); + else + fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname); exit(1); } diff --git a/sbin/md5/tests/Makefile b/sbin/md5/tests/Makefile index b37332aa9894..93f3913c687d 100644 --- a/sbin/md5/tests/Makefile +++ b/sbin/md5/tests/Makefile @@ -32,6 +32,7 @@ PLAIN_TESTS_SH+= self-test PLAIN_TESTS_SH+= bsd-c-test PLAIN_TESTS_SH+= bsd-p-test PLAIN_TESTS_SH+= bsd-s-test +PLAIN_TESTS_SH+= coreutils-c-test .SUFFIXES: .SH diff --git a/sbin/md5/tests/coreutils-c-test.SH b/sbin/md5/tests/coreutils-c-test.SH new file mode 100644 index 000000000000..5996e533c627 --- /dev/null +++ b/sbin/md5/tests/coreutils-c-test.SH @@ -0,0 +1,21 @@ +#!/bin/sh + +/bin/cp %%TESTSBASE%%/sbin/md5/*.inp . || exit 127 + +exitcode=0 + +testloop () { + opt=$1 + + while read algorithm; do + ${algorithm}sum -c %%TESTSBASE%%/sbin/md5/${algorithm}.digest || exitcode=1 + ${algorithm}sum -c %%TESTSBASE%%/sbin/md5/${algorithm}sum.digest || exitcode=1 + done < %%TESTSBASE%%/sbin/md5/algorithms.txt +} + +testloop "" +testloop -q +testloop -r +testloop -qr + +exit $exitcode From owner-dev-commits-src-all@freebsd.org Tue Jul 6 15:48:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 778EE65CDA8; Tue, 6 Jul 2021 15:48:02 +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 4GK6QV30KDz3hmg; Tue, 6 Jul 2021 15:48: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 4F8201C671; Tue, 6 Jul 2021 15:48:02 +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 166Fm2cZ078878; Tue, 6 Jul 2021 15:48:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166Fm2ol078877; Tue, 6 Jul 2021 15:48:02 GMT (envelope-from git) Date: Tue, 6 Jul 2021 15:48:02 GMT Message-Id: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 15:48:02 -0000 The branch main has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 Author: Ram Kishore Vegesna AuthorDate: 2021-06-24 07:05:00 +0000 Commit: Ram Kishore Vegesna CommitDate: 2021-07-06 15:38:11 +0000 ocs_fc: Add gendump and dump_to_host ioctl command support. Support to generate firmware dump. Approved by: mav(mentor) --- sys/dev/ocs_fc/ocs_gendump.c | 388 +++++++++++++++++++++++++++++++++++++++++++ sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ sys/dev/ocs_fc/ocs_ioctl.c | 13 +- sys/dev/ocs_fc/ocs_ioctl.h | 3 + sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- sys/dev/ocs_fc/ocs_os.c | 3 +- sys/dev/ocs_fc/ocs_os.h | 3 +- sys/modules/ocs_fc/Makefile | 3 +- 8 files changed, 449 insertions(+), 158 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_gendump.c b/sys/dev/ocs_fc/ocs_gendump.c new file mode 100644 index 000000000000..d24870f39668 --- /dev/null +++ b/sys/dev/ocs_fc/ocs_gendump.c @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2021 Broadcom. All rights reserved. + * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE 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 HOLDER 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 "ocs.h" +#include "ocs_gendump.h" + +/* Reset all the functions associated with a bus/dev */ +static int +ocs_gen_dump_reset(uint8_t bus, uint8_t dev) +{ + uint32_t index = 0; + ocs_t *ocs; + int rc = 0; + + while ((ocs = ocs_get_instance(index++)) != NULL) { + uint8_t ocs_bus, ocs_dev, ocs_func; + ocs_domain_t *domain; + + ocs_get_bus_dev_func(ocs, &ocs_bus, &ocs_dev, &ocs_func); + + if (!(ocs_bus == bus && ocs_dev == dev)) + continue; + + if (ocs_hw_reset(&ocs->hw, OCS_HW_RESET_FUNCTION)) { + ocs_log_test(ocs, "failed to reset port\n"); + rc = -1; + continue; + } + + ocs_log_debug(ocs, "successfully reset port\n"); + while ((domain = ocs_list_get_head(&ocs->domain_list)) != NULL) { + ocs_log_debug(ocs, "free domain %p\n", domain); + ocs_domain_force_free(domain); + } + /* now initialize hw so user can read the dump in */ + if (ocs_hw_init(&ocs->hw)) { + ocs_log_err(ocs, "failed to initialize hw\n"); + rc = -1; + } else { + ocs_log_debug(ocs, "successfully initialized hw\n"); + } + } + return rc; +} + +int +ocs_gen_dump(ocs_t *ocs) +{ + uint32_t reset_required; + uint32_t dump_ready; + uint32_t ms_waited; + uint8_t bus, dev, func; + int rc = 0; + int index = 0, port_index = 0; + ocs_t *nxt_ocs; + uint8_t nxt_bus, nxt_dev, nxt_func; + uint8_t prev_port_state[OCS_MAX_HBA_PORTS] = {0,}; + ocs_xport_stats_t link_status; + + ocs_get_bus_dev_func(ocs, &bus, &dev, &func); + + /* Drop link on all ports belongs to this HBA*/ + while ((nxt_ocs = ocs_get_instance(index++)) != NULL) { + ocs_get_bus_dev_func(nxt_ocs, &nxt_bus, &nxt_dev, &nxt_func); + + if (!(bus == nxt_bus && dev == nxt_dev)) + continue; + + if ((port_index >= OCS_MAX_HBA_PORTS)) + continue; + + /* Check current link status and save for future use */ + if (ocs_xport_status(nxt_ocs->xport, OCS_XPORT_PORT_STATUS, + &link_status) == 0) { + if (link_status.value == OCS_XPORT_PORT_ONLINE) { + prev_port_state[port_index] = 1; + ocs_xport_control(nxt_ocs->xport, + OCS_XPORT_PORT_OFFLINE); + } else { + prev_port_state[port_index] = 0; + } + } + port_index++; + } + + /* Wait until all ports have quiesced */ + for (index = 0; (nxt_ocs = ocs_get_instance(index++)) != NULL; ) { + ms_waited = 0; + for (;;) { + ocs_xport_stats_t status; + + ocs_xport_status(nxt_ocs->xport, OCS_XPORT_IS_QUIESCED, + &status); + if (status.value) { + ocs_log_debug(nxt_ocs, "port quiesced\n"); + break; + } + + ocs_msleep(10); + ms_waited += 10; + if (ms_waited > 60000) { + ocs_log_test(nxt_ocs, + "timed out waiting for port to quiesce\n"); + break; + } + } + } + + /* Initiate dump */ + if (ocs_hw_raise_ue(&ocs->hw, 1) == OCS_HW_RTN_SUCCESS) { + + /* Wait for dump to complete */ + ocs_log_debug(ocs, "Dump requested, wait for completion.\n"); + + dump_ready = 0; + ms_waited = 0; + while ((!dump_ready) && (ms_waited < 30000)) { + ocs_hw_get(&ocs->hw, OCS_HW_DUMP_READY, &dump_ready); + ocs_udelay(10000); + ms_waited += 10; + } + + if (!dump_ready) { + ocs_log_test(ocs, "Failed to see dump after 30 secs\n"); + rc = -1; + } else { + ocs_log_debug(ocs, "sucessfully generated dump\n"); + } + + /* now reset port */ + ocs_hw_get(&ocs->hw, OCS_HW_RESET_REQUIRED, &reset_required); + ocs_log_debug(ocs, "reset required=%d\n", reset_required); + if (reset_required) { + if (ocs_gen_dump_reset(bus, dev) == 0) { + ocs_log_debug(ocs, "all devices reset\n"); + } else { + ocs_log_test(ocs, "all devices NOT reset\n"); + } + } + } else { + ocs_log_test(ocs, "dump request to hw failed\n"); + rc = -1; + } + + index = port_index = 0; + nxt_ocs = NULL; + /* Bring links on each HBA port to previous state*/ + while ((nxt_ocs = ocs_get_instance(index++)) != NULL) { + ocs_get_bus_dev_func(nxt_ocs, &nxt_bus, &nxt_dev, &nxt_func); + if (port_index > OCS_MAX_HBA_PORTS) { + ocs_log_err(NULL, "port index(%d) out of boundary\n", + port_index); + rc = -1; + break; + } + if ((bus == nxt_bus) && (dev == nxt_dev) && + prev_port_state[port_index++]) { + ocs_xport_control(nxt_ocs->xport, OCS_XPORT_PORT_ONLINE); + } + } + + return rc; +} + +int +ocs_fdb_dump(ocs_t *ocs) +{ + uint32_t dump_ready; + uint32_t ms_waited; + int rc = 0; + +#define FDB 2 + + /* Initiate dump */ + if (ocs_hw_raise_ue(&ocs->hw, FDB) == OCS_HW_RTN_SUCCESS) { + + /* Wait for dump to complete */ + ocs_log_debug(ocs, "Dump requested, wait for completion.\n"); + + dump_ready = 0; + ms_waited = 0; + while ((!(dump_ready == FDB)) && (ms_waited < 10000)) { + ocs_hw_get(&ocs->hw, OCS_HW_DUMP_READY, &dump_ready); + ocs_udelay(10000); + ms_waited += 10; + } + + if (!dump_ready) { + ocs_log_err(ocs, "Failed to see dump after 10 secs\n"); + return -1; + } + + ocs_log_debug(ocs, "sucessfully generated dump\n"); + + } else { + ocs_log_err(ocs, "dump request to hw failed\n"); + rc = -1; + } + + return rc; +} + +/** + * @brief Create a Lancer dump into a memory buffer + * @par Description + * This function creates a DMA buffer to hold a Lancer dump, + * sets the dump location to point to that buffer, then calls + * ocs_gen_dump to cause a dump to be transfered to the buffer. + * After the dump is complete it copies the dump to the provided + * user space buffer. + * + * @param ocs Pointer to ocs structure + * @param buf User space buffer in which to store the dump + * @param buflen Length of the user buffer in bytes + * + * @return Returns 0 on success, non-zero on error. + */ +int +ocs_dump_to_host(ocs_t *ocs, void *buf, uint32_t buflen) +{ + int rc; + uint32_t i, num_buffers; + ocs_dma_t *dump_buffers; + uint32_t rem_bytes, offset; + + if (buflen == 0) { + ocs_log_test(ocs, "zero buffer length is invalid\n"); + return -1; + } + + num_buffers = ((buflen + OCS_MAX_DMA_ALLOC - 1) / OCS_MAX_DMA_ALLOC); + + dump_buffers = ocs_malloc(ocs, sizeof(ocs_dma_t) * num_buffers, + OCS_M_ZERO | OCS_M_NOWAIT); + if (dump_buffers == NULL) { + ocs_log_err(ocs, "Failed to dump buffers\n"); + return -1; + } + + /* Allocate a DMA buffers to hold the dump */ + rem_bytes = buflen; + for (i = 0; i < num_buffers; i++) { + uint32_t num_bytes = MIN(rem_bytes, OCS_MAX_DMA_ALLOC); + + rc = ocs_dma_alloc(ocs, &dump_buffers[i], num_bytes, + OCS_MIN_DMA_ALIGNMENT); + if (rc) { + ocs_log_err(ocs, "Failed to allocate dump buffer\n"); + + /* Free any previously allocated buffers */ + goto free_and_return; + } + rem_bytes -= num_bytes; + } + + rc = ocs_hw_set_dump_location(&ocs->hw, num_buffers, dump_buffers, 0); + if (rc) { + ocs_log_test(ocs, "ocs_hw_set_dump_location failed\n"); + goto free_and_return; + } + + /* Generate the dump */ + rc = ocs_gen_dump(ocs); + if (rc) { + ocs_log_test(ocs, "ocs_gen_dump failed\n"); + goto free_and_return; + } + + /* Copy the dump from the DMA buffer into the user buffer */ + offset = 0; + for (i = 0; i < num_buffers; i++) { + if (ocs_copy_to_user((uint8_t*)buf + offset, + dump_buffers[i].virt, dump_buffers[i].size)) { + ocs_log_test(ocs, "ocs_copy_to_user failed\n"); + rc = -1; + } + offset += dump_buffers[i].size; + } + +free_and_return: + /* Free the DMA buffer and return */ + for (i = 0; i < num_buffers; i++) { + ocs_dma_free(ocs, &dump_buffers[i]); + } + ocs_free(ocs, dump_buffers, sizeof(ocs_dma_t) * num_buffers); + return rc; +} + +int +ocs_function_speciic_dump(ocs_t *ocs, void *buf, uint32_t buflen) +{ + int rc; + uint32_t i, num_buffers; + ocs_dma_t *dump_buffers; + uint32_t rem_bytes, offset; + + if (buflen == 0) { + ocs_log_err(ocs, "zero buffer length is invalid\n"); + return -1; + } + + num_buffers = ((buflen + OCS_MAX_DMA_ALLOC - 1) / OCS_MAX_DMA_ALLOC); + + dump_buffers = ocs_malloc(ocs, sizeof(ocs_dma_t) * num_buffers, + OCS_M_ZERO | OCS_M_NOWAIT); + if (dump_buffers == NULL) { + ocs_log_err(ocs, "Failed to allocate dump buffers\n"); + return -1; + } + + /* Allocate a DMA buffers to hold the dump */ + rem_bytes = buflen; + for (i = 0; i < num_buffers; i++) { + uint32_t num_bytes = MIN(rem_bytes, OCS_MAX_DMA_ALLOC); + rc = ocs_dma_alloc(ocs, &dump_buffers[i], num_bytes, + OCS_MIN_DMA_ALIGNMENT); + if (rc) { + ocs_log_err(ocs, "Failed to allocate dma buffer\n"); + + /* Free any previously allocated buffers */ + goto free_and_return; + } + rem_bytes -= num_bytes; + } + + /* register buffers for function spcific dump */ + rc = ocs_hw_set_dump_location(&ocs->hw, num_buffers, dump_buffers, 1); + if (rc) { + ocs_log_err(ocs, "ocs_hw_set_dump_location failed\n"); + goto free_and_return; + } + + /* Invoke dump by setting fdd=1 and ip=1 in sliport_control register */ + rc = ocs_fdb_dump(ocs); + if (rc) { + ocs_log_err(ocs, "ocs_gen_dump failed\n"); + goto free_and_return; + } + + /* Copy the dump from the DMA buffer into the user buffer */ + offset = 0; + for (i = 0; i < num_buffers; i++) { + if (ocs_copy_to_user((uint8_t*)buf + offset, + dump_buffers[i].virt, dump_buffers[i].size)) { + ocs_log_err(ocs, "ocs_copy_to_user failed\n"); + rc = -1; + } + offset += dump_buffers[i].size; + } + +free_and_return: + /* Free the DMA buffer and return */ + for (i = 0; i < num_buffers; i++) { + ocs_dma_free(ocs, &dump_buffers[i]); + } + ocs_free(ocs, dump_buffers, sizeof(ocs_dma_t) * num_buffers); + return rc; + +} diff --git a/sys/dev/ocs_fc/ocs_gendump.h b/sys/dev/ocs_fc/ocs_gendump.h new file mode 100644 index 000000000000..2343003feef6 --- /dev/null +++ b/sys/dev/ocs_fc/ocs_gendump.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Broadcom. All rights reserved. + * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE 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 HOLDER 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. + * + */ + +#if !defined(__OCS_GENDUMP_H__) +#define __OCS_GENDUMP_H__ +extern int ocs_gen_dump(ocs_t *ocs); +extern int ocs_fdb_dump(ocs_t *ocs); +extern int ocs_dump_to_host(ocs_t *ocs, void *buf, uint32_t buflen); +extern int ocs_function_speciic_dump(ocs_t *ocs, void *buf, uint32_t buflen); + +#define OCS_MAX_HBA_PORTS 4 + +#endif // __OCS_GENDUMP_H__ diff --git a/sys/dev/ocs_fc/ocs_ioctl.c b/sys/dev/ocs_fc/ocs_ioctl.c index 13d80bd3edde..c0576bd6600f 100644 --- a/sys/dev/ocs_fc/ocs_ioctl.c +++ b/sys/dev/ocs_fc/ocs_ioctl.c @@ -60,22 +60,12 @@ ocs_firmware_write(ocs_t *ocs, const uint8_t *buf, size_t buf_len, uint8_t *chan static int ocs_open(struct cdev *cdev, int flags, int fmt, struct thread *td) { -#if 0 - struct ocs_softc *ocs = cdev->si_drv1; - - device_printf(ocs->dev, "%s\n", __func__); -#endif return 0; } static int ocs_close(struct cdev *cdev, int flag, int fmt, struct thread *td) { -#if 0 - struct ocs_softc *ocs = cdev->si_drv1; - - device_printf(ocs->dev, "%s\n", __func__); -#endif return 0; } @@ -95,7 +85,8 @@ __ocs_ioctl_mbox_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) } static int -ocs_process_sli_config (ocs_t *ocs, ocs_ioctl_elxu_mbox_t *mcmd, ocs_dma_t *dma){ +ocs_process_sli_config (ocs_t *ocs, ocs_ioctl_elxu_mbox_t *mcmd, ocs_dma_t *dma) +{ sli4_cmd_sli_config_t *sli_config = (sli4_cmd_sli_config_t *)mcmd->payload; if (sli_config->emb) { diff --git a/sys/dev/ocs_fc/ocs_ioctl.h b/sys/dev/ocs_fc/ocs_ioctl.h index ad2460d09b87..f2a291843d5a 100644 --- a/sys/dev/ocs_fc/ocs_ioctl.h +++ b/sys/dev/ocs_fc/ocs_ioctl.h @@ -303,18 +303,21 @@ typedef struct { typedef struct { uint8_t *name; /*<< Input: name of property to retrieve */ + uint16_t name_len; /*<< Input: Length of name */ uint8_t *value; /*<< Output: user space buffer in which to place the response */ uint32_t value_length; /*<< Input: size of the user space buffer */ } ocs_ioctl_cmd_get_t; typedef struct { uint8_t *name; /*<< Input: name of property to set */ + uint16_t name_len; /*<< Input: Length of name */ uint8_t *value; /*<< Input: user space buffer which contains the new value */ int32_t result; /*<< Output: result */ } ocs_ioctl_cmd_set_t; typedef struct { uint8_t *name; /*<< Input: name of action to execute */ + uint16_t name_len; /*<< Input: Length of name */ void *arg_in; /*<< Input: pointer to argument in user space */ uint32_t arg_in_length; /*<< Input: size of arg_in in bytes */ void *arg_out; /*<< Output: pointer to argument from kernel to user */ diff --git a/sys/dev/ocs_fc/ocs_mgmt.c b/sys/dev/ocs_fc/ocs_mgmt.c index 1f22a0316791..ff0e028caea2 100644 --- a/sys/dev/ocs_fc/ocs_mgmt.c +++ b/sys/dev/ocs_fc/ocs_mgmt.c @@ -42,6 +42,7 @@ #include "ocs.h" #include "ocs_mgmt.h" +#include "ocs_gendump.h" #include "ocs_vpd.h" #define SFP_PAGE_SIZE 128 @@ -55,11 +56,6 @@ static int ocs_mgmt_function_reset(ocs_t *ocs, char *, void *buf, uint32_t buf_l static void ocs_mgmt_fw_write_cb(int32_t status, uint32_t actual_write_length, uint32_t change_status, void *arg); static int ocs_mgmt_force_assert(ocs_t *ocs, char *, void *buf, uint32_t buf_len, void*, uint32_t); -#if defined(OCS_INCLUDE_RAMD) -static int32_t -ocs_mgmt_read_phys(ocs_t *ocs, char *, void *, uint32_t , void *, uint32_t); -#endif - /* Getters */ static void get_nodes_count(ocs_t *, char *, ocs_textbuf_t*); @@ -141,9 +137,6 @@ static int set_nv_wwn(ocs_t*, char*, char*); static int set_loglevel(ocs_t*, char*, char*); static void ocs_mgmt_linkcfg_cb(int32_t status, uintptr_t value, void *arg); -#if defined(OCS_INCLUDE_RAMD) -static void* find_address_in_target(ocs_ramdisc_t **ramdisc_array, uint32_t ramdisc_count, uintptr_t target_addr); -#endif ocs_mgmt_table_entry_t mgmt_table[] = { {"nodes_count", get_nodes_count, NULL, NULL}, @@ -193,9 +186,6 @@ ocs_mgmt_table_entry_t mgmt_table[] = { {"firmware_write", NULL, NULL, ocs_mgmt_firmware_write}, {"firmware_reset", NULL, NULL, ocs_mgmt_firmware_reset}, {"function_reset", NULL, NULL, ocs_mgmt_function_reset}, -#if defined(OCS_INCLUDE_RAMD) - {"read_phys", NULL, NULL, ocs_mgmt_read_phys}, -#endif {"force_assert", NULL, NULL, ocs_mgmt_force_assert}, {"tgt_rscn_delay", get_tgt_rscn_delay, set_tgt_rscn_delay, NULL}, @@ -490,6 +480,15 @@ ocs_mgmt_exec(ocs_t *ocs, char *action, void *arg_in, } } + /* See if it's a value I can supply */ + if (ocs_strcmp(unqualified_name, "driver/gendump") == 0) { + return ocs_gen_dump(ocs); + } + + if (ocs_strcmp(unqualified_name, "driver/dump_to_host") == 0) { + return ocs_dump_to_host(ocs, arg_out, arg_out_length); + } + if ((ocs->mgmt_functions) && (ocs->mgmt_functions->exec_handler)) { result = ocs->mgmt_functions->exec_handler(qualifier, action, arg_in, arg_in_length, arg_out, arg_out_length, ocs); @@ -559,137 +558,6 @@ ocs_mgmt_get_all(ocs_t *ocs, ocs_textbuf_t *textbuf) ocs_mgmt_end_unnumbered_section(textbuf, "ocs"); } -#if defined(OCS_INCLUDE_RAMD) -static int32_t -ocs_mgmt_read_phys(ocs_t *ocs, char *name, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length) -{ - uint32_t length; - char addr_str[80]; - uintptr_t target_addr; - void* vaddr = NULL; - ocs_ramdisc_t **ramdisc_array; - uint32_t ramdisc_count; - - if ((arg_in == NULL) || - (arg_in_length == 0) || - (arg_out == NULL) || - (arg_out_length == 0)) { - return -1; - } - - if (arg_in_length > 80) { - arg_in_length = 80; - } - - if (ocs_copy_from_user(addr_str, arg_in, arg_in_length)) { - ocs_log_test(ocs, "Failed to copy addr from user\n"); - return -EFAULT; - } - - target_addr = (uintptr_t)ocs_strtoul(addr_str, NULL, 0); - /* addr_str must be the physical address of a buffer that was reported - * in an SGL. Search ramdiscs looking for a segment that contains that - * physical address - */ - - if (ocs->tgt_ocs.use_global_ramd) { - /* Only one target */ - ramdisc_count = ocs->tgt_ocs.rdisc_count; - ramdisc_array = ocs->tgt_ocs.rdisc; - vaddr = find_address_in_target(ramdisc_array, ramdisc_count, target_addr); - } else { - /* Multiple targets. Each target is on a sport */ - uint32_t domain_idx; - - for (domain_idx=0; domain_idxdomain_instance_count; domain_idx++) { - ocs_domain_t *domain; - uint32_t sport_idx; - - domain = ocs_domain_get_instance(ocs, domain_idx); - for (sport_idx=0; sport_idx < domain->sport_instance_count; sport_idx++) { - ocs_sport_t *sport; - - sport = ocs_sport_get_instance(domain, sport_idx); - ramdisc_count = sport->tgt_sport.rdisc_count; - ramdisc_array = sport->tgt_sport.rdisc; - vaddr = find_address_in_target(ramdisc_array, ramdisc_count, target_addr); - - if (vaddr != NULL) { - break; - } - } - } - } - - length = arg_out_length; - - if (vaddr != NULL) { - if (ocs_copy_to_user(arg_out, vaddr, length)) { - ocs_log_test(ocs, "Failed to copy buffer to user\n"); - return -EFAULT; - } - - return 0; - } else { - return -EFAULT; - } - -} - -/* - * This function searches a target for a given physical address. - * The target is made up of a number of LUNs, each represented by - * a ocs_ramdisc_t. - */ -static void* find_address_in_target(ocs_ramdisc_t **ramdisc_array, uint32_t ramdisc_count, uintptr_t target_addr) -{ - void *vaddr = NULL; - uint32_t ramdisc_idx; - - /* Check each ramdisc */ - for (ramdisc_idx=0; ramdisc_idxsegment_count; segment_idx++) { - ramdisc_segment_t *segment = rdisc->segments[segment_idx]; - uintptr_t segment_start; - uintptr_t segment_end; - uint32_t offset; - - segment_start = segment->data_segment.phys; - segment_end = segment->data_segment.phys + segment->data_segment.size - 1; - if ((target_addr >= segment_start) && (target_addr <= segment_end)) { - /* Found the target address */ - offset = target_addr - segment_start; - vaddr = (uint32_t*)segment->data_segment.virt + offset; - } - - if (rdisc->dif_separate) { - segment_start = segment->dif_segment.phys; - segment_end = segment->data_segment.phys + segment->dif_segment.size - 1; - if ((target_addr >= segment_start) && (target_addr <= segment_end)) { - /* Found the target address */ - offset = target_addr - segment_start; - vaddr = (uint32_t*)segment->dif_segment.virt + offset; - } - } - - if (vaddr != NULL) { - break; - } - } - - if (vaddr != NULL) { - break; - } - } - - return vaddr; -} -#endif - static int32_t ocs_mgmt_firmware_reset(ocs_t *ocs, char *name, void *buf, uint32_t buf_len, void *arg_out, uint32_t arg_out_length) { diff --git a/sys/dev/ocs_fc/ocs_os.c b/sys/dev/ocs_fc/ocs_os.c index 985a611ba91e..4e4edea2e63f 100644 --- a/sys/dev/ocs_fc/ocs_os.c +++ b/sys/dev/ocs_fc/ocs_os.c @@ -883,13 +883,12 @@ ocs_pci_model(uint16_t vendor, uint16_t device) return "unknown"; } -int32_t +void ocs_get_bus_dev_func(ocs_t *ocs, uint8_t* bus, uint8_t* dev, uint8_t* func) { *bus = pci_get_bus(ocs->dev); *dev = pci_get_slot(ocs->dev); *func= pci_get_function(ocs->dev); - return 0; } /** diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h index acc1a9b1cc19..5e36cca3b829 100644 --- a/sys/dev/ocs_fc/ocs_os.h +++ b/sys/dev/ocs_fc/ocs_os.h @@ -1050,9 +1050,8 @@ typedef struct ocs_pci_reg_s { * @param dev Pointer to location to store the device number. * @param func Pointer to location to store the function number. * - * @return Returns 0. */ -extern int32_t +extern void ocs_get_bus_dev_func(ocs_t *ocs, uint8_t* bus, uint8_t* dev, uint8_t* func); extern ocs_t *ocs_get_instance(uint32_t index); diff --git a/sys/modules/ocs_fc/Makefile b/sys/modules/ocs_fc/Makefile index 9bab50eba5bc..8d546f9eabfd 100644 --- a/sys/modules/ocs_fc/Makefile +++ b/sys/modules/ocs_fc/Makefile @@ -33,7 +33,8 @@ SRCS += \ ocs_scsi.c \ ocs_unsol.c \ ocs_ddump.c \ - ocs_mgmt.c + ocs_mgmt.c \ + ocs_gendump.c # CAM initiator/target From owner-dev-commits-src-all@freebsd.org Tue Jul 6 16:07:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F38C865D1E2; Tue, 6 Jul 2021 16:07: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 4GK6rS6SX3z3l1t; Tue, 6 Jul 2021 16:07: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 C61C81C9B1; Tue, 6 Jul 2021 16:07: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 166G74Ur006295; Tue, 6 Jul 2021 16:07:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166G74ta006294; Tue, 6 Jul 2021 16:07:04 GMT (envelope-from git) Date: Tue, 6 Jul 2021 16:07:04 GMT Message-Id: <202107061607.166G74ta006294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: 53b438b2425c - main - zfsd: Check for error from zpool_vdev_online MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53b438b2425c374f6147ac80b3330a9ec08432bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 16:07:05 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=53b438b2425c374f6147ac80b3330a9ec08432bb commit 53b438b2425c374f6147ac80b3330a9ec08432bb Author: Ryan Moeller AuthorDate: 2021-07-06 16:00:18 +0000 Commit: Ryan Moeller CommitDate: 2021-07-06 16:00:18 +0000 zfsd: Check for error from zpool_vdev_online Onlining a vdev can fail. Log the error if it does. Reviewed by: mav, asomers MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30882 --- cddl/usr.sbin/zfsd/case_file.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc index da2125b4d716..8da711fc10cb 100644 --- a/cddl/usr.sbin/zfsd/case_file.cc +++ b/cddl/usr.sbin/zfsd/case_file.cc @@ -280,9 +280,17 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { - zpool_vdev_online(pool, vdev->GUIDString().c_str(), - ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, - &m_vdevState); + if (zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState) != 0) { + syslog(LOG_ERR, + "Failed to online vdev(%s/%s:%s): %s: %s\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", zpool_get_name(pool), vdev->GUIDString().c_str(), devPath.c_str(), From owner-dev-commits-src-all@freebsd.org Tue Jul 6 17:38:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3507C664929; Tue, 6 Jul 2021 17:38:29 +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 4GK8sx0qj2z4XMS; Tue, 6 Jul 2021 17:38: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 04A9F1DE89; Tue, 6 Jul 2021 17:38: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 166HcSCQ026380; Tue, 6 Jul 2021 17:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166HcSjN026379; Tue, 6 Jul 2021 17:38:28 GMT (envelope-from git) Date: Tue, 6 Jul 2021 17:38:28 GMT Message-Id: <202107061738.166HcSjN026379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 4b74458dddba - stable/13 - bsdinstall: Avoid double-mounting /dev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b74458dddba20cf83e27ba2834aba61e37d0324 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 17:38:29 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4b74458dddba20cf83e27ba2834aba61e37d0324 commit 4b74458dddba20cf83e27ba2834aba61e37d0324 Author: Ryan Moeller AuthorDate: 2021-06-23 13:42:43 +0000 Commit: Ryan Moeller CommitDate: 2021-07-06 17:04:28 +0000 bsdinstall: Avoid double-mounting /dev After 34766aa8cb514472c571f8b0e90e833833acef51 we are mounting and unmounting devfs elsewhere already. Reviewed by: nwhitehorn MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30877 (cherry picked from commit b50db44f021c12283a2e140063a6b6fcc30295e5) --- usr.sbin/bsdinstall/scripts/script | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index 131ef008d35f..9ed06c1bd36b 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -162,9 +162,7 @@ fi if [ -f $TMPDIR/bsdinstall-installscript-ab ]; then cp $TMPDIR/bsdinstall-installscript-ab $BSDINSTALL_CHROOT/tmp/installscript chmod a+x $BSDINSTALL_CHROOT/tmp/installscript - mount -t devfs devfs "$BSDINSTALL_CHROOT/dev" chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1 - umount "$BSDINSTALL_CHROOT/dev" rm $BSDINSTALL_CHROOT/tmp/installscript fi From owner-dev-commits-src-all@freebsd.org Tue Jul 6 17:53:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0EE8F6648F2; Tue, 6 Jul 2021 17:53: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 4GK9C86s9Mz4YrH; Tue, 6 Jul 2021 17:53: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 D465B1DE76; Tue, 6 Jul 2021 17:53: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 166HrO4S052702; Tue, 6 Jul 2021 17:53:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166HrO1O052701; Tue, 6 Jul 2021 17:53:24 GMT (envelope-from git) Date: Tue, 6 Jul 2021 17:53:24 GMT Message-Id: <202107061753.166HrO1O052701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: f98545c7e991 - stable/13 - libnv: fix memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f98545c7e99195d0f6e4be2068331421c853be17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 17:53:25 -0000 The branch stable/13 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=f98545c7e99195d0f6e4be2068331421c853be17 commit f98545c7e99195d0f6e4be2068331421c853be17 Author: Mariusz Zaborski AuthorDate: 2019-02-10 23:28:55 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:53:07 +0000 libnv: fix memory leaks nvpair_create_stringv: free the temporary string; this fix affects nvlist_add_stringf() and nvlist_add_stringv(). nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain of nvpairs (as resetting it prevents nvlist_destroy() from freeing it). Note: freeing the chain in nvlist_destroy() is not sufficient, because it would still leak through nvlist_take_nvlist_array(). This affects all nvlist_*_nvlist_array() use Submitted by: Mindaugas Rasiukevicius Reported by: clang/gcc ASAN MFC after: 2 weeks (cherry picked from commit b5d787d93b3d83f28e87e1f8cc740cb160f8f0ac) --- sys/contrib/libnv/bsd_nvpair.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/contrib/libnv/bsd_nvpair.c b/sys/contrib/libnv/bsd_nvpair.c index 6405dcd1c516..556203f740fc 100644 --- a/sys/contrib/libnv/bsd_nvpair.c +++ b/sys/contrib/libnv/bsd_nvpair.c @@ -229,8 +229,16 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, &count)); for (i = 0; i < count; i++) { - nvlist_set_array_next(nvlarray[i], NULL); - nvlist_set_parent(nvlarray[i], NULL); + nvlist_t *nvl; + nvpair_t *nnvp; + + nvl = nvlarray[i]; + nnvp = nvlist_get_array_next_nvpair(nvl); + if (nnvp != NULL) { + nvpair_free_structure(nnvp); + } + nvlist_set_array_next(nvl, NULL); + nvlist_set_parent(nvl, NULL); } } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 17:53:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 49C3E664DB3; Tue, 6 Jul 2021 17:53: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 4GK9CB0vJwz4YNy; Tue, 6 Jul 2021 17:53: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 0177A1E408; Tue, 6 Jul 2021 17:53: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 166HrP0D052726; Tue, 6 Jul 2021 17:53:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166HrPl9052725; Tue, 6 Jul 2021 17:53:25 GMT (envelope-from git) Date: Tue, 6 Jul 2021 17:53:25 GMT Message-Id: <202107061753.166HrPl9052725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: 4c79391a7fa4 - stable/13 - libnv: fix double free MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c79391a7fa47c22429d0f9c8877a27065794cf1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 17:53:26 -0000 The branch stable/13 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=4c79391a7fa47c22429d0f9c8877a27065794cf1 commit 4c79391a7fa47c22429d0f9c8877a27065794cf1 Author: Mariusz Zaborski AuthorDate: 2019-02-17 18:26:27 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:53:08 +0000 libnv: fix double free In r343986 we introduced a double free. The structure was already freed fixed in the r302966. This problem was introduced because the GitHub version was out of sync with the FreeBSD one. Submitted by: Mindaugas Rasiukevicius MFC with: r343986 (cherry picked from commit d97753b5c8f1d32fbcdcbb0d129b49f808245865) --- sys/contrib/libnv/bsd_nvpair.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/contrib/libnv/bsd_nvpair.c b/sys/contrib/libnv/bsd_nvpair.c index 556203f740fc..34ea8c6bc1d5 100644 --- a/sys/contrib/libnv/bsd_nvpair.c +++ b/sys/contrib/libnv/bsd_nvpair.c @@ -229,14 +229,6 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, &count)); for (i = 0; i < count; i++) { - nvlist_t *nvl; - nvpair_t *nnvp; - - nvl = nvlarray[i]; - nnvp = nvlist_get_array_next_nvpair(nvl); - if (nnvp != NULL) { - nvpair_free_structure(nnvp); - } nvlist_set_array_next(nvl, NULL); nvlist_set_parent(nvl, NULL); } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 17:53:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DB83F664771; Tue, 6 Jul 2021 17:53:27 +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 4GK9CC5VLvz4YrS; Tue, 6 Jul 2021 17:53:27 +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 286281E306; Tue, 6 Jul 2021 17:53:27 +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 166HrRu9052750; Tue, 6 Jul 2021 17:53:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166HrRUc052749; Tue, 6 Jul 2021 17:53:27 GMT (envelope-from git) Date: Tue, 6 Jul 2021 17:53:27 GMT Message-Id: <202107061753.166HrRUc052749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: b907e9d9a149 - stable/13 - libnv: fix revert MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b907e9d9a1492711e5e342b2bc33b30670a7222d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 17:53:28 -0000 The branch stable/13 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=b907e9d9a1492711e5e342b2bc33b30670a7222d commit b907e9d9a1492711e5e342b2bc33b30670a7222d Author: Mariusz Zaborski AuthorDate: 2019-02-17 18:32:19 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:53:08 +0000 libnv: fix revert Reported by: jenkins (cherry picked from commit 3bea7b5b05f200df4cabee12e405b8feade16f0e) --- sys/contrib/libnv/bsd_nvpair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/libnv/bsd_nvpair.c b/sys/contrib/libnv/bsd_nvpair.c index 34ea8c6bc1d5..6405dcd1c516 100644 --- a/sys/contrib/libnv/bsd_nvpair.c +++ b/sys/contrib/libnv/bsd_nvpair.c @@ -229,8 +229,8 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, &count)); for (i = 0; i < count; i++) { - nvlist_set_array_next(nvl, NULL); - nvlist_set_parent(nvl, NULL); + nvlist_set_array_next(nvlarray[i], NULL); + nvlist_set_parent(nvlarray[i], NULL); } } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 17:53:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 879DC664F1B; Tue, 6 Jul 2021 17:53: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 4GK9CD3H77z4YX6; Tue, 6 Jul 2021 17:53: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 4F6D41E307; Tue, 6 Jul 2021 17:53: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 166HrS0m052778; Tue, 6 Jul 2021 17:53:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166HrSwV052777; Tue, 6 Jul 2021 17:53:28 GMT (envelope-from git) Date: Tue, 6 Jul 2021 17:53:28 GMT Message-Id: <202107061753.166HrSwV052777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: ff339365be13 - stable/13 - libnv: optimize nvlist size calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ff339365be130f155f94f9a5d8daf69b695cfc55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 17:53:28 -0000 The branch stable/13 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=ff339365be130f155f94f9a5d8daf69b695cfc55 commit ff339365be130f155f94f9a5d8daf69b695cfc55 Author: Mariusz Zaborski AuthorDate: 2021-06-11 15:35:36 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:53:08 +0000 libnv: optimize nvlist size calculation If we had a multiple nvlist, during nvlist_pack, we calculated the size of every nvlist separately. For example, if we had a nvlist with three nodes each containing another (A contains B, and B contains C), we first calculated the size of nvlist A (which contains B, C), then we calculate the size of B (which contains C, notice that we already did the calculation of B, when we calculate A), and finally C. This means that this calculation was O(N!). This was done because each time we pack nvlist, we have to put its size in the header (the separate header for A, B, and C). To not break the ABI and to reduce the complexity of nvlist_size, instead of calculating the nvlist size when requested, we track the size of each nvlist. Reported by: pjd, kp Tested by: kp (cherry picked from commit 89d5cbb82294c8624e66f920d50353057ccab14b) --- sys/contrib/libnv/nvlist.c | 124 +++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 71 deletions(-) diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c index 311325d822ce..31ab62abeb67 100644 --- a/sys/contrib/libnv/nvlist.c +++ b/sys/contrib/libnv/nvlist.c @@ -99,6 +99,7 @@ struct nvlist { int nvl_magic; int nvl_error; int nvl_flags; + size_t nvl_datasize; nvpair_t *nvl_parent; nvpair_t *nvl_array_next; struct nvl_head nvl_head; @@ -139,6 +140,7 @@ nvlist_create(int flags) nvl->nvl_flags = flags; nvl->nvl_parent = NULL; nvl->nvl_array_next = NULL; + nvl->nvl_datasize = sizeof(struct nvlist_header); TAILQ_INIT(&nvl->nvl_head); nvl->nvl_magic = NVLIST_MAGIC; @@ -247,6 +249,51 @@ nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele) nvl->nvl_array_next = ele; } +static void +nvlist_update_size(nvlist_t *nvl, nvpair_t *new, ssize_t mul) +{ + ssize_t size; + size_t nitems; + const nvlist_t *nvlistnew; + const nvlist_t * const *nvlarray; + nvlist_t *parent; + unsigned int ii; + + NVLIST_ASSERT(nvl); + NVPAIR_ASSERT(new); + PJDLOG_ASSERT(mul == 1 || mul == -1); + + size = nvpair_header_size(); + size += strlen(nvpair_name(new)) + 1; + + if (nvpair_type(new) == NV_TYPE_NVLIST) { + nvlistnew = nvpair_get_nvlist(new); + size += nvlistnew->nvl_datasize; + size += nvpair_header_size() + 1; + } else if (nvpair_type(new) == NV_TYPE_NVLIST_ARRAY) { + nvlarray = nvpair_get_nvlist_array(new, &nitems); + PJDLOG_ASSERT(nitems > 0); + + size += (nvpair_header_size() + 1) * nitems; + for (ii = 0; ii < nitems; ii++) { + PJDLOG_ASSERT(nvlarray[ii]->nvl_error == 0); + size += nvlarray[ii]->nvl_datasize; + } + } else { + size += nvpair_size(new); + } + + size *= mul; + + nvl->nvl_datasize += size; + + parent = nvl; + while ((parent = __DECONST(nvlist_t *, + nvlist_get_parent(parent, NULL))) != NULL) { + parent->nvl_datasize += size; + } +} + nvpair_t * nvlist_get_array_next_nvpair(nvlist_t *nvl) { @@ -640,78 +687,8 @@ nvlist_fdump(const nvlist_t *nvl, FILE *fp) size_t nvlist_size(const nvlist_t *nvl) { - const nvlist_t *tmpnvl; - const nvlist_t * const *nvlarray; - const nvpair_t *nvp, *tmpnvp; - void *cookie; - size_t size, nitems; - unsigned int ii; - - NVLIST_ASSERT(nvl); - PJDLOG_ASSERT(nvl->nvl_error == 0); - size = sizeof(struct nvlist_header); - nvp = nvlist_first_nvpair(nvl); - while (nvp != NULL) { - size += nvpair_header_size(); - size += strlen(nvpair_name(nvp)) + 1; - if (nvpair_type(nvp) == NV_TYPE_NVLIST) { - size += sizeof(struct nvlist_header); - size += nvpair_header_size() + 1; - tmpnvl = nvpair_get_nvlist(nvp); - PJDLOG_ASSERT(tmpnvl->nvl_error == 0); - tmpnvp = nvlist_first_nvpair(tmpnvl); - if (tmpnvp != NULL) { - nvl = tmpnvl; - nvp = tmpnvp; - continue; - } - } else if (nvpair_type(nvp) == NV_TYPE_NVLIST_ARRAY) { - nvlarray = nvpair_get_nvlist_array(nvp, &nitems); - PJDLOG_ASSERT(nitems > 0); - - size += (nvpair_header_size() + 1) * nitems; - size += sizeof(struct nvlist_header) * nitems; - - tmpnvl = NULL; - tmpnvp = NULL; - for (ii = 0; ii < nitems; ii++) { - PJDLOG_ASSERT(nvlarray[ii]->nvl_error == 0); - tmpnvp = nvlist_first_nvpair(nvlarray[ii]); - if (tmpnvp != NULL) { - tmpnvl = nvlarray[ii]; - break; - } - } - if (tmpnvp != NULL) { - nvp = tmpnvp; - nvl = tmpnvl; - continue; - } - - } else { - size += nvpair_size(nvp); - } - - while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) { - do { - cookie = NULL; - nvl = nvlist_get_pararr(nvl, &cookie); - if (nvl == NULL) - goto out; - if (nvlist_in_array(nvl) && cookie == NULL) { - nvp = nvlist_first_nvpair(nvl); - } else { - nvp = cookie; - } - } while (nvp == NULL); - if (nvlist_in_array(nvl) && cookie == NULL) - break; - } - } - -out: - return (size); + return (nvl->nvl_datasize); } #ifndef _KERNEL @@ -1483,6 +1460,7 @@ nvlist_add_nvpair(nvlist_t *nvl, const nvpair_t *nvp) } nvpair_insert(&nvl->nvl_head, newnvp, nvl); + nvlist_update_size(nvl, newnvp, 1); } void @@ -1631,10 +1609,12 @@ nvlist_append_##type##_array(nvlist_t *nvl, const char *name, vtype value)\ nvlist_add_##type##_array(nvl, name, &value, 1); \ return; \ } \ + nvlist_update_size(nvl, nvp, -1); \ if (nvpair_append_##type##_array(nvp, value) == -1) { \ nvl->nvl_error = ERRNO_OR_DEFAULT(ENOMEM); \ ERRNO_SET(nvl->nvl_error); \ } \ + nvlist_update_size(nvl, nvp, 1); \ } NVLIST_APPEND_ARRAY(const bool, bool, BOOL) @@ -1669,6 +1649,7 @@ nvlist_move_nvpair(nvlist_t *nvl, nvpair_t *nvp) } nvpair_insert(&nvl->nvl_head, nvp, nvl); + nvlist_update_size(nvl, nvp, 1); return (true); } @@ -2020,6 +2001,7 @@ nvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *nvp) PJDLOG_ASSERT(nvpair_nvlist(nvp) == nvl); nvpair_remove(&nvl->nvl_head, nvp, nvl); + nvlist_update_size(nvl, nvp, -1); } void From owner-dev-commits-src-all@freebsd.org Tue Jul 6 18:25:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 20E5E6651EB; Tue, 6 Jul 2021 18:25: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 4GK9wg0PQKz4ccK; Tue, 6 Jul 2021 18:25: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 E943F1E7D4; Tue, 6 Jul 2021 18:25: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 166IPsjn093214; Tue, 6 Jul 2021 18:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166IPsi5093213; Tue, 6 Jul 2021 18:25:54 GMT (envelope-from git) Date: Tue, 6 Jul 2021 18:25:54 GMT Message-Id: <202107061825.166IPsi5093213@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: dc876a5bcd46 - stable/12 - libnv: fix memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: dc876a5bcd46b486103c9127f51e01663504195b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:25:55 -0000 The branch stable/12 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=dc876a5bcd46b486103c9127f51e01663504195b commit dc876a5bcd46b486103c9127f51e01663504195b Author: Mariusz Zaborski AuthorDate: 2019-02-10 23:28:55 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:58:08 +0000 libnv: fix memory leaks nvpair_create_stringv: free the temporary string; this fix affects nvlist_add_stringf() and nvlist_add_stringv(). nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain of nvpairs (as resetting it prevents nvlist_destroy() from freeing it). Note: freeing the chain in nvlist_destroy() is not sufficient, because it would still leak through nvlist_take_nvlist_array(). This affects all nvlist_*_nvlist_array() use Submitted by: Mindaugas Rasiukevicius Reported by: clang/gcc ASAN MFC after: 2 weeks (cherry picked from commit b5d787d93b3d83f28e87e1f8cc740cb160f8f0ac) --- lib/libnv/tests/nvlist_send_recv_test.c | 2 ++ sys/contrib/libnv/nv_impl.h | 1 + sys/contrib/libnv/nvlist.c | 9 +++++++++ sys/contrib/libnv/nvpair.c | 15 +++++++++++---- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/libnv/tests/nvlist_send_recv_test.c b/lib/libnv/tests/nvlist_send_recv_test.c index 1b673b5d4259..fbc918102b50 100644 --- a/lib/libnv/tests/nvlist_send_recv_test.c +++ b/lib/libnv/tests/nvlist_send_recv_test.c @@ -304,6 +304,8 @@ parent(int sock) name = nvlist_next(nvl, &type, &cookie); CHECK(name == NULL); + + nvlist_destroy(nvl); } static void diff --git a/sys/contrib/libnv/nv_impl.h b/sys/contrib/libnv/nv_impl.h index a67cc2ca0883..1875c739beee 100644 --- a/sys/contrib/libnv/nv_impl.h +++ b/sys/contrib/libnv/nv_impl.h @@ -103,6 +103,7 @@ bool nvlist_move_nvpair(nvlist_t *nvl, nvpair_t *nvp); void nvlist_set_parent(nvlist_t *nvl, nvpair_t *parent); void nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele); +nvpair_t *nvlist_get_array_next_nvpair(nvlist_t *nvl); const nvpair_t *nvlist_get_nvpair(const nvlist_t *nvl, const char *name); diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c index 69b32a62a4cc..311325d822ce 100644 --- a/sys/contrib/libnv/nvlist.c +++ b/sys/contrib/libnv/nvlist.c @@ -247,6 +247,15 @@ nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele) nvl->nvl_array_next = ele; } +nvpair_t * +nvlist_get_array_next_nvpair(nvlist_t *nvl) +{ + + NVLIST_ASSERT(nvl); + + return (nvl->nvl_array_next); +} + bool nvlist_in_array(const nvlist_t *nvl) { diff --git a/sys/contrib/libnv/nvpair.c b/sys/contrib/libnv/nvpair.c index ed01da2c5040..b767b9bbf972 100644 --- a/sys/contrib/libnv/nvpair.c +++ b/sys/contrib/libnv/nvpair.c @@ -229,8 +229,16 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, &count)); for (i = 0; i < count; i++) { - nvlist_set_array_next(nvlarray[i], NULL); - nvlist_set_parent(nvlarray[i], NULL); + nvlist_t *nvl; + nvpair_t *nnvp; + + nvl = nvlarray[i]; + nnvp = nvlist_get_array_next_nvpair(nvl); + if (nnvp != NULL) { + nvpair_free_structure(nnvp); + } + nvlist_set_array_next(nvl, NULL); + nvlist_set_parent(nvl, NULL); } } @@ -1194,8 +1202,7 @@ nvpair_create_stringv(const char *name, const char *valuefmt, va_list valueap) if (len < 0) return (NULL); nvp = nvpair_create_string(name, str); - if (nvp == NULL) - nv_free(str); + nv_free(str); return (nvp); } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 18:25:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 44CC26651EC; Tue, 6 Jul 2021 18:25:56 +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 4GK9wh1P5Dz4chk; Tue, 6 Jul 2021 18:25: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 17B061E672; Tue, 6 Jul 2021 18:25: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 166IPuta093239; Tue, 6 Jul 2021 18:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166IPtT0093238; Tue, 6 Jul 2021 18:25:55 GMT (envelope-from git) Date: Tue, 6 Jul 2021 18:25:55 GMT Message-Id: <202107061825.166IPtT0093238@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: bc2bc8ee6e18 - stable/12 - libnv: fix memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bc2bc8ee6e1814361125c189591917be0fa5e4c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:25:56 -0000 The branch stable/12 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=bc2bc8ee6e1814361125c189591917be0fa5e4c1 commit bc2bc8ee6e1814361125c189591917be0fa5e4c1 Author: Mariusz Zaborski AuthorDate: 2019-02-10 23:30:54 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:58:08 +0000 libnv: fix memory leaks Free the data array for NV_TYPE_DESCRIPTOR_ARRAY case. MFC after: 2 weeks (cherry picked from commit 0020c845a086766b3315372f006363f8ad76ac54) --- sys/contrib/libnv/nvpair.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/contrib/libnv/nvpair.c b/sys/contrib/libnv/nvpair.c index b767b9bbf972..556203f740fc 100644 --- a/sys/contrib/libnv/nvpair.c +++ b/sys/contrib/libnv/nvpair.c @@ -2062,6 +2062,7 @@ nvpair_free(nvpair_t *nvp) case NV_TYPE_DESCRIPTOR_ARRAY: for (i = 0; i < nvp->nvp_nitems; i++) close(((int *)(intptr_t)nvp->nvp_data)[i]); + nv_free((int *)(intptr_t)nvp->nvp_data); break; #endif case NV_TYPE_NVLIST: From owner-dev-commits-src-all@freebsd.org Tue Jul 6 18:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E346F6658A5; Tue, 6 Jul 2021 18:25: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 4GK9wj2y2kz4cRY; Tue, 6 Jul 2021 18:25:57 +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 43A501E999; Tue, 6 Jul 2021 18:25: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 166IPvtl093263; Tue, 6 Jul 2021 18:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166IPv9H093262; Tue, 6 Jul 2021 18:25:57 GMT (envelope-from git) Date: Tue, 6 Jul 2021 18:25:57 GMT Message-Id: <202107061825.166IPv9H093262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: 6c33105c1a81 - stable/12 - libnv: fix double free MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6c33105c1a817e4cc3d6e59998fb53e8d9bd5748 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:25:58 -0000 The branch stable/12 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=6c33105c1a817e4cc3d6e59998fb53e8d9bd5748 commit 6c33105c1a817e4cc3d6e59998fb53e8d9bd5748 Author: Mariusz Zaborski AuthorDate: 2019-02-17 18:26:27 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:58:09 +0000 libnv: fix double free In r343986 we introduced a double free. The structure was already freed fixed in the r302966. This problem was introduced because the GitHub version was out of sync with the FreeBSD one. Submitted by: Mindaugas Rasiukevicius MFC with: r343986 (cherry picked from commit d97753b5c8f1d32fbcdcbb0d129b49f808245865) --- sys/contrib/libnv/nvpair.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/contrib/libnv/nvpair.c b/sys/contrib/libnv/nvpair.c index 556203f740fc..34ea8c6bc1d5 100644 --- a/sys/contrib/libnv/nvpair.c +++ b/sys/contrib/libnv/nvpair.c @@ -229,14 +229,6 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, &count)); for (i = 0; i < count; i++) { - nvlist_t *nvl; - nvpair_t *nnvp; - - nvl = nvlarray[i]; - nnvp = nvlist_get_array_next_nvpair(nvl); - if (nnvp != NULL) { - nvpair_free_structure(nnvp); - } nvlist_set_array_next(nvl, NULL); nvlist_set_parent(nvl, NULL); } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 18:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E93A066562D; Tue, 6 Jul 2021 18:25:58 +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 4GK9wk3jFBz4cTg; Tue, 6 Jul 2021 18:25:58 +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 5D9CB1E97F; Tue, 6 Jul 2021 18:25: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 166IPwrY093287; Tue, 6 Jul 2021 18:25:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166IPwZk093286; Tue, 6 Jul 2021 18:25:58 GMT (envelope-from git) Date: Tue, 6 Jul 2021 18:25:58 GMT Message-Id: <202107061825.166IPwZk093286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: ddab4ee61002 - stable/12 - libnv: fix revert MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ddab4ee6100216900d6bbc9f3da4d98fde844812 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:25:59 -0000 The branch stable/12 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=ddab4ee6100216900d6bbc9f3da4d98fde844812 commit ddab4ee6100216900d6bbc9f3da4d98fde844812 Author: Mariusz Zaborski AuthorDate: 2019-02-17 18:32:19 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:58:09 +0000 libnv: fix revert Reported by: jenkins (cherry picked from commit 3bea7b5b05f200df4cabee12e405b8feade16f0e) --- sys/contrib/libnv/nvpair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/libnv/nvpair.c b/sys/contrib/libnv/nvpair.c index 34ea8c6bc1d5..6405dcd1c516 100644 --- a/sys/contrib/libnv/nvpair.c +++ b/sys/contrib/libnv/nvpair.c @@ -229,8 +229,8 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, &count)); for (i = 0; i < count; i++) { - nvlist_set_array_next(nvl, NULL); - nvlist_set_parent(nvl, NULL); + nvlist_set_array_next(nvlarray[i], NULL); + nvlist_set_parent(nvlarray[i], NULL); } } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 18:26:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7663D665918; Tue, 6 Jul 2021 18:26: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 4GK9wm0SFwz4clY; Tue, 6 Jul 2021 18:25: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 81BB31E99A; Tue, 6 Jul 2021 18:25: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 166IPxMj093311; Tue, 6 Jul 2021 18:25:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166IPxAs093310; Tue, 6 Jul 2021 18:25:59 GMT (envelope-from git) Date: Tue, 6 Jul 2021 18:25:59 GMT Message-Id: <202107061825.166IPxAs093310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: eed85dd1ad31 - stable/12 - libnv: optimize nvlist size calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: eed85dd1ad31fc83aa3bc1bd8b4c9249616c8b78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:26:00 -0000 The branch stable/12 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=eed85dd1ad31fc83aa3bc1bd8b4c9249616c8b78 commit eed85dd1ad31fc83aa3bc1bd8b4c9249616c8b78 Author: Mariusz Zaborski AuthorDate: 2021-06-11 15:35:36 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-06 17:58:09 +0000 libnv: optimize nvlist size calculation If we had a multiple nvlist, during nvlist_pack, we calculated the size of every nvlist separately. For example, if we had a nvlist with three nodes each containing another (A contains B, and B contains C), we first calculated the size of nvlist A (which contains B, C), then we calculate the size of B (which contains C, notice that we already did the calculation of B, when we calculate A), and finally C. This means that this calculation was O(N!). This was done because each time we pack nvlist, we have to put its size in the header (the separate header for A, B, and C). To not break the ABI and to reduce the complexity of nvlist_size, instead of calculating the nvlist size when requested, we track the size of each nvlist. Reported by: pjd, kp Tested by: kp (cherry picked from commit 89d5cbb82294c8624e66f920d50353057ccab14b) --- sys/contrib/libnv/nvlist.c | 124 +++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 71 deletions(-) diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c index 311325d822ce..31ab62abeb67 100644 --- a/sys/contrib/libnv/nvlist.c +++ b/sys/contrib/libnv/nvlist.c @@ -99,6 +99,7 @@ struct nvlist { int nvl_magic; int nvl_error; int nvl_flags; + size_t nvl_datasize; nvpair_t *nvl_parent; nvpair_t *nvl_array_next; struct nvl_head nvl_head; @@ -139,6 +140,7 @@ nvlist_create(int flags) nvl->nvl_flags = flags; nvl->nvl_parent = NULL; nvl->nvl_array_next = NULL; + nvl->nvl_datasize = sizeof(struct nvlist_header); TAILQ_INIT(&nvl->nvl_head); nvl->nvl_magic = NVLIST_MAGIC; @@ -247,6 +249,51 @@ nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele) nvl->nvl_array_next = ele; } +static void +nvlist_update_size(nvlist_t *nvl, nvpair_t *new, ssize_t mul) +{ + ssize_t size; + size_t nitems; + const nvlist_t *nvlistnew; + const nvlist_t * const *nvlarray; + nvlist_t *parent; + unsigned int ii; + + NVLIST_ASSERT(nvl); + NVPAIR_ASSERT(new); + PJDLOG_ASSERT(mul == 1 || mul == -1); + + size = nvpair_header_size(); + size += strlen(nvpair_name(new)) + 1; + + if (nvpair_type(new) == NV_TYPE_NVLIST) { + nvlistnew = nvpair_get_nvlist(new); + size += nvlistnew->nvl_datasize; + size += nvpair_header_size() + 1; + } else if (nvpair_type(new) == NV_TYPE_NVLIST_ARRAY) { + nvlarray = nvpair_get_nvlist_array(new, &nitems); + PJDLOG_ASSERT(nitems > 0); + + size += (nvpair_header_size() + 1) * nitems; + for (ii = 0; ii < nitems; ii++) { + PJDLOG_ASSERT(nvlarray[ii]->nvl_error == 0); + size += nvlarray[ii]->nvl_datasize; + } + } else { + size += nvpair_size(new); + } + + size *= mul; + + nvl->nvl_datasize += size; + + parent = nvl; + while ((parent = __DECONST(nvlist_t *, + nvlist_get_parent(parent, NULL))) != NULL) { + parent->nvl_datasize += size; + } +} + nvpair_t * nvlist_get_array_next_nvpair(nvlist_t *nvl) { @@ -640,78 +687,8 @@ nvlist_fdump(const nvlist_t *nvl, FILE *fp) size_t nvlist_size(const nvlist_t *nvl) { - const nvlist_t *tmpnvl; - const nvlist_t * const *nvlarray; - const nvpair_t *nvp, *tmpnvp; - void *cookie; - size_t size, nitems; - unsigned int ii; - - NVLIST_ASSERT(nvl); - PJDLOG_ASSERT(nvl->nvl_error == 0); - size = sizeof(struct nvlist_header); - nvp = nvlist_first_nvpair(nvl); - while (nvp != NULL) { - size += nvpair_header_size(); - size += strlen(nvpair_name(nvp)) + 1; - if (nvpair_type(nvp) == NV_TYPE_NVLIST) { - size += sizeof(struct nvlist_header); - size += nvpair_header_size() + 1; - tmpnvl = nvpair_get_nvlist(nvp); - PJDLOG_ASSERT(tmpnvl->nvl_error == 0); - tmpnvp = nvlist_first_nvpair(tmpnvl); - if (tmpnvp != NULL) { - nvl = tmpnvl; - nvp = tmpnvp; - continue; - } - } else if (nvpair_type(nvp) == NV_TYPE_NVLIST_ARRAY) { - nvlarray = nvpair_get_nvlist_array(nvp, &nitems); - PJDLOG_ASSERT(nitems > 0); - - size += (nvpair_header_size() + 1) * nitems; - size += sizeof(struct nvlist_header) * nitems; - - tmpnvl = NULL; - tmpnvp = NULL; - for (ii = 0; ii < nitems; ii++) { - PJDLOG_ASSERT(nvlarray[ii]->nvl_error == 0); - tmpnvp = nvlist_first_nvpair(nvlarray[ii]); - if (tmpnvp != NULL) { - tmpnvl = nvlarray[ii]; - break; - } - } - if (tmpnvp != NULL) { - nvp = tmpnvp; - nvl = tmpnvl; - continue; - } - - } else { - size += nvpair_size(nvp); - } - - while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) { - do { - cookie = NULL; - nvl = nvlist_get_pararr(nvl, &cookie); - if (nvl == NULL) - goto out; - if (nvlist_in_array(nvl) && cookie == NULL) { - nvp = nvlist_first_nvpair(nvl); - } else { - nvp = cookie; - } - } while (nvp == NULL); - if (nvlist_in_array(nvl) && cookie == NULL) - break; - } - } - -out: - return (size); + return (nvl->nvl_datasize); } #ifndef _KERNEL @@ -1483,6 +1460,7 @@ nvlist_add_nvpair(nvlist_t *nvl, const nvpair_t *nvp) } nvpair_insert(&nvl->nvl_head, newnvp, nvl); + nvlist_update_size(nvl, newnvp, 1); } void @@ -1631,10 +1609,12 @@ nvlist_append_##type##_array(nvlist_t *nvl, const char *name, vtype value)\ nvlist_add_##type##_array(nvl, name, &value, 1); \ return; \ } \ + nvlist_update_size(nvl, nvp, -1); \ if (nvpair_append_##type##_array(nvp, value) == -1) { \ nvl->nvl_error = ERRNO_OR_DEFAULT(ENOMEM); \ ERRNO_SET(nvl->nvl_error); \ } \ + nvlist_update_size(nvl, nvp, 1); \ } NVLIST_APPEND_ARRAY(const bool, bool, BOOL) @@ -1669,6 +1649,7 @@ nvlist_move_nvpair(nvlist_t *nvl, nvpair_t *nvp) } nvpair_insert(&nvl->nvl_head, nvp, nvl); + nvlist_update_size(nvl, nvp, 1); return (true); } @@ -2020,6 +2001,7 @@ nvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *nvp) PJDLOG_ASSERT(nvpair_nvlist(nvp) == nvl); nvpair_remove(&nvl->nvl_head, nvp, nvl); + nvlist_update_size(nvl, nvp, -1); } void From owner-dev-commits-src-all@freebsd.org Tue Jul 6 18:55:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 262D4665E91; Tue, 6 Jul 2021 18:55:49 +0000 (UTC) (envelope-from kp@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 4GKBb90H8pz4fxT; Tue, 6 Jul 2021 18:55:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id CC940A73C; Tue, 6 Jul 2021 18:55:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id D19F946013; Tue, 6 Jul 2021 20:55:45 +0200 (CEST) From: "Kristof Provost" To: "Ram Kishore Vegesna" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. Date: Tue, 06 Jul 2021 20:55:44 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 18:55:49 -0000 Hi Ram, On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: > The branch main has been updated by ram: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D29e2dbd42c3e2e10e606b3414f4d0= c53021d4e86 > > commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > Author: Ram Kishore Vegesna > AuthorDate: 2021-06-24 07:05:00 +0000 > Commit: Ram Kishore Vegesna > CommitDate: 2021-07-06 15:38:11 +0000 > > ocs_fc: Add gendump and dump_to_host ioctl command support. > > Support to generate firmware dump. > > Approved by: mav(mentor) > --- > sys/dev/ocs_fc/ocs_gendump.c | 388 = > +++++++++++++++++++++++++++++++++++++++++++ > sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ > sys/dev/ocs_fc/ocs_ioctl.c | 13 +- > sys/dev/ocs_fc/ocs_ioctl.h | 3 + > sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- > sys/dev/ocs_fc/ocs_os.c | 3 +- > sys/dev/ocs_fc/ocs_os.h | 3 +- > sys/modules/ocs_fc/Makefile | 3 +- > 8 files changed, 449 insertions(+), 158 deletions(-) > I=E2=80=99m seeing this build failure (amd64, GENERIC kernel): ld: error: undefined symbol: ocs_gen_dump >>> referenced by ocs_mgmt.c:485 = (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: ocs_dump_to_host >>> referenced by ocs_mgmt.c:489 = (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> ocs_mgmt.o:(ocs_mgmt_exec) *** [kernel.full] Error code 1 Does that ring any bells? Thanks, Kristof From owner-dev-commits-src-all@freebsd.org Tue Jul 6 19:03:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC314666237; Tue, 6 Jul 2021 19:03: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 4GKBmJ4NPnz4h0d; Tue, 6 Jul 2021 19:03: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 7ECF41F305; Tue, 6 Jul 2021 19:03: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 166J3i3n047081; Tue, 6 Jul 2021 19:03:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166J3iG7047080; Tue, 6 Jul 2021 19:03:44 GMT (envelope-from git) Date: Tue, 6 Jul 2021 19:03:44 GMT Message-Id: <202107061903.166J3iG7047080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: d0732fa81963 - main - Add ocs_gendump.c to the build, missed in 29e2dbd42c3e. 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/main X-Git-Reftype: branch X-Git-Commit: d0732fa81963d336099a6b134a1eb4be867bfa8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:03:44 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d0732fa81963d336099a6b134a1eb4be867bfa8b commit d0732fa81963d336099a6b134a1eb4be867bfa8b Author: Alexander Motin AuthorDate: 2021-07-06 19:03:06 +0000 Commit: Alexander Motin CommitDate: 2021-07-06 19:03:06 +0000 Add ocs_gendump.c to the build, missed in 29e2dbd42c3e. --- sys/conf/files | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files b/sys/conf/files index ef58ba895d2b..94f4e92bb25c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2579,6 +2579,7 @@ dev/oce/oce_mbox.c optional oce pci dev/oce/oce_queue.c optional oce pci dev/oce/oce_sysctl.c optional oce pci dev/oce/oce_util.c optional oce pci +dev/ocs_fc/ocs_gendump.c optional ocs_fc pci dev/ocs_fc/ocs_pci.c optional ocs_fc pci dev/ocs_fc/ocs_ioctl.c optional ocs_fc pci dev/ocs_fc/ocs_os.c optional ocs_fc pci From owner-dev-commits-src-all@freebsd.org Tue Jul 6 19:04:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E9E476660A5; Tue, 6 Jul 2021 19:04:50 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (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 4GKBnZ5Vvbz4gxl; Tue, 6 Jul 2021 19:04:50 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x731.google.com with SMTP id t19so6608899qkg.7; Tue, 06 Jul 2021 12:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5EclEbvOQR0Bml1e8BxOMOHKOp1k1W/bJ11Rlb1SIAI=; b=GZBEs4rsDVmKf5MuBWzmg6d98VPlZP6kEqSRMgh7xnPo14f9lsXrSDtdCWNnnYR40h D5W0T3ohYzEtCyOjGp5iIXPSxOsVb3qW7R5JHyT3mThLmVmIO9nnwDsa1LZhuehHG91w HXEP3Pe+JbsCb/jZmg+QaEd5XjQvTxDxJYU49UpjHddz6w1YsfkNvth2P/p7xHvnNnUn KGK5dYb8qztrBRWO49dZWlAq7tYoCQgt5MOAtMtVk2tw+5ddMTLsDWisaWi5tbnT3nYH XpgQXh5l1FhBildhpPKgV9NBZUW7t9Y1nrwhX5dZ7FUj7/VZV3glZ1R9Uj+Tka7PoVwc spYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=5EclEbvOQR0Bml1e8BxOMOHKOp1k1W/bJ11Rlb1SIAI=; b=ieFe/srD8RynDMBJMndudfFmOFsiIiBQFrDw/D7yqTe5SAB124gHKNiJIohc+PdAmP vUJ/bXuaJicgBOkL87pZz6whtVvPI9R4Mk3Ly9zFMlFwRftjHAAt/p0gqPV8x2dtlWfj ezZni9wzwagP5ER216fV2vc4C+Q2Ygx1Dgr5YygZj7L0l4ijB/vq5Uhtb93AqsRq9Gd0 IkmeS5z9WGgegvJftjZRKekrSA8/aljiVbzkXoGXdwsBHt9lsPWWeSuPFh971RBM+GyL 2rk8xYf9hqMed9Y5oEqIsHxHSC+1YgYvx6GLunE1UKk5XkfYEsOgndS0Mqzn1TuU3Vml sECQ== X-Gm-Message-State: AOAM532Kg6rVYG+rmfzxJh5YjHQdAxmpeQmrY727ostq3pLBMdbNGUam vM08qo3vin2/hoLOo/jojtLpsi9fKpk= X-Google-Smtp-Source: ABdhPJw3ltOforn2LqNL+eywirdgGe2O2nhkmsTSyL3gX/cRF5XKZbrVORhzPIWQ8FEJcXK+cR597g== X-Received: by 2002:ae9:f805:: with SMTP id x5mr10181671qkh.373.1625598289295; Tue, 06 Jul 2021 12:04:49 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id t62sm7188292qkc.26.2021.07.06.12.04.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 12:04:48 -0700 (PDT) Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. To: Kristof Provost , Ram Kishore Vegesna Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> From: Alexander Motin Autocrypt: addr=mavbsd@gmail.com; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IkFsZXhhbmRlciBNb3RpbiA8bWF2YnNkQGdtYWlsLmNvbT6JAVQEEwEKAD4CGwMFCwkI BwMFFQoJCAsFFgMCAQACHgECF4AWIQTpjPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDCtwUJDTHM ogAKCRCDGMOVW6sif7nYB/9TpvgdnxMVBT9aPaaGrFOToI8lV5eCUIB3ot6+VbfeMam0nkFZ GGoaXvDMdIf++1jFADTP+hcl1fIrrH1uy2ZS1tDu3Ngd6BUCAcHcbFEqEZnCwzQTkULHbYGJ pHxKAvQYIvrOTpBb4IBHBO44lOVC21VYj8ii6hTr1ACqYa4SbIaQobByWkWErHNGN9A64LFS rbir4mXJ0Bo0vgfj3jtoGEV8RrbYseYBR2NOaw+1GjRMjoJxyTMgU1XNDZHAVGHiw/KG2cR8 EH4rqj47fLWJLWZy/ffUsWmqDnWvqswbzZjQXT8B4Yls9aqum5pykoNKtbAFT8Xpb/Y9RE1s nkXTuQENBFOzxAwBCADmYFn9nCSLvufCMz9nZFxP7q497a+Dqqwf8hxllH+9S8+g9BYumQF4 A7ZnBSxj3zMlriwL0jPsZqILpO8wuIUQWL0MnJiIbqgatYztVqf2fpaaDzP9XA2C5/BZb5iP 3ONDIVGYd+OQwOI2FlmmTY0B1FlUNXz3+feb3VVTD0/2mxPBOQ2hen0pEZqhU5n2EZH27d8r VPDXVGqQ3CVWO3BD9pyQVTWT5ziDm0f2SIEsY46xuaN+Ml6KnrqfCb8BL/vzcpc87slxGUdR HRCM0P2tZ4f9I+DV7c2RKiluGk1pZkqm+sDfI4dTkjjqpGLH5xN538XGW8YuCEaDUGJZufUf ABEBAAGJATwEGAEKACYCGwwWIQTpjPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDC2AUJDTHMzAAK CRCDGMOVW6sif06oB/0UBwpZL3nBNNutpcCqD/5tDIeCOUy0YKCSZ/EuxtQZ6qIWCZIi6gOs Xurqxg+zqnTQJddlG641m3SVfs73mt7yaDODGbmImKxml1scxV6liXD8DFPbAIfDEYIR7rgu b4D2+OU537cPf/p9IvBn1YUITqnqVBnUIODT3F74kpKAL4oOqafS3MYrJ9IK6FECrdeRnLEv WHEFoN4/R54qXOjLuNeh1/fBW9ddzRyanNoHkxy5EcrgRTqMiKgejfRio8zgCM8cbFXZfU3r 8BrK6eDOP0Rc1m0oLGzp2xO+OeJZrlWRn0XhI51JvER6fUNlFil5ad3sZWY7zqf7lRKQoJc+ tCJBbGV4YW5kZXIgTW90aW4gPG1hdmJzZEBnbWFpbC5jb20+uQENBFOzxAwBCADmYFn9nCSL vufCMz9nZFxP7q497a+Dqqwf8hxllH+9S8+g9BYumQF4A7ZnBSxj3zMlriwL0jPsZqILpO8w uIUQWL0MnJiIbqgatYztVqf2fpaaDzP9XA2C5/BZb5iP3ONDIVGYd+OQwOI2FlmmTY0B1FlU NXz3+feb3VVTD0/2mxPBOQ2hen0pEZqhU5n2EZH27d8rVPDXVGqQ3CVWO3BD9pyQVTWT5ziD m0f2SIEsY46xuaN+Ml6KnrqfCb8BL/vzcpc87slxGUdRHRCM0P2tZ4f9I+DV7c2RKiluGk1p Zkqm+sDfI4dTkjjqpGLH5xN538XGW8YuCEaDUGJZufUfABEBAAGJATwEGAEKACYCGwwWIQTp jPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDC2AUJDTHMzAAKCRCDGMOVW6sif06oB/0UBwpZL3nB NNutpcCqD/5tDIeCOUy0YKCSZ/EuxtQZ6qIWCZIi6gOsXurqxg+zqnTQJddlG641m3SVfs73 mt7yaDODGbmImKxml1scxV6liXD8DFPbAIfDEYIR7rgub4D2+OU537cPf/p9IvBn1YUITqnq VBnUIODT3F74kpKAL4oOqafS3MYrJ9IK6FECrdeRnLEvWHEFoN4/R54qXOjLuNeh1/fBW9dd zRyanNoHkxy5EcrgRTqMiKgejfRio8zgCM8cbFXZfU3r8BrK6eDOP0Rc1m0oLGzp2xO+OeJZ rlWRn0XhI51JvER6fUNlFil5ad3sZWY7zqf7lRKQoJc+ Message-ID: <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> Date: Tue, 6 Jul 2021 15:04:47 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GKBnZ5Vvbz4gxl 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:04:51 -0000 On 06.07.2021 14:55, Kristof Provost wrote: > On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: > The branch main has been updated by ram: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > > commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > Author: Ram Kishore Vegesna > AuthorDate: 2021-06-24 07:05:00 +0000 > Commit: Ram Kishore Vegesna > CommitDate: 2021-07-06 15:38:11 +0000 > > ocs_fc: Add gendump and dump_to_host ioctl command support. > > Support to generate firmware dump. > > Approved by: mav(mentor) > --- > sys/dev/ocs_fc/ocs_gendump.c | 388 > +++++++++++++++++++++++++++++++++++++++++++ > sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ > sys/dev/ocs_fc/ocs_ioctl.c | 13 +- > sys/dev/ocs_fc/ocs_ioctl.h | 3 + > sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- > sys/dev/ocs_fc/ocs_os.c | 3 +- > sys/dev/ocs_fc/ocs_os.h | 3 +- > sys/modules/ocs_fc/Makefile | 3 +- > 8 files changed, 449 insertions(+), 158 deletions(-) > > I’m seeing this build failure (amd64, GENERIC kernel): > > |ld: error: undefined symbol: ocs_gen_dump >>> referenced by > ocs_mgmt.c:485 (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> > ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: ocs_dump_to_host >>>> referenced by ocs_mgmt.c:489 > (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> ocs_mgmt.o:(ocs_mgmt_exec) > *** [kernel.full] Error code 1 | > > Does that ring any bells? d0732fa81963 should fix it. Sorry for breakage. -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Tue Jul 6 19:05:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE18B6661DE; Tue, 6 Jul 2021 19:05:15 +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 4GKBp34qWSz4gy3; Tue, 6 Jul 2021 19:05:15 +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 8D8BD1F152; Tue, 6 Jul 2021 19: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 166J5FoH047304; Tue, 6 Jul 2021 19: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 166J5FDH047303; Tue, 6 Jul 2021 19:05:15 GMT (envelope-from git) Date: Tue, 6 Jul 2021 19:05:15 GMT Message-Id: <202107061905.166J5FDH047303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 2a69eb8c878e - main - cxgb: switch bare zone_mbuf use to m_free_raw 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/main X-Git-Reftype: branch X-Git-Commit: 2a69eb8c878eb5c9a31c37fd08ea292f9a3a0a36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:05:15 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2a69eb8c878eb5c9a31c37fd08ea292f9a3a0a36 commit 2a69eb8c878eb5c9a31c37fd08ea292f9a3a0a36 Author: Mateusz Guzik AuthorDate: 2021-07-06 16:25:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-06 19:05:11 +0000 cxgb: switch bare zone_mbuf use to m_free_raw Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/cxgb/cxgb_sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 00b67880fcc8..0d415d94224f 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -806,7 +806,7 @@ free_rx_bufs(adapter_t *sc, struct sge_fl *q) uma_zfree(zone_pack, d->m); } else { m_init(d->m, M_NOWAIT, MT_DATA, 0); - uma_zfree(zone_mbuf, d->m); + m_free_raw(d->m); uma_zfree(q->zone, d->rxsd_cl); } } From owner-dev-commits-src-all@freebsd.org Tue Jul 6 19:18:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 15CA9666409; Tue, 6 Jul 2021 19:18:32 +0000 (UTC) (envelope-from kp@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 4GKC5M71kBz4j48; Tue, 6 Jul 2021 19:18:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id BF9A5AB35; Tue, 6 Jul 2021 19:18:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 3BC2A45F2C; Tue, 6 Jul 2021 21:18:29 +0200 (CEST) From: "Kristof Provost" To: "Alexander Motin" Cc: "Ram Kishore Vegesna" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. Date: Tue, 06 Jul 2021 21:18:28 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <0BD4E409-AD73-45F8-80B4-99E6FAC7BFE6@FreeBSD.org> In-Reply-To: <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:18:32 -0000 On 6 Jul 2021, at 21:04, Alexander Motin wrote: > On 06.07.2021 14:55, Kristof Provost wrote: >> On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: >> The branch main has been updated by ram: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D29e2dbd42c3e2e10e606b341= 4f4d0c53021d4e86 >> >> commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 >> Author: Ram Kishore Vegesna >> AuthorDate: 2021-06-24 07:05:00 +0000 >> Commit: Ram Kishore Vegesna >> CommitDate: 2021-07-06 15:38:11 +0000 >> >> ocs_fc: Add gendump and dump_to_host ioctl command support. >> >> Support to generate firmware dump. >> >> Approved by: mav(mentor) >> --- >> sys/dev/ocs_fc/ocs_gendump.c | 388 >> +++++++++++++++++++++++++++++++++++++++++++ >> sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ >> sys/dev/ocs_fc/ocs_ioctl.c | 13 +- >> sys/dev/ocs_fc/ocs_ioctl.h | 3 + >> sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- >> sys/dev/ocs_fc/ocs_os.c | 3 +- >> sys/dev/ocs_fc/ocs_os.h | 3 +- >> sys/modules/ocs_fc/Makefile | 3 +- >> 8 files changed, 449 insertions(+), 158 deletions(-) >> >> I=E2=80=99m seeing this build failure (amd64, GENERIC kernel): >> >> |ld: error: undefined symbol: ocs_gen_dump >>> referenced by >> ocs_mgmt.c:485 (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> >> ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: = >> ocs_dump_to_host >>>>> referenced by ocs_mgmt.c:489 >> (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> = >> ocs_mgmt.o:(ocs_mgmt_exec) >> *** [kernel.full] Error code 1 | >> >> Does that ring any bells? > > d0732fa81963 should fix it. Sorry for breakage. > That works. Thanks for the quick fix. =E2=80=94 Kristof From owner-dev-commits-src-all@freebsd.org Tue Jul 6 19:26:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5B4C0666EF6; Tue, 6 Jul 2021 19:26: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 4GKCH227nMz4kk3; Tue, 6 Jul 2021 19:26: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 3275C1F65D; Tue, 6 Jul 2021 19:26: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 166JQsc2074749; Tue, 6 Jul 2021 19:26:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 166JQsLw074748; Tue, 6 Jul 2021 19:26:54 GMT (envelope-from git) Date: Tue, 6 Jul 2021 19:26:54 GMT Message-Id: <202107061926.166JQsLw074748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: e834f9a44acc - main - tcp: Address goodput and TLP edge cases. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e834f9a44acc577e658f40023d9465e887c94920 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 19:26:54 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=e834f9a44acc577e658f40023d9465e887c94920 commit e834f9a44acc577e658f40023d9465e887c94920 Author: Randall Stewart AuthorDate: 2021-07-06 14:36:14 +0000 Commit: Randall Stewart CommitDate: 2021-07-06 19:26:37 +0000 tcp: Address goodput and TLP edge cases. There are several cases where we make a goodput measurement and we are running out of data when we decide to make the measurement. In reality we should not make such a measurement if there is no chance we can have "enough" data. There is also some corner case TLP's that end up not registering as a TLP like they should, we fix this by pushing the doing_tlp setup to the actual timeout that knows it did a TLP. This makes it so we always have the appropriate flag on the sendmap indicating a TLP being done as well as count correctly so we make no more that two TLP's. In addressing the goodput lets also add a "quality" metric that can be viewed via blackbox logs so that a casual observer does not have to figure out how good of a measurement it is. This is needed due to the fact that we may still make a measurement that is of a poorer quality as we run out of data but still have a minimal amount of data to make a measurement. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31076 --- sys/netinet/tcp_stacks/rack.c | 329 +++++++++++++++++++++++++++----------- sys/netinet/tcp_stacks/tcp_rack.h | 11 ++ 2 files changed, 251 insertions(+), 89 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 6678ca92738b..b5727f7873fd 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -458,9 +458,11 @@ rack_log_alt_to_to_cancel(struct tcp_rack *rack, uint32_t flex3, uint32_t flex4, uint32_t flex5, uint32_t flex6, uint16_t flex7, uint8_t mod); + static void rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, - uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, int line, struct rack_sendmap *rsm); + uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, int line, + struct rack_sendmap *rsm, uint8_t quality); static struct rack_sendmap * rack_find_high_nonack(struct tcp_rack *rack, struct rack_sendmap *rsm); @@ -472,7 +474,7 @@ rack_get_sockopt(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp, struct tcp_rack *rack); static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, - tcp_seq th_ack, int line); + tcp_seq th_ack, int line, uint8_t quality); static uint32_t rack_get_pacing_len(struct tcp_rack *rack, uint64_t bw, uint32_t mss); static int32_t rack_handoff_ok(struct tcpcb *tp); @@ -1566,9 +1568,6 @@ rack_init_sysctls(void) SYSCTL_CHILDREN(rack_counters), OID_AUTO, "hwpace_lost", CTLFLAG_RD, &rack_hw_pace_lost, "Total number of times we failed to initialize hw pacing"); - - - rack_badfr = counter_u64_alloc(M_WAITOK); SYSCTL_ADD_COUNTER_U64(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_counters), @@ -3045,7 +3044,7 @@ rack_get_measure_window(struct tcpcb *tp, struct tcp_rack *rack) /* * We have no measurement (IW is in flight?) so * we can only guess using our data_window sysctl - * value (usually 100MSS). + * value (usually 20MSS). */ return (def_len); } @@ -3113,7 +3112,7 @@ rack_get_measure_window(struct tcpcb *tp, struct tcp_rack *rack) } static int -rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack) +rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack, uint8_t *quality) { uint32_t tim, srtts, segsiz; @@ -3123,6 +3122,7 @@ rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ if ((tp->snd_max == tp->snd_una) || (th_ack == tp->snd_max)){ /* All is acked */ + *quality = RACK_QUALITY_ALLACKED; return (1); } if (SEQ_LT(th_ack, tp->gput_seq)) { @@ -3136,17 +3136,19 @@ rack_enough_for_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ return (0); } if (rack->r_ctl.rc_first_appl && - (rack->r_ctl.rc_first_appl->r_start == th_ack)) { + (SEQ_GEQ(th_ack, rack->r_ctl.rc_first_appl->r_end))) { /* - * We are up to the app limited point + * We are up to the app limited send point * we have to measure irrespective of the time.. */ + *quality = RACK_QUALITY_APPLIMITED; return (1); } /* Now what about time? */ srtts = (rack->r_ctl.rc_gp_srtt * rack_min_srtts); tim = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time) - tp->gput_ts; if (tim >= srtts) { + *quality = RACK_QUALITY_HIGH; return (1); } /* Nope not even a full SRTT has passed */ @@ -3673,7 +3675,8 @@ rack_enter_probertt(struct tcp_rack *rack, uint32_t us_cts) * now. */ rack_do_goodput_measurement(rack->rc_tp, rack, - rack->rc_tp->snd_una, __LINE__); + rack->rc_tp->snd_una, __LINE__, + RACK_QUALITY_PROBERTT); } rack->r_ctl.rack_per_of_gp_probertt = rack_per_of_gp_probertt; rack->r_ctl.rc_time_probertt_entered = us_cts; @@ -3711,7 +3714,8 @@ rack_exit_probertt(struct tcp_rack *rack, uint32_t us_cts) * now. */ rack_do_goodput_measurement(rack->rc_tp, rack, - rack->rc_tp->snd_una, __LINE__); + rack->rc_tp->snd_una, __LINE__, + RACK_QUALITY_PROBERTT); } else if (rack->rc_tp->t_flags & TF_GPUTINPROG) { /* * We don't have enough data to make a measurement. @@ -4188,7 +4192,7 @@ rack_make_timely_judgement(struct tcp_rack *rack, uint32_t rtt, int32_t rtt_diff static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, - tcp_seq th_ack, int line) + tcp_seq th_ack, int line, uint8_t quality) { uint64_t tim, bytes_ps, ltim, stim, utim; uint32_t segsiz, bytes, reqbytes, us_cts; @@ -4202,7 +4206,6 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, tim = us_cts - tp->gput_ts; else tim = 0; - if (rack->r_ctl.rc_gp_cumack_ts > rack->r_ctl.rc_gp_output_ts) stim = rack->r_ctl.rc_gp_cumack_ts - rack->r_ctl.rc_gp_output_ts; else @@ -4230,7 +4233,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } if (rack->r_ctl.rc_gp_lowrtt == 0xffffffff) { @@ -4238,7 +4241,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } /* @@ -4275,7 +4278,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, bytes = 0; bytes_ps = 0; rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, - 0, 0, 0, 10, __LINE__, NULL); + 0, 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } else bytes = (th_ack - tp->gput_seq); @@ -4307,7 +4310,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, if ((bytes_ps < reqbytes) || rack->app_limited_needs_set) { rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, rack->r_ctl.rc_app_limited_cnt, - 0, 0, 10, __LINE__, NULL); + 0, 0, 10, __LINE__, NULL, quality); goto skip_measurement; } /* @@ -4349,7 +4352,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, */ rack_log_pacing_delay_calc(rack, bytes, reqbytes, bytes_ps, rack->r_ctl.last_max_bw, 0, - 11, __LINE__, NULL); + 11, __LINE__, NULL, quality); bytes_ps = rack->r_ctl.last_max_bw; } /* We store gp for b/w in bytes per second */ @@ -4363,7 +4366,7 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, } else { rack_log_pacing_delay_calc(rack, bytes_ps, reqbytes, rack->r_ctl.rc_app_limited_cnt, - 0, 0, 10, __LINE__, NULL); + 0, 0, 10, __LINE__, NULL, quality); } if (rack->rc_inp->inp_in_hpts && (rack->r_ctl.rc_hpts_flags & PACE_PKT_OUTPUT)) { @@ -4504,14 +4507,14 @@ rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, rack_apply_deferred_options(rack); } rack_log_pacing_delay_calc(rack, subpart, addpart, bytes_ps, stim, - rack_get_bw(rack), 22, did_add, NULL); + rack_get_bw(rack), 22, did_add, NULL, quality); /* We do not update any multipliers if we are in or have seen a probe-rtt */ if ((rack->measure_saw_probe_rtt == 0) && rack->rc_gp_rtt_set) rack_update_multiplier(rack, timely_says, bytes_ps, rack->r_ctl.rc_gp_srtt, rack->r_ctl.rc_rtt_diff); rack_log_pacing_delay_calc(rack, bytes, tim, bytes_ps, stim, - rack_get_bw(rack), 3, line, NULL); + rack_get_bw(rack), 3, line, NULL, quality); /* reset the gp srtt and setup the new prev */ rack->r_ctl.rc_prev_gp_srtt = rack->r_ctl.rc_gp_srtt; /* Record the lost count for the next measurement */ @@ -4554,14 +4557,13 @@ skip_measurement: TCPS_HAVEESTABLISHED(tp->t_state) && rack->r_ctl.rc_app_limited_cnt && (SEQ_GT(rack->r_ctl.rc_first_appl->r_start, th_ack)) && - ((rack->r_ctl.rc_first_appl->r_start - th_ack) > + ((rack->r_ctl.rc_first_appl->r_end - th_ack) > max(rc_init_window(rack), (MIN_GP_WIN * segsiz)))) { /* * Yep there is enough outstanding to make a measurement here. */ struct rack_sendmap *rsm, fe; - tp->t_flags |= TF_GPUTINPROG; rack->r_ctl.rc_gp_lowrtt = 0xffffffff; rack->r_ctl.rc_gp_high_rwnd = rack->rc_tp->snd_wnd; tp->gput_ts = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time); @@ -4572,13 +4574,34 @@ skip_measurement: else if ((rack->measure_saw_probe_rtt) && (SEQ_GEQ(tp->gput_seq, rack->r_ctl.rc_probertt_sndmax_atexit))) rack->measure_saw_probe_rtt = 0; - if ((rack->r_ctl.rc_first_appl->r_start - th_ack) >= rack_get_measure_window(tp, rack)) { + if ((rack->r_ctl.rc_first_appl->r_end - th_ack) >= rack_get_measure_window(tp, rack)) { /* There is a full window to gain info from */ tp->gput_ack = tp->gput_seq + rack_get_measure_window(tp, rack); } else { /* We can only measure up to the applimited point */ - tp->gput_ack = tp->gput_seq + (rack->r_ctl.rc_first_appl->r_start - th_ack); + tp->gput_ack = tp->gput_seq + (rack->r_ctl.rc_first_appl->r_end - th_ack); + if ((tp->gput_ack - tp->gput_seq) < (MIN_GP_WIN * segsiz)) { + /* + * We don't have enough to make a measurement. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, tp->gput_ack, tp->gput_seq, + 0, 0, 0, 6, __LINE__, NULL, quality); + return; + } + } + if (tp->t_state >= TCPS_FIN_WAIT_1) { + /* + * We will get no more data into the SB + * this means we need to have the data available + * before we start a measurement. + */ + if (sbavail(&tp->t_inpcb->inp_socket->so_snd) < (tp->gput_ack - tp->gput_seq)) { + /* Nope not enough data. */ + return; + } } + tp->t_flags |= TF_GPUTINPROG; /* * Now we need to find the timestamp of the send at tp->gput_seq * for the send based measurement. @@ -4619,7 +4642,7 @@ skip_measurement: tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, quality); } } @@ -4632,7 +4655,7 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint { uint32_t prior_cwnd, acked; struct tcp_log_buffer *lgb = NULL; - uint8_t labc_to_use; + uint8_t labc_to_use, quality; INP_WLOCK_ASSERT(tp->t_inpcb); tp->ccv->nsegs = nsegs; @@ -4649,10 +4672,11 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *rack, uint32_t th_ack, uint stats_voi_update_abs_s32(tp->t_stats, VOI_TCP_CALCFRWINDIFF, ((int32_t)rack->r_ctl.cwnd_to_use) - tp->snd_wnd); #endif + quality = RACK_QUALITY_NONE; if ((tp->t_flags & TF_GPUTINPROG) && - rack_enough_for_measurement(tp, rack, th_ack)) { + rack_enough_for_measurement(tp, rack, th_ack, &quality)) { /* Measure the Goodput */ - rack_do_goodput_measurement(tp, rack, th_ack, __LINE__); + rack_do_goodput_measurement(tp, rack, th_ack, __LINE__, quality); #ifdef NETFLIX_PEAKRATE if ((type == CC_ACK) && (tp->t_maxpeakrate)) { @@ -5511,7 +5535,8 @@ rack_enter_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) * Stop the goodput now, the calling of the * measurement function clears the flag. */ - rack_do_goodput_measurement(tp, rack, tp->snd_una, __LINE__); + rack_do_goodput_measurement(tp, rack, tp->snd_una, __LINE__, + RACK_QUALITY_PERSIST); } #ifdef NETFLIX_SHARED_CWND if (rack->r_ctl.rc_scw) { @@ -5678,7 +5703,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tcpcb *tp, uint32_t cts, rack->r_ctl.rc_hpts_flags = 0; us_cts = tcp_get_usecs(&tv); /* Now early/late accounting */ - rack_log_pacing_delay_calc(rack, entry_slot, slot, 0, 0, 0, 26, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, entry_slot, slot, 0, 0, 0, 26, __LINE__, NULL, 0); if (rack->r_early && (rack->rc_ack_can_sendout_data == 0)) { /* * We have a early carry over set, @@ -5820,7 +5845,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tcpcb *tp, uint32_t cts, hpts_timeout = 0x7ffffffe; rack->r_ctl.rc_timer_exp = cts + hpts_timeout; } - rack_log_pacing_delay_calc(rack, entry_slot, slot, hpts_timeout, 0, 0, 27, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, entry_slot, slot, hpts_timeout, 0, 0, 27, __LINE__, NULL, 0); if ((rack->gp_ready == 0) && (rack->use_fixed_rate == 0) && (hpts_timeout < slot) && @@ -6152,7 +6177,7 @@ rack_merge_rsm(struct tcp_rack *rack, * when all timers have been stopped (destroyed PCB?). */ static int -rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) +rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t *doing_tlp) { /* * Tail Loss Probe. @@ -6194,6 +6219,22 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) collapsed_win = 1; goto need_retran; } + if ((tp->t_flags & TF_GPUTINPROG) && + (rack->r_ctl.rc_tlp_cnt_out == 1)) { + /* + * If this is the second in a row + * TLP and we are doing a measurement + * its time to abandon the measurement. + * Something is likely broken on + * the clients network and measuring a + * broken network does us no good. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } /* * Check our send oldest always settings, and if * there is an oldest to send jump to the need_retran. @@ -6219,6 +6260,7 @@ rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) if (rack->rack_no_prr == 0) { if (out + amm <= tp->snd_wnd) { rack->r_ctl.rc_prr_sndcnt = amm; + rack->r_ctl.rc_tlp_new_data = amm; rack_log_to_prr(rack, 4, 0); } } else @@ -6312,6 +6354,8 @@ need_retran: } rack->r_ctl.rc_tlpsend = rsm; send: + /* Make sure output path knows we are doing a TLP */ + *doing_tlp = 1; rack->r_timer_override = 1; rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); @@ -6675,6 +6719,20 @@ rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) if (tp->t_timers->tt_flags & TT_STOPPED) { return (1); } + if ((tp->t_flags & TF_GPUTINPROG) && + (tp->t_rxtshift)) { + /* + * We have had a second timeout + * measurements on successive rxt's are not profitable. + * It is unlikely to be of any use (the network is + * broken or the client went away). + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } if (ctf_progress_timeout_check(tp, false)) { tcp_log_end_status(tp, TCP_EI_STATUS_RETRAN); rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); @@ -6912,11 +6970,37 @@ out: } static int -rack_process_timers(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t hpts_calling) +rack_process_timers(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, uint8_t hpts_calling, uint8_t *doing_tlp) { int32_t ret = 0; int32_t timers = (rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } if (timers == 0) { return (0); } @@ -6980,7 +7064,7 @@ skip_time_check: ret = rack_timeout_rack(tp, rack, cts); } else if (timers & PACE_TMR_TLP) { rack->r_ctl.rc_tlp_rxt_last_time = cts; - ret = rack_timeout_tlp(tp, rack, cts); + ret = rack_timeout_tlp(tp, rack, cts, doing_tlp); } else if (timers & PACE_TMR_RXT) { rack->r_ctl.rc_tlp_rxt_last_time = cts; rack->r_fast_output = 0; @@ -8106,7 +8190,7 @@ rack_need_set_test(struct tcpcb *tp, (SEQ_GEQ(tp->gput_seq, rack->r_ctl.rc_probertt_sndmax_atexit))) rack->measure_saw_probe_rtt = 0; rack_log_pacing_delay_calc(rack, ts, tp->gput_ts, - seq, tp->gput_seq, 0, 5, line, NULL); + seq, tp->gput_seq, 0, 5, line, NULL, 0); if (rack->rc_gp_filled && ((tp->gput_ack - tp->gput_seq) < max(rc_init_window(rack), (MIN_GP_WIN * @@ -8123,7 +8207,7 @@ rack_need_set_test(struct tcpcb *tp, */ tp->t_flags &= ~TF_GPUTINPROG; rack_log_pacing_delay_calc(rack, tp->gput_ack, tp->gput_seq, - 0, 0, 0, 6, __LINE__, NULL); + 0, 0, 0, 6, __LINE__, NULL, 0); } else { /* * Reset the window further out. @@ -12861,6 +12945,32 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb if (rack->r_state != tp->t_state) rack_set_state(tp, rack); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } to = &to_holder; to->to_flags = 0; KASSERT((m->m_len >= sizeof(struct tcp_ackent)), @@ -13465,6 +13575,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, * tv passed from common code is from either M_TSTMP_LRO or * tcp_get_usecs() if no LRO m_pkthdr timestamp is present. */ + rack = (struct tcp_rack *)tp->t_fb_ptr; + cts = tcp_tv_to_usectick(tv); if (m->m_flags & M_ACKCMP) { return (rack_do_compressed_ack_processing(tp, so, m, nxt_pkt, tv)); } @@ -13479,9 +13591,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, if (thflags & TH_ACK) ts_val = get_cyclecount(); #endif - cts = tcp_tv_to_usectick(tv); - rack = (struct tcp_rack *)tp->t_fb_ptr; - if ((m->m_flags & M_TSTMP) || (m->m_flags & M_TSTMP_LRO)) { mbuf_tstmp2timespec(m, &ts); @@ -13532,6 +13641,32 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, __func__)); KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT", __func__)); + if ((tp->t_state >= TCPS_FIN_WAIT_1) && + (tp->t_flags & TF_GPUTINPROG)) { + /* + * We have a goodput in progress + * and we have entered a late state. + * Do we have enough data in the sb + * to handle the GPUT request? + */ + uint32_t bytes; + + bytes = tp->gput_ack - tp->gput_seq; + if (SEQ_GT(tp->gput_seq, tp->snd_una)) + bytes += tp->gput_seq - tp->snd_una; + if (bytes > sbavail(&tp->t_inpcb->inp_socket->so_snd)) { + /* + * There are not enough bytes in the socket + * buffer that have been sent to cover this + * measurement. Cancel it. + */ + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + tp->t_flags &= ~TF_GPUTINPROG; + } + } if (tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; struct timeval ltv; @@ -13813,6 +13948,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, /* Check in on probertt */ rack_check_probe_rtt(rack, us_cts); } + rack_clear_rate_sample(rack); if (rack->forced_ack) { uint32_t us_rtt; @@ -13828,8 +13964,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, us_rtt = us_cts - rack->r_ctl.forced_ack_ts; if (us_rtt == 0) us_rtt = 1; - rack_log_rtt_upd(tp, rack, us_rtt, 0, NULL, 3); rack_apply_updated_usrtt(rack, us_rtt, us_cts); + tcp_rack_xmit_timer(rack, us_rtt, 0, us_rtt, 3, NULL, 1); } /* * This is the one exception case where we set the rack state @@ -13843,7 +13979,6 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, (rsm = RB_MIN(rack_rb_tree_head, &rack->r_ctl.rc_mtree)) != NULL) kern_prefetch(rsm, &prev_state); prev_state = rack->r_state; - rack_clear_rate_sample(rack); retval = (*rack->r_substate) (m, th, so, tp, &to, drop_hdrlen, tlen, tiwin, thflags, nxt_pkt, iptos); @@ -14088,7 +14223,7 @@ check_it: static void rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, uint64_t bw_est, uint64_t bw, uint64_t len_time, int method, - int line, struct rack_sendmap *rsm) + int line, struct rack_sendmap *rsm, uint8_t quality) { if (rack->rc_tp->t_logstate != TCP_LOG_STATE_OFF) { union tcp_log_stackspecific log; @@ -14145,6 +14280,7 @@ rack_log_pacing_delay_calc(struct tcp_rack *rack, uint32_t len, uint32_t slot, log.u_bbr.cwnd_gain |= rack->rc_gp_saw_ss; log.u_bbr.cwnd_gain <<= 1; log.u_bbr.cwnd_gain |= rack->rc_gp_saw_ca; + log.u_bbr.bbr_substate = quality; TCP_LOG_EVENTP(rack->rc_tp, NULL, &rack->rc_inp->inp_socket->so_rcv, &rack->rc_inp->inp_socket->so_snd, @@ -14269,7 +14405,7 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se *rate_wanted = fill_bw; if (non_paced || (lentim < slot)) { rack_log_pacing_delay_calc(rack, len, slot, fill_bw, - 0, lentim, 12, __LINE__, NULL); + 0, lentim, 12, __LINE__, NULL, 0); return ((int32_t)lentim); } else return (slot); @@ -14278,7 +14414,6 @@ pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t se static int32_t rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, struct rack_sendmap *rsm, uint32_t segsiz) { - struct rack_sendmap *lrsm; int32_t slot = 0; int can_start_hw_pacing = 1; int err; @@ -14331,29 +14466,14 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str slot = 0; } slot *= HPTS_USEC_IN_MSEC; - if (rsm == NULL) { - /* - * We always consider ourselves app limited with old style - * that are not retransmits. This could be the initial - * measurement, but thats ok its all setup and specially - * handled. If another send leaks out, then that too will - * be mark app-limited. - */ - lrsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); - if (lrsm && ((lrsm->r_flags & RACK_APP_LIMITED) == 0)) { - rack->r_ctl.rc_first_appl = lrsm; - lrsm->r_flags |= RACK_APP_LIMITED; - rack->r_ctl.rc_app_limited_cnt++; - } - } if (rack->rc_pace_to_cwnd) { uint64_t rate_wanted = 0; slot = pace_to_fill_cwnd(rack, slot, len, segsiz, NULL, &rate_wanted, 1); rack->rc_ack_can_sendout_data = 1; - rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, 0, 0, 14, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, 0, 0, 14, __LINE__, NULL, 0); } else - rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, tr_perms, reduce, 0, 7, __LINE__, NULL, 0); } else { uint64_t bw_est, res, lentim, rate_wanted; uint32_t orig_val, srtt, segs, oh; @@ -14428,7 +14548,7 @@ rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, str } /* Did we change the TSO size, if so log it */ if (rack->r_ctl.rc_pace_max_segs != orig_val) - rack_log_pacing_delay_calc(rack, len, slot, orig_val, 0, 0, 15, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, len, slot, orig_val, 0, 0, 15, __LINE__, NULL, 0); prev_fill = rack->r_via_fill_cw; if ((rack->rc_pace_to_cwnd) && (capped == 0) && @@ -14582,11 +14702,11 @@ done_w_hdwr: else srtt = RACK_INITIAL_RTO * HPTS_USEC_IN_MSEC; /* its in ms convert */ if (srtt < slot) { - rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, srtt, slot, rate_wanted, bw_est, lentim, 99, __LINE__, NULL, 0); slot = srtt; } } - rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, bw_est, lentim, 2, __LINE__, rsm); + rack_log_pacing_delay_calc(rack, len, slot, rate_wanted, bw_est, lentim, 2, __LINE__, rsm, 0); } if (rack->r_ctl.crte && (rack->r_ctl.crte->rs_num_enobufs > 0)) { /* @@ -14626,6 +14746,20 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, */ return; } + if (tp->t_state >= TCPS_FIN_WAIT_1) { + /* + * We will get no more data into the SB + * this means we need to have the data available + * before we start a measurement. + */ + + if (sbavail(&tp->t_inpcb->inp_socket->so_snd) < + max(rc_init_window(rack), + (MIN_GP_WIN * ctf_fixed_maxseg(tp)))) { + /* Nope not enough data */ + return; + } + } tp->t_flags |= TF_GPUTINPROG; rack->r_ctl.rc_gp_lowrtt = 0xffffffff; rack->r_ctl.rc_gp_high_rwnd = rack->rc_tp->snd_wnd; @@ -14664,7 +14798,7 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, 0); return; } if (sb_offset) { @@ -14672,7 +14806,6 @@ rack_start_gp_measurement(struct tcpcb *tp, struct tcp_rack *rack, * We are out somewhere in the sb * can we use the already outstanding data? */ - if (rack->r_ctl.rc_app_limited_cnt == 0) { /* * Yes first one is good and in this case @@ -14748,7 +14881,7 @@ start_set: tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, 9, - __LINE__, NULL); + __LINE__, NULL, 0); return; } @@ -14796,7 +14929,7 @@ use_latest: (uint64_t)my_rsm, tp->gput_ts, rack->r_ctl.rc_app_limited_cnt, - 9, __LINE__, NULL); + 9, __LINE__, NULL, 0); } static inline uint32_t @@ -15069,7 +15202,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, static int rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendmap *rsm, - uint64_t ts_val, uint32_t cts, uint32_t ms_cts, struct timeval *tv, int len) + uint64_t ts_val, uint32_t cts, uint32_t ms_cts, struct timeval *tv, int len, uint8_t doing_tlp) { /* * Enter the fast retransmit path. We are given that a sched_pin is @@ -15090,7 +15223,6 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma uint64_t crtsc; int cnt_thru = 1; #endif - int doing_tlp = 0; struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; @@ -15116,6 +15248,8 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma } if (rsm->r_flags & RACK_TLP) doing_tlp = 1; + else if (doing_tlp) + rsm->r_flags |= RACK_TLP; startseq = rsm->r_start; segsiz = min(ctf_fixed_maxseg(tp), rack->r_ctl.rc_pace_min_segs); inp = rack->rc_inp; @@ -15371,7 +15505,10 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma log.u_bbr.flex6 = rack->r_ctl.rc_agg_early; log.u_bbr.applimited = rack->r_ctl.rc_agg_delayed; log.u_bbr.bw_inuse = rack_get_bw(rack); - log.u_bbr.flex8 = 1; + if (doing_tlp == 0) + log.u_bbr.flex8 = 1; + else + log.u_bbr.flex8 = 2; log.u_bbr.pacing_gain = rack_get_output_gain(rack, NULL); log.u_bbr.flex7 = 55; log.u_bbr.pkts_out = tp->t_maxseg; @@ -16010,6 +16147,7 @@ rack_output(struct tcpcb *tp) int32_t sup_rack = 0; uint32_t cts, ms_cts, delayed, early; uint16_t add_flag = RACK_SENT_SP; + /* The doing_tlp flag will be set by the actual rack_timeout_tlp() */ uint8_t hpts_calling, doing_tlp = 0; uint32_t cwnd_to_use, pace_max_seg; int32_t do_a_prefetch = 0; @@ -16090,7 +16228,7 @@ rack_output(struct tcpcb *tp) } /* Do the timers, which may override the pacer */ if (rack->r_ctl.rc_hpts_flags & PACE_TMR_MASK) { - if (rack_process_timers(tp, rack, cts, hpts_calling)) { + if (rack_process_timers(tp, rack, cts, hpts_calling, &doing_tlp)) { counter_u64_add(rack_out_size[TCP_MSS_ACCT_ATIMER], 1); #ifdef TCP_ACCOUNTING sched_unpin(); @@ -16158,6 +16296,7 @@ rack_output(struct tcpcb *tp) rack_set_state(tp, rack); } if ((rack->r_fast_output) && + (doing_tlp == 0) && (tp->rcv_numsacks == 0)) { int ret; @@ -16323,7 +16462,6 @@ again: long cwin; long tlen; - doing_tlp = 1; /* * Check if we can do a TLP with a RACK'd packet * this can happen if we are not doing the rack @@ -16422,7 +16560,7 @@ again: ((rsm->r_flags & RACK_HAS_FIN) == 0)) { int ret; - ret = rack_fast_rsm_output(tp, rack, rsm, ts_val, cts, ms_cts, &tv, len); + ret = rack_fast_rsm_output(tp, rack, rsm, ts_val, cts, ms_cts, &tv, len, doing_tlp); if (ret == 0) return (0); } @@ -16516,8 +16654,6 @@ again: } else { len = rack->r_ctl.rc_tlp_new_data; } - rack->r_ctl.rc_tlp_new_data = 0; - doing_tlp = 1; } else { len = rack_what_can_we_send(tp, rack, cwnd_to_use, avail, sb_offset); } @@ -17167,12 +17303,23 @@ just_return_nolock: if (end_window) { uint8_t log = 0; + /* Adjust the Gput measurement */ if ((tp->t_flags & TF_GPUTINPROG) && SEQ_GT(tp->gput_ack, tp->snd_max)) { - /* Mark the last packet has app limited */ tp->gput_ack = tp->snd_max; - log = 1; + if ((tp->gput_ack - tp->gput_seq) < (MIN_GP_WIN * segsiz)) { + /* + * There is not enough to measure. + */ + tp->t_flags &= ~TF_GPUTINPROG; + rack_log_pacing_delay_calc(rack, (tp->gput_ack - tp->gput_seq) /*flex2*/, + rack->r_ctl.rc_gp_srtt /*flex1*/, + tp->gput_seq, + 0, 0, 18, __LINE__, NULL, 0); + } else + log = 1; } + /* Mark the last packet has app limited */ rsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); if (rsm && ((rsm->r_flags & RACK_APP_LIMITED) == 0)) { if (rack->r_ctl.rc_app_limited_cnt == 0) @@ -17193,7 +17340,7 @@ just_return_nolock: if (log) rack_log_pacing_delay_calc(rack, rack->r_ctl.rc_app_limited_cnt, seq, - tp->gput_ack, 0, 0, 4, __LINE__, NULL); + tp->gput_ack, 0, 0, 4, __LINE__, NULL, 0); } } if (slot) { @@ -18141,6 +18288,10 @@ out: rack->rc_gp_saw_ss = 1; } } + if (doing_tlp && (rsm == NULL)) { + /* Make sure new data TLP cnt is clear */ + rack->r_ctl.rc_tlp_new_data = 0; + } if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) @@ -18624,7 +18775,7 @@ rack_update_seg(struct tcp_rack *rack) orig_val = rack->r_ctl.rc_pace_max_segs; rack_set_pace_segments(rack->rc_tp, rack, __LINE__, NULL); if (orig_val != rack->r_ctl.rc_pace_max_segs) - rack_log_pacing_delay_calc(rack, 0, 0, orig_val, 0, 0, 15, __LINE__, NULL); + rack_log_pacing_delay_calc(rack, 0, 0, orig_val, 0, 0, 15, __LINE__, NULL, 0); } static void @@ -19242,7 +19393,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL,0); break; case TCP_RACK_PACE_RATE_SS: @@ -19260,7 +19411,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_PACE_RATE_CA: @@ -19278,7 +19429,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rc_fixed_pacing_rate_ss, rack->r_ctl.rc_fixed_pacing_rate_ca, rack->r_ctl.rc_fixed_pacing_rate_rec, 0, 0, 8, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_REC: RACK_OPTS_INC(tcp_gp_inc_rec); @@ -19287,7 +19438,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_CA: RACK_OPTS_INC(tcp_gp_inc_ca); @@ -19305,7 +19456,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_GP_INCREASE_SS: RACK_OPTS_INC(tcp_gp_inc_ss); @@ -19323,7 +19474,7 @@ rack_process_option(struct tcpcb *tp, struct tcp_rack *rack, int sopt_name, rack->r_ctl.rack_per_of_gp_ss, rack->r_ctl.rack_per_of_gp_ca, rack->r_ctl.rack_per_of_gp_rec, 0, 0, 1, - __LINE__, NULL); + __LINE__, NULL, 0); break; case TCP_RACK_RR_CONF: RACK_OPTS_INC(tcp_rack_rrr_no_conf_rate); @@ -19555,8 +19706,8 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, case TCP_RACK_GP_INCREASE_REC: /* URL:gp_inc_rec */ case TCP_RACK_RR_CONF: /* URL:rrr_conf */ case TCP_BBR_HDWR_PACE: /* URL:hdwrpace */ - case TCP_HDWR_RATE_CAP: /* URL: hdwrcap boolean */ - case TCP_PACING_RATE_CAP: /* URL:cap-- used by side-channel */ + case TCP_HDWR_RATE_CAP: /* URL:hdwrcap boolean */ + case TCP_PACING_RATE_CAP: /* URL:cap -- used by side-channel */ case TCP_HDWR_UP_ONLY: /* URL:uponly -- hardware pacing boolean */ /* End pacing related */ case TCP_FAST_RSM_HACK: /* URL:frsm_hack */ diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 54582d4fd9c5..55ebb07549d0 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -268,6 +268,15 @@ struct rack_opts_stats { #define TLP_USE_TWO_TWO 3 /* Use 2.2 behavior */ #define RACK_MIN_BW 8000 /* 64kbps in Bps */ +/* Rack quality indicators for GPUT measurements */ +#define RACK_QUALITY_NONE 0 /* No quality stated */ +#define RACK_QUALITY_HIGH 1 /* A normal measurement of a GP RTT */ +#define RACK_QUALITY_APPLIMITED 2 /* An app limited case that may be of lower quality */ +#define RACK_QUALITY_PERSIST 3 /* A measurement where we went into persists */ +#define RACK_QUALITY_PROBERTT 4 /* A measurement where we went into or exited probe RTT */ +#define RACK_QUALITY_ALLACKED 5 /* All data is now acknowledged */ + + #define MIN_GP_WIN 6 /* We need at least 6 MSS in a GP measurement */ #ifdef _KERNEL #define RACK_OPTS_SIZE (sizeof(struct rack_opts_stats)/sizeof(uint64_t)) @@ -318,6 +327,7 @@ extern counter_u64_t rack_opts_arry[RACK_OPTS_SIZE]; #define RACK_GP_HIST 4 /* How much goodput history do we maintain? */ #define RACK_NUM_FSB_DEBUG 16 +#ifdef _KERNEL struct rack_fast_send_blk { uint32_t left_to_send; uint16_t tcp_ip_hdr_len; @@ -501,6 +511,7 @@ struct rack_control { uint8_t rc_rate_sample_method; uint8_t rc_gp_hist_idx; }; +#endif #define RACK_TIMELY_CNT_BOOST 5 /* At 5th increase boost */ #define RACK_MINRTT_FILTER_TIM 10 /* Seconds */ From owner-dev-commits-src-all@freebsd.org Tue Jul 6 21:42:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 578D7648CEF; Tue, 6 Jul 2021 21:42:53 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 4GKGHx1pctz3JK0; Tue, 6 Jul 2021 21:42:53 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: by mail-oi1-f179.google.com with SMTP id h9so975375oih.4; Tue, 06 Jul 2021 14:42:53 -0700 (PDT) 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:content-transfer-encoding; bh=Sn9hrf7Xd1oxpLCYfT20DzRJi1jK+ITgAaBlaIrsdbE=; b=kkQlSp7L5+3o3S4KgGZA6t3ojTER9085H6MQs4sC2dpIO3TJI6jfZNI1oPoCJfjsCK 51Bg6D4v4LNtaO64bNBC4EKaQGT6gW4IvmdmF4t8krUBklamz6JkH3c0NvLptG49gEzc eOR1RvP0qGuju1QGFXutB/oGDI/Lz+7PAqBC2dG404rPuE5v+KNjhDA9Ier6F6knm0mO 4Mrc3MStSG3d77aLLESJfM61ZFrjh/nDlYQnaYodmpOVyQqZHR3R/YxfteQLDLeU5+Er DtGdpmMBVDPXmv9xM+Jiigw6+BGQtgJl0/xWazOYHOmPOQJUCditqLAon4VSvbd1Wx+J wsYA== X-Gm-Message-State: AOAM5307XdJGRDqx1YJcrjKIHsrrQKHBwH1xeYQxpvispQ74VA62IP0A VXh9Yhi5opIzXOb7fdMirERSLq/csAX3wQ== X-Google-Smtp-Source: ABdhPJzL3xYPqv0it/9+8OHFAg5n+nYNuZGjYRoKe/5/QKnkpahwDHPapn7T9TQd+wMyzv9bGz+ANw== X-Received: by 2002:aca:dc44:: with SMTP id t65mr16148666oig.76.1625607771526; Tue, 06 Jul 2021 14:42:51 -0700 (PDT) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com. [209.85.210.53]) by smtp.gmail.com with ESMTPSA id o26sm3664302oic.12.2021.07.06.14.42.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 14:42:51 -0700 (PDT) Received: by mail-ot1-f53.google.com with SMTP id d27-20020a05683018fbb02904ae64d1b56bso221628otf.9; Tue, 06 Jul 2021 14:42:51 -0700 (PDT) X-Received: by 2002:a25:bb08:: with SMTP id z8mr28378392ybg.188.1625607411652; Tue, 06 Jul 2021 14:36:51 -0700 (PDT) MIME-Version: 1.0 References: <202106300806.15U86pGq037942@gitrepo.freebsd.org> <20210706090311.aomxh4n45tkpktdc@aniel.nours.eu> In-Reply-To: <20210706090311.aomxh4n45tkpktdc@aniel.nours.eu> From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= Date: Tue, 6 Jul 2021 21:34:40 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 0a0f7486413c - main - man: Build manpages for all architectures To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4GKGHx1pctz3JK0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2021 21:42:53 -0000 On Tue, Jul 6, 2021 at 11:03 AM Baptiste Daroussin wrote= : > > On Wed, Jun 30, 2021 at 08:06:51AM +0000, Fernando Apestegu=C3=ADa wrote: > > The branch main has been updated by fernape (doc, ports committer): > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D0a0f7486413c147d56808b38= 055c40c64cff61f5 > > > > commit 0a0f7486413c147d56808b38055c40c64cff61f5 > > Author: Fernando Apestegu=C3=ADa > > AuthorDate: 2021-06-09 10:58:04 +0000 > > Commit: Fernando Apestegu=C3=ADa > > CommitDate: 2021-06-30 07:57:51 +0000 > > > > man: Build manpages for all architectures > > > > Building and installing architecture-specific man pages only raises= a number of > > problems: > > > > * The https://www.freebsd.org/cgi/man.cgi is incomplete. As an > > example, it does not show results for pae(4). The reason for thi= s is > > that the cgi interface runs on FreeBSD amd64. > > > > * In FreeBSD amd64 some manual pages have broken X-refs. See hptrr= (4) > > for an example. > > > > * Also, we have broken links in our Release Notes. This is a > > consequence of the first point. See > > https://www.freebsd.org/releases/13.0R/hardware/#proc-i386. > > > > Make MAN_ARCH default to 'all' so we build all the man pages for al= l the > > architectures. The difference in disk space is negligible. Also lin= k > > architecture-specific man pages to their own section while keeping = their own > > namespace. > > > > PR: 212290 > > Reported by: mj@bsdops.com > > Approved by: ceri@, wosch@ > > MFC after: 4 weeks > > --- > > sbin/Makefile | 6 ++++++ > > share/man/man4/Makefile | 4 +--- > > share/man/man4/man4.aarch64/Makefile | 5 +++++ > > share/man/man4/man4.arm/Makefile | 5 +++++ > > share/man/man4/man4.i386/Makefile | 5 +++++ > > share/man/man4/man4.powerpc/Makefile | 5 +++++ > > share/man/man5/make.conf.5 | 2 +- > > usr.sbin/Makefile | 7 +++++++ > > usr.sbin/apm/Makefile | 4 ++++ > > 9 files changed, 39 insertions(+), 4 deletions(-) > > > > diff --git a/sbin/Makefile b/sbin/Makefile > > index 64840bae82bb..f53e2f037ebe 100644 > > --- a/sbin/Makefile > > +++ b/sbin/Makefile > > @@ -90,6 +90,12 @@ SUBDIR.${MK_ZFS}+=3D zfsbootcfg > > > > SUBDIR.${MK_TESTS}+=3D tests > > > > +# Add architecture-specific manpages > > +# to be included anyway > > +MAN=3D sconfig/sconfig.8 > > + > > +.include > > + > > .include > > > > SUBDIR_PARALLEL=3D > > diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile > > index 5051470edc71..9027fe7df841 100644 > > --- a/share/man/man4/Makefile > > +++ b/share/man/man4/Makefile > > @@ -895,9 +895,7 @@ _cgem.4=3D cgem.4 > > MLINKS+=3Dcgem.4 if_cgem.4 > > .endif > > > > -.if empty(MAN_ARCH) > > -__arches=3D ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH} > > -.elif ${MAN_ARCH} =3D=3D "all" > > +.if empty(MAN_ARCH) || ${MAN_ARCH} =3D=3D "all" > > __arches=3D ${:!/bin/sh -c "/bin/ls -d ${.CURDIR}/man4.*"!:E} > > .else > > __arches=3D ${MAN_ARCH} > > diff --git a/share/man/man4/man4.aarch64/Makefile b/share/man/man4/man4= .aarch64/Makefile > > index 6714a47011ef..ef5fcd84ccd4 100644 > > --- a/share/man/man4/man4.aarch64/Makefile > > +++ b/share/man/man4/man4.aarch64/Makefile > > @@ -17,6 +17,11 @@ MAN=3D \ > > rk_i2c.4 \ > > rk_pinctrl.4 \ > > > > +# Link files to the parent directory > > +.for _manpage in ${MAN} > > +MLINKS+=3D${_manpage} ../${_manpage} > > +.endfor > > This breaks make -DNO_ROOT in a subtle manner and so likely pkgbase. > > The right way to do it is to add something that uses INSTALL_RSYMLINK or = alike. I'll look into it. Thanks! > > Best regards, > Bapt From owner-dev-commits-src-all@freebsd.org Wed Jul 7 00:43:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4E9F464AE76; Wed, 7 Jul 2021 00:43:58 +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 4GKLJt1pHnz4RCj; Wed, 7 Jul 2021 00:43:58 +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 254AF23C8D; Wed, 7 Jul 2021 00:43: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 1670hwUi000982; Wed, 7 Jul 2021 00:43:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1670hwDn000981; Wed, 7 Jul 2021 00:43:58 GMT (envelope-from git) Date: Wed, 7 Jul 2021 00:43:58 GMT Message-Id: <202107070043.1670hwDn000981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: da2f833f7a0b - main - MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da2f833f7a0bef3cde7d5fc2a05e4646e873567f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 00:43:58 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=da2f833f7a0bef3cde7d5fc2a05e4646e873567f commit da2f833f7a0bef3cde7d5fc2a05e4646e873567f Author: Bjoern A. Zeeb AuthorDate: 2021-07-07 00:37:45 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-07 00:37:45 +0000 MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c During the removal of cam_sim_alloc_dev() in aeb04e88f51a706ef4b6a380bf5e82d15203fb6a for sdhci.c and the follow-up build-fix in a72af82e3169fcacfedf9047120679300a4296f8 slot->dev and slot->bus got mixed up for MMCCAM; slot->dev is only used in the !MMCCAM case so is uninitialised here leading to a panic; switch back to slot->bus to return to the status quo. Reviewed by: imp (ack on arm@) X-Differential Revision: https://reviews.freebsd.org/D30857 --- sys/dev/sdhci/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index bd30175e9f86..d075c2e05000 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -2484,7 +2484,7 @@ sdhci_start_slot(struct sdhci_slot *slot) mtx_init(&slot->sim_mtx, "sdhcisim", NULL, MTX_DEF); slot->sim = cam_sim_alloc(sdhci_cam_action, sdhci_cam_poll, - "sdhci_slot", slot, device_get_unit(slot->dev), + "sdhci_slot", slot, device_get_unit(slot->bus), &slot->sim_mtx, 1, 1, slot->devq); if (slot->sim == NULL) { From owner-dev-commits-src-all@freebsd.org Wed Jul 7 09:47:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C53FD65285F; Wed, 7 Jul 2021 09:47: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 4GKZN752Rtz4TDD; Wed, 7 Jul 2021 09:47: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 95D1E2D14; Wed, 7 Jul 2021 09:47: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 1679lZ7T023297; Wed, 7 Jul 2021 09:47:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1679lZ2f023296; Wed, 7 Jul 2021 09:47:35 GMT (envelope-from git) Date: Wed, 7 Jul 2021 09:47:35 GMT Message-Id: <202107070947.1679lZ2f023296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 6f147a0734e0 - main - cam: enable kern.cam.ada.enable_uma_ccbs by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f147a0734e00437db89ccbddc57f60fa6c5db7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 09:47:35 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6f147a0734e00437db89ccbddc57f60fa6c5db7b commit 6f147a0734e00437db89ccbddc57f60fa6c5db7b Author: Edward Tomasz Napierala AuthorDate: 2021-07-07 08:39:34 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-07 08:40:34 +0000 cam: enable kern.cam.ada.enable_uma_ccbs by default This makes the ada(4) driver use UMA for its CCBs. While it's da(4) counterpart needs some more testing, this one seems to be safe now. Please let me know via email if you notice any suspicious kernel messages, Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30567 --- sys/cam/ata/ata_da.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index a8b67b2254a6..7063a40fcc3c 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -904,7 +904,7 @@ static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND; static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; static int ada_enable_biospeedup = 1; -static int ada_enable_uma_ccbs = 0; +static int ada_enable_uma_ccbs = 1; static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver"); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 10:39:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4DA55652AF9; Wed, 7 Jul 2021 10:39: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 4GKbWd1G10z4bcC; Wed, 7 Jul 2021 10:39: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 126423831; Wed, 7 Jul 2021 10:39: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 167Ad8Dw091015; Wed, 7 Jul 2021 10:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167Ad8nw091014; Wed, 7 Jul 2021 10:39:08 GMT (envelope-from git) Date: Wed, 7 Jul 2021 10:39:08 GMT Message-Id: <202107071039.167Ad8nw091014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: a7b05eb16c9d - main - Sync the arm64 special registers with the Armv8.5 XML MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7b05eb16c9d84e1fd59864f5da67d23897ed91c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 10:39:09 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a7b05eb16c9d84e1fd59864f5da67d23897ed91c commit a7b05eb16c9d84e1fd59864f5da67d23897ed91c Author: Andrew Turner AuthorDate: 2021-07-01 01:14:09 +0000 Commit: Andrew Turner CommitDate: 2021-07-06 20:46:55 +0000 Sync the arm64 special registers with the Armv8.5 XML Add the missing macros and decode all the fields as described in the Arm Architecture System Registers XML corresponding to Armv8.5. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30983 --- sys/arm64/arm64/identcpu.c | 83 +++++++++++++++++++++++++++++++++++++++------- sys/arm64/include/armreg.h | 51 +++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index bae5770b4b04..c2812055dfa9 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -304,9 +304,22 @@ static struct mrs_field id_aa64afr1_fields[] = { /* ID_AA64DFR0_EL1 */ +static struct mrs_field_value id_aa64dfr0_tracefilt[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_NONE, ""), + MRS_FIELD_VALUE(ID_AA64DFR0_TraceFilt_8_4, "Trace v8.4"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64dfr0_doublelock[] = { + MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_IMPL, "DoubleLock"), + MRS_FIELD_VALUE(ID_AA64DFR0_DoubleLock_NONE, ""), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64dfr0_pmsver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_NONE, ""), - MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_V1, "SPE"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE, "SPE"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMSVer_SPE_8_3, "SPE v8.3"), MRS_FIELD_VALUE_END, }; @@ -328,7 +341,9 @@ static struct mrs_field_value id_aa64dfr0_brps[] = { static struct mrs_field_value id_aa64dfr0_pmuver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_NONE, ""), MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3, "PMUv3"), - MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3+16 bit evtCount"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_1, "PMUv3 v8.1"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_4, "PMUv3 v8.4"), + MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_3_5, "PMUv3 v8.5"), MRS_FIELD_VALUE(ID_AA64DFR0_PMUVer_IMPL, "IMPL PMU"), MRS_FIELD_VALUE_END, }; @@ -343,10 +358,15 @@ static struct mrs_field_value id_aa64dfr0_debugver[] = { MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8, "Debugv8"), MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_VHE, "Debugv8_VHE"), MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_2, "Debugv8.2"), + MRS_FIELD_VALUE(ID_AA64DFR0_DebugVer_8_4, "Debugv8.4"), MRS_FIELD_VALUE_END, }; static struct mrs_field id_aa64dfr0_fields[] = { + MRS_FIELD(ID_AA64DFR0, TraceFilt, false, MRS_EXACT, + id_aa64dfr0_tracefilt), + MRS_FIELD(ID_AA64DFR0, DoubleLock, false, MRS_EXACT, + id_aa64dfr0_doublelock), MRS_FIELD(ID_AA64DFR0, PMSVer, false, MRS_EXACT, id_aa64dfr0_pmsver), MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT, id_aa64dfr0_ctx_cmps), @@ -361,7 +381,7 @@ static struct mrs_field id_aa64dfr0_fields[] = { }; -/* ID_AA64DFR1 */ +/* ID_AA64DFR1_EL1 */ static struct mrs_field id_aa64dfr1_fields[] = { MRS_FIELD_END, }; @@ -524,12 +544,16 @@ static struct mrs_field_value id_aa64isar1_jscvt[] = { }; static struct mrs_field_value id_aa64isar1_api[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, API, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_PAC, "API PAC"), + MRS_FIELD_VALUE(ID_AA64ISAR1_API_EPAC, "API EPAC"), MRS_FIELD_VALUE_END, }; static struct mrs_field_value id_aa64isar1_apa[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, APA, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_PAC, "APA PAC"), + MRS_FIELD_VALUE(ID_AA64ISAR1_APA_EPAC, "APA EPAC"), MRS_FIELD_VALUE_END, }; @@ -562,8 +586,34 @@ static struct mrs_field id_aa64isar1_fields[] = { /* ID_AA64MMFR0_EL1 */ +static struct mrs_field_value id_aa64mmfr0_exs[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, ExS, ALL, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran4_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_TGran4, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_NONE, "No S2 TGran4"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran4_2_IMPL, "S2 TGran4"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran64_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_TGran64, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_NONE, "No S2 TGran64"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran64_2_IMPL, "S2 TGran64"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64mmfr0_tgran16_2[] = { + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_TGran16, ""), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_NONE, "No S2 TGran16"), + MRS_FIELD_VALUE(ID_AA64MMFR0_TGran16_2_IMPL, "S2 TGran16"), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64mmfr0_tgran4[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, TGran4,NONE, IMPL), MRS_FIELD_VALUE_END, }; @@ -577,7 +627,7 @@ static struct mrs_field_value id_aa64mmfr0_tgran16[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64mmfr0_bigend_el0[] = { +static struct mrs_field_value id_aa64mmfr0_bigendel0[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR0, BigEndEL0, FIXED, MIXED), MRS_FIELD_VALUE_END, }; @@ -592,7 +642,7 @@ static struct mrs_field_value id_aa64mmfr0_bigend[] = { MRS_FIELD_VALUE_END, }; -static struct mrs_field_value id_aa64mmfr0_asid_bits[] = { +static struct mrs_field_value id_aa64mmfr0_asidbits[] = { MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_8, "8bit ASID"), MRS_FIELD_VALUE(ID_AA64MMFR0_ASIDBits_16, "16bit ASID"), MRS_FIELD_VALUE_END, @@ -610,17 +660,24 @@ static struct mrs_field_value id_aa64mmfr0_parange[] = { }; static struct mrs_field id_aa64mmfr0_fields[] = { + MRS_FIELD(ID_AA64MMFR0, ExS, false, MRS_EXACT, id_aa64mmfr0_exs), + MRS_FIELD(ID_AA64MMFR0, TGran4_2, false, MRS_EXACT, + id_aa64mmfr0_tgran4_2), + MRS_FIELD(ID_AA64MMFR0, TGran64_2, false, MRS_EXACT, + id_aa64mmfr0_tgran64_2), + MRS_FIELD(ID_AA64MMFR0, TGran16_2, false, MRS_EXACT, + id_aa64mmfr0_tgran16_2), MRS_FIELD(ID_AA64MMFR0, TGran4, false, MRS_EXACT, id_aa64mmfr0_tgran4), MRS_FIELD(ID_AA64MMFR0, TGran64, false, MRS_EXACT, id_aa64mmfr0_tgran64), MRS_FIELD(ID_AA64MMFR0, TGran16, false, MRS_EXACT, id_aa64mmfr0_tgran16), MRS_FIELD(ID_AA64MMFR0, BigEndEL0, false, MRS_EXACT, - id_aa64mmfr0_bigend_el0), + id_aa64mmfr0_bigendel0), MRS_FIELD(ID_AA64MMFR0, SNSMem, false, MRS_EXACT, id_aa64mmfr0_snsmem), MRS_FIELD(ID_AA64MMFR0, BigEnd, false, MRS_EXACT, id_aa64mmfr0_bigend), MRS_FIELD(ID_AA64MMFR0, ASIDBits, false, MRS_EXACT, - id_aa64mmfr0_asid_bits), + id_aa64mmfr0_asidbits), MRS_FIELD(ID_AA64MMFR0, PARange, false, MRS_EXACT, id_aa64mmfr0_parange), MRS_FIELD_END, @@ -735,7 +792,8 @@ static struct mrs_field_value id_aa64mmfr2_st[] = { }; static struct mrs_field_value id_aa64mmfr2_nv[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64MMFR2, NV, NONE, 8_3), + MRS_FIELD_VALUE(ID_AA64MMFR2_NV_8_4, "NV v8.4"), MRS_FIELD_VALUE_END, }; @@ -835,7 +893,8 @@ static struct mrs_field_value id_aa64pfr0_sve[] = { static struct mrs_field_value id_aa64pfr0_ras[] = { MRS_FIELD_VALUE(ID_AA64PFR0_RAS_NONE, ""), - MRS_FIELD_VALUE(ID_AA64PFR0_RAS_V1, "RASv1"), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_IMPL, "RAS"), + MRS_FIELD_VALUE(ID_AA64PFR0_RAS_8_4, "RAS v8.4"), MRS_FIELD_VALUE_END, }; diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index af6e84e6c772..8a2bbb60f3d0 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -266,6 +266,7 @@ #define ID_AA64DFR0_DebugVer_8 (UL(0x6) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_VHE (UL(0x7) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer_8_2 (UL(0x8) << ID_AA64DFR0_DebugVer_SHIFT) +#define ID_AA64DFR0_DebugVer_8_4 (UL(0x9) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_TraceVer_SHIFT 4 #define ID_AA64DFR0_TraceVer_MASK (UL(0xf) << ID_AA64DFR0_TraceVer_SHIFT) #define ID_AA64DFR0_TraceVer_VAL(x) ((x) & ID_AA64DFR0_TraceVer_MASK) @@ -277,6 +278,8 @@ #define ID_AA64DFR0_PMUVer_NONE (UL(0x0) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3 (UL(0x1) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_3_1 (UL(0x4) << ID_AA64DFR0_PMUVer_SHIFT) +#define ID_AA64DFR0_PMUVer_3_4 (UL(0x5) << ID_AA64DFR0_PMUVer_SHIFT) +#define ID_AA64DFR0_PMUVer_3_5 (UL(0x6) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_PMUVer_IMPL (UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) #define ID_AA64DFR0_BRPs_SHIFT 12 #define ID_AA64DFR0_BRPs_MASK (UL(0xf) << ID_AA64DFR0_BRPs_SHIFT) @@ -294,7 +297,18 @@ #define ID_AA64DFR0_PMSVer_MASK (UL(0xf) << ID_AA64DFR0_PMSVer_SHIFT) #define ID_AA64DFR0_PMSVer_VAL(x) ((x) & ID_AA64DFR0_PMSVer_MASK) #define ID_AA64DFR0_PMSVer_NONE (UL(0x0) << ID_AA64DFR0_PMSVer_SHIFT) -#define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_PMSVer_SPE (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_PMSVer_SPE_8_3 (UL(0x2) << ID_AA64DFR0_PMSVer_SHIFT) +#define ID_AA64DFR0_DoubleLock_SHIFT 36 +#define ID_AA64DFR0_DoubleLock_MASK (UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_DoubleLock_VAL(x) ((x) & ID_AA64DFR0_DoubleLock_MASK) +#define ID_AA64DFR0_DoubleLock_IMPL (UL(0x0) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_DoubleLock_NONE (UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) +#define ID_AA64DFR0_TraceFilt_SHIFT 40 +#define ID_AA64DFR0_TraceFilt_MASK (UL(0xf) << ID_AA64DFR0_TraceFilt_SHIFT) +#define ID_AA64DFR0_TraceFilt_VAL(x) ((x) & ID_AA64DFR0_TraceFilt_MASK) +#define ID_AA64DFR0_TraceFilt_NONE (UL(0x0) << ID_AA64DFR0_TraceFilt_SHIFT) +#define ID_AA64DFR0_TraceFilt_8_4 (UL(0x1) << ID_AA64DFR0_TraceFilt_SHIFT) /* ID_AA64ISAR0_EL1 */ #define ID_AA64ISAR0_EL1 MRS_REG(3, 0, 0, 6, 0) @@ -385,12 +399,14 @@ #define ID_AA64ISAR1_APA_MASK (UL(0xf) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_APA_VAL(x) ((x) & ID_AA64ISAR1_APA_MASK) #define ID_AA64ISAR1_APA_NONE (UL(0x0) << ID_AA64ISAR1_APA_SHIFT) -#define ID_AA64ISAR1_APA_IMPL (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_PAC (UL(0x1) << ID_AA64ISAR1_APA_SHIFT) +#define ID_AA64ISAR1_APA_EPAC (UL(0x2) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_API_SHIFT 8 #define ID_AA64ISAR1_API_MASK (UL(0xf) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_API_VAL(x) ((x) & ID_AA64ISAR1_API_MASK) #define ID_AA64ISAR1_API_NONE (UL(0x0) << ID_AA64ISAR1_API_SHIFT) -#define ID_AA64ISAR1_API_IMPL (UL(0x1) << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_PAC (UL(0x1) << ID_AA64ISAR1_API_SHIFT) +#define ID_AA64ISAR1_API_EPAC (UL(0x2) << ID_AA64ISAR1_API_SHIFT) #define ID_AA64ISAR1_JSCVT_SHIFT 12 #define ID_AA64ISAR1_JSCVT_MASK (UL(0xf) << ID_AA64ISAR1_JSCVT_SHIFT) #define ID_AA64ISAR1_JSCVT_VAL(x) ((x) & ID_AA64ISAR1_JSCVT_MASK) @@ -495,6 +511,29 @@ #define ID_AA64MMFR0_TGran4_VAL(x) ((x) & ID_AA64MMFR0_TGran4_MASK) #define ID_AA64MMFR0_TGran4_IMPL (UL(0x0) << ID_AA64MMFR0_TGran4_SHIFT) #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) +#define ID_AA64MMFR0_TGran16_2_SHIFT 32 +#define ID_AA64MMFR0_TGran16_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_VAL(x) ((x) & ID_AA64MMFR0_TGran16_2_MASK) +#define ID_AA64MMFR0_TGran16_2_TGran16 (UL(0x0) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran16_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran16_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_SHIFT 36 +#define ID_AA64MMFR0_TGran64_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_VAL(x) ((x) & ID_AA64MMFR0_TGran64_2_MASK) +#define ID_AA64MMFR0_TGran64_2_TGran64 (UL(0x0) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran64_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran64_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_SHIFT 40 +#define ID_AA64MMFR0_TGran4_2_MASK (UL(0xf) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_VAL(x) ((x) & ID_AA64MMFR0_TGran4_2_MASK) +#define ID_AA64MMFR0_TGran4_2_TGran4 (UL(0x0) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_NONE (UL(0x1) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_TGran4_2_IMPL (UL(0x2) << ID_AA64MMFR0_TGran4_2_SHIFT) +#define ID_AA64MMFR0_ExS_SHIFT 44 +#define ID_AA64MMFR0_ExS_MASK (UL(0xf) << ID_AA64MMFR0_ExS_SHIFT) +#define ID_AA64MMFR0_ExS_VAL(x) ((x) & ID_AA64MMFR0_ExS_MASK) +#define ID_AA64MMFR0_ExS_ALL (UL(0x0) << ID_AA64MMFR0_ExS_SHIFT) +#define ID_AA64MMFR0_ExS_IMPL (UL(0x1) << ID_AA64MMFR0_ExS_SHIFT) /* ID_AA64MMFR1_EL1 */ #define ID_AA64MMFR1_EL1 MRS_REG(3, 0, 0, 7, 1) @@ -578,7 +617,8 @@ #define ID_AA64MMFR2_NV_MASK (UL(0xf) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_NV_VAL(x) ((x) & ID_AA64MMFR2_NV_MASK) #define ID_AA64MMFR2_NV_NONE (UL(0x0) << ID_AA64MMFR2_NV_SHIFT) -#define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_8_3 (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) +#define ID_AA64MMFR2_NV_8_4 (UL(0x2) << ID_AA64MMFR2_NV_SHIFT) #define ID_AA64MMFR2_ST_SHIFT 28 #define ID_AA64MMFR2_ST_MASK (UL(0xf) << ID_AA64MMFR2_ST_SHIFT) #define ID_AA64MMFR2_ST_VAL(x) ((x) & ID_AA64MMFR2_ST_MASK) @@ -668,7 +708,8 @@ #define ID_AA64PFR0_RAS_MASK (UL(0xf) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_RAS_VAL(x) ((x) & ID_AA64PFR0_RAS_MASK) #define ID_AA64PFR0_RAS_NONE (UL(0x0) << ID_AA64PFR0_RAS_SHIFT) -#define ID_AA64PFR0_RAS_V1 (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) +#define ID_AA64PFR0_RAS_IMPL (UL(0x1) << ID_AA64PFR0_RAS_SHIFT) +#define ID_AA64PFR0_RAS_8_4 (UL(0x2) << ID_AA64PFR0_RAS_SHIFT) #define ID_AA64PFR0_SVE_SHIFT 32 #define ID_AA64PFR0_SVE_MASK (UL(0xf) << ID_AA64PFR0_SVE_SHIFT) #define ID_AA64PFR0_SVE_VAL(x) ((x) & ID_AA64PFR0_SVE_MASK) From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:00:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DE1296537EA; Wed, 7 Jul 2021 11:00:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (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 4GKc0V5Ynyz4dbL; Wed, 7 Jul 2021 11:00:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12f.google.com with SMTP id r26so3378169lfp.2; Wed, 07 Jul 2021 04:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=x4HYnOvzFttJ0e5A9VisZaMB3Bp+13UgEiTdrd4Wfb8=; b=FqptaHB1iE/gLMRxPRI0dKA3eY1w8uPkYQTJnzXVgwPGJbQjtcjkv07ledUlPB1HWy 1xPXpHlPz/w8h7iAflbSh/aCdt7mUbj85R5CSn8zx0+jyK9pV3t3PcvmKybR1nCNqMQg 9rmzN3hM1RCyEwSVr3AoJ6tSCcuspdJBMweSmbTjOkBdQl+6s51APALqqM/k+XKHnBBr NbQwxpELpvTidPtnvjJUWrKT3hS79r/+I6a5BPhzto89jYU0gxlN0rodkJ7f47+fsxO7 f63R5RScHNgPH+Rz0VazvR1bXpDvigmHqrqu6CELpIqpcAK3k1FTYkMd8DsKppUl3FZv 9xdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=x4HYnOvzFttJ0e5A9VisZaMB3Bp+13UgEiTdrd4Wfb8=; b=FQ+Mvrf5pMhHUWvM/p8IKHrPTR89LqVJLdcPrbuLW3QG6Gi/uEbTo9OYA+sPefMn9j tnHAqgztX9XXwMBH7TDHE8vRUyo7ipNRfv5fbYIL1VWrgvcd+XMalBlZNcGUREaEz4Zl 9uPti4eZ2Z5cauRYtZXtW0t7vmeNGz9/4qZVgBOb/SKDk6xBbQ9+3waRcaQcuT7ksQtz w7JW+g3b0xOOT7ADeywtrOWXw7EFfdxba+nTgj4T3HrtToe3B9pazo0NFSJK6Ku6XX9p sLVfLq0mR2jLwuQuhp1oFM3JcnoYq9pGVRTParaOuMm18QcfPrPgkrbfMvQKFjX8OyFY TtpQ== X-Gm-Message-State: AOAM533qbm2V4U5QLpIVQOGdcMBlr+WId4TZluteRmCuhGNE57nwo41O ga9tLafKkEEwE+TgLCX00O+kEK+LNvgYSmtA/dq1UDWP X-Google-Smtp-Source: ABdhPJz11+67aU78e9gHje3YI1yfeAUkUknTcg3bX8cTTnST6b96cWfu1TjrAHZ0Qvj/QDRYyM7DCa2Pv+rdQwDH1uQ= X-Received: by 2002:ac2:5a04:: with SMTP id q4mr18955625lfn.110.1625655641020; Wed, 07 Jul 2021 04:00:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:8416:0:0:0:0:0 with HTTP; Wed, 7 Jul 2021 04:00:40 -0700 (PDT) In-Reply-To: <202107061429.166ETTEn064437@gitrepo.freebsd.org> References: <202107061429.166ETTEn064437@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 7 Jul 2021 13:00:40 +0200 Message-ID: Subject: Re: git: 28d0a740dd9a - main - ktls: auto-disable ifnet (inline hw) kTLS To: Andrew Gallatin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GKc0V5Ynyz4dbL 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:00:42 -0000 This breaks NOIP kernel builds. On 7/6/21, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 > > commit 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 > Author: Andrew Gallatin > AuthorDate: 2021-07-06 14:17:33 +0000 > Commit: Andrew Gallatin > CommitDate: 2021-07-06 14:28:32 +0000 > > ktls: auto-disable ifnet (inline hw) kTLS > > Ifnet (inline) hw kTLS NICs typically keep state within > a TLS record, so that when transmitting in-order, > they can continue encryption on each segment sent without > DMA'ing extra state from the host. > > This breaks down when transmits are out of order (eg, > TCP retransmits). In this case, the NIC must re-DMA > the entire TLS record up to and including the segment > being retransmitted. This means that when re-transmitting > the last 1448 byte segment of a TLS record, the NIC will > have to re-DMA the entire 16KB TLS record. This can lead > to the NIC running out of PCIe bus bandwidth well before > it saturates the network link if a lot of TCP connections have > a high retransmoit rate. > > This change introduces a new sysctl > (kern.ipc.tls.ifnet_max_rexmit_pct), > where TCP connections with higher retransmit rate will be > switched to SW kTLS so as to conserve PCIe bandwidth. > > Reviewed by: hselasky, markj, rrs > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D30908 > --- > sys/kern/uipc_ktls.c | 107 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > sys/netinet/tcp_var.h | 13 +++++- > sys/sys/ktls.h | 15 ++++++- > 3 files changed, 133 insertions(+), 2 deletions(-) > > diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c > index 7e87e7c740e3..88e29157289d 100644 > --- a/sys/kern/uipc_ktls.c > +++ b/sys/kern/uipc_ktls.c > @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); > > #include "opt_inet.h" > #include "opt_inet6.h" > +#include "opt_kern_tls.h" > #include "opt_ratelimit.h" > #include "opt_rss.h" > > @@ -121,6 +122,11 @@ SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, > CTLFLAG_RD, > &ktls_number_threads, 0, > "Number of TLS threads in thread-pool"); > > +unsigned int ktls_ifnet_max_rexmit_pct = 2; > +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, ifnet_max_rexmit_pct, CTLFLAG_RWTUN, > + &ktls_ifnet_max_rexmit_pct, 2, > + "Max percent bytes retransmitted before ifnet TLS is disabled"); > + > static bool ktls_offload_enable; > SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RWTUN, > &ktls_offload_enable, 0, > @@ -184,6 +190,14 @@ static COUNTER_U64_DEFINE_EARLY(ktls_switch_failed); > SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, > CTLFLAG_RD, > &ktls_switch_failed, "TLS sessions unable to switch between SW and > ifnet"); > > +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_fail); > +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_failed, > CTLFLAG_RD, > + &ktls_ifnet_disable_fail, "TLS sessions unable to switch to SW from > ifnet"); > + > +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_ok); > +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_ok, > CTLFLAG_RD, > + &ktls_ifnet_disable_ok, "TLS sessions able to switch to SW from > ifnet"); > + > SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, > "Software TLS session stats"); > SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD | CTLFLAG_MPSAFE, > 0, > @@ -2187,3 +2201,96 @@ ktls_work_thread(void *ctx) > } > } > } > + > +static void > +ktls_disable_ifnet_help(void *context, int pending __unused) > +{ > + struct ktls_session *tls; > + struct inpcb *inp; > + struct tcpcb *tp; > + struct socket *so; > + int err; > + > + tls = context; > + inp = tls->inp; > + if (inp == NULL) > + return; > + INP_WLOCK(inp); > + so = inp->inp_socket; > + MPASS(so != NULL); > + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || > + (inp->inp_flags2 & INP_FREED)) { > + goto out; > + } > + > + if (so->so_snd.sb_tls_info != NULL) > + err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); > + else > + err = ENXIO; > + if (err == 0) { > + counter_u64_add(ktls_ifnet_disable_ok, 1); > + /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ > + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && > + (inp->inp_flags2 & INP_FREED) == 0 && > + (tp = intotcpcb(inp)) != NULL && > + tp->t_fb->tfb_hwtls_change != NULL) > + (*tp->t_fb->tfb_hwtls_change)(tp, 0); > + } else { > + counter_u64_add(ktls_ifnet_disable_fail, 1); > + } > + > +out: > + SOCK_LOCK(so); > + sorele(so); > + if (!in_pcbrele_wlocked(inp)) > + INP_WUNLOCK(inp); > + ktls_free(tls); > +} > + > +/* > + * Called when re-transmits are becoming a substantial portion of the > + * sends on this connection. When this happens, we transition the > + * connection to software TLS. This is needed because most inline TLS > + * NICs keep crypto state only for in-order transmits. This means > + * that to handle a TCP rexmit (which is out-of-order), the NIC must > + * re-DMA the entire TLS record up to and including the current > + * segment. This means that when re-transmitting the last ~1448 byte > + * segment of a 16KB TLS record, we could wind up re-DMA'ing an order > + * of magnitude more data than we are sending. This can cause the > + * PCIe link to saturate well before the network, which can cause > + * output drops, and a general loss of capacity. > + */ > +void > +ktls_disable_ifnet(void *arg) > +{ > + struct tcpcb *tp; > + struct inpcb *inp; > + struct socket *so; > + struct ktls_session *tls; > + > + tp = arg; > + inp = tp->t_inpcb; > + INP_WLOCK_ASSERT(inp); > + so = inp->inp_socket; > + SOCK_LOCK(so); > + tls = so->so_snd.sb_tls_info; > + if (tls->disable_ifnet_pending) { > + SOCK_UNLOCK(so); > + return; > + } > + > + /* > + * note that disable_ifnet_pending is never cleared; disabling > + * ifnet can only be done once per session, so we never want > + * to do it again > + */ > + > + (void)ktls_hold(tls); > + in_pcbref(inp); > + soref(so); > + tls->disable_ifnet_pending = true; > + tls->inp = inp; > + SOCK_UNLOCK(so); > + TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); > + (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); > +} > diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h > index dd30f89896d2..3f72a821e71f 100644 > --- a/sys/netinet/tcp_var.h > +++ b/sys/netinet/tcp_var.h > @@ -39,8 +39,10 @@ > #include > > #ifdef _KERNEL > +#include "opt_kern_tls.h" > #include > #include > +#include > #endif > > #define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information > array" */ > @@ -1139,8 +1141,10 @@ tcp_fields_to_net(struct tcphdr *th) > > static inline void > tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, > - uint8_t is_tlp, int hw_tls __unused) > + uint8_t is_tlp, int hw_tls) > { > + uint64_t rexmit_percent; > + > if (is_tlp) { > tp->t_sndtlppack++; > tp->t_sndtlpbyte += len; > @@ -1150,6 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, > uint8_t is_rxt, > tp->t_snd_rxt_bytes += len; > else > tp->t_sndbytes += len; > + > + if (hw_tls && is_rxt) { > + rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * > (tp->t_snd_rxt_bytes + tp->t_sndbytes)); > + if (rexmit_percent > ktls_ifnet_max_rexmit_pct) > + ktls_disable_ifnet(tp); > + } > + > } > #endif /* _KERNEL */ > > diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h > index b28c94965c97..7fd8831878b4 100644 > --- a/sys/sys/ktls.h > +++ b/sys/sys/ktls.h > @@ -189,10 +189,12 @@ struct ktls_session { > u_int wq_index; > volatile u_int refcount; > int mode; > - bool reset_pending; > > struct task reset_tag_task; > + struct task disable_ifnet_task; > struct inpcb *inp; > + bool reset_pending; > + bool disable_ifnet_pending; > } __aligned(CACHE_LINE_SIZE); > > void ktls_check_rx(struct sockbuf *sb); > @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) > ktls_destroy(tls); > } > > +#ifdef KERN_TLS > +extern unsigned int ktls_ifnet_max_rexmit_pct; > +void ktls_disable_ifnet(void *arg); > +#else > +#define ktls_ifnet_max_rexmit_pct 1 > +inline void > +ktls_disable_ifnet(void *arg __unused) > +{ > +} > +#endif > + > #endif /* !_KERNEL */ > #endif /* !_SYS_KTLS_H_ */ > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:08:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF68A6539A4; Wed, 7 Jul 2021 11:08: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 4GKc996BYnz4fQ0; Wed, 7 Jul 2021 11:08: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 BC043439D; Wed, 7 Jul 2021 11:08: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 167B8Dou032105; Wed, 7 Jul 2021 11:08:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8DZZ032104; Wed, 7 Jul 2021 11:08:13 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:13 GMT Message-Id: <202107071108.167B8DZZ032104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0a718a6e6eba - main - mbuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw 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/main X-Git-Reftype: branch X-Git-Commit: 0a718a6e6ebaa1b8442123df8bdbae5a04a77987 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:14 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0a718a6e6ebaa1b8442123df8bdbae5a04a77987 commit 0a718a6e6ebaa1b8442123df8bdbae5a04a77987 Author: Mateusz Guzik AuthorDate: 2021-07-06 16:44:35 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 mbuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31082 --- sys/kern/kern_mbuf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 2333bf887354..c43f086bb83f 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1191,19 +1191,19 @@ mb_free_ext(struct mbuf *m) break; case EXT_CLUSTER: uma_zfree(zone_clust, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_JUMBOP: uma_zfree(zone_jumbop, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_JUMBO9: uma_zfree(zone_jumbo9, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_JUMBO16: uma_zfree(zone_jumbo16, m->m_ext.ext_buf); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_SFBUF: case EXT_NET_DRV: @@ -1212,7 +1212,7 @@ mb_free_ext(struct mbuf *m) KASSERT(mref->m_ext.ext_free != NULL, ("%s: ext_free not set", __func__)); mref->m_ext.ext_free(mref); - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); break; case EXT_EXTREF: KASSERT(m->m_ext.ext_free != NULL, @@ -1230,7 +1230,7 @@ mb_free_ext(struct mbuf *m) } if (freembuf && m != mref) - uma_zfree(zone_mbuf, m); + m_free_raw(m); } /* @@ -1268,11 +1268,11 @@ mb_free_extpg(struct mbuf *m) ktls_enqueue_to_free(mref); else #endif - uma_zfree(zone_mbuf, mref); + m_free_raw(mref); } if (m != mref) - uma_zfree(zone_mbuf, m); + m_free_raw(m); } /* @@ -1364,7 +1364,7 @@ m_get2(int size, int how, short type, int flags) n = uma_zalloc_arg(zone_jumbop, m, how); if (n == NULL) { - uma_zfree(zone_mbuf, m); + m_free_raw(m); return (NULL); } @@ -1395,7 +1395,7 @@ m_getjcl(int how, short type, int flags, int size) zone = m_getzone(size); n = uma_zalloc_arg(zone, m, how); if (n == NULL) { - uma_zfree(zone_mbuf, m); + m_free_raw(m); return (NULL); } MBUF_PROBE5(m__getjcl, how, type, flags, size, m); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:08:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 18062653836; Wed, 7 Jul 2021 11:08:15 +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 4GKc9C04wYz4fNB; Wed, 7 Jul 2021 11:08:15 +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 D5C374074; Wed, 7 Jul 2021 11:08: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 167B8EYI032129; Wed, 7 Jul 2021 11:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8E3U032128; Wed, 7 Jul 2021 11:08:14 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:14 GMT Message-Id: <202107071108.167B8E3U032128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c2c34ee5401d - main - mbuf: add m_get_raw and m_gethdr_raw 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/main X-Git-Reftype: branch X-Git-Commit: c2c34ee5401d8772165707e2c80beddf8a7d60df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:15 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c2c34ee5401d8772165707e2c80beddf8a7d60df commit c2c34ee5401d8772165707e2c80beddf8a7d60df Author: Mateusz Guzik AuthorDate: 2021-07-06 18:51:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 mbuf: add m_get_raw and m_gethdr_raw The intent is to eliminate the MT_NOINIT flag and consequently a branch from the constructor. Reviewed by: gallatin Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31080 --- sys/kern/uipc_mbuf.c | 10 ++++++++++ sys/sys/mbuf.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index b9e716b411be..74c8ef62eb8d 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -62,11 +62,21 @@ SDT_PROBE_DEFINE5_XLATE(sdt, , , m__init, "uint32_t", "uint32_t", "uint32_t", "uint32_t"); +SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr_raw, + "uint32_t", "uint32_t", + "uint16_t", "uint16_t", + "struct mbuf *", "mbufinfo_t *"); + SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr, "uint32_t", "uint32_t", "uint16_t", "uint16_t", "struct mbuf *", "mbufinfo_t *"); +SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get_raw, + "uint32_t", "uint32_t", + "uint16_t", "uint16_t", + "struct mbuf *", "mbufinfo_t *"); + SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get, "uint32_t", "uint32_t", "uint16_t", "uint16_t", diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 1dac5fcf32b7..2936966f6acc 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -62,7 +62,9 @@ SDT_PROBE5(sdt, , , probe, arg0, arg1, arg2, arg3, arg4) SDT_PROBE_DECLARE(sdt, , , m__init); +SDT_PROBE_DECLARE(sdt, , , m__gethdr_raw); SDT_PROBE_DECLARE(sdt, , , m__gethdr); +SDT_PROBE_DECLARE(sdt, , , m__get_raw); SDT_PROBE_DECLARE(sdt, , , m__get); SDT_PROBE_DECLARE(sdt, , , m__getcl); SDT_PROBE_DECLARE(sdt, , , m__getjcl); @@ -956,6 +958,19 @@ m_init(struct mbuf *m, int how, short type, int flags) return (error); } +static __inline struct mbuf * +m_get_raw(int how, short type) +{ + struct mbuf *m; + struct mb_args args; + + args.flags = 0; + args.type = type | MT_NOINIT; + m = uma_zalloc_arg(zone_mbuf, &args, how); + MBUF_PROBE3(m__get_raw, how, type, m); + return (m); +} + static __inline struct mbuf * m_get(int how, short type) { @@ -969,6 +984,19 @@ m_get(int how, short type) return (m); } +static __inline struct mbuf * +m_gethdr_raw(int how, short type) +{ + struct mbuf *m; + struct mb_args args; + + args.flags = M_PKTHDR; + args.type = type | MT_NOINIT; + m = uma_zalloc_arg(zone_mbuf, &args, how); + MBUF_PROBE3(m__gethdr_raw, how, type, m); + return (m); +} + static __inline struct mbuf * m_gethdr(int how, short type) { From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:08:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5B2486539AE; Wed, 7 Jul 2021 11:08: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 4GKc9D0xrmz4fHh; Wed, 7 Jul 2021 11:08: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 066103E77; Wed, 7 Jul 2021 11:08: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 167B8FoE032153; Wed, 7 Jul 2021 11:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8FiO032152; Wed, 7 Jul 2021 11:08:15 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:15 GMT Message-Id: <202107071108.167B8FiO032152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a56888534d96 - main - iflib: use m_gethdr_raw 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/main X-Git-Reftype: branch X-Git-Commit: a56888534d96641af97e6d659d8ecf5a054204c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:16 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a56888534d96641af97e6d659d8ecf5a054204c2 commit a56888534d96641af97e6d659d8ecf5a054204c2 Author: Mateusz Guzik AuthorDate: 2021-07-06 18:52:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 iflib: use m_gethdr_raw Reviewed by: gallatin Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31081 --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 0b36e880e15e..abd6bd32cd4e 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2122,7 +2122,7 @@ iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) BUS_DMASYNC_PREREAD); if (sd_m[frag_idx] == NULL) { - m = m_gethdr(M_NOWAIT, MT_NOINIT); + m = m_gethdr_raw(M_NOWAIT, 0); if (__predict_false(m == NULL)) break; sd_m[frag_idx] = m; From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:08:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B4CB56535CC; Wed, 7 Jul 2021 11:08: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 4GKc9F2FZzz4f9C; Wed, 7 Jul 2021 11:08: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 33BE03E78; Wed, 7 Jul 2021 11:08: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 167B8HS3032184; Wed, 7 Jul 2021 11:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167B8HFH032183; Wed, 7 Jul 2021 11:08:17 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:08:17 GMT Message-Id: <202107071108.167B8HFH032183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: edcf1054d3fb - main - cxgb: use m_gethdr_raw 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/main X-Git-Reftype: branch X-Git-Commit: edcf1054d3fb4772ade6a2c0b7afd9e28672385d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:08:17 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=edcf1054d3fb4772ade6a2c0b7afd9e28672385d commit edcf1054d3fb4772ade6a2c0b7afd9e28672385d Author: Mateusz Guzik AuthorDate: 2021-07-07 07:38:23 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-07 11:05:46 +0000 cxgb: use m_gethdr_raw Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/cxgb/cxgb_sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 0d415d94224f..eb9d8f51dcd3 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -727,7 +727,7 @@ refill_fl(adapter_t *sc, struct sge_fl *q, int n) } else { if ((cl = m_cljget(NULL, M_NOWAIT, q->buf_size)) == NULL) break; - if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { + if ((m = m_gethdr_raw(M_NOWAIT, 0)) == NULL) { uma_zfree(q->zone, cl); break; } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:10:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4CE9A653E89; Wed, 7 Jul 2021 11:10: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 4GKcDH1m6rz4fXc; Wed, 7 Jul 2021 11:10: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 24FB043D8; Wed, 7 Jul 2021 11:10: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 167BAtAV040780; Wed, 7 Jul 2021 11:10:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BAt9r040779; Wed, 7 Jul 2021 11:10:55 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:10:55 GMT Message-Id: <202107071110.167BAt9r040779@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: 1fc1d45374d5 - stable/13 - seqc: add symbolic name for in-modify bit 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/13 X-Git-Reftype: branch X-Git-Commit: 1fc1d45374d58bb24c93f6eed66e1503d10cd4ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:10:55 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1fc1d45374d58bb24c93f6eed66e1503d10cd4ee commit 1fc1d45374d58bb24c93f6eed66e1503d10cd4ee Author: Konstantin Belousov AuthorDate: 2021-04-29 22:39:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:20 +0000 seqc: add symbolic name for in-modify bit (cherry picked from commit 71faea93070e6df371bf73ed12e2a1da27dc8e2d) --- sys/sys/seqc.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/sys/seqc.h b/sys/sys/seqc.h index 3cfaaf3acbda..fd9f196aceca 100644 --- a/sys/sys/seqc.h +++ b/sys/sys/seqc.h @@ -45,13 +45,15 @@ #include +#define SEQC_MOD 1 + /* * Predicts from inline functions are not honored by clang. */ #define seqc_in_modify(seqc) ({ \ seqc_t __seqc = (seqc); \ \ - __predict_false(__seqc & 1); \ + __predict_false(__seqc & SEQC_MOD); \ }) static __inline void @@ -60,7 +62,7 @@ seqc_write_begin(seqc_t *seqcp) critical_enter(); MPASS(!seqc_in_modify(*seqcp)); - *seqcp += 1; + *seqcp += SEQC_MOD; atomic_thread_fence_rel(); } @@ -69,7 +71,7 @@ seqc_write_end(seqc_t *seqcp) { atomic_thread_fence_rel(); - *seqcp += 1; + *seqcp += SEQC_MOD; MPASS(!seqc_in_modify(*seqcp)); critical_exit(); } @@ -85,7 +87,7 @@ static __inline seqc_t seqc_read_notmodify(const seqc_t *seqcp) { - return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~1); + return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~SEQC_MOD); } static __inline seqc_t @@ -126,7 +128,7 @@ seqc_sleepable_write_begin(seqc_t *seqcp) { MPASS(!seqc_in_modify(*seqcp)); - *seqcp += 1; + *seqcp += SEQC_MOD; atomic_thread_fence_rel(); } @@ -135,7 +137,7 @@ seqc_sleepable_write_end(seqc_t *seqcp) { atomic_thread_fence_rel(); - *seqcp += 1; + *seqcp += SEQC_MOD; MPASS(!seqc_in_modify(*seqcp)); } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:10:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D04E653A4E; Wed, 7 Jul 2021 11:10:56 +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 4GKcDJ2t5Yz4fmV; Wed, 7 Jul 2021 11:10: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 4753345BF; Wed, 7 Jul 2021 11:10: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 167BAueW040804; Wed, 7 Jul 2021 11:10:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BAuL8040803; Wed, 7 Jul 2021 11:10:56 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:10:56 GMT Message-Id: <202107071110.167BAuL8040803@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: 893aecc35acc - stable/13 - namei: add NDPREINIT() macro 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/13 X-Git-Reftype: branch X-Git-Commit: 893aecc35acc603ba9ca00addefd6c6ead9f403c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:10:56 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=893aecc35acc603ba9ca00addefd6c6ead9f403c commit 893aecc35acc603ba9ca00addefd6c6ead9f403c Author: Konstantin Belousov AuthorDate: 2021-06-14 19:03:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:25 +0000 namei: add NDPREINIT() macro (cherry picked from commit 802cf4ab0ee9cae7af523cfcf1221febd2143210) --- sys/kern/vfs_syscalls.c | 9 +++++++++ sys/sys/namei.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c18bb56fc632..7f2f3480a5af 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1329,6 +1329,7 @@ kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, } if (error != 0) return (error); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -1437,6 +1438,7 @@ kern_mkfifoat(struct thread *td, int fd, const char *path, int error; AUDIT_ARG_MODE(mode); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -1568,6 +1570,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, struct nameidata nd; int error; + NDPREINIT(&nd); do { bwillwrite(); NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflag, @@ -1715,6 +1718,7 @@ kern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2, syspath = tmppath; } AUDIT_ARG_TEXT(syspath); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -1779,6 +1783,7 @@ sys_undelete(struct thread *td, struct undelete_args *uap) struct nameidata nd; int error; + NDPREINIT(&nd); restart: bwillwrite(); NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1, @@ -1892,6 +1897,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, return (error); } + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | @@ -3423,6 +3429,7 @@ kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg, if (length < 0) return (EINVAL); + NDPREINIT(&nd); retry: NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); if ((error = namei(&nd)) != 0) @@ -3790,6 +3797,7 @@ kern_mkdirat(struct thread *td, int fd, const char *path, enum uio_seg segflg, int error; AUDIT_ARG_MODE(mode); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -3860,6 +3868,7 @@ kern_frmdirat(struct thread *td, int dfd, const char *path, int fd, return (error); } + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 5f3d917083a5..b4db0e758e2b 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -265,6 +265,9 @@ do { \ _ndp->ni_startdir = NULL; \ } while (0) +#define NDPREINIT(ndp) do { \ +} while (0) + #define NDF_NO_DVP_RELE 0x00000001 #define NDF_NO_DVP_UNLOCK 0x00000002 #define NDF_NO_DVP_PUT 0x00000003 From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:10:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E5983653D11; Wed, 7 Jul 2021 11:10: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 4GKcDK4YYGz4fs0; Wed, 7 Jul 2021 11:10:57 +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 6C63345C0; Wed, 7 Jul 2021 11:10: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 167BAv4s040828; Wed, 7 Jul 2021 11:10:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BAvce040827; Wed, 7 Jul 2021 11:10:57 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:10:57 GMT Message-Id: <202107071110.167BAvce040827@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: eee344ccd142 - stable/13 - unionfs: do not use bare struct componentname 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/13 X-Git-Reftype: branch X-Git-Commit: eee344ccd1420498eb7860999d115ea1de8c68e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:10:58 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eee344ccd1420498eb7860999d115ea1de8c68e6 commit eee344ccd1420498eb7860999d115ea1de8c68e6 Author: Konstantin Belousov AuthorDate: 2021-06-14 18:45:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:30 +0000 unionfs: do not use bare struct componentname (cherry picked from commit 190110f2eba1551793f290a9f01e52ffe015a5da) --- sys/fs/unionfs/union_subr.c | 70 ++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 30b637171021..93e4f50d98c5 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -760,7 +760,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, struct vnode *uvp; struct vattr va; struct vattr lva; - struct componentname cn; + struct nameidata nd; struct mount *mp; struct ucred *cred; struct ucred *credbk; @@ -787,12 +787,14 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, uifree(rootinfo); cnp->cn_cred = cred; - memset(&cn, 0, sizeof(cn)); + memset(&nd.ni_cnd, 0, sizeof(struct componentname)); + NDPREINIT(&nd); if ((error = VOP_GETATTR(lvp, &lva, cnp->cn_cred))) goto unionfs_mkshadowdir_abort; - if ((error = unionfs_relookup(udvp, &uvp, cnp, &cn, td, cnp->cn_nameptr, cnp->cn_namelen, CREATE))) + if ((error = unionfs_relookup(udvp, &uvp, cnp, &nd.ni_cnd, td, + cnp->cn_nameptr, cnp->cn_namelen, CREATE))) goto unionfs_mkshadowdir_abort; if (uvp != NULLVP) { if (udvp == uvp) @@ -808,7 +810,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, goto unionfs_mkshadowdir_free_out; unionfs_create_uppervattr_core(ump, &lva, &va, td); - error = VOP_MKDIR(udvp, &uvp, &cn, &va); + error = VOP_MKDIR(udvp, &uvp, &nd.ni_cnd, &va); if (!error) { unionfs_node_update(unp, uvp, td); @@ -818,14 +820,14 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, * Ignore errors. */ va.va_type = VNON; - VOP_SETATTR(uvp, &va, cn.cn_cred); + VOP_SETATTR(uvp, &va, nd.ni_cnd.cn_cred); } vn_finished_write(mp); unionfs_mkshadowdir_free_out: - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } unionfs_mkshadowdir_abort: @@ -847,19 +849,21 @@ unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, { int error; struct vnode *wvp; - struct componentname cn; + struct nameidata nd; struct mount *mp; if (path == NULL) path = cnp->cn_nameptr; wvp = NULLVP; - if ((error = unionfs_relookup(dvp, &wvp, cnp, &cn, td, path, strlen(path), CREATE))) + NDPREINIT(&nd); + if ((error = unionfs_relookup(dvp, &wvp, cnp, &nd.ni_cnd, td, path, + strlen(path), CREATE))) return (error); if (wvp != NULLVP) { - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } if (dvp == wvp) vrele(wvp); @@ -871,14 +875,14 @@ unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, if ((error = vn_start_write(dvp, &mp, V_WAIT | PCATCH))) goto unionfs_mkwhiteout_free_out; - error = VOP_WHITEOUT(dvp, &cn, CREATE); + error = VOP_WHITEOUT(dvp, &nd.ni_cnd, CREATE); vn_finished_write(mp); unionfs_mkwhiteout_free_out: - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } return (error); @@ -904,7 +908,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, struct vattr lva; int fmode; int error; - struct componentname cn; + struct nameidata nd; ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount); vp = NULLVP; @@ -920,18 +924,20 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, if (unp->un_path == NULL) panic("unionfs: un_path is null"); - cn.cn_namelen = strlen(unp->un_path); - cn.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); - bcopy(unp->un_path, cn.cn_pnbuf, cn.cn_namelen + 1); - cn.cn_nameiop = CREATE; - cn.cn_flags = (LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | ISLASTCN); - cn.cn_lkflags = LK_EXCLUSIVE; - cn.cn_thread = td; - cn.cn_cred = cred; - cn.cn_nameptr = cn.cn_pnbuf; + nd.ni_cnd.cn_namelen = strlen(unp->un_path); + nd.ni_cnd.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); + bcopy(unp->un_path, nd.ni_cnd.cn_pnbuf, nd.ni_cnd.cn_namelen + 1); + nd.ni_cnd.cn_nameiop = CREATE; + nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | + ISLASTCN; + nd.ni_cnd.cn_lkflags = LK_EXCLUSIVE; + nd.ni_cnd.cn_thread = td; + nd.ni_cnd.cn_cred = cred; + nd.ni_cnd.cn_nameptr = nd.ni_cnd.cn_pnbuf; + NDPREINIT(&nd); vref(udvp); - if ((error = relookup(udvp, &vp, &cn)) != 0) + if ((error = relookup(udvp, &vp, &nd.ni_cnd)) != 0) goto unionfs_vn_create_on_upper_free_out2; vrele(udvp); @@ -944,7 +950,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, goto unionfs_vn_create_on_upper_free_out1; } - if ((error = VOP_CREATE(udvp, &vp, &cn, uvap)) != 0) + if ((error = VOP_CREATE(udvp, &vp, &nd.ni_cnd, uvap)) != 0) goto unionfs_vn_create_on_upper_free_out1; if ((error = VOP_OPEN(vp, fmode, cred, td, NULL)) != 0) { @@ -964,9 +970,9 @@ unionfs_vn_create_on_upper_free_out1: VOP_UNLOCK(udvp); unionfs_vn_create_on_upper_free_out2: - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } return (error); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:10:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 35463653CD3; Wed, 7 Jul 2021 11:10: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 4GKcDL5THQz4fs5; Wed, 7 Jul 2021 11:10:58 +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 8ECE645C1; Wed, 7 Jul 2021 11:10: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 167BAwvX040852; Wed, 7 Jul 2021 11:10:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BAw13040851; Wed, 7 Jul 2021 11:10:58 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:10:58 GMT Message-Id: <202107071110.167BAw13040851@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: b3c1b988ded5 - stable/13 - ufs_vnops.c: style 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/13 X-Git-Reftype: branch X-Git-Commit: b3c1b988ded5d80e0fd3425580716f1110629bfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:10:59 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b3c1b988ded5d80e0fd3425580716f1110629bfb commit b3c1b988ded5d80e0fd3425580716f1110629bfb Author: Konstantin Belousov AuthorDate: 2021-05-01 21:40:50 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:35 +0000 ufs_vnops.c: style (cherry picked from commit b2b40b28b1784fb153f8aefb4f86e085a149e91e) --- sys/ufs/ufs/ufs_vnops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ef288a32e815..00249e3902c8 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -105,14 +105,16 @@ VFS_SMR_DECLARE; static vop_accessx_t ufs_accessx; static vop_fplookup_vexec_t ufs_fplookup_vexec; static int ufs_chmod(struct vnode *, int, struct ucred *, struct thread *); -static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct thread *); +static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, + struct thread *); static vop_close_t ufs_close; static vop_create_t ufs_create; static vop_stat_t ufs_stat; static vop_getattr_t ufs_getattr; static vop_ioctl_t ufs_ioctl; static vop_link_t ufs_link; -static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *, const char *); +static int ufs_makeinode(int mode, struct vnode *, struct vnode **, + struct componentname *, const char *); static vop_mmapped_t ufs_mmapped; static vop_mkdir_t ufs_mkdir; static vop_mknod_t ufs_mknod; From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 42B03653D1B; Wed, 7 Jul 2021 11:11: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 4GKcDM6Rjsz4fXp; Wed, 7 Jul 2021 11:10: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 BA0423DBC; Wed, 7 Jul 2021 11:10: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 167BAxBj040880; Wed, 7 Jul 2021 11:10:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BAxsQ040879; Wed, 7 Jul 2021 11:10:59 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:10:59 GMT Message-Id: <202107071110.167BAxsQ040879@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: 91ef0d6ac65f - stable/13 - ffs: reduce number of dvp relocks in softdep_prelink() 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/13 X-Git-Reftype: branch X-Git-Commit: 91ef0d6ac65f20fe677802146f5fa308793c6443 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:00 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=91ef0d6ac65f20fe677802146f5fa308793c6443 commit 91ef0d6ac65f20fe677802146f5fa308793c6443 Author: Konstantin Belousov AuthorDate: 2021-04-29 22:21:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:40 +0000 ffs: reduce number of dvp relocks in softdep_prelink() (cherry picked from commit d0929a990c80b78bc84326234cf54cd4382d42fd) --- sys/ufs/ffs/ffs_softdep.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 2cc16ab2a2c1..dbd08905d953 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3392,10 +3392,9 @@ softdep_prelink(dvp, vp) if (vp != NULL) VOP_UNLOCK(vp); ffs_syncvnode(dvp, MNT_WAIT, 0); - VOP_UNLOCK(dvp); - /* Process vp before dvp as it may create .. removes. */ if (vp != NULL) { + VOP_UNLOCK(dvp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_data == NULL) { vn_lock_pair(dvp, false, vp, true); @@ -3406,12 +3405,11 @@ softdep_prelink(dvp, vp) process_truncates(vp); FREE_LOCK(ump); VOP_UNLOCK(vp); - } - - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); - if (dvp->v_data == NULL) { - vn_lock_pair(dvp, true, vp, false); - return (ERELOOKUP); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); + if (dvp->v_data == NULL) { + vn_lock_pair(dvp, true, vp, false); + return (ERELOOKUP); + } } ACQUIRE_LOCK(ump); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9E0C7653247; Wed, 7 Jul 2021 11:11: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 4GKcDP2pVgz4fdM; Wed, 7 Jul 2021 11:11: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 DE6B143DA; Wed, 7 Jul 2021 11:11: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 167BB0xj040922; Wed, 7 Jul 2021 11:11:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BB0Ls040921; Wed, 7 Jul 2021 11:11:00 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:11:00 GMT Message-Id: <202107071111.167BB0Ls040921@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: ac6447c08aec - stable/13 - ufs_rename(): softdep_prerename() does something only for SU+J 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/13 X-Git-Reftype: branch X-Git-Commit: ac6447c08aec6e389ae87369af221dfe2ecd2f16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:01 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ac6447c08aec6e389ae87369af221dfe2ecd2f16 commit ac6447c08aec6e389ae87369af221dfe2ecd2f16 Author: Konstantin Belousov AuthorDate: 2021-04-29 22:23:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:45 +0000 ufs_rename(): softdep_prerename() does something only for SU+J (cherry picked from commit 5eacde3eb83de6ef1e0b126c019c759bf411e36a) --- sys/ufs/ufs/ufs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 00249e3902c8..2154f7aa7f95 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1364,7 +1364,7 @@ relock: } } - if (DOINGSOFTDEP(fdvp)) { + if (DOINGSUJ(fdvp)) { error = softdep_prerename(fdvp, fvp, tdvp, tvp); if (error != 0) { if (error == ERELOOKUP) { From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5DF09653A5C; Wed, 7 Jul 2021 11:11:02 +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 4GKcDQ19MJz4fsG; Wed, 7 Jul 2021 11:11: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 0A22743DC; Wed, 7 Jul 2021 11:11:02 +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 167BB1OS040946; Wed, 7 Jul 2021 11:11:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BB1C1040945; Wed, 7 Jul 2021 11:11:01 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:11:01 GMT Message-Id: <202107071111.167BB1C1040945@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: a7a074d50aec - stable/13 - ffs: mark block (re-)allocations as seqc writes 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/13 X-Git-Reftype: branch X-Git-Commit: a7a074d50aecfe5717d469a81018678ce2880cf1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:02 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a7a074d50aecfe5717d469a81018678ce2880cf1 commit a7a074d50aecfe5717d469a81018678ce2880cf1 Author: Konstantin Belousov AuthorDate: 2021-05-21 14:12:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:53 +0000 ffs: mark block (re-)allocations as seqc writes (cherry picked from commit d4d289cd51078de9e82c9d83977cfa614032cd06) --- sys/ufs/ffs/ffs_alloc.c | 9 ++-- sys/ufs/ffs/ffs_balloc.c | 116 ++++++++++++++++++++++++++++------------------- 2 files changed, 75 insertions(+), 50 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index c895c8c7bf07..771377b7cefc 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -517,6 +517,7 @@ ffs_reallocblks(ap) } */ *ap; { struct ufsmount *ump; + int error; /* * We used to skip reallocating the blocks of a file into a @@ -546,9 +547,11 @@ ffs_reallocblks(ap) if (DOINGSUJ(ap->a_vp)) if (softdep_prealloc(ap->a_vp, MNT_NOWAIT) != 0) return (ENOSPC); - if (ump->um_fstype == UFS1) - return (ffs_reallocblks_ufs1(ap)); - return (ffs_reallocblks_ufs2(ap)); + vn_seqc_write_begin(ap->a_vp); + error = ump->um_fstype == UFS1 ? ffs_reallocblks_ufs1(ap) : + ffs_reallocblks_ufs2(ap); + vn_seqc_write_end(ap->a_vp); + return (error); } static int diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index 1b53a90a48c4..d7718e56dd87 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -128,6 +128,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, return (EFBIG); gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; + vn_seqc_write_begin(vp); + /* * If the next write will extend the file into a new block, * and the file is currently composed of a fragment @@ -144,7 +146,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, (int)fs->fs_bsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, nb, dbtofsb(fs, bp->b_blkno), dp->di_db[nb], @@ -174,17 +176,20 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, error = bread(vp, lbn, fs->fs_bsize, NOCRED, &bp); if (error != 0) - return (error); + goto done; } else { bp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); - if (bp == NULL) - return (EIO); + if (bp == NULL) { + error = EIO; + goto done; + } vfs_bio_clrbuf(bp); } bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; - return (0); + error = 0; + goto done; } if (nb != 0) { /* @@ -194,9 +199,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, nsize = fragroundup(fs, size); if (nsize <= osize) { error = bread(vp, lbn, osize, NOCRED, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); } else { UFS_LOCK(ump); @@ -205,7 +209,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, nsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, lbn, dbtofsb(fs, bp->b_blkno), nb, @@ -221,7 +225,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, ffs_blkpref_ufs1(ip, lbn, (int)lbn, &dp->di_db[0]), nsize, flags, cred, &newb); if (error) - return (error); + goto done; bp = getblk(vp, lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) @@ -233,14 +237,15 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, dp->di_db[lbn] = dbtofsb(fs, bp->b_blkno); UFS_INODE_SET_FLAG(ip, IN_CHANGE | IN_UPDATE | IN_IBLKDATA); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Determine the number of levels of indirection. */ pref = 0; if ((error = ufs_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + goto done; #ifdef INVARIANTS if (num < 1) panic ("ffs_balloc_ufs1: ufs_getlbns returned indirect block"); @@ -261,7 +266,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { curthread_pflags_restore(saved_inbdflush); - return (error); + goto done; } pref = newb + fs->fs_frag; nb = newb; @@ -387,7 +392,8 @@ retry: if (flags & BA_METAONLY) { curthread_pflags_restore(saved_inbdflush); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Get the data block, allocating if necessary. @@ -453,7 +459,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; } brelse(bp); if (flags & BA_CLRBUF) { @@ -478,7 +485,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; fail: curthread_pflags_restore(saved_inbdflush); /* @@ -486,7 +494,7 @@ fail: * This is the usual case and avoids the need to fsync the file. */ if (allocblk == allociblk && allocib == NULL && unwindidx == -1) - return (error); + goto done; /* * If we have failed part way through block allocation, we * have to deallocate any indirect blocks that we have allocated. @@ -574,6 +582,8 @@ fail: ffs_blkfree(ump, fs, ump->um_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL, SINGLETON_KEY); } +done: + vn_seqc_write_end(vp); return (error); } @@ -619,12 +629,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, return (EFBIG); gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; + vn_seqc_write_begin(vp); + /* * Check for allocating external data. */ if (flags & IO_EXT) { - if (lbn >= UFS_NXADDR) - return (EFBIG); + if (lbn >= UFS_NXADDR) { + error = EFBIG; + goto done; + } + /* * If the next write will extend the data into a new block, * and the data is currently composed of a fragment @@ -642,7 +657,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_extb[0]), osize, (int)fs->fs_bsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocext(ip, nb, dbtofsb(fs, bp->b_blkno), @@ -668,13 +683,12 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if (nb != 0 && dp->di_extsize >= smalllblktosize(fs, lbn + 1)) { error = bread_gb(vp, -1 - lbn, fs->fs_bsize, NOCRED, gbflags, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); bp->b_xflags |= BX_ALTDATA; *bpp = bp; - return (0); + goto done; } if (nb != 0) { /* @@ -685,9 +699,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if (nsize <= osize) { error = bread_gb(vp, -1 - lbn, osize, NOCRED, gbflags, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); bp->b_xflags |= BX_ALTDATA; } else { @@ -698,7 +711,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_extb[0]), osize, nsize, flags, cred, &bp); if (error) - return (error); + goto done; bp->b_xflags |= BX_ALTDATA; if (DOINGSOFTDEP(vp)) softdep_setup_allocext(ip, lbn, @@ -715,7 +728,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_extb[0]), nsize, flags, cred, &newb); if (error) - return (error); + goto done; bp = getblk(vp, -1 - lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); bp->b_xflags |= BX_ALTDATA; @@ -728,7 +741,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, dp->di_extb[lbn] = dbtofsb(fs, bp->b_blkno); UFS_INODE_SET_FLAG(ip, IN_CHANGE | IN_IBLKDATA); *bpp = bp; - return (0); + error = 0; + goto done; } /* * If the next write will extend the file into a new block, @@ -746,7 +760,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, (int)fs->fs_bsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, nb, dbtofsb(fs, bp->b_blkno), @@ -775,17 +789,20 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, error = bread_gb(vp, lbn, fs->fs_bsize, NOCRED, gbflags, &bp); if (error != 0) - return (error); + goto done; } else { bp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); - if (bp == NULL) - return (EIO); + if (bp == NULL) { + error = EIO; + goto done; + } vfs_bio_clrbuf(bp); } bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; - return (0); + error = 0; + goto done; } if (nb != 0) { /* @@ -796,9 +813,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if (nsize <= osize) { error = bread_gb(vp, lbn, osize, NOCRED, gbflags, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); } else { UFS_LOCK(ump); @@ -807,7 +823,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, nsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, lbn, dbtofsb(fs, bp->b_blkno), nb, @@ -823,7 +839,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_db[0]), nsize, flags, cred, &newb); if (error) - return (error); + goto done; bp = getblk(vp, lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) @@ -835,14 +851,15 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, dp->di_db[lbn] = dbtofsb(fs, bp->b_blkno); UFS_INODE_SET_FLAG(ip, IN_CHANGE | IN_UPDATE | IN_IBLKDATA); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Determine the number of levels of indirection. */ pref = 0; if ((error = ufs_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + goto done; #ifdef INVARIANTS if (num < 1) panic ("ffs_balloc_ufs2: ufs_getlbns returned indirect block"); @@ -863,7 +880,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { curthread_pflags_restore(saved_inbdflush); - return (error); + goto done; } pref = newb + fs->fs_frag; nb = newb; @@ -991,7 +1008,8 @@ retry: if (flags & BA_METAONLY) { curthread_pflags_restore(saved_inbdflush); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Get the data block, allocating if necessary. @@ -1057,7 +1075,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; } brelse(bp); /* @@ -1088,7 +1107,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; fail: curthread_pflags_restore(saved_inbdflush); /* @@ -1096,7 +1116,7 @@ fail: * This is the usual case and avoids the need to fsync the file. */ if (allocblk == allociblk && allocib == NULL && unwindidx == -1) - return (error); + goto done; /* * If we have failed part way through block allocation, we * have to deallocate any indirect blocks that we have allocated. @@ -1184,5 +1204,7 @@ fail: ffs_blkfree(ump, fs, ump->um_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL, SINGLETON_KEY); } +done: + vn_seqc_write_end(vp); return (error); } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8A43365324D; Wed, 7 Jul 2021 11:11: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 4GKcDR6kLkz4fnC; Wed, 7 Jul 2021 11:11: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 258704606; Wed, 7 Jul 2021 11:11: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 167BB3FA040970; Wed, 7 Jul 2021 11:11:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BB3tB040969; Wed, 7 Jul 2021 11:11:03 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:11:03 GMT Message-Id: <202107071111.167BB3tB040969@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: 9487bd8ee37e - stable/13 - ufs_rename(): only do softdep_prerename() when other thread changed a vnode 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/13 X-Git-Reftype: branch X-Git-Commit: 9487bd8ee37e6a0394946909636267f644ee8df0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:04 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9487bd8ee37e6a0394946909636267f644ee8df0 commit 9487bd8ee37e6a0394946909636267f644ee8df0 Author: Konstantin Belousov AuthorDate: 2021-04-29 22:39:57 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:23:58 +0000 ufs_rename(): only do softdep_prerename() when other thread changed a vnode (cherry picked from commit f7565466622a411a50522f23528faeb1e57d4571) --- sys/ufs/ufs/ufs_vnops.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 2154f7aa7f95..b0fb1b74b900 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1248,6 +1248,7 @@ ufs_rename(ap) int error = 0; struct mount *mp; ino_t ino; + seqc_t fdvp_s, fvp_s, tdvp_s, tvp_s; bool want_seqc_end; want_seqc_end = false; @@ -1271,6 +1272,8 @@ ufs_rename(ap) mp = NULL; goto releout; } + + fdvp_s = fvp_s = tdvp_s = tvp_s = SEQC_MOD; relock: /* * We need to acquire 2 to 4 locks depending on whether tvp is NULL @@ -1364,10 +1367,20 @@ relock: } } - if (DOINGSUJ(fdvp)) { + if (DOINGSUJ(fdvp) && + (seqc_in_modify(fdvp_s) || !vn_seqc_consistent(fdvp, fdvp_s) || + seqc_in_modify(fvp_s) || !vn_seqc_consistent(fvp, fvp_s) || + seqc_in_modify(tdvp_s) || !vn_seqc_consistent(tdvp, tdvp_s) || + (tvp != NULL && (seqc_in_modify(tvp_s) || + !vn_seqc_consistent(tvp, tvp_s))))) { error = softdep_prerename(fdvp, fvp, tdvp, tvp); if (error != 0) { if (error == ERELOOKUP) { + fdvp_s = vn_seqc_read_any(fdvp); + fvp_s = vn_seqc_read_any(fvp); + tdvp_s = vn_seqc_read_any(tdvp); + if (tvp != NULL) + tvp_s = vn_seqc_read_any(tvp); atomic_add_int(&rename_restarts, 1); goto relock; } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A1E49653C5E; Wed, 7 Jul 2021 11:11: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 4GKcDS3B26z4fY6; Wed, 7 Jul 2021 11:11: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 4CA1943DE; Wed, 7 Jul 2021 11:11: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 167BB47q040994; Wed, 7 Jul 2021 11:11:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BB4BB040993; Wed, 7 Jul 2021 11:11:04 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:11:04 GMT Message-Id: <202107071111.167BB4BB040993@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: 2622570aeb3d - stable/13 - softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink 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/13 X-Git-Reftype: branch X-Git-Commit: 2622570aeb3d162812d72f7ef192c322cd8b73ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:04 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2622570aeb3d162812d72f7ef192c322cd8b73ef commit 2622570aeb3d162812d72f7ef192c322cd8b73ef Author: Konstantin Belousov AuthorDate: 2021-05-01 21:53:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:50:13 +0000 softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink FreeBSD_version is bumped due to struct namei size change (cherry picked from commit 64b494a1050ae2cf2412edc19b57dc80f49eeda1) --- sys/sys/namei.h | 12 +++++++++++- sys/sys/param.h | 2 +- sys/ufs/ffs/ffs_extern.h | 3 ++- sys/ufs/ffs/ffs_softdep.c | 32 +++++++++++++++++++++++++++----- sys/ufs/ufs/ufs_vnops.c | 12 ++++++------ 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/sys/sys/namei.h b/sys/sys/namei.h index b4db0e758e2b..9e0a82ea1659 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -38,6 +38,7 @@ #include #include #include +#include #include enum nameiop { LOOKUP, CREATE, DELETE, RENAME }; @@ -111,6 +112,12 @@ struct nameidata { */ struct componentname ni_cnd; struct nameicap_tracker_head ni_cap_tracker; + /* + * Private helper data for UFS, must be at the end. See + * NDINIT_PREFILL(). + */ + seqc_t ni_dvp_seqc; + seqc_t ni_vp_seqc; }; #ifdef _KERNEL @@ -224,7 +231,8 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, * Note the constant pattern may *hide* bugs. */ #ifdef INVARIANTS -#define NDINIT_PREFILL(arg) memset(arg, 0xff, sizeof(*arg)) +#define NDINIT_PREFILL(arg) memset(arg, 0xff, offsetof(struct nameidata, \ + ni_dvp_seqc)) #define NDINIT_DBG(arg) { (arg)->ni_debugflags = NAMEI_DBG_INITED; } #define NDREINIT_DBG(arg) { \ if (((arg)->ni_debugflags & NAMEI_DBG_INITED) == 0) \ @@ -266,6 +274,8 @@ do { \ } while (0) #define NDPREINIT(ndp) do { \ + (ndp)->ni_dvp_seqc = SEQC_MOD; \ + (ndp)->ni_vp_seqc = SEQC_MOD; \ } while (0) #define NDF_NO_DVP_RELE 0x00000001 diff --git a/sys/sys/param.h b/sys/sys/param.h index 41db9a1675f7..4c43839c297e 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300510 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300511 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 544012089046..0365cb76601e 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -178,7 +178,8 @@ int softdep_request_cleanup(struct fs *, struct vnode *, struct ucred *, int); int softdep_prerename(struct vnode *, struct vnode *, struct vnode *, struct vnode *); -int softdep_prelink(struct vnode *, struct vnode *); +int softdep_prelink(struct vnode *, struct vnode *, + struct componentname *); void softdep_setup_freeblocks(struct inode *, off_t, int); void softdep_setup_inomapdep(struct buf *, struct inode *, ino_t, int); void softdep_setup_blkmapdep(struct buf *, struct mount *, ufs2_daddr_t, diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index dbd08905d953..f6dd5c776611 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -621,9 +621,10 @@ softdep_prerename(fdvp, fvp, tdvp, tvp) } int -softdep_prelink(dvp, vp) +softdep_prelink(dvp, vp, cnp) struct vnode *dvp; struct vnode *vp; + struct componentname *cnp; { panic("softdep_prelink called"); @@ -3361,11 +3362,13 @@ softdep_prerename(fdvp, fvp, tdvp, tvp) * syscall must be restarted at top level from the lookup. */ int -softdep_prelink(dvp, vp) +softdep_prelink(dvp, vp, cnp) struct vnode *dvp; struct vnode *vp; + struct componentname *cnp; { struct ufsmount *ump; + struct nameidata *ndp; ASSERT_VOP_ELOCKED(dvp, "prelink dvp"); if (vp != NULL) @@ -3381,13 +3384,28 @@ softdep_prelink(dvp, vp) if (journal_space(ump, 0) || (vp != NULL && IS_SNAPSHOT(VTOI(vp)))) return (0); + /* + * Check if the journal space consumption can in theory be + * accounted on dvp and vp. If the vnodes metadata was not + * changed comparing with the previous round-trip into + * softdep_prelink(), as indicated by the seqc generation + * recorded in the nameidata, then there is no point in + * starting the sync. + */ + ndp = __containerof(cnp, struct nameidata, ni_cnd); + if (!seqc_in_modify(ndp->ni_dvp_seqc) && + vn_seqc_consistent(dvp, ndp->ni_dvp_seqc) && + (vp == NULL || (!seqc_in_modify(ndp->ni_vp_seqc) && + vn_seqc_consistent(vp, ndp->ni_vp_seqc)))) + return (0); + stat_journal_low++; if (vp != NULL) { VOP_UNLOCK(dvp); ffs_syncvnode(vp, MNT_NOWAIT, 0); vn_lock_pair(dvp, false, vp, true); if (dvp->v_data == NULL) - return (ERELOOKUP); + goto out; } if (vp != NULL) VOP_UNLOCK(vp); @@ -3398,7 +3416,7 @@ softdep_prelink(dvp, vp) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_data == NULL) { vn_lock_pair(dvp, false, vp, true); - return (ERELOOKUP); + goto out; } ACQUIRE_LOCK(ump); process_removes(vp); @@ -3408,7 +3426,7 @@ softdep_prelink(dvp, vp) vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); if (dvp->v_data == NULL) { vn_lock_pair(dvp, true, vp, false); - return (ERELOOKUP); + goto out; } } @@ -3427,6 +3445,10 @@ softdep_prelink(dvp, vp) FREE_LOCK(ump); vn_lock_pair(dvp, false, vp, false); +out: + ndp->ni_dvp_seqc = vn_seqc_read_any(dvp); + if (vp != NULL) + ndp->ni_vp_seqc = vn_seqc_read_any(vp); return (ERELOOKUP); } diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index b0fb1b74b900..2dfc2e24f772 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1010,7 +1010,7 @@ ufs_remove(ap) (VTOI(dvp)->i_flags & APPEND)) return (EPERM); if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, vp); + error = softdep_prelink(dvp, vp, ap->a_cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -1075,7 +1075,7 @@ ufs_link(ap) #endif if (DOINGSUJ(tdvp)) { - error = softdep_prelink(tdvp, vp); + error = softdep_prelink(tdvp, vp, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -1147,7 +1147,7 @@ ufs_whiteout(ap) if (DOINGSUJ(dvp) && (ap->a_flags == CREATE || ap->a_flags == DELETE)) { - error = softdep_prelink(dvp, NULL); + error = softdep_prelink(dvp, NULL, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -1962,7 +1962,7 @@ ufs_mkdir(ap) } if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, NULL); + error = softdep_prelink(dvp, NULL, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -2226,7 +2226,7 @@ ufs_rmdir(ap) goto out; } if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, vp); + error = softdep_prelink(dvp, vp, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -2751,7 +2751,7 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc) return (EINVAL); } if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, NULL); + error = softdep_prelink(dvp, NULL, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 42AC3653250; Wed, 7 Jul 2021 11:11: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 4GKcDT4YW5z4fq5; Wed, 7 Jul 2021 11:11: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 70D5C40B6; Wed, 7 Jul 2021 11:11: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 167BB5RA041018; Wed, 7 Jul 2021 11:11:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BB564041017; Wed, 7 Jul 2021 11:11:05 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:11:05 GMT Message-Id: <202107071111.167BB564041017@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: ecb63094dce6 - stable/13 - ffs_softdep.c: add journal_check_space() helper 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/13 X-Git-Reftype: branch X-Git-Commit: ecb63094dce6c4a77c19eba046e61ccd4094381b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:06 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ecb63094dce6c4a77c19eba046e61ccd4094381b commit ecb63094dce6c4a77c19eba046e61ccd4094381b Author: Konstantin Belousov AuthorDate: 2021-06-15 10:23:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:50:43 +0000 ffs_softdep.c: add journal_check_space() helper (cherry picked from commit 2126f103e0434db6ca34f0a5167bf5f03d4f02ad) --- sys/ufs/ffs/ffs_softdep.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index f6dd5c776611..fe3af651632e 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3199,6 +3199,19 @@ journal_unsuspend(struct ufsmount *ump) return (0); } +static void +journal_check_space(ump) + struct ufsmount *ump; +{ + LOCK_OWNED(ump); + + if (journal_space(ump, 0) == 0) { + softdep_speedup(ump); + if (journal_space(ump, 1) == 0) + journal_suspend(ump); + } +} + /* * Called before any allocation function to be certain that there is * sufficient space in the journal prior to creating any new records. @@ -3249,11 +3262,7 @@ softdep_prealloc(vp, waitok) ACQUIRE_LOCK(ump); process_removes(vp); process_truncates(vp); - if (journal_space(ump, 0) == 0) { - softdep_speedup(ump); - if (journal_space(ump, 1) == 0) - journal_suspend(ump); - } + journal_check_space(ump); FREE_LOCK(ump); return (0); @@ -3340,11 +3349,7 @@ softdep_prerename(fdvp, fvp, tdvp, tvp) ACQUIRE_LOCK(ump); softdep_speedup(ump); process_worklist_item(UFSTOVFS(ump), 2, LK_NOWAIT); - if (journal_space(ump, 0) == 0) { - softdep_speedup(ump); - if (journal_space(ump, 1) == 0) - journal_suspend(ump); - } + journal_check_space(ump); FREE_LOCK(ump); return (ERELOOKUP); } @@ -3437,11 +3442,7 @@ softdep_prelink(dvp, vp, cnp) softdep_speedup(ump); process_worklist_item(UFSTOVFS(ump), 2, LK_NOWAIT); - if (journal_space(ump, 0) == 0) { - softdep_speedup(ump); - if (journal_space(ump, 1) == 0) - journal_suspend(ump); - } + journal_check_space(ump); FREE_LOCK(ump); vn_lock_pair(dvp, false, vp, false); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:11:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9DABC653E28; Wed, 7 Jul 2021 11:11: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 4GKcDW5KWjz4fsT; Wed, 7 Jul 2021 11:11: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 9970D44A4; Wed, 7 Jul 2021 11:11: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 167BB67G041048; Wed, 7 Jul 2021 11:11:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BB6O5041047; Wed, 7 Jul 2021 11:11:06 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:11:06 GMT Message-Id: <202107071111.167BB6O5041047@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: d36505493d2a - stable/13 - ffs_softdep: force sync if journal is low in journal_check_space 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/13 X-Git-Reftype: branch X-Git-Commit: d36505493d2a876b37da0c7850ef906b1f32df08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:11:08 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d36505493d2a876b37da0c7850ef906b1f32df08 commit d36505493d2a876b37da0c7850ef906b1f32df08 Author: Konstantin Belousov AuthorDate: 2021-06-15 10:27:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 10:50:44 +0000 ffs_softdep: force sync if journal is low in journal_check_space (cherry picked from commit 50acaaef54b4d7811393eb8c05a398d7a1882418) --- sys/ufs/ffs/ffs_softdep.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index fe3af651632e..446fc69a6a32 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3203,10 +3203,17 @@ static void journal_check_space(ump) struct ufsmount *ump; { + struct mount *mp; + LOCK_OWNED(ump); if (journal_space(ump, 0) == 0) { softdep_speedup(ump); + mp = UFSTOVFS(ump); + FREE_LOCK(ump); + VFS_SYNC(mp, MNT_NOWAIT); + ffs_sbupdate(ump, MNT_WAIT, 0); + ACQUIRE_LOCK(ump); if (journal_space(ump, 1) == 0) journal_suspend(ump); } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:12:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 642FE654245; Wed, 7 Jul 2021 11:12:29 +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 4GKcG52SZVz4gH2; Wed, 7 Jul 2021 11:12: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 3D11745E8; Wed, 7 Jul 2021 11:12: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 167BCT5d045422; Wed, 7 Jul 2021 11:12:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCT9e045421; Wed, 7 Jul 2021 11:12:29 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:29 GMT Message-Id: <202107071112.167BCT9e045421@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 71ab344524a1 - main - Add sv_onexec_old() sysent hook for exec event 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/main X-Git-Reftype: branch X-Git-Commit: 71ab344524a14f00f21c4c5638906d7b965d2b64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71ab344524a14f00f21c4c5638906d7b965d2b64 commit 71ab344524a14f00f21c4c5638906d7b965d2b64 Author: Konstantin Belousov AuthorDate: 2021-07-01 18:04:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:07 +0000 Add sv_onexec_old() sysent hook for exec event Unlike sv_onexec(), it is called from the old (pre-exec) sysentvec structure. The old vmspace for the process is still intact during the call. Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/kern/kern_exec.c | 2 ++ sys/sys/sysent.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c3c23f44189e..763196a593e4 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1064,6 +1064,8 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) sigfastblock_clear(td); umtx_exec(p); + if (p->p_sysent->sv_onexec_old != NULL) + p->p_sysent->sv_onexec_old(td); itimers_exec(p); if (sv->sv_onexec != NULL) sv->sv_onexec(p, imgp); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index e0e5e351ae20..869c140c06f5 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -150,6 +150,7 @@ struct sysentvec { u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */ const char *(*sv_machine_arch)(struct proc *); vm_offset_t sv_fxrng_gen_base; + void (*sv_onexec_old)(struct thread *td); void (*sv_onexec)(struct proc *, struct image_params *); void (*sv_onexit)(struct proc *); void (*sv_ontdexit)(struct thread *td); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:12:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C57E654421; Wed, 7 Jul 2021 11:12: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 4GKcG63TYGz4gR0; Wed, 7 Jul 2021 11:12: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 5F75644BB; Wed, 7 Jul 2021 11:12: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 167BCUu5045446; Wed, 7 Jul 2021 11:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCUMP045445; Wed, 7 Jul 2021 11:12:30 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:30 GMT Message-Id: <202107071112.167BCUMP045445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 55976ce11a10 - main - Move sv_onexit() sysentvec hook slightly later 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/main X-Git-Reftype: branch X-Git-Commit: 55976ce11a10765dee6c71b7ed6eac016bd560ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=55976ce11a10765dee6c71b7ed6eac016bd560ef commit 55976ce11a10765dee6c71b7ed6eac016bd560ef Author: Konstantin Belousov AuthorDate: 2021-07-01 18:06:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:07 +0000 Move sv_onexit() sysentvec hook slightly later after itimers are stopped. This makes it more usable for e.g. native FreeBSD ABI sysentvecs. Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/kern/kern_exit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index fcd8b39a8ee2..515c2d4e6397 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -340,9 +340,6 @@ exit1(struct thread *td, int rval, int signo) itimers_exit(p); - if (p->p_sysent->sv_onexit != NULL) - p->p_sysent->sv_onexit(p); - /* * Check if any loadable modules need anything done at process exit. * E.g. SYSV IPC stuff. @@ -374,6 +371,8 @@ exit1(struct thread *td, int rval, int signo) PROC_UNLOCK(p); umtx_thread_exit(td); + if (p->p_sysent->sv_onexit != NULL) + p->p_sysent->sv_onexit(p); seltdfini(td); /* From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:12:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 18B8B6543DF; Wed, 7 Jul 2021 11:12: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 4GKcG75RdGz4gR9; Wed, 7 Jul 2021 11:12: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 8564344BC; Wed, 7 Jul 2021 11:12: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 167BCVn9045470; Wed, 7 Jul 2021 11:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCVtx045469; Wed, 7 Jul 2021 11:12:31 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:31 GMT Message-Id: <202107071112.167BCVtx045469@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 28a66fc3da34 - main - Do not call FreeBSD-ABI specific code for all ABIs 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/main X-Git-Reftype: branch X-Git-Commit: 28a66fc3da3460850520389971e1194f5327f560 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28a66fc3da3460850520389971e1194f5327f560 commit 28a66fc3da3460850520389971e1194f5327f560 Author: Konstantin Belousov AuthorDate: 2021-07-01 18:00:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:07 +0000 Do not call FreeBSD-ABI specific code for all ABIs Use sysentvec hooks to only call umtx_thread_exit/umtx_exec, which handle robust mutexes, for native FreeBSD ABI. Similarly, there is no sense in calling sigfastblock_clear() for non-native ABIs. Requested by: dchagin Reviewed by: dchagin, markj (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/amd64/amd64/elf_machdep.c | 4 ++++ sys/arm/arm/elf_machdep.c | 2 ++ sys/arm64/arm64/elf32_machdep.c | 2 ++ sys/arm64/arm64/elf_machdep.c | 2 ++ sys/compat/ia32/ia32_sysvec.c | 2 ++ sys/i386/i386/elf_machdep.c | 2 ++ sys/kern/imgact_aout.c | 4 ++++ sys/kern/kern_exec.c | 9 +++++++-- sys/kern/kern_exit.c | 8 +++++++- sys/mips/mips/elf_machdep.c | 2 ++ sys/powerpc/powerpc/elf32_machdep.c | 2 ++ sys/powerpc/powerpc/elf64_machdep.c | 4 ++++ sys/riscv/riscv/elf_machdep.c | 2 ++ sys/sys/sysent.h | 3 +++ 14 files changed, 45 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index a7cef2a8d92a..80f7d1d8cefa 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -85,6 +85,8 @@ struct sysentvec elf64_freebsd_sysvec_la48 = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_stackgap = elf64_stackgap, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; struct sysentvec elf64_freebsd_sysvec_la57 = { @@ -123,6 +125,8 @@ struct sysentvec elf64_freebsd_sysvec_la57 = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_stackgap = elf64_stackgap, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; static void diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index c67cd225a1af..64e347ce7649 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -100,6 +100,8 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_hwcap2 = &elf_hwcap2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 5321e12d74e9..206413b45172 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -112,6 +112,8 @@ static struct sysentvec elf32_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c index 82ecdf894911..eafaf4150dff 100644 --- a/sys/arm64/arm64/elf_machdep.c +++ b/sys/arm64/arm64/elf_machdep.c @@ -95,6 +95,8 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_hwcap2 = &elf_hwcap2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index 2b019e3b0323..df8a36a34810 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -131,6 +131,8 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_stackgap = elf32_stackgap, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec); diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index cb7b5617715c..5858c8382e33 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -86,6 +86,8 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 3255ef169f70..9e7455e14e1d 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -101,6 +101,8 @@ struct sysentvec aout_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; #elif defined(__amd64__) @@ -137,6 +139,8 @@ struct sysentvec aout_sysvec = { .sv_set_syscall_retval = ia32_set_syscall_retval, .sv_fetch_syscall_args = ia32_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; #else #error "Port me" diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 763196a593e4..edb4ad1af3c1 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1040,6 +1040,13 @@ exec_unmap_first_page(struct image_params *imgp) } } +void +exec_onexec_old(struct thread *td) +{ + sigfastblock_clear(td); + umtx_exec(td->td_proc); +} + /* * Destroy old address space, and allocate a new stack. * The new stack is only sgrowsiz large because it is grown @@ -1062,8 +1069,6 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) imgp->vmspace_destroyed = 1; imgp->sysent = sv; - sigfastblock_clear(td); - umtx_exec(p); if (p->p_sysent->sv_onexec_old != NULL) p->p_sysent->sv_onexec_old(td); itimers_exec(p); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 515c2d4e6397..bfd25366b49c 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -195,6 +195,13 @@ proc_clear_orphan(struct proc *p) p->p_treeflag &= ~P_TREE_ORPHANED; } +void +exit_onexit(struct proc *p) +{ + MPASS(p->p_numthreads == 1); + umtx_thread_exit(FIRST_THREAD_IN_PROC(p)); +} + /* * exit -- death of process. */ @@ -370,7 +377,6 @@ exit1(struct thread *td, int rval, int signo) PROC_UNLOCK(p); - umtx_thread_exit(td); if (p->p_sysent->sv_onexit != NULL) p->p_sysent->sv_onexit(p); seltdfini(td); diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c index 9df6d1d36436..c6a45f71107b 100644 --- a/sys/mips/mips/elf_machdep.c +++ b/sys/mips/mips/elf_machdep.c @@ -91,6 +91,8 @@ static struct sysentvec elf_freebsd_sysvec = { .sv_schedtail = NULL, .sv_thread_detach = NULL, .sv_trap = NULL, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; static __ElfN(Brandinfo) freebsd_brand_info = { diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c index 2c4928f7d9df..341352fdd589 100644 --- a/sys/powerpc/powerpc/elf32_machdep.c +++ b/sys/powerpc/powerpc/elf32_machdep.c @@ -134,6 +134,8 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &cpu_features, .sv_hwcap2 = &cpu_features2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c index 38f76c158793..dca1ec6bb535 100644 --- a/sys/powerpc/powerpc/elf64_machdep.c +++ b/sys/powerpc/powerpc/elf64_machdep.c @@ -96,6 +96,8 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_trap = NULL, .sv_hwcap = &cpu_features, .sv_hwcap2 = &cpu_features2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; struct sysentvec elf64_freebsd_sysvec_v2 = { @@ -135,6 +137,8 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_trap = NULL, .sv_hwcap = &cpu_features, .sv_hwcap2 = &cpu_features2, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; static boolean_t ppc64_elfv1_header_match(struct image_params *params, diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index 2a355a977800..8cb1355708d2 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -99,6 +99,8 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_trap = NULL, .sv_hwcap = &elf_hwcap, .sv_machine_arch = riscv_machine_arch, + .sv_onexec_old = exec_onexec_old, + .sv_onexit = exit_onexit, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 869c140c06f5..f0bb084d59dc 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -322,6 +322,9 @@ void exec_sysvec_init(void *param); void exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2); void exec_inittk(void); +void exit_onexit(struct proc *p); +void exec_onexec_old(struct thread *td); + #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ (sysinit_cfunc_t)exec_sysvec_init, sv); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:12:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 294E0654514; Wed, 7 Jul 2021 11:12: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 4GKcG85fqjz4g7Z; Wed, 7 Jul 2021 11:12: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 A3E3A44BD; Wed, 7 Jul 2021 11:12: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 167BCWhk045494; Wed, 7 Jul 2021 11:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BCWhd045493; Wed, 7 Jul 2021 11:12:32 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:12:32 GMT Message-Id: <202107071112.167BCWhd045493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 747a6b7ace3d - main - cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall 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/main X-Git-Reftype: branch X-Git-Commit: 747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:12:33 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc commit 747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc Author: Konstantin Belousov AuthorDate: 2021-07-01 22:30:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-07 11:12:14 +0000 cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall These ABIs do not use umtx at all, so there is nothing to clean. Cloudabi references to umtx keys do not require any cleanups anyway. Requested by: dchagin Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/compat/cloudabi/cloudabi_thread.c | 3 --- sys/compat/linux/linux_fork.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_thread.c b/sys/compat/cloudabi/cloudabi_thread.c index e70549b6e332..f920b8b41ee8 100644 --- a/sys/compat/cloudabi/cloudabi_thread.c +++ b/sys/compat/cloudabi/cloudabi_thread.c @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -45,8 +44,6 @@ cloudabi_sys_thread_exit(struct thread *td, .scope = uap->scope, }; - umtx_thread_exit(td); - /* Wake up joining thread. */ cloudabi_sys_lock_unlock(td, &cloudabi_sys_lock_unlock_args); diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index ed4adcf8a175..8230d5b4108b 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -376,8 +375,6 @@ linux_exit(struct thread *td, struct linux_exit_args *args) LINUX_CTR2(exit, "thread(%d) (%d)", em->em_tid, args->rval); - umtx_thread_exit(td); - linux_thread_detach(td); /* From owner-dev-commits-src-all@freebsd.org Wed Jul 7 11:22:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0CDC3654A0F; Wed, 7 Jul 2021 11:22: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 4GKcTr6yHTz4hM8; Wed, 7 Jul 2021 11:22: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 D74174900; Wed, 7 Jul 2021 11:22: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 167BMexV059362; Wed, 7 Jul 2021 11:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167BMe50059361; Wed, 7 Jul 2021 11:22:40 GMT (envelope-from git) Date: Wed, 7 Jul 2021 11:22:40 GMT Message-Id: <202107071122.167BMe50059361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: d7955cc0ffdf - main - tcp: HPTS performance enhancements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7955cc0ffdf9fb58013245a6f181c757574ea0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 11:22:41 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=d7955cc0ffdf9fb58013245a6f181c757574ea0a commit d7955cc0ffdf9fb58013245a6f181c757574ea0a Author: Randall Stewart AuthorDate: 2021-07-06 19:23:22 +0000 Commit: Randall Stewart CommitDate: 2021-07-07 11:22:35 +0000 tcp: HPTS performance enhancements HPTS drives both rack and bbr, and yet there have been many complaints about performance. This bit of work restructures hpts to help reduce CPU overhead. It does this by now instead of relying on the timer/callout to drive it instead use user return from a system call as well as lro flushes to drive hpts. The timer becomes a backstop that dynamically adjusts based on how "late" we are. Reviewed by: tuexen, glebius Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31083 --- sys/kern/subr_trap.c | 10 + sys/netinet/in_pcb.h | 4 +- sys/netinet/tcp_hpts.c | 1309 +++++++++++++++++++++++++---------------- sys/netinet/tcp_hpts.h | 99 +++- sys/netinet/tcp_lro.c | 28 +- sys/netinet/tcp_lro.h | 10 +- sys/netinet/tcp_stacks/bbr.c | 6 +- sys/netinet/tcp_stacks/rack.c | 22 +- 8 files changed, 931 insertions(+), 557 deletions(-) diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 8981091b50ed..d0f616d037c5 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -140,6 +140,16 @@ userret(struct thread *td, struct trapframe *frame) #ifdef HWPMC_HOOKS if (PMC_THREAD_HAS_SAMPLES(td)) PMC_CALL_HOOK(td, PMC_FN_THR_USERRET, NULL); +#endif +#ifdef TCPHPTS + /* + * @gallatin is adament that this needs to go here, I + * am not so sure. Running hpts is a lot like + * a lro_flush() that happens while a user process + * is running. But he may know best so I will go + * with his view of accounting. :-) + */ + tcp_run_hpts(); #endif /* * Let the scheduler adjust our priority etc. diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 923c5ba4edff..c20c516628b8 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -258,6 +258,7 @@ struct inpcb { volatile uint32_t inp_in_input; /* on input hpts (lock b) */ #endif volatile uint16_t inp_hpts_cpu; /* Lock (i) */ + volatile uint16_t inp_irq_cpu; /* Set by LRO in behalf of or the driver */ u_int inp_refcount; /* (i) refcount */ int inp_flags; /* (i) generic IP/datagram flags */ int inp_flags2; /* (i) generic IP/datagram flags #2*/ @@ -266,7 +267,8 @@ struct inpcb { inp_input_cpu_set : 1, /* on input hpts (i) */ inp_hpts_calls :1, /* (i) from output hpts */ inp_input_calls :1, /* (i) from input hpts */ - inp_spare_bits2 : 4; + inp_irq_cpu_set :1, /* (i) from LRO/Driver */ + inp_spare_bits2 : 3; uint8_t inp_numa_domain; /* numa domain */ void *inp_ppcb; /* (i) pointer to per-protocol pcb */ struct socket *inp_socket; /* (i) back pointer to socket */ diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index fd8b66b9ccdb..9a390e3a85c8 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -193,23 +193,29 @@ static int tcp_bind_threads = 1; #else static int tcp_bind_threads = 2; #endif -TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); - +static int tcp_use_irq_cpu = 0; static struct tcp_hptsi tcp_pace; +static uint32_t *cts_last_ran; static int hpts_does_tp_logging = 0; +static int hpts_use_assigned_cpu = 1; +static int32_t hpts_uses_oldest = OLDEST_THRESHOLD; -static void tcp_wakehpts(struct tcp_hpts_entry *p); -static void tcp_wakeinput(struct tcp_hpts_entry *p); static void tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv); -static void tcp_hptsi(struct tcp_hpts_entry *hpts); +static int32_t tcp_hptsi(struct tcp_hpts_entry *hpts, int from_callout); static void tcp_hpts_thread(void *ctx); static void tcp_init_hptsi(void *st); int32_t tcp_min_hptsi_time = DEFAULT_MIN_SLEEP; -static int32_t tcp_hpts_callout_skip_swi = 0; +static int conn_cnt_thresh = DEFAULT_CONNECTION_THESHOLD; +static int32_t dynamic_min_sleep = DYNAMIC_MIN_SLEEP; +static int32_t dynamic_max_sleep = DYNAMIC_MAX_SLEEP; + + SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hpts, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP Hpts controls"); +SYSCTL_NODE(_net_inet_tcp_hpts, OID_AUTO, stats, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "TCP Hpts statistics"); #define timersub(tvp, uvp, vvp) \ do { \ @@ -230,44 +236,92 @@ struct hpts_domain_info { struct hpts_domain_info hpts_domains[MAXMEMDOM]; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CTLFLAG_RW, - &tcp_hpts_precision, 120, - "Value for PRE() precision of callout"); - counter_u64_t hpts_hopelessly_behind; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, hopeless, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, hopeless, CTLFLAG_RD, &hpts_hopelessly_behind, "Number of times hpts could not catch up and was behind hopelessly"); counter_u64_t hpts_loops; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, loops, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, loops, CTLFLAG_RD, &hpts_loops, "Number of times hpts had to loop to catch up"); counter_u64_t back_tosleep; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, no_tcbsfound, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, no_tcbsfound, CTLFLAG_RD, &back_tosleep, "Number of times hpts found no tcbs"); counter_u64_t combined_wheel_wrap; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, &combined_wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); counter_u64_t wheel_wrap; -SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, wheel_wrap, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, wheel_wrap, CTLFLAG_RD, &wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); -static int32_t out_ts_percision = 0; +counter_u64_t hpts_direct_call; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, direct_call, CTLFLAG_RD, + &hpts_direct_call, "Number of times hpts was called by syscall/trap or other entry"); + +counter_u64_t hpts_wake_timeout; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, timeout_wakeup, CTLFLAG_RD, + &hpts_wake_timeout, "Number of times hpts threads woke up via the callout expiring"); + +counter_u64_t hpts_direct_awakening; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, direct_awakening, CTLFLAG_RD, + &hpts_direct_awakening, "Number of times hpts threads woke up via the callout expiring"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tspercision, CTLFLAG_RW, - &out_ts_percision, 0, - "Do we use a percise timestamp for every output cts"); +counter_u64_t hpts_back_tosleep; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, back_tosleep, CTLFLAG_RD, + &hpts_back_tosleep, "Number of times hpts threads woke up via the callout expiring and went back to sleep no work"); + +counter_u64_t cpu_uses_flowid; +counter_u64_t cpu_uses_random; + +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, cpusel_flowid, CTLFLAG_RD, + &cpu_uses_flowid, "Number of times when setting cpuid we used the flowid field"); +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, cpusel_random, CTLFLAG_RD, + &cpu_uses_random, "Number of times when setting cpuid we used the a random value"); + +TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); +TUNABLE_INT("net.inet.tcp.use_irq", &tcp_use_irq_cpu); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, bind_hptss, CTLFLAG_RD, + &tcp_bind_threads, 2, + "Thread Binding tunable"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_irq, CTLFLAG_RD, + &tcp_use_irq_cpu, 0, + "Use of irq CPU tunable"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CTLFLAG_RW, + &tcp_hpts_precision, 120, + "Value for PRE() precision of callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, cnt_thresh, CTLFLAG_RW, + &conn_cnt_thresh, 0, + "How many connections (below) make us use the callout based mechanism"); SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, &hpts_does_tp_logging, 0, "Do we add to any tp that has logging on pacer logs"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_assigned_cpu, CTLFLAG_RW, + &hpts_use_assigned_cpu, 0, + "Do we start any hpts timer on the assigned cpu?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, use_oldest, CTLFLAG_RW, + &hpts_uses_oldest, OLDEST_THRESHOLD, + "Do syscalls look for the hpts that has been the longest since running (or just use cpu no if 0)?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, dyn_minsleep, CTLFLAG_RW, + &dynamic_min_sleep, 250, + "What is the dynamic minsleep value?"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, dyn_maxsleep, CTLFLAG_RW, + &dynamic_max_sleep, 5000, + "What is the dynamic maxsleep value?"); + + + + static int32_t max_pacer_loops = 10; SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, loopmax, CTLFLAG_RW, @@ -287,7 +341,7 @@ sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) new = hpts_sleep_max; error = sysctl_handle_int(oidp, &new, 0, req); if (error == 0 && req->newptr) { - if ((new < (NUM_OF_HPTSI_SLOTS / 4)) || + if ((new < dynamic_min_sleep) || (new > HPTS_MAX_SLEEP_ALLOWED)) error = EINVAL; else @@ -296,26 +350,60 @@ sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) return (error); } +static int +sysctl_net_inet_tcp_hpts_min_sleep(SYSCTL_HANDLER_ARGS) +{ + int error; + uint32_t new; + + new = tcp_min_hptsi_time; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if (new < LOWEST_SLEEP_ALLOWED) + error = EINVAL; + else + tcp_min_hptsi_time = new; + } + return (error); +} + SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, maxsleep, CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &hpts_sleep_max, 0, &sysctl_net_inet_tcp_hpts_max_sleep, "IU", "Maximum time hpts will sleep"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, minsleep, CTLFLAG_RW, +SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, minsleep, + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, &tcp_min_hptsi_time, 0, + &sysctl_net_inet_tcp_hpts_min_sleep, "IU", "The minimum time the hpts must sleep before processing more slots"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, skip_swi, CTLFLAG_RW, - &tcp_hpts_callout_skip_swi, 0, - "Do we have the callout call directly to the hpts?"); +static int ticks_indicate_more_sleep = TICKS_INDICATE_MORE_SLEEP; +static int ticks_indicate_less_sleep = TICKS_INDICATE_LESS_SLEEP; +static int tcp_hpts_no_wake_over_thresh = 1; + +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, more_sleep, CTLFLAG_RW, + &ticks_indicate_more_sleep, 0, + "If we only process this many or less on a timeout, we need longer sleep on the next callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, less_sleep, CTLFLAG_RW, + &ticks_indicate_less_sleep, 0, + "If we process this many or more on a timeout, we need less sleep on the next callout"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, nowake_over_thresh, CTLFLAG_RW, + &tcp_hpts_no_wake_over_thresh, 0, + "When we are over the threshold on the pacer do we prohibit wakeups?"); static void tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, - int ticks_to_run, int idx) + int slots_to_run, int idx, int from_callout) { union tcp_log_stackspecific log; - + /* + * Unused logs are + * 64 bit - delRate, rttProp, bw_inuse + * 16 bit - cwnd_gain + * 8 bit - bbr_state, bbr_substate, inhpts, ininput; + */ memset(&log.u_bbr, 0, sizeof(log.u_bbr)); log.u_bbr.flex1 = hpts->p_nxt_slot; log.u_bbr.flex2 = hpts->p_cur_slot; @@ -323,8 +411,9 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, log.u_bbr.flex4 = idx; log.u_bbr.flex5 = hpts->p_curtick; log.u_bbr.flex6 = hpts->p_on_queue_cnt; - log.u_bbr.use_lt_bw = 1; - log.u_bbr.inflight = ticks_to_run; + log.u_bbr.flex7 = hpts->p_cpu; + log.u_bbr.flex8 = (uint8_t)from_callout; + log.u_bbr.inflight = slots_to_run; log.u_bbr.applimited = hpts->overidden_sleep; log.u_bbr.delivered = hpts->saved_curtick; log.u_bbr.timeStamp = tcp_tv_to_usectick(tv); @@ -332,7 +421,9 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, log.u_bbr.lt_epoch = hpts->saved_prev_slot; log.u_bbr.pkts_out = hpts->p_delayed_by; log.u_bbr.lost = hpts->p_hpts_sleep_time; - log.u_bbr.cur_del_rate = hpts->p_runningtick; + log.u_bbr.pacing_gain = hpts->p_cpu; + log.u_bbr.pkt_epoch = hpts->p_runningslot; + log.u_bbr.use_lt_bw = 1; TCP_LOG_EVENTP(tp, NULL, &tp->t_inpcb->inp_socket->so_rcv, &tp->t_inpcb->inp_socket->so_snd, @@ -341,47 +432,40 @@ tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, } static void -hpts_timeout_swi(void *arg) +tcp_wakehpts(struct tcp_hpts_entry *hpts) { - struct tcp_hpts_entry *hpts; + HPTS_MTX_ASSERT(hpts); - hpts = (struct tcp_hpts_entry *)arg; - swi_sched(hpts->ie_cookie, 0); + if (tcp_hpts_no_wake_over_thresh && (hpts->p_on_queue_cnt >= conn_cnt_thresh)) { + hpts->p_direct_wake = 0; + return; + } + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); + } } static void -hpts_timeout_dir(void *arg) +hpts_timeout_swi(void *arg) { - tcp_hpts_thread(arg); + struct tcp_hpts_entry *hpts; + + hpts = (struct tcp_hpts_entry *)arg; + swi_sched(hpts->ie_cookie, 0); } static inline void hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hptsh *head, int clear) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_hpts_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_hpts == 0) { - /* We are not on the hpts? */ - panic("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_hpts != 0, ("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp)); TAILQ_REMOVE(head, inp, inp_hpts); hpts->p_on_queue_cnt--; - if (hpts->p_on_queue_cnt < 0) { - /* Count should not go negative .. */ -#ifdef INVARIANTS - panic("Hpts goes negative inp:%p hpts:%p", - inp, hpts); -#endif - hpts->p_on_queue_cnt = 0; - } + KASSERT(hpts->p_on_queue_cnt >= 0, + ("Hpts goes negative inp:%p hpts:%p", + inp, hpts)); if (clear) { inp->inp_hpts_request = 0; inp->inp_in_hpts = 0; @@ -391,20 +475,13 @@ hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hpt static inline void hpts_sane_pace_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hptsh *head, int line, int noref) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_hpts_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if ((noref == 0) && (inp->inp_in_hpts == 1)) { - /* We are already on the hpts? */ - panic("%s: hpts:%p inp:%p already on the hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(((noref == 1) && (inp->inp_in_hpts == 1)) || + ((noref == 0) && (inp->inp_in_hpts == 0)), + ("%s: hpts:%p inp:%p already on the hpts?", + __FUNCTION__, hpts, inp)); TAILQ_INSERT_TAIL(head, inp, inp_hpts); inp->inp_in_hpts = 1; hpts->p_on_queue_cnt++; @@ -416,37 +493,20 @@ hpts_sane_pace_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, struct hpt static inline void hpts_sane_input_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, int clear) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_input_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_input == 0) { - /* We are not on the input hpts? */ - panic("%s: hpts:%p inp:%p not on the input hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_input != 0, + ("%s: hpts:%p inp:%p not on the input hpts?", __FUNCTION__, hpts, inp)); TAILQ_REMOVE(&hpts->p_input, inp, inp_input); hpts->p_on_inqueue_cnt--; - if (hpts->p_on_inqueue_cnt < 0) { -#ifdef INVARIANTS - panic("Hpts in goes negative inp:%p hpts:%p", - inp, hpts); -#endif - hpts->p_on_inqueue_cnt = 0; - } -#ifdef INVARIANTS - if (TAILQ_EMPTY(&hpts->p_input) && - (hpts->p_on_inqueue_cnt != 0)) { - /* We should not be empty with a queue count */ - panic("%s hpts:%p in_hpts input empty but cnt:%d", - __FUNCTION__, hpts, hpts->p_on_inqueue_cnt); - } -#endif + KASSERT(hpts->p_on_inqueue_cnt >= 0, + ("Hpts in goes negative inp:%p hpts:%p", + inp, hpts)); + KASSERT((((TAILQ_EMPTY(&hpts->p_input) != 0) && (hpts->p_on_inqueue_cnt == 0)) || + ((TAILQ_EMPTY(&hpts->p_input) == 0) && (hpts->p_on_inqueue_cnt > 0))), + ("%s hpts:%p input cnt (p_on_inqueue):%d and queue state mismatch", + __FUNCTION__, hpts, hpts->p_on_inqueue_cnt)); if (clear) inp->inp_in_input = 0; } @@ -454,46 +514,17 @@ hpts_sane_input_remove(struct tcp_hpts_entry *hpts, struct inpcb *inp, int clear static inline void hpts_sane_input_insert(struct tcp_hpts_entry *hpts, struct inpcb *inp, int line) { -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx) == 0) { - /* We don't own the mutex? */ - panic("%s: hpts:%p inp:%p no hpts mutex", __FUNCTION__, hpts, inp); - } - if (hpts->p_cpu != inp->inp_input_cpu) { - /* It is not the right cpu/mutex? */ - panic("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp); - } - if (inp->inp_in_input == 1) { - /* We are already on the input hpts? */ - panic("%s: hpts:%p inp:%p already on the input hpts?", __FUNCTION__, hpts, inp); - } -#endif + HPTS_MTX_ASSERT(hpts); + KASSERT(hpts->p_cpu == inp->inp_hpts_cpu, + ("%s: hpts:%p inp:%p incorrect CPU", __FUNCTION__, hpts, inp)); + KASSERT(inp->inp_in_input == 0, + ("%s: hpts:%p inp:%p already on the input hpts?", __FUNCTION__, hpts, inp)); TAILQ_INSERT_TAIL(&hpts->p_input, inp, inp_input); inp->inp_in_input = 1; hpts->p_on_inqueue_cnt++; in_pcbref(inp); } -static void -tcp_wakehpts(struct tcp_hpts_entry *hpts) -{ - HPTS_MTX_ASSERT(hpts); - if (hpts->p_hpts_wake_scheduled == 0) { - hpts->p_hpts_wake_scheduled = 1; - swi_sched(hpts->ie_cookie, 0); - } -} - -static void -tcp_wakeinput(struct tcp_hpts_entry *hpts) -{ - HPTS_MTX_ASSERT(hpts); - if (hpts->p_hpts_wake_scheduled == 0) { - hpts->p_hpts_wake_scheduled = 1; - swi_sched(hpts->ie_cookie, 0); - } -} - struct tcp_hpts_entry * tcp_cur_hpts(struct inpcb *inp) { @@ -514,12 +545,9 @@ tcp_hpts_lock(struct inpcb *inp) again: hpts_num = inp->inp_hpts_cpu; hpts = tcp_pace.rp_ent[hpts_num]; -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx)) { - panic("Hpts:%p owns mtx prior-to lock line:%d", - hpts, __LINE__); - } -#endif + KASSERT(mtx_owned(&hpts->p_mtx) == 0, + ("Hpts:%p owns mtx prior-to lock line:%d", + hpts, __LINE__)); mtx_lock(&hpts->p_mtx); if (hpts_num != inp->inp_hpts_cpu) { mtx_unlock(&hpts->p_mtx); @@ -537,12 +565,9 @@ tcp_input_lock(struct inpcb *inp) again: hpts_num = inp->inp_input_cpu; hpts = tcp_pace.rp_ent[hpts_num]; -#ifdef INVARIANTS - if (mtx_owned(&hpts->p_mtx)) { - panic("Hpts:%p owns mtx prior-to lock line:%d", - hpts, __LINE__); - } -#endif + KASSERT(mtx_owned(&hpts->p_mtx) == 0, + ("Hpts:%p owns mtx prior-to lock line:%d", + hpts, __LINE__)); mtx_lock(&hpts->p_mtx); if (hpts_num != inp->inp_input_cpu) { mtx_unlock(&hpts->p_mtx); @@ -555,6 +580,7 @@ static void tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) { int32_t add_freed; + int32_t ret; if (inp->inp_flags2 & INP_FREED) { /* @@ -567,26 +593,11 @@ tcp_remove_hpts_ref(struct inpcb *inp, struct tcp_hpts_entry *hpts, int line) add_freed = 0; } #ifndef INP_REF_DEBUG - if (in_pcbrele_wlocked(inp)) { - /* - * This should not happen. We have the inpcb referred to by - * the main socket (why we are called) and the hpts. It - * should always return 0. - */ - panic("inpcb:%p release ret 1", - inp); - } + ret = in_pcbrele_wlocked(inp); #else - if (__in_pcbrele_wlocked(inp, line)) { - /* - * This should not happen. We have the inpcb referred to by - * the main socket (why we are called) and the hpts. It - * should always return 0. - */ - panic("inpcb:%p release ret 1", - inp); - } + ret = __in_pcbrele_wlocked(inp, line); #endif + KASSERT(ret != 1, ("inpcb:%p release ret 1", inp)); if (add_freed) { inp->inp_flags2 |= INP_FREED; } @@ -642,73 +653,76 @@ __tcp_hpts_remove(struct inpcb *inp, int32_t flags, int32_t line) } static inline int -hpts_tick(uint32_t wheel_tick, uint32_t plus) +hpts_slot(uint32_t wheel_slot, uint32_t plus) { /* * Given a slot on the wheel, what slot * is that plus ticks out? */ - KASSERT(wheel_tick < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_tick)); - return ((wheel_tick + plus) % NUM_OF_HPTSI_SLOTS); + KASSERT(wheel_slot < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_slot)); + return ((wheel_slot + plus) % NUM_OF_HPTSI_SLOTS); } static inline int tick_to_wheel(uint32_t cts_in_wticks) { /* - * Given a timestamp in wheel ticks (10usec inc's) - * map it to our limited space wheel. + * Given a timestamp in ticks (so by + * default to get it to a real time one + * would multiply by 10.. i.e the number + * of ticks in a slot) map it to our limited + * space wheel. */ return (cts_in_wticks % NUM_OF_HPTSI_SLOTS); } static inline int -hpts_ticks_diff(int prev_tick, int tick_now) +hpts_slots_diff(int prev_slot, int slot_now) { /* - * Given two ticks that are someplace + * Given two slots that are someplace * on our wheel. How far are they apart? */ - if (tick_now > prev_tick) - return (tick_now - prev_tick); - else if (tick_now == prev_tick) + if (slot_now > prev_slot) + return (slot_now - prev_slot); + else if (slot_now == prev_slot) /* * Special case, same means we can go all of our * wheel less one slot. */ return (NUM_OF_HPTSI_SLOTS - 1); else - return ((NUM_OF_HPTSI_SLOTS - prev_tick) + tick_now); + return ((NUM_OF_HPTSI_SLOTS - prev_slot) + slot_now); } /* - * Given a tick on the wheel that is the current time - * mapped to the wheel (wheel_tick), what is the maximum + * Given a slot on the wheel that is the current time + * mapped to the wheel (wheel_slot), what is the maximum * distance forward that can be obtained without - * wrapping past either prev_tick or running_tick + * wrapping past either prev_slot or running_slot * depending on the htps state? Also if passed - * a uint32_t *, fill it with the tick location. + * a uint32_t *, fill it with the slot location. * * Note if you do not give this function the current - * time (that you think it is) mapped to the wheel + * time (that you think it is) mapped to the wheel slot * then the results will not be what you expect and * could lead to invalid inserts. */ static inline int32_t -max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t *target_tick) +max_slots_available(struct tcp_hpts_entry *hpts, uint32_t wheel_slot, uint32_t *target_slot) { - uint32_t dis_to_travel, end_tick, pacer_to_now, avail_on_wheel; + uint32_t dis_to_travel, end_slot, pacer_to_now, avail_on_wheel; if ((hpts->p_hpts_active == 1) && (hpts->p_wheel_complete == 0)) { - end_tick = hpts->p_runningtick; + end_slot = hpts->p_runningslot; /* Back up one tick */ - if (end_tick == 0) - end_tick = NUM_OF_HPTSI_SLOTS - 1; + if (end_slot == 0) + end_slot = NUM_OF_HPTSI_SLOTS - 1; else - end_tick--; - if (target_tick) - *target_tick = end_tick; + end_slot--; + if (target_slot) + *target_slot = end_slot; } else { /* * For the case where we are @@ -718,26 +732,26 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * * prev tick and subtract one from it. This puts us * as far out as possible on the wheel. */ - end_tick = hpts->p_prev_slot; - if (end_tick == 0) - end_tick = NUM_OF_HPTSI_SLOTS - 1; + end_slot = hpts->p_prev_slot; + if (end_slot == 0) + end_slot = NUM_OF_HPTSI_SLOTS - 1; else - end_tick--; - if (target_tick) - *target_tick = end_tick; + end_slot--; + if (target_slot) + *target_slot = end_slot; /* * Now we have close to the full wheel left minus the * time it has been since the pacer went to sleep. Note * that wheel_tick, passed in, should be the current time * from the perspective of the caller, mapped to the wheel. */ - if (hpts->p_prev_slot != wheel_tick) - dis_to_travel = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + if (hpts->p_prev_slot != wheel_slot) + dis_to_travel = hpts_slots_diff(hpts->p_prev_slot, wheel_slot); else dis_to_travel = 1; /* * dis_to_travel in this case is the space from when the - * pacer stopped (p_prev_slot) and where our wheel_tick + * pacer stopped (p_prev_slot) and where our wheel_slot * is now. To know how many slots we can put it in we * subtract from the wheel size. We would not want * to place something after p_prev_slot or it will @@ -746,21 +760,21 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * return (NUM_OF_HPTSI_SLOTS - dis_to_travel); } /* - * So how many slots are open between p_runningtick -> p_cur_slot + * So how many slots are open between p_runningslot -> p_cur_slot * that is what is currently un-available for insertion. Special * case when we are at the last slot, this gets 1, so that * the answer to how many slots are available is all but 1. */ - if (hpts->p_runningtick == hpts->p_cur_slot) + if (hpts->p_runningslot == hpts->p_cur_slot) dis_to_travel = 1; else - dis_to_travel = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + dis_to_travel = hpts_slots_diff(hpts->p_runningslot, hpts->p_cur_slot); /* * How long has the pacer been running? */ - if (hpts->p_cur_slot != wheel_tick) { + if (hpts->p_cur_slot != wheel_slot) { /* The pacer is a bit late */ - pacer_to_now = hpts_ticks_diff(hpts->p_cur_slot, wheel_tick); + pacer_to_now = hpts_slots_diff(hpts->p_cur_slot, wheel_slot); } else { /* The pacer is right on time, now == pacers start time */ pacer_to_now = 0; @@ -774,24 +788,24 @@ max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t * /* * Now how many of those we will eat due to the pacer's * time (p_cur_slot) of start being behind the - * real time (wheel_tick)? + * real time (wheel_slot)? */ if (avail_on_wheel <= pacer_to_now) { /* * Wheel wrap, we can't fit on the wheel, that * is unusual the system must be way overloaded! - * Insert into the assured tick, and return special + * Insert into the assured slot, and return special * "0". */ counter_u64_add(combined_wheel_wrap, 1); - *target_tick = hpts->p_nxt_slot; + *target_slot = hpts->p_nxt_slot; return (0); } else { /* * We know how many slots are open * on the wheel (the reverse of what * is left to run. Take away the time - * the pacer started to now (wheel_tick) + * the pacer started to now (wheel_slot) * and that tells you how many slots are * open that can be inserted into that won't * be touched by the pacer until later. @@ -815,7 +829,7 @@ tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpt * A sleeping hpts we want in next slot to run * note that in this state p_prev_slot == p_cur_slot */ - inp->inp_hptsslot = hpts_tick(hpts->p_prev_slot, 1); + inp->inp_hptsslot = hpts_slot(hpts->p_prev_slot, 1); if ((hpts->p_on_min_sleep == 0) && (hpts->p_hpts_active == 0)) need_wake = 1; } else if ((void *)inp == hpts->p_inp) { @@ -827,7 +841,7 @@ tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpt */ inp->inp_hptsslot = hpts->p_nxt_slot; } else - inp->inp_hptsslot = hpts->p_runningtick; + inp->inp_hptsslot = hpts->p_runningslot; hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); if (need_wake) { /* @@ -862,9 +876,9 @@ check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uin * Sanity checks for the pacer with invariants * on insert. */ - if (inp_hptsslot >= NUM_OF_HPTSI_SLOTS) - panic("hpts:%p inp:%p slot:%d > max", - hpts, inp, inp_hptsslot); + KASSERT(inp_hptsslot < NUM_OF_HPTSI_SLOTS, + ("hpts:%p inp:%p slot:%d > max", + hpts, inp, inp_hptsslot)); if ((hpts->p_hpts_active) && (hpts->p_wheel_complete == 0)) { /* @@ -875,17 +889,16 @@ check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uin */ int distance, yet_to_run; - distance = hpts_ticks_diff(hpts->p_runningtick, inp_hptsslot); - if (hpts->p_runningtick != hpts->p_cur_slot) - yet_to_run = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + distance = hpts_slots_diff(hpts->p_runningslot, inp_hptsslot); + if (hpts->p_runningslot != hpts->p_cur_slot) + yet_to_run = hpts_slots_diff(hpts->p_runningslot, hpts->p_cur_slot); else yet_to_run = 0; /* processing last slot */ - if (yet_to_run > distance) { - panic("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", - hpts, inp, inp_hptsslot, - distance, yet_to_run, - hpts->p_runningtick, hpts->p_cur_slot); - } + KASSERT(yet_to_run <= distance, + ("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", + hpts, inp, inp_hptsslot, + distance, yet_to_run, + hpts->p_runningslot, hpts->p_cur_slot)); } } #endif @@ -895,8 +908,9 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t struct hpts_diag *diag, struct timeval *tv) { uint32_t need_new_to = 0; - uint32_t wheel_cts, last_tick; - int32_t wheel_tick, maxticks; + uint32_t wheel_cts; + int32_t wheel_slot, maxslots, last_slot; + int cpu; int8_t need_wakeup = 0; HPTS_MTX_ASSERT(hpts); @@ -904,7 +918,7 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t memset(diag, 0, sizeof(struct hpts_diag)); diag->p_hpts_active = hpts->p_hpts_active; diag->p_prev_slot = hpts->p_prev_slot; - diag->p_runningtick = hpts->p_runningtick; + diag->p_runningslot = hpts->p_runningslot; diag->p_nxt_slot = hpts->p_nxt_slot; diag->p_cur_slot = hpts->p_cur_slot; diag->p_curtick = hpts->p_curtick; @@ -913,131 +927,120 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t diag->p_on_min_sleep = hpts->p_on_min_sleep; diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if (inp->inp_in_hpts == 0) { - if (slot == 0) { - /* Immediate */ - tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); - return; - } - /* Get the current time relative to the wheel */ - wheel_cts = tcp_tv_to_hptstick(tv); - /* Map it onto the wheel */ - wheel_tick = tick_to_wheel(wheel_cts); - /* Now what's the max we can place it at? */ - maxticks = max_ticks_available(hpts, wheel_tick, &last_tick); - if (diag) { - diag->wheel_tick = wheel_tick; - diag->maxticks = maxticks; - diag->wheel_cts = wheel_cts; + KASSERT(inp->inp_in_hpts == 0, ("Hpts:%p tp:%p already on hpts and add?", hpts, inp)); + if (slot == 0) { + /* Immediate */ + tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); + return; + } + /* Get the current time relative to the wheel */ + wheel_cts = tcp_tv_to_hptstick(tv); + /* Map it onto the wheel */ + wheel_slot = tick_to_wheel(wheel_cts); + /* Now what's the max we can place it at? */ + maxslots = max_slots_available(hpts, wheel_slot, &last_slot); + if (diag) { + diag->wheel_slot = wheel_slot; + diag->maxslots = maxslots; + diag->wheel_cts = wheel_cts; + } + if (maxslots == 0) { + /* The pacer is in a wheel wrap behind, yikes! */ + if (slot > 1) { + /* + * Reduce by 1 to prevent a forever loop in + * case something else is wrong. Note this + * probably does not hurt because the pacer + * if its true is so far behind we will be + * > 1second late calling anyway. + */ + slot--; } - if (maxticks == 0) { - /* The pacer is in a wheel wrap behind, yikes! */ - if (slot > 1) { - /* - * Reduce by 1 to prevent a forever loop in - * case something else is wrong. Note this - * probably does not hurt because the pacer - * if its true is so far behind we will be - * > 1second late calling anyway. - */ - slot--; - } - inp->inp_hptsslot = last_tick; - inp->inp_hpts_request = slot; - } else if (maxticks >= slot) { - /* It all fits on the wheel */ - inp->inp_hpts_request = 0; - inp->inp_hptsslot = hpts_tick(wheel_tick, slot); - } else { - /* It does not fit */ - inp->inp_hpts_request = slot - maxticks; - inp->inp_hptsslot = last_tick; + inp->inp_hptsslot = last_slot; + inp->inp_hpts_request = slot; + } else if (maxslots >= slot) { + /* It all fits on the wheel */ + inp->inp_hpts_request = 0; + inp->inp_hptsslot = hpts_slot(wheel_slot, slot); + } else { + /* It does not fit */ + inp->inp_hpts_request = slot - maxslots; + inp->inp_hptsslot = last_slot; + } + if (diag) { + diag->slot_remaining = inp->inp_hpts_request; + diag->inp_hptsslot = inp->inp_hptsslot; + } +#ifdef INVARIANTS + check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); +#endif + hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); + if ((hpts->p_hpts_active == 0) && + (inp->inp_hpts_request == 0) && + (hpts->p_on_min_sleep == 0)) { + /* + * The hpts is sleeping and NOT on a minimum + * sleep time, we need to figure out where + * it will wake up at and if we need to reschedule + * its time-out. + */ + uint32_t have_slept, yet_to_sleep; + + /* Now do we need to restart the hpts's timer? */ + have_slept = hpts_slots_diff(hpts->p_prev_slot, wheel_slot); + if (have_slept < hpts->p_hpts_sleep_time) + yet_to_sleep = hpts->p_hpts_sleep_time - have_slept; + else { + /* We are over-due */ + yet_to_sleep = 0; + need_wakeup = 1; } if (diag) { - diag->slot_remaining = inp->inp_hpts_request; - diag->inp_hptsslot = inp->inp_hptsslot; + diag->have_slept = have_slept; + diag->yet_to_sleep = yet_to_sleep; } -#ifdef INVARIANTS - check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); -#endif - hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); - if ((hpts->p_hpts_active == 0) && - (inp->inp_hpts_request == 0) && - (hpts->p_on_min_sleep == 0)) { + if (yet_to_sleep && + (yet_to_sleep > slot)) { /* *** 1483 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Jul 7 13:18:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9C36D655976; Wed, 7 Jul 2021 13:18: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 4GKg3M3rq2z3Cmt; Wed, 7 Jul 2021 13:18: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 6C3EB5B6D; Wed, 7 Jul 2021 13:18: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 167DINI8007801; Wed, 7 Jul 2021 13:18:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167DINdW007800; Wed, 7 Jul 2021 13:18:23 GMT (envelope-from git) Date: Wed, 7 Jul 2021 13:18:23 GMT Message-Id: <202107071318.167DINdW007800@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: 9e06b34bb5d3 - stable/13 - Add deprecation notice for WITH_PROFILE option 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/13 X-Git-Reftype: branch X-Git-Commit: 9e06b34bb5d3544915ebea1a3f343f915004bbe1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 13:18:23 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9e06b34bb5d3544915ebea1a3f343f915004bbe1 commit 9e06b34bb5d3544915ebea1a3f343f915004bbe1 Author: Ed Maste AuthorDate: 2021-06-27 17:21:26 +0000 Commit: Ed Maste CommitDate: 2021-07-07 13:17:06 +0000 Add deprecation notice for WITH_PROFILE option As discussed on freebsd-current [1] and freebsd-arch [2] and review D30833, FreeBSD 14 will ship without the _p.a libraries built with -pg. Both upstream and base system (in commit b762974cf4b9) Clang have been modified to remove the special case for linking against these libraries. Clang's -pg support and mcount() remain, so building with -pg can still be used on code that the user builds; we just do not provide prebuilt libraries compiled with -pg. A similar change is still needed for GCC. [1] https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html [2] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 175841285e289edebb6603da39f02549521ce950) Clarify notice for profiled libraries in FreeBSD 14 Reported by: kevans Fixes: 175841285e28 ("Add deprecation notice for...") Sponsored by: The FreeBSD Foundation (cherry picked from commit f94360971e649fa684ef3b7e72839b59c7242bdb) --- share/man/man5/src.conf.5 | 2 ++ tools/build/options/WITH_PROFILE | 2 ++ 2 files changed, 4 insertions(+) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index dad8d465e3fd..4f44bda093ce 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1374,6 +1374,8 @@ mips/mips64. .It Va WITH_PROFILE Set to build profiled libraries for use with .Xr gprof 8 . +This option is deprecated and is not present in +.Fx 14 . .Pp This is a default setting on amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. diff --git a/tools/build/options/WITH_PROFILE b/tools/build/options/WITH_PROFILE index b8880d9459cc..347a3db000d1 100644 --- a/tools/build/options/WITH_PROFILE +++ b/tools/build/options/WITH_PROFILE @@ -1,3 +1,5 @@ .\" $FreeBSD$ Set to build profiled libraries for use with .Xr gprof 8 . +This option is deprecated and is not present in +.Fx 14 . From owner-dev-commits-src-all@freebsd.org Wed Jul 7 13:19:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2439C656304; Wed, 7 Jul 2021 13:19: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 4GKg4n0ZNTz3DHF; Wed, 7 Jul 2021 13:19: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 E62265AC6; Wed, 7 Jul 2021 13:19: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 167DJaip008016; Wed, 7 Jul 2021 13:19:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167DJaRV008015; Wed, 7 Jul 2021 13:19:36 GMT (envelope-from git) Date: Wed, 7 Jul 2021 13:19:36 GMT Message-Id: <202107071319.167DJaRV008015@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: c3e6df3967f9 - stable/12 - Add deprecation notice for WITH_PROFILE option 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: c3e6df3967f9a64322ad493e0ecd7e8cffba018f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 13:19:37 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c3e6df3967f9a64322ad493e0ecd7e8cffba018f commit c3e6df3967f9a64322ad493e0ecd7e8cffba018f Author: Ed Maste AuthorDate: 2021-06-27 17:21:26 +0000 Commit: Ed Maste CommitDate: 2021-07-07 13:19:00 +0000 Add deprecation notice for WITH_PROFILE option As discussed on freebsd-current [1] and freebsd-arch [2] and review D30833, FreeBSD 14 will ship without the _p.a libraries built with -pg. Both upstream and base system (in commit b762974cf4b9) Clang have been modified to remove the special case for linking against these libraries. Clang's -pg support and mcount() remain, so building with -pg can still be used on code that the user builds; we just do not provide prebuilt libraries compiled with -pg. A similar change is still needed for GCC. [1] https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html [2] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 175841285e289edebb6603da39f02549521ce950) Clarify notice for profiled libraries in FreeBSD 14 Reported by: kevans Fixes: 175841285e28 ("Add deprecation notice for...") Sponsored by: The FreeBSD Foundation (cherry picked from commit f94360971e649fa684ef3b7e72839b59c7242bdb) --- share/man/man5/src.conf.5 | 4 +++- tools/build/options/WITH_PROFILE | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 0e36281c78df..606e61a4e9c4 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 December 29, 2020 +.Dd June 28, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1660,6 +1660,8 @@ mips/mips64el, mips/mips64, mips/mips64elhf and mips/mips64hf. .It Va WITH_PROFILE Set to build profiled libraries for use with .Xr gprof 8 . +This option is deprecated and is not present in +.Fx 14 . .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. diff --git a/tools/build/options/WITH_PROFILE b/tools/build/options/WITH_PROFILE index b8880d9459cc..347a3db000d1 100644 --- a/tools/build/options/WITH_PROFILE +++ b/tools/build/options/WITH_PROFILE @@ -1,3 +1,5 @@ .\" $FreeBSD$ Set to build profiled libraries for use with .Xr gprof 8 . +This option is deprecated and is not present in +.Fx 14 . From owner-dev-commits-src-all@freebsd.org Wed Jul 7 14:40:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 507A6657D80; Wed, 7 Jul 2021 14:40: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 4GKhsn1ZK5z3MFy; Wed, 7 Jul 2021 14:40: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 1AF0F6D54; Wed, 7 Jul 2021 14:40: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 167EeCXE020123; Wed, 7 Jul 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 167EeCSk020117; Wed, 7 Jul 2021 14:40:12 GMT (envelope-from git) Date: Wed, 7 Jul 2021 14:40:12 GMT Message-Id: <202107071440.167EeCSk020117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 4150a5a87ed6 - main - ktls: fix NOINET build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4150a5a87ed6757cb6fd0118b4058eef77f735f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 14:40:13 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=4150a5a87ed6757cb6fd0118b4058eef77f735f7 commit 4150a5a87ed6757cb6fd0118b4058eef77f735f7 Author: Andrew Gallatin AuthorDate: 2021-07-07 14:38:57 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-07 14:40:02 +0000 ktls: fix NOINET build Reported by: mjguzik Sponsored by: Netflix --- sys/kern/uipc_ktls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 88e29157289d..5f7dde325740 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2202,6 +2202,7 @@ ktls_work_thread(void *ctx) } } +#if defined(INET) || defined(INET6) static void ktls_disable_ifnet_help(void *context, int pending __unused) { @@ -2294,3 +2295,4 @@ ktls_disable_ifnet(void *arg) TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); } +#endif From owner-dev-commits-src-all@freebsd.org Wed Jul 7 14:49:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B60BE657D6C; Wed, 7 Jul 2021 14:49:20 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GKj4J4JWtz3NDG; Wed, 7 Jul 2021 14:49:20 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [192.168.1.2] (pool-74-110-137-7.rcmdva.fios.verizon.net [74.110.137.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gallatin) by duke.cs.duke.edu (Postfix) with ESMTPSA id 14E23270016A; Wed, 7 Jul 2021 10:49:19 -0400 (EDT) DMARC-Filter: OpenDMARC Filter v1.3.1 duke.cs.duke.edu 14E23270016A DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail0816; t=1625669359; bh=Uo4D0KOkTInGOdbeR4wRsr/W9Lh5CdsrTJR6F87/vBc=; h=Subject:To:From:Date:From; b=YPtvb9X2YWSSrI4TGqBdrMVkAlB7d/2twkbd5X0nOtvPRsgRLbGt1VhAVcRkkQOE5 eOVgXTpLaKtFDRjdTgh9fsgDxvoC2PK9DdgwWiq+WslhWKYXmqTE/Z10RLrI/qv92D gfAzQulCd3aJM8+VIRmNcYP7npF/bqJPizN9M5y3F4H7lU/qiSnkRiMvs4Pb362d5l CM6+Mr6FmpOR4eruGJ3GWOVgHgGgYUx+KDGhk2j4db1TZEhG7xcpCgqMk/27vuodxM yOowTtlnbnf+GG9b9DYofkI6s7Jm/7j8FbY74mJB5kLZucKmZC062FVtm4Z0smxuRg OsOgjaJO8hDAg== Subject: Re: git: 28d0a740dd9a - main - ktls: auto-disable ifnet (inline hw) kTLS To: Mateusz Guzik , Andrew Gallatin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202107061429.166ETTEn064437@gitrepo.freebsd.org> From: Andrew Gallatin Message-ID: <8285ccb3-87d8-fe84-de27-0fd06409df70@cs.duke.edu> Date: Wed, 7 Jul 2021 10:49:18 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 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: 4GKj4J4JWtz3NDG 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 14:49:20 -0000 On 7/7/21 7:00 AM, Mateusz Guzik wrote: > This breaks NOIP kernel builds. Thanks for pointing this out, it should be fixed in 4150a5a87ed > On 7/6/21, Andrew Gallatin wrote: >> The branch main has been updated by gallatin: >> >> URL: >> https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=28d0a740dd9a67e4a4fa9fda5bb39b5963316f35__;!!OToaGQ!_d4pkzhNaWowgMsR4-c1qtLXr1H9SC_kBWNDvXvVV15lerMV4elltm-V6OZj3iET-A$ >> >> commit 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 >> Author: Andrew Gallatin >> AuthorDate: 2021-07-06 14:17:33 +0000 >> Commit: Andrew Gallatin >> CommitDate: 2021-07-06 14:28:32 +0000 >> >> ktls: auto-disable ifnet (inline hw) kTLS >> >> Ifnet (inline) hw kTLS NICs typically keep state within >> a TLS record, so that when transmitting in-order, >> they can continue encryption on each segment sent without >> DMA'ing extra state from the host. >> >> This breaks down when transmits are out of order (eg, >> TCP retransmits). In this case, the NIC must re-DMA >> the entire TLS record up to and including the segment >> being retransmitted. This means that when re-transmitting >> the last 1448 byte segment of a TLS record, the NIC will >> have to re-DMA the entire 16KB TLS record. This can lead >> to the NIC running out of PCIe bus bandwidth well before >> it saturates the network link if a lot of TCP connections have >> a high retransmoit rate. >> >> This change introduces a new sysctl >> (kern.ipc.tls.ifnet_max_rexmit_pct), >> where TCP connections with higher retransmit rate will be >> switched to SW kTLS so as to conserve PCIe bandwidth. >> >> Reviewed by: hselasky, markj, rrs >> Sponsored by: Netflix >> Differential Revision: https://urldefense.com/v3/__https://reviews.freebsd.org/D30908__;!!OToaGQ!_d4pkzhNaWowgMsR4-c1qtLXr1H9SC_kBWNDvXvVV15lerMV4elltm-V6OYOYLaV0A$ >> --- >> sys/kern/uipc_ktls.c | 107 >> ++++++++++++++++++++++++++++++++++++++++++++++++++ >> sys/netinet/tcp_var.h | 13 +++++- >> sys/sys/ktls.h | 15 ++++++- >> 3 files changed, 133 insertions(+), 2 deletions(-) >> >> diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c >> index 7e87e7c740e3..88e29157289d 100644 >> --- a/sys/kern/uipc_ktls.c >> +++ b/sys/kern/uipc_ktls.c >> @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); >> >> #include "opt_inet.h" >> #include "opt_inet6.h" >> +#include "opt_kern_tls.h" >> #include "opt_ratelimit.h" >> #include "opt_rss.h" >> >> @@ -121,6 +122,11 @@ SYSCTL_INT(_kern_ipc_tls_stats, OID_AUTO, threads, >> CTLFLAG_RD, >> &ktls_number_threads, 0, >> "Number of TLS threads in thread-pool"); >> >> +unsigned int ktls_ifnet_max_rexmit_pct = 2; >> +SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, ifnet_max_rexmit_pct, CTLFLAG_RWTUN, >> + &ktls_ifnet_max_rexmit_pct, 2, >> + "Max percent bytes retransmitted before ifnet TLS is disabled"); >> + >> static bool ktls_offload_enable; >> SYSCTL_BOOL(_kern_ipc_tls, OID_AUTO, enable, CTLFLAG_RWTUN, >> &ktls_offload_enable, 0, >> @@ -184,6 +190,14 @@ static COUNTER_U64_DEFINE_EARLY(ktls_switch_failed); >> SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, switch_failed, >> CTLFLAG_RD, >> &ktls_switch_failed, "TLS sessions unable to switch between SW and >> ifnet"); >> >> +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_fail); >> +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_failed, >> CTLFLAG_RD, >> + &ktls_ifnet_disable_fail, "TLS sessions unable to switch to SW from >> ifnet"); >> + >> +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_disable_ok); >> +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ifnet_disable_ok, >> CTLFLAG_RD, >> + &ktls_ifnet_disable_ok, "TLS sessions able to switch to SW from >> ifnet"); >> + >> SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, sw, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, >> "Software TLS session stats"); >> SYSCTL_NODE(_kern_ipc_tls, OID_AUTO, ifnet, CTLFLAG_RD | CTLFLAG_MPSAFE, >> 0, >> @@ -2187,3 +2201,96 @@ ktls_work_thread(void *ctx) >> } >> } >> } >> + >> +static void >> +ktls_disable_ifnet_help(void *context, int pending __unused) >> +{ >> + struct ktls_session *tls; >> + struct inpcb *inp; >> + struct tcpcb *tp; >> + struct socket *so; >> + int err; >> + >> + tls = context; >> + inp = tls->inp; >> + if (inp == NULL) >> + return; >> + INP_WLOCK(inp); >> + so = inp->inp_socket; >> + MPASS(so != NULL); >> + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || >> + (inp->inp_flags2 & INP_FREED)) { >> + goto out; >> + } >> + >> + if (so->so_snd.sb_tls_info != NULL) >> + err = ktls_set_tx_mode(so, TCP_TLS_MODE_SW); >> + else >> + err = ENXIO; >> + if (err == 0) { >> + counter_u64_add(ktls_ifnet_disable_ok, 1); >> + /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ >> + if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && >> + (inp->inp_flags2 & INP_FREED) == 0 && >> + (tp = intotcpcb(inp)) != NULL && >> + tp->t_fb->tfb_hwtls_change != NULL) >> + (*tp->t_fb->tfb_hwtls_change)(tp, 0); >> + } else { >> + counter_u64_add(ktls_ifnet_disable_fail, 1); >> + } >> + >> +out: >> + SOCK_LOCK(so); >> + sorele(so); >> + if (!in_pcbrele_wlocked(inp)) >> + INP_WUNLOCK(inp); >> + ktls_free(tls); >> +} >> + >> +/* >> + * Called when re-transmits are becoming a substantial portion of the >> + * sends on this connection. When this happens, we transition the >> + * connection to software TLS. This is needed because most inline TLS >> + * NICs keep crypto state only for in-order transmits. This means >> + * that to handle a TCP rexmit (which is out-of-order), the NIC must >> + * re-DMA the entire TLS record up to and including the current >> + * segment. This means that when re-transmitting the last ~1448 byte >> + * segment of a 16KB TLS record, we could wind up re-DMA'ing an order >> + * of magnitude more data than we are sending. This can cause the >> + * PCIe link to saturate well before the network, which can cause >> + * output drops, and a general loss of capacity. >> + */ >> +void >> +ktls_disable_ifnet(void *arg) >> +{ >> + struct tcpcb *tp; >> + struct inpcb *inp; >> + struct socket *so; >> + struct ktls_session *tls; >> + >> + tp = arg; >> + inp = tp->t_inpcb; >> + INP_WLOCK_ASSERT(inp); >> + so = inp->inp_socket; >> + SOCK_LOCK(so); >> + tls = so->so_snd.sb_tls_info; >> + if (tls->disable_ifnet_pending) { >> + SOCK_UNLOCK(so); >> + return; >> + } >> + >> + /* >> + * note that disable_ifnet_pending is never cleared; disabling >> + * ifnet can only be done once per session, so we never want >> + * to do it again >> + */ >> + >> + (void)ktls_hold(tls); >> + in_pcbref(inp); >> + soref(so); >> + tls->disable_ifnet_pending = true; >> + tls->inp = inp; >> + SOCK_UNLOCK(so); >> + TASK_INIT(&tls->disable_ifnet_task, 0, ktls_disable_ifnet_help, tls); >> + (void)taskqueue_enqueue(taskqueue_thread, &tls->disable_ifnet_task); >> +} >> diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h >> index dd30f89896d2..3f72a821e71f 100644 >> --- a/sys/netinet/tcp_var.h >> +++ b/sys/netinet/tcp_var.h >> @@ -39,8 +39,10 @@ >> #include >> >> #ifdef _KERNEL >> +#include "opt_kern_tls.h" >> #include >> #include >> +#include >> #endif >> >> #define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information >> array" */ >> @@ -1139,8 +1141,10 @@ tcp_fields_to_net(struct tcphdr *th) >> >> static inline void >> tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, >> - uint8_t is_tlp, int hw_tls __unused) >> + uint8_t is_tlp, int hw_tls) >> { >> + uint64_t rexmit_percent; >> + >> if (is_tlp) { >> tp->t_sndtlppack++; >> tp->t_sndtlpbyte += len; >> @@ -1150,6 +1154,13 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, >> uint8_t is_rxt, >> tp->t_snd_rxt_bytes += len; >> else >> tp->t_sndbytes += len; >> + >> + if (hw_tls && is_rxt) { >> + rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * >> (tp->t_snd_rxt_bytes + tp->t_sndbytes)); >> + if (rexmit_percent > ktls_ifnet_max_rexmit_pct) >> + ktls_disable_ifnet(tp); >> + } >> + >> } >> #endif /* _KERNEL */ >> >> diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h >> index b28c94965c97..7fd8831878b4 100644 >> --- a/sys/sys/ktls.h >> +++ b/sys/sys/ktls.h >> @@ -189,10 +189,12 @@ struct ktls_session { >> u_int wq_index; >> volatile u_int refcount; >> int mode; >> - bool reset_pending; >> >> struct task reset_tag_task; >> + struct task disable_ifnet_task; >> struct inpcb *inp; >> + bool reset_pending; >> + bool disable_ifnet_pending; >> } __aligned(CACHE_LINE_SIZE); >> >> void ktls_check_rx(struct sockbuf *sb); >> @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) >> ktls_destroy(tls); >> } >> >> +#ifdef KERN_TLS >> +extern unsigned int ktls_ifnet_max_rexmit_pct; >> +void ktls_disable_ifnet(void *arg); >> +#else >> +#define ktls_ifnet_max_rexmit_pct 1 >> +inline void >> +ktls_disable_ifnet(void *arg __unused) >> +{ >> +} >> +#endif >> + >> #endif /* !_KERNEL */ >> #endif /* !_SYS_KTLS_H_ */ >> > > From owner-dev-commits-src-all@freebsd.org Wed Jul 7 17:05:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A4F3365947A; Wed, 7 Jul 2021 17:05: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 4GKm5H45Ccz4SB3; Wed, 7 Jul 2021 17:05: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 75A1A110F9; Wed, 7 Jul 2021 17:05: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 167H5N1s014931; Wed, 7 Jul 2021 17:05:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167H5No7014930; Wed, 7 Jul 2021 17:05:23 GMT (envelope-from git) Date: Wed, 7 Jul 2021 17:05:23 GMT Message-Id: <202107071705.167H5No7014930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: b1e806c0ed96 - main - tcp: fix alternate stack build with LINT-NO{INET, INET6, IP} MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1e806c0ed960e1eb9ee889c7d0df3c168290c4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 17:05:23 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e806c0ed960e1eb9ee889c7d0df3c168290c4f commit b1e806c0ed960e1eb9ee889c7d0df3c168290c4f Author: Andrew Gallatin AuthorDate: 2021-07-07 17:02:08 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-07 17:02:08 +0000 tcp: fix alternate stack build with LINT-NO{INET,INET6,IP} When fixing another bug, I noticed that the alternate TCP stacks do not build when various combinations of ipv4 and ipv6 are disabled. Reviewed by: rrs, tuexen Differential Revision: https://reviews.freebsd.org/D31094 Sponsored by: Netflix --- sys/netinet/tcp_stacks/bbr.c | 9 ++++--- sys/netinet/tcp_stacks/rack.c | 45 ++++++++++++++++++++++++-------- sys/netinet/tcp_stacks/rack_bbr_common.c | 6 ++++- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 8969e4e47ba1..c96fec07b6c9 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -3515,13 +3515,16 @@ bbr_get_header_oh(struct tcp_bbr *bbr) if (bbr->r_ctl.rc_inc_ip_oh) { /* Do we include IP overhead? */ #ifdef INET6 - if (bbr->r_is_v6) + if (bbr->r_is_v6) { seg_oh += sizeof(struct ip6_hdr); - else + } else #endif + { + #ifdef INET seg_oh += sizeof(struct ip); #endif + } } if (bbr->r_ctl.rc_inc_enet_oh) { /* Do we include the ethernet overhead? */ @@ -11956,7 +11959,7 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeval *tv) uint32_t tot_len = 0; uint32_t rtr_cnt = 0; uint32_t maxseg, pace_max_segs, p_maxseg; - int32_t csum_flags; + int32_t csum_flags = 0; int32_t hw_tls; #if defined(IPSEC) || defined(IPSEC_SUPPORT) unsigned ipsec_optlen = 0; diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 75287282cf3e..f417f8a4ee7f 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12043,7 +12043,9 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) #ifdef INET struct ip *ip = NULL; #endif +#if defined(INET) || defined(INET6) struct udphdr *udp = NULL; +#endif /* Ok lets fill in the fast block, it can only be used with no IP options! */ #ifdef INET6 @@ -12067,6 +12069,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) ip6, rack->r_ctl.fsb.th); } else #endif /* INET6 */ +#ifdef INET { rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct tcpiphdr); ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; @@ -12086,6 +12089,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) tp->t_port, ip, rack->r_ctl.fsb.th); } +#endif rack->r_fsb_inited = 1; } @@ -15226,7 +15230,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; - int32_t slot, segsiz, max_val, tso = 0, error, flags, ulen = 0; + int32_t slot, segsiz, max_val, tso = 0, error = 0, flags, ulen = 0; uint32_t us_cts; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -15706,7 +15710,7 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val, u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; int cnt_thru = 1; - int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error, flags, ulen = 0; + int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error = 0, flags, ulen = 0; uint32_t us_cts, s_soff; uint32_t if_hw_tsomaxsegcount = 0, startseq; uint32_t if_hw_tsomaxsegsize; @@ -16119,9 +16123,9 @@ rack_output(struct tcpcb *tp) long tot_len_this_send = 0; #ifdef INET struct ip *ip = NULL; -#endif #ifdef TCPDEBUG struct ipovly *ipov = NULL; +#endif #endif struct udphdr *udp = NULL; struct tcp_rack *rack; @@ -16130,7 +16134,10 @@ rack_output(struct tcpcb *tp) uint8_t mark = 0; uint8_t wanted_cookie = 0; u_char opt[TCP_MAXOLEN]; - unsigned ipoptlen, optlen, hdrlen, ulen=0; + unsigned ipoptlen, optlen, hdrlen; +#if defined(INET) || defined(INET6) + unsigned ulen=0; +#endif uint32_t rack_seq; #if defined(IPSEC) || defined(IPSEC_SUPPORT) @@ -17830,21 +17837,29 @@ send: #endif if ((ipoptlen == 0) && (rack->r_ctl.fsb.tcp_ip_hdr) && rack->r_fsb_inited) { #ifdef INET6 - if (isipv6) + if (isipv6) { ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; - else + } else #endif /* INET6 */ + { +#ifdef INET ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif + } th = rack->r_ctl.fsb.th; udp = rack->r_ctl.fsb.udp; if (udp) { #ifdef INET6 - if (isipv6) + if (isipv6) { ulen = hdrlen + len - sizeof(struct ip6_hdr); - else + } else #endif /* INET6 */ + { +#ifdef INET ulen = hdrlen + len - sizeof(struct ip); - udp->uh_ulen = htons(ulen); + udp->uh_ulen = htons(ulen); +#endif + } } } else { #ifdef INET6 @@ -17863,6 +17878,7 @@ send: } else #endif /* INET6 */ { +#ifdef INET ip = mtod(m, struct ip *); #ifdef TCPDEBUG ipov = (struct ipovly *)ip; @@ -17877,6 +17893,7 @@ send: } else th = (struct tcphdr *)(ip + 1); tcpip_fillheaders(inp, tp->t_port, ip, th); +#endif /* INET */ } } /* @@ -17915,11 +17932,15 @@ send: if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) && (sack_rxmit == 0)) { #ifdef INET6 - if (isipv6) + if (isipv6) { ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20); - else + } else #endif + { +#ifdef INET ip->ip_tos |= IPTOS_ECN_ECT0; +#endif + } KMOD_TCPSTAT_INC(tcps_ecn_ect0); /* * Reply with proper ECN notifications. @@ -18024,7 +18045,9 @@ send: ip6 = mtod(m, struct ip6_hdr *); else #endif /* INET6 */ +#ifdef INET ip = mtod(m, struct ip *); +#endif /* INET */ th = (struct tcphdr *)(cpto + ((uint8_t *)rack->r_ctl.fsb.th - rack->r_ctl.fsb.tcp_ip_hdr)); /* If we have a udp header lets set it into the mbuf as well */ if (udp) diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c index 501d29ac48da..d9f48f733e93 100644 --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -166,17 +166,21 @@ static int ctf_get_enet_type(struct ifnet *ifp, struct mbuf *m) { struct ether_header *eh; - struct tcphdr *th; #ifdef INET6 struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ #endif #ifdef INET struct ip *ip = NULL; /* Keep compiler happy. */ #endif +#if defined(INET) || defined(INET6) + struct tcphdr *th; int32_t tlen; uint16_t drop_hdrlen; +#endif uint16_t etype; +#ifdef INET uint8_t iptos; +#endif /* Is it the easy way? */ if (m->m_flags & M_LRO_EHDRSTRP) From owner-dev-commits-src-all@freebsd.org Wed Jul 7 18:15:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 88C0265A985; Wed, 7 Jul 2021 18:15:58 +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 4GKnfk01RVz4dqQ; Wed, 7 Jul 2021 18:15:58 +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 DCDA411E6B; Wed, 7 Jul 2021 18:15: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 167IFvvC007722; Wed, 7 Jul 2021 18:15:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167IFvon007721; Wed, 7 Jul 2021 18:15:57 GMT (envelope-from git) Date: Wed, 7 Jul 2021 18:15:57 GMT Message-Id: <202107071815.167IFvon007721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 48b4fe050328 - main - zfs: attach zpool_influxdb to build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48b4fe0503282f03d25e23f44109c5cb6d450f7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 18:15:58 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=48b4fe0503282f03d25e23f44109c5cb6d450f7c commit 48b4fe0503282f03d25e23f44109c5cb6d450f7c Author: Martin Matuska AuthorDate: 2021-07-07 17:45:52 +0000 Commit: Martin Matuska CommitDate: 2021-07-07 18:15:12 +0000 zfs: attach zpool_influxdb to build From the zpool_influxdb.8 manual page: zpool_influxdb produces InfluxDB-line-protocol-compatible metrics from zpools. Like the zpool command, zpool_influxdb reads the current pool status and statistics. Unlike the zpool command which is intended for humans, zpool_influxdb formats the output in the InfluxDB line protocol. The expected use is as a plugin to a metrics collector or aggregator, such as Telegraf. zpool_influxdb is installed into /usr/libexec/zfs/ Differential revision: https://reviews.freebsd.org/D31094 MFC after: 3 days --- cddl/Makefile | 2 +- cddl/usr.libexec/Makefile | 13 +++++++++++ cddl/usr.libexec/zpool_influxdb/Makefile | 28 ++++++++++++++++++++++ cddl/usr.libexec/zpool_influxdb/Makefile.depend | 31 +++++++++++++++++++++++++ etc/mtree/BSD.debug.dist | 2 ++ etc/mtree/BSD.usr.dist | 2 ++ 6 files changed, 77 insertions(+), 1 deletion(-) diff --git a/cddl/Makefile b/cddl/Makefile index 7b9d13146afa..284a370c0167 100644 --- a/cddl/Makefile +++ b/cddl/Makefile @@ -3,7 +3,7 @@ .include SUBDIR= lib .WAIT \ - sbin share usr.bin usr.sbin + sbin share usr.bin usr.libexec usr.sbin SUBDIR.${MK_TESTS}+= tests diff --git a/cddl/usr.libexec/Makefile b/cddl/usr.libexec/Makefile new file mode 100644 index 000000000000..6280cbab5766 --- /dev/null +++ b/cddl/usr.libexec/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +SUBDIR= ${_zpool_influxdb} + +.if ${MK_ZFS} != "no" +_zpool_influxdb= zpool_influxdb +.endif + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/usr.libexec/zpool_influxdb/Makefile b/cddl/usr.libexec/zpool_influxdb/Makefile new file mode 100644 index 000000000000..2fb22f02ef32 --- /dev/null +++ b/cddl/usr.libexec/zpool_influxdb/Makefile @@ -0,0 +1,28 @@ +# $FreeBSD$ + +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs + +.PATH: ${ZFSTOP}/cmd/zpool_influxdb +.PATH: ${ZFSTOP}/man/man8 + +PROG= zpool_influxdb +MAN= zpool_influxdb.8 +BINDIR?= /usr/libexec/zfs + +WARNS?= 0 +CSTD= c99 + +CFLAGS+= \ + -DIN_BASE \ + -I${ZFSTOP}/include \ + -I${ZFSTOP}/lib/libspl/include \ + -I${ZFSTOP}/lib/libspl/include/os/freebsd \ + -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ + -DHAVE_ISSETUGID \ + -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ + -DSYSCONFDIR=\"/etc\" \ + -DPKGDATADIR=\"/usr/share/zfs\" + +LIBADD= nvpair spl zfs + +.include diff --git a/cddl/usr.libexec/zpool_influxdb/Makefile.depend b/cddl/usr.libexec/zpool_influxdb/Makefile.depend new file mode 100644 index 000000000000..53090da6e2fc --- /dev/null +++ b/cddl/usr.libexec/zpool_influxdb/Makefile.depend @@ -0,0 +1,31 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + cddl/lib/libavl \ + cddl/lib/libnvpair \ + cddl/lib/libumem \ + cddl/lib/libuutil \ + cddl/lib/libzfs \ + cddl/lib/libzfs_core \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libexpat \ + lib/libgeom \ + lib/libmd \ + lib/libsbuf \ + lib/libthr \ + lib/libutil \ + lib/libz \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/etc/mtree/BSD.debug.dist b/etc/mtree/BSD.debug.dist index d377e9fe1f69..551137beefa3 100644 --- a/etc/mtree/BSD.debug.dist +++ b/etc/mtree/BSD.debug.dist @@ -54,6 +54,8 @@ .. sm.bin .. + zfs + .. .. sbin .. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index b4bac9406f79..97d17cedb5a1 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -156,6 +156,8 @@ .. sm.bin .. + zfs + .. .. local .. From owner-dev-commits-src-all@freebsd.org Wed Jul 7 18:36:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1990565A67D; Wed, 7 Jul 2021 18:36:20 +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 4GKp6D0Ftvz4gyy; Wed, 7 Jul 2021 18:36:20 +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 E54F11253F; Wed, 7 Jul 2021 18:36: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 167IaJGl034163; Wed, 7 Jul 2021 18:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167IaJFH034162; Wed, 7 Jul 2021 18:36:19 GMT (envelope-from git) Date: Wed, 7 Jul 2021 18:36:19 GMT Message-Id: <202107071836.167IaJFH034162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 0add3c9945c8 - main - arm64: Simplify fcmpset failure in pmap_promote_l2() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0add3c9945c85c7f766f9225866e99e2a805819b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 18:36:20 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=0add3c9945c85c7f766f9225866e99e2a805819b commit 0add3c9945c85c7f766f9225866e99e2a805819b Author: Alan Cox AuthorDate: 2021-07-07 18:16:03 +0000 Commit: Alan Cox CommitDate: 2021-07-07 18:34:11 +0000 arm64: Simplify fcmpset failure in pmap_promote_l2() When the initial fcmpset in pmap_promote_l2() fails, there is no need to repeat the check for the physical address being 2MB aligned or for the accessed bit being set. While the pmap is locked the hardware can only transition the accessed bit from 0 to 1, and we have already determined that it is 1 when the fcmpset fails. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index bf476490b6be..7758a84d81d5 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3502,7 +3502,6 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, firstl3 = pmap_l2_to_l3(l2, sva); newl2 = pmap_load(firstl3); -setl2: if (((newl2 & (~ATTR_MASK | ATTR_AF)) & L2_OFFSET) != ATTR_AF) { atomic_add_long(&pmap_l2_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" @@ -3510,6 +3509,7 @@ setl2: return; } +setl2: if ((newl2 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { /* From owner-dev-commits-src-all@freebsd.org Wed Jul 7 19:08:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8784365B495; Wed, 7 Jul 2021 19:08: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 4GKpqc3TP7z4mSS; Wed, 7 Jul 2021 19:08: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 5FBC5128CF; Wed, 7 Jul 2021 19:08: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 167J8iDf073954; Wed, 7 Jul 2021 19:08:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167J8iXL073953; Wed, 7 Jul 2021 19:08:44 GMT (envelope-from git) Date: Wed, 7 Jul 2021 19:08:44 GMT Message-Id: <202107071908.167J8iXL073953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 0756bdf19c5c - main - ktls: make ktls_disable_ifnet() shim static MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0756bdf19c5c97fabf4090e844f8df9505fbd566 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 19:08:44 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=0756bdf19c5c97fabf4090e844f8df9505fbd566 commit 0756bdf19c5c97fabf4090e844f8df9505fbd566 Author: Andrew Gallatin AuthorDate: 2021-07-07 19:05:49 +0000 Commit: Andrew Gallatin CommitDate: 2021-07-07 19:08:13 +0000 ktls: make ktls_disable_ifnet() shim static A user reported that when compiling without KERN_TLS, and with -O0, the kernel failed to link due to ktls_disable_ifnet() being undefined. Making the shim static works around this issue. Reported by: Gary Jennejohn Sponsored by: Netflix --- sys/sys/ktls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 7fd8831878b4..a4156eb10395 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -238,7 +238,7 @@ extern unsigned int ktls_ifnet_max_rexmit_pct; void ktls_disable_ifnet(void *arg); #else #define ktls_ifnet_max_rexmit_pct 1 -inline void +static inline void ktls_disable_ifnet(void *arg __unused) { } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 19:53:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 421EB65BDFF; Wed, 7 Jul 2021 19:53: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 4GKqqf1H7lz4sJq; Wed, 7 Jul 2021 19:53: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 141EF139AE; Wed, 7 Jul 2021 19:53: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 167Jrnnv039756; Wed, 7 Jul 2021 19:53:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167JrnnU039755; Wed, 7 Jul 2021 19:53:49 GMT (envelope-from git) Date: Wed, 7 Jul 2021 19:53:49 GMT Message-Id: <202107071953.167JrnnU039755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 3874c0abb0af - main - [skip ci] correct a few SPDX license tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 19:53:50 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=3874c0abb0afaea6adc24ac96dc9dc5043f2b69e commit 3874c0abb0afaea6adc24ac96dc9dc5043f2b69e Author: Alan Somers AuthorDate: 2021-07-07 19:52:20 +0000 Commit: Alan Somers CommitDate: 2021-07-07 19:52:20 +0000 [skip ci] correct a few SPDX license tags These were all incorrectly labeled as 2-clause BSD licenses by a semi-automated process, when in fact they are 3-clause. Discussed with: pfg, imp MFC after: 2 weeks Sponsored by: Axcient --- lib/libgeom/geom_getxml.c | 2 +- lib/libgeom/geom_stats.c | 2 +- lib/libgeom/geom_xml2tree.c | 2 +- lib/libgeom/libgeom.h | 2 +- sbin/fsck_ffs/ea.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libgeom/geom_getxml.c b/lib/libgeom/geom_getxml.c index f3d7ba9deb03..48565f707b03 100644 --- a/lib/libgeom/geom_getxml.c +++ b/lib/libgeom/geom_getxml.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 7c9191e29686..e8e2969e835f 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 5f4636f9368b..824800070933 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h index 075d2d21f26c..fc593b234302 100644 --- a/lib/libgeom/libgeom.h +++ b/lib/libgeom/libgeom.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 7cf20196dfae..54353005bdc0 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index c2d28720205f..65388c3002ff 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-3-Clause-FreeBSD * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:10:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CEC3865C16B; Wed, 7 Jul 2021 20:10: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 4GKrBN5LC7z4tgj; Wed, 7 Jul 2021 20:10: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 9F943136E0; Wed, 7 Jul 2021 20:10: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 167KA40j056366; Wed, 7 Jul 2021 20:10:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KA4QU056363; Wed, 7 Jul 2021 20:10:04 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:10:04 GMT Message-Id: <202107072010.167KA4QU056363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: e991afea1e79 - stable/13 - kern: fail getgroup and setgroup with negative int MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e991afea1e794885931d17310019e4c067501981 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:10:04 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e991afea1e794885931d17310019e4c067501981 commit e991afea1e794885931d17310019e4c067501981 Author: Moritz Buhl AuthorDate: 2019-07-09 15:03:37 +0000 Commit: Warner Losh CommitDate: 2021-07-07 20:09:44 +0000 kern: fail getgroup and setgroup with negative int Found using https://github.com/NetBSD/src/blob/trunk/tests/lib/libc/sys/t_getgroups.c getgroups/setgroups want an int and therefore casting it to u_int resulted in `getgroups(-1, ...)` not returning -1 / errno = EINVAL. imp@ updated syscall.master and made changes markj@ suggested PR: 189941 Tested by: imp@ Reviewed by: markj@ Pull Request: https://github.com/freebsd/freebsd-src/pull/407 Differential Revision: https://reviews.freebsd.org/D30617 (cherry picked from commit 4bc2174a1b489c36195ccc8cfc15e0775b817c69) --- sys/kern/kern_prot.c | 12 +++++------- sys/kern/syscalls.master | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 170e9598835e..08fc3c8062db 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -288,7 +288,7 @@ sys_getegid(struct thread *td, struct getegid_args *uap) #ifndef _SYS_SYSPROTO_H_ struct getgroups_args { - u_int gidsetsize; + int gidsetsize; gid_t *gidset; }; #endif @@ -296,8 +296,7 @@ int sys_getgroups(struct thread *td, struct getgroups_args *uap) { struct ucred *cred; - u_int ngrp; - int error; + int ngrp, error; cred = td->td_ucred; ngrp = cred->cr_ngroups; @@ -791,7 +790,7 @@ fail: #ifndef _SYS_SYSPROTO_H_ struct setgroups_args { - u_int gidsetsize; + int gidsetsize; gid_t *gidset; }; #endif @@ -801,11 +800,10 @@ sys_setgroups(struct thread *td, struct setgroups_args *uap) { gid_t smallgroups[XU_NGROUPS]; gid_t *groups; - u_int gidsetsize; - int error; + int gidsetsize, error; gidsetsize = uap->gidsetsize; - if (gidsetsize > ngroups_max + 1) + if (gidsetsize > ngroups_max + 1 || gidsetsize < 0) return (EINVAL); if (gidsetsize > XU_NGROUPS) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 5c6ebeb9b52f..5b8e8049927c 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -526,13 +526,13 @@ } 79 AUE_GETGROUPS STD { int getgroups( - u_int gidsetsize, + int gidsetsize, _Out_writes_opt_(gidsetsize) gid_t *gidset ); } 80 AUE_SETGROUPS STD { int setgroups( - u_int gidsetsize, + int gidsetsize, _In_reads_(gidsetsize) gid_t *gidset ); } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:10:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0BD0065C3CE; Wed, 7 Jul 2021 20:10: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 4GKrBP6mLnz4tjW; Wed, 7 Jul 2021 20:10: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 C064313BAF; Wed, 7 Jul 2021 20:10: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 167KA5lS056585; Wed, 7 Jul 2021 20:10:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KA5U8056582; Wed, 7 Jul 2021 20:10:05 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:10:05 GMT Message-Id: <202107072010.167KA5U8056582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0f4cb36cef40 - stable/13 - t_getgroups: No longer expected to fail MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0f4cb36cef406cc7dae7100df82297f1a4b16585 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:10:06 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0f4cb36cef406cc7dae7100df82297f1a4b16585 commit 0f4cb36cef406cc7dae7100df82297f1a4b16585 Author: Warner Losh AuthorDate: 2021-06-02 18:02:56 +0000 Commit: Warner Losh CommitDate: 2021-07-07 20:09:44 +0000 t_getgroups: No longer expected to fail Sponsored by: Netflix (cherry picked from commit bf26ea77553931c22e72ddf1f9df6fb51fcbadfe) --- contrib/netbsd-tests/lib/libc/sys/t_getgroups.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c b/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c index 7dedca445288..9a8ec8ede271 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c @@ -57,9 +57,6 @@ ATF_TC_BODY(getgroups_err, tc) errno = 0; -#ifdef __FreeBSD__ - atf_tc_expect_fail("Reported as kern/189941"); -#endif ATF_REQUIRE(getgroups(-1, gidset) == -1); ATF_REQUIRE(errno == EINVAL); } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:12:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A717165C3F7; Wed, 7 Jul 2021 20:12: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 4GKrDd4NJrz4tcD; Wed, 7 Jul 2021 20:12: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 7F55213E8C; Wed, 7 Jul 2021 20:12: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 167KC1ZE065913; Wed, 7 Jul 2021 20:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KC1IL065912; Wed, 7 Jul 2021 20:12:01 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:12:01 GMT Message-Id: <202107072012.167KC1IL065912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Fernando Apestegu=C3=ADa?= Subject: git: f6043a672135 - main - ObsoleteFiles.inc: Remove manpages from OLD_FILES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6043a672135da8ec090d8878cc844b8aace54f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:12:01 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f6043a672135da8ec090d8878cc844b8aace54f9 commit f6043a672135da8ec090d8878cc844b8aace54f9 Author: Fernando Apesteguía AuthorDate: 2021-07-07 13:15:02 +0000 Commit: Fernando Apesteguía CommitDate: 2021-07-07 18:09:02 +0000 ObsoleteFiles.inc: Remove manpages from OLD_FILES In 0a0f7486413c147d56808b38055c40c64cff61f5 sconfig.8.gz and apmd.8.gz were moved back to the parent directory share/man/man8. This conflicts with a previous entry in OLD_FILES so running 'make delete-old' would delete the new installed files. Reported by: marklmi@yahoo.com Approved by: emaste@ Fixes: 0a0f7486413c - Build manpages for all architectures MFH: 4 weeks Differential Revision: https://reviews.freebsd.org/D31092 --- ObsoleteFiles.inc | 2 -- 1 file changed, 2 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 60707faebefc..d72aea5e8efc 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -14840,11 +14840,9 @@ OLD_FILES+=usr/share/man/man7/mmroff.7.gz OLD_FILES+=usr/share/man/man7/mwww.7.gz OLD_FILES+=usr/share/man/man8/apm.8.gz OLD_FILES+=usr/share/man/man8/apmconf.8.gz -OLD_FILES+=usr/share/man/man8/apmd.8.gz OLD_FILES+=usr/share/man/man8/dm.8.gz OLD_FILES+=usr/share/man/man8/pam_ftp.8.gz OLD_FILES+=usr/share/man/man8/pam_wheel.8.gz -OLD_FILES+=usr/share/man/man8/sconfig.8.gz OLD_FILES+=usr/share/man/man8/ssl.8.gz OLD_FILES+=usr/share/man/man8/wlconfig.8.gz OLD_FILES+=usr/share/man/man9/CURSIG.9.gz From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:24:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0D3B665C75A; Wed, 7 Jul 2021 20:24:02 +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 4GKrVT714mz4vdZ; Wed, 7 Jul 2021 20:24: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 D925C1410E; Wed, 7 Jul 2021 20:24: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 167KO1KW080440; Wed, 7 Jul 2021 20:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KO1rR080439; Wed, 7 Jul 2021 20:24:01 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:24:01 GMT Message-Id: <202107072024.167KO1rR080439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Houchard Subject: git: d2e48ad87d3e - stable/13 - arm64: Make sure COMPAT_FREEBSD32 handles thumb entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2e48ad87d3e0f63f4ac73c524fb18afce4a2d53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:24:02 -0000 The branch stable/13 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=d2e48ad87d3e0f63f4ac73c524fb18afce4a2d53 commit d2e48ad87d3e0f63f4ac73c524fb18afce4a2d53 Author: Olivier Houchard AuthorDate: 2021-06-30 12:50:47 +0000 Commit: Olivier Houchard CommitDate: 2021-07-07 20:22:18 +0000 arm64: Make sure COMPAT_FREEBSD32 handles thumb entry point. If the entry point for the binary executed is a thumb 2 entry point, make sure we set the PSR_T bit, or the CPU will interpret it as arm32 code and bad things will happen. PR: 256899 MFC after: 1 week (cherry picked from commit 712c060c94fd447c91b0e6218c12a431206b487a) Signed-off-by: Olivier Houchard --- sys/arm64/arm64/elf32_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index b9669616e1dd..6c98f7c839ca 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -255,6 +255,8 @@ freebsd32_setregs(struct thread *td, struct image_params *imgp, tf->tf_x[14] = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; tf->tf_spsr = PSR_M_32; + if ((uint32_t)imgp->entry_addr & 1) + tf->tf_spsr |= PSR_T; #ifdef VFP vfp_reset_state(td, pcb); From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:24:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B98965C53E; Wed, 7 Jul 2021 20:24: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 4GKrVW0wYHz4vkV; Wed, 7 Jul 2021 20:24: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 07B4F13F25; Wed, 7 Jul 2021 20:24: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 167KO2VK080464; Wed, 7 Jul 2021 20:24:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KO2AW080463; Wed, 7 Jul 2021 20:24:02 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:24:02 GMT Message-Id: <202107072024.167KO2AW080463@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Houchard Subject: git: 82a1d67f018c - stable/13 - arm: Make sure we can handle a thumb entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82a1d67f018c7178485166ae3e06f29bff292263 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:24:03 -0000 The branch stable/13 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=82a1d67f018c7178485166ae3e06f29bff292263 commit 82a1d67f018c7178485166ae3e06f29bff292263 Author: Olivier Houchard AuthorDate: 2021-06-30 20:56:50 +0000 Commit: Olivier Houchard CommitDate: 2021-07-07 20:22:41 +0000 arm: Make sure we can handle a thumb entry point. Similarly to what's been done on arm64 with commit 712c060c94fd447c91b0e6218c12a431206b487a, when executing a binary, if the entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise the CPU will interpret it in ARM mode, and that will likely leads to an undefined instruction. PR: 256899 MFC after: 1 week (cherry picked from commit 8c3bd133dd52824e427e350c65eae1fd9eb5a3cd) Signed-off-by: Olivier Houchard --- sys/arm/arm/machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 3296adaaa44b..ea5b5a0de251 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -351,6 +351,8 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_svc_lr = 0x77777777; tf->tf_pc = imgp->entry_addr; tf->tf_spsr = PSR_USR32_MODE; + if ((register_t)imgp->entry_addr & 1) + tf->tf_spsr |= PSR_T; } #ifdef VFP From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:25:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AAB2765C8CC; Wed, 7 Jul 2021 20:25: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 4GKrX83fSwz3Cd9; Wed, 7 Jul 2021 20:25: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 56AB614119; Wed, 7 Jul 2021 20:25: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 167KPSl1080705; Wed, 7 Jul 2021 20:25:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KPSqH080704; Wed, 7 Jul 2021 20:25:28 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:25:28 GMT Message-Id: <202107072025.167KPSqH080704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Houchard Subject: git: 9bc7bbcf214b - stable/12 - arm: Make sure we can handle a thumb entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9bc7bbcf214b9e15b67e42706cef770ede541913 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:25:28 -0000 The branch stable/12 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=9bc7bbcf214b9e15b67e42706cef770ede541913 commit 9bc7bbcf214b9e15b67e42706cef770ede541913 Author: Olivier Houchard AuthorDate: 2021-06-30 20:56:50 +0000 Commit: Olivier Houchard CommitDate: 2021-07-07 20:24:56 +0000 arm: Make sure we can handle a thumb entry point. Similarly to what's been done on arm64 with commit 712c060c94fd447c91b0e6218c12a431206b487a, when executing a binary, if the entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise the CPU will interpret it in ARM mode, and that will likely leads to an undefined instruction. PR: 256899 MFC after: 1 week (cherry picked from commit 8c3bd133dd52824e427e350c65eae1fd9eb5a3cd) Signed-off-by: Olivier Houchard --- sys/arm/arm/machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index f24df96ca3d6..a1354f303b3a 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -425,6 +425,8 @@ exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) tf->tf_svc_lr = 0x77777777; tf->tf_pc = imgp->entry_addr; tf->tf_spsr = PSR_USR32_MODE; + if ((register_t)imgp->entry_addr & 1) + tf->tf_spsr |= PSR_T; } From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:49:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D08665D089; Wed, 7 Jul 2021 20:49: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 4GKs3J46GWz3J2n; Wed, 7 Jul 2021 20:49: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 753FE1444E; Wed, 7 Jul 2021 20:49: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 167Kn0wU006978; Wed, 7 Jul 2021 20:49:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167Kn01O006977; Wed, 7 Jul 2021 20:49:00 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:49:00 GMT Message-Id: <202107072049.167Kn01O006977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f68e3ea831b7 - main - devmatch: defer until after kld MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f68e3ea831b76a8927eed7f7abfea55ee5a193c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:49:00 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f68e3ea831b76a8927eed7f7abfea55ee5a193c4 commit f68e3ea831b76a8927eed7f7abfea55ee5a193c4 Author: Helge Oldach AuthorDate: 2021-07-07 20:43:35 +0000 Commit: Warner Losh CommitDate: 2021-07-07 20:48:40 +0000 devmatch: defer until after kld devmatch loads a number of things automatically. Allow the list of things to load to happen first in case those drivers affect what would be loaded. Normally, this will produce the same results, but there's some special cases that may not when drivers are loaded that report other drivers missing, like virtio_pci. PR: 253287 Reviewed by: imp MFC After: 2 weeks --- libexec/rc/rc.d/devmatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index 0b2e3719dabb..dd61307a4e0a 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -26,7 +26,7 @@ # $FreeBSD$ # # PROVIDE: devmatch -# REQUIRE: kldxref +# REQUIRE: kld # BEFORE: netif # KEYWORD: nojail From owner-dev-commits-src-all@freebsd.org Wed Jul 7 20:52:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C7EED65CE25 for ; Wed, 7 Jul 2021 20:52: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 4GKs6q5LX0z3JWK; Wed, 7 Jul 2021 20:52: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 9FD1614808; Wed, 7 Jul 2021 20:52: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 167Kq3FH019237; Wed, 7 Jul 2021 20:52:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167Kq3gn019236; Wed, 7 Jul 2021 20:52:03 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:52:03 GMT Message-Id: <202107072052.167Kq3gn019236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Martin Matuska Subject: git: 4694131a0a05..bdd11cbb90a2 - vendor/openzfs/master - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs/master X-Git-Reftype: branch X-Git-Commit: bdd11cbb90a2afa54fd00935ac0d34b4ddf2515c X-Git-Oldrev: 4694131a0a05b6db2727c9801f9729b9378d3064 X-Git-Newrev: bdd11cbb90a2afa54fd00935ac0d34b4ddf2515c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:52:03 -0000 The branch vendor/openzfs/master has been updated by mm: URL: https://cgit.FreeBSD.org/src/log/?id=4694131a0a05..bdd11cbb90a2 cfc564f9b11e ZED: Match added disk by pool/vdev GUID if found (#12217) 42afb12da70f Remove refcount from spa_config_*() 50e09eddd0c5 Optimize txg_kick() process (#12274) eca174527e0b Upstream: dmu_zfetch_stream_fini leaks refcount c6d1112bf412 Fix abd leak, kmem_free correct size of abd_t 490c845efe3c Compact dbuf/buf hashes and lock arrays b192a2c0a191 Remove avl_size field from struct avl_tree a5398f8782eb Udev rules: use non-ancient comma syntax 17c794e7b072 Udev rules: replace deprecated $tempnode with $devnode f1aef8d4df83 Udev rules: use match (==) rather than assign (=) for PROGRAM b19e2bdfb5a2 Print zvol_id error messages to stderr rather than stdout f24c7c359ea4 Use substantially more robust program exit status logic in zvol_id 6e4e3c3ab67d Udev rules: remove zvol compat symlinks (without the leading zvol/) 97752ba22a4a Move gethrtime() calls out of vdev queue lock bdd11cbb90a2 FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE From owner-dev-commits-src-all@freebsd.org Wed Jul 7 21:32:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7F81365D6A3; Wed, 7 Jul 2021 21:32: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 4GKt193BgFz3Q6Q; Wed, 7 Jul 2021 21:32: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 563DF14D33; Wed, 7 Jul 2021 21:32: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 167LWDla073425; Wed, 7 Jul 2021 21:32:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167LWDte073424; Wed, 7 Jul 2021 21:32:13 GMT (envelope-from git) Date: Wed, 7 Jul 2021 21:32:13 GMT Message-Id: <202107072132.167LWDte073424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 7cd22ac43418 - main - zfs: merge openzfs/zfs@bdd11cbb9 (master) into main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cd22ac43418da08448d0bab1009ff3cbda85120 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 21:32:13 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=7cd22ac43418da08448d0bab1009ff3cbda85120 commit 7cd22ac43418da08448d0bab1009ff3cbda85120 Merge: f68e3ea831b7 bdd11cbb90a2 Author: Martin Matuska AuthorDate: 2021-07-07 21:31:10 +0000 Commit: Martin Matuska CommitDate: 2021-07-07 21:31:52 +0000 zfs: merge openzfs/zfs@bdd11cbb9 (master) into main Notable upstream pull request merges: #12274 Optimize txg_kick() process #12281 Move gethrtime() calls out of vdev queue lock #12287 Remove refcount from spa_config_*( #12289 Compact dbuf/buf hashes and lock arrays #12290 Remove avl_size field from struct avl_tree #12294 Upstream: dmu_zfetch_stream_fini leaks refcount #12295 Fix abd leak, kmem_free correct size of abd_t #12328 FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE Obtained from: OpenZFS OpenZFS commit: bdd11cbb90a2afa54fd00935ac0d34b4ddf2515c sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c | 40 +++++- sys/contrib/openzfs/cmd/zed/zed_disk_event.c | 2 + sys/contrib/openzfs/cmd/zvol_id/zvol_id_main.c | 58 +++++---- sys/contrib/openzfs/include/sys/abd.h | 1 - sys/contrib/openzfs/include/sys/abd_impl.h | 2 +- sys/contrib/openzfs/include/sys/avl_impl.h | 4 +- sys/contrib/openzfs/include/sys/dbuf.h | 4 +- sys/contrib/openzfs/include/sys/spa_impl.h | 4 +- sys/contrib/openzfs/include/sys/txg.h | 2 +- sys/contrib/openzfs/module/avl/avl.c | 2 - sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 136 +++++++++------------ sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 3 +- sys/contrib/openzfs/module/zfs/abd.c | 2 +- sys/contrib/openzfs/module/zfs/arc.c | 25 +--- sys/contrib/openzfs/module/zfs/dbuf.c | 6 +- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 2 + sys/contrib/openzfs/module/zfs/dsl_pool.c | 25 +++- sys/contrib/openzfs/module/zfs/spa_misc.c | 19 ++- sys/contrib/openzfs/module/zfs/txg.c | 36 +++--- sys/contrib/openzfs/module/zfs/vdev_queue.c | 11 +- sys/contrib/openzfs/tests/runfiles/linux.run | 9 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 1 + .../zfs-tests/tests/functional/fault/Makefile.am | 1 + .../tests/functional/fault/auto_online_002_pos.ksh | 94 ++++++++++++++ sys/contrib/openzfs/udev/rules.d/60-zvol.rules.in | 9 +- sys/modules/zfs/zfs_config.h | 4 +- 26 files changed, 303 insertions(+), 199 deletions(-) diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_002_pos.ksh index 000000000000,60185ace34bb..60185ace34bb mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_002_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_002_pos.ksh diff --cc sys/modules/zfs/zfs_config.h index 7983ac8959e7,000000000000..9c7c76fac70f mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,774 -1,0 +1,774 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT_LEGACY */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* kernel has large stacks */ +/* #undef HAVE_LARGE_STACKS */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->create()/mkdir()/mknod() take umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available */ +/* #undef HAVE_SETATTR_PREPARE */ + +/* iops->set_acl() exists */ +/* #undef HAVE_SET_ACL */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g4694131a0" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_gbdd11cbb9" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + +/* Define the maximum compatible kernel version. */ +#define ZFS_META_KVER_MAX "5.13" + +/* Define the minimum compatible kernel version. */ +#define ZFS_META_KVER_MIN "3.10" + +/* Define the project license. */ +#define ZFS_META_LICENSE "CDDL" + +/* Define the libtool library 'age' version information. */ +/* #undef ZFS_META_LT_AGE */ + +/* Define the libtool library 'current' version information. */ +/* #undef ZFS_META_LT_CURRENT */ + +/* Define the libtool library 'revision' version information. */ +/* #undef ZFS_META_LT_REVISION */ + +/* Define the project name. */ +#define ZFS_META_NAME "zfs" + +/* Define the project release. */ - #define ZFS_META_RELEASE "FreeBSD_g4694131a0" ++#define ZFS_META_RELEASE "FreeBSD_gbdd11cbb9" + +/* Define the project version. */ +#define ZFS_META_VERSION "2.1.99" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ + From owner-dev-commits-src-all@freebsd.org Wed Jul 7 23:18:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9A0F565E6D1 for ; Wed, 7 Jul 2021 23: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 4GKwMT3tvvz3tgQ; Wed, 7 Jul 2021 23:18: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 6B20315D72; Wed, 7 Jul 2021 23:18: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 167NIDHu006760; Wed, 7 Jul 2021 23:18:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167NIDGd006759; Wed, 7 Jul 2021 23:18:13 GMT (envelope-from git) Date: Wed, 7 Jul 2021 23:18:13 GMT Message-Id: <202107072318.167NIDGd006759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Warner Losh Subject: git: fe50a7501374 - Create tag vendor/one-true-awk/1e4bc42c53a1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/tags/vendor/one-true-awk/1e4bc42c53a1 X-Git-Reftype: annotated tag X-Git-Commit: fe50a75013745586fcdf53aec347a2b8c985e0f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 23:18:13 -0000 The annotated tag vendor/one-true-awk/1e4bc42c53a1 has been created by imp: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/one-true-awk/1e4bc42c53a1 tag vendor/one-true-awk/1e4bc42c53a1 Tagger: Warner Losh TaggerDate: 2021-07-07 23:15:10 +0000 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Import the latest bsd-features branch of the one-true-awk upstream: o Move to bison for $YACC o Set close-on-exec flag for file and pipe redirects that aren't std* o lots of little fixes to modernize ocde base o free sval member before setting it o fix a bug where a{0,3} could match aaaa o pull in systime and strftime from NetBSD awk o pull in fixes from {Net,Free,Open}BSD o add BSD extensions and, or, xor, compl, lsheift, rshift -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIzBAABCgAdFiEEIDX4lLAKo898zeG3bBzRKH2wEQAFAmDmNX4ACgkQbBzRKH2w EQDHwxAA5o1zfocIF3MCviBIiGW6c4RC4WM4NIS9SCm/n022ZvABC0oCqjHO5+vd 6eBrNcBWCP9R29/ukp0xiBnwNDQM+bPmdOtPOM7H3cL9iPzDGWiB7edMt0bckljR +c26hI53MjPuiQbsafbwL2pylVY3jfyfnUkBw0DBCTPhIQH2YE+myhHuioqo74Ja 85TAs4loAi6Mh5O5Q7N66d9kZ4SOOfIOqnz/Hi9ymdK8ykXoGaRYD2yYBab4CHjq S9PrH2wWDtGdM7JhsJwqhNwCat1aPVC0DHbIzznV1nqSDeQ8SmpMimhrchmSf/jg 1Fg7PGWzMBLBQoDjWTffQwL/bJZ+E6gTFwzQhNR/lcOKAlZOSN1nFoMMxorX0aoA tH9bB7sK4jXNh/s54urZo381RcPpyTTOq3SOxv2FftgdMwPQAbRRS1yFe2mKslSu Cq8FzcYPx7h9GjK+xza92PWfiP40IZNiXNsTgEeQjQoW2CXoQni8ipvIrSC/vC8J pYXDPaVS3HXEiu+JoAAxp5dR2mpr7R1eLRjQZM0smXth6l4xcjYHk7tqb69H4W+S 7pZ84MVr83H6lCgFSTDwzNhMJb+Lp4PejbHHKHbPuo9I6iuyq6EAutHr2xAV7GTa x39NF5pgxnwI5Ccfp68AEsyk0YtWIBMCObt6Gw6QxtENS5braSw= =qF4T -----END PGP SIGNATURE----- commit 746b7396bb3e85208573892a0f314e0b4e7dacf4 Author: Warner Losh AuthorDate: 2021-07-07 23:03:17 +0000 Commit: Warner Losh CommitDate: 2021-07-07 23:09:41 +0000 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Import the latest bsd-features branch of the one-true-awk upstream: o Move to bison for $YACC o Set close-on-exec flag for file and pipe redirects that aren't std* o lots of little fixes to modernize ocde base o free sval member before setting it o fix a bug where a{0,3} could match aaaa o pull in systime and strftime from NetBSD awk o pull in fixes from {Net,Free,Open}BSD o add BSD extensions and, or, xor, compl, lsheift, rshift Sponsored by: Netflix From owner-dev-commits-src-all@freebsd.org Wed Jul 7 23:18:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C6D465E3E1 for ; Wed, 7 Jul 2021 23: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 4GKwMT3Lf9z3tnm; Wed, 7 Jul 2021 23:18: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 508C0163CA; Wed, 7 Jul 2021 23:18: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 167NIDDk006736; Wed, 7 Jul 2021 23:18:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167NIDTX006735; Wed, 7 Jul 2021 23:18:13 GMT (envelope-from git) Date: Wed, 7 Jul 2021 23:18:13 GMT Message-Id: <202107072318.167NIDTX006735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Warner Losh Subject: git: 03ee4d05f1d9..746b7396bb3e - vendor/one-true-awk - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/vendor/one-true-awk X-Git-Reftype: branch X-Git-Commit: 746b7396bb3e85208573892a0f314e0b4e7dacf4 X-Git-Oldrev: 03ee4d05f1d963d60451e04ce505e4da116300db X-Git-Newrev: 746b7396bb3e85208573892a0f314e0b4e7dacf4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 23:18:13 -0000 The branch vendor/one-true-awk has been updated by imp: URL: https://cgit.FreeBSD.org/src/log/?id=03ee4d05f1d9..746b7396bb3e 746b7396bb3e one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs From owner-dev-commits-src-all@freebsd.org Thu Jul 8 01:27:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C0E7065FE38; Thu, 8 Jul 2021 01:27: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 4GKzDw4vKHz4chH; Thu, 8 Jul 2021 01:27: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 904FE180E5; Thu, 8 Jul 2021 01:27: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 1681RiJ3079010; Thu, 8 Jul 2021 01:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1681Ri8I079008; Thu, 8 Jul 2021 01:27:44 GMT (envelope-from git) Date: Thu, 8 Jul 2021 01:27:44 GMT Message-Id: <202107080127.1681Ri8I079008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f39dd6a97844 - main - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f39dd6a9784467f0db5886012b3f4b13899be6b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 01:27:44 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f39dd6a9784467f0db5886012b3f4b13899be6b8 commit f39dd6a9784467f0db5886012b3f4b13899be6b8 Merge: 7cd22ac43418 746b7396bb3e Author: Warner Losh AuthorDate: 2021-07-07 23:30:35 +0000 Commit: Warner Losh CommitDate: 2021-07-08 01:25:43 +0000 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Import the latest bsd-features branch of the one-true-awk upstream: o Move to bison for $YACC o Set close-on-exec flag for file and pipe redirects that aren't std* o lots of little fixes to modernize ocde base o free sval member before setting it o fix a bug where a{0,3} could match aaaa o pull in systime and strftime from NetBSD awk o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) Also revert a few of the trivial FreeBSD changes that were done slightly differently in the upstreaming process. Also, our PR database may have been mined by upstream for these fixes, and Mikolaj Golub may deserve credit for some of the fixes in this update. Suggested by: Mikolaj Golub PR: 143363,143365,143368,143369,143373,143375,214782 Sponsored by: Netflix contrib/one-true-awk/ChangeLog | 108 +++ contrib/one-true-awk/FIXES | 261 +++++- contrib/one-true-awk/REGRESS | 4 + contrib/one-true-awk/awk.1 | 159 +++- contrib/one-true-awk/awk.h | 67 +- contrib/one-true-awk/awkgram.y | 48 +- contrib/one-true-awk/b.c | 438 +++++++--- .../one-true-awk/bugs-fixed/missing-precision.ok | 2 +- contrib/one-true-awk/bugs-fixed/negative-nf.ok | 2 +- contrib/one-true-awk/lex.c | 77 +- contrib/one-true-awk/lib.c | 327 +++++--- contrib/one-true-awk/main.c | 163 ++-- contrib/one-true-awk/makefile | 74 +- contrib/one-true-awk/maketab.c | 66 +- contrib/one-true-awk/parse.c | 29 +- contrib/one-true-awk/proctab.c | 202 ++--- contrib/one-true-awk/proto.h | 41 +- contrib/one-true-awk/run.c | 918 ++++++++++++++------- contrib/one-true-awk/tran.c | 164 ++-- usr.bin/awk/Makefile | 10 +- 20 files changed, 2192 insertions(+), 968 deletions(-) diff --cc contrib/one-true-awk/awk.h index 31d070aecddc,51c00df9f279..230eac41548c --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@@ -217,9 -235,8 +235,10 @@@ extern int pairstack[], paircnt #define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */ /* watch out in match(), etc. */ + #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 +#define HAT (NCHARS+2) /* matches ^ in regular expr */ + /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --cc contrib/one-true-awk/b.c index 0cdcf30a972e,000000000000..20f4a8bee7f9 mode 100644,000000..100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@@ -1,1225 -1,0 +1,1391 @@@ +/**************************************************************** +Copyright (C) Lucent Technologies 1997 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. +****************************************************************/ + +/* lasciate ogne speranza, voi ch'intrate. */ + +#include +__FBSDID("$FreeBSD$"); + +#define DEBUG + +#include +#include +#include +#include +#include +#include "awk.h" - #include "ytab.h" ++#include "awkgram.tab.h" + +#define MAXLIN 22 + +#define type(v) (v)->nobj /* badly overloaded here */ +#define info(v) (v)->ntype /* badly overloaded here */ +#define left(v) (v)->narg[0] +#define right(v) (v)->narg[1] +#define parent(v) (v)->nnext + +#define LEAF case CCL: case NCCL: case CHAR: case DOT: case FINAL: case ALL: +#define ELEAF case EMPTYRE: /* empty string in regexp */ +#define UNARY case STAR: case PLUS: case QUEST: + +/* encoding in tree Nodes: + leaf (CCL, NCCL, CHAR, DOT, FINAL, ALL, EMPTYRE): + left is index, right contains value or pointer to value + unary (STAR, PLUS, QUEST): left is child, right is null + binary (CAT, OR): left and right are children + parent contains pointer to parent +*/ + + +int *setvec; +int *tmpset; +int maxsetvec = 0; + +int rtok; /* next token in current re */ +int rlxval; - static uschar *rlxstr; - static uschar *prestr; /* current position in current re */ - static uschar *lastre; /* origin of last re */ - static uschar *lastatom; /* origin of last Atom */ - static uschar *starttok; - static uschar *basestr; /* starts with original, replaced during ++static const uschar *rlxstr; ++static const uschar *prestr; /* current position in current re */ ++static const uschar *lastre; /* origin of last re */ ++static const uschar *lastatom; /* origin of last Atom */ ++static const uschar *starttok; ++static const uschar *basestr; /* starts with original, replaced during + repetition processing */ - static uschar *firstbasestr; ++static const uschar *firstbasestr; + +static int setcnt; +static int poscnt; + - char *patbeg; ++const char *patbeg; +int patlen; + - #define NFA 20 /* cache this many dynamic fa's */ ++#define NFA 128 /* cache this many dynamic fa's */ +fa *fatab[NFA]; +int nfatab = 0; /* entries in fatab */ + - fa *makedfa(const char *s, int anchor) /* returns dfa for reg expr s */ ++static int * ++intalloc(size_t n, const char *f) ++{ ++ int *p = (int *) calloc(n, sizeof(int)); ++ if (p == NULL) ++ overflo(f); ++ return p; ++} ++ ++static void ++resizesetvec(const char *f) ++{ ++ if (maxsetvec == 0) ++ maxsetvec = MAXLIN; ++ else ++ maxsetvec *= 4; ++ setvec = (int *) realloc(setvec, maxsetvec * sizeof(*setvec)); ++ tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(*tmpset)); ++ if (setvec == NULL || tmpset == NULL) ++ overflo(f); ++} ++ ++static void ++resize_state(fa *f, int state) ++{ ++ unsigned int **p; ++ uschar *p2; ++ int **p3; ++ int i, new_count; ++ ++ if (++state < f->state_count) ++ return; ++ ++ new_count = state + 10; /* needs to be tuned */ ++ ++ p = (unsigned int **) realloc(f->gototab, new_count * sizeof(f->gototab[0])); ++ if (p == NULL) ++ goto out; ++ f->gototab = p; ++ ++ p2 = (uschar *) realloc(f->out, new_count * sizeof(f->out[0])); ++ if (p2 == NULL) ++ goto out; ++ f->out = p2; ++ ++ p3 = (int **) realloc(f->posns, new_count * sizeof(f->posns[0])); ++ if (p3 == NULL) ++ goto out; ++ f->posns = p3; ++ ++ for (i = f->state_count; i < new_count; ++i) { ++ f->gototab[i] = (unsigned int *) calloc(NCHARS, sizeof(**f->gototab)); ++ if (f->gototab[i] == NULL) ++ goto out; ++ f->out[i] = 0; ++ f->posns[i] = NULL; ++ } ++ f->state_count = new_count; ++ return; ++out: ++ overflo(__func__); ++} ++ ++fa *makedfa(const char *s, bool anchor) /* returns dfa for reg expr s */ +{ + int i, use, nuse; + fa *pfa; + static int now = 1; + + if (setvec == NULL) { /* first time through any RE */ - maxsetvec = MAXLIN; - setvec = (int *) malloc(maxsetvec * sizeof(int)); - tmpset = (int *) malloc(maxsetvec * sizeof(int)); - if (setvec == NULL || tmpset == NULL) - overflo("out of space initializing makedfa"); ++ resizesetvec(__func__); + } + - if (compile_time) /* a constant for sure */ ++ if (compile_time != RUNNING) /* a constant for sure */ + return mkdfa(s, anchor); + for (i = 0; i < nfatab; i++) /* is it there already? */ + if (fatab[i]->anchor == anchor + && strcmp((const char *) fatab[i]->restr, s) == 0) { + fatab[i]->use = now++; + return fatab[i]; + } + pfa = mkdfa(s, anchor); + if (nfatab < NFA) { /* room for another */ + fatab[nfatab] = pfa; + fatab[nfatab]->use = now++; + nfatab++; + return pfa; + } + use = fatab[0]->use; /* replace least-recently used */ + nuse = 0; + for (i = 1; i < nfatab; i++) + if (fatab[i]->use < use) { + use = fatab[i]->use; + nuse = i; + } + freefa(fatab[nuse]); + fatab[nuse] = pfa; + pfa->use = now++; + return pfa; +} + - fa *mkdfa(const char *s, int anchor) /* does the real work of making a dfa */ - /* anchor = 1 for anchored matches, else 0 */ ++fa *mkdfa(const char *s, bool anchor) /* does the real work of making a dfa */ ++ /* anchor = true for anchored matches, else false */ +{ + Node *p, *p1; + fa *f; + - firstbasestr = (uschar *) s; ++ firstbasestr = (const uschar *) s; + basestr = firstbasestr; + p = reparse(s); + p1 = op2(CAT, op2(STAR, op2(ALL, NIL, NIL), NIL), p); + /* put ALL STAR in front of reg. exp. */ + p1 = op2(CAT, p1, op2(FINAL, NIL, NIL)); + /* put FINAL after reg. exp. */ + + poscnt = 0; + penter(p1); /* enter parent pointers and leaf indices */ - if ((f = (fa *) calloc(1, sizeof(fa) + poscnt*sizeof(rrow))) == NULL) - overflo("out of space for fa"); ++ if ((f = (fa *) calloc(1, sizeof(fa) + poscnt * sizeof(rrow))) == NULL) ++ overflo(__func__); + f->accept = poscnt-1; /* penter has computed number of positions in re */ + cfoll(f, p1); /* set up follow sets */ + freetr(p1); - if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL) - overflo("out of space in makedfa"); - if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL) - overflo("out of space in makedfa"); ++ resize_state(f, 1); ++ f->posns[0] = intalloc(*(f->re[0].lfollow), __func__); ++ f->posns[1] = intalloc(1, __func__); + *f->posns[1] = 0; + f->initstat = makeinit(f, anchor); + f->anchor = anchor; + f->restr = (uschar *) tostring(s); + if (firstbasestr != basestr) { + if (basestr) + xfree(basestr); + } + return f; +} + - int makeinit(fa *f, int anchor) ++int makeinit(fa *f, bool anchor) +{ + int i, k; + + f->curstat = 2; + f->out[2] = 0; - f->reset = 0; + k = *(f->re[0].lfollow); - xfree(f->posns[2]); - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in makeinit"); - for (i=0; i <= k; i++) { ++ xfree(f->posns[2]); ++ f->posns[2] = intalloc(k + 1, __func__); ++ for (i = 0; i <= k; i++) { + (f->posns[2])[i] = (f->re[0].lfollow)[i]; + } + if ((f->posns[2])[1] == f->accept) + f->out[2] = 1; - for (i=0; i < NCHARS; i++) ++ for (i = 0; i < NCHARS; i++) + f->gototab[2][i] = 0; + f->curstat = cgoto(f, 2, HAT); + if (anchor) { + *f->posns[2] = k-1; /* leave out position 0 */ - for (i=0; i < k; i++) { ++ for (i = 0; i < k; i++) { + (f->posns[0])[i] = (f->posns[2])[i]; + } + + f->out[0] = f->out[2]; + if (f->curstat != 2) + --(*f->posns[f->curstat]); + } + return f->curstat; +} + +void penter(Node *p) /* set up parent pointers and leaf indices */ +{ + switch (type(p)) { + ELEAF + LEAF + info(p) = poscnt; + poscnt++; + break; + UNARY + penter(left(p)); + parent(left(p)) = p; + break; + case CAT: + case OR: + penter(left(p)); + penter(right(p)); + parent(left(p)) = p; + parent(right(p)) = p; + break; ++ case ZERO: ++ break; + default: /* can't happen */ + FATAL("can't happen: unknown type %d in penter", type(p)); + break; + } +} + +void freetr(Node *p) /* free parse tree */ +{ + switch (type(p)) { + ELEAF + LEAF + xfree(p); + break; + UNARY ++ case ZERO: + freetr(left(p)); + xfree(p); + break; + case CAT: + case OR: + freetr(left(p)); + freetr(right(p)); + xfree(p); + break; + default: /* can't happen */ + FATAL("can't happen: unknown type %d in freetr", type(p)); + break; + } +} + +/* in the parsing of regular expressions, metacharacters like . have */ +/* to be seen literally; \056 is not a metacharacter. */ + - int hexstr(uschar **pp) /* find and eval hex string at pp, return new p */ ++int hexstr(const uschar **pp) /* find and eval hex string at pp, return new p */ +{ /* only pick up one 8-bit byte (2 chars) */ - uschar *p; ++ const uschar *p; + int n = 0; + int i; + - for (i = 0, p = (uschar *) *pp; i < 2 && isxdigit(*p); i++, p++) { ++ for (i = 0, p = *pp; i < 2 && isxdigit(*p); i++, p++) { + if (isdigit(*p)) + n = 16 * n + *p - '0'; + else if (*p >= 'a' && *p <= 'f') + n = 16 * n + *p - 'a' + 10; + else if (*p >= 'A' && *p <= 'F') + n = 16 * n + *p - 'A' + 10; + } - *pp = (uschar *) p; ++ *pp = p; + return n; +} + +#define isoctdigit(c) ((c) >= '0' && (c) <= '7') /* multiple use of arg */ + - int quoted(uschar **pp) /* pick up next thing after a \\ */ ++int quoted(const uschar **pp) /* pick up next thing after a \\ */ + /* and increment *pp */ +{ - uschar *p = *pp; ++ const uschar *p = *pp; + int c; + + if ((c = *p++) == 't') + c = '\t'; + else if (c == 'n') + c = '\n'; + else if (c == 'f') + c = '\f'; + else if (c == 'r') + c = '\r'; + else if (c == 'b') + c = '\b'; ++ else if (c == 'v') ++ c = '\v'; ++ else if (c == 'a') ++ c = '\a'; + else if (c == '\\') + c = '\\'; + else if (c == 'x') { /* hexadecimal goo follows */ + c = hexstr(&p); /* this adds a null if number is invalid */ + } else if (isoctdigit(c)) { /* \d \dd \ddd */ + int n = c - '0'; + if (isoctdigit(*p)) { + n = 8 * n + *p++ - '0'; + if (isoctdigit(*p)) + n = 8 * n + *p++ - '0'; + } + c = n; + } /* else */ + /* c = c; */ + *pp = p; + return c; +} + +static int collate_range_cmp(int a, int b) +{ + static char s[2][2]; + + if ((uschar)a == (uschar)b) + return 0; + s[0][0] = a; + s[1][0] = b; + return (strcoll(s[0], s[1])); +} + +char *cclenter(const char *argp) /* add a character class */ +{ - int i, c, c2; - int j; - uschar *p = (uschar *) argp; - uschar *op, *bp; ++ int i, c, c2, j; ++ const uschar *op, *p = (const uschar *) argp; ++ uschar *bp; + static uschar *buf = NULL; + static int bufsz = 100; + + op = p; + if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL) + FATAL("out of space for character class [%.10s...] 1", p); + bp = buf; + for (i = 0; (c = *p++) != 0; ) { + if (c == '\\') { + c = quoted(&p); + } else if (c == '-' && i > 0 && bp[-1] != 0) { + if (*p != 0) { + c = bp[-1]; + c2 = *p++; + if (c2 == '\\') + c2 = quoted(&p); + if (collate_range_cmp(c, c2) > 0) { + bp--; + i--; + continue; + } + for (j = 0; j < NCHARS; j++) { + if ((collate_range_cmp(c, j) > 0) || + collate_range_cmp(j, c2) > 0) + continue; + if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) + FATAL("out of space for character class [%.10s...] 2", p); + *bp++ = j; + i++; + } + continue; + } + } + if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter2")) + FATAL("out of space for character class [%.10s...] 3", p); + *bp++ = c; + i++; + } + *bp = 0; - dprintf( ("cclenter: in = |%s|, out = |%s|\n", op, buf) ); ++ DPRINTF("cclenter: in = |%s|, out = |%s|\n", op, buf); + xfree(op); + return (char *) tostring((char *) buf); +} + +void overflo(const char *s) +{ - FATAL("regular expression too big: %.30s...", s); ++ FATAL("regular expression too big: out of space in %.30s...", s); +} + +void cfoll(fa *f, Node *v) /* enter follow set of each leaf of vertex v into lfollow[leaf] */ +{ + int i; + int *p; + + switch (type(v)) { + ELEAF + LEAF + f->re[info(v)].ltype = type(v); + f->re[info(v)].lval.np = right(v); + while (f->accept >= maxsetvec) { /* guessing here! */ - maxsetvec *= 4; - setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); - tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == NULL || tmpset == NULL) - overflo("out of space in cfoll()"); ++ resizesetvec(__func__); + } + for (i = 0; i <= f->accept; i++) + setvec[i] = 0; + setcnt = 0; + follow(v); /* computes setvec and setcnt */ - if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL) - overflo("out of space building follow set"); ++ p = intalloc(setcnt + 1, __func__); + f->re[info(v)].lfollow = p; + *p = setcnt; + for (i = f->accept; i >= 0; i--) + if (setvec[i] == 1) + *++p = i; + break; + UNARY + cfoll(f,left(v)); + break; + case CAT: + case OR: + cfoll(f,left(v)); + cfoll(f,right(v)); + break; ++ case ZERO: ++ break; + default: /* can't happen */ + FATAL("can't happen: unknown type %d in cfoll", type(v)); + } +} + +int first(Node *p) /* collects initially active leaves of p into setvec */ + /* returns 0 if p matches empty string */ +{ + int b, lp; + + switch (type(p)) { + ELEAF + LEAF + lp = info(p); /* look for high-water mark of subscripts */ + while (setcnt >= maxsetvec || lp >= maxsetvec) { /* guessing here! */ - maxsetvec *= 4; - setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); - tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == NULL || tmpset == NULL) - overflo("out of space in first()"); ++ resizesetvec(__func__); + } + if (type(p) == EMPTYRE) { + setvec[lp] = 0; + return(0); + } + if (setvec[lp] != 1) { + setvec[lp] = 1; + setcnt++; + } + if (type(p) == CCL && (*(char *) right(p)) == '\0') + return(0); /* empty CCL */ - else return(1); ++ return(1); + case PLUS: - if (first(left(p)) == 0) return(0); ++ if (first(left(p)) == 0) ++ return(0); + return(1); + case STAR: + case QUEST: + first(left(p)); + return(0); + case CAT: + if (first(left(p)) == 0 && first(right(p)) == 0) return(0); + return(1); + case OR: + b = first(right(p)); + if (first(left(p)) == 0 || b == 0) return(0); + return(1); ++ case ZERO: ++ return 0; + } + FATAL("can't happen: unknown type %d in first", type(p)); /* can't happen */ + return(-1); +} + +void follow(Node *v) /* collects leaves that can follow v into setvec */ +{ + Node *p; + + if (type(v) == FINAL) + return; + p = parent(v); + switch (type(p)) { + case STAR: + case PLUS: + first(v); + follow(p); + return; + + case OR: + case QUEST: + follow(p); + return; + + case CAT: + if (v == left(p)) { /* v is left child of p */ + if (first(right(p)) == 0) { + follow(p); + return; + } + } else /* v is right child */ + follow(p); + return; + } +} + +int member(int c, const char *sarg) /* is c in s? */ +{ - uschar *s = (uschar *) sarg; ++ const uschar *s = (const uschar *) sarg; + + while (*s) + if (c == *s++) + return(1); + return(0); +} + +int match(fa *f, const char *p0) /* shortest match ? */ +{ + int s, ns; - uschar *p = (uschar *) p0; ++ const uschar *p = (const uschar *) p0; ++ ++ s = f->initstat; ++ assert (s < f->state_count); + - s = f->reset ? makeinit(f,0) : f->initstat; + if (f->out[s]) + return(1); + do { + /* assert(*p < NCHARS); */ + if ((ns = f->gototab[s][*p]) != 0) + s = ns; + else + s = cgoto(f, s, *p); + if (f->out[s]) + return(1); + } while (*p++ != 0); + return(0); +} + +int pmatch(fa *f, const char *p0) /* longest match, for sub */ +{ + int s, ns; - uschar *p = (uschar *) p0; - uschar *q; - int i, k; ++ const uschar *p = (const uschar *) p0; ++ const uschar *q; + - /* s = f->reset ? makeinit(f,1) : f->initstat; */ - if (f->reset) { - f->initstat = s = makeinit(f,1); - } else { - s = f->initstat; - } - patbeg = (char *) p; ++ s = f->initstat; ++ assert(s < f->state_count); ++ ++ patbeg = (const char *)p; + patlen = -1; + do { + q = p; + do { + if (f->out[s]) /* final state */ + patlen = q-p; + /* assert(*q < NCHARS); */ + if ((ns = f->gototab[s][*q]) != 0) + s = ns; + else + s = cgoto(f, s, *q); ++ ++ assert(s < f->state_count); ++ + if (s == 1) { /* no transition */ + if (patlen >= 0) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } + else + goto nextin; /* no match */ + } + } while (*q++ != 0); + if (f->out[s]) + patlen = q-p-1; /* don't count $ */ + if (patlen >= 0) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } + nextin: + s = 2; ++#if 0 /* XXX */ + if (f->reset) { + for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); ++n xfree(f->posns[i]); + k = *f->posns[0]; + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) + overflo("out of space in pmatch"); + for (i = 0; i <= k; i++) + (f->posns[2])[i] = (f->posns[0])[i]; + f->initstat = f->curstat = 2; + f->out[2] = f->out[0]; + for (i = 0; i < NCHARS; i++) + f->gototab[2][i] = 0; + } ++#endif + } while (*p++ != 0); + return (0); +} + +int nematch(fa *f, const char *p0) /* non-empty match, for sub */ +{ + int s, ns; - uschar *p = (uschar *) p0; - uschar *q; - int i, k; ++ const uschar *p = (const uschar *) p0; ++ const uschar *q; + - /* s = f->reset ? makeinit(f,1) : f->initstat; */ - if (f->reset) { - f->initstat = s = makeinit(f,1); - } else { - s = f->initstat; - } ++ s = f->initstat; ++ assert(s < f->state_count); ++ ++ patbeg = (const char *)p; + patlen = -1; + while (*p) { + q = p; + do { + if (f->out[s]) /* final state */ + patlen = q-p; + /* assert(*q < NCHARS); */ + if ((ns = f->gototab[s][*q]) != 0) + s = ns; + else + s = cgoto(f, s, *q); + if (s == 1) { /* no transition */ + if (patlen > 0) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } else + goto nnextin; /* no nonempty match */ + } + } while (*q++ != 0); + if (f->out[s]) + patlen = q-p-1; /* don't count $ */ + if (patlen > 0 ) { - patbeg = (char *) p; ++ patbeg = (const char *) p; + return(1); + } + nnextin: + s = 2; ++#if 0 /* XXX */ + if (f->reset) { + for (i = 2; i <= f->curstat; i++) + xfree(f->posns[i]); + k = *f->posns[0]; + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) + overflo("out of state space"); + for (i = 0; i <= k; i++) + (f->posns[2])[i] = (f->posns[0])[i]; + f->initstat = f->curstat = 2; + f->out[2] = f->out[0]; + for (i = 0; i < NCHARS; i++) + f->gototab[2][i] = 0; + } ++#endif + p++; + } + return (0); +} + ++ ++/* ++ * NAME ++ * fnematch ++ * ++ * DESCRIPTION ++ * A stream-fed version of nematch which transfers characters to a ++ * null-terminated buffer. All characters up to and including the last ++ * character of the matching text or EOF are placed in the buffer. If ++ * a match is found, patbeg and patlen are set appropriately. ++ * ++ * RETURN VALUES ++ * false No match found. ++ * true Match found. ++ */ ++ ++bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) ++{ ++ char *buf = *pbuf; ++ int bufsize = *pbufsize; ++ int c, i, j, k, ns, s; ++ ++ s = pfa->initstat; ++ patlen = 0; ++ ++ /* ++ * All indices relative to buf. ++ * i <= j <= k <= bufsize ++ * ++ * i: origin of active substring ++ * j: current character ++ * k: destination of next getc() ++ */ ++ i = -1, k = 0; ++ do { ++ j = i++; ++ do { ++ if (++j == k) { ++ if (k == bufsize) ++ if (!adjbuf((char **) &buf, &bufsize, bufsize+1, quantum, 0, "fnematch")) ++ FATAL("stream '%.30s...' too long", buf); ++ buf[k++] = (c = getc(f)) != EOF ? c : 0; ++ } ++ c = (uschar)buf[j]; ++ /* assert(c < NCHARS); */ ++ ++ if ((ns = pfa->gototab[s][c]) != 0) ++ s = ns; ++ else ++ s = cgoto(pfa, s, c); ++ ++ if (pfa->out[s]) { /* final state */ ++ patlen = j - i + 1; ++ if (c == 0) /* don't count $ */ ++ patlen--; ++ } ++ } while (buf[j] && s != 1); ++ s = 2; ++ } while (buf[i] && !patlen); ++ ++ /* adjbuf() may have relocated a resized buffer. Inform the world. */ ++ *pbuf = buf; ++ *pbufsize = bufsize; ++ ++ if (patlen) { ++ patbeg = (char *) buf + i; ++ /* ++ * Under no circumstances is the last character fed to ++ * the automaton part of the match. It is EOF's nullbyte, ++ * or it sent the automaton into a state with no further ++ * transitions available (s==1), or both. Room for a ++ * terminating nullbyte is guaranteed. ++ * ++ * ungetc any chars after the end of matching text ++ * (except for EOF's nullbyte, if present) and null ++ * terminate the buffer. ++ */ ++ do ++ if (buf[--k] && ungetc(buf[k], f) == EOF) ++ FATAL("unable to ungetc '%c'", buf[k]); ++ while (k > i + patlen); ++ buf[k] = '\0'; ++ return true; ++ } ++ else ++ return false; ++} ++ +Node *reparse(const char *p) /* parses regular expression pointed to by p */ +{ /* uses relex() to scan regular expression */ + Node *np; + - dprintf( ("reparse <%s>\n", p) ); - lastre = prestr = (uschar *) p; /* prestr points to string to be parsed */ ++ DPRINTF("reparse <%s>\n", p); ++ lastre = prestr = (const uschar *) p; /* prestr points to string to be parsed */ + rtok = relex(); + /* GNU compatibility: an empty regexp matches anything */ + if (rtok == '\0') { + /* FATAL("empty regular expression"); previous */ + return(op2(EMPTYRE, NIL, NIL)); + } + np = regexp(); + if (rtok != '\0') + FATAL("syntax error in regular expression %s at %s", lastre, prestr); + return(np); +} + +Node *regexp(void) /* top-level parse of reg expr */ +{ + return (alt(concat(primary()))); +} + +Node *primary(void) +{ + Node *np; + int savelastatom; + + switch (rtok) { + case CHAR: + lastatom = starttok; + np = op2(CHAR, NIL, itonp(rlxval)); + rtok = relex(); + return (unary(np)); + case ALL: + rtok = relex(); + return (unary(op2(ALL, NIL, NIL))); + case EMPTYRE: + rtok = relex(); + return (unary(op2(EMPTYRE, NIL, NIL))); + case DOT: + lastatom = starttok; *** 3688 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jul 8 02:30:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C5CC7660D90; Thu, 8 Jul 2021 02:30:18 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4GL0d64rtTz4pK3; Thu, 8 Jul 2021 02:30:18 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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: lwhsu/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 86F792A1F2; Thu, 8 Jul 2021 02:30:18 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by mail-yb1-f178.google.com with SMTP id r132so6512054yba.5; Wed, 07 Jul 2021 19:30:18 -0700 (PDT) X-Gm-Message-State: AOAM533+uO8B74j4+CbTnXzxmk3ZrYTzjJg+UkP064r3T5gjr9gBtAvV jKYpiv0MV8I6I1LenLMquOMDgGmiqEjqdj4iai8= X-Google-Smtp-Source: ABdhPJz+AjQNesJYGzkL3Bfa5pZ3DSqAQXmLAZmPRsweGd1hhA7bFZ02dE7w++se+gWO4cOW7XKIeOw8K+up8jUX+Hg= X-Received: by 2002:a25:34d1:: with SMTP id b200mr34319167yba.492.1625711417978; Wed, 07 Jul 2021 19:30:17 -0700 (PDT) MIME-Version: 1.0 References: <202107071122.167BMe50059361@gitrepo.freebsd.org> In-Reply-To: <202107071122.167BMe50059361@gitrepo.freebsd.org> From: Li-Wen Hsu Date: Thu, 8 Jul 2021 10:30:06 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d7955cc0ffdf - main - tcp: HPTS performance enhancements To: Randall Stewart Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 02:30:18 -0000 On Wed, Jul 7, 2021 at 7:22 PM Randall Stewart wrote: > > The branch main has been updated by rrs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d7955cc0ffdf9fb58013245a6f181c757574ea0a > > commit d7955cc0ffdf9fb58013245a6f181c757574ea0a > Author: Randall Stewart > AuthorDate: 2021-07-06 19:23:22 +0000 > Commit: Randall Stewart > CommitDate: 2021-07-07 11:22:35 +0000 > > tcp: HPTS performance enhancements > > HPTS drives both rack and bbr, and yet there have been many complaints > about performance. This bit of work restructures hpts to help reduce CPU > overhead. It does this by now instead of relying on the timer/callout to > drive it instead use user return from a system call as well as lro flushes > to drive hpts. The timer becomes a backstop that dynamically adjusts > based on how "late" we are. > > Reviewed by: tuexen, glebius > Sponsored by: Netflix Inc. > Differential Revision: https://reviews.freebsd.org/D31083 > --- > sys/kern/subr_trap.c | 10 + > sys/netinet/in_pcb.h | 4 +- > sys/netinet/tcp_hpts.c | 1309 +++++++++++++++++++++++++---------------- > sys/netinet/tcp_hpts.h | 99 +++- > sys/netinet/tcp_lro.c | 28 +- > sys/netinet/tcp_lro.h | 10 +- > sys/netinet/tcp_stacks/bbr.c | 6 +- > sys/netinet/tcp_stacks/rack.c | 22 +- > 8 files changed, 931 insertions(+), 557 deletions(-) Hi Randall. I think this breaks 32 bits platforms builds, for example: https://ci.freebsd.org/job/FreeBSD-main-i386-LINT/18214/console https://ci.freebsd.org/job/FreeBSD-main-armv7-LINT/1192/console Can you help check this? Thanks! Best, Li-Wen From owner-dev-commits-src-all@freebsd.org Thu Jul 8 05:10:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 301676626FD; Thu, 8 Jul 2021 05:10: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 4GL49s0wTSz5820; Thu, 8 Jul 2021 05:10: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 07DC91AAF8; Thu, 8 Jul 2021 05:10: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 1685AOHR079663; Thu, 8 Jul 2021 05:10:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1685AOAM079662; Thu, 8 Jul 2021 05:10:24 GMT (envelope-from git) Date: Thu, 8 Jul 2021 05:10:24 GMT Message-Id: <202107080510.1685AOAM079662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 427654eb6a14 - stable/12 - mergemaster: handle symbolic links during update. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 427654eb6a1435acb15c272731fd9518b11961d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 05:10:25 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=427654eb6a1435acb15c272731fd9518b11961d7 commit 427654eb6a1435acb15c272731fd9518b11961d7 Author: Warner Losh AuthorDate: 2020-11-18 19:22:24 +0000 Commit: Warner Losh CommitDate: 2021-07-08 05:10:05 +0000 mergemaster: handle symbolic links during update. /etc/os-release is now a symbolic link to a generated file. Make mergemaster cope with symbolic links generically. I'm no longer a big mergemaster user, so this has only been lightly tested by me, though Kimura-san has ran it through its paces. Submitted by: Yasushiro KIMURA-san PR: 242212 MFC After: 2 weeks (cherry picked from commit 30a56f9ef72705f2f3646ce4330cbc20675a465e) --- usr.sbin/mergemaster/mergemaster.sh | 118 +++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh index 9360ac98bdae..7703e2856111 100755 --- a/usr.sbin/mergemaster/mergemaster.sh +++ b/usr.sbin/mergemaster/mergemaster.sh @@ -1093,6 +1093,7 @@ for COMPFILE in `find . | sort` ; do fi done +# Compare regular files for COMPFILE in `find . -type f | sort`; do # First, check to see if the file exists in DESTDIR. If not, the @@ -1182,6 +1183,119 @@ for COMPFILE in `find . -type f | sort`; do fi # Yes, the file still remains to be checked done # This is for the for way up there at the beginning of the comparison +ask_answer_for_symbolic_link () { + HANDLE_COMPSYMLINK='' + while true; do + echo " Use 'd' to delete the temporary ${COMPSYMLINK}" + echo " Use 'i' to install the temporary ${COMPSYMLINK}" + echo '' + echo " Default is to leave the temporary symbolic link to deal with by hand" + echo '' + echo -n "How should I deal with this? [Leave it for later] " + read HANDLE_COMPSYMLINK + case ${HANDLE_COMPSYMLINK} in + ''|[dDiI]) + break + ;; + *) + echo "invalid choice: ${HANDLE_COMPSYMLINK}" + echo '' + HANDLE_COMPSYMLINK='' + ;; + esac + done +} + +install_symbolic_link () { + rm -f ${DESTDIR}${COMPSYMLINK#.} > /dev/null 2>&1 + if [ -L ${DESTDIR}${COMPSYMLINK#.} ]; then + return 1 + fi + cp -a ${COMPSYMLINK} ${DESTDIR}${COMPSYMLINK#.} > /dev/null 2>&1 + if [ ! -L ${DESTDIR}${COMPSYMLINK#.} ]; then + return 1 + fi + return 0 +} + +handle_symbolic_link () { + case ${HANDLE_COMPSYMLINK} in + [dD]) + rm ${COMPSYMLINK} + echo '' + echo " *** Deleting ${COMPSYMLINK}" + echo '' + return 1 + ;; + [iI]) + echo '' + if install_symbolic_link; then + rm ${COMPSYMLINK} + echo " *** ${COMPSYMLINK} installed successfully" + return 2 + else + echo " *** Problem installing ${COMPSYMLINK}, it will remain to merge by hand" + return 3 + fi + echo '' + ;; + '') + echo '' + echo " *** ${COMPSYMLINK} will remain for your consideration" + echo '' + return 0 + ;; + esac +} + +# Compare symblic links +for COMPSYMLINK in `find . -type l | sort`; do + if [ ! -L "${DESTDIR}${COMPSYMLINK#.}" ]; then + if [ -n "${AUTO_RUN}" -a -z "${AUTO_INSTALL}" ]; then + echo " *** ${COMPSYMLINK} will remain for your consideration" + continue + else + echo '' + echo " *** There is no installed version of ${COMPSYMLINK}" + echo '' + if [ -n "${AUTO_INSTALL}" ]; then + HANDLE_COMPSYMLINK="i" + else + ask_answer_for_symbolic_link + fi + handle_symbolic_link + if [ -n "${AUTO_INSTALL}" -a $? -eq 2 ]; then + AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPSYMLINK#.} +" + fi + fi + elif [ $(readlink ${COMPSYMLINK}) = $(readlink ${DESTDIR}${COMPSYMLINK#.}) ]; then + echo " *** Temp ${COMPSYMLINK} and installed are the same, deleting" + rm ${COMPSYMLINK} + else + if [ -n "${AUTO_RUN}" -a -z "${AUTO_UPGRADE}" ]; then + echo " *** ${COMPSYMLINK} will remain for your consideration" + continue + else + echo '' + echo " *** Target of temp symbolic link is differnt from that of installed one" + echo " Temp (${COMPSYMLINK}): $(readlink ${COMPSYMLINK})" + echo " Installed (${DESTDIR}${COMPSYMLINK#.})): $(readlink ${DESTDIR}${COMPSYMLINK#.})" + echo '' + if [ -n "${AUTO_UPGRADE}" ]; then + HANDLE_COMPSYMLINK="i" + else + ask_answer_for_symbolic_link + fi + handle_symbolic_link + if [ -n "${AUTO_UPGRADE}" -a $? -eq 2 ]; then + AUTO_UPGRADED_FILES="${AUTO_UPGRADED_FILES} ${DESTDIR}${COMPSYMLINK#.} +" + fi + fi + fi +done + echo '' echo "*** Comparison complete" @@ -1193,10 +1307,10 @@ fi echo '' -TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null` +TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 -or -type l 2>/dev/null` if [ -n "${TEST_FOR_FILES}" ]; then echo "*** Files that remain for you to merge by hand:" - find "${TEMPROOT}" -type f -size +0 | sort + find "${TEMPROOT}" -type f -size +0 -or -type l | sort echo '' case "${AUTO_RUN}" in From owner-dev-commits-src-all@freebsd.org Thu Jul 8 05:13:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9845C662EB9; Thu, 8 Jul 2021 05:13:29 +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 4GL4FP2vYxz58T4; Thu, 8 Jul 2021 05:13: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 4C3FF1AFE1; Thu, 8 Jul 2021 05:13: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 1685DTXF083957; Thu, 8 Jul 2021 05:13:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1685DTrK083956; Thu, 8 Jul 2021 05:13:29 GMT (envelope-from git) Date: Thu, 8 Jul 2021 05:13:29 GMT Message-Id: <202107080513.1685DTrK083956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 27e18c06f08b - stable/11 - mergemaster: handle symbolic links during update. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 27e18c06f08b413cd6d90922971194ae65921805 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 05:13:29 -0000 The branch stable/11 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=27e18c06f08b413cd6d90922971194ae65921805 commit 27e18c06f08b413cd6d90922971194ae65921805 Author: Warner Losh AuthorDate: 2020-11-18 19:22:24 +0000 Commit: Warner Losh CommitDate: 2021-07-08 05:13:18 +0000 mergemaster: handle symbolic links during update. /etc/os-release is now a symbolic link to a generated file. Make mergemaster cope with symbolic links generically. I'm no longer a big mergemaster user, so this has only been lightly tested by me, though Kimura-san has ran it through its paces. Submitted by: Yasushiro KIMURA-san PR: 242212 MFC After: 2 weeks (cherry picked from commit 30a56f9ef72705f2f3646ce4330cbc20675a465e) --- usr.sbin/mergemaster/mergemaster.sh | 118 +++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh index 086ee11db0f6..fdccf81802ea 100755 --- a/usr.sbin/mergemaster/mergemaster.sh +++ b/usr.sbin/mergemaster/mergemaster.sh @@ -1072,6 +1072,7 @@ for COMPFILE in `find . | sort` ; do fi done +# Compare regular files for COMPFILE in `find . -type f | sort`; do # First, check to see if the file exists in DESTDIR. If not, the @@ -1161,6 +1162,119 @@ for COMPFILE in `find . -type f | sort`; do fi # Yes, the file still remains to be checked done # This is for the for way up there at the beginning of the comparison +ask_answer_for_symbolic_link () { + HANDLE_COMPSYMLINK='' + while true; do + echo " Use 'd' to delete the temporary ${COMPSYMLINK}" + echo " Use 'i' to install the temporary ${COMPSYMLINK}" + echo '' + echo " Default is to leave the temporary symbolic link to deal with by hand" + echo '' + echo -n "How should I deal with this? [Leave it for later] " + read HANDLE_COMPSYMLINK + case ${HANDLE_COMPSYMLINK} in + ''|[dDiI]) + break + ;; + *) + echo "invalid choice: ${HANDLE_COMPSYMLINK}" + echo '' + HANDLE_COMPSYMLINK='' + ;; + esac + done +} + +install_symbolic_link () { + rm -f ${DESTDIR}${COMPSYMLINK#.} > /dev/null 2>&1 + if [ -L ${DESTDIR}${COMPSYMLINK#.} ]; then + return 1 + fi + cp -a ${COMPSYMLINK} ${DESTDIR}${COMPSYMLINK#.} > /dev/null 2>&1 + if [ ! -L ${DESTDIR}${COMPSYMLINK#.} ]; then + return 1 + fi + return 0 +} + +handle_symbolic_link () { + case ${HANDLE_COMPSYMLINK} in + [dD]) + rm ${COMPSYMLINK} + echo '' + echo " *** Deleting ${COMPSYMLINK}" + echo '' + return 1 + ;; + [iI]) + echo '' + if install_symbolic_link; then + rm ${COMPSYMLINK} + echo " *** ${COMPSYMLINK} installed successfully" + return 2 + else + echo " *** Problem installing ${COMPSYMLINK}, it will remain to merge by hand" + return 3 + fi + echo '' + ;; + '') + echo '' + echo " *** ${COMPSYMLINK} will remain for your consideration" + echo '' + return 0 + ;; + esac +} + +# Compare symblic links +for COMPSYMLINK in `find . -type l | sort`; do + if [ ! -L "${DESTDIR}${COMPSYMLINK#.}" ]; then + if [ -n "${AUTO_RUN}" -a -z "${AUTO_INSTALL}" ]; then + echo " *** ${COMPSYMLINK} will remain for your consideration" + continue + else + echo '' + echo " *** There is no installed version of ${COMPSYMLINK}" + echo '' + if [ -n "${AUTO_INSTALL}" ]; then + HANDLE_COMPSYMLINK="i" + else + ask_answer_for_symbolic_link + fi + handle_symbolic_link + if [ -n "${AUTO_INSTALL}" -a $? -eq 2 ]; then + AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES} ${DESTDIR}${COMPSYMLINK#.} +" + fi + fi + elif [ $(readlink ${COMPSYMLINK}) = $(readlink ${DESTDIR}${COMPSYMLINK#.}) ]; then + echo " *** Temp ${COMPSYMLINK} and installed are the same, deleting" + rm ${COMPSYMLINK} + else + if [ -n "${AUTO_RUN}" -a -z "${AUTO_UPGRADE}" ]; then + echo " *** ${COMPSYMLINK} will remain for your consideration" + continue + else + echo '' + echo " *** Target of temp symbolic link is differnt from that of installed one" + echo " Temp (${COMPSYMLINK}): $(readlink ${COMPSYMLINK})" + echo " Installed (${DESTDIR}${COMPSYMLINK#.})): $(readlink ${DESTDIR}${COMPSYMLINK#.})" + echo '' + if [ -n "${AUTO_UPGRADE}" ]; then + HANDLE_COMPSYMLINK="i" + else + ask_answer_for_symbolic_link + fi + handle_symbolic_link + if [ -n "${AUTO_UPGRADE}" -a $? -eq 2 ]; then + AUTO_UPGRADED_FILES="${AUTO_UPGRADED_FILES} ${DESTDIR}${COMPSYMLINK#.} +" + fi + fi + fi +done + echo '' echo "*** Comparison complete" @@ -1172,10 +1286,10 @@ fi echo '' -TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null` +TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 -or -type l 2>/dev/null` if [ -n "${TEST_FOR_FILES}" ]; then echo "*** Files that remain for you to merge by hand:" - find "${TEMPROOT}" -type f -size +0 | sort + find "${TEMPROOT}" -type f -size +0 -or -type l | sort echo '' case "${AUTO_RUN}" in From owner-dev-commits-src-all@freebsd.org Thu Jul 8 05:51:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DEC166633A5; Thu, 8 Jul 2021 05:51: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 4GL5565jdCz3F0m; Thu, 8 Jul 2021 05:51: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 ACBCF1B55A; Thu, 8 Jul 2021 05:51: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 1685pMlu035365; Thu, 8 Jul 2021 05:51:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1685pMOb035364; Thu, 8 Jul 2021 05:51:22 GMT (envelope-from git) Date: Thu, 8 Jul 2021 05:51:22 GMT Message-Id: <202107080551.1685pMOb035364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c978000da5c6 - stable/12 - Mount and unmount devfs around calls to add packages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c978000da5c6a909e16c0996a93d91068cafb03e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 05:51:22 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c978000da5c6a909e16c0996a93d91068cafb03e commit c978000da5c6a909e16c0996a93d91068cafb03e Author: Warner Losh AuthorDate: 2019-06-21 03:49:36 +0000 Commit: Warner Losh CommitDate: 2021-07-08 05:51:03 +0000 Mount and unmount devfs around calls to add packages. pkg now uses /dev/null for some of its operations. NanoBSD's packaging stuff didn't mount that for the chroot it ran in, so any config that added packages would see the error: pkg: Cannot open /dev/null:No such file or directory when trying to actually add those packages. It's easy enough for nanobsd to mount /dev and it won't hurt anything that was already working and may help things that weren't (like this). I moved the mount/unmount pair to be in the right push/pop order from the submitted patch. PR: 238727 Submitted by: mike tancsa Tested by: Karl Denninger (cherry picked from commit 804b78634d543667a37ac459e692fe42c9dd30e8) --- tools/tools/nanobsd/defaults.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 0002373be658..86acab65f67d 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -778,8 +778,9 @@ cust_pkgng ( ) ( # Mount packages into chroot mkdir -p ${NANO_WORLDDIR}/_.p mount -t nullfs -o noatime -o ro ${NANO_PACKAGE_DIR} ${NANO_WORLDDIR}/_.p + mount -t devfs devfs ${NANO_WORLDDIR}/dev - trap "umount ${NANO_WORLDDIR}/_.p ; rm -rf ${NANO_WORLDDIR}/_.p" 1 2 15 EXIT + trap "umount ${NANO_WORLDDIR}/dev; umount ${NANO_WORLDDIR}/_.p ; rm -rf ${NANO_WORLDDIR}/_.p" 1 2 15 EXIT # Install pkg-* package CR "${PKGCMD} add /_.p/${_NANO_PKG_PACKAGE}" @@ -804,6 +805,7 @@ cust_pkgng ( ) ( CR0 "${PKGCMD} info" trap - 1 2 15 EXIT + umount ${NANO_WORLDDIR}/dev umount ${NANO_WORLDDIR}/_.p rm -rf ${NANO_WORLDDIR}/_.p ) From owner-dev-commits-src-all@freebsd.org Thu Jul 8 06:44:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F0A8A663EDB; Thu, 8 Jul 2021 06:44:56 +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 4GL6Gw6Jj1z3M0G; Thu, 8 Jul 2021 06: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 C0E421C2BA; Thu, 8 Jul 2021 06: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 1686iufZ002782; Thu, 8 Jul 2021 06: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 1686iu9c002781; Thu, 8 Jul 2021 06:44:56 GMT (envelope-from git) Date: Thu, 8 Jul 2021 06:44:56 GMT Message-Id: <202107080644.1686iu9c002781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: a49f208d94b8 - main - intrng: Releasing interrupt source should clear interrupt table full state. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a49f208d94b873b2187adbfe1d785b3bc8bdc598 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 06:44:57 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=a49f208d94b873b2187adbfe1d785b3bc8bdc598 commit a49f208d94b873b2187adbfe1d785b3bc8bdc598 Author: Michal Meloun AuthorDate: 2021-07-02 18:17:36 +0000 Commit: Michal Meloun CommitDate: 2021-07-08 06:16:46 +0000 intrng: Releasing interrupt source should clear interrupt table full state. The first release of an interrupt in a situation where the interrupt table is full should schedule a full table check the next time an interrupt is allocated. A full check is necessary to ensure maximum separation between the order of allocation and the order of release. Submitted by: ehem_freebsd@m5p.com (initial version) Discussed in: https://reviews.freebsd.org/D29310 MFC after: 4 weeks --- sys/kern/subr_intr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index df6bf9e63ba0..d4926b2e2364 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -447,6 +447,16 @@ isrc_free_irq(struct intr_irqsrc *isrc) irq_sources[isrc->isrc_irq] = NULL; isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */ + + /* + * If we are recovering from the state irq_sources table is full, + * then the following allocation should check the entire table. This + * will ensure maximum separation of allocation order from release + * order. + */ + if (irq_next_free >= intr_nirq) + irq_next_free = 0; + return (0); } From owner-dev-commits-src-all@freebsd.org Thu Jul 8 06:58:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4800E664707; Thu, 8 Jul 2021 06:58:27 +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 4GL6ZW1Nlmz3MtD; Thu, 8 Jul 2021 06:58:27 +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 17FF01C6A9; Thu, 8 Jul 2021 06:58:27 +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 1686wRf3016204; Thu, 8 Jul 2021 06:58:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1686wQrP016203; Thu, 8 Jul 2021 06:58:26 GMT (envelope-from git) Date: Thu, 8 Jul 2021 06:58:26 GMT Message-Id: <202107080658.1686wQrP016203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: e88c3b1b02a6 - main - intrng: remove now redundant shadow variable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e88c3b1b02a663f18f51167f54a50e7b4f0eca02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 06:58:27 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=e88c3b1b02a663f18f51167f54a50e7b4f0eca02 commit e88c3b1b02a663f18f51167f54a50e7b4f0eca02 Author: Michal Meloun AuthorDate: 2021-07-02 18:28:25 +0000 Commit: Michal Meloun CommitDate: 2021-07-08 06:46:41 +0000 intrng: remove now redundant shadow variable. Should not be a functional change. Submitted by: ehem_freebsd@m5p.com Discussed in: https://reviews.freebsd.org/D29310 MFC after: 4 weeks --- sys/kern/subr_intr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index d4926b2e2364..04636f09c5a1 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -401,15 +401,14 @@ intr_isrc_dispatch(struct intr_irqsrc *isrc, struct trapframe *tf) static inline int isrc_alloc_irq(struct intr_irqsrc *isrc) { - u_int maxirqs, irq; + u_int irq; mtx_assert(&isrc_table_lock, MA_OWNED); - maxirqs = intr_nirq; - if (irq_next_free >= maxirqs) + if (irq_next_free >= intr_nirq) return (ENOSPC); - for (irq = irq_next_free; irq < maxirqs; irq++) { + for (irq = irq_next_free; irq < intr_nirq; irq++) { if (irq_sources[irq] == NULL) goto found; } @@ -418,7 +417,7 @@ isrc_alloc_irq(struct intr_irqsrc *isrc) goto found; } - irq_next_free = maxirqs; + irq_next_free = intr_nirq; return (ENOSPC); found: @@ -426,7 +425,7 @@ found: irq_sources[irq] = isrc; irq_next_free = irq + 1; - if (irq_next_free >= maxirqs) + if (irq_next_free >= intr_nirq) irq_next_free = 0; return (0); } From owner-dev-commits-src-all@freebsd.org Thu Jul 8 08:48:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7DAE2665E52; Thu, 8 Jul 2021 08:48: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 4GL90w2t8pz3snx; Thu, 8 Jul 2021 08:48: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 4AB3B1DEFF; Thu, 8 Jul 2021 08:48: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 1688m0je062408; Thu, 8 Jul 2021 08:48:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1688m0G7062407; Thu, 8 Jul 2021 08:48:00 GMT (envelope-from git) Date: Thu, 8 Jul 2021 08:48:00 GMT Message-Id: <202107080848.1688m0G7062407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 211cddf9e3a1 - main - pf: rename pf_state to pf_kstate 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/main X-Git-Reftype: branch X-Git-Commit: 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:48:00 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49 commit 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49 Author: Kristof Provost AuthorDate: 2021-07-06 09:42:20 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 08:31:43 +0000 pf: rename pf_state to pf_kstate Indicate that this is a kernel-only structure, and make it easier to distinguish from others used to communicate with userspace. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31096 --- sys/net/pfvar.h | 56 +++++++++++----------- sys/netpfil/pf/if_pfsync.c | 84 ++++++++++++++++----------------- sys/netpfil/pf/pf.c | 114 ++++++++++++++++++++++----------------------- sys/netpfil/pf/pf_ioctl.c | 42 ++++++++--------- sys/netpfil/pf/pf_norm.c | 4 +- sys/netpfil/pf/pf_nv.c | 2 +- sys/netpfil/pf/pf_nv.h | 2 +- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 1840c23bc937..f491e18b03a4 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -501,10 +501,10 @@ struct pf_state_key { u_int8_t pad[2]; LIST_ENTRY(pf_state_key) entry; - TAILQ_HEAD(, pf_state) states[2]; + TAILQ_HEAD(, pf_kstate) states[2]; }; -/* Keep synced with struct pf_state. */ +/* Keep synced with struct pf_kstate. */ struct pf_state_cmp { u_int64_t id; u_int32_t creatorid; @@ -521,16 +521,16 @@ struct pf_state_cmp { #define PFSTATE_SETMASK (PFSTATE_SETPRIO) #ifdef _KERNEL -struct pf_state { +struct pf_kstate { u_int64_t id; u_int32_t creatorid; u_int8_t direction; u_int8_t pad[3]; u_int refs; - TAILQ_ENTRY(pf_state) sync_list; - TAILQ_ENTRY(pf_state) key_list[2]; - LIST_ENTRY(pf_state) entry; + TAILQ_ENTRY(pf_kstate) sync_list; + TAILQ_ENTRY(pf_kstate) key_list[2]; + LIST_ENTRY(pf_kstate) entry; struct pf_state_peer src; struct pf_state_peer dst; union pf_krule_ptr rule; @@ -562,7 +562,7 @@ struct pf_state { /* * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. */ -_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); +_Static_assert(sizeof(struct pf_kstate) <= 312, "pf_kstate size crosses 312 bytes"); #endif /* @@ -623,11 +623,11 @@ struct pfsync_state { #ifdef _KERNEL /* pfsync */ typedef int pfsync_state_import_t(struct pfsync_state *, u_int8_t); -typedef void pfsync_insert_state_t(struct pf_state *); -typedef void pfsync_update_state_t(struct pf_state *); -typedef void pfsync_delete_state_t(struct pf_state *); +typedef void pfsync_insert_state_t(struct pf_kstate *); +typedef void pfsync_update_state_t(struct pf_kstate *); +typedef void pfsync_delete_state_t(struct pf_kstate *); typedef void pfsync_clear_states_t(u_int32_t, const char *); -typedef int pfsync_defer_t(struct pf_state *, struct mbuf *); +typedef int pfsync_defer_t(struct pf_kstate *, struct mbuf *); typedef void pfsync_detach_ifnet_t(struct ifnet *); VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); @@ -645,7 +645,7 @@ VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, - struct pf_state *); + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1474,7 +1474,7 @@ struct pf_keyhash { }; struct pf_idhash { - LIST_HEAD(, pf_state) states; + LIST_HEAD(, pf_kstate) states; struct mtx lock; }; @@ -1548,26 +1548,26 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_state *, u_int); +extern int pf_unlink_state(struct pf_kstate *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, - struct pf_state *); -extern struct pf_state *pf_alloc_state(int); -extern void pf_free_state(struct pf_state *); + struct pf_kstate *); +extern struct pf_kstate *pf_alloc_state(int); +extern void pf_free_state(struct pf_kstate *); static __inline void -pf_ref_state(struct pf_state *s) +pf_ref_state(struct pf_kstate *s) { refcount_acquire(&s->refs); } static __inline int -pf_release_state(struct pf_state *s) +pf_release_state(struct pf_kstate *s) { if (refcount_release(&s->refs)) { @@ -1578,7 +1578,7 @@ pf_release_state(struct pf_state *s) } static __inline int -pf_release_staten(struct pf_state *s, u_int n) +pf_release_staten(struct pf_kstate *s, u_int n) { if (refcount_releasen(&s->refs, n)) { @@ -1588,14 +1588,14 @@ pf_release_staten(struct pf_state *s, u_int n) return (0); } -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 *, +extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); +extern struct pf_kstate *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_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 *); +extern void pf_print_state(struct pf_kstate *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, u_int8_t); @@ -1626,7 +1626,7 @@ void pf_addr_inc(struct pf_addr *, sa_family_t); int pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *); #endif /* INET6 */ -u_int32_t pf_new_isn(struct pf_state *); +u_int32_t pf_new_isn(struct pf_kstate *); void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *, sa_family_t); void pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t); @@ -1637,7 +1637,7 @@ void pf_patch_16_unaligned(struct mbuf *, u_int16_t *, void *, u_int16_t, bool, u_int8_t); void pf_patch_32_unaligned(struct mbuf *, u_int16_t *, void *, u_int32_t, bool, u_int8_t); -void pf_send_deferred_syn(struct pf_state *); +void pf_send_deferred_syn(struct pf_kstate *); int pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *, struct pf_addr *, sa_family_t); int pf_match_addr_range(struct pf_addr *, struct pf_addr *, @@ -1648,14 +1648,14 @@ void pf_normalize_init(void); void pf_normalize_cleanup(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 *); +void pf_normalize_tcp_cleanup(struct pf_kstate *); int pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *); int pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *, - u_short *, struct tcphdr *, struct pf_state *, + u_short *, struct tcphdr *, struct pf_kstate *, struct pf_state_peer *, struct pf_state_peer *, int *); u_int32_t - pf_state_expires(const struct pf_state *); + pf_state_expires(const struct pf_kstate *); 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_kkif *, diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 16878fe87750..7208444d65d7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -115,7 +115,7 @@ struct pfsync_pkt { u_int8_t flags; }; -static int pfsync_upd_tcp(struct pf_state *, struct pfsync_state_peer *, +static int pfsync_upd_tcp(struct pf_kstate *, struct pfsync_state_peer *, struct pfsync_state_peer *); static int pfsync_in_clr(struct pfsync_pkt *, struct mbuf *, int, int); static int pfsync_in_ins(struct pfsync_pkt *, struct mbuf *, int, int); @@ -147,16 +147,16 @@ static int (*pfsync_acts[])(struct pfsync_pkt *, struct mbuf *, int, int) = { }; struct pfsync_q { - void (*write)(struct pf_state *, void *); + void (*write)(struct pf_kstate *, void *); size_t len; u_int8_t action; }; /* we have one of these for every PFSYNC_S_ */ -static void pfsync_out_state(struct pf_state *, void *); -static void pfsync_out_iack(struct pf_state *, void *); -static void pfsync_out_upd_c(struct pf_state *, void *); -static void pfsync_out_del(struct pf_state *, void *); +static void pfsync_out_state(struct pf_kstate *, void *); +static void pfsync_out_iack(struct pf_kstate *, void *); +static void pfsync_out_upd_c(struct pf_kstate *, void *); +static void pfsync_out_del(struct pf_kstate *, void *); static struct pfsync_q pfsync_qs[] = { { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_INS }, @@ -166,10 +166,10 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static void pfsync_q_ins(struct pf_state *, int, bool); -static void pfsync_q_del(struct pf_state *, bool, struct pfsync_bucket *); +static void pfsync_q_ins(struct pf_kstate *, int, bool); +static void pfsync_q_del(struct pf_kstate *, bool, struct pfsync_bucket *); -static void pfsync_update_state(struct pf_state *); +static void pfsync_update_state(struct pf_kstate *); struct pfsync_upd_req_item { TAILQ_ENTRY(pfsync_upd_req_item) ur_entry; @@ -182,7 +182,7 @@ struct pfsync_deferral { u_int pd_refs; struct callout pd_tmo; - struct pf_state *pd_st; + struct pf_kstate *pd_st; struct mbuf *pd_m; }; @@ -198,7 +198,7 @@ struct pfsync_bucket #define PFSYNCF_BUCKET_PUSH 0x00000001 size_t b_len; - TAILQ_HEAD(, pf_state) b_qs[PFSYNC_S_COUNT]; + TAILQ_HEAD(, pf_kstate) b_qs[PFSYNC_S_COUNT]; TAILQ_HEAD(, pfsync_upd_req_item) b_upd_req_list; TAILQ_HEAD(, pfsync_deferral) b_deferrals; u_int b_deferred; @@ -291,13 +291,13 @@ static int pfsyncoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); static int pfsyncioctl(struct ifnet *, u_long, caddr_t); -static int pfsync_defer(struct pf_state *, struct mbuf *); +static int pfsync_defer(struct pf_kstate *, struct mbuf *); static void pfsync_undefer(struct pfsync_deferral *, int); -static void pfsync_undefer_state(struct pf_state *, int); +static void pfsync_undefer_state(struct pf_kstate *, int); static void pfsync_defer_tmo(void *); static void pfsync_request_update(u_int32_t, u_int64_t); -static bool pfsync_update_state_req(struct pf_state *); +static bool pfsync_update_state_req(struct pf_kstate *); static void pfsync_drop(struct pfsync_softc *); static void pfsync_sendout(int, int); @@ -313,7 +313,7 @@ static void pfsync_detach_ifnet(struct ifnet *); static void pfsync_update_net_tdb(struct pfsync_tdb *); #endif static struct pfsync_bucket *pfsync_get_bucket(struct pfsync_softc *, - struct pf_state *); + struct pf_kstate *); #define PFSYNC_MAX_BULKTRIES 12 @@ -461,7 +461,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pfsync_state_key key[2]; #endif struct pfsync_state_key *kw, *ks; - struct pf_state *st = NULL; + struct pf_kstate *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_krule *r = NULL; struct pfi_kkif *kif; @@ -753,7 +753,7 @@ pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; - struct pf_state *s; + struct pf_kstate *s; relock: PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -812,7 +812,7 @@ static int pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_ins_ack *ia, *iaa; - struct pf_state *st; + struct pf_kstate *st; struct mbuf *mp; int len = count * sizeof(*ia); @@ -846,7 +846,7 @@ pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) } static int -pfsync_upd_tcp(struct pf_state *st, struct pfsync_state_peer *src, +pfsync_upd_tcp(struct pf_kstate *st, struct pfsync_state_peer *src, struct pfsync_state_peer *dst) { int sync = 0; @@ -884,7 +884,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int sync; struct mbuf *mp; @@ -970,7 +970,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_upd_c *ua, *up; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*up); int sync; struct mbuf *mp; @@ -1060,7 +1060,7 @@ pfsync_in_ureq(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) int len = count * sizeof(*ur); int i, offp; - struct pf_state *st; + struct pf_kstate *st; mp = m_pulldown(m, offset, len, &offp); if (mp == NULL) { @@ -1098,7 +1098,7 @@ pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_state *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1129,7 +1129,7 @@ pfsync_in_del_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { struct mbuf *mp; struct pfsync_del_c *sa, *sp; - struct pf_state *st; + struct pf_kstate *st; int len = count * sizeof(*sp); int offp, i; @@ -1480,7 +1480,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static void -pfsync_out_state(struct pf_state *st, void *buf) +pfsync_out_state(struct pf_kstate *st, void *buf) { struct pfsync_state *sp = buf; @@ -1488,7 +1488,7 @@ pfsync_out_state(struct pf_state *st, void *buf) } static void -pfsync_out_iack(struct pf_state *st, void *buf) +pfsync_out_iack(struct pf_kstate *st, void *buf) { struct pfsync_ins_ack *iack = buf; @@ -1497,7 +1497,7 @@ pfsync_out_iack(struct pf_state *st, void *buf) } static void -pfsync_out_upd_c(struct pf_state *st, void *buf) +pfsync_out_upd_c(struct pf_kstate *st, void *buf) { struct pfsync_upd_c *up = buf; @@ -1510,7 +1510,7 @@ pfsync_out_upd_c(struct pf_state *st, void *buf) } static void -pfsync_out_del(struct pf_state *st, void *buf) +pfsync_out_del(struct pf_kstate *st, void *buf) { struct pfsync_del_c *dp = buf; @@ -1522,7 +1522,7 @@ pfsync_out_del(struct pf_state *st, void *buf) static void pfsync_drop(struct pfsync_softc *sc) { - struct pf_state *st, *next; + struct pf_kstate *st, *next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b; int c, q; @@ -1562,7 +1562,7 @@ pfsync_sendout(int schedswi, int c) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st, *st_next; + struct pf_kstate *st, *st_next; struct pfsync_upd_req_item *ur; struct pfsync_bucket *b = &sc->sc_buckets[c]; int offset; @@ -1702,7 +1702,7 @@ pfsync_sendout(int schedswi, int c) } static void -pfsync_insert_state(struct pf_state *st) +pfsync_insert_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -1730,7 +1730,7 @@ pfsync_insert_state(struct pf_state *st) } static int -pfsync_defer(struct pf_state *st, struct mbuf *m) +pfsync_defer(struct pf_kstate *st, struct mbuf *m) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1778,7 +1778,7 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) { struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1804,7 +1804,7 @@ pfsync_defer_tmo(void *arg) struct pfsync_deferral *pd = arg; struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; - struct pf_state *st = pd->pd_st; + struct pf_kstate *st = pd->pd_st; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PFSYNC_BUCKET_LOCK_ASSERT(b); @@ -1828,7 +1828,7 @@ pfsync_defer_tmo(void *arg) } static void -pfsync_undefer_state(struct pf_state *st, int drop) +pfsync_undefer_state(struct pf_kstate *st, int drop) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; @@ -1851,14 +1851,14 @@ pfsync_undefer_state(struct pf_state *st, int drop) } static struct pfsync_bucket* -pfsync_get_bucket(struct pfsync_softc *sc, struct pf_state *st) +pfsync_get_bucket(struct pfsync_softc *sc, struct pf_kstate *st) { int c = PF_IDHASH(st) % pfsync_buckets; return &sc->sc_buckets[c]; } static void -pfsync_update_state(struct pf_state *st) +pfsync_update_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool sync = false, ref = true; @@ -1956,7 +1956,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) } static bool -pfsync_update_state_req(struct pf_state *st) +pfsync_update_state_req(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; bool ref = true, full = false; @@ -2003,7 +2003,7 @@ pfsync_update_state_req(struct pf_state *st) } static void -pfsync_delete_state(struct pf_state *st) +pfsync_delete_state(struct pf_kstate *st) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_bucket *b = pfsync_get_bucket(sc, st); @@ -2067,7 +2067,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname) } static void -pfsync_q_ins(struct pf_state *st, int q, bool ref) +pfsync_q_ins(struct pf_kstate *st, int q, bool ref) { struct pfsync_softc *sc = V_pfsyncif; size_t nlen = pfsync_qs[q].len; @@ -2097,7 +2097,7 @@ pfsync_q_ins(struct pf_state *st, int q, bool ref) } static void -pfsync_q_del(struct pf_state *st, bool unref, struct pfsync_bucket *b) +pfsync_q_del(struct pf_kstate *st, bool unref, struct pfsync_bucket *b) { int q = st->sync_state; @@ -2137,7 +2137,7 @@ static void pfsync_bulk_update(void *arg) { struct pfsync_softc *sc = arg; - struct pf_state *s; + struct pf_kstate *s; int i, sent = 0; PFSYNC_BLOCK_ASSERT(sc); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index ed273e6e0b6a..8fae01ce1c23 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -115,12 +115,12 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DEFINE(pf); SDT_PROBE_DEFINE4(pf, ip, test, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE4(pf, ip, test6, done, "int", "int", "struct pf_krule *", - "struct pf_state *"); + "struct pf_kstate *"); SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", "struct pf_state_key_cmp *", "int", "struct pf_pdesc *", - "struct pf_state *"); + "struct pf_kstate *"); /* * Global variables @@ -228,7 +228,7 @@ VNET_DEFINE(uint64_t, pf_stateid[MAXCPU]); #define PFID_MAXID (~PFID_CPUMASK) CTASSERT((1 << PFID_CPUBITS) >= MAXCPU); -static void pf_src_tree_remove_state(struct pf_state *); +static void pf_src_tree_remove_state(struct pf_kstate *); static void pf_init_threshold(struct pf_threshold *, u_int32_t, u_int32_t); static void pf_add_threshold(struct pf_threshold *); @@ -251,13 +251,13 @@ static void pf_send_tcp(struct mbuf *, u_int16_t, struct ifnet *); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, sa_family_t, struct pf_krule *); -static void pf_detach_state(struct pf_state *); +static void pf_detach_state(struct pf_kstate *); 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); + struct pf_state_key *, struct pf_kstate *); +static void pf_state_key_detach(struct pf_kstate *, 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 **, +static int pf_test_rule(struct pf_krule **, struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **, struct inpcb *); @@ -266,29 +266,29 @@ static int pf_create_state(struct pf_krule *, struct pf_krule *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kkif *, - struct pf_state **, int, u_int16_t, u_int16_t, + struct pf_kstate **, int, u_int16_t, u_int16_t, int); static int pf_test_fragment(struct pf_krule **, int, 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 pf_state_peer *, struct pf_kstate **, 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_state_peer *, struct pf_kstate **, struct pf_pdesc *, u_short *); -static int pf_test_state_tcp(struct pf_state **, int, +static int pf_test_state_tcp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_udp(struct pf_state **, int, +static int pf_test_state_udp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *); -static int pf_test_state_icmp(struct pf_state **, int, +static int pf_test_state_icmp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); -static int pf_test_state_other(struct pf_state **, int, +static int pf_test_state_other(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); @@ -298,15 +298,15 @@ static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, u_int8_t, sa_family_t); -static void pf_print_state_parts(struct pf_state *, +static void pf_print_state_parts(struct pf_kstate *, struct pf_state_key *, struct pf_state_key *); 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_kkif *, +static struct pf_kstate *pf_find_state(struct pfi_kkif *, struct pf_state_key_cmp *, u_int); -static int pf_src_connlimit(struct pf_state **); +static int pf_src_connlimit(struct pf_kstate **); static void pf_overload_task(void *v, int pending); static int pf_insert_src_node(struct pf_ksrc_node **, struct pf_krule *, struct pf_addr *, sa_family_t); @@ -316,14 +316,14 @@ 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_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, 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_krule *, int, - struct ifnet *, struct pf_state *, + struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ @@ -480,7 +480,7 @@ pf_hashsrc(struct pf_addr *addr, sa_family_t af) #ifdef ALTQ static int -pf_state_hash(struct pf_state *s) +pf_state_hash(struct pf_kstate *s) { u_int32_t hv = (intptr_t)s / sizeof(*s); @@ -543,7 +543,7 @@ pf_check_threshold(struct pf_threshold *threshold) } static int -pf_src_connlimit(struct pf_state **state) +pf_src_connlimit(struct pf_kstate **state) { struct pf_overload_entry *pfoe; int bad = 0; @@ -659,7 +659,7 @@ pf_overload_task(void *v, int pending) for (int i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; struct pf_state_key *sk; - struct pf_state *s; + struct pf_kstate *s; PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { @@ -844,7 +844,7 @@ pf_initialize() V_pf_hashseed = arc4random(); /* States and state keys storage. */ - V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_state), + V_pf_state_z = uma_zcreate("pf states", sizeof(struct pf_kstate), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_STATES].zone = V_pf_state_z; uma_zone_set_max(V_pf_state_z, PFSTATE_HIWAT); @@ -1007,11 +1007,11 @@ pf_get_mtag(struct mbuf *m) static int pf_state_key_attach(struct pf_state_key *skw, struct pf_state_key *sks, - struct pf_state *s) + struct pf_kstate *s) { struct pf_keyhash *khs, *khw, *kh; struct pf_state_key *sk, *cur; - struct pf_state *si, *olds = NULL; + struct pf_kstate *si, *olds = NULL; int idx; KASSERT(s->refs == 0, ("%s: state not pristine", __func__)); @@ -1172,7 +1172,7 @@ stateattach: } static void -pf_detach_state(struct pf_state *s) +pf_detach_state(struct pf_kstate *s) { struct pf_state_key *sks = s->key[PF_SK_STACK]; struct pf_keyhash *kh; @@ -1203,7 +1203,7 @@ pf_detach_state(struct pf_state *s) } static void -pf_state_key_detach(struct pf_state *s, int idx) +pf_state_key_detach(struct pf_kstate *s, int idx) { struct pf_state_key *sk = s->key[idx]; #ifdef INVARIANTS @@ -1268,10 +1268,10 @@ pf_state_key_clone(struct pf_state_key *orig) int pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, - struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) + struct pf_state_key *skw, struct pf_state_key *sks, struct pf_kstate *s) { struct pf_idhash *ih; - struct pf_state *cur; + struct pf_kstate *cur; int error; KASSERT(TAILQ_EMPTY(&sks->states[0]) && TAILQ_EMPTY(&sks->states[1]), @@ -1328,11 +1328,11 @@ pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif, /* * Find state by ID: returns with locked row on success. */ -struct pf_state * +struct pf_kstate * pf_find_state_byid(uint64_t id, uint32_t creatorid) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1353,12 +1353,12 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Find state by key. * Returns with ID hash slot locked on success. */ -static struct pf_state * +static struct pf_kstate * 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; - struct pf_state *s; + struct pf_kstate *s; int idx; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1397,12 +1397,12 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) return (NULL); } -struct pf_state * +struct pf_kstate * pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more) { struct pf_keyhash *kh; struct pf_state_key *sk; - struct pf_state *s, *ret = NULL; + struct pf_kstate *s, *ret = NULL; int idx, inout = 0; counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); @@ -1592,7 +1592,7 @@ pf_unload_vnet_purge(void) } u_int32_t -pf_state_expires(const struct pf_state *state) +pf_state_expires(const struct pf_kstate *state) { u_int32_t timeout; u_int32_t start; @@ -1656,7 +1656,7 @@ pf_purge_expired_src_nodes() } static void -pf_src_tree_remove_state(struct pf_state *s) +pf_src_tree_remove_state(struct pf_kstate *s) { struct pf_ksrc_node *sn; struct pf_srchash *sh; @@ -1693,7 +1693,7 @@ pf_src_tree_remove_state(struct pf_state *s) * unlocked, since it needs to go through key hash locking. */ int -pf_unlink_state(struct pf_state *s, u_int flags) +pf_unlink_state(struct pf_kstate *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; @@ -1740,7 +1740,7 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (pf_release_staten(s, 2)); } -struct pf_state * +struct pf_kstate * pf_alloc_state(int flags) { @@ -1748,7 +1748,7 @@ pf_alloc_state(int flags) } void -pf_free_state(struct pf_state *cur) +pf_free_state(struct pf_kstate *cur) { KASSERT(cur->refs == 0, ("%s: %p has refs", __func__, cur)); @@ -1767,7 +1767,7 @@ static u_int pf_purge_expired_states(u_int i, int maxcheck) { struct pf_idhash *ih; - struct pf_state *s; + struct pf_kstate *s; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -1925,13 +1925,13 @@ pf_print_host(struct pf_addr *addr, u_int16_t p, sa_family_t af) } void -pf_print_state(struct pf_state *s) +pf_print_state(struct pf_kstate *s) { pf_print_state_parts(s, NULL, NULL); } static void -pf_print_state_parts(struct pf_state *s, +pf_print_state_parts(struct pf_kstate *s, struct pf_state_key *skwp, struct pf_state_key *sksp) { struct pf_state_key *skw, *sks; @@ -3330,7 +3330,7 @@ pf_tcp_iss(struct pf_pdesc *pd) } static int -pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, +pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { @@ -3707,10 +3707,10 @@ 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_kkif *kif, struct pf_state **sm, + u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_kstate **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_ksrc_node *sn = NULL; struct tcphdr *th = &pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; @@ -4049,7 +4049,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, static int pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pfi_kkif *kif, struct mbuf *m, int off, + struct pf_kstate **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; @@ -4375,7 +4375,7 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, static int pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pf_pdesc *pd, u_short *reason) + struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { struct tcphdr *th = &pd->hdr.tcp; @@ -4445,7 +4445,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_kkif *kif, +pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { @@ -4613,7 +4613,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -4680,7 +4680,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_icmp(struct pf_kstate **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; @@ -5284,7 +5284,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, } static int -pf_test_state_other(struct pf_state **state, int direction, struct pfi_kkif *kif, +pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct mbuf *m, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -5456,7 +5456,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif, #ifdef INET static void 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 pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1; struct sockaddr_in dst; @@ -5644,7 +5644,7 @@ bad: #ifdef INET6 static void 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 pf_kstate *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0; struct sockaddr_in6 dst; @@ -5933,7 +5933,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * struct ip *h = NULL; struct m_tag *ipfwtag; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, dirndx, pqid = 0; @@ -6321,7 +6321,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb struct m_tag *mtag; struct ip6_hdr *h = NULL; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; - struct pf_state *s = NULL; + struct pf_kstate *s = NULL; struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 51781d488763..19b92e932052 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1957,7 +1957,7 @@ pf_label_match(const struct pf_krule *rule, const char *label) static unsigned int pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) { - struct pf_state *match; + struct pf_kstate *match; int more = 0; unsigned int killed = 0; @@ -1975,7 +1975,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) static int pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) { - struct pf_state *s; + struct pf_kstate *s; *** 165 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jul 8 08:48:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C0AF7665F0D; Thu, 8 Jul 2021 08:48:02 +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 4GL90y4fwhz3slx; Thu, 8 Jul 2021 08:48: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 875471DDC9; Thu, 8 Jul 2021 08:48:02 +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 1688m2jP062456; Thu, 8 Jul 2021 08:48:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1688m2Ff062455; Thu, 8 Jul 2021 08:48:02 GMT (envelope-from git) Date: Thu, 8 Jul 2021 08:48:02 GMT Message-Id: <202107080848.1688m2Ff062455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fa96701c8abb - main - pf: Handle errors returned by pf_killstates() 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/main X-Git-Reftype: branch X-Git-Commit: fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:48:02 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 commit fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 Author: Kristof Provost AuthorDate: 2021-07-05 12:21:03 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 08:32:42 +0000 pf: Handle errors returned by pf_killstates() Happily this wasn't a real bug, because pf_killstates() never fails, but we should check the return value anyway, in case it does ever start returning errors. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 19b92e932052..fece41e917e5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4887,6 +4887,8 @@ pf_killstates_nv(struct pfioc_nv *nv) ERROUT(error); error = pf_killstates(&kill, &killed); + if (error) + ERROUT(error); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-all@freebsd.org Thu Jul 8 08:48:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F0E56665F0A; Thu, 8 Jul 2021 08:48: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 4GL90x4PGlz3sx8; Thu, 8 Jul 2021 08:48: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 72A4C1DBF1; Thu, 8 Jul 2021 08:48: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 1688m102062432; Thu, 8 Jul 2021 08:48:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1688m1rI062431; Thu, 8 Jul 2021 08:48:01 GMT (envelope-from git) Date: Thu, 8 Jul 2021 08:48:01 GMT Message-Id: <202107080848.1688m1rI062431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8cceacc0f1ee - main - pf: Remove unneeded NULL check 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/main X-Git-Reftype: branch X-Git-Commit: 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:48:02 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20 commit 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20 Author: Kristof Provost AuthorDate: 2021-07-05 12:02:06 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 08:32:33 +0000 pf: Remove unneeded NULL check pidx is never NULL, and is used unconditionally later on in the function. Add an assertion, as documentation for the requirement to provide an idx pointer. Reported by: clang --analyze MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 5afc90e54d7c..4cfe5d61e83e 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -2177,6 +2177,8 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, struct pfr_kentry *ke, *ke2 = NULL; int idx = -1, use_counter = 0; + MPASS(pidx != NULL); + switch (af) { case AF_INET: uaddr.sin.sin_len = sizeof(struct sockaddr_in); @@ -2194,8 +2196,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) return (-1); - if (pidx != NULL) - idx = *pidx; + idx = *pidx; if (counter != NULL && idx >= 0) use_counter = 1; if (idx < 0) From owner-dev-commits-src-all@freebsd.org Thu Jul 8 08:52:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 93223665FDA; Thu, 8 Jul 2021 08:52:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (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 4GL96L3dyBz3t5d; Thu, 8 Jul 2021 08:52:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12c.google.com with SMTP id 8so1377855lfp.9; Thu, 08 Jul 2021 01:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZMMkSs+LTZpOXb7MNz8IqQ4LwDXrEyIKVgdsAGGhehM=; b=ocYonRddLnclkx1BstViADtdlTFPtf3QQyDUL3lGwh9r4KnInIHdth/peiqW2s+HrI O/lgeQtM2MF/ypCVSeC3MAufADifWvglA3j7hj6RJMiiVu2mw/clGTQ1nmsdvr9f1Mqo 0hXiiAGazTIv5aN/a6QRiU273WXjPnLqIn18U2myykA7KQTFtthbT0Utx57XMazLzi1Q B03XAG1j3hw1MBgG/aSFDs70qCp94//ncZsCvEaEoGehnE/N3Y3VZyBdo3MznQ7p5a1Q GhN1zGqCkrLvPe8x9t0YGE1HhG9awgAYxfbGF/P5FFPnDaIdn06PyG7/8XVLZ/TbuoGm NFOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZMMkSs+LTZpOXb7MNz8IqQ4LwDXrEyIKVgdsAGGhehM=; b=HTsszJhAtPgURxLKSRlFmuO1bh1bIgIBkTKvrNJnptwgzOXEIOq9xfLZX1x7+c3rL4 9dfn4PZl7eOUm1NOAu6tzo5qEj/zI4lUns9Xt0Y+UTdWtUSz+gjLHdSHXs1gvU5nuB2I M7lS0y69UqX1Esa0+9YAMB4mSsQSHv0arnDeVIL8MhwD2jVdYey4UZihFDzMZjOJQekn DdST96t03RE335EhtzUxthUuapXKVTSxdTAaht6uOEKrfuc/2K/IVd45hTxya4PaTplw v+Jl0ptw8jAsuk3i63KVA7mnNyrjh6yfB7sj+v8WwOO7cKXQryrToBDTEs9vGBnnT4M6 lRDA== X-Gm-Message-State: AOAM530f5Dnta9boBBiQbedAToFJzcfRHuEQsZbt+uISAErvIeI9Jka3 t34Tax9ceyuvfkAeyuORfboCkQLwju4WX/rDFBSXNsB6 X-Google-Smtp-Source: ABdhPJzln77xq17BcJSsDumyaKg/9guhAfHtMqlTyeJmVkaX3IZZeTGlyLLaSue1jL+Ps/wzCwDxwua5bTCQ23RSuhw= X-Received: by 2002:a05:651c:54f:: with SMTP id q15mr23765844ljp.347.1625734358550; Thu, 08 Jul 2021 01:52:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:9c8b:0:0:0:0:0 with HTTP; Thu, 8 Jul 2021 01:52:37 -0700 (PDT) In-Reply-To: <202107080848.1688m2Ff062455@gitrepo.freebsd.org> References: <202107080848.1688m2Ff062455@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 8 Jul 2021 10:52:37 +0200 Message-ID: Subject: Re: git: fa96701c8abb - main - pf: Handle errors returned by pf_killstates() To: Kristof Provost Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GL96L3dyBz3t5d 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:52:42 -0000 if it never fails it should return void On 7/8/21, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 > > commit fa96701c8abbc29aad7f8f8d6b823bd7f89c6c15 > Author: Kristof Provost > AuthorDate: 2021-07-05 12:21:03 +0000 > Commit: Kristof Provost > CommitDate: 2021-07-08 08:32:42 +0000 > > pf: Handle errors returned by pf_killstates() > > Happily this wasn't a real bug, because pf_killstates() never fails, > but > we should check the return value anyway, in case it does ever start > returning errors. > > Reported by: clang --analyze > MFC after: 1 week > Sponsored by: Rubicon Communications, LLC ("Netgate") > --- > sys/netpfil/pf/pf_ioctl.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c > index 19b92e932052..fece41e917e5 100644 > --- a/sys/netpfil/pf/pf_ioctl.c > +++ b/sys/netpfil/pf/pf_ioctl.c > @@ -4887,6 +4887,8 @@ pf_killstates_nv(struct pfioc_nv *nv) > ERROUT(error); > > error = pf_killstates(&kill, &killed); > + if (error) > + ERROUT(error); > > free(nvlpacked, M_NVLIST); > nvlpacked = NULL; > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Thu Jul 8 11:50:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EEE05668213; Thu, 8 Jul 2021 11:50:29 +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 4GLF3T6F76z4k11; Thu, 8 Jul 2021 11:50: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 BE16C205C1; Thu, 8 Jul 2021 11:50: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 168BoT3n011093; Thu, 8 Jul 2021 11:50:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168BoTSW011092; Thu, 8 Jul 2021 11:50:29 GMT (envelope-from git) Date: Thu, 8 Jul 2021 11:50:29 GMT Message-Id: <202107081150.168BoTSW011092@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: 1975b8347df6 - stable/13 - dummynet: fix sysctls 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/13 X-Git-Reftype: branch X-Git-Commit: 1975b8347df66301e4760df04f4fa74e8619fa07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 11:50:30 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1975b8347df66301e4760df04f4fa74e8619fa07 commit 1975b8347df66301e4760df04f4fa74e8619fa07 Author: Kristof Provost AuthorDate: 2021-07-01 07:42:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 06:46:45 +0000 dummynet: fix sysctls The sysctl nodes which use V_dn_cfg must be marked as CTLFLAG_VNET so that we use the correct per-vnet offset PR: 256819 Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30974 (cherry picked from commit 8f76eebce424de064f65fec5cdd105446a2de3bd) --- sys/netpfil/ipfw/ip_dn_io.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index 39bea3eb99dd..11357b44e05e 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -169,55 +169,55 @@ SYSCTL_PROC(_net_inet_ip_dummynet, OID_AUTO, pipe_byte_limit, 0, 0, sysctl_limits, "L", "Upper limit in bytes for pipe queue."); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, io_fast, - CTLFLAG_RW, DC(io_fast), 0, "Enable fast dummynet io."); + CTLFLAG_RW | CTLFLAG_VNET, DC(io_fast), 0, "Enable fast dummynet io."); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, debug, - CTLFLAG_RW, DC(debug), 0, "Dummynet debug level"); + CTLFLAG_RW | CTLFLAG_VNET, DC(debug), 0, "Dummynet debug level"); /* RED parameters */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_lookup_depth, - CTLFLAG_RD, DC(red_lookup_depth), 0, "Depth of RED lookup table"); + CTLFLAG_RD | CTLFLAG_VNET, DC(red_lookup_depth), 0, "Depth of RED lookup table"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_avg_pkt_size, - CTLFLAG_RD, DC(red_avg_pkt_size), 0, "RED Medium packet size"); + CTLFLAG_RD | CTLFLAG_VNET, DC(red_avg_pkt_size), 0, "RED Medium packet size"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_max_pkt_size, - CTLFLAG_RD, DC(red_max_pkt_size), 0, "RED Max packet size"); + CTLFLAG_RD | CTLFLAG_VNET, DC(red_max_pkt_size), 0, "RED Max packet size"); /* time adjustment */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta, - CTLFLAG_RD, DC(tick_delta), 0, "Last vs standard tick difference (usec)."); + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_delta), 0, "Last vs standard tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta_sum, - CTLFLAG_RD, DC(tick_delta_sum), 0, "Accumulated tick difference (usec)."); + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_delta_sum), 0, "Accumulated tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_adjustment, - CTLFLAG_RD, DC(tick_adjustment), 0, "Tick adjustments done."); + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_adjustment), 0, "Tick adjustments done."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_diff, - CTLFLAG_RD, DC(tick_diff), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_diff), 0, "Adjusted vs non-adjusted curr_time difference (ticks)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_lost, - CTLFLAG_RD, DC(tick_lost), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_lost), 0, "Number of ticks coalesced by dummynet taskqueue."); /* Drain parameters */ SYSCTL_UINT(_net_inet_ip_dummynet, OID_AUTO, expire, - CTLFLAG_RW, DC(expire), 0, "Expire empty queues/pipes"); + CTLFLAG_RW | CTLFLAG_VNET, DC(expire), 0, "Expire empty queues/pipes"); SYSCTL_UINT(_net_inet_ip_dummynet, OID_AUTO, expire_cycle, - CTLFLAG_RD, DC(expire_cycle), 0, "Expire cycle for queues/pipes"); + CTLFLAG_RD | CTLFLAG_VNET, DC(expire_cycle), 0, "Expire cycle for queues/pipes"); /* statistics */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, schk_count, - CTLFLAG_RD, DC(schk_count), 0, "Number of schedulers"); + CTLFLAG_RD | CTLFLAG_VNET, DC(schk_count), 0, "Number of schedulers"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, si_count, - CTLFLAG_RD, DC(si_count), 0, "Number of scheduler instances"); + CTLFLAG_RD | CTLFLAG_VNET, DC(si_count), 0, "Number of scheduler instances"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, fsk_count, - CTLFLAG_RD, DC(fsk_count), 0, "Number of flowsets"); + CTLFLAG_RD | CTLFLAG_VNET, DC(fsk_count), 0, "Number of flowsets"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, queue_count, - CTLFLAG_RD, DC(queue_count), 0, "Number of queues"); + CTLFLAG_RD | CTLFLAG_VNET, DC(queue_count), 0, "Number of queues"); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt, - CTLFLAG_RD, DC(io_pkt), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(io_pkt), 0, "Number of packets passed to dummynet."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_fast, - CTLFLAG_RD, DC(io_pkt_fast), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(io_pkt_fast), 0, "Number of packets bypassed dummynet scheduler."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop, - CTLFLAG_RD, DC(io_pkt_drop), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(io_pkt_drop), 0, "Number of packets dropped by dummynet."); #undef DC SYSEND From owner-dev-commits-src-all@freebsd.org Thu Jul 8 11:50:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1610A667BE0; Thu, 8 Jul 2021 11:50: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 4GLF3W00pfz4k13; Thu, 8 Jul 2021 11:50: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 DD83F20689; Thu, 8 Jul 2021 11:50: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 168BoUei011128; Thu, 8 Jul 2021 11:50:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168BoUPN011127; Thu, 8 Jul 2021 11:50:30 GMT (envelope-from git) Date: Thu, 8 Jul 2021 11:50:30 GMT Message-Id: <202107081150.168BoUPN011127@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: 4f5a2009ad8a - stable/13 - ftp-proxy: Revert incorrect migration to libpfctl 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/13 X-Git-Reftype: branch X-Git-Commit: 4f5a2009ad8ad98a457ddecb63fe1ed8a968226d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 11:50:31 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f5a2009ad8ad98a457ddecb63fe1ed8a968226d commit 4f5a2009ad8ad98a457ddecb63fe1ed8a968226d Author: Kristof Provost AuthorDate: 2021-07-01 15:16:10 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 06:46:54 +0000 ftp-proxy: Revert incorrect migration to libpfctl libpfctl supports creating rules, but not (yet) adding addresses to a pool. Adding addresses certainly does not work through adding a rule. PR: 256917 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8923ea6c867fd75b08b76883ec122c429a4018f9) --- contrib/pf/ftp-proxy/filter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index dad6324808bc..e4787985e99f 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -103,8 +103,7 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, - pfticket, pfpool_ticket)) + if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); pfrule.rpool.proxy_port[0] = nat_range_low; @@ -138,8 +137,7 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, - pfticket, pfpool_ticket)) + if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); pfrule.rpool.proxy_port[0] = rdr_port; From owner-dev-commits-src-all@freebsd.org Thu Jul 8 11:50:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BC8F6680D6; Thu, 8 Jul 2021 11:50: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 4GLF3W2P33z4k3V; Thu, 8 Jul 2021 11:50: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 3AAF420155; Thu, 8 Jul 2021 11:50: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 168BoVG6011211; Thu, 8 Jul 2021 11:50:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168BoVVw011210; Thu, 8 Jul 2021 11:50:31 GMT (envelope-from git) Date: Thu, 8 Jul 2021 11:50:31 GMT Message-Id: <202107081150.168BoVVw011210@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: aae1a783dd44 - stable/12 - dummynet: fix sysctls 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: aae1a783dd444060f9a9ed9cf0fbb0c3ba7c6800 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 11:50:31 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=aae1a783dd444060f9a9ed9cf0fbb0c3ba7c6800 commit aae1a783dd444060f9a9ed9cf0fbb0c3ba7c6800 Author: Kristof Provost AuthorDate: 2021-07-01 07:42:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 06:49:56 +0000 dummynet: fix sysctls The sysctl nodes which use V_dn_cfg must be marked as CTLFLAG_VNET so that we use the correct per-vnet offset PR: 256819 Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30974 (cherry picked from commit 8f76eebce424de064f65fec5cdd105446a2de3bd) --- sys/netpfil/ipfw/ip_dn_io.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index d276f85311d1..114cfac440ee 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -165,55 +165,55 @@ SYSCTL_PROC(_net_inet_ip_dummynet, OID_AUTO, pipe_byte_limit, CTLTYPE_LONG | CTLFLAG_RW, 0, 0, sysctl_limits, "L", "Upper limit in bytes for pipe queue."); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, io_fast, - CTLFLAG_RW, DC(io_fast), 0, "Enable fast dummynet io."); + CTLFLAG_RW | CTLFLAG_VNET, DC(io_fast), 0, "Enable fast dummynet io."); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, debug, - CTLFLAG_RW, DC(debug), 0, "Dummynet debug level"); + CTLFLAG_RW | CTLFLAG_VNET, DC(debug), 0, "Dummynet debug level"); /* RED parameters */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_lookup_depth, - CTLFLAG_RD, DC(red_lookup_depth), 0, "Depth of RED lookup table"); + CTLFLAG_RD | CTLFLAG_VNET, DC(red_lookup_depth), 0, "Depth of RED lookup table"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_avg_pkt_size, - CTLFLAG_RD, DC(red_avg_pkt_size), 0, "RED Medium packet size"); + CTLFLAG_RD | CTLFLAG_VNET, DC(red_avg_pkt_size), 0, "RED Medium packet size"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_max_pkt_size, - CTLFLAG_RD, DC(red_max_pkt_size), 0, "RED Max packet size"); + CTLFLAG_RD | CTLFLAG_VNET, DC(red_max_pkt_size), 0, "RED Max packet size"); /* time adjustment */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta, - CTLFLAG_RD, DC(tick_delta), 0, "Last vs standard tick difference (usec)."); + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_delta), 0, "Last vs standard tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta_sum, - CTLFLAG_RD, DC(tick_delta_sum), 0, "Accumulated tick difference (usec)."); + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_delta_sum), 0, "Accumulated tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_adjustment, - CTLFLAG_RD, DC(tick_adjustment), 0, "Tick adjustments done."); + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_adjustment), 0, "Tick adjustments done."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_diff, - CTLFLAG_RD, DC(tick_diff), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_diff), 0, "Adjusted vs non-adjusted curr_time difference (ticks)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_lost, - CTLFLAG_RD, DC(tick_lost), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(tick_lost), 0, "Number of ticks coalesced by dummynet taskqueue."); /* Drain parameters */ SYSCTL_UINT(_net_inet_ip_dummynet, OID_AUTO, expire, - CTLFLAG_RW, DC(expire), 0, "Expire empty queues/pipes"); + CTLFLAG_RW | CTLFLAG_VNET, DC(expire), 0, "Expire empty queues/pipes"); SYSCTL_UINT(_net_inet_ip_dummynet, OID_AUTO, expire_cycle, - CTLFLAG_RD, DC(expire_cycle), 0, "Expire cycle for queues/pipes"); + CTLFLAG_RD | CTLFLAG_VNET, DC(expire_cycle), 0, "Expire cycle for queues/pipes"); /* statistics */ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, schk_count, - CTLFLAG_RD, DC(schk_count), 0, "Number of schedulers"); + CTLFLAG_RD | CTLFLAG_VNET, DC(schk_count), 0, "Number of schedulers"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, si_count, - CTLFLAG_RD, DC(si_count), 0, "Number of scheduler instances"); + CTLFLAG_RD | CTLFLAG_VNET, DC(si_count), 0, "Number of scheduler instances"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, fsk_count, - CTLFLAG_RD, DC(fsk_count), 0, "Number of flowsets"); + CTLFLAG_RD | CTLFLAG_VNET, DC(fsk_count), 0, "Number of flowsets"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, queue_count, - CTLFLAG_RD, DC(queue_count), 0, "Number of queues"); + CTLFLAG_RD | CTLFLAG_VNET, DC(queue_count), 0, "Number of queues"); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt, - CTLFLAG_RD, DC(io_pkt), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(io_pkt), 0, "Number of packets passed to dummynet."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_fast, - CTLFLAG_RD, DC(io_pkt_fast), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(io_pkt_fast), 0, "Number of packets bypassed dummynet scheduler."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop, - CTLFLAG_RD, DC(io_pkt_drop), 0, + CTLFLAG_RD | CTLFLAG_VNET, DC(io_pkt_drop), 0, "Number of packets dropped by dummynet."); #undef DC SYSEND From owner-dev-commits-src-all@freebsd.org Thu Jul 8 11:50:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 28A8B667E3A; Thu, 8 Jul 2021 11:50: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 4GLF3X49Vvz4k3f; Thu, 8 Jul 2021 11:50: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 469D720635; Thu, 8 Jul 2021 11:50: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 168BoW3a011260; Thu, 8 Jul 2021 11:50:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168BoW7l011259; Thu, 8 Jul 2021 11:50:32 GMT (envelope-from git) Date: Thu, 8 Jul 2021 11:50:32 GMT Message-Id: <202107081150.168BoW7l011259@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: d442d97b7632 - stable/12 - ftp-proxy: Revert incorrect migration to libpfctl 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: d442d97b7632628ac3cf3e591ddbd8b872c14818 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 11:50:33 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d442d97b7632628ac3cf3e591ddbd8b872c14818 commit d442d97b7632628ac3cf3e591ddbd8b872c14818 Author: Kristof Provost AuthorDate: 2021-07-01 15:16:10 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 06:49:56 +0000 ftp-proxy: Revert incorrect migration to libpfctl libpfctl supports creating rules, but not (yet) adding addresses to a pool. Adding addresses certainly does not work through adding a rule. PR: 256917 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 8923ea6c867fd75b08b76883ec122c429a4018f9) --- contrib/pf/ftp-proxy/filter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index dad6324808bc..e4787985e99f 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -103,8 +103,7 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, - pfticket, pfpool_ticket)) + if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); pfrule.rpool.proxy_port[0] = nat_range_low; @@ -138,8 +137,7 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, - pfticket, pfpool_ticket)) + if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); pfrule.rpool.proxy_port[0] = rdr_port; From owner-dev-commits-src-all@freebsd.org Thu Jul 8 11:50:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F2FBF668063; Thu, 8 Jul 2021 11:50: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 4GLF3X2KZKz4kCm; Thu, 8 Jul 2021 11:50: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 0F048205C2; Thu, 8 Jul 2021 11:50: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 168BoV89011236; Thu, 8 Jul 2021 11:50:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168BoVfd011235; Thu, 8 Jul 2021 11:50:31 GMT (envelope-from git) Date: Thu, 8 Jul 2021 11:50:31 GMT Message-Id: <202107081150.168BoVfd011235@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: f6d448caf698 - stable/13 - pf tests: ftp-proxy test 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/13 X-Git-Reftype: branch X-Git-Commit: f6d448caf69889eca9e41a0815db65a22fe7652d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 11:50:33 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f6d448caf69889eca9e41a0815db65a22fe7652d commit f6d448caf69889eca9e41a0815db65a22fe7652d Author: Kristof Provost AuthorDate: 2021-07-01 15:15:36 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 06:47:09 +0000 pf tests: ftp-proxy test Basic test case for ftp-proxy PR: 256917 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit dd82fd3543022017b84007ac1a0d45fc683f9850) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/proxy.sh | 95 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index e21f78e761b6..b693ca63adcb 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -17,6 +17,7 @@ ATF_TESTS_SH+= anchor \ nat \ pass_block \ pfsync \ + proxy \ rdr \ route_to \ rules_counter \ diff --git a/tests/sys/netpfil/pf/proxy.sh b/tests/sys/netpfil/pf/proxy.sh new file mode 100644 index 000000000000..bb5286103e85 --- /dev/null +++ b/tests/sys/netpfil/pf/proxy.sh @@ -0,0 +1,95 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +common_dir=$(atf_get_srcdir)/../common + +atf_test_case "ftp" "cleanup" +ftp_head() +{ + atf_set descr 'Test ftp-proxy' + atf_set require.user root + atf_set require.progs twistd +} + +ftp_body() +{ + pft_init + + epair_client=$(vnet_mkepair) + epair_link=$(vnet_mkepair) + + ifconfig ${epair_client}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + vnet_mkjail fwd ${epair_client}b ${epair_link}a + jexec fwd ifconfig ${epair_client}b 192.0.2.1/24 up + jexec fwd ifconfig ${epair_link}a 198.51.100.1/24 up + jexec fwd ifconfig lo0 127.0.0.1/8 up + jexec fwd sysctl net.inet.ip.forwarding=1 + + vnet_mkjail srv ${epair_link}b + jexec srv ifconfig ${epair_link}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + + # Start FTP server in srv + jexec srv twistd ftp -r `pwd` -p 21 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + jexec fwd pfctl -e + pft_set_rules fwd \ + "nat on ${epair_link}a inet from 192.0.2.0/24 to any -> (${epair_link}a)" \ + "nat-anchor \"ftp-proxy/*\"" \ + "rdr-anchor \"ftp-proxy/*\"" \ + "rdr pass on ${epair_client}b proto tcp from 192.0.2.0/24 to any port 21 -> 127.0.0.1 port 8021" \ + "anchor \"ftp-proxy/*\"" \ + "pass out proto tcp from 127.0.0.1 to any port 21" + jexec fwd /usr/sbin/ftp-proxy + + # Create a dummy file to download + echo 'foo' > remote.txt + echo 'get remote.txt local.txt' | ftp -a 198.51.100.2 + + # Compare the downloaded file to the original + if ! diff -q local.txt remote.txt; + then + atf_fail 'Failed to retrieve file' + fi +} + +ftp_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "ftp" +} From owner-dev-commits-src-all@freebsd.org Thu Jul 8 11:50:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C7440667BE6; Thu, 8 Jul 2021 11:50: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 4GLF3Y4Mn6z4jxM; Thu, 8 Jul 2021 11:50: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 6FF34203CA; Thu, 8 Jul 2021 11:50: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 168BoXh8011338; Thu, 8 Jul 2021 11:50:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168BoX5v011337; Thu, 8 Jul 2021 11:50:33 GMT (envelope-from git) Date: Thu, 8 Jul 2021 11:50:33 GMT Message-Id: <202107081150.168BoX5v011337@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: e26de428fa54 - stable/12 - pf tests: ftp-proxy test 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: e26de428fa542c0fd62a696e2d721ff6f8dbc5db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 11:50:34 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e26de428fa542c0fd62a696e2d721ff6f8dbc5db commit e26de428fa542c0fd62a696e2d721ff6f8dbc5db Author: Kristof Provost AuthorDate: 2021-07-01 15:15:36 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 06:49:56 +0000 pf tests: ftp-proxy test Basic test case for ftp-proxy PR: 256917 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit dd82fd3543022017b84007ac1a0d45fc683f9850) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/proxy.sh | 95 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index f67f510fbf29..a8c5aac4af08 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -23,6 +23,7 @@ ATF_TESTS_SH+= anchor \ synproxy \ set_skip \ pfsync \ + proxy \ table \ tos diff --git a/tests/sys/netpfil/pf/proxy.sh b/tests/sys/netpfil/pf/proxy.sh new file mode 100644 index 000000000000..bb5286103e85 --- /dev/null +++ b/tests/sys/netpfil/pf/proxy.sh @@ -0,0 +1,95 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +common_dir=$(atf_get_srcdir)/../common + +atf_test_case "ftp" "cleanup" +ftp_head() +{ + atf_set descr 'Test ftp-proxy' + atf_set require.user root + atf_set require.progs twistd +} + +ftp_body() +{ + pft_init + + epair_client=$(vnet_mkepair) + epair_link=$(vnet_mkepair) + + ifconfig ${epair_client}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + vnet_mkjail fwd ${epair_client}b ${epair_link}a + jexec fwd ifconfig ${epair_client}b 192.0.2.1/24 up + jexec fwd ifconfig ${epair_link}a 198.51.100.1/24 up + jexec fwd ifconfig lo0 127.0.0.1/8 up + jexec fwd sysctl net.inet.ip.forwarding=1 + + vnet_mkjail srv ${epair_link}b + jexec srv ifconfig ${epair_link}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + + # Start FTP server in srv + jexec srv twistd ftp -r `pwd` -p 21 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + jexec fwd pfctl -e + pft_set_rules fwd \ + "nat on ${epair_link}a inet from 192.0.2.0/24 to any -> (${epair_link}a)" \ + "nat-anchor \"ftp-proxy/*\"" \ + "rdr-anchor \"ftp-proxy/*\"" \ + "rdr pass on ${epair_client}b proto tcp from 192.0.2.0/24 to any port 21 -> 127.0.0.1 port 8021" \ + "anchor \"ftp-proxy/*\"" \ + "pass out proto tcp from 127.0.0.1 to any port 21" + jexec fwd /usr/sbin/ftp-proxy + + # Create a dummy file to download + echo 'foo' > remote.txt + echo 'get remote.txt local.txt' | ftp -a 198.51.100.2 + + # Compare the downloaded file to the original + if ! diff -q local.txt remote.txt; + then + atf_fail 'Failed to retrieve file' + fi +} + +ftp_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "ftp" +} From owner-dev-commits-src-all@freebsd.org Thu Jul 8 12:16:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B1C18668ABB; Thu, 8 Jul 2021 12:16: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 4GLFds4HClz4qHR; Thu, 8 Jul 2021 12:16: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 6F3282096A; Thu, 8 Jul 2021 12:16: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 168CGnmv042719; Thu, 8 Jul 2021 12:16:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168CGnkl042718; Thu, 8 Jul 2021 12:16:49 GMT (envelope-from git) Date: Thu, 8 Jul 2021 12:16:49 GMT Message-Id: <202107081216.168CGnkl042718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 7312e4e5cfc8 - main - tcp: Fix 32 bit platform breakage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7312e4e5cfc8e48597acf17f4faa8159f0b5fa06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 12:16:49 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=7312e4e5cfc8e48597acf17f4faa8159f0b5fa06 commit 7312e4e5cfc8e48597acf17f4faa8159f0b5fa06 Author: Randall Stewart AuthorDate: 2021-07-08 11:06:58 +0000 Commit: Randall Stewart CommitDate: 2021-07-08 12:16:45 +0000 tcp: Fix 32 bit platform breakage This fixes the incorrect use of a sysctl add to u64. It was for a useconds time, but on 32 bit platforms its not a u64. Instead use the long directive. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D31107 --- sys/netinet/tcp_hpts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c index 9a390e3a85c8..9ec092f703ec 100644 --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -2208,10 +2208,10 @@ tcp_init_hptsi(void *st) OID_AUTO, "lastran", CTLFLAG_RD, &cts_last_ran[i], 0, "The last usec tick that this hpts ran"); - SYSCTL_ADD_U64(&hpts->hpts_ctx, + SYSCTL_ADD_LONG(&hpts->hpts_ctx, SYSCTL_CHILDREN(hpts->hpts_root), OID_AUTO, "cur_min_sleep", CTLFLAG_RD, - &hpts->p_mysleep.tv_usec, 0, + &hpts->p_mysleep.tv_usec, "What the running pacers is using for p_mysleep.tv_usec"); SYSCTL_ADD_U64(&hpts->hpts_ctx, SYSCTL_CHILDREN(hpts->hpts_root), From owner-dev-commits-src-all@freebsd.org Thu Jul 8 13:12:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4C19E66934F; Thu, 8 Jul 2021 13:12:02 +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 4GLGsZ1nBgz3Dkw; Thu, 8 Jul 2021 13:12: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 25CEF21A72; Thu, 8 Jul 2021 13:12:02 +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 168DC2MU022309; Thu, 8 Jul 2021 13:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168DC2dx022308; Thu, 8 Jul 2021 13:12:02 GMT (envelope-from git) Date: Thu, 8 Jul 2021 13:12:02 GMT Message-Id: <202107081312.168DC2dx022308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: c0edde302190 - main - Fix the name of the arm64 SCTLR_E0E register MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0edde3021900b80fec4e6360d97ba9d9e50d4fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 13:12:02 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c0edde3021900b80fec4e6360d97ba9d9e50d4fd commit c0edde3021900b80fec4e6360d97ba9d9e50d4fd Author: Andrew Turner AuthorDate: 2021-07-07 23:12:50 +0000 Commit: Andrew Turner CommitDate: 2021-07-07 23:18:04 +0000 Fix the name of the arm64 SCTLR_E0E register The character between the E's was the letter O, however in the Arm Documentation and XML the character is the number 0 (zero). Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/locore.S | 2 +- sys/arm64/include/armreg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 472a052e9903..a7e0c87bec0e 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -727,7 +727,7 @@ sctlr_set: SCTLR_M | SCTLR_CP15BEN) sctlr_clear: /* Bits to clear */ - .quad (SCTLR_EE | SCTLR_EOE | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ + .quad (SCTLR_EE | SCTLR_E0E | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \ SCTLR_ITD | SCTLR_A) LEND(start_mmu) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 8a2bbb60f3d0..58b6c2f637f0 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -831,7 +831,7 @@ #define SCTLR_IESB 0x00200000 /* ARMv8.2 */ /* Bit 22 is reserved */ #define SCTLR_SPAN 0x00800000 /* ARMv8.1 */ -#define SCTLR_EOE 0x01000000 +#define SCTLR_E0E 0x01000000 #define SCTLR_EE 0x02000000 #define SCTLR_UCI 0x04000000 #define SCTLR_EnDA 0x08000000 /* ARMv8.3 */ From owner-dev-commits-src-all@freebsd.org Thu Jul 8 14:00:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E3604669F26; Thu, 8 Jul 2021 14:00: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 4GLHy35Dm0z3JY8; Thu, 8 Jul 2021 14:00: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 9BDD122383; Thu, 8 Jul 2021 14:00: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 168E0xnU088313; Thu, 8 Jul 2021 14:00:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E0xrO088312; Thu, 8 Jul 2021 14:00:59 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:00:59 GMT Message-Id: <202107081400.168E0xrO088312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: e0c0612d9ba4 - main - setkey: ansify 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/main X-Git-Reftype: branch X-Git-Commit: e0c0612d9ba4b56e51ebca483f1f82d70d64f0f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:00 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e0c0612d9ba4b56e51ebca483f1f82d70d64f0f8 commit e0c0612d9ba4b56e51ebca483f1f82d70d64f0f8 Author: Mateusz Guzik AuthorDate: 2021-07-08 11:28:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 setkey: ansify --- sbin/setkey/setkey.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c index 1d66a92e0100..d011fd44a40a 100644 --- a/sbin/setkey/setkey.c +++ b/sbin/setkey/setkey.c @@ -91,7 +91,7 @@ extern int lineno; extern int parse(FILE **); void -usage() +usage(void) { printf("usage: setkey [-v] -c\n"); @@ -103,9 +103,7 @@ usage() } int -main(ac, av) - int ac; - char **av; +main(int ac, char **av) { FILE *fp = stdin; int c; @@ -202,7 +200,7 @@ main(ac, av) } int -get_supported() +get_supported(void) { if (pfkey_send_register(so, SADB_SATYPE_UNSPEC) < 0) @@ -234,7 +232,7 @@ sendkeyshort(u_int type, uint8_t satype) } void -promisc() +promisc(void) { struct sadb_msg msg; u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ @@ -300,9 +298,7 @@ promisc() } int -sendkeymsg(buf, len) - char *buf; - size_t len; +sendkeymsg(char *buf, size_t len) { u_char rbuf[1024 * 32]; /* XXX: Enough ? Should I do MSG_PEEK ? */ ssize_t l; @@ -374,9 +370,7 @@ end: } int -postproc(msg, len) - struct sadb_msg *msg; - int len; +postproc(struct sadb_msg *msg, int len) { if (msg->sadb_msg_errno != 0) { @@ -482,8 +476,7 @@ static const char *ipproto[] = { (((x) < sizeof(tab)/sizeof(tab[0]) && tab[(x)]) ? tab[(x)] : numstr(x)) const char * -numstr(x) - int x; +numstr(int x) { static char buf[20]; snprintf(buf, sizeof(buf), "#%d", x); @@ -491,15 +484,14 @@ numstr(x) } void -shortdump_hdr() +shortdump_hdr(void) { printf("%-4s %-3s %-1s %-8s %-7s %s -> %s\n", "time", "p", "s", "spi", "ltime", "src", "dst"); } void -shortdump(msg) - struct sadb_msg *msg; +shortdump(struct sadb_msg *msg) { caddr_t mhp[SADB_EXT_MAX + 1]; char buf[NI_MAXHOST], pbuf[NI_MAXSERV]; @@ -585,7 +577,7 @@ shortdump(msg) * Print the timestamp */ static void -printdate() +printdate(void) { struct timeval tp; int s; From owner-dev-commits-src-all@freebsd.org Thu Jul 8 14:01:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1E37466A2AA; Thu, 8 Jul 2021 14:01:02 +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 4GLHy608WDz3JVy; Thu, 8 Jul 2021 14:01: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 E0D3B22384; Thu, 8 Jul 2021 14:01: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 168E11Tw088361; Thu, 8 Jul 2021 14:01:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E119E088360; Thu, 8 Jul 2021 14:01:01 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:01:01 GMT Message-Id: <202107081401.168E119E088360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 1e67e3109d9d - main - setkey: drop an unused argument from postproc 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/main X-Git-Reftype: branch X-Git-Commit: 1e67e3109d9df74c9de60f0f6ee4d8f303c2d7bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:02 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1e67e3109d9df74c9de60f0f6ee4d8f303c2d7bd commit 1e67e3109d9df74c9de60f0f6ee4d8f303c2d7bd Author: Mateusz Guzik AuthorDate: 2021-07-08 11:31:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 setkey: drop an unused argument from postproc --- sbin/setkey/setkey.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c index 9e896996a259..d556a842f048 100644 --- a/sbin/setkey/setkey.c +++ b/sbin/setkey/setkey.c @@ -61,7 +61,7 @@ int get_supported(void); void sendkeyshort(u_int, uint8_t); void promisc(void); int sendkeymsg(char *, size_t); -int postproc(struct sadb_msg *, int); +int postproc(struct sadb_msg *); const char *numstr(int); void shortdump_hdr(void); void shortdump(struct sadb_msg *); @@ -355,7 +355,7 @@ again: kdebug_sadb((struct sadb_msg *)rbuf); printf("\n"); } - if (postproc(msg, l) < 0) + if (postproc(msg) < 0) break; } while (msg->sadb_msg_errno || msg->sadb_msg_seq); @@ -370,7 +370,7 @@ end: } int -postproc(struct sadb_msg *msg, int len) +postproc(struct sadb_msg *msg) { if (msg->sadb_msg_errno != 0) { From owner-dev-commits-src-all@freebsd.org Thu Jul 8 14:01:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EA895669F28; Thu, 8 Jul 2021 14:01: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 4GLHy46GZgz3Jf8; Thu, 8 Jul 2021 14:01: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 BE31E221B8; Thu, 8 Jul 2021 14:01: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 168E10Ss088337; Thu, 8 Jul 2021 14:01:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E10in088336; Thu, 8 Jul 2021 14:01:00 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:01:00 GMT Message-Id: <202107081401.168E10in088336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: b29817874d19 - main - setkey: fix several warnings popping up when compiling without WARNS=1 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/main X-Git-Reftype: branch X-Git-Commit: b29817874d19ce3e4e4c78e3cb74ebefe71f90cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:01 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b29817874d19ce3e4e4c78e3cb74ebefe71f90cc commit b29817874d19ce3e4e4c78e3cb74ebefe71f90cc Author: Mateusz Guzik AuthorDate: 2021-07-08 11:30:45 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 setkey: fix several warnings popping up when compiling without WARNS=1 --- sbin/setkey/setkey.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c index d011fd44a40a..9e896996a259 100644 --- a/sbin/setkey/setkey.c +++ b/sbin/setkey/setkey.c @@ -73,17 +73,17 @@ static int32_t gmt2local(time_t); #define MODE_CMDFLUSH 3 #define MODE_PROMISC 4 -int so; - -int f_forever = 0; -int f_all = 0; -int f_verbose = 0; -int f_mode = 0; -int f_cmddump = 0; -int f_policy = 0; -int f_hexdump = 0; -int f_tflag = 0; -int f_scope = 0; +static int so; + +static int f_forever = 0; +static int f_all = 0; +static int f_verbose = 0; +static int f_mode = 0; +static int f_cmddump = 0; +static int f_policy = 0; +static int f_hexdump = 0; +static int f_tflag = 0; +static int f_scope = 0; static time_t thiszone; extern int lineno; @@ -322,10 +322,10 @@ again: printf("\n"); } if (f_hexdump) { - int i; + size_t i; for (i = 0; i < len; i++) { if (i % 16 == 0) - printf("%08x: ", i); + printf("%08x: ", (u_int)i); printf("%02x ", buf[i] & 0xff); if (i % 16 == 15) printf("\n"); From owner-dev-commits-src-all@freebsd.org Thu Jul 8 14:01:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4D8CC669D49; Thu, 8 Jul 2021 14:01: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 4GLHy71Vfhz3JYF; Thu, 8 Jul 2021 14:01: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 0E12F22386; Thu, 8 Jul 2021 14:01: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 168E12lc088389; Thu, 8 Jul 2021 14:01:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168E12mq088388; Thu, 8 Jul 2021 14:01:02 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:01:02 GMT Message-Id: <202107081401.168E12mq088388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 19d6e29b8722 - main - pf: add pf_find_state_all_exists 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/main X-Git-Reftype: branch X-Git-Commit: 19d6e29b872232c47190344f3dfded2f73edd8ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:01:03 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=19d6e29b872232c47190344f3dfded2f73edd8ae commit 19d6e29b872232c47190344f3dfded2f73edd8ae Author: Mateusz Guzik AuthorDate: 2021-07-08 13:11:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-07-08 14:00:55 +0000 pf: add pf_find_state_all_exists Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf.c | 9 +++++++++ sys/netpfil/pf/pf_lb.c | 10 ++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index f491e18b03a4..7bbb585106c7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1591,6 +1591,8 @@ pf_release_staten(struct pf_kstate *s, u_int n) extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); +extern bool pf_find_state_all_exists(struct pf_state_key_cmp *, + u_int); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8fae01ce1c23..3ca921ff3287 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1453,6 +1453,15 @@ second_run: return (ret); } +bool +pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir) +{ + struct pf_kstate *s; + + s = pf_find_state_all(key, dir, NULL); + return (s != NULL); +} + /* END state table stuff */ static void diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 5e281eccc144..000ee69d9ae9 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -244,13 +244,13 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, * (traceroute -I through nat) */ key.port[1] = sport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = sport; return (0); } } else if (low == high) { key.port[1] = htons(low); - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(low); return (0); } @@ -268,8 +268,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, /* low <= cut <= high */ for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } @@ -277,8 +276,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, tmp = cut; for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } From owner-dev-commits-src-all@freebsd.org Thu Jul 8 14:23:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D260466A465; Thu, 8 Jul 2021 14:23: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 4GLJRm5MPTz3M45; Thu, 8 Jul 2021 14:23: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 965E922995; Thu, 8 Jul 2021 14:23: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 168ENGGa019476; Thu, 8 Jul 2021 14:23:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168ENGr6019475; Thu, 8 Jul 2021 14:23:16 GMT (envelope-from git) Date: Thu, 8 Jul 2021 14:23:16 GMT Message-Id: <202107081423.168ENGr6019475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 28f47a199cfd - main - pf: fallback if $pf_rules fails to load 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/main X-Git-Reftype: branch X-Git-Commit: 28f47a199cfd8749ab30a0327b0a3f8977ec2b43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 14:23:16 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=28f47a199cfd8749ab30a0327b0a3f8977ec2b43 commit 28f47a199cfd8749ab30a0327b0a3f8977ec2b43 Author: Thomas Steen Rasmussen AuthorDate: 2021-06-16 18:29:06 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 12:22:04 +0000 pf: fallback if $pf_rules fails to load Support loading a default pf ruleset in case of invalid pf.conf. If no pf rules are loaded pf will pass/allow all traffic, assuming the kernel is compiled without PF_DEFAULT_TO_DROP, as is the case in GENERIC. In other words: if there's a typo in the main pf_rules we would allow all traffic. The new default rules minimise the impact of this. If $pf_program (i.e. pfctl) fails to set $pf_fules and $pf_fallback_rules_enable is YES we will load $pf_fallback_rules_file if set, or $pf_fallback_rules. $pf_fallback_rules can include multiple rules, for example to permit traffic on a management interface. $pf_fallback_rules_enable defaults to "NO", preserving historic behaviour. man page changes by ceri@. PR: 256410 Reviewed by: donner, kp Sponsored by: semaphor.dk Differential Revision: https://reviews.freebsd.org/D30791 --- libexec/rc/rc.conf | 5 +++++ libexec/rc/rc.d/pf | 19 ++++++++++++++++++- share/man/man5/rc.conf.5 | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 9fdc4d9d8636..b392dae9ae6c 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -224,6 +224,11 @@ pf_rules="/etc/pf.conf" # rules definition file for pf (nonexistent # by default) pf_program="/sbin/pfctl" # where the pfctl program lives pf_flags="" # additional flags for pfctl +pf_fallback_rules_enable="NO" # fallback if loading ruleset fails +pf_fallback_rules="block drop log all" # rules to load on pf ruleset failure +#pf_fallback_rules="block drop log all +#pass quick on em4" # multi-rule +pf_fallback_rules_file="/etc/pf-fallback.conf" # rules file on ruleset failure pflog_enable="NO" # Set to YES to enable packet filter logging pflog_logfile="/var/log/pflog" # where pflogd should store the logfile pflog_program="/sbin/pflogd" # where the pflogd program lives diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf index 1f7394007667..fa1b49643cc5 100755 --- a/libexec/rc/rc.d/pf +++ b/libexec/rc/rc.d/pf @@ -23,11 +23,28 @@ extra_commands="check reload resync" required_files="$pf_rules" required_modules="pf" +pf_fallback() +{ + warn "Unable to load $pf_rules." + + if ! checkyesno pf_fallback_rules_enable; then + return + fi + + if [ -f $pf_fallback_rules_file ]; then + warn "Loading fallback rules file: $pf_fallback_rules_file" + $pf_program -f "$pf_fallback_rules_file" $pf_flags + else + warn "Loading fallback rules: $pf_fallback_rules" + echo $pf_fallback_rules | $pf_program -f - $pf_flags + fi +} + pf_start() { check_startmsgs && echo -n 'Enabling pf' $pf_program -F all > /dev/null 2>&1 - $pf_program -f "$pf_rules" $pf_flags + $pf_program -f "$pf_rules" $pf_flags || pf_fallback if ! $pf_program -s info | grep -q "Enabled" ; then $pf_program -eq fi diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 5692228c4db5..57404b8c0e89 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2021 +.Dd July 8, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -996,6 +996,42 @@ is set to these flags are passed to the .Xr pfctl 8 program when loading the ruleset. +.It Va pf_fallback_rules_enable +.Pq Vt bool +Set to +.Dq Li NO +by default. +Setting this to +.Dq Li YES +enables loading +.Va pf_fallback_rules_file +or +.Va pf_fallback_rules +in case of a problem when loading the ruleset in +.Va pf_rules . +.It Va pf_fallback_rules_file +.Pq Vt str +Path to a pf ruleset to load in case of failure when loading the +ruleset in +.Va pf_rules +(default +.Pa /etc/pf-fallback.conf ) . +.It Va pf_fallback_rules +.Pq Vt str +A pf ruleset to load in case of failure when loading the ruleset in +.Va pf_rules +and +.Va pf_fallback_rules_file +is not found. +Multiple rules can be set as follows: +.Bd -literal +pf_fallback_rules="\\ + block drop log all\\ + pass in quick on em0" +.Pp +.Ed +The default fallback rule is +.Dq block drop log all .It Va pflog_enable .Pq Vt bool Set to From owner-dev-commits-src-all@freebsd.org Thu Jul 8 16:18:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0A3E664E2ED; Thu, 8 Jul 2021 16:18: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 4GLM0H6rpCz3q0w; Thu, 8 Jul 2021 16:18: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 D21DF24192; Thu, 8 Jul 2021 16:18: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 168GI7h4066453; Thu, 8 Jul 2021 16:18:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168GI72c066452; Thu, 8 Jul 2021 16:18:07 GMT (envelope-from git) Date: Thu, 8 Jul 2021 16:18:07 GMT Message-Id: <202107081618.168GI72c066452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 61631b24a134 - main - iostat: fix rounding errors in iostat -x MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61631b24a1347a23cafe0657fba894622b1606e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 16:18:08 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=61631b24a1347a23cafe0657fba894622b1606e2 commit 61631b24a1347a23cafe0657fba894622b1606e2 Author: Alan Somers AuthorDate: 2021-07-08 16:16:32 +0000 Commit: Alan Somers CommitDate: 2021-07-08 16:16:32 +0000 iostat: fix rounding errors in iostat -x Better to round numbers instead of flooring them. MFC after: 3 weeks Sponsored by: Axcient --- usr.sbin/iostat/iostat.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index 4cbfcfcbcbd5..9140bf10ef07 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -888,17 +888,17 @@ devstats(int perf_select, long double etime, int havelast) mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { if (Iflag == 0) - printf("%-8.8s %7d %7d %8.1Lf " - "%8.1Lf %5d %5d %5d %5d " - "%4" PRIu64 " %3.0Lf ", + printf("%-8.8s %7.0Lf %7.0Lf %8.1Lf " + "%8.1Lf %5.0Lf %5.0Lf %5.0Lf %5.0Lf" + " %4" PRIu64 " %3.0Lf ", devicename, - (int)transfers_per_second_read, - (int)transfers_per_second_write, + transfers_per_second_read, + transfers_per_second_write, mb_per_second_read * 1024, mb_per_second_write * 1024, - (int)ms_per_read, (int)ms_per_write, - (int)ms_per_other, - (int)ms_per_transaction, + ms_per_read, ms_per_write, + ms_per_other, + ms_per_transaction, queue_len, busy_pct); else printf("%-8.8s %11.1Lf %11.1Lf " From owner-dev-commits-src-all@freebsd.org Thu Jul 8 16:53:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4507A6506EC for ; Thu, 8 Jul 2021 16:53:40 +0000 (UTC) (envelope-from ram.vegesna@broadcom.com) Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) (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 4GLMnH41dRz3vf3 for ; Thu, 8 Jul 2021 16:53:39 +0000 (UTC) (envelope-from ram.vegesna@broadcom.com) Received: by mail-ot1-x336.google.com with SMTP id 7-20020a9d0d070000b0290439abcef697so6493195oti.2 for ; Thu, 08 Jul 2021 09:53:39 -0700 (PDT) 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=MBrlef5veJUEsM6rCuPG+sdzR8xjZqRZzeGGwVolU6w=; b=CBeUiMMajeqvE8tjIIWpPj+0c6bMBPYhYT8465rr2NLJgS19DfJbDQeonpN5AqJovK DlLocxt+BmAnFPYQUJkUxOqRCGTGilmMRBCaPO6BUYWmJ7GzFrFmtvpRR7+JoZLvdACE +dgzbCld2hRFTK6Ps4ipM6+tjRzdImzr4fqzhl3QrrAEDKsvibIZpXUl3A8Gn/8TpVMx GEiIW7DdsQLYjmLRYFwoMUPreE86tHG6/ZLa0enRfGEnN0xnOBCjaO2P4L6T8EKDP+JR MPy7fp2QBwH/Tha5NqH1Z43qZW+5t1NYB4QPryQJAL6nSpiJhsrwy28Ul33HNvluVt07 7oEQ== X-Gm-Message-State: AOAM533jJ1R+sJdRYJhAhKcVp6grrAqswQaPI/u9/SMzPFazaLKRpRa0 Vf5BIK5Q7R49ay+430z0DLfWiYtQwzAKUGMM/MhEsU+StbDG4Zq/3q+c2niM/hBgjSZhQtflpPc pIcNtO/NhkROELgAkwfDaJjEw4wtpYQfo1xo= X-Google-Smtp-Source: ABdhPJzAGm0EHNkNSsejQA9yc3VmSKlE7GMjOcrnZPm6lzBaGS8mbRdJtqTe/2oGUhI5RjpVIoOmEG0Z8nTZi4lWK8g= X-Received: by 2002:a05:6830:1f55:: with SMTP id u21mr24360363oth.4.1625763217604; Thu, 08 Jul 2021 09:53:37 -0700 (PDT) MIME-Version: 1.0 References: <202107061548.166Fm2ol078877@gitrepo.freebsd.org> <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> In-Reply-To: <2b8685de-e94b-9413-b4fd-43526c7903d3@gmail.com> From: Ram Kishore Vegesna Date: Thu, 8 Jul 2021 22:23:26 +0530 Message-ID: Subject: Re: git: 29e2dbd42c3e - main - ocs_fc: Add gendump and dump_to_host ioctl command support. To: Alexander Motin Cc: Kristof Provost , Ram Kishore Vegesna , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000249fc305c69f7f6b" X-Rspamd-Queue-Id: 4GLMnH41dRz3vf3 X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.88 / 15.00]; TO_DN_SOME(0.00)[]; HAS_ATTACHMENT(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[broadcom.com:+]; DMARC_POLICY_ALLOW(0.00)[broadcom.com,quarantine]; DMARC_POLICY_ALLOW_WITH_FAILURES(-0.50)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::336:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[broadcom.com:s=google]; FROM_HAS_DN(0.00)[]; SIGNED_SMIME(-2.00)[]; NEURAL_SPAM_SHORT(1.00)[0.999]; NEURAL_HAM_LONG(-0.98)[-0.976]; MIME_GOOD(-0.20)[multipart/signed,multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::336:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::336:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 16:53:40 -0000 --000000000000249fc305c69f7f6b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry I missed that change. Alexander, Thanks for the fix. -Ram On Wed, Jul 7, 2021 at 12:34 AM Alexander Motin wrote: > On 06.07.2021 14:55, Kristof Provost wrote: > > On 6 Jul 2021, at 17:48, Ram Kishore Vegesna wrote: > > The branch main has been updated by ram: > > > > URL: > > > https://cgit.FreeBSD.org/src/commit/?id=3D29e2dbd42c3e2e10e606b3414f4d0c5= 3021d4e86 > > > > commit 29e2dbd42c3e2e10e606b3414f4d0c53021d4e86 > > Author: Ram Kishore Vegesna > > AuthorDate: 2021-06-24 07:05:00 +0000 > > Commit: Ram Kishore Vegesna > > CommitDate: 2021-07-06 15:38:11 +0000 > > > > ocs_fc: Add gendump and dump_to_host ioctl command support. > > > > Support to generate firmware dump. > > > > Approved by: mav(mentor) > > --- > > sys/dev/ocs_fc/ocs_gendump.c | 388 > > +++++++++++++++++++++++++++++++++++++++++++ > > sys/dev/ocs_fc/ocs_gendump.h | 42 +++++ > > sys/dev/ocs_fc/ocs_ioctl.c | 13 +- > > sys/dev/ocs_fc/ocs_ioctl.h | 3 + > > sys/dev/ocs_fc/ocs_mgmt.c | 152 ++--------------- > > sys/dev/ocs_fc/ocs_os.c | 3 +- > > sys/dev/ocs_fc/ocs_os.h | 3 +- > > sys/modules/ocs_fc/Makefile | 3 +- > > 8 files changed, 449 insertions(+), 158 deletions(-) > > > > I=E2=80=99m seeing this build failure (amd64, GENERIC kernel): > > > > |ld: error: undefined symbol: ocs_gen_dump >>> referenced by > > ocs_mgmt.c:485 (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:485) >>> > > ocs_mgmt.o:(ocs_mgmt_exec) ld: error: undefined symbol: ocs_dump_to_hos= t > >>>> referenced by ocs_mgmt.c:489 > > (/usr/src/sys/dev/ocs_fc/ocs_mgmt.c:489) >>> ocs_mgmt.o:(ocs_mgmt_exec) > > *** [kernel.full] Error code 1 | > > > > Does that ring any bells? > > d0732fa81963 should fix it. Sorry for breakage. > > -- > Alexander Motin > --=20 This electronic communication and the information and any files transmitted= =20 with it, or attached to it, are confidential and are intended solely for=20 the use of the individual or entity to whom it is addressed and may contain= =20 information that is confidential, legally privileged, protected by privacy= =20 laws, or otherwise restricted from disclosure to anyone else. If you are=20 not the intended recipient or the person responsible for delivering the=20 e-mail to the intended recipient, you are hereby notified that any use,=20 copying, distributing, dissemination, forwarding, printing, or copying of= =20 this e-mail is strictly prohibited. If you received this e-mail in error,= =20 please return the e-mail to the sender, delete it from your computer, and= =20 destroy any printed copy of it. --000000000000249fc305c69f7f6b Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQcgYJKoZIhvcNAQcCoIIQYzCCEF8CAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3JMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iYWxTaWduIEdDQyBS MyBQZXJzb25hbFNpZ24gMiBDQSAyMDIwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA vbCmXCcsbZ/a0fRIQMBxp4gJnnyeneFYpEtNydrZZ+GeKSMdHiDgXD1UnRSIudKo+moQ6YlCOu4t rVWO/EiXfYnK7zeop26ry1RpKtogB7/O115zultAz64ydQYLe+a1e/czkALg3sgTcOOcFZTXk38e aqsXsipoX1vsNurqPtnC27TWsA7pk4uKXscFjkeUE8JZu9BDKaswZygxBOPBQBwrA5+20Wxlk6k1 e6EKaaNaNZUy30q3ArEf30ZDpXyfCtiXnupjSK8WU2cK4qsEtj09JS4+mhi0CTCrCnXAzum3tgcH cHRg0prcSzzEUDQWoFxyuqwiwhHu3sPQNmFOMwIDAQABo4IB2jCCAdYwDgYDVR0PAQH/BAQDAgGG MGAGA1UdJQRZMFcGCCsGAQUFBwMCBggrBgEFBQcDBAYKKwYBBAGCNxQCAgYKKwYBBAGCNwoDBAYJ KwYBBAGCNxUGBgorBgEEAYI3CgMMBggrBgEFBQcDBwYIKwYBBQUHAxEwEgYDVR0TAQH/BAgwBgEB /wIBADAdBgNVHQ4EFgQUljPR5lgXWzR1ioFWZNW+SN6hj88wHwYDVR0jBBgwFoAUj/BLf6guRSSu TVD6Y5qL3uLdG7wwegYIKwYBBQUHAQEEbjBsMC0GCCsGAQUFBzABhiFodHRwOi8vb2NzcC5nbG9i YWxzaWduLmNvbS9yb290cjMwOwYIKwYBBQUHMAKGL2h0dHA6Ly9zZWN1cmUuZ2xvYmFsc2lnbi5j b20vY2FjZXJ0L3Jvb3QtcjMuY3J0MDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwuZ2xvYmFs c2lnbi5jb20vcm9vdC1yMy5jcmwwWgYDVR0gBFMwUTALBgkrBgEEAaAyASgwQgYKKwYBBAGgMgEo CjA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxzaWduLmNvbS9yZXBvc2l0b3J5LzAN BgkqhkiG9w0BAQsFAAOCAQEAdAXk/XCnDeAOd9nNEUvWPxblOQ/5o/q6OIeTYvoEvUUi2qHUOtbf jBGdTptFsXXe4RgjVF9b6DuizgYfy+cILmvi5hfk3Iq8MAZsgtW+A/otQsJvK2wRatLE61RbzkX8 9/OXEZ1zT7t/q2RiJqzpvV8NChxIj+P7WTtepPm9AIj0Keue+gS2qvzAZAY34ZZeRHgA7g5O4TPJ /oTd+4rgiU++wLDlcZYd/slFkaT3xg4qWDepEMjT4T1qFOQIL+ijUArYS4owpPg9NISTKa1qqKWJ jFoyms0d0GwOniIIbBvhI2MJ7BSY9MYtWVT5jJO3tsVHwj4cp92CSFuGwunFMzCCA18wggJHoAMC AQICCwQAAAAAASFYUwiiMA0GCSqGSIb3DQEBCwUAMEwxIDAeBgNVBAsTF0dsb2JhbFNpZ24gUm9v dCBDQSAtIFIzMRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTA5 MDMxODEwMDAwMFoXDTI5MDMxODEwMDAwMFowTDEgMB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENB IC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wggEiMA0GCSqG SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMJXaQeQZ4Ihb1wIO2hMoonv0FdhHFrYhy/EYCQ8eyip0E XyTLLkvhYIJG4VKrDIFHcGzdZNHr9SyjD4I9DCuul9e2FIYQebs7E4B3jAjhSdJqYi8fXvqWaN+J J5U4nwbXPsnLJlkNc96wyOkmDoMVxu9bi9IEYMpJpij2aTv2y8gokeWdimFXN6x0FNx04Druci8u nPvQu7/1PQDhBjPogiuuU6Y6FnOM3UEOIDrAtKeh6bJPkC4yYOlXy7kEkmho5TgmYHWyn3f/kRTv riBJ/K1AFUjRAjFhGV64l++td7dkmnq/X8ET75ti+w1s4FRpFqkD2m7pg5NxdsZphYIXAgMBAAGj QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSP8Et/qC5FJK5N UPpjmove4t0bvDANBgkqhkiG9w0BAQsFAAOCAQEAS0DbwFCq/sgM7/eWVEVJu5YACUGssxOGhigH M8pr5nS5ugAtrqQK0/Xx8Q+Kv3NnSoPHRHt44K9ubG8DKY4zOUXDjuS5V2yq/BKW7FPGLeQkbLmU Y/vcU2hnVj6DuM81IcPJaP7O2sJTqsyQiunwXUaMld16WCgaLx3ezQA3QY/tRG3XUyiXfvNnBB4V 14qWtNPeTCekTBtzc3b0F5nCH3oO4y0IrQocLP88q1UOD5F+NuvDV0m+4S4tfGCLw0FREyOdzvcy a5QBqJnnLDMfOjsl0oZAzjsshnjJYS8Uuu7bVW/fhO4FCU29KNhyztNiUGUe65KXgzHZs7XKR1g/ XzCCBVEwggQ5oAMCAQICDCHWmFjgp1UNrBuhLTANBgkqhkiG9w0BAQsFADBbMQswCQYDVQQGEwJC RTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTExMC8GA1UEAxMoR2xvYmFsU2lnbiBHQ0MgUjMg UGVyc29uYWxTaWduIDIgQ0EgMjAyMDAeFw0yMTAyMjIxMzIwNDlaFw0yMjA5MTgwNTQ0MjBaMIGU MQswCQYDVQQGEwJJTjESMBAGA1UECBMJS2FybmF0YWthMRIwEAYDVQQHEwlCYW5nYWxvcmUxFjAU BgNVBAoTDUJyb2FkY29tIEluYy4xHDAaBgNVBAMTE1JhbSBLaXNob3JlIFZlZ2VzbmExJzAlBgkq hkiG9w0BCQEWGHJhbS52ZWdlc25hQGJyb2FkY29tLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP ADCCAQoCggEBAKvDIuYw4Dw9iSL1FWdgKrhC9K2xqtq0FeHNKQGyTOZzJ6DsQDCaDqKL2D1XWMf2 XaIEnkjdCglht1PGBfTChSjLBKojnG2iBRze8NTHJV6oJsCZDXPPwdyJMXL/vMAkxAFqkDU078oO gufvsLigzOCQXAYp6HHt53iHtp06J16pJCY9fhdIcn7OcVYik2ofB7xDnb1HZOHNhkHdjdIaID0H Vxab43fOCbFozIOlzutBV4fhpWlA3FrVNhbPhbwO398TsV3gUkYHkxoS9kLeRXHnNcdOcFMo8Maz mQF6P67d881N/0Tt0k0MfXGTHytZvfFdayivzlL9nAnyXTzPFU8CAwEAAaOCAdkwggHVMA4GA1Ud DwEB/wQEAwIFoDCBowYIKwYBBQUHAQEEgZYwgZMwTgYIKwYBBQUHMAKGQmh0dHA6Ly9zZWN1cmUu Z2xvYmFsc2lnbi5jb20vY2FjZXJ0L2dzZ2NjcjNwZXJzb25hbHNpZ24yY2EyMDIwLmNydDBBBggr BgEFBQcwAYY1aHR0cDovL29jc3AuZ2xvYmFsc2lnbi5jb20vZ3NnY2NyM3BlcnNvbmFsc2lnbjJj YTIwMjAwTQYDVR0gBEYwRDBCBgorBgEEAaAyASgKMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8vd3d3 Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMAkGA1UdEwQCMAAwSQYDVR0fBEIwQDA+oDygOoY4 aHR0cDovL2NybC5nbG9iYWxzaWduLmNvbS9nc2djY3IzcGVyc29uYWxzaWduMmNhMjAyMC5jcmww IwYDVR0RBBwwGoEYcmFtLnZlZ2VzbmFAYnJvYWRjb20uY29tMBMGA1UdJQQMMAoGCCsGAQUFBwME MB8GA1UdIwQYMBaAFJYz0eZYF1s0dYqBVmTVvkjeoY/PMB0GA1UdDgQWBBQt2m9JVe4cejFw9Mog spXwL7sKWzANBgkqhkiG9w0BAQsFAAOCAQEAARwXxUTPdWpdSOs12BsNVMRlHdaahp3UNv1LW20i ps55UslOtXjHiznNQr5nyhmnkH0TLxn12NGEV0BnOmb70Ml2klfFLXTw73cp/mxM2eOZX5ho+f8v TuqwzxbJ+WAoFHzMJfevy9SEdovoE1TeBhc+IgZQR3zCkMt00bsKvKD0SmgNKiSmkHr+WbJCjCq7 tlkydEDuGjuSfbNzIcS0qLpqIHaSh/3WmF7TWzBJ8Ln1HwrvuMZ3Txksjsmpt34GFSubX+CGrYyW ORNGomSiW66FqRvj0iaYYbNTIfnU7/iJy3CN8Z5SvVroNAQbRfoooT/loWsoiUUNmTR9kebvLzGC Am0wggJpAgEBMGswWzELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExMTAv BgNVBAMTKEdsb2JhbFNpZ24gR0NDIFIzIFBlcnNvbmFsU2lnbiAyIENBIDIwMjACDCHWmFjgp1UN rBuhLTANBglghkgBZQMEAgEFAKCB1DAvBgkqhkiG9w0BCQQxIgQg+C3Ga0I10J4QPPCsoe8YhfhO ksQS08cKG2TNrws/v08wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcN MjEwNzA4MTY1MzM4WjBpBgkqhkiG9w0BCQ8xXDBaMAsGCWCGSAFlAwQBKjALBglghkgBZQMEARYw CwYJYIZIAWUDBAECMAoGCCqGSIb3DQMHMAsGCSqGSIb3DQEBCjALBgkqhkiG9w0BAQcwCwYJYIZI AWUDBAIBMA0GCSqGSIb3DQEBAQUABIIBAHNo4QUTVRmBcyc2qr+HOuajOpFrrKSvsfL5+275f7Px DrlCr5HWHEMVS4z2p/+mcE6UVQZ1gcn+fOT0BVo+Sn4Irexyc1bmLMWOjTli5Zm4BjpOSsudmH6y agi9nfUzbo9YH/9Ci3hOMYs7GEkeKR1kZa4pIKyRW992mDKcSRM32HdiCvZKEq8Hx7h2kTsiI0OR hbEFP9ivQU6dvopfbP3+qn+aZWtERt6QSQjXNgN/3RXWpJid2S/BjRBy6ojc6ky99yU6epRBSSsG fEXqFpBBxsXhEhBkPNe8Bb6W0/Q9EMHCoa6JhOTd0QJO4it3tQXmcKInm5ElxhhgJPhRrpA= --000000000000249fc305c69f7f6b-- From owner-dev-commits-src-all@freebsd.org Thu Jul 8 18:25:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5A3C9651C1C; Thu, 8 Jul 2021 18:25: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 4GLPqK1wPXz4ZcB; Thu, 8 Jul 2021 18:25: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 269F625D8B; Thu, 8 Jul 2021 18:25: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 168IPX1r040625; Thu, 8 Jul 2021 18:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168IPXki040624; Thu, 8 Jul 2021 18:25:33 GMT (envelope-from git) Date: Thu, 8 Jul 2021 18:25:33 GMT Message-Id: <202107081825.168IPXki040624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 34641052826c - main - pf: pf_killstates() never fails, so remove the return value 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/main X-Git-Reftype: branch X-Git-Commit: 34641052826c718566b994b75cd2bddb53a21583 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 18:25:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=34641052826c718566b994b75cd2bddb53a21583 commit 34641052826c718566b994b75cd2bddb53a21583 Author: Kristof Provost AuthorDate: 2021-07-08 08:54:16 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 16:56:29 +0000 pf: pf_killstates() never fails, so remove the return value Suggested by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index fece41e917e5..33eb0e15ea57 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -201,7 +201,7 @@ struct cdev *pf_dev; */ static void pf_clear_all_states(void); static unsigned int pf_clear_states(const struct pf_kstate_kill *); -static int pf_killstates(struct pf_kstate_kill *, +static void pf_killstates(struct pf_kstate_kill *, unsigned int *); static int pf_killstates_row(struct pf_kstate_kill *, struct pf_idhash *); @@ -2779,7 +2779,7 @@ DIOCCHANGERULE_error: break; psk->psk_killed = 0; - error = pf_killstates(&kill, &psk->psk_killed); + pf_killstates(&kill, &psk->psk_killed); break; } @@ -4834,7 +4834,7 @@ relock_DIOCCLRSTATES: return (killed); } -static int +static void pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) { struct pf_kstate *s; @@ -4847,13 +4847,13 @@ pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) pf_unlink_state(s, PF_ENTER_LOCKED); *killed = 1; } - return (0); + return; } for (unsigned int i = 0; i <= pf_hashmask; i++) *killed += pf_killstates_row(kill, &V_pf_idhash[i]); - return (0); + return; } static int @@ -4886,9 +4886,7 @@ pf_killstates_nv(struct pfioc_nv *nv) if (error) ERROUT(error); - error = pf_killstates(&kill, &killed); - if (error) - ERROUT(error); + pf_killstates(&kill, &killed); free(nvlpacked, M_NVLIST); nvlpacked = NULL; From owner-dev-commits-src-all@freebsd.org Thu Jul 8 18:25:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 71D29651C89; Thu, 8 Jul 2021 18:25: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 4GLPqL2Y2sz4ZrX; Thu, 8 Jul 2021 18:25: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 40C7225E9F; Thu, 8 Jul 2021 18:25: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 168IPYFQ040649; Thu, 8 Jul 2021 18:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168IPYLo040648; Thu, 8 Jul 2021 18:25:34 GMT (envelope-from git) Date: Thu, 8 Jul 2021 18:25:34 GMT Message-Id: <202107081825.168IPYLo040648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c5dd8bac0b96 - main - dummynet: reduce console spam 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/main X-Git-Reftype: branch X-Git-Commit: c5dd8bac0b96e11da02181bd1dbee677e270842d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 18:25:34 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c5dd8bac0b96e11da02181bd1dbee677e270842d commit c5dd8bac0b96e11da02181bd1dbee677e270842d Author: Luiz Otavio O Souza AuthorDate: 2016-02-11 13:35:01 +0000 Commit: Kristof Provost CommitDate: 2021-07-08 18:25:05 +0000 dummynet: reduce console spam Only print this warning when boot verbose is enabled. This can get pretty annoying (and useless) in some systems. Reviewed by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/ipfw/ip_dummynet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 56fa56138d96..d3242fd85817 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -169,7 +169,7 @@ ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg) op = "Clamp"; } else return *v; - if (op && msg) + if (op && msg && bootverbose) printf("%s %s to %d (was %d)\n", op, msg, *v, oldv); return *v; } From owner-dev-commits-src-all@freebsd.org Thu Jul 8 20:20:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CCD21653403; Thu, 8 Jul 2021 20:20: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 4GLSMw4Wrfz4mjR; Thu, 8 Jul 2021 20:20: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 7B474271E7; Thu, 8 Jul 2021 20:20: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 168KKSni096403; Thu, 8 Jul 2021 20:20:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168KKSWj096402; Thu, 8 Jul 2021 20:20:28 GMT (envelope-from git) Date: Thu, 8 Jul 2021 20:20:28 GMT Message-Id: <202107082020.168KKSWj096402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: bf3a385217ce - main - fan53555: attach to build and switch from syr827 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf3a385217ce4ea96f08559692dd55ec9431a628 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 20:20:28 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bf3a385217ce4ea96f08559692dd55ec9431a628 commit bf3a385217ce4ea96f08559692dd55ec9431a628 Author: Bjoern A. Zeeb AuthorDate: 2021-07-08 17:25:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-08 20:17:45 +0000 fan53555: attach to build and switch from syr827 Rather than extending syr827 for syr828 (as initially done in D31103) switch to the Fairchild Semiconductor Corporation fan53555 implementation which is in-tree but was not attached to the build. The fan53555 implementation also supports syr827/syr8278 already. [1] Update NOTES and the arm64 GENERIC configuration for the switch. syr827 for now stays in the tree but is not used by any kernel configuration. Suggested by: mmel [1] Reviewed by: mmel, manu Differential Revision: https://reviews.freebsd.org/D31112 --- sys/arm64/conf/GENERIC | 2 +- sys/conf/NOTES | 2 +- sys/conf/files | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 473578f8fbe1..f92a78f8e802 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -198,10 +198,10 @@ device iicmux device iic device icee # Generic IIC eeprom device twsi # Allwinner I2C controller +device fan53555 # Fairchild Semi FAN53555/SYR82x Regulator device pca9547 # NPX I2C bus multiplexer device pcf8563 # NXP Real-time clock/calendar device rk_i2c # RockChip I2C controller -device syr827 # Silergy SYR827 PMIC device sy8106a # SY8106A Buck Regulator device vf_i2c # Freescale Vybrid I2C controller device fsliic # Freescale iMX I2C controller diff --git a/sys/conf/NOTES b/sys/conf/NOTES index d7972c4a7e7a..a13882facce2 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2265,6 +2265,7 @@ device ds1307 # Dallas DS1307 RTC and compatible device ds13rtc # All Dallas/Maxim ds13xx chips device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature +device fan53555 # Fairchild Semi FAN53555/SYR82x Regulator device icee # AT24Cxxx and compatible EEPROMs device isl12xx # Intersil ISL12xx RTC device lm75 # LM75 compatible temperature sensor @@ -2272,7 +2273,6 @@ device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx device rtc8583 # Epson RTC-8583 device s35390a # Seiko Instruments S-35390A RTC device sy8106a # Silergy Corp. SY8106A buck regulator -device syr827 # Silergy Corp. DC/DC regulator # Parallel-Port Bus # diff --git a/sys/conf/files b/sys/conf/files index 94f4e92bb25c..22cf4db11695 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1881,6 +1881,7 @@ dev/iicbus/s35390a.c optional s35390a dev/iicbus/sy8106a.c optional sy8106a ext_resources fdt dev/iicbus/syr827.c optional syr827 ext_resources fdt dev/iicbus/gpio/tca6416.c optional tca6416 fdt +dev/iicbus/pmic/fan53555.c optional fan53555 ext_resources fdt dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir dev/iir/iir_pci.c optional iir pci From owner-dev-commits-src-all@freebsd.org Thu Jul 8 21:27:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 63421653D7E; Thu, 8 Jul 2021 21:27: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 4GLTsB2PjGz3CsR; Thu, 8 Jul 2021 21:27: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 3C2794C6; Thu, 8 Jul 2021 21:27: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 168LRQ4m081655; Thu, 8 Jul 2021 21:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168LRQVb081654; Thu, 8 Jul 2021 21:27:26 GMT (envelope-from git) Date: Thu, 8 Jul 2021 21:27:26 GMT Message-Id: <202107082127.168LRQVb081654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b29ebb9c65b3 - main - devmatch: Be tolerant of .ko being present. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b29ebb9c65b350e78aedfc790bfcaf9717059b70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 21:27:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b29ebb9c65b350e78aedfc790bfcaf9717059b70 commit b29ebb9c65b350e78aedfc790bfcaf9717059b70 Author: Warner Losh AuthorDate: 2021-07-08 19:44:21 +0000 Commit: Warner Losh CommitDate: 2021-07-08 21:22:22 +0000 devmatch: Be tolerant of .ko being present. We document that we did not need .ko on the module names in devmatch_blocklist, but we really needed them. Keep the documentation the same, but strip the .ko when we need to use the names so you can specify either. PR: 256240 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index dd61307a4e0a..f7f677b968e7 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -52,18 +52,23 @@ devmatch_start() [ -n "$list" ] || return - # While kldload can accept multiple modules - # on the line at once, we loop here in case - # there's some weird error with one of them. - # We also optimize against the false positives - # or drivers that have symbolic links that - # confuse devmatch by running it -n. - # Finally, we filter out all items in the - # devmatch_blocklist. + # While kldload can accept multiple modules on the line at once, we loop + # here in case there's some weird error with one of them. We also + # optimize against the false positives or drivers that have symbolic + # links that confuse devmatch by running it -n. Finally, we filter out + # all items in the devmatch_blocklist. + # + # We strip all the .ko suffixes off so that one may specify modules + # with or without .ko. Prior version documented it was without, while + # the code required it, so accept both now. devmatch produces module + # names with .ko + devctl freeze - x=$(echo ${devmatch_blocklist:-${devmatch_blacklist}} | tr ' ' '#') + x=$(echo '#'${devmatch_blocklist:-${devmatch_blacklist}}'#' | \ + sed -e "s/ /#/g;s/\.ko#/#/g") for m in ${list}; do - case "#${x}#" in + m="${m%.ko}" + case "${x}" in *"#${m}#"*) continue ;; esac echo "Autoloading module: ${m}" From owner-dev-commits-src-all@freebsd.org Thu Jul 8 21:27:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A7169653F21; Thu, 8 Jul 2021 21:27:27 +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 4GLTsC3nsXz3DCR; Thu, 8 Jul 2021 21:27:27 +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 66909531; Thu, 8 Jul 2021 21:27:27 +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 168LRRUM081679; Thu, 8 Jul 2021 21:27:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168LRRtm081678; Thu, 8 Jul 2021 21:27:27 GMT (envelope-from git) Date: Thu, 8 Jul 2021 21:27:27 GMT Message-Id: <202107082127.168LRRtm081678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5549c6a62f0f - main - devmatch: don't announce autoloading so much MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 21:27:27 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 commit 5549c6a62f0f4fc5d7e80973b28ebcf7f556edf8 Author: Warner Losh AuthorDate: 2021-07-08 19:53:18 +0000 Commit: Warner Losh CommitDate: 2021-07-08 21:22:22 +0000 devmatch: don't announce autoloading so much devmatch rc script would announce it was loading a module multiple times. It used kldload -n so it really wasn't loading it that many times, but the message is confusing. Use kldstat to see if we need to load the module before saying we do. This fixes the vast majority of the problems. It may be possible to race devmatch with a user invocation and devd, though quite hard. In that case we'll announce things twice, but still only load it once. No attempt is made to fix this. PR: 232782 MFC After: 2 weeks Sponsored by: Netflix --- libexec/rc/rc.d/devmatch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index f7f677b968e7..f5b8e8e51071 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -71,8 +71,8 @@ devmatch_start() case "${x}" in *"#${m}#"*) continue ;; esac - echo "Autoloading module: ${m}" - kldload -n ${m} + kldstat -q -n ${m} || \ + (echo "Autoloading module: ${m}"; kldload -n ${m}) done devctl thaw } From owner-dev-commits-src-all@freebsd.org Thu Jul 8 22:26:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8FFD0654BE4; Thu, 8 Jul 2021 22:26: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 4GLW9J3HVnz3NpJ; Thu, 8 Jul 2021 22:26: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 58C481035; Thu, 8 Jul 2021 22:26: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 168MQSTO061066; Thu, 8 Jul 2021 22:26:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168MQSwP061065; Thu, 8 Jul 2021 22:26:28 GMT (envelope-from git) Date: Thu, 8 Jul 2021 22:26:28 GMT Message-Id: <202107082226.168MQSwP061065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f00dd44f0a24 - stable/13 - devmatch: improve naming of devmatch config variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f00dd44f0a249019e5d4045c296bb17086c8f5e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 22:26:28 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f00dd44f0a249019e5d4045c296bb17086c8f5e2 commit f00dd44f0a249019e5d4045c296bb17086c8f5e2 Author: Ceri Davies AuthorDate: 2021-06-18 12:17:30 +0000 Commit: Warner Losh CommitDate: 2021-07-08 22:14:07 +0000 devmatch: improve naming of devmatch config variable Accept the old rc.conf variable if the new one is not present for compatability. Approved by: imp Differential Revision: https://reviews.freebsd.org/D30806 (cherry picked from commit c43b0081faab742eb93c3d064b552b65f926b86e) --- libexec/rc/rc.conf | 2 +- libexec/rc/rc.d/devmatch | 4 ++-- share/man/man5/rc.conf.5 | 10 +++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 53bd8c81c2d7..89bb8e65d7b8 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -45,7 +45,7 @@ ddb_config="/etc/ddb.conf" # ddb(8) config file. devd_enable="YES" # Run devd, to trigger programs on device tree changes. devd_flags="" # Additional flags for devd(8). devmatch_enable="YES" # Demand load kernel modules based on device ids. -devmatch_blacklist="" # List of modules (w/o .ko) to exclude from devmatch. +devmatch_blocklist="" # List of modules (w/o .ko) to exclude from devmatch. #kld_list="" # Kernel modules to load after local disks are mounted kldxref_enable="YES" # Build linker.hints files with kldxref(8). kldxref_clobber="NO" # Overwrite old linker.hints at boot. diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index 491bc94c4a16..0b2e3719dabb 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -59,9 +59,9 @@ devmatch_start() # or drivers that have symbolic links that # confuse devmatch by running it -n. # Finally, we filter out all items in the - # devmactch_blacklist. + # devmatch_blocklist. devctl freeze - x=$(echo ${devmatch_blacklist} | tr ' ' '#') + x=$(echo ${devmatch_blocklist:-${devmatch_blacklist}} | tr ' ' '#') for m in ${list}; do case "#${x}#" in *"#${m}#"*) continue ;; diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 473406660b8b..5f0022ca1a78 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 10, 2021 +.Dd July 8, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -257,8 +257,16 @@ If set to .Dq Li NO , disable auto-loading of kernel modules with .Xr devmatch 8 . +.It Va devmatch_blocklist +.Pq Vt str +A whitespace-separated list of kernel modules to be ignored by +.Xr devmatch 8 . .It Va devmatch_blacklist .Pq Vt str +This variable is deprecated. +Use +.Va devmatch_blocklist +instead. A whitespace-separated list of kernel modules to be ignored by .Xr devmatch 8 . .It Va kld_list From owner-dev-commits-src-all@freebsd.org Thu Jul 8 23:58:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4E037655F06; Thu, 8 Jul 2021 23:58: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 4GLYCK1prlz3v0p; Thu, 8 Jul 2021 23:58: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 222AB1EE6; Thu, 8 Jul 2021 23:58: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 168NwLq1081373; Thu, 8 Jul 2021 23:58:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 168NwKGa081372; Thu, 8 Jul 2021 23:58:20 GMT (envelope-from git) Date: Thu, 8 Jul 2021 23:58:20 GMT Message-Id: <202107082358.168NwKGa081372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 25a66f1fb177 - main - nanobsd: remove sparc64 embedded example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25a66f1fb177e0f3628f92f73b6ecf48a305d230 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 23:58:21 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=25a66f1fb177e0f3628f92f73b6ecf48a305d230 commit 25a66f1fb177e0f3628f92f73b6ecf48a305d230 Author: Warner Losh AuthorDate: 2021-07-08 23:55:20 +0000 Commit: Warner Losh CommitDate: 2021-07-08 23:56:54 +0000 nanobsd: remove sparc64 embedded example Remove the qemu sparc64 example. It was only ever compile tested since qemu had issues booting FreeBSD/sparc64. Also remove obsolete info about armv5 configs removed long ago. Sponsored by: Netflix --- tools/tools/nanobsd/embedded/README | 9 ------- tools/tools/nanobsd/embedded/qemu-sparc64.cfg | 36 --------------------------- 2 files changed, 45 deletions(-) diff --git a/tools/tools/nanobsd/embedded/README b/tools/tools/nanobsd/embedded/README index 78f6c31b2c6d..b77d3302d861 100644 --- a/tools/tools/nanobsd/embedded/README +++ b/tools/tools/nanobsd/embedded/README @@ -31,17 +31,8 @@ qemu-powerpc.cfg Create a bootable 32-bit powerpc image for qemu qemu-powerpc64.cfg Create a bootable 64-bit IBM-flavor image for qemu -qemu-sparc64.cfg Create a bootable sparc64 image for qemu rpi.cfg Create a bootable image for Raspberry Pi B rpi2.cfg Create a bootable image for Raspberry Pi2 -sam9260ek.cfg Create a bootable image for an Atmel SAM9260-EK - evaluation board (still needs a kernel loaded - into dataflash or NAND, so experimental). -sam9g20ek.cfg Create a bootable image for an Atmel SAM9G20-EK - evaluation board (still needs a kernel loaded - into dataflash or NAND, so experimental). Also - works on many after-market boards that are somewhat - compatible with the references board. QEMU command lines for serial console access diff --git a/tools/tools/nanobsd/embedded/qemu-sparc64.cfg b/tools/tools/nanobsd/embedded/qemu-sparc64.cfg deleted file mode 100644 index 9a63c9b42d55..000000000000 --- a/tools/tools/nanobsd/embedded/qemu-sparc64.cfg +++ /dev/null @@ -1,36 +0,0 @@ -# $FreeBSD$ - -#- -# Copyright (c) 2015 M. Warner Losh -# Copyright (c) 2010-2011 iXsystems, Inc. -# -# 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 iXsystems, Inc. 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. -# - -NANO_ARCH=sparc64 -NANO_KERNEL=GENERIC -NANO_DRIVE=ada0 -NANO_NAME=qemu-sparc64 - -. common # Pull in common definitions - -qemu_env From owner-dev-commits-src-all@freebsd.org Fri Jul 9 00:44:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C40A4656A88; Fri, 9 Jul 2021 00:44: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 4GLZD04k2rz4V9K; Fri, 9 Jul 2021 00:44: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 8A23529D9; Fri, 9 Jul 2021 00:44: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 1690i0Gq047696; Fri, 9 Jul 2021 00:44:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1690i00x047695; Fri, 9 Jul 2021 00:44:00 GMT (envelope-from git) Date: Fri, 9 Jul 2021 00:44:00 GMT Message-Id: <202107090044.1690i00x047695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 1e0a518d6548 - main - nfscl: Add a Linux compatible "nconnect" mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e0a518d65488caafff89a4ecba9cfb2be233379 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 00:44:00 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1e0a518d65488caafff89a4ecba9cfb2be233379 commit 1e0a518d65488caafff89a4ecba9cfb2be233379 Author: Rick Macklem AuthorDate: 2021-07-09 00:39:04 +0000 Commit: Rick Macklem CommitDate: 2021-07-09 00:39:04 +0000 nfscl: Add a Linux compatible "nconnect" mount option Linux has had an "nconnect" NFS mount option for some time. It specifies that N (up to 16) TCP connections are to created for a mount, instead of just one TCP connection. A discussion on freebsd-net@ indicated that this could improve client<-->server network bandwidth, if either the client or server have one of the following: - multiple network ports aggregated to-gether with lagg/lacp. - a fast NIC that is using multiple queues It does result in using more IP port#s and might increase server peak load for a client. One difference from the Linux implementation is that this implementation uses the first TCP connection for all RPCs composed of small messages and uses the additional TCP connections for RPCs that normally have large messages (Read/Readdir/Write). The Linux implementation spreads all RPCs across all TCP connections in a round robin fashion, whereas this implementation spreads Read/Readdir/Write across the additional TCP connections in a round robin fashion. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30970 --- sys/fs/nfs/nfs_commonkrpc.c | 70 ++++++++++++++++++++++++++++++++++------ sys/fs/nfs/nfs_commonsubs.c | 5 +-- sys/fs/nfs/nfs_var.h | 4 +-- sys/fs/nfsclient/nfs_clrpcops.c | 8 ++--- sys/fs/nfsclient/nfs_clvfsops.c | 66 ++++++++++++++++++++++++++++++------- sys/fs/nfsclient/nfsmount.h | 8 +++++ sys/fs/nfsserver/nfs_nfsdstate.c | 6 ++-- 7 files changed, 134 insertions(+), 33 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 63ff02331a0e..423ddb52494f 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -167,7 +167,8 @@ static int nfsv2_procid[NFS_V3NPROCS] = { */ int newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, - struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls) + struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls, + struct __rpc_client **clipp) { int rcvreserve, sndreserve; int pktscale, pktscalesav; @@ -420,15 +421,22 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, &timo); } + /* + * *clipp is &nrp->nr_client or &nm_aconn[nmp->nm_nextaconn]. + * The latter case is for additional connections specified by the + * "nconnect" mount option. nr_mtx etc is used for these additional + * connections, as well as nr_client in the nfssockreq + * structure for the mount. + */ mtx_lock(&nrp->nr_mtx); - if (nrp->nr_client != NULL) { + if (*clipp != NULL) { mtx_unlock(&nrp->nr_mtx); /* * Someone else already connected. */ CLNT_RELEASE(client); } else { - nrp->nr_client = client; + *clipp = client; /* * Protocols that do not require connections may be optionally * left unconnected for servers that reply from a port other @@ -453,18 +461,34 @@ out: * NFS disconnect. Clean up and unlink. */ void -newnfs_disconnect(struct nfssockreq *nrp) +newnfs_disconnect(struct nfsmount *nmp, struct nfssockreq *nrp) { - CLIENT *client; + CLIENT *client, *aconn[NFS_MAXNCONN - 1]; + int i; mtx_lock(&nrp->nr_mtx); if (nrp->nr_client != NULL) { client = nrp->nr_client; nrp->nr_client = NULL; + if (nmp != NULL && nmp->nm_aconnect > 0) { + for (i = 0; i < nmp->nm_aconnect; i++) { + aconn[i] = nmp->nm_aconn[i]; + nmp->nm_aconn[i] = NULL; + } + } mtx_unlock(&nrp->nr_mtx); rpc_gss_secpurge_call(client); CLNT_CLOSE(client); CLNT_RELEASE(client); + if (nmp != NULL && nmp->nm_aconnect > 0) { + for (i = 0; i < nmp->nm_aconnect; i++) { + if (aconn[i] != NULL) { + rpc_gss_secpurge_call(aconn[i]); + CLNT_CLOSE(aconn[i]); + CLNT_RELEASE(aconn[i]); + } + } + } } else { mtx_unlock(&nrp->nr_mtx); } @@ -565,7 +589,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, int error = 0, usegssname = 0, secflavour = AUTH_SYS; int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; - u_int trylater_delay = 1; + u_int nextconn, trylater_delay = 1; struct nfs_feedback_arg nf; struct timeval timo; AUTH *auth; @@ -577,6 +601,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct ucred *authcred; struct nfsclsession *sep; uint8_t sessionid[NFSX_V4SESSIONID]; + bool nextconn_set; sep = dssep; if (xidp != NULL) @@ -602,12 +627,24 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, } /* - * XXX if not already connected call nfs_connect now. Longer - * term, change nfs_mount to call nfs_connect unconditionally - * and let clnt_reconnect_create handle reconnects. + * If not already connected call newnfs_connect now. */ if (nrp->nr_client == NULL) - newnfs_connect(nmp, nrp, cred, td, 0, false); + newnfs_connect(nmp, nrp, cred, td, 0, false, &nrp->nr_client); + + nextconn_set = false; + if (nmp != NULL && nmp->nm_aconnect > 0 && + (nd->nd_procnum == NFSPROC_READ || + nd->nd_procnum == NFSPROC_READDIR || + nd->nd_procnum == NFSPROC_READDIRPLUS || + nd->nd_procnum == NFSPROC_WRITE)) { + nextconn = atomic_fetchadd_int(&nmp->nm_nextaconn, 1); + nextconn %= nmp->nm_aconnect; + nextconn_set = true; + if (nmp->nm_aconn[nextconn] == NULL) + newnfs_connect(nmp, nrp, cred, td, 0, false, + &nmp->nm_aconn[nextconn]); + } /* * For a client side mount, nmp is != NULL and clp == NULL. For @@ -830,6 +867,19 @@ tryagain: if (clp != NULL && sep != NULL) stat = clnt_bck_call(nrp->nr_client, &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo, sep->nfsess_xprt); + else if (nextconn_set) + /* + * When there are multiple TCP connections, send the + * RPCs with large messages on the alternate TCP + * connection(s) in a round robin fashion. + * The small RPC messages are sent on the default + * TCP connection because they do not require much + * network bandwidth and separating them from the + * large RPC messages avoids them getting "log jammed" + * behind several large RPC messages. + */ + stat = CLNT_CALL_MBUF(nmp->nm_aconn[nextconn], + &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo); else stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, nd->nd_mreq, &nd->nd_mrep, timo); diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 02416da54f01..1bdc13123aac 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -3624,7 +3624,8 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPROC_T *p) } rp->nr_vers = RPCNFSUSERD_VERS; if (error == 0) - error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false); + error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false, + &rp->nr_client); if (error == 0) { NFSLOCKNAMEID(); nfsrv_nfsuserd = RUNNING; @@ -3658,7 +3659,7 @@ nfsrv_nfsuserddelport(void) msleep(&nfsrv_userdupcalls, NFSNAMEIDMUTEXPTR, PVFS, "nfsupcalls", 0); NFSUNLOCKNAMEID(); - newnfs_disconnect(&nfsrv_nfsuserdsock); + newnfs_disconnect(NULL, &nfsrv_nfsuserdsock); free(nfsrv_nfsuserdsock.nr_nam, M_SONAME); NFSLOCKNAMEID(); nfsrv_nfsuserd = NOTRUNNING; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 5c474d97ad04..9cbaeae361a6 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -772,8 +772,8 @@ int newnfs_request(struct nfsrv_descript *, struct nfsmount *, struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *, struct nfsclsession *); int newnfs_connect(struct nfsmount *, struct nfssockreq *, - struct ucred *, NFSPROC_T *, int, bool); -void newnfs_disconnect(struct nfssockreq *); + struct ucred *, NFSPROC_T *, int, bool, struct __rpc_client **); +void newnfs_disconnect(struct nfsmount *, struct nfssockreq *); int newnfs_sigintr(struct nfsmount *, NFSPROC_T *); /* nfs_nfsdkrpc.c */ diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 128afb33b9ef..213399551097 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5610,7 +5610,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, * unmount, but I did it anyhow. */ nrp->nr_cred = crhold(nmp->nm_sockreq.nr_cred); - error = newnfs_connect(nmp, nrp, NULL, p, 0, false); + error = newnfs_connect(nmp, nrp, NULL, p, 0, false, &nrp->nr_client); NFSCL_DEBUG(3, "DS connect=%d\n", error); dsp = NULL; @@ -5628,7 +5628,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, } while (error == NFSERR_MINORVERMISMATCH && firsttry++ == 0); if (error != 0) - newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); } else { dsp = malloc(sizeof(struct nfsclds), M_NFSCLDS, M_WAITOK | M_ZERO); @@ -5656,7 +5656,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, * If there is already a session for this * server, use it. */ - (void)newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); nfscl_freenfsclds(dsp); *dspp = tdsp; return (0); @@ -5688,7 +5688,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, NFSUNLOCKMNT(nmp); *dspp = dsp; } else if (dsp != NULL) { - newnfs_disconnect(nrp); + newnfs_disconnect(NULL, nrp); nfscl_freenfsclds(dsp); } return (error); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 931f37d4ef67..57eae3f1f1cf 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -118,7 +118,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, int, u_char *, int, u_char *, int, struct vnode **, struct ucred *, - struct thread *, int, int, int, uint32_t, char *); + struct thread *, int, int, int, uint32_t, char *, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -548,7 +548,7 @@ nfs_mountdiskless(char *path, nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO, - NFS_DEFAULT_NEGNAMETIMEO, 0, 0, NULL)) != 0) { + NFS_DEFAULT_NEGNAMETIMEO, 0, 0, NULL, 0)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -715,14 +715,14 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, haslock = 1; } if (!error) { - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(nmp, &nmp->nm_sockreq); if (haslock) newnfs_sndunlock(&nmp->nm_sockreq.nr_lock); nmp->nm_sotype = argp->sotype; nmp->nm_soproto = argp->proto; if (nmp->nm_sotype == SOCK_DGRAM) while (newnfs_connect(nmp, &nmp->nm_sockreq, - cred, td, 0, false)) { + cred, td, 0, false, &nmp->nm_sockreq.nr_client)) { printf("newnfs_args: retrying connect\n"); (void) nfs_catnap(PSOCK, 0, "nfscon"); } @@ -750,7 +750,7 @@ static const char *nfs_opts[] = { "from", "nfs_args", "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr", - "pnfs", "wcommitsize", "oneopenown", "tls", "tlscertname", + "pnfs", "wcommitsize", "oneopenown", "tls", "tlscertname", "nconnect", NULL }; /* @@ -902,6 +902,7 @@ nfs_mount(struct mount *mp) krbnamelen, srvkrbnamelen; size_t hstlen; uint32_t newflag; + int aconn = 0; has_nfs_args_opt = 0; has_nfs_from_opt = 0; @@ -1192,6 +1193,20 @@ nfs_mount(struct mount *mp) goto out; } } + if (vfs_getopt(mp->mnt_optnew, "nconnect", (void **)&opt, NULL) == + 0) { + ret = sscanf(opt, "%d", &aconn); + if (ret != 1 || aconn < 1 || aconn > NFS_MAXNCONN) { + vfs_mount_error(mp, "illegal nconnect: %s", opt); + error = EINVAL; + goto out; + } + /* + * Setting nconnect=1 is a no-op, allowed so that + * the option can be used in a Linux compatible way. + */ + aconn--; + } if (vfs_getopt(mp->mnt_optnew, "sec", (void **) &secname, NULL) == 0) nfs_sec_name(secname, &args.flags); @@ -1359,10 +1374,25 @@ nfs_mount(struct mount *mp) } } + if (aconn > 0 && (args.sotype != SOCK_STREAM || + (args.flags & NFSMNT_NFSV4) == 0 || minvers == 0)) { + /* + * RFC 5661 requires that an NFSv4.1/4.2 server + * send an RPC reply on the same TCP connection + * as the one it received the request on. + * This property in required for "nconnect" and + * might not be the case for NFSv3 or NFSv4.0 servers. + */ + vfs_mount_error(mp, "nconnect should only be used " + "for NFSv4.1/4.2 mounts"); + error = EINVAL; + goto out; + } + args.fh = nfh; error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, - nametimeo, negnametimeo, minvers, newflag, tlscertname); + nametimeo, negnametimeo, minvers, newflag, tlscertname, aconn); out: if (!error) { MNT_ILOCK(mp); @@ -1410,7 +1440,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, struct ucred *cred, struct thread *td, int nametimeo, int negnametimeo, - int minvers, uint32_t newflag, char *tlscertname) + int minvers, uint32_t newflag, char *tlscertname, int aconn) { struct nfsmount *nmp; struct nfsnode *np; @@ -1577,7 +1607,8 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, else nmp->nm_sockreq.nr_vers = NFS_VER2; - if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false))) + if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false, + &nmp->nm_sockreq.nr_client))) goto bad; /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { @@ -1586,6 +1617,12 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; + if (aconn > 0 && nmp->nm_minorvers == 0) { + vfs_mount_error(mp, "nconnect should only be used " + "for NFSv4.1/4.2 mounts"); + error = EINVAL; + goto bad; + } } if (nmp->nm_fhsize == 0 && (nmp->nm_flag & NFSMNT_NFSV4) && @@ -1680,6 +1717,10 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, MNT_IUNLOCK(mp); } + /* Can now allow additional connections. */ + if (aconn > 0) + nmp->nm_aconnect = aconn; + /* * Lose the lock but keep the ref. */ @@ -1692,7 +1733,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, bad: if (clp != NULL) nfscl_clientrelease(clp); - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(NULL, &nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); if (nmp->nm_sockreq.nr_auth != NULL) AUTH_DESTROY(nmp->nm_sockreq.nr_auth); @@ -1707,7 +1748,7 @@ bad: TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) { if (dsp != TAILQ_FIRST(&nmp->nm_sess) && dsp->nfsclds_sockp != NULL) - newnfs_disconnect(dsp->nfsclds_sockp); + newnfs_disconnect(NULL, dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } free(nmp->nm_tlscertname, M_NEWNFSMNT); @@ -1793,7 +1834,7 @@ nfs_unmount(struct mount *mp, int mntflags) msleep(nmp, &nmp->nm_mtx, PVFS, "nfsfdism", 0); mtx_unlock(&nmp->nm_mtx); - newnfs_disconnect(&nmp->nm_sockreq); + newnfs_disconnect(nmp, &nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); free(nmp->nm_nam, M_SONAME); if (nmp->nm_sockreq.nr_auth != NULL) @@ -1803,7 +1844,7 @@ nfs_unmount(struct mount *mp, int mntflags) TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) { if (dsp != TAILQ_FIRST(&nmp->nm_sess) && dsp->nfsclds_sockp != NULL) - newnfs_disconnect(dsp->nfsclds_sockp); + newnfs_disconnect(NULL, dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } free(nmp->nm_tlscertname, M_NEWNFSMNT); @@ -2067,6 +2108,7 @@ void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen) &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCONN) != 0, ",noconn", &buf, &blen); + nfscl_printoptval(nmp, nmp->nm_aconnect + 1, ",nconnect", &buf, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) == 0, ",hard", &buf, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) != 0, ",soft", &buf, diff --git a/sys/fs/nfsclient/nfsmount.h b/sys/fs/nfsclient/nfsmount.h index f8ea8c9a1418..a5997e474be9 100644 --- a/sys/fs/nfsclient/nfsmount.h +++ b/sys/fs/nfsclient/nfsmount.h @@ -39,6 +39,9 @@ #include +/* Maximum value for nm_nconnect. */ +#define NFS_MAXNCONN 16 + /* * Mount structure. * One allocated on every NFS mount. @@ -81,6 +84,11 @@ struct nfsmount { u_int64_t nm_clval; /* identifies which clientid */ u_int64_t nm_fsid[2]; /* NFSv4 fsid */ int nm_minorvers; /* Minor version # for NFSv4 */ + u_int nm_aconnect; /* additional TCP connections */ + u_int nm_nextaconn; /* Next nm_aconn[] to use */ + /* unclipped, wraps to 0 */ + struct __rpc_client *nm_aconn[NFS_MAXNCONN - 1]; /* Additional nconn */ + /* Locked via nm_sockreq.nr_mtx */ u_int16_t nm_krbnamelen; /* Krb5 host principal, if any */ u_int16_t nm_dirpathlen; /* and mount dirpath, for V4 */ u_int16_t nm_srvkrbnamelen; /* and the server's target name */ diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 98f5e26d49bb..01280c8e49c6 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -1368,7 +1368,7 @@ nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p) NULL, 0, NULL, NULL, NULL, 0, p); } #endif - newnfs_disconnect(&clp->lc_req); + newnfs_disconnect(NULL, &clp->lc_req); free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); @@ -4577,10 +4577,10 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, nfsrv_freesession(sep, NULL); } else if (nd->nd_procnum == NFSV4PROC_CBNULL) error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 1, dotls); + NULL, 1, dotls, &clp->lc_req.nr_client); else error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 3, dotls); + NULL, 3, dotls, &clp->lc_req.nr_client); } newnfs_sndunlock(&clp->lc_req.nr_lock); NFSD_DEBUG(4, "aft sndunlock=%d\n", error); From owner-dev-commits-src-all@freebsd.org Fri Jul 9 01:33:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5DC8A65732F; Fri, 9 Jul 2021 01:33: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 4GLbKJ22Ypz4b6N; Fri, 9 Jul 2021 01:33: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 2E8763ABD; Fri, 9 Jul 2021 01:33: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 1691XePu014313; Fri, 9 Jul 2021 01:33:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1691Xewa014312; Fri, 9 Jul 2021 01:33:40 GMT (envelope-from git) Date: Fri, 9 Jul 2021 01:33:40 GMT Message-Id: <202107090133.1691Xewa014312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: bd597b814933 - main - UPDATING: Add an entry for commit 1e0a518d6548 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd597b8149331b4da4675c022a859d86e9c6a5b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 01:33:40 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=bd597b8149331b4da4675c022a859d86e9c6a5b6 commit bd597b8149331b4da4675c022a859d86e9c6a5b6 Author: Rick Macklem AuthorDate: 2021-07-09 01:30:24 +0000 Commit: Rick Macklem CommitDate: 2021-07-09 01:30:24 +0000 UPDATING: Add an entry for commit 1e0a518d6548 --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index 35994b25a2f1..d1ebb992c78c 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210708: + Commit 1e0a518d6548 changed the internal KAPI between the NFS + modules. They all need to be rebuilt from sources. I did not + bump __FreeBSD_version, since it was bumped recently. + 20210624: The NFSv4 client now uses the highest minor version of NFSv4 supported by the NFSv4 server by default instead of minor version 0, From owner-dev-commits-src-all@freebsd.org Fri Jul 9 01:38:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9C9436573A8; Fri, 9 Jul 2021 01:38: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 4GLbR12dXcz4bLT; Fri, 9 Jul 2021 01:38: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 418FF3ABE; Fri, 9 Jul 2021 01:38: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 1691cbRm014749; Fri, 9 Jul 2021 01:38:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1691cbYk014748; Fri, 9 Jul 2021 01:38:37 GMT (envelope-from git) Date: Fri, 9 Jul 2021 01:38:37 GMT Message-Id: <202107090138.1691cbYk014748@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: 4a58aca40df9 - stable/13 - Allow sleepq_signal() to drop the lock. 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/13 X-Git-Reftype: branch X-Git-Commit: 4a58aca40df9a5a5e5db430f3744a2712f955ed7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 01:38:37 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4a58aca40df9a5a5e5db430f3744a2712f955ed7 commit 4a58aca40df9a5a5e5db430f3744a2712f955ed7 Author: Alexander Motin AuthorDate: 2021-06-25 17:52:58 +0000 Commit: Alexander Motin CommitDate: 2021-07-09 01:38:32 +0000 Allow sleepq_signal() to drop the lock. Introduce SLEEPQ_DROP sleepq_signal() flag, allowing one to drop the sleep queue chain lock before returning. Reduced lock scope allows significantly reduce lock contention inside taskqueue_enqueue() for ZFS worker threads doing ~350K disk reads/s on 40-thread system. MFC after: 2 weeks Sponsored by: iXsystems, Inc. (cherry picked from commit 6df35af4d85c6311d8e762521580e7176b69394e) --- sys/kern/kern_synch.c | 8 +++----- sys/kern/subr_sleepqueue.c | 8 ++++++-- sys/sys/sleepqueue.h | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 4c0491ab6e85..b63877e26b68 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -366,8 +366,7 @@ wakeup_one(const void *ident) int wakeup_swapper; sleepq_lock(ident); - wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP, 0, 0); - sleepq_release(ident); + wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_DROP, 0, 0); if (wakeup_swapper) kick_proc0(); } @@ -378,9 +377,8 @@ wakeup_any(const void *ident) int wakeup_swapper; sleepq_lock(ident); - wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_UNFAIR, - 0, 0); - sleepq_release(ident); + wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_UNFAIR | + SLEEPQ_DROP, 0, 0); if (wakeup_swapper) kick_proc0(); } diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 0718f01fa48a..b146a978a60c 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -927,8 +927,11 @@ sleepq_signal(const void *wchan, int flags, int pri, int queue) KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", __func__)); MPASS((queue >= 0) && (queue < NR_SLEEPQS)); sq = sleepq_lookup(wchan); - if (sq == NULL) + if (sq == NULL) { + if (flags & SLEEPQ_DROP) + sleepq_release(wchan); return (0); + } KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); @@ -961,7 +964,8 @@ sleepq_signal(const void *wchan, int flags, int pri, int queue) } } MPASS(besttd != NULL); - wakeup_swapper = sleepq_resume_thread(sq, besttd, pri, SRQ_HOLD); + wakeup_swapper = sleepq_resume_thread(sq, besttd, pri, + (flags & SLEEPQ_DROP) ? 0 : SRQ_HOLD); return (wakeup_swapper); } diff --git a/sys/sys/sleepqueue.h b/sys/sys/sleepqueue.h index 18c7568777b6..6715894ed1f3 100644 --- a/sys/sys/sleepqueue.h +++ b/sys/sys/sleepqueue.h @@ -85,6 +85,7 @@ struct thread; #define SLEEPQ_LK 0x04 /* Used by a lockmgr. */ #define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */ #define SLEEPQ_UNFAIR 0x200 /* Unfair wakeup order. */ +#define SLEEPQ_DROP 0x400 /* Return without lock held. */ void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); From owner-dev-commits-src-all@freebsd.org Fri Jul 9 05:08:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9A39965994A; Fri, 9 Jul 2021 05:08: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 4GLh4l3lDdz3BrZ; Fri, 9 Jul 2021 05:08: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 694946909; Fri, 9 Jul 2021 05:08: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 1695870Z094364; Fri, 9 Jul 2021 05:08:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169587B5094363; Fri, 9 Jul 2021 05:08:07 GMT (envelope-from git) Date: Fri, 9 Jul 2021 05:08:07 GMT Message-Id: <202107090508.169587B5094363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f68a53dba933 - main - awk: Reduce diffs with upstream to almost nothing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f68a53dba933f9c1143863603f5a16fdbe5f070e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:08:07 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f68a53dba933f9c1143863603f5a16fdbe5f070e commit f68a53dba933f9c1143863603f5a16fdbe5f070e Author: Warner Losh AuthorDate: 2021-07-09 03:51:24 +0000 Commit: Warner Losh CommitDate: 2021-07-09 05:05:13 +0000 awk: Reduce diffs with upstream to almost nothing. In the merge of 20210215, I left two merge conflicts #if 0'd by mistake to check later rather than resolve them as part of the merge. This code turns out to be from the original one-true-awk import and not FreeBSD specific, so remove them. Remove a extra definition of HAT. Remove a stylistic change that also appears to be a mismerge along the way. Remove FREEBSD-upgrade. Nobody has updated it since the original 2007 cvs import. It talks about old CVS branches that never made it into svn, let alone git. New imports will follow the standard practices now, so there's nothing left to document. Move README to README.md and copy the README.md from upstream over. This leaves just the $FreeBSD$ lines (which remain for the stable/12 merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only diffs with upstream. FreeBSD also still has its own man page, which I don't plan on changing. Once this commit is merged to stable/12, I plan no further merges to stable/12. Sometime after that I'll remove the $FreeBSD$ lines to reduce the diffs even more (though i want to make sure plans won't change first). I also plan to talk to upstream about this change... MFC After: 2 weeks Sponsored by: Netflix --- contrib/one-true-awk/FREEBSD-upgrade | 24 ------- contrib/one-true-awk/README | 94 --------------------------- contrib/one-true-awk/README.md | 119 +++++++++++++++++++++++++++++++++++ contrib/one-true-awk/awk.h | 2 - contrib/one-true-awk/b.c | 32 +--------- 5 files changed, 120 insertions(+), 151 deletions(-) diff --git a/contrib/one-true-awk/FREEBSD-upgrade b/contrib/one-true-awk/FREEBSD-upgrade deleted file mode 100644 index f0f70ab7b17b..000000000000 --- a/contrib/one-true-awk/FREEBSD-upgrade +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD$ - -Import of the 2005/04/24 version of the "one true awk", as described -in "The AWK Programming Language", by Al Aho, Brian Kernighan, and -Peter Weinberger (Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Original sources were taken from the Brian Kernighan's AWK page -http://www.cs.princeton.edu/~bwk/btl.mirror -and include bug fixes up thru Oct 23, 2007. - -The following files were removed for this import: - - buildwin.bat - makefile.win - missing95.c - vcvars32.bat - ytab.c - ytab.h - ytabc.bak - ytabh.bak - -The vendor import was done by: - - cvs import src/contrib/one-true-awk BELL_LABS bwk_20071023 diff --git a/contrib/one-true-awk/README b/contrib/one-true-awk/README deleted file mode 100644 index 24aaf9092d58..000000000000 --- a/contrib/one-true-awk/README +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************** -Copyright (C) Lucent Technologies 1997 -All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name Lucent Technologies or any of -its entities not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. -****************************************************************/ - -This is the version of awk described in "The AWK Programming Language", -by Al Aho, Brian Kernighan, and Peter Weinberger -(Addison-Wesley, 1988, ISBN 0-201-07981-X). - -Changes, mostly bug fixes and occasional enhancements, are listed -in FIXES. If you distribute this code further, please please please -distribute FIXES with it. If you find errors, please report them -to bwk@cs.princeton.edu. Thanks. - -The program itself is created by - make -which should produce a sequence of messages roughly like this: - - yacc -d awkgram.y - -conflicts: 43 shift/reduce, 85 reduce/reduce - mv y.tab.c ytab.c - mv y.tab.h ytab.h - cc -c ytab.c - cc -c b.c - cc -c main.c - cc -c parse.c - cc maketab.c -o maketab - ./maketab >proctab.c - cc -c proctab.c - cc -c tran.c - cc -c lib.c - cc -c run.c - cc -c lex.c - cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm - -This produces an executable a.out; you will eventually want to -move this to some place like /usr/bin/awk. - -If your system does not have yacc or bison (the GNU -equivalent), you must compile the pieces manually. We have -included yacc output in ytab.c and ytab.h, and backup copies in -case you overwrite them. We have also included a copy of -proctab.c so you do not need to run maketab. - -NOTE: This version uses ANSI C, as you should also. We have -compiled this without any changes using gcc -Wall and/or local C -compilers on a variety of systems, but new systems or compilers -may raise some new complaint; reports of difficulties are -welcome. - -This also compiles with Visual C++ on all flavors of Windows, -*if* you provide versions of popen and pclose. The file -missing95.c contains versions that can be used to get started -with, though the underlying support has mysterious properties, -the symptom of which can be truncated pipe output. Beware. The -file makefile.win gives hints on how to proceed; if you run -vcvars32.bat, it will set up necessary paths and parameters so -you can subsequently run nmake -f makefile.win. Beware also that -when running on Windows under command.com, various quoting -conventions are different from Unix systems: single quotes won't -work around arguments, and various characters like % are -interpreted within double quotes. - -This compiles without change on Macintosh OS X using gcc and -the standard developer tools. - -This is also said to compile on Macintosh OS 9 systems, using the -file "buildmac" provided by Dan Allen (danallen@microsoft.com), -to whom many thanks. - -The version of malloc that comes with some systems is sometimes -astonishly slow. If awk seems slow, you might try fixing that. -More generally, turning on optimization can significantly improve -awk's speed, perhaps by 1/3 for highest levels. diff --git a/contrib/one-true-awk/README.md b/contrib/one-true-awk/README.md new file mode 100644 index 000000000000..b8089b3a4803 --- /dev/null +++ b/contrib/one-true-awk/README.md @@ -0,0 +1,119 @@ +# The One True Awk + +This is the version of `awk` described in _The AWK Programming Language_, +by Al Aho, Brian Kernighan, and Peter Weinberger +(Addison-Wesley, 1988, ISBN 0-201-07981-X). + +## Copyright + +Copyright (C) Lucent Technologies 1997
+All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Distribution and Reporting Problems + +Changes, mostly bug fixes and occasional enhancements, are listed +in `FIXES`. If you distribute this code further, please please please +distribute `FIXES` with it. + +If you find errors, please report them +to bwk@cs.princeton.edu. +Please _also_ open an issue in the GitHub issue tracker, to make +it easy to track issues. +Thanks. + +## Submitting Pull Requests + +Pull requests are welcome. Some guidelines: + +* Please do not use functions or facilities that are not standard (e.g., +`strlcpy()`, `fpurge()`). + +* Please run the test suite and make sure that your changes pass before +posting the pull request. To do so: + + 1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example). + 1. Run `oldawk=nawk make check > check.out 2>&1`. + 1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors. + +* Please create the pull request with a request +to merge into the `staging` branch instead of into the `master` branch. +This allows us to do testing, and to make any additional edits or changes +after the merge but before merging to `master`. + +## Building + +The program itself is created by + + make + +which should produce a sequence of messages roughly like this: + + yacc -d awkgram.y + conflicts: 43 shift/reduce, 85 reduce/reduce + mv y.tab.c ytab.c + mv y.tab.h ytab.h + cc -c ytab.c + cc -c b.c + cc -c main.c + cc -c parse.c + cc maketab.c -o maketab + ./maketab >proctab.c + cc -c proctab.c + cc -c tran.c + cc -c lib.c + cc -c run.c + cc -c lex.c + cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm + +This produces an executable `a.out`; you will eventually want to +move this to some place like `/usr/bin/awk`. + +If your system does not have `yacc` or `bison` (the GNU +equivalent), you need to install one of them first. + +NOTE: This version uses ANSI C (C 99), as you should also. We have +compiled this without any changes using `gcc -Wall` and/or local C +compilers on a variety of systems, but new systems or compilers +may raise some new complaint; reports of difficulties are +welcome. + +This compiles without change on Macintosh OS X using `gcc` and +the standard developer tools. + +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + +The version of `malloc` that comes with some systems is sometimes +astonishly slow. If `awk` seems slow, you might try fixing that. +More generally, turning on optimization can significantly improve +`awk`'s speed, perhaps by 1/3 for highest levels. + +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + +#### Last Updated + +Fri Dec 25 16:53:34 EST 2020 diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 230eac41548c..51c00df9f279 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -237,8 +237,6 @@ extern int pairstack[], paircnt; /* watch out in match(), etc. */ #define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 20f4a8bee7f9..dd64f09647b0 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -614,22 +614,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ } nextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) -n xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of space in pmatch"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif - } while (*p++ != 0); + } while (*p++); return (0); } @@ -670,21 +655,6 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ } nnextin: s = 2; -#if 0 /* XXX */ - if (f->reset) { - for (i = 2; i <= f->curstat; i++) - xfree(f->posns[i]); - k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) - overflo("out of state space"); - for (i = 0; i <= k; i++) - (f->posns[2])[i] = (f->posns[0])[i]; - f->initstat = f->curstat = 2; - f->out[2] = f->out[0]; - for (i = 0; i < NCHARS; i++) - f->gototab[2][i] = 0; - } -#endif p++; } return (0); From owner-dev-commits-src-all@freebsd.org Fri Jul 9 05:23:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD7A06597C4; Fri, 9 Jul 2021 05:23: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 4GLhPw5ggKz3DtL; Fri, 9 Jul 2021 05:23: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 A5FEB69CB; Fri, 9 Jul 2021 05:23: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 1695N0j0020804; Fri, 9 Jul 2021 05:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1695N0vO020803; Fri, 9 Jul 2021 05:23:00 GMT (envelope-from git) Date: Fri, 9 Jul 2021 05:23:00 GMT Message-Id: <202107090523.1695N0vO020803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 3f7b23177f1d - main - UPDATING: Note awk upgraded to upstream one-true-awk 20210215. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f7b23177f1d68547196958f504c514432478115 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:23:01 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3f7b23177f1d68547196958f504c514432478115 commit 3f7b23177f1d68547196958f504c514432478115 Author: Warner Losh AuthorDate: 2021-07-09 05:10:38 +0000 Commit: Warner Losh CommitDate: 2021-07-09 05:16:06 +0000 UPDATING: Note awk upgraded to upstream one-true-awk 20210215. The updating entry can be used for release notes. I'll merge this to stable/12 and stable/13 to make sure it gets into thier release notes. Relnotes: yes Sponsored by: Netflix --- UPDATING | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UPDATING b/UPDATING index d1ebb992c78c..e7453030b24a 100644 --- a/UPDATING +++ b/UPDATING @@ -32,6 +32,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: modules. They all need to be rebuilt from sources. I did not bump __FreeBSD_version, since it was bumped recently. +20210707: + awk has been updated to the latest one-true-awk version 20120215. + This contains a number of minor bug fixes. + 20210624: The NFSv4 client now uses the highest minor version of NFSv4 supported by the NFSv4 server by default instead of minor version 0, From owner-dev-commits-src-all@freebsd.org Fri Jul 9 05:29:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0AC6F659AB5; Fri, 9 Jul 2021 05:29:35 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from gate.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (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 4GLhYV58sLz3FBK; Fri, 9 Jul 2021 05:29:34 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by gate.home.utahime.org (Postfix) with ESMTPS id 88D093A948; Fri, 9 Jul 2021 14:29:25 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1625808565; bh=tdj+aDYBN4gEOEZowRJLazecqfPJtq0Ot/52K8e03Lk=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=tpO0vmfEPQfQRfCbF78tWgtBHywZt1IDMhHSBoSm1513dHg2+NFqz+F73wKqQqo4z ez3M9wwUeqQrnn+99wa9oJIg4Zf+OSoWwzLReFfrO6wzXLMGEwNUMN1vwjAS7YW/Bk lhIZaebbp+3StG0R8HxkUZ/b4aOcaJrkQgGx5rzIWfDiSlwumbboaofyFOzCNjp1lX l+v2DPozF+47wWf2KpE/4m78YyR2s96AjL5RX7LF4eTyuh7oRzIll6QV+hNOsPI6jl PTrcI8r3ZPlLgQ5MykqvtNha1hdf3eyK674cOs3JeLFByaa9aekIF9LqMbc1yUHrOn myckY1roDHhyw== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id A528A3CAE2; Fri, 9 Jul 2021 14:29:24 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.3 at eastasia.home.utahime.org Date: Fri, 09 Jul 2021 14:29:05 +0900 (JST) Message-Id: <20210709.142905.792234204091664441.yasu@utahime.org> To: imp@FreeBSD.org Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3f7b23177f1d - main - UPDATING: Note awk upgraded to upstream one-true-awk 20210215. From: Yasuhiro Kimura In-Reply-To: <202107090523.1695N0vO020803@gitrepo.freebsd.org> References: <202107090523.1695N0vO020803@gitrepo.freebsd.org> X-Mailer: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GLhYV58sLz3FBK 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:29:35 -0000 From: Warner Losh Subject: git: 3f7b23177f1d - main - UPDATING: Note awk upgraded to upstream one-true-awk 20210215. Date: Fri, 9 Jul 2021 05:23:00 GMT > +20210707: > + awk has been updated to the latest one-true-awk version 20120215. ^^^^^^^^ Typo of 20210215? --- Yasuhiro Kimura From owner-dev-commits-src-all@freebsd.org Fri Jul 9 05:43:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BEF965A1B4; Fri, 9 Jul 2021 05:43: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 4GLhss2PSxz3GMX; Fri, 9 Jul 2021 05:43: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 3AD8A700E; Fri, 9 Jul 2021 05:43: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 1695hjnS047402; Fri, 9 Jul 2021 05:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1695hjKt047401; Fri, 9 Jul 2021 05:43:45 GMT (envelope-from git) Date: Fri, 9 Jul 2021 05:43:45 GMT Message-Id: <202107090543.1695hjKt047401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a65fe39d5418 - main - UPDATING: fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a65fe39d5418ffd96b93744d3a3e43cd48ecab4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 05:43:45 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a65fe39d5418ffd96b93744d3a3e43cd48ecab4c commit a65fe39d5418ffd96b93744d3a3e43cd48ecab4c Author: Warner Losh AuthorDate: 2021-07-09 05:42:15 +0000 Commit: Warner Losh CommitDate: 2021-07-09 05:42:15 +0000 UPDATING: fix typo The correct version is 20210215, not 20120215 :( Reported by: Yasuhiro Kimura Fixes: 3f7b23177f1d Sponsored by: Netflix --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index e7453030b24a..4a8fde856e83 100644 --- a/UPDATING +++ b/UPDATING @@ -33,7 +33,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: bump __FreeBSD_version, since it was bumped recently. 20210707: - awk has been updated to the latest one-true-awk version 20120215. + awk has been updated to the latest one-true-awk version 20210215. This contains a number of minor bug fixes. 20210624: From owner-dev-commits-src-all@freebsd.org Fri Jul 9 09:16:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0BF4265CAAF; Fri, 9 Jul 2021 09:16: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 4GLnZw6zvKz4Rl7; Fri, 9 Jul 2021 09:16: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 D7CBE11FFF; Fri, 9 Jul 2021 09:16: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 1699G8a9028607; Fri, 9 Jul 2021 09:16:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1699G8sm028606; Fri, 9 Jul 2021 09:16:08 GMT (envelope-from git) Date: Fri, 9 Jul 2021 09:16:08 GMT Message-Id: <202107090916.1699G8sm028606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c6bf20a2a46d - main - pf: add DIOCGETSTATESV2 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/main X-Git-Reftype: branch X-Git-Commit: c6bf20a2a46dc36bf881ac594454f71379828a9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 09:16:09 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c6bf20a2a46dc36bf881ac594454f71379828a9a commit c6bf20a2a46dc36bf881ac594454f71379828a9a Author: Kristof Provost AuthorDate: 2021-07-06 10:12:12 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:29:53 +0000 pf: add DIOCGETSTATESV2 Add a new version of the DIOCGETSTATES call, which extends the struct to include the original interface information. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31097 --- sys/net/pfvar.h | 73 ++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 7bbb585106c7..17af5d46a183 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -520,6 +520,65 @@ struct pf_state_cmp { #define PFSTATE_SETPRIO 0x0200 #define PFSTATE_SETMASK (PFSTATE_SETPRIO) +struct pf_state_scrub_export { + uint16_t pfss_flags; + uint8_t pfss_ttl; /* stashed TTL */ +#define PF_SCRUB_FLAG_VALID 0x01 + uint8_t scrub_flag; + uint32_t pfss_ts_mod; /* timestamp modulation */ +}; + +struct pf_state_key_export { + struct pf_addr addr[2]; + uint16_t port[2]; +}; + +struct pf_state_peer_export { + struct pf_state_scrub_export scrub; /* state is scrubbed */ + uint32_t seqlo; /* Max sequence number sent */ + uint32_t seqhi; /* Max the other end ACKd + win */ + uint32_t seqdiff; /* Sequence number modulator */ + uint16_t max_win; /* largest window (pre scaling) */ + uint16_t mss; /* Maximum segment size option */ + uint8_t state; /* active state level */ + uint8_t wscale; /* window scaling factor */ + uint8_t dummy[6]; +}; +_Static_assert(sizeof(struct pf_state_peer_export) == 32, "size incorrect"); + +struct pf_state_export { + uint64_t version; +#define PF_STATE_VERSION 20210706 + uint64_t id; + char ifname[IFNAMSIZ]; + char orig_ifname[IFNAMSIZ]; + struct pf_state_key_export key[2]; + struct pf_state_peer_export src; + struct pf_state_peer_export dst; + struct pf_addr rt_addr; + uint32_t rule; + uint32_t anchor; + uint32_t nat_rule; + uint32_t creation; + uint32_t expire; + uint32_t spare0; + uint64_t packets[2]; + uint64_t bytes[2]; + uint32_t creatorid; + uint32_t spare1; + sa_family_t af; + uint8_t proto; + uint8_t direction; + uint8_t log; + uint8_t state_flags; + uint8_t timeout; + uint8_t sync_flags; + uint8_t updates; + + uint8_t spare[112]; +}; +_Static_assert(sizeof(struct pf_state_export) == 384, "size incorrect"); + #ifdef _KERNEL struct pf_kstate { u_int64_t id; @@ -646,6 +705,8 @@ extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, struct pf_kstate *); +void pf_state_export(struct pf_state_export *, + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1187,6 +1248,17 @@ struct pfioc_states { #define ps_states ps_u.psu_states }; +struct pfioc_states_v2 { + int ps_len; + uint64_t ps_req_version; + union { + caddr_t psu_buf; + struct pf_state_export *psu_states; + } ps_u; +#define ps_buf ps_u.psu_buf +#define ps_states ps_u.psu_states +}; + struct pfioc_src_nodes { int psn_len; union { @@ -1402,6 +1474,7 @@ struct pfioc_iface { #define DIOCCLRIFFLAG _IOWR('D', 90, struct pfioc_iface) #define DIOCKILLSRCNODES _IOWR('D', 91, struct pfioc_src_node_kill) #define DIOCKEEPCOUNTERS _IOWR('D', 92, struct pfioc_nv) +#define DIOCGETSTATESV2 _IOWR('D', 93, struct pfioc_states_v2) struct pf_ifspeed_v0 { char ifname[IFNAMSIZ]; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 33eb0e15ea57..e4017f48a8ca 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2108,6 +2108,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCNATLOOK: case DIOCSETDEBUG: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCCLRRULECTRS: @@ -2161,6 +2162,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCGETSTATUS: case DIOCGETSTATES: + case DIOCGETSTATESV2: case DIOCGETSTATESNV: case DIOCGETTIMEOUT: case DIOCGETLIMIT: @@ -2871,6 +2873,60 @@ DIOCGETSTATES_full: break; } + case DIOCGETSTATESV2: { + struct pfioc_states_v2 *ps = (struct pfioc_states_v2 *)addr; + struct pf_kstate *s; + struct pf_state_export *pstore, *p; + int i, nr; + + if (ps->ps_req_version > PF_STATE_VERSION) { + error = ENOTSUP; + break; + } + + if (ps->ps_len <= 0) { + nr = uma_zone_get_cur(V_pf_state_z); + ps->ps_len = sizeof(struct pf_state_export) * nr; + break; + } + + p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + nr = 0; + + for (i = 0; i <= pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + + if (LIST_EMPTY(&ih->states)) + continue; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + + if ((nr+1) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + pf_state_export(p, s); + p++; + nr++; + } + PF_HASHROW_UNLOCK(ih); + } +DIOCGETSTATESV2_full: + error = copyout(pstore, ps->ps_states, + sizeof(struct pf_state_export) * nr); + if (error) { + free(pstore, M_TEMP); + break; + } + ps->ps_len = sizeof(struct pf_state_export) * nr; + free(pstore, M_TEMP); + + break; + } + case DIOCGETSTATESNV: { error = pf_getstates((struct pfioc_nv *)addr); break; @@ -4594,7 +4650,70 @@ pfsync_state_export(struct pfsync_state *sp, struct pf_kstate *st) pf_state_counter_hton(st->packets[1], sp->packets[1]); pf_state_counter_hton(st->bytes[0], sp->bytes[0]); pf_state_counter_hton(st->bytes[1], sp->bytes[1]); +} + +void +pf_state_export(struct pf_state_export *sp, struct pf_kstate *st) +{ + bzero(sp, sizeof(*sp)); + + sp->version = PF_STATE_VERSION; + + /* copy from state key */ + sp->key[PF_SK_WIRE].addr[0] = st->key[PF_SK_WIRE]->addr[0]; + sp->key[PF_SK_WIRE].addr[1] = st->key[PF_SK_WIRE]->addr[1]; + sp->key[PF_SK_WIRE].port[0] = st->key[PF_SK_WIRE]->port[0]; + sp->key[PF_SK_WIRE].port[1] = st->key[PF_SK_WIRE]->port[1]; + sp->key[PF_SK_STACK].addr[0] = st->key[PF_SK_STACK]->addr[0]; + sp->key[PF_SK_STACK].addr[1] = st->key[PF_SK_STACK]->addr[1]; + sp->key[PF_SK_STACK].port[0] = st->key[PF_SK_STACK]->port[0]; + sp->key[PF_SK_STACK].port[1] = st->key[PF_SK_STACK]->port[1]; + sp->proto = st->key[PF_SK_WIRE]->proto; + sp->af = st->key[PF_SK_WIRE]->af; + + /* copy from state */ + strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->orig_ifname, st->orig_kif->pfik_name, + sizeof(sp->orig_ifname)); + bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); + sp->creation = htonl(time_uptime - st->creation); + sp->expire = pf_state_expires(st); + if (sp->expire <= time_uptime) + sp->expire = htonl(0); + else + sp->expire = htonl(sp->expire - time_uptime); + + sp->direction = st->direction; + sp->log = st->log; + sp->timeout = st->timeout; + sp->state_flags = st->state_flags; + if (st->src_node) + sp->sync_flags |= PFSYNC_FLAG_SRCNODE; + if (st->nat_src_node) + sp->sync_flags |= PFSYNC_FLAG_NATSRCNODE; + + sp->id = st->id; + sp->creatorid = st->creatorid; + pf_state_peer_hton(&st->src, &sp->src); + pf_state_peer_hton(&st->dst, &sp->dst); + + if (st->rule.ptr == NULL) + sp->rule = htonl(-1); + else + sp->rule = htonl(st->rule.ptr->nr); + if (st->anchor.ptr == NULL) + sp->anchor = htonl(-1); + else + sp->anchor = htonl(st->anchor.ptr->nr); + if (st->nat_rule.ptr == NULL) + sp->nat_rule = htonl(-1); + else + sp->nat_rule = htonl(st->nat_rule.ptr->nr); + sp->packets[0] = st->packets[0]; + sp->packets[1] = st->packets[1]; + sp->bytes[0] = st->bytes[0]; + sp->bytes[1] = st->bytes[1]; } static void From owner-dev-commits-src-all@freebsd.org Fri Jul 9 09:16:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 83DDF65CC1F; Fri, 9 Jul 2021 09:16:11 +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 4GLnZz24ksz4RNF; Fri, 9 Jul 2021 09:16: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 2A5D411B73; Fri, 9 Jul 2021 09:16:11 +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 1699GBh3028659; Fri, 9 Jul 2021 09:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1699GBCF028658; Fri, 9 Jul 2021 09:16:11 GMT (envelope-from git) Date: Fri, 9 Jul 2021 09:16:11 GMT Message-Id: <202107090916.1699GBCF028658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3fc12ae04204 - main - pf: bound DIOCGETSTATESV2 memory use 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/main X-Git-Reftype: branch X-Git-Commit: 3fc12ae042040192aa43984106a75663aaa9e0f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 09:16:11 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3fc12ae042040192aa43984106a75663aaa9e0f5 commit 3fc12ae042040192aa43984106a75663aaa9e0f5 Author: Kristof Provost AuthorDate: 2021-07-08 13:01:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:30:02 +0000 pf: bound DIOCGETSTATESV2 memory use Rather than allocating however much memory userspace asks for we only allocate enough for a handful of states, and copy to userspace for each completed row. We start out with enough space for 16 states (per row), but grow that as required. In most configurations we expect at most a handful of states per row (more than that would have other negative effects on packet processing performance). Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31111 --- sys/netpfil/pf/pf_ioctl.c | 48 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e4017f48a8ca..e0f7216ce5fc 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2878,6 +2878,8 @@ DIOCGETSTATES_full: struct pf_kstate *s; struct pf_state_export *pstore, *p; int i, nr; + size_t slice_count = 16, count; + void *out; if (ps->ps_req_version > PF_STATE_VERSION) { error = ENOTSUP; @@ -2890,38 +2892,60 @@ DIOCGETSTATES_full: break; } - p = pstore = malloc(ps->ps_len, M_TEMP, M_WAITOK | M_ZERO); + out = ps->ps_states; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, M_WAITOK | M_ZERO); nr = 0; for (i = 0; i <= pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; +DIOCGETSTATESV2_retry: + p = pstore; + if (LIST_EMPTY(&ih->states)) continue; PF_HASHROW_LOCK(ih); + count = 0; + LIST_FOREACH(s, &ih->states, entry) { + if (s->timeout == PFTM_UNLINKED) + continue; + count++; + } + + if (count > slice_count) { + PF_HASHROW_UNLOCK(ih); + free(pstore, M_TEMP); + slice_count = count * 2; + pstore = mallocarray(slice_count, + sizeof(struct pf_state_export), M_TEMP, + M_WAITOK | M_ZERO); + goto DIOCGETSTATESV2_retry; + } + + if ((nr+count) * sizeof(*p) > ps->ps_len) { + PF_HASHROW_UNLOCK(ih); + goto DIOCGETSTATESV2_full; + } + LIST_FOREACH(s, &ih->states, entry) { if (s->timeout == PFTM_UNLINKED) continue; - if ((nr+1) * sizeof(*p) > ps->ps_len) { - PF_HASHROW_UNLOCK(ih); - goto DIOCGETSTATESV2_full; - } pf_state_export(p, s); p++; nr++; } PF_HASHROW_UNLOCK(ih); + error = copyout(pstore, out, + sizeof(struct pf_state_export) * count); + if (error) + break; + out = ps->ps_states + nr; } DIOCGETSTATESV2_full: - error = copyout(pstore, ps->ps_states, - sizeof(struct pf_state_export) * nr); - if (error) { - free(pstore, M_TEMP); - break; - } - ps->ps_len = sizeof(struct pf_state_export) * nr; + ps->ps_len = nr * sizeof(struct pf_state_export); free(pstore, M_TEMP); break; From owner-dev-commits-src-all@freebsd.org Fri Jul 9 09:16:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2C84C65CBBD; Fri, 9 Jul 2021 09:16:10 +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 4GLnZy0gZ2z4Rfq; Fri, 9 Jul 2021 09:16:10 +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 F2FF311C74; Fri, 9 Jul 2021 09:16: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 1699G9Ap028635; Fri, 9 Jul 2021 09:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1699G9ch028634; Fri, 9 Jul 2021 09:16:09 GMT (envelope-from git) Date: Fri, 9 Jul 2021 09:16:09 GMT Message-Id: <202107090916.1699G9ch028634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: be70c7a50d32 - main - libpfctl: migrate to DIOCGETSTATESV2 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/main X-Git-Reftype: branch X-Git-Commit: be70c7a50d324dd56f3a0d37d8372e7855dd580b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 09:16:10 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=be70c7a50d324dd56f3a0d37d8372e7855dd580b commit be70c7a50d324dd56f3a0d37d8372e7855dd580b Author: Kristof Provost AuthorDate: 2021-07-06 11:05:19 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:29:57 +0000 libpfctl: migrate to DIOCGETSTATESV2 Stop using the *NV version to retrieve states, as its performance is unacceptably bad. For 1,000,000 states the nvlist version needed ~100 seconds to retrieve the states, the new version needs ~3 seconds. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31098 --- lib/libpfctl/libpfctl.c | 196 +++++++++++++++++++----------------------------- 1 file changed, 79 insertions(+), 117 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index bbb53edf8bc1..6421a2c752a8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -637,150 +637,112 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, } static void -pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, - struct pfctl_state_peer *peer) +pf_state_key_export_to_state_key(struct pfctl_state_key *ps, + const struct pf_state_key_export *s) { - bzero(peer, sizeof(*peer)); - - peer->seqlo = nvlist_get_number(nvl, "seqlo"); - peer->seqhi = nvlist_get_number(nvl, "seqhi"); - peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); - peer->state = nvlist_get_number(nvl, "state"); - peer->wscale = nvlist_get_number(nvl, "wscale"); + bcopy(s->addr, ps->addr, sizeof(ps->addr[0]) * 2); + ps->port[0] = s->port[0]; + ps->port[1] = s->port[1]; } static void -pf_nvstate_key_to_state_key(const nvlist_t *nvl, struct pfctl_state_key *key) +pf_state_peer_export_to_state_peer(struct pfctl_state_peer *ps, + const struct pf_state_peer_export *s) { - const nvlist_t * const *tmp; - size_t count; - - bzero(key, sizeof(*key)); - - tmp = nvlist_get_nvlist_array(nvl, "addr", &count); - assert(count == 2); - - for (int i = 0; i < 2; i++) - pf_nvaddr_to_addr(tmp[i], &key->addr[i]); - - pf_nvuint_16_array(nvl, "port", 2, key->port, NULL); - - key->af = nvlist_get_number(nvl, "af"); - key->proto = nvlist_get_number(nvl, "proto"); + /* Ignore scrub. */ + ps->seqlo = s->seqlo; + ps->seqhi = s->seqhi; + ps->seqdiff = s->seqdiff; + /* Ignore max_win & mss */ + ps->state = s->state; + ps->wscale = s->wscale; } static void -pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) -{ - bzero(s, sizeof(*s)); - - s->id = nvlist_get_number(nvl, "id"); - s->creatorid = nvlist_get_number(nvl, "creatorid"); - s->direction = nvlist_get_number(nvl, "direction"); - - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "src"), &s->src); - pf_nvstate_peer_to_state_peer(nvlist_get_nvlist(nvl, "dst"), &s->dst); - - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "stack_key"), - &s->key[0]); - pf_nvstate_key_to_state_key(nvlist_get_nvlist(nvl, "wire_key"), - &s->key[1]); - - strlcpy(s->ifname, nvlist_get_string(nvl, "ifname"), - sizeof(s->ifname)); - strlcpy(s->orig_ifname, nvlist_get_string(nvl, "orig_ifname"), - sizeof(s->orig_ifname)); - - pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "rt_addr"), &s->rt_addr); - s->rule = nvlist_get_number(nvl, "rule"); - s->anchor = nvlist_get_number(nvl, "anchor"); - s->nat_rule = nvlist_get_number(nvl, "nat_rule"); - s->creation = nvlist_get_number(nvl, "creation"); - s->expire = nvlist_get_number(nvl, "expire"); - - pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); - pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); - - s->state_flags = nvlist_get_number(nvl, "state_flags"); - s->sync_flags = nvlist_get_number(nvl, "sync_flags"); +pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s) +{ + assert(s->version >= PF_STATE_VERSION); + + ps->id = s->id; + strlcpy(ps->ifname, s->ifname, sizeof(ps->ifname)); + strlcpy(ps->orig_ifname, s->orig_ifname, sizeof(ps->orig_ifname)); + pf_state_key_export_to_state_key(&ps->key[0], &s->key[0]); + pf_state_key_export_to_state_key(&ps->key[1], &s->key[1]); + pf_state_peer_export_to_state_peer(&ps->src, &s->src); + pf_state_peer_export_to_state_peer(&ps->dst, &s->dst); + bcopy(&s->rt_addr, &ps->rt_addr, sizeof(ps->rt_addr)); + ps->rule = s->rule; + ps->anchor = s->anchor; + ps->nat_rule = s->nat_rule; + ps->creation = s->creation; + ps->expire = s->expire; + ps->packets[0] = s->packets[0]; + ps->packets[1] = s->packets[1]; + ps->bytes[0] = s->bytes[0]; + ps->bytes[1] = s->bytes[1]; + ps->creatorid = s->creatorid; + ps->key[0].proto = s->proto; + ps->key[1].proto = s->proto; + ps->key[0].af = s->af; + ps->key[1].af = s->af; + ps->direction = s->direction; + ps->state_flags = s->state_flags; + ps->sync_flags = s->sync_flags; } int pfctl_get_states(int dev, struct pfctl_states *states) { - struct pfioc_nv nv; - nvlist_t *nvl = NULL; - const nvlist_t * const *slist; - size_t found_count; - int error = 0; + struct pfioc_states_v2 ps; + struct pf_state_export *p; + char *inbuf = NULL, *newinbuf = NULL; + unsigned int len = 0; + int i, error; + + bzero(&ps, sizeof(ps)); + ps.ps_req_version = PF_STATE_VERSION; bzero(states, sizeof(*states)); TAILQ_INIT(&states->states); - /* Just enough to get a number, and we'll grow from there. */ - nv.data = malloc(64); - nv.len = nv.size = 64; - for (;;) { - if (ioctl(dev, DIOCGETSTATESNV, &nv)) { - error = errno; - goto out; + ps.ps_len = len; + if (len) { + newinbuf = realloc(inbuf, len); + if (newinbuf == NULL) + return (ENOMEM); + ps.ps_buf = inbuf = newinbuf; } - - nvlist_destroy(nvl); - nvl = nvlist_unpack(nv.data, nv.len, 0); - if (nvl == NULL) { - error = EIO; - goto out; + if ((error = ioctl(dev, DIOCGETSTATESV2, &ps)) < 0) { + free(inbuf); + return (error); } - - states->count = nvlist_get_number(nvl, "count"); - - /* Are there any states? */ - if (states->count == 0) + if (ps.ps_len + sizeof(struct pfioc_states_v2) < len) break; + if (len == 0 && ps.ps_len == 0) + goto out; + if (len == 0 && ps.ps_len != 0) + len = ps.ps_len; + if (ps.ps_len == 0) + goto out; /* no states */ + len *= 2; + } + p = ps.ps_states; - if (nvlist_exists_nvlist_array(nvl, "states")) - slist = nvlist_get_nvlist_array(nvl, "states", &found_count); - else - found_count = 0; - - if (found_count < states->count) { - size_t new_size = nv.size + - (nv.size * states->count / (found_count + 1) * 2); - - /* Our buffer is too small. Estimate what we need based - * on how many states fit in the previous allocation - * and how many states there are. Doubled for margin. - * */ - nv.data = realloc(nv.data, new_size); - nv.size = new_size; - - if (nv.data == NULL) { - error = ENOMEM; - goto out; - } - continue; + for (i = 0; i < ps.ps_len; i += sizeof(*p), p++) { + struct pfctl_state *s = malloc(sizeof(*s)); + if (s == NULL) { + pfctl_free_states(states); + error = ENOMEM; + goto out; } - for (size_t i = 0; i < found_count; i++) { - struct pfctl_state *s = malloc(sizeof(*s)); - if (s == NULL) { - pfctl_free_states(states); - error = ENOMEM; - goto out; - } - - pf_nvstate_to_state(slist[i], s); - TAILQ_INSERT_TAIL(&states->states, s, entry); - } - break; + pf_state_export_to_state(s, p); + TAILQ_INSERT_TAIL(&states->states, s, entry); } out: - nvlist_destroy(nvl); - free(nv.data); - + free(inbuf); return (error); } From owner-dev-commits-src-all@freebsd.org Fri Jul 9 11:48:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E3F4F65E70A; Fri, 9 Jul 2021 11: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 4GLryy5vv6z4lFw; Fri, 9 Jul 2021 11: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 A8A9F1409C; Fri, 9 Jul 2021 11:48: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 169BmgTr030119; Fri, 9 Jul 2021 11: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 169BmgYW030118; Fri, 9 Jul 2021 11:48:42 GMT (envelope-from git) Date: Fri, 9 Jul 2021 11:48:42 GMT Message-Id: <202107091148.169BmgYW030118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 84992a3251d5 - main - sctp: provide sac_error also for ABORT chunk being sent 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/main X-Git-Reftype: branch X-Git-Commit: 84992a3251d56df3bc36e0ac33ba383f41107864 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 11:48:43 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=84992a3251d56df3bc36e0ac33ba383f41107864 commit 84992a3251d56df3bc36e0ac33ba383f41107864 Author: Michael Tuexen AuthorDate: 2021-07-09 11:46:27 +0000 Commit: Michael Tuexen CommitDate: 2021-07-09 11:46:27 +0000 sctp: provide sac_error also for ABORT chunk being sent Thanks to Florent Castelli for bringing this issue up for the userland stack and providing an initial patch. MFC: 3 days --- sys/netinet/sctputil.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index aec2298e26b2..1f909fa1d8d4 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4367,19 +4367,29 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t mflowtype, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { + struct sctp_gen_error_cause *cause; uint32_t vtag; + uint16_t cause_code; - vtag = 0; if (stcb != NULL) { vtag = stcb->asoc.peer_vtag; vrf_id = stcb->asoc.vrf_id; + if (op_err != NULL) { + /* Read the cause code from the error cause. */ + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause_code = ntohs(cause->code); + } else { + cause_code = 0; + } + } else { + vtag = 0; } sctp_send_abort(m, iphlen, src, dst, sh, vtag, op_err, mflowtype, mflowid, inp->fibnum, vrf_id, port); if (stcb != NULL) { /* We have a TCB to abort, send notification too */ - sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, 0, cause_code, NULL, SCTP_SO_NOT_LOCKED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4458,6 +4468,8 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *op_err, int so_locked) { + struct sctp_gen_error_cause *cause; + uint16_t cause_code; if (stcb == NULL) { /* Got to have a TCB */ @@ -4469,6 +4481,13 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } return; } + if (op_err != NULL) { + /* Read the cause code from the error cause. */ + cause = mtod(op_err, struct sctp_gen_error_cause *); + cause_code = ntohs(cause->code); + } else { + cause_code = 0; + } /* notify the peer */ sctp_send_abort_tcb(stcb, op_err, so_locked); SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -4478,7 +4497,7 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, 0, NULL, so_locked); + sctp_abort_notification(stcb, 0, cause_code, NULL, so_locked); } /* now free the asoc */ #ifdef SCTP_ASOCLOG_OF_TSNS From owner-dev-commits-src-all@freebsd.org Fri Jul 9 12:10:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F021665EEFE; Fri, 9 Jul 2021 12:10: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 4GLsRs67G6z4qlB; Fri, 9 Jul 2021 12:10: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 B9729145E5; Fri, 9 Jul 2021 12:10: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 169CAHgl063939; Fri, 9 Jul 2021 12:10:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169CAHVx063934; Fri, 9 Jul 2021 12:10:17 GMT (envelope-from git) Date: Fri, 9 Jul 2021 12:10:17 GMT Message-Id: <202107091210.169CAHVx063934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 24c681a7f6d6 - main - grep: fix combination of quite and count flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24c681a7f6d6c777221fdbd289da64ff65ad8785 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 12:10:18 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=24c681a7f6d6c777221fdbd289da64ff65ad8785 commit 24c681a7f6d6c777221fdbd289da64ff65ad8785 Author: Mariusz Zaborski AuthorDate: 2021-07-09 12:09:14 +0000 Commit: Mariusz Zaborski CommitDate: 2021-07-09 12:09:14 +0000 grep: fix combination of quite and count flag When the quite (-q) flag is provided, we don't expect any output. Currently, the behavior is broken: $ grep -cq flag util.c 1 $ grep -cs flag util.c 55 First of all, we print a number to stdout. Secondly, it just returns 0 or 1 (which is unexpected). GNU grep with c and q flags doesn't print anything. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31108 --- usr.bin/grep/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index a2520e24de8e..698e347c192e 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -388,7 +388,7 @@ procfile(const char *fn) clearqueue(); grep_close(f); - if (cflag) { + if (cflag && !qflag) { if (!hflag) printf("%s:", pc.ln.file); printf("%u\n", lines); From owner-dev-commits-src-all@freebsd.org Fri Jul 9 12:17:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D245765F189; Fri, 9 Jul 2021 12:17: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 4GLsbm4wpqz4rLF; Fri, 9 Jul 2021 12:17: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 916701426B; Fri, 9 Jul 2021 12:17: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 169CH8Ev070697; Fri, 9 Jul 2021 12:17:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169CH8qd070696; Fri, 9 Jul 2021 12:17:08 GMT (envelope-from git) Date: Fri, 9 Jul 2021 12:17:08 GMT Message-Id: <202107091217.169CH8qd070696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: ce64352a702d - main - sctp: provide consistent stream information in case of early errors 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/main X-Git-Reftype: branch X-Git-Commit: ce64352a702db1fef8c0e33f3a6f13a3e5d92736 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 12:17:08 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=ce64352a702db1fef8c0e33f3a6f13a3e5d92736 commit ce64352a702db1fef8c0e33f3a6f13a3e5d92736 Author: Michael Tuexen AuthorDate: 2021-07-09 12:15:22 +0000 Commit: Michael Tuexen CommitDate: 2021-07-09 12:16:59 +0000 sctp: provide consistent stream information in case of early errors While there, make sure the function is called correctly. MFC after: 3 days --- sys/netinet/sctputil.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 1f909fa1d8d4..21e49bdfcb23 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -3163,6 +3163,8 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, uint16_t abort_len; unsigned int i; + KASSERT((abort == NULL) || (from_peer != 0), + ("sctp_notify_assoc_change: ABORT chunk provided for local termination")); if (stcb == NULL) { return; } @@ -3202,9 +3204,13 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, sac->sac_length = sizeof(struct sctp_assoc_change); sac->sac_state = state; sac->sac_error = error; - /* XXX verify these stream counts */ - sac->sac_outbound_streams = stcb->asoc.streamoutcnt; - sac->sac_inbound_streams = stcb->asoc.streamincnt; + if (state == SCTP_CANT_STR_ASSOC) { + sac->sac_outbound_streams = 0; + sac->sac_inbound_streams = 0; + } else { + sac->sac_outbound_streams = stcb->asoc.streamoutcnt; + sac->sac_inbound_streams = stcb->asoc.streamincnt; + } sac->sac_assoc_id = sctp_get_associd(stcb); if (notif_len > sizeof(struct sctp_assoc_change)) { if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 222A965FAB4; Fri, 9 Jul 2021 13:24:24 +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 4GLv5N0WFpz3Jc4; Fri, 9 Jul 2021 13:24: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 EE01E1572D; Fri, 9 Jul 2021 13:24: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 169DONQp063253; Fri, 9 Jul 2021 13:24:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DONuV063251; Fri, 9 Jul 2021 13:24:23 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:23 GMT Message-Id: <202107091324.169DONuV063251@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: fc4e7ccde0b6 - stable/12 - pf tests: Stress state retrieval 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: fc4e7ccde0b677d544a0f5ad42515b706071d093 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:24 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fc4e7ccde0b677d544a0f5ad42515b706071d093 commit fc4e7ccde0b677d544a0f5ad42515b706071d093 Author: Kristof Provost AuthorDate: 2021-06-28 10:48:20 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:07:48 +0000 pf tests: Stress state retrieval Create and retrieve 20.000 states. There have been issues with nvlists causing very slow state retrieval. We don't impose a specific limit on the time required to retrieve the states, but do log it. In excessive cases the Kyua timeout will fail this test. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30943 (cherry picked from commit d8d43b2de1fa679179f7089cb3c31e6780ec82af) --- tests/sys/netpfil/common/Makefile | 2 + tests/sys/netpfil/common/pft_synflood.py | 62 ++++++++++++++++++++++++ tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/get_state.sh | 81 ++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index 9e2fa132c84f..ce4026a5ed71 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -6,8 +6,10 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/common ${PACKAGE}FILES+= \ pft_ping.py \ + pft_synflood.py \ sniffer.py ${PACKAGE}FILESMODE_pft_ping.py= 0555 +${PACKAGE}FILESMODE_pft_synflood.py= 0555 .include diff --git a/tests/sys/netpfil/common/pft_synflood.py b/tests/sys/netpfil/common/pft_synflood.py new file mode 100644 index 000000000000..3d37724593e2 --- /dev/null +++ b/tests/sys/netpfil/common/pft_synflood.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import scapy.all as sp + +def syn_flood(args): + s = sp.conf.L2socket(iface=args.sendif[0]) + + # Set a src mac, to avoid doing lookups which really slow us down. + ether = sp.Ether(src='01:02:03:04:05') + ip = sp.IP(dst=args.to[0]) + for i in range(int(args.count[0])): + tcp = sp.TCP(flags='S', sport=1+i, dport=22, seq=500+i) + pkt = ether / ip / tcp + s.send(pkt) + +def main(): + parser = argparse.ArgumentParser("pft_synflood.py", + description="SYN flooding tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address for the SYN packets') + parser.add_argument('--count', nargs=1, + required=True, + help='The number of packets to send') + + args = parser.parse_args() + + syn_flood(args) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index a8c5aac4af08..08174ad7ce19 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -10,6 +10,7 @@ ATF_TESTS_SH+= anchor \ checksum \ forward \ fragmentation \ + get_state \ icmp \ killstate \ map_e \ diff --git a/tests/sys/netpfil/pf/get_state.sh b/tests/sys/netpfil/pf/get_state.sh new file mode 100644 index 000000000000..5e6a9040e016 --- /dev/null +++ b/tests/sys/netpfil/pf/get_state.sh @@ -0,0 +1,81 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +common_dir=$(atf_get_srcdir)/../common + +atf_test_case "many" "cleanup" +many_head() +{ + atf_set descr 'Test retrieving many states' + atf_set require.user root + atf_set require.progs scapy +} + +many_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "set timeout tcp.closed 60000" \ + "pass in proto icmp" \ + "pass in proto tcp" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 -W 1 192.0.2.2 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 20000 + + count=$(time jexec alcatraz pfctl -ss | wc -l 2>time.txt) + echo "Found $count states in `cat time.txt`" + if [ $count -lt 20000 ]; + then + atf_fail "Fail to retrieve states" + fi +} + +many_cleanup() +{ + rm -f time.txt + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "many" +} From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A2E5865FDE9; Fri, 9 Jul 2021 13:24:24 +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 4GLv5N4Gj6z3Jgj; Fri, 9 Jul 2021 13:24: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 7AB0814DFC; Fri, 9 Jul 2021 13:24: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 169DOOf7063346; Fri, 9 Jul 2021 13:24:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DOOav063345; Fri, 9 Jul 2021 13:24:24 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:24 GMT Message-Id: <202107091324.169DOOav063345@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: 36c08263b74d - stable/13 - pf tests: Stress state retrieval 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/13 X-Git-Reftype: branch X-Git-Commit: 36c08263b74db894722c952612a22c6f21c23c8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:24 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=36c08263b74db894722c952612a22c6f21c23c8c commit 36c08263b74db894722c952612a22c6f21c23c8c Author: Kristof Provost AuthorDate: 2021-06-28 10:48:20 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:07:10 +0000 pf tests: Stress state retrieval Create and retrieve 20.000 states. There have been issues with nvlists causing very slow state retrieval. We don't impose a specific limit on the time required to retrieve the states, but do log it. In excessive cases the Kyua timeout will fail this test. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30943 (cherry picked from commit d8d43b2de1fa679179f7089cb3c31e6780ec82af) --- tests/sys/netpfil/common/Makefile | 2 + tests/sys/netpfil/common/pft_synflood.py | 62 ++++++++++++++++++++++++ tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/get_state.sh | 81 ++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index e63a23b59687..915c19ba590c 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -16,8 +16,10 @@ ${PACKAGE}FILES+= \ utils.subr \ runner.subr \ pft_ping.py \ + pft_synflood.py \ sniffer.py ${PACKAGE}FILESMODE_pft_ping.py= 0555 +${PACKAGE}FILESMODE_pft_synflood.py= 0555 .include diff --git a/tests/sys/netpfil/common/pft_synflood.py b/tests/sys/netpfil/common/pft_synflood.py new file mode 100644 index 000000000000..3d37724593e2 --- /dev/null +++ b/tests/sys/netpfil/common/pft_synflood.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import scapy.all as sp + +def syn_flood(args): + s = sp.conf.L2socket(iface=args.sendif[0]) + + # Set a src mac, to avoid doing lookups which really slow us down. + ether = sp.Ether(src='01:02:03:04:05') + ip = sp.IP(dst=args.to[0]) + for i in range(int(args.count[0])): + tcp = sp.TCP(flags='S', sport=1+i, dport=22, seq=500+i) + pkt = ether / ip / tcp + s.send(pkt) + +def main(): + parser = argparse.ArgumentParser("pft_synflood.py", + description="SYN flooding tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address for the SYN packets') + parser.add_argument('--count', nargs=1, + required=True, + help='The number of packets to send') + + args = parser.parse_args() + + syn_flood(args) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index b693ca63adcb..e5139b4262e1 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -10,6 +10,7 @@ ATF_TESTS_SH+= anchor \ dup \ forward \ fragmentation \ + get_state \ icmp \ killstate \ map_e \ diff --git a/tests/sys/netpfil/pf/get_state.sh b/tests/sys/netpfil/pf/get_state.sh new file mode 100644 index 000000000000..5e6a9040e016 --- /dev/null +++ b/tests/sys/netpfil/pf/get_state.sh @@ -0,0 +1,81 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +common_dir=$(atf_get_srcdir)/../common + +atf_test_case "many" "cleanup" +many_head() +{ + atf_set descr 'Test retrieving many states' + atf_set require.user root + atf_set require.progs scapy +} + +many_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "set timeout tcp.closed 60000" \ + "pass in proto icmp" \ + "pass in proto tcp" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 -W 1 192.0.2.2 + + # Now syn flood to create many states + ${common_dir}/pft_synflood.py \ + --sendif ${epair}a \ + --to 192.0.2.2 \ + --count 20000 + + count=$(time jexec alcatraz pfctl -ss | wc -l 2>time.txt) + echo "Found $count states in `cat time.txt`" + if [ $count -lt 20000 ]; + then + atf_fail "Fail to retrieve states" + fi +} + +many_cleanup() +{ + rm -f time.txt + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "many" +} From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 039A365F6B8; Fri, 9 Jul 2021 13:24:27 +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 4GLv5Q6PfGz3JW7; Fri, 9 Jul 2021 13:24: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 C3227155D3; Fri, 9 Jul 2021 13:24: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 169DOQ8X063448; Fri, 9 Jul 2021 13:24:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DOQSw063447; Fri, 9 Jul 2021 13:24:26 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:26 GMT Message-Id: <202107091324.169DOQSw063447@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: 1882bdd192bc - stable/13 - pf: getstates: avoid taking the hashrow lock if the row is empty 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/13 X-Git-Reftype: branch X-Git-Commit: 1882bdd192bc406459dda00dda7246bb2f56b66c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:27 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1882bdd192bc406459dda00dda7246bb2f56b66c commit 1882bdd192bc406459dda00dda7246bb2f56b66c Author: Kristof Provost AuthorDate: 2021-06-29 09:34:49 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:08:32 +0000 pf: getstates: avoid taking the hashrow lock if the row is empty Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30946 (cherry picked from commit a19ff8ce9b58548a5f965db2c46eb03c38b15edb) --- sys/netpfil/pf/pf_ioctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 0097d8b0f6b6..2e332156a488 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5055,6 +5055,10 @@ pf_getstates(struct pfioc_nv *nv) for (int i = 0; i < pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; + /* Avoid taking the lock if there are no states in the row. */ + if (LIST_EMPTY(&ih->states)) + continue; + PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { if (s->timeout == PFTM_UNLINKED) From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9597965FABA; Fri, 9 Jul 2021 13:24: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 4GLv5P2KXnz3Jc9; Fri, 9 Jul 2021 13:24: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 2EFA31566D; Fri, 9 Jul 2021 13:24: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 169DOP8P063370; Fri, 9 Jul 2021 13:24:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DOPmW063369; Fri, 9 Jul 2021 13:24:25 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:25 GMT Message-Id: <202107091324.169DOPmW063369@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: 63a8dc255208 - stable/12 - pf: Reduce the data returned in DIOCGETSTATESNV 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: 63a8dc255208692f022beff22f38ae16ea51565b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:25 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=63a8dc255208692f022beff22f38ae16ea51565b commit 63a8dc255208692f022beff22f38ae16ea51565b Author: Kristof Provost AuthorDate: 2021-06-29 08:26:40 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:07:52 +0000 pf: Reduce the data returned in DIOCGETSTATESNV This call is particularly slow due to the large amount of data it returns. Remove all fields pfctl does not use. There is no functional impact to pfctl, but it somewhat speeds up the call. It might affect other (i.e. non-FreeBSD) code that uses the new interface, but this call is very new, so there's unlikely to be any. No releases contained the previous version, so we choose to live with the ABI modification. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30944 (cherry picked from commit 34285eefddc99c994c3e5374ba7836cc7cfc8e2e) --- lib/libpfctl/libpfctl.c | 22 ---------------------- lib/libpfctl/libpfctl.h | 12 ------------ sys/netpfil/pf/pf_nv.c | 34 +--------------------------------- 3 files changed, 1 insertion(+), 67 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 52cd0ed7f36c..524e2472238e 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -636,35 +636,15 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, nvlist_destroy(nv); } -static void -pf_nvstate_scrub_to_state_scrub(const nvlist_t *nvl, - struct pfctl_state_scrub *scrub) -{ - bzero(scrub, sizeof(*scrub)); - - scrub->timestamp = nvlist_get_bool(nvl, "timestamp"); - scrub->ttl = nvlist_get_number(nvl, "ttl"); - scrub->ts_mod = nvlist_get_number(nvl, "ts_mod"); -} - static void pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, struct pfctl_state_peer *peer) { bzero(peer, sizeof(*peer)); - if (nvlist_exists_nvlist(nvl, "scrub")) { - peer->scrub = malloc(sizeof(*peer->scrub)); - pf_nvstate_scrub_to_state_scrub( - nvlist_get_nvlist(nvl, "scrub"), - peer->scrub); - } - peer->seqlo = nvlist_get_number(nvl, "seqlo"); peer->seqhi = nvlist_get_number(nvl, "seqhi"); peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); - peer->max_win = nvlist_get_number(nvl, "max_win"); - peer->mss = nvlist_get_number(nvl, "mss"); peer->state = nvlist_get_number(nvl, "state"); peer->wscale = nvlist_get_number(nvl, "wscale"); } @@ -721,9 +701,7 @@ pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); - s->log = nvlist_get_number(nvl, "log"); s->state_flags = nvlist_get_number(nvl, "state_flags"); - s->timeout = nvlist_get_number(nvl, "timeout"); s->sync_flags = nvlist_get_number(nvl, "sync_flags"); } diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index a54ee9db6ec7..62866e17f904 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -197,19 +197,10 @@ struct pfctl_kill { bool kill_match; }; -struct pfctl_state_scrub { - bool timestamp; - uint8_t ttl; - uint32_t ts_mod; -}; - struct pfctl_state_peer { - struct pfctl_state_scrub *scrub; uint32_t seqlo; uint32_t seqhi; uint32_t seqdiff; - uint16_t max_win; - uint16_t mss; uint8_t state; uint8_t wscale; }; @@ -243,10 +234,7 @@ struct pfctl_state { uint32_t creation; uint32_t expire; uint32_t pfsync_time; - uint16_t tag; - uint8_t log; uint8_t state_flags; - uint8_t timeout; uint32_t sync_flags; }; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 553290c88586..e52d52642eab 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -874,52 +874,22 @@ errout: return (NULL); } -static nvlist_t * -pf_state_scrub_to_nvstate_scrub(const struct pf_state_scrub *scrub) -{ - nvlist_t *nvl; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_bool(nvl, "timestamp", scrub->pfss_flags & PFSS_TIMESTAMP); - nvlist_add_number(nvl, "ttl", scrub->pfss_ttl); - nvlist_add_number(nvl, "ts_mod", scrub->pfss_ts_mod); - - return (nvl); -} - static nvlist_t * pf_state_peer_to_nvstate_peer(const struct pf_state_peer *peer) { - nvlist_t *nvl, *tmp; + nvlist_t *nvl; nvl = nvlist_create(0); if (nvl == NULL) return (NULL); - if (peer->scrub) { - tmp = pf_state_scrub_to_nvstate_scrub(peer->scrub); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "scrub", tmp); - nvlist_destroy(tmp); - } - nvlist_add_number(nvl, "seqlo", peer->seqlo); nvlist_add_number(nvl, "seqhi", peer->seqhi); nvlist_add_number(nvl, "seqdiff", peer->seqdiff); - nvlist_add_number(nvl, "max_win", peer->max_win); - nvlist_add_number(nvl, "mss", peer->mss); nvlist_add_number(nvl, "state", peer->state); nvlist_add_number(nvl, "wscale", peer->wscale); return (nvl); - -errout: - nvlist_destroy(nvl); - return (NULL); } nvlist_t * @@ -989,9 +959,7 @@ pf_state_to_nvstate(const struct pf_state *s) nvlist_add_number(nvl, "creatorid", s->creatorid); nvlist_add_number(nvl, "direction", s->direction); - nvlist_add_number(nvl, "log", s->log); nvlist_add_number(nvl, "state_flags", s->state_flags); - nvlist_add_number(nvl, "timeout", s->timeout); if (s->src_node) flags |= PFSYNC_FLAG_SRCNODE; if (s->nat_src_node) From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 433F665FABB; Fri, 9 Jul 2021 13:24: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 4GLv5P6db1z3Jgk; Fri, 9 Jul 2021 13:24: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 AAF6C1566E; Fri, 9 Jul 2021 13:24: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 169DOPfP063394; Fri, 9 Jul 2021 13:24:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DOPwo063393; Fri, 9 Jul 2021 13:24:25 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:25 GMT Message-Id: <202107091324.169DOPwo063393@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: 9e5d987058fe - stable/13 - pf: Reduce the data returned in DIOCGETSTATESNV 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/13 X-Git-Reftype: branch X-Git-Commit: 9e5d987058fe79d46d9bc320b05630319bcca225 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:26 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9e5d987058fe79d46d9bc320b05630319bcca225 commit 9e5d987058fe79d46d9bc320b05630319bcca225 Author: Kristof Provost AuthorDate: 2021-06-29 08:26:40 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:07:21 +0000 pf: Reduce the data returned in DIOCGETSTATESNV This call is particularly slow due to the large amount of data it returns. Remove all fields pfctl does not use. There is no functional impact to pfctl, but it somewhat speeds up the call. It might affect other (i.e. non-FreeBSD) code that uses the new interface, but this call is very new, so there's unlikely to be any. No releases contained the previous version, so we choose to live with the ABI modification. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30944 (cherry picked from commit 34285eefddc99c994c3e5374ba7836cc7cfc8e2e) --- lib/libpfctl/libpfctl.c | 22 ---------------------- lib/libpfctl/libpfctl.h | 12 ------------ sys/netpfil/pf/pf_nv.c | 34 +--------------------------------- 3 files changed, 1 insertion(+), 67 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 52cd0ed7f36c..524e2472238e 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -636,35 +636,15 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, nvlist_destroy(nv); } -static void -pf_nvstate_scrub_to_state_scrub(const nvlist_t *nvl, - struct pfctl_state_scrub *scrub) -{ - bzero(scrub, sizeof(*scrub)); - - scrub->timestamp = nvlist_get_bool(nvl, "timestamp"); - scrub->ttl = nvlist_get_number(nvl, "ttl"); - scrub->ts_mod = nvlist_get_number(nvl, "ts_mod"); -} - static void pf_nvstate_peer_to_state_peer(const nvlist_t *nvl, struct pfctl_state_peer *peer) { bzero(peer, sizeof(*peer)); - if (nvlist_exists_nvlist(nvl, "scrub")) { - peer->scrub = malloc(sizeof(*peer->scrub)); - pf_nvstate_scrub_to_state_scrub( - nvlist_get_nvlist(nvl, "scrub"), - peer->scrub); - } - peer->seqlo = nvlist_get_number(nvl, "seqlo"); peer->seqhi = nvlist_get_number(nvl, "seqhi"); peer->seqdiff = nvlist_get_number(nvl, "seqdiff"); - peer->max_win = nvlist_get_number(nvl, "max_win"); - peer->mss = nvlist_get_number(nvl, "mss"); peer->state = nvlist_get_number(nvl, "state"); peer->wscale = nvlist_get_number(nvl, "wscale"); } @@ -721,9 +701,7 @@ pf_nvstate_to_state(const nvlist_t *nvl, struct pfctl_state *s) pf_nvuint_64_array(nvl, "packets", 2, s->packets, NULL); pf_nvuint_64_array(nvl, "bytes", 2, s->bytes, NULL); - s->log = nvlist_get_number(nvl, "log"); s->state_flags = nvlist_get_number(nvl, "state_flags"); - s->timeout = nvlist_get_number(nvl, "timeout"); s->sync_flags = nvlist_get_number(nvl, "sync_flags"); } diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index a54ee9db6ec7..62866e17f904 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -197,19 +197,10 @@ struct pfctl_kill { bool kill_match; }; -struct pfctl_state_scrub { - bool timestamp; - uint8_t ttl; - uint32_t ts_mod; -}; - struct pfctl_state_peer { - struct pfctl_state_scrub *scrub; uint32_t seqlo; uint32_t seqhi; uint32_t seqdiff; - uint16_t max_win; - uint16_t mss; uint8_t state; uint8_t wscale; }; @@ -243,10 +234,7 @@ struct pfctl_state { uint32_t creation; uint32_t expire; uint32_t pfsync_time; - uint16_t tag; - uint8_t log; uint8_t state_flags; - uint8_t timeout; uint32_t sync_flags; }; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 553290c88586..e52d52642eab 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -874,52 +874,22 @@ errout: return (NULL); } -static nvlist_t * -pf_state_scrub_to_nvstate_scrub(const struct pf_state_scrub *scrub) -{ - nvlist_t *nvl; - - nvl = nvlist_create(0); - if (nvl == NULL) - return (NULL); - - nvlist_add_bool(nvl, "timestamp", scrub->pfss_flags & PFSS_TIMESTAMP); - nvlist_add_number(nvl, "ttl", scrub->pfss_ttl); - nvlist_add_number(nvl, "ts_mod", scrub->pfss_ts_mod); - - return (nvl); -} - static nvlist_t * pf_state_peer_to_nvstate_peer(const struct pf_state_peer *peer) { - nvlist_t *nvl, *tmp; + nvlist_t *nvl; nvl = nvlist_create(0); if (nvl == NULL) return (NULL); - if (peer->scrub) { - tmp = pf_state_scrub_to_nvstate_scrub(peer->scrub); - if (tmp == NULL) - goto errout; - nvlist_add_nvlist(nvl, "scrub", tmp); - nvlist_destroy(tmp); - } - nvlist_add_number(nvl, "seqlo", peer->seqlo); nvlist_add_number(nvl, "seqhi", peer->seqhi); nvlist_add_number(nvl, "seqdiff", peer->seqdiff); - nvlist_add_number(nvl, "max_win", peer->max_win); - nvlist_add_number(nvl, "mss", peer->mss); nvlist_add_number(nvl, "state", peer->state); nvlist_add_number(nvl, "wscale", peer->wscale); return (nvl); - -errout: - nvlist_destroy(nvl); - return (NULL); } nvlist_t * @@ -989,9 +959,7 @@ pf_state_to_nvstate(const struct pf_state *s) nvlist_add_number(nvl, "creatorid", s->creatorid); nvlist_add_number(nvl, "direction", s->direction); - nvlist_add_number(nvl, "log", s->log); nvlist_add_number(nvl, "state_flags", s->state_flags); - nvlist_add_number(nvl, "timeout", s->timeout); if (s->src_node) flags |= PFSYNC_FLAG_SRCNODE; if (s->nat_src_node) From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9767265FEC5; Fri, 9 Jul 2021 13:24: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 4GLv5Q3Y5zz3Jk3; Fri, 9 Jul 2021 13:24: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 36B1E155D2; Fri, 9 Jul 2021 13:24: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 169DOQ03063420; Fri, 9 Jul 2021 13:24:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DOQKH063419; Fri, 9 Jul 2021 13:24:26 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:26 GMT Message-Id: <202107091324.169DOQKH063419@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: b43db87c97dd - stable/12 - pf: getstates: avoid taking the hashrow lock if the row is empty 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: b43db87c97dd396da866919842715aef7b84daba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:26 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b43db87c97dd396da866919842715aef7b84daba commit b43db87c97dd396da866919842715aef7b84daba Author: Kristof Provost AuthorDate: 2021-06-29 09:34:49 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:08:32 +0000 pf: getstates: avoid taking the hashrow lock if the row is empty Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30946 (cherry picked from commit a19ff8ce9b58548a5f965db2c46eb03c38b15edb) --- sys/netpfil/pf/pf_ioctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 0ce39db05c15..92b0cda8261e 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5122,6 +5122,10 @@ pf_getstates(struct pfioc_nv *nv) for (int i = 0; i < pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; + /* Avoid taking the lock if there are no states in the row. */ + if (LIST_EMPTY(&ih->states)) + continue; + PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { if (s->timeout == PFTM_UNLINKED) From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1419365F6C3; Fri, 9 Jul 2021 13:24: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 4GLv5T52xfz3JfX; Fri, 9 Jul 2021 13:24: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 1217815783; Fri, 9 Jul 2021 13:24: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 169DOSv1063559; Fri, 9 Jul 2021 13:24:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DOSRa063558; Fri, 9 Jul 2021 13:24:28 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:28 GMT Message-Id: <202107091324.169DOSRa063558@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: 1f4a64039692 - stable/13 - netpfil tests: Basic dummynet pipe test 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/13 X-Git-Reftype: branch X-Git-Commit: 1f4a6403969271885d1c37fd642820d5a6562791 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:30 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1f4a6403969271885d1c37fd642820d5a6562791 commit 1f4a6403969271885d1c37fd642820d5a6562791 Author: Kristof Provost AuthorDate: 2021-05-21 09:14:34 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:09:34 +0000 netpfil tests: Basic dummynet pipe test Test dummynet pipes (i.e. bandwidth limitation) with ipfw. This is put in the common tests because we hope to add dummynet support to pf in the near future. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30380 (cherry picked from commit ea3eca5cb6dbcb4deb7c7277a65c48911f0475d1) --- tests/sys/netpfil/common/Makefile | 1 + tests/sys/netpfil/common/dummynet.sh | 75 ++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/common/utils.subr | 15 ++++++++ 3 files changed, 91 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index 915c19ba590c..749e0dd99469 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/common ATF_TESTS_SH+= \ + dummynet \ pass_block \ nat \ tos \ diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh new file mode 100644 index 000000000000..82cd22b77fef --- /dev/null +++ b/tests/sys/netpfil/common/dummynet.sh @@ -0,0 +1,75 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. + +. $(atf_get_srcdir)/utils.subr +. $(atf_get_srcdir)/runner.subr + +pipe_head() +{ + atf_set descr 'Basic pipe test' + atf_set require.user root +} + +pipe_body() +{ + fw=$1 + firewall_init $fw + dummynet_init $fw + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec alcatraz dnctl pipe 1 config bw 30Byte/s + + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1000 pipe 1 ip from any to any" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Saturate the link + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +pipe_cleanup() +{ + firewall_cleanup $1 +} + +setup_tests \ + pipe \ + ipfw diff --git a/tests/sys/netpfil/common/utils.subr b/tests/sys/netpfil/common/utils.subr index 3f9d6b40183a..722271981af4 100644 --- a/tests/sys/netpfil/common/utils.subr +++ b/tests/sys/netpfil/common/utils.subr @@ -103,6 +103,21 @@ firewall_init() } +dummynet_init() +{ + firewall=$1 + + if ! kldstat -q -m dummynet; then + atf_skip "This test requires dummynet" + fi + + if [ ${firewall} == "ipfw" ]; then + # Nothing. This is okay. + else + atf_skip "${firewall} does not support dummynet" + fi +} + nat_init() { firewall=$1 From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BFDC565FF53; Fri, 9 Jul 2021 13:24: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 4GLv5S2hvHz3Jk8; Fri, 9 Jul 2021 13:24: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 E9817155D4; Fri, 9 Jul 2021 13:24:27 +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 169DOR2c063497; Fri, 9 Jul 2021 13:24:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DORsI063496; Fri, 9 Jul 2021 13:24:27 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:27 GMT Message-Id: <202107091324.169DORsI063496@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: 4debb6a3a027 - stable/13 - libpfctl: memory leak fix 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/13 X-Git-Reftype: branch X-Git-Commit: 4debb6a3a027498aa657fcb79007d9936fc8b771 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:31 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4debb6a3a027498aa657fcb79007d9936fc8b771 commit 4debb6a3a027498aa657fcb79007d9936fc8b771 Author: Kristof Provost AuthorDate: 2021-06-30 11:02:35 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:08:37 +0000 libpfctl: memory leak fix We must remember to free the nvlist we create from the kernel's response to DIOCGETSTATESNV, on every iteration. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30957 (cherry picked from commit 0e9f1892ec739d7fbd854af699507167a0a5dde2) --- lib/libpfctl/libpfctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 524e2472238e..bbb53edf8bc1 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -727,6 +727,7 @@ pfctl_get_states(int dev, struct pfctl_states *states) goto out; } + nvlist_destroy(nvl); nvl = nvlist_unpack(nv.data, nv.len, 0); if (nvl == NULL) { error = EIO; From owner-dev-commits-src-all@freebsd.org Fri Jul 9 13:24:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 852E165FF52; Fri, 9 Jul 2021 13:24: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 4GLv5R5mjjz3Jk6; Fri, 9 Jul 2021 13:24:27 +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 58F141566F; Fri, 9 Jul 2021 13:24:27 +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 169DOR4J063473; Fri, 9 Jul 2021 13:24:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169DORsm063472; Fri, 9 Jul 2021 13:24:27 GMT (envelope-from git) Date: Fri, 9 Jul 2021 13:24:27 GMT Message-Id: <202107091324.169DORsm063472@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: e553299fd630 - stable/12 - libpfctl: memory leak fix 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: e553299fd630d181401f9179aacca62682e2f26c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:24:29 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e553299fd630d181401f9179aacca62682e2f26c commit e553299fd630d181401f9179aacca62682e2f26c Author: Kristof Provost AuthorDate: 2021-06-30 11:02:35 +0000 Commit: Kristof Provost CommitDate: 2021-07-09 08:08:39 +0000 libpfctl: memory leak fix We must remember to free the nvlist we create from the kernel's response to DIOCGETSTATESNV, on every iteration. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30957 (cherry picked from commit 0e9f1892ec739d7fbd854af699507167a0a5dde2) --- lib/libpfctl/libpfctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 524e2472238e..bbb53edf8bc1 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -727,6 +727,7 @@ pfctl_get_states(int dev, struct pfctl_states *states) goto out; } + nvlist_destroy(nvl); nvl = nvlist_unpack(nv.data, nv.len, 0); if (nvl == NULL) { error = EIO; From owner-dev-commits-src-all@freebsd.org Fri Jul 9 14:26:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1E3B6660C18; Fri, 9 Jul 2021 14:26: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 4GLwST088Cz3j67; Fri, 9 Jul 2021 14:26: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 E0C7E162B7; Fri, 9 Jul 2021 14:26: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 169EQ0xk043402; Fri, 9 Jul 2021 14:26:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169EQ0uW043401; Fri, 9 Jul 2021 14:26:00 GMT (envelope-from git) Date: Fri, 9 Jul 2021 14:26:00 GMT Message-Id: <202107091426.169EQ0uW043401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Tuffli Subject: git: a7761d19dacd - stable/13 - bhyve: Fix NVMe iovec construction for large IOs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a7761d19dacd414c8b8269a6cf909ab4528783dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 14:26:01 -0000 The branch stable/13 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=a7761d19dacd414c8b8269a6cf909ab4528783dc commit a7761d19dacd414c8b8269a6cf909ab4528783dc Author: Chuck Tuffli AuthorDate: 2021-06-27 22:14:52 +0000 Commit: Chuck Tuffli CommitDate: 2021-07-09 14:24:14 +0000 bhyve: Fix NVMe iovec construction for large IOs The UEFI driver included with Rocky Linux 8.4 uncovered an existing bug in the NVMe emulation's construction of iovec's. By default, NVMe data transfer operations use a scatter-gather list in which all entries point to a fixed size memory region. For example, if the Memory Page Size is 4KiB, a 2MiB IO requires 512 entries. Lists themselves are also fixed size (default is 512 entries). Because the list size is fixed, the last entry is special. If the IO requires more than 512 entries, the last entry in the list contains the address of the next list of entries. But if the IO requires exactly 512 entries, the last entry points to data. The NVMe emulation missed this logic and unconditionally treated the last entry as a pointer to the next list. Fix is to check if the remaining data is greater than the page size before using the last entry as a pointer to the next list. PR: 256422 Reported by: dave@syix.com Tested by: jason@tubnor.net Relnotes: yes (cherry picked from commit 91064841d72b285a146a3f1c32cb447251e062ea) --- usr.sbin/bhyve/pci_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 24f401630d6d..bd21819f0607 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -1976,7 +1976,7 @@ nvme_write_read_blockif(struct pci_nvme_softc *sc, /* PRP2 is pointer to a physical region page list */ while (bytes) { /* Last entry in list points to the next list */ - if (prp_list == last) { + if ((prp_list == last) && (bytes > PAGE_SIZE)) { uint64_t prp = *prp_list; prp_list = paddr_guest2host(vmctx, prp, From owner-dev-commits-src-all@freebsd.org Fri Jul 9 14:27:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0BE0B660E88; Fri, 9 Jul 2021 14:27: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 4GLwVF6YKFz3jMn; Fri, 9 Jul 2021 14:27: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 C8AFC16233; Fri, 9 Jul 2021 14:27: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 169ERXGC043687; Fri, 9 Jul 2021 14:27:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169ERXw8043686; Fri, 9 Jul 2021 14:27:33 GMT (envelope-from git) Date: Fri, 9 Jul 2021 14:27:33 GMT Message-Id: <202107091427.169ERXw8043686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Tuffli Subject: git: cd8a5d2316a1 - stable/12 - bhyve: Fix NVMe iovec construction for large IOs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cd8a5d2316a12a8abca458c31467dc9dcf8361ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 14:27:34 -0000 The branch stable/12 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=cd8a5d2316a12a8abca458c31467dc9dcf8361ce commit cd8a5d2316a12a8abca458c31467dc9dcf8361ce Author: Chuck Tuffli AuthorDate: 2021-06-27 22:14:52 +0000 Commit: Chuck Tuffli CommitDate: 2021-07-09 14:25:45 +0000 bhyve: Fix NVMe iovec construction for large IOs The UEFI driver included with Rocky Linux 8.4 uncovered an existing bug in the NVMe emulation's construction of iovec's. By default, NVMe data transfer operations use a scatter-gather list in which all entries point to a fixed size memory region. For example, if the Memory Page Size is 4KiB, a 2MiB IO requires 512 entries. Lists themselves are also fixed size (default is 512 entries). Because the list size is fixed, the last entry is special. If the IO requires more than 512 entries, the last entry in the list contains the address of the next list of entries. But if the IO requires exactly 512 entries, the last entry points to data. The NVMe emulation missed this logic and unconditionally treated the last entry as a pointer to the next list. Fix is to check if the remaining data is greater than the page size before using the last entry as a pointer to the next list. PR: 256422 Reported by: dave@syix.com Tested by: jason@tubnor.net Relnotes: yes (cherry picked from commit 91064841d72b285a146a3f1c32cb447251e062ea) --- usr.sbin/bhyve/pci_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 2679874d73fc..5f7a13d492f2 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -1973,7 +1973,7 @@ nvme_write_read_blockif(struct pci_nvme_softc *sc, /* PRP2 is pointer to a physical region page list */ while (bytes) { /* Last entry in list points to the next list */ - if (prp_list == last) { + if ((prp_list == last) && (bytes > PAGE_SIZE)) { uint64_t prp = *prp_list; prp_list = paddr_guest2host(vmctx, prp, From owner-dev-commits-src-all@freebsd.org Fri Jul 9 15:16:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A92E661901; Fri, 9 Jul 2021 15:16: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 4GLxb90BZnz3rCN; Fri, 9 Jul 2021 15:16: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 E28C016EFA; Fri, 9 Jul 2021 15:16: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 169FGqfc011852; Fri, 9 Jul 2021 15:16:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169FGqte011851; Fri, 9 Jul 2021 15:16:52 GMT (envelope-from git) Date: Fri, 9 Jul 2021 15:16:52 GMT Message-Id: <202107091516.169FGqte011851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 1472117a1e1c - main - Support fixed size, variable location acpi resources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1472117a1e1c40f10b9c3a48788fbf8355588ee8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 15:16:53 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1472117a1e1c40f10b9c3a48788fbf8355588ee8 commit 1472117a1e1c40f10b9c3a48788fbf8355588ee8 Author: Andrew Turner AuthorDate: 2021-07-08 15:25:38 +0000 Commit: Andrew Turner CommitDate: 2021-07-09 01:31:19 +0000 Support fixed size, variable location acpi resources These have been found in some Arm ACPI tables generated by edk2, e.g. when describing the pl011 uart on the Arm AEMv8 model. Reviewed by: imp, jkim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31110 --- sys/dev/acpica/acpi_resource.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index fbd0baaa7d37..2e813276af8f 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -421,6 +421,27 @@ acpi_parse_resource(ACPI_RESOURCE *res, void *context) (uintmax_t)min, (uintmax_t)length)); set->set_ioport(dev, arc->context, min, length); } + } else if (res->Data.Address.MinAddressFixed != ACPI_ADDRESS_FIXED && + res->Data.Address.MaxAddressFixed != ACPI_ADDRESS_FIXED) { + /* Fixed size, variable location resource descriptor */ + min = roundup(min, gran + 1); + if ((min + length - 1) > max) { + device_printf(dev, + "invalid memory range: start: %jx end: %jx max: %jx\n", + (uintmax_t)min, (uintmax_t)(min + length - 1), + (uintmax_t)max); + } else { + if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, + "%s/Memory 0x%jx/%ju\n", name, (uintmax_t)min, + (uintmax_t)length)); + set->set_memory(dev, arc->context, min, length); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s/IO 0x%jx/%ju\n", + name, (uintmax_t)min, (uintmax_t)length)); + set->set_ioport(dev, arc->context, min, length); + } + } } else { if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) { ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, From owner-dev-commits-src-all@freebsd.org Fri Jul 9 17:26:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8A27F663BA1; Fri, 9 Jul 2021 17:26: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 4GM0TF3GxRz4b9w; Fri, 9 Jul 2021 17:26:57 +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 58AB91899A; Fri, 9 Jul 2021 17:26: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 169HQvxR084474; Fri, 9 Jul 2021 17:26:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169HQvGQ084473; Fri, 9 Jul 2021 17:26:57 GMT (envelope-from git) Date: Fri, 9 Jul 2021 17:26:57 GMT Message-Id: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72821668b039c276914569e9caa1cdfa4e4cb674 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 17:26:57 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=72821668b039c276914569e9caa1cdfa4e4cb674 commit 72821668b039c276914569e9caa1cdfa4e4cb674 Author: Warner Losh AuthorDate: 2021-07-09 17:21:18 +0000 Commit: Warner Losh CommitDate: 2021-07-09 17:21:18 +0000 stand/kmem_zalloc: panic when a M_WAITOK allocation fails Malloc() might return NULL, in which case we will panic with a NULL pointer deref. Make it panic when the allocation fails to preserve the postcondtion that we never return a non-NULL value. Reviewed by: tsoome PR: 249859 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31106 --- sys/sys/malloc.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 0c585c5a0dcf..b8c2788edd44 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -298,16 +298,20 @@ extern void *Malloc(size_t bytes, const char *file, int line); * flags mean anything and there's no need declare malloc types. * Define the simple alloc / free routines in terms of Malloc and * Free. None of the kernel features that this stuff disables are needed. - * - * XXX we are setting ourselves up for a potential crash if we can't allocate - * memory for a M_WAITOK call. */ -#define M_WAITOK 0 +#define M_WAITOK 1 #define M_ZERO 0 -#define M_NOWAIT 0 +#define M_NOWAIT 2 #define MALLOC_DECLARE(x) -#define kmem_zalloc(size, flags) Malloc((size), __FILE__, __LINE__) +#define kmem_zalloc(size, flags) ({ \ + void *p = Malloc((size), __FILE__, __LINE__); \ + if (p == NULL && (flags & M_WAITOK) != 0) \ + panic("Could not malloc %zd bytes with M_WAITOK from %s line %d", \ + (size_t)size, __FILE__, __LINE__); \ + p; \ +}) + #define kmem_free(p, size) Free(p, __FILE__, __LINE__) /* @@ -315,5 +319,6 @@ extern void *Malloc(size_t bytes, const char *file, int line); * M_WAITOK. Given the above, it will also be a nop. */ #define KM_SLEEP M_WAITOK +#define KM_NOSLEEP M_NOWAIT #endif /* _STANDALONE */ #endif /* !_SYS_MALLOC_H_ */ From owner-dev-commits-src-all@freebsd.org Fri Jul 9 17:26:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CF00C66395A; Fri, 9 Jul 2021 17:26:58 +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 4GM0TG4sHPz4Zy3; Fri, 9 Jul 2021 17:26:58 +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 7B3C918A1A; Fri, 9 Jul 2021 17:26: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 169HQw8C084499; Fri, 9 Jul 2021 17:26:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169HQwsR084498; Fri, 9 Jul 2021 17:26:58 GMT (envelope-from git) Date: Fri, 9 Jul 2021 17:26:58 GMT Message-Id: <202107091726.169HQwsR084498@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9e3761d126c5 - main - arm: remove fslsdma from GENERIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e3761d126c5c019d6c935e83989928eb1a0e76e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 17:26:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9e3761d126c5c019d6c935e83989928eb1a0e76e commit 9e3761d126c5c019d6c935e83989928eb1a0e76e Author: MIHIRA Sanpei Yoshiro AuthorDate: 2021-07-09 17:12:39 +0000 Commit: Warner Losh CommitDate: 2021-07-09 17:21:40 +0000 arm: remove fslsdma from GENERIC The fslsdma device requires sdma_fw, but that's not included in GENERIC. That firmware is not in the FreeBSD tree at the moment, but could easily be. The license for the firmware can be found in the linux firmware repo: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=3123d78e09d2f815de4d94aa35c07b3c0469c80e and looks to be a BSD license + no reverse engineer. We can add this back after the firmware is imported, made a port, or whose automatic loading can be made to happen. Reviewed by: imp (with ian finding the license) PR: 237466 MFC after: 1 week --- sys/arm/conf/GENERIC | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 427f354d1f93..34876e285f8d 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -258,7 +258,6 @@ device ti_pruss device ti_mbox # DMA controller -device fslsdma device ti_sdma device a10_dmac device a31_dmac From owner-dev-commits-src-all@freebsd.org Fri Jul 9 17:56:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 72F83664226; Fri, 9 Jul 2021 17:56: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 4GM17C2gBNz4f8L; Fri, 9 Jul 2021 17:56: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 439CB191B4; Fri, 9 Jul 2021 17:56: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 169HuNSG024203; Fri, 9 Jul 2021 17:56:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169HuNf4024202; Fri, 9 Jul 2021 17:56:23 GMT (envelope-from git) Date: Fri, 9 Jul 2021 17:56:23 GMT Message-Id: <202107091756.169HuNf4024202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: c5cbef2f85e6 - main - math(3): Use the .Fa macro for function arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5cbef2f85e6020ef8357b7d3af3ca228a262309 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 17:56:23 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c5cbef2f85e6020ef8357b7d3af3ca228a262309 commit c5cbef2f85e6020ef8357b7d3af3ca228a262309 Author: Gordon Bergling AuthorDate: 2021-07-09 17:51:44 +0000 Commit: Gordon Bergling CommitDate: 2021-07-09 17:51:44 +0000 math(3): Use the .Fa macro for function arguments .Fa is the suitable macro for functions in comparsion to the .Ar macro, which should be used for commandline arguments. While here, fix some mandoc warnings. Reviewed by: imp (earlier version) Obtained from: OpenBSD (in partial) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31090 --- lib/msun/man/acos.3 | 2 +- lib/msun/man/acosh.3 | 4 ++-- lib/msun/man/asin.3 | 2 +- lib/msun/man/asinh.3 | 4 ++-- lib/msun/man/atan2.3 | 16 ++++++++-------- lib/msun/man/atanh.3 | 6 +++--- lib/msun/man/ccos.3 | 2 +- lib/msun/man/ccosh.3 | 2 +- lib/msun/man/exp.3 | 8 ++++---- lib/msun/man/sincos.3 | 6 +++--- lib/msun/man/sqrt.3 | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/msun/man/acos.3 b/lib/msun/man/acos.3 index e0c7e676f5d6..4e75f854c1da 100644 --- a/lib/msun/man/acos.3 +++ b/lib/msun/man/acos.3 @@ -60,7 +60,7 @@ These functions return the arc cosine in the range radians. If: .Bd -unfilled -offset indent -.Pf \&| Ns Ar x Ns \&| > 1 , +.Pf \&| Ns Fa x Ns \&| > 1 , .Ed .Pp .Fn acos x diff --git a/lib/msun/man/acosh.3 b/lib/msun/man/acosh.3 index 6af85f85ddfb..c2943317573c 100644 --- a/lib/msun/man/acosh.3 +++ b/lib/msun/man/acosh.3 @@ -55,13 +55,13 @@ and functions compute the inverse hyperbolic cosine of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic cosine of -.Ar x . +.Fa x . If the argument is less than 1, .Fn acosh raises an invalid exception and returns an \*(Na. diff --git a/lib/msun/man/asin.3 b/lib/msun/man/asin.3 index 8bb3c3be66ec..15c181bd8d1f 100644 --- a/lib/msun/man/asin.3 +++ b/lib/msun/man/asin.3 @@ -62,7 +62,7 @@ These functions return the arc sine in the range radians. If: .Bd -unfilled -offset indent -.Pf \&| Ns Ar x Ns \&| > 1 +.Pf \&| Ns Fa x Ns \&| > 1 .Ed .Pp .Fn asin x diff --git a/lib/msun/man/asinh.3 b/lib/msun/man/asinh.3 index 38b33175dd2a..c2181dc49d32 100644 --- a/lib/msun/man/asinh.3 +++ b/lib/msun/man/asinh.3 @@ -55,13 +55,13 @@ and functions compute the inverse hyperbolic sine of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic sine of -.Ar x . +.Fa x . .Sh SEE ALSO .Xr acosh 3 , .Xr atanh 3 , diff --git a/lib/msun/man/atan2.3 b/lib/msun/man/atan2.3 index 59c8a0e3de36..307dadd1a628 100644 --- a/lib/msun/man/atan2.3 +++ b/lib/msun/man/atan2.3 @@ -63,7 +63,7 @@ The and .Fn atan2l functions compute the principal value of the arc tangent of -.Fa y/ Ns Ar x , +.Fa y/ Ns Fa x , using the signs of both arguments to determine the quadrant of the return value. .Pp @@ -94,7 +94,7 @@ and .Fn atan2l functions, if successful, return the arc tangent of -.Fa y/ Ns Ar x +.Fa y/ Ns Fa x in the range .Bk -words .Bq \&- Ns \*(Pi , \&+ Ns \*(Pi @@ -105,22 +105,22 @@ Here are some of the special cases: .It Fn atan2 y x No := Ta .Fn atan y/x Ta if -.Ar x +.Fa x > 0, -.It Ta sign( Ns Ar y Ns )*(\*(Pi - +.It Ta sign( Ns Fa y Ns )*(\*(Pi - .Fn atan "\*(Bay/x\*(Ba" ) Ta if -.Ar x +.Fa x < 0, .It Ta .No 0 Ta if x = y = 0, or .It Ta -.Pf sign( Ar y Ns )*\*(Pi/2 Ta +.Pf sign( Fa y Ns )*\*(Pi/2 Ta if -.Ar x +.Fa x = 0 \(!= -.Ar y . +.Fa y . .El .Sh NOTES The function diff --git a/lib/msun/man/atanh.3 b/lib/msun/man/atanh.3 index 5c3bb7e30f16..5984ee89337e 100644 --- a/lib/msun/man/atanh.3 +++ b/lib/msun/man/atanh.3 @@ -55,18 +55,18 @@ and functions compute the inverse hyperbolic tangent of the real argument -.Ar x . +.Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES These functions return the inverse hyperbolic tangent of -.Ar x +.Fa x if successful. If the argument has absolute value 1, a divide-by-zero exception is raised and an infinity is returned. If -.Ar |x| +.Fa |x| > 1, an invalid exception is raised and an \*(Na is returned. .Sh SEE ALSO .Xr acosh 3 , diff --git a/lib/msun/man/ccos.3 b/lib/msun/man/ccos.3 index c07205e6d91d..2c66b6b1b9cf 100644 --- a/lib/msun/man/ccos.3 +++ b/lib/msun/man/ccos.3 @@ -31,7 +31,7 @@ .Nm ccos , .Nm ccosf , .Nm csin , -.Nm csinf +.Nm csinf , .Nm ctan , .Nm ctanf .Nd complex trigonometric functions diff --git a/lib/msun/man/ccosh.3 b/lib/msun/man/ccosh.3 index f006442cdc1d..748b5429b072 100644 --- a/lib/msun/man/ccosh.3 +++ b/lib/msun/man/ccosh.3 @@ -31,7 +31,7 @@ .Nm ccosh , .Nm ccoshf , .Nm csinh , -.Nm csinhf +.Nm csinhf , .Nm ctanh , .Nm ctanhf .Nd complex hyperbolic functions diff --git a/lib/msun/man/exp.3 b/lib/msun/man/exp.3 index 2244bfac375a..ee43081bad83 100644 --- a/lib/msun/man/exp.3 +++ b/lib/msun/man/exp.3 @@ -108,9 +108,9 @@ and the .Fn powl functions compute the value of -.Ar x +.Fa x to the exponent -.Ar y . +.Fa y . .Sh ERROR (due to Roundoff etc.) The values of .Fn exp 0 , @@ -181,8 +181,8 @@ then \*(Na**0 = 1 too because x**0 = 1 for all finite and infinite x, i.e., independently of x. .El .Sh SEE ALSO -.Xr clog 3 -.Xr cpow 3 +.Xr clog 3 , +.Xr cpow 3 , .Xr fenv 3 , .Xr ldexp 3 , .Xr log 3 , diff --git a/lib/msun/man/sincos.3 b/lib/msun/man/sincos.3 index 7d44bea931b1..eecccf3cf37a 100644 --- a/lib/msun/man/sincos.3 +++ b/lib/msun/man/sincos.3 @@ -67,13 +67,13 @@ Upon returning from and .Fn sincosl , the memory pointed to by -.Ar "*s" +.Fa "*s" and -.Ar "*c" +.Fa "*c" are assigned the values of sine and cosine, respectively. .Sh SEE ALSO .Xr cos 3 , -.Xr sin 3 , +.Xr sin 3 .Sh HISTORY These functions were added to .Fx 9.0 diff --git a/lib/msun/man/sqrt.3 b/lib/msun/man/sqrt.3 index bf6c3436cdbf..8214f8a2a7fb 100644 --- a/lib/msun/man/sqrt.3 +++ b/lib/msun/man/sqrt.3 @@ -63,7 +63,7 @@ and .Fn cbrtl functions compute the cube root of -.Ar x . +.Fa x . .Pp The .Fn sqrt , @@ -72,7 +72,7 @@ and .Fn sqrtl functions compute the non-negative square root of -.Ar x . +.Fa x . .Sh RETURN VALUES The .Fn cbrt , From owner-dev-commits-src-all@freebsd.org Fri Jul 9 19:34:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 53A1C6653E7; Fri, 9 Jul 2021 19:34: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 4GM3Jb1f2fz4v6N; Fri, 9 Jul 2021 19:34: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 1C51C1A618; Fri, 9 Jul 2021 19:34: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 169JYcLe057364; Fri, 9 Jul 2021 19:34:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169JYcWt057363; Fri, 9 Jul 2021 19:34:38 GMT (envelope-from git) Date: Fri, 9 Jul 2021 19:34:38 GMT Message-Id: <202107091934.169JYcWt057363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 82626fef6253 - main - iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82626fef6253a9172163df137097f54e93e3c209 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 19:34:39 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=82626fef6253a9172163df137097f54e93e3c209 commit 82626fef6253a9172163df137097f54e93e3c209 Author: Vladimir Kondratyev AuthorDate: 2021-07-09 19:32:59 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-09 19:32:59 +0000 iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts during suspend/resume cycle. Previously used bus_generic_suspend_intr and bus_generic_resume_intr may cause interrupt storm because of missed interrupt acknowledges caused by blocking of intr handler. Reported by: J.R. Oldroyd MFC after: 1 week --- sys/dev/iicbus/iichid.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index 68d7cfd9090f..d95ffb8add88 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -177,6 +177,7 @@ struct iichid_softc { struct task event_task; #endif + struct task suspend_task; bool open; /* iicbus lock */ bool suspend; /* iicbus lock */ bool power_on; /* iicbus lock */ @@ -188,6 +189,8 @@ static device_detach_t iichid_detach; static device_resume_t iichid_resume; static device_suspend_t iichid_suspend; +static void iichid_suspend_task(void *, int); + #ifdef IICHID_SAMPLING static int iichid_setup_callout(struct iichid_softc *); static int iichid_reset_callout(struct iichid_softc *); @@ -1075,6 +1078,7 @@ iichid_attach(device_t dev) sc->power_on = true; + TASK_INIT(&sc->suspend_task, 0, iichid_suspend_task, sc); #ifdef IICHID_SAMPLING TASK_INIT(&sc->event_task, 0, iichid_event_task, sc); /* taskqueue_create can't fail with M_WAITOK mflag passed. */ @@ -1146,7 +1150,6 @@ iichid_attach(device_t dev) device_printf(dev, "failed to attach child: error %d\n", error); iichid_detach(dev); } - done: (void)iichid_set_power(sc, I2C_HID_POWER_OFF); sc->power_on = false; @@ -1175,6 +1178,14 @@ iichid_detach(device_t dev) return (0); } +static void +iichid_suspend_task(void *context, int pending) +{ + struct iichid_softc *sc = context; + + iichid_teardown_interrupt(sc); +} + static int iichid_suspend(device_t dev) { @@ -1183,12 +1194,6 @@ iichid_suspend(device_t dev) sc = device_get_softc(dev); (void)bus_generic_suspend(dev); -#ifdef IICHID_SAMPLING - if (sc->sampling_rate_slow < 0) -#endif - (void)bus_generic_suspend_intr(device_get_parent(dev), dev, - sc->irq_res); - /* * 8.2 - The HOST is going into a deep power optimized state and wishes * to put all the devices into a low power state also. The HOST @@ -1202,6 +1207,24 @@ iichid_suspend(device_t dev) else DPRINTF(sc, "Successfully set power_state\n"); +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow < 0) +#endif + { + /* + * bus_teardown_intr can not be executed right here as it wants + * to run on certain CPU to interacts with LAPIC while suspend + * thread is bound to CPU0. So run it from taskqueue context. + */ +#ifdef IICHID_SAMPLING +#define suspend_thread sc->taskqueue +#else +#define suspend_thread taskqueue_thread +#endif + taskqueue_enqueue(suspend_thread, &sc->suspend_task); + taskqueue_drain(suspend_thread, &sc->suspend_task); + } + return (0); } @@ -1212,6 +1235,11 @@ iichid_resume(device_t dev) int error; sc = device_get_softc(dev); +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow < 0) +#endif + iichid_setup_interrupt(sc); + DPRINTF(sc, "Resume called, setting device to power_state 0\n"); error = iichid_set_power_state(sc, IICHID_PS_NULL, IICHID_PS_ON); if (error != 0) @@ -1219,11 +1247,6 @@ iichid_resume(device_t dev) else DPRINTF(sc, "Successfully set power_state\n"); (void)bus_generic_resume(dev); -#ifdef IICHID_SAMPLING - if (sc->sampling_rate_slow < 0) -#endif - (void)bus_generic_resume_intr(device_get_parent(dev), dev, - sc->irq_res); return (0); } From owner-dev-commits-src-all@freebsd.org Fri Jul 9 19:54:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A75346656A6 for ; Fri, 9 Jul 2021 19:54:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (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 4GM3lR3tlbz3D3h for ; Fri, 9 Jul 2021 19:54:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x831.google.com with SMTP id d10so1129640qtw.7 for ; Fri, 09 Jul 2021 12:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7VXe/T725BhUcviId67HBLTEjgIEQSFSJdaeow7whlk=; b=DQVwCxIVXGVFpTtz0XqbECcJwz94PPV94FGhV6vTL6QEH9hjOlTYh/MDs3FVQ89oWM Ty1hIGgjPPBwP0JLYiU2dFPlLNLp1Ceqbi0VJQJxCD+YyYO6nuCn5M7GY5D9hI5mOgp/ b5zTpfz2/WGc5Gca6hgFY780cqTABjHLbS3QCMjZrvAV1+CATDoZrd04ytnTmGqBRmfn 8Jq+leC+iClswRcOojQP6ZBsNOuGjL67lDA3MfpvmIlPR4XkUlT2nvy3pCyMBBk+Giay t+oodPAb03W/UrOCvzkD+W1TB2CIqhxahKbX29i8gcEl7w0T0fLYjVrGiZhBi1buo/Tf 5pVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7VXe/T725BhUcviId67HBLTEjgIEQSFSJdaeow7whlk=; b=gFu2CRq888OEg6x0mTgzThsudeKRrt2OC+pynpjOvCKge0In1R3p0R2uBEG0EP79QX f4I/fY62ZKf8WUrO6Iui+BqpBcImCY8DDOhVT7MCxUsZV+775CEJ4Qwz1Tb97DAUmrp+ er8UvgWU7feceAVIb9eTJdAFKKmSg6O+2jztMnr0I7has2lTHTiIfVf2ewyZhAMpBLSi jMX4qgIKCJArJUZeaRXIKZ0/Fh/7viwrGmEF4llVlMq7CarLa/266nCVE+oP6m3Dr4I5 a3WfrcdrTzOKmVebfLDhcZsIOVHDFoZKC9V2Xlru+Di00I/UYVCDNxLFRaGG2lS2SacK 0NzQ== X-Gm-Message-State: AOAM532l8/tLJARcveVbexRma/TUtXRe7sVMBsQBevnPkyAmu3g6Tz0V GtBkPs/NcSfriNFvsPp/u1t1upzSJcE3gVOq X-Google-Smtp-Source: ABdhPJzAp06cIY49U8j4hLKsIYbvf2KhUc7rIdOpkkDNPJ4167WFHp+CVBd27HneflKLoMMLjHkYDw== X-Received: by 2002:ac8:5314:: with SMTP id t20mr2842703qtn.235.1625860466668; Fri, 09 Jul 2021 12:54:26 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id d26sm480810qka.107.2021.07.09.12.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 12:54:26 -0700 (PDT) Date: Fri, 9 Jul 2021 15:54:25 -0400 From: Shawn Webb To: Warner Losh Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails Message-ID: <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bbnarx7wbuksohxs" Content-Disposition: inline In-Reply-To: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4GM3lR3tlbz3D3h 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 19:54:27 -0000 --bbnarx7wbuksohxs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > The branch main has been updated by imp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D72821668b039c276914569e9ca= a1cdfa4e4cb674 >=20 > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > Author: Warner Losh > AuthorDate: 2021-07-09 17:21:18 +0000 > Commit: Warner Losh > CommitDate: 2021-07-09 17:21:18 +0000 >=20 > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > =20 > Malloc() might return NULL, in which case we will panic with a NULL > pointer deref. Make it panic when the allocation fails to preserve the > postcondtion that we never return a non-NULL value. malloc(9) tells us that M_WAITOK will never fail. I'm thinking this conditional might need to be negated for the !M_WAITOK case, in which malloc(9) could indeed fail. Although, even as I type this email, I just realized that a different function, Malloc, is being called. What's the difference between malloc and Malloc? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --bbnarx7wbuksohxs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDoqXEACgkQ/y5nonf4 4fpiPQ/9GhtOSJy3+Stl9jkeS3ZoT03rPiQouKWNEyS3PqbPJ9LYN2xT66FVDViJ ZYQ/fjH27lDikBOExbvO70ykU5D9HBgjmvqkrG8sQKbCwJzGE9gy4l0uNTdA4Lm7 fOic36syucTSeKwvWq7ptYMyz75/fSxovIoyH9uPB4oL6bZzjjuhYk1Z3XnglVG8 MJhqvpzz77ORjiuymB1QbZSq7a1F79jPcRMC0cK6xm4BmLPn+Brw/+eviQ4vr160 0L9ZfR/NA0XUgC9tDwfDgGjYQVRsZ3Xl8B8M9UXybbPHQMRyunWupfU4+Gln2AVH X6Rt6aeuvBA46gBp+/ea8NatGDWYZLPAfGNe54oS8LGj3Db1e2LayEyLDSguTzWL AgY1p0fnNdF4YAfY8HIoTmP7PvYwFjUNpL4MXAjeotWWMKoaIXtbWBFfYmxmfbZx ep2/S8jenXYK0SmG5ky9+P5YJCNdKpeg5/b5LsApOoegme6LFTd2uAN1Dg33ipvH VfxX7B35dqlFqR6gGBUJm3MzOJF1kR7L5cZR/BWHIJ1Y9ZPzZ0xeaZ8OJrKjhQOm QoATgJ2ouHUxXO1vLETJxRiwoKfzOxaMOitbXblU014bAr3YojzZ7KCj0ipFvdn/ t4y+Q2dsEMcZtRKvv94vdcCgx/QUcFJoFksELQisLfs4vd9/QpY= =NObg -----END PGP SIGNATURE----- --bbnarx7wbuksohxs-- From owner-dev-commits-src-all@freebsd.org Fri Jul 9 20:34:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E240C6660EA for ; Fri, 9 Jul 2021 20:34:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (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 4GM4dY5cQ3z3JRW for ; Fri, 9 Jul 2021 20:34:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x830.google.com with SMTP id c9so4454047qte.6 for ; Fri, 09 Jul 2021 13:34:25 -0700 (PDT) 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=dqPoCulu499GOXS7I1BI3tFTyc/v6/IzhGnfpiTpAEo=; b=K5rnQgkFSaRY68QX4c2wzNWKQF+rf+pLwLzrAyX1affrdaBtf3ofWhN2XJzgXSiIXJ QXE/j14W/Fos22dHp+Fg+bLnCdTTrbr0ldVtk5VQMp1keM64zPauSwMhnjWFEQAZbglh 1qXUOk5xe+Ca+2nikEf6oioxqSyUh4mJSt+vAo2L+pEqB5HAdmJg5LRB6zPs8juBdgL6 6pnODUMlxZfpv8v1FB4fqnfO/6vWGkBt9cf683mcatGsRnoFCrJbpWWHt1Ygt8Qer7kN 2B3c/eEHjX5uuclVh2hNkDPVoWGB1jjjN7UzNVnt2NSHTmGPbOooCIoU4J5dlRiFvoAN ebdQ== 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=dqPoCulu499GOXS7I1BI3tFTyc/v6/IzhGnfpiTpAEo=; b=ZEsXvjp0mEZzqVcSoTBF/SFygSCaOBz/CRmcguyDrizNmSdSXRGR4gvZ1IYL+KsWT2 OKAOM+yF6Y9rWgP3k4ANG2FZd59CjkEdqpDZbcHUqj9xc4XtVC13BXuBQSx4oJlymtf2 XRA2REAFAsAfAquUvSlzuWRnlBpWvna1ECHV/PTRKl906ch0ZPOP1NOf2GTZrcf6OwLR X+XDHGufyEbRP1+OqTsZK61bpym5CqIXgrFe9dVlUOrM0SOvspgifSEU5pRwrhszMAxb jP2B2jaIbKsoXPofXBxjvyWM0q8BpRrcDbFrVuVgEwscgxxEbNZnjQDn3uHXV7HhFrJq 4sdw== X-Gm-Message-State: AOAM530wpc6Kyb/89v0yNc9JhWh0M2dGOZ8vgsWFK2PFySDndJZgs2JW mnZcnXX1On1nGWH7/lrO0fjkXlcb+JSL+gsnXjkIfg== X-Google-Smtp-Source: ABdhPJytaDHZKCZVmivilBF8V8wxh5TdKen4IqRB554rcVUFsDk6pSLtb8GYpNwIkgmSas9fHyanT+H+V4sJXbq3giE= X-Received: by 2002:ac8:5314:: with SMTP id t20mr2982637qtn.235.1625862864517; Fri, 09 Jul 2021 13:34:24 -0700 (PDT) MIME-Version: 1.0 References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> In-Reply-To: <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> From: Warner Losh Date: Fri, 9 Jul 2021 14:34:12 -0600 Message-ID: Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails To: Shawn Webb Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4GM4dY5cQ3z3JRW 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 20:34:25 -0000 On Fri, Jul 9, 2021 at 1:54 PM Shawn Webb wrote: > On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=72821668b039c276914569e9caa1cdfa4e4cb674 > > > > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > > Author: Warner Losh > > AuthorDate: 2021-07-09 17:21:18 +0000 > > Commit: Warner Losh > > CommitDate: 2021-07-09 17:21:18 +0000 > > > > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > > > > Malloc() might return NULL, in which case we will panic with a NULL > > pointer deref. Make it panic when the allocation fails to preserve > the > > postcondtion that we never return a non-NULL value. > > malloc(9) tells us that M_WAITOK will never fail. I'm thinking this > conditional might need to be negated for the !M_WAITOK case, in which > malloc(9) could indeed fail. > > Although, even as I type this email, I just realized that a different > function, Malloc, is being called. What's the difference between > malloc and Malloc? > The block of code is to be used in the standalone environment. The Malloc() function there doesn't have wait/nowait variants and can fail (though in the boot loader, that almost never happens except when there's a bug). The code is for wrappers around kmem_zalloc which is the OpenZFS spelling of malloc. It assumes that kmem_zalloc with M_WAITOK will never return NULL, so it never checks. This changes a weird panic when the returned NULL pointer is dereferenced, to an orderly panic when the malloc that the code assumes will never fail actuall fails. This at least gives better context of where the error happened and what the error was. In practice, this is a big nop, but we have had issues with other Malloc calls in the past failing because of bugs that caused us to ask for a ridiculous amount of memory. Make sense? Warner From owner-dev-commits-src-all@freebsd.org Fri Jul 9 21:19:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7BC946665C2; Fri, 9 Jul 2021 21:19: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 4GM5dn36J7z3NqG; Fri, 9 Jul 2021 21:19: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 4F0351BD65; Fri, 9 Jul 2021 21:19: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 169LJfZU090840; Fri, 9 Jul 2021 21:19:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 169LJfSb090839; Fri, 9 Jul 2021 21:19:41 GMT (envelope-from git) Date: Fri, 9 Jul 2021 21:19:41 GMT Message-Id: <202107092119.169LJfSb090839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 105b68b42dd1 - main - sctp: Fix errno in case of association setup failures 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/main X-Git-Reftype: branch X-Git-Commit: 105b68b42dd11bce5c554b1ef0ddf73aa069d7da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 21:19:41 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=105b68b42dd11bce5c554b1ef0ddf73aa069d7da commit 105b68b42dd11bce5c554b1ef0ddf73aa069d7da Author: Michael Tuexen AuthorDate: 2021-07-09 21:17:35 +0000 Commit: Michael Tuexen CommitDate: 2021-07-09 21:19:25 +0000 sctp: Fix errno in case of association setup failures Do not report always ETIMEDOUT, but only when appropriate. In other cases report ECONNABORTED. MFC after: 3 days --- sys/netinet/sctp_asconf.c | 2 +- sys/netinet/sctp_constants.h | 1 + sys/netinet/sctp_indata.c | 34 ++++++++++++++--------------- sys/netinet/sctp_input.c | 8 +++---- sys/netinet/sctp_output.c | 10 ++++----- sys/netinet/sctp_pcb.c | 4 ++-- sys/netinet/sctp_timer.c | 4 ++-- sys/netinet/sctp_usrreq.c | 4 ++-- sys/netinet/sctputil.c | 52 ++++++++++++++++++++++++++++---------------- sys/netinet/sctputil.h | 4 ++-- sys/netinet6/sctp6_usrreq.c | 2 +- 11 files changed, 70 insertions(+), 55 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index c06ddf7b1f2e..0915e187ee40 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -1704,7 +1704,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); SCTP_SNPRINTF(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return; } diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h index 197b93791944..1ff3f3918ef6 100644 --- a/sys/netinet/sctp_constants.h +++ b/sys/netinet/sctp_constants.h @@ -716,6 +716,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_NO_PEER_AUTH 25 #define SCTP_NOTIFY_SENDER_DRY 26 #define SCTP_NOTIFY_REMOTE_ERROR 27 +#define SCTP_NOTIFY_ASSOC_TIMEDOUT 28 /* This is the value for messages that are NOT completely * copied down where we will start to split the message. diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 6997a0099c88..fb1327a94475 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -444,7 +444,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1; - sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } @@ -533,7 +533,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } @@ -623,7 +623,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; } } @@ -1745,7 +1745,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, */ op_err = sctp_generate_no_user_data_cause(tsn); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1811,7 +1811,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, * receiver. Send peer an ABORT! */ op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -1882,7 +1882,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2017,7 +2017,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_18; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } @@ -2736,7 +2736,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if ((asoc->idata_supported == 0) && @@ -2747,7 +2747,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_22; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if ((ch->chunk_type == SCTP_DATA) || @@ -2772,7 +2772,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_23; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } #ifdef SCTP_AUDITING_ENABLED @@ -2841,7 +2841,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "DATA chunk followed by chunk of type %2.2x", ch->chunk_type); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } default: @@ -2860,7 +2860,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, SCTP_SNPRINTF(msg, sizeof(msg), "Chunk of length %u", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return (2); } if (ch->chunk_type & 0x40) { @@ -4003,7 +4003,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack, cumack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } asoc->this_sack_highest_gap = cumack; @@ -4308,7 +4308,7 @@ again: /* XXX */ op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && @@ -4524,7 +4524,7 @@ hopeless_peer: cum_ack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_29; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } /**********************/ @@ -4985,7 +4985,7 @@ hopeless_peer: /* XXX */ op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_35; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && @@ -5533,7 +5533,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, new_cum_tsn, asoc->highest_tsn_inside_map); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_37; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); return; } SCTP_STAT_INCR(sctps_fwdtsn_map_over); diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 6a0b5d41052a..ed15b81ba3e5 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -414,7 +414,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, &nat_friendly, &cookie_found); if (abort_flag) { /* Send an abort and notify peer */ - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return (-1); } @@ -785,7 +785,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INPUT + SCTP_LOC_7); /* notify user of the abort and clean up... */ - sctp_abort_notification(stcb, 1, error, abort, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, error, abort, SCTP_SO_NOT_LOCKED); /* free the tcb */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -1140,7 +1140,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch, asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { - sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, false, true, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_12); @@ -5106,7 +5106,7 @@ process_control_chunks: SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-FORWARD-TSN chunk received when FORWARD-TSN was negotiated"); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); *offset = length; return (NULL); } diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index c69db88f7d7d..e34534e80fa3 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6631,7 +6631,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, * us. */ atomic_add_int(&stcb->asoc.refcnt, 1); - sctp_abort_an_association(inp, stcb, m, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, m, false, SCTP_SO_NOT_LOCKED); /* * sctp_abort_an_association calls sctp_free_asoc() free * association will NOT free it since we incremented the @@ -6715,7 +6715,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_NOT_LOCKED); + op_err, false, SCTP_SO_NOT_LOCKED); atomic_add_int(&stcb->asoc.refcnt, -1); goto no_chunk_output; } @@ -9555,7 +9555,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, - so_locked); + false, so_locked); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); return (SCTP_RETRAN_EXIT); @@ -12967,7 +12967,7 @@ sctp_lower_sosend(struct socket *so, free_cnt_applied = 0; /* release this lock, otherwise we hang on ourselves */ NET_EPOCH_ENTER(et); - sctp_abort_an_association(stcb->sctp_ep, stcb, mm, SCTP_SO_LOCKED); + sctp_abort_an_association(stcb->sctp_ep, stcb, mm, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); /* now relock the stcb so everything is sane */ hold_tcblock = 0; @@ -13544,7 +13544,7 @@ dataless_eof: msg); NET_EPOCH_ENTER(et); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_LOCKED); + op_err, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); /* * now relock the stcb so everything diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index ce4850469144..bdc575de615f 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -6198,7 +6198,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, op_err, + stcb_tmp, op_err, false, SCTP_SO_NOT_LOCKED); goto add_it_now; } @@ -6298,7 +6298,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, op_err, + stcb_tmp, op_err, false, SCTP_SO_NOT_LOCKED); goto add_it_now6; } diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 582abd8e8854..2d3836829e89 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -157,7 +157,7 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Association error counter exceeded"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_2; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED); return (1); } return (0); @@ -1071,7 +1071,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp, op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Cookie timer expired, but no cookie"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_3; - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); } else { #ifdef INVARIANTS panic("Cookie timer expires in wrong state?"); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 6308cabf5d63..822a8ffb534f 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -189,7 +189,7 @@ sctp_notify(struct sctp_inpcb *inp, } else if ((icmp_code == ICMP_UNREACH_PROTOCOL) || (icmp_code == ICMP_UNREACH_PORT)) { /* Treat it like an ABORT. */ - sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); /* no need to unlock here, since the TCB is gone */ @@ -960,7 +960,7 @@ sctp_shutdown(struct socket *so) stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; SCTP_INP_RUNLOCK(inp); sctp_abort_an_association(stcb->sctp_ep, stcb, - op_err, SCTP_SO_LOCKED); + op_err, false, SCTP_SO_LOCKED); NET_EPOCH_EXIT(et); return (0); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 21e49bdfcb23..ad4409f666df 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1998,7 +1998,7 @@ sctp_timeout_handler(void *t) SCTP_STAT_INCR(sctps_timoshutdownguard); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + sctp_abort_an_association(inp, stcb, op_err, true, SCTP_SO_NOT_LOCKED); /* no need to unlock on tcb its gone */ goto out_decr; case SCTP_TIMER_TYPE_AUTOCLOSE: @@ -3154,7 +3154,8 @@ sctp_pad_lastmbuf(struct mbuf *m, int padval, struct mbuf *last_mbuf) static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked) + uint16_t error, struct sctp_abort_chunk *abort, + bool from_peer, bool timedout, int so_locked) { struct mbuf *m_notify; struct sctp_assoc_change *sac; @@ -3163,8 +3164,10 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, uint16_t abort_len; unsigned int i; - KASSERT((abort == NULL) || (from_peer != 0), + KASSERT(abort == NULL || from_peer, ("sctp_notify_assoc_change: ABORT chunk provided for local termination")); + KASSERT(!from_peer || !timedout, + ("sctp_notify_assoc_change: timeouts can only be local")); if (stcb == NULL) { return; } @@ -3272,8 +3275,7 @@ set_error: stcb->sctp_socket->so_error = ECONNRESET; } } else { - if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || - (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + if (timedout) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ETIMEDOUT); stcb->sctp_socket->so_error = ETIMEDOUT; } else { @@ -4085,7 +4087,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, switch (notification) { case SCTP_NOTIFY_ASSOC_UP: if (stcb->asoc.assoc_up_sent == 0) { - sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_COMM_UP, stcb, error, NULL, false, false, so_locked); stcb->asoc.assoc_up_sent = 1; } if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) { @@ -4097,7 +4099,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, } break; case SCTP_NOTIFY_ASSOC_DOWN: - sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_SHUTDOWN_COMP, stcb, error, NULL, false, false, so_locked); break; case SCTP_NOTIFY_INTERFACE_DOWN: { @@ -4150,21 +4152,29 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, case SCTP_NOTIFY_ASSOC_LOC_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 0, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, false, false, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 0, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, false, false, so_locked); } break; case SCTP_NOTIFY_ASSOC_REM_ABORTED: if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, 1, so_locked); + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, true, false, so_locked); } else { - sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, 1, so_locked); + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, true, false, so_locked); + } + break; + case SCTP_NOTIFY_ASSOC_TIMEDOUT: + if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || + (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + sctp_notify_assoc_change(SCTP_CANT_STR_ASSOC, stcb, error, data, false, true, so_locked); + } else { + sctp_notify_assoc_change(SCTP_COMM_LOST, stcb, error, data, false, true, so_locked); } break; case SCTP_NOTIFY_ASSOC_RESTART: - sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, 0, so_locked); + sctp_notify_assoc_change(SCTP_RESTART, stcb, error, NULL, false, false, so_locked); if (stcb->asoc.auth_supported == 0) { sctp_ulp_notify(SCTP_NOTIFY_NO_PEER_AUTH, stcb, 0, NULL, so_locked); @@ -4337,8 +4347,9 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked) } void -sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, - struct sctp_abort_chunk *abort, int so_locked) +sctp_abort_notification(struct sctp_tcb *stcb, bool from_peer, bool timeout, + uint16_t error, struct sctp_abort_chunk *abort, + int so_locked) { if (stcb == NULL) { return; @@ -4361,7 +4372,11 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error if (from_peer) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); } else { - sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + if (timeout) { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_TIMEDOUT, stcb, error, abort, so_locked); + } else { + sctp_ulp_notify(SCTP_NOTIFY_ASSOC_LOC_ABORTED, stcb, error, abort, so_locked); + } } } @@ -4395,7 +4410,7 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, vrf_id, port); if (stcb != NULL) { /* We have a TCB to abort, send notification too */ - sctp_abort_notification(stcb, 0, cause_code, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, false, false, cause_code, NULL, SCTP_SO_NOT_LOCKED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4471,8 +4486,7 @@ none_in: void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *op_err, - int so_locked) + struct mbuf *op_err, bool timedout, int so_locked) { struct sctp_gen_error_cause *cause; uint16_t cause_code; @@ -4503,7 +4517,7 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* notify the ulp */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - sctp_abort_notification(stcb, 0, cause_code, NULL, so_locked); + sctp_abort_notification(stcb, false, timedout, cause_code, NULL, so_locked); } /* now free the asoc */ #ifdef SCTP_ASOCLOG_OF_TSNS diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index c81633223224..3319eb4f455b 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -167,7 +167,7 @@ void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int); int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void -sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t, +sctp_abort_notification(struct sctp_tcb *, bool, bool, uint16_t, struct sctp_abort_chunk *, int); /* We abort responding to an IP packet for some reason */ @@ -181,7 +181,7 @@ sctp_abort_association(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, /* We choose to abort via user input */ void sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int); + struct mbuf *, bool, int); void sctp_handle_ootb(struct mbuf *, int, int, diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 09371ce249db..6f5d639e6367 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -200,7 +200,7 @@ sctp6_notify(struct sctp_inpcb *inp, case ICMP6_PARAM_PROB: /* Treat it like an ABORT. */ if (icmp6_code == ICMP6_PARAMPROB_NEXTHEADER) { - sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); + sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_2); } else { From owner-dev-commits-src-all@freebsd.org Fri Jul 9 21:48:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 90E9C666EE7; Fri, 9 Jul 2021 21:48:37 +0000 (UTC) (envelope-from jhb@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 4GM6H93Mgtz3R3d; Fri, 9 Jul 2021 21:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (d-24-233-223-154.va.cpe.atlanticbb.net [24.233.223.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 26CD7E2DA; Fri, 9 Jul 2021 21:48:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 1f7d11e636ab - main - build.7: remove documentation of "make update" To: Ceri Davies , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202107011552.161FqeER094768@gitrepo.freebsd.org> From: John Baldwin Message-ID: <5e8ca76f-39e8-0b52-1b10-249d0c0bfd0c@FreeBSD.org> Date: Fri, 9 Jul 2021 17:48:36 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <202107011552.161FqeER094768@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 21:48:37 -0000 On 7/1/21 8:52 AM, Ceri Davies wrote: > The branch main has been updated by ceri (doc committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=1f7d11e636abf68d92b052fefe63b687d84c966a > > commit 1f7d11e636abf68d92b052fefe63b687d84c966a > Author: Ceri Davies > AuthorDate: 2021-07-01 15:04:33 +0000 > Commit: Ceri Davies > CommitDate: 2021-07-01 15:52:32 +0000 > > build.7: remove documentation of "make update" > > update target was removed in e290182bcf3895ca659dff111bca6a077c4708b1 Oops, thanks for fixing! -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Jul 9 22:41:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE522667793 for ; Fri, 9 Jul 2021 22:41:38 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (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 4GM7SL3s5Tz3nrx for ; Fri, 9 Jul 2021 22:41:38 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x832.google.com with SMTP id x24so8674585qts.11 for ; Fri, 09 Jul 2021 15:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZAaMmPy3viyS6h8rtZDadXHtxla3RXLgeQVjodelawg=; b=W1QTpeN2Pv3LToA4aCuM+4kOk9LcNQCDw4qnVHoXs5XOhzf/Gu3MPLzFeompA3JkKk Ke5TQQyrQBqM+/vvMJHVZYlRiYKcZG7Tp/joaZPUlFfso1eKttXksJffuOpaoCHn85FJ mOYV6mwCO4pI2caiTxJunuQKIJtjp1AbOvLWOl91hFJX5iscbqEYYv6x1oCLrUzD0uFY 3vKrX8N67StKDZDZen6H4/LYPHepkrounW/6UKDiAcBH7nQAttGyOGycTrzTycet6cn/ GUGU2fvOlGv4M0KTu8Rb1V6Wuz440gck1Ho1rxz44/qadIH8z65sAZA490TQ+DCOQFKR aTag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZAaMmPy3viyS6h8rtZDadXHtxla3RXLgeQVjodelawg=; b=QjCvCvWyk/xtOF2NElpwzGuCpXSDCHk8JdDAbX39USjxlugPUV0+qTHyRR5N1IUWfM 3FmpbiM+QV1o+WdoVQ0CRLsZtEbThFA/DL1XK32a2PFzNv2HFmghiZiPSxMmyaRGNNLW 3LTttSa0l4pVPKDtOxaouznXoPRrBJE3dKv/kGLfVywQZI5xNQAc8CqAs8PVHs7CfacO gf5pA/kNJXy5pfbe/wsQpxqbv2y83F4hqWMxZjA/LS/aAGuNVtDIFT6i3kb8HF+WM4AE 5emM5SQNxigH6/us5RvPRBTgtn+lrQPid+4fLmug1cG7N8+uU8+0FZxLZMbEBYd3WKpU 7coQ== X-Gm-Message-State: AOAM530WECD31Bk8+mf1A44VpcD8g92JVvTwMIz3hSHHglj4TabyFXll 4W9y0JXPZn166xqnGZ93bOyRxg== X-Google-Smtp-Source: ABdhPJwhOCTup/lglIQLB5ltY0IBECbDou8j5qSWaNZJceaAlYv6hjKDmK5cZ0xdmF55gEaJC0+HDw== X-Received: by 2002:ac8:6698:: with SMTP id d24mr35978620qtp.37.1625870497611; Fri, 09 Jul 2021 15:41:37 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id q206sm3156226qka.19.2021.07.09.15.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 15:41:37 -0700 (PDT) Date: Fri, 9 Jul 2021 18:41:36 -0400 From: Shawn Webb To: Warner Losh Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails Message-ID: <20210709224136.qprhblk43ndtmxqf@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="53mirfa322pvcatr" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4GM7SL3s5Tz3nrx 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 22:41:38 -0000 --53mirfa322pvcatr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 09, 2021 at 02:34:12PM -0600, Warner Losh wrote: > On Fri, Jul 9, 2021 at 1:54 PM Shawn Webb > wrote: >=20 > > On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > > > The branch main has been updated by imp: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3D72821668b039c276914569e9caa1c= dfa4e4cb674 > > > > > > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > > > Author: Warner Losh > > > AuthorDate: 2021-07-09 17:21:18 +0000 > > > Commit: Warner Losh > > > CommitDate: 2021-07-09 17:21:18 +0000 > > > > > > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > > > > > > Malloc() might return NULL, in which case we will panic with a NU= LL > > > pointer deref. Make it panic when the allocation fails to preserve > > the > > > postcondtion that we never return a non-NULL value. > > > > malloc(9) tells us that M_WAITOK will never fail. I'm thinking this > > conditional might need to be negated for the !M_WAITOK case, in which > > malloc(9) could indeed fail. > > > > Although, even as I type this email, I just realized that a different > > function, Malloc, is being called. What's the difference between > > malloc and Malloc? > > >=20 > The block of code is to be used in the standalone environment. > The Malloc() function there doesn't have wait/nowait variants and > can fail (though in the boot loader, that almost never happens except > when there's a bug). The code is for wrappers around kmem_zalloc > which is the OpenZFS spelling of malloc. It assumes that kmem_zalloc > with M_WAITOK will never return NULL, so it never checks. This > changes a weird panic when the returned NULL pointer is dereferenced, > to an orderly panic when the malloc that the code assumes will never > fail actuall fails. This at least gives better context of where the error > happened and what the error was. In practice, this is a big nop, but > we have had issues with other Malloc calls in the past failing because > of bugs that caused us to ask for a ridiculous amount of memory. >=20 > Make sense? That makes much more sense. Thanks a lot for the clarification! --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --53mirfa322pvcatr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDo0J4ACgkQ/y5nonf4 4fq4tRAAoQKdCupdv+PZ+1R36+kh9uRyFkOk+/fR5VkQl8anqid7GMAYx6fwEC5k bsqj95tIBJZ00iV0pjoqdCJYgzmBAOcrs8ZNNka1Q42kgSyqk+xgHe2MHGnVaQ7g 60zCj8267dpo+nhQVp0vkffpSgb+qpLm9wKZQ0wDe4hExyZNBabSfOubCrLDCkwW m8t/iG0laOAtbRNJ2EqWuELIAkqKZpuume0KUH4iL14d8RjhpPCQecwA7orPZnDU sZnO2te2qQbckBRhfCNEMNW7pBY7JfIPyzqfa4Bk0vdWtm7PIJnFwxi59IvqWKtZ jwCWMNzNNIt9wZDOnB0ktuLZWRxQvCqcV2SQ96lDIQCbWYEnzxItGqD9INpqh3y2 Jfl7dnWDmcnnHHfHYRaYJgW4yEqnqpAB8V/BhgES4bnYN4vCst3LWheEPBpKOe3s Ar4735O+QwdR9hFKyHPVeVokaeFSu46mfD/3/li1F7/HcLNKpqs7KxvCksZE+uHq Fv3n7ddWrndI+DTkFzPtvleVBQjhpS828rgoP5jCC6liFRkOp/omFD85g4l68L73 ejKAn6ZWiP/LzS/8La9xDfHRQ3SMsw8CVO81m83b9WixDlnCLLx66WGnA596pMkb OFvNA7c4hZHr9z5H46/C2hZ8G9mpaW2e7R/U2IbkN8y4x0bSTj8= =RxBr -----END PGP SIGNATURE----- --53mirfa322pvcatr-- From owner-dev-commits-src-all@freebsd.org Sat Jul 10 00:48:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A9E466496D4; Sat, 10 Jul 2021 00:48: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 4GMBGJ4BBGz4XhH; Sat, 10 Jul 2021 00:48: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 740671E65B; Sat, 10 Jul 2021 00:48: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 16A0m8OZ072308; Sat, 10 Jul 2021 00:48:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0m8L8072307; Sat, 10 Jul 2021 00:48:08 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:08 GMT Message-Id: <202107100048.16A0m8L8072307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f08f0ae5247a - main - amd64: Mark the trapframe as initialized in trap() 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/main X-Git-Reftype: branch X-Git-Commit: f08f0ae5247ab31de58bda0817e74ccc1a3a5e95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:08 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f08f0ae5247ab31de58bda0817e74ccc1a3a5e95 commit f08f0ae5247ab31de58bda0817e74ccc1a3a5e95 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:03 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 amd64: Mark the trapframe as initialized in trap() Otherwise KASAN may generate false positives if the trapframe was written into a poisoned region of the stack. Reported by: pho Sponsored by: The FreeBSD Foundation --- sys/amd64/amd64/trap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index e67e188bb4fd..a60b17cf554f 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdb.h" #include +#include #include #include #include @@ -227,6 +228,8 @@ trap(struct trapframe *frame) p = td->td_proc; dr6 = 0; + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); + VM_CNT_INC(v_trap); type = frame->tf_trapno; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 00:48:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CB48064961C; Sat, 10 Jul 2021 00:48: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 4GMBGK4yZ4z4XmT; Sat, 10 Jul 2021 00:48: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 8BBB11E8A6; Sat, 10 Jul 2021 00:48: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 16A0m94H072332; Sat, 10 Jul 2021 00:48:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0m9Jb072331; Sat, 10 Jul 2021 00:48:09 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:09 GMT Message-Id: <202107100048.16A0m9Jb072331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5d243d41b120 - main - hwpmc: Disable KASAN in pmc_save_kernel_callchain() 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/main X-Git-Reftype: branch X-Git-Commit: 5d243d41b1206044cb5eddd5d48c1c711b731478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:09 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5d243d41b1206044cb5eddd5d48c1c711b731478 commit 5d243d41b1206044cb5eddd5d48c1c711b731478 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:11 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 hwpmc: Disable KASAN in pmc_save_kernel_callchain() As in commit 831850d8b087, this routine can trigger false positives, so exclude it from instrumentation. Reported by: pho Sponsored by: The FreeBSD Foundation --- sys/dev/hwpmc/hwpmc_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c index 2b2596328ec0..db6ed6fb1145 100644 --- a/sys/dev/hwpmc/hwpmc_x86.c +++ b/sys/dev/hwpmc/hwpmc_x86.c @@ -156,7 +156,7 @@ pmc_save_user_callchain(uintptr_t *cc, int nframes, struct trapframe *tf) * code, and if so we terminate our trace. */ -int +int __nosanitizeaddress pmc_save_kernel_callchain(uintptr_t *cc, int nframes, struct trapframe *tf) { int n; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 00:48:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0281F6491F2; Sat, 10 Jul 2021 00:48:11 +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 4GMBGL6KYXz4XhM; Sat, 10 Jul 2021 00:48:10 +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 B9A031EA14; Sat, 10 Jul 2021 00:48:10 +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 16A0mATs072356; Sat, 10 Jul 2021 00:48:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0mAnx072355; Sat, 10 Jul 2021 00:48:10 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:10 GMT Message-Id: <202107100048.16A0mAnx072355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 36226163fa48 - main - x86: Mark the trapframe as initialized in ipi_bitmap_handler() 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/main X-Git-Reftype: branch X-Git-Commit: 36226163fa48ee2c5f73bd2e870ce2e5a057f42e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=36226163fa48ee2c5f73bd2e870ce2e5a057f42e commit 36226163fa48ee2c5f73bd2e870ce2e5a057f42e Author: Mark Johnston AuthorDate: 2021-07-10 00:38:18 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 x86: Mark the trapframe as initialized in ipi_bitmap_handler() Otherwise KASAN may generate false positives if the trapframe was written into a poisoned region of the stack. Reported by: pho Reported by: syzbot+ee60455cd58e6eed20c9@syzkaller.appspotmail.com Reported by: syzbot+be5f9df26426ace3a00c@syzkaller.appspotmail.com Sponsored by: The FreeBSD Foundation --- sys/x86/x86/mp_x86.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 2dcdf923c467..1f22b3a7886a 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include /* cngetc() */ #include @@ -1279,6 +1280,8 @@ ipi_bitmap_handler(struct trapframe frame) int cpu = PCPU_GET(cpuid); u_int ipi_bitmap; + kasan_mark(&frame, sizeof(frame), sizeof(frame), 0); + td = curthread; ipi_bitmap = atomic_readandclear_int(&cpuid_to_pcpu[cpu]-> pc_ipi_bitmap); From owner-dev-commits-src-all@freebsd.org Sat Jul 10 00:48:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E97564988D; Sat, 10 Jul 2021 00:48: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 4GMBGN0Vyhz4XrW; Sat, 10 Jul 2021 00:48: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 E0AF61E5C3; Sat, 10 Jul 2021 00:48:11 +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 16A0mBY5072380; Sat, 10 Jul 2021 00:48:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0mBPQ072379; Sat, 10 Jul 2021 00:48:11 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:11 GMT Message-Id: <202107100048.16A0mBPQ072379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b0dfc4868478 - main - uma: Fix a few problems with KASAN integration 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/main X-Git-Reftype: branch X-Git-Commit: b0dfc48684780024a3d736c5a5449284dad97f4e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b0dfc48684780024a3d736c5a5449284dad97f4e commit b0dfc48684780024a3d736c5a5449284dad97f4e Author: Mark Johnston AuthorDate: 2021-07-10 00:38:21 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 uma: Fix a few problems with KASAN integration - Ensure that all items returned by UMA are aligned to KASAN_SHADOW_SCALE (8). This was true in practice since smaller alignments are not used by any consumers, but we should enforce it anyway. - Use a non-zero code for marking redzones that appear naturally in items that are not a multiple of the scale factor in size. Currently we do not modify keg layouts to force the creation of redzones. - Use a non-zero code for marking freed per-CPU items, otherwise accesses of freed per-CPU items are not detected by the runtime. Sponsored by: The FreeBSD Foundation --- sys/vm/uma_core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index d2e01f3a0605..59cc960d3dd9 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -556,11 +556,12 @@ kasan_mark_item_valid(uma_zone_t zone, void *item) sz = zone->uz_size; rsz = roundup2(sz, KASAN_SHADOW_SCALE); if ((zone->uz_flags & UMA_ZONE_PCPU) == 0) { - kasan_mark(item, sz, rsz, 0); + kasan_mark(item, sz, rsz, KASAN_GENERIC_REDZONE); } else { pcpu_item = zpcpu_base_to_offset(item); for (i = 0; i <= mp_maxid; i++) - kasan_mark(zpcpu_get_cpu(pcpu_item, i), sz, rsz, 0); + kasan_mark(zpcpu_get_cpu(pcpu_item, i), sz, rsz, + KASAN_GENERIC_REDZONE); } } @@ -580,7 +581,8 @@ kasan_mark_item_invalid(uma_zone_t zone, void *item) } else { pcpu_item = zpcpu_base_to_offset(item); for (i = 0; i <= mp_maxid; i++) - kasan_mark(zpcpu_get_cpu(pcpu_item, i), 0, sz, 0); + kasan_mark(zpcpu_get_cpu(pcpu_item, i), 0, sz, + KASAN_UMA_FREED); } } @@ -2238,6 +2240,14 @@ keg_layout(uma_keg_t keg) PRINT_UMA_ZFLAGS)); alignsize = keg->uk_align + 1; +#ifdef KASAN + /* + * ASAN requires that each allocation be aligned to the shadow map + * scale factor. + */ + if (alignsize < KASAN_SHADOW_SCALE) + alignsize = KASAN_SHADOW_SCALE; +#endif /* * Calculate the size of each allocation (rsize) according to From owner-dev-commits-src-all@freebsd.org Sat Jul 10 00:48:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E8F486496E9; Sat, 10 Jul 2021 00:48: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 4GMBGP1tSLz4XvH; Sat, 10 Jul 2021 00:48: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 0A46B1E4CE; Sat, 10 Jul 2021 00:48: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 16A0mC7O072411; Sat, 10 Jul 2021 00:48:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0mCp4072410; Sat, 10 Jul 2021 00:48:12 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:48:12 GMT Message-Id: <202107100048.16A0mCp4072410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 588c7a06dffb - main - KASAN: Implement __asan_unregister_globals() 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/main X-Git-Reftype: branch X-Git-Commit: 588c7a06dffbc74b281dacbdd854437b0815e501 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:48:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=588c7a06dffbc74b281dacbdd854437b0815e501 commit 588c7a06dffbc74b281dacbdd854437b0815e501 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:28 +0000 Commit: Mark Johnston CommitDate: 2021-07-10 00:38:50 +0000 KASAN: Implement __asan_unregister_globals() It will be called during KLD unload to unpoison the redzones following global variables. Otherwise, virtual address ranges previously used for a KLD may be left tainted, triggering false positives when they are recycled. Reported by: pho Sponsored by: The FreeBSD Foundation --- sys/kern/subr_asan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index b812f7bca465..07f7b44d08d7 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -948,7 +948,12 @@ __asan_register_globals(struct __asan_global *globals, size_t n) void __asan_unregister_globals(struct __asan_global *globals, size_t n) { - /* never called */ + size_t i; + + for (i = 0; i < n; i++) { + kasan_mark(globals[i].beg, globals[i].size_with_redzone, + globals[i].size_with_redzone, 0); + } } #define ASAN_LOAD_STORE(size) \ From owner-dev-commits-src-all@freebsd.org Sat Jul 10 00:58:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6B0D1649E25; Sat, 10 Jul 2021 00:58: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 4GMBTm2Czzz4YZd; Sat, 10 Jul 2021 00:58: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 3005F1EA3E; Sat, 10 Jul 2021 00:58: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 16A0w4VK085355; Sat, 10 Jul 2021 00:58:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16A0w42M085354; Sat, 10 Jul 2021 00:58:04 GMT (envelope-from git) Date: Sat, 10 Jul 2021 00:58:04 GMT Message-Id: <202107100058.16A0w42M085354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 63ca9ea4f34d - main - Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). 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/main X-Git-Reftype: branch X-Git-Commit: 63ca9ea4f34d887b66c7b9f1710f5e4be543ebed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 00:58:04 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=63ca9ea4f34d887b66c7b9f1710f5e4be543ebed commit 63ca9ea4f34d887b66c7b9f1710f5e4be543ebed Author: Alexander Motin AuthorDate: 2021-07-10 00:52:40 +0000 Commit: Alexander Motin CommitDate: 2021-07-10 00:57:58 +0000 Use sleepq_signal(SLEEPQ_DROP) in cv_signal(). Same as wakeup_one()/wakeup_any() commit before it reduces the lock hold time and so contention. MFC after: 1 week --- sys/kern/kern_condvar.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c index e26b689b4e11..ffceee44a5c0 100644 --- a/sys/kern/kern_condvar.c +++ b/sys/kern/kern_condvar.c @@ -397,26 +397,23 @@ _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock, void cv_signal(struct cv *cvp) { - int wakeup_swapper; if (cvp->cv_waiters == 0) return; - wakeup_swapper = 0; sleepq_lock(cvp); - if (cvp->cv_waiters > 0) { - if (cvp->cv_waiters == CV_WAITERS_BOUND && - sleepq_lookup(cvp) == NULL) { - cvp->cv_waiters = 0; - } else { - if (cvp->cv_waiters < CV_WAITERS_BOUND) - cvp->cv_waiters--; - wakeup_swapper = sleepq_signal(cvp, SLEEPQ_CONDVAR, 0, - 0); - } + if (cvp->cv_waiters == 0) { + sleepq_release(cvp); + return; + } + if (cvp->cv_waiters == CV_WAITERS_BOUND && sleepq_lookup(cvp) == NULL) { + cvp->cv_waiters = 0; + sleepq_release(cvp); + } else { + if (cvp->cv_waiters < CV_WAITERS_BOUND) + cvp->cv_waiters--; + if (sleepq_signal(cvp, SLEEPQ_CONDVAR | SLEEPQ_DROP, 0, 0)) + kick_proc0(); } - sleepq_release(cvp); - if (wakeup_swapper) - kick_proc0(); } /* From owner-dev-commits-src-all@freebsd.org Sat Jul 10 10:25:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DCFC06514F2 for ; Sat, 10 Jul 2021 10:25:56 +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 4GMR505T55z4bfd; Sat, 10 Jul 2021 10:25: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 977B126176; Sat, 10 Jul 2021 10:25: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 16AAPu1A042492; Sat, 10 Jul 2021 10:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AAPuV4042491; Sat, 10 Jul 2021 10:25:56 GMT (envelope-from git) Date: Sat, 10 Jul 2021 10:25:56 GMT Message-Id: <202107101025.16AAPuV4042491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Martin Matuska Subject: git: 508fff0e4b06..4f92fe0f5c82 - vendor/openzfs/zfs-2.1-release - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs/zfs-2.1-release X-Git-Reftype: branch X-Git-Commit: 4f92fe0f5c822f6802c6ec675809d7c112a46f2e X-Git-Oldrev: 508fff0e4b0653744fd6ae7857cc860e4d0d80af X-Git-Newrev: 4f92fe0f5c822f6802c6ec675809d7c112a46f2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 10:25:57 -0000 The branch vendor/openzfs/zfs-2.1-release has been updated by mm: URL: https://cgit.FreeBSD.org/src/log/?id=508fff0e4b06..4f92fe0f5c82 4f92fe0f5c82 Tag 2.1.0 From owner-dev-commits-src-all@freebsd.org Sat Jul 10 11:13:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BF4E46528B4; Sat, 10 Jul 2021 11:13: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 4GMS7P50bVz4hHx; Sat, 10 Jul 2021 11:13: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 9473126E31; Sat, 10 Jul 2021 11:13: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 16ABD5wo009027; Sat, 10 Jul 2021 11:13:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABD5dG009026; Sat, 10 Jul 2021 11:13:05 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:13:05 GMT Message-Id: <202107101113.16ABD5dG009026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 58080fbca09f - main - libalias: fix divide by zero causing panic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58080fbca09fda6d5f011d37059edbca8ceb4c58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:13:05 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=58080fbca09fda6d5f011d37059edbca8ceb4c58 commit 58080fbca09fda6d5f011d37059edbca8ceb4c58 Author: Stefan Eßer AuthorDate: 2021-07-10 11:00:56 +0000 Commit: Stefan Eßer CommitDate: 2021-07-10 11:08:18 +0000 libalias: fix divide by zero causing panic The packet_limit can fall to 0, leading to a divide by zero abort in the "packets % packet_limit". An possible solution would be to apply a lower limit of 1 after the calculation of packet_limit, but since any number modulo 1 gives 0, the more efficient solution is to skip the modulo operation for packet_limit <= 1. Since this is a fix for a panic observed in stable/12, merging this fix to stable/12 and stable/13 before expiry of the 3 day waiting period might be justified, if it works for the reporter of the issue. Reported by: Karl Denninger MFC after: 3 days --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index c09ad4352ce4..4612b32c139c 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la) * Reduce the amount of house keeping work substantially by * sampling over the packets. */ - if (packets % packet_limit == 0) { + if (packet_limit <= 1 || packets % packet_limit == 0) { time_t now; #ifdef _KERNEL From owner-dev-commits-src-all@freebsd.org Sat Jul 10 11:47:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 66F91652CBA; Sat, 10 Jul 2021 11:47: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 4GMStg2CLKz4lRX; Sat, 10 Jul 2021 11:47: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 34881273F0; Sat, 10 Jul 2021 11:47: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 16ABl7Fj048379; Sat, 10 Jul 2021 11:47:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABl7gl048378; Sat, 10 Jul 2021 11:47:07 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:07 GMT Message-Id: <202107101147.16ABl7gl048378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 55e63ed307fb - main - x86: use ANSI C definition style for trap_fatal 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/main X-Git-Reftype: branch X-Git-Commit: 55e63ed307fb099722cf6d30a18c9badab9b5d03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:07 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=55e63ed307fb099722cf6d30a18c9badab9b5d03 commit 55e63ed307fb099722cf6d30a18c9badab9b5d03 Author: Konstantin Belousov AuthorDate: 2021-07-10 10:59:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:53 +0000 x86: use ANSI C definition style for trap_fatal PR: 257062 Submitted by: Vijay Sharma MFC after: 1 week --- sys/amd64/amd64/trap.c | 4 +--- sys/i386/i386/trap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index a60b17cf554f..55649687ce50 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -874,9 +874,7 @@ after_vmfault: } static void -trap_fatal(frame, eva) - struct trapframe *frame; - vm_offset_t eva; +trap_fatal(struct trapframe *frame, vm_offset_t eva) { int code, ss; u_int type; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 6fd2a1393761..045478149be5 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -875,9 +875,7 @@ trap_pfault(struct trapframe *frame, bool usermode, vm_offset_t eva, } static void -trap_fatal(frame, eva) - struct trapframe *frame; - vm_offset_t eva; +trap_fatal(struct trapframe *frame, vm_offset_t eva) { int code, ss, esp; u_int type; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 11:47:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BC542652CC5; Sat, 10 Jul 2021 11:47: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 4GMStj4sVhz4lPS; Sat, 10 Jul 2021 11:47: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 846F227579; Sat, 10 Jul 2021 11:47: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 16ABl9ss048427; Sat, 10 Jul 2021 11:47:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABl9Ts048426; Sat, 10 Jul 2021 11:47:09 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:09 GMT Message-Id: <202107101147.16ABl9Ts048426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 63664df72036 - main - amd64 locore.S: add FF copyright for LA57 work 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/main X-Git-Reftype: branch X-Git-Commit: 63664df72036dc8ee99bd83fecc91faf167fa232 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:09 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=63664df72036dc8ee99bd83fecc91faf167fa232 commit 63664df72036dc8ee99bd83fecc91faf167fa232 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:05:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:53 +0000 amd64 locore.S: add FF copyright for LA57 work Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/locore.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 6cd2061aef07..f2eedb402ef3 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -2,6 +2,12 @@ * Copyright (c) 2003 Peter Wemm * All rights reserved. * + * Copyright (c) 2020, 2021 The FreeBSD Foundation + * + * 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: From owner-dev-commits-src-all@freebsd.org Sat Jul 10 11:47:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 028CE652B74; Sat, 10 Jul 2021 11:47:11 +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 4GMStk5nkZz4lRn; Sat, 10 Jul 2021 11:47:10 +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 A9741276D7; Sat, 10 Jul 2021 11:47:10 +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 16ABlAVs048451; Sat, 10 Jul 2021 11:47:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABlA7C048450; Sat, 10 Jul 2021 11:47:10 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:10 GMT Message-Id: <202107101147.16ABlA7C048450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 71463a34ab3f - main - amd64 mpboot.S: fix typo in comment 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/main X-Git-Reftype: branch X-Git-Commit: 71463a34ab3f65ff109b529f2fae93b694b73fdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71463a34ab3f65ff109b529f2fae93b694b73fdd commit 71463a34ab3f65ff109b529f2fae93b694b73fdd Author: Konstantin Belousov AuthorDate: 2021-07-10 11:06:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:54 +0000 amd64 mpboot.S: fix typo in comment Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/mpboot.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/mpboot.S b/sys/amd64/amd64/mpboot.S index fb75d2b88440..e525102b5d3d 100644 --- a/sys/amd64/amd64/mpboot.S +++ b/sys/amd64/amd64/mpboot.S @@ -47,7 +47,7 @@ mptramp_start: mov %ax, %ss /* - * Find relocation base and patch the gdt descript and ljmp targets + * Find relocation base and patch the gdt descriptor and ljmp targets */ xorl %ebx,%ebx mov %cs, %bx From owner-dev-commits-src-all@freebsd.org Sat Jul 10 11:47:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AE2C8653203; Sat, 10 Jul 2021 11:47: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 4GMSth3FgMz4l45; Sat, 10 Jul 2021 11:47: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 5670B27725; Sat, 10 Jul 2021 11:47: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 16ABl8Ki048403; Sat, 10 Jul 2021 11:47:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABl8tM048402; Sat, 10 Jul 2021 11:47:08 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:08 GMT Message-Id: <202107101147.16ABl8tM048402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9dc715230cca - main - amd64 locore.S: trim .globl list from symbols gone for long time 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/main X-Git-Reftype: branch X-Git-Commit: 9dc715230ccab1c3ad17f076379d29a017059030 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:08 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9dc715230ccab1c3ad17f076379d29a017059030 commit 9dc715230ccab1c3ad17f076379d29a017059030 Author: Konstantin Belousov AuthorDate: 2021-07-10 11:04:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:53 +0000 amd64 locore.S: trim .globl list from symbols gone for long time Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/locore.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index a9bb9be330d8..6cd2061aef07 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -36,7 +36,7 @@ /* * Compiled KERNBASE location */ - .globl kernbase, kernload, loc_PTmap, loc_PDmap, loc_PDPmap, dmapbase, dmapend + .globl kernbase, kernload, dmapbase, dmapend .set kernbase,KERNBASE .set kernload,KERNLOAD .set dmapbase,DMAP_MIN_ADDRESS From owner-dev-commits-src-all@freebsd.org Sat Jul 10 11:47:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 18F936528E8; Sat, 10 Jul 2021 11:47: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 4GMStl6hhQz4lLr; Sat, 10 Jul 2021 11:47: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 C61522757A; Sat, 10 Jul 2021 11:47:11 +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 16ABlB3s048481; Sat, 10 Jul 2021 11:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16ABlBTq048480; Sat, 10 Jul 2021 11:47:11 GMT (envelope-from git) Date: Sat, 10 Jul 2021 11:47:11 GMT Message-Id: <202107101147.16ABlBTq048480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: fdc71fa112d6 - main - amd64 pmap: unexpand the NBPDR macro definition 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/main X-Git-Reftype: branch X-Git-Commit: fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 11:47:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca commit fdc71fa112d66c7c0aba9ff80adc7b8bb22ea6ca Author: Konstantin Belousov AuthorDate: 2021-07-10 11:07:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-10 11:46:54 +0000 amd64 pmap: unexpand the NBPDR macro definition Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 5e0b6d76ae0a..f8bd17dc6238 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1554,7 +1554,7 @@ nkpt_init(vm_paddr_t addr) #ifdef NKPT pt_pages = NKPT; #else - pt_pages = howmany(addr, 1 << PDRSHIFT); + pt_pages = howmany(addr, NBPDR); pt_pages += NKPDPE(pt_pages); /* From owner-dev-commits-src-all@freebsd.org Sat Jul 10 14:22:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EA4DD654765; Sat, 10 Jul 2021 14:22: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 4GMXKq689Bz3Qsw; Sat, 10 Jul 2021 14:22: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 AED6B1A62; Sat, 10 Jul 2021 14:22: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 16AEMNkd061205; Sat, 10 Jul 2021 14:22:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AEMNKo061204; Sat, 10 Jul 2021 14:22:23 GMT (envelope-from git) Date: Sat, 10 Jul 2021 14:22:23 GMT Message-Id: <202107101422.16AEMNKo061204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 804a06089158 - stable/13 - zfs: attach zpool_influxdb to build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 804a0608915837eeb3f235a05f93324750770d19 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 14:22:24 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=804a0608915837eeb3f235a05f93324750770d19 commit 804a0608915837eeb3f235a05f93324750770d19 Author: Martin Matuska AuthorDate: 2021-07-07 17:45:52 +0000 Commit: Martin Matuska CommitDate: 2021-07-10 10:26:42 +0000 zfs: attach zpool_influxdb to build From the zpool_influxdb.8 manual page: zpool_influxdb produces InfluxDB-line-protocol-compatible metrics from zpools. Like the zpool command, zpool_influxdb reads the current pool status and statistics. Unlike the zpool command which is intended for humans, zpool_influxdb formats the output in the InfluxDB line protocol. The expected use is as a plugin to a metrics collector or aggregator, such as Telegraf. zpool_influxdb is installed into /usr/libexec/zfs/ Differential revision: https://reviews.freebsd.org/D31094 (cherry picked from commit 48b4fe0503282f03d25e23f44109c5cb6d450f7c) --- cddl/Makefile | 2 +- cddl/usr.libexec/Makefile | 13 +++++++++++ cddl/usr.libexec/zpool_influxdb/Makefile | 28 ++++++++++++++++++++++ cddl/usr.libexec/zpool_influxdb/Makefile.depend | 31 +++++++++++++++++++++++++ etc/mtree/BSD.debug.dist | 2 ++ etc/mtree/BSD.usr.dist | 2 ++ 6 files changed, 77 insertions(+), 1 deletion(-) diff --git a/cddl/Makefile b/cddl/Makefile index 7b9d13146afa..284a370c0167 100644 --- a/cddl/Makefile +++ b/cddl/Makefile @@ -3,7 +3,7 @@ .include SUBDIR= lib .WAIT \ - sbin share usr.bin usr.sbin + sbin share usr.bin usr.libexec usr.sbin SUBDIR.${MK_TESTS}+= tests diff --git a/cddl/usr.libexec/Makefile b/cddl/usr.libexec/Makefile new file mode 100644 index 000000000000..6280cbab5766 --- /dev/null +++ b/cddl/usr.libexec/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +SUBDIR= ${_zpool_influxdb} + +.if ${MK_ZFS} != "no" +_zpool_influxdb= zpool_influxdb +.endif + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/usr.libexec/zpool_influxdb/Makefile b/cddl/usr.libexec/zpool_influxdb/Makefile new file mode 100644 index 000000000000..2fb22f02ef32 --- /dev/null +++ b/cddl/usr.libexec/zpool_influxdb/Makefile @@ -0,0 +1,28 @@ +# $FreeBSD$ + +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs + +.PATH: ${ZFSTOP}/cmd/zpool_influxdb +.PATH: ${ZFSTOP}/man/man8 + +PROG= zpool_influxdb +MAN= zpool_influxdb.8 +BINDIR?= /usr/libexec/zfs + +WARNS?= 0 +CSTD= c99 + +CFLAGS+= \ + -DIN_BASE \ + -I${ZFSTOP}/include \ + -I${ZFSTOP}/lib/libspl/include \ + -I${ZFSTOP}/lib/libspl/include/os/freebsd \ + -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ + -DHAVE_ISSETUGID \ + -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ + -DSYSCONFDIR=\"/etc\" \ + -DPKGDATADIR=\"/usr/share/zfs\" + +LIBADD= nvpair spl zfs + +.include diff --git a/cddl/usr.libexec/zpool_influxdb/Makefile.depend b/cddl/usr.libexec/zpool_influxdb/Makefile.depend new file mode 100644 index 000000000000..53090da6e2fc --- /dev/null +++ b/cddl/usr.libexec/zpool_influxdb/Makefile.depend @@ -0,0 +1,31 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + cddl/lib/libavl \ + cddl/lib/libnvpair \ + cddl/lib/libumem \ + cddl/lib/libuutil \ + cddl/lib/libzfs \ + cddl/lib/libzfs_core \ + gnu/lib/csu \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libexpat \ + lib/libgeom \ + lib/libmd \ + lib/libsbuf \ + lib/libthr \ + lib/libutil \ + lib/libz \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/etc/mtree/BSD.debug.dist b/etc/mtree/BSD.debug.dist index 3ccdf50188c8..7df3113b183b 100644 --- a/etc/mtree/BSD.debug.dist +++ b/etc/mtree/BSD.debug.dist @@ -54,6 +54,8 @@ .. sm.bin .. + zfs + .. .. sbin .. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 9ae3acbe6eba..797bc06ab7df 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -156,6 +156,8 @@ .. sm.bin .. + zfs + .. .. local .. From owner-dev-commits-src-all@freebsd.org Sat Jul 10 15:44:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C695B656054; Sat, 10 Jul 2021 15: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 4GMZ8v52Nwz3pxS; Sat, 10 Jul 2021 15: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 95BD12355; Sat, 10 Jul 2021 15: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 16AFilDi067845; Sat, 10 Jul 2021 15: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 16AFilLn067844; Sat, 10 Jul 2021 15:44:47 GMT (envelope-from git) Date: Sat, 10 Jul 2021 15:44:47 GMT Message-Id: <202107101544.16AFilLn067844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 476ef25d321c - main - zfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 476ef25d321c4eb9fffe91265a03960983332bc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 15:44:47 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=476ef25d321c4eb9fffe91265a03960983332bc2 commit 476ef25d321c4eb9fffe91265a03960983332bc2 Author: Martin Matuska AuthorDate: 2021-07-10 14:46:21 +0000 Commit: Martin Matuska CommitDate: 2021-07-10 15:43:16 +0000 zfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9) TBD: build with fetch(3) support for keylocation=http(s):// --- sys/modules/zfs/zfs_config.h | 92 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 10 deletions(-) diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 9c7c76fac70f..ddb2527e56fd 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -88,6 +88,9 @@ /* bdev_whole() is available */ /* #undef HAVE_BDEV_WHOLE */ +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + /* bio->bi_opf is defined */ /* #undef HAVE_BIO_BI_OPF */ @@ -100,6 +103,9 @@ /* bio_*_io_acct() available */ /* #undef HAVE_BIO_IO_ACCT */ +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + /* bio_set_dev() is available */ /* #undef HAVE_BIO_SET_DEV */ @@ -151,6 +157,9 @@ /* blk_queue_write_cache() is GPL-only */ /* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ /* #undef HAVE_CFLOCALECOPYCURRENT */ @@ -197,6 +206,9 @@ /* sops->dirty_inode() wants flags */ /* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 @@ -236,6 +248,9 @@ /* fops->fsync() without dentry */ /* #undef HAVE_FSYNC_WITHOUT_DENTRY */ +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + /* generic_*_io_acct() 3 arg available */ /* #undef HAVE_GENERIC_IO_ACCT_3ARG */ @@ -272,6 +287,12 @@ /* yes */ /* #undef HAVE_INODE_LOCK_SHARED */ +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + /* inode_set_flags() exists */ /* #undef HAVE_INODE_SET_FLAGS */ @@ -290,6 +311,21 @@ /* in_compat_syscall() is available */ /* #undef HAVE_IN_COMPAT_SYSCALL */ +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + /* iov_iter_advance() is available */ /* #undef HAVE_IOV_ITER_ADVANCE */ @@ -299,12 +335,6 @@ /* iov_iter_fault_in_readable() is available */ /* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ -/* iov_iter_init() is available */ -/* #undef HAVE_IOV_ITER_INIT */ - -/* iov_iter_init() is available */ -/* #undef HAVE_IOV_ITER_INIT_LEGACY */ - /* iov_iter_revert() is available */ /* #undef HAVE_IOV_ITER_REVERT */ @@ -404,7 +434,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 -/* iops->create()/mkdir()/mknod() take umode_t */ +/* iops->mkdir() takes umode_t */ /* #undef HAVE_MKDIR_UMODE_T */ /* Define to 1 if you have the `mlockall' function. */ @@ -425,6 +455,9 @@ /* Define if host toolchain supports PCLMULQDQ */ #define HAVE_PCLMULQDQ 1 +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + /* percpu_counter_init() wants gfp_t */ /* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ @@ -500,18 +533,33 @@ /* Define to 1 if you have the header file. */ #define HAVE_SECURITY_PAM_MODULES_H 1 -/* setattr_prepare() is available */ -/* #undef HAVE_SETATTR_PREPARE */ +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ -/* iops->set_acl() exists */ +/* iops->set_acl() exists, takes 3 args */ /* #undef HAVE_SET_ACL */ +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + /* set_cached_acl() is usable */ /* #undef HAVE_SET_CACHED_ACL_USABLE */ +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + /* struct shrink_control exists */ /* #undef HAVE_SHRINK_CONTROL_STRUCT */ +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + /* new shrinker callback wants 2 args */ /* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ @@ -577,6 +625,9 @@ /* i_op->tmpfile() exists */ /* #undef HAVE_TMPFILE */ +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + /* totalhigh_pages() exists */ /* #undef HAVE_TOTALHIGH_PAGES */ @@ -592,6 +643,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + /* iops->getattr() takes a vfsmount */ /* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ @@ -664,6 +718,9 @@ /* xattr_handler->set() wants xattr_handler */ /* #undef HAVE_XATTR_SET_HANDLER */ +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + /* Define if you have [z] */ #define HAVE_ZLIB 1 @@ -673,6 +730,21 @@ /* kernel exports FPU functions */ /* #undef KERNEL_EXPORTS_X86_FPU */ +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + /* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" From owner-dev-commits-src-all@freebsd.org Sat Jul 10 15:58:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D4658656AD3; Sat, 10 Jul 2021 15: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 4GMZS95Jc4z3qgN; Sat, 10 Jul 2021 15: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 9E8BE26D2; Sat, 10 Jul 2021 15: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 16AFw1ZA080987; Sat, 10 Jul 2021 15: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 16AFw1tH080986; Sat, 10 Jul 2021 15:58:01 GMT (envelope-from git) Date: Sat, 10 Jul 2021 15:58:01 GMT Message-Id: <202107101558.16AFw1tH080986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: a4c167674923 - stable/13 - zfs: update zfs_config.h to match current OpenZFS version (4f92fe0f5) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a4c167674923394d985822fe281187779697ce2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 15:58:01 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=a4c167674923394d985822fe281187779697ce2d commit a4c167674923394d985822fe281187779697ce2d Author: Martin Matuska AuthorDate: 2021-07-10 15:56:31 +0000 Commit: Martin Matuska CommitDate: 2021-07-10 15:56:31 +0000 zfs: update zfs_config.h to match current OpenZFS version (4f92fe0f5) TBD: fetch(3) support for keylocation=http(s):// (direct commit) --- sys/modules/zfs/zfs_config.h | 86 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 4 deletions(-) diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 92fb0571934e..c9d3a5feccaa 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -88,6 +88,9 @@ /* bdev_whole() is available */ /* #undef HAVE_BDEV_WHOLE */ +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + /* bio->bi_opf is defined */ /* #undef HAVE_BIO_BI_OPF */ @@ -100,6 +103,9 @@ /* bio_*_io_acct() available */ /* #undef HAVE_BIO_IO_ACCT */ +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + /* bio_set_dev() is available */ /* #undef HAVE_BIO_SET_DEV */ @@ -151,6 +157,9 @@ /* blk_queue_write_cache() is GPL-only */ /* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ /* #undef HAVE_CFLOCALECOPYCURRENT */ @@ -197,6 +206,9 @@ /* sops->dirty_inode() wants flags */ /* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 @@ -236,6 +248,9 @@ /* fops->fsync() without dentry */ /* #undef HAVE_FSYNC_WITHOUT_DENTRY */ +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + /* generic_*_io_acct() 3 arg available */ /* #undef HAVE_GENERIC_IO_ACCT_3ARG */ @@ -272,6 +287,12 @@ /* yes */ /* #undef HAVE_INODE_LOCK_SHARED */ +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + /* inode_set_flags() exists */ /* #undef HAVE_INODE_SET_FLAGS */ @@ -290,6 +311,21 @@ /* in_compat_syscall() is available */ /* #undef HAVE_IN_COMPAT_SYSCALL */ +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + /* iov_iter_advance() is available */ /* #undef HAVE_IOV_ITER_ADVANCE */ @@ -404,7 +440,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 -/* iops->create()/mkdir()/mknod() take umode_t */ +/* iops->mkdir() takes umode_t */ /* #undef HAVE_MKDIR_UMODE_T */ /* Define to 1 if you have the `mlockall' function. */ @@ -425,6 +461,9 @@ /* Define if host toolchain supports PCLMULQDQ */ #define HAVE_PCLMULQDQ 1 +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + /* percpu_counter_init() wants gfp_t */ /* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ @@ -500,18 +539,33 @@ /* Define to 1 if you have the header file. */ #define HAVE_SECURITY_PAM_MODULES_H 1 -/* setattr_prepare() is available */ -/* #undef HAVE_SETATTR_PREPARE */ +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ -/* iops->set_acl() exists */ +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ /* #undef HAVE_SET_ACL */ +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + /* set_cached_acl() is usable */ /* #undef HAVE_SET_CACHED_ACL_USABLE */ +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + /* struct shrink_control exists */ /* #undef HAVE_SHRINK_CONTROL_STRUCT */ +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + /* new shrinker callback wants 2 args */ /* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ @@ -577,6 +631,9 @@ /* i_op->tmpfile() exists */ /* #undef HAVE_TMPFILE */ +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + /* totalhigh_pages() exists */ /* #undef HAVE_TOTALHIGH_PAGES */ @@ -592,6 +649,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + /* iops->getattr() takes a vfsmount */ /* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ @@ -664,6 +724,9 @@ /* xattr_handler->set() wants xattr_handler */ /* #undef HAVE_XATTR_SET_HANDLER */ +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + /* Define if you have [z] */ #define HAVE_ZLIB 1 @@ -673,6 +736,21 @@ /* kernel exports FPU functions */ /* #undef KERNEL_EXPORTS_X86_FPU */ +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + /* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" From owner-dev-commits-src-all@freebsd.org Sat Jul 10 16:00:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 78F33656B33; Sat, 10 Jul 2021 16:00: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 4GMZW831fYz3r0s; Sat, 10 Jul 2021 16:00: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 4FF542C96; Sat, 10 Jul 2021 16:00: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 16AG0aE0090297; Sat, 10 Jul 2021 16:00:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AG0aUH090296; Sat, 10 Jul 2021 16:00:36 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:00:36 GMT Message-Id: <202107101600.16AG0aUH090296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: e1946a699d53 - stable/13 - zfs: merge openzfs/zfs@4f92fe0f5 (zfs-2.1-release) into stable/13 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e1946a699d530ede26a16598599c8aa6a2a70776 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:00:36 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=e1946a699d530ede26a16598599c8aa6a2a70776 commit e1946a699d530ede26a16598599c8aa6a2a70776 Merge: a4c167674923 4f92fe0f5c82 Author: Martin Matuska AuthorDate: 2021-07-10 15:58:35 +0000 Commit: Martin Matuska CommitDate: 2021-07-10 15:59:52 +0000 zfs: merge openzfs/zfs@4f92fe0f5 (zfs-2.1-release) into stable/13 OpenZFS release 2.1.0 Version bump only, no changes in code. Obtained from: OpenZFS OpenZFS commit: 4f92fe0f5c822f6802c6ec675809d7c112a46f2e OpenZFS tag: zfs-2.1.0 Relnotes: yes sys/contrib/openzfs/META | 2 +- sys/modules/zfs/zfs_config.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --cc sys/modules/zfs/zfs_config.h index c9d3a5feccaa,000000000000..ebad45d3def7 mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,852 -1,0 +1,852 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT_LEGACY */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* kernel has large stacks */ +/* #undef HAVE_LARGE_STACKS */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->mkdir() takes umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ +/* #undef HAVE_SET_ACL */ + +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_g508fff0e4" ++#define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_g4f92fe0f5" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + +/* Define the maximum compatible kernel version. */ +#define ZFS_META_KVER_MAX "5.13" + +/* Define the minimum compatible kernel version. */ +#define ZFS_META_KVER_MIN "3.10" + +/* Define the project license. */ +#define ZFS_META_LICENSE "CDDL" + +/* Define the libtool library 'age' version information. */ +/* #undef ZFS_META_LT_AGE */ + +/* Define the libtool library 'current' version information. */ +/* #undef ZFS_META_LT_CURRENT */ + +/* Define the libtool library 'revision' version information. */ +/* #undef ZFS_META_LT_REVISION */ + +/* Define the project name. */ +#define ZFS_META_NAME "zfs" + +/* Define the project release. */ - #define ZFS_META_RELEASE "FreeBSD_g508fff0e4" ++#define ZFS_META_RELEASE "FreeBSD_g4f92fe0f5" + +/* Define the project version. */ +#define ZFS_META_VERSION "2.1.0" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ + From owner-dev-commits-src-all@freebsd.org Sat Jul 10 16:20:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2DD96657106; Sat, 10 Jul 2021 16:20:11 +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 4GMZxl0q1fz3tNv; Sat, 10 Jul 2021 16:20: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 02CDB3289; Sat, 10 Jul 2021 16:20:11 +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 16AGKAFT012187; Sat, 10 Jul 2021 16:20:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AGKAAW012182; Sat, 10 Jul 2021 16:20:10 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:20:10 GMT Message-Id: <202107101620.16AGKAAW012182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Chisnall Subject: git: 3a522ba1bc85 - main - Pass the syscall number to capsicum permission-denied signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: theraven X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:20:11 -0000 The branch main has been updated by theraven: URL: https://cgit.FreeBSD.org/src/commit/?id=3a522ba1bc852c3d4660a4fa32e4a94999d09a47 commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 Author: David Chisnall AuthorDate: 2021-07-10 16:19:52 +0000 Commit: David Chisnall CommitDate: 2021-07-10 16:19:52 +0000 Pass the syscall number to capsicum permission-denied signals The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler. Approved by: markj (mentor) Reviewed by: kib, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29185 --- lib/libc/sys/procctl.2 | 10 ++++++++++ share/man/man3/siginfo.3 | 2 ++ sys/amd64/amd64/trap.c | 1 + sys/amd64/cloudabi32/cloudabi32_sysvec.c | 1 + sys/amd64/cloudabi64/cloudabi64_sysvec.c | 1 + sys/amd64/ia32/ia32_syscall.c | 1 + sys/amd64/include/proc.h | 1 + sys/amd64/linux/linux_sysvec.c | 1 + sys/amd64/linux32/linux32_sysvec.c | 1 + sys/arm/arm/syscall.c | 1 + sys/arm/cloudabi32/cloudabi32_sysvec.c | 1 + sys/arm/include/proc.h | 1 + sys/arm64/arm64/elf32_machdep.c | 1 + sys/arm64/arm64/trap.c | 1 + sys/arm64/cloudabi32/cloudabi32_sysvec.c | 1 + sys/arm64/cloudabi64/cloudabi64_sysvec.c | 1 + sys/arm64/include/proc.h | 1 + sys/arm64/linux/linux_sysvec.c | 1 + sys/i386/cloudabi32/cloudabi32_sysvec.c | 1 + sys/i386/i386/trap.c | 1 + sys/i386/include/proc.h | 1 + sys/i386/linux/linux_sysvec.c | 1 + sys/kern/subr_syscall.c | 1 + sys/mips/include/proc.h | 1 + sys/mips/mips/trap.c | 1 + sys/powerpc/include/proc.h | 1 + sys/powerpc/powerpc/trap.c | 1 + sys/riscv/include/proc.h | 1 + sys/riscv/riscv/trap.c | 1 + sys/sys/signal.h | 7 +++++++ 30 files changed, 46 insertions(+) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 432ed5919a81..ce7a2be5d5e4 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -454,6 +454,16 @@ and the .Va si_code member is set to .Dv TRAP_CAP . +The system call number is stored in the +.Va si_syscall +field of the +.Fa siginfo +signal handler parameter. +The other system call parameters can be read from the +.Fa ucontext_t +but the system call number is typically stored in the register +that also contains the return value and so is unavailable in the +signal handler. .Pp See .Xr capsicum 4 diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index acc8785b2f0d..7f8a809cdfa5 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -85,6 +85,8 @@ timer overrun count .It Vt int Ta Va si_mqd Ta .Tn POSIX message queue ID +.It Vt int Ta Va si_syscall Ta +system-call number for system calls blocked by Capsicum .El .Pp The diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 55649687ce50..b08495f3f139 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1059,6 +1059,7 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_rax; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall || diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c index 164f87e90e91..26924ed5a980 100644 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/amd64/cloudabi32/cloudabi32_sysvec.c @@ -101,6 +101,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index d3893902b08e..c08d912e84d4 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -98,6 +98,7 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 6c9399d1a52f..9294ef8ce741 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -150,6 +150,7 @@ ia32_fetch_syscall_args(struct thread *td) params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; + sa->original_code = sa->code; /* * Need to check if this is a 32 bit or 64 bit syscall. diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 59796e729ac4..0f8cf50e326d 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -92,6 +92,7 @@ struct mdproc { struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index c5538932b1e3..566af6de29e7 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -191,6 +191,7 @@ linux_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_r8; sa->args[5] = frame->tf_r9; sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 504d57e418a5..7dfd57a74a1e 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -662,6 +662,7 @@ linux32_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_rdi; sa->args[5] = frame->tf_rbp; /* Unconfirmed */ sa->code = frame->tf_rax; + sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index a851db6e4556..a635de0ec716 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -108,6 +108,7 @@ cpu_fetch_syscall_args(struct thread *td) nap = 4; sa = &td->td_sa; sa->code = td->td_frame->tf_r7; + sa->original_code = sa->code; ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c index a8c5da47d265..4df57b22e13d 100644 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm/cloudabi32/cloudabi32_sysvec.c @@ -78,6 +78,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_r12; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index a37ccd8f621c..9566c264731e 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -75,6 +75,7 @@ struct mdproc { */ struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; } __aligned(8); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 206413b45172..7cedbffc4d43 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -175,6 +175,7 @@ freebsd32_fetch_syscall_args(struct thread *td) /* r7 is the syscall id */ sa->code = td->td_frame->tf_x[7]; + sa->original_code = sa->code; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 744b646b31c8..2b2d2e433efa 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -130,6 +130,7 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_x[8]; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/arm64/cloudabi32/cloudabi32_sysvec.c b/sys/arm64/cloudabi32/cloudabi32_sysvec.c index 889393560ede..b7be5cc0e5e3 100644 --- a/sys/arm64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm64/cloudabi32/cloudabi32_sysvec.c @@ -75,6 +75,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[0]; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm64/cloudabi64/cloudabi64_sysvec.c b/sys/arm64/cloudabi64/cloudabi64_sysvec.c index bdbd828b7b62..624d86693457 100644 --- a/sys/arm64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/arm64/cloudabi64/cloudabi64_sysvec.c @@ -78,6 +78,7 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[8]; + sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index bb933dc98241..3800798d79b7 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -49,6 +49,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index e1d3708b70e9..7749c1cd7fc8 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -125,6 +125,7 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = td->td_frame->tf_x[8]; + sa->original_code = sa->code; /* LINUXTODO: generic syscall? */ if (sa->code >= p->p_sysent->sv_size) sa->callp = &p->p_sysent->sv_table[0]; diff --git a/sys/i386/cloudabi32/cloudabi32_sysvec.c b/sys/i386/cloudabi32/cloudabi32_sysvec.c index 4f12d2b6cbce..e0a50f6697a9 100644 --- a/sys/i386/cloudabi32/cloudabi32_sysvec.c +++ b/sys/i386/cloudabi32/cloudabi32_sysvec.c @@ -96,6 +96,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_eax; + sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 045478149be5..07abac23c9da 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1052,6 +1052,7 @@ cpu_fetch_syscall_args(struct thread *td) #endif sa->code = frame->tf_eax; + sa->original_code = sa->code; params = (caddr_t)frame->tf_esp + sizeof(uint32_t); /* diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 2950946ff155..76e1ac611474 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -64,6 +64,7 @@ struct mdproc { struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index adb70fded6dc..a0959d55b585 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -756,6 +756,7 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_eax; + sa->original_code = sa->code; sa->args[0] = frame->tf_ebx; sa->args[1] = frame->tf_ecx; sa->args[2] = frame->tf_edx; diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 85a0814a2125..2304e3e7f3f9 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -230,6 +230,7 @@ syscallret(struct thread *td) ksi.ksi_signo = SIGTRAP; ksi.ksi_errno = td->td_errno; ksi.ksi_code = TRAP_CAP; + ksi.ksi_info.si_syscall = sa->original_code; trapsignal(td, &ksi); } } diff --git a/sys/mips/include/proc.h b/sys/mips/include/proc.h index 0cb1d433387c..29d832a162e6 100644 --- a/sys/mips/include/proc.h +++ b/sys/mips/include/proc.h @@ -84,6 +84,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 96a2de4ee817..9d7a07606373 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -355,6 +355,7 @@ cpu_fetch_syscall_args(struct thread *td) else locr0->pc += sizeof(int); sa->code = locr0->v0; + sa->original_code = sa->code; switch (sa->code) { case SYS___syscall: diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index d4df3ccfefef..aac4e66b39fc 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -62,6 +62,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 3a1bdf7cde07..ab5189a0f418 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -667,6 +667,7 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->fixreg[0]; + sa->original_code = sa->code; params = (caddr_t)(frame->fixreg + FIRSTARG); n = NARGREG; diff --git a/sys/riscv/include/proc.h b/sys/riscv/include/proc.h index 4b5ae9ebe3ed..1c6c8d2919b5 100644 --- a/sys/riscv/include/proc.h +++ b/sys/riscv/include/proc.h @@ -48,6 +48,7 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; + u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 07d7f84a94e8..8844638c8204 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -103,6 +103,7 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_t[0]; + sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 8b45a521c3ee..9dae3ce04745 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -255,6 +255,12 @@ typedef struct __siginfo { struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ + struct { + int _syscall; /* Syscall number for signals + * delivered as a result of + * system calls denied by + * Capsicum. */ + } _capsicum; struct { long __spare1__; int __spare2__[7]; @@ -267,6 +273,7 @@ typedef struct __siginfo { #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band +#define si_syscall _reason._capsicum._syscall #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) struct siginfo32 { From owner-dev-commits-src-all@freebsd.org Sat Jul 10 16:54:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 72F9065727A; Sat, 10 Jul 2021 16:54: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 4GMbhq2sszz4Rll; Sat, 10 Jul 2021 16:54: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 4AC333B46; Sat, 10 Jul 2021 16:54: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 16AGs3Ki061055; Sat, 10 Jul 2021 16:54:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AGs3Hn061054; Sat, 10 Jul 2021 16:54:03 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:54:03 GMT Message-Id: <202107101654.16AGs3Hn061054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 445b5554bf97 - main - nvmecontrol: document power command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 445b5554bf97254a0ead3d70f801871d62dcfb62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:54:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=445b5554bf97254a0ead3d70f801871d62dcfb62 commit 445b5554bf97254a0ead3d70f801871d62dcfb62 Author: Warner Losh AuthorDate: 2021-07-10 16:51:15 +0000 Commit: Warner Losh CommitDate: 2021-07-10 16:53:34 +0000 nvmecontrol: document power command The description of the power command is missing. While the synopsis is present, there's no explanation. Add one. Reviewed by: mav, chuck PR: 237866 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31122 --- sbin/nvmecontrol/nvmecontrol.8 | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 2d634eb54216..7d70e1762f73 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -470,6 +470,37 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss power +Manage the power modes of the NVMe controller. +.Bl -tag -width 6n +.It Fl l +List all supported power modes. +.It Fl p Ar mode +Set the power mode to +.Ar mode . +This must be a mode listed with the +.Dl nvmecontrol power -l +command. +.It Fl w Ar hint +Set the workload hint for automatic power mode control. +.Bl -tag -compact -width 6n +.It 0 +No workload hint is provided. +.It 1 +Extended idle period workload. +The device is often idle for minutes at a time. +A burst of write commands comes in over a period of seconds. +Then the device returns to being idle. +.It 2 +Heavy sequential writes. +A huge number of sequential writes will be submitted, filling the submission queues. +.It Other +All other values are reserved and have no standard meaning. +.El +Please see the +.Dq NVM Subsystem Workloads +section of the relevant NVM Express Base Standard for details. +.El .Ss selftest Start the specified device self-test: .Bl -tag -width 6n @@ -505,7 +536,7 @@ and commands send NVMe commands to either the administrative or the data part of the device. These commands are expected to be compatible with nvme-cli. -Please see the NVMe Standard for details. +Please see the NVM Express Base Standard for details. .Bl -tag -width 16n .It Fl o -opcode Ar opcode Opcode to send. From owner-dev-commits-src-all@freebsd.org Sat Jul 10 16:54:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C6909657184; Sat, 10 Jul 2021 16:54: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 4GMbhr3sdRz4S2k; Sat, 10 Jul 2021 16:54: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 5A06E3BCB; Sat, 10 Jul 2021 16:54: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 16AGs4uR061079; Sat, 10 Jul 2021 16:54:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AGs4DG061078; Sat, 10 Jul 2021 16:54:04 GMT (envelope-from git) Date: Sat, 10 Jul 2021 16:54:04 GMT Message-Id: <202107101654.16AGs4DG061078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d8514fa6f1b0 - main - mk: LZMA_SUPPORT is unused MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8514fa6f1b0b9824b169c5ab66f37713b303c57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 16:54:04 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d8514fa6f1b0b9824b169c5ab66f37713b303c57 commit d8514fa6f1b0b9824b169c5ab66f37713b303c57 Author: Warner Losh AuthorDate: 2021-07-10 16:52:12 +0000 Commit: Warner Losh CommitDate: 2021-07-10 16:53:35 +0000 mk: LZMA_SUPPORT is unused Retire LZMA_SUPPORT. It's unused since r332995. Reviewed by: delphij PR: 244302 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31088 --- share/man/man5/src.conf.5 | 4 +--- share/mk/src.opts.mk | 1 - tools/build/options/WITHOUT_LZMA_SUPPORT | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index e9265df9051a..b08abf4888b7 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 June 28, 2021 +.Dd July 6, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1040,8 +1040,6 @@ and related programs. Build .Xr ls 1 without support for colors to distinguish file types. -.It Va WITHOUT_LZMA_SUPPORT -Build some programs without optional lzma compression support. .It Va WITHOUT_MAIL Do not build any mail support (MUA or MTA). When set, it enforces these options: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index db2625a80c52..27de86f6c8d4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -139,7 +139,6 @@ __DEFAULT_YES_OPTIONS = \ LOCATE \ LPR \ LS_COLORS \ - LZMA_SUPPORT \ MAIL \ MAILWRAPPER \ MAKE \ diff --git a/tools/build/options/WITHOUT_LZMA_SUPPORT b/tools/build/options/WITHOUT_LZMA_SUPPORT deleted file mode 100644 index 9e8a9bc55194..000000000000 --- a/tools/build/options/WITHOUT_LZMA_SUPPORT +++ /dev/null @@ -1,2 +0,0 @@ -.\" $FreeBSD$ -Build some programs without optional lzma compression support. From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:08:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 96BC66579B0; Sat, 10 Jul 2021 17:08: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 4GMc1Y3czmz4TxN; Sat, 10 Jul 2021 17:08: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 632563E59; Sat, 10 Jul 2021 17:08: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 16AH8Xl1075345; Sat, 10 Jul 2021 17:08:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AH8XTj075344; Sat, 10 Jul 2021 17:08:33 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:08:33 GMT Message-Id: <202107101708.16AH8XTj075344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 666abb0888d2 - stable/13 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 666abb0888d277e82c6468851e015798e9a7629f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:08:33 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=666abb0888d277e82c6468851e015798e9a7629f commit 666abb0888d277e82c6468851e015798e9a7629f Author: Warner Losh AuthorDate: 2021-07-07 23:30:35 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:07:26 +0000 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Import the latest bsd-features branch of the one-true-awk upstream: o Move to bison for $YACC o Set close-on-exec flag for file and pipe redirects that aren't std* o lots of little fixes to modernize ocde base o free sval member before setting it o fix a bug where a{0,3} could match aaaa o pull in systime and strftime from NetBSD awk o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) Also revert a few of the trivial FreeBSD changes that were done slightly differently in the upstreaming process. Also, our PR database may have been mined by upstream for these fixes, and Mikolaj Golub may deserve credit for some of the fixes in this update. Suggested by: Mikolaj Golub PR: 143363, 143365, 143368, 143369, 143373, 143375, 214783 Sponsored by: Netflix (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) --- contrib/one-true-awk/ChangeLog | 108 +++ contrib/one-true-awk/FIXES | 261 +++++- contrib/one-true-awk/REGRESS | 4 + contrib/one-true-awk/awk.1 | 159 +++- contrib/one-true-awk/awk.h | 67 +- contrib/one-true-awk/awkgram.y | 48 +- contrib/one-true-awk/b.c | 438 +++++++--- .../one-true-awk/bugs-fixed/missing-precision.ok | 2 +- contrib/one-true-awk/bugs-fixed/negative-nf.ok | 2 +- contrib/one-true-awk/lex.c | 77 +- contrib/one-true-awk/lib.c | 327 +++++--- contrib/one-true-awk/main.c | 163 ++-- contrib/one-true-awk/makefile | 74 +- contrib/one-true-awk/maketab.c | 66 +- contrib/one-true-awk/parse.c | 29 +- contrib/one-true-awk/proctab.c | 202 ++--- contrib/one-true-awk/proto.h | 41 +- contrib/one-true-awk/run.c | 918 ++++++++++++++------- contrib/one-true-awk/tran.c | 164 ++-- usr.bin/awk/Makefile | 10 +- 20 files changed, 2192 insertions(+), 968 deletions(-) diff --git a/contrib/one-true-awk/ChangeLog b/contrib/one-true-awk/ChangeLog index fd03b2bbca0b..dea4ed7e3187 100644 --- a/contrib/one-true-awk/ChangeLog +++ b/contrib/one-true-awk/ChangeLog @@ -1,3 +1,111 @@ +2020-07-30 Arnold D. Robbins + + By fiat, we use bison for $(YACC). Trying to accommodate + different versions didn't work. + + * makefile: Significant cleanup. Replace all ytab* references + with awkgram.tab.* and simplify definition of YACC. + * .gitignore: Remove ytab* references. + * b.c, lex.c, maketab.c, parse.c, run.c: Replace include of ytab.h + with awkgram.tab.h. + * lib.c, main.c, tran.c: Remove include of ytab.h, wasn't needed. + +2020-01-20 Arnold D. Robbins + + * run.c (openfile): Set the close-on-exec flag for file + and pipe redirections that aren't stdin/stdout/stderr. + +2020-01-06 Arnold D. Robbins + + Minor fixes. + * b.c (replace_repeat): Turn init_q back into an int. + * lex.c (string): Use \a instead of \007. + * tran.c (catstr): Use snprintf instead of sprintf. + +2020-01-01 Arnold D. Robbins + + * tran.c (syminit, arginit, envinit): Free sval member before + setting it. Thanks to valgrind. + * b.c: Small formatting cleanups in several routines. + +2019-12-27 Arnold D. Robbins + + * b.c (replace_repeat): Fix a bug whereby a{0,3} could match + four a's. Thanks to Anonymous AWK fan + for the report. Also, minor code formatting cleanups. + * testdir/T.int-expr: New file. + +2019-12-11 Arnold D. Robbins + + * README: Renamed to ... + * README.md: ... this. Cleaned up some as well, + including moving to Markdown. + +2019-11-08 Arnold D. Robbins + + * test/T.chem: Use $oldawk instead of hardwiring 'awk'. + * test/T.lilly: Remove gawk warnings from output, improves + portability. + +2019-10-17 Arnold D. Robbins + + Pull in systime() and strftime() from the NetBSD awk. + + * awk.1: Document the functions. + * run.c (bltin): Implement the functions. + * awk.h: Add defines for systime and strftime. + * lex.c: Add support for systime and strftime. + +2019-10-07 Arnold D. Robbins + + Integrate features from different *BSD versions of awk. + Gensub support from NetBSD. Bitwise functions from OpenBSD. + + * awk.h: Add defines for and, or, xor, compl, lshift and rshift. + * awkgram.y: Add support for gensub. + * maketab.c: Ditto. + * lex.c: Add support for gensub and bitwise functions. + * parse.c (node5, op5): New functions. + * proto.h (node5, op5): New declarations. + * run.c (bltin): Implement the bitwise functions. + (gensub): New function. + * awk.1: Document additional functions. + +2019-10-07 Arnold D. Robbins + + * b.c (fnematch): Change type of pbuf from unsigned char to char. + * proto.h (fnematch): Ditto. + +2019-10-06 Arnold D. Robbins + + * lib.c (readrec): Allow RS a regular expression. Imported + the code from the NetBSD awk. + * b.c (fnematch): New function for implementing the feature. + * awk.1: Updated. + * main.c (version): Updated. + +2019-06-24 Arnold D. Robbins + + * makefile: Revise to take into account there is no more awktest.tar, + add targets 'check' and 'test', and also 'testclean' to clean up + after test run. Have 'clean' and 'cleaner' depend upon 'testclean'. + +2019-06-23 Arnold D. Robbins + + * testdir: Extracted from awktest.tar and added to Git. + * awktest.tar: Removed. + +2019-06-06 Arnold D. Robbins + + * awk.1: Fix a typo, minor edits. + +2019-06-05 Arnold D. Robbins + + * b.c (relex): Count parentheses and treat umatched right paren + as a literal character. + * awktest.tar (testdir/T.re): Added a test case. + * main.c (version): Updated. + 2019-05-29 Arnold D. Robbins * lib.c (isclvar): Remove check for additional '=' after diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES index 183eaedee47d..516458eee0c1 100644 --- a/contrib/one-true-awk/FIXES +++ b/contrib/one-true-awk/FIXES @@ -25,6 +25,229 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +February 15, 2021: + Small fix so that awk will compile again with g++. Thanks to + Arnold Robbins. + +January 06, 2021: + Fix a decision bug with trailing stuff in lib.c:is_valid_number + after recent changes. Thanks to Ozan Yigit. + +December 18, 2020: + Fix problems converting inf and NaN values in lib.c:is_valid_number. + Enhance number to string conversion to do the right thing for + NaN and inf values. Things are now pretty much the same as in + gawk. (Found a gawk bug while we're at it.) Added a torture + test for these values. Thanks to Arnold Robbins. Allows closing + of PR #101. + +December 15, 2020: + Merge PR #99, which gets the right header for strcasecmp. + Thanks to GitHub user michaelforney. + +December 8, 2020: + Merge PR #98: Disallow hex data. Allow only +nan, -nan, + +inf, -inf (case independent) to give NaN and infinity values. + Improve things so that string to double conversion is only + done once, yielding something of a speedup. This obviate + PR #95. Thanks to Arnold Robbins. + +December 3, 2020: + Fix to argument parsing to avoid printing spurious newlines. + Thanks to Todd Miller. Merges PR #97. + +October 13, 2020: + Add casts before all the calls to malloc/calloc/realloc in order + to get it to compile with g++. Thanks to Arnold Robbins. + +August 16, 2020: + Additional fixes for DJGPP. Thanks to Eli Zaretskii for + the testing. + +August 7, 2020: + Merge PR #93, which adds casts to (void*) for debug prints + using the %p format specifier. Thanks to GitHub user YongHaoWu + ("Chris") for the fixes. + +August 4, 2020: + In run.c, use non-restartable multibyte routines to attain + portability to DJGPP. Should fix Issue 92. Thanks to Albert Wik + for the report and to Todd Miller for the suggested fix. + +July 30, 2020: + Merge PRs 88-91 which fix small bugs. Thanks to Todd Miller and + Tim van der Molen for the fixes. + + In order to make life easier, we move exclusively to bison + as the parser generator. + +July 2, 2020: + Merge PRs 85 and 86 which fix regressions. Thanks to + Tim van der Molen for the fixes. + +June 25, 2020: + Merge PRs 82 and 84. The latter fixes issue #83. Thanks to + Todd Miller and awkfan77. + +June 12, 2020: + Clear errno before calling errcheck to avoid any spurious errors + left over from previous calls that may have set it. Thanks to + Todd Miller for the fix, from PR #80. + + Fix Issue #78 by allowing \r to follow floating point numbers in + lib.c:is_number. Thanks to GitHub user ajcarr for the report + and to Arnold Robbins for the fix. + +June 5, 2020: + In fldbld(), make sure that inputFS is set before trying to + use it. Thanks to Steffen Nurpmeso + for the report. + +May 5, 2020: + Fix checks for compilers that can handle noreturn. Thanks to + GitHub user enh-google for pointing it out. Closes Issue #79. + +April 16, 2020: + Handle old compilers that don't support C11 (for noreturn). + Thanks to Arnold Robbins. + +April 5, 2020: + Use and noreturn instead of GCC attributes. + Thanks to GitHub user awkfan77. Closes PR #77. + +February 28, 2020: + More cleanups from Christos Zoulas: notably backslash continuation + inside strings removes the newline and a fix for RS = "^a". + Fix for address sanitizer-found problem. Thanks to GitHub user + enh-google. + +February 19, 2020: + More small cleanups from Christos Zoulas. + +February 18, 2020: + Additional cleanups from Christos Zoulas. It's no longer necessary + to use the -y flag to bison. + +February 6, 2020: + Additional small cleanups from Christos Zoulas. awk is now + a little more robust about reporting I/O errors upon exit. + +January 31, 2020: + Merge PR #70, which avoids use of variable length arrays. Thanks + to GitHub user michaelforney. Fix issue #60 ({0} in interval + expressions doesn't work). Also get all tests working again. + Thanks to Arnold Robbins. + +January 24, 2020: + A number of small cleanups from Christos Zoulas. Add the close + on exec flag to files/pipes opened for redirection; courtesy of + Arnold Robbins. + +January 19, 2020: + If POSIXLY_CORRECT is set in the environment, then sub and gsub + use POSIX rules for multiple backslashes. This fixes Issue #66, + while maintaining backwards compatibility. + +January 9, 2020: + Input/output errors on closing files are now fatal instead of + mere warnings. Thanks to Martijn Dekker . + +January 5, 2020: + Fix a bug in the concatentation of two string constants into + one done in the grammar. Fixes GitHub issue #61. Thanks + to GitHub user awkfan77 for pointing out the direction for + the fix. New test T.concat added to the test suite. + Fix a few memory leaks reported by valgrind, as well. + +December 27, 2019: + Fix a bug whereby a{0,3} could match four a's. Thanks to + "Anonymous AWK fan" for the report. + +December 11, 2019: + Further printf-related fixes for 32 bit systems. + Thanks again to Christos Zoulas. + +December 8, 2019: + Fix the return value of sprintf("%d") on 32 bit systems. + Thanks to Jim Lowe for the report and to Christos Zoulas + for the fix. + +November 10, 2019: + Convert a number of Boolean integer variables into + actual bools. Convert compile_time variable into an + enum and simplify some of the related code. Thanks + to Arnold Robbins. + +November 8, 2019: + Fix from Ori Bernstein to get UTF-8 characters instead of + bytes when FS = "". This is currently the only bit of + the One True Awk that understands multibyte characters. + From Arnold Robbins, apply some cleanups in the test suite. + +October 25, 2019: + More fixes and cleanups from NetBSD, courtesy of Christos + Zoulas. Merges PRs 54 and 55. + +October 24, 2019: + Import second round of code cleanups from NetBSD. Much thanks + to Christos Zoulas (GitHub user zoulasc). Merges PR 53. + Add an optimization for string concatenation, also from + Christos. + +October 17, 2019: + Import code cleanups from NetBSD. Much thanks to Christos + Zoulas (GitHub user zoulasc). Merges PR 51. + +October 6, 2019: + Import code from NetBSD awk that implements RS as a regular + expression. + +September 10, 2019: + Fixes for various array / memory overruns found via gcc's + -fsanitize=unknown. Thanks to Alexander Richardson (GitHub + user arichardson). Merges PRs 47 and 48. + +July 28, 2019: + Import grammar optimization from NetBSD: Two string constants + concatenated together get turned into a single string. + +July 26, 2019: + Support POSIX-specified C-style escape sequences "\a" (alarm) + and "\v" (vertical tab) in command line arguments and regular + expressions, further to the support for them in strings added on + Apr 9, 1989. These now no longer match as literal "a" and "v" + characters (as they don't on other awk implementations). + Thanks to Martijn Dekker. + +July 17, 2019: + Pull in a number of code cleanups and minor fixes from + Warner Losh's bsd-ota branch. The only user visible change + is the use of random(3) as the random number generator. + Thanks to Warner Losh for collecting all these fixes in + one easy place to get them from. + +July 16, 2019: + Fix field splitting to use FS value as of the time a record + was read or assigned to. Thanks to GitHub user Cody Mello (melloc) + for the fix. (Merged from his branch, via PR #42.) Updated + testdir/T.split per said PR as well. + +June 24, 2019: + Extract awktest.tar into testdir directory. Add some very + simple mechanics to the makefile for running the tests and + for cleaning up. No changes to awk itself. + +June 17, 2019: + Disallow deleting SYMTAB and its elements, which creates + use-after-free bugs. Thanks to GitHub user Cody Mello (melloc) + for the fix. (Merged from PR #43.) + +June 5, 2019: + Allow unmatched right parenthesis in a regular expression to + be treated literally. Fixes Issue #40. Thanks to GitHub user + Warner Losh (bsdimp) for the report. Thanks to Arnold Robbins + for the fix. + May 29,2019: Fix check for command line arguments to no longer require that first character after '=' not be another '='. Reverts change of @@ -34,7 +257,7 @@ May 29,2019: Apr 7, 2019: Update awktest.tar(p.50) to use modern options to sort. Needed for Android development. Thanks to GitHub user mohd-akram (Mohamed - Akram). From Comment #33. + Akram). From Issue #33. Mar 12, 2019: Added very simplistic support for cross-compiling in the @@ -54,7 +277,7 @@ Mar 3, 2019: #12: Avoid undefined behaviour when using ctype(3) functions in relex(). Thanks to GitHub user iamleot. #31: Make getline handle numeric strings, and update FIXES. Thanks - to GitHub user arnoldrobbins + to GitHub user arnoldrobbins. #32: maketab: support build systems with read-only source. Thanks to GitHub user enh. @@ -159,10 +382,10 @@ Jun 12, 2011: /pat/, \n /pat/ {...} is now legal, though bad style to use. added checks to new -v code that permits -vnospace; thanks to - ruslan ermilov for spotting this and providing the patch. + ruslan ermilov for spotting this and providing the patch. removed fixed limit on number of open files; thanks to aleksey - cheusov and christos zoulos. + cheusov and christos zoulos. fixed day 1 bug that resurrected deleted elements of ARGV when used as filenames (in lib.c). @@ -180,10 +403,10 @@ May 1, 2011: and arnold robbins, changed srand() to return the previous seed (which is 1 on the first call of srand). the seed is an Awkfloat internally though converted to unsigned int to - pass to the library srand(). thanks, everyone. + pass to the library srand(). thanks, everyone. fixed a subtle (and i hope low-probability) overflow error - in fldbld, by adding space for one extra \0. thanks to + in fldbld, by adding space for one extra \0. thanks to robert bassett for spotting this one and providing a fix. removed the files related to compilation on windows. i no @@ -220,7 +443,7 @@ Oct 8, 2008: Oct 23, 2007: minor fix in lib.c: increase inputFS to 100, change malloc - for fields to n+1. + for fields to n+1. fixed memory fault caused by out of order test in setsval. @@ -267,7 +490,7 @@ Jan 17, 2006: core dump on linux with BEGIN {nextfile}, now fixed. - removed some #ifdef's in run.c and lex.c that appear to no + removed some #ifdef's in run.c and lex.c that appear to no longer be necessary. Apr 24, 2005: @@ -281,8 +504,8 @@ Jan 14, 2005: rethinking it. Dec 31, 2004: - prevent overflow of -f array in main, head off potential error in - call of SYNTAX(), test malloc return in lib.c, all with thanks to + prevent overflow of -f array in main, head off potential error in + call of SYNTAX(), test malloc return in lib.c, all with thanks to todd miller. Dec 22, 2004: @@ -310,8 +533,8 @@ Nov 22, 2003: code known to man. fixed a storage leak in call() that appears to have been there since - 1983 or so -- a function without an explicit return that assigns a - string to a parameter leaked a Cell. thanks to moinak ghosh for + 1983 or so -- a function without an explicit return that assigns a + string to a parameter leaked a Cell. thanks to moinak ghosh for spotting this very subtle one. Jul 31, 2003: @@ -333,7 +556,7 @@ Jul 28, 2003: radix character in programs and command line arguments regardless of the locale; otherwise, the locale should prevail for input and output of numbers. so it's intended to work that way. - + i have rescinded the attempt to use strcoll in expanding shorthands in regular expressions (cclenter). its properties are much too surprising; for example [a-c] matches aAbBc in locale en_US but abBcC @@ -397,7 +620,7 @@ Nov 29, 2002: Jun 28, 2002: modified run/format() and tran/getsval() to do a slightly better job on using OFMT for output from print and CONVFMT for other - number->string conversions, as promised by posix and done by + number->string conversions, as promised by posix and done by gawk and mawk. there are still places where it doesn't work right if CONVFMT is changed; by then the STR attribute of the variable has been irrevocably set. thanks to arnold robbins for @@ -429,7 +652,7 @@ Feb 10, 2002: Jan 1, 2002: fflush() or fflush("") flushes all files and pipes. - length(arrayname) returns number of elements; thanks to + length(arrayname) returns number of elements; thanks to arnold robbins for suggestion. added a makefile.win to make it easier to build on windows. @@ -479,7 +702,7 @@ July 5, 2000: May 25, 2000: yet another attempt at making 8-bit input work, with another - band-aid in b.c (member()), and some (uschar) casts to head + band-aid in b.c (member()), and some (uschar) casts to head off potential errors in subscripts (like isdigit). also changed HAT to NCHARS-2. thanks again to santiago vila. @@ -526,7 +749,7 @@ Apr 21, 1999: the test case.) Apr 16, 1999: - with code kindly provided by Bruce Lilly, awk now parses + with code kindly provided by Bruce Lilly, awk now parses /=/ and similar constructs more sensibly in more places. Bruce also provided some helpful test cases. @@ -583,7 +806,7 @@ Jan 13, 1999: Oct 19, 1998: fixed a couple of bugs in getrec: could fail to update $0 - after a getline var; because inputFS wasn't initialized, + after a getline var; because inputFS wasn't initialized, could split $0 on every character, a misleading diversion. fixed caching bug in makedfa: LRU was actually removing @@ -731,7 +954,7 @@ May 2, 1996: input file. (thanks to arnold robbins for inspiration and code). small fixes to regexpr code: can now handle []], [[], and - variants; [] is now a syntax error, rather than matching + variants; [] is now a syntax error, rather than matching everything; [z-a] is now empty, not z. far from complete or correct, however. (thanks to jeffrey friedl for pointing out some awful behaviors.) diff --git a/contrib/one-true-awk/REGRESS b/contrib/one-true-awk/REGRESS index 7d3ded69d536..eb3b5d7ac70b 100755 --- a/contrib/one-true-awk/REGRESS +++ b/contrib/one-true-awk/REGRESS @@ -33,3 +33,7 @@ then fi REGRESS + +cd .. +cd bugs-fixed +REGRESS diff --git a/contrib/one-true-awk/awk.1 b/contrib/one-true-awk/awk.1 index b8e00cb60449..b3698eb07d1a 100644 --- a/contrib/one-true-awk/awk.1 +++ b/contrib/one-true-awk/awk.1 @@ -7,6 +7,10 @@ .fi .ft 1 .. +.de TF +.IP "" "\w'\fB\\$1\ \ \fP'u" +.PD 0 +.. .TH AWK 1 .CT 1 files prog_other .SH NAME @@ -48,7 +52,7 @@ matches the pattern. Each line is matched against the pattern portion of every pattern-action statement; the associated action is performed for each matched pattern. -The file name +The file name .B \- means the standard input. Any @@ -90,7 +94,7 @@ A pattern-action statement has the form: .IP .IB pattern " { " action " } .PP -A missing +A missing .BI { " action " } means print the line; a missing pattern always matches. @@ -209,7 +213,7 @@ or length of if no argument. .TP .B rand -random number on [0,1) +random number on [0,1). .TP .B srand sets seed for @@ -217,7 +221,7 @@ sets seed for and returns the previous seed. .TP .B int -truncates to an integer value +truncates to an integer value. .TP \fBsubstr(\fIs\fB, \fIm\fR [\fB, \fIn\^\fR]\fB)\fR the @@ -225,12 +229,11 @@ the substring of .I s that begins at position -.I m +.I m counted from 1. If no -.IR m , -use the rest of the string -.I +.IR n , +use the rest of the string. .TP .BI index( s , " t" ) the position in @@ -294,6 +297,25 @@ and .B gsub return the number of replacements. .TP +\fBgensub(\fIpat\fB, \fIrepl\fB, \fIhow\fR [\fB, \fItarget\fR]\fB)\fR +replaces instances of +.I pat +in +.I target +with +.IR repl . +If +.I how +is \fB"g"\fR or \fB"G"\fR, do so globally. Otherwise, +.I how +is a number indicating which occurrence to replace. If no +.IR target , +use +.BR $0 . +Return the resulting string; +.I target +is not modified. +.TP .BI sprintf( fmt , " expr" , " ...\fB) the string resulting from formatting .I expr ... @@ -302,13 +324,35 @@ according to the format .IR fmt . .TP +.B systime() +returns the current date and time as a standard +``seconds since the epoch'' value. +.TP +.BI strftime( fmt ", " timestamp\^ ) +formats +.I timestamp +(a value in seconds since the epoch) +according to +.IR fmt , +which is a format string as supported by +.IR strftime (3). +Both +.I timestamp +and +.I fmt +may be omitted; if no +.IR timestamp , +the current time of day is used, and if no +.IR fmt , +a default format of \fB"%a %b %e %H:%M:%S %Z %Y"\fR is used. +.TP .BI system( cmd ) executes .I cmd and returns its exit status. This will be \-1 upon error, .IR cmd 's exit status upon a normal exit, -256 + +256 + .I sig upon death-by-signal, where .I sig @@ -361,19 +405,26 @@ In all cases, returns 1 for a successful input, 0 for end of file, and \-1 for an error. .PP +The functions +.BR compl , +.BR and , +.BR or , +.BR xor , +.BR lshift , +and +.B rshift +peform the corresponding bitwise operations on their +operands, which are first truncated to integer. +.PP Patterns are arbitrary Boolean combinations (with .BR "! || &&" ) of regular expressions and relational expressions. Regular expressions are as in -.IR egrep (1) -except numeric quantifiers are not supported beyond the basic -.B + -and -.B ? -for quantities \&\f(CW"0 or 1"\fP and \&\f(CW"1 or more"\fP -respectively. +.IR egrep ; +see +.IR grep (1). Isolated regular expressions in a pattern apply to the entire line. Regular expressions may also occur in @@ -483,6 +534,11 @@ the length of a string matched by .TP .B RS input record separator (default newline). +If empty, blank lines separate records. +If more than one character long, +.B RS +is treated as a regular expression, and records are +separated by text matching the expression. .TP .B RSTART the start position of a string matched by @@ -502,6 +558,16 @@ functions may be called recursively. Parameters are local to the function; all other variables are global. Thus local variables may be created by providing excess parameters in the function definition. +.SH ENVIRONMENT VARIABLES +If +.B POSIXLY_CORRECT +is set in the environment, then +.I awk +follows the POSIX rules for +.B sub +and +.B gsub +with respect to consecutive backslashes and ampersands. .SH EXAMPLES .TP .EX @@ -546,8 +612,8 @@ BEGIN { # Simulate echo(1) .fi .EE .SH SEE ALSO -.IR grep (1), -.IR lex (1), +.IR grep (1), +.IR lex (1), .IR sed (1) .br A. V. Aho, B. W. Kernighan, P. J. Weinberger, @@ -558,8 +624,61 @@ There are no explicit conversions between numbers and strings. To force an expression to be treated as a number add 0 to it; to force it to be treated as a string concatenate \&\f(CW""\fP to it. -.br +.PP The scope rules for variables in functions are a botch; the syntax is worse. -.br +.PP Only eight-bit characters sets are handled correctly. +.SH UNUSUAL FLOATING-POINT VALUES +.I Awk +was designed before IEEE 754 arithmetic defined Not-A-Number (NaN) +and Infinity values, which are supported by all modern floating-point +hardware. +.PP +Because +.I awk +uses +.IR strtod (3) +and +.IR atof (3) +to convert string values to double-precision floating-point values, +modern C libraries also convert strings starting with +.B inf +and +.B nan +into infinity and NaN values respectively. This led to strange results, +with something like this: +.PP +.EX +.nf +echo nancy | awk '{ print $1 + 0 }' +.fi +.EE +.PP +printing +.B nan +instead of zero. +.PP +.I Awk +now follows GNU AWK, and prefilters string values before attempting +to convert them to numbers, as follows: +.TP +.I "Hexadecimal values" +Hexadecimal values (allowed since C99) convert to zero, as they did +prior to C99. +.TP +.I "NaN values" +The two strings +.B +nan +and +.B \-nan +(case independent) convert to NaN. No others do. +(NaNs can have signs.) +.TP +.I "Infinity values" +The two strings +.B +inf +and +.B \-inf +(case independent) convert to positive and negative infinity, respectively. +No others do. diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 31d070aecddc..230eac41548c 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -23,6 +23,13 @@ THIS SOFTWARE. ****************************************************************/ #include +#include +#include +#if __STDC_VERSION__ <= 199901L +#define noreturn +#else +#include +#endif typedef double Awkfloat; @@ -30,24 +37,34 @@ typedef double Awkfloat; typedef unsigned char uschar; -#define xfree(a) { if ((a) != NULL) { free((void *) (a)); (a) = NULL; } } +#define xfree(a) { if ((a) != NULL) { free((void *)(intptr_t)(a)); (a) = NULL; } } +/* + * We sometimes cheat writing read-only pointers to NUL-terminate them + * and then put back the original value + */ +#define setptr(ptr, a) (*(char *)(intptr_t)(ptr)) = (a) -#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf +#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for DPRINTF */ #define DEBUG #ifdef DEBUG - /* uses have to be doubly parenthesized */ -# define dprintf(x) if (dbg) printf x +# define DPRINTF(...) if (dbg) printf(__VA_ARGS__) #else -# define dprintf(x) +# define DPRINTF(...) #endif -extern int compile_time; /* 1 if compiling, 0 if running */ -extern int safe; /* 0 => unsafe, 1 => safe */ +extern enum compile_states { + RUNNING, + COMPILING, + ERROR_PRINTING +} compile_time; + +extern bool safe; /* false => unsafe, true => safe */ #define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */ extern int recsize; /* size of current record, orig RECSIZE */ +extern char EMPTY[]; /* this avoid -Wwritable-strings issues */ extern char **FS; extern char **RS; extern char **ORS; @@ -64,13 +81,11 @@ extern Awkfloat *RLENGTH; extern char *record; /* points to $0 */ extern int lineno; /* line number in awk program */ extern int errorflag; /* 1 if error has occurred */ -extern int donefld; /* 1 if record broken into fields */ -extern int donerec; /* 1 if record is valid (no fld has changed */ -extern char inputFS[]; /* FS at time of input, for field splitting */ - +extern bool donefld; /* true if record broken into fields */ +extern bool donerec; /* true if record is valid (no fld has changed */ extern int dbg; -extern char *patbeg; /* beginning of pattern matched */ +extern const char *patbeg; /* beginning of pattern matched */ extern int patlen; /* length of pattern matched. set in b.c */ /* Cell: all information about a variable or constant */ @@ -105,6 +120,7 @@ extern Cell *rsloc; /* RS */ extern Cell *rstartloc; /* RSTART */ extern Cell *rlengthloc; /* RLENGTH */ extern Cell *subseploc; /* SUBSEP */ +extern Cell *symtabloc; /* SYMTAB */ /* Cell.tval values: */ #define NUM 01 /* number value is valid */ @@ -134,12 +150,14 @@ extern Cell *subseploc; /* SUBSEP */ #define FTOUPPER 12 #define FTOLOWER 13 #define FFLUSH 14 -#define FAND 15 -#define FFOR 16 -#define FXOR 17 -#define FCOMPL 18 -#define FLSHIFT 19 -#define FRSHIFT 20 +#define FAND 15 +#define FFOR 16 +#define FXOR 17 +#define FCOMPL 18 +#define FLSHIFT 19 +#define FRSHIFT 20 +#define FSYSTIME 21 +#define FSTRFTIME 22 /* Node: parse tree is made of nodes, with Cell's at bottom */ @@ -167,7 +185,7 @@ extern Node *nullnode; #define CCOPY 6 #define CCON 5 #define CTEMP 4 -#define CNAME 3 +#define CNAME 3 #define CVAR 2 #define CFLD 1 #define CUNK 0 @@ -217,6 +235,7 @@ extern int pairstack[], paircnt; #define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */ /* watch out in match(), etc. */ +#define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 #define HAT (NCHARS+2) /* matches ^ in regular expr */ /* NCHARS is 2**n */ @@ -232,16 +251,16 @@ typedef struct rrow { } rrow; typedef struct fa { - uschar gototab[NSTATES][HAT + 1]; - uschar out[NSTATES]; + unsigned int **gototab; + uschar *out; uschar *restr; - int *posns[NSTATES]; - int anchor; + int **posns; + int state_count; + bool anchor; int use; int initstat; int curstat; int accept; - int reset; struct rrow re[1]; /* variable: actual size set by calling malloc */ } fa; diff --git a/contrib/one-true-awk/awkgram.y b/contrib/one-true-awk/awkgram.y index e4abeeddcb6a..f37073d1f9ac 100644 --- a/contrib/one-true-awk/awkgram.y +++ b/contrib/one-true-awk/awkgram.y @@ -32,8 +32,8 @@ int yywrap(void) { return(1); } Node *beginloc = 0; Node *endloc = 0; -int infunc = 0; /* = 1 if in arglist or body of func */ *** 4848 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 810E76579E1; Sat, 10 Jul 2021 17:12: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 4GMc6R1Z0Zz4V7J; Sat, 10 Jul 2021 17:12: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 1E09A3AD5; Sat, 10 Jul 2021 17:12: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 16AHClDS088195; Sat, 10 Jul 2021 17:12:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHClDo088194; Sat, 10 Jul 2021 17:12:47 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:47 GMT Message-Id: <202107101712.16AHClDo088194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 421eebb4f8a3 - stable/12 - Update awk(1) manual to state an exception to egrep(1)-like RE syntax MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 421eebb4f8a346e7f91a5fde31e67b4193f289ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:47 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=421eebb4f8a346e7f91a5fde31e67b4193f289ff commit 421eebb4f8a346e7f91a5fde31e67b4193f289ff Author: Devin Teske AuthorDate: 2018-11-02 23:03:40 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:14 +0000 Update awk(1) manual to state an exception to egrep(1)-like RE syntax Reviewed by: imp, jmg MFC after: 3 days Sponsored by: Smule, Inc. Differential Revision: https://reviews.freebsd.org/D17739 (cherry picked from commit e0ff4751f0a9757f0bfc776b5da5421f6294daf8) --- contrib/one-true-awk/awk.1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/one-true-awk/awk.1 b/contrib/one-true-awk/awk.1 index b0d243b495cc..b2c36558fc83 100644 --- a/contrib/one-true-awk/awk.1 +++ b/contrib/one-true-awk/awk.1 @@ -352,9 +352,13 @@ Patterns are arbitrary Boolean combinations of regular expressions and relational expressions. Regular expressions are as in -.IR egrep ; -see -.IR grep (1). +.IR egrep (1) +except numeric quantifiers are not supported beyond the basic +.B + +and +.B ? +for quantities \&\f(CW"0 or 1"\fP and \&\f(CW"1 or more"\fP +respectively. Isolated regular expressions in a pattern apply to the entire line. Regular expressions may also occur in From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6F991657E90; Sat, 10 Jul 2021 17:12:48 +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 4GMc6S2Ywkz4VH3; Sat, 10 Jul 2021 17:12:48 +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 3F2B24193; Sat, 10 Jul 2021 17:12: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 16AHCmVG088226; Sat, 10 Jul 2021 17:12:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCmDA088225; Sat, 10 Jul 2021 17:12:48 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:48 GMT Message-Id: <202107101712.16AHCmDA088225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 330070826672 - stable/12 - Merge from upstream at 4189ef5d from https://github.com/onetrueawk/awk.git MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 330070826672f3f63d17bc4e9ee1c81032d1669d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:48 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=330070826672f3f63d17bc4e9ee1c81032d1669d commit 330070826672f3f63d17bc4e9ee1c81032d1669d Author: Warner Losh AuthorDate: 2019-06-02 16:25:07 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:14 +0000 Merge from upstream at 4189ef5d from https://github.com/onetrueawk/awk.git Note: this backs out a number of changes we've made to awk because they aren't upstream, but are on the vendor branch. Those will be reapplied. svn makes it needlessly difficult to know which ones, but at least r315426, r301289, and maybe r301691, though there may be others too. None of these are critical, so bisecting through this point is safe for all but awk regression tests :). (cherry picked from commit b5253557294400621041b8ce1dfbf11e124c1575) --- contrib/one-true-awk/ChangeLog | 245 +++++++++++++++++ contrib/one-true-awk/FIXES | 109 ++++++++ contrib/one-true-awk/LICENSE | 23 ++ contrib/one-true-awk/REGRESS | 35 +++ contrib/one-true-awk/awk.1 | 160 ++++++----- contrib/one-true-awk/awk.h | 10 +- contrib/one-true-awk/awkgram.y | 4 +- contrib/one-true-awk/b.c | 291 +++++++++++++++++++-- contrib/one-true-awk/bugs-fixed/README | 57 ++++ contrib/one-true-awk/bugs-fixed/a-format.awk | 3 + contrib/one-true-awk/bugs-fixed/a-format.bad | 3 + contrib/one-true-awk/bugs-fixed/a-format.ok | 1 + .../one-true-awk/bugs-fixed/concat-assign-same.awk | 4 + .../one-true-awk/bugs-fixed/concat-assign-same.bad | 2 + .../one-true-awk/bugs-fixed/concat-assign-same.ok | 2 + contrib/one-true-awk/bugs-fixed/decr-NF.awk | 11 + contrib/one-true-awk/bugs-fixed/decr-NF.bad | 5 + contrib/one-true-awk/bugs-fixed/decr-NF.ok | 5 + contrib/one-true-awk/bugs-fixed/fmt-overflow.awk | 1 + contrib/one-true-awk/bugs-fixed/fmt-overflow.ok | 1 + contrib/one-true-awk/bugs-fixed/fs-overflow.awk | 13 + .../one-true-awk/bugs-fixed/getline-numeric.awk | 6 + .../one-true-awk/bugs-fixed/getline-numeric.bad | 3 + contrib/one-true-awk/bugs-fixed/getline-numeric.in | 1 + contrib/one-true-awk/bugs-fixed/getline-numeric.ok | 3 + .../one-true-awk/bugs-fixed/missing-precision.awk | 1 + .../one-true-awk/bugs-fixed/missing-precision.ok | 2 + contrib/one-true-awk/bugs-fixed/negative-nf.awk | 1 + contrib/one-true-awk/bugs-fixed/negative-nf.ok | 2 + contrib/one-true-awk/bugs-fixed/nf-self-assign.awk | 6 + contrib/one-true-awk/bugs-fixed/nf-self-assign.bad | 1 + contrib/one-true-awk/bugs-fixed/nf-self-assign.ok | 1 + contrib/one-true-awk/bugs-fixed/numeric-fs.awk | 5 + contrib/one-true-awk/bugs-fixed/numeric-fs.ok | 3 + .../bugs-fixed/numeric-output-seps.awk | 8 + .../bugs-fixed/numeric-output-seps.bad | 2 + .../one-true-awk/bugs-fixed/numeric-output-seps.ok | 1 + contrib/one-true-awk/bugs-fixed/numeric-rs.awk | 6 + contrib/one-true-awk/bugs-fixed/numeric-rs.bad | 1 + contrib/one-true-awk/bugs-fixed/numeric-rs.ok | 4 + contrib/one-true-awk/bugs-fixed/numeric-subsep.awk | 5 + contrib/one-true-awk/bugs-fixed/numeric-subsep.bad | 1 + contrib/one-true-awk/bugs-fixed/numeric-subsep.ok | 1 + contrib/one-true-awk/bugs-fixed/ofs-rebuild.awk | 17 ++ contrib/one-true-awk/bugs-fixed/ofs-rebuild.bad | 1 + contrib/one-true-awk/bugs-fixed/ofs-rebuild.ok | 1 + contrib/one-true-awk/bugs-fixed/space.awk | 22 ++ contrib/one-true-awk/bugs-fixed/space.bad | 16 ++ contrib/one-true-awk/bugs-fixed/space.ok | 16 ++ .../bugs-fixed/split-fs-from-array.awk | 5 + .../one-true-awk/bugs-fixed/split-fs-from-array.ok | 1 + contrib/one-true-awk/bugs-fixed/string-conv.awk | 13 + contrib/one-true-awk/bugs-fixed/string-conv.bad | 4 + contrib/one-true-awk/bugs-fixed/string-conv.ok | 4 + .../one-true-awk/bugs-fixed/subsep-overflow.awk | 24 ++ contrib/one-true-awk/bugs-fixed/subsep-overflow.ok | 5 + contrib/one-true-awk/bugs-fixed/system-status.awk | 19 ++ contrib/one-true-awk/bugs-fixed/system-status.bad | 3 + contrib/one-true-awk/bugs-fixed/system-status.ok | 3 + contrib/one-true-awk/bugs-fixed/unary-plus.awk | 4 + contrib/one-true-awk/bugs-fixed/unary-plus.bad | 2 + contrib/one-true-awk/bugs-fixed/unary-plus.ok | 2 + contrib/one-true-awk/lex.c | 32 ++- contrib/one-true-awk/lib.c | 36 ++- contrib/one-true-awk/main.c | 13 +- contrib/one-true-awk/makefile | 53 ++-- contrib/one-true-awk/maketab.c | 13 +- contrib/one-true-awk/parse.c | 2 +- contrib/one-true-awk/proctab.c | 209 +++++++++++++++ contrib/one-true-awk/proto.h | 3 + contrib/one-true-awk/run.c | 187 ++++++++----- contrib/one-true-awk/tran.c | 183 +++++++++++-- 72 files changed, 1723 insertions(+), 219 deletions(-) diff --git a/contrib/one-true-awk/ChangeLog b/contrib/one-true-awk/ChangeLog new file mode 100644 index 000000000000..fd03b2bbca0b --- /dev/null +++ b/contrib/one-true-awk/ChangeLog @@ -0,0 +1,245 @@ +2019-05-29 Arnold D. Robbins + + * lib.c (isclvar): Remove check for additional '=' after + first one. No longer needed. + +2019-01-26 Arnold D. Robbins + + * main.c (version): Updated. + +2019-01-25 Arnold D. Robbins + + * run.c (awkgetline): Check for numeric value in all getline + variants. See the numeric-getline.* files in bugs-fixed directory. + +2018-08-29 Arnold D. Robbins + + * REGRESS: Check for existence of a.out. If not there, run + make. Enable core dumps for T.arnold system status test + to work on MacOS X. + +2018-08-22 Arnold D. Robbins + + * awktest.tar (testdir/T.expr): Fix test for unary plus. + +2018-08-22 Arnold D. Robbins + + * REGRESS: Extract tests if necessary, set PATH to include '.'. + * regdir/beebe.tar (Makefile): Fix longwrds test to prefix + sort with LC_ALL=C. + * awktest.tar: Updated from fixed test suite, directory + it extracts is now called 'testdir' to match what's in top-level + REGRESS script. + * regdir: Removed, as Brian wants to keep the test suite in + the tar file. + +2018-08-22 Arnold D. Robbins + + * FIXES, lib.c, run.c, makefile, main.c: Merge from Brian's tree. + * REGRESS: New file, from Brian. + * awktest.tar: Restored from Brian's tree. + +2018-08-22 Arnold D. Robbins + + * awkgram.y (UPLUS): New token. In the grammar, call op1() + with it. + * maketab.c (proc): Add entry for UPLUS. + * run.c (arith): Handle UPLUS. + * main.c (version): Updated. + * bugs-fixed/unary-plus.awk, bugs-fixed/unary-plus.bad, + bugs-fixed/unary-plus.ok: New files. + +2018-08-10 Arnold D. Robbins + + * TODO: Updated. + * awk.1: Improve use of macros, add some additional explanation + in a few places, alphabetize list of variables. + +2018-08-08 Arnold D. Robbins + + * awk.h (Cell): Add new field `fmt' to track xFMT value used + for a string conversion. + [CONVC, CONVO]: New flag macros. + * bugs-fixed/README: Updated. + * bugs-fixed/string-conv.awk, bugs-fixed/string-conv.bad, + bugs-fixed/string-conv.ok: New files. + * main.c (version): Updated. + * proto.h (flags2str): Add declaration. + * tran.c (setfval): Clear CONVC and CONVO flags and set vp->fmt + to NULL. + (setsval): Ditto. Add large comment and new code to manage + correct conversion of number to string based on various flags + and the value of vp->fmt. The idea is to not convert again + if xFMT is the same as before and we're doing the same conversion. + Otherwise, clear the old flags, set the new, and reconvert. + (flags2str): New function. For debug prints and for use from a debugger. + +2018-08-05 Arnold D. Robbins + + Fix filename conflicts in regdir where the only difference was + in letter case. This caused problems on Windows systems. + + * regdir/Compare.T1: Renamed from regdir/Compare.T. + * regdir/t.delete0: Renamed from regdir/t.delete. + * regdir/t.getline1: Renamed from regdir/t.getline. + * regdir/t.redir1: Renamed from regdir/t.redir. + * regdir/t.split1: Renamed from regdir/t.split. + * regdir/t.sub0: Renamed from regdir/t.sub. + * regdir/REGRESS: Adjusted. + +2018-08-04 Arnold D. Robbins + + With scalpel, tweasers, magnifying glass and bated breath, + borrow code from the NetBSD version of nawk to fix the years-old + bug whereby decrementing the value of NF did not change the + record. + + * lib.c (fldbld): Set donerec to 1 when done. + (setlastfld): New function. + * proto.h (setlastfld): Add declaration. + * run.c (copycell): Make code smarter about flags (from NetBSD code). + * tran.c (setfree): New function. + * tran.c (setfval): Normalize negative zero to positive zero. + If setting NF, clear donerec and call setlastfld(). + (setsval): Remove call to save_old_OFS(). If setting OFS, call + recbld(). If setting NF, clear donerec and call setlastfld(). + + As part of the process, revert OFS-related changes of 2018-05-22: + + * awk.h (saveOFS, saveOFSlen, save_old_OFS): Remove declarations. + * lib.c (recbld): Use *OFS instead of saveOFS. + * run.c (saveOFS, saveOFSlen, save_old_OFS): Remove. + * tran.c (syminit): Remove initialization of saveOFS and saveOFSlen. + + General stuff that goes along with all this: + + * bugs-fixed/README: Updated. + * bugs-fixed/decr-NF.awk, bugs-fixed/decr-NF.bad, + bugs-fixed/decr-NF.ok: New files. + * main.c (version): Updated. + * regdir/README.TESTS: Fix awk book title. + * regdir/T.misc: Revise test to match fixed code. + * run.c (format): Increase size of buffer used for %a test. (Unrelated + to NF or OFS, but fixes a compiler complaint.) + +2018-06-07 Arnold D. Robbins + + * regdir/beebe.tar: Fix longwrds.ok so that the test will pass. + The file was incorrectly sorted. + +2018-06-06 Arnold D. Robbins + + * regdir/T.lilly: Fix the bug again in the second instance + of the code. Thanks to BWK for pointing this out. + +2018-05-31 Arnold D. Robbins + + * regdir/T.lilly: Fix a syntax error and ordering bug + in creating the 'foo' file. + +2018-05-23 Arnold D. Robbins + + * awk.1: Remove standalone 'awk' at the top of file, it messed up + the formatting. Arrange built-in variable list in alphabetical + order. + +2018-05-23 Arnold D. Robbins + + * main.c (version): Add my email address and a date so that + users can tell this isn't straight BWK awk. + * README.md: Minor updates. + * TODO: Updated. + +2018-05-22 Arnold D. Robbins + + Add POSIX-required formats %a and %A. + + * run.c (format): Check for %a support in C library. If there, + allow %a and %A as valid formats. + * TODO: Updated. + * bugs-fixed/README: Updated. + * bugs-fixed/a-format.awk, bugs-fixed/a-format.bad, + bugs-fixed/a-format.ok: New files. + +2018-05-22 Arnold D. Robbins + + * FIXES: Restored a line from a much earlier version that + apparently got lost when the dates were reordered. + * TODO: Updated. + +2018-05-22 Arnold D. Robbins + + * README.md: New file. + +2018-05-22 Arnold D. Robbins + + * regdir/echo.c, regdir/time.c: Minor fixes to compile without + warning on current GCC / Linux. + +2018-05-22 Arnold D. Robbins + + * TODO: New file. + +2018-05-22 Arnold D. Robbins + + * makefile (gitadd, gitpush): Remove these targets. They + should not be automated and were incorrect for things that + would be done regularly. + +2018-05-22 Arnold D. Robbins + + Fix nawk so that [[:blank:]] only matches space and tab instead + of any whitespace character, originally made May 10, 2018. + See bugs-fixed/space.awk. + + This appears to have been a thinko on Brian's part. + + * b.c (charclasses): Use xisblank() function for [[:blank:]]. + * bugs-fixed/README: Updated. + * bugs-fixed/space.awk, bugs-fixed/space.bad, + bugs-fixed/space.ok: New files. + +2018-05-22 Arnold D. Robbins + + * .gitignore: New file. + +2018-05-22 Arnold D. Robbins + + Fix nawk to provide reasonable exit status for system(), + a la gawk, originally made March 12, 2016. See + bugs-fixed/system-status.awk. + + * run.c (bltin): For FSYSTEM, use the macros defined for wait(2) + to produce a reasonable exit value, instead of doing a floating-point + division by 256. + * awk.1: Document the return status values. + * bugs-fixed/README: Updated. + * bugs-fixed/system-status.awk, bugs-fixed/system-status.bad, + bugs-fixed/system-status.ok: New files. + +2018-05-22 Arnold D. Robbins + + Bug fix with respect to rebuilding a record, originally + made August 19, 2014. See bugs-fixed/ofs-rebuild.awk. + + * awk.h (saveOFS, saveOFSlen): Declare new variables. + * lib.c (recbld): Use them when rebuilding the record. + * run.c (saveOFS, saveOFSlen): Define new variables. + (save_old_OFS): New function to save OFS aside. + * tran.c (syminit): Initialize saveOFS and saveOFSlen. + (setsval): If setting a field, call save_old_OFS(). + * bugs-fixed/README, bugs-fixed/ofs-rebuild.awk, + bugs-fixed/ofs-rebuild.bad, bugs-fixed/ofs-rebuild.ok: New files. + +2018-05-22 Arnold D. Robbins + + * makefile (YACC): Use bison. + +2018-05-22 Arnold D. Robbins + + * ChangeLog: Created. + * regdir: Created. Based on contents of awktest.a. + * .gitattributes: Created, to preserve CR LF in regdir/t.crlf. + * awktest.a: Removed. + * regdir/T.gawk, regdir/T.latin1: Updated from awktest.tar. + * awktest.tar: Removed. diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES index c78aabc511f3..183eaedee47d 100644 --- a/contrib/one-true-awk/FIXES +++ b/contrib/one-true-awk/FIXES @@ -25,6 +25,113 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +May 29,2019: + Fix check for command line arguments to no longer require that + first character after '=' not be another '='. Reverts change of + August 11, 1989. Thanks to GitHub user Jamie Landeg Jones for + pointing out the issue; from Issue #38. + +Apr 7, 2019: + Update awktest.tar(p.50) to use modern options to sort. Needed + for Android development. Thanks to GitHub user mohd-akram (Mohamed + Akram). From Comment #33. + +Mar 12, 2019: + Added very simplistic support for cross-compiling in the + makefile. We are NOT going to go in the direction of the + autotools, though. Thanks to GitHub user nee-san for + the basic change. (Merged from PR #34.) + +Mar 5, 2019: + Added support for POSIX-standard interval expressions (a.k.a. + bounds, a.k.a. repetition expressions) in regular expressions, + backported (via NetBSD) from Apple awk-24 (20070501). + Thanks to Martijn Dekker for the port. + (Merged from PR #30.) + +Mar 3, 2019: + Merge PRs as follows: + #12: Avoid undefined behaviour when using ctype(3) functions in + relex(). Thanks to GitHub user iamleot. + #31: Make getline handle numeric strings, and update FIXES. Thanks + to GitHub user arnoldrobbins + #32: maketab: support build systems with read-only source. Thanks + to GitHub user enh. + +Jan 25, 2019: + Make getline handle numeric strings properly in all cases. + (Thanks, Arnold.) + +Jan 21, 2019: + Merged a number of small fixes from GitHub pull requests. + Thanks to GitHub users Arnold Robbins (arnoldrobbins), + Cody Mello (melloc) and Christoph Junghans (junghans). + PR numbers: 13-21, 23, 24, 27. + +Oct 25, 2018: + Added test in maketab.c to prevent generating a proctab entry + for YYSTYPE_IS_DEFINED. It was harmless but some gcc settings + generated a warning message. Thanks to Nan Xiao for report. + +Aug 27, 2018: + Disallow '$' in printf formats; arguments evaluated in order + and printed in order. + + Added some casts to silence warnings on debugging printfs. + (Thanks, Arnold.) + +Aug 23, 2018: + A long list of fixes courtesy of Arnold Robbins, + to whom profound thanks. + + 1. ofs-rebuild: OFS value used to rebuild the record was incorrect. + Fixed August 19, 2014. Revised fix August 2018. + + 2. system-status: Instead of a floating-point division by 256, use + the wait(2) macros to create a reasonable exit status. + Fixed March 12, 2016. + + 3. space: Use provided xisblank() function instead of ispace() for + matching [[:blank:]]. + + 4. a-format: Add POSIX standard %a and %A to supported formats. Check + at runtime that this format is available. + + 5. decr-NF: Decrementing NF did not change $0. This is a decades-old + bug. There are interactions with the old and new value of OFS as well. + Most of the fix came from the NetBSD awk. + + 6. string-conv: String conversions of scalars were sticky. Once a + conversion to string happened, even with OFMT, that value was used until + a new numeric value was assigned, even if OFMT differed from CONVFMT, + and also if CONVFMT changed. + + 7. unary-plus: Unary plus on a string constant returned the string. + Instead, it should convert the value to numeric and give that value. + + Also added Arnold's tests for these to awktest.tar as T.arnold. + +Aug 15, 2018: + fixed mangled awktest.tar (thanks, Arnold), posted all + current (very minor) fixes to github / onetrueawk + +Jun 7, 2018: + (yes, a long layoff) + Updated some broken tests (beebe.tar, T.lilly) + [thanks to Arnold Robbins] + +Mar 26, 2015: + buffer overflow in error reporting; thanks to tobias ulmer + and john-mark gurney for spotting it and the fix. + +Feb 4, 2013: + cleaned up a handful of tests that didn't seem to actually + test for correct behavior: T.latin1, T.gawk. + +Jan 5, 2013: + added ,NULL initializer to static Cells in run.c; not really + needed but cleaner. Thanks to Michael Bombardieri. + Dec 20, 2012: fiddled makefile to get correct yacc and bison flags. pick yacc (linux) or bison (mac) as necessary. @@ -493,6 +600,8 @@ May 12, 1998: Mar 12, 1998: added -V to print version number and die. +[notify dave kerns, dkerns@dacsoup.ih.lucent.com] + Feb 11, 1998: subtle silent bug in lex.c: if the program ended with a number longer than 1 digit, part of the input would be pushed back and diff --git a/contrib/one-true-awk/LICENSE b/contrib/one-true-awk/LICENSE new file mode 100644 index 000000000000..07dfd7b73b11 --- /dev/null +++ b/contrib/one-true-awk/LICENSE @@ -0,0 +1,23 @@ +/**************************************************************** +Copyright (C) Lucent Technologies 1997 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name Lucent Technologies or any of +its entities not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. +****************************************************************/ diff --git a/contrib/one-true-awk/REGRESS b/contrib/one-true-awk/REGRESS new file mode 100755 index 000000000000..7d3ded69d536 --- /dev/null +++ b/contrib/one-true-awk/REGRESS @@ -0,0 +1,35 @@ +#! /bin/sh + +case `uname` in +CYGWIN) EXE=a.exe ;; +*) EXE=a.out ;; +esac + +if [ ! -f $EXE ] +then + make || exit 1 +fi + +if [ -d testdir ] +then + true # do nothing +elif [ -f awktest.tar ] +then + echo extracting testdir + tar -xpf awktest.tar +else + echo $0: No testdir directory and no awktest.tar to extract it from! >&2 + exit 1 +fi + +cd testdir +pwd +PATH=.:$PATH +export PATH +if (ulimit -c unlimited > /dev/null 2>&1) +then + # Workaround broken default on MacOS X + ulimit -c unlimited +fi + +REGRESS diff --git a/contrib/one-true-awk/awk.1 b/contrib/one-true-awk/awk.1 index b2c36558fc83..b8e00cb60449 100644 --- a/contrib/one-true-awk/awk.1 +++ b/contrib/one-true-awk/awk.1 @@ -7,7 +7,6 @@ .fi .ft 1 .. -awk .TH AWK 1 .CT 1 files prog_other .SH NAME @@ -36,7 +35,7 @@ awk \- pattern-directed scanning and processing language scans each input .I file for lines that match any of a set of patterns specified literally in -.IR prog +.I prog or in one or more files specified as .B \-f @@ -53,7 +52,7 @@ The file name .B \- means the standard input. Any -.IR file +.I file of the form .I var=value is treated as an assignment, not a filename, @@ -70,12 +69,12 @@ any number of options may be present. The .B \-F -.IR fs +.I fs option defines the input field separator to be the regular expression -.IR fs. +.IR fs . .PP An input line is normally made up of fields separated by white space, -or by regular expression +or by the regular expression .BR FS . The fields are denoted .BR $1 , @@ -87,7 +86,7 @@ If .BR FS is null, the input line is split into one field per character. .PP -A pattern-action statement has the form +A pattern-action statement has the form: .IP .IB pattern " { " action " } .PP @@ -101,7 +100,7 @@ An action is a sequence of statements. A statement can be one of the following: .PP .EX -.ta \w'\f(CWdelete array[expression]'u +.ta \w'\f(CWdelete array[expression]\fR'u .RS .nf .ft CW @@ -145,7 +144,7 @@ The operators are also available in expressions. Variables may be scalars, array elements (denoted -.IB x [ i ] ) +.IB x [ i ] \fR) or fields. Variables are initialized to the null string. Array subscripts may be any string, @@ -161,11 +160,11 @@ The .B print statement prints its arguments on the standard output (or on a file if -.BI > file +.BI > " file or -.BI >> file +.BI >> " file is present or on a pipe if -.BI | cmd +.BI | " cmd is present), separated by the current output field separator, and terminated by the output record separator. .I file @@ -176,9 +175,10 @@ identical string values in different statements denote the same open file. The .B printf -statement formats its expression list according to the format +statement formats its expression list according to the +.I format (see -.IR printf (3)) . +.IR printf (3)). The built-in function .BI close( expr ) closes the file or pipe @@ -189,13 +189,13 @@ flushes any buffered output for the file or pipe .IR expr . .PP The mathematical functions +.BR atan2 , +.BR cos , .BR exp , .BR log , -.BR sqrt , .BR sin , -.BR cos , and -.BR atan2 +.B sqrt are built in. Other built-in functions: .TF length @@ -203,7 +203,8 @@ Other built-in functions: .B length the length of its argument taken as a string, -or of +number of elements in an array for an array argument, +or length of .B $0 if no argument. .TP @@ -218,14 +219,18 @@ and returns the previous seed. .B int truncates to an integer value .TP -.BI substr( s , " m" , " n\fB) +\fBsubstr(\fIs\fB, \fIm\fR [\fB, \fIn\^\fR]\fB)\fR the .IR n -character substring of .I s that begins at position -.IR m +.I m counted from 1. +If no +.IR m , +use the rest of the string +.I .TP .BI index( s , " t" ) the position in @@ -246,14 +251,14 @@ and .B RLENGTH are set to the position and length of the matched string. .TP -.BI split( s , " a" , " fs\fB) +\fBsplit(\fIs\fB, \fIa \fR[\fB, \fIfs\^\fR]\fB)\fR splits the string .I s into array elements -.IB a [1] , -.IB a [2] , +.IB a [1] \fR, +.IB a [2] \fR, \&..., -.IB a [ n ] , +.IB a [ n ] \fR, and returns .IR n . The separation is done with the regular expression @@ -266,7 +271,7 @@ is not given. An empty string as field separator splits the string into one array element per character. .TP -.BI sub( r , " t" , " s\fB) +\fBsub(\fIr\fB, \fIt \fR[, \fIs\^\fR]\fB) substitutes .I t for the first occurrence of the regular expression @@ -279,7 +284,7 @@ is not given, .B $0 is used. .TP -.B gsub +\fBgsub(\fIr\fB, \fIt \fR[, \fIs\^\fR]\fB) same as .B sub except that all occurrences of the regular expression @@ -289,18 +294,28 @@ and .B gsub return the number of replacements. .TP -.BI sprintf( fmt , " expr" , " ...\fB ) +.BI sprintf( fmt , " expr" , " ...\fB) the string resulting from formatting .I expr ... according to the .IR printf (3) format -.I fmt +.IR fmt . .TP .BI system( cmd ) executes .I cmd -and returns its exit status +and returns its exit status. This will be \-1 upon error, +.IR cmd 's +exit status upon a normal exit, +256 + +.I sig +upon death-by-signal, where +.I sig +is the number of the murdering signal, +or 512 + +.I sig +if there was a core dump. .TP .BI tolower( str ) returns a copy of @@ -321,7 +336,7 @@ sets .B $0 to the next input record from the current input file; .B getline -.BI < file +.BI < " file sets .B $0 to the next record from @@ -363,7 +378,7 @@ Isolated regular expressions in a pattern apply to the entire line. Regular expressions may also occur in relational expressions, using the operators -.BR ~ +.B ~ and .BR !~ . .BI / re / @@ -387,8 +402,12 @@ A relational expression is one of the following: .br .BI ( expr , expr,... ") in " array-name .PP -where a relop is any of the six relational operators in C, -and a matchop is either +where a +.I relop +is any of the six relational operators in C, +and a +.I matchop +is either .B ~ (matches) or @@ -409,57 +428,68 @@ and after the last. and .B END do not combine with other patterns. +They may appear multiple times in a program and execute +in the order they are read by +.IR awk . .PP Variable names with special meanings: .TF FILENAME .TP +.B ARGC +argument count, assignable. +.TP +.B ARGV +argument array, assignable; +non-null members are taken as filenames. +.TP .B CONVFMT conversion format used when converting numbers (default -.BR "%.6g" ) +.BR "%.6g" ). +.TP +.B ENVIRON +array of environment variables; subscripts are names. +.TP +.B FILENAME +the name of the current input file. +.TP +.B FNR +ordinal number of the current record in the current file. .TP .B FS regular expression used to separate fields; also settable by option -.BI \-F fs. +.BI \-F fs\fR. .TP .BR NF -number of fields in the current record +number of fields in the current record. .TP .B NR -ordinal number of the current record -.TP -.B FNR -ordinal number of the current record in the current file -.TP -.B FILENAME -the name of the current input file +ordinal number of the current record. .TP -.B RS -input record separator (default newline) +.B OFMT +output format for numbers (default +.BR "%.6g" ). .TP .B OFS -output field separator (default blank) +output field separator (default space). .TP .B ORS -output record separator (default newline) +output record separator (default newline). .TP -.B OFMT -output format for numbers (default -.BR "%.6g" ) -.TP -.B SUBSEP -separates multiple subscripts (default 034) +.B RLENGTH +the length of a string matched by +.BR match . .TP -.B ARGC -argument count, assignable +.B RS +input record separator (default newline). .TP -.B ARGV -argument array, assignable; -non-null members are taken as filenames +.B RSTART +the start position of a string matched by +.BR match . .TP -.B ENVIRON -array of environment variables; subscripts are names. +.B SUBSEP +separates multiple subscripts (default 034). .PD .PP Functions may be defined (at the position of a pattern-action statement) thus: @@ -490,7 +520,7 @@ BEGIN { FS = ",[ \et]*|[ \et]+" } .EE .ns .IP -Same, with input fields separated by comma and/or blanks and tabs. +Same, with input fields separated by comma and/or spaces and tabs. .PP .EX .nf @@ -516,13 +546,13 @@ BEGIN { # Simulate echo(1) .fi .EE .SH SEE ALSO +.IR grep (1), .IR lex (1), .IR sed (1) .br A. V. Aho, B. W. Kernighan, P. J. Weinberger, -.I -The AWK Programming Language, -Addison-Wesley, 1988. ISBN 0-201-07981-X +.IR "The AWK Programming Language" , +Addison-Wesley, 1988. ISBN 0-201-07981-X. .SH BUGS There are no explicit conversions between numbers and strings. To force an expression to be treated as a number add 0 to it; @@ -531,3 +561,5 @@ to force it to be treated as a string concatenate .br The scope rules for variables in functions are a botch; the syntax is worse. +.br +Only eight-bit characters sets are handled correctly. diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 5564af7619a4..b16c2f36f828 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -81,7 +81,8 @@ typedef struct Cell { char *nval; /* name, for variables only */ char *sval; /* string value */ Awkfloat fval; /* value as number */ - int tval; /* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE */ + int tval; /* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE|CONVC|CONVO */ + char *fmt; /* CONVFMT/OFMT value used to convert from number */ struct Cell *cnext; /* ptr to next if chained */ } Cell; @@ -96,9 +97,14 @@ extern Array *symtab; extern Cell *nrloc; /* NR */ extern Cell *fnrloc; /* FNR */ +extern Cell *fsloc; /* FS */ extern Cell *nfloc; /* NF */ +extern Cell *ofsloc; /* OFS */ +extern Cell *orsloc; /* ORS */ +extern Cell *rsloc; /* RS */ extern Cell *rstartloc; /* RSTART */ extern Cell *rlengthloc; /* RLENGTH */ +extern Cell *subseploc; /* SUBSEP */ /* Cell.tval values: */ #define NUM 01 /* number value is valid */ @@ -109,6 +115,8 @@ extern Cell *rlengthloc; /* RLENGTH */ #define FCN 040 /* this is a function name */ #define FLD 0100 /* this is a field $1, $2, ... */ #define REC 0200 /* this is $0 */ +#define CONVC 0400 /* string was converted from number via CONVFMT */ +#define CONVO 01000 /* string was converted from number via OFMT */ /* function types */ diff --git a/contrib/one-true-awk/awkgram.y b/contrib/one-true-awk/awkgram.y index 5b5c461b3eed..e4abeeddcb6a 100644 --- a/contrib/one-true-awk/awkgram.y +++ b/contrib/one-true-awk/awkgram.y @@ -86,7 +86,7 @@ Node *arglist = 0; /* list of args for current function */ %left CAT %left '+' '-' %left '*' '/' '%' -%left NOT UMINUS +%left NOT UMINUS UPLUS %right POWER %right DECR INCR %left INDIRECT @@ -357,7 +357,7 @@ term: | term '%' term { $$ = op2(MOD, $1, $3); } | term POWER term { $$ = op2(POWER, $1, $3); } | '-' term %prec UMINUS { $$ = op1(UMINUS, $2); } - | '+' term %prec UMINUS { $$ = $2; } + | '+' term %prec UMINUS { $$ = op1(UPLUS, $2); } | NOT term %prec UMINUS { $$ = op1(NOT, notnull($2)); } | BLTIN '(' ')' { $$ = op2(BLTIN, itonp($1), rectonode()); } | BLTIN '(' patlist ')' { $$ = op2(BLTIN, itonp($1), $3); } diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index f9dae52a0a95..6bf473820488 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); *** 2657 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EC60B657C18; Sat, 10 Jul 2021 17:12: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 4GMc6T5ZPLz4VB9; Sat, 10 Jul 2021 17:12: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 61F1D42B2; Sat, 10 Jul 2021 17:12: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 16AHCndf088250; Sat, 10 Jul 2021 17:12:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCndw088249; Sat, 10 Jul 2021 17:12:49 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:49 GMT Message-Id: <202107101712.16AHCndw088249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 46ee8211774c - stable/12 - Reapply r301289 by pfg: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 46ee8211774cc59d40e62dec883a42d075baad8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:50 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=46ee8211774cc59d40e62dec883a42d075baad8b commit 46ee8211774cc59d40e62dec883a42d075baad8b Author: Warner Losh AuthorDate: 2019-06-02 16:28:20 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Reapply r301289 by pfg: | MFV r300961: one-true-awk: replace 0 with NULL for pointers | Also remove a redundant semicolon. | Also had to rebase on upstream pull. (cherry picked from commit 10ce5b990fc0c874071c21e47d02194337732f27) --- contrib/one-true-awk/b.c | 20 ++++++++--------- contrib/one-true-awk/lex.c | 14 ++++++------ contrib/one-true-awk/maketab.c | 2 +- contrib/one-true-awk/parse.c | 2 +- contrib/one-true-awk/run.c | 49 ++++++++++++++++++++++-------------------- contrib/one-true-awk/tran.c | 2 +- 6 files changed, 46 insertions(+), 43 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 6bf473820488..24baa33d8db1 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -91,11 +91,11 @@ fa *makedfa(const char *s, int anchor) /* returns dfa for reg expr s */ fa *pfa; static int now = 1; - if (setvec == 0) { /* first time through any RE */ + if (setvec == NULL) { /* first time through any RE */ maxsetvec = MAXLIN; setvec = (int *) malloc(maxsetvec * sizeof(int)); tmpset = (int *) malloc(maxsetvec * sizeof(int)); - if (setvec == 0 || tmpset == 0) + if (setvec == NULL || tmpset == NULL) overflo("out of space initializing makedfa"); } @@ -317,11 +317,11 @@ char *cclenter(const char *argp) /* add a character class */ int j; uschar *p = (uschar *) argp; uschar *op, *bp; - static uschar *buf = 0; + static uschar *buf = NULL; static int bufsz = 100; op = p; - if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL) FATAL("out of space for character class [%.10s...] 1", p); bp = buf; for (i = 0; (c = *p++) != 0; ) { @@ -380,7 +380,7 @@ void cfoll(fa *f, Node *v) /* enter follow set of each leaf of vertex v into lfo maxsetvec *= 4; setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == 0 || tmpset == 0) + if (setvec == NULL || tmpset == NULL) overflo("out of space in cfoll()"); } for (i = 0; i <= f->accept; i++) @@ -421,7 +421,7 @@ int first(Node *p) /* collects initially active leaves of p into setvec */ maxsetvec *= 4; setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == 0 || tmpset == 0) + if (setvec == NULL || tmpset == NULL) overflo("out of space in first()"); } if (type(p) == EMPTYRE) { @@ -923,7 +923,7 @@ int relex(void) /* lexical analyzer for reparse */ { int c, n; int cflag; - static uschar *buf = 0; + static uschar *buf = NULL; static int bufsz = 100; uschar *bp; struct charclass *cc; @@ -953,7 +953,7 @@ rescan: rlxval = c; return CHAR; case '[': - if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL) FATAL("out of space in reg expr %.10s..", lastre); bp = buf; if (*prestr == '^') { @@ -1129,7 +1129,7 @@ int cgoto(fa *f, int s, int c) maxsetvec *= 4; setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == 0 || tmpset == 0) + if (setvec == NULL || tmpset == NULL) overflo("out of space in cgoto()"); } for (i = 0; i <= f->accept; i++) @@ -1151,7 +1151,7 @@ int cgoto(fa *f, int s, int c) maxsetvec *= 4; setvec = (int *) realloc(setvec, maxsetvec * sizeof(int)); tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int)); - if (setvec == 0 || tmpset == 0) + if (setvec == NULL || tmpset == NULL) overflo("cgoto overflow"); } if (setvec[q[j]] == 0) { diff --git a/contrib/one-true-awk/lex.c b/contrib/one-true-awk/lex.c index 18927f842b23..8e689f1a682a 100644 --- a/contrib/one-true-awk/lex.c +++ b/contrib/one-true-awk/lex.c @@ -176,10 +176,10 @@ int reg = 0; /* 1 => return a REGEXPR now */ int yylex(void) { int c; - static char *buf = 0; + static char *buf = NULL; static int bufsize = 5; /* BUG: setting this small causes core dump! */ - if (buf == 0 && (buf = (char *) malloc(bufsize)) == NULL) + if (buf == NULL && (buf = (char *) malloc(bufsize)) == NULL) FATAL( "out of space in yylex" ); if (sc) { sc = 0; @@ -366,10 +366,10 @@ int string(void) { int c, n; char *s, *bp; - static char *buf = 0; + static char *buf = NULL; static int bufsz = 500; - if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for strings"); for (bp = buf; (c = input()) != '"'; ) { if (!adjbuf(&buf, &bufsz, bp-buf+2, 500, &bp, "string")) @@ -513,11 +513,11 @@ void startreg(void) /* next call to yylex will return a regular expression */ int regexpr(void) { int c; - static char *buf = 0; + static char *buf = NULL; static int bufsz = 500; char *bp; - if (buf == 0 && (buf = (char *) malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for rex expr"); bp = buf; for ( ; (c = input()) != '/' && c != 0; ) { @@ -549,7 +549,7 @@ char ebuf[300]; char *ep = ebuf; char yysbuf[100]; /* pushback buffer */ char *yysptr = yysbuf; -FILE *yyin = 0; +FILE *yyin = NULL; int input(void) /* get next lexical input character */ { diff --git a/contrib/one-true-awk/maketab.c b/contrib/one-true-awk/maketab.c index dbe3d241fcc8..9faed8414f10 100644 --- a/contrib/one-true-awk/maketab.c +++ b/contrib/one-true-awk/maketab.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) table[p->token-FIRSTTOKEN] = p->name; printf("\nCell *(*proctab[%d])(Node **, int) = {\n", SIZE); for (i=0; innext, n++) + for (n = 0; p != NULL; p = p->nnext, n++) if (strcmp(((Cell *)(p->narg[0]))->nval, s) == 0) return n; return -1; diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index c3a3e5f4751a..d74b54ca3445 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -517,7 +517,7 @@ Cell *awkdelete(Node **a, int n) /* a[0] is symtab, a[1] is list of subscripts * x = execute(a[0]); /* Cell* for symbol table */ if (!isarr(x)) return True; - if (a[1] == 0) { /* delete the elements, not the table */ + if (a[1] == NULL) { /* delete the elements, not the table */ freesymtab(x); x->tval &= ~STR; x->tval |= ARR; @@ -603,7 +603,7 @@ Cell *matchop(Node **a, int n) /* ~ and match() */ } x = execute(a[1]); /* a[1] = target text */ s = getsval(x); - if (a[0] == 0) /* a[1] == 0: already-compiled reg expr */ + if (a[0] == NULL) /* a[1] == 0: already-compiled reg expr */ i = (*mf)((fa *) a[2], s); else { y = execute(a[2]); /* a[2] = regular expr */ @@ -719,7 +719,7 @@ Cell *gettemp(void) /* get a tempcell */ FATAL("out of space for temporaries"); for(i = 1; i < 100; i++) tmps[i-1].cnext = &tmps[i]; - tmps[i-1].cnext = 0; + tmps[i-1].cnext = NULL; } x = tmps; tmps = x->cnext; @@ -754,18 +754,18 @@ Cell *substr(Node **a, int nnn) /* substr(a[0], a[1], a[2]) */ int k, m, n; char *s; int temp; - Cell *x, *y, *z = 0; + Cell *x, *y, *z = NULL; x = execute(a[0]); y = execute(a[1]); - if (a[2] != 0) + if (a[2] != NULL) z = execute(a[2]); s = getsval(x); k = strlen(s) + 1; if (k <= 1) { tempfree(x); tempfree(y); - if (a[2] != 0) { + if (a[2] != NULL) { tempfree(z); } x = gettemp(); @@ -778,7 +778,7 @@ Cell *substr(Node **a, int nnn) /* substr(a[0], a[1], a[2]) */ else if (m > k) m = k; tempfree(y); - if (a[2] != 0) { + if (a[2] != NULL) { n = (int) getfval(z); tempfree(z); } else @@ -1219,7 +1219,7 @@ Cell *pastat(Node **a, int n) /* a[0] { a[1] } */ { Cell *x; - if (a[0] == 0) + if (a[0] == NULL) x = execute(a[1]); else { x = execute(a[0]); @@ -1256,9 +1256,9 @@ Cell *dopa2(Node **a, int n) /* a[0], a[1] { a[2] } */ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ { - Cell *x = 0, *y, *ap; + Cell *x = NULL, *y, *ap; char *s, *origs; - char *fs, *origfs = NULL; + char *fs = NULL, *origfs = NULL; int sep; char *t, temp, num[50]; int n, tempstat, arg3type; @@ -1266,8 +1266,8 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ y = execute(a[0]); /* source string */ origs = s = strdup(getsval(y)); arg3type = ptoi(a[3]); - if (a[2] == 0) /* fs string */ - fs = getsval(fsloc); + if (a[2] == NULL) /* fs string */ + fs = *FS; else if (arg3type == STRING) { /* split(str,arr,"string") */ x = execute(a[2]); origfs = fs = strdup(getsval(x)); @@ -1387,6 +1387,9 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ tempfree(y); free(origs); free(origfs); + if (a[2] != NULL && arg3type == STRING) { + tempfree(x); + } x = gettemp(); x->tval = NUM; x->fval = n; @@ -1416,7 +1419,7 @@ Cell *ifstat(Node **a, int n) /* if (a[0]) a[1]; else a[2] */ if (istrue(x)) { tempfree(x); x = execute(a[1]); - } else if (a[2] != 0) { + } else if (a[2] != NULL) { tempfree(x); x = execute(a[2]); } @@ -1468,7 +1471,7 @@ Cell *forstat(Node **a, int n) /* for (a[0]; a[1]; a[2]) a[3] */ x = execute(a[0]); tempfree(x); for (;;) { - if (a[1]!=0) { + if (a[1]!=NULL) { x = execute(a[1]); if (!istrue(x)) return(x); else tempfree(x); @@ -1551,7 +1554,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis case FCOS: u = cos(getfval(x)); break; case FATAN: - if (nextarg == 0) { + if (nextarg == NULL) { WARNING("atan2 requires two arguments; returning 1.0"); u = 1.0; } else { @@ -1697,7 +1700,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis tempfree(x); x = gettemp(); setfval(x, u); - if (nextarg != 0) { + if (nextarg != NULL) { WARNING("warning: function has too many arguments"); for ( ; nextarg; nextarg = nextarg->nnext) execute(nextarg); @@ -1711,7 +1714,7 @@ Cell *printstat(Node **a, int n) /* print a[0] */ Cell *y; FILE *fp; - if (a[1] == 0) /* a[1] is redirection operator, a[2] is file */ + if (a[1] == NULL) /* a[1] is redirection operator, a[2] is file */ fp = stdout; else fp = redirect(ptoi(a[1]), a[2]); @@ -1724,7 +1727,7 @@ Cell *printstat(Node **a, int n) /* print a[0] */ else fputs(getsval(ofsloc), fp); } - if (a[1] != 0) + if (a[1] != NULL) fflush(fp); if (ferror(fp)) FATAL("write error on %s", filename(fp)); @@ -1781,7 +1784,7 @@ FILE *openfile(int a, const char *us) { const char *s = us; int i, m; - FILE *fp = 0; + FILE *fp = NULL; if (*s == '\0') FATAL("null file name in print or getline"); @@ -1796,7 +1799,7 @@ FILE *openfile(int a, const char *us) return NULL; for (i=0; i < nfiles; i++) - if (files[i].fp == 0) + if (files[i].fp == NULL) break; if (i >= nfiles) { struct files *nf; @@ -1912,7 +1915,7 @@ Cell *sub(Node **a, int nnn) /* substitute command */ FATAL("out of memory in sub"); x = execute(a[3]); /* target string */ t = getsval(x); - if (a[0] == 0) /* 0 => a[1] is already-compiled regexpr */ + if (a[0] == NULL) /* 0 => a[1] is already-compiled regexpr */ pfa = (fa *) a[1]; /* regular expression */ else { y = execute(a[1]); @@ -1952,7 +1955,7 @@ Cell *sub(Node **a, int nnn) /* substitute command */ if (pb > buf + bufsz) FATAL("sub result2 %.30s too big; can't happen", buf); setsval(x, buf); /* BUG: should be able to avoid copy */ - result = True;; + result = True; } tempfree(x); tempfree(y); @@ -1975,7 +1978,7 @@ Cell *gsub(Node **a, int nnn) /* global substitute */ num = 0; x = execute(a[3]); /* target string */ t = getsval(x); - if (a[0] == 0) /* 0 => a[1] is already-compiled regexpr */ + if (a[0] == NULL) /* 0 => a[1] is already-compiled regexpr */ pfa = (fa *) a[1]; /* regular expression */ else { y = execute(a[1]); diff --git a/contrib/one-true-awk/tran.c b/contrib/one-true-awk/tran.c index d1dfe2b2f176..8577a0b11d31 100644 --- a/contrib/one-true-awk/tran.c +++ b/contrib/one-true-awk/tran.c @@ -194,7 +194,7 @@ void freesymtab(Cell *ap) /* free a symbol table */ free(cp); tp->nelem--; } - tp->tab[i] = 0; + tp->tab[i] = NULL; } if (tp->nelem != 0) WARNING("can't happen: inconsistent element count freeing %s", ap->nval); From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C341E657C19; Sat, 10 Jul 2021 17:12: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 4GMc6V4bJ9z4VHH; Sat, 10 Jul 2021 17:12: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 75A7F4111; Sat, 10 Jul 2021 17:12: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 16AHCo0k088274; Sat, 10 Jul 2021 17:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCotn088273; Sat, 10 Jul 2021 17:12:50 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:50 GMT Message-Id: <202107101712.16AHCotn088273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 83f5846fc818 - stable/12 - Reapply r315426 by pfg: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 83f5846fc8180e17baff66480473846978a3f030 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:50 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=83f5846fc8180e17baff66480473846978a3f030 commit 83f5846fc8180e17baff66480473846978a3f030 Author: Warner Losh AuthorDate: 2019-06-02 16:30:53 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Reapply r315426 by pfg: | MFV r315425: one-true-awk: have calloc(3) do the multiplication. (cherry picked from commit 06d1e65393f95e0fd2d068fe118487f754e4248b) --- contrib/one-true-awk/b.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 24baa33d8db1..4de746fa087f 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -148,7 +148,7 @@ fa *mkdfa(const char *s, int anchor) /* does the real work of making a dfa */ f->accept = poscnt-1; /* penter has computed number of positions in re */ cfoll(f, p1); /* set up follow sets */ freetr(p1); - if ((f->posns[0] = (int *) calloc(1, *(f->re[0].lfollow)*sizeof(int))) == NULL) + if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL) overflo("out of space in makedfa"); if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL) overflo("out of space in makedfa"); @@ -172,7 +172,7 @@ int makeinit(fa *f, int anchor) f->reset = 0; k = *(f->re[0].lfollow); xfree(f->posns[2]); - if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL) + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) overflo("out of space in makeinit"); for (i=0; i <= k; i++) { (f->posns[2])[i] = (f->re[0].lfollow)[i]; @@ -387,7 +387,7 @@ void cfoll(fa *f, Node *v) /* enter follow set of each leaf of vertex v into lfo setvec[i] = 0; setcnt = 0; follow(v); /* computes setvec and setcnt */ - if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL) + if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL) overflo("out of space building follow set"); f->re[info(v)].lfollow = p; *p = setcnt; @@ -561,7 +561,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */ for (i = 2; i <= f->curstat; i++) xfree(f->posns[i]); k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL) + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) overflo("out of space in pmatch"); for (i = 0; i <= k; i++) (f->posns[2])[i] = (f->posns[0])[i]; @@ -618,7 +618,7 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ for (i = 2; i <= f->curstat; i++) xfree(f->posns[i]); k = *f->posns[0]; - if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL) + if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL) overflo("out of state space"); for (i = 0; i <= k; i++) (f->posns[2])[i] = (f->posns[0])[i]; @@ -1194,7 +1194,7 @@ int cgoto(fa *f, int s, int c) for (i = 0; i < NCHARS; i++) f->gototab[f->curstat][i] = 0; xfree(f->posns[f->curstat]); - if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL) + if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL) overflo("out of space in cgoto"); f->posns[f->curstat] = p; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 235FD657F89; Sat, 10 Jul 2021 17:12: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 4GMc6W6Rh2z4V7V; Sat, 10 Jul 2021 17:12: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 981A44194; Sat, 10 Jul 2021 17:12: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 16AHCpZE088298; Sat, 10 Jul 2021 17:12:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCpFk088297; Sat, 10 Jul 2021 17:12:51 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:51 GMT Message-Id: <202107101712.16AHCpFk088297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: cf150bbe650d - stable/12 - Reapply r301691: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cf150bbe650db237f94de7331a25e486c0c497c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:52 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cf150bbe650db237f94de7331a25e486c0c497c5 commit cf150bbe650db237f94de7331a25e486c0c497c5 Author: Warner Losh AuthorDate: 2019-06-02 20:47:15 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Reapply r301691: Revert r301689 - one-true-awk: Avoid a NULL dereference. I got this wrong and the coverity report doesn't match the NetBSD change, which was thought for a different version. The change wouldn't hurt but let's wait until upstream figures this out. (cherry picked from commit 2675e1b91dcfa744a414a42f5522f4fed958476c) --- contrib/one-true-awk/tran.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/one-true-awk/tran.c b/contrib/one-true-awk/tran.c index 8577a0b11d31..837f3742bc4f 100644 --- a/contrib/one-true-awk/tran.c +++ b/contrib/one-true-awk/tran.c @@ -366,7 +366,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ if (donerec == 0) recbld(); } - t = s ? tostring(s) : tostring(""); /* in case it's self-assign */ + t = tostring(s); /* in case it's self-assign */ if (freeable(vp)) xfree(vp->sval); vp->tval &= ~(NUM|CONVC|CONVO); From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 78143657BCE; Sat, 10 Jul 2021 17:12: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 4GMc6Y2LZSz4VBJ; Sat, 10 Jul 2021 17:12: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 BAEB442B3; Sat, 10 Jul 2021 17:12: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 16AHCqTK088322; Sat, 10 Jul 2021 17:12:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCqd7088321; Sat, 10 Jul 2021 17:12:52 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:52 GMT Message-Id: <202107101712.16AHCqd7088321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 086165376b02 - stable/12 - Revert r348518 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 086165376b029983658816a16a44e5ec0b4f0363 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:53 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=086165376b029983658816a16a44e5ec0b4f0363 commit 086165376b029983658816a16a44e5ec0b4f0363 Author: Warner Losh AuthorDate: 2019-06-02 20:52:21 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Revert r348518 It should not have happened. The change is actually in upstream and I misread the diffs. (cherry picked from commit adb46ac4c0a64c2cd1fbf46022f4aafb4e605cd3) --- contrib/one-true-awk/tran.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/one-true-awk/tran.c b/contrib/one-true-awk/tran.c index 837f3742bc4f..8577a0b11d31 100644 --- a/contrib/one-true-awk/tran.c +++ b/contrib/one-true-awk/tran.c @@ -366,7 +366,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ if (donerec == 0) recbld(); } - t = tostring(s); /* in case it's self-assign */ + t = s ? tostring(s) : tostring(""); /* in case it's self-assign */ if (freeable(vp)) xfree(vp->sval); vp->tval &= ~(NUM|CONVC|CONVO); From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B5EE5657CA4; Sat, 10 Jul 2021 17:12: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 4GMc6Z38nkz4VSP; Sat, 10 Jul 2021 17:12: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 DD5FD3AD6; Sat, 10 Jul 2021 17:12: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 16AHCreb088352; Sat, 10 Jul 2021 17:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCrZo088351; Sat, 10 Jul 2021 17:12:53 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:53 GMT Message-Id: <202107101712.16AHCrZo088351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0ca88d564187 - stable/12 - Fix mismerge that crept into r301289. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0ca88d56418731b16dd81d096bdbf3b88de90b68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:54 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0ca88d56418731b16dd81d096bdbf3b88de90b68 commit 0ca88d56418731b16dd81d096bdbf3b88de90b68 Author: Warner Losh AuthorDate: 2019-06-03 05:25:16 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Fix mismerge that crept into r301289. The conversion of 0 -> NULL required a rebase at some point, as noted in r301289 when pfg commited it. In that rebase, three lines remained that had been removed in a prior version of awk, and one of them had a 0 -> NULL change causing a conflict. The conflict should have been resolved by removing the three lines, but wasn't. This introduces a regression into f.split3 test which prior to this commit we were failing, but a pure onetrueawk wasn't. Remove the offending 3 lines. (cherry picked from commit 31d232c2a3c18fb05e5b2f1ec42872708cbfd27e) --- contrib/one-true-awk/run.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index d74b54ca3445..1859263f7f4b 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -1387,9 +1387,6 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ tempfree(y); free(origs); free(origfs); - if (a[2] != NULL && arg3type == STRING) { - tempfree(x); - } x = gettemp(); x->tval = NUM; x->fval = n; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C33DC657C2E; Sat, 10 Jul 2021 17:12: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 4GMc6b3tGgz4V7f; Sat, 10 Jul 2021 17:12: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 1BD5543CD; Sat, 10 Jul 2021 17:12: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 16AHCsoh088376; Sat, 10 Jul 2021 17:12:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCsAE088375; Sat, 10 Jul 2021 17:12:54 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:54 GMT Message-Id: <202107101712.16AHCsAE088375@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: ffc35739bac4 - stable/12 - Another partial revert of r301289. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ffc35739bac49abe823182f61e36162d25e06fe4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:55 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ffc35739bac49abe823182f61e36162d25e06fe4 commit ffc35739bac49abe823182f61e36162d25e06fe4 Author: Warner Losh AuthorDate: 2019-06-03 05:25:22 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Another partial revert of r301289. In this case, a change was made in one-true-awk from *FS to getsval(fsloc) in a line just after one of the lines that had the 0 -> NULL change. It works both ways as far as I can tell. It looks like a bug fix, but I've not tried to track down which ancient version of one-true-awk it was in (github starts too late for tracking this down). Before and after the changes the regression suite is passes 100% relative to the un-modified one-true-awk. (cherry picked from commit d9e8cf281b12ca943d150b29ae5a847b0df888f3) --- contrib/one-true-awk/run.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 1859263f7f4b..baea06ed2500 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -1267,7 +1267,7 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ origs = s = strdup(getsval(y)); arg3type = ptoi(a[3]); if (a[2] == NULL) /* fs string */ - fs = *FS; + fs = getsval(fsloc); else if (arg3type == STRING) { /* split(str,arr,"string") */ x = execute(a[2]); origfs = fs = strdup(getsval(x)); From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 16087657E99; Sat, 10 Jul 2021 17:12: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 4GMc6c5JFVz4VSV; Sat, 10 Jul 2021 17:12: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 281D54112; Sat, 10 Jul 2021 17:12: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 16AHCuT4088400; Sat, 10 Jul 2021 17:12:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCuXP088399; Sat, 10 Jul 2021 17:12:56 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:56 GMT Message-Id: <202107101712.16AHCuXP088399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: e32d04bed890 - stable/12 - awk: Fix subobject out-of-bounds access MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e32d04bed89057c54147db931fa544bb601f48ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:57 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e32d04bed89057c54147db931fa544bb601f48ac commit e32d04bed89057c54147db931fa544bb601f48ac Author: Alex Richardson AuthorDate: 2020-09-21 19:03:07 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 awk: Fix subobject out-of-bounds access When matching a regex with ^, it would attempt to access gototab[NSTATES][NCHARS+2], and therefore access the state for the \002 character instead. This change is required to run awk under CHERI (with sub-object bounds) and when running with UBSan instrumentation. This was committed upstream as https://github.com/onetrueawk/awk/commit/cbf924342b63a095a4c6842280c3085b1b63ae45 Found by: CHERI (with subobject bounds enabled) Obtained from: CheriBSD Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D26509 (cherry picked from commit ae692c42cb46a5e72772070070840b15dd5d6bd8) --- contrib/one-true-awk/awk.h | 4 +++- contrib/one-true-awk/b.c | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index b16c2f36f828..31d070aecddc 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -218,6 +218,8 @@ extern int pairstack[], paircnt; #define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */ /* watch out in match(), etc. */ #define NSTATES 32 +#define HAT (NCHARS+2) /* matches ^ in regular expr */ + /* NCHARS is 2**n */ typedef struct rrow { long ltype; /* long avoids pointer warnings on 64-bit */ @@ -230,7 +232,7 @@ typedef struct rrow { } rrow; typedef struct fa { - uschar gototab[NSTATES][NCHARS]; + uschar gototab[NSTATES][HAT + 1]; uschar out[NSTATES]; uschar *restr; int *posns[NSTATES]; diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index 4de746fa087f..0cdcf30a972e 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -37,8 +37,6 @@ __FBSDID("$FreeBSD$"); #include "awk.h" #include "ytab.h" -#define HAT (NCHARS+2) /* matches ^ in regular expr */ - /* NCHARS is 2**n */ #define MAXLIN 22 #define type(v) (v)->nobj /* badly overloaded here */ From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65C8E657E67; Sat, 10 Jul 2021 17:12:58 +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 4GMc6d41dJz4VHk; Sat, 10 Jul 2021 17:12:57 +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 4F3333AD7; Sat, 10 Jul 2021 17:12: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 16AHCv1P088424; Sat, 10 Jul 2021 17:12:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCv3B088423; Sat, 10 Jul 2021 17:12:57 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:57 GMT Message-Id: <202107101712.16AHCv3B088423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a711add6ceff - stable/12 - Fix another UBSan error in awk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a711add6ceffc58dabb930a0fdd685ddbac7b83c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:59 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a711add6ceffc58dabb930a0fdd685ddbac7b83c commit a711add6ceffc58dabb930a0fdd685ddbac7b83c Author: Alex Richardson AuthorDate: 2020-09-21 19:03:12 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 Fix another UBSan error in awk This applies my upstreamed fix: https://github.com/onetrueawk/awk/commit/ad9bd2f40a89ec9533b92254b86a756cf4f40fd4 Found By: UBSan (cherry picked from commit 1116946093d537569a29692a6a86de59cd49384e) --- contrib/one-true-awk/lex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/one-true-awk/lex.c b/contrib/one-true-awk/lex.c index 8e689f1a682a..e537df4151da 100644 --- a/contrib/one-true-awk/lex.c +++ b/contrib/one-true-awk/lex.c @@ -467,9 +467,8 @@ int word(char *w) int c, n; n = binsearch(w, keywords, sizeof(keywords)/sizeof(keywords[0])); -/* BUG: this ought to be inside the if; in theory could fault (daniel barrett) */ - kp = keywords + n; if (n != -1) { /* found in table */ + kp = keywords + n; yylval.i = kp->sub; switch (kp->type) { /* special handling */ case BLTIN: From owner-dev-commits-src-all@freebsd.org Sat Jul 10 17:12:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E56DA657A69; Sat, 10 Jul 2021 17:12:58 +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 4GMc6f4pl3z4VHr; Sat, 10 Jul 2021 17:12:58 +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 81A974195; Sat, 10 Jul 2021 17:12: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 16AHCwkR088448; Sat, 10 Jul 2021 17:12:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AHCwoE088447; Sat, 10 Jul 2021 17:12:58 GMT (envelope-from git) Date: Sat, 10 Jul 2021 17:12:58 GMT Message-Id: <202107101712.16AHCwoE088447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 6edf5082bab7 - stable/12 - one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6edf5082bab71cf923efff9f18e38efe5b83b0ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 17:12:59 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6edf5082bab71cf923efff9f18e38efe5b83b0ec commit 6edf5082bab71cf923efff9f18e38efe5b83b0ec Author: Warner Losh AuthorDate: 2021-07-07 23:30:35 +0000 Commit: Warner Losh CommitDate: 2021-07-10 17:11:15 +0000 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs Import the latest bsd-features branch of the one-true-awk upstream: o Move to bison for $YACC o Set close-on-exec flag for file and pipe redirects that aren't std* o lots of little fixes to modernize ocde base o free sval member before setting it o fix a bug where a{0,3} could match aaaa o pull in systime and strftime from NetBSD awk o pull in fixes from {Net,Free,Open}BSD (normalized our code with them) o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop) Also revert a few of the trivial FreeBSD changes that were done slightly differently in the upstreaming process. Also, our PR database may have been mined by upstream for these fixes, and Mikolaj Golub may deserve credit for some of the fixes in this update. Suggested by: Mikolaj Golub PR: 143363,143365,143368,143369,143373,143375,214782 Sponsored by: Netflix (cherry picked from commit f39dd6a9784467f0db5886012b3f4b13899be6b8) --- contrib/one-true-awk/ChangeLog | 108 +++ contrib/one-true-awk/FIXES | 261 +++++- contrib/one-true-awk/REGRESS | 4 + contrib/one-true-awk/awk.1 | 159 +++- contrib/one-true-awk/awk.h | 67 +- contrib/one-true-awk/awkgram.y | 48 +- contrib/one-true-awk/b.c | 438 +++++++--- .../one-true-awk/bugs-fixed/missing-precision.ok | 2 +- contrib/one-true-awk/bugs-fixed/negative-nf.ok | 2 +- contrib/one-true-awk/lex.c | 77 +- contrib/one-true-awk/lib.c | 327 +++++--- contrib/one-true-awk/main.c | 163 ++-- contrib/one-true-awk/makefile | 74 +- contrib/one-true-awk/maketab.c | 66 +- contrib/one-true-awk/parse.c | 29 +- contrib/one-true-awk/proctab.c | 202 ++--- contrib/one-true-awk/proto.h | 41 +- contrib/one-true-awk/run.c | 918 ++++++++++++++------- contrib/one-true-awk/tran.c | 164 ++-- usr.bin/awk/Makefile | 10 +- 20 files changed, 2192 insertions(+), 968 deletions(-) diff --git a/contrib/one-true-awk/ChangeLog b/contrib/one-true-awk/ChangeLog index fd03b2bbca0b..dea4ed7e3187 100644 --- a/contrib/one-true-awk/ChangeLog +++ b/contrib/one-true-awk/ChangeLog @@ -1,3 +1,111 @@ +2020-07-30 Arnold D. Robbins + + By fiat, we use bison for $(YACC). Trying to accommodate + different versions didn't work. + + * makefile: Significant cleanup. Replace all ytab* references + with awkgram.tab.* and simplify definition of YACC. + * .gitignore: Remove ytab* references. + * b.c, lex.c, maketab.c, parse.c, run.c: Replace include of ytab.h + with awkgram.tab.h. + * lib.c, main.c, tran.c: Remove include of ytab.h, wasn't needed. + +2020-01-20 Arnold D. Robbins + + * run.c (openfile): Set the close-on-exec flag for file + and pipe redirections that aren't stdin/stdout/stderr. + +2020-01-06 Arnold D. Robbins + + Minor fixes. + * b.c (replace_repeat): Turn init_q back into an int. + * lex.c (string): Use \a instead of \007. + * tran.c (catstr): Use snprintf instead of sprintf. + +2020-01-01 Arnold D. Robbins + + * tran.c (syminit, arginit, envinit): Free sval member before + setting it. Thanks to valgrind. + * b.c: Small formatting cleanups in several routines. + +2019-12-27 Arnold D. Robbins + + * b.c (replace_repeat): Fix a bug whereby a{0,3} could match + four a's. Thanks to Anonymous AWK fan + for the report. Also, minor code formatting cleanups. + * testdir/T.int-expr: New file. + +2019-12-11 Arnold D. Robbins + + * README: Renamed to ... + * README.md: ... this. Cleaned up some as well, + including moving to Markdown. + +2019-11-08 Arnold D. Robbins + + * test/T.chem: Use $oldawk instead of hardwiring 'awk'. + * test/T.lilly: Remove gawk warnings from output, improves + portability. + +2019-10-17 Arnold D. Robbins + + Pull in systime() and strftime() from the NetBSD awk. + + * awk.1: Document the functions. + * run.c (bltin): Implement the functions. + * awk.h: Add defines for systime and strftime. + * lex.c: Add support for systime and strftime. + +2019-10-07 Arnold D. Robbins + + Integrate features from different *BSD versions of awk. + Gensub support from NetBSD. Bitwise functions from OpenBSD. + + * awk.h: Add defines for and, or, xor, compl, lshift and rshift. + * awkgram.y: Add support for gensub. + * maketab.c: Ditto. + * lex.c: Add support for gensub and bitwise functions. + * parse.c (node5, op5): New functions. + * proto.h (node5, op5): New declarations. + * run.c (bltin): Implement the bitwise functions. + (gensub): New function. + * awk.1: Document additional functions. + +2019-10-07 Arnold D. Robbins + + * b.c (fnematch): Change type of pbuf from unsigned char to char. + * proto.h (fnematch): Ditto. + +2019-10-06 Arnold D. Robbins + + * lib.c (readrec): Allow RS a regular expression. Imported + the code from the NetBSD awk. + * b.c (fnematch): New function for implementing the feature. + * awk.1: Updated. + * main.c (version): Updated. + +2019-06-24 Arnold D. Robbins + + * makefile: Revise to take into account there is no more awktest.tar, + add targets 'check' and 'test', and also 'testclean' to clean up + after test run. Have 'clean' and 'cleaner' depend upon 'testclean'. + +2019-06-23 Arnold D. Robbins + + * testdir: Extracted from awktest.tar and added to Git. + * awktest.tar: Removed. + +2019-06-06 Arnold D. Robbins + + * awk.1: Fix a typo, minor edits. + +2019-06-05 Arnold D. Robbins + + * b.c (relex): Count parentheses and treat umatched right paren + as a literal character. + * awktest.tar (testdir/T.re): Added a test case. + * main.c (version): Updated. + 2019-05-29 Arnold D. Robbins * lib.c (isclvar): Remove check for additional '=' after diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES index 183eaedee47d..516458eee0c1 100644 --- a/contrib/one-true-awk/FIXES +++ b/contrib/one-true-awk/FIXES @@ -25,6 +25,229 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +February 15, 2021: + Small fix so that awk will compile again with g++. Thanks to + Arnold Robbins. + +January 06, 2021: + Fix a decision bug with trailing stuff in lib.c:is_valid_number + after recent changes. Thanks to Ozan Yigit. + +December 18, 2020: + Fix problems converting inf and NaN values in lib.c:is_valid_number. + Enhance number to string conversion to do the right thing for + NaN and inf values. Things are now pretty much the same as in + gawk. (Found a gawk bug while we're at it.) Added a torture + test for these values. Thanks to Arnold Robbins. Allows closing + of PR #101. + +December 15, 2020: + Merge PR #99, which gets the right header for strcasecmp. + Thanks to GitHub user michaelforney. + +December 8, 2020: + Merge PR #98: Disallow hex data. Allow only +nan, -nan, + +inf, -inf (case independent) to give NaN and infinity values. + Improve things so that string to double conversion is only + done once, yielding something of a speedup. This obviate + PR #95. Thanks to Arnold Robbins. + +December 3, 2020: + Fix to argument parsing to avoid printing spurious newlines. + Thanks to Todd Miller. Merges PR #97. + +October 13, 2020: + Add casts before all the calls to malloc/calloc/realloc in order + to get it to compile with g++. Thanks to Arnold Robbins. + +August 16, 2020: + Additional fixes for DJGPP. Thanks to Eli Zaretskii for + the testing. + +August 7, 2020: + Merge PR #93, which adds casts to (void*) for debug prints + using the %p format specifier. Thanks to GitHub user YongHaoWu + ("Chris") for the fixes. + +August 4, 2020: + In run.c, use non-restartable multibyte routines to attain + portability to DJGPP. Should fix Issue 92. Thanks to Albert Wik + for the report and to Todd Miller for the suggested fix. + +July 30, 2020: + Merge PRs 88-91 which fix small bugs. Thanks to Todd Miller and + Tim van der Molen for the fixes. + + In order to make life easier, we move exclusively to bison + as the parser generator. + +July 2, 2020: + Merge PRs 85 and 86 which fix regressions. Thanks to + Tim van der Molen for the fixes. + +June 25, 2020: + Merge PRs 82 and 84. The latter fixes issue #83. Thanks to + Todd Miller and awkfan77. + +June 12, 2020: + Clear errno before calling errcheck to avoid any spurious errors + left over from previous calls that may have set it. Thanks to + Todd Miller for the fix, from PR #80. + + Fix Issue #78 by allowing \r to follow floating point numbers in + lib.c:is_number. Thanks to GitHub user ajcarr for the report + and to Arnold Robbins for the fix. + +June 5, 2020: + In fldbld(), make sure that inputFS is set before trying to + use it. Thanks to Steffen Nurpmeso + for the report. + +May 5, 2020: + Fix checks for compilers that can handle noreturn. Thanks to + GitHub user enh-google for pointing it out. Closes Issue #79. + +April 16, 2020: + Handle old compilers that don't support C11 (for noreturn). + Thanks to Arnold Robbins. + +April 5, 2020: + Use and noreturn instead of GCC attributes. + Thanks to GitHub user awkfan77. Closes PR #77. + +February 28, 2020: + More cleanups from Christos Zoulas: notably backslash continuation + inside strings removes the newline and a fix for RS = "^a". + Fix for address sanitizer-found problem. Thanks to GitHub user + enh-google. + +February 19, 2020: + More small cleanups from Christos Zoulas. + +February 18, 2020: + Additional cleanups from Christos Zoulas. It's no longer necessary + to use the -y flag to bison. + +February 6, 2020: + Additional small cleanups from Christos Zoulas. awk is now + a little more robust about reporting I/O errors upon exit. + +January 31, 2020: + Merge PR #70, which avoids use of variable length arrays. Thanks + to GitHub user michaelforney. Fix issue #60 ({0} in interval + expressions doesn't work). Also get all tests working again. + Thanks to Arnold Robbins. + +January 24, 2020: + A number of small cleanups from Christos Zoulas. Add the close + on exec flag to files/pipes opened for redirection; courtesy of + Arnold Robbins. + +January 19, 2020: + If POSIXLY_CORRECT is set in the environment, then sub and gsub + use POSIX rules for multiple backslashes. This fixes Issue #66, + while maintaining backwards compatibility. + +January 9, 2020: + Input/output errors on closing files are now fatal instead of + mere warnings. Thanks to Martijn Dekker . + +January 5, 2020: + Fix a bug in the concatentation of two string constants into + one done in the grammar. Fixes GitHub issue #61. Thanks + to GitHub user awkfan77 for pointing out the direction for + the fix. New test T.concat added to the test suite. + Fix a few memory leaks reported by valgrind, as well. + +December 27, 2019: + Fix a bug whereby a{0,3} could match four a's. Thanks to + "Anonymous AWK fan" for the report. + +December 11, 2019: + Further printf-related fixes for 32 bit systems. + Thanks again to Christos Zoulas. + +December 8, 2019: + Fix the return value of sprintf("%d") on 32 bit systems. + Thanks to Jim Lowe for the report and to Christos Zoulas + for the fix. + +November 10, 2019: + Convert a number of Boolean integer variables into + actual bools. Convert compile_time variable into an + enum and simplify some of the related code. Thanks + to Arnold Robbins. + +November 8, 2019: + Fix from Ori Bernstein to get UTF-8 characters instead of + bytes when FS = "". This is currently the only bit of + the One True Awk that understands multibyte characters. + From Arnold Robbins, apply some cleanups in the test suite. + +October 25, 2019: + More fixes and cleanups from NetBSD, courtesy of Christos + Zoulas. Merges PRs 54 and 55. + +October 24, 2019: + Import second round of code cleanups from NetBSD. Much thanks + to Christos Zoulas (GitHub user zoulasc). Merges PR 53. + Add an optimization for string concatenation, also from + Christos. + +October 17, 2019: + Import code cleanups from NetBSD. Much thanks to Christos + Zoulas (GitHub user zoulasc). Merges PR 51. + +October 6, 2019: + Import code from NetBSD awk that implements RS as a regular + expression. + +September 10, 2019: + Fixes for various array / memory overruns found via gcc's + -fsanitize=unknown. Thanks to Alexander Richardson (GitHub + user arichardson). Merges PRs 47 and 48. + +July 28, 2019: + Import grammar optimization from NetBSD: Two string constants + concatenated together get turned into a single string. + +July 26, 2019: + Support POSIX-specified C-style escape sequences "\a" (alarm) + and "\v" (vertical tab) in command line arguments and regular + expressions, further to the support for them in strings added on + Apr 9, 1989. These now no longer match as literal "a" and "v" + characters (as they don't on other awk implementations). + Thanks to Martijn Dekker. + +July 17, 2019: + Pull in a number of code cleanups and minor fixes from + Warner Losh's bsd-ota branch. The only user visible change + is the use of random(3) as the random number generator. + Thanks to Warner Losh for collecting all these fixes in + one easy place to get them from. + +July 16, 2019: + Fix field splitting to use FS value as of the time a record + was read or assigned to. Thanks to GitHub user Cody Mello (melloc) + for the fix. (Merged from his branch, via PR #42.) Updated + testdir/T.split per said PR as well. + +June 24, 2019: + Extract awktest.tar into testdir directory. Add some very + simple mechanics to the makefile for running the tests and + for cleaning up. No changes to awk itself. + +June 17, 2019: + Disallow deleting SYMTAB and its elements, which creates + use-after-free bugs. Thanks to GitHub user Cody Mello (melloc) + for the fix. (Merged from PR #43.) + +June 5, 2019: + Allow unmatched right parenthesis in a regular expression to + be treated literally. Fixes Issue #40. Thanks to GitHub user + Warner Losh (bsdimp) for the report. Thanks to Arnold Robbins + for the fix. + May 29,2019: Fix check for command line arguments to no longer require that first character after '=' not be another '='. Reverts change of @@ -34,7 +257,7 @@ May 29,2019: Apr 7, 2019: Update awktest.tar(p.50) to use modern options to sort. Needed for Android development. Thanks to GitHub user mohd-akram (Mohamed - Akram). From Comment #33. + Akram). From Issue #33. Mar 12, 2019: Added very simplistic support for cross-compiling in the @@ -54,7 +277,7 @@ Mar 3, 2019: #12: Avoid undefined behaviour when using ctype(3) functions in relex(). Thanks to GitHub user iamleot. #31: Make getline handle numeric strings, and update FIXES. Thanks - to GitHub user arnoldrobbins + to GitHub user arnoldrobbins. #32: maketab: support build systems with read-only source. Thanks to GitHub user enh. @@ -159,10 +382,10 @@ Jun 12, 2011: /pat/, \n /pat/ {...} is now legal, though bad style to use. added checks to new -v code that permits -vnospace; thanks to - ruslan ermilov for spotting this and providing the patch. + ruslan ermilov for spotting this and providing the patch. removed fixed limit on number of open files; thanks to aleksey - cheusov and christos zoulos. + cheusov and christos zoulos. fixed day 1 bug that resurrected deleted elements of ARGV when used as filenames (in lib.c). @@ -180,10 +403,10 @@ May 1, 2011: and arnold robbins, changed srand() to return the previous seed (which is 1 on the first call of srand). the seed is an Awkfloat internally though converted to unsigned int to - pass to the library srand(). thanks, everyone. + pass to the library srand(). thanks, everyone. fixed a subtle (and i hope low-probability) overflow error - in fldbld, by adding space for one extra \0. thanks to + in fldbld, by adding space for one extra \0. thanks to robert bassett for spotting this one and providing a fix. removed the files related to compilation on windows. i no @@ -220,7 +443,7 @@ Oct 8, 2008: Oct 23, 2007: minor fix in lib.c: increase inputFS to 100, change malloc - for fields to n+1. + for fields to n+1. fixed memory fault caused by out of order test in setsval. @@ -267,7 +490,7 @@ Jan 17, 2006: core dump on linux with BEGIN {nextfile}, now fixed. - removed some #ifdef's in run.c and lex.c that appear to no + removed some #ifdef's in run.c and lex.c that appear to no longer be necessary. Apr 24, 2005: @@ -281,8 +504,8 @@ Jan 14, 2005: rethinking it. Dec 31, 2004: - prevent overflow of -f array in main, head off potential error in - call of SYNTAX(), test malloc return in lib.c, all with thanks to + prevent overflow of -f array in main, head off potential error in + call of SYNTAX(), test malloc return in lib.c, all with thanks to todd miller. Dec 22, 2004: @@ -310,8 +533,8 @@ Nov 22, 2003: code known to man. fixed a storage leak in call() that appears to have been there since - 1983 or so -- a function without an explicit return that assigns a - string to a parameter leaked a Cell. thanks to moinak ghosh for + 1983 or so -- a function without an explicit return that assigns a + string to a parameter leaked a Cell. thanks to moinak ghosh for spotting this very subtle one. Jul 31, 2003: @@ -333,7 +556,7 @@ Jul 28, 2003: radix character in programs and command line arguments regardless of the locale; otherwise, the locale should prevail for input and output of numbers. so it's intended to work that way. - + i have rescinded the attempt to use strcoll in expanding shorthands in regular expressions (cclenter). its properties are much too surprising; for example [a-c] matches aAbBc in locale en_US but abBcC @@ -397,7 +620,7 @@ Nov 29, 2002: Jun 28, 2002: modified run/format() and tran/getsval() to do a slightly better job on using OFMT for output from print and CONVFMT for other - number->string conversions, as promised by posix and done by + number->string conversions, as promised by posix and done by gawk and mawk. there are still places where it doesn't work right if CONVFMT is changed; by then the STR attribute of the variable has been irrevocably set. thanks to arnold robbins for @@ -429,7 +652,7 @@ Feb 10, 2002: Jan 1, 2002: fflush() or fflush("") flushes all files and pipes. - length(arrayname) returns number of elements; thanks to + length(arrayname) returns number of elements; thanks to arnold robbins for suggestion. added a makefile.win to make it easier to build on windows. @@ -479,7 +702,7 @@ July 5, 2000: May 25, 2000: yet another attempt at making 8-bit input work, with another - band-aid in b.c (member()), and some (uschar) casts to head + band-aid in b.c (member()), and some (uschar) casts to head off potential errors in subscripts (like isdigit). also changed HAT to NCHARS-2. thanks again to santiago vila. @@ -526,7 +749,7 @@ Apr 21, 1999: the test case.) Apr 16, 1999: - with code kindly provided by Bruce Lilly, awk now parses + with code kindly provided by Bruce Lilly, awk now parses /=/ and similar constructs more sensibly in more places. Bruce also provided some helpful test cases. @@ -583,7 +806,7 @@ Jan 13, 1999: Oct 19, 1998: fixed a couple of bugs in getrec: could fail to update $0 - after a getline var; because inputFS wasn't initialized, + after a getline var; because inputFS wasn't initialized, could split $0 on every character, a misleading diversion. fixed caching bug in makedfa: LRU was actually removing @@ -731,7 +954,7 @@ May 2, 1996: input file. (thanks to arnold robbins for inspiration and code). small fixes to regexpr code: can now handle []], [[], and - variants; [] is now a syntax error, rather than matching + variants; [] is now a syntax error, rather than matching everything; [z-a] is now empty, not z. far from complete or correct, however. (thanks to jeffrey friedl for pointing out some awful behaviors.) diff --git a/contrib/one-true-awk/REGRESS b/contrib/one-true-awk/REGRESS index 7d3ded69d536..eb3b5d7ac70b 100755 --- a/contrib/one-true-awk/REGRESS +++ b/contrib/one-true-awk/REGRESS @@ -33,3 +33,7 @@ then fi REGRESS + +cd .. +cd bugs-fixed +REGRESS diff --git a/contrib/one-true-awk/awk.1 b/contrib/one-true-awk/awk.1 index b8e00cb60449..b3698eb07d1a 100644 --- a/contrib/one-true-awk/awk.1 +++ b/contrib/one-true-awk/awk.1 @@ -7,6 +7,10 @@ .fi .ft 1 .. +.de TF +.IP "" "\w'\fB\\$1\ \ \fP'u" +.PD 0 +.. .TH AWK 1 .CT 1 files prog_other .SH NAME @@ -48,7 +52,7 @@ matches the pattern. Each line is matched against the pattern portion of every pattern-action statement; the associated action is performed for each matched pattern. -The file name +The file name .B \- means the standard input. Any @@ -90,7 +94,7 @@ A pattern-action statement has the form: .IP .IB pattern " { " action " } .PP -A missing +A missing .BI { " action " } means print the line; a missing pattern always matches. @@ -209,7 +213,7 @@ or length of if no argument. .TP .B rand -random number on [0,1) +random number on [0,1). .TP .B srand sets seed for @@ -217,7 +221,7 @@ sets seed for and returns the previous seed. .TP .B int -truncates to an integer value +truncates to an integer value. .TP \fBsubstr(\fIs\fB, \fIm\fR [\fB, \fIn\^\fR]\fB)\fR the @@ -225,12 +229,11 @@ the substring of .I s that begins at position -.I m +.I m counted from 1. If no -.IR m , -use the rest of the string -.I +.IR n , +use the rest of the string. .TP .BI index( s , " t" ) the position in @@ -294,6 +297,25 @@ and .B gsub return the number of replacements. .TP +\fBgensub(\fIpat\fB, \fIrepl\fB, \fIhow\fR [\fB, \fItarget\fR]\fB)\fR +replaces instances of +.I pat +in +.I target +with +.IR repl . +If +.I how +is \fB"g"\fR or \fB"G"\fR, do so globally. Otherwise, +.I how +is a number indicating which occurrence to replace. If no +.IR target , +use +.BR $0 . +Return the resulting string; +.I target +is not modified. +.TP .BI sprintf( fmt , " expr" , " ...\fB) the string resulting from formatting .I expr ... @@ -302,13 +324,35 @@ according to the format .IR fmt . .TP +.B systime() +returns the current date and time as a standard +``seconds since the epoch'' value. +.TP +.BI strftime( fmt ", " timestamp\^ ) +formats +.I timestamp +(a value in seconds since the epoch) +according to +.IR fmt , +which is a format string as supported by +.IR strftime (3). +Both +.I timestamp +and +.I fmt +may be omitted; if no +.IR timestamp , +the current time of day is used, and if no +.IR fmt , +a default format of \fB"%a %b %e %H:%M:%S %Z %Y"\fR is used. +.TP .BI system( cmd ) executes .I cmd and returns its exit status. This will be \-1 upon error, .IR cmd 's exit status upon a normal exit, -256 + +256 + .I sig upon death-by-signal, where .I sig @@ -361,19 +405,26 @@ In all cases, returns 1 for a successful input, 0 for end of file, and \-1 for an error. .PP +The functions +.BR compl , +.BR and , +.BR or , +.BR xor , +.BR lshift , +and +.B rshift +peform the corresponding bitwise operations on their +operands, which are first truncated to integer. +.PP Patterns are arbitrary Boolean combinations (with .BR "! || &&" ) of regular expressions and relational expressions. Regular expressions are as in -.IR egrep (1) -except numeric quantifiers are not supported beyond the basic -.B + -and -.B ? -for quantities \&\f(CW"0 or 1"\fP and \&\f(CW"1 or more"\fP -respectively. +.IR egrep ; +see +.IR grep (1). Isolated regular expressions in a pattern apply to the entire line. Regular expressions may also occur in @@ -483,6 +534,11 @@ the length of a string matched by .TP .B RS input record separator (default newline). +If empty, blank lines separate records. +If more than one character long, +.B RS +is treated as a regular expression, and records are +separated by text matching the expression. .TP .B RSTART the start position of a string matched by @@ -502,6 +558,16 @@ functions may be called recursively. Parameters are local to the function; all other variables are global. Thus local variables may be created by providing excess parameters in the function definition. +.SH ENVIRONMENT VARIABLES +If +.B POSIXLY_CORRECT +is set in the environment, then +.I awk +follows the POSIX rules for +.B sub +and +.B gsub +with respect to consecutive backslashes and ampersands. .SH EXAMPLES .TP .EX @@ -546,8 +612,8 @@ BEGIN { # Simulate echo(1) .fi .EE .SH SEE ALSO -.IR grep (1), -.IR lex (1), +.IR grep (1), +.IR lex (1), .IR sed (1) .br A. V. Aho, B. W. Kernighan, P. J. Weinberger, @@ -558,8 +624,61 @@ There are no explicit conversions between numbers and strings. To force an expression to be treated as a number add 0 to it; to force it to be treated as a string concatenate \&\f(CW""\fP to it. -.br +.PP The scope rules for variables in functions are a botch; the syntax is worse. -.br +.PP Only eight-bit characters sets are handled correctly. +.SH UNUSUAL FLOATING-POINT VALUES +.I Awk +was designed before IEEE 754 arithmetic defined Not-A-Number (NaN) +and Infinity values, which are supported by all modern floating-point +hardware. +.PP +Because +.I awk +uses +.IR strtod (3) +and +.IR atof (3) +to convert string values to double-precision floating-point values, +modern C libraries also convert strings starting with +.B inf +and +.B nan +into infinity and NaN values respectively. This led to strange results, +with something like this: +.PP +.EX +.nf +echo nancy | awk '{ print $1 + 0 }' +.fi +.EE +.PP +printing +.B nan +instead of zero. +.PP +.I Awk +now follows GNU AWK, and prefilters string values before attempting +to convert them to numbers, as follows: +.TP +.I "Hexadecimal values" +Hexadecimal values (allowed since C99) convert to zero, as they did +prior to C99. +.TP +.I "NaN values" +The two strings +.B +nan +and +.B \-nan +(case independent) convert to NaN. No others do. +(NaNs can have signs.) +.TP +.I "Infinity values" +The two strings +.B +inf +and +.B \-inf +(case independent) convert to positive and negative infinity, respectively. +No others do. diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 31d070aecddc..230eac41548c 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -23,6 +23,13 @@ THIS SOFTWARE. ****************************************************************/ #include +#include +#include +#if __STDC_VERSION__ <= 199901L +#define noreturn +#else +#include +#endif typedef double Awkfloat; @@ -30,24 +37,34 @@ typedef double Awkfloat; typedef unsigned char uschar; -#define xfree(a) { if ((a) != NULL) { free((void *) (a)); (a) = NULL; } } +#define xfree(a) { if ((a) != NULL) { free((void *)(intptr_t)(a)); (a) = NULL; } } +/* + * We sometimes cheat writing read-only pointers to NUL-terminate them + * and then put back the original value + */ +#define setptr(ptr, a) (*(char *)(intptr_t)(ptr)) = (a) -#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf +#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for DPRINTF */ #define DEBUG #ifdef DEBUG - /* uses have to be doubly parenthesized */ -# define dprintf(x) if (dbg) printf x +# define DPRINTF(...) if (dbg) printf(__VA_ARGS__) #else -# define dprintf(x) +# define DPRINTF(...) #endif -extern int compile_time; /* 1 if compiling, 0 if running */ -extern int safe; /* 0 => unsafe, 1 => safe */ +extern enum compile_states { + RUNNING, + COMPILING, + ERROR_PRINTING +} compile_time; + +extern bool safe; /* false => unsafe, true => safe */ #define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */ extern int recsize; /* size of current record, orig RECSIZE */ +extern char EMPTY[]; /* this avoid -Wwritable-strings issues */ extern char **FS; extern char **RS; extern char **ORS; @@ -64,13 +81,11 @@ extern Awkfloat *RLENGTH; extern char *record; /* points to $0 */ extern int lineno; /* line number in awk program */ extern int errorflag; /* 1 if error has occurred */ -extern int donefld; /* 1 if record broken into fields */ -extern int donerec; /* 1 if record is valid (no fld has changed */ -extern char inputFS[]; /* FS at time of input, for field splitting */ - +extern bool donefld; /* true if record broken into fields */ +extern bool donerec; /* true if record is valid (no fld has changed */ extern int dbg; -extern char *patbeg; /* beginning of pattern matched */ +extern const char *patbeg; /* beginning of pattern matched */ extern int patlen; /* length of pattern matched. set in b.c */ /* Cell: all information about a variable or constant */ @@ -105,6 +120,7 @@ extern Cell *rsloc; /* RS */ extern Cell *rstartloc; /* RSTART */ extern Cell *rlengthloc; /* RLENGTH */ extern Cell *subseploc; /* SUBSEP */ +extern Cell *symtabloc; /* SYMTAB */ /* Cell.tval values: */ #define NUM 01 /* number value is valid */ @@ -134,12 +150,14 @@ extern Cell *subseploc; /* SUBSEP */ #define FTOUPPER 12 #define FTOLOWER 13 #define FFLUSH 14 -#define FAND 15 -#define FFOR 16 -#define FXOR 17 -#define FCOMPL 18 -#define FLSHIFT 19 -#define FRSHIFT 20 +#define FAND 15 +#define FFOR 16 +#define FXOR 17 +#define FCOMPL 18 +#define FLSHIFT 19 +#define FRSHIFT 20 +#define FSYSTIME 21 +#define FSTRFTIME 22 /* Node: parse tree is made of nodes, with Cell's at bottom */ @@ -167,7 +185,7 @@ extern Node *nullnode; #define CCOPY 6 #define CCON 5 #define CTEMP 4 -#define CNAME 3 +#define CNAME 3 #define CVAR 2 #define CFLD 1 #define CUNK 0 @@ -217,6 +235,7 @@ extern int pairstack[], paircnt; #define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */ /* watch out in match(), etc. */ +#define HAT (NCHARS+2) /* matches ^ in regular expr */ #define NSTATES 32 #define HAT (NCHARS+2) /* matches ^ in regular expr */ /* NCHARS is 2**n */ @@ -232,16 +251,16 @@ typedef struct rrow { } rrow; typedef struct fa { - uschar gototab[NSTATES][HAT + 1]; - uschar out[NSTATES]; + unsigned int **gototab; + uschar *out; uschar *restr; - int *posns[NSTATES]; - int anchor; + int **posns; + int state_count; + bool anchor; int use; int initstat; int curstat; int accept; - int reset; struct rrow re[1]; /* variable: actual size set by calling malloc */ } fa; diff --git a/contrib/one-true-awk/awkgram.y b/contrib/one-true-awk/awkgram.y index e4abeeddcb6a..f37073d1f9ac 100644 --- a/contrib/one-true-awk/awkgram.y +++ b/contrib/one-true-awk/awkgram.y @@ -32,8 +32,8 @@ int yywrap(void) { return(1); } Node *beginloc = 0; Node *endloc = 0; -int infunc = 0; /* = 1 if in arglist or body of func */ *** 4847 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 10 18:27:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 30593658F38; Sat, 10 Jul 2021 18:27: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 4GMdmB0fl5z4dgD; Sat, 10 Jul 2021 18:27: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 F304E518C; Sat, 10 Jul 2021 18:27: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 16AIR5Yl081320; Sat, 10 Jul 2021 18:27:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AIR5no081319; Sat, 10 Jul 2021 18:27:05 GMT (envelope-from git) Date: Sat, 10 Jul 2021 18:27:05 GMT Message-Id: <202107101827.16AIR5no081319@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f2712c6c073c - stable/12 - This should have been committed in r348511 with the awk update. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f2712c6c073c58d64863e452e7a75b413834a80a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 18:27:06 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f2712c6c073c58d64863e452e7a75b413834a80a commit f2712c6c073c58d64863e452e7a75b413834a80a Author: Warner Losh AuthorDate: 2019-06-02 16:44:50 +0000 Commit: Warner Losh CommitDate: 2021-07-10 18:24:20 +0000 This should have been committed in r348511 with the awk update. It was in my tree, the build worked, but I committed from contrib/one-true-awk rather than the top level, so was omitted. (cherry picked from commit e9b659753c07b539df17441012b0bfa5ebdbe0ea) --- usr.bin/awk/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index fc032f66459b..d31e811bbec5 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -23,7 +23,7 @@ awkgram.tab.h: awkgram.h ln -sf ${.ALLSRC:M*.h} ${.TARGET} proctab.c: maketab - ${BTOOLSPATH:U.}/maketab > proctab.c + ${BTOOLSPATH:U.}/maketab awkgram.h > proctab.c build-tools: maketab maketab: awkgram.tab.h maketab.c ${BUILD_TOOLS_META} From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:04:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A630659542; Sat, 10 Jul 2021 19:04: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 4GMfbg03qRz4jKj; Sat, 10 Jul 2021 19:04: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 DEEB051F5; Sat, 10 Jul 2021 19:04: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 16AJ4kmm035409; Sat, 10 Jul 2021 19:04:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4k4x035408; Sat, 10 Jul 2021 19:04:46 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:46 GMT Message-Id: <202107101904.16AJ4k4x035408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: e036ee6ce2e4 - main - Let the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing the number of completion event TRBs. This avoids wasting memory. 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/main X-Git-Reftype: branch X-Git-Commit: e036ee6ce2e4d6fe0564f8bb3aa99a2f61d48fc6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:47 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e036ee6ce2e4d6fe0564f8bb3aa99a2f61d48fc6 commit e036ee6ce2e4d6fe0564f8bb3aa99a2f61d48fc6 Author: Hans Petter Selasky AuthorDate: 2021-07-10 12:14:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 17:57:52 +0000 Let the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing the number of completion event TRBs. This avoids wasting memory. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index c0427e0cf11f..e8841a05b134 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -33,7 +33,7 @@ #define XHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) #define XHCI_MAX_ENDPOINTS 32 /* hardcoded - do not change */ #define XHCI_MAX_SCRATCHPADS 256 /* theoretical max is 1023 */ -#define XHCI_MAX_EVENTS (16 * 13) +#define XHCI_MAX_EVENTS 232 #define XHCI_MAX_COMMANDS (16 * 1) #define XHCI_MAX_RSEG 1 #define XHCI_MAX_TRANSFERS 4 @@ -383,6 +383,8 @@ struct xhci_hw_root { struct xhci_trb hwr_commands[XHCI_MAX_COMMANDS]; }; +CTASSERT(sizeof(struct xhci_hw_root) == XHCI_PAGE_SIZE); + struct xhci_endpoint_ext { struct xhci_trb *trb; struct usb_xfer *xfer[XHCI_MAX_TRANSFERS * XHCI_MAX_STREAMS]; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:04:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A941365986A; Sat, 10 Jul 2021 19:04:48 +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 4GMfbh1Blbz4jFD; Sat, 10 Jul 2021 19:04:48 +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 105295B15; Sat, 10 Jul 2021 19:04: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 16AJ4lqt035433; Sat, 10 Jul 2021 19:04:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4lj3035432; Sat, 10 Jul 2021 19:04:47 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:47 GMT Message-Id: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: d038463bd269 - main - Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. 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/main X-Git-Reftype: branch X-Git-Commit: d038463bd269031fa8f13c0951b223bcae02bbca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:48 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d038463bd269031fa8f13c0951b223bcae02bbca commit d038463bd269031fa8f13c0951b223bcae02bbca Author: Hans Petter Selasky AuthorDate: 2021-07-10 16:09:56 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 17:57:52 +0000 Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.c | 11 ++++++++++- sys/dev/usb/controller/xhci.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 10e37c97c254..dd64c2d45141 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -644,6 +644,9 @@ xhci_init(struct xhci_softc *sc, device_t self, uint8_t dma32) DPRINTF("HCS2=0x%08x\n", temp); + /* get isochronous scheduling threshold */ + sc->sc_ist = XHCI_HCS2_IST(temp); + /* get number of scratchpads */ sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp); @@ -2075,7 +2078,13 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) x = XREAD4(temp.sc, runt, XHCI_MFINDEX); - DPRINTF("MFINDEX=0x%08x\n", x); + DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, sc->sc_ist); + + /* add isochronous scheduling threshold */ + if (temp.sc->sc_ist & 8) + x += (temp.sc->sc_ist & 7) << 3; + else + x += (temp.sc->sc_ist & 7); switch (usbd_get_speed(xfer->xroot->udev)) { case USB_SPEED_FULL: diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h index e8841a05b134..802207208569 100644 --- a/sys/dev/usb/controller/xhci.h +++ b/sys/dev/usb/controller/xhci.h @@ -529,6 +529,9 @@ struct xhci_softc { /* size of context */ uint8_t sc_ctx_is_64_byte; + /* Isochronous Scheduling Threshold */ + uint8_t sc_ist; + /* vendor string for root HUB */ char sc_vendor[16]; }; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:04:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 59A9B65992E; Sat, 10 Jul 2021 19:04: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 4GMfbj1vvSz4j6d; Sat, 10 Jul 2021 19:04: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 26D6F5A8B; Sat, 10 Jul 2021 19:04: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 16AJ4nv1035461; Sat, 10 Jul 2021 19:04:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4nuC035460; Sat, 10 Jul 2021 19:04:49 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:49 GMT Message-Id: <202107101904.16AJ4nuC035460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 3f5054862a46 - main - Make sure the avr32dci_odevd structure is used. This fixes a compilation error. 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/main X-Git-Reftype: branch X-Git-Commit: 3f5054862a4603116bb872cf8b7b3cc946e93741 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:49 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3f5054862a4603116bb872cf8b7b3cc946e93741 commit 3f5054862a4603116bb872cf8b7b3cc946e93741 Author: Hans Petter Selasky AuthorDate: 2021-07-10 16:13:21 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 17:57:52 +0000 Make sure the avr32dci_odevd structure is used. This fixes a compilation error. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/avr32dci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index eaf0f8261b92..7cc5ca5d90c7 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -1690,6 +1690,12 @@ tr_handle_get_descriptor: len = sizeof(avr32dci_devd); ptr = (const void *)&avr32dci_devd; goto tr_valid; + case UDESC_DEVICE_QUALIFIER: + if (value & 0xff) + goto tr_stalled; + len = sizeof(avr32dci_odevd); + ptr = (const void *)&avr32dci_odevd; + goto tr_valid; case UDESC_CONFIG: if (value & 0xff) { goto tr_stalled; From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:04:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 90B8D65986F; Sat, 10 Jul 2021 19:04: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 4GMfbk2w4rz4jQD; Sat, 10 Jul 2021 19:04: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 4204158B3; Sat, 10 Jul 2021 19:04: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 16AJ4oPN035488; Sat, 10 Jul 2021 19:04:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJ4oFN035487; Sat, 10 Jul 2021 19:04:50 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:04:50 GMT Message-Id: <202107101904.16AJ4oFN035487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 8fc2a3c41791 - main - Factor out repeated code in the USB controller drivers to avoid bugs computing the same isochronous start frame number over and over again. 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/main X-Git-Reftype: branch X-Git-Commit: 8fc2a3c41791b205a107dc2bec16ac7514a57958 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:04:51 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8fc2a3c41791b205a107dc2bec16ac7514a57958 commit 8fc2a3c41791b205a107dc2bec16ac7514a57958 Author: Hans Petter Selasky AuthorDate: 2021-07-10 16:17:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 18:59:00 +0000 Factor out repeated code in the USB controller drivers to avoid bugs computing the same isochronous start frame number over and over again. PR: 257082 MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/atmegadci.c | 37 +------------- sys/dev/usb/controller/avr32dci.c | 37 +------------- sys/dev/usb/controller/dwc_otg.c | 45 +---------------- sys/dev/usb/controller/ehci.c | 96 ++++++------------------------------ sys/dev/usb/controller/musb_otg.c | 42 +--------------- sys/dev/usb/controller/ohci.c | 33 +++---------- sys/dev/usb/controller/saf1761_otg.c | 70 ++------------------------ sys/dev/usb/controller/uhci.c | 41 +++------------ sys/dev/usb/controller/uss820dci.c | 35 +------------ sys/dev/usb/controller/xhci.c | 85 +++++++++++-------------------- sys/dev/usb/usb_transfer.c | 69 ++++++++++++++++++++++++++ sys/dev/usb/usb_transfer.h | 1 + 12 files changed, 140 insertions(+), 451 deletions(-) diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index 1f91948c4ccd..06bee13c3a59 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -1421,7 +1421,6 @@ static void atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -1433,41 +1432,9 @@ atmegadci_device_isoc_fs_enter(struct usb_xfer *xfer) (ATMEGA_READ_1(sc, ATMEGA_UDFNUMH) << 8) | (ATMEGA_READ_1(sc, ATMEGA_UDFNUML)); - nframes &= ATMEGA_FRAME_MASK; - - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & ATMEGA_FRAME_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & ATMEGA_FRAME_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, ATMEGA_FRAME_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & ATMEGA_FRAME_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ atmegadci_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index 7cc5ca5d90c7..0ab9a8ff665d 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -1355,7 +1355,6 @@ static void avr32dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; uint8_t ep_no; @@ -1366,41 +1365,9 @@ avr32dci_device_isoc_fs_enter(struct usb_xfer *xfer) ep_no = xfer->endpointno & UE_ADDR; nframes = (AVR32_READ_4(sc, AVR32_FNUM) / 8); - nframes &= AVR32_FRAME_MASK; - - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & AVR32_FRAME_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, AVR32_FRAME_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & AVR32_FRAME_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ avr32dci_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c index 421b95593b3a..8192c7b011e9 100644 --- a/sys/dev/usb/controller/dwc_otg.c +++ b/sys/dev/usb/controller/dwc_otg.c @@ -4189,9 +4189,7 @@ dwc_otg_device_isoc_start(struct usb_xfer *xfer) { struct dwc_otg_softc *sc = DWC_OTG_BUS2SC(xfer->xroot->bus); uint32_t temp; - uint32_t msframes; uint32_t framenum; - uint8_t shift = usbd_xfer_get_fps_shift(xfer); DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", xfer, xfer->endpoint->isoc_next, xfer->nframes); @@ -4214,52 +4212,13 @@ dwc_otg_device_isoc_start(struct usb_xfer *xfer) if (sc->sc_flags.status_high_speed) framenum /= 8; - framenum &= DWC_OTG_FRAME_MASK; - - /* - * Compute number of milliseconds worth of data traffic for - * this USB transfer: - */ - if (xfer->xroot->udev->speed == USB_SPEED_HIGH) - msframes = ((xfer->nframes << shift) + 7) / 8; - else - msframes = xfer->nframes; - - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (framenum - xfer->endpoint->isoc_next) & DWC_OTG_FRAME_MASK; - - if ((xfer->endpoint->is_synced == 0) || (temp < msframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (framenum + 3) & DWC_OTG_FRAME_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, framenum, 0, 1, DWC_OTG_FRAME_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - framenum) & DWC_OTG_FRAME_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, framenum) + temp + msframes; /* setup TDs */ dwc_otg_setup_standard_chain(xfer); - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += msframes; - /* start TD chain */ dwc_otg_start_standard_chain(xfer); } diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c index 0b7f41b39234..dd4f7c568625 100644 --- a/sys/dev/usb/controller/ehci.c +++ b/sys/dev/usb/controller/ehci.c @@ -2440,6 +2440,7 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) uint32_t *plen; uint32_t buf_offset; uint32_t nframes; + uint32_t startframe; uint32_t temp; uint32_t sitd_mask; uint16_t tlen; @@ -2458,39 +2459,9 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) nframes = EOREAD4(sc, EHCI_FRINDEX) / 8; - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - buf_offset = (nframes - xfer->endpoint->isoc_next) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - if ((xfer->endpoint->is_synced == 0) || - (buf_offset < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - buf_offset = (xfer->endpoint->isoc_next - nframes) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + - buf_offset + xfer->nframes; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, EHCI_VIRTUAL_FRAMELIST_COUNT - 1, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); /* get the real number of frames */ @@ -2507,11 +2478,11 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) td = xfer->td_start[xfer->flags_int.curr_dma_set]; xfer->td_transfer_first = td; - pp_last = &sc->sc_isoc_fs_p_last[xfer->endpoint->isoc_next]; + pp_last = &sc->sc_isoc_fs_p_last[startframe]; /* store starting position */ - xfer->qh_pos = xfer->endpoint->isoc_next; + xfer->qh_pos = startframe; while (nframes--) { if (td == NULL) { @@ -2633,10 +2604,6 @@ ehci_device_isoc_fs_enter(struct usb_xfer *xfer) xfer->td_transfer_last = td_last; - /* update isoc_next */ - xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_fs_p_last[0]) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - /* * We don't allow cancelling of the SPLIT transaction USB FULL * speed transfer, because it disturbs the bandwidth @@ -2743,11 +2710,11 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) uint32_t status; uint32_t buf_offset; uint32_t nframes; + uint32_t startframe; uint32_t itd_offset[8 + 1]; uint8_t x; uint8_t td_no; uint8_t page_no; - uint8_t shift = usbd_xfer_get_fps_shift(xfer); #ifdef USB_DEBUG uint8_t once = 1; @@ -2755,47 +2722,16 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) #endif DPRINTFN(6, "xfer=%p next=%d nframes=%d shift=%d\n", - xfer, xfer->endpoint->isoc_next, xfer->nframes, (int)shift); + xfer, xfer->endpoint->isoc_next, xfer->nframes, + usbd_xfer_get_fps_shift(xfer)); /* get the current frame index */ nframes = EOREAD4(sc, EHCI_FRINDEX) / 8; - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - buf_offset = (nframes - xfer->endpoint->isoc_next) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - if ((xfer->endpoint->is_synced == 0) || - (buf_offset < (((xfer->nframes << shift) + 7) / 8))) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - buf_offset = (xfer->endpoint->isoc_next - nframes) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset + - (((xfer->nframes << shift) + 7) / 8); - - /* get the real number of frames */ + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, EHCI_VIRTUAL_FRAMELIST_COUNT - 1, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); nframes = xfer->nframes; @@ -2811,11 +2747,11 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) td = xfer->td_start[xfer->flags_int.curr_dma_set]; xfer->td_transfer_first = td; - pp_last = &sc->sc_isoc_hs_p_last[xfer->endpoint->isoc_next]; + pp_last = &sc->sc_isoc_hs_p_last[startframe]; /* store starting position */ - xfer->qh_pos = xfer->endpoint->isoc_next; + xfer->qh_pos = startframe; while (nframes) { if (td == NULL) { @@ -2927,10 +2863,6 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) } xfer->td_transfer_last = td_last; - - /* update isoc_next */ - xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_hs_p_last[0]) & - (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); } static void diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index 24eba2a9a552..fd2f7e72c43a 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -3436,9 +3436,7 @@ static void musbotg_device_isoc_enter(struct usb_xfer *xfer) { struct musbotg_softc *sc = MUSBOTG_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; - uint32_t fs_frames; DPRINTFN(5, "xfer=%p next=%d nframes=%d\n", xfer, xfer->endpoint->isoc_next, xfer->nframes); @@ -3447,45 +3445,9 @@ musbotg_device_isoc_enter(struct usb_xfer *xfer) nframes = MUSB2_READ_2(sc, MUSB2_REG_FRAME); - /* - * check if the frame index is within the window where the frames - * will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & MUSB2_MASK_FRAME; - - if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { - fs_frames = (xfer->nframes + 7) / 8; - } else { - fs_frames = xfer->nframes; - } - - if ((xfer->endpoint->is_synced == 0) || - (temp < fs_frames)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & MUSB2_MASK_FRAME; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, MUSB2_MASK_FRAME, NULL)) DPRINTFN(2, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & MUSB2_MASK_FRAME; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - fs_frames; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += fs_frames; /* setup TDs */ musbotg_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c index 39f3bd54f507..7268af06a602 100644 --- a/sys/dev/usb/controller/ohci.c +++ b/sys/dev/usb/controller/ohci.c @@ -1824,6 +1824,7 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) struct ohci_hcca *hcca; uint32_t buf_offset; uint32_t nframes; + uint32_t startframe; uint32_t ed_flags; uint32_t *plen; uint16_t itd_offset[OHCI_ITD_NOFFSET]; @@ -1840,31 +1841,9 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) DPRINTFN(6, "xfer=%p isoc_next=%u nframes=%u hcca_fn=%u\n", xfer, xfer->endpoint->isoc_next, xfer->nframes, nframes); - if ((xfer->endpoint->is_synced == 0) || - (((nframes - xfer->endpoint->isoc_next) & 0xFFFF) < xfer->nframes) || - (((xfer->endpoint->isoc_next - nframes) & 0xFFFF) >= 128)) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & 0xFFFF; - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - buf_offset = ((xfer->endpoint->isoc_next - nframes) & 0xFFFF); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - (usb_isoc_time_expand(&sc->sc_bus, nframes) + buf_offset + - xfer->nframes); + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, 0xFFFF, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); /* get the real number of frames */ @@ -1905,12 +1884,12 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) /* fill current ITD */ td->itd_flags = htole32( OHCI_ITD_NOCC | - OHCI_ITD_SET_SF(xfer->endpoint->isoc_next) | + OHCI_ITD_SET_SF(startframe) | OHCI_ITD_NOINTR | OHCI_ITD_SET_FC(ncur)); td->frames = ncur; - xfer->endpoint->isoc_next += ncur; + startframe += ncur; if (length == 0) { /* all zero */ diff --git a/sys/dev/usb/controller/saf1761_otg.c b/sys/dev/usb/controller/saf1761_otg.c index df0162e51749..f5725a3cb48a 100644 --- a/sys/dev/usb/controller/saf1761_otg.c +++ b/sys/dev/usb/controller/saf1761_otg.c @@ -2632,7 +2632,6 @@ static void saf1761_otg_device_isoc_enter(struct usb_xfer *xfer) { struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -2642,39 +2641,9 @@ saf1761_otg_device_isoc_enter(struct usb_xfer *xfer) nframes = SAF1761_READ_LE_4(sc, SOTG_FRAME_NUM); - /* - * check if the frame index is within the window where the - * frames will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & SOTG_FRAME_NUM_SOFR_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & SOTG_FRAME_NUM_SOFR_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, SOTG_FRAME_NUM_SOFR_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & SOTG_FRAME_NUM_SOFR_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ saf1761_otg_setup_standard_chain(xfer); @@ -2714,7 +2683,6 @@ static void saf1761_otg_host_isoc_enter(struct usb_xfer *xfer) { struct saf1761_otg_softc *sc = SAF1761_OTG_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -2724,39 +2692,9 @@ saf1761_otg_host_isoc_enter(struct usb_xfer *xfer) nframes = (SAF1761_READ_LE_4(sc, SOTG_FRINDEX) & SOTG_FRINDEX_MASK) >> 3; - /* - * check if the frame index is within the window where the - * frames will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & (SOTG_FRINDEX_MASK >> 3); - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & (SOTG_FRINDEX_MASK >> 3); - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, SOTG_FRINDEX_MASK >> 3, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & (SOTG_FRINDEX_MASK >> 3); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ saf1761_otg_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c index 59453359deb0..41caa1610989 100644 --- a/sys/dev/usb/controller/uhci.c +++ b/sys/dev/usb/controller/uhci.c @@ -2111,7 +2111,7 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) struct uhci_mem_layout ml; uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus); uint32_t nframes; - uint32_t temp; + uint32_t startframe; uint32_t *plen; #ifdef USB_DEBUG @@ -2127,34 +2127,9 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) nframes = UREAD2(sc, UHCI_FRNUM); - temp = (nframes - xfer->endpoint->isoc_next) & - (UHCI_VFRAMELIST_COUNT - 1); - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is empty we - * schedule the transfer a few frames ahead of the current - * frame position. Else two isochronous transfers might - * overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & (UHCI_VFRAMELIST_COUNT - 1); - xfer->endpoint->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & - (UHCI_VFRAMELIST_COUNT - 1); - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, UHCI_VFRAMELIST_COUNT - 1, &startframe)) + DPRINTFN(3, "start next=%d\n", startframe); /* get the real number of frames */ @@ -2171,11 +2146,11 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) td = xfer->td_start[xfer->flags_int.curr_dma_set]; xfer->td_transfer_first = td; - pp_last = &sc->sc_isoc_p_last[xfer->endpoint->isoc_next]; + pp_last = &sc->sc_isoc_p_last[startframe]; /* store starting position */ - xfer->qh_pos = xfer->endpoint->isoc_next; + xfer->qh_pos = startframe; while (nframes--) { if (td == NULL) { @@ -2252,10 +2227,6 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) } xfer->td_transfer_last = td_last; - - /* update isoc_next */ - xfer->endpoint->isoc_next = (pp_last - &sc->sc_isoc_p_last[0]) & - (UHCI_VFRAMELIST_COUNT - 1); } static void diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c index b2e112b07f6e..0c37a932b2a9 100644 --- a/sys/dev/usb/controller/uss820dci.c +++ b/sys/dev/usb/controller/uss820dci.c @@ -1706,7 +1706,6 @@ static void uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer) { struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); - uint32_t temp; uint32_t nframes; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", @@ -1716,39 +1715,9 @@ uss820dci_device_isoc_fs_enter(struct usb_xfer *xfer) nframes = USS820_READ_1(sc, USS820_SOFL); - /* - * check if the frame index is within the window where the - * frames will be inserted - */ - temp = (nframes - xfer->endpoint->isoc_next) & USS820_SOFL_MASK; - - if ((xfer->endpoint->is_synced == 0) || - (temp < xfer->nframes)) { - /* - * If there is data underflow or the pipe queue is - * empty we schedule the transfer a few frames ahead - * of the current frame position. Else two isochronous - * transfers might overlap. - */ - xfer->endpoint->isoc_next = (nframes + 3) & USS820_SOFL_MASK; - xfer->endpoint->is_synced = 1; + if (usbd_xfer_get_isochronous_start_frame( + xfer, nframes, 0, 1, USS820_SOFL_MASK, NULL)) DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); - } - /* - * compute how many milliseconds the insertion is ahead of the - * current frame position: - */ - temp = (xfer->endpoint->isoc_next - nframes) & USS820_SOFL_MASK; - - /* - * pre-compute when the isochronous transfer will be finished: - */ - xfer->isoc_time_complete = - usb_isoc_time_expand(&sc->sc_bus, nframes) + temp + - xfer->nframes; - - /* compute frame number for next insertion */ - xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ uss820dci_setup_standard_chain(xfer); diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index dd64c2d45141..93468c5d9333 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -133,8 +133,8 @@ struct xhci_std_temp { uint32_t offset; uint32_t max_packet_size; uint32_t average; + uint32_t isoc_frame; uint16_t isoc_delta; - uint16_t isoc_frame; uint8_t shortpkt; uint8_t multishort; uint8_t last_frame; @@ -2080,62 +2080,55 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, sc->sc_ist); - /* add isochronous scheduling threshold */ - if (temp.sc->sc_ist & 8) - x += (temp.sc->sc_ist & 7) << 3; - else - x += (temp.sc->sc_ist & 7); - switch (usbd_get_speed(xfer->xroot->udev)) { case USB_SPEED_FULL: shift = 3; temp.isoc_delta = 8; /* 1ms */ - x += temp.isoc_delta - 1; - x &= ~(temp.isoc_delta - 1); break; default: shift = usbd_xfer_get_fps_shift(xfer); temp.isoc_delta = 1U << shift; - x += temp.isoc_delta - 1; - x &= ~(temp.isoc_delta - 1); - /* simple frame load balancing */ - x += xfer->endpoint->usb_uframe; break; } - y = XHCI_MFINDEX_GET(x - xfer->endpoint->isoc_next); + /* Compute isochronous scheduling threshold. */ + if (temp.sc->sc_ist & 8) + y = (temp.sc->sc_ist & 7) << 3; + else + y = (temp.sc->sc_ist & 7); - if ((xfer->endpoint->is_synced == 0) || - (y < (xfer->nframes << shift)) || - (XHCI_MFINDEX_GET(-y) >= (128 * 8))) { + /* Range check the IST. */ + if (y < 8) { + y = 0; + } else if (y > 15) { + DPRINTFN(3, "IST(%d) is too big!\n", temp.sc->sc_ist); /* - * If there is data underflow or the pipe - * queue is empty we schedule the transfer a - * few frames ahead of the current frame - * position. Else two isochronous transfers - * might overlap. + * The USB stack minimum isochronous transfer + * size is typically 2x2 ms of payload. If the + * IST makes is above 15 microframes, we have + * an effective scheduling delay of more than + * or equal to 2 milliseconds, which is too + * much. */ - xfer->endpoint->isoc_next = XHCI_MFINDEX_GET(x + (3 * 8)); - xfer->endpoint->is_synced = 1; - temp.do_isoc_sync = 1; - - DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); + } else { + /* + * Subtract one millisecond, because the + * generic code adds that to the latency. + */ + y -= 8; } - /* compute isochronous completion time */ - - y = XHCI_MFINDEX_GET(xfer->endpoint->isoc_next - (x & ~7)); + if (usbd_xfer_get_isochronous_start_frame( + xfer, x, y, 8, XHCI_MFINDEX_GET(-1), &temp.isoc_frame)) { + /* Start isochronous transfer at specified time. */ + temp.do_isoc_sync = 1; - xfer->isoc_time_complete = - usb_isoc_time_expand(&temp.sc->sc_bus, x / 8) + - (y / 8) + (((xfer->nframes << shift) + 7) / 8); + DPRINTFN(3, "start next=%d\n", temp.isoc_frame); + } x = 0; - temp.isoc_frame = xfer->endpoint->isoc_next; temp.trb_type = XHCI_TRB_TYPE_ISOCH; - xfer->endpoint->isoc_next += xfer->nframes << shift; - } else if (xfer->flags_int.control_xfr) { /* check if we should prepend a setup message */ @@ -3072,15 +3065,7 @@ xhci_device_done(struct usb_xfer *xfer, usb_error_t error) static void xhci_device_generic_open(struct usb_xfer *xfer) { - if (xfer->flags_int.isochronous_xfr) { - switch (xfer->xroot->udev->speed) { - case USB_SPEED_FULL: - break; - default: - usb_hs_bandwidth_alloc(xfer); - break; - } - } + DPRINTF("\n"); } static void @@ -3089,16 +3074,6 @@ xhci_device_generic_close(struct usb_xfer *xfer) DPRINTF("\n"); xhci_device_done(xfer, USB_ERR_CANCELLED); - - if (xfer->flags_int.isochronous_xfr) { - switch (xfer->xroot->udev->speed) { - case USB_SPEED_FULL: - break; - default: - usb_hs_bandwidth_free(xfer); - break; - } - } } static void diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index 871f8d729658..436e08db14a1 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -3627,3 +3627,72 @@ usbd_xfer_maxp_was_clamped(struct usb_xfer *xfer) { return (xfer->flags_int.maxp_was_clamped); } + +/* + * The following function computes the next isochronous frame number + * where the first isochronous packet should be queued. + * + * The function returns non-zero if there was a discontinuity. + * Else zero is returned for normal operation. + */ +uint8_t +usbd_xfer_get_isochronous_start_frame(struct usb_xfer *xfer, uint32_t frame_curr, + uint32_t frame_min, uint32_t frame_ms, uint32_t frame_mask, uint32_t *p_frame_start) +{ + uint32_t duration; + uint32_t delta; + uint8_t retval; + uint8_t shift; + + /* Compute time ahead of current schedule. */ + delta = (xfer->endpoint->isoc_next - frame_curr) & frame_mask; + + /* + * Check if it is the first transfer or if the future frame + * delta is less than one millisecond or if the frame delta is + * negative: + */ + if (xfer->endpoint->is_synced == 0 || + delta < (frame_ms + frame_min) || + delta > (frame_mask / 2)) { + /* Schedule transfer 2 milliseconds into the future. */ + xfer->endpoint->isoc_next = (frame_curr + 2 * frame_ms + frame_min) & frame_mask; + xfer->endpoint->is_synced = 1; + + retval = 1; + } else { + retval = 0; + } + + /* Store start time, if any. */ + if (p_frame_start != NULL) + *p_frame_start = xfer->endpoint->isoc_next & frame_mask; + + /* Get relative completion time, in milliseconds. */ + delta = xfer->endpoint->isoc_next - frame_curr + (frame_curr % frame_ms); + delta &= frame_mask; + delta /= frame_ms; + + switch (usbd_get_speed(xfer->xroot->udev)) { + case USB_SPEED_FULL: + shift = 3; + break; + default: + shift = usbd_xfer_get_fps_shift(xfer); + break; + } + + /* Get duration in milliseconds, rounded up. */ + duration = ((xfer->nframes << shift) + 7) / 8; + + /* Compute full 32-bit completion time, in milliseconds. */ + xfer->isoc_time_complete = + usb_isoc_time_expand(xfer->xroot->bus, frame_curr / frame_ms) + + delta + duration; + + /* Compute next isochronous frame. */ + xfer->endpoint->isoc_next += duration * frame_ms; + xfer->endpoint->isoc_next &= frame_mask; + + return (retval); +} diff --git a/sys/dev/usb/usb_transfer.h b/sys/dev/usb/usb_transfer.h index c6b97e1ab3c5..91f4f6790b31 100644 --- a/sys/dev/usb/usb_transfer.h +++ b/sys/dev/usb/usb_transfer.h @@ -250,5 +250,6 @@ void usbd_transfer_timeout_ms(struct usb_xfer *xfer, void (*cb) (void *arg), usb_timeout_t ms); usb_timeout_t usbd_get_dma_delay(struct usb_device *udev); void usbd_transfer_power_ref(struct usb_xfer *xfer, int val); +uint8_t usbd_xfer_get_isochronous_start_frame(struct usb_xfer *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t *); #endif /* _USB_TRANSFER_H_ */ From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:10:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5B889659DEF; Sat, 10 Jul 2021 19:10: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 4GMfkS29rHz4jtp; Sat, 10 Jul 2021 19:10: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 27E855932; Sat, 10 Jul 2021 19:10: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 16AJAeBp046580; Sat, 10 Jul 2021 19:10:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJAe4d046579; Sat, 10 Jul 2021 19:10:40 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:10:40 GMT Message-Id: <202107101910.16AJAe4d046579@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: e50fd6778435 - stable/13 - Improve handling of USB device re-open in the LibUSB v1.x API. 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/13 X-Git-Reftype: branch X-Git-Commit: e50fd67784355030aedca8704223456c056fdeb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:10:40 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e50fd67784355030aedca8704223456c056fdeb4 commit e50fd67784355030aedca8704223456c056fdeb4 Author: Hans Petter Selasky AuthorDate: 2021-06-11 15:06:10 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:10:10 +0000 Improve handling of USB device re-open in the LibUSB v1.x API. Make sure the "device_is_gone" flag is cleared after every successful open, so that the "device_is_gone" flag doesn't persist forever. Found by: sergii.dmytruk@3mdeb.com PR: 256296 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 6847ea50196f1a685be408a24f01cb8d407da19c) --- lib/libusb/libusb10.c | 9 +++++++++ lib/libusb/libusb10_io.c | 12 ++++++++++-- lib/libusb/libusb20.c | 5 +++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index 1c45b87d8f0b..ffe0cf3f366a 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -529,6 +529,15 @@ libusb_open(libusb_device *dev, libusb_device_handle **devh) libusb_unref_device(dev); return (LIBUSB_ERROR_NO_MEM); } + + /* + * Clear the device gone flag, in case the device was opened + * after a re-attach, to allow new transaction: + */ + CTX_LOCK(ctx); + dev->device_is_gone = 0; + CTX_UNLOCK(ctx); + libusb10_add_pollfd(ctx, &dev->dev_poll, pdev, libusb20_dev_get_fd(pdev), POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM); diff --git a/lib/libusb/libusb10_io.c b/lib/libusb/libusb10_io.c index 53f5b040436d..0e32fc31c8e0 100644 --- a/lib/libusb/libusb10_io.c +++ b/lib/libusb/libusb10_io.c @@ -165,8 +165,16 @@ libusb10_handle_events_sub(struct libusb_context *ctx, struct timeval *tv) err = libusb20_dev_process(ppdev[i]); if (err) { - /* set device is gone */ - dev->device_is_gone = 1; + /* + * When the device is opened + * set the "device_is_gone" + * flag. This prevents the + * client from submitting new + * USB transfers to a detached + * device. + */ + if (ppdev[i]->is_opened) + dev->device_is_gone = 1; /* remove USB device from polling loop */ libusb10_remove_pollfd(dev->ctx, &dev->dev_poll); diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 6c2bf721bea9..4323552b83ad 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -608,6 +608,11 @@ libusb20_dev_close(struct libusb20_device *pdev) pdev->is_opened = 0; + /* + * Make sure libusb20_tr_get_pointer() fails: + */ + pdev->nTransfer = 0; + /* * The following variable is only used by the libusb v0.1 * compat layer: From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:14:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 217D0659F0D; Sat, 10 Jul 2021 19:14: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 4GMfpc754tz4kct; Sat, 10 Jul 2021 19:14: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 CFE4F5D84; Sat, 10 Jul 2021 19:14: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 16AJEG8n048616; Sat, 10 Jul 2021 19:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJEGOi048615; Sat, 10 Jul 2021 19:14:16 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:14:16 GMT Message-Id: <202107101914.16AJEGOi048615@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: 1e68639f62f9 - stable/12 - Improve handling of USB device re-open in the LibUSB v1.x API. 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: 1e68639f62f9d965cd46e6f5ca9c3dde0941d704 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:14:17 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1e68639f62f9d965cd46e6f5ca9c3dde0941d704 commit 1e68639f62f9d965cd46e6f5ca9c3dde0941d704 Author: Hans Petter Selasky AuthorDate: 2021-06-11 15:06:10 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:13:51 +0000 Improve handling of USB device re-open in the LibUSB v1.x API. Make sure the "device_is_gone" flag is cleared after every successful open, so that the "device_is_gone" flag doesn't persist forever. Found by: sergii.dmytruk@3mdeb.com PR: 256296 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 6847ea50196f1a685be408a24f01cb8d407da19c) --- lib/libusb/libusb10.c | 9 +++++++++ lib/libusb/libusb10_io.c | 12 ++++++++++-- lib/libusb/libusb20.c | 5 +++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index 1c45b87d8f0b..ffe0cf3f366a 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -529,6 +529,15 @@ libusb_open(libusb_device *dev, libusb_device_handle **devh) libusb_unref_device(dev); return (LIBUSB_ERROR_NO_MEM); } + + /* + * Clear the device gone flag, in case the device was opened + * after a re-attach, to allow new transaction: + */ + CTX_LOCK(ctx); + dev->device_is_gone = 0; + CTX_UNLOCK(ctx); + libusb10_add_pollfd(ctx, &dev->dev_poll, pdev, libusb20_dev_get_fd(pdev), POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM); diff --git a/lib/libusb/libusb10_io.c b/lib/libusb/libusb10_io.c index 53f5b040436d..0e32fc31c8e0 100644 --- a/lib/libusb/libusb10_io.c +++ b/lib/libusb/libusb10_io.c @@ -165,8 +165,16 @@ libusb10_handle_events_sub(struct libusb_context *ctx, struct timeval *tv) err = libusb20_dev_process(ppdev[i]); if (err) { - /* set device is gone */ - dev->device_is_gone = 1; + /* + * When the device is opened + * set the "device_is_gone" + * flag. This prevents the + * client from submitting new + * USB transfers to a detached + * device. + */ + if (ppdev[i]->is_opened) + dev->device_is_gone = 1; /* remove USB device from polling loop */ libusb10_remove_pollfd(dev->ctx, &dev->dev_poll); diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 6c2bf721bea9..4323552b83ad 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -608,6 +608,11 @@ libusb20_dev_close(struct libusb20_device *pdev) pdev->is_opened = 0; + /* + * Make sure libusb20_tr_get_pointer() fails: + */ + pdev->nTransfer = 0; + /* * The following variable is only used by the libusb v0.1 * compat layer: From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:18:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D5A1E659FB3; Sat, 10 Jul 2021 19:18: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 4GMfw35bk6z4lC9; Sat, 10 Jul 2021 19:18: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 A48D75B9E; Sat, 10 Jul 2021 19:18: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 16AJIxD6049094; Sat, 10 Jul 2021 19:18:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJIxob049093; Sat, 10 Jul 2021 19:18:59 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:18:59 GMT Message-Id: <202107101918.16AJIxob049093@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: 5e0a56256cb0 - stable/13 - ibstat: Include prototype for sysctlbyname(). 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/13 X-Git-Reftype: branch X-Git-Commit: 5e0a56256cb0390c7b7f89e8dcf5398d1a0f1577 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:18:59 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5e0a56256cb0390c7b7f89e8dcf5398d1a0f1577 commit 5e0a56256cb0390c7b7f89e8dcf5398d1a0f1577 Author: Hans Petter Selasky AuthorDate: 2021-05-27 07:39:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:17:24 +0000 ibstat: Include prototype for sysctlbyname(). Fixes the following compile warning: implicit declaration of function 'sysctlbyname' is invalid in C99 [-Wimplicit-function-declaration] Found by: J87 Differential Revision: https://reviews.freebsd.org/D30484 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 16fa3dcba027d13dcda9ee78e6057e3e5a79f80c) --- contrib/ofed/infiniband-diags/src/ibstat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/ofed/infiniband-diags/src/ibstat.c b/contrib/ofed/infiniband-diags/src/ibstat.c index 6e08fad409ca..e4f3608dfd76 100644 --- a/contrib/ofed/infiniband-diags/src/ibstat.c +++ b/contrib/ofed/infiniband-diags/src/ibstat.c @@ -48,6 +48,7 @@ #include #include #include +#include #include From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:19:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E607C65A16A; Sat, 10 Jul 2021 19:19: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 4GMfw466Yxz4lHT; Sat, 10 Jul 2021 19:19: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 BAA4F58DC; Sat, 10 Jul 2021 19:19: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 16AJJ0Tl049125; Sat, 10 Jul 2021 19:19:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJJ0bx049124; Sat, 10 Jul 2021 19:19:00 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:19:00 GMT Message-Id: <202107101919.16AJJ0bx049124@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: 77f7133bd55c - stable/13 - Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(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/13 X-Git-Reftype: branch X-Git-Commit: 77f7133bd55c3f6a73b6428ceaa8c266940a55f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:19:01 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=77f7133bd55c3f6a73b6428ceaa8c266940a55f3 commit 77f7133bd55c3f6a73b6428ceaa8c266940a55f3 Author: Hans Petter Selasky AuthorDate: 2021-06-04 08:28:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:17:26 +0000 Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(4). Submitted by: fbbz@synack.eu PR: 253374 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit d4cf41a99b405c73288aea81e3c4580d1de18435) --- sys/dev/usb/net/if_ure.c | 965 ++++++++++++++++++++++++++++++++------------ sys/dev/usb/net/if_urereg.h | 200 ++++++++- 2 files changed, 890 insertions(+), 275 deletions(-) diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c index 30fcee59cce3..2e4053a0e0c6 100644 --- a/sys/dev/usb/net/if_ure.c +++ b/sys/dev/usb/net/if_ure.c @@ -96,16 +96,17 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN, &ure_debug, 0, */ static const STRUCT_USB_HOST_ID ure_devs[] = { #define URE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } - URE_DEV(LENOVO, RTL8153, 0), + URE_DEV(LENOVO, RTL8153, URE_FLAG_8153), URE_DEV(LENOVO, TBT3LAN, 0), URE_DEV(LENOVO, TBT3LANGEN2, 0), URE_DEV(LENOVO, ONELINK, 0), URE_DEV(LENOVO, USBCLAN, 0), URE_DEV(LENOVO, USBCLANGEN2, 0), - URE_DEV(NVIDIA, RTL8153, 0), + URE_DEV(NVIDIA, RTL8153, URE_FLAG_8153), URE_DEV(REALTEK, RTL8152, URE_FLAG_8152), - URE_DEV(REALTEK, RTL8153, 0), - URE_DEV(TPLINK, RTL8153, 0), + URE_DEV(REALTEK, RTL8153, URE_FLAG_8153), + URE_DEV(TPLINK, RTL8153, URE_FLAG_8153), + URE_DEV(REALTEK, RTL8156, URE_FLAG_8156), #undef URE_DEV }; @@ -141,6 +142,7 @@ static int ure_write_2(struct ure_softc *, uint16_t, uint16_t, uint32_t); static int ure_write_4(struct ure_softc *, uint16_t, uint16_t, uint32_t); static uint16_t ure_ocp_reg_read(struct ure_softc *, uint16_t); static void ure_ocp_reg_write(struct ure_softc *, uint16_t, uint16_t); +static void ure_sram_write(struct ure_softc *, uint16_t, uint16_t); static int ure_sysctl_chipver(SYSCTL_HANDLER_ARGS); @@ -149,96 +151,21 @@ static int ure_attach_post_sub(struct usb_ether *); static void ure_reset(struct ure_softc *); static int ure_ifmedia_upd(struct ifnet *); static void ure_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static int ure_ioctl(struct ifnet *, u_long, caddr_t); +static void ure_add_media_types(struct ure_softc *); +static void ure_link_state(struct ure_softc *sc); +static int ure_get_link_status(struct ure_softc *); +static int ure_ioctl(struct ifnet *, u_long, caddr_t); static void ure_rtl8152_init(struct ure_softc *); +static void ure_rtl8152_nic_reset(struct ure_softc *); static void ure_rtl8153_init(struct ure_softc *); +static void ure_rtl8153b_init(struct ure_softc *); +static void ure_rtl8153b_nic_reset(struct ure_softc *); static void ure_disable_teredo(struct ure_softc *); -static void ure_init_fifo(struct ure_softc *); +static void ure_enable_aldps(struct ure_softc *, bool); +static uint16_t ure_phy_status(struct ure_softc *, uint16_t); static void ure_rxcsum(int capenb, struct ure_rxpkt *rp, struct mbuf *m); static int ure_txcsum(struct mbuf *m, int caps, uint32_t *regout); -static const struct usb_config ure_config_rx[URE_N_TRANSFER] = { - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, -#if URE_N_TRANSFER == 4 - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, -#endif -}; - -static const struct usb_config ure_config_tx[URE_N_TRANSFER] = { - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, -#if URE_N_TRANSFER == 4 - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, -#endif -}; - static device_method_t ure_methods[] = { /* Device interface. */ DEVMETHOD(device_probe, ure_probe), @@ -283,6 +210,20 @@ static const struct usb_ether_methods ure_ue_methods = { .ue_mii_sts = ure_ifmedia_sts, }; +#define URE_SETBIT_1(sc, reg, index, x) \ + ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) | (x)) +#define URE_SETBIT_2(sc, reg, index, x) \ + ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) | (x)) +#define URE_SETBIT_4(sc, reg, index, x) \ + ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) | (x)) + +#define URE_CLRBIT_1(sc, reg, index, x) \ + ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) & ~(x)) +#define URE_CLRBIT_2(sc, reg, index, x) \ + ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) & ~(x)) +#define URE_CLRBIT_4(sc, reg, index, x) \ + ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) & ~(x)) + static int ure_ctl(struct ure_softc *sc, uint8_t rw, uint16_t val, uint16_t index, void *buf, int len) @@ -435,6 +376,13 @@ ure_ocp_reg_write(struct ure_softc *sc, uint16_t addr, uint16_t data) ure_write_2(sc, reg, URE_MCU_TYPE_PLA, data); } +static void +ure_sram_write(struct ure_softc *sc, uint16_t addr, uint16_t data) +{ + ure_ocp_reg_write(sc, URE_OCP_SRAM_ADDR, addr); + ure_ocp_reg_write(sc, URE_OCP_SRAM_DATA, data); +} + static int ure_miibus_readreg(device_t dev, int phy, int reg) { @@ -558,25 +506,58 @@ ure_attach(device_t dev) struct usb_attach_arg *uaa = device_get_ivars(dev); struct ure_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; + struct usb_config ure_config_rx[URE_MAX_RX]; + struct usb_config ure_config_tx[URE_MAX_TX]; uint8_t iface_index; int error; + int i; sc->sc_flags = USB_GET_DRIVER_INFO(uaa); device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); iface_index = URE_IFACE_IDX; + + if (sc->sc_flags & (URE_FLAG_8153 | URE_FLAG_8153B)) + sc->sc_rxbufsz = URE_8153_RX_BUFSZ; + else if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) + sc->sc_rxbufsz = URE_8156_RX_BUFSZ; + else + sc->sc_rxbufsz = URE_8152_RX_BUFSZ; + + for (i = 0; i < URE_MAX_RX; i++) { + ure_config_rx[i] = (struct usb_config) { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .bufsize = sc->sc_rxbufsz, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = ure_bulk_read_callback, + .timeout = 0, /* no timeout */ + }; + } error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_rx_xfer, - ure_config_rx, URE_N_TRANSFER, sc, &sc->sc_mtx); + ure_config_rx, URE_MAX_RX, sc, &sc->sc_mtx); if (error != 0) { device_printf(dev, "allocating USB RX transfers failed\n"); goto detach; } + for (i = 0; i < URE_MAX_TX; i++) { + ure_config_tx[i] = (struct usb_config) { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_OUT, + .bufsize = URE_TX_BUFSZ, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = ure_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ + }; + } error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_tx_xfer, - ure_config_tx, URE_N_TRANSFER, sc, &sc->sc_mtx); + ure_config_tx, URE_MAX_TX, sc, &sc->sc_mtx); if (error != 0) { - usbd_transfer_unsetup(sc->sc_rx_xfer, URE_N_TRANSFER); + usbd_transfer_unsetup(sc->sc_rx_xfer, URE_MAX_RX); device_printf(dev, "allocating USB TX transfers failed\n"); goto detach; } @@ -605,8 +586,8 @@ ure_detach(device_t dev) struct ure_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; - usbd_transfer_unsetup(sc->sc_tx_xfer, URE_N_TRANSFER); - usbd_transfer_unsetup(sc->sc_rx_xfer, URE_N_TRANSFER); + usbd_transfer_unsetup(sc->sc_tx_xfer, URE_MAX_TX); + usbd_transfer_unsetup(sc->sc_rx_xfer, URE_MAX_RX); uether_ifdetach(ue); mtx_destroy(&sc->sc_mtx); @@ -785,7 +766,7 @@ tr_setup: caps = if_getcapenable(ifp); pos = 0; - rem = URE_TRANSFER_SIZE; + rem = URE_TX_BUFSZ; while (rem > sizeof(txpkt)) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) @@ -895,21 +876,51 @@ ure_read_chipver(struct ure_softc *sc) switch (ver) { case 0x4c00: sc->sc_chip |= URE_CHIP_VER_4C00; + sc->sc_flags = URE_FLAG_8152; break; case 0x4c10: sc->sc_chip |= URE_CHIP_VER_4C10; + sc->sc_flags = URE_FLAG_8152; break; case 0x5c00: sc->sc_chip |= URE_CHIP_VER_5C00; + sc->sc_flags = URE_FLAG_8153; break; case 0x5c10: sc->sc_chip |= URE_CHIP_VER_5C10; + sc->sc_flags = URE_FLAG_8153; break; case 0x5c20: sc->sc_chip |= URE_CHIP_VER_5C20; + sc->sc_flags = URE_FLAG_8153; break; case 0x5c30: sc->sc_chip |= URE_CHIP_VER_5C30; + sc->sc_flags = URE_FLAG_8153; + break; + case 0x6000: + sc->sc_flags = URE_FLAG_8153B; + sc->sc_chip |= URE_CHIP_VER_6000; + break; + case 0x6010: + sc->sc_flags = URE_FLAG_8153B; + sc->sc_chip |= URE_CHIP_VER_6010; + break; + case 0x7020: + sc->sc_flags = URE_FLAG_8156; + sc->sc_chip |= URE_CHIP_VER_7020; + break; + case 0x7030: + sc->sc_flags = URE_FLAG_8156; + sc->sc_chip |= URE_CHIP_VER_7030; + break; + case 0x7400: + sc->sc_flags = URE_FLAG_8156B; + sc->sc_chip |= URE_CHIP_VER_7400; + break; + case 0x7410: + sc->sc_flags = URE_FLAG_8156B; + sc->sc_chip |= URE_CHIP_VER_7410; break; default: device_printf(sc->sc_ue.ue_dev, @@ -949,6 +960,8 @@ ure_attach_post(struct usb_ether *ue) /* Initialize controller and get station address. */ if (sc->sc_flags & URE_FLAG_8152) ure_rtl8152_init(sc); + else if (sc->sc_flags & (URE_FLAG_8153B | URE_FLAG_8156 | URE_FLAG_8156B)) + ure_rtl8153b_init(sc); else ure_rtl8153_init(sc); @@ -972,7 +985,7 @@ static int ure_attach_post_sub(struct usb_ether *ue) { struct sysctl_ctx_list *sctx; - struct sysctl_oid *soid; + struct sysctl_oid *soid; struct ure_softc *sc; struct ifnet *ifp; int error; @@ -1001,9 +1014,19 @@ ure_attach_post_sub(struct usb_ether *ue) if_setcapenable(ifp, if_getcapabilities(ifp)); mtx_lock(&Giant); - error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, - uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, - BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, 0); + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ifmedia_init(&sc->sc_ifmedia, IFM_IMASK, ure_ifmedia_upd, + ure_ifmedia_sts); + ure_add_media_types(sc); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO); + sc->sc_ifmedia.ifm_media = IFM_ETHER | IFM_AUTO; + error = 0; + } else { + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, 0); + } mtx_unlock(&Giant); sctx = device_get_sysctl_ctx(sc->sc_ue.ue_dev); @@ -1022,6 +1045,7 @@ ure_init(struct usb_ether *ue) struct ure_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); uint16_t cpcr; + uint32_t reg; URE_LOCK_ASSERT(sc, MA_OWNED); @@ -1031,7 +1055,10 @@ ure_init(struct usb_ether *ue) /* Cancel pending I/O. */ ure_stop(ue); - ure_reset(sc); + if (sc->sc_flags & (URE_FLAG_8153B | URE_FLAG_8156 | URE_FLAG_8156B)) + ure_rtl8153b_nic_reset(sc); + else + ure_reset(sc); /* Set MAC address. */ ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_CONFIG); @@ -1039,13 +1066,50 @@ ure_init(struct usb_ether *ue) IF_LLADDR(ifp), 8); ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_NORAML); + /* Set RX EARLY timeout and size */ + if (sc->sc_flags & URE_FLAG_8153) { + switch (usbd_get_speed(sc->sc_ue.ue_udev)) { + case USB_SPEED_SUPER: + reg = URE_COALESCE_SUPER / 8; + break; + case USB_SPEED_HIGH: + reg = URE_COALESCE_HIGH / 8; + break; + default: + reg = URE_COALESCE_SLOW / 8; + break; + } + ure_write_2(sc, URE_USB_RX_EARLY_AGG, URE_MCU_TYPE_USB, reg); + reg = URE_8153_RX_BUFSZ - (URE_FRAMELEN(if_getmtu(ifp)) + + sizeof(struct ure_rxpkt) + URE_RXPKT_ALIGN); + ure_write_2(sc, URE_USB_RX_EARLY_SIZE, URE_MCU_TYPE_USB, reg / 4); + } else if (sc->sc_flags & URE_FLAG_8153B) { + ure_write_2(sc, URE_USB_RX_EARLY_AGG, URE_MCU_TYPE_USB, 158); + ure_write_2(sc, URE_USB_RX_EXTRA_AGG_TMR, URE_MCU_TYPE_USB, 1875); + reg = URE_8153_RX_BUFSZ - (URE_FRAMELEN(if_getmtu(ifp)) + + sizeof(struct ure_rxpkt) + URE_RXPKT_ALIGN); + ure_write_2(sc, URE_USB_RX_EARLY_SIZE, URE_MCU_TYPE_USB, reg / 8); + ure_write_1(sc, URE_USB_UPT_RXDMA_OWN, URE_MCU_TYPE_USB, + URE_OWN_UPDATE | URE_OWN_CLEAR); + } else if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ure_write_2(sc, URE_USB_RX_EARLY_AGG, URE_MCU_TYPE_USB, 80); + ure_write_2(sc, URE_USB_RX_EXTRA_AGG_TMR, URE_MCU_TYPE_USB, 1875); + reg = URE_8156_RX_BUFSZ - (URE_FRAMELEN(if_getmtu(ifp)) + + sizeof(struct ure_rxpkt) + URE_RXPKT_ALIGN); + ure_write_2(sc, URE_USB_RX_EARLY_SIZE, URE_MCU_TYPE_USB, reg / 8); + ure_write_1(sc, URE_USB_UPT_RXDMA_OWN, URE_MCU_TYPE_USB, + URE_OWN_UPDATE | URE_OWN_CLEAR); + } + + if (sc->sc_flags & URE_FLAG_8156B) { + URE_CLRBIT_2(sc, URE_USB_FW_TASK, URE_MCU_TYPE_USB, URE_FC_PATCH_TASK); + uether_pause(&sc->sc_ue, hz / 500); + URE_SETBIT_2(sc, URE_USB_FW_TASK, URE_MCU_TYPE_USB, URE_FC_PATCH_TASK); + } + /* Reset the packet filter. */ - ure_write_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA) & - ~URE_FMC_FCR_MCU_EN); - ure_write_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA) | - URE_FMC_FCR_MCU_EN); + URE_CLRBIT_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, URE_FMC_FCR_MCU_EN); + URE_SETBIT_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, URE_FMC_FCR_MCU_EN); /* Enable RX VLANs if enabled */ cpcr = ure_read_2(sc, URE_PLA_CPCR, URE_MCU_TYPE_PLA); @@ -1059,13 +1123,9 @@ ure_init(struct usb_ether *ue) ure_write_2(sc, URE_PLA_CPCR, URE_MCU_TYPE_PLA, cpcr); /* Enable transmit and receive. */ - ure_write_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, - ure_read_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA) | URE_CR_RE | - URE_CR_TE); + URE_SETBIT_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, URE_CR_RE | URE_CR_TE); - ure_write_2(sc, URE_PLA_MISC_1, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_MISC_1, URE_MCU_TYPE_PLA) & - ~URE_RXDY_GATED_EN); + URE_CLRBIT_2(sc, URE_PLA_MISC_1, URE_MCU_TYPE_PLA, URE_RXDY_GATED_EN); /* Configure RX filters. */ ure_rxfilter(ue); @@ -1084,26 +1144,31 @@ ure_tick(struct usb_ether *ue) { struct ure_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct mii_data *mii = GET_MII(sc); + struct mii_data *mii; URE_LOCK_ASSERT(sc, MA_OWNED); (void)ifp; - for (int i = 0; i < URE_N_TRANSFER; i++) + for (int i = 0; i < URE_MAX_RX; i++) DEVPRINTFN(13, sc->sc_ue.ue_dev, "rx[%d] = %d\n", i, USB_GET_STATE(sc->sc_rx_xfer[i])); - for (int i = 0; i < URE_N_TRANSFER; i++) + for (int i = 0; i < URE_MAX_TX; i++) DEVPRINTFN(13, sc->sc_ue.ue_dev, "tx[%d] = %d\n", i, USB_GET_STATE(sc->sc_tx_xfer[i])); - mii_tick(mii); - if ((sc->sc_flags & URE_FLAG_LINK) == 0 - && mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - sc->sc_flags |= URE_FLAG_LINK; - sc->sc_rxstarted = 0; - ure_start(ue); + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ure_link_state(sc); + } else { + mii = GET_MII(sc); + mii_tick(mii); + if ((sc->sc_flags & URE_FLAG_LINK) == 0 + && mii->mii_media_status & IFM_ACTIVE && + IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + sc->sc_flags |= URE_FLAG_LINK; + sc->sc_rxstarted = 0; + ure_start(ue); + } } } @@ -1171,11 +1236,11 @@ ure_start(struct usb_ether *ue) if (!sc->sc_rxstarted) { sc->sc_rxstarted = 1; - for (i = 0; i != URE_N_TRANSFER; i++) + for (i = 0; i != URE_MAX_RX; i++) usbd_transfer_start(sc->sc_rx_xfer[i]); } - for (i = 0; i != URE_N_TRANSFER; i++) + for (i = 0; i != URE_MAX_TX; i++) usbd_transfer_start(sc->sc_tx_xfer[i]); } @@ -1203,12 +1268,73 @@ static int ure_ifmedia_upd(struct ifnet *ifp) { struct ure_softc *sc = ifp->if_softc; - struct mii_data *mii = GET_MII(sc); + struct ifmedia *ifm; + struct mii_data *mii; struct mii_softc *miisc; + int gig; + int reg; + int anar; + int locked; int error; - URE_LOCK_ASSERT(sc, MA_OWNED); + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ifm = &sc->sc_ifmedia; + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + return (EINVAL); + + locked = mtx_owned(&sc->sc_mtx); + if (!locked) + URE_LOCK(sc); + reg = ure_ocp_reg_read(sc, 0xa5d4); + reg &= ~URE_ADV_2500TFDX; + + anar = gig = 0; + switch (IFM_SUBTYPE(ifm->ifm_media)) { + case IFM_AUTO: + anar |= ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10; + gig |= GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX; + reg |= URE_ADV_2500TFDX; + break; + case IFM_2500_T: + anar |= ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10; + gig |= GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX; + reg |= URE_ADV_2500TFDX; + ifp->if_baudrate = IF_Mbps(2500); + break; + case IFM_1000_T: + anar |= ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10; + gig |= GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX; + ifp->if_baudrate = IF_Gbps(1); + break; + case IFM_100_TX: + anar |= ANAR_TX | ANAR_TX_FD; + ifp->if_baudrate = IF_Mbps(100); + break; + case IFM_10_T: + anar |= ANAR_10 | ANAR_10_FD; + ifp->if_baudrate = IF_Mbps(10); + break; + default: + device_printf(sc->sc_ue.ue_dev, "unsupported media type\n"); + if (!locked) + URE_UNLOCK(sc); + return (EINVAL); + } + + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_ANAR * 2, + anar | ANAR_PAUSE_ASYM | ANAR_FC); + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_100T2CR * 2, gig); + ure_ocp_reg_write(sc, 0xa5d4, reg); + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_BMCR, + BMCR_AUTOEN | BMCR_STARTNEG); + if (!locked) + URE_UNLOCK(sc); + return (0); + } + mii = GET_MII(sc); + + URE_LOCK_ASSERT(sc, MA_OWNED); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); @@ -1223,8 +1349,34 @@ ure_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ure_softc *sc; struct mii_data *mii; + uint16_t status; sc = ifp->if_softc; + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + URE_LOCK(sc); + ifmr->ifm_status = IFM_AVALID; + if (ure_get_link_status(sc)) { + ifmr->ifm_status |= IFM_ACTIVE; + status = ure_read_2(sc, URE_PLA_PHYSTATUS, + URE_MCU_TYPE_PLA); + if ((status & URE_PHYSTATUS_FDX) || + (status & URE_PHYSTATUS_2500MBPS)) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; + if (status & URE_PHYSTATUS_10MBPS) + ifmr->ifm_active |= IFM_10_T; + else if (status & URE_PHYSTATUS_100MBPS) + ifmr->ifm_active |= IFM_100_TX; + else if (status & URE_PHYSTATUS_1000MBPS) + ifmr->ifm_active |= IFM_1000_T; + else if (status & URE_PHYSTATUS_2500MBPS) + ifmr->ifm_active |= IFM_2500_T; + } + URE_UNLOCK(sc); + return; + } + mii = GET_MII(sc); URE_LOCK(sc); @@ -1234,6 +1386,54 @@ ure_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) URE_UNLOCK(sc); } +static void +ure_add_media_types(struct ure_softc *sc) +{ + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_2500_T | IFM_FDX, 0, NULL); +} + +static void +ure_link_state(struct ure_softc *sc) +{ + struct ifnet *ifp = uether_getifp(&sc->sc_ue); + + if (ure_get_link_status(sc)) { + if (ifp->if_link_state != LINK_STATE_UP) { + if_link_state_change(ifp, LINK_STATE_UP); + /* Enable transmit and receive. */ + URE_SETBIT_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, URE_CR_RE | URE_CR_TE); + + if (ure_read_2(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA) & + URE_PHYSTATUS_2500MBPS) + URE_CLRBIT_2(sc, URE_PLA_MAC_PWR_CTRL4, URE_MCU_TYPE_PLA, 0x40); + else + URE_SETBIT_2(sc, URE_PLA_MAC_PWR_CTRL4, URE_MCU_TYPE_PLA, 0x40); + } + } else { + if (ifp->if_link_state != LINK_STATE_DOWN) { + if_link_state_change(ifp, LINK_STATE_DOWN); + } + } +} + +static int +ure_get_link_status(struct ure_softc *sc) +{ + if (ure_read_2(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA) & + URE_PHYSTATUS_LINK) { + sc->sc_flags |= URE_FLAG_LINK; + return (1); + } else { + sc->sc_flags &= ~URE_FLAG_LINK; + return (0); + } +} + static int ure_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { @@ -1298,8 +1498,17 @@ ure_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) URE_UNLOCK(sc); break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) + error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); + else + error = uether_ioctl(ifp, cmd, data); + break; + default: error = uether_ioctl(ifp, cmd, data); + break; } return (error); @@ -1310,27 +1519,18 @@ ure_rtl8152_init(struct ure_softc *sc) { uint32_t pwrctrl; - /* Disable ALDPS. */ - ure_ocp_reg_write(sc, URE_OCP_ALDPS_CONFIG, URE_ENPDNPS | URE_LINKENA | - URE_DIS_SDSAVE); - uether_pause(&sc->sc_ue, hz / 50); + ure_enable_aldps(sc, false); if (sc->sc_chip & URE_CHIP_VER_4C00) { - ure_write_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA) & - ~URE_LED_MODE_MASK); + URE_CLRBIT_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, URE_LED_MODE_MASK); } - ure_write_2(sc, URE_USB_UPS_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_UPS_CTRL, URE_MCU_TYPE_USB) & - ~URE_POWER_CUT); - ure_write_2(sc, URE_USB_PM_CTRL_STATUS, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_PM_CTRL_STATUS, URE_MCU_TYPE_USB) & - ~URE_RESUME_INDICATE); + URE_CLRBIT_2(sc, URE_USB_UPS_CTRL, URE_MCU_TYPE_USB, URE_POWER_CUT); + + URE_CLRBIT_2(sc, URE_USB_PM_CTRL_STATUS, URE_MCU_TYPE_USB, URE_RESUME_INDICATE); + + URE_SETBIT_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA, URE_TX_10M_IDLE_EN | URE_PFM_PWM_SWITCH); - ure_write_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA) | - URE_TX_10M_IDLE_EN | URE_PFM_PWM_SWITCH); pwrctrl = ure_read_4(sc, URE_PLA_MAC_PWR_CTRL, URE_MCU_TYPE_PLA); pwrctrl &= ~URE_MCU_CLK_RATIO_MASK; pwrctrl |= URE_MCU_CLK_RATIO | URE_D3_CLK_GATED_EN; @@ -1340,16 +1540,11 @@ ure_rtl8152_init(struct ure_softc *sc) URE_SPDWN_LINKCHG_MSK); /* Enable Rx aggregation. */ - ure_write_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB) & - ~URE_RX_AGG_DISABLE); + URE_CLRBIT_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, URE_RX_AGG_DISABLE | URE_RX_ZERO_EN); - /* Disable ALDPS. */ - ure_ocp_reg_write(sc, URE_OCP_ALDPS_CONFIG, URE_ENPDNPS | URE_LINKENA | - URE_DIS_SDSAVE); - uether_pause(&sc->sc_ue, hz / 50); + ure_enable_aldps(sc, false); - ure_init_fifo(sc); + ure_rtl8152_nic_reset(sc); ure_write_1(sc, URE_USB_TX_AGG, URE_MCU_TYPE_USB, URE_TX_AGG_MAX_THRESHOLD); @@ -1365,10 +1560,7 @@ ure_rtl8153_init(struct ure_softc *sc) uint8_t u1u2[8]; int i; - /* Disable ALDPS. */ - ure_ocp_reg_write(sc, URE_OCP_POWER_CFG, - ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) & ~URE_EN_ALDPS); - uether_pause(&sc->sc_ue, hz / 50); + ure_enable_aldps(sc, false); memset(u1u2, 0x00, sizeof(u1u2)); ure_write_mem(sc, URE_USB_TOLERANCE, @@ -1395,9 +1587,7 @@ ure_rtl8153_init(struct ure_softc *sc) device_printf(sc->sc_ue.ue_dev, "timeout waiting for phy to stabilize\n"); - ure_write_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB) & - ~URE_U2P3_ENABLE); + URE_CLRBIT_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB, URE_U2P3_ENABLE); if (sc->sc_chip & URE_CHIP_VER_5C10) { val = ure_read_2(sc, URE_USB_SSPHYLINK2, URE_MCU_TYPE_USB); @@ -1405,14 +1595,10 @@ ure_rtl8153_init(struct ure_softc *sc) val |= URE_PWD_DN_SCALE(96); ure_write_2(sc, URE_USB_SSPHYLINK2, URE_MCU_TYPE_USB, val); - ure_write_1(sc, URE_USB_USB2PHY, URE_MCU_TYPE_USB, - ure_read_1(sc, URE_USB_USB2PHY, URE_MCU_TYPE_USB) | - URE_USB2PHY_L1 | URE_USB2PHY_SUSPEND); - } else if (sc->sc_chip & URE_CHIP_VER_5C20) { - ure_write_1(sc, URE_PLA_DMY_REG0, URE_MCU_TYPE_PLA, - ure_read_1(sc, URE_PLA_DMY_REG0, URE_MCU_TYPE_PLA) & - ~URE_ECM_ALDPS); - } + URE_SETBIT_1(sc, URE_USB_USB2PHY, URE_MCU_TYPE_USB, URE_USB2PHY_L1 | URE_USB2PHY_SUSPEND); + } else if (sc->sc_chip & URE_CHIP_VER_5C20) + URE_CLRBIT_1(sc, URE_PLA_DMY_REG0, URE_MCU_TYPE_PLA, URE_ECM_ALDPS); + if (sc->sc_chip & (URE_CHIP_VER_5C20 | URE_CHIP_VER_5C30)) { val = ure_read_1(sc, URE_USB_CSR_DUMMY1, URE_MCU_TYPE_USB); if (ure_read_2(sc, URE_USB_BURST_SIZE, URE_MCU_TYPE_USB) == @@ -1423,17 +1609,11 @@ ure_rtl8153_init(struct ure_softc *sc) ure_write_1(sc, URE_USB_CSR_DUMMY1, URE_MCU_TYPE_USB, val); } - ure_write_1(sc, URE_USB_CSR_DUMMY2, URE_MCU_TYPE_USB, - ure_read_1(sc, URE_USB_CSR_DUMMY2, URE_MCU_TYPE_USB) | - URE_EP4_FULL_FC); + URE_SETBIT_1(sc, URE_USB_CSR_DUMMY2, URE_MCU_TYPE_USB, URE_EP4_FULL_FC); - ure_write_2(sc, URE_USB_WDT11_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_WDT11_CTRL, URE_MCU_TYPE_USB) & - ~URE_TIMER11_EN); + URE_CLRBIT_2(sc, URE_USB_WDT11_CTRL, URE_MCU_TYPE_USB, URE_TIMER11_EN); - ure_write_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA) & - ~URE_LED_MODE_MASK); + URE_CLRBIT_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, URE_LED_MODE_MASK); if ((sc->sc_chip & URE_CHIP_VER_5C10) && usbd_get_speed(sc->sc_ue.ue_udev) != USB_SPEED_SUPER) @@ -1450,12 +1630,9 @@ ure_rtl8153_init(struct ure_softc *sc) ure_write_2(sc, URE_USB_CONNECT_TIMER, URE_MCU_TYPE_USB, 0x0001); - ure_write_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB) & - ~(URE_PWR_EN | URE_PHASE2_EN)); - ure_write_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB) & - ~URE_PCUT_STATUS); + URE_CLRBIT_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, URE_PWR_EN | URE_PHASE2_EN); + + URE_CLRBIT_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB, URE_PCUT_STATUS); memset(u1u2, 0xff, sizeof(u1u2)); ure_write_mem(sc, URE_USB_TOLERANCE, @@ -1484,17 +1661,41 @@ ure_rtl8153_init(struct ure_softc *sc) ure_write_mem(sc, URE_USB_TOLERANCE, URE_MCU_TYPE_USB | URE_BYTE_EN_SIX_BYTES, u1u2, sizeof(u1u2)); - /* Disable ALDPS. */ + ure_enable_aldps(sc, false); + + if (sc->sc_chip & (URE_CHIP_VER_5C00 | URE_CHIP_VER_5C10 | + URE_CHIP_VER_5C20)) { + ure_ocp_reg_write(sc, URE_OCP_ADC_CFG, + URE_CKADSEL_L | URE_ADC_EN | URE_EN_EMI_L); + } + if (sc->sc_chip & URE_CHIP_VER_5C00) { + ure_ocp_reg_write(sc, URE_OCP_EEE_CFG, + ure_ocp_reg_read(sc, URE_OCP_EEE_CFG) & + ~URE_CTAP_SHORT_EN); + } ure_ocp_reg_write(sc, URE_OCP_POWER_CFG, - ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) & ~URE_EN_ALDPS); - uether_pause(&sc->sc_ue, hz / 50); + ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) | + URE_EEE_CLKDIV_EN); + ure_ocp_reg_write(sc, URE_OCP_DOWN_SPEED, + ure_ocp_reg_read(sc, URE_OCP_DOWN_SPEED) | + URE_EN_10M_BGOFF); + ure_ocp_reg_write(sc, URE_OCP_POWER_CFG, + ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) | + URE_EN_10M_PLLOFF); + ure_sram_write(sc, URE_SRAM_IMPEDANCE, 0x0b13); + URE_SETBIT_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA, URE_PFM_PWM_SWITCH); + + /* Enable LPF corner auto tune. */ + ure_sram_write(sc, URE_SRAM_LPF_CFG, 0xf70f); - ure_init_fifo(sc); + /* Adjust 10M amplitude. */ + ure_sram_write(sc, URE_SRAM_10M_AMP1, 0x00af); + ure_sram_write(sc, URE_SRAM_10M_AMP2, 0x0208); + + ure_rtl8152_nic_reset(sc); /* Enable Rx aggregation. */ - ure_write_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB) & - ~URE_RX_AGG_DISABLE); + URE_CLRBIT_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, URE_RX_AGG_DISABLE | URE_RX_ZERO_EN); val = ure_read_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB); if (!(sc->sc_chip & (URE_CHIP_VER_5C00 | URE_CHIP_VER_5C10))) @@ -1508,6 +1709,266 @@ ure_rtl8153_init(struct ure_softc *sc) URE_MCU_TYPE_USB | URE_BYTE_EN_SIX_BYTES, u1u2, sizeof(u1u2)); } +static void +ure_rtl8153b_init(struct ure_softc *sc) +{ + uint16_t val; + int i; + + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + URE_CLRBIT_1(sc, 0xd26b, URE_MCU_TYPE_USB, 0x01); + ure_write_2(sc, 0xd32a, URE_MCU_TYPE_USB, 0); + URE_SETBIT_2(sc, 0xcfee, URE_MCU_TYPE_USB, 0x0020); + } + + if (sc->sc_flags & URE_FLAG_8156B) { + URE_SETBIT_2(sc, 0xb460, URE_MCU_TYPE_USB, 0x08); + } + + ure_enable_aldps(sc, false); + + /* Disable U1U2 */ + URE_CLRBIT_2(sc, URE_USB_LPM_CONFIG, URE_MCU_TYPE_USB, URE_LPM_U1U2_EN); + + /* Wait loading flash */ + if (sc->sc_chip == URE_CHIP_VER_7410) { + if ((ure_read_2(sc, 0xd3ae, URE_MCU_TYPE_PLA) & 0x0002) && + !(ure_read_2(sc, 0xd284, URE_MCU_TYPE_USB) & 0x0020)) { + for (i=0; i < 100; i++) { + if (ure_read_2(sc, 0xd284, URE_MCU_TYPE_USB) & 0x0004) + break; + uether_pause(&sc->sc_ue, hz / 1000); + } + } + } + + for (i = 0; i < URE_TIMEOUT; i++) { + if (ure_read_2(sc, URE_PLA_BOOT_CTRL, URE_MCU_TYPE_PLA) & + URE_AUTOLOAD_DONE) + break; + uether_pause(&sc->sc_ue, hz / 100); + } + if (i == URE_TIMEOUT) + device_printf(sc->sc_ue.ue_dev, + "timeout waiting for chip autoload\n"); + + val = ure_phy_status(sc, 0); + if ((val == URE_PHY_STAT_EXT_INIT) & + (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B))) { + ure_ocp_reg_write(sc, 0xa468, + ure_ocp_reg_read(sc, 0xa468) & ~0x0a); + if (sc->sc_flags & URE_FLAG_8156B) + ure_ocp_reg_write(sc, 0xa466, + ure_ocp_reg_read(sc, 0xa466) & ~0x01); + } + + val = ure_ocp_reg_read(sc, URE_OCP_BASE_MII + MII_BMCR); + if (val & BMCR_PDOWN) { + val &= ~BMCR_PDOWN; + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_BMCR, val); + } + + ure_phy_status(sc, URE_PHY_STAT_LAN_ON); + + /* Disable U2P3 */ + URE_CLRBIT_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB, URE_U2P3_ENABLE); + + /* MSC timer, 32760 ms. */ + ure_write_2(sc, URE_USB_MSC_TIMER, URE_MCU_TYPE_USB, 0x0fff); + + /* U1/U2/L1 idle timer, 500 us. */ + ure_write_2(sc, URE_USB_U1U2_TIMER, URE_MCU_TYPE_USB, 500); + + /* Disable power cut */ + URE_CLRBIT_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, URE_PWR_EN); + URE_CLRBIT_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB, URE_PCUT_STATUS); + + /* Disable ups */ + URE_CLRBIT_1(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, URE_UPS_EN | URE_USP_PREWAKE); + URE_CLRBIT_1(sc, 0xcfff, URE_MCU_TYPE_USB, 0x01); + + /* Disable queue wake */ + URE_CLRBIT_1(sc, URE_PLA_INDICATE_FALG, URE_MCU_TYPE_USB, URE_UPCOMING_RUNTIME_D3); + URE_CLRBIT_1(sc, URE_PLA_SUSPEND_FLAG, URE_MCU_TYPE_USB, URE_LINK_CHG_EVENT); + URE_CLRBIT_2(sc, URE_PLA_EXTRA_STATUS, URE_MCU_TYPE_USB, URE_LINK_CHANGE_FLAG); + + /* Disable runtime suspend */ + ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_CONFIG); + URE_CLRBIT_2(sc, URE_PLA_CONFIG34, URE_MCU_TYPE_USB, URE_LINK_OFF_WAKE_EN); + ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_NORAML); + + /* Enable U1U2 */ + if (usbd_get_speed(sc->sc_ue.ue_udev) == USB_SPEED_SUPER) + URE_SETBIT_2(sc, URE_USB_LPM_CONFIG, URE_MCU_TYPE_USB, URE_LPM_U1U2_EN); + + if (sc->sc_flags & URE_FLAG_8156B) { + URE_CLRBIT_2(sc, 0xc010, URE_MCU_TYPE_PLA, 0x0800); + URE_SETBIT_2(sc, 0xe854, URE_MCU_TYPE_PLA, 0x0001); *** 740 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:19:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4D4B1659F2C; Sat, 10 Jul 2021 19:19:02 +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 4GMfw6068Hz4lHY; Sat, 10 Jul 2021 19:19: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 DD6BB5B4D; Sat, 10 Jul 2021 19:19: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 16AJJ1Yn049149; Sat, 10 Jul 2021 19:19:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJJ1BN049148; Sat, 10 Jul 2021 19:19:01 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:19:01 GMT Message-Id: <202107101919.16AJJ1BN049148@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: 47c5e288eee9 - stable/13 - Narrow down the probe range for if_ure(4) compatible devices to only match the first vendor specific interface, if any. 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/13 X-Git-Reftype: branch X-Git-Commit: 47c5e288eee94c67369443d0ed7c2ab21235c924 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:19:02 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=47c5e288eee94c67369443d0ed7c2ab21235c924 commit 47c5e288eee94c67369443d0ed7c2ab21235c924 Author: Hans Petter Selasky AuthorDate: 2021-06-04 13:48:15 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:17:29 +0000 Narrow down the probe range for if_ure(4) compatible devices to only match the first vendor specific interface, if any. PR: 253374 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit dab84426a68d43efaede62ccf86ca3ef852f8ae3) --- sys/dev/usb/net/if_ure.c | 7 ++++--- sys/dev/usb/usb.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c index 2e4053a0e0c6..6439a0bfd71d 100644 --- a/sys/dev/usb/net/if_ure.c +++ b/sys/dev/usb/net/if_ure.c @@ -95,7 +95,10 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN, &ure_debug, 0, * Various supported device vendors/products. */ static const STRUCT_USB_HOST_ID ure_devs[] = { -#define URE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } +#define URE_DEV(v,p,i) { \ + USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i), \ + USB_IFACE_CLASS(UICLASS_VENDOR), \ + USB_IFACE_SUBCLASS(UISUBCLASS_VENDOR) } URE_DEV(LENOVO, RTL8153, URE_FLAG_8153), URE_DEV(LENOVO, TBT3LAN, 0), URE_DEV(LENOVO, TBT3LANGEN2, 0), @@ -488,8 +491,6 @@ ure_probe(device_t dev) uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); - if (uaa->info.bConfigIndex != URE_CONFIG_IDX) - return (ENXIO); if (uaa->info.bIfaceIndex != URE_IFACE_IDX) return (ENXIO); diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index dcdb62114d63..ad0381366f98 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -520,6 +520,7 @@ typedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t; #define UICLASS_VENDOR 0xff #define UISUBCLASS_XBOX360_CONTROLLER 0x5d +#define UISUBCLASS_VENDOR 0xff #define UIPROTO_XBOX360_GAMEPAD 0x01 struct usb_endpoint_descriptor { From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:24:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AE81265A58A; Sat, 10 Jul 2021 19:24: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 4GMg2L4Zt2z4lhq; Sat, 10 Jul 2021 19:24: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 809115F27; Sat, 10 Jul 2021 19:24: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 16AJOQjx062011; Sat, 10 Jul 2021 19:24:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJOQe1062010; Sat, 10 Jul 2021 19:24:26 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:24:26 GMT Message-Id: <202107101924.16AJOQe1062010@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: 0f82fd0714a9 - stable/12 - ibstat: Include prototype for sysctlbyname(). 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: 0f82fd0714a9e6faabb0fead2c3b1e42444c1400 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:24:26 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0f82fd0714a9e6faabb0fead2c3b1e42444c1400 commit 0f82fd0714a9e6faabb0fead2c3b1e42444c1400 Author: Hans Petter Selasky AuthorDate: 2021-05-27 07:39:49 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:24:05 +0000 ibstat: Include prototype for sysctlbyname(). Fixes the following compile warning: implicit declaration of function 'sysctlbyname' is invalid in C99 [-Wimplicit-function-declaration] Found by: J87 Differential Revision: https://reviews.freebsd.org/D30484 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 16fa3dcba027d13dcda9ee78e6057e3e5a79f80c) --- contrib/ofed/infiniband-diags/src/ibstat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/ofed/infiniband-diags/src/ibstat.c b/contrib/ofed/infiniband-diags/src/ibstat.c index 6e08fad409ca..e4f3608dfd76 100644 --- a/contrib/ofed/infiniband-diags/src/ibstat.c +++ b/contrib/ofed/infiniband-diags/src/ibstat.c @@ -48,6 +48,7 @@ #include #include #include +#include #include From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:26:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 296FA65A448; Sat, 10 Jul 2021 19:26: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 4GMg4v0hzSz4lsH; Sat, 10 Jul 2021 19:26: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 EA6D858FA; Sat, 10 Jul 2021 19:26: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 16AJQcMC062400; Sat, 10 Jul 2021 19:26:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJQcRv062399; Sat, 10 Jul 2021 19:26:38 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:26:38 GMT Message-Id: <202107101926.16AJQcRv062399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Chisnall Subject: git: d2b558281aad - main - Revert "Pass the syscall number to capsicum permission-denied signals" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: theraven X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2b558281aadc266807e42ffb27d2108d308de46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:26:39 -0000 The branch main has been updated by theraven: URL: https://cgit.FreeBSD.org/src/commit/?id=d2b558281aadc266807e42ffb27d2108d308de46 commit d2b558281aadc266807e42ffb27d2108d308de46 Author: David Chisnall AuthorDate: 2021-07-10 19:25:38 +0000 Commit: David Chisnall CommitDate: 2021-07-10 19:26:01 +0000 Revert "Pass the syscall number to capsicum permission-denied signals" This broke the i386 build. This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47. --- lib/libc/sys/procctl.2 | 10 ---------- share/man/man3/siginfo.3 | 2 -- sys/amd64/amd64/trap.c | 1 - sys/amd64/cloudabi32/cloudabi32_sysvec.c | 1 - sys/amd64/cloudabi64/cloudabi64_sysvec.c | 1 - sys/amd64/ia32/ia32_syscall.c | 1 - sys/amd64/include/proc.h | 1 - sys/amd64/linux/linux_sysvec.c | 1 - sys/amd64/linux32/linux32_sysvec.c | 1 - sys/arm/arm/syscall.c | 1 - sys/arm/cloudabi32/cloudabi32_sysvec.c | 1 - sys/arm/include/proc.h | 1 - sys/arm64/arm64/elf32_machdep.c | 1 - sys/arm64/arm64/trap.c | 1 - sys/arm64/cloudabi32/cloudabi32_sysvec.c | 1 - sys/arm64/cloudabi64/cloudabi64_sysvec.c | 1 - sys/arm64/include/proc.h | 1 - sys/arm64/linux/linux_sysvec.c | 1 - sys/i386/cloudabi32/cloudabi32_sysvec.c | 1 - sys/i386/i386/trap.c | 1 - sys/i386/include/proc.h | 1 - sys/i386/linux/linux_sysvec.c | 1 - sys/kern/subr_syscall.c | 1 - sys/mips/include/proc.h | 1 - sys/mips/mips/trap.c | 1 - sys/powerpc/include/proc.h | 1 - sys/powerpc/powerpc/trap.c | 1 - sys/riscv/include/proc.h | 1 - sys/riscv/riscv/trap.c | 1 - sys/sys/signal.h | 7 ------- 30 files changed, 46 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index ce7a2be5d5e4..432ed5919a81 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -454,16 +454,6 @@ and the .Va si_code member is set to .Dv TRAP_CAP . -The system call number is stored in the -.Va si_syscall -field of the -.Fa siginfo -signal handler parameter. -The other system call parameters can be read from the -.Fa ucontext_t -but the system call number is typically stored in the register -that also contains the return value and so is unavailable in the -signal handler. .Pp See .Xr capsicum 4 diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index 7f8a809cdfa5..acc8785b2f0d 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -85,8 +85,6 @@ timer overrun count .It Vt int Ta Va si_mqd Ta .Tn POSIX message queue ID -.It Vt int Ta Va si_syscall Ta -system-call number for system calls blocked by Capsicum .El .Pp The diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index b08495f3f139..55649687ce50 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1059,7 +1059,6 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_rax; - sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall || diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c index 26924ed5a980..164f87e90e91 100644 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/amd64/cloudabi32/cloudabi32_sysvec.c @@ -101,7 +101,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index c08d912e84d4..d3893902b08e 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -98,7 +98,6 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 9294ef8ce741..6c9399d1a52f 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -150,7 +150,6 @@ ia32_fetch_syscall_args(struct thread *td) params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t); sa->code = frame->tf_rax; - sa->original_code = sa->code; /* * Need to check if this is a 32 bit or 64 bit syscall. diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 0f8cf50e326d..59796e729ac4 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -92,7 +92,6 @@ struct mdproc { struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 566af6de29e7..c5538932b1e3 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -191,7 +191,6 @@ linux_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_r8; sa->args[5] = frame->tf_r9; sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 7dfd57a74a1e..504d57e418a5 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -662,7 +662,6 @@ linux32_fetch_syscall_args(struct thread *td) sa->args[4] = frame->tf_rdi; sa->args[5] = frame->tf_rbp; /* Unconfirmed */ sa->code = frame->tf_rax; - sa->original_code = sa->code; if (sa->code >= p->p_sysent->sv_size) /* nosys */ diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index a635de0ec716..a851db6e4556 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -108,7 +108,6 @@ cpu_fetch_syscall_args(struct thread *td) nap = 4; sa = &td->td_sa; sa->code = td->td_frame->tf_r7; - sa->original_code = sa->code; ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c index 4df57b22e13d..a8c5da47d265 100644 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm/cloudabi32/cloudabi32_sysvec.c @@ -78,7 +78,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_r12; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index 9566c264731e..a37ccd8f621c 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -75,7 +75,6 @@ struct mdproc { */ struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; } __aligned(8); diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 7cedbffc4d43..206413b45172 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -175,7 +175,6 @@ freebsd32_fetch_syscall_args(struct thread *td) /* r7 is the syscall id */ sa->code = td->td_frame->tf_x[7]; - sa->original_code = sa->code; if (sa->code == SYS_syscall) { sa->code = *ap++; diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 2b2d2e433efa..744b646b31c8 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -130,7 +130,6 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_x[8]; - sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/arm64/cloudabi32/cloudabi32_sysvec.c b/sys/arm64/cloudabi32/cloudabi32_sysvec.c index b7be5cc0e5e3..889393560ede 100644 --- a/sys/arm64/cloudabi32/cloudabi32_sysvec.c +++ b/sys/arm64/cloudabi32/cloudabi32_sysvec.c @@ -75,7 +75,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[0]; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/arm64/cloudabi64/cloudabi64_sysvec.c b/sys/arm64/cloudabi64/cloudabi64_sysvec.c index 624d86693457..bdbd828b7b62 100644 --- a/sys/arm64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/arm64/cloudabi64/cloudabi64_sysvec.c @@ -78,7 +78,6 @@ cloudabi64_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_x[8]; - sa->original_code = sa->code; if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi64_sysent[sa->code]; diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index 3800798d79b7..bb933dc98241 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -49,7 +49,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 7749c1cd7fc8..e1d3708b70e9 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -125,7 +125,6 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = td->td_frame->tf_x[8]; - sa->original_code = sa->code; /* LINUXTODO: generic syscall? */ if (sa->code >= p->p_sysent->sv_size) sa->callp = &p->p_sysent->sv_table[0]; diff --git a/sys/i386/cloudabi32/cloudabi32_sysvec.c b/sys/i386/cloudabi32/cloudabi32_sysvec.c index e0a50f6697a9..4f12d2b6cbce 100644 --- a/sys/i386/cloudabi32/cloudabi32_sysvec.c +++ b/sys/i386/cloudabi32/cloudabi32_sysvec.c @@ -96,7 +96,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) /* Obtain system call number. */ sa->code = frame->tf_eax; - sa->original_code = sa->code; if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = &cloudabi32_sysent[sa->code]; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 07abac23c9da..045478149be5 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1052,7 +1052,6 @@ cpu_fetch_syscall_args(struct thread *td) #endif sa->code = frame->tf_eax; - sa->original_code = sa->code; params = (caddr_t)frame->tf_esp + sizeof(uint32_t); /* diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 76e1ac611474..2950946ff155 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -64,7 +64,6 @@ struct mdproc { struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[8]; }; diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index a0959d55b585..adb70fded6dc 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -756,7 +756,6 @@ linux_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->tf_eax; - sa->original_code = sa->code; sa->args[0] = frame->tf_ebx; sa->args[1] = frame->tf_ecx; sa->args[2] = frame->tf_edx; diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 2304e3e7f3f9..85a0814a2125 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -230,7 +230,6 @@ syscallret(struct thread *td) ksi.ksi_signo = SIGTRAP; ksi.ksi_errno = td->td_errno; ksi.ksi_code = TRAP_CAP; - ksi.ksi_info.si_syscall = sa->original_code; trapsignal(td, &ksi); } } diff --git a/sys/mips/include/proc.h b/sys/mips/include/proc.h index 29d832a162e6..0cb1d433387c 100644 --- a/sys/mips/include/proc.h +++ b/sys/mips/include/proc.h @@ -84,7 +84,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 9d7a07606373..96a2de4ee817 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -355,7 +355,6 @@ cpu_fetch_syscall_args(struct thread *td) else locr0->pc += sizeof(int); sa->code = locr0->v0; - sa->original_code = sa->code; switch (sa->code) { case SYS___syscall: diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index aac4e66b39fc..d4df3ccfefef 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -62,7 +62,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index ab5189a0f418..3a1bdf7cde07 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -667,7 +667,6 @@ cpu_fetch_syscall_args(struct thread *td) sa = &td->td_sa; sa->code = frame->fixreg[0]; - sa->original_code = sa->code; params = (caddr_t)(frame->fixreg + FIRSTARG); n = NARGREG; diff --git a/sys/riscv/include/proc.h b/sys/riscv/include/proc.h index 1c6c8d2919b5..4b5ae9ebe3ed 100644 --- a/sys/riscv/include/proc.h +++ b/sys/riscv/include/proc.h @@ -48,7 +48,6 @@ struct mdproc { #define MAXARGS 8 struct syscall_args { u_int code; - u_int original_code; struct sysent *callp; register_t args[MAXARGS]; }; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 8844638c8204..07d7f84a94e8 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -103,7 +103,6 @@ cpu_fetch_syscall_args(struct thread *td) dst_ap = &sa->args[0]; sa->code = td->td_frame->tf_t[0]; - sa->original_code = sa->code; if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 9dae3ce04745..8b45a521c3ee 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -255,12 +255,6 @@ typedef struct __siginfo { struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ - struct { - int _syscall; /* Syscall number for signals - * delivered as a result of - * system calls denied by - * Capsicum. */ - } _capsicum; struct { long __spare1__; int __spare2__[7]; @@ -273,7 +267,6 @@ typedef struct __siginfo { #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band -#define si_syscall _reason._capsicum._syscall #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) struct siginfo32 { From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:30:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 372C465A47A for ; Sat, 10 Jul 2021 19:30:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 4GMg9G0n3mz4mGs for ; Sat, 10 Jul 2021 19:30:25 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f47.google.com with SMTP id f9so11867149wrq.11 for ; Sat, 10 Jul 2021 12:30:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Yjn9x3DUZpCnDncqDYORAKKF/MLImMdTxz74QWi7Xmg=; b=TJo83917ZhNbeqwXjnRiZD/o5U63v17Tij3FHLD48OacIEYF4U+Sn4GeX206SW5j/a dtWDQB/sPlRU1NxwkE6PUWC4640JDC0Gn/naj8Ol+FEhqvgPbIIjWS+R6aiODW/EuFjy peV6R3TbDMq05HarJKULorwaZljz7G6Zn1xI4xSIHPVBsJ1zNivUommoa/Ji3WBW2V6l 6Y9flrfjQ2eAX4T7AqByJGfUpoXHJ5l0ZjSH5r9xy61L7KZmsSMUcZewZXxEP8r9mzGu 7ny4T1trgofE2/1c5KYUXpoWGuEeTK/2wc5MjSgbrXY5GnXwfhblhPs7doR3G7kohGiV PDrQ== X-Gm-Message-State: AOAM533jJ56zITR5G4mT3jiTKjVlOd2Tla8lyeP4DteRBnZsw383+ybn /iaUibnn0/1xcYhAM7nfo5Eo5A== X-Google-Smtp-Source: ABdhPJxEywK2rff1ISliAJuqJqr7ehsgzcwhi5tf5yESNYo3EuVqSvY3FgsROoEuzxSuils7pfN5ag== X-Received: by 2002:a5d:47a7:: with SMTP id 7mr17974773wrb.150.1625945424755; Sat, 10 Jul 2021 12:30:24 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id x19sm8214198wmi.10.2021.07.10.12.30.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Jul 2021 12:30:24 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: d038463bd269 - main - Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. From: Jessica Clarke In-Reply-To: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> Date: Sat, 10 Jul 2021 20:30:22 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <09444339-973B-4A2B-ACEA-B00B8E48F460@freebsd.org> References: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GMg9G0n3mz4mGs 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:30:26 -0000 On 10 Jul 2021, at 20:04, Hans Petter Selasky = wrote: >=20 > The branch main has been updated by hselasky: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dd038463bd269031fa8f13c0951b223bc= ae02bbca >=20 > commit d038463bd269031fa8f13c0951b223bcae02bbca > Author: Hans Petter Selasky > AuthorDate: 2021-07-10 16:09:56 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-07-10 17:57:52 +0000 >=20 > Make sure the XHCI driver obeys the isochronous scheduling = threshold value > as given by the XHCI hardware parameters to avoid scheduling = isochronous > transfers too early. >=20 > MFC after: 1 week > Sponsored by: NVIDIA Networking > --- > sys/dev/usb/controller/xhci.c | 11 ++++++++++- > sys/dev/usb/controller/xhci.h | 3 +++ > 2 files changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/sys/dev/usb/controller/xhci.c = b/sys/dev/usb/controller/xhci.c > index 10e37c97c254..dd64c2d45141 100644 > --- a/sys/dev/usb/controller/xhci.c > +++ b/sys/dev/usb/controller/xhci.c > @@ -644,6 +644,9 @@ xhci_init(struct xhci_softc *sc, device_t self, = uint8_t dma32) >=20 > DPRINTF("HCS2=3D0x%08x\n", temp); >=20 > + /* get isochronous scheduling threshold */ > + sc->sc_ist =3D XHCI_HCS2_IST(temp); > + > /* get number of scratchpads */ > sc->sc_noscratch =3D XHCI_HCS2_SPB_MAX(temp); >=20 > @@ -2075,7 +2078,13 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) >=20 > x =3D XREAD4(temp.sc, runt, XHCI_MFINDEX); >=20 > - DPRINTF("MFINDEX=3D0x%08x\n", x); > + DPRINTF("MFINDEX=3D0x%08x IST=3D0x%x\n", x, sc->sc_ist); This broke amd64 GENERIC with error: use of undeclared identifier =E2=80=98= sc' Should this be temp.sc? Jess From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:32:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 64B6F65A92A; Sat, 10 Jul 2021 19:32: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 4GMgC91p4wz4mj5; Sat, 10 Jul 2021 19:32: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 274F96025; Sat, 10 Jul 2021 19:32: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 16AJW5KZ074819; Sat, 10 Jul 2021 19:32:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AJW5ev074818; Sat, 10 Jul 2021 19:32:05 GMT (envelope-from git) Date: Sat, 10 Jul 2021 19:32:05 GMT Message-Id: <202107101932.16AJW5ev074818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: f52783fcf5cc - main - Fix USB debug print after 8fc2a3c41791b205a107dc2bec16ac7514a57958 . 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/main X-Git-Reftype: branch X-Git-Commit: f52783fcf5cc60734121d061beef0d4ea47b224a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:32:05 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f52783fcf5cc60734121d061beef0d4ea47b224a commit f52783fcf5cc60734121d061beef0d4ea47b224a Author: Hans Petter Selasky AuthorDate: 2021-07-10 19:30:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:31:28 +0000 Fix USB debug print after 8fc2a3c41791b205a107dc2bec16ac7514a57958 . MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 93468c5d9333..690091fcef2f 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -2078,7 +2078,7 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) x = XREAD4(temp.sc, runt, XHCI_MFINDEX); - DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, sc->sc_ist); + DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, temp.sc->sc_ist); switch (usbd_get_speed(xfer->xroot->udev)) { case USB_SPEED_FULL: From owner-dev-commits-src-all@freebsd.org Sat Jul 10 19:34:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A394265A741; Sat, 10 Jul 2021 19:34:58 +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 4GMgGV3QMXz4mPk; Sat, 10 Jul 2021 19:34:58 +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 313F826028D; Sat, 10 Jul 2021 21:34:51 +0200 (CEST) Subject: Re: git: d038463bd269 - main - Make sure the XHCI driver obeys the isochronous scheduling threshold value as given by the XHCI hardware parameters to avoid scheduling isochronous transfers too early. To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202107101904.16AJ4lj3035432@gitrepo.freebsd.org> <09444339-973B-4A2B-ACEA-B00B8E48F460@freebsd.org> From: Hans Petter Selasky Message-ID: <4a0de77e-babe-8fd7-502e-df3dbb309616@selasky.org> Date: Sat, 10 Jul 2021 21:34:43 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <09444339-973B-4A2B-ACEA-B00B8E48F460@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GMgGV3QMXz4mPk 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 19:34:58 -0000 On 7/10/21 9:30 PM, Jessica Clarke wrote: > This broke amd64 GENERIC with error: use of undeclared identifier ‘sc' > > Should this be temp.sc? Yes. I was testing mostly with GENERIC-NODEBUG and forgot to check all the prints. Fixed: https://cgit.freebsd.org/src/commit/?id=f52783fcf5cc60734121d061beef0d4ea47b224a --HPS From owner-dev-commits-src-all@freebsd.org Sat Jul 10 20:00:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1C0CA65AB9A; Sat, 10 Jul 2021 20:00: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 4GMgr20Lgrz4qby; Sat, 10 Jul 2021 20:00: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 E80B5668E; Sat, 10 Jul 2021 20:00: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 16AK0Xqt011425; Sat, 10 Jul 2021 20:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AK0Xdt011424; Sat, 10 Jul 2021 20:00:33 GMT (envelope-from git) Date: Sat, 10 Jul 2021 20:00:33 GMT Message-Id: <202107102000.16AK0Xdt011424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 05f56ac92fe4 - main - LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer. 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/main X-Git-Reftype: branch X-Git-Commit: 05f56ac92fe4bcb00be5bd01574991a50c548b8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 20:00:34 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=05f56ac92fe4bcb00be5bd01574991a50c548b8b commit 05f56ac92fe4bcb00be5bd01574991a50c548b8b Author: Hans Petter Selasky AuthorDate: 2021-07-10 19:56:29 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-10 19:59:31 +0000 LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer. This allows other threads to execute, typically during hardware waiting loops. This also maches how the function works in Linux. Reviewed by: kib MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/delay.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/delay.h b/sys/compat/linuxkpi/common/include/linux/delay.h index 860d36368a8e..1ed9dffed359 100644 --- a/sys/compat/linuxkpi/common/include/linux/delay.h +++ b/sys/compat/linuxkpi/common/include/linux/delay.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2021 Mellanox Technologies, Ltd. * Copyright (c) 2014 François Tigeot * All rights reserved. * @@ -68,7 +68,10 @@ ndelay(unsigned long x) static inline void usleep_range(unsigned long min, unsigned long max) { - DELAY(min); + /* guard against invalid values */ + if (min == 0) + min = 1; + pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK); } extern unsigned int linux_msleep_interruptible(unsigned int ms); From owner-dev-commits-src-all@freebsd.org Sun Jul 11 12:01:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0D92B666067; Sun, 11 Jul 2021 12:01: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 4GN58D705Jz4mLx; Sun, 11 Jul 2021 12:01: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 D7EEA1B27C; Sun, 11 Jul 2021 12:01: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 16BC10t1090590; Sun, 11 Jul 2021 12:01:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BC10tG090589; Sun, 11 Jul 2021 12:01:00 GMT (envelope-from git) Date: Sun, 11 Jul 2021 12:01:00 GMT Message-Id: <202107111201.16BC10tG090589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: cf48d1f77126 - main - Clamp the XHCI minimum isochronous scheduling delay to the maximum value that will work under FreeBSD, if the value is too big. 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/main X-Git-Reftype: branch X-Git-Commit: cf48d1f77126d8de4c03c4dd7c8502be2b5f1954 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 12:01:01 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cf48d1f77126d8de4c03c4dd7c8502be2b5f1954 commit cf48d1f77126d8de4c03c4dd7c8502be2b5f1954 Author: Hans Petter Selasky AuthorDate: 2021-07-11 11:56:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-07-11 11:57:15 +0000 Clamp the XHCI minimum isochronous scheduling delay to the maximum value that will work under FreeBSD, if the value is too big. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/xhci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 690091fcef2f..e9d15eabc20a 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -2110,6 +2110,7 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) * or equal to 2 milliseconds, which is too * much. */ + y = 7; } else { /* * Subtract one millisecond, because the From owner-dev-commits-src-all@freebsd.org Sun Jul 11 12:54:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A829A6674C2; Sun, 11 Jul 2021 12:54: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 4GN6KX4BMMz3CwY; Sun, 11 Jul 2021 12:54: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 789401C180; Sun, 11 Jul 2021 12:54: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 16BCs8qk059450; Sun, 11 Jul 2021 12:54:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BCs8LD059449; Sun, 11 Jul 2021 12:54:08 GMT (envelope-from git) Date: Sun, 11 Jul 2021 12:54:08 GMT Message-Id: <202107111254.16BCs8LD059449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 5aa1e55b0ae7 - main - hwpmc(4): Fix a typo in the man page date MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5aa1e55b0ae777920e0672ec3e627bea7cb6c1fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 12:54:08 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5aa1e55b0ae777920e0672ec3e627bea7cb6c1fc commit 5aa1e55b0ae777920e0672ec3e627bea7cb6c1fc Author: Gordon Bergling AuthorDate: 2021-07-11 12:53:18 +0000 Commit: Gordon Bergling CommitDate: 2021-07-11 12:53:18 +0000 hwpmc(4): Fix a typo in the man page date MFC after: 3 days --- share/man/man4/hwpmc.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4 index a5b4bcb94707..d1bd576fcb9c 100644 --- a/share/man/man4/hwpmc.4 +++ b/share/man/man4/hwpmc.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Apryl 3, 2021 +.Dd April 3, 2021 .Dt HWPMC 4 .Os .Sh NAME From owner-dev-commits-src-all@freebsd.org Sun Jul 11 14:47:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3D8A6668CE7; Sun, 11 Jul 2021 14:47: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 4GN8rv1C9Fz3jrJ; Sun, 11 Jul 2021 14:47: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 10A831D738; Sun, 11 Jul 2021 14:47: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 16BElwvd006051; Sun, 11 Jul 2021 14:47:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BElwkH006050; Sun, 11 Jul 2021 14:47:58 GMT (envelope-from git) Date: Sun, 11 Jul 2021 14:47:58 GMT Message-Id: <202107111447.16BElwkH006050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9c1c02093b90 - main - loader: support.4th resets the read buffer incorrectly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c1c02093b90ae49745a174eb26ea85dd1990eec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 14:47:59 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9c1c02093b90ae49745a174eb26ea85dd1990eec commit 9c1c02093b90ae49745a174eb26ea85dd1990eec Author: John Hood AuthorDate: 2021-07-11 14:44:12 +0000 Commit: Warner Losh CommitDate: 2021-07-11 14:47:29 +0000 loader: support.4th resets the read buffer incorrectly Large nextboot.conf files (over 80 bytes) are not read correctly by the Forth loader, causing file parsing to abort, and nextboot configuration fails to apply. Simple repro: nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx shutdown -r now That will cause the bug to cause a parse failure but shouldn't otherwise affect the boot. Depending on your loader configuration, you may also have to set beastie_disable and/or reduce the number of modules loaded to see the error on a small console screen. 12.0 or CURRENT users will also have to explicitly use the Forth loader instead of the Lua loader. The error will look something like: Warning: syntax error on file /boot/loader.conf.local foo="xxxxxxxxxxxxxxnextboot_enable="YES" ^ /boot/support.4th has crude file I/O buffering, which uses a buffer 'read_buffer', defined to be 80 bytes by the 'read_buffer_size' constant. The loader first tastes nextboot.conf, reading and parsing the first line in it for nextboot_enable="YES". If this is true, then it reopens the file and parses it like other loader .conf files. Unfortunately, the file I/O buffering code does not fully reset the buffer state in the reset_line_reading word. If the last file was read to the end, that doesn't matter; the file buffer is treated as empty anyway. But in the nextboot.conf case, the loader will not read to the end of file if it is over 80 bytes, and the file buffer may be reused when reading the next file. When the file is reread, the corrupt text may cause file parsing to abort on bad syntax (if the corrupt line has <>2 quotes in it), the wrong variable to be set, no variable to be set at all, or (if the splice happens to land at a line ending) something approximating normal operation. The bug is very old, dating back to at least 2000 if not before, and is still present in 12.0 and CURRENT r345863 (though it is now hidden by the Lua loader by default). Suggested one-line attached. This does change the behavior of the reset_line_reading word, which is exported in the line-reading dictionary (though the export is not documented in loader man pages). But repo history shows it was probably exported for the PNP support code, which was never included in the loader build, and was removed 5 months ago. One thing that puzzles me: how has this bug gone unnoticed/unfixed for nearly 2 decades? I find it hard to believe that nobody's tried to do something interesting with nextboot, like load a kernel and filesystem, which is what I'm doing. PR: 239315 Reviewed by: imp --- stand/forth/support.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index d87cf16a16dd..ec04b7e9e322 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -485,7 +485,7 @@ variable fd get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading - 0 to read_buffer_ptr + 0 read_buffer .len ! ; : read_line From owner-dev-commits-src-all@freebsd.org Sun Jul 11 15:06:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6190F6691E0; Sun, 11 Jul 2021 15:06: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 4GN9G628Dxz3m2H; Sun, 11 Jul 2021 15:06: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 260FB1DD89; Sun, 11 Jul 2021 15:06: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 16BF6MSh033389; Sun, 11 Jul 2021 15:06:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BF6MV9033388; Sun, 11 Jul 2021 15:06:22 GMT (envelope-from git) Date: Sun, 11 Jul 2021 15:06:22 GMT Message-Id: <202107111506.16BF6MV9033388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 36cfb5d50f8e - main - nanobsd: enhance fill_pkg.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36cfb5d50f8e8856695780a6792fb7e81816e9ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 15:06:22 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=36cfb5d50f8e8856695780a6792fb7e81816e9ee commit 36cfb5d50f8e8856695780a6792fb7e81816e9ee Author: Lev A. Serebryakov AuthorDate: 2021-07-11 15:04:39 +0000 Commit: Warner Losh CommitDate: 2021-07-11 15:05:16 +0000 nanobsd: enhance fill_pkg.sh NanoBSD has helper script "fill_pkg.sh" which links all packages and ther dependencies from "package dump" (like /usr/ports/packages/All) to specified director. fill_pkg.sh has some limitations: 1) It needs ports tree, which should have exactly same versions as "package dump". 2) It requires full paths to needed ports, including "/usr/ports" part. 3) It has assumptions about Nano Package Dir (it assumes, that it specified rtelative to current directory). 4) It does not have any diagnostics (almost). This PR enhances "fill_pkg.sh" script in several ways: 1) Nano package dir could be absolute path. 2) Script understands four ways to specify "root" ports/packages: (a) Absolute directory with port (old one) (b) Relative directory with port, relative to ${PORTSDIR} or /usr/ports (c) Absolute path to file with package (with .tbz suffix) (d) Name of package in dump dir, with or without .tbz suffix These ways can be mixed in one call. Dependencies for packages are obtained with 'pkg_info -r' call, and are searched for in same directory as "parent" package. Dependencies for ports are obtained in old way from port's Makefile. 3) Three levels of diagnostic (and -v option, could be repeated) are added. 4) All path variables are enclosed in quotes, to make script work with paths, containing spaces. Note: imp merged in the changes to fill_pkg.sh since this has been a PR. PR: 151695 Reviewed by: imp@ MFC After: 3 days Differential Revision: https://reviews.freebsd.org/D31101 --- tools/tools/nanobsd/fill_pkg.sh | 154 +++++++++++++++++++++++++++++----------- 1 file changed, 113 insertions(+), 41 deletions(-) diff --git a/tools/tools/nanobsd/fill_pkg.sh b/tools/tools/nanobsd/fill_pkg.sh index be240a3bf66f..80f61429ee8f 100644 --- a/tools/tools/nanobsd/fill_pkg.sh +++ b/tools/tools/nanobsd/fill_pkg.sh @@ -1,5 +1,6 @@ #!/bin/sh # +# Copyright (c) 2014 Lev Serebryakov. # Copyright (c) 2009 Poul-Henning Kamp. # All rights reserved. # @@ -27,70 +28,141 @@ # $FreeBSD$ # # Usage: -# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar ... +# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar [package.txz]... # # Will symlink the packages listed, including their runtime dependencies, # from the PACKAGE_DUMP to the NANO_PACKAGE_DIR. # -NANO_PKG_DUMP=$1 -shift; -if [ ! -d $NANO_PKG_DUMP ] ; then - echo "$NANO_PKG_DUMP not a directory" 1>&2 - exit 1 -fi +: ${PORTSDIR:=/usr/ports} -NANO_PACKAGE_DIR=$1 -shift; +usage () { + echo "Usage: $0 [-v] package-dump-dir nano-package-dir port-dir-or-pkg ..." 1>&2 + exit 2 +} + +msg () { + local l + l=$1 ; shift + [ "$l" -le "$VERBOSE" ] && echo $* +} ports_recurse() ( - of=$1 - shift - for d - do - if [ ! -d $d ] ; then - echo "Missing port $d" 1>&2 + local outputfile dumpdir type fullpath pkgname p + outputfile=$1 ; shift + dumpdir=$1 ; shift + for p do + if [ -d "$p" -a -f "$p/Makefile" ] ; then + msg 3 "$p: full path to port" + pkgname=`cd "$p" && make -V pkgname` + type=port + fullpath=$p + elif [ -d "${PORTSDIR}/$p" -a -f "${PORTSDIR}/$p/Makefile" ] ; then + msg 3 "$p: path to port relative to ${PORTSDIR}}" + pkgname=`cd "${PORTSDIR}/$p" && make -V pkgname` + type=port + fullpath=${PORTSDIR}/$p + elif [ "${p%.txz}" != "$p" -a -f "$p" ] && pkg info -F "$p" > /dev/null 2>&1 ; then + msg 3 "$p: full package file name" + pkgname=`basename "$p" | sed 's/\.txz$//I'` + type=pkg + fullpath=$p + elif [ "${p%.txz}" != "$p" -a -f "$dumpdir/$p" ] && pkg info -F "$dumpdir/$p" > /dev/null 2>&1 ; then + msg 3 "$p: package file name relative to $dumpdir" + pkgname=`basename "$p" | sed 's/\.txz$//I'` + type=pkg + fullpath=$dumpdir/$p + elif [ -f "$dumpdir/$p.txz" ] && pkg info -F "$dumpdir/$p.txz" > /dev/null 2>&1 ; then + msg 3 "$p: package name relative to $dumpdir" + pkgname=`basename "$p"` + type=pkg + fullpath=$dumpdir/$p.txz + else + echo "Missing port or package $p" 1>&2 exit 2 fi - if grep -q "^$d\$" $of ; then + if grep -q "^$pkgname\$" "$outputfile" ; then + msg 3 "$pkgname was added already" true - else + elif [ "$type" = "port" ] ; then ( - cd $d - rd=`make -V RUN_DEPENDS ${PORTS_OPTS}` - ld=`make -V LIB_DEPENDS ${PORTS_OPTS}` - - for x in $rd $ld - do - ports_recurse $of `echo $x | - sed 's/^[^:]*:\([^:]*\).*$/\1/'` - done + cd "$fullpath" + rd=`make -V RUN_DEPENDS ${PORTS_OPTS}` + ld=`make -V LIB_DEPENDS ${PORTS_OPTS}` + + for dep in $rd $ld ; do + arg=`echo $dep | sed 's/^[^:]*:\([^:]*\).*$/\1/'` + msg 2 "Check $arg as requirement for port $pkgname" + ports_recurse "$outputfile" "$dumpdir" "$arg" + done ) - echo $d >> $of + msg 1 "Add $pkgname" + echo "$pkgname" >> "$outputfile" + else + dir=`dirname "$p"` # Get directory from SPECIFIED path, not from full path + if [ "$dir" = "." ] ; then + dir="" + else + dir=${dir}/ + fi + deps=`pkg info -dF "$fullpath" | grep -v "$pkgname:"` + for dep in $deps ; do + arg=`echo $dep | sed -e "s|^|$dir|" -e 's/$/.txz/'` + msg 2 "Check $arg as requirement for package $pkgname" + ports_recurse "$outputfile" "$dumpdir" "$arg" + done + msg 1 "Add $pkgname" + echo "$pkgname" >> "$outputfile" fi done ) -rm -rf $NANO_PACKAGE_DIR -mkdir -p $NANO_PACKAGE_DIR +VERBOSE=0 + +while getopts v opt ; do + case "$opt" in + v) VERBOSE=$(($VERBOSE + 1)) ;; + [?]) usage ;; + esac +done +shift $(( ${OPTIND} - 1 )) + +if [ "$#" -lt 3 ] ; then + usage +fi + +NANO_PKG_DUMP=`realpath $1` +shift; +if [ ! -d "$NANO_PKG_DUMP" ] ; then + echo "$NANO_PKG_DUMP is not a directory" 1>&2 + usage +fi + +NANO_PKG_DIR=`realpath $1` +shift; +if [ ! -d "$NANO_PKG_DIR" ] ; then + echo "$NANO_PKG_DIR is not a directory" 1>&2 + usage +fi + +# Cleanup +rm -rf "$NANO_PKG_DIR/"* + +PL=$NANO_PKG_DIR/_list +true > "$PL" -PL=$NANO_PACKAGE_DIR/_list -true > $PL -for i -do - ports_recurse `pwd`/$PL $i +for p do + ports_recurse "$PL" "$NANO_PKG_DUMP" "$p" done -for i in `cat $PL` -do - p=`(cd $i && make -V PKGNAME)` - if [ -f $NANO_PKG_DUMP/$p.t[bx]z ] ; then - ln -s $NANO_PKG_DUMP/$p.t[bx]z $NANO_PACKAGE_DIR +for i in `cat "$PL"` ; do + if [ -f "$NANO_PKG_DUMP/$i.txz" ] ; then + ln -s "$NANO_PKG_DUMP/$i.txz" "$NANO_PKG_DIR" else - echo "Package $p misssing in $NANO_PKG_DUMP" 1>&2 + echo "Package $i misssing in $NANO_PKG_DUMP" 1>&2 exit 1 fi done -rm -f $PL +rm -f "$PL" exit 0 From owner-dev-commits-src-all@freebsd.org Sun Jul 11 16:36:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3115C66AEA8; Sun, 11 Jul 2021 16:36: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 4GNCGC0W0Gz4SsM; Sun, 11 Jul 2021 16:36: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 EF2DB1ECEF; Sun, 11 Jul 2021 16:36: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 16BGaY6Z052919; Sun, 11 Jul 2021 16:36:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BGaYeH052918; Sun, 11 Jul 2021 16:36:34 GMT (envelope-from git) Date: Sun, 11 Jul 2021 16:36:34 GMT Message-Id: <202107111636.16BGaYeH052918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b21f19c9e0b7 - main - MINIMAL: remove debugging and some loadable network modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b21f19c9e0b7f3c923d845e9e31c0552f0162a62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 16:36:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b21f19c9e0b7f3c923d845e9e31c0552f0162a62 commit b21f19c9e0b7f3c923d845e9e31c0552f0162a62 Author: Helge Oldach AuthorDate: 2021-07-11 16:21:11 +0000 Commit: Warner Losh CommitDate: 2021-07-11 16:35:42 +0000 MINIMAL: remove debugging and some loadable network modules Remove deugging stuff, since it's arguably not needed in a minimal setup. Also vlan, tuntap and gif since they can be loaded. imp didn't include the part of the patch that removed xen guest support. Xen guest is relatively small and has no way of being loaded. Reviewed by: imp PR: 229564 MFC After: 3 days --- sys/amd64/conf/MINIMAL | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index b03b17b1bfcd..6678f0a7ee63 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 @@ -135,9 +125,6 @@ device loop # Network loopback device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tuntap # Packet tunnel. -device gif # IPv6 and IPv4 tunneling # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! From owner-dev-commits-src-all@freebsd.org Sun Jul 11 20:37:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7053F66EB13; Sun, 11 Jul 2021 20:37: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 4GNJbz2l3Qz3JXL; Sun, 11 Jul 2021 20:37: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 3B30C2213B; Sun, 11 Jul 2021 20:37: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 16BKbJae072823; Sun, 11 Jul 2021 20:37:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BKbJ2Q072822; Sun, 11 Jul 2021 20:37:19 GMT (envelope-from git) Date: Sun, 11 Jul 2021 20:37:19 GMT Message-Id: <202107112037.16BKbJ2Q072822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 4488c8c34ba3 - main - mount_nfs.8: Add information for "nconnect" to man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4488c8c34ba38146aab52fd60211bb32cdc87267 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 20:37:19 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4488c8c34ba38146aab52fd60211bb32cdc87267 commit 4488c8c34ba38146aab52fd60211bb32cdc87267 Author: Rick Macklem AuthorDate: 2021-07-11 20:34:16 +0000 Commit: Rick Macklem CommitDate: 2021-07-11 20:34:16 +0000 mount_nfs.8: Add information for "nconnect" to man page Commit 1e0a518d6548 added a new NFS mount option "nconnect". This patch adds information on this option to the man page. It also adds an IMPLEMENTATION section that explains how the default I/O size is determined and that "nfsstat -m" can be used to find out what option settings are actually in use. This is a content change. Reviewed by: gbe (manpages) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31135 --- sbin/mount_nfs/mount_nfs.8 | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 36a3c180b1e3..648cb2128e90 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd June 26, 2021 +.Dd July 10, 2021 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -196,6 +196,25 @@ If this is set to 0 it disables positive name caching for the mount point. Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds) for negative name cache entries. If this is set to 0 it disables negative name caching for the mount point. +.It Cm nconnect Ns = Ns Aq Ar value +Specify the number of TCP connections (1-16) to be used +for an NFS Version 4, minor version 1 or 2 mount. +Multiple TCP connections can provide more client to server network +bandwidth for certain network configurations such as: +.Bd -literal +- Multiple network interfaces that are aggregated together. +- A fast network interface that uses multiple queues. +.Ed +.sp +The first TCP connection will be used for all RPCs that consist +entirely of small RPC messages. +The RPCs that can have large RPC messages (Read/Readdir/Write) are +distributed over the additional TCP connections in a round robin +fashion. +This option will result in more IP port#s being used. +This option requires the +.Cm nfsv4 +option. .It Cm nfsv2 Use the NFS Version 2 protocol (the default is to try version 3 first then version 2). @@ -586,9 +605,31 @@ Same as Same as .Fl o Cm nfsv4 .El +.Sh IMPLEMENTATION NOTES +When neither the +.Cm rsize +nor +.Cm wsize +options are specified, the I/O size will be set to the largest value +supported by both the NFS client and server. +The largest value supported by the NFS client is defined by +the tunable +.Cd vfs.maxbcachebuf +which can be set to a power of two up to +.Cd kern.maxphys . +.Pp +The +.Xr nfsstat 1 +command with the +.Ic -m +command line option will show what +.Nm +option settings are actually in use for the mount. .Sh SEE ALSO +.Xr nfsstat 1 , .Xr nmount 2 , .Xr unmount 2 , +.Xr lagg 4 , .Xr nfsv4 4 , .Xr fstab 5 , .Xr gssd 8 , From owner-dev-commits-src-all@freebsd.org Sun Jul 11 20:58:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0AF2566EDDA; Sun, 11 Jul 2021 20:58:15 +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 4GNK466jgLz3Ls5; Sun, 11 Jul 2021 20:58: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 CE80A2258E; Sun, 11 Jul 2021 20:58: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 16BKwE8o099122; Sun, 11 Jul 2021 20:58:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BKwECM099121; Sun, 11 Jul 2021 20:58:14 GMT (envelope-from git) Date: Sun, 11 Jul 2021 20:58:14 GMT Message-Id: <202107112058.16BKwECM099121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 0c5a59252c8e - main - fsck_ffs: fix background fsck in preen mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c5a59252c8e7b80b98521ebc23a415a05ff9594 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 20:58:15 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=0c5a59252c8e7b80b98521ebc23a415a05ff9594 commit 0c5a59252c8e7b80b98521ebc23a415a05ff9594 Author: Robert Wing AuthorDate: 2021-07-11 20:47:27 +0000 Commit: Robert Wing CommitDate: 2021-07-11 20:47:27 +0000 fsck_ffs: fix background fsck in preen mode Background checks are only allowed for mounted filesystems - don't try to open the device for writing when performing a background check. While here, remove a debugging printf that's commented out. PR: 256746 Fixes: 5cc52631b3b88dfc36d8049dc8bece8573c5f9af Reviewed by: mckusick MFC After: 1 week Differential Revision: https://reviews.freebsd.org/D30880 --- sbin/fsck_ffs/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index edda3d785f09..90eb745ddabc 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -295,15 +295,14 @@ checkfilesys(char *filesys) */ if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) exit(3); /* Cannot read superblock */ - if (nflag || (fswritefd = open(filesys, O_WRONLY)) < 0) { + if (bkgrdflag == 0 && + (nflag || (fswritefd = open(filesys, O_WRONLY)) < 0)) { fswritefd = -1; if (preen) pfatal("NO WRITE ACCESS"); printf(" (NO WRITE)"); } if ((sblock.fs_flags & FS_GJOURNAL) != 0) { - //printf("GJournaled file system detected on %s.\n", - // filesys); if (sblock.fs_clean == 1) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); exit(0); @@ -317,10 +316,10 @@ checkfilesys(char *filesys) } else { pfatal( "UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n"); - close(fsreadfd); - close(fswritefd); } } + close(fsreadfd); + close(fswritefd); } /* * If we are to do a background check: From owner-dev-commits-src-all@freebsd.org Sun Jul 11 22:30:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BFC1666FC76; Sun, 11 Jul 2021 22:30: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 4GNM6M4tK2z3vDY; Sun, 11 Jul 2021 22:30: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 8FC4523A06; Sun, 11 Jul 2021 22:30: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 16BMUJsW025715; Sun, 11 Jul 2021 22:30:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BMUJen025708; Sun, 11 Jul 2021 22:30:19 GMT (envelope-from git) Date: Sun, 11 Jul 2021 22:30:19 GMT Message-Id: <202107112230.16BMUJen025708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 8a04edfdcbd2 - stable/13 - nfscl: Change the default minor version for NFSv4 mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a04edfdcbd2267ce8d8485374101bba580f5d83 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 22:30:19 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=8a04edfdcbd2267ce8d8485374101bba580f5d83 commit 8a04edfdcbd2267ce8d8485374101bba580f5d83 Author: Rick Macklem AuthorDate: 2021-06-25 01:52:23 +0000 Commit: Rick Macklem CommitDate: 2021-07-11 22:26:55 +0000 nfscl: Change the default minor version for NFSv4 mounts When NFSv4.1 support was added to the client, the implementation was still experimental and, as such, the default minor version was set to 0. Since the NFSv4.1 client implementation is now believed to be solid and the NFSv4.1/4.2 protocol is significantly better than NFSv4.0, I beieve that NFSv4.1/4.2 should be used where possible. This patch changes the default minor version for NFSv4 to be the highest minor version supported by the NFSv4 server. If a specific minor version is desired, the "minorversion" mount option can be used to override this default. This is compatible with the Linux NFSv4 client behaviour. This was discussed on freebsd-current@ in mid-May 2021 under the subject "changing the default NFSv4 minor version" and the consensus seemed to be support for this change. It also appeared that changing this for FreeBSD 13.1 was not considered a POLA violation, so long as UPDATING and RELNOTES entries were made for it. (cherry picked from commit a145cf3f73c7d0f6071a6bddbe8a50a280285900) --- sys/fs/nfsclient/nfs_clstate.c | 9 ++++++++- sys/fs/nfsclient/nfs_clvfsops.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index fb90c80c69e7..8ea5d77d2053 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -959,11 +959,18 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, error == NFSERR_BADSESSION || error == NFSERR_CLIDINUSE) { (void) nfs_catnap(PZERO, error, "nfs_setcl"); + } else if (error == NFSERR_MINORVERMISMATCH && + tryminvers) { + if (nmp->nm_minorvers > 0) + nmp->nm_minorvers--; + else + tryminvers = false; } } while (((error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION || error == NFSERR_STALEDONTRECOVER) && --trystalecnt > 0) || - (error == NFSERR_CLIDINUSE && --clidinusedelay > 0)); + (error == NFSERR_CLIDINUSE && --clidinusedelay > 0) || + (error == NFSERR_MINORVERMISMATCH && tryminvers)); if (error) { NFSLOCKCLSTATE(); nfsv4_unlock(&clp->nfsc_lock, 0); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 5abd41dee1a1..974bc684bf5b 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -895,7 +895,7 @@ nfs_mount(struct mount *mp) char *cp, *opt, *name, *secname, *tlscertname; int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; - int minvers = 0; + int minvers = -1; int dirlen, has_nfs_args_opt, has_nfs_from_opt, krbnamelen, srvkrbnamelen; size_t hstlen; @@ -1417,6 +1417,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, struct nfsclclient *clp; struct nfsclds *dsp, *tdsp; uint32_t lease; + bool tryminvers; static u_int64_t clval = 0; #ifdef KERN_TLS u_int maxlen; @@ -1521,9 +1522,14 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_wcommitsize *= 2; nmp->nm_wcommitsize *= 256; - if ((argp->flags & NFSMNT_NFSV4) != 0) + tryminvers = false; + if ((argp->flags & NFSMNT_NFSV4) != 0) { + if (minvers < 0) { + tryminvers = true; + minvers = NFSV42_MINORVERSION; + } nmp->nm_minorvers = minvers; - else + } else nmp->nm_minorvers = 0; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1574,7 +1580,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { NFSCL_DEBUG(3, "at getcl\n"); - error = nfscl_getcl(mp, cred, td, false, &clp); + error = nfscl_getcl(mp, cred, td, tryminvers, &clp); NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; From owner-dev-commits-src-all@freebsd.org Sun Jul 11 22:33:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1D6CC66FCE2; Sun, 11 Jul 2021 22:33: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 4GNM9c52Xfz3vpj; Sun, 11 Jul 2021 22:33: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 938282391D; Sun, 11 Jul 2021 22:33: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 16BMX8Xr032148; Sun, 11 Jul 2021 22:33:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BMX8Jq032147; Sun, 11 Jul 2021 22:33:08 GMT (envelope-from git) Date: Sun, 11 Jul 2021 22:33:08 GMT Message-Id: <202107112233.16BMX8Jq032147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 50f2705d2674 - stable/13 - mount_nfs.8: Update the man page for commit a145cf3f73c7 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 50f2705d267491b27376d37ee25986f33f92271e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 22:33:09 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=50f2705d267491b27376d37ee25986f33f92271e commit 50f2705d267491b27376d37ee25986f33f92271e Author: Rick Macklem AuthorDate: 2021-06-26 21:09:28 +0000 Commit: Rick Macklem CommitDate: 2021-07-11 22:30:01 +0000 mount_nfs.8: Update the man page for commit a145cf3f73c7 The NFSv4 client now uses the highest minor version of NFSv4 by default instead of minor version 0, for NFSv4 mounts. The "minorversion" mount option may be used to override this default. This patch updates the man page to reflect this change. While here, fix nfsstat(8) to be nfsstat(1). (cherry picked from commit b413b03597db10dbee514141b10f7c7ef236abe6) --- sbin/mount_nfs/mount_nfs.8 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 76e009817d8b..36a3c180b1e3 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd January 17, 2021 +.Dd June 26, 2021 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -206,9 +206,15 @@ Use the NFS Version 3 protocol. Use the NFS Version 4 protocol. This option will force the mount to use TCP transport. +By default, the highest minor version of NFS Version 4 that is +supported by the NFS Version 4 server will be used. +See the +.Cm minorversion +option. .It Cm minorversion Ns = Ns Aq Ar value -Override the default of 0 for the minor version of the NFS Version 4 protocol. -The minor versions other than 0 currently supported are 1 and 2. +Use the specified minor version for a NFS Version 4 mount, +overriding the default. +The minor versions supported are 0, 1, and 2. This option is only meaningful when used with the .Cm nfsv4 option. @@ -221,7 +227,7 @@ It may be required when an accumulation of NFS version 4 Opens occurs, as indicated by the .Dq Opens count displayed by -.Xr nfsstat 8 +.Xr nfsstat 1 with the .Fl c and @@ -231,22 +237,16 @@ A common case for an accumulation of Opens is a shared library within the NFS mount that is used by several processes, where at least one of these processes is always running. This option cannot be used for an NFS Version 4, minor version 0 mount. -As such, this option requires the -.Cm minorversion -option be specified with a value of 1 for AmazonEFS, because AmazonEFS does -not support minor version 2 at this time. It may not work correctly when Delegations are being issued by a server, but note that the AmazonEFS server does not issued delegations at this time. This option is only meaningful when used with the .Cm nfsv4 -and -.Cm minorversion -options. +option. .It Cm pnfs Enable support for parallel NFS (pNFS) for minor version 1 or 2 of the NFS Version 4 protocol. This option is only meaningful when used with the -.Cm minorversion +.Cm nfsv4 option. .It Cm noac Disable attribute caching. From owner-dev-commits-src-all@freebsd.org Sun Jul 11 22:42:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A7BB864948E; Sun, 11 Jul 2021 22:42: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 4GNMMv4QyQz3wRb; Sun, 11 Jul 2021 22:42: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 8069B23CD7; Sun, 11 Jul 2021 22:42: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 16BMg3m0042718; Sun, 11 Jul 2021 22:42:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BMg3Po042717; Sun, 11 Jul 2021 22:42:03 GMT (envelope-from git) Date: Sun, 11 Jul 2021 22:42:03 GMT Message-Id: <202107112242.16BMg3Po042717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: e5c2f39823d1 - stable/13 - UPDATING: Add an entry for commit 8a04edfdcbd2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e5c2f39823d103007e3a4d5492b36835c70dc4ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 22:42:03 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e5c2f39823d103007e3a4d5492b36835c70dc4ef commit e5c2f39823d103007e3a4d5492b36835c70dc4ef Author: Rick Macklem AuthorDate: 2021-07-11 22:39:23 +0000 Commit: Rick Macklem CommitDate: 2021-07-11 22:39:23 +0000 UPDATING: Add an entry for commit 8a04edfdcbd2 This is a direct commit. --- UPDATING | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/UPDATING b/UPDATING index 8dd158f0a05c..073e9b03867a 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,15 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20210711: + Commit 8a04edfdcbd2 changes the default minor version + used for NFSv4 mounts to the highest minor version supported + by the NFSv4 server. This default can be overridden by using + the "minorversion" mount option. + The consensus of a discussion on freebsd-current@ indicated + that this would be acceptable to do and would not be considered + a POLA violation. + 20210630: Commit ca179c4d74f2/632e3f2f3a66 changed the package in which the OpenSSL libraries and utilities are packaged. From owner-dev-commits-src-all@freebsd.org Sun Jul 11 22:47:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B3F516495C9; Sun, 11 Jul 2021 22:47: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 4GNMVQ4m3Fz4RFr; Sun, 11 Jul 2021 22:47: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 8739F23D1E; Sun, 11 Jul 2021 22:47: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 16BMlgig045740; Sun, 11 Jul 2021 22:47:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BMlgLE045739; Sun, 11 Jul 2021 22:47:42 GMT (envelope-from git) Date: Sun, 11 Jul 2021 22:47:42 GMT Message-Id: <202107112247.16BMlgLE045739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: ac0343b88ddc - stable/13 - RELNOTES: Add an entry for commit 8a04edfdcbd2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ac0343b88ddc439437874ce3e4c0f6deac81d9ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 22:47:42 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ac0343b88ddc439437874ce3e4c0f6deac81d9ae commit ac0343b88ddc439437874ce3e4c0f6deac81d9ae Author: Rick Macklem AuthorDate: 2021-07-11 22:45:00 +0000 Commit: Rick Macklem CommitDate: 2021-07-11 22:45:00 +0000 RELNOTES: Add an entry for commit 8a04edfdcbd2 This is a direct commit. --- RELNOTES | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RELNOTES b/RELNOTES index 320d947c24e7..1e8c23f98703 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,12 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +8a04edfdcbd2: + Change the default minor version used for an NFSv4 mount + to the highest minor version supported by the NFSv4 server. + This default can be overridden by using the "minorversion" + mount option. + 2c76eebca71b, 59f6f5e23c1a: Add two daemons rpc.tlsclntd(8) and rpc.tlsservd(8) that provide support for NFS-over-TLS as described in the Internet Draft titled From owner-dev-commits-src-all@freebsd.org Sun Jul 11 23:29:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE10464A313; Sun, 11 Jul 2021 23:29:18 +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 4GNNQQ537xz4XWw; Sun, 11 Jul 2021 23:29:18 +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 956B723F6F; Sun, 11 Jul 2021 23:29:18 +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 16BNTIBY099114; Sun, 11 Jul 2021 23:29:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BNTIf2099113; Sun, 11 Jul 2021 23:29:18 GMT (envelope-from git) Date: Sun, 11 Jul 2021 23:29:18 GMT Message-Id: <202107112329.16BNTIf2099113@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: 2e96f2635591 - stable/13 - clang: stop linking _p libs for -pg as of FreeBSD 14 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/13 X-Git-Reftype: branch X-Git-Commit: 2e96f2635591abb839c92566046e3a9b6ee5ff35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 23:29:18 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2e96f2635591abb839c92566046e3a9b6ee5ff35 commit 2e96f2635591abb839c92566046e3a9b6ee5ff35 Author: Ed Maste AuthorDate: 2021-06-26 23:58:16 +0000 Commit: Ed Maste CommitDate: 2021-07-11 23:27:47 +0000 clang: stop linking _p libs for -pg as of FreeBSD 14 In FreeBSD 14 we will stop providing _p libraries (compiled with -pg). [Note this is controlled by the target version. There is no change for FreeBSD <= 13.] Reviewed by: dim (upstream) Obtained from: LLVM 699d47472c3f MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30861 (cherry picked from commit b762974cf4b9ea77f1decf4a6d829372f0a97f75) --- .../clang/lib/Driver/ToolChains/FreeBSD.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp index baefb1607619..c14f34b6107c 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -286,6 +286,8 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); + bool Profiling = Args.hasArg(options::OPT_pg) && + ToolChain.getTriple().getOSMajorVersion() < 14; if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { // Use the static OpenMP runtime with -static-openmp bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && @@ -295,7 +297,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (D.CCCIsCXX()) { if (ToolChain.ShouldLinkCXXStdlib(Args)) ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lm_p"); else CmdArgs.push_back("-lm"); @@ -306,13 +308,13 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, linkXRayRuntimeDeps(ToolChain, CmdArgs); // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding // the default system libraries. Just mimic this for now. - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lgcc_p"); else CmdArgs.push_back("-lgcc"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-lgcc_eh"); - } else if (Args.hasArg(options::OPT_pg)) { + } else if (Profiling) { CmdArgs.push_back("-lgcc_eh_p"); } else { CmdArgs.push_back("--as-needed"); @@ -321,13 +323,13 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, } if (Args.hasArg(options::OPT_pthread)) { - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lpthread_p"); else CmdArgs.push_back("-lpthread"); } - if (Args.hasArg(options::OPT_pg)) { + if (Profiling) { if (Args.hasArg(options::OPT_shared)) CmdArgs.push_back("-lc"); else @@ -340,7 +342,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-lgcc_eh"); - } else if (Args.hasArg(options::OPT_pg)) { + } else if (Profiling) { CmdArgs.push_back("-lgcc_eh_p"); } else { CmdArgs.push_back("--as-needed"); @@ -408,7 +410,8 @@ void FreeBSD::addLibStdCxxIncludePaths( void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { CXXStdlibType Type = GetCXXStdlibType(Args); - bool Profiling = Args.hasArg(options::OPT_pg); + bool Profiling = + Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14; switch (Type) { case ToolChain::CST_Libcxx: From owner-dev-commits-src-all@freebsd.org Sun Jul 11 23:30:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A8DBD64A14D; Sun, 11 Jul 2021 23: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 4GNNRt4SrQz4XZX; Sun, 11 Jul 2021 23: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 81FDC23F71; Sun, 11 Jul 2021 23:30: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 16BNUY9t007619; Sun, 11 Jul 2021 23:30:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16BNUYp5007618; Sun, 11 Jul 2021 23:30:34 GMT (envelope-from git) Date: Sun, 11 Jul 2021 23:30:34 GMT Message-Id: <202107112330.16BNUYp5007618@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: d004f3428f95 - stable/12 - clang: stop linking _p libs for -pg as of FreeBSD 14 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: d004f3428f9532837275b0b8e2458dc56f2aab7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2021 23:30:34 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d004f3428f9532837275b0b8e2458dc56f2aab7c commit d004f3428f9532837275b0b8e2458dc56f2aab7c Author: Ed Maste AuthorDate: 2021-06-26 23:58:16 +0000 Commit: Ed Maste CommitDate: 2021-07-11 23:29:51 +0000 clang: stop linking _p libs for -pg as of FreeBSD 14 In FreeBSD 14 we will stop providing _p libraries (compiled with -pg). [Note this is controlled by the target version. There is no change for FreeBSD <= 13.] Reviewed by: dim (upstream) Obtained from: LLVM 699d47472c3f MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30861 (cherry picked from commit b762974cf4b9ea77f1decf4a6d829372f0a97f75) --- .../clang/lib/Driver/ToolChains/FreeBSD.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp index 6fb4ddd7f501..37ea8bed0745 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -284,6 +284,8 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); + bool Profiling = Args.hasArg(options::OPT_pg) && + ToolChain.getTriple().getOSMajorVersion() < 14; if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { // Use the static OpenMP runtime with -static-openmp bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && @@ -293,7 +295,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (D.CCCIsCXX()) { if (ToolChain.ShouldLinkCXXStdlib(Args)) ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lm_p"); else CmdArgs.push_back("-lm"); @@ -304,13 +306,13 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, linkXRayRuntimeDeps(ToolChain, CmdArgs); // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding // the default system libraries. Just mimic this for now. - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lgcc_p"); else CmdArgs.push_back("-lgcc"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-lgcc_eh"); - } else if (Args.hasArg(options::OPT_pg)) { + } else if (Profiling) { CmdArgs.push_back("-lgcc_eh_p"); } else { CmdArgs.push_back("--as-needed"); @@ -319,13 +321,13 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, } if (Args.hasArg(options::OPT_pthread)) { - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lpthread_p"); else CmdArgs.push_back("-lpthread"); } - if (Args.hasArg(options::OPT_pg)) { + if (Profiling) { if (Args.hasArg(options::OPT_shared)) CmdArgs.push_back("-lc"); else @@ -338,7 +340,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-lgcc_eh"); - } else if (Args.hasArg(options::OPT_pg)) { + } else if (Profiling) { CmdArgs.push_back("-lgcc_eh_p"); } else { CmdArgs.push_back("--as-needed"); @@ -405,7 +407,8 @@ void FreeBSD::addLibStdCxxIncludePaths( void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { CXXStdlibType Type = GetCXXStdlibType(Args); - bool Profiling = Args.hasArg(options::OPT_pg); + bool Profiling = + Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14; switch (Type) { case ToolChain::CST_Libcxx: