From nobody Mon Nov 1 00:45:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A17731829855; Mon, 1 Nov 2021 00:45: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 4HjDq85rCdz4d7f; Mon, 1 Nov 2021 00:45: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 39CF727CED; Mon, 1 Nov 2021 00:45: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 1A10ju4R005085; Mon, 1 Nov 2021 00:45:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A10juYR005084; Mon, 1 Nov 2021 00:45:56 GMT (envelope-from git) Date: Mon, 1 Nov 2021 00:45:56 GMT Message-Id: <202111010045.1A10juYR005084@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: 7db438d4705e - stable/13 - vm_object_list: split sysctl handler in separate function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 7db438d4705ee741368a4392233e8df60c37002d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7db438d4705ee741368a4392233e8df60c37002d commit 7db438d4705ee741368a4392233e8df60c37002d Author: Konstantin Belousov AuthorDate: 2021-07-13 10:23:25 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 00:44:51 +0000 vm_object_list: split sysctl handler in separate function (cherry picked from commit 1b610624fdc851f54871f7ee4d67642f5879096f) --- sys/vm/vm_object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 9bd3f416ff94..533d1e37318e 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2471,7 +2471,7 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) } static int -sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) +vm_object_list_handler(struct sysctl_req *req) { struct kinfo_vmobject *kvo; char *fullpath, *freepath; @@ -2588,6 +2588,13 @@ sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) free(kvo, M_TEMP); return (error); } + +static int +sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) +{ + return (vm_object_list_handler(req)); +} + SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_object_list, "S,kinfo_vmobject", "List of VM objects"); From nobody Mon Nov 1 00:45:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7F4961829A08; Mon, 1 Nov 2021 00:46: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 4HjDqB4gdvz4d58; Mon, 1 Nov 2021 00:45: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 7796327D19; Mon, 1 Nov 2021 00:45: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 1A10jwNf005137; Mon, 1 Nov 2021 00:45:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A10jw70005136; Mon, 1 Nov 2021 00:45:58 GMT (envelope-from git) Date: Mon, 1 Nov 2021 00:45:58 GMT Message-Id: <202111010045.1A10jw70005136@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: 5ac0e08ef609 - stable/13 - vm.objects_swap: disable reporting some information List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 5ac0e08ef6099a8a20d534fef884ee8ee32b2dbf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5ac0e08ef6099a8a20d534fef884ee8ee32b2dbf commit 5ac0e08ef6099a8a20d534fef884ee8ee32b2dbf Author: Konstantin Belousov AuthorDate: 2021-07-13 10:34:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 00:44:51 +0000 vm.objects_swap: disable reporting some information (cherry picked from commit 7738118e9a298a205b37c256245fd8449acccb0c) --- sys/vm/vm_object.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index addcf5f2c686..9462e8753afb 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2526,20 +2526,22 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) kvo->kvo_memattr = obj->memattr; kvo->kvo_active = 0; kvo->kvo_inactive = 0; - TAILQ_FOREACH(m, &obj->memq, listq) { - /* - * A page may belong to the object but be - * dequeued and set to PQ_NONE while the - * object lock is not held. This makes the - * reads of m->queue below racy, and we do not - * count pages set to PQ_NONE. However, this - * sysctl is only meant to give an - * approximation of the system anyway. - */ - if (m->a.queue == PQ_ACTIVE) - kvo->kvo_active++; - else if (m->a.queue == PQ_INACTIVE) - kvo->kvo_inactive++; + if (!swap_only) { + TAILQ_FOREACH(m, &obj->memq, listq) { + /* + * A page may belong to the object but be + * dequeued and set to PQ_NONE while the + * object lock is not held. This makes the + * reads of m->queue below racy, and we do not + * count pages set to PQ_NONE. However, this + * sysctl is only meant to give an + * approximation of the system anyway. + */ + if (m->a.queue == PQ_ACTIVE) + kvo->kvo_active++; + else if (m->a.queue == PQ_INACTIVE) + kvo->kvo_inactive++; + } } kvo->kvo_vn_fileid = 0; @@ -2547,7 +2549,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) kvo->kvo_vn_fsid_freebsd11 = 0; freepath = NULL; fullpath = ""; - kvo->kvo_type = vm_object_kvme_type(obj, &vp); + vp = NULL; + kvo->kvo_type = vm_object_kvme_type(obj, swap_only ? NULL : &vp); if (vp != NULL) { vref(vp); } else if ((obj->flags & OBJ_ANON) != 0) { From nobody Mon Nov 1 00:45:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 894B5182987E; Mon, 1 Nov 2021 00:46: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 4HjDq93kG5z4d9s; Mon, 1 Nov 2021 00:45: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 5507827D18; Mon, 1 Nov 2021 00:45: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 1A10jvQV005109; Mon, 1 Nov 2021 00:45:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A10jvMU005108; Mon, 1 Nov 2021 00:45:57 GMT (envelope-from git) Date: Mon, 1 Nov 2021 00:45:57 GMT Message-Id: <202111010045.1A10jvMU005108@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: c54be5cfcf70 - stable/13 - Add vm.swap_objects sysctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c54be5cfcf70953b8e0a8c1fcf9a6d5005516f55 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c54be5cfcf70953b8e0a8c1fcf9a6d5005516f55 commit c54be5cfcf70953b8e0a8c1fcf9a6d5005516f55 Author: Konstantin Belousov AuthorDate: 2021-07-13 10:27:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 00:44:51 +0000 Add vm.swap_objects sysctl (cherry picked from commit 42812ccc969f174b3e5827c1c320b1738a1e0985) --- sys/vm/vm_object.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 533d1e37318e..addcf5f2c686 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2471,7 +2471,7 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) } static int -vm_object_list_handler(struct sysctl_req *req) +vm_object_list_handler(struct sysctl_req *req, bool swap_only) { struct kinfo_vmobject *kvo; char *fullpath, *freepath; @@ -2509,10 +2509,12 @@ vm_object_list_handler(struct sysctl_req *req) */ mtx_lock(&vm_object_list_mtx); TAILQ_FOREACH(obj, &vm_object_list, object_list) { - if (obj->type == OBJT_DEAD) + if (obj->type == OBJT_DEAD || + (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) continue; VM_OBJECT_RLOCK(obj); - if (obj->type == OBJT_DEAD) { + if (obj->type == OBJT_DEAD || + (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) { VM_OBJECT_RUNLOCK(obj); continue; } @@ -2592,13 +2594,31 @@ vm_object_list_handler(struct sysctl_req *req) static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { - return (vm_object_list_handler(req)); + return (vm_object_list_handler(req, false)); } SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_object_list, "S,kinfo_vmobject", "List of VM objects"); +static int +sysctl_vm_object_list_swap(SYSCTL_HANDLER_ARGS) +{ + return (vm_object_list_handler(req, true)); +} + +/* + * This sysctl returns list of the anonymous or swap objects. Intent + * is to provide stripped optimized list useful to analyze swap use. + * Since technically non-swap (default) objects participate in the + * shadow chains, and are converted to swap type as needed by swap + * pager, we must report them. + */ +SYSCTL_PROC(_vm, OID_AUTO, swap_objects, + CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, 0, + sysctl_vm_object_list_swap, "S,kinfo_vmobject", + "List of swap VM objects"); + #include "opt_ddb.h" #ifdef DDB #include From nobody Mon Nov 1 00:46:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7456F1829957; Mon, 1 Nov 2021 00:46: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 4HjDqF0p72z4dBC; Mon, 1 Nov 2021 00:46: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 B7F4A27D1A; Mon, 1 Nov 2021 00:46: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 1A10k0Kf005188; Mon, 1 Nov 2021 00:46:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A10k0KU005187; Mon, 1 Nov 2021 00:46:00 GMT (envelope-from git) Date: Mon, 1 Nov 2021 00:46:00 GMT Message-Id: <202111010046.1A10k0KU005187@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: cfccf3baca5c - stable/13 - libutil: add kinfo_getswapvmobject(3) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: cfccf3baca5c26feb9fb4b72a980ea85d3f4f810 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cfccf3baca5c26feb9fb4b72a980ea85d3f4f810 commit cfccf3baca5c26feb9fb4b72a980ea85d3f4f810 Author: Konstantin Belousov AuthorDate: 2021-10-26 08:40:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 00:44:51 +0000 libutil: add kinfo_getswapvmobject(3) (cherry picked from commit f2069331e5821f4c2b65d82af2809946a34158d2) --- lib/libutil/kinfo_getvmobject.c | 20 ++++++++++++++++---- lib/libutil/libutil.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/libutil/kinfo_getvmobject.c b/lib/libutil/kinfo_getvmobject.c index de55650a518b..4bf666fd7f3b 100644 --- a/lib/libutil/kinfo_getvmobject.c +++ b/lib/libutil/kinfo_getvmobject.c @@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$"); #include "libutil.h" -struct kinfo_vmobject * -kinfo_getvmobject(int *cntp) +static struct kinfo_vmobject * +kinfo_getvmobject_impl(int *cntp, const char *vmobjsysctl) { char *buf, *bp, *ep; struct kinfo_vmobject *kvo, *list, *kp; @@ -46,14 +46,14 @@ kinfo_getvmobject(int *cntp) buf = NULL; for (i = 0; i < 3; i++) { - if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0) { + if (sysctlbyname(vmobjsysctl, NULL, &len, NULL, 0) < 0) { free(buf); return (NULL); } buf = reallocf(buf, len); if (buf == NULL) return (NULL); - if (sysctlbyname("vm.objects", buf, &len, NULL, 0) == 0) + if (sysctlbyname(vmobjsysctl, buf, &len, NULL, 0) == 0) goto unpack; if (errno != ENOMEM) { free(buf); @@ -94,3 +94,15 @@ unpack: *cntp = cnt; return (list); } + +struct kinfo_vmobject * +kinfo_getvmobject(int *cntp) +{ + return (kinfo_getvmobject_impl(cntp, "vm.objects")); +} + +struct kinfo_vmobject * +kinfo_getswapvmobject(int *cntp) +{ + return (kinfo_getvmobject_impl(cntp, "vm.swap_objects")); +} diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h index bb96b2caa502..17c44de0fce7 100644 --- a/lib/libutil/libutil.h +++ b/lib/libutil/libutil.h @@ -109,6 +109,8 @@ struct kinfo_vmentry * kinfo_getvmmap(pid_t _pid, int *_cntp); struct kinfo_vmobject * kinfo_getvmobject(int *_cntp); +struct kinfo_vmobject * + kinfo_getswapvmobject(int *_cntp); struct kinfo_proc * kinfo_getallproc(int *_cntp); struct kinfo_proc * From nobody Mon Nov 1 00:45:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D388D182967D; Mon, 1 Nov 2021 00:46: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 4HjDqC5wz6z4dR4; Mon, 1 Nov 2021 00:45: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 91BA327BCE; Mon, 1 Nov 2021 00:45: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 1A10jxLN005164; Mon, 1 Nov 2021 00:45:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A10jx4w005163; Mon, 1 Nov 2021 00:45:59 GMT (envelope-from git) Date: Mon, 1 Nov 2021 00:45:59 GMT Message-Id: <202111010045.1A10jx4w005163@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: 9b392d07381e - stable/13 - sysctl vm.objects: yield if hog List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 9b392d07381e6129a1f5e6280ed5b603a3b4d3db Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b392d07381e6129a1f5e6280ed5b603a3b4d3db commit 9b392d07381e6129a1f5e6280ed5b603a3b4d3db Author: Konstantin Belousov AuthorDate: 2021-05-07 22:13:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 00:44:51 +0000 sysctl vm.objects: yield if hog (cherry picked from commit 350fc36b4cf896cbfce657a6dab600b26367a34a) --- sys/vm/vm_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 9462e8753afb..5bbe7faed50b 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2585,6 +2585,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) kvo->kvo_structsize = roundup(kvo->kvo_structsize, sizeof(uint64_t)); error = SYSCTL_OUT(req, kvo, kvo->kvo_structsize); + maybe_yield(); mtx_lock(&vm_object_list_mtx); if (error) break; From nobody Mon Nov 1 00:46:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 036FF1829C09; Mon, 1 Nov 2021 00:46: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 4HjDqG0F7tz4dM3; Mon, 1 Nov 2021 00:46: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 CE1AE279E3; Mon, 1 Nov 2021 00:46: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 1A10k19d005212; Mon, 1 Nov 2021 00:46:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A10k1mg005211; Mon, 1 Nov 2021 00:46:01 GMT (envelope-from git) Date: Mon, 1 Nov 2021 00:46:01 GMT Message-Id: <202111010046.1A10k1mg005211@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: f33a9999e2a4 - stable/13 - Augment systat(1) -swap to display large swap space processes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: f33a9999e2a458afe4b9c8f5cee42b30feb308ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f33a9999e2a458afe4b9c8f5cee42b30feb308ee commit f33a9999e2a458afe4b9c8f5cee42b30feb308ee Author: Konstantin Belousov AuthorDate: 2021-10-26 08:43:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 00:44:51 +0000 Augment systat(1) -swap to display large swap space processes (cherry picked from commit 57e5da2c98003e5ab77a337e9fbe22ab7e512ba7) --- usr.bin/systat/Makefile | 4 +- usr.bin/systat/proc.c | 309 ++++++++++++++++++++++++++++++++++++++++++++++++ usr.bin/systat/swap.c | 24 ++-- usr.bin/systat/sysput.c | 24 +--- usr.bin/systat/systat.1 | 30 ++++- usr.bin/systat/systat.h | 6 + 6 files changed, 361 insertions(+), 36 deletions(-) diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile index ca3f7ed72ce4..bfbe1336d291 100644 --- a/usr.bin/systat/Makefile +++ b/usr.bin/systat/Makefile @@ -5,7 +5,7 @@ PROG= systat SRCS= cmds.c cmdtab.c devs.c fetch.c iostat.c keyboard.c main.c sysput.c \ - netcmds.c netstat.c pigs.c swap.c icmp.c \ + netcmds.c netstat.c pigs.c proc.c swap.c icmp.c \ mode.c ip.c sctp.c tcp.c zarc.c \ vmstat.c convtbl.c ifcmds.c ifstat.c @@ -16,6 +16,6 @@ CFLAGS+= -DINET6 WARNS?= 1 -LIBADD= ncursesw m devstat kvm util +LIBADD= ncursesw m devstat kvm util procstat .include diff --git a/usr.bin/systat/proc.c b/usr.bin/systat/proc.c new file mode 100644 index 000000000000..58c3bea64239 --- /dev/null +++ b/usr.bin/systat/proc.c @@ -0,0 +1,309 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Yoshihiro Ota + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "systat.h" +#include "extern.h" + +/* + * vm objects of swappable types + */ +static struct swapvm { + uint64_t kvo_me; + uint32_t swapped; /* in pages */ + uint64_t next; + pid_t pid; /* to avoid double counting */ +} *swobj = NULL; +static int nswobj = 0; + +static struct procstat *prstat = NULL; +/* + *procstat_getvmmap() is an expensive call and the number of processes running + * may also be high. So, maintain an array of pointers for ease of expanding + * an array and also swapping pointers are faster than struct. + */ +static struct proc_usage { + pid_t pid; + uid_t uid; + char command[COMMLEN + 1]; + uint64_t total; + uint32_t pages; +} **pu = NULL; +static unsigned int nproc; +static int proc_compar(const void *, const void *); + +static void +display_proc_line(int idx, int y, uint64_t totalswappages) +{ + int offset = 0, rate; + const char *uname, *pname; + char buf[30]; + uint64_t swapbytes; + + wmove(wnd, y, 0); + wclrtoeol(wnd); + if (idx >= nproc) + return; + + uname = user_from_uid(pu[idx]->uid, 0); + swapbytes = ptoa(pu[idx]->pages); + + snprintf(buf, sizeof(buf), "%6d %-10s %-10.10s", pu[idx]->pid, uname, + pu[idx]->command); + offset = 6 + 1 + 10 + 1 + 10 + 1; + mvwaddstr(wnd, y, 0, buf); + sysputuint64(wnd, y, offset, 4, swapbytes, 0); + offset += 4; + mvwaddstr(wnd, y, offset, " / "); + offset += 3; + sysputuint64(wnd, y, offset, 4, pu[idx]->total, 0); + offset += 4; + + rate = pu[idx]->total > 1 ? 100 * swapbytes / pu[idx]->total : 0; + snprintf(buf, sizeof(buf), "%3d%%", rate); + mvwaddstr(wnd, y, offset, buf); + if (rate > 100) /* avoid running over the screen */ + rate = 100; + sysputXs(wnd, y, offset + 5, rate / 10); + + rate = 100 * pu[idx]->pages / totalswappages; + snprintf(buf, sizeof(buf), "%3d%%", rate); + mvwaddstr(wnd, y, offset + 16, buf); + if (rate > 100) /* avoid running over the screen */ + rate = 100; + sysputXs(wnd, y, offset + 21, rate / 10); +} + +static int +swobj_search(const void *a, const void *b) +{ + const uint64_t *aa = a; + const struct swapvm *bb = b; + + if (*aa == bb->kvo_me) + return (0); + return (*aa > bb->kvo_me ? -1 : 1); +} + +static int +swobj_sort(const void *a, const void *b) +{ + + return ((((const struct swapvm *) a)->kvo_me > + ((const struct swapvm *) b)->kvo_me) ? -1 : 1); +} + +static bool +get_swap_vmobjects(void) +{ + static int maxnobj; + int cnt, i, next_i, last_nswobj; + struct kinfo_vmobject *kvo; + + next_i = nswobj = 0; + kvo = kinfo_getswapvmobject(&cnt); + if (kvo == NULL) { + error("kinfo_getswapvmobject()"); + return (false); + } + do { + for (i = next_i; i < cnt; i++) { + if (kvo[i].kvo_type != KVME_TYPE_DEFAULT && + kvo[i].kvo_type != KVME_TYPE_SWAP) + continue; + if (nswobj < maxnobj) { + swobj[nswobj].kvo_me = kvo[i].kvo_me; + swobj[nswobj].swapped = kvo[i].kvo_swapped; + swobj[nswobj].next = kvo[i].kvo_backing_obj; + swobj[nswobj].pid = 0; + next_i = i + 1; + } + nswobj++; + } + if (nswobj <= maxnobj) + break; + /* allocate memory and fill skipped elements */ + last_nswobj = maxnobj; + maxnobj = nswobj; + nswobj = last_nswobj; + /* allocate more memory and fill missed ones */ + if ((swobj = reallocf(swobj, maxnobj * sizeof(*swobj))) == + NULL) { + error("Out of memory"); + die(0); + } + } while (i <= cnt); /* extra safety guard */ + free(kvo); + if (nswobj > 1) + qsort(swobj, nswobj, sizeof(swobj[0]), swobj_sort); + return (nswobj > 0); +} + +/* This returns the number of swap pages a process uses. */ +static uint32_t +per_proc_swap_usage(struct kinfo_proc *kipp) +{ + int i, cnt; + uint32_t pages = 0; + uint64_t vmobj; + struct kinfo_vmentry *freep, *kve; + struct swapvm *vm; + + freep = procstat_getvmmap(prstat, kipp, &cnt); + if (freep == NULL) + return (pages); + + for (i = 0; i < cnt; i++) { + kve = &freep[i]; + if (kve->kve_type == KVME_TYPE_DEFAULT || + kve->kve_type == KVME_TYPE_SWAP) { + vmobj = kve->kve_obj; + do { + vm = bsearch(&vmobj, swobj, nswobj, + sizeof(swobj[0]), swobj_search); + if (vm != NULL && vm->pid != kipp->ki_pid) { + pages += vm->swapped; + vmobj = vm->next; + vm->pid = kipp->ki_pid; + } else + break; + } while (vmobj != 0); + } + } + free(freep); + return (pages); +} + +void +closeproc(WINDOW *w) +{ + + if (prstat != NULL) + procstat_close(prstat); + prstat = NULL; + if (w == NULL) + return; + wclear(w); + wrefresh(w); + delwin(w); +} + +void +procshow(int col, int hight, uint64_t totalswappages) +{ + int i, y; + + for (i = 0, y = col + 1 /* HEADING */; i < hight; i++, y++) + display_proc_line(i, y, totalswappages); +} + +int +procinit(void) +{ + + if (prstat == NULL) + prstat = procstat_open_sysctl(); + return (prstat != NULL); +} + +void +procgetinfo(void) +{ + static unsigned int maxnproc = 0; + int cnt, i; + uint32_t pages; + struct kinfo_proc *kipp; + + nproc = 0; + if ( ! get_swap_vmobjects() ) /* call failed or nothing is paged-out */ + return; + + kipp = procstat_getprocs(prstat, KERN_PROC_PROC, 0, &cnt); + if (kipp == NULL) { + error("procstat_getprocs()"); + return; + } + if (maxnproc < cnt) { + if ((pu = realloc(pu, cnt * sizeof(*pu))) == NULL) { + error("Out of memory"); + die(0); + } + memset(&pu[maxnproc], 0, (cnt - maxnproc) * sizeof(pu[0])); + maxnproc = cnt; + } + + for (i = 0; i < cnt; i++) { + pages = per_proc_swap_usage(&kipp[i]); + if (pages == 0) + continue; + if (pu[nproc] == NULL && + (pu[nproc] = malloc(sizeof(**pu))) == NULL) { + error("Out of memory"); + die(0); + } + strlcpy(pu[nproc]->command, kipp[i].ki_comm, + sizeof(pu[nproc]->command)); + pu[nproc]->pid = kipp[i].ki_pid; + pu[nproc]->uid = kipp[i].ki_uid; + pu[nproc]->pages = pages; + pu[nproc]->total = kipp[i].ki_size; + nproc++; + } + if (nproc > 1) + qsort(pu, nproc, sizeof(*pu), proc_compar); +} + +void +proclabel(int col) +{ + + wmove(wnd, col, 0); + wclrtoeol(wnd); + mvwaddstr(wnd, col, 0, + "Pid Username Command Swap/Total " + "Per-Process Per-System"); +} + +int +proc_compar(const void *a, const void *b) +{ + const struct proc_usage *aa = *((const struct proc_usage **)a); + const struct proc_usage *bb = *((const struct proc_usage **)b); + + return (aa->pages > bb->pages ? -1 : 1); +} diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index 29b04df0157f..f28059bfecd4 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -103,6 +103,7 @@ initswap(void) } pathlen = 80 - 50 /* % */ - 5 /* Used */ - 5 /* Size */ - 3 /* space */; dsinit(12); + procinit(); once = 1; return (1); @@ -125,14 +126,13 @@ fetchswap(void) cur_dev.dinfo = tmp_dinfo; last_dev.snap_time = cur_dev.snap_time; - dsgetinfo( &cur_dev ); + dsgetinfo(&cur_dev); + procgetinfo(); } void labelswap(void) { - const char *name; - int i; werase(wnd); @@ -146,18 +146,13 @@ labelswap(void) mvwprintw(wnd, 0, 0, "%*s%5s %5s %s", -pathlen, "Device/Path", "Size", "Used", "|0% /10 /20 /30 /40 / 60\\ 70\\ 80\\ 90\\ 100|"); - - for (i = 0; i <= kvnsw; ++i) { - name = i == kvnsw ? "Total" : kvmsw[i].ksw_devname; - mvwprintw(wnd, 1 + i, 0, "%-*.*s", pathlen, pathlen - 1, name); - } } void showswap(void) { - int count; - int i; + const char *name; + int count, i; if (kvnsw != okvnsw) labelswap(); @@ -167,7 +162,10 @@ showswap(void) if (kvnsw <= 0) return; - for (i = 0; i <= kvnsw; ++i) { + for (i = (kvnsw == 1 ? 0 : kvnsw); i >= 0; i--) { + name = i == kvnsw ? "Total" : kvmsw[i].ksw_devname; + mvwprintw(wnd, 1 + i, 0, "%-*.*s", pathlen, pathlen - 1, name); + sysputpage(wnd, i + 1, pathlen, 5, kvmsw[i].ksw_total, 0); sysputpage(wnd, i + 1, pathlen + 5 + 1, 5, kvmsw[i].ksw_used, 0); @@ -178,4 +176,8 @@ showswap(void) } wclrtoeol(wnd); } + count = kvnsw == 1 ? 2 : 3; + proclabel(kvnsw + count); + procshow(kvnsw + count, LINES - 5 - kvnsw + 3 - DISKHIGHT + 1, + kvmsw[kvnsw].ksw_total); } diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index e089c5c2ff55..6e14f9eb752f 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -31,10 +31,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include +#include #include +#include +#include #include "systat.h" #include "extern.h" @@ -103,26 +104,9 @@ sysputwuint64(WINDOW *wd, int row, int col, int width, uint64_t val, int flags) sysputuint64(wd, row, col, width, val, flags); } -static int -calc_page_shift() -{ - u_int page_size; - int shifts; - - shifts = 0; - GETSYSCTL("vm.stats.vm.v_page_size", page_size); - for(; page_size > 1; page_size >>= 1) - shifts++; - return shifts; -} - void sysputpage(WINDOW *wd, int row, int col, int width, uint64_t pages, int flags) { - static int shifts = 0; - if (shifts == 0) - shifts = calc_page_shift(); - pages <<= shifts; - sysputuint64(wd, row, col, width, pages, flags); + sysputuint64(wd, row, col, width, ptoa(pages), flags); } diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1 index 5ad8078a85a4..1f6ddaeafb1a 100644 --- a/usr.bin/systat/systat.1 +++ b/usr.bin/systat/systat.1 @@ -279,9 +279,11 @@ not display kilobytes per transaction). .El .It Ic swap Show information about swap space usage on all the -swap areas compiled into the kernel. -The first column is the device name of the partition. -The next column is the total space available in the partition. +swap areas compiled into the kernel and processes that are swapped out +as well as a summary of disk activity. +.Pp +The swap areas are displayed first with their name, sizes and +usage percentage. The .Ar Used column indicates the total blocks used so far; @@ -289,6 +291,28 @@ the graph shows the percentage of space in use on each partition. If there are more than one swap partition in use, a total line is also shown. Areas known to the kernel, but not in use are shown as not available. +.Pp +Below the swap space statistics, +processes are listed in order of higher swap area usage. +Pid, username, a part of command line, the total use of swap space +in bytes, the size of process, as well as per-process swap usage percentage and +per-system swap space percentage are shown per process. +.Pp +At the bottom left is the disk usage display. +It reports the number of +kilobytes per transaction, transactions per second, megabytes +per second and the percentage of the time the disk was busy averaged +over the refresh period of the display (by default, five seconds). +The system keeps statistics on most every storage device. +In general, up +to seven devices are displayed. +The devices displayed by default are the +first devices in the kernel's device list. +See +.Xr devstat 3 +and +.Xr devstat 9 +for details on the devstat system. .It Ic vmstat Take over the entire display and show a (rather crowded) compendium of statistics related to virtual memory usage, process scheduling, diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h index 92233e058172..4ced36c32932 100644 --- a/usr.bin/systat/systat.h +++ b/usr.bin/systat/systat.h @@ -32,6 +32,7 @@ * $FreeBSD$ */ +#include #include struct cmdtab { @@ -72,3 +73,8 @@ extern int use_kvm; extern void putint(int, int, int, int); extern void putfloat(double, int, int, int, int, int); extern void putlongdouble(long double, int, int, int, int, int); + +int procinit(void); +void procgetinfo(void); +void proclabel(int col); +void procshow(int col, int hight, uint64_t totalswappages); From nobody Mon Nov 1 01:28:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 39A53183D660; Mon, 1 Nov 2021 01:28: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 4HjFmP14nSz4sDk; Mon, 1 Nov 2021 01:28: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 0232D592; Mon, 1 Nov 2021 01:28: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 1A11Saoi058814; Mon, 1 Nov 2021 01:28:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A11Safl058813; Mon, 1 Nov 2021 01:28:36 GMT (envelope-from git) Date: Mon, 1 Nov 2021 01:28:36 GMT Message-Id: <202111010128.1A11Safl058813@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: 59821002f7d6 - stable/13 - systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 59821002f7d61ce57ed99d2798de64dec6bb3433 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=59821002f7d61ce57ed99d2798de64dec6bb3433 commit 59821002f7d61ce57ed99d2798de64dec6bb3433 Author: Michael Reifenberger AuthorDate: 2021-04-21 18:31:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 01:26:53 +0000 systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size. (cherry picked from commit 66483838039b21a20d748448f8916a73ec419691) --- usr.bin/systat/devs.c | 8 +------- usr.bin/systat/devs.h | 4 +++- usr.bin/systat/main.c | 16 ++++++++++++++++ usr.bin/systat/swap.c | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c index b293796c2c77..87d04f989ea3 100644 --- a/usr.bin/systat/devs.c +++ b/usr.bin/systat/devs.c @@ -426,12 +426,6 @@ dsshow2(int diskcol, int diskrow, int dn, int lc, struct statinfo *now, struct s putlongdouble(device_busy, diskrow + 4, lc, 5, 0, 0); } -static void -dsshow3(int diskcol, int diskrow, int dn, int lc, struct statinfo *now, struct statinfo *then) -{ - dsshow2(diskcol, diskrow, dn, lc, now, then); -} - void dsshow(int maxdrives, int diskcol, int diskrow, struct statinfo *now, struct statinfo *then) { @@ -439,5 +433,5 @@ dsshow(int maxdrives, int diskcol, int diskrow, struct statinfo *now, struct sta for (i = 0, lc = 0; i < num_devices && lc < maxdrives; i++) if (dev_select[i].selected) - dsshow3(diskcol, diskrow, i, ++lc, now, then); + dsshow2(diskcol, diskrow, i, ++lc, now, then); } diff --git a/usr.bin/systat/devs.h b/usr.bin/systat/devs.h index cbedd844290e..79a44a6c3f5e 100644 --- a/usr.bin/systat/devs.h +++ b/usr.bin/systat/devs.h @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1998 David E. O'Brien - * 2015 Yoshihiro Ota + * 2015, 2021 Yoshihiro Ota * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,8 @@ #include +#define DISKHIGHT 5 + int dsinit(int); void dsgetinfo(struct statinfo *); int dscmd(const char *, const char *, int, struct statinfo *); diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index b5a19d381ada..b84351379f41 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -135,6 +135,21 @@ parse_cmd_args (int argc, char **argv) } +static void +resize(int signo __unused) +{ + + endwin(); + refresh(); + clear(); + + CMDLINE = LINES - 1; + labels(); + display(); + status(); +} + + int main(int argc, char **argv) { @@ -191,6 +206,7 @@ main(int argc, char **argv) signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); + signal(SIGWINCH, resize); /* * Initialize display. Load average appears in a one line diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index f28059bfecd4..19374918ff68 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -136,7 +136,7 @@ labelswap(void) werase(wnd); - dslabel(12, 0, 18); + dslabel(12, 0, LINES - DISKHIGHT - 1); if (kvnsw <= 0) { mvwprintw(wnd, 0, 0, "(swap not configured)"); @@ -157,7 +157,7 @@ showswap(void) if (kvnsw != okvnsw) labelswap(); - dsshow(12, 0, 18, &cur_dev, &last_dev); + dsshow(12, 0, LINES - DISKHIGHT - 1, &cur_dev, &last_dev); if (kvnsw <= 0) return; From nobody Mon Nov 1 02:04:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A37631826CDA; Mon, 1 Nov 2021 02:04: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 4HjGYr4Dctz3Jkh; Mon, 1 Nov 2021 02:04: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 716EBE28; Mon, 1 Nov 2021 02:04: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 1A124Wxq012035; Mon, 1 Nov 2021 02:04:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A124Wsx012034; Mon, 1 Nov 2021 02:04:32 GMT (envelope-from git) Date: Mon, 1 Nov 2021 02:04:32 GMT Message-Id: <202111010204.1A124Wsx012034@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: d37e54c771d3 - stable/13 - nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: d37e54c771d300665383e0a19d8ce8bec35e42e4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d37e54c771d300665383e0a19d8ce8bec35e42e4 commit d37e54c771d300665383e0a19d8ce8bec35e42e4 Author: Rick Macklem AuthorDate: 2021-10-18 00:50:56 +0000 Commit: Rick Macklem CommitDate: 2021-11-01 02:01:03 +0000 nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2 This patch modifies the function that does the Close RPC (nfsrpc_closerpc) so that it does not use the open_owner (nfso_own) for NFSv4.1/4.2. Use of the seqid in the open_owner structure is only needed for NFSv4.0. Same applies to a NFSERR_STALESTATEID reply, which should only happen for NFSv4.0. This allows nfsrpc_closerpc() to be called when nfso_own is no longer valid. This, in turn, allows nfsrpc_closerpc() to be called after the shared lock on the clientID is released, for NFSv4.1/4.2. This is being done to prepare the code for a future patch that fixes the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation. (cherry picked from commit d95c0a12a2dd58b4b13cbc2d1a9fccd848f8ac5e) --- sys/fs/nfsclient/nfs_clrpcops.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index fc7d8687be77..ab25306a9c29 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -866,11 +866,13 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp, nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, op->nfso_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); - *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); - if (NFSHASNFSV4N(nmp)) + if (NFSHASNFSV4N(nmp)) { *tl++ = 0; - else + *tl++ = 0; + } else { + *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = op->nfso_stateid.seqid; + } *tl++ = op->nfso_stateid.other[0]; *tl++ = op->nfso_stateid.other[1]; *tl = op->nfso_stateid.other[2]; @@ -880,11 +882,12 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); if (error) return (error); - NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd); + if (!NFSHASNFSV4N(nmp)) + NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd); if (nd->nd_repstat == 0) NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID) + if (!NFSHASNFSV4N(nmp) && error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: m_freem(nd->nd_mrep); From nobody Mon Nov 1 02:08:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 52D651827363; Mon, 1 Nov 2021 02:08: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 4HjGfV1hwLz3KLM; Mon, 1 Nov 2021 02:08: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 1A3E9E2C; Mon, 1 Nov 2021 02:08: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 1A128YEi012418; Mon, 1 Nov 2021 02:08:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A128XRp012417; Mon, 1 Nov 2021 02:08:33 GMT (envelope-from git) Date: Mon, 1 Nov 2021 02:08:33 GMT Message-Id: <202111010208.1A128XRp012417@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: 9910716d014a - stable/13 - nfscl: Handle NFSv4.1/4.2 Close RPC NFSERR_DELAY replies better List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 9910716d014acc8477f1508bc0a1395d823c1a6f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9910716d014acc8477f1508bc0a1395d823c1a6f commit 9910716d014acc8477f1508bc0a1395d823c1a6f Author: Rick Macklem AuthorDate: 2021-10-18 22:02:21 +0000 Commit: Rick Macklem CommitDate: 2021-11-01 02:02:53 +0000 nfscl: Handle NFSv4.1/4.2 Close RPC NFSERR_DELAY replies better Without this patch, if a NFSv4.1/4.2 server replies NFSERR_DELAY to a Close operation, the client loops retrying the Close while holding a shared lock on the clientID. This shared lock blocks returns of delegations, even though the server has issued a CB_RECALL to request the delegation return. This patch delays doing a retry of a Close that received a reply of NFSERR_DELAY until after the shared lock on the clientID is released, for NFSv4.1/4.2. To fix this for NFSv4.0 would be very difficult and since the only known NFSv4 server to reply NFSERR_DELAY to Close only does NFSv4.1/4.2, this fix is hoped to be sufficient. This problem was detected during a recent IETF working group NFSv4 testing event. (cherry picked from commit 52dee2bc035545f7ae2b838d8a0449f65043cd8a) --- sys/fs/nfs/nfs_var.h | 3 ++- sys/fs/nfsclient/nfs_clrpcops.c | 11 +++++++---- sys/fs/nfsclient/nfs_clstate.c | 23 +++++++++++++++++++++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 609debe9cc16..44aedec09a96 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -600,7 +600,8 @@ void nfscl_dumpstate(struct nfsmount *, int, int, int, int); void nfscl_dupopen(vnode_t, int); int nfscl_getclose(vnode_t, struct nfsclclient **); int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *); -void nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *); +int nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *, bool, + bool); int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int, struct ucred *, NFSPROC_T *, struct nfscldeleg **); void nfscl_lockinit(struct nfsv4lock *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index ab25306a9c29..211fd3523f34 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -758,8 +758,9 @@ nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p) /* * Close the open. */ -void -nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) +int +nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p, + bool loop_on_delayed, bool freeop) { struct nfsrv_descript nfsd, *nd = &nfsd; struct nfscllockowner *lp, *nlp; @@ -838,7 +839,7 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) nfscl_lockexcl(&op->nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR); NFSUNLOCKCLSTATE(); do { - error = nfscl_tryclose(op, tcred, nmp, p, true); + error = nfscl_tryclose(op, tcred, nmp, p, loop_on_delayed); if (error == NFSERR_GRACE) (void) nfs_catnap(PZERO, error, "nfs_close"); } while (error == NFSERR_GRACE); @@ -847,9 +848,11 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) LIST_FOREACH_SAFE(lp, &op->nfso_lock, nfsl_list, nlp) nfscl_freelockowner(lp, 0); - nfscl_freeopen(op, 0, true); + if (freeop && error != NFSERR_DELAY) + nfscl_freeopen(op, 0, true); NFSUNLOCKCLSTATE(); NFSFREECRED(tcred); + return (error); } /* diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 984d8382ee45..3b76cbe502c4 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3329,8 +3329,10 @@ int nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) { struct nfsclclient *clp; + struct nfsmount *nmp; struct nfsclowner *owp, *nowp; - struct nfsclopen *op; + struct nfsclopen *op, *nop; + struct nfsclopenhead delayed; struct nfscldeleg *dp; struct nfsfh *nfhp; struct nfsclrecalllayout *recallp; @@ -3341,6 +3343,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) return (error); *clpp = clp; + nmp = VFSTONFS(vp->v_mount); nfhp = VTONFS(vp)->n_fhp; recallp = malloc(sizeof(*recallp), M_NFSLAYRECALL, M_WAITOK); NFSLOCKCLSTATE(); @@ -3365,6 +3368,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp); /* Now process the opens against the server. */ + LIST_INIT(&delayed); lookformore: LIST_FOREACH(op, NFSCLOPENHASH(clp, nfhp->nfh_fh, nfhp->nfh_len), nfso_hash) { @@ -3378,8 +3382,16 @@ lookformore: op->nfso_opencnt)); #endif NFSUNLOCKCLSTATE(); - nfsrpc_doclose(VFSTONFS(vp->v_mount), op, p); + if (NFSHASNFSV4N(nmp)) + error = nfsrpc_doclose(nmp, op, p, false, true); + else + error = nfsrpc_doclose(nmp, op, p, true, true); NFSLOCKCLSTATE(); + if (error == NFSERR_DELAY) { + nfscl_unlinkopen(op); + op->nfso_own = NULL; + LIST_INSERT_HEAD(&delayed, op, nfso_list); + } goto lookformore; } } @@ -3390,6 +3402,13 @@ lookformore: * used by the function, but calling free() with a NULL pointer is ok. */ free(recallp, M_NFSLAYRECALL); + + /* Now, loop retrying the delayed closes. */ + LIST_FOREACH_SAFE(op, &delayed, nfso_list, nop) { + nfsrpc_doclose(nmp, op, p, true, false); + LIST_REMOVE(op, nfso_list); + nfscl_freeopen(op, 0, false); + } return (0); } From nobody Mon Nov 1 02:26:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C178E1830A7D; Mon, 1 Nov 2021 02:27:06 +0000 (UTC) (envelope-from kpn@neutralgood.org) Received: from gunsight1.neutralgood.org (gunsight1.neutralgood.org [IPv6:2607:f758:2280:1:d6be:d9ff:feac:a1e9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "gunsight1.neutralgood.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjH3s5QxGz3QZZ; Mon, 1 Nov 2021 02:27:05 +0000 (UTC) (envelope-from kpn@neutralgood.org) Received: from gunsight1.NeutralGood.ORG (localhost [127.0.0.1]) by gunsight1.neutralgood.org (8.16.1/8.15.2) with ESMTPS id 1A12Qf0V051124 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 31 Oct 2021 22:26:41 -0400 (EDT) (envelope-from kpn@gunsight1.NeutralGood.ORG) Received: (from kpn@localhost) by gunsight1.NeutralGood.ORG (8.16.1/8.15.2/Submit) id 1A12Qc9J051121; Sun, 31 Oct 2021 22:26:38 -0400 (EDT) (envelope-from kpn) Date: Sun, 31 Oct 2021 22:26:38 -0400 From: "Kevin P. Neal" To: Emmanuel Vadot Cc: Benjamin Kaduk , "Rodney W. Grimes" , "Rodney W. Grimes" , gljennjohn@gmail.com, Gleb Smirnoff , Slawa Olhovchenkov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default Message-ID: References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> X-No-archive: Yes X-Rspamd-Queue-Id: 4HjH3s5QxGz3QZZ X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of kpn@neutralgood.org designates 2607:f758:2280:1:d6be:d9ff:feac:a1e9 as permitted sender) smtp.mailfrom=kpn@neutralgood.org X-Spamd-Result: default: False [-1.77 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.02)[-0.021]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[neutralgood.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.45)[-0.446]; RCPT_COUNT_SEVEN(0.00)[10]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:13649, ipnet:2607:f758::/32, country:US]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org,gndrsh.dnsmgr.net,zxy.spb.ru] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N On Fri, Oct 22, 2021 at 10:55:40PM +0200, Emmanuel Vadot wrote: > If I knew that this change would have caused that much mails I would > have send a mail to current or whatever before and left the review > opened for more time. Is this exposing an issue with the review process? I don't know the FreeBSD review process, but I do know the LLVM one. Now, LLVM has a different set of people in the project. That means that what works over there might not be a good fit here. I thought I'd mention it just the same. On the LLVM project they don't allow code that is up for review to be pushed without an explicit signoff from one of the reviewers. Period. There's _no_ putting code up for review, waiting, and then going ahead and pushing. If there's no feedback for a while the person asking for the review will add a message every week or two that says just "ping". This often nudges people to get to the review. Not always, and it can take a while to get code through, but that's the process. Changes are allowed without a review if they are "obvious". If someone pushes a change that another committer doesn't feel is obvious then the change is reverted, usually by the person who cares. Personally, I've never had this happen, but my non-review pushes are usually either new tests or fixes to broken builds. -- Kevin P. Neal http://www.pobox.com/~kpn/ "It sounded pretty good, but it's hard to tell how it will work out in practice." -- Dennis Ritchie, ~1977, "Summary of a DEC 32-bit machine" From nobody Mon Nov 1 02:38:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E9F851836FD2; Mon, 1 Nov 2021 02:38: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 4HjHKV6Kq3z3kR3; Mon, 1 Nov 2021 02:38: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 B923D1242; Mon, 1 Nov 2021 02:38: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 1A12csHm052790; Mon, 1 Nov 2021 02:38:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A12csuF052789; Mon, 1 Nov 2021 02:38:54 GMT (envelope-from git) Date: Mon, 1 Nov 2021 02:38:54 GMT Message-Id: <202111010238.1A12csuF052789@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: 4f889260c33c - main - sinpi[fl] etc: Fix the ld128 implementations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 4f889260c33c163ab28e0e082b4d7e7562d9c647 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4f889260c33c163ab28e0e082b4d7e7562d9c647 commit 4f889260c33c163ab28e0e082b4d7e7562d9c647 Author: Steve Kargl AuthorDate: 2021-10-31 22:26:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 02:38:19 +0000 sinpi[fl] etc: Fix the ld128 implementations Mark Murray graciously provided access to an aarch64 system to test the ld128 implementations. This patch address * Misuses of copysignl() in sinpil() and tanpil(). * Redo the splitting of argument 'x' into an integer part and remainder. The remainder must satify 0 <= r < 1. * Update the reduction of the integer part to something that can easily be seen as even or odd, e.g., sin(pi*x) = (-1)^n*sin(pi*r) with n <= 2^112 and we an reduce n by subtracting integer powers of 2. * In s_cospil.c, fix typos where 'x' is used where 'ax', the remainder, is required. * In tanpil(), fix the use of an uninitialized variable, ax = fabsl(ax), ax should be x in fabsl(). One item of note, in the limited tested on aarch64, the max ULP for sinpil() and cospil() were less than 1.1 ULP, which is higher that the desired max ULP less than 1. This was traced to the kernel for cosl() in the fundamental interval [0,pi/4]. The coefficients in the minmax polynomial likely need refinement. PR: 218514 MFC after: 1 week --- lib/msun/ld128/s_cospil.c | 31 +++++++++++++++++-------------- lib/msun/ld128/s_sinpil.c | 29 ++++++++++++++++------------- lib/msun/ld128/s_tanpil.c | 23 +++++++++++++---------- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/lib/msun/ld128/s_cospil.c b/lib/msun/ld128/s_cospil.c index b4bc50bb4d89..71acc4485f7b 100644 --- a/lib/msun/ld128/s_cospil.c +++ b/lib/msun/ld128/s_cospil.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Steven G. Kargl + * Copyright (c) 2017-2021 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +26,6 @@ /* * See ../src/s_cospi.c for implementation details. - * - * FIXME: This has not been compiled nor has it been tested for accuracy. - * FIXME: This should use bit twiddling. */ #include "math.h" @@ -54,7 +51,7 @@ cospil(long double x) ax = fabsl(x); - if (ax < 1) { + if (ax <= 1) { if (ax < 0.25) { if (ax < 0x1p-60) { if ((int)x == 0) @@ -75,15 +72,21 @@ cospil(long double x) } if (ax < 0x1p112) { - xf = floorl(ax); - ax -= xf; - if (x < 0.5) { - if (x < 0.25) + /* Split x = n + r with 0 <= r < 1. */ + xf = (ax + 0x1p112L) - 0x1p112L; /* Integer part */ + ax -= xf; /* Remainder */ + if (ax < 0) { + ax += 1; + xf -= 1; + } + + if (ax < 0.5) { + if (ax < 0.25) c = ax == 0 ? 1 : __kernel_cospil(ax); else c = __kernel_sinpil(0.5 - ax); } else { - if (x < 0.75) { + if (ax < 0.75) { if (ax == 0.5) return (0); c = -__kernel_sinpil(ax - 0.5); @@ -91,10 +94,10 @@ cospil(long double x) c = -__kernel_cospil(1 - ax); } - if (xf > 0x1p50) - xf -= 0x1p50; - if (xf > 0x1p30) - xf -= 0x1p30; + if (xf > 0x1p64) + xf -= 0x1p64; + if (xf > 0x1p32) + xf -= 0x1p32; ix = (uint32_t)xf; return (ix & 1 ? -c : c); } diff --git a/lib/msun/ld128/s_sinpil.c b/lib/msun/ld128/s_sinpil.c index 39eed9b007bc..cdfa2bcac3ef 100644 --- a/lib/msun/ld128/s_sinpil.c +++ b/lib/msun/ld128/s_sinpil.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Steven G. Kargl + * Copyright (c) 2017-2021 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +26,6 @@ /* * See ../src/s_sinpi.c for implementation details. - * - * FIXME: This has not been compiled nor has it been tested for accuracy. - * FIXME: This should use bit twiddling. */ #include "math.h" @@ -68,7 +65,7 @@ sinpil(long double x) } s = __kernel_sinpil(ax); - return (copysignl(s, x)); + return (x < 0 ? -s : s); } if (ax < 0.5) @@ -77,12 +74,18 @@ sinpil(long double x) s = __kernel_cospil(ax - 0.5); else s = __kernel_sinpil(1 - ax); - return (copysignl(s, x)); + return (x < 0 ? -s : s); } if (ax < 0x1p112) { - xf = floorl(ax); - ax -= xf; + /* Split x = n + r with 0 <= r < 1. */ + xf = (ax + 0x1p112L) - 0x1p112L; /* Integer part */ + ax -= xf; /* Remainder */ + if (ax < 0) { + ax += 1; + xf -= 1; + } + if (ax == 0) { s = 0; } else { @@ -98,14 +101,14 @@ sinpil(long double x) s = __kernel_sinpil(1 - ax); } - if (xf > 0x1p50) - xf -= 0x1p50; - if (xf > 0x1p30) - xf -= 0x1p30; + if (xf > 0x1p64) + xf -= 0x1p64; + if (xf > 0x1p32) + xf -= 0x1p32; ix = (uint32_t)xf; if (ix & 1) s = -s; } - return (copysignl(s, x)); + return (x < 0 ? -s : s); } if (isinf(x) || isnan(x)) diff --git a/lib/msun/ld128/s_tanpil.c b/lib/msun/ld128/s_tanpil.c index 7cbbdc8a5d05..90f4aea5c629 100644 --- a/lib/msun/ld128/s_tanpil.c +++ b/lib/msun/ld128/s_tanpil.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Steven G. Kargl + * Copyright (c) 2017-2021 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +26,6 @@ /* * See ../src/s_tanpi.c for implementation details. - * - * FIXME: This has not been compiled nor has it been tested for accuracy. - * FIXME: This should use bit twiddling. */ #include "math.h" @@ -75,7 +72,7 @@ tanpil(long double x) long double ax, hi, lo, xf, t; uint32_t ix; - ax = fabsl(ax); + ax = fabsl(x); if (ax < 1) { if (ax < 0.5) { @@ -94,19 +91,25 @@ tanpil(long double x) return ((ax - ax) / (ax - ax)); else t = -__kernel_tanpil(1 - ax); - return (copysignl(t, x)); + return (x < 0 ? -t : t); } if (ix < 0x1p112) { - xf = floorl(ax); - ax -= xf; + /* Split x = n + r with 0 <= r < 1. */ + xf = (ax + 0x1p112L) - 0x1p112L; /* Integer part */ + ax -= xf; /* Remainder */ + if (ax < 0) { + ax += 1; + xf -= 1; + } + if (ax < 0.5) t = ax == 0 ? 0 : __kernel_tanpil(ax); else if (ax == 0.5) return ((ax - ax) / (ax - ax)); else t = -__kernel_tanpil(1 - ax); - return (copysignl(t, x)); + return (x < 0 ? -t : t); } /* x = +-inf or nan. */ @@ -114,7 +117,7 @@ tanpil(long double x) return (vzero / vzero); /* - * |x| >= 0x1p53 is always an integer, so return +-0. + * |x| >= 0x1p112 is always an integer, so return +-0. */ return (copysignl(0, x)); } From nobody Mon Nov 1 02:40:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0104A18378DA for ; Mon, 1 Nov 2021 02:40:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92a.google.com (mail-ua1-x92a.google.com [IPv6:2607:f8b0:4864:20::92a]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjHMZ5z1Zz3kty for ; Mon, 1 Nov 2021 02:40:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92a.google.com with SMTP id e2so29316711uax.7 for ; Sun, 31 Oct 2021 19:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=idIjZiIz+q+FX7mMgYEwOPjThaHYMb0fyNFuIraC/II=; b=ysnsF+evIV3nBz2EsgV0OQdTiuufl2WeaBMxq5BgnZjbwVhI6mlE8wlm8Ke4s4a3c5 M/fpF/XNbGDLAnjg0hImtDwXZduHxfoRTSa4BZapOa4WVVVebtfEjbpF2Ry5eETHFXFX /p58LxIhR7GV8PqoLRSec3FZ2e0korM22VrPhPdreBxujZjvZeJJLv0M2p1jlfGaSbn8 wSXTzhl9JU6xeSRpIFIRC9Emg7aPKMrDQehg7y9Zkbnp6th/87yxURlUVqwhf1YfNYP+ eMciKWJMUVx0t8sBJro+zysOpP+hl4eL8/W4bHkoViexQfQVR9WslP7LYU5DSltfyc0o zmxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=idIjZiIz+q+FX7mMgYEwOPjThaHYMb0fyNFuIraC/II=; b=Hk1/8lPj0XHISGl+Q4Fkfmnkq5LAPauTweccN9Efityzfg9bqw3TQEw1TWC3tdabyi bYqlzzuyuzK21swbGjoRgj5I8sb12uf/sDxQl+iN9r0RXAv3FydlySS741Mb4ZBcZM0K duzQyIXClVMtWe0Tzk5/ivZpYLspx1u8o4iPPByh2ohxO10cDlPdqj6tWBsMNip8xy1X thmYGr3ZFJBAZ+Faoq+ilc2t8Le8q1rd4DWPKz8Lq8IPANjAhKlEVDMn0vYwyxF+Ik2Z NifOsUZJfRW00o3erkgoYsI+FDUSaiisV1WsFGc6ge2T0/6oodGcBf6r+evzMVo1OjOh GB5A== X-Gm-Message-State: AOAM530JixZSJtVdI9qBtukoY+FiJ0Lhrpex8lDux8JB9a8UCR/mu+dM MZwg0Z2KPC4UXpTKn1OFu6KCRVt5iW4bviP6o536eg== X-Google-Smtp-Source: ABdhPJyAyxrkphwijiCWhF294KjHmL+yTBvf26QXxT4OdA4z5+CPX3e4U54U1aYU+FXYpgjZOuTCZk8F4j85NgILlXw= X-Received: by 2002:ab0:3d07:: with SMTP id f7mr4012209uax.11.1635734442241; Sun, 31 Oct 2021 19:40:42 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <20211021192020.6dcb95c1@ernst.home> <202110221704.19MH4FDn075994@gndrsh.dnsmgr.net> <20211022194717.8c94d2fa302339b55882497f@bidouilliste.com> <20211022225540.a4220cfddc96cc1e08cb5235@bidouilliste.com> In-Reply-To: From: Warner Losh Date: Sun, 31 Oct 2021 20:40:31 -0600 Message-ID: Subject: Re: git: 225639e7db68 - main - vt: Disable bell by default To: "Kevin P. Neal" Cc: Emmanuel Vadot , Benjamin Kaduk , "Rodney W. Grimes" , "Rodney W. Grimes" , Gary Jennejohn , Gleb Smirnoff , Slawa Olhovchenkov , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="00000000000060818305cfb11a3d" X-Rspamd-Queue-Id: 4HjHMZ5z1Zz3kty X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --00000000000060818305cfb11a3d Content-Type: text/plain; charset="UTF-8" On Sun, Oct 31, 2021 at 8:27 PM Kevin P. Neal wrote: > On Fri, Oct 22, 2021 at 10:55:40PM +0200, Emmanuel Vadot wrote: > > If I knew that this change would have caused that much mails I would > > have send a mail to current or whatever before and left the review > > opened for more time. > > Is this exposing an issue with the review process? I don't know the FreeBSD > review process, but I do know the LLVM one. Now, LLVM has a different set > of people in the project. That means that what works over there might not > be a good fit here. I thought I'd mention it just the same. > > > On the LLVM project they don't allow code that is up for review to be > pushed without an explicit signoff from one of the reviewers. Period. > > There's _no_ putting code up for review, waiting, and then going ahead and > pushing. > > If there's no feedback for a while the person asking for the review will > add a message every week or two that says just "ping". This often nudges > people to get to the review. Not always, and it can take a while to get > code through, but that's the process. > > Changes are allowed without a review if they are "obvious". If someone > pushes a change that another committer doesn't feel is obvious then the > change is reverted, usually by the person who cares. Personally, I've never > had this happen, but my non-review pushes are usually either new tests or > fixes to broken builds. > I clicked approve on this quickly after manu posted it. There was little other comment. Seemed like a boring change. A better review process wouldn't have helped. Dozens of other boring commits have a very similar profile. Warner --00000000000060818305cfb11a3d-- From nobody Mon Nov 1 05:09:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 806A21833702; Mon, 1 Nov 2021 05:09: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 4HjLg83D6Dz3Bmh; Mon, 1 Nov 2021 05:09: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 4E65A36AD; Mon, 1 Nov 2021 05:09: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 1A159ODB054721; Mon, 1 Nov 2021 05:09:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A159OOo054720; Mon, 1 Nov 2021 05:09:24 GMT (envelope-from git) Date: Mon, 1 Nov 2021 05:09:24 GMT Message-Id: <202111010509.1A159OOo054720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: e528757ca6a9 - main - iicoc: add support for SiFive HiFive Unmatched List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e528757ca6a9c03dca7e35b77411b311af166b7f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=e528757ca6a9c03dca7e35b77411b311af166b7f commit e528757ca6a9c03dca7e35b77411b311af166b7f Author: Thomas Skibo AuthorDate: 2021-11-01 04:23:22 +0000 Commit: Philip Paeps CommitDate: 2021-11-01 04:26:49 +0000 iicoc: add support for SiFive HiFive Unmatched Reviewed by: jrtc27, philip MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32737 --- sys/dev/iicbus/iicoc_fdt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/iicbus/iicoc_fdt.c b/sys/dev/iicbus/iicoc_fdt.c index 699a1738f53b..052174a91134 100644 --- a/sys/dev/iicbus/iicoc_fdt.c +++ b/sys/dev/iicbus/iicoc_fdt.c @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); static struct ofw_compat_data compat_data[] = { { "opencores,i2c-ocores", 1 }, + { "sifive,fu740-c000-i2c", 1 }, + { "sifive,fu540-c000-i2c", 1 }, + { "sifive,i2c0", 1 }, { NULL, 0 } }; From nobody Mon Nov 1 05:09:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B78B31833624; Mon, 1 Nov 2021 05:09: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 4HjLg94BMHz4vkk; Mon, 1 Nov 2021 05:09: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 701A636B7; Mon, 1 Nov 2021 05:09: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 1A159PhX054745; Mon, 1 Nov 2021 05:09:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A159Pe2054744; Mon, 1 Nov 2021 05:09:25 GMT (envelope-from git) Date: Mon, 1 Nov 2021 05:09:25 GMT Message-Id: <202111010509.1A159Pe2054744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 2a36909a94be - main - iicoc: fix repeated start List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a36909a94be110c34128319536c1c595635aa2e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=2a36909a94be110c34128319536c1c595635aa2e commit 2a36909a94be110c34128319536c1c595635aa2e Author: Thomas Skibo AuthorDate: 2021-11-01 04:29:29 +0000 Commit: Philip Paeps CommitDate: 2021-11-01 04:29:29 +0000 iicoc: fix repeated start Reviewed by: jrtc27, philip MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32737 --- sys/dev/iicbus/iicoc.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/dev/iicbus/iicoc.c b/sys/dev/iicbus/iicoc.c index e243e7128be7..f22878224c32 100644 --- a/sys/dev/iicbus/iicoc.c +++ b/sys/dev/iicbus/iicoc.c @@ -147,8 +147,8 @@ iicoc_init(device_t dev) return ((value & OC_CONTROL_EN) == 0); } -int -iicoc_iicbus_start(device_t dev, u_char slave, int timeout) +static int +iicoc_iicbus_start_common(device_t dev, u_char slave, int timeout, bool repeat) { int error = IIC_EBUSERR; struct iicoc_softc *sc; @@ -158,7 +158,7 @@ iicoc_iicbus_start(device_t dev, u_char slave, int timeout) sc->i2cdev_addr = (slave >> 1); /* Verify the bus is idle */ - if (iicoc_wait_on_status(dev, OC_STATUS_BUSY) < 0) + if (!repeat && iicoc_wait_on_status(dev, OC_STATUS_BUSY) < 0) goto i2c_stx_error; /* Write Slave Address */ @@ -186,6 +186,20 @@ i2c_stx_error: return (error); } +int +iicoc_iicbus_start(device_t dev, u_char slave, int timeout) +{ + + return (iicoc_iicbus_start_common(dev, slave, timeout, false)); +} + +int +iicoc_iicbus_repeated_start(device_t dev, u_char slave, int timeout) +{ + + return (iicoc_iicbus_start_common(dev, slave, timeout, true)); +} + int iicoc_iicbus_stop(device_t dev) { @@ -268,10 +282,3 @@ iicoc_iicbus_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr) mtx_unlock(&sc->sc_mtx); return (error); } - -int -iicoc_iicbus_repeated_start(device_t dev, u_char slave, int timeout) -{ - - return 0; -} From nobody Mon Nov 1 05:09:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9098218335C8; Mon, 1 Nov 2021 05:09: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 4HjLgB6158z3Bsh; Mon, 1 Nov 2021 05:09: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 9B8DB3660; Mon, 1 Nov 2021 05:09: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 1A159Q2c054769; Mon, 1 Nov 2021 05:09:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A159QCA054768; Mon, 1 Nov 2021 05:09:26 GMT (envelope-from git) Date: Mon, 1 Nov 2021 05:09:26 GMT Message-Id: <202111010509.1A159QCA054768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 99443830fa7c - main - iicoc: support building as a module List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99443830fa7c121af42a6af5971357f9ab52deff Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=99443830fa7c121af42a6af5971357f9ab52deff commit 99443830fa7c121af42a6af5971357f9ab52deff Author: Thomas Skibo AuthorDate: 2021-11-01 04:31:49 +0000 Commit: Philip Paeps CommitDate: 2021-11-01 04:33:39 +0000 iicoc: support building as a module Only build on RISC-V for now, since we're not aware of any other cores with this IP supported by FreeBSD. Reviewed by: jrtc27, philip MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32737 --- sys/dev/iicbus/iicoc_fdt.c | 1 + sys/modules/i2c/controllers/Makefile | 3 +++ sys/modules/i2c/controllers/iicoc/Makefile | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/sys/dev/iicbus/iicoc_fdt.c b/sys/dev/iicbus/iicoc_fdt.c index 052174a91134..0bc25044a293 100644 --- a/sys/dev/iicbus/iicoc_fdt.c +++ b/sys/dev/iicbus/iicoc_fdt.c @@ -185,6 +185,7 @@ static driver_t iicoc_driver = { sizeof(struct iicoc_softc), }; +SIMPLEBUS_PNP_INFO(compat_data); DRIVER_MODULE(iicoc, simplebus, iicoc_driver, iicoc_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, iicoc, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); MODULE_DEPEND(iicoc, iicbus, 1, 1, 1); diff --git a/sys/modules/i2c/controllers/Makefile b/sys/modules/i2c/controllers/Makefile index 8773bc09c030..3bae39c3b439 100644 --- a/sys/modules/i2c/controllers/Makefile +++ b/sys/modules/i2c/controllers/Makefile @@ -5,5 +5,8 @@ SUBDIR = alpm amdpm amdsmb ichiic ichsmb intpm ismt nfsmb viapm lpbb pcf .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" SUBDIR += imcsmb .endif +.if ${MACHINE_CPUARCH} == "riscv" +SUBDIR += iicoc +.endif .include diff --git a/sys/modules/i2c/controllers/iicoc/Makefile b/sys/modules/i2c/controllers/iicoc/Makefile new file mode 100644 index 000000000000..f6902f1f864a --- /dev/null +++ b/sys/modules/i2c/controllers/iicoc/Makefile @@ -0,0 +1,7 @@ +.PATH: ${SRCTOP}/sys/dev/iicbus + +KMOD = iicoc +SRCS = device_if.h bus_if.h iicbus_if.h \ + iicoc.c iicoc_fdt.c iicoc_pci.c + +.include From nobody Mon Nov 1 05:21:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 033F0182273E; Mon, 1 Nov 2021 05:21: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 4HjLx46cqpz3HK0; Mon, 1 Nov 2021 05:21: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 C3FD92EEA; Mon, 1 Nov 2021 05:21: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 1A15LSAs079616; Mon, 1 Nov 2021 05:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A15LS5q079615; Mon, 1 Nov 2021 05:21:28 GMT (envelope-from git) Date: Mon, 1 Nov 2021 05:21:28 GMT Message-Id: <202111010521.1A15LS5q079615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 91feb4f42075 - main - riscv: add iicbus and iicoc to GENERIC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91feb4f42075e2d7c8d6d50cd5faa651ab3a0e7d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=91feb4f42075e2d7c8d6d50cd5faa651ab3a0e7d commit 91feb4f42075e2d7c8d6d50cd5faa651ab3a0e7d Author: Philip Paeps AuthorDate: 2021-11-01 05:16:27 +0000 Commit: Philip Paeps CommitDate: 2021-11-01 05:19:55 +0000 riscv: add iicbus and iicoc to GENERIC The iicoc driver supports the OpenCores I2C IP. This is included in at least the SiFive "Unleashed" and "Unmatched" cores and probably others. Suggested by: jrtc27 --- sys/riscv/conf/GENERIC | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index a02a30d4834f..4ce1cb6a3cda 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -203,6 +203,10 @@ device bpf # Berkeley packet filter options FDT makeoptions MODULES_EXTRA+="dtb/sifive" +# I2C support +device iicbus # Bus support, required for iicoc below. +device iicoc # OpenCores I2C controller support + # SiFive device drivers device fu740_pci_dw device sifive_gpio From nobody Mon Nov 1 06:54:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0261818119DD; Mon, 1 Nov 2021 06:54: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 4HjP0L6g0Rz4R9v; Mon, 1 Nov 2021 06:54: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 C0AE04FA0; Mon, 1 Nov 2021 06:54: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 1A16sQeW000300; Mon, 1 Nov 2021 06:54:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A16sQ2L000299; Mon, 1 Nov 2021 06:54:26 GMT (envelope-from git) Date: Mon, 1 Nov 2021 06:54:26 GMT Message-Id: <202111010654.1A16sQ2L000299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: e18fbe6f19ed - main - fuser: restore functionality by fixing fsid type List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e18fbe6f19ed106f035c7d2aaeade6eb55cc0b5a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=e18fbe6f19ed106f035c7d2aaeade6eb55cc0b5a commit e18fbe6f19ed106f035c7d2aaeade6eb55cc0b5a Author: Andriy Gapon AuthorDate: 2021-11-01 06:40:17 +0000 Commit: Andriy Gapon CommitDate: 2021-11-01 06:45:26 +0000 fuser: restore functionality by fixing fsid type Use types from sys/stat.h for the filesystem and inode numbers for extra safety. PR: 259504 Reported by: Markus Wild MFC after: 1 week --- usr.bin/fstat/fuser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fstat/fuser.c b/usr.bin/fstat/fuser.c index b4225328fc1f..ad4aebf4a2cb 100644 --- a/usr.bin/fstat/fuser.c +++ b/usr.bin/fstat/fuser.c @@ -92,8 +92,8 @@ struct consumer { STAILQ_ENTRY(consumer) next; }; struct reqfile { - uint32_t fsid; - uint64_t fileid; + dev_t fsid; + ino_t fileid; const char *name; STAILQ_HEAD(, consumer) consumers; }; From nobody Mon Nov 1 11:27:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 20D211839866; Mon, 1 Nov 2021 11:27: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 4HjW3F0Mq8z4sWP; Mon, 1 Nov 2021 11:27: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 E210D107E0; Mon, 1 Nov 2021 11:27: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 1A1BRKEM059538; Mon, 1 Nov 2021 11:27:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1BRK3d059537; Mon, 1 Nov 2021 11:27:20 GMT (envelope-from git) Date: Mon, 1 Nov 2021 11:27:20 GMT Message-Id: <202111011127.1A1BRK3d059537@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: 62cbc00d2f57 - main - Print the correct register for the arm64 elr List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 62cbc00d2f57785c747632b1a5ba7571281d17c4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=62cbc00d2f57785c747632b1a5ba7571281d17c4 commit 62cbc00d2f57785c747632b1a5ba7571281d17c4 Author: Andrew Turner AuthorDate: 2021-11-01 11:19:57 +0000 Commit: Andrew Turner CommitDate: 2021-11-01 11:19:57 +0000 Print the correct register for the arm64 elr In 7ec86b6609912 ("Also print symbols when printing arm64 registers") a new function was created to print most registers. Unfortunately the Link Register (LR) was being printed when we should have printed the Exception Link Register (ELR). Fix this by adding the missing 'e'. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/trap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index c1566b7df492..891f1024232a 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -399,7 +399,7 @@ print_registers(struct trapframe *frame) } printf(" sp: %16lx\n", frame->tf_sp); print_gp_register(" lr", frame->tf_lr); - print_gp_register("elr", frame->tf_lr); + print_gp_register("elr", frame->tf_elr); printf("spsr: %8x\n", frame->tf_spsr); } From nobody Mon Nov 1 12:55:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D5E831832CCE for ; Mon, 1 Nov 2021 12:55:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjY1K5MK4z3sgR for ; Mon, 1 Nov 2021 12:55:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f54.google.com with SMTP id d27so10048787wrb.6 for ; Mon, 01 Nov 2021 05:55:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xUf/cYQAZG8Cs4emnNwQA4q5TNsJ5Y3TE0G+zO4oYhE=; b=2VND38uaTUc7PZFr6B0llEb2rZIpacYTZusbkpPcW28O9/BwjOwDjyGNb0oS1ampQo LqqXRL/7Sb4kZbSq9jgcp7aeKFoNevXYHofptHIw9s75/c2SaelZ0ARBC+2QMoLx8LC/ MKQFMrlzZjEa5mNJVhbpKBs7xHHs4Mn5h54TMzOtRwjyjFBmyWTzqzJ7ab6CaxPyP6Oa O82jSQNiWhw64SuzPuwIV7L6ysrIKq5Wt4RXADTdTt+oxwaVp2Pq+eOpNzhLHspN5icc 1jJtqRWN3MLqX6ElREA1FHiqs1V+veUnUNFZ+kVNrf2vV2ByjeYvOwQ3HrEcEdy0HZFn BSbQ== X-Gm-Message-State: AOAM530/Kt1bWajLYs6Yba5XqvWgKHlMZIs56JdFASMhKX/ztLvLP/l3 VkSY6BPg3gIZTh0xVi8chsOa1A== X-Google-Smtp-Source: ABdhPJzdfx/rTm3McNnh+VV6e/6wDNinB9CU+ESgiW9Ltg10bb7T3F6N50oCC5Itb+Kc965EuBpP0w== X-Received: by 2002:a05:6000:2ca:: with SMTP id o10mr36801406wry.383.1635771343496; Mon, 01 Nov 2021 05:55:43 -0700 (PDT) Received: from smtpclient.apple (global-5-141.nat-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id j10sm3814696wru.15.2021.11.01.05.55.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Nov 2021 05:55:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: e528757ca6a9 - main - iicoc: add support for SiFive HiFive Unmatched From: Jessica Clarke In-Reply-To: <202111010509.1A159OOo054720@gitrepo.freebsd.org> Date: Mon, 1 Nov 2021 12:55:42 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <3DD4AA9B-9985-4DFB-BBC8-E5E34787BA7A@freebsd.org> References: <202111010509.1A159OOo054720@gitrepo.freebsd.org> To: Philip Paeps X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HjY1K5MK4z3sgR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 1 Nov 2021, at 05:09, Philip Paeps wrote: >=20 > The branch main has been updated by philip: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3De528757ca6a9c03dca7e35b77411b311= af166b7f >=20 > commit e528757ca6a9c03dca7e35b77411b311af166b7f > Author: Thomas Skibo > AuthorDate: 2021-11-01 04:23:22 +0000 > Commit: Philip Paeps > CommitDate: 2021-11-01 04:26:49 +0000 >=20 > iicoc: add support for SiFive HiFive Unmatched >=20 > Reviewed by: jrtc27, philip > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D32737 I didn=E2=80=99t approve the revision, I just left comments on the first version. One of which still stands (not limiting the module to RISC-V). Jess > --- > sys/dev/iicbus/iicoc_fdt.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/sys/dev/iicbus/iicoc_fdt.c b/sys/dev/iicbus/iicoc_fdt.c > index 699a1738f53b..052174a91134 100644 > --- a/sys/dev/iicbus/iicoc_fdt.c > +++ b/sys/dev/iicbus/iicoc_fdt.c > @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); >=20 > static struct ofw_compat_data compat_data[] =3D { > { "opencores,i2c-ocores", 1 }, > + { "sifive,fu740-c000-i2c", 1 }, > + { "sifive,fu540-c000-i2c", 1 }, > + { "sifive,i2c0", 1 }, > { NULL, 0 } > }; >=20 From nobody Mon Nov 1 13:09:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 65F571821797; Mon, 1 Nov 2021 13:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjYJj2QB2z4RnN; Mon, 1 Nov 2021 13:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33406121B7; Mon, 1 Nov 2021 13:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A1D9993092594; Mon, 1 Nov 2021 13:09:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1D990a092593; Mon, 1 Nov 2021 13:09:09 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:09:09 GMT Message-Id: <202111011309.1A1D990a092593@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: ac56b22f44d8 - main - src.conf.5: regen List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: ac56b22f44d829eae7d6fb0e84d00d7ad10b1067 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ac56b22f44d829eae7d6fb0e84d00d7ad10b1067 commit ac56b22f44d829eae7d6fb0e84d00d7ad10b1067 Author: Ed Maste AuthorDate: 2021-11-01 13:07:37 +0000 Commit: Ed Maste CommitDate: 2021-11-01 13:08:44 +0000 src.conf.5: regen Pick up changes in option dependencies (WITHOUT_OPENSSL and WITHOUT_CXX) and the addition of WITH_DETECT_TZ_CHANGES and WITH_LLVM_BINUTILS. Sponsored by: The FreeBSD Foundation --- share/man/man5/src.conf.5 | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 60f2f0af02aa..9ba27d393410 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 August 7, 2021 +.Dd November 1, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -326,6 +326,35 @@ When set, it enforces these options: .It .Va WITHOUT_LLVM_COV .El +.Pp +When set, these options are also in effect: +.Pp +.Bl -inset -compact +.It Va WITHOUT_LLVM_TARGET_AARCH64 +(unless +.Va WITH_LLVM_TARGET_AARCH64 +is set explicitly) +.It Va WITHOUT_LLVM_TARGET_ALL +(unless +.Va WITH_LLVM_TARGET_ALL +is set explicitly) +.It Va WITHOUT_LLVM_TARGET_ARM +(unless +.Va WITH_LLVM_TARGET_ARM +is set explicitly) +.It Va WITHOUT_LLVM_TARGET_MIPS +(unless +.Va WITH_LLVM_TARGET_MIPS +is set explicitly) +.It Va WITHOUT_LLVM_TARGET_POWERPC +(unless +.Va WITH_LLVM_TARGET_POWERPC +is set explicitly) +.It Va WITHOUT_LLVM_TARGET_RISCV +(unless +.Va WITH_LLVM_TARGET_RISCV +is set explicitly) +.El .It Va WITHOUT_CLANG_BOOTSTRAP Do not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -393,6 +422,8 @@ When set, it enforces these options: .It .Va WITHOUT_OPENSSL .It +.Va WITHOUT_OPENSSL_KTLS +.It .Va WITHOUT_PKGBOOTSTRAP .It .Va WITHOUT_UNBOUND @@ -452,11 +483,21 @@ When set, it enforces these options: .It .Va WITHOUT_LLVM_COV .It +.Va WITHOUT_OFED +.It +.Va WITHOUT_OFED_EXTRA +.It +.Va WITHOUT_OPENMP +.It +.Va WITHOUT_PMC +.It .Va WITHOUT_TESTS .El .It Va WITHOUT_DEBUG_FILES Avoid building or installing standalone debug files for each executable binary and shared library. +.It Va WITH_DETECT_TZ_CHANGES +Make the time handling code detect changes to the timezone files. .It Va WITHOUT_DIALOG Do not build .Xr dialog 1 , @@ -873,6 +914,8 @@ The system will not have a usable tool chain unless a linker is provided some other way. .It Va WITHOUT_LLVM_ASSERTIONS Disable debugging assertions in LLVM. +.It Va WITH_LLVM_BINUTILS +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. .It Va WITHOUT_LLVM_COV Do not build the .Xr llvm-cov 1 @@ -1278,6 +1321,8 @@ When set, it enforces these options: .It .Va WITHOUT_OPENSSH .It +.Va WITHOUT_OPENSSL_KTLS +.It .Va WITHOUT_PKGBOOTSTRAP .It .Va WITHOUT_UNBOUND From nobody Mon Nov 1 13:23:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ECE6F18280E7; Mon, 1 Nov 2021 13:23: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 4HjYcn6Q5yz4Wbr; Mon, 1 Nov 2021 13:23: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 BC8BA1225C; Mon, 1 Nov 2021 13: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 1A1DN5MN018895; Mon, 1 Nov 2021 13: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 1A1DN5ki018894; Mon, 1 Nov 2021 13:23:05 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:05 GMT Message-Id: <202111011323.1A1DN5ki018894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a2ca269b3810 - stable/13 - hyperv: Register hyperv_timecounter later during boot List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a2ca269b38105a250cb1273290ccc6a4b200388d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a2ca269b38105a250cb1273290ccc6a4b200388d commit a2ca269b38105a250cb1273290ccc6a4b200388d Author: Mark Johnston AuthorDate: 2021-10-25 17:08:38 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 12:56:16 +0000 hyperv: Register hyperv_timecounter later during boot Previously the MSR-based timecounter was registered during SI_SUB_HYPERVISOR, i.e., very early during boot, and before SI_SUB_LOCK. After commit 621fd9dcb2d8 this triggers a panic since the timecounter list lock is not yet initialized. The hyperv timecounter does not need to be registered so early, so defer that to SI_SUB_DRIVERS, at the same time the hyperv TSC timecounter is registered. Reported by: whu Approved by: whu Fixes: 621fd9dcb2d8 ("timecounter: Lock the timecounter list") Sponsored by: The FreeBSD Foundation (cherry picked from commit 9ef7df022a467776aa616b92fe5783e4261e84c6) --- sys/dev/hyperv/vmbus/hyperv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c index 5bb38fde8241..2c413664cd07 100644 --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -247,6 +247,13 @@ hyperv_init(void *dummy __unused) /* Set guest id */ wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); +} +SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, + NULL); + +static void +hyperv_tc_init(void *arg __unused) +{ if (hyperv_features & CPUID_HV_MSR_TIME_REFCNT) { /* Register Hyper-V timecounter */ tc_init(&hyperv_timecounter); @@ -258,8 +265,7 @@ hyperv_init(void *dummy __unused) hyperv_tc64 = hyperv_tc64_rdmsr; } } -SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, - NULL); +SYSINIT(hyperv_tc_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, hyperv_tc_init, NULL); static void hypercall_memfree(void) From nobody Mon Nov 1 13:23:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B45BF182871E; Mon, 1 Nov 2021 13:23: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 4HjYcq1MHzz4WdZ; Mon, 1 Nov 2021 13:23: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 F13EB1243E; Mon, 1 Nov 2021 13:23: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 1A1DN6IF018922; Mon, 1 Nov 2021 13:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DN66v018921; Mon, 1 Nov 2021 13:23:06 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:06 GMT Message-Id: <202111011323.1A1DN66v018921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 946a297fbd9a - stable/13 - sort: Fix random sort List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 946a297fbd9a01a433f2cfb5fa0ae86df07ee593 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=946a297fbd9a01a433f2cfb5fa0ae86df07ee593 commit 946a297fbd9a01a433f2cfb5fa0ae86df07ee593 Author: Mark Johnston AuthorDate: 2021-10-29 18:25:42 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:10:54 +0000 sort: Fix random sort bwsrawdata() is supposed to return the string buffer. PR: 259451 Reported by: sigsys@gmail.com Fixes: d053fb22f6d3 ("usr.bin/sort: Avoid UBSan errors") Sponsored by: The FreeBSD Foundation (cherry picked from commit e9bfb50d5e7aa5d673a5a35318820320c4190d33) --- usr.bin/sort/bwstring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index c31cb859cb37..2f2737e94314 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -152,7 +152,7 @@ bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) const void* bwsrawdata(const struct bwstring *bws) { - return (&(bws->wdata)); + return (bws->wdata.str); } size_t bwsrawlen(const struct bwstring *bws) From nobody Mon Nov 1 13:23:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 780E718284D8; Mon, 1 Nov 2021 13:23: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 4HjYcr226Pz4Wmv; Mon, 1 Nov 2021 13:23: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 13B341225D; Mon, 1 Nov 2021 13:23: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 1A1DN721018946; Mon, 1 Nov 2021 13:23:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DN7ws018945; Mon, 1 Nov 2021 13:23:07 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:07 GMT Message-Id: <202111011323.1A1DN7ws018945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 943421bdf764 - stable/13 - signal: Add SIG_FOREACH and refactor issignal() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 943421bdf7649af10806823bf3f30d7bf9b1cfaf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=943421bdf7649af10806823bf3f30d7bf9b1cfaf commit 943421bdf7649af10806823bf3f30d7bf9b1cfaf Author: Mark Johnston AuthorDate: 2021-10-16 13:44:40 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:20:11 +0000 signal: Add SIG_FOREACH and refactor issignal() Add a SIG_FOREACH macro that can be used to iterate over a signal set. This is a bit cleaner and more efficient than calling sig_ffs() in a loop. The implementation is based on BIT_FOREACH_ISSET(), except that the bitset limbs are always 32 bits wide, and signal sets are 1-indexed rather than 0-indexed like bitset(9) sets. issignal() cannot really be modified to use SIG_FOREACH() directly. Take this opportunity to split the function into two explicit loops. I've always found this function hard to read and think that this change is an improvement. Remove sig_ffs(), nothing uses it now. Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 81f2e9063d64cc976b47e7ee1e9c35692cda7cb4) --- sys/kern/kern_sig.c | 390 +++++++++++++++++++++++++++++----------------------- sys/sys/signalvar.h | 1 - 2 files changed, 218 insertions(+), 173 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index f73c9e85442f..0c5e9f41f153 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -249,6 +249,29 @@ static int sigproptbl[NSIG] = { [SIGUSR2] = SIGPROP_KILL, }; +#define _SIG_FOREACH_ADVANCE(i, set) ({ \ + int __found; \ + for (;;) { \ + if (__bits != 0) { \ + int __sig = ffs(__bits); \ + __bits &= ~(1u << (__sig - 1)); \ + sig = __i * sizeof((set)->__bits[0]) * NBBY + __sig; \ + __found = 1; \ + break; \ + } \ + if (++__i == _SIG_WORDS) { \ + __found = 0; \ + break; \ + } \ + __bits = (set)->__bits[__i]; \ + } \ + __found != 0; \ +}) + +#define SIG_FOREACH(i, set) \ + for (int32_t __i = -1, __bits = 0; \ + _SIG_FOREACH_ADVANCE(i, set); ) \ + sigset_t fastblock_mask; static void @@ -660,17 +683,6 @@ sigprop(int sig) return (0); } -int -sig_ffs(sigset_t *set) -{ - int i; - - for (i = 0; i < _SIG_WORDS; i++) - if (set->__bits[i]) - return (ffs(set->__bits[i]) + (i * 32)); - return (0); -} - static bool sigact_flag_test(const struct sigaction *act, int flag) { @@ -1009,9 +1021,7 @@ execsigs(struct proc *p) */ if (SV_PROC_ABI(p) == SV_ABI_CLOUDABI) { osigignore = ps->ps_sigignore; - while (SIGNOTEMPTY(osigignore)) { - sig = sig_ffs(&osigignore); - SIGDELSET(osigignore, sig); + SIG_FOREACH(sig, &osigignore) { if (sig != SIGPIPE) sigdflt(ps, sig); } @@ -2780,8 +2790,7 @@ reschedule_signals(struct proc *p, sigset_t block, int flags) return; SIGSETAND(block, p->p_siglist); fastblk = (flags & SIGPROCMASK_FASTBLK) != 0; - while ((sig = sig_ffs(&block)) != 0) { - SIGDELSET(block, sig); + SIG_FOREACH(sig, &block) { td = sigtd(p, sig, fastblk); /* @@ -2913,13 +2922,188 @@ sigallowstop_impl(int prev) } } +enum sigstatus { + SIGSTATUS_HANDLE, + SIGSTATUS_HANDLED, + SIGSTATUS_IGNORE, + SIGSTATUS_SBDRY_STOP, +}; + +/* + * The thread has signal "sig" pending. Figure out what to do with it: + * + * _HANDLE -> the caller should handle the signal + * _HANDLED -> handled internally, reload pending signal set + * _IGNORE -> ignored, remove from the set of pending signals and try the + * next pending signal + * _SBDRY_STOP -> the signal should stop the thread but this is not + * permitted in the current context + */ +static enum sigstatus +sigprocess(struct thread *td, int sig) +{ + struct proc *p; + struct sigacts *ps; + struct sigqueue *queue; + ksiginfo_t ksi; + int prop; + + KASSERT(_SIG_VALID(sig), ("%s: invalid signal %d", __func__, sig)); + + p = td->td_proc; + ps = p->p_sigacts; + mtx_assert(&ps->ps_mtx, MA_OWNED); + PROC_LOCK_ASSERT(p, MA_OWNED); + + /* + * We should allow pending but ignored signals below + * only if there is sigwait() active, or P_TRACED was + * on when they were posted. + */ + if (SIGISMEMBER(ps->ps_sigignore, sig) && + (p->p_flag & P_TRACED) == 0 && + (td->td_flags & TDF_SIGWAIT) == 0) { + return (SIGSTATUS_IGNORE); + } + + if ((p->p_flag & (P_TRACED | P_PPTRACE)) == P_TRACED) { + /* + * If traced, always stop. + * Remove old signal from queue before the stop. + * XXX shrug off debugger, it causes siginfo to + * be thrown away. + */ + queue = &td->td_sigqueue; + ksiginfo_init(&ksi); + if (sigqueue_get(queue, sig, &ksi) == 0) { + queue = &p->p_sigqueue; + sigqueue_get(queue, sig, &ksi); + } + td->td_si = ksi.ksi_info; + + mtx_unlock(&ps->ps_mtx); + sig = ptracestop(td, sig, &ksi); + mtx_lock(&ps->ps_mtx); + + td->td_si.si_signo = 0; + + /* + * Keep looking if the debugger discarded or + * replaced the signal. + */ + if (sig == 0) + return (SIGSTATUS_HANDLED); + + /* + * If the signal became masked, re-queue it. + */ + if (SIGISMEMBER(td->td_sigmask, sig)) { + ksi.ksi_flags |= KSI_HEAD; + sigqueue_add(&p->p_sigqueue, sig, &ksi); + return (SIGSTATUS_HANDLED); + } + + /* + * If the traced bit got turned off, requeue the signal and + * reload the set of pending signals. This ensures that p_sig* + * and p_sigact are consistent. + */ + if ((p->p_flag & P_TRACED) == 0) { + ksi.ksi_flags |= KSI_HEAD; + sigqueue_add(queue, sig, &ksi); + return (SIGSTATUS_HANDLED); + } + } + + /* + * Decide whether the signal should be returned. + * Return the signal's number, or fall through + * to clear it from the pending mask. + */ + switch ((intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)]) { + case (intptr_t)SIG_DFL: + /* + * Don't take default actions on system processes. + */ + if (p->p_pid <= 1) { +#ifdef DIAGNOSTIC + /* + * Are you sure you want to ignore SIGSEGV + * in init? XXX + */ + printf("Process (pid %lu) got signal %d\n", + (u_long)p->p_pid, sig); +#endif + return (SIGSTATUS_IGNORE); + } + + /* + * If there is a pending stop signal to process with + * default action, stop here, then clear the signal. + * Traced or exiting processes should ignore stops. + * Additionally, a member of an orphaned process group + * should ignore tty stops. + */ + prop = sigprop(sig); + if (prop & SIGPROP_STOP) { + mtx_unlock(&ps->ps_mtx); + if ((p->p_flag & (P_TRACED | P_WEXIT | + P_SINGLE_EXIT)) != 0 || ((p->p_pgrp-> + pg_flags & PGRP_ORPHANED) != 0 && + (prop & SIGPROP_TTYSTOP) != 0)) { + mtx_lock(&ps->ps_mtx); + return (SIGSTATUS_IGNORE); + } + if (TD_SBDRY_INTR(td)) { + KASSERT((td->td_flags & TDF_SBDRY) != 0, + ("lost TDF_SBDRY")); + mtx_lock(&ps->ps_mtx); + return (SIGSTATUS_SBDRY_STOP); + } + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, + &p->p_mtx.lock_object, "Catching SIGSTOP"); + sigqueue_delete(&td->td_sigqueue, sig); + sigqueue_delete(&p->p_sigqueue, sig); + p->p_flag |= P_STOPPED_SIG; + p->p_xsig = sig; + PROC_SLOCK(p); + sig_suspend_threads(td, p, 0); + thread_suspend_switch(td, p); + PROC_SUNLOCK(p); + mtx_lock(&ps->ps_mtx); + return (SIGSTATUS_HANDLED); + } else if ((prop & SIGPROP_IGNORE) != 0 && + (td->td_flags & TDF_SIGWAIT) == 0) { + /* + * Default action is to ignore; drop it if + * not in kern_sigtimedwait(). + */ + return (SIGSTATUS_IGNORE); + } else { + return (SIGSTATUS_HANDLE); + } + + case (intptr_t)SIG_IGN: + if ((td->td_flags & TDF_SIGWAIT) == 0) + return (SIGSTATUS_IGNORE); + else + return (SIGSTATUS_HANDLE); + + default: + /* + * This signal has an action, let postsig() process it. + */ + return (SIGSTATUS_HANDLE); + } +} + /* * If the current process has received a signal (should be caught or cause * termination, should interrupt current syscall), return the signal number. * Stop signals with default action are processed immediately, then cleared; * they aren't returned. This is checked after each entry to the system for - * a syscall or trap (though this can usually be done without calling issignal - * by checking the pending signal masks in cursig.) The normal call + * a syscall or trap (though this can usually be done without calling + * issignal by checking the pending signal masks in cursig.) The normal call * sequence is * * while (sig = cursig(curthread)) @@ -2929,16 +3113,12 @@ static int issignal(struct thread *td) { struct proc *p; - struct sigacts *ps; - struct sigqueue *queue; sigset_t sigpending; - ksiginfo_t ksi; - int prop, sig; + int sig; p = td->td_proc; - ps = p->p_sigacts; - mtx_assert(&ps->ps_mtx, MA_OWNED); PROC_LOCK_ASSERT(p, MA_OWNED); + for (;;) { sigpending = td->td_sigqueue.sq_signals; SIGSETOR(sigpending, p->p_sigqueue.sq_signals); @@ -2976,160 +3156,27 @@ issignal(struct thread *td) * execute the debugger attach ritual in * order. */ - sig = SIGSTOP; td->td_dbgflags |= TDB_FSTP; - } else { - sig = sig_ffs(&sigpending); + SIGEMPTYSET(sigpending); + SIGADDSET(sigpending, SIGSTOP); } - /* - * We should allow pending but ignored signals below - * only if there is sigwait() active, or P_TRACED was - * on when they were posted. - */ - if (SIGISMEMBER(ps->ps_sigignore, sig) && - (p->p_flag & P_TRACED) == 0 && - (td->td_flags & TDF_SIGWAIT) == 0) { - sigqueue_delete(&td->td_sigqueue, sig); - sigqueue_delete(&p->p_sigqueue, sig); - continue; - } - if ((p->p_flag & (P_TRACED | P_PPTRACE)) == P_TRACED) { - /* - * If traced, always stop. - * Remove old signal from queue before the stop. - * XXX shrug off debugger, it causes siginfo to - * be thrown away. - */ - queue = &td->td_sigqueue; - ksiginfo_init(&ksi); - if (sigqueue_get(queue, sig, &ksi) == 0) { - queue = &p->p_sigqueue; - sigqueue_get(queue, sig, &ksi); - } - td->td_si = ksi.ksi_info; - - mtx_unlock(&ps->ps_mtx); - sig = ptracestop(td, sig, &ksi); - mtx_lock(&ps->ps_mtx); - - td->td_si.si_signo = 0; - - /* - * Keep looking if the debugger discarded or - * replaced the signal. - */ - if (sig == 0) - continue; - - /* - * If the signal became masked, re-queue it. - */ - if (SIGISMEMBER(td->td_sigmask, sig)) { - ksi.ksi_flags |= KSI_HEAD; - sigqueue_add(&p->p_sigqueue, sig, &ksi); - continue; - } - - /* - * If the traced bit got turned off, requeue - * the signal and go back up to the top to - * rescan signals. This ensures that p_sig* - * and p_sigact are consistent. - */ - if ((p->p_flag & P_TRACED) == 0) { - ksi.ksi_flags |= KSI_HEAD; - sigqueue_add(queue, sig, &ksi); - continue; - } - } - - prop = sigprop(sig); - - /* - * Decide whether the signal should be returned. - * Return the signal's number, or fall through - * to clear it from the pending mask. - */ - switch ((intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)]) { - case (intptr_t)SIG_DFL: - /* - * Don't take default actions on system processes. - */ - if (p->p_pid <= 1) { -#ifdef DIAGNOSTIC - /* - * Are you sure you want to ignore SIGSEGV - * in init? XXX - */ - printf("Process (pid %lu) got signal %d\n", - (u_long)p->p_pid, sig); -#endif - break; /* == ignore */ - } - /* - * If there is a pending stop signal to process with - * default action, stop here, then clear the signal. - * Traced or exiting processes should ignore stops. - * Additionally, a member of an orphaned process group - * should ignore tty stops. - */ - if (prop & SIGPROP_STOP) { - mtx_unlock(&ps->ps_mtx); - if ((p->p_flag & (P_TRACED | P_WEXIT | - P_SINGLE_EXIT)) != 0 || ((p->p_pgrp-> - pg_flags & PGRP_ORPHANED) != 0 && - (prop & SIGPROP_TTYSTOP) != 0)) { - mtx_lock(&ps->ps_mtx); - break; /* == ignore */ - } - if (TD_SBDRY_INTR(td)) { - KASSERT((td->td_flags & TDF_SBDRY) != 0, - ("lost TDF_SBDRY")); - mtx_lock(&ps->ps_mtx); - return (-1); - } - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, - &p->p_mtx.lock_object, "Catching SIGSTOP"); + SIG_FOREACH(sig, &sigpending) { + switch (sigprocess(td, sig)) { + case SIGSTATUS_HANDLE: + return (sig); + case SIGSTATUS_HANDLED: + goto next; + case SIGSTATUS_IGNORE: sigqueue_delete(&td->td_sigqueue, sig); sigqueue_delete(&p->p_sigqueue, sig); - p->p_flag |= P_STOPPED_SIG; - p->p_xsig = sig; - PROC_SLOCK(p); - sig_suspend_threads(td, p, 0); - thread_suspend_switch(td, p); - PROC_SUNLOCK(p); - mtx_lock(&ps->ps_mtx); - goto next; - } else if ((prop & SIGPROP_IGNORE) != 0 && - (td->td_flags & TDF_SIGWAIT) == 0) { - /* - * Default action is to ignore; drop it if - * not in kern_sigtimedwait(). - */ - break; /* == ignore */ - } else - return (sig); - /*NOTREACHED*/ - - case (intptr_t)SIG_IGN: - if ((td->td_flags & TDF_SIGWAIT) == 0) - break; /* == ignore */ - else - return (sig); - - default: - /* - * This signal has an action, let - * postsig() process it. - */ - return (sig); + break; + case SIGSTATUS_SBDRY_STOP: + return (-1); + } } - sigqueue_delete(&td->td_sigqueue, sig); /* take the signal! */ - sigqueue_delete(&p->p_sigqueue, sig); next:; } - /* NOTREACHED */ } void @@ -4138,8 +4185,7 @@ sig_drop_caught(struct proc *p) ps = p->p_sigacts; PROC_LOCK_ASSERT(p, MA_OWNED); mtx_assert(&ps->ps_mtx, MA_OWNED); - while (SIGNOTEMPTY(ps->ps_sigcatch)) { - sig = sig_ffs(&ps->ps_sigcatch); + SIG_FOREACH(sig, &ps->ps_sigcatch) { sigdflt(ps, sig); if ((sigprop(sig) & SIGPROP_IGNORE) != 0) sigqueue_delete_proc(p, sig); diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index df761a1e1a5d..d43dd4a44190 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -404,7 +404,6 @@ int sig_ast_needsigchk(struct thread *td); void sig_drop_caught(struct proc *p); void sigexit(struct thread *td, int sig) __dead2; int sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **); -int sig_ffs(sigset_t *set); void sigfastblock_clear(struct thread *td); void sigfastblock_fetch(struct thread *td); void sigfastblock_setpend(struct thread *td, bool resched); From nobody Mon Nov 1 13:23:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0C27A18287AA; Mon, 1 Nov 2021 13:23: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 4HjYcs3TBnz4Wdr; Mon, 1 Nov 2021 13:23: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 34E9612364; Mon, 1 Nov 2021 13:23: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 1A1DN9jt018970; Mon, 1 Nov 2021 13:23:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DN9nT018969; Mon, 1 Nov 2021 13:23:09 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:09 GMT Message-Id: <202111011323.1A1DN9nT018969@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2788bb20cc05 - stable/13 - bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLR List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2788bb20cc05f581a57b4f50e5c63f9c70e04208 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2788bb20cc05f581a57b4f50e5c63f9c70e04208 commit 2788bb20cc05f581a57b4f50e5c63f9c70e04208 Author: Mark Johnston AuthorDate: 2021-09-21 15:32:23 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:20:11 +0000 bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLR These allow one to non-destructively iterate over the set or clear bits in a bitset. The motivation is that we have several code fragments which iterate over a CPU set like this: while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); ; } This is slow since CPU_FFS begins the search at the beginning of the bitset each time. On amd64 and arm64, CPU sets have size 256, so there are four limbs in the bitset and we do a lot of unnecessary scanning. A second problem is that this is destructive, so code which needs to preserve the original set has to make a copy. In particular, we have quite a few functions which take a cpuset_t parameter by value, meaning that each call has to copy the 32 byte cpuset_t. The new macros address both problems. Reviewed by: cem, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit dfd3bde5775ecf88851d5dffd6a8ed6076b53566) --- share/man/man9/Makefile | 2 ++ share/man/man9/bitset.9 | 34 ++++++++++++++++++++++++++++++++-- sys/sys/bitset.h | 10 ++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index c180742bdb4b..8793eb6b7278 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -616,6 +616,8 @@ MLINKS+=bitset.9 BITSET_DEFINE.9 \ bitset.9 BIT_FFS.9 \ bitset.9 BIT_FFS_AT.9 \ bitset.9 BIT_FLS.9 \ + bitset.9 BIT_FOREACH_ISSET.9 \ + bitset.9 BIT_FOREACH_ISCLR.9 \ bitset.9 BIT_COUNT.9 \ bitset.9 BIT_SUBSET.9 \ bitset.9 BIT_OVERLAP.9 \ diff --git a/share/man/man9/bitset.9 b/share/man/man9/bitset.9 index 1e080f515788..5788f09f2465 100644 --- a/share/man/man9/bitset.9 +++ b/share/man/man9/bitset.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2020 +.Dd September 20, 2021 .Dt BITSET 9 .Os .Sh NAME @@ -45,6 +45,8 @@ .Nm BIT_FFS , .Nm BIT_FFS_AT , .Nm BIT_FLS , +.Nm BIT_FOREACH_ISSET , +.Nm BIT_FOREACH_ISCLR , .Nm BIT_COUNT , .Nm BIT_SUBSET , .Nm BIT_OVERLAP , @@ -92,9 +94,18 @@ .Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "long start" .Ft long .Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset" +.Fo BIT_FOREACH_ISSET +.Fa "const SETSIZE" +.Fa "size_t bit" +.Fa "const struct STRUCTNAME *bitset" +.Fc +.Fo BIT_FOREACH_ISCLR +.Fa "const SETSIZE" +.Fa "size_t bit" +.Fa "const struct STRUCTNAME *bitset" +.Fc .Ft long .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" -.\" .Ft bool .Fo BIT_SUBSET .Fa "const SETSIZE" "struct STRUCTNAME *haystack" "struct STRUCTNAME *needle" @@ -329,6 +340,25 @@ index parameter to any other macro, you must subtract one from the result. .Pp The +.Fn BIT_FOREACH_ISSET +macro can be used to iterate over all set bits in +.Fa bitset . +The index variable +.Fa bit +must have been declared with type +.Ft int , +and upon each iteration +.Fa bit +is set to the index of successive set bits. +The value of +.Fa bit +after the loop terminates is undefined. +Similarly, +.Fn BIT_FOREACH_ISCLR +iterates over all clear bits in +.Fa bitset . +.Pp +The .Fn BIT_COUNT macro returns the total number of set bits in .Fa bitset . diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h index 2b5df78a8193..ab6eaf85b8df 100644 --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -271,6 +271,16 @@ __count; \ }) +/* Non-destructively loop over all set or clear bits in the set. */ +#define _BIT_FOREACH(_s, i, p, op) \ + for (__size_t __i = 0; __i < __bitset_words(_s); __i++) \ + for (long __j = op((p)->__bits[__i]), __b = ffsl(__j); \ + (i = (__b - 1) + __i * _BITSET_BITS), __j != 0; \ + __j &= ~(1l << i), __b = ffsl(__j)) + +#define BIT_FOREACH_ISSET(_s, i, p) _BIT_FOREACH(_s, i, p, ) +#define BIT_FOREACH_ISCLR(_s, i, p) _BIT_FOREACH(_s, i, p, ~) + #define BITSET_T_INITIALIZER(x) \ { .__bits = { x } } From nobody Mon Nov 1 13:23:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BA05118287BF; Mon, 1 Nov 2021 13:23: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 4HjYcv2nCjz4WcL; Mon, 1 Nov 2021 13:23: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 543BF1258E; Mon, 1 Nov 2021 13:23: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 1A1DNAUt018994; Mon, 1 Nov 2021 13:23:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DNAX5018993; Mon, 1 Nov 2021 13:23:10 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:10 GMT Message-Id: <202111011323.1A1DNAX5018993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 4e669a95d614 - stable/13 - clang-format: Add bitset loop macros List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e669a95d614092855dcaa5d250d088ad7e95c67 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4e669a95d614092855dcaa5d250d088ad7e95c67 commit 4e669a95d614092855dcaa5d250d088ad7e95c67 Author: Mark Johnston AuthorDate: 2021-09-21 15:39:49 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:20:11 +0000 clang-format: Add bitset loop macros Sponsored by: The FreeBSD Foundation (cherry picked from commit a3e3d90863f3af81bca485468814a787206a235d) --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index 06709b762ec1..34ed52f7db51 100644 --- a/.clang-format +++ b/.clang-format @@ -52,7 +52,11 @@ ForEachMacros: - ARB_FOREACH_REVERSE - ARB_FOREACH_REVERSE_FROM - ARB_FOREACH_REVERSE_SAFE + - BIT_FOREACH_ISCLR + - BIT_FOREACH_ISSET - CPU_FOREACH + - CPU_FOREACH_ISCLR + - CPU_FOREACH_ISSET - FOREACH_THREAD_IN_PROC - FOREACH_PROC_IN_SYSTEM - FOREACH_PRISON_CHILD From nobody Mon Nov 1 13:23:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B8E0F18286C5; Mon, 1 Nov 2021 13:23: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 4HjYcv6Gljz4WMY; Mon, 1 Nov 2021 13:23: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 71B0C12365; Mon, 1 Nov 2021 13:23: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 1A1DNBV9019019; Mon, 1 Nov 2021 13:23:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DNBMq019017; Mon, 1 Nov 2021 13:23:11 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:11 GMT Message-Id: <202111011323.1A1DNBMq019017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c5bd130deb1c - stable/13 - bitset: Reimplement BIT_FOREACH_IS(SET|CLR) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5bd130deb1c89f57fba29365cdffd05656fe20d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c5bd130deb1c89f57fba29365cdffd05656fe20d commit c5bd130deb1c89f57fba29365cdffd05656fe20d Author: Mark Johnston AuthorDate: 2021-10-16 13:38:26 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:20:11 +0000 bitset: Reimplement BIT_FOREACH_IS(SET|CLR) Eliminate the nested loops and re-implement following a suggestion from rlibby. Add some simple regression tests. Reviewed by: rlibby, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 51425cb2107c07ff379639edfbad65c77b55c3b8) --- share/man/man9/bitset.9 | 4 +++ sys/sys/bitset.h | 31 ++++++++++++---- tests/sys/sys/Makefile | 7 +++- tests/sys/sys/bitset_test.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 7 deletions(-) diff --git a/share/man/man9/bitset.9 b/share/man/man9/bitset.9 index 5788f09f2465..1a5ec05b01c6 100644 --- a/share/man/man9/bitset.9 +++ b/share/man/man9/bitset.9 @@ -357,6 +357,10 @@ Similarly, .Fn BIT_FOREACH_ISCLR iterates over all clear bits in .Fa bitset . +In the loop body, the currently indexed bit may be set or cleared. +However, setting or clearing bits other than the currently indexed +bit does not guarantee that they will or will not be returned in +subsequent iterations of the same loop. .Pp The .Fn BIT_COUNT diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h index ab6eaf85b8df..1c154d5601ab 100644 --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -271,12 +271,31 @@ __count; \ }) -/* Non-destructively loop over all set or clear bits in the set. */ -#define _BIT_FOREACH(_s, i, p, op) \ - for (__size_t __i = 0; __i < __bitset_words(_s); __i++) \ - for (long __j = op((p)->__bits[__i]), __b = ffsl(__j); \ - (i = (__b - 1) + __i * _BITSET_BITS), __j != 0; \ - __j &= ~(1l << i), __b = ffsl(__j)) +#define _BIT_FOREACH_ADVANCE(_s, i, p, op) __extension__ ({ \ + int __found; \ + for (;;) { \ + if (__bits != 0) { \ + int __bit = ffsl(__bits) - 1; \ + __bits &= ~(1ul << __bit); \ + (i) = __i * _BITSET_BITS + __bit; \ + __found = 1; \ + break; \ + } \ + if (++__i == __bitset_words(_s)) { \ + __found = 0; \ + break; \ + } \ + __bits = op((p)->__bits[__i]); \ + } \ + __found != 0; \ +}) + +/* + * Non-destructively loop over all set or clear bits in the set. + */ +#define _BIT_FOREACH(_s, i, p, op) \ + for (long __i = -1, __bits = 0; \ + _BIT_FOREACH_ADVANCE(_s, i, p, op); ) #define BIT_FOREACH_ISSET(_s, i, p) _BIT_FOREACH(_s, i, p, ) #define BIT_FOREACH_ISCLR(_s, i, p) _BIT_FOREACH(_s, i, p, ~) diff --git a/tests/sys/sys/Makefile b/tests/sys/sys/Makefile index 95739c127632..f6c45971d93c 100644 --- a/tests/sys/sys/Makefile +++ b/tests/sys/sys/Makefile @@ -4,7 +4,12 @@ TESTSDIR= ${TESTSBASE}/sys/sys -ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test +ATF_TESTS_C= arb_test \ + bitset_test \ + bitstring_test \ + qmath_test \ + rb_test \ + splay_test .if ${COMPILER_TYPE} == "gcc" CFLAGS.bitstring_test= -fno-strict-overflow diff --git a/tests/sys/sys/bitset_test.c b/tests/sys/sys/bitset_test.c new file mode 100644 index 000000000000..781b523dae97 --- /dev/null +++ b/tests/sys/sys/bitset_test.c @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software was developed by Mark Johnston under sponsorship from + * the FreeBSD Foundation. + */ + +#include +#include +#include +#include +#include + +#include + +BITSET_DEFINE(bs256, 256); + +ATF_TC_WITHOUT_HEAD(bit_foreach); +ATF_TC_BODY(bit_foreach, tc) +{ + struct bs256 bs0, bs1, bsrand; + int setc, clrc, i; + +#define _BIT_FOREACH_COUNT(s, bs) do { \ + int prev = -1; \ + setc = clrc = 0; \ + BIT_FOREACH_ISSET((s), i, (bs)) { \ + ATF_REQUIRE_MSG(prev < i, "incorrect bit ordering"); \ + ATF_REQUIRE_MSG(BIT_ISSET((s), i, (bs)), \ + "bit %d is not set", i); \ + setc++; \ + prev = i; \ + } \ + prev = -1; \ + BIT_FOREACH_ISCLR((s), i, (bs)) { \ + ATF_REQUIRE_MSG(prev < i, "incorrect bit ordering"); \ + ATF_REQUIRE_MSG(!BIT_ISSET((s), i, (bs)), \ + "bit %d is set", i); \ + clrc++; \ + prev = i; \ + } \ +} while (0) + + /* + * Create several bitsets, and for each one count the number + * of set and clear bits and make sure they match what we expect. + */ + + BIT_FILL(256, &bs1); + _BIT_FOREACH_COUNT(256, &bs1); + ATF_REQUIRE_MSG(setc == 256, "incorrect set count %d", setc); + ATF_REQUIRE_MSG(clrc == 0, "incorrect clear count %d", clrc); + + BIT_ZERO(256, &bs0); + _BIT_FOREACH_COUNT(256, &bs0); + ATF_REQUIRE_MSG(setc == 0, "incorrect set count %d", setc); + ATF_REQUIRE_MSG(clrc == 256, "incorrect clear count %d", clrc); + + BIT_ZERO(256, &bsrand); + for (i = 0; i < 256; i++) + if (random() % 2 != 0) + BIT_SET(256, i, &bsrand); + _BIT_FOREACH_COUNT(256, &bsrand); + ATF_REQUIRE_MSG(setc + clrc == 256, "incorrect counts %d, %d", + setc, clrc); + + /* + * Try to verify that we can safely clear bits in the set while + * iterating. + */ + BIT_FOREACH_ISSET(256, i, &bsrand) { + ATF_REQUIRE(setc-- > 0); + BIT_CLR(256, i, &bsrand); + } + _BIT_FOREACH_COUNT(256, &bsrand); + ATF_REQUIRE_MSG(setc == 0, "incorrect set count %d", setc); + ATF_REQUIRE_MSG(clrc == 256, "incorrect clear count %d", clrc); + +#undef _BIT_FOREACH_COUNT +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, bit_foreach); + return (atf_no_error()); +} From nobody Mon Nov 1 13:23:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6AF021828767; Mon, 1 Nov 2021 13:23:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjYcx2T0wz4Whx; Mon, 1 Nov 2021 13:23: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 9446512440; Mon, 1 Nov 2021 13:23: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 1A1DNC74019048; Mon, 1 Nov 2021 13:23:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DNCYH019047; Mon, 1 Nov 2021 13:23:12 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:12 GMT Message-Id: <202111011323.1A1DNCYH019047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: acbd8022ae23 - stable/13 - cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: acbd8022ae23b7ec1a2179877c4e54ce40919309 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=acbd8022ae23b7ec1a2179877c4e54ce40919309 commit acbd8022ae23b7ec1a2179877c4e54ce40919309 Author: Mark Johnston AuthorDate: 2021-09-21 15:36:55 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:20:11 +0000 cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it This implementation is faster and doesn't modify the cpuset, so it lets us avoid some unnecessary copying as well. No functional change intended. This is a re-application of commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e. Reviewed by: cem, kib, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit de8554295b47475e758a573ab7418265f21fee7e) --- sys/amd64/amd64/mp_machdep.c | 11 +++-------- sys/amd64/vmm/io/vlapic.c | 13 +++---------- sys/amd64/vmm/vmm_lapic.c | 4 +--- sys/i386/i386/mp_machdep.c | 4 +--- sys/sys/cpuset.h | 2 ++ sys/x86/x86/mp_x86.c | 4 +--- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 383226b96d10..14853ce56603 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -618,7 +618,7 @@ static void smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { - cpuset_t other_cpus, mask1; + cpuset_t other_cpus; uint32_t generation, *p_cpudone; int cpu; bool is_all; @@ -662,10 +662,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, /* Fence between filling smp_tlb fields and clearing scoreboard. */ atomic_thread_fence_rel(); - mask1 = mask; - while ((cpu = CPU_FFS(&mask1)) != 0) { - cpu--; - CPU_CLR(cpu, &mask1); + CPU_FOREACH_ISSET(cpu, &mask) { KASSERT(*invl_scoreboard_slot(cpu) != 0, ("IPI scoreboard is zero, initiator %d target %d", PCPU_GET(cpuid), cpu)); @@ -686,9 +683,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, ipi_selected(mask, IPI_INVLOP); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = invl_scoreboard_slot(cpu); while (atomic_load_int(p_cpudone) != generation) ia32_pause(); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 06df1c1a87e5..4e7ddbafd447 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -860,10 +860,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); - while ((vcpuid = CPU_FFS(&amask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &amask); - + CPU_FOREACH_ISSET(vcpuid, &amask) { vlapic = vm_lapic(vm, vcpuid); dfr = vlapic->apic_page->dfr; ldr = vlapic->apic_page->ldr; @@ -1003,9 +1000,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; } - while ((i = CPU_FFS(&dmask)) != 0) { - i--; - CPU_CLR(i, &dmask); + CPU_FOREACH_ISSET(i, &dmask) { if (mode == APIC_DELMODE_FIXED) { lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, @@ -1554,9 +1549,7 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, */ vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false); - while ((vcpuid = CPU_FFS(&dmask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &dmask); + CPU_FOREACH_ISSET(vcpuid, &dmask) { if (delmode == IOART_DELEXINT) { vm_inject_extint(vm, vcpuid); } else { diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 89a1ebc8eff9..8191da758100 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -87,9 +87,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector) else CPU_SETOF(cpu, &dmask); error = 0; - while ((cpu = CPU_FFS(&dmask)) != 0) { - cpu--; - CPU_CLR(cpu, &dmask); + CPU_FOREACH_ISSET(cpu, &dmask) { vlapic = vm_lapic(vm, cpu); error = vlapic_trigger_lvt(vlapic, vector); if (error) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 156702118c45..777aefa021b3 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -598,9 +598,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, ipi_selected(mask, vector); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done; while (*p_cpudone != generation) ia32_pause(); diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 1a96bb4766ce..9ef1a65f4506 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -66,6 +66,8 @@ #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) +#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) +#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 326b6fdae77d..255a6c13f025 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1343,9 +1343,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); - while ((cpu = CPU_FFS(&cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &cpus); + CPU_FOREACH_ISSET(cpu, &cpus) { CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } From nobody Mon Nov 1 13:23:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2B6C018286F0; Mon, 1 Nov 2021 13: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 4HjYcz0TgFz4WVq; Mon, 1 Nov 2021 13:23: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 B885B11FCE; Mon, 1 Nov 2021 13:23: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 1A1DNDUp019072; Mon, 1 Nov 2021 13:23:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DNDKn019071; Mon, 1 Nov 2021 13:23:13 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:23:13 GMT Message-Id: <202111011323.1A1DNDKn019071@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: bb5c81812f0f - stable/13 - timecounter: Lock the timecounter list List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb5c81812f0f02f29362c2f7cb6b9ad1fdcf3681 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bb5c81812f0f02f29362c2f7cb6b9ad1fdcf3681 commit bb5c81812f0f02f29362c2f7cb6b9ad1fdcf3681 Author: Mark Johnston AuthorDate: 2021-10-16 13:46:55 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:20:11 +0000 timecounter: Lock the timecounter list Timecounter registration is dynamic, i.e., there is no requirement that timecounters must be registered during single-threaded boot. Loadable drivers may in principle register timecounters (which can be switched to automatically). Timecounters cannot be unregistered, though this could be implemented. Registered timecounters belong to a global linked list. Add a mutex to synchronize insertions and the traversals done by (mpsafe) sysctl handlers. No functional change intended. Reviewed by: imp, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 621fd9dcb2d83daab477c130bc99b905f6fc27dc) --- sys/kern/kern_tc.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 4ae0169b7d8d..bd1e44c44bd8 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -98,6 +98,10 @@ static struct timehands *volatile timehands = &ths[0]; struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; +/* Mutex to protect the timecounter list. */ +static struct mtx tc_lock; +MTX_SYSINIT(tc_lock, &tc_lock, "tc", MTX_DEF); + int tc_min_ticktock_freq = 1; volatile time_t time_second = 1; @@ -1183,8 +1187,6 @@ tc_init(struct timecounter *tc) tc->tc_quality); } - tc->tc_next = timecounters; - timecounters = tc; /* * Set up sysctl tree for this counter. */ @@ -1206,6 +1208,11 @@ tc_init(struct timecounter *tc) SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(tc_root), OID_AUTO, "quality", CTLFLAG_RD, &(tc->tc_quality), 0, "goodness of time counter"); + + mtx_lock(&tc_lock); + tc->tc_next = timecounters; + timecounters = tc; + /* * Do not automatically switch if the current tc was specifically * chosen. Never automatically use a timecounter with negative quality. @@ -1213,22 +1220,24 @@ tc_init(struct timecounter *tc) * worse since this timecounter may not be monotonic. */ if (tc_chosen) - return; + goto unlock; if (tc->tc_quality < 0) - return; + goto unlock; if (tc_from_tunable[0] != '\0' && strcmp(tc->tc_name, tc_from_tunable) == 0) { tc_chosen = 1; tc_from_tunable[0] = '\0'; } else { if (tc->tc_quality < timecounter->tc_quality) - return; + goto unlock; if (tc->tc_quality == timecounter->tc_quality && tc->tc_frequency < timecounter->tc_frequency) - return; + goto unlock; } (void)tc->tc_get_timecount(tc); timecounter = tc; +unlock: + mtx_unlock(&tc_lock); } /* Report the frequency of the current timecounter. */ @@ -1474,16 +1483,22 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) struct timecounter *newtc, *tc; int error; + mtx_lock(&tc_lock); tc = timecounter; strlcpy(newname, tc->tc_name, sizeof(newname)); + mtx_unlock(&tc_lock); error = sysctl_handle_string(oidp, &newname[0], sizeof(newname), req); if (error != 0 || req->newptr == NULL) return (error); + + mtx_lock(&tc_lock); /* Record that the tc in use now was specifically chosen. */ tc_chosen = 1; - if (strcmp(newname, tc->tc_name) == 0) + if (strcmp(newname, tc->tc_name) == 0) { + mtx_unlock(&tc_lock); return (0); + } for (newtc = timecounters; newtc != NULL; newtc = newtc->tc_next) { if (strcmp(newname, newtc->tc_name) != 0) continue; @@ -1501,11 +1516,11 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) * use any locking and that it can be called in hard interrupt * context via 'tc_windup()'. */ - return (0); + break; } - return (EINVAL); + mtx_unlock(&tc_lock); + return (newtc != NULL ? 0 : EINVAL); } - SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_hardware, "A", @@ -1519,12 +1534,17 @@ sysctl_kern_timecounter_choice(SYSCTL_HANDLER_ARGS) struct timecounter *tc; int error; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sb, NULL, 0, req); + mtx_lock(&tc_lock); for (tc = timecounters; tc != NULL; tc = tc->tc_next) { if (tc != timecounters) sbuf_putc(&sb, ' '); sbuf_printf(&sb, "%s(%d)", tc->tc_name, tc->tc_quality); } + mtx_unlock(&tc_lock); error = sbuf_finish(&sb); sbuf_delete(&sb); return (error); From nobody Mon Nov 1 13:52:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 20822183E408; Mon, 1 Nov 2021 13:52: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 4HjZGT4WbBz4pXp; Mon, 1 Nov 2021 13:52: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 1416B12B20; Mon, 1 Nov 2021 13:52: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 1A1DqGiS066847; Mon, 1 Nov 2021 13:52:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DqGXN066846; Mon, 1 Nov 2021 13:52:16 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:52:16 GMT Message-Id: <202111011352.1A1DqGXN066846@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: fab343a7168a - main - uma: Improve M_USE_RESERVE handling in keg_fetch_slab() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: fab343a7168a2f033073bb5f65b5af17d9092c6f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fab343a7168a2f033073bb5f65b5af17d9092c6f commit fab343a7168a2f033073bb5f65b5af17d9092c6f Author: Mark Johnston AuthorDate: 2021-11-01 13:27:35 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:51:18 +0000 uma: Improve M_USE_RESERVE handling in keg_fetch_slab() M_USE_RESERVE is used in a couple of places in the VM to avoid unbounded recursion when the direct map is not available, as is the case on 32-bit platforms or when certain kernel sanitizers (KASAN and KMSAN) are enabled. For example, to allocate KVA, the kernel might allocate a kernel map entry, which might require a new slab, which requires KVA. For these zones, we use uma_prealloc() to populate a reserve of items, and then in certain serialized contexts M_USE_RESERVE can be used to guarantee a successful allocation. uma_prealloc() allocates the requested number of items, distributing them evenly among NUMA domains. Thus, in a first-touch zone, to satisfy an M_USE_RESERVE allocation we might have to check the slab lists of other domains than the current one to provide the semantics expected by consumers. So, try harder to find an item if M_USE_RESERVE is specified and the keg doesn't have anything for current (first-touch) domain. Specifically, fall back to a round-robin slab allocation. This change fixes boot-time panics on NUMA systems with KASAN or KMSAN enabled.[1] Alternately we could have uma_prealloc() allocate the requested number of items for each domain, but for some existing consumers this would be quite wasteful. In general I think keg_fetch_slab() should try harder to find free slabs in other domains before trying to allocate fresh ones, but let's limit this to M_USE_RESERVE for now. Also fix a separate problem that I noticed: in a non-round-robin slab allocation with M_WAITOK, rather than sleeping after a failed slab allocation we simply try again. Call vm_wait_domain() before retrying. Reported by: mjg, tuexen [1] Reviewed by: alc MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32515 --- sys/vm/uma_core.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 35ed473da5ca..de9605a28bb6 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -3914,6 +3914,9 @@ keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdomain, const int flags) int aflags, domain; bool rr; + KASSERT((flags & (M_WAITOK | M_NOVM)) != (M_WAITOK | M_NOVM), + ("%s: invalid flags %#x", __func__, flags)); + restart: /* * Use the keg's policy if upper layers haven't already specified a @@ -3939,17 +3942,29 @@ restart: return (slab); /* - * M_NOVM means don't ask at all! + * M_NOVM is used to break the recursion that can otherwise + * occur if low-level memory management routines use UMA. */ - if (flags & M_NOVM) - break; + if ((flags & M_NOVM) == 0) { + slab = keg_alloc_slab(keg, zone, domain, flags, aflags); + if (slab != NULL) + return (slab); + } - slab = keg_alloc_slab(keg, zone, domain, flags, aflags); - if (slab != NULL) - return (slab); - if (!rr && (flags & M_WAITOK) == 0) - break; - if (rr && vm_domainset_iter_policy(&di, &domain) != 0) { + if (!rr) { + if ((flags & M_USE_RESERVE) != 0) { + /* + * Drain reserves from other domains before + * giving up or sleeping. It may be useful to + * support per-domain reserves eventually. + */ + rdomain = UMA_ANYDOMAIN; + goto restart; + } + if ((flags & M_WAITOK) == 0) + break; + vm_wait_domain(domain); + } else if (vm_domainset_iter_policy(&di, &domain) != 0) { if ((flags & M_WAITOK) != 0) { vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask, 0); goto restart; From nobody Mon Nov 1 13:52:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1AA6E183E40D; Mon, 1 Nov 2021 13:52: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 4HjZGV3BRwz4pKs; Mon, 1 Nov 2021 13:52: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 339E712D08; Mon, 1 Nov 2021 13:52: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 1A1DqIvr066871; Mon, 1 Nov 2021 13:52:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1DqIQq066870; Mon, 1 Nov 2021 13:52:18 GMT (envelope-from git) Date: Mon, 1 Nov 2021 13:52:18 GMT Message-Id: <202111011352.1A1DqIQq066870@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: 7585c5db25b7 - main - uma: Fix handling of reserves in zone_import() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 7585c5db25b700d19baebd7afd7a1b2e03c29cda Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7585c5db25b700d19baebd7afd7a1b2e03c29cda commit 7585c5db25b700d19baebd7afd7a1b2e03c29cda Author: Mark Johnston AuthorDate: 2021-11-01 13:27:52 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:51:43 +0000 uma: Fix handling of reserves in zone_import() Kegs with no items reserved have uk_reserve = 0. So the check keg->uk_reserve >= dom->ud_free_items will be true once all slabs are depleted. Then, rather than go and allocate a fresh slab, we return to the cache layer. The intent was to do this only when the keg actually has a reserve, so modify the check to verify this first. Another approach would be to make uk_reserve signed and set it to -1 until uma_zone_reserve() is called, but this requires a few casts elsewhere. Fixes: 1b2dcc8c54a8 ("uma: Avoid depleting keg reserves when filling a bucket") MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32516 --- sys/vm/uma_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index de9605a28bb6..7b83d81a423d 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -4038,7 +4038,8 @@ zone_import(void *arg, void **bucket, int max, int domain, int flags) dom = &keg->uk_domain[slab->us_domain]; do { bucket[i++] = slab_alloc_item(keg, slab); - if (dom->ud_free_items <= keg->uk_reserve) { + if (keg->uk_reserve > 0 && + dom->ud_free_items <= keg->uk_reserve) { /* * Avoid depleting the reserve after a * successful item allocation, even if From nobody Mon Nov 1 14:32:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1C491182D5A0; Mon, 1 Nov 2021 14:32: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 4Hjb9M06nDz3sD7; Mon, 1 Nov 2021 14:32: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 CA4C613419; Mon, 1 Nov 2021 14:32: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 1A1EWsNb021220; Mon, 1 Nov 2021 14:32:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EWsuk021219; Mon, 1 Nov 2021 14:32:54 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:32:54 GMT Message-Id: <202111011432.1A1EWsuk021219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8b3c771fc62a - stable/13 - Add a KASAN option to the kernel build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8b3c771fc62af7d0d9e5b36e835892924e44b144 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b3c771fc62af7d0d9e5b36e835892924e44b144 commit 8b3c771fc62af7d0d9e5b36e835892924e44b144 Author: Mark Johnston AuthorDate: 2021-04-13 20:29:47 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:56:14 +0000 Add a KASAN option to the kernel build LLVM support for enabling KASAN has not yet landed so the option is not yet usable, but hopefully this will change soon. Reviewed by: imp, andrew Sponsored by: The FreeBSD Foundation (cherry picked from commit 01028c736cbcdba079967c787bee1551fc8439aa) --- sys/conf/kern.pre.mk | 10 ++++++++++ sys/conf/options | 1 + 2 files changed, 11 insertions(+) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index bb52d1b9fbc4..8cab54d0763a 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -107,6 +107,16 @@ PROF= -pg .endif DEFINED_PROF= ${PROF} +KASAN_ENABLED!= grep KASAN opt_global.h || true ; echo +.if !empty(KASAN_ENABLED) +SAN_CFLAGS+= -fsanitize=kernel-address \ + -mllvm -asan-stack=true \ + -mllvm -asan-instrument-dynamic-allocas=true \ + -mllvm -asan-globals=true \ + -mllvm -asan-use-after-scope=true \ + -mllvm -asan-instrumentation-with-call-threshold=0 +.endif + KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo .if !empty(KCSAN_ENABLED) SAN_CFLAGS+= -fsanitize=thread diff --git a/sys/conf/options b/sys/conf/options index 121a23ed876c..774850158221 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -229,6 +229,7 @@ ZSTDIO opt_zstdio.h # Sanitizers COVERAGE opt_global.h +KASAN opt_global.h KCOV KCSAN opt_global.h KUBSAN opt_global.h From nobody Mon Nov 1 14:32:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8118A182D5AA; Mon, 1 Nov 2021 14:32: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 4Hjb9N0zNsz3s0q; Mon, 1 Nov 2021 14:32: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 E43FA1341A; Mon, 1 Nov 2021 14:32: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 1A1EWtxL021244; Mon, 1 Nov 2021 14:32:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EWtO3021243; Mon, 1 Nov 2021 14:32:55 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:32:55 GMT Message-Id: <202111011432.1A1EWtO3021243@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 48d2c7cc305c - stable/13 - Add the KASAN runtime List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 48d2c7cc305cc94542f95d3c2f378f63b92c8562 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=48d2c7cc305cc94542f95d3c2f378f63b92c8562 commit 48d2c7cc305cc94542f95d3c2f378f63b92c8562 Author: Mark Johnston AuthorDate: 2021-04-13 21:39:19 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:56:31 +0000 Add the KASAN runtime KASAN enables the use of LLVM's AddressSanitizer in the kernel. This feature makes use of compiler instrumentation to validate memory accesses in the kernel and detect several types of bugs, including use-after-frees and out-of-bounds accesses. It is particularly effective when combined with test suites or syzkaller. KASAN has high CPU and memory usage overhead and so is not suited for production environments. The runtime and pmap maintain a shadow of the kernel map to store information about the validity of memory mapped at a given kernel address. The runtime implements a number of functions defined by the compiler ABI. These are prefixed by __asan. The compiler emits calls to __asan_load*() and __asan_store*() around memory accesses, and the runtime consults the shadow map to determine whether a given access is valid. kasan_mark() is called by various kernel allocators to update state in the shadow map. Updates to those allocators will come in subsequent commits. The runtime also defines various interceptors. Some low-level routines are implemented in assembly and are thus not amenable to compiler instrumentation. To handle this, the runtime implements these routines on behalf of the rest of the kernel. The sanitizer implementation validates memory accesses manually before handing off to the real implementation. The sanitizer in a KASAN-configured kernel can be disabled by setting the loader tunable debug.kasan.disable=1. Obtained from: NetBSD Sponsored by: The FreeBSD Foundation (cherry picked from commit 38da497a4dfcf1979c8c2b0e9f3fa0564035c147) --- share/man/man9/Makefile | 3 + share/man/man9/kasan.9 | 171 ++++++++ sys/conf/files | 2 + sys/kern/subr_asan.c | 1091 +++++++++++++++++++++++++++++++++++++++++++++++ sys/sys/asan.h | 68 +++ 5 files changed, 1335 insertions(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 8793eb6b7278..500cd252a3df 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -186,6 +186,7 @@ MAN= accept_filter.9 \ insmntque.9 \ intro.9 \ ithread.9 \ + kasan.9 \ KASSERT.9 \ kern_reboot.9 \ kern_testfrwk.9 \ @@ -1314,6 +1315,8 @@ MLINKS+=kernel_mount.9 free_mntarg.9 \ kernel_mount.9 mount_argb.9 \ kernel_mount.9 mount_argf.9 \ kernel_mount.9 mount_argsu.9 +MLINKS+=kasan.9 KASAN.9 \ + kasan.9 kasan_mark.9 MLINKS+=khelp.9 khelp_add_hhook.9 \ khelp.9 KHELP_DECLARE_MOD.9 \ khelp.9 KHELP_DECLARE_MOD_UMA.9 \ diff --git a/share/man/man9/kasan.9 b/share/man/man9/kasan.9 new file mode 100644 index 000000000000..ecc068209913 --- /dev/null +++ b/share/man/man9/kasan.9 @@ -0,0 +1,171 @@ +.\"- +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" This documentation was written by Mark Johnston under sponsorship from +.\" the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 13, 2021 +.Dt KASAN 9 +.Os +.Sh NAME +.Nm kasan +.Nd kernel address sanitizer +.Sh SYNOPSIS +To compile KASAN into the kernel, place the following line in your kernel +configuration file: +.Bd -ragged -offset indent +.Cd "options KASAN" +.Ed +.Pp +.Ft void +.Fn kasan_mark "const void *addr" "size_t size" "size_t redzsize" "uint8_t code" +.Sh DESCRIPTION +.Nm +is a subsystem which leverages compiler instrumentation to detect invalid +memory accesses in the kernel. +Currently it is implemented only on the amd64 platform. +.Pp +When +.Nm +is compiled into the kernel, the compiler is configured to emit function +calls upon every memory access. +The functions are implemented by +.Nm +and permit run-time detection of several types of bugs including +use-after-frees, double frees and frees of invalid pointers, and out-of-bounds +accesses. +These protections apply to memory allocated by +.Xr uma 9 , +.Xr malloc 9 +and related functions, and +.Fn kmem_malloc +and related functions, +as well as global variables and kernel stacks. +.Nm +is conservative and will not detect all instances of these types of bugs. +Memory accesses through the kernel map are sanitized, but accesses via the +direct map are not. +When +.Nm +is configured, the kernel aims to minimize its use of the direct map. +.Sh IMPLEMENTATION NOTES +.Nm +is implemented using compiler instrumentation and a kernel runtime. +When a +kernel is built with the KASAN option enabled, the compiler inserts function calls +before most memory accesses in the generated code. +The runtime implements the corresponding functions, which decide whether a +given access is valid. +If not, the runtime prints a warning or panics the kernel, depending on the +value of the +.Sy debug.kasan.panic_on_violation +sysctl/tunable. +.Pp +The +.Nm +runtime works by maintaining a shadow map for the kernel map. +There exists a linear mapping between addresses in the kernel map and addresses +in the shadow map. +The shadow map is used to store information about the current state of +allocations from the kernel map. +For example, when a buffer is returned by +.Xr malloc 9 , +the corresponding region of the shadow map is marked to indicate that the +buffer is valid. +When it is freed, the shadow map is updated to mark the buffer as invalid. +Accesses to the buffer are intercepted by the +.Nm +runtime and validated using the contents of the shadow map. +.Pp +Upon booting, all kernel memory is marked as valid. +Kernel allocators must mark cached but free buffers as invalid, and must mark +them valid before freeing the kernel virtual address range. +This slightly reduces the effectiveness of +.Nm +but simplifies its maintenance and integration into the kernel. +.Pp +Updates to the shadow map are performed by calling +.Fn kasan_mark . +Parameter +.Fa addr +is the address of the buffer whose shadow is to be updated, +.Fa size +is the usable size of the buffer, and +.Fa redzsize +is the full size of the buffer allocated from lower layers of the system. +.Fa redzsize +must be greater than or equal to +.Fa size . +In some cases kernel allocators will return a buffer larger than that requested +by the consumer; the unused space at the end is referred to as a red zone and is +always marked as invalid. +.Fa code +allows the caller to specify an identifier used when marking a buffer as invalid. +The identifier is included in any reports generated by +.Nm +and helps identify the source of the invalid access. +For instance, when an item is freed to a +.Xr uma 9 +zone, the item is marked with +.Dv KASAN_UMA_FREED . +See +.In sys/asan.h +for the available identifiers. +If the entire buffer is to be marked valid, i.e., +.Fa size +and +.Fa redzsize +are equal, +.Fa code +should be 0. +.Sh SEE ALSO +.Xr malloc 9 , +.Xr memguard 9 , +.Xr redzone 9 , +.Xr uma 9 +.Sh HISTORY +.Nm +first appeared in +.Fx 14.0 . +.Sh BUGS +Accesses to kernel memory outside of the kernel map are ignored by the +.Nm +runtime. +When +.Nm +is configured, the kernel memory allocators are configured to use the kernel +map, but some uses of the direct map remain. +For example, on amd64, accesses to page table pages are not tracked. +.Pp +Some kernel memory allocators explicitly permit accesses after an object has +been freed. +These cannot be sanitized by +.Nm . +For example, memory from all +.Xr uma 9 +zones initialized with the +.Dv UMA_ZONE_NOFREE +flag are not sanitized. diff --git a/sys/conf/files b/sys/conf/files index a5f23ca09774..282a86d74347 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3900,6 +3900,8 @@ kern/stack_protector.c standard \ compile-with "${NORMAL_C:N-fstack-protector*}" kern/subr_acl_nfs4.c optional ufs_acl | zfs kern/subr_acl_posix1e.c optional ufs_acl +kern/subr_asan.c optional kasan \ + compile-with "${NORMAL_C:N-fsanitize*}" kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_boot.c standard diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c new file mode 100644 index 000000000000..842370ad1e63 --- /dev/null +++ b/sys/kern/subr_asan.c @@ -0,0 +1,1091 @@ +/* $NetBSD: subr_asan.c,v 1.26 2020/09/10 14:10:46 maxv Exp $ */ + +/* + * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net + * All rights reserved. + * + * This code is part of the KASAN subsystem of the NetBSD kernel. + * + * 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 ``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 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. + */ + +#define SAN_RUNTIME + +#include +__FBSDID("$FreeBSD$"); +#if 0 +__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.26 2020/09/10 14:10:46 maxv Exp $"); +#endif + +#include +#include +#include +#include +#include +#include + +#include + +/* ASAN constants. Part of the compiler ABI. */ +#define KASAN_SHADOW_MASK (KASAN_SHADOW_SCALE - 1) +#define KASAN_ALLOCA_SCALE_SIZE 32 + +/* ASAN ABI version. */ +#if defined(__clang__) && (__clang_major__ - 0 >= 6) +#define ASAN_ABI_VERSION 8 +#elif __GNUC_PREREQ__(7, 1) && !defined(__clang__) +#define ASAN_ABI_VERSION 8 +#elif __GNUC_PREREQ__(6, 1) && !defined(__clang__) +#define ASAN_ABI_VERSION 6 +#else +#error "Unsupported compiler version" +#endif + +#define __RET_ADDR (unsigned long)__builtin_return_address(0) + +/* Global variable descriptor. Part of the compiler ABI. */ +struct __asan_global_source_location { + const char *filename; + int line_no; + int column_no; +}; + +struct __asan_global { + const void *beg; /* address of the global variable */ + size_t size; /* size of the global variable */ + size_t size_with_redzone; /* size with the redzone */ + const void *name; /* name of the variable */ + const void *module_name; /* name of the module where the var is declared */ + unsigned long has_dynamic_init; /* the var has dyn initializer (c++) */ + struct __asan_global_source_location *location; +#if ASAN_ABI_VERSION >= 7 + uintptr_t odr_indicator; /* the address of the ODR indicator symbol */ +#endif +}; + +FEATURE(kasan, "Kernel address sanitizer"); + +static SYSCTL_NODE(_debug, OID_AUTO, kasan, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "KASAN options"); + +static int panic_on_violation = 1; +SYSCTL_INT(_debug_kasan, OID_AUTO, panic_on_violation, CTLFLAG_RDTUN, + &panic_on_violation, 0, + "Panic if an invalid access is detected"); + +static bool kasan_enabled __read_mostly = false; + +/* -------------------------------------------------------------------------- */ + +void +kasan_shadow_map(void *addr, size_t size) +{ + size_t sz, npages, i; + vm_offset_t sva, eva; + + KASSERT((vm_offset_t)addr % KASAN_SHADOW_SCALE == 0, + ("%s: invalid address %p", __func__, addr)); + + sz = roundup(size, KASAN_SHADOW_SCALE) / KASAN_SHADOW_SCALE; + + sva = kasan_md_addr_to_shad((vm_offset_t)addr); + eva = kasan_md_addr_to_shad((vm_offset_t)addr) + sz; + + sva = rounddown(sva, PAGE_SIZE); + eva = roundup(eva, PAGE_SIZE); + + npages = (eva - sva) / PAGE_SIZE; + + KASSERT(sva >= KASAN_MIN_ADDRESS && eva < KASAN_MAX_ADDRESS, + ("%s: invalid address range %#lx-%#lx", __func__, sva, eva)); + + for (i = 0; i < npages; i++) + pmap_kasan_enter(sva + ptoa(i)); +} + +void +kasan_init(void) +{ + int disabled; + + disabled = 0; + TUNABLE_INT_FETCH("debug.kasan.disabled", &disabled); + if (disabled) + return; + + /* MD initialization. */ + kasan_md_init(); + + /* Now officially enabled. */ + kasan_enabled = true; +} + +static inline const char * +kasan_code_name(uint8_t code) +{ + switch (code) { + case KASAN_GENERIC_REDZONE: + return "GenericRedZone"; + case KASAN_MALLOC_REDZONE: + return "MallocRedZone"; + case KASAN_KMEM_REDZONE: + return "KmemRedZone"; + case KASAN_UMA_FREED: + return "UMAUseAfterFree"; + case KASAN_KSTACK_FREED: + return "KernelStack"; + case 1 ... 7: + return "RedZonePartial"; + case KASAN_STACK_LEFT: + return "StackLeft"; + case KASAN_STACK_MID: + return "StackMiddle"; + case KASAN_STACK_RIGHT: + return "StackRight"; + case KASAN_USE_AFTER_RET: + return "UseAfterRet"; + case KASAN_USE_AFTER_SCOPE: + return "UseAfterScope"; + default: + return "Unknown"; + } +} + +#define REPORT(f, ...) do { \ + if (panic_on_violation) { \ + panic(f, __VA_ARGS__); \ + } else { \ + struct stack st; \ + \ + stack_save(&st); \ + printf(f "\n", __VA_ARGS__); \ + stack_print_ddb(&st); \ + } \ +} while (0) + +static void +kasan_report(unsigned long addr, size_t size, bool write, unsigned long pc, + uint8_t code) +{ + REPORT("ASan: Invalid access, %zu-byte %s at %#lx, %s(%x)", + size, (write ? "write" : "read"), addr, kasan_code_name(code), + code); +} + +static __always_inline void +kasan_shadow_1byte_markvalid(unsigned long addr) +{ + int8_t *byte = (int8_t *)kasan_md_addr_to_shad(addr); + int8_t last = (addr & KASAN_SHADOW_MASK) + 1; + + *byte = last; +} + +static __always_inline void +kasan_shadow_Nbyte_markvalid(const void *addr, size_t size) +{ + size_t i; + + for (i = 0; i < size; i++) { + kasan_shadow_1byte_markvalid((unsigned long)addr + i); + } +} + +static __always_inline void +kasan_shadow_Nbyte_fill(const void *addr, size_t size, uint8_t code) +{ + void *shad; + + if (__predict_false(size == 0)) + return; + if (__predict_false(kasan_md_unsupported((vm_offset_t)addr))) + return; + + KASSERT((vm_offset_t)addr % KASAN_SHADOW_SCALE == 0, + ("%s: invalid address %p", __func__, addr)); + KASSERT(size % KASAN_SHADOW_SCALE == 0, + ("%s: invalid size %zu", __func__, size)); + + shad = (void *)kasan_md_addr_to_shad((uintptr_t)addr); + size = size >> KASAN_SHADOW_SCALE_SHIFT; + + __builtin_memset(shad, code, size); +} + +/* + * In an area of size 'sz_with_redz', mark the 'size' first bytes as valid, + * and the rest as invalid. There are generally two use cases: + * + * o kasan_mark(addr, origsize, size, code), with origsize < size. This marks + * the redzone at the end of the buffer as invalid. If the entire is to be + * marked invalid, origsize will be 0. + * + * o kasan_mark(addr, size, size, 0). This marks the entire buffer as valid. + */ +void +kasan_mark(const void *addr, size_t size, size_t redzsize, uint8_t code) +{ + size_t i, n, redz; + int8_t *shad; + + if ((vm_offset_t)addr >= DMAP_MIN_ADDRESS && + (vm_offset_t)addr < DMAP_MAX_ADDRESS) + return; + + KASSERT((vm_offset_t)addr >= VM_MIN_KERNEL_ADDRESS && + (vm_offset_t)addr < VM_MAX_KERNEL_ADDRESS, + ("%s: invalid address %p", __func__, addr)); + KASSERT((vm_offset_t)addr % KASAN_SHADOW_SCALE == 0, + ("%s: invalid address %p", __func__, addr)); + redz = redzsize - roundup(size, KASAN_SHADOW_SCALE); + KASSERT(redz % KASAN_SHADOW_SCALE == 0, + ("%s: invalid size %zu", __func__, redz)); + shad = (int8_t *)kasan_md_addr_to_shad((uintptr_t)addr); + + /* Chunks of 8 bytes, valid. */ + n = size / KASAN_SHADOW_SCALE; + for (i = 0; i < n; i++) { + *shad++ = 0; + } + + /* Possibly one chunk, mid. */ + if ((size & KASAN_SHADOW_MASK) != 0) { + *shad++ = (size & KASAN_SHADOW_MASK); + } + + /* Chunks of 8 bytes, invalid. */ + n = redz / KASAN_SHADOW_SCALE; + for (i = 0; i < n; i++) { + *shad++ = code; + } +} + +/* -------------------------------------------------------------------------- */ + +#define ADDR_CROSSES_SCALE_BOUNDARY(addr, size) \ + (addr >> KASAN_SHADOW_SCALE_SHIFT) != \ + ((addr + size - 1) >> KASAN_SHADOW_SCALE_SHIFT) + +static __always_inline bool +kasan_shadow_1byte_isvalid(unsigned long addr, uint8_t *code) +{ + int8_t *byte = (int8_t *)kasan_md_addr_to_shad(addr); + int8_t last = (addr & KASAN_SHADOW_MASK) + 1; + + if (__predict_true(*byte == 0 || last <= *byte)) { + return (true); + } + *code = *byte; + return (false); +} + +static __always_inline bool +kasan_shadow_2byte_isvalid(unsigned long addr, uint8_t *code) +{ + int8_t *byte, last; + + if (ADDR_CROSSES_SCALE_BOUNDARY(addr, 2)) { + return (kasan_shadow_1byte_isvalid(addr, code) && + kasan_shadow_1byte_isvalid(addr+1, code)); + } + + byte = (int8_t *)kasan_md_addr_to_shad(addr); + last = ((addr + 1) & KASAN_SHADOW_MASK) + 1; + + if (__predict_true(*byte == 0 || last <= *byte)) { + return (true); + } + *code = *byte; + return (false); +} + +static __always_inline bool +kasan_shadow_4byte_isvalid(unsigned long addr, uint8_t *code) +{ + int8_t *byte, last; + + if (ADDR_CROSSES_SCALE_BOUNDARY(addr, 4)) { + return (kasan_shadow_2byte_isvalid(addr, code) && + kasan_shadow_2byte_isvalid(addr+2, code)); + } + + byte = (int8_t *)kasan_md_addr_to_shad(addr); + last = ((addr + 3) & KASAN_SHADOW_MASK) + 1; + + if (__predict_true(*byte == 0 || last <= *byte)) { + return (true); + } + *code = *byte; + return (false); +} + +static __always_inline bool +kasan_shadow_8byte_isvalid(unsigned long addr, uint8_t *code) +{ + int8_t *byte, last; + + if (ADDR_CROSSES_SCALE_BOUNDARY(addr, 8)) { + return (kasan_shadow_4byte_isvalid(addr, code) && + kasan_shadow_4byte_isvalid(addr+4, code)); + } + + byte = (int8_t *)kasan_md_addr_to_shad(addr); + last = ((addr + 7) & KASAN_SHADOW_MASK) + 1; + + if (__predict_true(*byte == 0 || last <= *byte)) { + return (true); + } + *code = *byte; + return (false); +} + +static __always_inline bool +kasan_shadow_Nbyte_isvalid(unsigned long addr, size_t size, uint8_t *code) +{ + size_t i; + + for (i = 0; i < size; i++) { + if (!kasan_shadow_1byte_isvalid(addr+i, code)) + return (false); + } + + return (true); +} + +static __always_inline void +kasan_shadow_check(unsigned long addr, size_t size, bool write, + unsigned long retaddr) +{ + uint8_t code; + bool valid; + + if (__predict_false(!kasan_enabled)) + return; + if (__predict_false(size == 0)) + return; + if (__predict_false(kasan_md_unsupported(addr))) + return; + if (__predict_false(panicstr != NULL)) + return; + + if (__builtin_constant_p(size)) { + switch (size) { + case 1: + valid = kasan_shadow_1byte_isvalid(addr, &code); + break; + case 2: + valid = kasan_shadow_2byte_isvalid(addr, &code); + break; + case 4: + valid = kasan_shadow_4byte_isvalid(addr, &code); + break; + case 8: + valid = kasan_shadow_8byte_isvalid(addr, &code); + break; + default: + valid = kasan_shadow_Nbyte_isvalid(addr, size, &code); + break; + } + } else { + valid = kasan_shadow_Nbyte_isvalid(addr, size, &code); + } + + if (__predict_false(!valid)) { + kasan_report(addr, size, write, retaddr, code); + } +} + +/* -------------------------------------------------------------------------- */ + +void * +kasan_memcpy(void *dst, const void *src, size_t len) +{ + kasan_shadow_check((unsigned long)src, len, false, __RET_ADDR); + kasan_shadow_check((unsigned long)dst, len, true, __RET_ADDR); + return (__builtin_memcpy(dst, src, len)); +} + +int +kasan_memcmp(const void *b1, const void *b2, size_t len) +{ + kasan_shadow_check((unsigned long)b1, len, false, __RET_ADDR); + kasan_shadow_check((unsigned long)b2, len, false, __RET_ADDR); + return (__builtin_memcmp(b1, b2, len)); +} + +void * +kasan_memset(void *b, int c, size_t len) +{ + kasan_shadow_check((unsigned long)b, len, true, __RET_ADDR); + return (__builtin_memset(b, c, len)); +} + +void * +kasan_memmove(void *dst, const void *src, size_t len) +{ + kasan_shadow_check((unsigned long)src, len, false, __RET_ADDR); + kasan_shadow_check((unsigned long)dst, len, true, __RET_ADDR); + return (__builtin_memmove(dst, src, len)); +} + +size_t +kasan_strlen(const char *str) +{ + const char *s; + + s = str; + while (1) { + kasan_shadow_check((unsigned long)s, 1, false, __RET_ADDR); + if (*s == '\0') + break; + s++; + } + + return (s - str); +} + +char * +kasan_strcpy(char *dst, const char *src) +{ + char *save = dst; + + while (1) { + kasan_shadow_check((unsigned long)src, 1, false, __RET_ADDR); + kasan_shadow_check((unsigned long)dst, 1, true, __RET_ADDR); + *dst = *src; + if (*src == '\0') + break; + src++, dst++; + } + + return save; +} + +int +kasan_strcmp(const char *s1, const char *s2) +{ + while (1) { + kasan_shadow_check((unsigned long)s1, 1, false, __RET_ADDR); + kasan_shadow_check((unsigned long)s2, 1, false, __RET_ADDR); + if (*s1 != *s2) + break; + if (*s1 == '\0') + return 0; + s1++, s2++; + } + + return (*(const unsigned char *)s1 - *(const unsigned char *)s2); +} + +int +kasan_copyin(const void *uaddr, void *kaddr, size_t len) +{ + kasan_shadow_check((unsigned long)kaddr, len, true, __RET_ADDR); + return (copyin(uaddr, kaddr, len)); +} + +int +kasan_copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) +{ + kasan_shadow_check((unsigned long)kaddr, len, true, __RET_ADDR); + return (copyinstr(uaddr, kaddr, len, done)); +} + +int +kasan_copyout(const void *kaddr, void *uaddr, size_t len) +{ + kasan_shadow_check((unsigned long)kaddr, len, false, __RET_ADDR); + return (copyout(kaddr, uaddr, len)); +} + +/* -------------------------------------------------------------------------- */ + +#include +#define ATOMIC_SAN_PREFIX kasan +#include + +#define _ASAN_ATOMIC_FUNC_ADD(name, type) \ + void kasan_atomic_add_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + atomic_add_##name(ptr, val); \ + } + +#define ASAN_ATOMIC_FUNC_ADD(name, type) \ + _ASAN_ATOMIC_FUNC_ADD(name, type) \ + _ASAN_ATOMIC_FUNC_ADD(acq_##name, type) \ + _ASAN_ATOMIC_FUNC_ADD(rel_##name, type) + +#define _ASAN_ATOMIC_FUNC_SUBTRACT(name, type) \ + void kasan_atomic_subtract_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + atomic_subtract_##name(ptr, val); \ + } + +#define ASAN_ATOMIC_FUNC_SUBTRACT(name, type) \ + _ASAN_ATOMIC_FUNC_SUBTRACT(name, type) \ + _ASAN_ATOMIC_FUNC_SUBTRACT(acq_##name, type) \ + _ASAN_ATOMIC_FUNC_SUBTRACT(rel_##name, type) + +#define _ASAN_ATOMIC_FUNC_SET(name, type) \ + void kasan_atomic_set_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + atomic_set_##name(ptr, val); \ + } + +#define ASAN_ATOMIC_FUNC_SET(name, type) \ + _ASAN_ATOMIC_FUNC_SET(name, type) \ + _ASAN_ATOMIC_FUNC_SET(acq_##name, type) \ + _ASAN_ATOMIC_FUNC_SET(rel_##name, type) + +#define _ASAN_ATOMIC_FUNC_CLEAR(name, type) \ + void kasan_atomic_clear_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + atomic_clear_##name(ptr, val); \ + } + +#define ASAN_ATOMIC_FUNC_CLEAR(name, type) \ + _ASAN_ATOMIC_FUNC_CLEAR(name, type) \ + _ASAN_ATOMIC_FUNC_CLEAR(acq_##name, type) \ + _ASAN_ATOMIC_FUNC_CLEAR(rel_##name, type) + +#define ASAN_ATOMIC_FUNC_FETCHADD(name, type) \ + type kasan_atomic_fetchadd_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_fetchadd_##name(ptr, val)); \ + } + +#define ASAN_ATOMIC_FUNC_READANDCLEAR(name, type) \ + type kasan_atomic_readandclear_##name(volatile type *ptr) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_readandclear_##name(ptr)); \ + } + +#define ASAN_ATOMIC_FUNC_TESTANDCLEAR(name, type) \ + int kasan_atomic_testandclear_##name(volatile type *ptr, u_int v) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_testandclear_##name(ptr, v)); \ + } + +#define ASAN_ATOMIC_FUNC_TESTANDSET(name, type) \ + int kasan_atomic_testandset_##name(volatile type *ptr, u_int v) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_testandset_##name(ptr, v)); \ + } + +#define ASAN_ATOMIC_FUNC_SWAP(name, type) \ + type kasan_atomic_swap_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_swap_##name(ptr, val)); \ + } + +#define _ASAN_ATOMIC_FUNC_CMPSET(name, type) \ + int kasan_atomic_cmpset_##name(volatile type *ptr, type oval, \ + type nval) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_cmpset_##name(ptr, oval, nval)); \ + } + +#define ASAN_ATOMIC_FUNC_CMPSET(name, type) \ + _ASAN_ATOMIC_FUNC_CMPSET(name, type) \ + _ASAN_ATOMIC_FUNC_CMPSET(acq_##name, type) \ + _ASAN_ATOMIC_FUNC_CMPSET(rel_##name, type) + +#define _ASAN_ATOMIC_FUNC_FCMPSET(name, type) \ + int kasan_atomic_fcmpset_##name(volatile type *ptr, type *oval, \ + type nval) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_fcmpset_##name(ptr, oval, nval)); \ + } + +#define ASAN_ATOMIC_FUNC_FCMPSET(name, type) \ + _ASAN_ATOMIC_FUNC_FCMPSET(name, type) \ + _ASAN_ATOMIC_FUNC_FCMPSET(acq_##name, type) \ + _ASAN_ATOMIC_FUNC_FCMPSET(rel_##name, type) + +#define ASAN_ATOMIC_FUNC_THREAD_FENCE(name) \ + void kasan_atomic_thread_fence_##name(void) \ + { \ + atomic_thread_fence_##name(); \ + } + +#define _ASAN_ATOMIC_FUNC_LOAD(name, type) \ + type kasan_atomic_load_##name(volatile type *ptr) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + return (atomic_load_##name(ptr)); \ + } + +#define ASAN_ATOMIC_FUNC_LOAD(name, type) \ + _ASAN_ATOMIC_FUNC_LOAD(name, type) \ + _ASAN_ATOMIC_FUNC_LOAD(acq_##name, type) + +#define _ASAN_ATOMIC_FUNC_STORE(name, type) \ + void kasan_atomic_store_##name(volatile type *ptr, type val) \ + { \ + kasan_shadow_check((uintptr_t)ptr, sizeof(type), true, \ + __RET_ADDR); \ + atomic_store_##name(ptr, val); \ + } + +#define ASAN_ATOMIC_FUNC_STORE(name, type) \ + _ASAN_ATOMIC_FUNC_STORE(name, type) \ + _ASAN_ATOMIC_FUNC_STORE(rel_##name, type) + +ASAN_ATOMIC_FUNC_ADD(8, uint8_t); +ASAN_ATOMIC_FUNC_ADD(16, uint16_t); +ASAN_ATOMIC_FUNC_ADD(32, uint32_t); +ASAN_ATOMIC_FUNC_ADD(64, uint64_t); +ASAN_ATOMIC_FUNC_ADD(int, u_int); +ASAN_ATOMIC_FUNC_ADD(long, u_long); +ASAN_ATOMIC_FUNC_ADD(ptr, uintptr_t); + +ASAN_ATOMIC_FUNC_SUBTRACT(8, uint8_t); +ASAN_ATOMIC_FUNC_SUBTRACT(16, uint16_t); +ASAN_ATOMIC_FUNC_SUBTRACT(32, uint32_t); +ASAN_ATOMIC_FUNC_SUBTRACT(64, uint64_t); +ASAN_ATOMIC_FUNC_SUBTRACT(int, u_int); +ASAN_ATOMIC_FUNC_SUBTRACT(long, u_long); +ASAN_ATOMIC_FUNC_SUBTRACT(ptr, uintptr_t); + +ASAN_ATOMIC_FUNC_SET(8, uint8_t); +ASAN_ATOMIC_FUNC_SET(16, uint16_t); +ASAN_ATOMIC_FUNC_SET(32, uint32_t); +ASAN_ATOMIC_FUNC_SET(64, uint64_t); +ASAN_ATOMIC_FUNC_SET(int, u_int); +ASAN_ATOMIC_FUNC_SET(long, u_long); +ASAN_ATOMIC_FUNC_SET(ptr, uintptr_t); + +ASAN_ATOMIC_FUNC_CLEAR(8, uint8_t); +ASAN_ATOMIC_FUNC_CLEAR(16, uint16_t); +ASAN_ATOMIC_FUNC_CLEAR(32, uint32_t); +ASAN_ATOMIC_FUNC_CLEAR(64, uint64_t); +ASAN_ATOMIC_FUNC_CLEAR(int, u_int); +ASAN_ATOMIC_FUNC_CLEAR(long, u_long); +ASAN_ATOMIC_FUNC_CLEAR(ptr, uintptr_t); + +ASAN_ATOMIC_FUNC_FETCHADD(32, uint32_t); +ASAN_ATOMIC_FUNC_FETCHADD(64, uint64_t); +ASAN_ATOMIC_FUNC_FETCHADD(int, u_int); +ASAN_ATOMIC_FUNC_FETCHADD(long, u_long); + +ASAN_ATOMIC_FUNC_READANDCLEAR(32, uint32_t); +ASAN_ATOMIC_FUNC_READANDCLEAR(64, uint64_t); *** 451 LINES SKIPPED *** From nobody Mon Nov 1 14:32:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06387182D5B3; Mon, 1 Nov 2021 14:32: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 4Hjb9P3DT3z3s12; Mon, 1 Nov 2021 14:32: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 0BBD0134A0; Mon, 1 Nov 2021 14:32: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 1A1EWuUM021268; Mon, 1 Nov 2021 14:32:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EWueM021267; Mon, 1 Nov 2021 14:32:56 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:32:56 GMT Message-Id: <202111011432.1A1EWueM021267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a3d4c8e21d64 - stable/13 - amd64: Implement a KASAN shadow map List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3d4c8e21d645bc8022af53232c12e236285de25 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a3d4c8e21d645bc8022af53232c12e236285de25 commit a3d4c8e21d645bc8022af53232c12e236285de25 Author: Mark Johnston AuthorDate: 2021-04-13 20:30:05 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 13:57:30 +0000 amd64: Implement a KASAN shadow map The idea behind KASAN is to use a region of memory to track the validity of buffers in the kernel map. This region is the shadow map. The compiler inserts calls to the KASAN runtime for every emitted load and store, and the runtime uses the shadow map to decide whether the access is valid. Various kernel allocators call kasan_mark() to update the shadow map. Since the shadow map tracks only accesses to the kernel map, accesses to other kernel maps are not validated by KASAN. UMA_MD_SMALL_ALLOC is disabled when KASAN is configured to reduce usage of the direct map. Currently we have no mechanism to completely eliminate uses of the direct map, so KASAN's coverage is not comprehensive. The shadow map uses one byte per eight bytes in the kernel map. In pmap_bootstrap() we create an initial set of page tables for the kernel and preloaded data. When pmap_growkernel() is called, we call kasan_shadow_map() to extend the shadow map. kasan_shadow_map() uses pmap_kasan_enter() to allocate memory for the shadow region and map it. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29417 (cherry picked from commit 6faf45b34b14da5f138774b43ec14fb5567ac584) --- sys/amd64/amd64/pmap.c | 140 +++++++++++++++++++++++++++++++++++++++++++- sys/amd64/include/asan.h | 71 ++++++++++++++++++++++ sys/amd64/include/pmap.h | 15 ++++- sys/amd64/include/vmparam.h | 8 ++- sys/kern/kern_malloc.c | 10 ++++ sys/kern/vfs_bio.c | 10 ++++ 6 files changed, 251 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 43ed0f7b7411..62bc1bb22e96 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$"); #include "opt_vm.h" #include +#include #include #include #include @@ -154,6 +155,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -425,6 +427,10 @@ u_int64_t KPML4phys; /* phys addr of kernel level 4 */ u_int64_t KPML5phys; /* phys addr of kernel level 5, if supported */ +#ifdef KASAN +static uint64_t KASANPDPphys; +#endif + static pml4_entry_t *kernel_pml4; static u_int64_t DMPDphys; /* phys addr of direct mapped level 2 */ static u_int64_t DMPDPphys; /* phys addr of direct mapped level 3 */ @@ -1631,6 +1637,12 @@ create_pagetables(vm_paddr_t *firstaddr) pml4_entry_t *p4_p; uint64_t DMPDkernphys; vm_paddr_t pax; +#ifdef KASAN + pt_entry_t *pt_p; + uint64_t KASANPDphys, KASANPTphys, KASANphys; + vm_offset_t kasankernbase; + int kasankpdpi, kasankpdi, nkasanpte; +#endif int i, j, ndm1g, nkpdpe, nkdmpde; /* Allocate page table pages for the direct map */ @@ -1673,6 +1685,10 @@ create_pagetables(vm_paddr_t *firstaddr) /* Allocate pages */ KPML4phys = allocpages(firstaddr, 1); KPDPphys = allocpages(firstaddr, NKPML4E); +#ifdef KASAN + KASANPDPphys = allocpages(firstaddr, NKASANPML4E); + KASANPDphys = allocpages(firstaddr, 1); +#endif /* * Allocate the initial number of kernel page table pages required to @@ -1690,6 +1706,12 @@ create_pagetables(vm_paddr_t *firstaddr) KPTphys = allocpages(firstaddr, nkpt); KPDphys = allocpages(firstaddr, nkpdpe); +#ifdef KASAN + nkasanpte = howmany(nkpt, KASAN_SHADOW_SCALE); + KASANPTphys = allocpages(firstaddr, nkasanpte); + KASANphys = allocpages(firstaddr, nkasanpte * NPTEPG); +#endif + /* * Connect the zero-filled PT pages to their PD entries. This * implicitly maps the PT pages at their correct locations within @@ -1726,6 +1748,25 @@ create_pagetables(vm_paddr_t *firstaddr) for (i = 0; i < nkpdpe; i++) pdp_p[i + KPDPI] = (KPDphys + ptoa(i)) | X86_PG_RW | X86_PG_V; +#ifdef KASAN + kasankernbase = kasan_md_addr_to_shad(KERNBASE); + kasankpdpi = pmap_pdpe_index(kasankernbase); + kasankpdi = pmap_pde_index(kasankernbase); + + pdp_p = (pdp_entry_t *)KASANPDPphys; + pdp_p[kasankpdpi] = (KASANPDphys | X86_PG_RW | X86_PG_V | pg_nx); + + pd_p = (pd_entry_t *)KASANPDphys; + for (i = 0; i < nkasanpte; i++) + pd_p[i + kasankpdi] = (KASANPTphys + ptoa(i)) | X86_PG_RW | + X86_PG_V | pg_nx; + + pt_p = (pt_entry_t *)KASANPTphys; + for (i = 0; i < nkasanpte * NPTEPG; i++) + pt_p[i] = (KASANphys + ptoa(i)) | X86_PG_RW | X86_PG_V | + X86_PG_M | X86_PG_A | pg_nx; +#endif + /* * Now, set up the direct map region using 2MB and/or 1GB pages. If * the end of physical memory is not aligned to a 1GB page boundary, @@ -1777,7 +1818,15 @@ create_pagetables(vm_paddr_t *firstaddr) p4_p[PML4PML4I] = KPML4phys; p4_p[PML4PML4I] |= X86_PG_RW | X86_PG_V | pg_nx; - /* Connect the Direct Map slot(s) up to the PML4. */ +#ifdef KASAN + /* Connect the KASAN shadow map slots up to the PML4. */ + for (i = 0; i < NKASANPML4E; i++) { + p4_p[KASANPML4I + i] = KASANPDPphys + ptoa(i); + p4_p[KASANPML4I + i] |= X86_PG_RW | X86_PG_V | pg_nx; + } +#endif + + /* Connect the Direct Map slots up to the PML4. */ for (i = 0; i < ndmpdpphys; i++) { p4_p[DMPML4I + i] = DMPDPphys + ptoa(i); p4_p[DMPML4I + i] |= X86_PG_RW | X86_PG_V | pg_nx; @@ -4132,6 +4181,12 @@ pmap_pinit_pml4(vm_page_t pml4pg) pm_pml4[KPML4BASE + i] = (KPDPphys + ptoa(i)) | X86_PG_RW | X86_PG_V; } +#ifdef KASAN + for (i = 0; i < NKASANPML4E; i++) { + pm_pml4[KASANPML4I + i] = (KASANPDPphys + ptoa(i)) | X86_PG_RW | + X86_PG_V | pg_nx; + } +#endif for (i = 0; i < ndmpdpphys; i++) { pm_pml4[DMPML4I + i] = (DMPDPphys + ptoa(i)) | X86_PG_RW | X86_PG_V; @@ -4715,6 +4770,10 @@ pmap_release(pmap_t pmap) } else { for (i = 0; i < NKPML4E; i++) /* KVA */ pmap->pm_pmltop[KPML4BASE + i] = 0; +#ifdef KASAN + for (i = 0; i < NKASANPML4E; i++) /* KASAN shadow map */ + pmap->pm_pmltop[KASANPML4I + i] = 0; +#endif for (i = 0; i < ndmpdpphys; i++)/* Direct Map */ pmap->pm_pmltop[DMPML4I + i] = 0; pmap->pm_pmltop[PML4PML4I] = 0; /* Recursive Mapping */ @@ -4832,6 +4891,8 @@ pmap_growkernel(vm_offset_t addr) addr = roundup2(addr, NBPDR); if (addr - 1 >= vm_map_max(kernel_map)) addr = vm_map_max(kernel_map); + if (kernel_vm_end < addr) + kasan_shadow_map((void *)kernel_vm_end, addr - kernel_vm_end); while (kernel_vm_end < addr) { pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end); if ((*pdpe & X86_PG_V) == 0) { @@ -11227,6 +11288,78 @@ pmap_pkru_clear(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) return (error); } +#ifdef KASAN +static vm_page_t +pmap_kasan_enter_alloc_4k(void) +{ + vm_page_t m; + + m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED | VM_ALLOC_ZERO); + if (m == NULL) + panic("%s: no memory to grow shadow map", __func__); + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + return (m); +} + +static vm_page_t +pmap_kasan_enter_alloc_2m(void) +{ + vm_page_t m; + + m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT); + if (m != NULL) + memset((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), 0, NBPDR); + return (m); +} + +/* + * Grow the shadow map by at least one 4KB page at the specified address. Use + * 2MB pages when possible. + */ +void +pmap_kasan_enter(vm_offset_t va) +{ + pdp_entry_t *pdpe; + pd_entry_t *pde; + pt_entry_t *pte; + vm_page_t m; + + mtx_assert(&kernel_map->system_mtx, MA_OWNED); + + pdpe = pmap_pdpe(kernel_pmap, va); + if ((*pdpe & X86_PG_V) == 0) { + m = pmap_kasan_enter_alloc_4k(); + *pdpe = (pdp_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | + X86_PG_V | pg_nx); + } + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & X86_PG_V) == 0) { + m = pmap_kasan_enter_alloc_2m(); + if (m != NULL) { + *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | + X86_PG_PS | X86_PG_V | pg_nx); + } else { + m = pmap_kasan_enter_alloc_4k(); + *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | + X86_PG_V | pg_nx); + } + } + if ((*pde & X86_PG_PS) != 0) + return; + pte = pmap_pde_to_pte(pde, va); + if ((*pte & X86_PG_V) != 0) + return; + KASSERT((*pte & X86_PG_V) == 0, + ("%s: shadow address %#lx is already mapped", __func__, va)); + m = pmap_kasan_enter_alloc_4k(); + *pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | + X86_PG_M | X86_PG_A | pg_nx); +} +#endif + /* * Track a range of the kernel's virtual address space that is contiguous * in various mapping attributes. @@ -11404,6 +11537,11 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS) case DMPML4I: sbuf_printf(sb, "\nDirect map:\n"); break; +#ifdef KASAN + case KASANPML4I: + sbuf_printf(sb, "\nKASAN shadow map:\n"); + break; +#endif case KPML4BASE: sbuf_printf(sb, "\nKernel map:\n"); break; diff --git a/sys/amd64/include/asan.h b/sys/amd64/include/asan.h new file mode 100644 index 000000000000..03d57673d05e --- /dev/null +++ b/sys/amd64/include/asan.h @@ -0,0 +1,71 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Mark Johnston under sponsorship from the + * FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, 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 _MACHINE_ASAN_H_ +#define _MACHINE_ASAN_H_ + +#ifdef KASAN + +#include +#include +#include +#include + +static inline vm_offset_t +kasan_md_addr_to_shad(vm_offset_t addr) +{ + return (((addr - VM_MIN_KERNEL_ADDRESS) >> KASAN_SHADOW_SCALE_SHIFT) + + KASAN_MIN_ADDRESS); +} + +static inline bool +kasan_md_unsupported(vm_offset_t addr) +{ + vm_offset_t kernmin; + + /* + * The vm_page array is mapped at the beginning of the kernel map, but + * accesses to the array are not validated for now. Handle the fact + * that KASAN must validate accesses before the vm_page array is + * initialized. + */ + kernmin = vm_page_array == NULL ? VM_MIN_KERNEL_ADDRESS : + (vm_offset_t)(vm_page_array + vm_page_array_size); + return (addr < kernmin || addr >= VM_MAX_KERNEL_ADDRESS); +} + +static inline void +kasan_md_init(void) +{ +} + +#endif /* KASAN */ + +#endif /* !_MACHINE_ASAN_H_ */ diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 0ac91d17792a..c5c1714f2f94 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -195,6 +195,12 @@ */ #define NKPML4E 4 +/* + * Number of PML4 slots for the KASAN shadow map. It requires 1 byte of memory + * for every 8 bytes of the kernel address space. + */ +#define NKASANPML4E ((NKPML4E + 7) / 8) + /* * We use the same numbering of the page table pages for 5-level and * 4-level paging structures. @@ -243,9 +249,11 @@ #define KPML4I (NPML4EPG-1) #define KPDPI (NPDPEPG-2) /* kernbase at -2GB */ +#define KASANPML4I (DMPML4I - NKASANPML4E) /* Below the direct map */ + /* Large map: index of the first and max last pml4 entry */ #define LMSPML4I (PML4PML4I + 1) -#define LMEPML4I (DMPML4I - 1) +#define LMEPML4I (KASANPML4I - 1) /* * XXX doesn't really belong here I guess... @@ -509,6 +517,11 @@ void pmap_thread_init_invl_gen(struct thread *td); int pmap_vmspace_copy(pmap_t dst_pmap, pmap_t src_pmap); void pmap_page_array_startup(long count); vm_page_t pmap_page_alloc_below_4g(bool zeroed); + +#ifdef KASAN +void pmap_kasan_enter(vm_offset_t); +#endif + #endif /* _KERNEL */ /* Return various clipped indexes for a given VA */ diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index b6f79ef8ca84..88fd29b80be3 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -75,7 +75,9 @@ * of the direct mapped segment. This uses 2MB pages for reduced * TLB pressure. */ +#ifndef KASAN #define UMA_MD_SMALL_ALLOC +#endif /* * The physical address space is densely populated. @@ -167,7 +169,8 @@ * 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot) * 0xffff804020100fff - 0xffff807fffffffff unused * 0xffff808000000000 - 0xffff847fffffffff large map (can be tuned up) - * 0xffff848000000000 - 0xfffff7ffffffffff unused (large map extends there) + * 0xffff848000000000 - 0xfffff77fffffffff unused (large map extends there) + * 0xfffff78000000000 - 0xfffff7ffffffffff 512GB KASAN shadow map * 0xfffff80000000000 - 0xfffffbffffffffff 4TB direct map * 0xfffffc0000000000 - 0xfffffdffffffffff unused * 0xfffffe0000000000 - 0xffffffffffffffff 2TB kernel map @@ -185,6 +188,9 @@ #define DMAP_MIN_ADDRESS KV4ADDR(DMPML4I, 0, 0, 0) #define DMAP_MAX_ADDRESS KV4ADDR(DMPML4I + NDMPML4E, 0, 0, 0) +#define KASAN_MIN_ADDRESS KV4ADDR(KASANPML4I, 0, 0, 0) +#define KASAN_MAX_ADDRESS KV4ADDR(KASANPML4I + NKASANPML4E, 0, 0, 0) + #define LARGEMAP_MIN_ADDRESS KV4ADDR(LMSPML4I, 0, 0, 0) #define LARGEMAP_MAX_ADDRESS KV4ADDR(LMEPML4I + 1, 0, 0, 0) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 0fc4fcbc0539..8f371d35f066 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1160,6 +1160,16 @@ kmeminit(void) vm_kmem_size = 2 * mem_size * PAGE_SIZE; vm_kmem_size = round_page(vm_kmem_size); + +#ifdef KASAN + /* + * With KASAN enabled, dynamically allocated kernel memory is shadowed. + * Account for this when setting the UMA limit. + */ + vm_kmem_size = (vm_kmem_size * KASAN_SHADOW_SCALE) / + (KASAN_SHADOW_SCALE + 1); +#endif + #ifdef DEBUG_MEMGUARD tmp = memguard_fudge(vm_kmem_size, kernel_map); #else diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 74dc2feb9ea6..d610f391de98 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1043,6 +1044,15 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) int tuned_nbuf; long maxbuf, maxbuf_sz, buf_sz, biotmap_sz; +#ifdef KASAN + /* + * With KASAN enabled, the kernel map is shadowed. Account for this + * when sizing maps based on the amount of physical memory available. + */ + physmem_est = (physmem_est * KASAN_SHADOW_SCALE) / + (KASAN_SHADOW_SCALE + 1); +#endif + /* * physmem_est is in pages. Convert it to kilobytes (assumes * PAGE_SIZE is >= 1K) From nobody Mon Nov 1 14:32:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C9BB2182D5C0; Mon, 1 Nov 2021 14:32: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 4Hjb9Q3KKVz3sDR; Mon, 1 Nov 2021 14:32: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 27606134A1; Mon, 1 Nov 2021 14:32: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 1A1EWwYr021292; Mon, 1 Nov 2021 14:32:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EWwg0021291; Mon, 1 Nov 2021 14:32:58 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:32:58 GMT Message-Id: <202111011432.1A1EWwg0021291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 65f3c07b9899 - stable/13 - amd64: Add MD bits for KASAN List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 65f3c07b989942897fbc8991ad3887ab4e1440a2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=65f3c07b989942897fbc8991ad3887ab4e1440a2 commit 65f3c07b989942897fbc8991ad3887ab4e1440a2 Author: Mark Johnston AuthorDate: 2021-04-13 21:39:35 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:02:41 +0000 amd64: Add MD bits for KASAN - Initialize KASAN before executing SYSINITs. - Add a GENERIC-KASAN kernel config, akin to GENERIC-KCSAN. - Increase the kernel stack size if KASAN is enabled. Some of the ASAN instrumentation increases stack usage and it's enough to trigger stack overflows in ZFS. - Mark the trapframe as valid in interrupt handlers if it is assigned to td_intr_frame. Otherwise, an interrupt in a function which creates a poisoned alloca region can trigger false positives. Sponsored by: The FreeBSD Foundation (cherry picked from commit f115c0612131d8f939f6f357f57bdd85bd6a59de) --- sys/amd64/amd64/machdep.c | 3 +++ sys/amd64/conf/GENERIC-KASAN | 7 +++++++ sys/amd64/include/param.h | 4 ++++ sys/x86/isa/atpic.c | 4 ++++ sys/x86/x86/local_apic.c | 7 +++++++ 5 files changed, 25 insertions(+) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 512fee0de7df..0e2e0e9db9e8 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1605,6 +1606,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) #endif thread0.td_critnest = 0; + kasan_init(); + TSEXIT(); /* Location of kernel stack for locore */ diff --git a/sys/amd64/conf/GENERIC-KASAN b/sys/amd64/conf/GENERIC-KASAN new file mode 100644 index 000000000000..8d5703141e86 --- /dev/null +++ b/sys/amd64/conf/GENERIC-KASAN @@ -0,0 +1,7 @@ +# $FreeBSD$ + +include GENERIC + +ident GENERIC-KASAN + +options KASAN diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 93ee524e1de2..cf1d2bd0a586 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -134,8 +134,12 @@ #define IOPERM_BITMAP_SIZE (IOPAGES * PAGE_SIZE + 1) #ifndef KSTACK_PAGES +#ifdef KASAN +#define KSTACK_PAGES 6 +#else #define KSTACK_PAGES 4 /* pages of kstack (with pcb) */ #endif +#endif #define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ /* diff --git a/sys/x86/isa/atpic.c b/sys/x86/isa/atpic.c index 07d63b041d0b..28c10ee7009f 100644 --- a/sys/x86/isa/atpic.c +++ b/sys/x86/isa/atpic.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -522,6 +523,9 @@ atpic_handle_intr(u_int vector, struct trapframe *frame) { struct intsrc *isrc; + /* The frame may have been written into a poisoned region. */ + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); + KASSERT(vector < NUM_ISA_IRQS, ("unknown int %u\n", vector)); isrc = &atintrs[vector].at_intsrc; diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index ab19a6c7bc69..715ae7734e29 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1299,6 +1300,9 @@ lapic_handle_intr(int vector, struct trapframe *frame) { struct intsrc *isrc; + /* The frame may have been written into a poisoned region. */ + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); + isrc = intr_lookup_source(apic_idt_to_irq(PCPU_GET(apic_id), vector)); intr_execute_handlers(isrc, frame); @@ -1314,6 +1318,9 @@ lapic_handle_timer(struct trapframe *frame) /* Send EOI first thing. */ lapic_eoi(); + /* The frame may have been written into a poisoned region. */ + kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0); + #if defined(SMP) && !defined(SCHED_ULE) /* * Don't do any accounting for the disabled HTT cores, since it From nobody Mon Nov 1 14:32:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 68C26182D476; Mon, 1 Nov 2021 14:33: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 4Hjb9R3ktSz3s5Z; Mon, 1 Nov 2021 14:32: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 4AE74130FF; Mon, 1 Nov 2021 14:32: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 1A1EWxmu021316; Mon, 1 Nov 2021 14:32:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EWxNW021315; Mon, 1 Nov 2021 14:32:59 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:32:59 GMT Message-Id: <202111011432.1A1EWxNW021315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 82f3e32c3958 - stable/13 - uma: Add KASAN state transitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82f3e32c3958c1fc6e6ab1d7a4440a9be128f205 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=82f3e32c3958c1fc6e6ab1d7a4440a9be128f205 commit 82f3e32c3958c1fc6e6ab1d7a4440a9be128f205 Author: Mark Johnston AuthorDate: 2021-04-13 21:39:50 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:02:54 +0000 uma: Add KASAN state transitions - Add a UMA_ZONE_NOKASAN flag to indicate that items from a particular zone should not be sanitized. This is applied implicitly for NOFREE and cache zones. - Add KASAN call backs which get invoked: 1) when a slab is imported into a keg 2) when an item is allocated from a zone 3) when an item is freed to a zone 4) when a slab is freed back to the VM In state transitions 1 and 3, memory is poisoned so that accesses will trigger a panic. In state transitions 2 and 4, memory is marked valid. - Disable trashing if KASAN is enabled. It just adds extra CPU overhead to catch problems that are detected by KASAN. Sponsored by: The FreeBSD Foundation (cherry picked from commit 09c8cb717d214d03e51b3e4f8e9997b9f4e1624d) --- sys/vm/uma.h | 7 ++- sys/vm/uma_core.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 144 insertions(+), 21 deletions(-) diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 6407a4f50fb8..5d473ba909b6 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -276,6 +276,11 @@ uma_zone_t uma_zcache_create(const char *name, int size, uma_ctor ctor, * * See sys/smr.h for more details. */ +#define UMA_ZONE_NOKASAN 0x80000 /* + * Disable KASAN verification. This is + * implied by NOFREE. Cache zones are + * not verified by default. + */ /* In use by UMA_ZFLAGs: 0xffe00000 */ /* @@ -286,7 +291,7 @@ uma_zone_t uma_zcache_create(const char *name, int size, uma_ctor ctor, #define UMA_ZONE_INHERIT \ (UMA_ZONE_NOTOUCH | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \ UMA_ZONE_VM | UMA_ZONE_NOTPAGE | UMA_ZONE_PCPU | \ - UMA_ZONE_FIRSTTOUCH | UMA_ZONE_ROUNDROBIN) + UMA_ZONE_FIRSTTOUCH | UMA_ZONE_ROUNDROBIN | UMA_ZONE_NOKASAN) /* Definitions for align */ #define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 5dfcd0c860e9..1398796ee2e7 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -323,6 +324,7 @@ static void bucket_zone_drain(int domain); static uma_bucket_t zone_alloc_bucket(uma_zone_t, void *, int, int); static void *slab_alloc_item(uma_keg_t keg, uma_slab_t slab); static void slab_free_item(uma_zone_t zone, uma_slab_t slab, void *item); +static size_t slab_sizeof(int nitems); static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, int align, uint32_t flags); static int zone_import(void *, void **, int, int, int); @@ -537,6 +539,94 @@ bucket_zone_drain(int domain) domain); } +#ifdef KASAN +static void +kasan_mark_item_valid(uma_zone_t zone, void *item) +{ + void *pcpu_item; + size_t sz, rsz; + int i; + + if ((zone->uz_flags & UMA_ZONE_NOKASAN) != 0) + return; + + sz = zone->uz_size; + rsz = roundup2(sz, KASAN_SHADOW_SCALE); + if ((zone->uz_flags & UMA_ZONE_PCPU) == 0) { + kasan_mark(item, sz, rsz, 0); + } 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); + } +} + +static void +kasan_mark_item_invalid(uma_zone_t zone, void *item) +{ + void *pcpu_item; + size_t sz; + int i; + + if ((zone->uz_flags & UMA_ZONE_NOKASAN) != 0) + return; + + sz = roundup2(zone->uz_size, KASAN_SHADOW_SCALE); + if ((zone->uz_flags & UMA_ZONE_PCPU) == 0) { + kasan_mark(item, 0, sz, KASAN_UMA_FREED); + } 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); + } +} + +static void +kasan_mark_slab_valid(uma_keg_t keg, void *mem) +{ + size_t sz; + + if ((keg->uk_flags & UMA_ZONE_NOKASAN) == 0) { + sz = keg->uk_ppera * PAGE_SIZE; + kasan_mark(mem, sz, sz, 0); + } +} + +static void +kasan_mark_slab_invalid(uma_keg_t keg, void *mem) +{ + size_t sz; + + if ((keg->uk_flags & UMA_ZONE_NOKASAN) == 0) { + if ((keg->uk_flags & UMA_ZFLAG_OFFPAGE) != 0) + sz = keg->uk_ppera * PAGE_SIZE; + else + sz = keg->uk_pgoff; + kasan_mark(mem, 0, sz, KASAN_UMA_FREED); + } +} +#else /* !KASAN */ +static void +kasan_mark_item_valid(uma_zone_t zone __unused, void *item __unused) +{ +} + +static void +kasan_mark_item_invalid(uma_zone_t zone __unused, void *item __unused) +{ +} + +static void +kasan_mark_slab_valid(uma_keg_t keg __unused, void *mem __unused) +{ +} + +static void +kasan_mark_slab_invalid(uma_keg_t keg __unused, void *mem __unused) +{ +} +#endif /* KASAN */ + /* * Acquire the domain lock and record contention. */ @@ -1205,8 +1295,11 @@ bucket_drain(uma_zone_t zone, uma_bucket_t bucket) zone->uz_size, NULL, SKIP_NONE); } if (zone->uz_fini) - for (i = 0; i < bucket->ub_cnt; i++) + for (i = 0; i < bucket->ub_cnt; i++) { + kasan_mark_item_valid(zone, bucket->ub_bucket[i]); zone->uz_fini(bucket->ub_bucket[i], zone->uz_size); + kasan_mark_item_invalid(zone, bucket->ub_bucket[i]); + } zone->uz_release(zone->uz_arg, bucket->ub_bucket, bucket->ub_cnt); if (zone->uz_max_items > 0) zone_free_limit(zone, bucket->ub_cnt); @@ -1437,6 +1530,7 @@ static void keg_free_slab(uma_keg_t keg, uma_slab_t slab, int start) { uint8_t *mem; + size_t size; int i; uint8_t flags; @@ -1444,10 +1538,11 @@ keg_free_slab(uma_keg_t keg, uma_slab_t slab, int start) keg->uk_name, keg, slab, PAGE_SIZE * keg->uk_ppera); mem = slab_data(slab, keg); - flags = slab->us_flags; - i = start; + size = PAGE_SIZE * keg->uk_ppera; + + kasan_mark_slab_valid(keg, mem); if (keg->uk_fini != NULL) { - for (i--; i > -1; i--) + for (i = start - 1; i > -1; i--) #ifdef INVARIANTS /* * trash_fini implies that dtor was trash_dtor. trash_fini @@ -1462,11 +1557,13 @@ keg_free_slab(uma_keg_t keg, uma_slab_t slab, int start) #endif keg->uk_fini(slab_item(slab, keg, i), keg->uk_size); } - if (keg->uk_flags & UMA_ZFLAG_OFFPAGE) + flags = slab->us_flags; + if (keg->uk_flags & UMA_ZFLAG_OFFPAGE) { zone_free_item(slabzone(keg->uk_ipers), slab_tohashslab(slab), NULL, SKIP_NONE); - keg->uk_freef(mem, PAGE_SIZE * keg->uk_ppera, flags); - uma_total_dec(PAGE_SIZE * keg->uk_ppera); + } + keg->uk_freef(mem, size, flags); + uma_total_dec(size); } static void @@ -1612,7 +1709,6 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, int aflags) { uma_domain_t dom; - uma_alloc allocf; uma_slab_t slab; unsigned long size; uint8_t *mem; @@ -1622,7 +1718,6 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, KASSERT(domain >= 0 && domain < vm_ndomains, ("keg_alloc_slab: domain %d out of range", domain)); - allocf = keg->uk_allocf; slab = NULL; mem = NULL; if (keg->uk_flags & UMA_ZFLAG_OFFPAGE) { @@ -1651,7 +1746,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, /* zone is passed for legacy reasons. */ size = keg->uk_ppera * PAGE_SIZE; - mem = allocf(zone, size, domain, &sflags, aflags); + mem = keg->uk_allocf(zone, size, domain, &sflags, aflags); if (mem == NULL) { if (keg->uk_flags & UMA_ZFLAG_OFFPAGE) zone_free_item(slabzone(keg->uk_ipers), @@ -1666,7 +1761,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, /* Point the slab into the allocated memory */ if (!(keg->uk_flags & UMA_ZFLAG_OFFPAGE)) - slab = (uma_slab_t )(mem + keg->uk_pgoff); + slab = (uma_slab_t)(mem + keg->uk_pgoff); else slab_tohashslab(slab)->uhs_data = mem; @@ -1694,6 +1789,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, goto fail; } } + kasan_mark_slab_invalid(keg, mem); KEG_LOCK(keg, domain); CTR3(KTR_UMA, "keg_alloc_slab: allocated slab %p for %s(%p)", @@ -2693,9 +2789,12 @@ zone_ctor(void *mem, int size, void *udata, int flags) STAILQ_INIT(&zdom->uzd_buckets); } -#ifdef INVARIANTS +#if defined(INVARIANTS) && !defined(KASAN) if (arg->uminit == trash_init && arg->fini == trash_fini) zone->uz_flags |= UMA_ZFLAG_TRASH | UMA_ZFLAG_CTORDTOR; +#elif defined(KASAN) + if ((arg->flags & (UMA_ZONE_NOFREE | UMA_ZFLAG_CACHE)) != 0) + arg->flags |= UMA_ZONE_NOKASAN; #endif /* @@ -3118,7 +3217,7 @@ uma_zcreate(const char *name, size_t size, uma_ctor ctor, uma_dtor dtor, args.dtor = dtor; args.uminit = uminit; args.fini = fini; -#ifdef INVARIANTS +#if defined(INVARIANTS) && !defined(KASAN) /* * Inject procedures which check for memory use after free if we are * allowed to scramble the memory while it is not allocated. This @@ -3275,12 +3374,17 @@ item_ctor(uma_zone_t zone, int uz_flags, int size, void *udata, int flags, { #ifdef INVARIANTS bool skipdbg; +#endif + + kasan_mark_item_valid(zone, item); +#ifdef INVARIANTS skipdbg = uma_dbg_zskip(zone, item); - if (!skipdbg && (zone->uz_flags & UMA_ZFLAG_TRASH) != 0 && + if (!skipdbg && (uz_flags & UMA_ZFLAG_TRASH) != 0 && zone->uz_ctor != trash_ctor) trash_ctor(item, size, udata, flags); #endif + /* Check flags before loading ctor pointer. */ if (__predict_false((uz_flags & UMA_ZFLAG_CTORDTOR) != 0) && __predict_false(zone->uz_ctor != NULL) && @@ -3323,6 +3427,7 @@ item_dtor(uma_zone_t zone, void *item, int size, void *udata, trash_dtor(item, size, udata); #endif } + kasan_mark_item_invalid(zone, item); } #ifdef NUMA @@ -4044,7 +4149,7 @@ static uma_bucket_t zone_alloc_bucket(uma_zone_t zone, void *udata, int domain, int flags) { uma_bucket_t bucket; - int maxbucket, cnt; + int error, maxbucket, cnt; CTR3(KTR_UMA, "zone_alloc_bucket zone %s(%p) domain %d", zone->uz_name, zone, domain); @@ -4079,10 +4184,15 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int domain, int flags) if (bucket->ub_cnt != 0 && zone->uz_init != NULL) { int i; - for (i = 0; i < bucket->ub_cnt; i++) - if (zone->uz_init(bucket->ub_bucket[i], zone->uz_size, - flags) != 0) + for (i = 0; i < bucket->ub_cnt; i++) { + kasan_mark_item_valid(zone, bucket->ub_bucket[i]); + error = zone->uz_init(bucket->ub_bucket[i], + zone->uz_size, flags); + kasan_mark_item_invalid(zone, bucket->ub_bucket[i]); + if (error != 0) break; + } + /* * If we couldn't initialize the whole bucket, put the * rest back onto the freelist. @@ -4149,7 +4259,12 @@ zone_alloc_item(uma_zone_t zone, void *udata, int domain, int flags) * to be both zone-init'd as well as zone-ctor'd. */ if (zone->uz_init != NULL) { - if (zone->uz_init(item, zone->uz_size, flags) != 0) { + int error; + + kasan_mark_item_valid(zone, item); + error = zone->uz_init(item, zone->uz_size, flags); + kasan_mark_item_invalid(zone, item); + if (error != 0) { zone_free_item(zone, item, udata, SKIP_FINI | SKIP_CNT); goto fail_cnt; } @@ -4631,8 +4746,11 @@ zone_free_item(uma_zone_t zone, void *item, void *udata, enum zfreeskip skip) item_dtor(zone, item, zone->uz_size, udata, skip); - if (skip < SKIP_FINI && zone->uz_fini) + if (skip < SKIP_FINI && zone->uz_fini) { + kasan_mark_item_valid(zone, item); zone->uz_fini(item, zone->uz_size); + kasan_mark_item_invalid(zone, item); + } zone->uz_release(zone->uz_arg, &item, 1); From nobody Mon Nov 1 14:33:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 72316182DBBD; Mon, 1 Nov 2021 14:33: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 4Hjb9d18Sdz3sFH; Mon, 1 Nov 2021 14: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 065B513615; Mon, 1 Nov 2021 14:33: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 1A1EX5VC021493; Mon, 1 Nov 2021 14:33:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX5Si021492; Mon, 1 Nov 2021 14:33:05 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:05 GMT Message-Id: <202111011433.1A1EX5Si021492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 28c338b34263 - stable/13 - realloc: Fix KASAN(9) shadow map updates List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 28c338b3426330b5c9668651e4e91b2dfafde6cf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=28c338b3426330b5c9668651e4e91b2dfafde6cf commit 28c338b3426330b5c9668651e4e91b2dfafde6cf Author: Mark Johnston AuthorDate: 2021-05-05 21:05:46 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:05:22 +0000 realloc: Fix KASAN(9) shadow map updates When copying from the old buffer to the new buffer, we don't know the requested size of the old allocation, but only the size of the allocation provided by UMA. This value is "alloc". Because the copy may access bytes in the old allocation's red zone, we must mark the full allocation valid in the shadow map. Do so using the correct size. Reported by: kp Tested by: kp Sponsored by: The FreeBSD Foundation (cherry picked from commit 9a7c2de36460cdb916734a6969aac666707a639b) --- sys/kern/kern_malloc.c | 2 +- sys/vm/uma_core.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 6adb16c95528..3061cb91568f 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1033,7 +1033,7 @@ realloc(void *addr, size_t size, struct malloc_type *mtp, int flags) * Copy over original contents. For KASAN, the redzone must be marked * valid before performing the copy. */ - kasan_mark(addr, size, size, 0); + kasan_mark(addr, alloc, alloc, 0); bcopy(addr, newaddr, min(size, alloc)); free(addr, mtp); return (newaddr); diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 1398796ee2e7..e3c7e2cc81e9 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -540,6 +540,9 @@ bucket_zone_drain(int domain) } #ifdef KASAN +_Static_assert(UMA_SMALLEST_UNIT % KASAN_SHADOW_SCALE == 0, + "Base UMA allocation size not a multiple of the KASAN scale factor"); + static void kasan_mark_item_valid(uma_zone_t zone, void *item) { From nobody Mon Nov 1 14:33:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3D0AE182DD15; Mon, 1 Nov 2021 14:33: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 4Hjb9f0V2Cz3sCM; Mon, 1 Nov 2021 14:33: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 14A5F13681; Mon, 1 Nov 2021 14:33: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 1A1EX7DS021521; Mon, 1 Nov 2021 14:33:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX7Tm021520; Mon, 1 Nov 2021 14:33:07 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:07 GMT Message-Id: <202111011433.1A1EX7Tm021520@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1d990fe59832 - stable/13 - linker_set: Disable ASAN only in userspace List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d990fe598320a80222467fb725a0cedfc19dbf4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1d990fe598320a80222467fb725a0cedfc19dbf4 commit 1d990fe598320a80222467fb725a0cedfc19dbf4 Author: Mark Johnston AuthorDate: 2021-05-07 18:24:37 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:05:39 +0000 linker_set: Disable ASAN only in userspace KASAN does not insert redzones around global variables and so is not susceptible to the problem that led to us disabling ASAN for linker set elements in the first place (see commit fe3d8086fb6f). Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30126 (cherry picked from commit 2d499d505262c9c965fc5f4fd36afdd2bb7cad3d) --- sys/sys/linker_set.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index f957858ada04..7c12ae215018 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -59,12 +59,23 @@ * Private macros, not to be used outside this header file. */ #ifdef __GNUCLIKE___SECTION + +/* + * The userspace address sanitizer inserts redzones around global variables, + * violating the assumption that linker set elements are packed. + */ +#ifdef _KERNEL +#define __NOASAN +#else +#define __NOASAN __nosanitizeaddress +#endif + #define __MAKE_SET_QV(set, sym, qv) \ __WEAK(__CONCAT(__start_set_,set)); \ __WEAK(__CONCAT(__stop_set_,set)); \ static void const * qv \ + __NOASAN \ __set_##set##_sym_##sym __section("set_" #set) \ - __nosanitizeaddress \ __used = &(sym) #define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) #else /* !__GNUCLIKE___SECTION */ From nobody Mon Nov 1 14:33:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AE66182D8A9; Mon, 1 Nov 2021 14:33: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 4Hjb9V3V1Mz3s1J; Mon, 1 Nov 2021 14:33: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 5FEEA13612; Mon, 1 Nov 2021 14:33: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 1A1EX06M021361; Mon, 1 Nov 2021 14:33:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX0Ux021359; Mon, 1 Nov 2021 14:33:00 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:00 GMT Message-Id: <202111011433.1A1EX0Ux021359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9d95539ffed2 - stable/13 - kstack: Add KASAN state transitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9d95539ffed299a8457c7c718a1fe039d6f595bd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9d95539ffed299a8457c7c718a1fe039d6f595bd commit 9d95539ffed299a8457c7c718a1fe039d6f595bd Author: Mark Johnston AuthorDate: 2021-04-13 21:39:55 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:03:02 +0000 kstack: Add KASAN state transitions We allocate kernel stacks using a UMA cache zone. Cache zones have KASAN disabled by default, but in this case it makes sense to enable it. Reviewed by: andrew (cherry picked from commit 244f3ec642ed99a371c97b946b93b877d8be1756) --- sys/vm/vm_glue.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index be741fd40199..7cfb08246f9e 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -86,7 +87,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -351,6 +351,7 @@ vm_thread_stack_dispose(vm_offset_t ks, int pages) vm_page_free(m); } VM_OBJECT_WUNLOCK(kstack_object); + kasan_mark((void *)ks, ptoa(pages), ptoa(pages), 0); kva_free(ks - (KSTACK_GUARD_PAGES * PAGE_SIZE), (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE); } @@ -385,6 +386,7 @@ vm_thread_new(struct thread *td, int pages) return (0); td->td_kstack = ks; td->td_kstack_pages = pages; + kasan_mark((void *)ks, ptoa(pages), ptoa(pages), 0); return (1); } @@ -401,6 +403,7 @@ vm_thread_dispose(struct thread *td) ks = td->td_kstack; td->td_kstack = 0; td->td_kstack_pages = 0; + kasan_mark((void *)ks, 0, ptoa(pages), KASAN_KSTACK_FREED); if (pages == kstack_pages) uma_zfree(kstack_cache, (void *)ks); else From nobody Mon Nov 1 14:33:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8611F182D6EE; Mon, 1 Nov 2021 14:33: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 4Hjb9X5J94z3sBt; Mon, 1 Nov 2021 14:33: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 96E62134A2; Mon, 1 Nov 2021 14:33: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 1A1EX2lR021419; Mon, 1 Nov 2021 14:33:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX2hV021418; Mon, 1 Nov 2021 14:33:02 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:02 GMT Message-Id: <202111011433.1A1EX2hV021418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 75306778f149 - stable/13 - vfs: Add KASAN state transitions for vnodes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 75306778f149e281f03ab9de7b3e1dc185e05c3e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=75306778f149e281f03ab9de7b3e1dc185e05c3e commit 75306778f149e281f03ab9de7b3e1dc185e05c3e Author: Mark Johnston AuthorDate: 2021-04-13 21:40:11 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:03:19 +0000 vfs: Add KASAN state transitions for vnodes vnodes are a bit special in that they may exist on per-CPU lists even while free. Add a KASAN-only destructor that poisons regions of each vnode that are not expected to be accessed after a free. Sponsored by: The FreeBSD Foundation (cherry picked from commit b261bb4057f4abbc1366e4af8e9e4081d039be4a) --- sys/kern/vfs_subr.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 76e01d1f7816..da2f90a44d86 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -511,6 +512,54 @@ vn_free_marker(struct vnode *vp) free(vp, M_VNODE_MARKER); } +#ifdef KASAN +static int +vnode_ctor(void *mem, int size, void *arg __unused, int flags __unused) +{ + kasan_mark(mem, size, roundup2(size, UMA_ALIGN_PTR + 1), 0); + return (0); +} + +static void +vnode_dtor(void *mem, int size, void *arg __unused) +{ + size_t end1, end2, off1, off2; + + _Static_assert(offsetof(struct vnode, v_vnodelist) < + offsetof(struct vnode, v_dbatchcpu), + "KASAN marks require updating"); + + off1 = offsetof(struct vnode, v_vnodelist); + off2 = offsetof(struct vnode, v_dbatchcpu); + end1 = off1 + sizeof(((struct vnode *)NULL)->v_vnodelist); + end2 = off2 + sizeof(((struct vnode *)NULL)->v_dbatchcpu); + + /* + * Access to the v_vnodelist and v_dbatchcpu fields are permitted even + * after the vnode has been freed. Try to get some KASAN coverage by + * marking everything except those two fields as invalid. Because + * KASAN's tracking is not byte-granular, any preceding fields sharing + * the same 8-byte aligned word must also be marked valid. + */ + + /* Handle the area from the start until v_vnodelist... */ + off1 = rounddown2(off1, KASAN_SHADOW_SCALE); + kasan_mark(mem, off1, off1, KASAN_UMA_FREED); + + /* ... then the area between v_vnodelist and v_dbatchcpu ... */ + off1 = roundup2(end1, KASAN_SHADOW_SCALE); + off2 = rounddown2(off2, KASAN_SHADOW_SCALE); + if (off2 > off1) + kasan_mark((void *)((char *)mem + off1), off2 - off1, + off2 - off1, KASAN_UMA_FREED); + + /* ... and finally the area from v_dbatchcpu to the end. */ + off2 = roundup2(end2, KASAN_SHADOW_SCALE); + kasan_mark((void *)((char *)mem + off2), size - off2, size - off2, + KASAN_UMA_FREED); +} +#endif /* KASAN */ + /* * Initialize a vnode as it first enters the zone. */ @@ -576,6 +625,8 @@ vnode_fini(void *mem, int size) mtx_destroy(&vp->v_interlock); bo = &vp->v_bufobj; rw_destroy(BO_LOCKPTR(bo)); + + kasan_mark(mem, size, size, 0); } /* @@ -603,6 +654,8 @@ static void vntblinit(void *dummy __unused) { struct vdbatch *vd; + uma_ctor ctor; + uma_dtor dtor; int cpu, physvnodes, virtvnodes; u_int i; @@ -642,9 +695,18 @@ vntblinit(void *dummy __unused) TAILQ_INSERT_HEAD(&vnode_list, vnode_list_free_marker, v_vnodelist); vnode_list_reclaim_marker = vn_alloc_marker(NULL); TAILQ_INSERT_HEAD(&vnode_list, vnode_list_reclaim_marker, v_vnodelist); - vnode_zone = uma_zcreate("VNODE", sizeof (struct vnode), NULL, NULL, - vnode_init, vnode_fini, UMA_ALIGN_PTR, 0); + +#ifdef KASAN + ctor = vnode_ctor; + dtor = vnode_dtor; +#else + ctor = NULL; + dtor = NULL; +#endif + vnode_zone = uma_zcreate("VNODE", sizeof(struct vnode), ctor, dtor, + vnode_init, vnode_fini, UMA_ALIGN_PTR, UMA_ZONE_NOKASAN); uma_zone_set_smr(vnode_zone, vfs_smr); + /* * Preallocate enough nodes to support one-per buf so that * we can not fail an insert. reassignbuf() callers can not From nobody Mon Nov 1 14:33:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 50F4B182DA05; Mon, 1 Nov 2021 14:33: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 4Hjb9X1f1Cz3sDv; Mon, 1 Nov 2021 14:33: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 81E0A13613; Mon, 1 Nov 2021 14:33: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 1A1EX13x021386; Mon, 1 Nov 2021 14:33:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX1nE021385; Mon, 1 Nov 2021 14:33:01 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:01 GMT Message-Id: <202111011433.1A1EX1nE021385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ed66f9c61b0f - stable/13 - kmem: Add KASAN state transitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ed66f9c61b0f91194164702bf0919c12c0354344 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ed66f9c61b0f91194164702bf0919c12c0354344 commit ed66f9c61b0f91194164702bf0919c12c0354344 Author: Mark Johnston AuthorDate: 2021-04-13 21:40:01 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:03:11 +0000 kmem: Add KASAN state transitions Memory allocated with kmem_* is unmapped upon free, so KASAN doesn't provide a lot of benefit, but since allocations are always a multiple of the page size we can create a redzone when the allocation request size is not a multiple of the page size. Sponsored by: The FreeBSD Foundation (cherry picked from commit 2b914b85ddf4c25d112b2639bbbb7618641872b4) --- sys/vm/vm_kern.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 160821ba3a19..f25784857440 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -71,12 +71,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* for ticks and hz */ +#include #include #include +#include #include -#include #include +#include #include #include #include @@ -215,25 +216,26 @@ kmem_alloc_attr_domain(int domain, vm_size_t size, int flags, vm_paddr_t low, vm_object_t object; vm_offset_t addr, i, offset; vm_page_t m; + vm_size_t asize; int pflags; vm_prot_t prot; object = kernel_object; - size = round_page(size); + asize = round_page(size); vmem = vm_dom[domain].vmd_kernel_arena; - if (vmem_alloc(vmem, size, M_BESTFIT | flags, &addr)) + if (vmem_alloc(vmem, asize, M_BESTFIT | flags, &addr)) return (0); offset = addr - VM_MIN_KERNEL_ADDRESS; pflags = malloc2vm_flags(flags) | VM_ALLOC_WIRED; prot = (flags & M_EXEC) != 0 ? VM_PROT_ALL : VM_PROT_RW; VM_OBJECT_WLOCK(object); - for (i = 0; i < size; i += PAGE_SIZE) { + for (i = 0; i < asize; i += PAGE_SIZE) { m = kmem_alloc_contig_pages(object, atop(offset + i), domain, pflags, 1, low, high, PAGE_SIZE, 0, memattr); if (m == NULL) { VM_OBJECT_WUNLOCK(object); kmem_unback(object, addr, i); - vmem_free(vmem, addr, size); + vmem_free(vmem, addr, asize); return (0); } KASSERT(vm_page_domain(m) == domain, @@ -246,6 +248,7 @@ kmem_alloc_attr_domain(int domain, vm_size_t size, int flags, vm_paddr_t low, prot | PMAP_ENTER_WIRED, 0); } VM_OBJECT_WUNLOCK(object); + kasan_mark((void *)addr, size, asize, KASAN_KMEM_REDZONE); return (addr); } @@ -294,23 +297,24 @@ kmem_alloc_contig_domain(int domain, vm_size_t size, int flags, vm_paddr_t low, vm_object_t object; vm_offset_t addr, offset, tmp; vm_page_t end_m, m; + vm_size_t asize; u_long npages; int pflags; object = kernel_object; - size = round_page(size); + asize = round_page(size); vmem = vm_dom[domain].vmd_kernel_arena; - if (vmem_alloc(vmem, size, flags | M_BESTFIT, &addr)) + if (vmem_alloc(vmem, asize, flags | M_BESTFIT, &addr)) return (0); offset = addr - VM_MIN_KERNEL_ADDRESS; pflags = malloc2vm_flags(flags) | VM_ALLOC_WIRED; - npages = atop(size); + npages = atop(asize); VM_OBJECT_WLOCK(object); m = kmem_alloc_contig_pages(object, atop(offset), domain, pflags, npages, low, high, alignment, boundary, memattr); if (m == NULL) { VM_OBJECT_WUNLOCK(object); - vmem_free(vmem, addr, size); + vmem_free(vmem, addr, asize); return (0); } KASSERT(vm_page_domain(m) == domain, @@ -327,6 +331,7 @@ kmem_alloc_contig_domain(int domain, vm_size_t size, int flags, vm_paddr_t low, tmp += PAGE_SIZE; } VM_OBJECT_WUNLOCK(object); + kasan_mark((void *)addr, size, asize, KASAN_KMEM_REDZONE); return (addr); } @@ -402,21 +407,23 @@ kmem_malloc_domain(int domain, vm_size_t size, int flags) { vmem_t *arena; vm_offset_t addr; + vm_size_t asize; int rv; if (__predict_true((flags & M_EXEC) == 0)) arena = vm_dom[domain].vmd_kernel_arena; else arena = vm_dom[domain].vmd_kernel_rwx_arena; - size = round_page(size); - if (vmem_alloc(arena, size, flags | M_BESTFIT, &addr)) + asize = round_page(size); + if (vmem_alloc(arena, asize, flags | M_BESTFIT, &addr)) return (0); - rv = kmem_back_domain(domain, kernel_object, addr, size, flags); + rv = kmem_back_domain(domain, kernel_object, addr, asize, flags); if (rv != KERN_SUCCESS) { - vmem_free(arena, addr, size); + vmem_free(arena, addr, asize); return (0); } + kasan_mark((void *)addr, size, asize, KASAN_KMEM_REDZONE); return (addr); } @@ -608,6 +615,7 @@ kmem_free(vm_offset_t addr, vm_size_t size) struct vmem *arena; size = round_page(size); + kasan_mark((void *)addr, size, size, 0); arena = _kmem_unback(kernel_object, addr, size); if (arena != NULL) vmem_free(arena, addr, size); From nobody Mon Nov 1 14:33:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 84F9E182D9AC; Mon, 1 Nov 2021 14:33: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 4Hjb9Z5y48z3s8H; Mon, 1 Nov 2021 14:33: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 D0CED1341B; Mon, 1 Nov 2021 14:33: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 1A1EX4mR021467; Mon, 1 Nov 2021 14:33:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX4Qr021466; Mon, 1 Nov 2021 14:33:04 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:04 GMT Message-Id: <202111011433.1A1EX4Qr021466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9710b74dd0f4 - stable/13 - malloc: Add state transitions for KASAN List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9710b74dd0f46c58a603c0bee7fad7f5bc71a80f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9710b74dd0f46c58a603c0bee7fad7f5bc71a80f commit 9710b74dd0f46c58a603c0bee7fad7f5bc71a80f Author: Mark Johnston AuthorDate: 2021-04-13 21:40:27 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:03:36 +0000 malloc: Add state transitions for KASAN - Reuse some REDZONE bits to keep track of the requested and allocated sizes, and use that to provide red zones. - As in UMA, disable memory trashing to avoid unnecessary CPU overhead. Sponsored by: The FreeBSD Foundation (cherry picked from commit 06a53ecf24005b3a74b85ecc4b504a401ac26cd0) --- sys/kern/kern_malloc.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 8f371d35f066..6adb16c95528 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -110,7 +111,7 @@ dtrace_malloc_probe_func_t __read_mostly dtrace_malloc_probe; #define MALLOC_DEBUG 1 #endif -#ifdef DEBUG_REDZONE +#if defined(KASAN) || defined(DEBUG_REDZONE) #define DEBUG_REDZONE_ARG_DEF , unsigned long osize #define DEBUG_REDZONE_ARG , osize #else @@ -603,11 +604,12 @@ malloc_large(size_t *size, struct malloc_type *mtp, struct domainset *policy, if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - } + } else { #ifdef DEBUG_REDZONE - if (va != NULL) va = redzone_setup(va, osize); #endif + kasan_mark((void *)va, osize, sz, KASAN_MALLOC_REDZONE); + } return (va); } @@ -633,7 +635,7 @@ void * int indx; caddr_t va; uma_zone_t zone; -#ifdef DEBUG_REDZONE +#if defined(DEBUG_REDZONE) || defined(KASAN) unsigned long osize = size; #endif @@ -664,6 +666,10 @@ void * #ifdef DEBUG_REDZONE if (va != NULL) va = redzone_setup(va, osize); +#endif +#ifdef KASAN + if (va != NULL) + kasan_mark((void *)va, osize, size, KASAN_MALLOC_REDZONE); #endif return ((void *) va); } @@ -699,7 +705,7 @@ malloc_domainset(size_t size, struct malloc_type *mtp, struct domainset *ds, caddr_t va; int domain; int indx; -#ifdef DEBUG_REDZONE +#if defined(KASAN) || defined(DEBUG_REDZONE) unsigned long osize = size; #endif @@ -727,6 +733,10 @@ malloc_domainset(size_t size, struct malloc_type *mtp, struct domainset *ds, #ifdef DEBUG_REDZONE if (va != NULL) va = redzone_setup(va, osize); +#endif +#ifdef KASAN + if (va != NULL) + kasan_mark((void *)va, osize, size, KASAN_MALLOC_REDZONE); #endif return (va); } @@ -745,7 +755,7 @@ void * malloc_domainset_exec(size_t size, struct malloc_type *mtp, struct domainset *ds, int flags) { -#ifdef DEBUG_REDZONE +#if defined(DEBUG_REDZONE) || defined(KASAN) unsigned long osize = size; #endif #ifdef MALLOC_DEBUG @@ -824,7 +834,7 @@ mallocarray_domainset(size_t nmemb, size_t size, struct malloc_type *type, return (malloc_domainset(size * nmemb, type, ds, flags)); } -#ifdef INVARIANTS +#if defined(INVARIANTS) && !defined(KASAN) static void free_save_type(void *addr, struct malloc_type *mtp, u_long size) { @@ -905,7 +915,7 @@ free(void *addr, struct malloc_type *mtp) if (__predict_true(!malloc_large_slab(slab))) { size = zone->uz_size; -#ifdef INVARIANTS +#if defined(INVARIANTS) && !defined(KASAN) free_save_type(addr, mtp, size); #endif uma_zfree_arg(zone, addr, slab); @@ -945,13 +955,15 @@ zfree(void *addr, struct malloc_type *mtp) if (__predict_true(!malloc_large_slab(slab))) { size = zone->uz_size; -#ifdef INVARIANTS +#if defined(INVARIANTS) && !defined(KASAN) free_save_type(addr, mtp, size); #endif + kasan_mark(addr, size, size, 0); explicit_bzero(addr, size); uma_zfree_arg(zone, addr, slab); } else { size = malloc_large_size(slab); + kasan_mark(addr, size, size, 0); explicit_bzero(addr, size); free_large(addr, size); } @@ -1006,16 +1018,22 @@ realloc(void *addr, size_t size, struct malloc_type *mtp, int flags) alloc = malloc_large_size(slab); /* Reuse the original block if appropriate */ - if (size <= alloc - && (size > (alloc >> REALLOC_FRACTION) || alloc == MINALLOCSIZE)) + if (size <= alloc && + (size > (alloc >> REALLOC_FRACTION) || alloc == MINALLOCSIZE)) { + kasan_mark((void *)addr, size, alloc, KASAN_MALLOC_REDZONE); return (addr); + } #endif /* !DEBUG_REDZONE */ /* Allocate a new, bigger (or smaller) block */ if ((newaddr = malloc(size, mtp, flags)) == NULL) return (NULL); - /* Copy over original contents */ + /* + * Copy over original contents. For KASAN, the redzone must be marked + * valid before performing the copy. + */ + kasan_mark(addr, size, size, 0); bcopy(addr, newaddr, min(size, alloc)); free(addr, mtp); return (newaddr); @@ -1216,7 +1234,7 @@ mallocinit(void *dummy) for (subzone = 0; subzone < numzones; subzone++) { kmemzones[indx].kz_zone[subzone] = uma_zcreate(name, size, -#ifdef INVARIANTS +#if defined(INVARIANTS) && !defined(KASAN) mtrash_ctor, mtrash_dtor, mtrash_init, mtrash_fini, #else NULL, NULL, NULL, NULL, From nobody Mon Nov 1 14:33:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B6616182DD2F; Mon, 1 Nov 2021 14:33: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 4Hjb9g4L5tz3sMf; Mon, 1 Nov 2021 14:33: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 3F4361341C; Mon, 1 Nov 2021 14: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 1A1EX8Q8021546; Mon, 1 Nov 2021 14: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 1A1EX8nD021545; Mon, 1 Nov 2021 14:33:08 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:08 GMT Message-Id: <202111011433.1A1EX8nD021545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 38f90212c27f - stable/13 - cdefs: Make __nosanitizeaddress work for KASAN as well List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 38f90212c27fedab0257cd99f075b4860266046a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=38f90212c27fedab0257cd99f075b4860266046a commit 38f90212c27fedab0257cd99f075b4860266046a Author: Mark Johnston AuthorDate: 2021-05-07 18:26:28 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:05:50 +0000 cdefs: Make __nosanitizeaddress work for KASAN as well Add __nosanitizememory while I'm here. Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit cfad8bd24f038e4779e937f48b05511f2dd4a5a8) --- sys/sys/cdefs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 30c462f6549b..dd11f4fb778d 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -859,12 +859,18 @@ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) /* - * Function or variable should not be sanitized, i.e. by AddressSanitizer. + * Function or variable should not be sanitized, e.g., by AddressSanitizer. * GCC has the nosanitize attribute, but as a function attribute only, and * warns on use as a variable attribute. */ #if __has_attribute(no_sanitize) && defined(__clang__) +#ifdef _KERNEL +#define __nosanitizeaddress __attribute__((no_sanitize("kernel-address"))) +#define __nosanitizememory __attribute__((no_sanitize("kernel-memory"))) +#else #define __nosanitizeaddress __attribute__((no_sanitize("address"))) +#define __nosanitizememory __attribute__((no_sanitize("memory"))) +#endif #define __nosanitizethread __attribute__((no_sanitize("thread"))) #else #define __nosanitizeaddress From nobody Mon Nov 1 14:33:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 84825182D947; Mon, 1 Nov 2021 14:33: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 4Hjb9X5lK4z3sM6; Mon, 1 Nov 2021 14:33: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 B7AF9134A3; Mon, 1 Nov 2021 14:33: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 1A1EX3pJ021443; Mon, 1 Nov 2021 14:33:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX3cW021442; Mon, 1 Nov 2021 14:33:03 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:03 GMT Message-Id: <202111011433.1A1EX3cW021442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2748ecec950d - stable/13 - execve: Mark exec argument buffers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2748ecec950de38d50f8a3c4ec917fd489cb4628 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2748ecec950de38d50f8a3c4ec917fd489cb4628 commit 2748ecec950de38d50f8a3c4ec917fd489cb4628 Author: Mark Johnston AuthorDate: 2021-04-13 21:40:19 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:03:28 +0000 execve: Mark exec argument buffers We cache mapped execve argument buffers to avoid the overhead of TLB shootdowns. Mark them invalid when they are freed to the cache. Sponsored by: The FreeBSD Foundation (cherry picked from commit f1c3adefd95d35115bd4597293e0b904ae401245) --- sys/kern/kern_exec.c | 5 +++++ sys/kern/subr_asan.c | 2 ++ sys/sys/asan.h | 1 + 3 files changed, 8 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 2ea0efc4a2cb..eb2d7d9986e2 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1347,6 +1348,8 @@ exec_alloc_args_kva(void **cookie) SLIST_REMOVE_HEAD(&exec_args_kva_freelist, next); mtx_unlock(&exec_args_kva_mtx); } + kasan_mark((void *)argkva->addr, exec_map_entry_size, + exec_map_entry_size, 0); *(struct exec_args_kva **)cookie = argkva; return (argkva->addr); } @@ -1357,6 +1360,8 @@ exec_release_args_kva(struct exec_args_kva *argkva, u_int gen) vm_offset_t base; base = argkva->addr; + kasan_mark((void *)argkva->addr, 0, exec_map_entry_size, + KASAN_EXEC_ARGS_FREED); if (argkva->gen != gen) { (void)vm_map_madvise(exec_map, base, base + exec_map_entry_size, MADV_FREE); diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 842370ad1e63..d0478899e8c7 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -153,6 +153,8 @@ kasan_code_name(uint8_t code) return "UMAUseAfterFree"; case KASAN_KSTACK_FREED: return "KernelStack"; + case KASAN_EXEC_ARGS_FREED: + return "ExecKVA"; case 1 ... 7: return "RedZonePartial"; case KASAN_STACK_LEFT: diff --git a/sys/sys/asan.h b/sys/sys/asan.h index a8e07b765028..c86202222c72 100644 --- a/sys/sys/asan.h +++ b/sys/sys/asan.h @@ -53,6 +53,7 @@ #define KASAN_KMEM_REDZONE 0xFC #define KASAN_UMA_FREED 0xFD #define KASAN_KSTACK_FREED 0xFE +#define KASAN_EXEC_ARGS_FREED 0xFF void kasan_init(void); void kasan_shadow_map(void *, size_t); From nobody Mon Nov 1 14:33:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C2567182DDA6; Mon, 1 Nov 2021 14:33: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 4Hjb9h4j5gz3sPs; Mon, 1 Nov 2021 14:33: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 6203A13701; Mon, 1 Nov 2021 14:33: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 1A1EX9DR021572; Mon, 1 Nov 2021 14:33:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EX9nx021571; Mon, 1 Nov 2021 14:33:09 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:09 GMT Message-Id: <202111011433.1A1EX9nx021571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0dbb46e5fa69 - stable/13 - stack(9): Disable KASAN in stack_capture() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0dbb46e5fa69fe41d871f674b651ba1428345c47 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0dbb46e5fa69fe41d871f674b651ba1428345c47 commit 0dbb46e5fa69fe41d871f674b651ba1428345c47 Author: Mark Johnston AuthorDate: 2021-05-07 18:20:53 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:06:00 +0000 stack(9): Disable KASAN in stack_capture() When unwinding the stack, we may encounter a stack frame in a poisoned region of the stack, triggering a false positive. Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 831850d8b0870c75c21d2e01527af1e55fe2fec8) --- sys/x86/x86/stack_machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/stack_machdep.c b/sys/x86/x86/stack_machdep.c index 6e16fc1669ff..0e4bf1bf2930 100644 --- a/sys/x86/x86/stack_machdep.c +++ b/sys/x86/x86/stack_machdep.c @@ -70,7 +70,7 @@ static struct mtx intr_lock; MTX_SYSINIT(intr_lock, &intr_lock, "stack intr", MTX_DEF); #endif -static void +static void __nosanitizeaddress stack_capture(struct thread *td, struct stack *st, register_t fp) { x86_frame_t frame; From nobody Mon Nov 1 14:33:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7546C182DAFC; Mon, 1 Nov 2021 14:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hjb9j6Dr3z3s8s; Mon, 1 Nov 2021 14:33: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 7F8CD13587; Mon, 1 Nov 2021 14:33: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 1A1EXAWN021605; Mon, 1 Nov 2021 14:33:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXAo6021604; Mon, 1 Nov 2021 14:33:10 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:10 GMT Message-Id: <202111011433.1A1EXAo6021604@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ab77265f883a - stable/13 - amd64: Mark the trapframe as initialized in trap() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ab77265f883ad5ddb71d41432ffa77401608e1b1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ab77265f883ad5ddb71d41432ffa77401608e1b1 commit ab77265f883ad5ddb71d41432ffa77401608e1b1 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:03 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:06:39 +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 (cherry picked from commit f08f0ae5247ab31de58bda0817e74ccc1a3a5e95) --- 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 942c99c4826e..55649687ce50 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 nobody Mon Nov 1 14:33:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 195A9182DF1D; Mon, 1 Nov 2021 14:33: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 4Hjb9l6ymzz3sLC; Mon, 1 Nov 2021 14:33: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 99A7B134A5; Mon, 1 Nov 2021 14:33: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 1A1EXBPg021631; Mon, 1 Nov 2021 14:33:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXBZW021630; Mon, 1 Nov 2021 14:33:11 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:11 GMT Message-Id: <202111011433.1A1EXBZW021630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 7e85d20eb8f1 - stable/13 - hwpmc: Disable KASAN in pmc_save_kernel_callchain() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e85d20eb8f16f8892fda4924a601655220216ca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7e85d20eb8f16f8892fda4924a601655220216ca commit 7e85d20eb8f16f8892fda4924a601655220216ca Author: Mark Johnston AuthorDate: 2021-07-10 00:38:11 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:06:47 +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 (cherry picked from commit 5d243d41b1206044cb5eddd5d48c1c711b731478) --- 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 nobody Mon Nov 1 14:33:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 66D14182DF76; Mon, 1 Nov 2021 14:33: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 4Hjb9r4DB9z3sSm; Mon, 1 Nov 2021 14:33: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 CCB601341D; Mon, 1 Nov 2021 14:33: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 1A1EXDat021695; Mon, 1 Nov 2021 14:33:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXDg0021694; Mon, 1 Nov 2021 14:33:13 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:13 GMT Message-Id: <202111011433.1A1EXDg0021694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: db33d492c807 - stable/13 - uma: Fix a few problems with KASAN integration List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: db33d492c807ff1a83640049b8e569d03a4975ad Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=db33d492c807ff1a83640049b8e569d03a4975ad commit db33d492c807ff1a83640049b8e569d03a4975ad Author: Mark Johnston AuthorDate: 2021-07-10 00:38:21 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:07:04 +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 (cherry picked from commit b0dfc48684780024a3d736c5a5449284dad97f4e) --- 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 e3c7e2cc81e9..b71527b3049f 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 nobody Mon Nov 1 14:33:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 72F8E182E119; Mon, 1 Nov 2021 14:33: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 4Hjb9s56P1z3sSs; Mon, 1 Nov 2021 14:33: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 F115C13702; Mon, 1 Nov 2021 14:33: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 1A1EXEVa021719; Mon, 1 Nov 2021 14:33:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXEKM021718; Mon, 1 Nov 2021 14:33:14 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:14 GMT Message-Id: <202111011433.1A1EXEKM021718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 224a01a34245 - stable/13 - KASAN: Implement __asan_unregister_globals() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 224a01a34245a65ac3a40380d3e88559dc0ac9aa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=224a01a34245a65ac3a40380d3e88559dc0ac9aa commit 224a01a34245a65ac3a40380d3e88559dc0ac9aa Author: Mark Johnston AuthorDate: 2021-07-10 00:38:28 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:07:13 +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 (cherry picked from commit 588c7a06dffbc74b281dacbdd854437b0815e501) --- 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 d0478899e8c7..d3638ffb5dde 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 nobody Mon Nov 1 14:33:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C4D41182DFFE; Mon, 1 Nov 2021 14:33: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 4Hjb9w0FSVz3sT6; Mon, 1 Nov 2021 14:33: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 230CF13703; Mon, 1 Nov 2021 14:33: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 1A1EXG2Z021743; Mon, 1 Nov 2021 14:33:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXGxw021742; Mon, 1 Nov 2021 14:33:16 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:16 GMT Message-Id: <202111011433.1A1EXGxw021742@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: bdfb568f8dfc - stable/13 - redzone: Raise a compile error if KASAN is configured List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bdfb568f8dfc8f1fb22b12cd8281c47bcd388b14 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bdfb568f8dfc8f1fb22b12cd8281c47bcd388b14 commit bdfb568f8dfc8f1fb22b12cd8281c47bcd388b14 Author: Mark Johnston AuthorDate: 2021-07-23 14:30:29 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:07:31 +0000 redzone: Raise a compile error if KASAN is configured redzone(9) does some munging of the allocation to insert redzones before and after a valid memory buffer, but KASAN does not know about this and will raise false positives if both are configured. Until this is fixed, do not allow both to be configured. Note that KASAN provides similar checking on its own but currently does not force the creation of redzones for all UMA allocations; this should be addressed as well. Sponsored by: The FreeBSD Foundation (cherry picked from commit 4e8e26a00471f1a5e7a2af322265c45b1529c5b8) --- sys/vm/redzone.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/vm/redzone.c b/sys/vm/redzone.c index affaa5008a22..88e36c41b928 100644 --- a/sys/vm/redzone.c +++ b/sys/vm/redzone.c @@ -37,6 +37,10 @@ __FBSDID("$FreeBSD$"); #include +#ifdef KASAN +#error KASAN and DEBUG_REDZONE cannot be configured together +#endif + static SYSCTL_NODE(_vm, OID_AUTO, redzone, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "RedZone data"); static u_long redzone_extra_mem = 0; From nobody Mon Nov 1 14:33:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C57E9182E152; Mon, 1 Nov 2021 14:33: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 4Hjb9x1Psgz3sLx; Mon, 1 Nov 2021 14:33: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 3DA6A13704; Mon, 1 Nov 2021 14:33: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 1A1EXHdJ021767; Mon, 1 Nov 2021 14:33:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXHuS021766; Mon, 1 Nov 2021 14:33:17 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:17 GMT Message-Id: <202111011433.1A1EXHuS021766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 252b6ae3e66b - stable/13 - KASAN: Disable checking before triggering a panic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 252b6ae3e66ba6a6a03334fe62665793e6d1359c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=252b6ae3e66ba6a6a03334fe62665793e6d1359c commit 252b6ae3e66ba6a6a03334fe62665793e6d1359c Author: Mark Johnston AuthorDate: 2021-07-23 14:41:00 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:07:45 +0000 KASAN: Disable checking before triggering a panic KASAN hooks will not generate reports if panicstr != NULL, but then there is a window after the initial panic() call where another report may be raised. This can happen if a false positive occurs; to simplify debugging of such problems, avoid recursing. Sponsored by: The FreeBSD Foundation (cherry picked from commit ea3fbe0707f9a02a29875966668b6f15284f335a) --- sys/kern/subr_asan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index d3638ffb5dde..2967b443d5c8 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -174,6 +174,7 @@ kasan_code_name(uint8_t code) #define REPORT(f, ...) do { \ if (panic_on_violation) { \ + kasan_enabled = false; \ panic(f, __VA_ARGS__); \ } else { \ struct stack st; \ From nobody Mon Nov 1 14:33:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BA479182E231; Mon, 1 Nov 2021 14:33: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 4Hjb9z501lz3sgD; Mon, 1 Nov 2021 14:33: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 9CD13134A6; Mon, 1 Nov 2021 14:33: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 1A1EXJZv021821; Mon, 1 Nov 2021 14:33:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXJ0R021820; Mon, 1 Nov 2021 14:33:19 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:19 GMT Message-Id: <202111011433.1A1EXJ0R021820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3388bf06d767 - stable/13 - Generalize sanitizer interceptors for memory and string routines List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3388bf06d767faf3390a77a96c3365926f05c201 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3388bf06d767faf3390a77a96c3365926f05c201 commit 3388bf06d767faf3390a77a96c3365926f05c201 Author: Mark Johnston AuthorDate: 2021-03-24 23:43:05 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:20:50 +0000 Generalize sanitizer interceptors for memory and string routines Similar to commit 3ead60236f ("Generalize bus_space(9) and atomic(9) sanitizer interceptors"), use a more generic scheme for interposing sanitizer implementations of routines like memcpy(). No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit ec8f1ea8d536e91ad37e03e45a688c4e255b9cb0) --- sys/kern/subr_csan.c | 6 ------ sys/sys/libkern.h | 18 ++++++++++-------- sys/sys/systm.h | 54 ++++++++++++++++++++++++++++++++-------------------- 3 files changed, 43 insertions(+), 35 deletions(-) diff --git a/sys/kern/subr_csan.c b/sys/kern/subr_csan.c index 06b0b6ebb020..56d2e59ff12c 100644 --- a/sys/kern/subr_csan.c +++ b/sys/kern/subr_csan.c @@ -350,12 +350,6 @@ kcsan_strlen(const char *str) return (s - str); } -#undef copyin -#undef copyin_nofault -#undef copyinstr -#undef copyout -#undef copyout_nofault - int kcsan_copyin(const void *uaddr, void *kaddr, size_t len) { diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 8517c0dab1f6..d8d3dce1b705 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -193,18 +193,20 @@ size_t strspn(const char *, const char *); char *strstr(const char *, const char *); int strvalid(const char *, size_t); -#ifdef KCSAN -char *kcsan_strcpy(char *, const char *); -int kcsan_strcmp(const char *, const char *); -size_t kcsan_strlen(const char *); -#define strcpy(d, s) kcsan_strcpy((d), (s)) -#define strcmp(s1, s2) kcsan_strcmp((s1), (s2)) -#define strlen(s) kcsan_strlen((s)) +#ifdef SAN_PREFIX +char *SAN_INTERCEPTOR(strcpy)(char *, const char *); +int SAN_INTERCEPTOR(strcmp)(const char *, const char *); +size_t SAN_INTERCEPTOR(strlen)(const char *); +#ifndef SAN_RUNTIME +#define strcpy(d, s) SAN_INTERCEPTOR(strcpy)((d), (s)) +#define strcmp(s1, s2) SAN_INTERCEPTOR(strcmp)((s1), (s2)) +#define strlen(s) SAN_INTERCEPTOR(strlen)(s) +#endif /* !SAN_RUNTIME */ #else #define strcpy(d, s) __builtin_strcpy((d), (s)) #define strcmp(s1, s2) __builtin_strcmp((s1), (s2)) #define strlen(s) __builtin_strlen((s)) -#endif +#endif /* SAN_PREFIX */ static __inline char * index(const char *p, int ch) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 36d48fbf080d..8080f22266e2 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -351,18 +351,28 @@ void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); int memcmp(const void *b1, const void *b2, size_t len); -#ifdef KCSAN -void *kcsan_memset(void *, int, size_t); -void *kcsan_memcpy(void *, const void *, size_t); -void *kcsan_memmove(void *, const void *, size_t); -int kcsan_memcmp(const void *, const void *, size_t); -#define bcopy(from, to, len) kcsan_memmove((to), (from), (len)) -#define bzero(buf, len) kcsan_memset((buf), 0, (len)) -#define bcmp(b1, b2, len) kcsan_memcmp((b1), (b2), (len)) -#define memset(buf, c, len) kcsan_memset((buf), (c), (len)) -#define memcpy(to, from, len) kcsan_memcpy((to), (from), (len)) -#define memmove(dest, src, n) kcsan_memmove((dest), (src), (n)) -#define memcmp(b1, b2, len) kcsan_memcmp((b1), (b2), (len)) +#if defined(KASAN) +#define SAN_PREFIX kasan_ +#elif defined(KCSAN) +#define SAN_PREFIX kcsan_ +#endif + +#ifdef SAN_PREFIX +#define SAN_INTERCEPTOR(func) __CONCAT(SAN_PREFIX, func) + +void *SAN_INTERCEPTOR(memset)(void *, int, size_t); +void *SAN_INTERCEPTOR(memcpy)(void *, const void *, size_t); +void *SAN_INTERCEPTOR(memmove)(void *, const void *, size_t); +int SAN_INTERCEPTOR(memcmp)(const void *, const void *, size_t); +#ifndef SAN_RUNTIME +#define bcopy(from, to, len) SAN_INTERCEPTOR(memmove)((to), (from), (len)) +#define bzero(buf, len) SAN_INTERCEPTOR(memset)((buf), 0, (len)) +#define bcmp(b1, b2, len) SAN_INTERCEPTOR(memcmp)((b1), (b2), (len)) +#define memset(buf, c, len) SAN_INTERCEPTOR(memset)((buf), (c), (len)) +#define memcpy(to, from, len) SAN_INTERCEPTOR(memcpy)((to), (from), (len)) +#define memmove(dest, src, n) SAN_INTERCEPTOR(memmove)((dest), (src), (n)) +#define memcmp(b1, b2, len) SAN_INTERCEPTOR(memcmp)((b1), (b2), (len)) +#endif /* !SAN_RUNTIME */ #else #define bcopy(from, to, len) __builtin_memmove((to), (from), (len)) #define bzero(buf, len) __builtin_memset((buf), 0, (len)) @@ -371,7 +381,7 @@ int kcsan_memcmp(const void *, const void *, size_t); #define memcpy(to, from, len) __builtin_memcpy((to), (from), (len)) #define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) #define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) -#endif +#endif /* !SAN_PREFIX */ void *memset_early(void * _Nonnull buf, int c, size_t len); #define bzero_early(buf, len) memset_early((buf), 0, (len)) @@ -402,14 +412,16 @@ int copyout(const void * _Nonnull __restrict kaddr, int copyout_nofault(const void * _Nonnull __restrict kaddr, void * __restrict udaddr, size_t len); -#ifdef KCSAN -int kcsan_copyin(const void *, void *, size_t); -int kcsan_copyinstr(const void *, void *, size_t, size_t *); -int kcsan_copyout(const void *, void *, size_t); -#define copyin(u, k, l) kcsan_copyin((u), (k), (l)) -#define copyinstr(u, k, l, lc) kcsan_copyinstr((u), (k), (l), (lc)) -#define copyout(k, u, l) kcsan_copyout((k), (u), (l)) -#endif +#ifdef SAN_PREFIX +int SAN_INTERCEPTOR(copyin)(const void *, void *, size_t); +int SAN_INTERCEPTOR(copyinstr)(const void *, void *, size_t, size_t *); +int SAN_INTERCEPTOR(copyout)(const void *, void *, size_t); +#ifndef SAN_RUNTIME +#define copyin(u, k, l) SAN_INTERCEPTOR(copyin)((u), (k), (l)) +#define copyinstr(u, k, l, lc) SAN_INTERCEPTOR(copyinstr)((u), (k), (l), (lc)) +#define copyout(k, u, l) SAN_INTERCEPTOR(copyout)((k), (u), (l)) +#endif /* !SAN_RUNTIME */ +#endif /* SAN_PREFIX */ int fubyte(volatile const void *base); long fuword(volatile const void *base); From nobody Mon Nov 1 14:33:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 09C69182DCF7; Mon, 1 Nov 2021 14:33: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 4Hjb9p3jv4z3sQN; Mon, 1 Nov 2021 14:33: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 C032613616; Mon, 1 Nov 2021 14:33: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 1A1EXCf7021671; Mon, 1 Nov 2021 14:33:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXCVQ021670; Mon, 1 Nov 2021 14:33:12 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:12 GMT Message-Id: <202111011433.1A1EXCVQ021670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 281ad195bd42 - stable/13 - x86: Mark the trapframe as initialized in ipi_bitmap_handler() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 281ad195bd42fa2dbb503c7b55b9108615e83d79 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=281ad195bd42fa2dbb503c7b55b9108615e83d79 commit 281ad195bd42fa2dbb503c7b55b9108615e83d79 Author: Mark Johnston AuthorDate: 2021-07-10 00:38:18 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:06:57 +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 (cherry picked from commit 36226163fa48ee2c5f73bd2e870ce2e5a057f42e) --- 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 255a6c13f025..ca1125886619 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include /* cngetc() */ #include @@ -1282,6 +1283,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 nobody Mon Nov 1 14:33:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D40B81835844; Mon, 1 Nov 2021 14:39: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 4HjbJw22fdz4Tbj; Mon, 1 Nov 2021 14:39: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 6BC3D12F78; Mon, 1 Nov 2021 14:33: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 1A1EXI9X021797; Mon, 1 Nov 2021 14:33:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EXICa021796; Mon, 1 Nov 2021 14:33:18 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:33:18 GMT Message-Id: <202111011433.1A1EXICa021796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: bf0986b742ab - stable/13 - Generalize bus_space(9) and atomic(9) sanitizer interceptors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bf0986b742abaa493ed572391c798791468c702f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bf0986b742abaa493ed572391c798791468c702f commit bf0986b742abaa493ed572391c798791468c702f Author: Mark Johnston AuthorDate: 2021-03-23 01:44:55 +0000 Commit: Mark Johnston CommitDate: 2021-11-01 14:16:39 +0000 Generalize bus_space(9) and atomic(9) sanitizer interceptors Make it easy to define interceptors for new sanitizer runtimes, rather than assuming KCSAN. Lay a bit of groundwork for KASAN and KMSAN. When a sanitizer is compiled in, atomic(9) and bus_space(9) definitions in atomic_san.h are used by default instead of the inline implementations in the platform's atomic.h. These definitions are implemented in the sanitizer runtime, which includes machine/{atomic,bus}.h with SAN_RUNTIME defined to pull in the actual implementations. No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit 3ead60236fd25ce64fece7ae4a453318ca18c119) --- sys/amd64/include/atomic.h | 12 +- sys/arm64/arm64/bus_machdep.c | 4 +- sys/arm64/include/bus.h | 10 +- sys/kern/kern_kcov.c | 4 +- sys/kern/subr_coverage.c | 4 +- sys/kern/subr_csan.c | 10 +- sys/sys/atomic_san.h | 630 ++++++++++++++++++++++-------------------- sys/sys/bus_san.h | 306 ++++++++++---------- sys/x86/include/bus.h | 18 +- sys/x86/x86/bus_machdep.c | 4 +- 10 files changed, 542 insertions(+), 460 deletions(-) diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index 61cb79645c10..c821e77e5b8b 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -68,7 +68,15 @@ #define OFFSETOF_MONITORBUF 0x100 #endif -#if defined(KCSAN) && !defined(KCSAN_RUNTIME) +#ifndef SAN_RUNTIME +#if defined(KASAN) +#define ATOMIC_SAN_PREFIX kasan +#elif defined(KCSAN) +#define ATOMIC_SAN_PREFIX kcsan +#endif +#endif + +#ifdef ATOMIC_SAN_PREFIX #include #else #include @@ -679,6 +687,6 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #endif /* !WANT_FUNCTIONS */ -#endif /* KCSAN && !KCSAN_RUNTIME */ +#endif /* !ATOMIC_SAN_PREFIX */ #endif /* !_MACHINE_ATOMIC_H_ */ diff --git a/sys/arm64/arm64/bus_machdep.c b/sys/arm64/arm64/bus_machdep.c index 7fc83e6924f2..69d7c5b591b2 100644 --- a/sys/arm64/arm64/bus_machdep.c +++ b/sys/arm64/arm64/bus_machdep.c @@ -25,7 +25,9 @@ * */ -#define KCSAN_RUNTIME +#if defined(KASAN) || defined(KCSAN) +#define SAN_RUNTIME +#endif #include "opt_platform.h" diff --git a/sys/arm64/include/bus.h b/sys/arm64/include/bus.h index 5995aa0b4a79..a2bd432a5de5 100644 --- a/sys/arm64/include/bus.h +++ b/sys/arm64/include/bus.h @@ -91,7 +91,15 @@ #define BUS_SPACE_BARRIER_READ 0x01 #define BUS_SPACE_BARRIER_WRITE 0x02 -#if defined(KCSAN) && !defined(KCSAN_RUNTIME) +#ifndef SAN_RUNTIME +#if defined(KASAN) +#define BUS_SAN_PREFIX kasan +#elif defined(KCSAN) +#define BUS_SAN_PREFIX kcsan +#endif +#endif + +#ifdef BUS_SAN_PREFIX #include #else diff --git a/sys/kern/kern_kcov.c b/sys/kern/kern_kcov.c index cedfa2c081ba..23e0da4cdb79 100644 --- a/sys/kern/kern_kcov.c +++ b/sys/kern/kern_kcov.c @@ -35,7 +35,9 @@ * $FreeBSD$ */ -#define KCSAN_RUNTIME +#ifdef KCSAN +#define SAN_RUNTIME +#endif #include __FBSDID("$FreeBSD$"); diff --git a/sys/kern/subr_coverage.c b/sys/kern/subr_coverage.c index f3ab27c2ca3d..9a719bcaecad 100644 --- a/sys/kern/subr_coverage.c +++ b/sys/kern/subr_coverage.c @@ -35,7 +35,9 @@ * $FreeBSD$ */ -#define KCSAN_RUNTIME +#ifdef KCSAN +#define SAN_RUNTIME +#endif #include __FBSDID("$FreeBSD$"); diff --git a/sys/kern/subr_csan.c b/sys/kern/subr_csan.c index ec2fd23729b2..06b0b6ebb020 100644 --- a/sys/kern/subr_csan.c +++ b/sys/kern/subr_csan.c @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define KCSAN_RUNTIME +#define SAN_RUNTIME #include "opt_ddb.h" @@ -380,6 +380,7 @@ kcsan_copyout(const void *kaddr, void *uaddr, size_t len) /* -------------------------------------------------------------------------- */ #include +#define ATOMIC_SAN_PREFIX kcsan #include #define _CSAN_ATOMIC_FUNC_ADD(name, type) \ @@ -684,10 +685,17 @@ CSAN_ATOMIC_FUNC_THREAD_FENCE(acq_rel) CSAN_ATOMIC_FUNC_THREAD_FENCE(rel) CSAN_ATOMIC_FUNC_THREAD_FENCE(seq_cst) +void +kcsan_atomic_interrupt_fence(void) +{ + atomic_interrupt_fence(); +} + /* -------------------------------------------------------------------------- */ #include #include +#define BUS_SAN_PREFIX kcsan #include int diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h index c2b963ae8b92..5d10f58f7565 100644 --- a/sys/sys/atomic_san.h +++ b/sys/sys/atomic_san.h @@ -2,12 +2,16 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2019 Andrew Turner + * Copyright (c) 2021 The FreeBSD Foundation * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the * DARPA SSITH research programme. * + * Portions of this software were written by Mark Johnston under sponsorship + * by the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -39,342 +43,360 @@ #error do not include this header, use machine/atomic.h #endif -#define KCSAN_ATOMIC_FUNC_1(op, name, type) \ - void kcsan_atomic_##op##_##name(volatile type *, type); \ - void kcsan_atomic_##op##_acq_##name(volatile type *, type); \ - void kcsan_atomic_##op##_rel_##name(volatile type *, type) +#ifndef ATOMIC_SAN_PREFIX +#error No sanitizer prefix available +#endif + +#define ATOMIC_SAN_FUNC_1(sp, op, name, type) \ + void sp##_atomic_##op##_##name(volatile type *, type); \ + void sp##_atomic_##op##_acq_##name(volatile type *, type); \ + void sp##_atomic_##op##_rel_##name(volatile type *, type) -#define KCSAN_ATOMIC_CMPSET(name, type) \ - int kcsan_atomic_cmpset_##name(volatile type *, type, type); \ - int kcsan_atomic_cmpset_acq_##name(volatile type *, type, type); \ - int kcsan_atomic_cmpset_rel_##name(volatile type *, type, type) +#define ATOMIC_SAN_CMPSET(sp, name, type) \ + int sp##_atomic_cmpset_##name(volatile type *, type, type); \ + int sp##_atomic_cmpset_acq_##name(volatile type *, type, type); \ + int sp##_atomic_cmpset_rel_##name(volatile type *, type, type) -#define KCSAN_ATOMIC_FCMPSET(name, type) \ - int kcsan_atomic_fcmpset_##name(volatile type *, type *, type); \ - int kcsan_atomic_fcmpset_acq_##name(volatile type *, type *, type); \ - int kcsan_atomic_fcmpset_rel_##name(volatile type *, type *, type) +#define ATOMIC_SAN_FCMPSET(sp, name, type) \ + int sp##_atomic_fcmpset_##name(volatile type *, type *, type); \ + int sp##_atomic_fcmpset_acq_##name(volatile type *, type *, type); \ + int sp##_atomic_fcmpset_rel_##name(volatile type *, type *, type) -#define KCSAN_ATOMIC_READ(op, name, type) \ - type kcsan_atomic_##op##_##name(volatile type *, type) +#define ATOMIC_SAN_READ(sp, op, name, type) \ + type sp##_atomic_##op##_##name(volatile type *, type) -#define KCSAN_ATOMIC_READANDCLEAR(name, type) \ - type kcsan_atomic_readandclear_##name(volatile type *) +#define ATOMIC_SAN_READANDCLEAR(sp, name, type) \ + type sp##_atomic_readandclear_##name(volatile type *) -#define KCSAN_ATOMIC_LOAD(name, type) \ - type kcsan_atomic_load_##name(volatile type *); \ - type kcsan_atomic_load_acq_##name(volatile type *) +#define ATOMIC_SAN_LOAD(sp, name, type) \ + type sp##_atomic_load_##name(volatile type *); \ + type sp##_atomic_load_acq_##name(volatile type *) -#define KCSAN_ATOMIC_STORE(name, type) \ - void kcsan_atomic_store_##name(volatile type *, type); \ - void kcsan_atomic_store_rel_##name(volatile type *, type) +#define ATOMIC_SAN_STORE(sp, name, type) \ + void sp##_atomic_store_##name(volatile type *, type); \ + void sp##_atomic_store_rel_##name(volatile type *, type) -#define KCSAN_ATOMIC_TEST(op, name, type) \ - int kcsan_atomic_##op##_##name(volatile type *, u_int); \ - int kcsan_atomic_##op##_acq_##name(volatile type *, u_int) +#define ATOMIC_SAN_TEST(sp, op, name, type) \ + int sp##_atomic_##op##_##name(volatile type *, u_int); \ + int sp##_atomic_##op##_acq_##name(volatile type *, u_int) -#define KCSAN_ATOMIC_FUNCS(name, type) \ - KCSAN_ATOMIC_FUNC_1(add, name, type); \ - KCSAN_ATOMIC_FUNC_1(clear, name, type); \ - KCSAN_ATOMIC_CMPSET(name, type); \ - KCSAN_ATOMIC_FCMPSET(name, type); \ - KCSAN_ATOMIC_READ(fetchadd, name, type); \ - KCSAN_ATOMIC_LOAD(name, type); \ - KCSAN_ATOMIC_READANDCLEAR(name, type); \ - KCSAN_ATOMIC_FUNC_1(set, name, type); \ - KCSAN_ATOMIC_FUNC_1(subtract, name, type); \ - KCSAN_ATOMIC_STORE(name, type); \ - KCSAN_ATOMIC_READ(swap, name, type); \ - KCSAN_ATOMIC_TEST(testandclear, name, type); \ - KCSAN_ATOMIC_TEST(testandset, name, type) +#define ATOMIC_SAN_THREAD_FENCE(sp) \ + void sp##_atomic_thread_fence_acq(void); \ + void sp##_atomic_thread_fence_rel(void); \ + void sp##_atomic_thread_fence_acq_rel(void); \ + void sp##_atomic_thread_fence_seq_cst(void); \ + void sp##_atomic_interrupt_fence(void) -KCSAN_ATOMIC_FUNCS(char, uint8_t); -KCSAN_ATOMIC_FUNCS(short, uint16_t); -KCSAN_ATOMIC_FUNCS(int, u_int); -KCSAN_ATOMIC_FUNCS(long, u_long); -KCSAN_ATOMIC_FUNCS(ptr, uintptr_t); -KCSAN_ATOMIC_FUNCS(8, uint8_t); -KCSAN_ATOMIC_FUNCS(16, uint16_t); -KCSAN_ATOMIC_FUNCS(32, uint32_t); -KCSAN_ATOMIC_FUNCS(64, uint64_t); +#define _ATOMIC_SAN_FUNCS(sp, name, type) \ + ATOMIC_SAN_FUNC_1(sp, add, name, type); \ + ATOMIC_SAN_FUNC_1(sp, clear, name, type); \ + ATOMIC_SAN_CMPSET(sp, name, type); \ + ATOMIC_SAN_FCMPSET(sp, name, type); \ + ATOMIC_SAN_READ(sp, fetchadd, name, type); \ + ATOMIC_SAN_LOAD(sp, name, type); \ + ATOMIC_SAN_READANDCLEAR(sp, name, type); \ + ATOMIC_SAN_FUNC_1(sp, set, name, type); \ + ATOMIC_SAN_FUNC_1(sp, subtract, name, type); \ + ATOMIC_SAN_STORE(sp, name, type); \ + ATOMIC_SAN_READ(sp, swap, name, type); \ + ATOMIC_SAN_TEST(sp, testandclear, name, type); \ + ATOMIC_SAN_TEST(sp, testandset, name, type); \ + ATOMIC_SAN_THREAD_FENCE(sp); -void kcsan_atomic_thread_fence_acq(void); -void kcsan_atomic_thread_fence_acq_rel(void); -void kcsan_atomic_thread_fence_rel(void); -void kcsan_atomic_thread_fence_seq_cst(void); +#define ATOMIC_SAN_FUNCS(name, type) \ + _ATOMIC_SAN_FUNCS(ATOMIC_SAN_PREFIX, name, type) -#ifndef KCSAN_RUNTIME +ATOMIC_SAN_FUNCS(char, uint8_t); +ATOMIC_SAN_FUNCS(short, uint16_t); +ATOMIC_SAN_FUNCS(int, u_int); +ATOMIC_SAN_FUNCS(long, u_long); +ATOMIC_SAN_FUNCS(ptr, uintptr_t); +ATOMIC_SAN_FUNCS(8, uint8_t); +ATOMIC_SAN_FUNCS(16, uint16_t); +ATOMIC_SAN_FUNCS(32, uint32_t); +ATOMIC_SAN_FUNCS(64, uint64_t); + +#ifndef SAN_RUNTIME + +/* + * Redirect uses of an atomic(9) function to the sanitizer's interceptor. + * For instance, KASAN callers of atomic_add_char() will be redirected to + * kasan_atomic_add_char(). + */ +#define ATOMIC_SAN(func) \ + __CONCAT(ATOMIC_SAN_PREFIX, __CONCAT(_atomic_, func)) -#define atomic_add_char kcsan_atomic_add_char -#define atomic_add_acq_char kcsan_atomic_add_acq_char -#define atomic_add_rel_char kcsan_atomic_add_rel_char -#define atomic_clear_char kcsan_atomic_clear_char -#define atomic_clear_acq_char kcsan_atomic_clear_acq_char -#define atomic_clear_rel_char kcsan_atomic_clear_rel_char -#define atomic_cmpset_char kcsan_atomic_cmpset_char -#define atomic_cmpset_acq_char kcsan_atomic_cmpset_acq_char -#define atomic_cmpset_rel_char kcsan_atomic_cmpset_rel_char -#define atomic_fcmpset_char kcsan_atomic_fcmpset_char -#define atomic_fcmpset_acq_char kcsan_atomic_fcmpset_acq_char -#define atomic_fcmpset_rel_char kcsan_atomic_fcmpset_rel_char -#define atomic_fetchadd_char kcsan_atomic_fetchadd_char -#define atomic_load_char kcsan_atomic_load_char -#define atomic_load_acq_char kcsan_atomic_load_acq_char -#define atomic_readandclear_char kcsan_atomic_readandclear_char -#define atomic_set_char kcsan_atomic_set_char -#define atomic_set_acq_char kcsan_atomic_set_acq_char -#define atomic_set_rel_char kcsan_atomic_set_rel_char -#define atomic_subtract_char kcsan_atomic_subtract_char -#define atomic_subtract_acq_char kcsan_atomic_subtract_acq_char -#define atomic_subtract_rel_char kcsan_atomic_subtract_rel_char -#define atomic_store_char kcsan_atomic_store_char -#define atomic_store_rel_char kcsan_atomic_store_rel_char -#define atomic_swap_char kcsan_atomic_swap_char -#define atomic_testandclear_char kcsan_atomic_testandclear_char -#define atomic_testandset_char kcsan_atomic_testandset_char +#define atomic_add_char ATOMIC_SAN(add_char) +#define atomic_add_acq_char ATOMIC_SAN(add_acq_char) +#define atomic_add_rel_char ATOMIC_SAN(add_rel_char) +#define atomic_clear_char ATOMIC_SAN(clear_char) +#define atomic_clear_acq_char ATOMIC_SAN(clear_acq_char) +#define atomic_clear_rel_char ATOMIC_SAN(clear_rel_char) +#define atomic_cmpset_char ATOMIC_SAN(cmpset_char) +#define atomic_cmpset_acq_char ATOMIC_SAN(cmpset_acq_char) +#define atomic_cmpset_rel_char ATOMIC_SAN(cmpset_rel_char) +#define atomic_fcmpset_char ATOMIC_SAN(fcmpset_char) +#define atomic_fcmpset_acq_char ATOMIC_SAN(fcmpset_acq_char) +#define atomic_fcmpset_rel_char ATOMIC_SAN(fcmpset_rel_char) +#define atomic_fetchadd_char ATOMIC_SAN(fetchadd_char) +#define atomic_load_char ATOMIC_SAN(load_char) +#define atomic_load_acq_char ATOMIC_SAN(load_acq_char) +#define atomic_readandclear_char ATOMIC_SAN(readandclear_char) +#define atomic_set_char ATOMIC_SAN(set_char) +#define atomic_set_acq_char ATOMIC_SAN(set_acq_char) +#define atomic_set_rel_char ATOMIC_SAN(set_rel_char) +#define atomic_subtract_char ATOMIC_SAN(subtract_char) +#define atomic_subtract_acq_char ATOMIC_SAN(subtract_acq_char) +#define atomic_subtract_rel_char ATOMIC_SAN(subtract_rel_char) +#define atomic_store_char ATOMIC_SAN(store_char) +#define atomic_store_rel_char ATOMIC_SAN(store_rel_char) +#define atomic_swap_char ATOMIC_SAN(swap_char) +#define atomic_testandclear_char ATOMIC_SAN(testandclear_char) +#define atomic_testandset_char ATOMIC_SAN(testandset_char) -#define atomic_add_short kcsan_atomic_add_short -#define atomic_add_acq_short kcsan_atomic_add_acq_short -#define atomic_add_rel_short kcsan_atomic_add_rel_short -#define atomic_clear_short kcsan_atomic_clear_short -#define atomic_clear_acq_short kcsan_atomic_clear_acq_short -#define atomic_clear_rel_short kcsan_atomic_clear_rel_short -#define atomic_cmpset_short kcsan_atomic_cmpset_short -#define atomic_cmpset_acq_short kcsan_atomic_cmpset_acq_short -#define atomic_cmpset_rel_short kcsan_atomic_cmpset_rel_short -#define atomic_fcmpset_short kcsan_atomic_fcmpset_short -#define atomic_fcmpset_acq_short kcsan_atomic_fcmpset_acq_short -#define atomic_fcmpset_rel_short kcsan_atomic_fcmpset_rel_short -#define atomic_fetchadd_short kcsan_atomic_fetchadd_short -#define atomic_load_short kcsan_atomic_load_short -#define atomic_load_acq_short kcsan_atomic_load_acq_short -#define atomic_readandclear_short kcsan_atomic_readandclear_short -#define atomic_set_short kcsan_atomic_set_short -#define atomic_set_acq_short kcsan_atomic_set_acq_short -#define atomic_set_rel_short kcsan_atomic_set_rel_short -#define atomic_subtract_short kcsan_atomic_subtract_short -#define atomic_subtract_acq_short kcsan_atomic_subtract_acq_short -#define atomic_subtract_rel_short kcsan_atomic_subtract_rel_short -#define atomic_store_short kcsan_atomic_store_short -#define atomic_store_rel_short kcsan_atomic_store_rel_short -#define atomic_swap_short kcsan_atomic_swap_short -#define atomic_testandclear_short kcsan_atomic_testandclear_short -#define atomic_testandset_short kcsan_atomic_testandset_short +#define atomic_add_short ATOMIC_SAN(add_short) +#define atomic_add_acq_short ATOMIC_SAN(add_acq_short) +#define atomic_add_rel_short ATOMIC_SAN(add_rel_short) +#define atomic_clear_short ATOMIC_SAN(clear_short) +#define atomic_clear_acq_short ATOMIC_SAN(clear_acq_short) +#define atomic_clear_rel_short ATOMIC_SAN(clear_rel_short) +#define atomic_cmpset_short ATOMIC_SAN(cmpset_short) +#define atomic_cmpset_acq_short ATOMIC_SAN(cmpset_acq_short) +#define atomic_cmpset_rel_short ATOMIC_SAN(cmpset_rel_short) +#define atomic_fcmpset_short ATOMIC_SAN(fcmpset_short) +#define atomic_fcmpset_acq_short ATOMIC_SAN(fcmpset_acq_short) +#define atomic_fcmpset_rel_short ATOMIC_SAN(fcmpset_rel_short) +#define atomic_fetchadd_short ATOMIC_SAN(fetchadd_short) +#define atomic_load_short ATOMIC_SAN(load_short) +#define atomic_load_acq_short ATOMIC_SAN(load_acq_short) +#define atomic_readandclear_short ATOMIC_SAN(readandclear_short) +#define atomic_set_short ATOMIC_SAN(set_short) +#define atomic_set_acq_short ATOMIC_SAN(set_acq_short) +#define atomic_set_rel_short ATOMIC_SAN(set_rel_short) +#define atomic_subtract_short ATOMIC_SAN(subtract_short) +#define atomic_subtract_acq_short ATOMIC_SAN(subtract_acq_short) +#define atomic_subtract_rel_short ATOMIC_SAN(subtract_rel_short) +#define atomic_store_short ATOMIC_SAN(store_short) +#define atomic_store_rel_short ATOMIC_SAN(store_rel_short) +#define atomic_swap_short ATOMIC_SAN(swap_short) +#define atomic_testandclear_short ATOMIC_SAN(testandclear_short) +#define atomic_testandset_short ATOMIC_SAN(testandset_short) -#define atomic_add_int kcsan_atomic_add_int -#define atomic_add_acq_int kcsan_atomic_add_acq_int -#define atomic_add_rel_int kcsan_atomic_add_rel_int -#define atomic_clear_int kcsan_atomic_clear_int -#define atomic_clear_acq_int kcsan_atomic_clear_acq_int -#define atomic_clear_rel_int kcsan_atomic_clear_rel_int -#define atomic_cmpset_int kcsan_atomic_cmpset_int -#define atomic_cmpset_acq_int kcsan_atomic_cmpset_acq_int -#define atomic_cmpset_rel_int kcsan_atomic_cmpset_rel_int -#define atomic_fcmpset_int kcsan_atomic_fcmpset_int -#define atomic_fcmpset_acq_int kcsan_atomic_fcmpset_acq_int -#define atomic_fcmpset_rel_int kcsan_atomic_fcmpset_rel_int -#define atomic_fetchadd_int kcsan_atomic_fetchadd_int -#define atomic_load_int kcsan_atomic_load_int -#define atomic_load_acq_int kcsan_atomic_load_acq_int -#define atomic_readandclear_int kcsan_atomic_readandclear_int -#define atomic_set_int kcsan_atomic_set_int -#define atomic_set_acq_int kcsan_atomic_set_acq_int -#define atomic_set_rel_int kcsan_atomic_set_rel_int -#define atomic_subtract_int kcsan_atomic_subtract_int -#define atomic_subtract_acq_int kcsan_atomic_subtract_acq_int -#define atomic_subtract_rel_int kcsan_atomic_subtract_rel_int -#define atomic_store_int kcsan_atomic_store_int -#define atomic_store_rel_int kcsan_atomic_store_rel_int -#define atomic_swap_int kcsan_atomic_swap_int -#define atomic_testandclear_int kcsan_atomic_testandclear_int -#define atomic_testandset_int kcsan_atomic_testandset_int +#define atomic_add_int ATOMIC_SAN(add_int) +#define atomic_add_acq_int ATOMIC_SAN(add_acq_int) +#define atomic_add_rel_int ATOMIC_SAN(add_rel_int) +#define atomic_clear_int ATOMIC_SAN(clear_int) +#define atomic_clear_acq_int ATOMIC_SAN(clear_acq_int) +#define atomic_clear_rel_int ATOMIC_SAN(clear_rel_int) +#define atomic_cmpset_int ATOMIC_SAN(cmpset_int) +#define atomic_cmpset_acq_int ATOMIC_SAN(cmpset_acq_int) +#define atomic_cmpset_rel_int ATOMIC_SAN(cmpset_rel_int) +#define atomic_fcmpset_int ATOMIC_SAN(fcmpset_int) +#define atomic_fcmpset_acq_int ATOMIC_SAN(fcmpset_acq_int) +#define atomic_fcmpset_rel_int ATOMIC_SAN(fcmpset_rel_int) +#define atomic_fetchadd_int ATOMIC_SAN(fetchadd_int) +#define atomic_load_int ATOMIC_SAN(load_int) +#define atomic_load_acq_int ATOMIC_SAN(load_acq_int) +#define atomic_readandclear_int ATOMIC_SAN(readandclear_int) +#define atomic_set_int ATOMIC_SAN(set_int) +#define atomic_set_acq_int ATOMIC_SAN(set_acq_int) +#define atomic_set_rel_int ATOMIC_SAN(set_rel_int) +#define atomic_subtract_int ATOMIC_SAN(subtract_int) +#define atomic_subtract_acq_int ATOMIC_SAN(subtract_acq_int) +#define atomic_subtract_rel_int ATOMIC_SAN(subtract_rel_int) +#define atomic_store_int ATOMIC_SAN(store_int) +#define atomic_store_rel_int ATOMIC_SAN(store_rel_int) +#define atomic_swap_int ATOMIC_SAN(swap_int) +#define atomic_testandclear_int ATOMIC_SAN(testandclear_int) +#define atomic_testandset_int ATOMIC_SAN(testandset_int) -#define atomic_add_long kcsan_atomic_add_long -#define atomic_add_acq_long kcsan_atomic_add_acq_long -#define atomic_add_rel_long kcsan_atomic_add_rel_long -#define atomic_clear_long kcsan_atomic_clear_long -#define atomic_clear_acq_long kcsan_atomic_clear_acq_long -#define atomic_clear_rel_long kcsan_atomic_clear_rel_long -#define atomic_cmpset_long kcsan_atomic_cmpset_long -#define atomic_cmpset_acq_long kcsan_atomic_cmpset_acq_long -#define atomic_cmpset_rel_long kcsan_atomic_cmpset_rel_long -#define atomic_fcmpset_long kcsan_atomic_fcmpset_long -#define atomic_fcmpset_acq_long kcsan_atomic_fcmpset_acq_long -#define atomic_fcmpset_rel_long kcsan_atomic_fcmpset_rel_long -#define atomic_fetchadd_long kcsan_atomic_fetchadd_long -#define atomic_load_long kcsan_atomic_load_long -#define atomic_load_acq_long kcsan_atomic_load_acq_long -#define atomic_readandclear_long kcsan_atomic_readandclear_long -#define atomic_set_long kcsan_atomic_set_long -#define atomic_set_acq_long kcsan_atomic_set_acq_long -#define atomic_set_rel_long kcsan_atomic_set_rel_long -#define atomic_subtract_long kcsan_atomic_subtract_long -#define atomic_subtract_acq_long kcsan_atomic_subtract_acq_long -#define atomic_subtract_rel_long kcsan_atomic_subtract_rel_long -#define atomic_store_long kcsan_atomic_store_long -#define atomic_store_rel_long kcsan_atomic_store_rel_long -#define atomic_swap_long kcsan_atomic_swap_long -#define atomic_testandclear_long kcsan_atomic_testandclear_long -#define atomic_testandset_long kcsan_atomic_testandset_long -#define atomic_testandset_acq_long kcsan_atomic_testandset_acq_long +#define atomic_add_long ATOMIC_SAN(add_long) +#define atomic_add_acq_long ATOMIC_SAN(add_acq_long) +#define atomic_add_rel_long ATOMIC_SAN(add_rel_long) +#define atomic_clear_long ATOMIC_SAN(clear_long) +#define atomic_clear_acq_long ATOMIC_SAN(clear_acq_long) +#define atomic_clear_rel_long ATOMIC_SAN(clear_rel_long) +#define atomic_cmpset_long ATOMIC_SAN(cmpset_long) +#define atomic_cmpset_acq_long ATOMIC_SAN(cmpset_acq_long) +#define atomic_cmpset_rel_long ATOMIC_SAN(cmpset_rel_long) +#define atomic_fcmpset_long ATOMIC_SAN(fcmpset_long) +#define atomic_fcmpset_acq_long ATOMIC_SAN(fcmpset_acq_long) +#define atomic_fcmpset_rel_long ATOMIC_SAN(fcmpset_rel_long) +#define atomic_fetchadd_long ATOMIC_SAN(fetchadd_long) +#define atomic_load_long ATOMIC_SAN(load_long) +#define atomic_load_acq_long ATOMIC_SAN(load_acq_long) +#define atomic_readandclear_long ATOMIC_SAN(readandclear_long) +#define atomic_set_long ATOMIC_SAN(set_long) +#define atomic_set_acq_long ATOMIC_SAN(set_acq_long) +#define atomic_set_rel_long ATOMIC_SAN(set_rel_long) +#define atomic_subtract_long ATOMIC_SAN(subtract_long) +#define atomic_subtract_acq_long ATOMIC_SAN(subtract_acq_long) +#define atomic_subtract_rel_long ATOMIC_SAN(subtract_rel_long) +#define atomic_store_long ATOMIC_SAN(store_long) +#define atomic_store_rel_long ATOMIC_SAN(store_rel_long) +#define atomic_swap_long ATOMIC_SAN(swap_long) +#define atomic_testandclear_long ATOMIC_SAN(testandclear_long) +#define atomic_testandset_long ATOMIC_SAN(testandset_long) +#define atomic_testandset_acq_long ATOMIC_SAN(testandset_acq_long) -#define atomic_add_ptr kcsan_atomic_add_ptr -#define atomic_add_acq_ptr kcsan_atomic_add_acq_ptr -#define atomic_add_rel_ptr kcsan_atomic_add_rel_ptr -#define atomic_clear_ptr kcsan_atomic_clear_ptr -#define atomic_clear_acq_ptr kcsan_atomic_clear_acq_ptr -#define atomic_clear_rel_ptr kcsan_atomic_clear_rel_ptr -#define atomic_cmpset_ptr kcsan_atomic_cmpset_ptr -#define atomic_cmpset_acq_ptr kcsan_atomic_cmpset_acq_ptr -#define atomic_cmpset_rel_ptr kcsan_atomic_cmpset_rel_ptr -#define atomic_fcmpset_ptr kcsan_atomic_fcmpset_ptr -#define atomic_fcmpset_acq_ptr kcsan_atomic_fcmpset_acq_ptr -#define atomic_fcmpset_rel_ptr kcsan_atomic_fcmpset_rel_ptr -#define atomic_fetchadd_ptr kcsan_atomic_fetchadd_ptr +#define atomic_add_ptr ATOMIC_SAN(add_ptr) +#define atomic_add_acq_ptr ATOMIC_SAN(add_acq_ptr) +#define atomic_add_rel_ptr ATOMIC_SAN(add_rel_ptr) +#define atomic_clear_ptr ATOMIC_SAN(clear_ptr) +#define atomic_clear_acq_ptr ATOMIC_SAN(clear_acq_ptr) +#define atomic_clear_rel_ptr ATOMIC_SAN(clear_rel_ptr) +#define atomic_cmpset_ptr ATOMIC_SAN(cmpset_ptr) +#define atomic_cmpset_acq_ptr ATOMIC_SAN(cmpset_acq_ptr) +#define atomic_cmpset_rel_ptr ATOMIC_SAN(cmpset_rel_ptr) +#define atomic_fcmpset_ptr ATOMIC_SAN(fcmpset_ptr) +#define atomic_fcmpset_acq_ptr ATOMIC_SAN(fcmpset_acq_ptr) +#define atomic_fcmpset_rel_ptr ATOMIC_SAN(fcmpset_rel_ptr) +#define atomic_fetchadd_ptr ATOMIC_SAN(fetchadd_ptr) #define atomic_load_ptr(x) ({ \ __typeof(*x) __retptr; \ - __retptr = (void *)kcsan_atomic_load_ptr((volatile uintptr_t *)(x)); \ + __retptr = (void *)ATOMIC_SAN(load_ptr)((volatile uintptr_t *)(x)); \ __retptr; \ }) -#define atomic_load_acq_ptr kcsan_atomic_load_acq_ptr +#define atomic_load_acq_ptr ATOMIC_SAN(load_acq_ptr) #define atomic_load_consume_ptr(x) ({ \ __typeof(*x) __retptr; \ - __retptr = (void *)kcsan_atomic_load_acq_ptr((volatile uintptr_t *)(x));\ + __retptr = (void *)atomic_load_acq_ptr((volatile uintptr_t *)(x));\ __retptr; \ }) -#define atomic_readandclear_ptr kcsan_atomic_readandclear_ptr -#define atomic_set_ptr kcsan_atomic_set_ptr -#define atomic_set_acq_ptr kcsan_atomic_set_acq_ptr -#define atomic_set_rel_ptr kcsan_atomic_set_rel_ptr -#define atomic_subtract_ptr kcsan_atomic_subtract_ptr -#define atomic_subtract_acq_ptr kcsan_atomic_subtract_acq_ptr -#define atomic_subtract_rel_ptr kcsan_atomic_subtract_rel_ptr +#define atomic_readandclear_ptr ATOMIC_SAN(readandclear_ptr) +#define atomic_set_ptr ATOMIC_SAN(set_ptr) +#define atomic_set_acq_ptr ATOMIC_SAN(set_acq_ptr) +#define atomic_set_rel_ptr ATOMIC_SAN(set_rel_ptr) +#define atomic_subtract_ptr ATOMIC_SAN(subtract_ptr) +#define atomic_subtract_acq_ptr ATOMIC_SAN(subtract_acq_ptr) +#define atomic_subtract_rel_ptr ATOMIC_SAN(subtract_rel_ptr) #define atomic_store_ptr(x, v) ({ \ __typeof(*x) __value = (v); \ - kcsan_atomic_store_ptr((volatile uintptr_t *)(x), (uintptr_t)(__value));\ + ATOMIC_SAN(store_ptr)((volatile uintptr_t *)(x), (uintptr_t)(__value));\ }) -#define atomic_store_rel_ptr kcsan_atomic_store_rel_ptr -#define atomic_swap_ptr kcsan_atomic_swap_ptr -#define atomic_testandclear_ptr kcsan_atomic_testandclear_ptr -#define atomic_testandset_ptr kcsan_atomic_testandset_ptr +#define atomic_store_rel_ptr ATOMIC_SAN(store_rel_ptr) +#define atomic_swap_ptr ATOMIC_SAN(swap_ptr) +#define atomic_testandclear_ptr ATOMIC_SAN(testandclear_ptr) +#define atomic_testandset_ptr ATOMIC_SAN(testandset_ptr) -#define atomic_add_8 kcsan_atomic_add_8 -#define atomic_add_acq_8 kcsan_atomic_add_acq_8 -#define atomic_add_rel_8 kcsan_atomic_add_rel_8 -#define atomic_clear_8 kcsan_atomic_clear_8 -#define atomic_clear_acq_8 kcsan_atomic_clear_acq_8 -#define atomic_clear_rel_8 kcsan_atomic_clear_rel_8 -#define atomic_cmpset_8 kcsan_atomic_cmpset_8 -#define atomic_cmpset_acq_8 kcsan_atomic_cmpset_acq_8 -#define atomic_cmpset_rel_8 kcsan_atomic_cmpset_rel_8 -#define atomic_fcmpset_8 kcsan_atomic_fcmpset_8 -#define atomic_fcmpset_acq_8 kcsan_atomic_fcmpset_acq_8 -#define atomic_fcmpset_rel_8 kcsan_atomic_fcmpset_rel_8 -#define atomic_fetchadd_8 kcsan_atomic_fetchadd_8 -#define atomic_load_8 kcsan_atomic_load_8 -#define atomic_load_acq_8 kcsan_atomic_load_acq_8 -#define atomic_readandclear_8 kcsan_atomic_readandclear_8 -#define atomic_set_8 kcsan_atomic_set_8 -#define atomic_set_acq_8 kcsan_atomic_set_acq_8 -#define atomic_set_rel_8 kcsan_atomic_set_rel_8 -#define atomic_subtract_8 kcsan_atomic_subtract_8 -#define atomic_subtract_acq_8 kcsan_atomic_subtract_acq_8 -#define atomic_subtract_rel_8 kcsan_atomic_subtract_rel_8 -#define atomic_store_8 kcsan_atomic_store_8 -#define atomic_store_rel_8 kcsan_atomic_store_rel_8 -#define atomic_swap_8 kcsan_atomic_swap_8 -#define atomic_testandclear_8 kcsan_atomic_testandclear_8 -#define atomic_testandset_8 kcsan_atomic_testandset_8 +#define atomic_add_8 ATOMIC_SAN(add_8) +#define atomic_add_acq_8 ATOMIC_SAN(add_acq_8) +#define atomic_add_rel_8 ATOMIC_SAN(add_rel_8) +#define atomic_clear_8 ATOMIC_SAN(clear_8) +#define atomic_clear_acq_8 ATOMIC_SAN(clear_acq_8) +#define atomic_clear_rel_8 ATOMIC_SAN(clear_rel_8) +#define atomic_cmpset_8 ATOMIC_SAN(cmpset_8) +#define atomic_cmpset_acq_8 ATOMIC_SAN(cmpset_acq_8) +#define atomic_cmpset_rel_8 ATOMIC_SAN(cmpset_rel_8) +#define atomic_fcmpset_8 ATOMIC_SAN(fcmpset_8) +#define atomic_fcmpset_acq_8 ATOMIC_SAN(fcmpset_acq_8) +#define atomic_fcmpset_rel_8 ATOMIC_SAN(fcmpset_rel_8) +#define atomic_fetchadd_8 ATOMIC_SAN(fetchadd_8) +#define atomic_load_8 ATOMIC_SAN(load_8) +#define atomic_load_acq_8 ATOMIC_SAN(load_acq_8) +#define atomic_readandclear_8 ATOMIC_SAN(readandclear_8) +#define atomic_set_8 ATOMIC_SAN(set_8) +#define atomic_set_acq_8 ATOMIC_SAN(set_acq_8) +#define atomic_set_rel_8 ATOMIC_SAN(set_rel_8) +#define atomic_subtract_8 ATOMIC_SAN(subtract_8) +#define atomic_subtract_acq_8 ATOMIC_SAN(subtract_acq_8) +#define atomic_subtract_rel_8 ATOMIC_SAN(subtract_rel_8) +#define atomic_store_8 ATOMIC_SAN(store_8) +#define atomic_store_rel_8 ATOMIC_SAN(store_rel_8) +#define atomic_swap_8 ATOMIC_SAN(swap_8) +#define atomic_testandclear_8 ATOMIC_SAN(testandclear_8) +#define atomic_testandset_8 ATOMIC_SAN(testandset_8) -#define atomic_add_16 kcsan_atomic_add_16 -#define atomic_add_acq_16 kcsan_atomic_add_acq_16 -#define atomic_add_rel_16 kcsan_atomic_add_rel_16 -#define atomic_clear_16 kcsan_atomic_clear_16 -#define atomic_clear_acq_16 kcsan_atomic_clear_acq_16 -#define atomic_clear_rel_16 kcsan_atomic_clear_rel_16 -#define atomic_cmpset_16 kcsan_atomic_cmpset_16 -#define atomic_cmpset_acq_16 kcsan_atomic_cmpset_acq_16 -#define atomic_cmpset_rel_16 kcsan_atomic_cmpset_rel_16 -#define atomic_fcmpset_16 kcsan_atomic_fcmpset_16 -#define atomic_fcmpset_acq_16 kcsan_atomic_fcmpset_acq_16 -#define atomic_fcmpset_rel_16 kcsan_atomic_fcmpset_rel_16 -#define atomic_fetchadd_16 kcsan_atomic_fetchadd_16 -#define atomic_load_16 kcsan_atomic_load_16 -#define atomic_load_acq_16 kcsan_atomic_load_acq_16 -#define atomic_readandclear_16 kcsan_atomic_readandclear_16 -#define atomic_set_16 kcsan_atomic_set_16 -#define atomic_set_acq_16 kcsan_atomic_set_acq_16 -#define atomic_set_rel_16 kcsan_atomic_set_rel_16 -#define atomic_subtract_16 kcsan_atomic_subtract_16 -#define atomic_subtract_acq_16 kcsan_atomic_subtract_acq_16 -#define atomic_subtract_rel_16 kcsan_atomic_subtract_rel_16 -#define atomic_store_16 kcsan_atomic_store_16 -#define atomic_store_rel_16 kcsan_atomic_store_rel_16 -#define atomic_swap_16 kcsan_atomic_swap_16 -#define atomic_testandclear_16 kcsan_atomic_testandclear_16 -#define atomic_testandset_16 kcsan_atomic_testandset_16 +#define atomic_add_16 ATOMIC_SAN(add_16) +#define atomic_add_acq_16 ATOMIC_SAN(add_acq_16) +#define atomic_add_rel_16 ATOMIC_SAN(add_rel_16) +#define atomic_clear_16 ATOMIC_SAN(clear_16) +#define atomic_clear_acq_16 ATOMIC_SAN(clear_acq_16) +#define atomic_clear_rel_16 ATOMIC_SAN(clear_rel_16) +#define atomic_cmpset_16 ATOMIC_SAN(cmpset_16) +#define atomic_cmpset_acq_16 ATOMIC_SAN(cmpset_acq_16) +#define atomic_cmpset_rel_16 ATOMIC_SAN(cmpset_rel_16) +#define atomic_fcmpset_16 ATOMIC_SAN(fcmpset_16) +#define atomic_fcmpset_acq_16 ATOMIC_SAN(fcmpset_acq_16) +#define atomic_fcmpset_rel_16 ATOMIC_SAN(fcmpset_rel_16) +#define atomic_fetchadd_16 ATOMIC_SAN(fetchadd_16) +#define atomic_load_16 ATOMIC_SAN(load_16) +#define atomic_load_acq_16 ATOMIC_SAN(load_acq_16) +#define atomic_readandclear_16 ATOMIC_SAN(readandclear_16) +#define atomic_set_16 ATOMIC_SAN(set_16) +#define atomic_set_acq_16 ATOMIC_SAN(set_acq_16) +#define atomic_set_rel_16 ATOMIC_SAN(set_rel_16) +#define atomic_subtract_16 ATOMIC_SAN(subtract_16) +#define atomic_subtract_acq_16 ATOMIC_SAN(subtract_acq_16) +#define atomic_subtract_rel_16 ATOMIC_SAN(subtract_rel_16) +#define atomic_store_16 ATOMIC_SAN(store_16) +#define atomic_store_rel_16 ATOMIC_SAN(store_rel_16) +#define atomic_swap_16 ATOMIC_SAN(swap_16) +#define atomic_testandclear_16 ATOMIC_SAN(testandclear_16) +#define atomic_testandset_16 ATOMIC_SAN(testandset_16) -#define atomic_add_32 kcsan_atomic_add_32 -#define atomic_add_acq_32 kcsan_atomic_add_acq_32 -#define atomic_add_rel_32 kcsan_atomic_add_rel_32 -#define atomic_clear_32 kcsan_atomic_clear_32 -#define atomic_clear_acq_32 kcsan_atomic_clear_acq_32 -#define atomic_clear_rel_32 kcsan_atomic_clear_rel_32 -#define atomic_cmpset_32 kcsan_atomic_cmpset_32 -#define atomic_cmpset_acq_32 kcsan_atomic_cmpset_acq_32 -#define atomic_cmpset_rel_32 kcsan_atomic_cmpset_rel_32 -#define atomic_fcmpset_32 kcsan_atomic_fcmpset_32 -#define atomic_fcmpset_acq_32 kcsan_atomic_fcmpset_acq_32 -#define atomic_fcmpset_rel_32 kcsan_atomic_fcmpset_rel_32 -#define atomic_fetchadd_32 kcsan_atomic_fetchadd_32 -#define atomic_load_32 kcsan_atomic_load_32 -#define atomic_load_acq_32 kcsan_atomic_load_acq_32 -#define atomic_readandclear_32 kcsan_atomic_readandclear_32 -#define atomic_set_32 kcsan_atomic_set_32 -#define atomic_set_acq_32 kcsan_atomic_set_acq_32 -#define atomic_set_rel_32 kcsan_atomic_set_rel_32 -#define atomic_subtract_32 kcsan_atomic_subtract_32 -#define atomic_subtract_acq_32 kcsan_atomic_subtract_acq_32 -#define atomic_subtract_rel_32 kcsan_atomic_subtract_rel_32 -#define atomic_store_32 kcsan_atomic_store_32 -#define atomic_store_rel_32 kcsan_atomic_store_rel_32 -#define atomic_swap_32 kcsan_atomic_swap_32 -#define atomic_testandclear_32 kcsan_atomic_testandclear_32 -#define atomic_testandset_32 kcsan_atomic_testandset_32 +#define atomic_add_32 ATOMIC_SAN(add_32) +#define atomic_add_acq_32 ATOMIC_SAN(add_acq_32) +#define atomic_add_rel_32 ATOMIC_SAN(add_rel_32) +#define atomic_clear_32 ATOMIC_SAN(clear_32) +#define atomic_clear_acq_32 ATOMIC_SAN(clear_acq_32) +#define atomic_clear_rel_32 ATOMIC_SAN(clear_rel_32) +#define atomic_cmpset_32 ATOMIC_SAN(cmpset_32) +#define atomic_cmpset_acq_32 ATOMIC_SAN(cmpset_acq_32) +#define atomic_cmpset_rel_32 ATOMIC_SAN(cmpset_rel_32) +#define atomic_fcmpset_32 ATOMIC_SAN(fcmpset_32) +#define atomic_fcmpset_acq_32 ATOMIC_SAN(fcmpset_acq_32) +#define atomic_fcmpset_rel_32 ATOMIC_SAN(fcmpset_rel_32) +#define atomic_fetchadd_32 ATOMIC_SAN(fetchadd_32) +#define atomic_load_32 ATOMIC_SAN(load_32) +#define atomic_load_acq_32 ATOMIC_SAN(load_acq_32) +#define atomic_readandclear_32 ATOMIC_SAN(readandclear_32) +#define atomic_set_32 ATOMIC_SAN(set_32) +#define atomic_set_acq_32 ATOMIC_SAN(set_acq_32) +#define atomic_set_rel_32 ATOMIC_SAN(set_rel_32) +#define atomic_subtract_32 ATOMIC_SAN(subtract_32) +#define atomic_subtract_acq_32 ATOMIC_SAN(subtract_acq_32) +#define atomic_subtract_rel_32 ATOMIC_SAN(subtract_rel_32) +#define atomic_store_32 ATOMIC_SAN(store_32) +#define atomic_store_rel_32 ATOMIC_SAN(store_rel_32) +#define atomic_swap_32 ATOMIC_SAN(swap_32) +#define atomic_testandclear_32 ATOMIC_SAN(testandclear_32) +#define atomic_testandset_32 ATOMIC_SAN(testandset_32) -#define atomic_add_64 kcsan_atomic_add_64 -#define atomic_add_acq_64 kcsan_atomic_add_acq_64 -#define atomic_add_rel_64 kcsan_atomic_add_rel_64 -#define atomic_clear_64 kcsan_atomic_clear_64 -#define atomic_clear_acq_64 kcsan_atomic_clear_acq_64 -#define atomic_clear_rel_64 kcsan_atomic_clear_rel_64 -#define atomic_cmpset_64 kcsan_atomic_cmpset_64 -#define atomic_cmpset_acq_64 kcsan_atomic_cmpset_acq_64 -#define atomic_cmpset_rel_64 kcsan_atomic_cmpset_rel_64 -#define atomic_fcmpset_64 kcsan_atomic_fcmpset_64 -#define atomic_fcmpset_acq_64 kcsan_atomic_fcmpset_acq_64 -#define atomic_fcmpset_rel_64 kcsan_atomic_fcmpset_rel_64 -#define atomic_fetchadd_64 kcsan_atomic_fetchadd_64 -#define atomic_load_64 kcsan_atomic_load_64 -#define atomic_load_acq_64 kcsan_atomic_load_acq_64 -#define atomic_readandclear_64 kcsan_atomic_readandclear_64 -#define atomic_set_64 kcsan_atomic_set_64 -#define atomic_set_acq_64 kcsan_atomic_set_acq_64 -#define atomic_set_rel_64 kcsan_atomic_set_rel_64 -#define atomic_subtract_64 kcsan_atomic_subtract_64 -#define atomic_subtract_acq_64 kcsan_atomic_subtract_acq_64 -#define atomic_subtract_rel_64 kcsan_atomic_subtract_rel_64 -#define atomic_store_64 kcsan_atomic_store_64 -#define atomic_store_rel_64 kcsan_atomic_store_rel_64 -#define atomic_swap_64 kcsan_atomic_swap_64 -#define atomic_testandclear_64 kcsan_atomic_testandclear_64 -#define atomic_testandset_64 kcsan_atomic_testandset_64 +#define atomic_add_64 ATOMIC_SAN(add_64) +#define atomic_add_acq_64 ATOMIC_SAN(add_acq_64) +#define atomic_add_rel_64 ATOMIC_SAN(add_rel_64) +#define atomic_clear_64 ATOMIC_SAN(clear_64) +#define atomic_clear_acq_64 ATOMIC_SAN(clear_acq_64) +#define atomic_clear_rel_64 ATOMIC_SAN(clear_rel_64) +#define atomic_cmpset_64 ATOMIC_SAN(cmpset_64) +#define atomic_cmpset_acq_64 ATOMIC_SAN(cmpset_acq_64) +#define atomic_cmpset_rel_64 ATOMIC_SAN(cmpset_rel_64) +#define atomic_fcmpset_64 ATOMIC_SAN(fcmpset_64) +#define atomic_fcmpset_acq_64 ATOMIC_SAN(fcmpset_acq_64) +#define atomic_fcmpset_rel_64 ATOMIC_SAN(fcmpset_rel_64) +#define atomic_fetchadd_64 ATOMIC_SAN(fetchadd_64) +#define atomic_load_64 ATOMIC_SAN(load_64) +#define atomic_load_acq_64 ATOMIC_SAN(load_acq_64) +#define atomic_readandclear_64 ATOMIC_SAN(readandclear_64) +#define atomic_set_64 ATOMIC_SAN(set_64) +#define atomic_set_acq_64 ATOMIC_SAN(set_acq_64) +#define atomic_set_rel_64 ATOMIC_SAN(set_rel_64) +#define atomic_subtract_64 ATOMIC_SAN(subtract_64) +#define atomic_subtract_acq_64 ATOMIC_SAN(subtract_acq_64) +#define atomic_subtract_rel_64 ATOMIC_SAN(subtract_rel_64) +#define atomic_store_64 ATOMIC_SAN(store_64) +#define atomic_store_rel_64 ATOMIC_SAN(store_rel_64) +#define atomic_swap_64 ATOMIC_SAN(swap_64) +#define atomic_testandclear_64 ATOMIC_SAN(testandclear_64) +#define atomic_testandset_64 ATOMIC_SAN(testandset_64) -#define atomic_thread_fence_acq kcsan_atomic_thread_fence_acq -#define atomic_thread_fence_acq_rel kcsan_atomic_thread_fence_acq_rel -#define atomic_thread_fence_rel kcsan_atomic_thread_fence_rel -#define atomic_thread_fence_seq_cst kcsan_atomic_thread_fence_seq_cst -#define atomic_interrupt_fence __compiler_membar +#define atomic_thread_fence_acq ATOMIC_SAN(thread_fence_acq) +#define atomic_thread_fence_acq_rel ATOMIC_SAN(thread_fence_acq_rel) +#define atomic_thread_fence_rel ATOMIC_SAN(thread_fence_rel) +#define atomic_thread_fence_seq_cst ATOMIC_SAN(thread_fence_seq_cst) +#define atomic_interrupt_fence ATOMIC_SAN(interrupt_fence) -#endif /* !KCSAN_RUNTIME */ +#endif /* !SAN_RUNTIME */ #endif /* !_SYS_ATOMIC_SAN_H_ */ diff --git a/sys/sys/bus_san.h b/sys/sys/bus_san.h index 96b2441fbdbe..05d5ecd4b844 100644 --- a/sys/sys/bus_san.h +++ b/sys/sys/bus_san.h @@ -2,12 +2,16 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2019 Andrew Turner + * Copyright (c) 2021 The FreeBSD Foundation * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the * DARPA SSITH research programme. * + * Portions of this software were written by Mark Johnston under sponsorship by + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -35,174 +39,190 @@ #ifndef _SYS_BUS_SAN_H_ #define _SYS_BUS_SAN_H_ -#define KCSAN_BS_MULTI(rw, width, type) \ - void kcsan_bus_space_##rw##_multi_##width(bus_space_tag_t, \ +#ifndef _MACHINE_BUS_H_ +#error do not include this header, use machine/bus.h +#endif + +#ifndef BUS_SAN_PREFIX +#error No sanitizer prefix defined +#endif + +#define BUS_SAN_MULTI(sp, rw, width, type) \ + void sp##_bus_space_##rw##_multi_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type *, bus_size_t); \ - void kcsan_bus_space_##rw##_multi_stream_##width(bus_space_tag_t, \ + void sp##_bus_space_##rw##_multi_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type *, bus_size_t); \ - void kcsan_bus_space_##rw##_region_##width(bus_space_tag_t, \ + void sp##_bus_space_##rw##_region_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type *, bus_size_t); \ - void kcsan_bus_space_##rw##_region_stream_##width(bus_space_tag_t, \ + void sp##_bus_space_##rw##_region_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type *, bus_size_t) -#define KCSAN_BS_READ(width, type) \ - type kcsan_bus_space_read_##width(bus_space_tag_t, \ +#define BUS_SAN_READ(sp, width, type) \ + type sp##_bus_space_read_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t); \ - type kcsan_bus_space_read_stream_##width(bus_space_tag_t, \ + type sp##_bus_space_read_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t); \ - KCSAN_BS_MULTI(read, width, type) + BUS_SAN_MULTI(sp, read, width, type) -#define KCSAN_BS_WRITE(width, type) \ - void kcsan_bus_space_write_##width(bus_space_tag_t, \ +#define BUS_SAN_WRITE(sp, width, type) \ + void sp##_bus_space_write_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type); \ - void kcsan_bus_space_write_stream_##width(bus_space_tag_t, \ + void sp##_bus_space_write_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type); \ - KCSAN_BS_MULTI(write, width, const type) + BUS_SAN_MULTI(sp, write, width, const type) -#define KCSAN_BS_SET(width, type) \ - void kcsan_bus_space_set_multi_##width(bus_space_tag_t, \ +#define BUS_SAN_SET(sp, width, type) \ + void sp##_bus_space_set_multi_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type, bus_size_t); \ - void kcsan_bus_space_set_multi_stream_##width(bus_space_tag_t, \ + void sp##_bus_space_set_multi_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type, bus_size_t); \ - void kcsan_bus_space_set_region_##width(bus_space_tag_t, \ + void sp##_bus_space_set_region_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type, bus_size_t); \ - void kcsan_bus_space_set_region_stream_##width(bus_space_tag_t, \ + void sp##_bus_space_set_region_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type, bus_size_t) -#define KCSAN_BS_COPY(width, type) \ - void kcsan_bus_space_copy_region_##width(bus_space_tag_t, \ +#define BUS_SAN_COPY(sp, width, type) \ + void sp##_bus_space_copy_region_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, bus_space_handle_t, \ bus_size_t, bus_size_t); \ - void kcsan_bus_space_copy_region_stream_##width(bus_space_tag_t, \ + void sp##_bus_space_copy_region_stream_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, bus_space_handle_t, \ bus_size_t, bus_size_t); -#define KCSAN_BS_PEEK(width, type) \ - int kcsan_bus_space_peek_##width(bus_space_tag_t, \ +#define BUS_SAN_PEEK(sp, width, type) \ + int sp##_bus_space_peek_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type *); -#define KCSAN_BS_POKE(width, type) \ - int kcsan_bus_space_poke_##width(bus_space_tag_t, \ +#define BUS_SAN_POKE(sp, width, type) \ + int sp##_bus_space_poke_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type); -#define KCSAN_BS(width, type) \ - KCSAN_BS_READ(width, type); \ - KCSAN_BS_WRITE(width, type); \ - KCSAN_BS_SET(width, type); \ - KCSAN_BS_COPY(width, type) \ - KCSAN_BS_PEEK(width, type); \ - KCSAN_BS_POKE(width, type); - -KCSAN_BS(1, uint8_t); -KCSAN_BS(2, uint16_t); -KCSAN_BS(4, uint32_t); -KCSAN_BS(8, uint64_t); - -int kcsan_bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, - bus_space_handle_t *); -void kcsan_bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); -int kcsan_bus_space_subregion(bus_space_tag_t, bus_space_handle_t, bus_size_t, - bus_size_t, bus_space_handle_t *); -int kcsan_bus_space_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, *** 284 LINES SKIPPED *** From nobody Mon Nov 1 14:49:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6A370183A1A7; Mon, 1 Nov 2021 14:49: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 4HjbXG2QqQz4cR0; Mon, 1 Nov 2021 14:49: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 33BA31389C; Mon, 1 Nov 2021 14:49: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 1A1EnIPp035504; Mon, 1 Nov 2021 14:49:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EnID1035503; Mon, 1 Nov 2021 14:49:18 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:49:18 GMT Message-Id: <202111011449.1A1EnID1035503@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: 065ef8f7832e - main - Add descriptions for WITH_ASAN and WITH_UBSAN List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 065ef8f7832e8722ea07213faa5efc2f4d70aa8d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=065ef8f7832e8722ea07213faa5efc2f4d70aa8d commit 065ef8f7832e8722ea07213faa5efc2f4d70aa8d Author: Ed Maste AuthorDate: 2021-11-01 13:03:14 +0000 Commit: Ed Maste CommitDate: 2021-11-01 14:48:56 +0000 Add descriptions for WITH_ASAN and WITH_UBSAN Reviewed by: jrtc27 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32773 --- tools/build/options/WITH_ASAN | 4 ++++ tools/build/options/WITH_UBSAN | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tools/build/options/WITH_ASAN b/tools/build/options/WITH_ASAN new file mode 100644 index 000000000000..2955434fd167 --- /dev/null +++ b/tools/build/options/WITH_ASAN @@ -0,0 +1,4 @@ +Build the base system with Address Sanitizer (ASan) to detect +memory corruption bugs such as buffer overflows or use-after-free. +Requires that Clang be used as the base system compiler +and that the runtime support library is available. diff --git a/tools/build/options/WITH_UBSAN b/tools/build/options/WITH_UBSAN new file mode 100644 index 000000000000..a27f72c713d7 --- /dev/null +++ b/tools/build/options/WITH_UBSAN @@ -0,0 +1,4 @@ +Build the base system with Undefined Behavior Sanitizer (UBSan) to detect +various kinds of undefined behavior at runtime. +Requires that Clang be used as the base system compiler +and that the runtime support library is available From nobody Mon Nov 1 14:49:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A8142183A305; Mon, 1 Nov 2021 14:49: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 4HjbXH3sq2z4cXn; Mon, 1 Nov 2021 14:49: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 632E21343E; Mon, 1 Nov 2021 14:49: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 1A1EnJ4A035535; Mon, 1 Nov 2021 14:49:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1EnJGv035534; Mon, 1 Nov 2021 14:49:19 GMT (envelope-from git) Date: Mon, 1 Nov 2021 14:49:19 GMT Message-Id: <202111011449.1A1EnJGv035534@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: 0ab89d72aab7 - main - src.conf.5: regen for WITH_ASAN and WITH_UBSAN descriptions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 0ab89d72aab7a6904b6990cb21e0a86afb58342f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0ab89d72aab7a6904b6990cb21e0a86afb58342f commit 0ab89d72aab7a6904b6990cb21e0a86afb58342f Author: Ed Maste AuthorDate: 2021-11-01 13:27:49 +0000 Commit: Ed Maste CommitDate: 2021-11-01 14:48:56 +0000 src.conf.5: regen for WITH_ASAN and WITH_UBSAN descriptions --- share/man/man5/src.conf.5 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 9ba27d393410..61629e32f225 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -106,6 +106,19 @@ Do not build .Xr apm 8 , .Xr apmd 8 and related programs. +.It Va WITH_ASAN +Build the base system with Address Sanitizer (ASan) to detect +memory corruption bugs such as buffer overflows or use-after-free. +Requires that Clang be used as the base system compiler +and that the runtime support library is available. +When set, it enforces these options: +.Pp +.Bl -item -compact +.It +.Va WITH_LLVM_BINUTILS +.It +.Va WITH_LLVM_CXXFILT +.El .It Va WITHOUT_ASSERT_DEBUG Compile programs and libraries without the .Xr assert 3 @@ -1645,6 +1658,11 @@ When set, it enforces these options: .It .Va WITHOUT_LLVM_COV .El +.It Va WITH_UBSAN +Build the base system with Undefined Behavior Sanitizer (UBSan) to detect +various kinds of undefined behavior at runtime. +Requires that Clang be used as the base system compiler +and that the runtime support library is available .It Va WITHOUT_UNBOUND Do not build .Xr unbound 8 From nobody Mon Nov 1 16:35:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1505E17EFCC5; Mon, 1 Nov 2021 16:35: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 4HjdtZ06B8z3lTc; Mon, 1 Nov 2021 16:35: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 D41B514BBB; Mon, 1 Nov 2021 16:35: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 1A1GZHO8081821; Mon, 1 Nov 2021 16:35:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1GZHtY081820; Mon, 1 Nov 2021 16:35:17 GMT (envelope-from git) Date: Mon, 1 Nov 2021 16:35:17 GMT Message-Id: <202111011635.1A1GZHtY081820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: dde6071adcf2 - main - devinfo(8): Remove cross-reference to pnpinfo(8) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dde6071adcf203b185c185289f687c2bd51532fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dde6071adcf203b185c185289f687c2bd51532fb commit dde6071adcf203b185c185289f687c2bd51532fb Author: Felix Johnson AuthorDate: 2021-11-01 16:29:12 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-01 16:29:12 +0000 devinfo(8): Remove cross-reference to pnpinfo(8) devinfo(8) manpage contains reference to pnpinfo(8) which existed at the time. Remove it. PR: 232587 MFC: 3 days Reported by: Graham Perrin --- usr.sbin/devinfo/devinfo.8 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.sbin/devinfo/devinfo.8 b/usr.sbin/devinfo/devinfo.8 index 72fd73dba82c..091248250830 100644 --- a/usr.sbin/devinfo/devinfo.8 +++ b/usr.sbin/devinfo/devinfo.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2017 +.Dd November 1, 2021 .Dt DEVINFO 8 .Os .Sh NAME @@ -75,7 +75,6 @@ back to the root of the device tree. .Xr devinfo 3 , .Xr iostat 8 , .Xr pciconf 8 , -.Xr pnpinfo 8 , .Xr vmstat 8 , .Xr devclass 9 , .Xr device 9 From nobody Mon Nov 1 17:08:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F3A551832DF0; Mon, 1 Nov 2021 17:08: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 4HjfdH6VT6z4Sm2; Mon, 1 Nov 2021 17:08: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 BF0A215354; Mon, 1 Nov 2021 17:08: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 1A1H8pG9024680; Mon, 1 Nov 2021 17:08:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1H8poq024679; Mon, 1 Nov 2021 17:08:51 GMT (envelope-from git) Date: Mon, 1 Nov 2021 17:08:51 GMT Message-Id: <202111011708.1A1H8poq024679@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: 1019354b5416 - main - carp: deal with negative net.inet.carp.demotion List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 1019354b54161c140d10a8203ff1e849c09c8010 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1019354b54161c140d10a8203ff1e849c09c8010 commit 1019354b54161c140d10a8203ff1e849c09c8010 Author: Marius Halden AuthorDate: 2021-10-31 20:18:42 +0000 Commit: Kristof Provost CommitDate: 2021-11-01 16:08:23 +0000 carp: deal with negative net.inet.carp.demotion Given nodes 1 and 2, where node 1 has an advskew of 0 and node 2 has an advskew of 100, making them master and backup respectively. If net.inet.carp.demotion is set to a negative value on node 1, node 2 might become master while node 1 still retains it master status. Wether or not node 2 becomes master seems to depend on the nodes advskew and what the demotion sysctl was set to on node 1. The reason for node 2 becoming master seems to be that the calculated advskew taking demotion into account is truncated to a single unsigned byte when copied into the carp header for sending, and node 1 stays master since it takes uses the whole non-truncated calculated advskew when deciding wether to stay master. PR: 259528 Reviewed by: donner, glebius MFC after: 3 weeks Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32759 --- sys/netinet/ip_carp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 9a551a70c3ad..7554becb974e 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -304,7 +304,9 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_carp, OID_AUTO, stats, struct carpstats, #define DEMOTE_ADVSKEW(sc) \ (((sc)->sc_advskew + V_carp_demotion > CARP_MAXSKEW) ? \ - CARP_MAXSKEW : ((sc)->sc_advskew + V_carp_demotion)) + CARP_MAXSKEW : \ + (((sc)->sc_advskew + V_carp_demotion < 0) ? \ + 0 : ((sc)->sc_advskew + V_carp_demotion))) static void carp_input_c(struct mbuf *, struct carp_header *, sa_family_t); static struct carp_softc From nobody Mon Nov 1 17:08:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 47ECB1832F97; Mon, 1 Nov 2021 17:08: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 4HjfdK16Lkz4T4s; Mon, 1 Nov 2021 17:08: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 D9EAB151E4; Mon, 1 Nov 2021 17:08: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 1A1H8qTl024705; Mon, 1 Nov 2021 17:08:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1H8q50024704; Mon, 1 Nov 2021 17:08:52 GMT (envelope-from git) Date: Mon, 1 Nov 2021 17:08:52 GMT Message-Id: <202111011708.1A1H8q50024704@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: 847b0d07c43c - main - carp tests: negative demotion List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 847b0d07c43c1190f0015c4c93a9e8fd953e3ab5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=847b0d07c43c1190f0015c4c93a9e8fd953e3ab5 commit 847b0d07c43c1190f0015c4c93a9e8fd953e3ab5 Author: Marius Halden AuthorDate: 2021-10-31 20:22:10 +0000 Commit: Kristof Provost CommitDate: 2021-11-01 16:08:23 +0000 carp tests: negative demotion PR: 259528 Reviewed by: donner MFC after: 3 weeks Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32760 --- tests/sys/netinet/carp.sh | 67 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh index 30ae79c93c8d..267e70ebf0dc 100755 --- a/tests/sys/netinet/carp.sh +++ b/tests/sys/netinet/carp.sh @@ -48,6 +48,15 @@ wait_for_carp() done } +carp_init() +{ + if ! kldstat -q -m carp; then + atf_skip "This test requires carp" + fi + + vnet_init +} + atf_test_case "basic_v4" "cleanup" basic_v4_head() { @@ -57,11 +66,8 @@ basic_v4_head() basic_v4_body() { - if ! kldstat -q -m carp; then - atf_skip "This test requires carp" - fi + carp_init - vnet_init bridge=$(vnet_mkbridge) epair_one=$(vnet_mkepair) epair_two=$(vnet_mkepair) @@ -104,11 +110,8 @@ basic_v6_head() basic_v6_body() { - if ! kldstat -q -m carp; then - atf_skip "This test requires carp" - fi + carp_init - vnet_init bridge=$(vnet_mkbridge) epair_one=$(vnet_mkepair) epair_two=$(vnet_mkepair) @@ -145,8 +148,56 @@ basic_v6_cleanup() vnet_cleanup } +atf_test_case "negative_demotion" "cleanup" +negative_demotion_head() +{ + atf_set descr 'Test PR #259528' + atf_set require.user root +} + +negative_demotion_body() +{ + carp_init + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + jexec one sysctl net.inet.carp.preempt=1 + jexec one ifconfig ${epair}a 192.0.2.1/24 up + jexec one ifconfig ${epair}a add vhid 1 192.0.2.254/24 \ + advskew 0 pass foobar + + vnet_mkjail two ${epair}b + jexec two sysctl net.inet.carp.preempt=1 + jexec two ifconfig ${epair}b 192.0.2.2/24 up + jexec two ifconfig ${epair}b add vhid 1 192.0.2.254/24 \ + advskew 100 pass foobar + + # Allow things to settle + wait_for_carp one ${epair}a two ${epair}b + + if is_master one ${epair}a && is_master two ${epair}b + then + atf_fail "Two masters!" + fi + + jexec one sysctl net.inet.carp.demotion=-1 + sleep 3 + + if is_master one ${epair}a && is_master two ${epair}b + then + atf_fail "Two masters!" + fi +} + +negative_demotion_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic_v4" atf_add_test_case "basic_v6" + atf_add_test_case "negative_demotion" } From nobody Mon Nov 1 17:25:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 475E2183B4C8; Mon, 1 Nov 2021 17:25:44 +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 4Hjg0m1cyfz4bXP; Mon, 1 Nov 2021 17:25:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (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 D409028F7F; Mon, 1 Nov 2021 17:25:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Xin LI , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202110310610.19V6A6M9016716@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: f38bef2ce417 - main - Bump __FreeBSD_version following the libdialog shared library version number bump. Message-ID: <21eaa4ed-3ec0-c2e6-7043-e3ebe03db421@FreeBSD.org> Date: Mon, 1 Nov 2021 10:25:41 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202110310610.19V6A6M9016716@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N On 10/30/21 11:10 PM, Xin LI wrote: > The branch main has been updated by delphij: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f38bef2ce417d6270f32b4ed17cec84bfd95d548 > > commit f38bef2ce417d6270f32b4ed17cec84bfd95d548 > Author: Xin LI > AuthorDate: 2021-10-31 06:09:29 +0000 > Commit: Xin LI > CommitDate: 2021-10-31 06:09:29 +0000 > > Bump __FreeBSD_version following the libdialog shared library > version number bump. > --- Oops, thanks. -- John Baldwin From nobody Mon Nov 1 18:35:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 16806183D2BF; Mon, 1 Nov 2021 18:35: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 4HjhYc04s1z3FNL; Mon, 1 Nov 2021 18:35: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 D2E1E16541; Mon, 1 Nov 2021 18:35: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 1A1IZlqw044575; Mon, 1 Nov 2021 18:35:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1IZlJ6044574; Mon, 1 Nov 2021 18:35:47 GMT (envelope-from git) Date: Mon, 1 Nov 2021 18:35:47 GMT Message-Id: <202111011835.1A1IZlJ6044574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a10482ea7476 - main - ktls: Add simple transmit tests of kernel TLS. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a10482ea7476d68d1ab028145ae6d97cef747b49 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a10482ea7476d68d1ab028145ae6d97cef747b49 commit a10482ea7476d68d1ab028145ae6d97cef747b49 Author: John Baldwin AuthorDate: 2021-11-01 18:28:10 +0000 Commit: John Baldwin CommitDate: 2021-11-01 18:28:10 +0000 ktls: Add simple transmit tests of kernel TLS. Note that these tests test the kernel TLS functionality directly. Rather than using OpenSSL to perform negotiation and generate keys, these tests generate random keys send data over a pair of TCP sockets manually decrypting the TLS records generated by the kernel. Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32652 --- tests/sys/kern/Makefile | 2 + tests/sys/kern/ktls_test.c | 1033 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1035 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 6746812d9b4a..ee9decac518c 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -12,6 +12,7 @@ ATF_TESTS_C+= kern_copyin ATF_TESTS_C+= kern_descrip_test ATF_TESTS_C+= fdgrowtable_test ATF_TESTS_C+= kill_zombie +ATF_TESTS_C+= ktls_test ATF_TESTS_C+= ptrace_test TEST_METADATA.ptrace_test+= timeout="15" ATF_TESTS_C+= reaper @@ -46,6 +47,7 @@ LIBADD.sys_getrandom+= pthread LIBADD.ptrace_test+= pthread LIBADD.unix_seqpacket_test+= pthread LIBADD.kcov+= pthread +LIBADD.ktls_test+= crypto LIBADD.sendfile_helper+= pthread LIBADD.fdgrowtable_test+= util pthread kvm procstat diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c new file mode 100644 index 000000000000..908f7f1818a2 --- /dev/null +++ b/tests/sys/kern/ktls_test.c @@ -0,0 +1,1033 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Netflix Inc. + * Written by: John Baldwin + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static void +require_ktls(void) +{ + size_t len; + bool enable; + + len = sizeof(enable); + if (sysctlbyname("kern.ipc.tls.enable", &enable, &len, NULL, 0) == -1) { + if (errno == ENOENT) + atf_tc_skip("kernel does not support TLS offload"); + atf_libc_error(errno, "Failed to read kern.ipc.tls.enable"); + } + + if (!enable) + atf_tc_skip("Kernel TLS is disabled"); +} + +#define ATF_REQUIRE_KTLS() require_ktls() + +static char +rdigit(void) +{ + /* ASCII printable values between 0x20 and 0x7e */ + return (0x20 + random() % (0x7f - 0x20)); +} + +static char * +alloc_buffer(size_t len) +{ + char *buf; + size_t i; + + if (len == 0) + return (NULL); + buf = malloc(len); + for (i = 0; i < len; i++) + buf[i] = rdigit(); + return (buf); +} + +static bool +socketpair_tcp(int *sv) +{ + struct pollfd pfd; + struct sockaddr_in sin; + socklen_t len; + int as, cs, ls; + + ls = socket(PF_INET, SOCK_STREAM, 0); + if (ls == -1) { + warn("socket() for listen"); + return (false); + } + + memset(&sin, 0, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if (bind(ls, (struct sockaddr *)&sin, sizeof(sin)) == -1) { + warn("bind"); + close(ls); + return (false); + } + + if (listen(ls, 1) == -1) { + warn("listen"); + close(ls); + return (false); + } + + len = sizeof(sin); + if (getsockname(ls, (struct sockaddr *)&sin, &len) == -1) { + warn("getsockname"); + close(ls); + return (false); + } + + cs = socket(PF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); + if (cs == -1) { + warn("socket() for connect"); + close(ls); + return (false); + } + + if (connect(cs, (struct sockaddr *)&sin, sizeof(sin)) == -1) { + if (errno != EINPROGRESS) { + warn("connect"); + close(ls); + close(cs); + return (false); + } + } + + as = accept4(ls, NULL, NULL, SOCK_NONBLOCK); + if (as == -1) { + warn("accept4"); + close(ls); + close(cs); + return (false); + } + + close(ls); + + pfd.fd = cs; + pfd.events = POLLOUT; + pfd.revents = 0; + ATF_REQUIRE(poll(&pfd, 1, INFTIM) == 1); + ATF_REQUIRE(pfd.revents == POLLOUT); + + sv[0] = cs; + sv[1] = as; + return (true); +} + +static void +fd_set_blocking(int fd) +{ + int flags; + + ATF_REQUIRE((flags = fcntl(fd, F_GETFL)) != -1); + flags &= ~O_NONBLOCK; + ATF_REQUIRE(fcntl(fd, F_SETFL, flags) != -1); +} + +static bool +cbc_decrypt(const EVP_CIPHER *cipher, const char *key, const char *iv, + const char *input, char *output, size_t size) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) { + warnx("EVP_CIPHER_CTX_new failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + return (false); + } + if (EVP_CipherInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)iv, 0) != 1) { + warnx("EVP_CipherInit_ex failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (EVP_CipherUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) { + warnx("EVP_CipherUpdate failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + total = outl; + if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) { + warnx("EVP_CipherFinal_ex failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + total += outl; + if ((size_t)total != size) { + warnx("decrypt size mismatch: %zu vs %d", size, total); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + EVP_CIPHER_CTX_free(ctx); + return (true); +} + +static bool +verify_hash(const EVP_MD *md, const void *key, size_t key_len, const void *aad, + size_t aad_len, const void *buffer, size_t len, const void *digest) +{ + HMAC_CTX *ctx; + unsigned char digest2[EVP_MAX_MD_SIZE]; + u_int digest_len; + + ctx = HMAC_CTX_new(); + if (ctx == NULL) { + warnx("HMAC_CTX_new failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + return (false); + } + if (HMAC_Init_ex(ctx, key, key_len, md, NULL) != 1) { + warnx("HMAC_Init_ex failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + HMAC_CTX_free(ctx); + return (false); + } + if (HMAC_Update(ctx, aad, aad_len) != 1) { + warnx("HMAC_Update (aad) failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + HMAC_CTX_free(ctx); + return (false); + } + if (HMAC_Update(ctx, buffer, len) != 1) { + warnx("HMAC_Update (payload) failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + HMAC_CTX_free(ctx); + return (false); + } + if (HMAC_Final(ctx, digest2, &digest_len) != 1) { + warnx("HMAC_Final failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + HMAC_CTX_free(ctx); + return (false); + } + HMAC_CTX_free(ctx); + if (memcmp(digest, digest2, digest_len) != 0) { + warnx("HMAC mismatch"); + return (false); + } + return (true); +} + +static bool +aead_decrypt(const EVP_CIPHER *cipher, const char *key, const char *nonce, + const void *aad, size_t aad_len, const char *input, char *output, + size_t size, const char *tag, size_t tag_len) +{ + EVP_CIPHER_CTX *ctx; + int outl, total; + bool valid; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) { + warnx("EVP_CIPHER_CTX_new failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + return (false); + } + if (EVP_DecryptInit_ex(ctx, cipher, NULL, (const u_char *)key, + (const u_char *)nonce) != 1) { + warnx("EVP_DecryptInit_ex failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (aad != NULL) { + if (EVP_DecryptUpdate(ctx, NULL, &outl, (const u_char *)aad, + aad_len) != 1) { + warnx("EVP_DecryptUpdate for AAD failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + } + if (EVP_DecryptUpdate(ctx, (u_char *)output, &outl, + (const u_char *)input, size) != 1) { + warnx("EVP_DecryptUpdate failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + total = outl; + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, + __DECONST(char *, tag)) != 1) { + warnx("EVP_CIPHER_CTX_ctrl(EVP_CTRL_AEAD_SET_TAG) failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + valid = (EVP_DecryptFinal_ex(ctx, (u_char *)output + outl, &outl) == 1); + total += outl; + if ((size_t)total != size) { + warnx("decrypt size mismatch: %zu vs %d", size, total); + EVP_CIPHER_CTX_free(ctx); + return (false); + } + if (!valid) + warnx("tag mismatch"); + EVP_CIPHER_CTX_free(ctx); + return (valid); +} + +static void +build_tls_enable(int cipher_alg, size_t cipher_key_len, int auth_alg, + int minor, uint64_t seqno, struct tls_enable *en) +{ + u_int auth_key_len, iv_len; + + memset(en, 0, sizeof(*en)); + + switch (cipher_alg) { + case CRYPTO_AES_CBC: + if (minor == TLS_MINOR_VER_ZERO) + iv_len = AES_BLOCK_LEN; + else + iv_len = 0; + break; + case CRYPTO_AES_NIST_GCM_16: + if (minor == TLS_MINOR_VER_TWO) + iv_len = TLS_AEAD_GCM_LEN; + else + iv_len = TLS_1_3_GCM_IV_LEN; + break; + case CRYPTO_CHACHA20_POLY1305: + iv_len = TLS_CHACHA20_IV_LEN; + break; + default: + iv_len = 0; + break; + } + switch (auth_alg) { + case CRYPTO_SHA1_HMAC: + auth_key_len = SHA1_HASH_LEN; + break; + case CRYPTO_SHA2_256_HMAC: + auth_key_len = SHA2_256_HASH_LEN; + break; + case CRYPTO_SHA2_384_HMAC: + auth_key_len = SHA2_384_HASH_LEN; + break; + default: + auth_key_len = 0; + break; + } + en->cipher_key = alloc_buffer(cipher_key_len); + en->iv = alloc_buffer(iv_len); + en->auth_key = alloc_buffer(auth_key_len); + en->cipher_algorithm = cipher_alg; + en->cipher_key_len = cipher_key_len; + en->iv_len = iv_len; + en->auth_algorithm = auth_alg; + en->auth_key_len = auth_key_len; + en->tls_vmajor = TLS_MAJOR_VER_ONE; + en->tls_vminor = minor; + be64enc(en->rec_seq, seqno); +} + +static void +free_tls_enable(struct tls_enable *en) +{ + free(__DECONST(void *, en->cipher_key)); + free(__DECONST(void *, en->iv)); + free(__DECONST(void *, en->auth_key)); +} + +static const EVP_CIPHER * +tls_EVP_CIPHER(const struct tls_enable *en) +{ + switch (en->cipher_algorithm) { + case CRYPTO_AES_CBC: + switch (en->cipher_key_len) { + case 128 / 8: + return (EVP_aes_128_cbc()); + case 256 / 8: + return (EVP_aes_256_cbc()); + default: + return (NULL); + } + break; + case CRYPTO_AES_NIST_GCM_16: + switch (en->cipher_key_len) { + case 128 / 8: + return (EVP_aes_128_gcm()); + case 256 / 8: + return (EVP_aes_256_gcm()); + default: + return (NULL); + } + break; + case CRYPTO_CHACHA20_POLY1305: + return (EVP_chacha20_poly1305()); + default: + return (NULL); + } +} + +static const EVP_MD * +tls_EVP_MD(const struct tls_enable *en) +{ + switch (en->auth_algorithm) { + case CRYPTO_SHA1_HMAC: + return (EVP_sha1()); + case CRYPTO_SHA2_256_HMAC: + return (EVP_sha256()); + case CRYPTO_SHA2_384_HMAC: + return (EVP_sha384()); + default: + return (NULL); + } +} + +static size_t +tls_header_len(struct tls_enable *en) +{ + size_t len; + + len = sizeof(struct tls_record_layer); + switch (en->cipher_algorithm) { + case CRYPTO_AES_CBC: + if (en->tls_vminor != TLS_MINOR_VER_ZERO) + len += AES_BLOCK_LEN; + return (len); + case CRYPTO_AES_NIST_GCM_16: + if (en->tls_vminor == TLS_MINOR_VER_TWO) + len += sizeof(uint64_t); + return (len); + case CRYPTO_CHACHA20_POLY1305: + return (len); + default: + return (0); + } +} + +static size_t +tls_mac_len(struct tls_enable *en) +{ + switch (en->cipher_algorithm) { + case CRYPTO_AES_CBC: + switch (en->auth_algorithm) { + case CRYPTO_SHA1_HMAC: + return (SHA1_HASH_LEN); + case CRYPTO_SHA2_256_HMAC: + return (SHA2_256_HASH_LEN); + case CRYPTO_SHA2_384_HMAC: + return (SHA2_384_HASH_LEN); + default: + return (0); + } + case CRYPTO_AES_NIST_GCM_16: + return (AES_GMAC_HASH_LEN); + case CRYPTO_CHACHA20_POLY1305: + return (POLY1305_HASH_LEN); + default: + return (0); + } +} + +/* Includes maximum padding for MTE. */ +static size_t +tls_trailer_len(struct tls_enable *en) +{ + size_t len; + + len = tls_mac_len(en); + if (en->cipher_algorithm == CRYPTO_AES_CBC) + len += AES_BLOCK_LEN; + if (en->tls_vminor == TLS_MINOR_VER_THREE) + len++; + return (len); +} + +/* 'len' is the length of the payload application data. */ +static void +tls_mte_aad(struct tls_enable *en, size_t len, + const struct tls_record_layer *hdr, uint64_t seqno, struct tls_mac_data *ad) +{ + ad->seq = htobe64(seqno); + ad->type = hdr->tls_type; + ad->tls_vmajor = hdr->tls_vmajor; + ad->tls_vminor = hdr->tls_vminor; + ad->tls_length = htons(len); +} + +static void +tls_12_aead_aad(struct tls_enable *en, size_t len, + const struct tls_record_layer *hdr, uint64_t seqno, + struct tls_aead_data *ad) +{ + ad->seq = htobe64(seqno); + ad->type = hdr->tls_type; + ad->tls_vmajor = hdr->tls_vmajor; + ad->tls_vminor = hdr->tls_vminor; + ad->tls_length = htons(len); +} + +static void +tls_13_aad(struct tls_enable *en, const struct tls_record_layer *hdr, + uint64_t seqno, struct tls_aead_data_13 *ad) +{ + ad->type = hdr->tls_type; + ad->tls_vmajor = hdr->tls_vmajor; + ad->tls_vminor = hdr->tls_vminor; + ad->tls_length = hdr->tls_length; +} + +static void +tls_12_gcm_nonce(struct tls_enable *en, const struct tls_record_layer *hdr, + char *nonce) +{ + memcpy(nonce, en->iv, TLS_AEAD_GCM_LEN); + memcpy(nonce + TLS_AEAD_GCM_LEN, hdr + 1, sizeof(uint64_t)); +} + +static void +tls_13_nonce(struct tls_enable *en, uint64_t seqno, char *nonce) +{ + static_assert(TLS_1_3_GCM_IV_LEN == TLS_CHACHA20_IV_LEN, + "TLS 1.3 nonce length mismatch"); + memcpy(nonce, en->iv, TLS_1_3_GCM_IV_LEN); + *(uint64_t *)(nonce + 4) ^= htobe64(seqno); +} + +/* + * Decrypt a TLS record 'len' bytes long at 'src' and store the result at + * 'dst'. If the TLS record header length doesn't match or 'dst' doesn't + * have sufficient room ('avail'), fail the test. + */ +static size_t +decrypt_tls_aes_cbc_mte(struct tls_enable *en, uint64_t seqno, const void *src, + size_t len, void *dst, size_t avail, uint8_t *record_type) +{ + const struct tls_record_layer *hdr; + struct tls_mac_data aad; + const char *iv; + char *buf; + size_t hdr_len, mac_len, payload_len; + int padding; + + hdr = src; + hdr_len = tls_header_len(en); + mac_len = tls_mac_len(en); + ATF_REQUIRE(hdr->tls_vmajor == TLS_MAJOR_VER_ONE); + ATF_REQUIRE(hdr->tls_vminor == en->tls_vminor); + + /* First, decrypt the outer payload into a temporary buffer. */ + payload_len = len - hdr_len; + buf = malloc(payload_len); + if (en->tls_vminor == TLS_MINOR_VER_ZERO) + iv = en->iv; + else + iv = (void *)(hdr + 1); + ATF_REQUIRE(cbc_decrypt(tls_EVP_CIPHER(en), en->cipher_key, iv, + (const u_char *)src + hdr_len, buf, payload_len)); + + /* + * Copy the last encrypted block to use as the IV for the next + * record for TLS 1.0. + */ + if (en->tls_vminor == TLS_MINOR_VER_ZERO) + memcpy(__DECONST(uint8_t *, en->iv), (const u_char *)src + + (len - AES_BLOCK_LEN), AES_BLOCK_LEN); + + /* + * Verify trailing padding and strip. + * + * The kernel always generates the smallest amount of padding. + */ + padding = buf[payload_len - 1] + 1; + ATF_REQUIRE(padding > 0 && padding <= AES_BLOCK_LEN); + ATF_REQUIRE(payload_len >= mac_len + padding); + payload_len -= padding; + + /* Verify HMAC. */ + payload_len -= mac_len; + tls_mte_aad(en, payload_len, hdr, seqno, &aad); + ATF_REQUIRE(verify_hash(tls_EVP_MD(en), en->auth_key, en->auth_key_len, + &aad, sizeof(aad), buf, payload_len, buf + payload_len)); + + ATF_REQUIRE(payload_len <= avail); + memcpy(dst, buf, payload_len); + *record_type = hdr->tls_type; + return (payload_len); +} + +static size_t +decrypt_tls_12_aead(struct tls_enable *en, uint64_t seqno, const void *src, + size_t len, void *dst, uint8_t *record_type) +{ + const struct tls_record_layer *hdr; + struct tls_aead_data aad; + char nonce[12]; + size_t hdr_len, mac_len, payload_len; + + hdr = src; + + hdr_len = tls_header_len(en); + mac_len = tls_mac_len(en); + payload_len = len - (hdr_len + mac_len); + ATF_REQUIRE(hdr->tls_vmajor == TLS_MAJOR_VER_ONE); + ATF_REQUIRE(hdr->tls_vminor == TLS_MINOR_VER_TWO); + + tls_12_aead_aad(en, payload_len, hdr, seqno, &aad); + if (en->cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + tls_12_gcm_nonce(en, hdr, nonce); + else + tls_13_nonce(en, seqno, nonce); + + ATF_REQUIRE(aead_decrypt(tls_EVP_CIPHER(en), en->cipher_key, nonce, + &aad, sizeof(aad), (const char *)src + hdr_len, dst, payload_len, + (const char *)src + hdr_len + payload_len, mac_len)); + + *record_type = hdr->tls_type; + return (payload_len); +} + +static size_t +decrypt_tls_13_aead(struct tls_enable *en, uint64_t seqno, const void *src, + size_t len, void *dst, uint8_t *record_type) +{ + const struct tls_record_layer *hdr; + struct tls_aead_data_13 aad; + char nonce[12]; + char *buf; + size_t hdr_len, mac_len, payload_len; + + hdr = src; + + hdr_len = tls_header_len(en); + mac_len = tls_mac_len(en); + payload_len = len - (hdr_len + mac_len); + ATF_REQUIRE(payload_len >= 1); + ATF_REQUIRE(hdr->tls_type == TLS_RLTYPE_APP); + ATF_REQUIRE(hdr->tls_vmajor == TLS_MAJOR_VER_ONE); + ATF_REQUIRE(hdr->tls_vminor == TLS_MINOR_VER_TWO); + + tls_13_aad(en, hdr, seqno, &aad); + tls_13_nonce(en, seqno, nonce); + + /* + * Have to use a temporary buffer for the output due to the + * record type as the last byte of the trailer. + */ + buf = malloc(payload_len); + + ATF_REQUIRE(aead_decrypt(tls_EVP_CIPHER(en), en->cipher_key, nonce, + &aad, sizeof(aad), (const char *)src + hdr_len, buf, payload_len, + (const char *)src + hdr_len + payload_len, mac_len)); + + /* Trim record type. */ + *record_type = buf[payload_len - 1]; + payload_len--; + + memcpy(dst, buf, payload_len); + free(buf); + + return (payload_len); +} + +static size_t +decrypt_tls_aead(struct tls_enable *en, uint64_t seqno, const void *src, + size_t len, void *dst, size_t avail, uint8_t *record_type) +{ + const struct tls_record_layer *hdr; + size_t payload_len; + + hdr = src; + ATF_REQUIRE(ntohs(hdr->tls_length) + sizeof(*hdr) == len); + + payload_len = len - (tls_header_len(en) + tls_trailer_len(en)); + ATF_REQUIRE(payload_len <= avail); + + if (en->tls_vminor == TLS_MINOR_VER_TWO) { + ATF_REQUIRE(decrypt_tls_12_aead(en, seqno, src, len, dst, + record_type) == payload_len); + } else { + ATF_REQUIRE(decrypt_tls_13_aead(en, seqno, src, len, dst, + record_type) == payload_len); + } + + return (payload_len); +} + +static size_t +decrypt_tls_record(struct tls_enable *en, uint64_t seqno, const void *src, + size_t len, void *dst, size_t avail, uint8_t *record_type) +{ + if (en->cipher_algorithm == CRYPTO_AES_CBC) + return (decrypt_tls_aes_cbc_mte(en, seqno, src, len, dst, avail, + record_type)); + else + return (decrypt_tls_aead(en, seqno, src, len, dst, avail, + record_type)); +} + +static void +test_ktls_transmit_app_data(struct tls_enable *en, uint64_t seqno, size_t len) +{ + struct kevent ev; + struct tls_record_layer *hdr; + char *plaintext, *decrypted, *outbuf; + size_t decrypted_len, outbuf_len, outbuf_cap, record_len, written; + ssize_t rv; + int kq, sockets[2]; + uint8_t record_type; + + plaintext = alloc_buffer(len); + decrypted = malloc(len); + outbuf_cap = tls_header_len(en) + TLS_MAX_MSG_SIZE_V10_2 + + tls_trailer_len(en); + outbuf = malloc(outbuf_cap); + hdr = (struct tls_record_layer *)outbuf; + + ATF_REQUIRE((kq = kqueue()) != -1); + + ATF_REQUIRE_MSG(socketpair_tcp(sockets), "failed to create sockets"); + + ATF_REQUIRE(setsockopt(sockets[1], IPPROTO_TCP, TCP_TXTLS_ENABLE, en, + sizeof(*en)) == 0); + + EV_SET(&ev, sockets[0], EVFILT_READ, EV_ADD, 0, 0, NULL); + ATF_REQUIRE(kevent(kq, &ev, 1, NULL, 0, NULL) == 0); + EV_SET(&ev, sockets[1], EVFILT_WRITE, EV_ADD, 0, 0, NULL); + ATF_REQUIRE(kevent(kq, &ev, 1, NULL, 0, NULL) == 0); + + decrypted_len = 0; + outbuf_len = 0; + written = 0; + + while (decrypted_len != len) { + ATF_REQUIRE(kevent(kq, NULL, 0, &ev, 1, NULL) == 1); + + switch (ev.filter) { + case EVFILT_WRITE: + /* Try to write any remaining data. */ + rv = write(ev.ident, plaintext + written, + len - written); + ATF_REQUIRE_MSG(rv > 0, + "failed to write to socket"); + written += rv; + if (written == len) { + ev.flags = EV_DISABLE; + ATF_REQUIRE(kevent(kq, &ev, 1, NULL, 0, + NULL) == 0); + } + break; + + case EVFILT_READ: + ATF_REQUIRE((ev.flags & EV_EOF) == 0); + + /* + * Try to read data for the next TLS record + * into outbuf. Start by reading the header + * to determine how much additional data to + * read. + */ + if (outbuf_len < sizeof(struct tls_record_layer)) { + rv = read(ev.ident, outbuf + outbuf_len, + sizeof(struct tls_record_layer) - + outbuf_len); + ATF_REQUIRE_MSG(rv > 0, + "failed to read from socket"); + outbuf_len += rv; + } + + if (outbuf_len < sizeof(struct tls_record_layer)) + break; + + record_len = sizeof(struct tls_record_layer) + + ntohs(hdr->tls_length); + assert(record_len <= outbuf_cap); + assert(record_len > outbuf_len); + rv = read(ev.ident, outbuf + outbuf_len, + record_len - outbuf_len); + if (rv == -1 && errno == EAGAIN) + break; + ATF_REQUIRE_MSG(rv > 0, "failed to read from socket"); + + outbuf_len += rv; + if (outbuf_len == record_len) { + decrypted_len += decrypt_tls_record(en, seqno, + outbuf, outbuf_len, + decrypted + decrypted_len, + len - decrypted_len, &record_type); + ATF_REQUIRE(record_type == TLS_RLTYPE_APP); + + seqno++; + outbuf_len = 0; + } + break; + } + } + + ATF_REQUIRE_MSG(written == decrypted_len, + "read %zu decrypted bytes, but wrote %zu", decrypted_len, written); + + ATF_REQUIRE(memcmp(plaintext, decrypted, len) == 0); + + free(outbuf); + free(decrypted); + free(plaintext); + + close(sockets[1]); + close(sockets[0]); + close(kq); +} + +static void +ktls_send_control_message(int fd, uint8_t type, void *data, size_t len) +{ + struct msghdr msg; + struct cmsghdr *cmsg; + char cbuf[CMSG_SPACE(sizeof(type))]; + struct iovec iov; + + memset(&msg, 0, sizeof(msg)); + + msg.msg_control = cbuf; + msg.msg_controllen = sizeof(cbuf); + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = IPPROTO_TCP; + cmsg->cmsg_type = TLS_SET_RECORD_TYPE; + cmsg->cmsg_len = CMSG_LEN(sizeof(type)); + *(uint8_t *)CMSG_DATA(cmsg) = type; + + iov.iov_base = data; + iov.iov_len = len; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + + ATF_REQUIRE(sendmsg(fd, &msg, 0) == (ssize_t)len); +} + +static void +test_ktls_transmit_control(struct tls_enable *en, uint64_t seqno, uint8_t type, + size_t len) +{ + struct tls_record_layer *hdr; + char *plaintext, *decrypted, *outbuf; + size_t outbuf_cap, payload_len, record_len; + ssize_t rv; + int sockets[2]; + uint8_t record_type; + + ATF_REQUIRE(len <= TLS_MAX_MSG_SIZE_V10_2); + + plaintext = alloc_buffer(len); + decrypted = malloc(len); + outbuf_cap = tls_header_len(en) + len + tls_trailer_len(en); + outbuf = malloc(outbuf_cap); + hdr = (struct tls_record_layer *)outbuf; + + ATF_REQUIRE_MSG(socketpair_tcp(sockets), "failed to create sockets"); + + ATF_REQUIRE(setsockopt(sockets[1], IPPROTO_TCP, TCP_TXTLS_ENABLE, en, + sizeof(*en)) == 0); + + fd_set_blocking(sockets[0]); + fd_set_blocking(sockets[1]); + + ktls_send_control_message(sockets[1], type, plaintext, len); + + /* + * First read the header to determine how much additional data + * to read. + */ + rv = read(sockets[0], outbuf, sizeof(struct tls_record_layer)); + ATF_REQUIRE(rv == sizeof(struct tls_record_layer)); + payload_len = ntohs(hdr->tls_length); + record_len = payload_len + sizeof(struct tls_record_layer); + assert(record_len <= outbuf_cap); + rv = read(sockets[0], outbuf + sizeof(struct tls_record_layer), + payload_len); + ATF_REQUIRE(rv == (ssize_t)payload_len); + + rv = decrypt_tls_record(en, seqno, outbuf, record_len, decrypted, len, + &record_type); + + ATF_REQUIRE_MSG((ssize_t)len == rv, + "read %zd decrypted bytes, but wrote %zu", rv, len); + ATF_REQUIRE(record_type == type); + + ATF_REQUIRE(memcmp(plaintext, decrypted, len) == 0); + + free(outbuf); + free(decrypted); + free(plaintext); + + close(sockets[1]); + close(sockets[0]); +} + +#define AES_CBC_TESTS(M) \ + M(aes128_cbc_1_0_sha1, CRYPTO_AES_CBC, 128 / 8, \ + CRYPTO_SHA1_HMAC, TLS_MINOR_VER_ZERO) \ + M(aes256_cbc_1_0_sha1, CRYPTO_AES_CBC, 256 / 8, \ + CRYPTO_SHA1_HMAC, TLS_MINOR_VER_ZERO) \ + M(aes128_cbc_1_1_sha1, CRYPTO_AES_CBC, 128 / 8, \ + CRYPTO_SHA1_HMAC, TLS_MINOR_VER_ONE) \ + M(aes256_cbc_1_1_sha1, CRYPTO_AES_CBC, 256 / 8, \ + CRYPTO_SHA1_HMAC, TLS_MINOR_VER_ONE) \ + M(aes128_cbc_1_2_sha1, CRYPTO_AES_CBC, 128 / 8, \ + CRYPTO_SHA1_HMAC, TLS_MINOR_VER_TWO) \ + M(aes256_cbc_1_2_sha1, CRYPTO_AES_CBC, 256 / 8, \ + CRYPTO_SHA1_HMAC, TLS_MINOR_VER_TWO) \ + M(aes128_cbc_1_2_sha256, CRYPTO_AES_CBC, 128 / 8, \ + CRYPTO_SHA2_256_HMAC, TLS_MINOR_VER_TWO) \ + M(aes256_cbc_1_2_sha256, CRYPTO_AES_CBC, 256 / 8, \ + CRYPTO_SHA2_256_HMAC, TLS_MINOR_VER_TWO) \ + M(aes128_cbc_1_2_sha384, CRYPTO_AES_CBC, 128 / 8, \ + CRYPTO_SHA2_384_HMAC, TLS_MINOR_VER_TWO) \ + M(aes256_cbc_1_2_sha384, CRYPTO_AES_CBC, 256 / 8, \ + CRYPTO_SHA2_384_HMAC, TLS_MINOR_VER_TWO) \ + +#define AES_GCM_TESTS(M) \ *** 97 LINES SKIPPED *** From nobody Mon Nov 1 19:43:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 72EA9183D480; Mon, 1 Nov 2021 19:43: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 4Hjk3f2JYnz3plg; Mon, 1 Nov 2021 19:43: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 2F701174E1; Mon, 1 Nov 2021 19:43: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 1A1JhQjE037704; Mon, 1 Nov 2021 19:43:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1JhQst037703; Mon, 1 Nov 2021 19:43:26 GMT (envelope-from git) Date: Mon, 1 Nov 2021 19:43:26 GMT Message-Id: <202111011943.1A1JhQst037703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Zhilin Subject: git: 9400fe9cf8df - main - Add entry in rtwn_usb(4) for TP-Link Archer T2U Plus List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mizhka X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9400fe9cf8df6744844038db3030ed2fe94e90dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mizhka: URL: https://cgit.FreeBSD.org/src/commit/?id=9400fe9cf8df6744844038db3030ed2fe94e90dd commit 9400fe9cf8df6744844038db3030ed2fe94e90dd Author: Michael Zhilin AuthorDate: 2021-11-01 19:39:50 +0000 Commit: Michael Zhilin CommitDate: 2021-11-01 19:39:50 +0000 Add entry in rtwn_usb(4) for TP-Link Archer T2U Plus This is missing documentation change of D24142. Submitted by: kjopek@gmail.com Reviewed by: gbe Differential Revision: https://reviews.freebsd.org/D25114 --- share/man/man4/rtwn_usb.4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man4/rtwn_usb.4 b/share/man/man4/rtwn_usb.4 index 86c4c02aafa9..aee135eaf5e4 100644 --- a/share/man/man4/rtwn_usb.4 +++ b/share/man/man4/rtwn_usb.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd May 27, 2021 +.Dd November 1, 2021 .Dt RTWN_USB 4 .Os .Sh NAME @@ -49,7 +49,7 @@ kernel configuration file: .Cd "device rtwn_usb" .Cd "device wlan" .Ed -.Sh DESCRIPTION +.SH DESCRIPTION This module provides the USB bus glue needed for the devices supported by the .Xr rtwn 4 @@ -99,6 +99,7 @@ based USB wireless network adapters, including: .It "Realtek RTL8188CUS" Ta RTL8188CUS Ta USB 2.0 .It "Sitecom WLA-7100" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T2U Nano" Ta RTL8821AU Ta USB 2.0 +.It "TP-Link Archer T2U Plus" Ta RTL8821AU Ta USB 2.0 .It "TP-Link Archer T2U v3" Ta RTL8821AU Ta USB 2.0 .It "TP-Link Archer T4U" Ta RTL8812AU Ta USB 3.0 .It "TP-Link Archer T4U v2" Ta RTL8812AU Ta USB 3.0 From nobody Mon Nov 1 19:46:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8956D183DA1A; Mon, 1 Nov 2021 19:46: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 4Hjk6p3TDSz3qR9; Mon, 1 Nov 2021 19:46: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 51E30177A2; Mon, 1 Nov 2021 19:46: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 1A1JkAbq038024; Mon, 1 Nov 2021 19:46:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1JkAVu038023; Mon, 1 Nov 2021 19:46:10 GMT (envelope-from git) Date: Mon, 1 Nov 2021 19:46:10 GMT Message-Id: <202111011946.1A1JkAVu038023@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: 87152f340549 - main - ssh: disble internal security key support in generated config.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 87152f34054921632016bc5eb4ab9f836fbaa522 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=87152f34054921632016bc5eb4ab9f836fbaa522 commit 87152f34054921632016bc5eb4ab9f836fbaa522 Author: Ed Maste AuthorDate: 2021-10-27 20:45:35 +0000 Commit: Ed Maste CommitDate: 2021-11-01 19:45:37 +0000 ssh: disble internal security key support in generated config.h We want to set ENABLE_SK_INTERNAL only when building with USB support. We'll leave it off in config.h and enble it via our bespoke build's Makefile.inc. Sponsored by: The FreeBSD Foundation --- crypto/openssh/freebsd-configure.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/openssh/freebsd-configure.sh b/crypto/openssh/freebsd-configure.sh index d89d536bfd6a..8df468e5eb1c 100755 --- a/crypto/openssh/freebsd-configure.sh +++ b/crypto/openssh/freebsd-configure.sh @@ -12,6 +12,7 @@ configure_args=" --with-libedit --with-ssl-engine --without-xauth + --without-security-key-internal " set -e From nobody Mon Nov 1 20:00:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F16B11844C9A; Mon, 1 Nov 2021 20: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 4HjkR56Wckz4R1P; Mon, 1 Nov 2021 20: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 C01CB17461; Mon, 1 Nov 2021 20: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 1A1K0HOw059386; Mon, 1 Nov 2021 20: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 1A1K0Hs4059375; Mon, 1 Nov 2021 20:00:17 GMT (envelope-from git) Date: Mon, 1 Nov 2021 20:00:17 GMT Message-Id: <202111012000.1A1K0Hs4059375@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: edf6dd82e966 - main - pf: fix use-after-free from pf_find_state_all List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: edf6dd82e9662b72c17483de4de5575dd5acd972 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=edf6dd82e9662b72c17483de4de5575dd5acd972 commit edf6dd82e9662b72c17483de4de5575dd5acd972 Author: Mateusz Guzik AuthorDate: 2021-11-01 13:02:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-01 19:59:05 +0000 pf: fix use-after-free from pf_find_state_all state was returned without any locks nor references held Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 21 +++++++++++++++++++-- sys/netpfil/pf/pf_ioctl.c | 42 +++++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 61eea329a7f7..d7644b47f700 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1510,6 +1510,9 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) return (NULL); } +/* + * Returns with ID hash slot locked on success. + */ struct pf_kstate * pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more) { @@ -1547,14 +1550,17 @@ pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more) second_run: TAILQ_FOREACH(s, &sk->states[idx], key_list[idx]) { if (more == NULL) { + PF_STATE_LOCK(s); PF_HASHROW_UNLOCK(kh); return (s); } if (ret) (*more)++; - else + else { ret = s; + PF_STATE_LOCK(s); + } } if (inout == 1) { inout = 0; @@ -1566,13 +1572,24 @@ second_run: return (ret); } +/* + * FIXME + * This routine is inefficient -- locks the state only to unlock immediately on + * return. + * It is racy -- after the state is unlocked nothing stops other threads from + * removing it. + */ 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); + if (s != NULL) { + PF_STATE_UNLOCK(s); + return (true); + } + return (false); } /* END state table stuff */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index ee265de65b45..1cfedf19e662 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2029,19 +2029,20 @@ 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_kstate *match; + struct pf_kstate *s; int more = 0; - unsigned int killed = 0; - /* Call with unlocked hashrow */ + s = pf_find_state_all(key, dir, &more); + if (s == NULL) + return (0); - match = pf_find_state_all(key, dir, &more); - if (match && !more) { - pf_unlink_state(match, 0); - killed++; + if (more) { + PF_STATE_UNLOCK(s); + return (0); } - return (killed); + pf_unlink_state(s, PF_ENTER_LOCKED); + return (1); } static int @@ -3159,18 +3160,21 @@ DIOCGETSTATESV2_full: key.port[didx] = pnl->dport; state = pf_find_state_all(&key, direction, &m); - - if (m > 1) - error = E2BIG; /* more than one state */ - else if (state != NULL) { - /* XXXGL: not locked read */ - sk = state->key[sidx]; - PF_ACPY(&pnl->rsaddr, &sk->addr[sidx], sk->af); - pnl->rsport = sk->port[sidx]; - PF_ACPY(&pnl->rdaddr, &sk->addr[didx], sk->af); - pnl->rdport = sk->port[didx]; - } else + if (state == NULL) { error = ENOENT; + } else { + if (m > 1) { + PF_STATE_UNLOCK(state); + error = E2BIG; /* more than one state */ + } else { + sk = state->key[sidx]; + PF_ACPY(&pnl->rsaddr, &sk->addr[sidx], sk->af); + pnl->rsport = sk->port[sidx]; + PF_ACPY(&pnl->rdaddr, &sk->addr[didx], sk->af); + pnl->rdport = sk->port[didx]; + PF_STATE_UNLOCK(state); + } + } } break; } From nobody Mon Nov 1 20:00:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 396221844B70; Mon, 1 Nov 2021 20:00: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 4HjkR70wv4z4Qsf; Mon, 1 Nov 2021 20:00: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 E835D17A90; Mon, 1 Nov 2021 20:00: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 1A1K0IIc059911; Mon, 1 Nov 2021 20:00:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1K0IBU059903; Mon, 1 Nov 2021 20:00:18 GMT (envelope-from git) Date: Mon, 1 Nov 2021 20:00:18 GMT Message-Id: <202111012000.1A1K0IBU059903@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: 8f3d786cb301 - main - pf: remove the flags argument from pf_unlink_state List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8f3d786cb301c49dec189bad80cdc163dd3ca1d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8f3d786cb301c49dec189bad80cdc163dd3ca1d7 commit 8f3d786cb301c49dec189bad80cdc163dd3ca1d7 Author: Mateusz Guzik AuthorDate: 2021-11-01 13:14:02 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-01 19:59:14 +0000 pf: remove the flags argument from pf_unlink_state All consumers call it with PF_ENTER_LOCKED. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 4 +--- sys/netpfil/pf/if_pfsync.c | 6 +++--- sys/netpfil/pf/pf.c | 11 ++++------- sys/netpfil/pf/pf_ioctl.c | 10 +++++----- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 9fa1da8b5c07..e9277dce4963 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1915,9 +1915,7 @@ 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_kstate *, u_int); -#define PF_ENTER_LOCKED 0x00000001 -#define PF_RETURN_LOCKED 0x00000002 +extern int pf_unlink_state(struct pf_kstate *); extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index e959fdbc8553..1aa5e6c0b066 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -759,7 +759,7 @@ relock: LIST_FOREACH(s, &ih->states, entry) { if (s->creatorid == creatorid) { s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); goto relock; } } @@ -1118,7 +1118,7 @@ pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) continue; } st->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(st, PF_ENTER_LOCKED); + pf_unlink_state(st); } return (len); @@ -1150,7 +1150,7 @@ pfsync_in_del_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) } st->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(st, PF_ENTER_LOCKED); + pf_unlink_state(st); } return (len); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d7644b47f700..9595650dbc36 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1995,14 +1995,11 @@ pf_src_tree_remove_state(struct pf_kstate *s) * unlocked, since it needs to go through key hash locking. */ int -pf_unlink_state(struct pf_kstate *s, u_int flags) +pf_unlink_state(struct pf_kstate *s) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; - if ((flags & PF_ENTER_LOCKED) == 0) - PF_HASHROW_LOCK(ih); - else - PF_HASHROW_ASSERT(ih); + PF_HASHROW_ASSERT(ih); if (s->timeout == PFTM_UNLINKED) { /* @@ -2091,7 +2088,7 @@ relock: LIST_FOREACH(s, &ih->states, entry) { if (pf_state_expires(s) <= time_uptime) { V_pf_status.states -= - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); goto relock; } s->rule.ptr->rule_ref |= PFRULE_REFS; @@ -4992,7 +4989,7 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } /* XXX make sure it's the same direction ?? */ pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); - pf_unlink_state(*state, PF_ENTER_LOCKED); + pf_unlink_state(*state); *state = NULL; return (PF_DROP); } diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 1cfedf19e662..727ebb0135f4 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2041,7 +2041,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) return (0); } - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); return (1); } @@ -2138,7 +2138,7 @@ relock_DIOCKILLSTATES: match_key.port[1] = s->key[idx]->port[0]; } - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); killed++; if (psk->psk_kill_match) @@ -5040,7 +5040,7 @@ relock: s->timeout = PFTM_PURGE; /* Don't send out individual delete messages. */ s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); goto relock; } PF_HASHROW_UNLOCK(ih); @@ -5227,7 +5227,7 @@ relock_DIOCCLRSTATES: * delete messages. */ s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); killed++; if (kill->psk_kill_match) @@ -5255,7 +5255,7 @@ pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) kill->psk_pfcmp.creatorid = V_pf_status.hostid; if ((s = pf_find_state_byid(kill->psk_pfcmp.id, kill->psk_pfcmp.creatorid))) { - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); *killed = 1; } return; From nobody Mon Nov 1 20:44:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 82272182C285 for ; Mon, 1 Nov 2021 20:44: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 4HjlPr0ByDz4hKr; Mon, 1 Nov 2021 20:44: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 CEFCB1822C; Mon, 1 Nov 2021 20:44: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 1A1KiF39017844; Mon, 1 Nov 2021 20:44:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1KiFVO017843; Mon, 1 Nov 2021 20:44:15 GMT (envelope-from git) Date: Mon, 1 Nov 2021 20:44:15 GMT Message-Id: <202111012044.1A1KiFVO017843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: eadd7a1c9dbc - internal/admin - Safekeep src bit of will@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: eadd7a1c9dbcb17a87d3121b788efe78ca20b602 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=eadd7a1c9dbcb17a87d3121b788efe78ca20b602 commit eadd7a1c9dbcb17a87d3121b788efe78ca20b602 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-01 20:42:46 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-01 20:42:46 +0000 Safekeep src bit of will@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 47474db33492..22a6418669b0 100644 --- a/access +++ b/access @@ -203,7 +203,6 @@ uqs vangyzen vmaffione whu -will wma wosch wulf From nobody Mon Nov 1 21:30:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 225C31822C0B for ; Mon, 1 Nov 2021 21:30: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 4HjmRj4Rbxz4wmw; Mon, 1 Nov 2021 21:30: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 740F018E00; Mon, 1 Nov 2021 21:30: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 1A1LUvTr083676; Mon, 1 Nov 2021 21:30:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1LUv6A083675; Mon, 1 Nov 2021 21:30:57 GMT (envelope-from git) Date: Mon, 1 Nov 2021 21:30:57 GMT Message-Id: <202111012130.1A1LUv6A083675@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 1a3e8ade00b7 - internal/admin - Safekeep src bit of davidcs@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 1a3e8ade00b7ba9bc542744c7a52adb13baa8998 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1a3e8ade00b7ba9bc542744c7a52adb13baa8998 commit 1a3e8ade00b7ba9bc542744c7a52adb13baa8998 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-01 21:29:45 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-01 21:29:45 +0000 Safekeep src bit of davidcs@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 22a6418669b0..35ae94dc0338 100644 --- a/access +++ b/access @@ -53,7 +53,6 @@ csjp cy dab daichi -davidcs dchagin delphij des From nobody Mon Nov 1 21:33:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D66BE1823A96 for ; Mon, 1 Nov 2021 21:33: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 4HjmVD2WY7z502d; Mon, 1 Nov 2021 21: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 EC0B418B5F; Mon, 1 Nov 2021 21:33: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 1A1LX7eq085751; Mon, 1 Nov 2021 21:33:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1LX7h5085750; Mon, 1 Nov 2021 21:33:07 GMT (envelope-from git) Date: Mon, 1 Nov 2021 21:33:07 GMT Message-Id: <202111012133.1A1LX7h5085750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 2d6c0cf18d14 - internal/admin - Safekeep src bit of cracauer@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 2d6c0cf18d14b4d49a53b17706a870f6d5fcf537 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2d6c0cf18d14b4d49a53b17706a870f6d5fcf537 commit 2d6c0cf18d14b4d49a53b17706a870f6d5fcf537 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-01 21:32:21 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-01 21:32:21 +0000 Safekeep src bit of cracauer@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 35ae94dc0338..3dce4800fb12 100644 --- a/access +++ b/access @@ -48,7 +48,6 @@ chs chuck cognet cperciva -cracauer csjp cy dab From nobody Mon Nov 1 21:44:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3B68C182AA1C for ; Mon, 1 Nov 2021 21:44: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 4Hjmkx19Fpz54QH; Mon, 1 Nov 2021 21:44: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 085E619224; Mon, 1 Nov 2021 21:44: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 1A1Li8FL099432; Mon, 1 Nov 2021 21:44:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1Li82r099431; Mon, 1 Nov 2021 21:44:08 GMT (envelope-from git) Date: Mon, 1 Nov 2021 21:44:08 GMT Message-Id: <202111012144.1A1Li82r099431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 552849c1378c - internal/admin - Safekeep src bit of bwidawsk@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 552849c1378c3132af37d5a1ac5803edce3a5e95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=552849c1378c3132af37d5a1ac5803edce3a5e95 commit 552849c1378c3132af37d5a1ac5803edce3a5e95 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-01 21:43:21 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-01 21:43:21 +0000 Safekeep src bit of bwidawsk@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 3dce4800fb12..6f6de130e30d 100644 --- a/access +++ b/access @@ -41,7 +41,6 @@ brd brooks brueffer bryanv -bwidawsk bz cem chs From nobody Mon Nov 1 21:46:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 14A78182AF22 for ; Mon, 1 Nov 2021 21:46: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 4Hjmn85NBRz54fc; Mon, 1 Nov 2021 21:46: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 6636E19225; Mon, 1 Nov 2021 21:46: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 1A1Lk4vL099679; Mon, 1 Nov 2021 21:46:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1Lk4bi099678; Mon, 1 Nov 2021 21:46:04 GMT (envelope-from git) Date: Mon, 1 Nov 2021 21:46:04 GMT Message-Id: <202111012146.1A1Lk4bi099678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 466ea7240338 - internal/admin - Safekeep src bit of kadesai@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 466ea72403381a6b2e22c17c582e0c093352f141 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=466ea72403381a6b2e22c17c582e0c093352f141 commit 466ea72403381a6b2e22c17c582e0c093352f141 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-01 21:45:14 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-01 21:45:14 +0000 Safekeep src bit of kadesai@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 6f6de130e30d..64d59a92aeb2 100644 --- a/access +++ b/access @@ -102,7 +102,6 @@ joerg freebsd-devel@uriah.heep.sax.de jrtc27 jtl julian -kadesai kaktus karels ken From nobody Mon Nov 1 21:48:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 37E5B182C1CB for ; Mon, 1 Nov 2021 21:48: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 4HjmrM0jBfz56j0; Mon, 1 Nov 2021 21:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E523818B74; Mon, 1 Nov 2021 21:48: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 1A1LmoFW099972; Mon, 1 Nov 2021 21:48:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1Lmo0Q099971; Mon, 1 Nov 2021 21:48:50 GMT (envelope-from git) Date: Mon, 1 Nov 2021 21:48:50 GMT Message-Id: <202111012148.1A1Lmo0Q099971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 8649d82a3a40 - internal/admin - Safekeep src bit of smh@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 8649d82a3a400045286b85a01965a3a5844a34f6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8649d82a3a400045286b85a01965a3a5844a34f6 commit 8649d82a3a400045286b85a01965a3a5844a34f6 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-01 21:48:02 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-01 21:48:02 +0000 Safekeep src bit of smh@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 64d59a92aeb2..275def0e150c 100644 --- a/access +++ b/access @@ -180,7 +180,6 @@ sgalabov shurd sjg slavash -smh sobomax stevek syrinx From nobody Mon Nov 1 23:11:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 182E31833452; Mon, 1 Nov 2021 23:11: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 4Hjph00FS2z3mqD; Mon, 1 Nov 2021 23:11: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 DD17E1A504; Mon, 1 Nov 2021 23:11: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 1A1NBhuA014892; Mon, 1 Nov 2021 23:11:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1NBhJh014891; Mon, 1 Nov 2021 23:11:43 GMT (envelope-from git) Date: Mon, 1 Nov 2021 23:11:43 GMT Message-Id: <202111012311.1A1NBhJh014891@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: 8e2796878626 - main - inet: remove tcp_debug from netinet/tcp_debug.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8e2796878626ccc2fc15e4911a16af8a9fa7819a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8e2796878626ccc2fc15e4911a16af8a9fa7819a commit 8e2796878626ccc2fc15e4911a16af8a9fa7819a Author: Mateusz Guzik AuthorDate: 2021-11-01 21:28:54 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-01 23:10:30 +0000 inet: remove tcp_debug from netinet/tcp_debug.h It was a hack only needed for trpt, which can just define it locally. This makes it possible to fix up systat which also includes the file. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netinet/tcp_debug.h | 6 ------ usr.sbin/trpt/trpt.c | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/netinet/tcp_debug.h b/sys/netinet/tcp_debug.h index c44930724b66..0b3c895e9909 100644 --- a/sys/netinet/tcp_debug.h +++ b/sys/netinet/tcp_debug.h @@ -73,10 +73,4 @@ static const char *tanames[] = #define TCP_NDEBUG 100 -#ifndef _KERNEL -/* XXX common variables for broken applications. */ -struct tcp_debug tcp_debug[TCP_NDEBUG]; -int tcp_debx; -#endif - #endif /* !_NETINET_TCP_DEBUG_H_ */ diff --git a/usr.sbin/trpt/trpt.c b/usr.sbin/trpt/trpt.c index e8198f7d080e..59727cadaaba 100644 --- a/usr.sbin/trpt/trpt.c +++ b/usr.sbin/trpt/trpt.c @@ -85,6 +85,9 @@ __FBSDID("$FreeBSD$"); #include #include +static struct tcp_debug tcp_debug[TCP_NDEBUG]; +static int tcp_debx; + static struct nlist nl[3]; #define N_TCP_DEBUG 0 #define N_TCP_DEBX 1 From nobody Mon Nov 1 23:11:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5954F18333A6; Mon, 1 Nov 2021 23:11: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 4Hjph11dR4z3mZ4; Mon, 1 Nov 2021 23:11: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 106DA19FF6; Mon, 1 Nov 2021 23:11: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 1A1NBidA014916; Mon, 1 Nov 2021 23:11:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1NBivv014915; Mon, 1 Nov 2021 23:11:44 GMT (envelope-from git) Date: Mon, 1 Nov 2021 23:11:44 GMT Message-Id: <202111012311.1A1NBivv014915@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: 6d88f9fed6a2 - main - systat: mostly clean up warns List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6d88f9fed6a2aa1ffd2c856d246209f24b7dbea0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=6d88f9fed6a2aa1ffd2c856d246209f24b7dbea0 commit 6d88f9fed6a2aa1ffd2c856d246209f24b7dbea0 Author: Mateusz Guzik AuthorDate: 2021-11-01 20:45:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-01 23:11:16 +0000 systat: mostly clean up warns Sponsored by: Rubicon Communications, LLC ("Netgate") --- usr.bin/systat/Makefile | 4 ++-- usr.bin/systat/devs.c | 10 +++++----- usr.bin/systat/extern.h | 5 +++++ usr.bin/systat/ifstat.c | 35 +++++++++++++---------------------- usr.bin/systat/main.c | 12 ++++++------ usr.bin/systat/netstat.c | 2 +- usr.bin/systat/proc.c | 30 ++++++++---------------------- usr.bin/systat/sysput.c | 36 +++++++++++++++++++++--------------- usr.bin/systat/vmstat.c | 16 ++++------------ 9 files changed, 65 insertions(+), 85 deletions(-) diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile index 58b6c855d6af..e0575ff0d15a 100644 --- a/usr.bin/systat/Makefile +++ b/usr.bin/systat/Makefile @@ -14,8 +14,8 @@ SRCS+= icmp6.c ip6.c CFLAGS+= -DINET6 .endif -WARNS?= 1 - LIBADD= tinfow ncursesw m devstat kvm util procstat .include + +CFLAGS+= -Wno-cast-align -Wno-cast-qual diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c index 87d04f989ea3..63990bab5f81 100644 --- a/usr.bin/systat/devs.c +++ b/usr.bin/systat/devs.c @@ -86,16 +86,16 @@ typedef enum { struct statinfo cur_dev, last_dev, run_dev; -last_match_type last_type; +static last_match_type last_type; struct device_selection *dev_select; long generation; int num_devices, num_selected; int num_selections; long select_generation; -struct devstat_match *matches = NULL; -int num_matches = 0; -char **specified_devices; -int num_devices_specified = 0; +static struct devstat_match *matches = NULL; +static int num_matches = 0; +static char **specified_devices; +static int num_devices_specified = 0; static int dsmatchselect(const char *args, devstat_select_mode select_mode, int maxshowdevs, struct statinfo *s1); diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h index 322065f79312..3b5597598b8b 100644 --- a/usr.bin/systat/extern.h +++ b/usr.bin/systat/extern.h @@ -58,6 +58,11 @@ extern int protos; extern int verbose; extern unsigned int delay; +extern int curscale; +extern char *matchline; +extern int showpps; +extern int needsort; + struct in_conninfo; extern struct device_selection *dev_select; diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c index 82e3429dbfda..c97e586ae7a3 100644 --- a/usr.bin/systat/ifstat.c +++ b/usr.bin/systat/ifstat.c @@ -56,15 +56,11 @@ #define C4 60 /* 60-80 */ #define C5 80 /* Used for label positioning. */ -static const int col0 = 0; -static const int col1 = C1; static const int col2 = C2; static const int col3 = C3; static const int col4 = C4; -static const int col5 = C5; -SLIST_HEAD(, if_stat) curlist; -SLIST_HEAD(, if_stat_disp) displist; +static SLIST_HEAD(, if_stat) curlist; struct if_stat { SLIST_ENTRY(if_stat) link; @@ -87,11 +83,6 @@ struct if_stat { u_int match; }; -extern int curscale; -extern char *matchline; -extern int showpps; -extern int needsort; - static int needclear = 0; static bool displayall = false; @@ -217,19 +208,19 @@ showifstat(void) struct if_stat *ifp = NULL; SLIST_FOREACH(ifp, &curlist, link) { - if (ifp->if_ypos < LINES - 3 && ifp->if_ypos != -1) + if (ifp->if_ypos < LINES - 3 && ifp->if_ypos != -1) { if (!ifp->display || ifp->match == 0) { wmove(wnd, ifp->if_ypos, 0); wclrtoeol(wnd); wmove(wnd, ifp->if_ypos + 1, 0); wclrtoeol(wnd); - } - else { + } else { PUTNAME(ifp); PUTRATE(col2, ifp->if_ypos); PUTRATE(col3, ifp->if_ypos); PUTTOTAL(col4, ifp->if_ypos); } + } } return; @@ -390,9 +381,9 @@ format_device_name(struct if_stat *ifp) static int check_match(const char *ifname) { - char *p = matchline, *c, t; + char *p = matchline, *ch, t; int match = 0, mlen; - + if (matchline == NULL) return (0); @@ -400,21 +391,21 @@ check_match(const char *ifname) while (*p == ' ') p ++; - c = p; - while ((mlen = strcspn(c, " ;,")) != 0) { - p = c + mlen; + ch = p; + while ((mlen = strcspn(ch, " ;,")) != 0) { + p = ch + mlen; t = *p; - if (p - c > 0) { + if (p - ch > 0) { *p = '\0'; - if (fnmatch(c, ifname, FNM_CASEFOLD) == 0) { + if (fnmatch(ch, ifname, FNM_CASEFOLD) == 0) { *p = t; return (1); } *p = t; - c = p + strspn(p, " ;,"); + ch = p + strspn(p, " ;,"); } else { - c = p + strspn(p, " ;,"); + ch = p + strspn(p, " ;,"); } } diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index b84351379f41..3266fa187714 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -38,7 +38,7 @@ static const char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif #ifndef lint -static const char copyright[] = +static const char copyright[] __unused = "@(#) Copyright (c) 1980, 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif @@ -65,12 +65,11 @@ static const char copyright[] = static int dellave; kvm_t *kd; -sig_t sigtstpdfl; double avenrun[3]; int col; unsigned int delay = 5000000; /* in microseconds */ int verbose = 1; /* to report kvm read errs */ -struct clockinfo clkinfo; +static struct clockinfo clkinfo; double hertz; char c; char *namp; @@ -86,7 +85,7 @@ struct cmdentry { char *cmd; /* Command name */ char *argv; /* Arguments vector for a command */ }; -SLIST_HEAD(, cmdentry) commands; +static SLIST_HEAD(, cmdentry) commands; static void parse_cmd_args (int argc, char **argv) @@ -277,6 +276,7 @@ void display(void) { uint64_t arc_stat; + unsigned int ui; int i, j; /* Get the load average over the last minute. */ @@ -316,8 +316,8 @@ display(void) GETSYSCTL("kstat.zfs.misc.arcstats.dbuf_size", arc_stat); arc[6] += arc_stat; wmove(wload, 0, 0); wclrtoeol(wload); - for (i = 0 ; i < nitems(arc); i++) - sysputuint64(wload, 0, i*8+2, 6, arc[i], 0); + for (ui = 0 ; ui < nitems(arc); ui++) + sysputuint64(wload, 0, ui*8+2, 6, arc[ui], 0); } } (*curcmd->c_refresh)(); diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index a334e03beb5a..8199d0c81586 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -115,7 +115,7 @@ struct netinfo { u_int ni_sndcc; /* snd buffer character count */ }; -TAILQ_HEAD(netinfohead, netinfo) netcb = TAILQ_HEAD_INITIALIZER(netcb); +static TAILQ_HEAD(netinfohead, netinfo) netcb = TAILQ_HEAD_INITIALIZER(netcb); static int aflag = 0; static int nflag = 0; diff --git a/usr.bin/systat/proc.c b/usr.bin/systat/proc.c index 58c3bea64239..deb27fc2f4bb 100644 --- a/usr.bin/systat/proc.c +++ b/usr.bin/systat/proc.c @@ -64,14 +64,14 @@ static struct proc_usage { uint64_t total; uint32_t pages; } **pu = NULL; -static unsigned int nproc; +static int nproc; static int proc_compar(const void *, const void *); static void display_proc_line(int idx, int y, uint64_t totalswappages) { int offset = 0, rate; - const char *uname, *pname; + const char *uname; char buf[30]; uint64_t swapbytes; @@ -210,25 +210,11 @@ per_proc_swap_usage(struct kinfo_proc *kipp) } void -closeproc(WINDOW *w) -{ - - if (prstat != NULL) - procstat_close(prstat); - prstat = NULL; - if (w == NULL) - return; - wclear(w); - wrefresh(w); - delwin(w); -} - -void -procshow(int col, int hight, uint64_t totalswappages) +procshow(int lcol, int hight, uint64_t totalswappages) { int i, y; - for (i = 0, y = col + 1 /* HEADING */; i < hight; i++, y++) + for (i = 0, y = lcol + 1 /* HEADING */; i < hight; i++, y++) display_proc_line(i, y, totalswappages); } @@ -244,7 +230,7 @@ procinit(void) void procgetinfo(void) { - static unsigned int maxnproc = 0; + static int maxnproc = 0; int cnt, i; uint32_t pages; struct kinfo_proc *kipp; @@ -289,12 +275,12 @@ procgetinfo(void) } void -proclabel(int col) +proclabel(int lcol) { - wmove(wnd, col, 0); + wmove(wnd, lcol, 0); wclrtoeol(wnd); - mvwaddstr(wnd, col, 0, + mvwaddstr(wnd, lcol, 0, "Pid Username Command Swap/Total " "Per-Process Per-System"); } diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index 6e14f9eb752f..bccc00f65165 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -41,36 +41,42 @@ __FBSDID("$FreeBSD$"); #include "extern.h" void -sysputspaces(WINDOW *wd, int row, int col, int width) +sysputspaces(WINDOW *wd, int row, int lcol, int width) { static char str60[] = " " " "; - mvwaddstr(wd, row, col, str60 + sizeof(str60) - width - 1); + mvwaddstr(wd, row, lcol, str60 + sizeof(str60) - width - 1); } void -sysputstrs(WINDOW *wd, int row, int col, int width) +sysputstrs(WINDOW *wd __unused, int row, int lcol, int width) { static char str60[] = "********************" "****************************************"; - mvwaddstr(wnd, row, col, str60 + sizeof(str60) - width - 1); + /* + * XXX wnd instead of wd? + */ + mvwaddstr(wnd, row, lcol, str60 + sizeof(str60) - width - 1); } void -sysputXs(WINDOW *wd, int row, int col, int width) +sysputXs(WINDOW *wd __unused, int row, int lcol, int width) { static char str60[] = "XXXXXXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; - mvwaddstr(wnd, row, col, str60 + sizeof(str60) - width - 1); + /* + * XXX wnd instead of wd? + */ + mvwaddstr(wnd, row, lcol, str60 + sizeof(str60) - width - 1); } void -sysputuint64(WINDOW *wd, int row, int col, int width, uint64_t val, int flags) +sysputuint64(WINDOW *wd, int row, int lcol, int width, uint64_t val, int flags) { - char unit, *ptr, *start, wrtbuf[width + width + 1]; + char unit, *start, wrtbuf[width + width + 1]; int len; unit = 0; @@ -88,25 +94,25 @@ sysputuint64(WINDOW *wd, int row, int col, int width, uint64_t val, int flags) memset(wrtbuf + len, ' ', width - len); start += len; - mvwaddstr(wd, row, col, start); + mvwaddstr(wd, row, lcol, start); return; error: - sysputstrs(wd, row, col, width); + sysputstrs(wd, row, lcol, width); } void -sysputwuint64(WINDOW *wd, int row, int col, int width, uint64_t val, int flags) +sysputwuint64(WINDOW *wd, int row, int lcol, int width, uint64_t val, int flags) { if(val == 0) - sysputspaces(wd, row, col, width); + sysputspaces(wd, row, lcol, width); else - sysputuint64(wd, row, col, width, val, flags); + sysputuint64(wd, row, lcol, width, val, flags); } void -sysputpage(WINDOW *wd, int row, int col, int width, uint64_t pages, int flags) +sysputpage(WINDOW *wd, int row, int lcol, int width, uint64_t pages, int flags) { - sysputuint64(wd, row, col, width, ptoa(pages), flags); + sysputuint64(wd, row, lcol, width, ptoa(pages), flags); } diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index e84b79bdd184..57697284a6ab 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -136,7 +136,6 @@ static void copyinfo(struct Info *, struct Info *); static float cputime(int); static void do_putuint64(uint64_t, int, int, int, int); static void getinfo(struct Info *); -static void putuint64(uint64_t, int, int, int); static int ucount(void); static int ncpu; @@ -298,7 +297,7 @@ fetchkre(void) void labelkre(void) { - int i, j; + int i; clear(); mvprintw(STATROW, STATCOL + 6, "users Load"); @@ -634,19 +633,12 @@ putint(int n, int l, int lc, int w) do_putuint64(n, l, lc, w, SI); } -static void -putuint64(uint64_t n, int l, int lc, int w) -{ - - do_putuint64(n, l, lc, w, IEC); -} - static void do_putuint64(uint64_t n, int l, int lc, int w, int div) { int snr; char b[128]; - char buf[128]; + char lbuf[128]; move(l, lc); #ifdef DEBUG @@ -661,9 +653,9 @@ do_putuint64(uint64_t n, int l, int lc, int w, int div) } snr = snprintf(b, sizeof(b), "%*ju", w, (uintmax_t)n); if (snr != w) { - humanize_number(buf, w, n, "", HN_AUTOSCALE, + humanize_number(lbuf, w, n, "", HN_AUTOSCALE, HN_NOSPACE | HN_DECIMAL | div); - snr = snprintf(b, sizeof(b), "%*s", w, buf); + snr = snprintf(b, sizeof(b), "%*s", w, lbuf); } if (snr != w) { while (w-- > 0) From nobody Mon Nov 1 23:59:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 278681820CB1; Mon, 1 Nov 2021 23:59: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 4Hjqkn0Yzgz4WQq; Mon, 1 Nov 2021 23:59: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 E31931AC16; Mon, 1 Nov 2021 23:59: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 1A1NxCfE071902; Mon, 1 Nov 2021 23:59:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A1NxCw6071901; Mon, 1 Nov 2021 23:59:12 GMT (envelope-from git) Date: Mon, 1 Nov 2021 23:59:12 GMT Message-Id: <202111012359.1A1NxCw6071901@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: 932c2667d9bc - main - systat: fix stack overflow when running -iostat List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 932c2667d9bca62ad5f03757775ebe8aa743cfd8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=932c2667d9bca62ad5f03757775ebe8aa743cfd8 commit 932c2667d9bca62ad5f03757775ebe8aa743cfd8 Author: Mateusz Guzik AuthorDate: 2021-11-01 23:55:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-01 23:57:27 +0000 systat: fix stack overflow when running -iostat The new buffer is arbitrarily sized to likely "big enough". Sponsored by: Rubicon Communications, LLC ("Netgate") --- usr.bin/systat/iostat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c index 8767a046d81a..e3d577507e08 100644 --- a/usr.bin/systat/iostat.c +++ b/usr.bin/systat/iostat.c @@ -185,7 +185,7 @@ static int numlabels(int row) { int i, _col, regions, ndrives; - char tmpstr[10]; + char tmpstr[32]; #define COLWIDTH 17 #define DRIVESPERLINE ((getmaxx(wnd) - 1 - INSET) / COLWIDTH) @@ -211,7 +211,7 @@ numlabels(int row) if (row > getmaxy(wnd) - 1 - (linesperregion + 1)) break; } - sprintf(tmpstr, "%s%d", dev_select[i].device_name, + snprintf(tmpstr, sizeof(tmpstr), "%s%d", dev_select[i].device_name, dev_select[i].unit_number); mvwaddstr(wnd, row, _col + 4, tmpstr); mvwaddstr(wnd, row + 1, _col, " KB/t tps MB/s "); @@ -226,7 +226,7 @@ static int barlabels(int row) { int i; - char tmpstr[10]; + char tmpstr[32]; mvwaddstr(wnd, row++, INSET, "/0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100"); @@ -235,7 +235,7 @@ barlabels(int row) if (dev_select[i].selected) { if (row > getmaxy(wnd) - 1 - linesperregion) break; - sprintf(tmpstr, "%s%d", dev_select[i].device_name, + snprintf(tmpstr, sizeof(tmpstr), "%s%d", dev_select[i].device_name, dev_select[i].unit_number); mvwprintw(wnd, row++, 0, "%-5.5s MB/s|", tmpstr); From nobody Tue Nov 2 00:24:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D308D182BB21; Tue, 2 Nov 2021 00:24: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 4HjrJH5QNtz4ckD; Tue, 2 Nov 2021 00:24: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 95BAF1B24D; Tue, 2 Nov 2021 00:24: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 1A20Olhi011758; Tue, 2 Nov 2021 00:24:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A20OlxE011757; Tue, 2 Nov 2021 00:24:47 GMT (envelope-from git) Date: Tue, 2 Nov 2021 00:24:47 GMT Message-Id: <202111020024.1A20OlxE011757@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: aac9d07f9314 - stable/13 - sleepqueue(9): Remove sbinuptime() from sleepq_timeout(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: aac9d07f9314d518996b63427b223be455869333 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=aac9d07f9314d518996b63427b223be455869333 commit aac9d07f9314d518996b63427b223be455869333 Author: Alexander Motin AuthorDate: 2021-10-03 00:57:55 +0000 Commit: Alexander Motin CommitDate: 2021-11-02 00:24:07 +0000 sleepqueue(9): Remove sbinuptime() from sleepq_timeout(). Callout c_time is always bigger or equal than the scheduled time. It is also smaller than sbinuptime() and can't change while the callback is running. So we reliably can use it instead of sbinuptime() here. In case there was a race and the callout was rescheduled to the later time, the callback will be called again. According to profiles it saves ~5% of the timer interrupt time even with fast TSC timecounter. MFC after: 1 month (cherry picked from commit 6df1359e5542f69179c142be1ea099d447e273d1) --- sys/kern/subr_sleepqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 73aef9890647..36832ef96ba4 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -1040,7 +1040,8 @@ sleepq_timeout(void *arg) (void *)td, (long)td->td_proc->p_pid, (void *)td->td_name); thread_lock(td); - if (td->td_sleeptimo == 0 || td->td_sleeptimo > sbinuptime()) { + if (td->td_sleeptimo == 0 || + td->td_sleeptimo > td->td_slpcallout.c_time) { /* * The thread does not want a timeout (yet). */ From nobody Tue Nov 2 00:24:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C26C6182BBFA; Tue, 2 Nov 2021 00:24: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 4HjrJQ6pF5z4d8k; Tue, 2 Nov 2021 00:24: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 94FB01AC7A; Tue, 2 Nov 2021 00:24: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 1A20OsMm011881; Tue, 2 Nov 2021 00:24:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A20OsCU011880; Tue, 2 Nov 2021 00:24:54 GMT (envelope-from git) Date: Tue, 2 Nov 2021 00:24:54 GMT Message-Id: <202111020024.1A20OsCU011880@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: 5a95a6e8e4d9 - main - nfscl: Use a smaller initial delay time for NFSERR_DELAY List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 5a95a6e8e4d9e947b3bb4b4755a7242e1ddd72e7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5a95a6e8e4d9e947b3bb4b4755a7242e1ddd72e7 commit 5a95a6e8e4d9e947b3bb4b4755a7242e1ddd72e7 Author: Rick Macklem AuthorDate: 2021-11-02 00:21:31 +0000 Commit: Rick Macklem CommitDate: 2021-11-02 00:21:31 +0000 nfscl: Use a smaller initial delay time for NFSERR_DELAY For NFS RPCs that receive a NFSERR_DELAY reply, the delay time is initially 1sec and then increases exponentially to NFS_TRYLATERDEL. It was found that this delay time is excessive for some NFSv4 servers, which work well with a 1msec delay. A 1sec delay resulted in very slow performance for Remove and Rename when delegations and pNFS were enabled. This patch decreases the initial delay time to 1msec. Found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfs/nfs_commonkrpc.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 423ddb52494f..2235f1077a03 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -107,6 +107,10 @@ static int nfs_reconnects; static int nfs3_jukebox_delay = 10; static int nfs_skip_wcc_data_onerr = 1; static int nfs_dsretries = 2; +static struct timespec nfs_trylater_max = { + .tv_sec = NFS_TRYLATERDEL, + .tv_nsec = 0, +}; SYSCTL_DECL(_vfs_nfs); @@ -584,12 +588,11 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep) { uint32_t retseq, retval, slotseq, *tl; - time_t waituntil; int i = 0, j = 0, opcnt, set_sigset = 0, slot; int error = 0, usegssname = 0, secflavour = AUTH_SYS; int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; - u_int nextconn, trylater_delay = 1; + u_int nextconn; struct nfs_feedback_arg nf; struct timeval timo; AUTH *auth; @@ -602,7 +605,11 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct nfsclsession *sep; uint8_t sessionid[NFSX_V4SESSIONID]; bool nextconn_set; + struct timespec trylater_delay, ts, waituntil; + /* Initially 1msec. */ + trylater_delay.tv_sec = 0; + trylater_delay.tv_nsec = 1000000; sep = dssep; if (xidp != NULL) *xidp = 0; @@ -1144,12 +1151,19 @@ tryagain: (nd->nd_repstat == NFSERR_DELAY && (nd->nd_flag & ND_NFSV4) == 0) || nd->nd_repstat == NFSERR_RESOURCE) { - if (trylater_delay > NFS_TRYLATERDEL) - trylater_delay = NFS_TRYLATERDEL; - waituntil = NFSD_MONOSEC + trylater_delay; - while (NFSD_MONOSEC < waituntil) - (void) nfs_catnap(PZERO, 0, "nfstry"); - trylater_delay *= 2; + /* Clip at NFS_TRYLATERDEL. */ + if (timespeccmp(&trylater_delay, + &nfs_trylater_max, >)) + trylater_delay = nfs_trylater_max; + getnanouptime(&waituntil); + timespecadd(&waituntil, &trylater_delay, + &waituntil); + do { + nfs_catnap(PZERO, 0, "nfstry"); + getnanouptime(&ts); + } while (timespeccmp(&ts, &waituntil, <)); + timespecadd(&trylater_delay, &trylater_delay, + &trylater_delay); /* Double each time. */ if (slot != -1) { mtx_lock(&sep->nfsess_mtx); sep->nfsess_slotseq[slot]++; From nobody Tue Nov 2 01:05:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DC6F2183F947; Tue, 2 Nov 2021 01:05: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 4HjsCV5rQ5z4sXw; Tue, 2 Nov 2021 01:05: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 A91811BD0A; Tue, 2 Nov 2021 01:05: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 1A215gdY065562; Tue, 2 Nov 2021 01:05:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A215gAs065561; Tue, 2 Nov 2021 01:05:42 GMT (envelope-from git) Date: Tue, 2 Nov 2021 01:05:42 GMT Message-Id: <202111020105.1A215gAs065561@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: 5d03c187731d - main - Document my doc commit bit List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 5d03c187731db84c55191869bd1e503fafa165bb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5d03c187731db84c55191869bd1e503fafa165bb commit 5d03c187731db84c55191869bd1e503fafa165bb Author: Ed Maste AuthorDate: 2021-11-02 00:59:52 +0000 Commit: Ed Maste CommitDate: 2021-11-02 01:04:55 +0000 Document my doc commit bit Prodded by: ygy --- share/misc/committers-doc.dot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index 8a256548e758..fe2323b3830b 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -68,6 +68,7 @@ dexter [label="Michael Dexter\ndexter@FreeBSD.org\n2016/11/15"] dru [label="Dru Lavigne\ndru@FreeBSD.org\n2013/01/22"] eadler [label="Eitan Adler\neadler@FreeBSD.org\n2012/10/15"] ebrandi [label="Edson Brandi\nebrandi@FreeBSD.org\n2012/09/13"] +emaste [label="Ed Maste\nemaste@FreeBSD.org\n2021/08/18"] fernape [label="Fernando Apesteguia\fernape@FreeBSD.org\n2021/02/07"] gabor [label="Gabor Kovesdan\ngabor@FreeBSD.org\n2007/02/02"] ganbold [label="Ganbold Tsagaankhuu\nganbold@FreeBSD.org\n2008/02/26"] @@ -133,6 +134,7 @@ blackend -> ceri brueffer -> joel +carlavilla -> emaste carlavilla -> lwhsu ceri -> brd @@ -214,5 +216,6 @@ trhodes -> jcamou wblock -> jgh wblock -> allanjude +ygy -> emaste ygy -> lwhsu } From nobody Tue Nov 2 01:16:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0D16E1826477; Tue, 2 Nov 2021 01:16: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 4HjsSV6dtwz3Clv; Tue, 2 Nov 2021 01:16: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 C29021BA5A; Tue, 2 Nov 2021 01:16: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 1A21GwgB078641; Tue, 2 Nov 2021 01:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A21Gwe6078640; Tue, 2 Nov 2021 01:16:58 GMT (envelope-from git) Date: Tue, 2 Nov 2021 01:16:58 GMT Message-Id: <202111020116.1A21Gwe6078640@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: a49617abb0c0 - stable/13 - [LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: a49617abb0c0dc763712fd70fae8bbd66ecca835 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a49617abb0c0dc763712fd70fae8bbd66ecca835 commit a49617abb0c0dc763712fd70fae8bbd66ecca835 Author: Steve Kargl AuthorDate: 2021-10-25 13:13:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-02 01:16:29 +0000 [LIBM] implementations of sinpi[fl], cospi[fl], and tanpi[fl] PR: 218514 (cherry picked from commit dce5f3abed7181cc533ca5ed3de44517775e78dd) --- lib/msun/Makefile | 14 +++- lib/msun/Symbol.map | 13 ++++ lib/msun/ld128/k_cospil.h | 42 +++++++++++ lib/msun/ld128/k_sinpil.h | 42 +++++++++++ lib/msun/ld128/s_cospil.c | 109 ++++++++++++++++++++++++++++ lib/msun/ld128/s_sinpil.c | 118 +++++++++++++++++++++++++++++++ lib/msun/ld128/s_tanpil.c | 120 +++++++++++++++++++++++++++++++ lib/msun/ld80/k_cospil.h | 42 +++++++++++ lib/msun/ld80/k_sinpil.h | 42 +++++++++++ lib/msun/ld80/s_cospil.c | 129 +++++++++++++++++++++++++++++++++ lib/msun/ld80/s_sinpil.c | 140 ++++++++++++++++++++++++++++++++++++ lib/msun/ld80/s_tanpil.c | 139 ++++++++++++++++++++++++++++++++++++ lib/msun/man/cospi.3 | 111 +++++++++++++++++++++++++++++ lib/msun/man/sinpi.3 | 102 +++++++++++++++++++++++++++ lib/msun/man/tanpi.3 | 106 ++++++++++++++++++++++++++++ lib/msun/src/k_cospi.h | 44 ++++++++++++ lib/msun/src/k_sinpi.h | 43 +++++++++++ lib/msun/src/math.h | 9 +++ lib/msun/src/s_cospi.c | 151 +++++++++++++++++++++++++++++++++++++++ lib/msun/src/s_cospif.c | 109 ++++++++++++++++++++++++++++ lib/msun/src/s_sinpi.c | 168 +++++++++++++++++++++++++++++++++++++++++++ lib/msun/src/s_sinpif.c | 122 ++++++++++++++++++++++++++++++++ lib/msun/src/s_tanpi.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++ lib/msun/src/s_tanpif.c | 114 ++++++++++++++++++++++++++++++ 24 files changed, 2203 insertions(+), 2 deletions(-) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 7107aad56aa7..dcee5572f949 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -126,6 +126,12 @@ COMMON_SRCS+= catrigl.c \ # See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067 .if ${COMPILER_TYPE} == "gcc" CFLAGS.e_powl.c+= -Wno-error=overflow + +# IEEE-754 2008 and ISO/IEC TS 18661-4 half-cycle trignometric functions +COMMON_SRCS+= s_cospi.c s_cospif.c s_cospil.c \ + s_sinpi.c s_sinpif.c s_sinpil.c \ + s_tanpi.c s_tanpif.c s_tanpil.c + .endif .endif @@ -154,7 +160,8 @@ INCS+= fenv.h math.h MAN= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 \ ceil.3 cacos.3 ccos.3 ccosh.3 cexp.3 \ - cimag.3 clog.3 copysign.3 cos.3 cosh.3 cpow.3 csqrt.3 erf.3 \ + cimag.3 clog.3 copysign.3 cos.3 cosh.3 cospi.3 \ + cpow.3 csqrt.3 erf.3 \ exp.3 fabs.3 fdim.3 \ feclearexcept.3 feenableexcept.3 fegetenv.3 \ fegetround.3 fenv.3 floor.3 \ @@ -162,7 +169,7 @@ MAN= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 \ lgamma.3 log.3 lrint.3 lround.3 math.3 nan.3 \ nextafter.3 remainder.3 rint.3 \ round.3 scalbn.3 signbit.3 sin.3 sincos.3 \ - sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 \ + sinh.3 sinpi.3 sqrt.3 tan.3 tanh.3 tanpi.3 trunc.3 \ complex.3 MLINKS+=acos.3 acosf.3 acos.3 acosl.3 @@ -192,6 +199,7 @@ MLINKS+=clog.3 clogf.3 clog.3 clogl.3 MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3 MLINKS+=cos.3 cosf.3 cos.3 cosl.3 MLINKS+=cosh.3 coshf.3 cosh.3 coshl.3 +MLINKS+=cospi.3 cospif.3 cospi.3 cospil.3 MLINKS+=cpow.3 cpowf.3 cpow.3 cpowl.3 MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 erf.3 erfl.3 erf.3 erfcl.3 @@ -244,10 +252,12 @@ MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3 MLINKS+=sin.3 sinf.3 sin.3 sinl.3 MLINKS+=sincos.3 sincosf.3 sin.3 sincosl.3 MLINKS+=sinh.3 sinhf.3 sinh.3 sinhl.3 +MLINKS+=sinpi.3 sinpif.3 sinpi.3 sinpil.3 MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 sqrtf.3 \ sqrt.3 sqrtl.3 MLINKS+=tan.3 tanf.3 tan.3 tanl.3 MLINKS+=tanh.3 tanhf.3 tanh.3 tanhl.3 +MLINKS+=tanpi.3 tanpif.3 tanpi.3 tanpil.3 MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3 .include diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index 51deded732f0..7229e7ef31fd 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -304,3 +304,16 @@ FBSD_1.5 { sincosf; sincosl; }; + +/* First added in 14.0-CURRENT */ +FBSD_1.7 { + cospi; + cospif; + cospil; + sinpi; + sinpif; + sinpil; + tanpi; + tanpif; + tanpil; +}; diff --git a/lib/msun/ld128/k_cospil.h b/lib/msun/ld128/k_cospil.h new file mode 100644 index 000000000000..592f19229532 --- /dev/null +++ b/lib/msun/ld128/k_cospil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_cospi.c for implementation details. + */ + +static inline long double +__kernel_cospil(long double x) +{ + long double hi, lo; + + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_cosl(hi, lo)); +} diff --git a/lib/msun/ld128/k_sinpil.h b/lib/msun/ld128/k_sinpil.h new file mode 100644 index 000000000000..fa4e7d6336d7 --- /dev/null +++ b/lib/msun/ld128/k_sinpil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_sinpi.c for implementation details. + */ + +static inline long double +__kernel_sinpil(long double x) +{ + long double hi, lo; + + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_sinl(hi, lo, 1)); +} diff --git a/lib/msun/ld128/s_cospil.c b/lib/msun/ld128/s_cospil.c new file mode 100644 index 000000000000..b4bc50bb4d89 --- /dev/null +++ b/lib/msun/ld128/s_cospil.c @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_cospi.c for implementation details. + * + * FIXME: This has not been compiled nor has it been tested for accuracy. + * FIXME: This should use bit twiddling. + */ + +#include "math.h" +#include "math_private.h" + +/* + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi. + */ +static const long double +pi_hi = 3.14159265358979322702026593105983920e+00L, +pi_lo = 1.14423774522196636802434264184180742e-17L; + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +cospil(long double x) +{ + long double ax, c, xf; + uint32_t ix; + + ax = fabsl(x); + + if (ax < 1) { + if (ax < 0.25) { + if (ax < 0x1p-60) { + if ((int)x == 0) + return (1); + } + return (__kernel_cospil(ax)); + } + + if (ax < 0.5) + c = __kernel_sinpil(0.5 - ax); + else if (ax < 0.75) { + if (ax == 0.5) + return (0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + return (c); + } + + if (ax < 0x1p112) { + xf = floorl(ax); + ax -= xf; + if (x < 0.5) { + if (x < 0.25) + c = ax == 0 ? 1 : __kernel_cospil(ax); + else + c = __kernel_sinpil(0.5 - ax); + } else { + if (x < 0.75) { + if (ax == 0.5) + return (0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + } + + if (xf > 0x1p50) + xf -= 0x1p50; + if (xf > 0x1p30) + xf -= 0x1p30; + ix = (uint32_t)xf; + return (ix & 1 ? -c : c); + } + + if (isinf(x) || isnan(x)) + return (vzero / vzero); + + /* + * |x| >= 0x1p112 is always an even integer, so return 1. + */ + return (1); +} diff --git a/lib/msun/ld128/s_sinpil.c b/lib/msun/ld128/s_sinpil.c new file mode 100644 index 000000000000..39eed9b007bc --- /dev/null +++ b/lib/msun/ld128/s_sinpil.c @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_sinpi.c for implementation details. + * + * FIXME: This has not been compiled nor has it been tested for accuracy. + * FIXME: This should use bit twiddling. + */ + +#include "math.h" +#include "math_private.h" + +/* + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi. + */ +static const long double +pi_hi = 3.14159265358979322702026593105983920e+00L, +pi_lo = 1.14423774522196636802434264184180742e-17L; + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +sinpil(long double x) +{ + long double ax, hi, lo, s, xf, xhi, xlo; + uint32_t ix; + + ax = fabsl(x); + + if (ax < 1) { + if (ax < 0.25) { + if (ax < 0x1p-60) { + if (x == 0) + return (x); + hi = (double)x; + hi *= 0x1p113L; + lo = x * 0x1p113L - hi; + s = (pi_lo + pi_hi) * lo + pi_lo * lo + + pi_hi * hi; + return (s * 0x1p-113L); + } + + s = __kernel_sinpil(ax); + return (copysignl(s, x)); + } + + if (ax < 0.5) + s = __kernel_cospil(0.5 - ax); + else if (ax < 0.75) + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + return (copysignl(s, x)); + } + + if (ax < 0x1p112) { + xf = floorl(ax); + ax -= xf; + if (ax == 0) { + s = 0; + } else { + if (ax < 0.5) { + if (ax <= 0.25) + s = __kernel_sinpil(ax); + else + s = __kernel_cospil(0.5 - ax); + } else { + if (ax < 0.75) + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + } + + if (xf > 0x1p50) + xf -= 0x1p50; + if (xf > 0x1p30) + xf -= 0x1p30; + ix = (uint32_t)xf; + if (ix & 1) s = -s; + } + return (copysignl(s, x)); + } + + if (isinf(x) || isnan(x)) + return (vzero / vzero); + + /* + * |x| >= 0x1p112 is always an integer, so return +-0. + */ + return (copysignl(0, x)); +} diff --git a/lib/msun/ld128/s_tanpil.c b/lib/msun/ld128/s_tanpil.c new file mode 100644 index 000000000000..33a61cf3115d --- /dev/null +++ b/lib/msun/ld128/s_tanpil.c @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_tanpi.c for implementation details. + * + * FIXME: This has not been compiled nor has it been tested for accuracy. + * FIXME: This should use bit twiddling. + */ + +#include "math.h" +#include "math_private.h" + +/* + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi. + */ +static const long double +pi_hi = 3.14159265358979322702026593105983920e+00L, +pi_lo = 1.14423774522196636802434264184180742e-17L; + +static inline long double +__kernel_tanpi(long double x) +{ + long double hi, lo, t; + + if (x < 0.25) { + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + t = __kernel_tanl(hi, lo, -1); + } else if (x > 0.25) { + x = 0.5 - x; + hi = (double)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + t = - __kernel_tanl(hi, lo, 1); + } else + t = 1; + + return (t); +} + +volatile static const double vzero = 0; + +long double +tanpil(long double x) +{ + long double ax, hi, lo, xf; + uint32_t ix; + + ax = fabsl(ax); + + if (ax < 1) { + if (ax < 0.5) { + if (ax < 0x1p-60) { + if (x == 0) + return (x); + hi = (double)x; + hi *= 0x1p113L + lo = x * 0x1p113L - hi; + t = (pi_lo + pi_hi) * lo + pi_lo * lo + + pi_hi * hi; + return (t * 0x1p-113L); + } + t = __kernel_tanpil(ax); + } else if (ax == 0.5) + return ((ax - ax) / (ax - ax)); + else + t = -__kernel_tanpil(1 - ax); + return (copysignl(t, x)); + } + + if (ix < 0x1p112) { + xf = floorl(ax); + ax -= xf; + if (ax < 0.5) + t = ax == 0 ? 0 : __kernel_tanpil(ax); + else if (ax == 0.5) + return ((ax - ax) / (ax - ax)); + else + t = -__kernel_tanpil(1 - ax); + return (copysignl(t, x)); + } + + /* x = +-inf or nan. */ + if (isinf(x) || isnan(x)) + return (vzero / vzero); + + /* + * |x| >= 0x1p53 is always an integer, so return +-0. + */ + return (copysignl(0, x)); +} diff --git a/lib/msun/ld80/k_cospil.h b/lib/msun/ld80/k_cospil.h new file mode 100644 index 000000000000..6e13ef02aea2 --- /dev/null +++ b/lib/msun/ld80/k_cospil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_cospi.c for implementation details. + */ + +static inline long double +__kernel_cospil(long double x) +{ + long double hi, lo; + + hi = (float)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_cosl(hi, lo)); +} diff --git a/lib/msun/ld80/k_sinpil.h b/lib/msun/ld80/k_sinpil.h new file mode 100644 index 000000000000..00241b932e9e --- /dev/null +++ b/lib/msun/ld80/k_sinpil.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/k_sinpi.c for implementation details. + */ + +static inline long double +__kernel_sinpil(long double x) +{ + long double hi, lo; + + hi = (float)x; + lo = x - hi; + lo = lo * (pi_lo + pi_hi) + hi * pi_lo; + hi *= pi_hi; + _2sumF(hi, lo); + return (__kernel_sinl(hi, lo, 1)); +} diff --git a/lib/msun/ld80/s_cospil.c b/lib/msun/ld80/s_cospil.c new file mode 100644 index 000000000000..199479e9eaf9 --- /dev/null +++ b/lib/msun/ld80/s_cospil.c @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_cospi.c for implementation details. + */ + +#ifdef __i386__ +#include +#endif +#include + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +static const double +pi_hi = 3.1415926814079285e+00, /* 0x400921fb 0x58000000 */ +pi_lo =-2.7818135228334233e-08; /* 0xbe5dde97 0x3dcb3b3a */ + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +cospil(long double x) +{ + long double ax, c; + uint64_t lx, m; + uint32_t j0; + uint16_t hx, ix; + + EXTRACT_LDBL80_WORDS(hx, lx, x); + ix = hx & 0x7fff; + INSERT_LDBL80_WORDS(ax, ix, lx); + + ENTERI(); + + if (ix < 0x3fff) { /* |x| < 1 */ + if (ix < 0x3ffd) { /* |x| < 0.25 */ + if (ix < 0x3fdd) { /* |x| < 0x1p-34 */ + if ((int)x == 0) + RETURNI(1); + } + RETURNI(__kernel_cospil(ax)); + } + + if (ix < 0x3ffe) /* |x| < 0.5 */ + c = __kernel_sinpil(0.5 - ax); + else if (lx < 0xc000000000000000ull) { /* |x| < 0.75 */ + if (ax == 0.5) + RETURNI(0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + RETURNI(c); + } + + if (ix < 0x403e) { /* 1 <= |x| < 0x1p63 */ + /* Determine integer part of ax. */ + j0 = ix - 0x3fff + 1; + if (j0 < 32) { + lx = (lx >> 32) << 32; + lx &= ~(((lx << 32)-1) >> j0); + } else { + m = (uint64_t)-1 >> (j0 + 1); + if (lx & m) lx &= ~m; + } + INSERT_LDBL80_WORDS(x, ix, lx); + + ax -= x; + EXTRACT_LDBL80_WORDS(ix, lx, ax); + + if (ix < 0x3ffe) { /* |x| < 0.5 */ + if (ix < 0x3ffd) /* |x| < 0.25 */ + c = ix == 0 ? 1 : __kernel_cospil(ax); + else + c = __kernel_sinpil(0.5 - ax); + + } else { + if (lx < 0xc000000000000000ull) { /* |x| < 0.75 */ + if (ax == 0.5) + RETURNI(0); + c = -__kernel_sinpil(ax - 0.5); + } else + c = -__kernel_cospil(1 - ax); + } + + if (j0 > 40) + x -= 0x1p40; + if (j0 > 30) + x -= 0x1p30; + j0 = (uint32_t)x; + + RETURNI(j0 & 1 ? -c : c); + } + + if (ix >= 0x7fff) + RETURNI(vzero / vzero); + + /* + * |x| >= 0x1p63 is always an even integer, so return 1. + */ + RETURNI(1); +} diff --git a/lib/msun/ld80/s_sinpil.c b/lib/msun/ld80/s_sinpil.c new file mode 100644 index 000000000000..4cefa92352e1 --- /dev/null +++ b/lib/msun/ld80/s_sinpil.c @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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. + */ + +/* + * See ../src/s_sinpi.c for implementation details. + */ + +#ifdef __i386__ +#include +#endif +#include + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +static const union IEEEl2bits +pi_hi_u = LD80C(0xc90fdaa200000000, 1, 3.14159265346825122833e+00L), +pi_lo_u = LD80C(0x85a308d313198a2e, -33, 1.21542010130123852029e-10L); +#define pi_hi (pi_hi_u.e) +#define pi_lo (pi_lo_u.e) + +#include "k_cospil.h" +#include "k_sinpil.h" + +volatile static const double vzero = 0; + +long double +sinpil(long double x) +{ + long double ax, hi, lo, s; + uint64_t lx, m; + uint32_t j0; + uint16_t hx, ix; + + EXTRACT_LDBL80_WORDS(hx, lx, x); + ix = hx & 0x7fff; + INSERT_LDBL80_WORDS(ax, ix, lx); + + ENTERI(); + + if (ix < 0x3fff) { /* |x| < 1 */ + if (ix < 0x3ffd) { /* |x| < 0.25 */ + if (ix < 0x3fdd) { /* |x| < 0x1p-34 */ + if (x == 0) + RETURNI(x); + INSERT_LDBL80_WORDS(hi, hx, + lx & 0xffffffff00000000ull); + hi *= 0x1p63L; + lo = x * 0x1p63L - hi; + s = (pi_lo + pi_hi) * lo + pi_lo * hi + + pi_hi * hi; + RETURNI(s * 0x1p-63L); + } + s = __kernel_sinpil(ax); + RETURNI((hx & 0x8000) ? -s : s); + } + + if (ix < 0x3ffe) /* |x| < 0.5 */ + s = __kernel_cospil(0.5 - ax); + else if (lx < 0xc000000000000000ull) /* |x| < 0.75 */ + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + RETURNI((hx & 0x8000) ? -s : s); + } + + if (ix < 0x403e) { /* 1 <= |x| < 0x1p63 */ + /* Determine integer part of ax. */ + j0 = ix - 0x3fff + 1; + if (j0 < 32) { + lx = (lx >> 32) << 32; + lx &= ~(((lx << 32)-1) >> j0); + } else { + m = (uint64_t)-1 >> (j0 + 1); + if (lx & m) lx &= ~m; + } + INSERT_LDBL80_WORDS(x, ix, lx); + + ax -= x; + EXTRACT_LDBL80_WORDS(ix, lx, ax); + + if (ix == 0) { + s = 0; + } else { + if (ix < 0x3ffe) { /* |x| < 0.5 */ + if (ix < 0x3ffd) /* |x| < 0.25 */ + s = __kernel_sinpil(ax); + else + s = __kernel_cospil(0.5 - ax); + } else { + /* |x| < 0.75 */ + if (lx < 0xc000000000000000ull) + s = __kernel_cospil(ax - 0.5); + else + s = __kernel_sinpil(1 - ax); + } + + if (j0 > 40) + x -= 0x1p40; + if (j0 > 30) + x -= 0x1p30; + j0 = (uint32_t)x; + if (j0 & 1) s = -s; + } + RETURNI((hx & 0x8000) ? -s : s); + } + + /* x = +-inf or nan. */ + if (ix >= 0x7fff) + RETURNI(vzero / vzero); + + /* + * |x| >= 0x1p63 is always an integer, so return +-0. + */ + RETURNI(copysignl(0, x)); +} diff --git a/lib/msun/ld80/s_tanpil.c b/lib/msun/ld80/s_tanpil.c new file mode 100644 index 000000000000..02451e562025 --- /dev/null +++ b/lib/msun/ld80/s_tanpil.c @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2017 Steven G. Kargl + * 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 unmodified, 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 ``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 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 *** 1448 LINES SKIPPED *** From nobody Tue Nov 2 01:16:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1F8D18265AB; Tue, 2 Nov 2021 01:17: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 4HjsSX1Yfkz3Cjy; Tue, 2 Nov 2021 01:17: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 EF7E11BF88; Tue, 2 Nov 2021 01:16: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 1A21GxU9078665; Tue, 2 Nov 2021 01:16:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A21GxvL078664; Tue, 2 Nov 2021 01:16:59 GMT (envelope-from git) Date: Tue, 2 Nov 2021 01:16:59 GMT Message-Id: <202111020116.1A21GxvL078664@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: 897800f8b6ae - stable/13 - lib/msun/ld128/s_tanpil.c: make it compile. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 897800f8b6ae32ed357df3ecfeb99ab228c8acb5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=897800f8b6ae32ed357df3ecfeb99ab228c8acb5 commit 897800f8b6ae32ed357df3ecfeb99ab228c8acb5 Author: Konstantin Belousov AuthorDate: 2021-10-26 21:14:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-02 01:16:29 +0000 lib/msun/ld128/s_tanpil.c: make it compile. (cherry picked from commit 6312d144613f97bf59703c442ee4871be1450c46) --- lib/msun/ld128/s_tanpil.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/ld128/s_tanpil.c b/lib/msun/ld128/s_tanpil.c index 33a61cf3115d..7cbbdc8a5d05 100644 --- a/lib/msun/ld128/s_tanpil.c +++ b/lib/msun/ld128/s_tanpil.c @@ -42,7 +42,7 @@ pi_hi = 3.14159265358979322702026593105983920e+00L, pi_lo = 1.14423774522196636802434264184180742e-17L; static inline long double -__kernel_tanpi(long double x) +__kernel_tanpil(long double x) { long double hi, lo, t; @@ -72,7 +72,7 @@ volatile static const double vzero = 0; long double tanpil(long double x) { - long double ax, hi, lo, xf; + long double ax, hi, lo, xf, t; uint32_t ix; ax = fabsl(ax); @@ -83,7 +83,7 @@ tanpil(long double x) if (x == 0) return (x); hi = (double)x; - hi *= 0x1p113L + hi *= 0x1p113L; lo = x * 0x1p113L - hi; t = (pi_lo + pi_hi) * lo + pi_lo * lo + pi_hi * hi; From nobody Tue Nov 2 01:17:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1171B1826646; Tue, 2 Nov 2021 01:17: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 4HjsSY2K03z3CsB; Tue, 2 Nov 2021 01:17: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 0B8941BD3F; Tue, 2 Nov 2021 01:17: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 1A21H0PF078689; Tue, 2 Nov 2021 01:17:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A21H0Mj078688; Tue, 2 Nov 2021 01:17:00 GMT (envelope-from git) Date: Tue, 2 Nov 2021 01:17:00 GMT Message-Id: <202111020117.1A21H0Mj078688@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: 6207f135e9da - stable/13 - lib/msun: Move the files to appropriate locations in the Makefile List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6207f135e9da677b31ed7fabad9b69461ae5d16d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6207f135e9da677b31ed7fabad9b69461ae5d16d commit 6207f135e9da677b31ed7fabad9b69461ae5d16d Author: Steve Kargl AuthorDate: 2021-10-26 20:53:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-02 01:16:29 +0000 lib/msun: Move the files to appropriate locations in the Makefile (cherry picked from commit ca3d8cb087cd5b40369478b1693f3e4038b5fa23) --- lib/msun/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index dcee5572f949..1d94e371e61f 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -89,6 +89,11 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \ s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_tgammaf.c s_trunc.c s_truncf.c \ w_cabs.c w_cabsf.c w_drem.c w_dremf.c +# IEEE-754 2008 and ISO/IEC TS 18661-4 half-cycle trignometric functions +COMMON_SRCS+= s_cospi.c s_cospif.c \ + s_sinpi.c s_sinpif.c \ + s_tanpi.c s_tanpif.c + # Location of fpmath.h and _fpmath.h .if exists(${LIBCSRCDIR}/${MACHINE_ARCH}) LIBC_ARCH=${MACHINE_ARCH} @@ -113,12 +118,12 @@ COMMON_SRCS+= catrigl.c \ e_remainderl.c e_sinhl.c e_sqrtl.c \ invtrig.c k_cosl.c k_sinl.c k_tanl.c \ s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c \ - s_clogl.c s_cosl.c s_cprojl.c \ + s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \ s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \ s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \ - s_scalbnl.c s_sinl.c s_sincosl.c \ - s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c + s_scalbnl.c s_sinl.c s_sincosl.c s_sinpil.c \ + s_tanhl.c s_tanl.c s_tanpil.c s_truncl.c w_cabsl.c # Work around this warning from gcc: # lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of # 'long double' [-Werror=overflow] @@ -126,12 +131,6 @@ COMMON_SRCS+= catrigl.c \ # See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067 .if ${COMPILER_TYPE} == "gcc" CFLAGS.e_powl.c+= -Wno-error=overflow - -# IEEE-754 2008 and ISO/IEC TS 18661-4 half-cycle trignometric functions -COMMON_SRCS+= s_cospi.c s_cospif.c s_cospil.c \ - s_sinpi.c s_sinpif.c s_sinpil.c \ - s_tanpi.c s_tanpif.c s_tanpil.c - .endif .endif From nobody Tue Nov 2 01:17:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BA47318266AC; Tue, 2 Nov 2021 01:17: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 4HjsSZ45Xvz3Cx5; Tue, 2 Nov 2021 01:17: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 3A3141BA5B; Tue, 2 Nov 2021 01:17: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 1A21H2Qe078713; Tue, 2 Nov 2021 01:17:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A21H2nl078712; Tue, 2 Nov 2021 01:17:02 GMT (envelope-from git) Date: Tue, 2 Nov 2021 01:17:02 GMT Message-Id: <202111020117.1A21H2nl078712@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: 8b231404a1b2 - stable/13 - sinpi,cospi,tanpi: float.h needed for week reference List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8b231404a1b29c1a21636d4db1ee1e454a87e54c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8b231404a1b29c1a21636d4db1ee1e454a87e54c commit 8b231404a1b29c1a21636d4db1ee1e454a87e54c Author: Steve Kargl AuthorDate: 2021-10-28 22:53:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-02 01:16:29 +0000 sinpi,cospi,tanpi: float.h needed for week reference PR: 218514 (cherry picked from commit 3bfc837685b8128067b946b31dfe2120dae0d003) --- lib/msun/src/s_cospi.c | 1 + lib/msun/src/s_sinpi.c | 1 + lib/msun/src/s_tanpi.c | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/msun/src/s_cospi.c b/lib/msun/src/s_cospi.c index 92a5f467c97f..860219efd3e4 100644 --- a/lib/msun/src/s_cospi.c +++ b/lib/msun/src/s_cospi.c @@ -60,6 +60,7 @@ * cospi(nan) = nan. Raises the "invalid" floating-point exception. */ +#include #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_sinpi.c b/lib/msun/src/s_sinpi.c index b9731112a7eb..858459a5fcb4 100644 --- a/lib/msun/src/s_sinpi.c +++ b/lib/msun/src/s_sinpi.c @@ -63,6 +63,7 @@ * sinpi(nan) = nan. Raises the "invalid" floating-point exception. */ +#include #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_tanpi.c b/lib/msun/src/s_tanpi.c index e01917c94c15..01d4c74367fd 100644 --- a/lib/msun/src/s_tanpi.c +++ b/lib/msun/src/s_tanpi.c @@ -63,6 +63,7 @@ * tanpi(nan) = NaN. Raises the "invalid" floating-point exception. */ +#include #include "math.h" #include "math_private.h" From nobody Tue Nov 2 01:17:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 082E218264F9; Tue, 2 Nov 2021 01:17: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 4HjsSc1b7tz3D0d; Tue, 2 Nov 2021 01:17: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 5B2991BB63; Tue, 2 Nov 2021 01:17: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 1A21H33M078737; Tue, 2 Nov 2021 01:17:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A21H3nM078736; Tue, 2 Nov 2021 01:17:03 GMT (envelope-from git) Date: Tue, 2 Nov 2021 01:17:03 GMT Message-Id: <202111020117.1A21H3nM078736@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: 5033d0b56f5b - stable/13 - sinpi[fl] etc: Fix the ld128 implementations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 5033d0b56f5be90fcca4ede92f28f9335eb20b4a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5033d0b56f5be90fcca4ede92f28f9335eb20b4a commit 5033d0b56f5be90fcca4ede92f28f9335eb20b4a Author: Steve Kargl AuthorDate: 2021-10-31 22:26:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-02 01:16:29 +0000 sinpi[fl] etc: Fix the ld128 implementations PR: 218514 (cherry picked from commit 4f889260c33c163ab28e0e082b4d7e7562d9c647) --- lib/msun/ld128/s_cospil.c | 31 +++++++++++++++++-------------- lib/msun/ld128/s_sinpil.c | 29 ++++++++++++++++------------- lib/msun/ld128/s_tanpil.c | 23 +++++++++++++---------- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/lib/msun/ld128/s_cospil.c b/lib/msun/ld128/s_cospil.c index b4bc50bb4d89..71acc4485f7b 100644 --- a/lib/msun/ld128/s_cospil.c +++ b/lib/msun/ld128/s_cospil.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Steven G. Kargl + * Copyright (c) 2017-2021 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +26,6 @@ /* * See ../src/s_cospi.c for implementation details. - * - * FIXME: This has not been compiled nor has it been tested for accuracy. - * FIXME: This should use bit twiddling. */ #include "math.h" @@ -54,7 +51,7 @@ cospil(long double x) ax = fabsl(x); - if (ax < 1) { + if (ax <= 1) { if (ax < 0.25) { if (ax < 0x1p-60) { if ((int)x == 0) @@ -75,15 +72,21 @@ cospil(long double x) } if (ax < 0x1p112) { - xf = floorl(ax); - ax -= xf; - if (x < 0.5) { - if (x < 0.25) + /* Split x = n + r with 0 <= r < 1. */ + xf = (ax + 0x1p112L) - 0x1p112L; /* Integer part */ + ax -= xf; /* Remainder */ + if (ax < 0) { + ax += 1; + xf -= 1; + } + + if (ax < 0.5) { + if (ax < 0.25) c = ax == 0 ? 1 : __kernel_cospil(ax); else c = __kernel_sinpil(0.5 - ax); } else { - if (x < 0.75) { + if (ax < 0.75) { if (ax == 0.5) return (0); c = -__kernel_sinpil(ax - 0.5); @@ -91,10 +94,10 @@ cospil(long double x) c = -__kernel_cospil(1 - ax); } - if (xf > 0x1p50) - xf -= 0x1p50; - if (xf > 0x1p30) - xf -= 0x1p30; + if (xf > 0x1p64) + xf -= 0x1p64; + if (xf > 0x1p32) + xf -= 0x1p32; ix = (uint32_t)xf; return (ix & 1 ? -c : c); } diff --git a/lib/msun/ld128/s_sinpil.c b/lib/msun/ld128/s_sinpil.c index 39eed9b007bc..cdfa2bcac3ef 100644 --- a/lib/msun/ld128/s_sinpil.c +++ b/lib/msun/ld128/s_sinpil.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Steven G. Kargl + * Copyright (c) 2017-2021 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +26,6 @@ /* * See ../src/s_sinpi.c for implementation details. - * - * FIXME: This has not been compiled nor has it been tested for accuracy. - * FIXME: This should use bit twiddling. */ #include "math.h" @@ -68,7 +65,7 @@ sinpil(long double x) } s = __kernel_sinpil(ax); - return (copysignl(s, x)); + return (x < 0 ? -s : s); } if (ax < 0.5) @@ -77,12 +74,18 @@ sinpil(long double x) s = __kernel_cospil(ax - 0.5); else s = __kernel_sinpil(1 - ax); - return (copysignl(s, x)); + return (x < 0 ? -s : s); } if (ax < 0x1p112) { - xf = floorl(ax); - ax -= xf; + /* Split x = n + r with 0 <= r < 1. */ + xf = (ax + 0x1p112L) - 0x1p112L; /* Integer part */ + ax -= xf; /* Remainder */ + if (ax < 0) { + ax += 1; + xf -= 1; + } + if (ax == 0) { s = 0; } else { @@ -98,14 +101,14 @@ sinpil(long double x) s = __kernel_sinpil(1 - ax); } - if (xf > 0x1p50) - xf -= 0x1p50; - if (xf > 0x1p30) - xf -= 0x1p30; + if (xf > 0x1p64) + xf -= 0x1p64; + if (xf > 0x1p32) + xf -= 0x1p32; ix = (uint32_t)xf; if (ix & 1) s = -s; } - return (copysignl(s, x)); + return (x < 0 ? -s : s); } if (isinf(x) || isnan(x)) diff --git a/lib/msun/ld128/s_tanpil.c b/lib/msun/ld128/s_tanpil.c index 7cbbdc8a5d05..90f4aea5c629 100644 --- a/lib/msun/ld128/s_tanpil.c +++ b/lib/msun/ld128/s_tanpil.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017 Steven G. Kargl + * Copyright (c) 2017-2021 Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,9 +26,6 @@ /* * See ../src/s_tanpi.c for implementation details. - * - * FIXME: This has not been compiled nor has it been tested for accuracy. - * FIXME: This should use bit twiddling. */ #include "math.h" @@ -75,7 +72,7 @@ tanpil(long double x) long double ax, hi, lo, xf, t; uint32_t ix; - ax = fabsl(ax); + ax = fabsl(x); if (ax < 1) { if (ax < 0.5) { @@ -94,19 +91,25 @@ tanpil(long double x) return ((ax - ax) / (ax - ax)); else t = -__kernel_tanpil(1 - ax); - return (copysignl(t, x)); + return (x < 0 ? -t : t); } if (ix < 0x1p112) { - xf = floorl(ax); - ax -= xf; + /* Split x = n + r with 0 <= r < 1. */ + xf = (ax + 0x1p112L) - 0x1p112L; /* Integer part */ + ax -= xf; /* Remainder */ + if (ax < 0) { + ax += 1; + xf -= 1; + } + if (ax < 0.5) t = ax == 0 ? 0 : __kernel_tanpil(ax); else if (ax == 0.5) return ((ax - ax) / (ax - ax)); else t = -__kernel_tanpil(1 - ax); - return (copysignl(t, x)); + return (x < 0 ? -t : t); } /* x = +-inf or nan. */ @@ -114,7 +117,7 @@ tanpil(long double x) return (vzero / vzero); /* - * |x| >= 0x1p53 is always an integer, so return +-0. + * |x| >= 0x1p112 is always an integer, so return +-0. */ return (copysignl(0, x)); } From nobody Tue Nov 2 01:23:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4B62F182A0C8; Tue, 2 Nov 2021 01:23:53 +0000 (UTC) (envelope-from philip@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 4HjscT0zHxz3HPH; Tue, 2 Nov 2021 01:23:53 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: philip/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id EC7B82D597; Tue, 2 Nov 2021 01:23:52 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 978CC27C0054; Mon, 1 Nov 2021 21:23:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 01 Nov 2021 21:23:52 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdehgedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffokfgjfhggtgfgsehtqh hmtdertdejnecuhfhrohhmpefrhhhilhhiphcurfgrvghpshcuoehphhhilhhiphesfhhr vggvsghsugdrohhrgheqnecuggftrfgrthhtvghrnhepjeekueehvddvjefhheektdeuue evudduieejvdegieeiffduieffleejgeekjedtnecuffhomhgrihhnpehfrhgvvggsshgu rdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epphhhihhlihhpodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeiiedv iedvgeekqddvfeehudektddtkedqphhhihhlihhppeepfhhrvggvsghsugdrohhrghesth hrohhusghlvgdrihhs X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Nov 2021 21:23:50 -0400 (EDT) From: Philip Paeps To: Jessica Clarke Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: e528757ca6a9 - main - iicoc: add support for SiFive HiFive Unmatched Date: Tue, 02 Nov 2021 09:23:35 +0800 X-Mailer: MailMate (1.14r5842) Message-ID: In-Reply-To: <3DD4AA9B-9985-4DFB-BBC8-E5E34787BA7A@freebsd.org> References: <202111010509.1A159OOo054720@gitrepo.freebsd.org> <3DD4AA9B-9985-4DFB-BBC8-E5E34787BA7A@freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On 2021-11-01 20:55:42 (+0800), Jessica Clarke wrote: > On 1 Nov 2021, at 05:09, Philip Paeps wrote: >> The branch main has been updated by philip: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3De528757ca6a9c03dca7e35b77411= b311af166b7f >> >> commit e528757ca6a9c03dca7e35b77411b311af166b7f >> Author: Thomas Skibo >> AuthorDate: 2021-11-01 04:23:22 +0000 >> Commit: Philip Paeps >> CommitDate: 2021-11-01 04:26:49 +0000 >> >> iicoc: add support for SiFive HiFive Unmatched >> >> Reviewed by: jrtc27, philip >> MFC after: 3 days >> Differential Revision: https://reviews.freebsd.org/D32737 > > I didn=E2=80=99t approve the revision, I just left comments on the firs= t = > version. Oh! I'm sorry. I misread the Phabricator "accepted by riscv group" = tick. I thought that was yours ... turns out it was mine. :-o > One of which still stands (not limiting the module to RISC-V). I agree it would make sense to build the module for all platforms. I'll = make that happen. Sorry for jumping the gun. Philip -- = Philip Paeps Senior Reality Engineer Alternative Enterprises From nobody Tue Nov 2 07:19:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D17271837450; Tue, 2 Nov 2021 07:19: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 4Hk1Vn5Zm0z4dHg; Tue, 2 Nov 2021 07:19: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 9F55C2094B; Tue, 2 Nov 2021 07:19: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 1A27JTqr058000; Tue, 2 Nov 2021 07:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A27JTS3057999; Tue, 2 Nov 2021 07:19:29 GMT (envelope-from git) Date: Tue, 2 Nov 2021 07:19:29 GMT Message-Id: <202111020719.1A27JTS3057999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: 2fe85640b2a3 - main - efirt(9): Correct efi_var_set definition in the manpage List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2fe85640b2a3bf5c377dd180e40cd3d6e1a4f1f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2fe85640b2a3bf5c377dd180e40cd3d6e1a4f1f4 commit 2fe85640b2a3bf5c377dd180e40cd3d6e1a4f1f4 Author: Lakshman AuthorDate: 2021-11-02 07:17:38 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-02 07:17:38 +0000 efirt(9): Correct efi_var_set definition in the manpage PR: 257531 MFC after: 3 days --- share/man/man9/efirt.9 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man9/efirt.9 b/share/man/man9/efirt.9 index fd5aee83656b..cdf0ea21ad8d 100644 --- a/share/man/man9/efirt.9 +++ b/share/man/man9/efirt.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2018 +.Dd November 2, 2021 .Dt EFIRT 9 .Os .Sh NAME @@ -63,8 +63,8 @@ .Ft int .Fn efi_var_nextname "size_t *namesize" "uint16_t *name" "struct uuid *vendor" .Ft int -.Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t *attrib" \ - "size_t *datasize" "void *data" +.Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t attrib" \ + "size_t datasize" "void *data" .Sh DESCRIPTION All of the following calls will return .Dv ENXIO From nobody Tue Nov 2 07:30:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6B049183DBD4; Tue, 2 Nov 2021 07:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hk1lV2T96z4htb; Tue, 2 Nov 2021 07:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3477D20E21; Tue, 2 Nov 2021 07:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A27UUs5079346; Tue, 2 Nov 2021 07:30:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A27UUQK079345; Tue, 2 Nov 2021 07:30:30 GMT (envelope-from git) Date: Tue, 2 Nov 2021 07:30:30 GMT Message-Id: <202111020730.1A27UUQK079345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: a85aa7f9d3bf - main - dpv: Fix synopsis formatting & sort options List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20 commit a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:05:48 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-02 07:30:11 +0000 dpv: Fix synopsis formatting & sort options MFC after: 3 days --- usr.bin/dpv/dpv.1 | 97 +++++++++++++++++++++++++++++++------------------------ usr.bin/dpv/dpv.c | 30 ++++++++--------- 2 files changed, 70 insertions(+), 57 deletions(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index 8c0dce79d2d1..d571addfa7c9 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2016 +.Dd November 2, 2021 .Dt DPV 1 .Os .Sh NAME @@ -33,13 +33,26 @@ .Sh SYNOPSIS .Nm .Op options -.Ar [bytes:]label +.Sm off +.Op Ar bytes Cm \&: +.Ar label +.Sm on .Nm .Op options .Fl m -.Ar [bytes1:]label1 +.Sm off +.Op Ar bytes1 Cm \& : +. Ar label1 +.Sm on .Ar path1 -.Op Ar [bytes2:]label2 path2 ... +.Oo +.Sm off +.Op Ar bytes2 Cm \&: +.Ar label2 +.Sm on +.Ar path2 +.Ar ... +.Oc .Sh DESCRIPTION .Nm provides a dialog progress view, allowing a user to see current throughput rate @@ -95,10 +108,6 @@ When using this is displayed inside the window .Pq at the top followed by a separator line. -.It Fl d -Debug mode. -Print dialog prompt data to standard out and provide additional debugging on -standard error. .It Fl D Do not use the default interface of .Xr dialog 3 , @@ -111,11 +120,15 @@ is taken from the environment variable or simply .Dq Li dialog if unset or NULL. +.It Fl d +Debug mode. +Print dialog prompt data to standard out and provide additional debugging on +standard error. .It Fl h Produce a short syntax usage with brief option descriptions and exit. Output is produced on standard error. -.It Fl i Ar format -Customize the single-file format string used to update the status line. +.It Fl I Ar format +Customize the multi-file format string used to update the status line. Ignored when using either .Ql Fl D or @@ -124,10 +137,10 @@ which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is -.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . -This format is used when handling one file. -.It Fl I Ar format -Customize the multi-file format string used to update the status line. +.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . +This format is used when handling more than one file. +.It Fl i Ar format +Customize the single-file format string used to update the status line. Ignored when using either .Ql Fl D or @@ -136,24 +149,27 @@ which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is -.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . -This format is used when handling more than one file. +.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . +This format is used when handling one file. .It Fl k Keep tite. Prevent visually distracting initialization/exit routines for scripts running .Xr dialog 1 several times. -.It Fl l -Line mode. -Read lines from input instead of bytes. .It Fl L Ar size Label size. If negative, shrink to longest label width. +.It Fl l +Line mode. +Read lines from input instead of bytes. .It Fl m Multi-input mode. Instead of reading bytes from standard input, read from a set of paths .Pq one for each label . By default, each path is processed sequentially in the order given. +.It Fl N +No overrun. +If enabled, stop reading known-length inputs when input reaches stated length. .It Fl n Ar num Display at-most .Ar num @@ -162,9 +178,6 @@ If zero, display as many as possible. If negative, only display the main progress indicator. Default is 0. Maximum value is 10. -.It Fl N -No overrun. -If enabled, stop reading known-length inputs when input reaches stated length. .It Fl o Ar file Output data to .Ar file . @@ -176,10 +189,6 @@ in will be replaced with the .Ar label text. -.It Fl p Ar text -Display -.Ar text -above the file progress indicator(s). .It Fl P Ar size Mini-progressbar size. If negative, don't display mini-progressbars @@ -187,6 +196,19 @@ If negative, don't display mini-progressbars If zero, auto-adjust based on number of files to read. When zero and only one file to read, defaults to -1. When zero and more than one file to read, defaults to 17. +.It Fl p Ar text +Display +.Ar text +above the file progress indicator(s). +.It Fl T +Test mode. +Simulate reading a number of bytes, divided evenly across the number of files, +while stepping through each percent value of each file to process. +Appends +.Dq Li [TEST MODE] +to the status line +.Pq to override, use Ql Fl u Ar format . +No data is actually read. .It Fl t Ar title Display .Ar title @@ -201,15 +223,6 @@ and .Ar title are effectively switched .Pq see BUGS section below . -.It Fl T -Test mode. -Simulate reading a number of bytes, divided evenly across the number of files, -while stepping through each percent value of each file to process. -Appends -.Dq Li [TEST MODE] -to the status line -.Pq to override, use Ql Fl u Ar format . -No data is actually read. .It Fl U Ar num Update status line .Ar num @@ -237,6 +250,13 @@ and to bump the dialog width. Prompts wider than the maximum width will wrap .Pq unless using Xr Xdialog 1 ; see BUGS section below . +.It Fl X +Enable X11 mode by using +.Xr Xdialog 1 +instead of +.Xr dialog 1 +or +.Xr dialog 3 . .It Fl x Ar cmd Execute .Ar cmd @@ -259,13 +279,6 @@ in will be replaced with the .Ar label text. -.It Fl X -Enable X11 mode by using -.Xr Xdialog 1 -instead of -.Xr dialog 1 -or -.Xr dialog 3 . .El .Sh ENVIRONMENT The following environment variables are referenced by diff --git a/usr.bin/dpv/dpv.c b/usr.bin/dpv/dpv.c index 440b5ab6de0f..725b24f6bbe9 100644 --- a/usr.bin/dpv/dpv.c +++ b/usr.bin/dpv/dpv.c @@ -496,50 +496,50 @@ usage(void) if (debug) /* No need for usage */ exit(EXIT_FAILURE); - fprintf(stderr, "Usage: %s [options] bytes:label\n", pgm); - fprintf(stderr, " %s [options] -m bytes1:label1 path1 " - "[bytes2:label2 path2 ...]\n", pgm); + fprintf(stderr, "Usage: %s [options] [bytes:]label\n", pgm); + fprintf(stderr, " %s [options] -m [bytes1:]label1 path1 " + "[[bytes2:]label2 path2 ...]\n", pgm); fprintf(stderr, "OPTIONS:\n"); #define OPTFMT "\t%-14s %s\n" fprintf(stderr, OPTFMT, "-a text", "Append text. Displayed below file progress indicators."); fprintf(stderr, OPTFMT, "-b backtitle", "String to be displayed on the backdrop, at top-left."); - fprintf(stderr, OPTFMT, "-d", - "Debug. Write to standard output instead of dialog."); fprintf(stderr, OPTFMT, "-D", "Use dialog(1) instead of dialog(3) [default]."); + fprintf(stderr, OPTFMT, "-d", + "Debug. Write to standard output instead of dialog."); fprintf(stderr, OPTFMT, "-h", "Produce this output on standard error and exit."); - fprintf(stderr, OPTFMT, "-i format", - "Customize status line format. See fdpv(1) for details."); fprintf(stderr, OPTFMT, "-I format", "Customize status line format. See fdpv(1) for details."); + fprintf(stderr, OPTFMT, "-i format", + "Customize status line format. See fdpv(1) for details."); fprintf(stderr, OPTFMT, "-L size", "Label size. Must be a number greater than 0, or -1."); fprintf(stderr, OPTFMT, "-m", "Enable processing of multiple file argiments."); - fprintf(stderr, OPTFMT, "-n num", - "Display at-most num files per screen. Default is -1."); fprintf(stderr, OPTFMT, "-N", "No overrun. Stop reading input at stated length, if any."); + fprintf(stderr, OPTFMT, "-n num", + "Display at-most num files per screen. Default is -1."); fprintf(stderr, OPTFMT, "-o file", "Output data to file. First %s replaced with label text."); - fprintf(stderr, OPTFMT, "-p text", - "Prefix text. Displayed above file progress indicators."); fprintf(stderr, OPTFMT, "-P size", "Mini-progressbar size. Must be a number greater than 3."); - fprintf(stderr, OPTFMT, "-t title", - "Title string to be displayed at top of dialog(1) box."); + fprintf(stderr, OPTFMT, "-p text", + "Prefix text. Displayed above file progress indicators."); fprintf(stderr, OPTFMT, "-T", "Test mode. Don't actually read any data, but fake it."); + fprintf(stderr, OPTFMT, "-t title", + "Title string to be displayed at top of dialog(1) box."); fprintf(stderr, OPTFMT, "-U num", "Update status line num times per-second. Default is 2."); fprintf(stderr, OPTFMT, "-w", "Wide. Width of `-p' and `-a' text bump dialog(1) width."); - fprintf(stderr, OPTFMT, "-x cmd", - "Send data to executed cmd. First %s replaced with label."); fprintf(stderr, OPTFMT, "-X", "X11. Use Xdialog(1) instead of dialog(1)."); + fprintf(stderr, OPTFMT, "-x cmd", + "Send data to executed cmd. First %s replaced with label."); exit(EXIT_FAILURE); } From nobody Tue Nov 2 07:30:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8EC2E183DBD8; Tue, 2 Nov 2021 07:30: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 4Hk1lW3NVxz4hmF; Tue, 2 Nov 2021 07:30: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 4BAD120BB2; Tue, 2 Nov 2021 07:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A27UVJS079388; Tue, 2 Nov 2021 07:30:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A27UVKk079381; Tue, 2 Nov 2021 07:30:31 GMT (envelope-from git) Date: Tue, 2 Nov 2021 07:30:31 GMT Message-Id: <202111020730.1A27UVKk079381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: f7c7a6ac00f1 - main - dpv.1: Fix an example List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7c7a6ac00f13e2d47d50844dd92071933c33a56 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f7c7a6ac00f13e2d47d50844dd92071933c33a56 commit f7c7a6ac00f13e2d47d50844dd92071933c33a56 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:11:50 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-02 07:30:11 +0000 dpv.1: Fix an example dpv(1) requires a label to be specified. MFC after: 3 days --- usr.bin/dpv/dpv.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index d571addfa7c9..dd5829f6829c 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -374,7 +374,7 @@ dpv -o /dev/ada0 -m label disk-image.img .Pp Zeroing a disk: .Bd -literal -offset indent -dpv -o /dev/md42 < /dev/zero +dpv -o /dev/md42 "Zeroing md42" < /dev/zero .Ed .Sh SEE ALSO .Xr dialog 1 , From nobody Tue Nov 2 07:30:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5FD1E183DE19; Tue, 2 Nov 2021 07:30:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hk1lX5KLMz4j03; Tue, 2 Nov 2021 07:30: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 706A320BB3; Tue, 2 Nov 2021 07:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A27UWQD080116; Tue, 2 Nov 2021 07:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A27UWC4080115; Tue, 2 Nov 2021 07:30:32 GMT (envelope-from git) Date: Tue, 2 Nov 2021 07:30:32 GMT Message-Id: <202111020730.1A27UWC4080115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 3693250e8a74 - main - dpv.1: Do not use mdoc macros for Bl width List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3693250e8a746053291849d8442f912336f0bf1b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3693250e8a746053291849d8442f912336f0bf1b commit 3693250e8a746053291849d8442f912336f0bf1b Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:17:19 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-02 07:30:11 +0000 dpv.1: Do not use mdoc macros for Bl width Macros do not expand there. MFC after: 3 days --- usr.bin/dpv/dpv.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index dd5829f6829c..801389529946 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -94,7 +94,7 @@ or instead .Pq see Ql Fl X . .Pp The following options are available: -.Bl -tag -width ".Fl b Ar backtitle" +.Bl -tag -width "-b backtitle" .It Fl a Ar text Display .Ar text @@ -323,7 +323,7 @@ If using .Xr Xdialog 1 is required. .Sh FILES -.Bl -tag -width ".Pa $HOME/.dialogrc" -compact +.Bl -tag -width "$HOME/.dialogrc" -compact .It Pa $HOME/.dialogrc .El .Sh EXAMPLES From nobody Tue Nov 2 08:24:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E64AB182E2A6; Tue, 2 Nov 2021 08:24: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 4Hk2y25zCTz3Dq7; Tue, 2 Nov 2021 08:24: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 9A8B32184C; Tue, 2 Nov 2021 08:24: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 1A28OgZA050548; Tue, 2 Nov 2021 08:24:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A28OgCa050547; Tue, 2 Nov 2021 08:24:42 GMT (envelope-from git) Date: Tue, 2 Nov 2021 08:24:42 GMT Message-Id: <202111020824.1A28OgCa050547@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: 3dd5760aa5f8 - main - if_epair: rework List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3dd5760aa5f876f8a3f0735afeebdf9ee414e1f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3dd5760aa5f876f8a3f0735afeebdf9ee414e1f5 commit 3dd5760aa5f876f8a3f0735afeebdf9ee414e1f5 Author: Bjoern A. Zeeb AuthorDate: 2021-10-09 14:09:04 +0000 Commit: Kristof Provost CommitDate: 2021-11-02 08:23:46 +0000 if_epair: rework Rework if_epair(4) to no longer use netisr and dpcpu. Instead use mbufq and swi_net. This simplifies the code and seems to make it work better and no longer hang. Work largely by bz@, with minor tweaks by kp@. Reviewed by: bz, kp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D31077 --- sys/net/if_epair.c | 746 +++++++++++++++++------------------------------------ 1 file changed, 240 insertions(+), 506 deletions(-) diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index a62fbfad8771..e46c5271cc0f 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -2,8 +2,8 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008 The FreeBSD Foundation - * Copyright (c) 2009-2010 Bjoern A. Zeeb * All rights reserved. + * Copyright (c) 2009-2021 Bjoern A. Zeeb * * This software was developed by CK Software GmbH under sponsorship * from the FreeBSD Foundation. @@ -37,17 +37,6 @@ * This is mostly intended to be used to provide connectivity between * different virtual network stack instances. */ -/* - * Things to re-think once we have more experience: - * - ifp->if_reassign function once we can test with vimage. Depending on - * how if_vmove() is going to be improved. - * - Real random etheraddrs that are checked to be uniquish; we would need - * to re-do them in case we move the interface between network stacks - * in a private if_reassign function. - * In case we bridge to a real interface/network or between indepedent - * epairs on multiple stacks/machines, we may need this. - * For now let the user handle that case. - */ #include __FBSDID("$FreeBSD$"); @@ -61,13 +50,15 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include #include #include +#include +#include +#include #include #include @@ -80,122 +71,41 @@ __FBSDID("$FreeBSD$"); #include #include -SYSCTL_DECL(_net_link); -static SYSCTL_NODE(_net_link, OID_AUTO, epair, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "epair sysctl"); - -#ifdef EPAIR_DEBUG -static int epair_debug = 0; -SYSCTL_INT(_net_link_epair, OID_AUTO, epair_debug, CTLFLAG_RW, - &epair_debug, 0, "if_epair(4) debugging."); -#define DPRINTF(fmt, arg...) \ - if (epair_debug) \ - printf("[%s:%d] " fmt, __func__, __LINE__, ##arg) -#else -#define DPRINTF(fmt, arg...) -#endif - -static void epair_nh_sintr(struct mbuf *); -static struct mbuf *epair_nh_m2cpuid(struct mbuf *, uintptr_t, u_int *); -static void epair_nh_drainedcpu(u_int); - -static void epair_start_locked(struct ifnet *); -static int epair_media_change(struct ifnet *); -static void epair_media_status(struct ifnet *, struct ifmediareq *); - static int epair_clone_match(struct if_clone *, const char *); static int epair_clone_create(struct if_clone *, char *, size_t, caddr_t); static int epair_clone_destroy(struct if_clone *, struct ifnet *); static const char epairname[] = "epair"; -static unsigned int next_index = 0; +#define RXRSIZE 4096 /* Probably overkill by 4-8x. */ -/* Netisr related definitions and sysctl. */ -static struct netisr_handler epair_nh = { - .nh_name = epairname, - .nh_proto = NETISR_EPAIR, - .nh_policy = NETISR_POLICY_CPU, - .nh_handler = epair_nh_sintr, - .nh_m2cpuid = epair_nh_m2cpuid, - .nh_drainedcpu = epair_nh_drainedcpu, -}; +static MALLOC_DEFINE(M_EPAIR, epairname, + "Pair of virtual cross-over connected Ethernet-like interfaces"); -static int -sysctl_epair_netisr_maxqlen(SYSCTL_HANDLER_ARGS) -{ - int error, qlimit; +VNET_DEFINE_STATIC(struct if_clone *, epair_cloner); +#define V_epair_cloner VNET(epair_cloner) - netisr_getqlimit(&epair_nh, &qlimit); - error = sysctl_handle_int(oidp, &qlimit, 0, req); - if (error || !req->newptr) - return (error); - if (qlimit < 1) - return (EINVAL); - return (netisr_setqlimit(&epair_nh, qlimit)); -} -SYSCTL_PROC(_net_link_epair, OID_AUTO, netisr_maxqlen, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, - sysctl_epair_netisr_maxqlen, "I", - "Maximum if_epair(4) netisr \"hw\" queue length"); +static unsigned int next_index = 0; +#define EPAIR_LOCK_INIT() mtx_init(&epair_n_index_mtx, "epairidx", \ + NULL, MTX_DEF) +#define EPAIR_LOCK_DESTROY() mtx_destroy(&epair_n_index_mtx) +#define EPAIR_LOCK() mtx_lock(&epair_n_index_mtx) +#define EPAIR_UNLOCK() mtx_unlock(&epair_n_index_mtx) + +static void *swi_cookie[MAXCPU]; /* swi(9). */ +static STAILQ_HEAD(, epair_softc) swi_sc[MAXCPU]; +static struct mtx epair_n_index_mtx; struct epair_softc { struct ifnet *ifp; /* This ifp. */ struct ifnet *oifp; /* other ifp of pair. */ + void *swi_cookie; /* swi(9). */ + struct buf_ring *rxring[2]; + volatile int ridx; /* 0 || 1 */ struct ifmedia media; /* Media config (fake). */ - u_int refcount; /* # of mbufs in flight. */ - u_int cpuid; /* CPU ID assigned upon creation. */ - void (*if_qflush)(struct ifnet *); - /* Original if_qflush routine. */ + uint32_t cpuidx; + STAILQ_ENTRY(epair_softc) entry; }; -/* - * Per-CPU list of ifps with data in the ifq that needs to be flushed - * to the netisr ``hw'' queue before we allow any further direct queuing - * to the ``hw'' queue. - */ -struct epair_ifp_drain { - STAILQ_ENTRY(epair_ifp_drain) ifp_next; - struct ifnet *ifp; -}; -STAILQ_HEAD(eid_list, epair_ifp_drain); - -#define EPAIR_LOCK_INIT(dpcpu) mtx_init(&(dpcpu)->if_epair_mtx, \ - "if_epair", NULL, MTX_DEF) -#define EPAIR_LOCK_DESTROY(dpcpu) mtx_destroy(&(dpcpu)->if_epair_mtx) -#define EPAIR_LOCK_ASSERT(dpcpu) mtx_assert(&(dpcpu)->if_epair_mtx, \ - MA_OWNED) -#define EPAIR_LOCK(dpcpu) mtx_lock(&(dpcpu)->if_epair_mtx) -#define EPAIR_UNLOCK(dpcpu) mtx_unlock(&(dpcpu)->if_epair_mtx) - -#ifdef INVARIANTS -#define EPAIR_REFCOUNT_INIT(r, v) refcount_init((r), (v)) -#define EPAIR_REFCOUNT_AQUIRE(r) refcount_acquire((r)) -#define EPAIR_REFCOUNT_RELEASE(r) refcount_release((r)) -#define EPAIR_REFCOUNT_ASSERT(a, p) KASSERT(a, p) -#else -#define EPAIR_REFCOUNT_INIT(r, v) -#define EPAIR_REFCOUNT_AQUIRE(r) -#define EPAIR_REFCOUNT_RELEASE(r) -#define EPAIR_REFCOUNT_ASSERT(a, p) -#endif - -static MALLOC_DEFINE(M_EPAIR, epairname, - "Pair of virtual cross-over connected Ethernet-like interfaces"); - -VNET_DEFINE_STATIC(struct if_clone *, epair_cloner); -#define V_epair_cloner VNET(epair_cloner) - -/* - * DPCPU area and functions. - */ -struct epair_dpcpu { - struct mtx if_epair_mtx; /* Per-CPU locking. */ - int epair_drv_flags; /* Per-CPU ``hw'' drv flags. */ - struct eid_list epair_ifp_drain_list; /* Per-CPU list of ifps with - * data in the ifq. */ -}; -DPCPU_DEFINE(struct epair_dpcpu, epair_dpcpu); - static void epair_clear_mbuf(struct mbuf *m) { @@ -210,313 +120,179 @@ epair_clear_mbuf(struct mbuf *m) } static void -epair_dpcpu_init(void) +epair_if_input(struct epair_softc *sc, int ridx) { - struct epair_dpcpu *epair_dpcpu; - struct eid_list *s; - u_int cpuid; - - CPU_FOREACH(cpuid) { - epair_dpcpu = DPCPU_ID_PTR(cpuid, epair_dpcpu); - - /* Initialize per-cpu lock. */ - EPAIR_LOCK_INIT(epair_dpcpu); - - /* Driver flags are per-cpu as are our netisr "hw" queues. */ - epair_dpcpu->epair_drv_flags = 0; - - /* - * Initialize per-cpu drain list. - * Manually do what STAILQ_HEAD_INITIALIZER would do. - */ - s = &epair_dpcpu->epair_ifp_drain_list; - s->stqh_first = NULL; - s->stqh_last = &s->stqh_first; - } -} + struct epoch_tracker et; + struct ifnet *ifp; + struct mbuf *m; -static void -epair_dpcpu_detach(void) -{ - struct epair_dpcpu *epair_dpcpu; - u_int cpuid; + ifp = sc->ifp; + NET_EPOCH_ENTER(et); + do { + m = buf_ring_dequeue_sc(sc->rxring[ridx]); + if (m == NULL) + break; - CPU_FOREACH(cpuid) { - epair_dpcpu = DPCPU_ID_PTR(cpuid, epair_dpcpu); + MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0); + (*ifp->if_input)(ifp, m); - /* Destroy per-cpu lock. */ - EPAIR_LOCK_DESTROY(epair_dpcpu); - } + } while (1); + NET_EPOCH_EXIT(et); } -/* - * Helper functions. - */ -static u_int -cpuid_from_ifp(struct ifnet *ifp) +static void +epair_sintr(struct epair_softc *sc) { - struct epair_softc *sc; + int ridx, nidx; - if (ifp == NULL) - return (0); - sc = ifp->if_softc; + if_ref(sc->ifp); + do { + ridx = sc->ridx; + nidx = (ridx == 0) ? 1 : 0; + } while (!atomic_cmpset_int(&sc->ridx, ridx, nidx)); + epair_if_input(sc, ridx); - return (sc->cpuid); + if_rele(sc->ifp); } -/* - * Netisr handler functions. - */ static void -epair_nh_sintr(struct mbuf *m) -{ - struct ifnet *ifp; - struct epair_softc *sc __unused; - - ifp = m->m_pkthdr.rcvif; - (*ifp->if_input)(ifp, m); - sc = ifp->if_softc; - EPAIR_REFCOUNT_RELEASE(&sc->refcount); - EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1, - ("%s: ifp=%p sc->refcount not >= 1: %d", - __func__, ifp, sc->refcount)); - DPRINTF("ifp=%p refcount=%u\n", ifp, sc->refcount); -} - -static struct mbuf * -epair_nh_m2cpuid(struct mbuf *m, uintptr_t source, u_int *cpuid) +epair_intr(void *arg) { + struct epair_softc *sc; + uint32_t cpuidx; + + cpuidx = (uintptr_t)arg; + /* If this is a problem, this is a read-mostly situation. */ + EPAIR_LOCK(); + STAILQ_FOREACH(sc, &swi_sc[cpuidx], entry) { + /* Do this lockless. */ + if (buf_ring_empty(sc->rxring[sc->ridx])) + continue; + epair_sintr(sc); + } + EPAIR_UNLOCK(); - *cpuid = cpuid_from_ifp(m->m_pkthdr.rcvif); - - return (m); + return; } -static void -epair_nh_drainedcpu(u_int cpuid) +static int +epair_menq(struct mbuf *m, struct epair_softc *osc) { - struct epair_dpcpu *epair_dpcpu; - struct epair_ifp_drain *elm, *tvar; - struct ifnet *ifp; + struct ifnet *ifp, *oifp; + int len, ret; + int ridx; + short mflags; + bool was_empty; - epair_dpcpu = DPCPU_ID_PTR(cpuid, epair_dpcpu); - EPAIR_LOCK(epair_dpcpu); /* - * Assume our "hw" queue and possibly ifq will be emptied - * again. In case we will overflow the "hw" queue while - * draining, epair_start_locked will set IFF_DRV_OACTIVE - * again and we will stop and return. + * I know this looks weird. We pass the "other sc" as we need that one + * and can get both ifps from it as well. */ - STAILQ_FOREACH_SAFE(elm, &epair_dpcpu->epair_ifp_drain_list, - ifp_next, tvar) { - ifp = elm->ifp; - epair_dpcpu->epair_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - epair_start_locked(ifp); - - IFQ_LOCK(&ifp->if_snd); - if (IFQ_IS_EMPTY(&ifp->if_snd)) { - struct epair_softc *sc __unused; - - STAILQ_REMOVE(&epair_dpcpu->epair_ifp_drain_list, - elm, epair_ifp_drain, ifp_next); - /* The cached ifp goes off the list. */ - sc = ifp->if_softc; - EPAIR_REFCOUNT_RELEASE(&sc->refcount); - EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1, - ("%s: ifp=%p sc->refcount not >= 1: %d", - __func__, ifp, sc->refcount)); - free(elm, M_EPAIR); - } - IFQ_UNLOCK(&ifp->if_snd); + oifp = osc->ifp; + ifp = osc->oifp; - if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) != 0) { - /* Our "hw"q overflew again. */ - epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE; - DPRINTF("hw queue length overflow at %u\n", - epair_nh.nh_qlimit); - break; - } - } - EPAIR_UNLOCK(epair_dpcpu); -} + M_ASSERTPKTHDR(m); + epair_clear_mbuf(m); + if_setrcvif(m, oifp); + M_SETFIB(m, oifp->if_fib); -/* - * Network interface (`if') related functions. - */ -static void -epair_remove_ifp_from_draining(struct ifnet *ifp) -{ - struct epair_dpcpu *epair_dpcpu; - struct epair_ifp_drain *elm, *tvar; - u_int cpuid; - - CPU_FOREACH(cpuid) { - epair_dpcpu = DPCPU_ID_PTR(cpuid, epair_dpcpu); - EPAIR_LOCK(epair_dpcpu); - STAILQ_FOREACH_SAFE(elm, &epair_dpcpu->epair_ifp_drain_list, - ifp_next, tvar) { - if (ifp == elm->ifp) { - struct epair_softc *sc __unused; - - STAILQ_REMOVE( - &epair_dpcpu->epair_ifp_drain_list, elm, - epair_ifp_drain, ifp_next); - /* The cached ifp goes off the list. */ - sc = ifp->if_softc; - EPAIR_REFCOUNT_RELEASE(&sc->refcount); - EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1, - ("%s: ifp=%p sc->refcount not >= 1: %d", - __func__, ifp, sc->refcount)); - free(elm, M_EPAIR); - } - } - EPAIR_UNLOCK(epair_dpcpu); - } -} + /* Save values as once the mbuf is queued, it's not ours anymore. */ + len = m->m_pkthdr.len; + mflags = m->m_flags; -static int -epair_add_ifp_for_draining(struct ifnet *ifp) -{ - struct epair_dpcpu *epair_dpcpu; - struct epair_softc *sc; - struct epair_ifp_drain *elm = NULL; + MPASS(m->m_nextpkt == NULL); + MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0); - sc = ifp->if_softc; - epair_dpcpu = DPCPU_ID_PTR(sc->cpuid, epair_dpcpu); - EPAIR_LOCK_ASSERT(epair_dpcpu); - STAILQ_FOREACH(elm, &epair_dpcpu->epair_ifp_drain_list, ifp_next) - if (elm->ifp == ifp) - break; - /* If the ifp is there already, return success. */ - if (elm != NULL) + ridx = atomic_load_int(&osc->ridx); + was_empty = buf_ring_empty(osc->rxring[ridx]); + ret = buf_ring_enqueue(osc->rxring[ridx], m); + if (ret != 0) { + /* Ring is full. */ + m_freem(m); return (0); + } - elm = malloc(sizeof(struct epair_ifp_drain), M_EPAIR, M_NOWAIT|M_ZERO); - if (elm == NULL) - return (ENOMEM); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + /* + * IFQ_HANDOFF_ADJ/ip_handoff() update statistics, + * but as we bypass all this we have to duplicate + * the logic another time. + */ + if_inc_counter(ifp, IFCOUNTER_OBYTES, len); + if (mflags & (M_BCAST|M_MCAST)) + if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); + /* Someone else received the packet. */ + if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1); - elm->ifp = ifp; - /* Add a reference for the ifp pointer on the list. */ - EPAIR_REFCOUNT_AQUIRE(&sc->refcount); - STAILQ_INSERT_TAIL(&epair_dpcpu->epair_ifp_drain_list, elm, ifp_next); + /* Kick the interrupt handler for the first packet. */ + if (was_empty && osc->swi_cookie != NULL) + swi_sched(osc->swi_cookie, 0); return (0); } static void -epair_start_locked(struct ifnet *ifp) +epair_start(struct ifnet *ifp) { - struct epair_dpcpu *epair_dpcpu; struct mbuf *m; struct epair_softc *sc; struct ifnet *oifp; - int error; - - DPRINTF("ifp=%p\n", ifp); - sc = ifp->if_softc; - epair_dpcpu = DPCPU_ID_PTR(sc->cpuid, epair_dpcpu); - EPAIR_LOCK_ASSERT(epair_dpcpu); - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - return; - if ((ifp->if_flags & IFF_UP) == 0) - return; /* * We get packets here from ether_output via if_handoff() * and need to put them into the input queue of the oifp - * and call oifp->if_input() via netisr/epair_sintr(). + * and will put the packet into the receive-queue (rxq) of the + * other interface (oifp) of our pair. */ + sc = ifp->if_softc; oifp = sc->oifp; sc = oifp->if_softc; for (;;) { IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) break; + M_ASSERTPKTHDR(m); BPF_MTAP(ifp, m); - /* - * In case the outgoing interface is not usable, - * drop the packet. - */ - if ((oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - (oifp->if_flags & IFF_UP) ==0) { - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + /* In case either interface is not usable drop the packet. */ + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (ifp->if_flags & IFF_UP) == 0 || + (oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (oifp->if_flags & IFF_UP) == 0) { m_freem(m); continue; } - DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname); - - epair_clear_mbuf(m); - - /* - * Add a reference so the interface cannot go while the - * packet is in transit as we rely on rcvif to stay valid. - */ - EPAIR_REFCOUNT_AQUIRE(&sc->refcount); - m->m_pkthdr.rcvif = oifp; - CURVNET_SET_QUIET(oifp->if_vnet); - error = netisr_queue(NETISR_EPAIR, m); - CURVNET_RESTORE(); - if (!error) { - if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); - /* Someone else received the packet. */ - if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1); - } else { - /* The packet was freed already. */ - epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - (void) epair_add_ifp_for_draining(ifp); - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - EPAIR_REFCOUNT_RELEASE(&sc->refcount); - EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1, - ("%s: ifp=%p sc->refcount not >= 1: %d", - __func__, oifp, sc->refcount)); - } - } -} -static void -epair_start(struct ifnet *ifp) -{ - struct epair_dpcpu *epair_dpcpu; - - epair_dpcpu = DPCPU_ID_PTR(cpuid_from_ifp(ifp), epair_dpcpu); - EPAIR_LOCK(epair_dpcpu); - epair_start_locked(ifp); - EPAIR_UNLOCK(epair_dpcpu); + (void) epair_menq(m, sc); + } } static int -epair_transmit_locked(struct ifnet *ifp, struct mbuf *m) +epair_transmit(struct ifnet *ifp, struct mbuf *m) { - struct epair_dpcpu *epair_dpcpu; struct epair_softc *sc; struct ifnet *oifp; int error, len; short mflags; - DPRINTF("ifp=%p m=%p\n", ifp, m); - sc = ifp->if_softc; - epair_dpcpu = DPCPU_ID_PTR(sc->cpuid, epair_dpcpu); - EPAIR_LOCK_ASSERT(epair_dpcpu); - if (m == NULL) return (0); + M_ASSERTPKTHDR(m); /* * We are not going to use the interface en/dequeue mechanism * on the TX side. We are called from ether_output_frame() - * and will put the packet into the incoming queue of the - * other interface of our pair via the netsir. + * and will put the packet into the receive-queue (rxq) of the + * other interface (oifp) of our pair. */ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { m_freem(m); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENXIO); } if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENETDOWN); } @@ -526,16 +302,16 @@ epair_transmit_locked(struct ifnet *ifp, struct mbuf *m) * In case the outgoing interface is not usable, * drop the packet. */ + sc = ifp->if_softc; oifp = sc->oifp; if ((oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - (oifp->if_flags & IFF_UP) ==0) { + (oifp->if_flags & IFF_UP) == 0) { if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (0); } len = m->m_pkthdr.len; mflags = m->m_flags; - DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname); #ifdef ALTQ /* Support ALTQ via the classic if_start() path. */ @@ -549,99 +325,17 @@ epair_transmit_locked(struct ifnet *ifp, struct mbuf *m) if_inc_counter(ifp, IFCOUNTER_OBYTES, len); if (mflags & (M_BCAST|M_MCAST)) if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); - - if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) - epair_start_locked(ifp); - else - (void)epair_add_ifp_for_draining(ifp); + epair_start(ifp); } return (error); } IF_UNLOCK(&ifp->if_snd); #endif - if ((epair_dpcpu->epair_drv_flags & IFF_DRV_OACTIVE) != 0) { - /* - * Our hardware queue is full, try to fall back - * queuing to the ifq but do not call ifp->if_start. - * Either we are lucky or the packet is gone. - */ - IFQ_ENQUEUE(&ifp->if_snd, m, error); - if (!error) - (void)epair_add_ifp_for_draining(ifp); - return (error); - } - - epair_clear_mbuf(m); - - sc = oifp->if_softc; - /* - * Add a reference so the interface cannot go while the - * packet is in transit as we rely on rcvif to stay valid. - */ - EPAIR_REFCOUNT_AQUIRE(&sc->refcount); - m->m_pkthdr.rcvif = oifp; - CURVNET_SET_QUIET(oifp->if_vnet); - error = netisr_queue(NETISR_EPAIR, m); - CURVNET_RESTORE(); - if (!error) { - if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); - /* - * IFQ_HANDOFF_ADJ/ip_handoff() update statistics, - * but as we bypass all this we have to duplicate - * the logic another time. - */ - if_inc_counter(ifp, IFCOUNTER_OBYTES, len); - if (mflags & (M_BCAST|M_MCAST)) - if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); - /* Someone else received the packet. */ - if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1); - } else { - /* The packet was freed already. */ - epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - EPAIR_REFCOUNT_RELEASE(&sc->refcount); - EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1, - ("%s: ifp=%p sc->refcount not >= 1: %d", - __func__, oifp, sc->refcount)); - } - - return (error); -} - -static int -epair_transmit(struct ifnet *ifp, struct mbuf *m) -{ - struct epair_dpcpu *epair_dpcpu; - int error; - - epair_dpcpu = DPCPU_ID_PTR(cpuid_from_ifp(ifp), epair_dpcpu); - EPAIR_LOCK(epair_dpcpu); - error = epair_transmit_locked(ifp, m); - EPAIR_UNLOCK(epair_dpcpu); + error = epair_menq(m, oifp->if_softc); return (error); } -static void -epair_qflush(struct ifnet *ifp) -{ - struct epair_softc *sc; - - sc = ifp->if_softc; - KASSERT(sc != NULL, ("%s: ifp=%p, epair_softc gone? sc=%p\n", - __func__, ifp, sc)); - /* - * Remove this ifp from all backpointer lists. The interface will not - * usable for flushing anyway nor should it have anything to flush - * after if_qflush(). - */ - epair_remove_ifp_from_draining(ifp); - - if (sc->if_qflush) - sc->if_qflush(ifp); -} - static int epair_media_change(struct ifnet *ifp __unused) { @@ -709,8 +403,6 @@ epair_clone_match(struct if_clone *ifc, const char *name) { const char *cp; - DPRINTF("name='%s'\n", name); - /* * Our base name is epair. * Our interfaces will be named epair[ab]. @@ -799,16 +491,16 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) /* Allocate memory for both [ab] interfaces */ sca = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO); - EPAIR_REFCOUNT_INIT(&sca->refcount, 1); sca->ifp = if_alloc(IFT_ETHER); if (sca->ifp == NULL) { free(sca, M_EPAIR); ifc_free_unit(ifc, unit); return (ENOSPC); } + sca->rxring[0] = buf_ring_alloc(RXRSIZE, M_EPAIR, M_WAITOK,NULL); + sca->rxring[1] = buf_ring_alloc(RXRSIZE, M_EPAIR, M_WAITOK, NULL); scb = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO); - EPAIR_REFCOUNT_INIT(&scb->refcount, 1); scb->ifp = if_alloc(IFT_ETHER); if (scb->ifp == NULL) { free(scb, M_EPAIR); @@ -817,6 +509,8 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) ifc_free_unit(ifc, unit); return (ENOSPC); } + scb->rxring[0] = buf_ring_alloc(RXRSIZE, M_EPAIR, M_WAITOK, NULL); + scb->rxring[1] = buf_ring_alloc(RXRSIZE, M_EPAIR, M_WAITOK, NULL); /* * Cross-reference the interfaces so we will be able to free both. @@ -824,16 +518,49 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) sca->oifp = scb->ifp; scb->oifp = sca->ifp; - /* - * Calculate the cpuid for netisr queueing based on the - * ifIndex of the interfaces. As long as we cannot configure - * this or use cpuset information easily we cannot guarantee - * cache locality but we can at least allow parallelism. - */ - sca->cpuid = - netisr_get_cpuid(sca->ifp->if_index); - scb->cpuid = - netisr_get_cpuid(scb->ifp->if_index); + EPAIR_LOCK(); +#ifdef SMP + /* Get an approximate distribution. */ + hash = next_index % mp_ncpus; +#else + hash = 0; +#endif + if (swi_cookie[hash] == NULL) { + void *cookie; + + EPAIR_UNLOCK(); + error = swi_add(NULL, epairname, + epair_intr, (void *)(uintptr_t)hash, + SWI_NET, INTR_MPSAFE, &cookie); + if (error) { + buf_ring_free(scb->rxring[0], M_EPAIR); + buf_ring_free(scb->rxring[1], M_EPAIR); + if_free(scb->ifp); + free(scb, M_EPAIR); + buf_ring_free(sca->rxring[0], M_EPAIR); + buf_ring_free(sca->rxring[1], M_EPAIR); + if_free(sca->ifp); + free(sca, M_EPAIR); + ifc_free_unit(ifc, unit); + return (ENOSPC); + } + EPAIR_LOCK(); + /* Recheck under lock even though a race is very unlikely. */ + if (swi_cookie[hash] == NULL) { + swi_cookie[hash] = cookie; + } else { + EPAIR_UNLOCK(); + (void) swi_remove(cookie); + EPAIR_LOCK(); + } + } + sca->cpuidx = hash; + STAILQ_INSERT_TAIL(&swi_sc[hash], sca, entry); + sca->swi_cookie = swi_cookie[hash]; + scb->cpuidx = hash; + STAILQ_INSERT_TAIL(&swi_sc[hash], scb, entry); + scb->swi_cookie = swi_cookie[hash]; + EPAIR_UNLOCK(); /* Initialise pseudo media types. */ ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status); @@ -850,6 +577,7 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) ifp->if_dname = epairname; ifp->if_dunit = unit; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_flags |= IFF_KNOWSEPOCH; ifp->if_capabilities = IFCAP_VLAN_MTU; ifp->if_capenable = IFCAP_VLAN_MTU; ifp->if_start = epair_start; @@ -870,12 +598,14 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) if (hostid == 0) arc4rand(&hostid, sizeof(hostid), 0); + EPAIR_LOCK(); if (ifp->if_index > next_index) next_index = ifp->if_index; else next_index++; key[0] = (uint32_t)next_index; + EPAIR_UNLOCK(); key[1] = (uint32_t)(hostid & 0xffffffff); key[2] = (uint32_t)((hostid >> 32) & 0xfffffffff); hash = jenkins_hash32(key, 3, 0); @@ -884,10 +614,8 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) memcpy(&eaddr[1], &hash, 4); eaddr[5] = 0x0a; ether_ifattach(ifp, eaddr); - sca->if_qflush = ifp->if_qflush; - ifp->if_qflush = epair_qflush; - ifp->if_transmit = epair_transmit; ifp->if_baudrate = IF_Gbps(10); /* arbitrary maximum */ + ifp->if_transmit = epair_transmit; /* Swap the name and finish initialization of interface b. */ *dp = 'b'; @@ -912,27 +640,40 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) strlcpy(name, scb->ifp->if_xname, len); epair_clone_add(ifc, scb); - scb->if_qflush = ifp->if_qflush; - ifp->if_qflush = epair_qflush; - ifp->if_transmit = epair_transmit; ifp->if_baudrate = IF_Gbps(10); /* arbitrary maximum */ + ifp->if_transmit = epair_transmit; /* * Restore name to a as the ifp for this will go into the * cloner list for the initial call. */ strlcpy(name, sca->ifp->if_xname, len); - DPRINTF("name='%s/%db' created sca=%p scb=%p\n", name, unit, sca, scb); /* Tell the world, that we are ready to rock. */ sca->ifp->if_drv_flags |= IFF_DRV_RUNNING; - scb->ifp->if_drv_flags |= IFF_DRV_RUNNING; if_link_state_change(sca->ifp, LINK_STATE_UP); + scb->ifp->if_drv_flags |= IFF_DRV_RUNNING; if_link_state_change(scb->ifp, LINK_STATE_UP); return (0); } +static void +epair_drain_rings(struct epair_softc *sc) +{ + int ridx; + struct mbuf *m; + + for (ridx = 0; ridx < 2; ridx++) { + do { + m = buf_ring_dequeue_sc(sc->rxring[ridx]); + if (m == NULL) + break; + m_freem(m); + } while (1); + } +} + static int epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) { @@ -940,8 +681,6 @@ epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) struct epair_softc *sca, *scb; int unit, error; - DPRINTF("ifp=%p\n", ifp); - /* * In case we called into if_clone_destroyif() ourselves * again to remove the second interface, the softc will be @@ -955,27 +694,26 @@ epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) oifp = sca->oifp; scb = oifp->if_softc; - DPRINTF("ifp=%p oifp=%p\n", ifp, oifp); + /* Frist get the interfaces down and detached. */ if_link_state_change(ifp, LINK_STATE_DOWN); - if_link_state_change(oifp, LINK_STATE_DOWN); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(oifp, LINK_STATE_DOWN); oifp->if_drv_flags &= ~IFF_DRV_RUNNING; - /* - * Get rid of our second half. As the other of the two - * interfaces may reside in a different vnet, we need to - * switch before freeing them. - */ - CURVNET_SET_QUIET(oifp->if_vnet); + ether_ifdetach(ifp); ether_ifdetach(oifp); - /* - * Wait for all packets to be dispatched to if_input. - * The numbers can only go down as the interface is - * detached so there is no need to use atomics. - */ - DPRINTF("scb refcnt=%u\n", scb->refcount); - EPAIR_REFCOUNT_ASSERT(scb->refcount == 1, - ("%s: ifp=%p scb->refcount!=1: %d", __func__, oifp, scb->refcount)); + + /* Second stop interrupt handler. */ + EPAIR_LOCK(); + STAILQ_REMOVE(&swi_sc[sca->cpuidx], sca, epair_softc, entry); + STAILQ_REMOVE(&swi_sc[scb->cpuidx], scb, epair_softc, entry); + EPAIR_UNLOCK(); + sca->swi_cookie = NULL; + scb->swi_cookie = NULL; + + /* Third free any queued packets and all the resources. */ + CURVNET_SET_QUIET(oifp->if_vnet); + epair_drain_rings(scb); oifp->if_softc = NULL; error = if_clone_destroyif(ifc, oifp); if (error) @@ -983,19 +721,19 @@ epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) __func__, error); if_free(oifp); ifmedia_removeall(&scb->media); + buf_ring_free(scb->rxring[0], M_EPAIR); + buf_ring_free(scb->rxring[1], M_EPAIR); *** 103 LINES SKIPPED *** From nobody Tue Nov 2 08:42:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3F8921836658; Tue, 2 Nov 2021 08:42: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 4Hk3Ln16MBz3KZb; Tue, 2 Nov 2021 08:42: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 F037621BE0; Tue, 2 Nov 2021 08:42: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 1A28geXp076446; Tue, 2 Nov 2021 08:42:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A28ge5u076445; Tue, 2 Nov 2021 08:42:40 GMT (envelope-from git) Date: Tue, 2 Nov 2021 08:42:40 GMT Message-Id: <202111020842.1A28ge5u076445@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: f8b998c73058 - stable/13 - usb(4): Fix for use after free in combination with EVDEV_SUPPORT. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: f8b998c73058412eb5d3111ba5784bf3ae11534c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f8b998c73058412eb5d3111ba5784bf3ae11534c commit f8b998c73058412eb5d3111ba5784bf3ae11534c Author: Hans Petter Selasky AuthorDate: 2021-10-24 11:38:04 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-02 08:37:25 +0000 usb(4): Fix for use after free in combination with EVDEV_SUPPORT. When EVDEV_SUPPORT was introduced, the USB transfers may be running after the main FIFO is closed. In connection to this a race may appear which can lead to use-after-free scenarios. Fix this for all FIFO consumers by initializing and resetting the FIFO queues under the lock used by the client. Then the client driver will see an empty queue in all cases a race may appear. Found by: pho@ Sponsored by: NVIDIA Networking (cherry picked from commit aad0c65d6b37364d8ba92ecb8c85e004398a5194) --- sys/dev/usb/usb_dev.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index 88b36e68976b..99b243464f6c 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -1938,18 +1938,30 @@ int usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, uint16_t nbuf) { + struct usb_ifqueue temp_q = {}; + void *queue_data; + usb_fifo_free_buffer(f); - /* allocate an endpoint */ - f->free_q.ifq_maxlen = nbuf; - f->used_q.ifq_maxlen = nbuf; + temp_q.ifq_maxlen = nbuf; - f->queue_data = usb_alloc_mbufs( - M_USBDEV, &f->free_q, bufsize, nbuf); + queue_data = usb_alloc_mbufs( + M_USBDEV, &temp_q, bufsize, nbuf); - if ((f->queue_data == NULL) && bufsize && nbuf) { + if (queue_data == NULL && bufsize != 0 && nbuf != 0) return (ENOMEM); - } + + mtx_lock(f->priv_mtx); + + /* + * Setup queues and sizes under lock to avoid early use by + * concurrent FIFO access: + */ + f->free_q = temp_q; + f->used_q.ifq_maxlen = nbuf; + f->queue_data = queue_data; + mtx_unlock(f->priv_mtx); + return (0); /* success */ } @@ -1962,15 +1974,24 @@ usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, void usb_fifo_free_buffer(struct usb_fifo *f) { - if (f->queue_data) { - /* free old buffer */ - free(f->queue_data, M_USBDEV); - f->queue_data = NULL; - } - /* reset queues */ + void *queue_data; + + mtx_lock(f->priv_mtx); + + /* Get and clear pointer to free, if any. */ + queue_data = f->queue_data; + f->queue_data = NULL; + /* + * Reset queues under lock to avoid use of freed buffers by + * concurrent FIFO activity: + */ memset(&f->free_q, 0, sizeof(f->free_q)); memset(&f->used_q, 0, sizeof(f->used_q)); + mtx_unlock(f->priv_mtx); + + /* Free old buffer, if any. */ + free(queue_data, M_USBDEV); } void From nobody Tue Nov 2 08:44:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5136F1836E50; Tue, 2 Nov 2021 08:44: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 4Hk3Nh1kfGz3LFN; Tue, 2 Nov 2021 08:44: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 1065221A4B; Tue, 2 Nov 2021 08:44: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 1A28iJqi076688; Tue, 2 Nov 2021 08:44:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A28iJUE076687; Tue, 2 Nov 2021 08:44:19 GMT (envelope-from git) Date: Tue, 2 Nov 2021 08:44:19 GMT Message-Id: <202111020844.1A28iJUE076687@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: bb9bee1ffbb2 - stable/12 - usb(4): Fix for use after free in combination with EVDEV_SUPPORT. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: bb9bee1ffbb27f903bfd2c11d681d331bea727ea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bb9bee1ffbb27f903bfd2c11d681d331bea727ea commit bb9bee1ffbb27f903bfd2c11d681d331bea727ea Author: Hans Petter Selasky AuthorDate: 2021-10-24 11:38:04 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-02 08:43:44 +0000 usb(4): Fix for use after free in combination with EVDEV_SUPPORT. When EVDEV_SUPPORT was introduced, the USB transfers may be running after the main FIFO is closed. In connection to this a race may appear which can lead to use-after-free scenarios. Fix this for all FIFO consumers by initializing and resetting the FIFO queues under the lock used by the client. Then the client driver will see an empty queue in all cases a race may appear. Found by: pho@ Sponsored by: NVIDIA Networking (cherry picked from commit aad0c65d6b37364d8ba92ecb8c85e004398a5194) --- sys/dev/usb/usb_dev.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index 9cd54bf0032c..d1a65bf8561b 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -1951,18 +1951,30 @@ int usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, uint16_t nbuf) { + struct usb_ifqueue temp_q = {}; + void *queue_data; + usb_fifo_free_buffer(f); - /* allocate an endpoint */ - f->free_q.ifq_maxlen = nbuf; - f->used_q.ifq_maxlen = nbuf; + temp_q.ifq_maxlen = nbuf; - f->queue_data = usb_alloc_mbufs( - M_USBDEV, &f->free_q, bufsize, nbuf); + queue_data = usb_alloc_mbufs( + M_USBDEV, &temp_q, bufsize, nbuf); - if ((f->queue_data == NULL) && bufsize && nbuf) { + if (queue_data == NULL && bufsize != 0 && nbuf != 0) return (ENOMEM); - } + + mtx_lock(f->priv_mtx); + + /* + * Setup queues and sizes under lock to avoid early use by + * concurrent FIFO access: + */ + f->free_q = temp_q; + f->used_q.ifq_maxlen = nbuf; + f->queue_data = queue_data; + mtx_unlock(f->priv_mtx); + return (0); /* success */ } @@ -1975,15 +1987,24 @@ usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, void usb_fifo_free_buffer(struct usb_fifo *f) { - if (f->queue_data) { - /* free old buffer */ - free(f->queue_data, M_USBDEV); - f->queue_data = NULL; - } - /* reset queues */ + void *queue_data; + + mtx_lock(f->priv_mtx); + + /* Get and clear pointer to free, if any. */ + queue_data = f->queue_data; + f->queue_data = NULL; + /* + * Reset queues under lock to avoid use of freed buffers by + * concurrent FIFO activity: + */ memset(&f->free_q, 0, sizeof(f->free_q)); memset(&f->used_q, 0, sizeof(f->used_q)); + mtx_unlock(f->priv_mtx); + + /* Free old buffer, if any. */ + free(queue_data, M_USBDEV); } void From nobody Tue Nov 2 09:07:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E9B8A1842126; Tue, 2 Nov 2021 09:07: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 4Hk3tt69TQz3jCn; Tue, 2 Nov 2021 09:07: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 B591422255; Tue, 2 Nov 2021 09:07: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 1A2972N3004618; Tue, 2 Nov 2021 09:07:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A297227004617; Tue, 2 Nov 2021 09:07:02 GMT (envelope-from git) Date: Tue, 2 Nov 2021 09:07:02 GMT Message-Id: <202111020907.1A297227004617@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: 6d04e1422e70 - main - cosl(): fix polynomial approximation coefficients for ld128 version List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6d04e1422e70ca0a77552782c01c291f90716773 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6d04e1422e70ca0a77552782c01c291f90716773 commit 6d04e1422e70ca0a77552782c01c291f90716773 Author: Steve Kargl AuthorDate: 2021-11-02 08:54:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-02 08:54:10 +0000 cosl(): fix polynomial approximation coefficients for ld128 version As mention previously, the minmax polynomial approximation in the kernel for cosl() seem to have a bad set of coefficients. In testing, cosl() in the interval [0.785, pi/4] for 1 million values and pi/4 written to 37 decimal digits. The old version on an aarch64 system gave % tlibm/tlibm_lmath -l -x 0.78 -X 7.85398163397448309615660845819875721e-1L cos Interval tested for cosl: [0.78,0.785398] count: 1000000 xm = 7.80213913234863919029058821396125599e-01L libm = 7.10763080972549562455058499280609083e-01L mpfr = 7.10763080972549562455058499280608983e-01L ULP = 1.04431 The max ULP exceeds 1, which is not good. So, I rinsed off a 10 year code and recomputed coefficients. The new minmax polynomial now yields % tlibm/tlibm_lmath -l -x 0.78 -X 7.85398163397448309615660845819875721e-1L cos Interval tested for cosl: [0.78,0.785398] count: 1000000 xm = 7.82916198746768272588844890973704219e-01L libm = 7.08859615479571058183956453286628396e-01L mpfr = 7.08859615479571058183956453286628469e-01L ULP = 0.75407 which is very good. PR: 218514 MFC after: 1 week --- lib/msun/ld128/k_cosl.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/msun/ld128/k_cosl.c b/lib/msun/ld128/k_cosl.c index fe57773a1348..422357bf8a6c 100644 --- a/lib/msun/ld128/k_cosl.c +++ b/lib/msun/ld128/k_cosl.c @@ -21,8 +21,8 @@ __FBSDID("$FreeBSD$"); #include "math_private.h" /* - * Domain [-0.7854, 0.7854], range ~[-1.80e-37, 1.79e-37]: - * |cos(x) - c(x))| < 2**-122.0 + * Domain [-0.7854, 0.7854], range ~[-1.17e-39, 1.19e-39]: + * |cos(x) - c(x))| < 2**-129.3 * * 113-bit precision requires more care than 64-bit precision, since * simple methods give a minimax polynomial with coefficient for x^2 @@ -31,21 +31,19 @@ __FBSDID("$FreeBSD$"); */ static const double one = 1.0; - static const long double -C1 = 0.04166666666666666666666666666666658424671L, -C2 = -0.001388888888888888888888888888863490893732L, -C3 = 0.00002480158730158730158730158600795304914210L, -C4 = -0.2755731922398589065255474947078934284324e-6L, -C5 = 0.2087675698786809897659225313136400793948e-8L, -C6 = -0.1147074559772972315817149986812031204775e-10L, -C7 = 0.4779477332386808976875457937252120293400e-13L; - -static const double -C8 = -0.1561920696721507929516718307820958119868e-15, -C9 = 0.4110317413744594971475941557607804508039e-18, -C10 = -0.8896592467191938803288521958313920156409e-21, -C11 = 0.1601061435794535138244346256065192782581e-23; +C1 = 4.16666666666666666666666666666666667e-02L, +C2 = -1.38888888888888888888888888888888834e-03L, +C3 = 2.48015873015873015873015873015446795e-05L, +C4 = -2.75573192239858906525573190949988493e-07L, +C5 = 2.08767569878680989792098886701451072e-09L, +C6 = -1.14707455977297247136657111139971865e-11L, +C7 = 4.77947733238738518870113294139830239e-14L, +C8 = -1.56192069685858079920640872925306403e-16L, +C9 = 4.11031762320473354032038893429515732e-19L, +C10= -8.89679121027589608738005163931958096e-22L, +C11= 1.61171797801314301767074036661901531e-24L, +C12= -2.46748624357670948912574279501044295e-27L; long double __kernel_cosl(long double x, long double y) @@ -54,7 +52,7 @@ __kernel_cosl(long double x, long double y) z = x*x; r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+ - z*(C8+z*(C9+z*(C10+z*C11)))))))))); + z*(C8+z*(C9+z*(C10+z*(C11+z*C12))))))))))); hz = 0.5*z; w = one-hz; return w + (((one-w)-hz) + (z*r-x*y)); From nobody Tue Nov 2 10:34:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2CA931822C29; Tue, 2 Nov 2021 10:34: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 4Hk5rG0r9hz4dQn; Tue, 2 Nov 2021 10:34: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 E60D6235CF; Tue, 2 Nov 2021 10:34: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 1A2AYr4j024075; Tue, 2 Nov 2021 10:34:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2AYr2C024074; Tue, 2 Nov 2021 10:34:53 GMT (envelope-from git) Date: Tue, 2 Nov 2021 10:34:53 GMT Message-Id: <202111021034.1A2AYr2C024074@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: a670e1c13a52 - main - arm: Fix handling of undefined instruction aborts in THUMB2 mode. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: a670e1c13a522df4fb8c63bb023b88b1d65de797 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=a670e1c13a522df4fb8c63bb023b88b1d65de797 commit a670e1c13a522df4fb8c63bb023b88b1d65de797 Author: Michal Meloun AuthorDate: 2021-10-17 17:36:33 +0000 Commit: Michal Meloun CommitDate: 2021-11-02 10:11:44 +0000 arm: Fix handling of undefined instruction aborts in THUMB2 mode. Correctly recognize NEON/SIMD and VFP instructions in THUMB2 mode and pass these to the appropriate handler. Note that it is not necessary to filter all undefined instruction variant or register combinations, this is a job for given handler. Reported by: Robert Clausecker PR: 259187 MFC after: 2 weks --- sys/arm/arm/undefined.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c index 4e9a5295d338..d95b02e2bbb4 100644 --- a/sys/arm/arm/undefined.c +++ b/sys/arm/arm/undefined.c @@ -90,13 +90,25 @@ __FBSDID("$FreeBSD$"); #define ARM_COPROC_INSN(insn) (((insn) & (1 << 27)) != 0) #define ARM_VFP_INSN(insn) ((((insn) & 0xfe000000) == 0xf2000000) || \ - (((insn) & 0xff100000) == 0xf4000000)) + (((insn) & 0xff100000) == 0xf4000000)) #define ARM_COPROC(insn) (((insn) >> 8) & 0xf) -#define THUMB_32BIT_INSN(insn) ((insn) >= 0xe800) +#define THUMB_32BIT_INSN(insn) ((((insn) & 0xe000) == 0xe000) && \ + (((insn) & 0x1800) != 0)) +/* + * Coprocessor, Advanced SIMD, and + * Floating-point instructions on page A6-251 + * OP1 == 01 OR 11 + * OP2 == 1xxxxxx + */ #define THUMB_COPROC_INSN(insn) (((insn) & (3 << 26)) == (3 << 26)) -#define THUMB_COPROC_UNDEFINED(insn) (((insn) & 0x3e << 20) == 0) -#define THUMB_VFP_INSN(insn) (((insn) & (3 << 24)) == (3 << 24)) +/* + * Advanced SIMD element or structure + * load/store instructions on page A7-275 + * OP1 == 11 + * OP2 == 001xxx0 +*/ +#define THUMB_VFP_INSN(insn) (((insn) & (0x1F1 << 20)) == (0x190 << 20)) #define THUMB_COPROC(insn) (((insn) >> 8) & 0xf) #define COPROC_VFP 10 @@ -278,18 +290,13 @@ undefinedinstruction(struct trapframe *frame) fault_instruction <<= 16; fault_instruction |= *(uint16_t *)(fault_pc + 2); - /* - * Is it a Coprocessor, Advanced SIMD, or - * Floating-point instruction. - */ - if (THUMB_COPROC_INSN(fault_instruction)) { - if (THUMB_COPROC_UNDEFINED(fault_instruction)) { - /* undefined insn */ - } else if (THUMB_VFP_INSN(fault_instruction)) - coprocessor = COPROC_VFP; - else - coprocessor = - THUMB_COPROC(fault_instruction); + /* Coprocessor, Advanced SIMD and Floating-point */ + if (THUMB_COPROC_INSN(fault_instruction)) + coprocessor = THUMB_COPROC(fault_instruction); + else { + /* Advanced SIMD load/store */ + if (THUMB_VFP_INSN(fault_instruction)) + coprocessor = COPROC_VFP; /* SIMD */ } } #else From nobody Tue Nov 2 14:05:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CE3F71843A07 for ; Tue, 2 Nov 2021 14:05: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 4HkBWq5QNwz4gdK; Tue, 2 Nov 2021 14:05: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 9A5512658E; Tue, 2 Nov 2021 14:05: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 1A2E5xxZ004267; Tue, 2 Nov 2021 14:05:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2E5xD0004266; Tue, 2 Nov 2021 14:05:59 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:05:59 GMT Message-Id: <202111021405.1A2E5xD0004266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: bdc677eec9e1 - internal/admin - Safekeep src bit of roberto@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: bdc677eec9e151c045a83434d95ce39b6ef3323d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bdc677eec9e151c045a83434d95ce39b6ef3323d commit bdc677eec9e151c045a83434d95ce39b6ef3323d Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:05:31 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:05:31 +0000 Safekeep src bit of roberto@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 275def0e150c..8f9707566697 100644 --- a/access +++ b/access @@ -163,7 +163,6 @@ rew rgrimes rlibby rmacklem -roberto royger rpokala rrs From nobody Tue Nov 2 14:07:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3F4F71843C45 for ; Tue, 2 Nov 2021 14: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 4HkBYW1L1hz4gw9; Tue, 2 Nov 2021 14: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 0E2A826517; Tue, 2 Nov 2021 14: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 1A2E7QaA004474; Tue, 2 Nov 2021 14:07:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2E7QF3004473; Tue, 2 Nov 2021 14:07:26 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:07:26 GMT Message-Id: <202111021407.1A2E7QF3004473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 795a65fbf16c - internal/admin - Safekeep src bit of slavash@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 795a65fbf16c631e8eb8289273d527e432207334 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=795a65fbf16c631e8eb8289273d527e432207334 commit 795a65fbf16c631e8eb8289273d527e432207334 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:07:00 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:07:00 +0000 Safekeep src bit of slavash@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 8f9707566697..a8e60b829068 100644 --- a/access +++ b/access @@ -178,7 +178,6 @@ sef sgalabov shurd sjg -slavash sobomax stevek syrinx From nobody Tue Nov 2 14:09:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 13A801844422 for ; Tue, 2 Nov 2021 14:09: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 4HkBbX06N0z4hlT; Tue, 2 Nov 2021 14:09: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 D7CF1262BA; Tue, 2 Nov 2021 14:09: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 1A2E9BaP004736; Tue, 2 Nov 2021 14:09:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2E9BOm004735; Tue, 2 Nov 2021 14:09:11 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:09:11 GMT Message-Id: <202111021409.1A2E9BOm004735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: fb63cce0b7d1 - internal/admin - Safekeep src bit of shurd@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: fb63cce0b7d1eacd8cda31eda4f916c97b74302c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fb63cce0b7d1eacd8cda31eda4f916c97b74302c commit fb63cce0b7d1eacd8cda31eda4f916c97b74302c Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:08:52 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:08:52 +0000 Safekeep src bit of shurd@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index a8e60b829068..675a528f933e 100644 --- a/access +++ b/access @@ -176,7 +176,6 @@ scottph se sef sgalabov -shurd sjg sobomax stevek From nobody Tue Nov 2 14:10:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5974F1845EBB for ; Tue, 2 Nov 2021 14:10: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 4HkBdN22z4z4jws; Tue, 2 Nov 2021 14:10: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 26D6326593; Tue, 2 Nov 2021 14:10: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 1A2EAm7S013160; Tue, 2 Nov 2021 14:10:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EAmnG013159; Tue, 2 Nov 2021 14:10:48 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:10:48 GMT Message-Id: <202111021410.1A2EAmnG013159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: d65c68dbcfeb - internal/admin - Safekeep src bit of arybchik@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: d65c68dbcfeb75c3bd78e78b551ebaee4d80837f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d65c68dbcfeb75c3bd78e78b551ebaee4d80837f commit d65c68dbcfeb75c3bd78e78b551ebaee4d80837f Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:10:27 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:10:27 +0000 Safekeep src bit of arybchik@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 675a528f933e..5acad8056e59 100644 --- a/access +++ b/access @@ -27,7 +27,6 @@ andrew anish antoine arichardson -arybchik asomers avatar avg From nobody Tue Nov 2 14:12:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD12418475EB for ; Tue, 2 Nov 2021 14:12:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HkBgY5Mxxz4l40; Tue, 2 Nov 2021 14:12: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 9846C264BF; Tue, 2 Nov 2021 14:12: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 1A2ECfxT017501; Tue, 2 Nov 2021 14:12:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2ECfhd017500; Tue, 2 Nov 2021 14:12:41 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:12:41 GMT Message-Id: <202111021412.1A2ECfhd017500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 81f03b19c556 - internal/admin - Safekeep src bit of avos@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 81f03b19c556f08c683ca02b9be2465a04dd06f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=81f03b19c556f08c683ca02b9be2465a04dd06f5 commit 81f03b19c556f08c683ca02b9be2465a04dd06f5 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:12:16 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:12:16 +0000 Safekeep src bit of avos@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 5acad8056e59..4380d7731ea2 100644 --- a/access +++ b/access @@ -30,7 +30,6 @@ arichardson asomers avatar avg -avos bapt bcran bdragon From nobody Tue Nov 2 14:13:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 51D051847D13 for ; Tue, 2 Nov 2021 14:13: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 4HkBhz1sP3z4lV6; Tue, 2 Nov 2021 14:13: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 193F1266A5; Tue, 2 Nov 2021 14:13: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 1A2EDt9a017688; Tue, 2 Nov 2021 14:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EDtNh017687; Tue, 2 Nov 2021 14:13:55 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:13:55 GMT Message-Id: <202111021413.1A2EDtNh017687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: c9c160773a15 - internal/admin - Safekeep src bit of emax@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: c9c160773a15d25e35791076f899eb67c946195b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c9c160773a15d25e35791076f899eb67c946195b commit c9c160773a15d25e35791076f899eb67c946195b Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:13:33 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:13:33 +0000 Safekeep src bit of emax@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 4380d7731ea2..d9d703671c83 100644 --- a/access +++ b/access @@ -60,7 +60,6 @@ dteske dwmalone dwmalone=freebsd-committers@maths.tcd.ie eadler emaste -emax erj eugen fabient From nobody Tue Nov 2 14:29:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 28351184E744 for ; Tue, 2 Nov 2021 14:29: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 4HkC2V0dS8z4rPd; Tue, 2 Nov 2021 14:29: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 EA13426669; Tue, 2 Nov 2021 14:29: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 1A2ET5re031327; Tue, 2 Nov 2021 14:29:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2ET5BK031326; Tue, 2 Nov 2021 14:29:05 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:29:05 GMT Message-Id: <202111021429.1A2ET5BK031326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 87a496bd9aa7 - internal/admin - Safekeep src bit of fabient@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 87a496bd9aa7d018f823da2fca151e8067f4d866 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=87a496bd9aa7d018f823da2fca151e8067f4d866 commit 87a496bd9aa7d018f823da2fca151e8067f4d866 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:28:46 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:28:46 +0000 Safekeep src bit of fabient@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index d9d703671c83..365d86c9c74c 100644 --- a/access +++ b/access @@ -62,7 +62,6 @@ eadler emaste erj eugen -fabient freqlabs fsu gad From nobody Tue Nov 2 14:31:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BBDE8184ED11 for ; Tue, 2 Nov 2021 14:31: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 4HkC5X51kXz4rlc; Tue, 2 Nov 2021 14:31: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 8C86026841; Tue, 2 Nov 2021 14:31: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 1A2EViLd044427; Tue, 2 Nov 2021 14:31:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EViJX044426; Tue, 2 Nov 2021 14:31:44 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:31:44 GMT Message-Id: <202111021431.1A2EViJX044426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: a24e639bc747 - internal/admin - Safekeep src bit of jchandra@ Approved by: core List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: a24e639bc747d926f88464633afc5af132c39f8a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a24e639bc747d926f88464633afc5af132c39f8a commit a24e639bc747d926f88464633afc5af132c39f8a Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:31:02 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:31:02 +0000 Safekeep src bit of jchandra@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 365d86c9c74c..0a4489b4419c 100644 --- a/access +++ b/access @@ -85,7 +85,6 @@ jah jamie jasone jceel -jchandra jeff jhb jhibbits From nobody Tue Nov 2 14:33:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 14D46182109B for ; Tue, 2 Nov 2021 14:33: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 4HkC7607QQz4snw; Tue, 2 Nov 2021 14:33: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 DA73026A7A; Tue, 2 Nov 2021 14:33: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 1A2EX5GI044671; Tue, 2 Nov 2021 14:33:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EX5bE044670; Tue, 2 Nov 2021 14:33:05 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:33:05 GMT Message-Id: <202111021433.1A2EX5bE044670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: d5948cb481cb - internal/admin - Safekeep src bit of jlh@ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: d5948cb481cb9e923cff67d31f0dbc6a6537c180 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d5948cb481cb9e923cff67d31f0dbc6a6537c180 commit d5948cb481cb9e923cff67d31f0dbc6a6537c180 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:32:45 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:32:45 +0000 Safekeep src bit of jlh@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 0a4489b4419c..fe9ee04601ba 100644 --- a/access +++ b/access @@ -90,7 +90,6 @@ jhb jhibbits jilles jkim -jlh jmallett jmg joerg freebsd-devel@uriah.heep.sax.de From nobody Tue Nov 2 14:34:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D885218228A7 for ; Tue, 2 Nov 2021 14:34: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 4HkC8S5rWmz4thL; Tue, 2 Nov 2021 14:34: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 A9A38268C2; Tue, 2 Nov 2021 14:34: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 1A2EYGu4044881; Tue, 2 Nov 2021 14:34:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EYGlq044880; Tue, 2 Nov 2021 14:34:16 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:34:16 GMT Message-Id: <202111021434.1A2EYGlq044880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: fffbb3ff6693 - internal/admin - Safekeep src bit of jasone@ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: fffbb3ff669378159f41d814c7216924fd378c84 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fffbb3ff669378159f41d814c7216924fd378c84 commit fffbb3ff669378159f41d814c7216924fd378c84 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:34:01 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:34:01 +0000 Safekeep src bit of jasone@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index fe9ee04601ba..36b2c0c22180 100644 --- a/access +++ b/access @@ -83,7 +83,6 @@ ian imp jah jamie -jasone jceel jeff jhb From nobody Tue Nov 2 14:35:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1A5361822C67 for ; Tue, 2 Nov 2021 14:35: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 4HkC9z0Jdxz4v7J; Tue, 2 Nov 2021 14:35: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 DE78A267F8; Tue, 2 Nov 2021 14:35: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 1A2EZYEi045080; Tue, 2 Nov 2021 14:35:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EZYlt045079; Tue, 2 Nov 2021 14:35:34 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:35:34 GMT Message-Id: <202111021435.1A2EZYlt045079@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: fa3d3d9471d7 - internal/admin - Safekeep src bit of anish@ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: fa3d3d9471d78f8d9d8480b29668bd8f482f038f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fa3d3d9471d78f8d9d8480b29668bd8f482f038f commit fa3d3d9471d78f8d9d8480b29668bd8f482f038f Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:35:17 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:35:17 +0000 Safekeep src bit of anish@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 36b2c0c22180..079f920d5720 100644 --- a/access +++ b/access @@ -24,7 +24,6 @@ allanjude ambrisko andreast andrew -anish antoine arichardson asomers From nobody Tue Nov 2 14:56:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 299EB182D529 for ; Tue, 2 Nov 2021 14:56: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 4HkCfX0h1Yz3HHG; Tue, 2 Nov 2021 14:56: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 EBD2726C73; Tue, 2 Nov 2021 14:56: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 1A2Eup1r071158; Tue, 2 Nov 2021 14:56:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2EupXR071157; Tue, 2 Nov 2021 14:56:51 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:56:51 GMT Message-Id: <202111021456.1A2EupXR071157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: c777f7fa744c - internal/admin - Safekeep src bit of sgalabov@ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: c777f7fa744c1ff64ec423697b8149c68a7de0a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c777f7fa744c1ff64ec423697b8149c68a7de0a9 commit c777f7fa744c1ff64ec423697b8149c68a7de0a9 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:56:25 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:56:25 +0000 Safekeep src bit of sgalabov@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 079f920d5720..df4ee3849fdf 100644 --- a/access +++ b/access @@ -167,7 +167,6 @@ scottl scottph se sef -sgalabov sjg sobomax stevek From nobody Tue Nov 2 14:58:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 654A6182DA85 for ; Tue, 2 Nov 2021 14:58:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HkCh62P3wz3Hbx; Tue, 2 Nov 2021 14: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 3244E26B2E; Tue, 2 Nov 2021 14: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 1A2EwEVw071361; Tue, 2 Nov 2021 14: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 1A2EwEYq071360; Tue, 2 Nov 2021 14:58:14 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:58:14 GMT Message-Id: <202111021458.1A2EwEYq071360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: a5252029fbbd - internal/admin - Safekeep src bit of gavin@ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: a5252029fbbdf6bb98ecfb5aa54870a34939bde0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a5252029fbbdf6bb98ecfb5aa54870a34939bde0 commit a5252029fbbdf6bb98ecfb5aa54870a34939bde0 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:57:56 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:57:56 +0000 Safekeep src bit of gavin@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index df4ee3849fdf..45fb87fde6ba 100644 --- a/access +++ b/access @@ -66,7 +66,6 @@ fsu gad gallatin ganbold -gavin gjb glebius gnn From nobody Tue Nov 2 14:59:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 71853182DF18 for ; Tue, 2 Nov 2021 14:59: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 4HkCjb2rhPz3Hvt; Tue, 2 Nov 2021 14:59: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 41B1C26C74; Tue, 2 Nov 2021 14:59: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 1A2ExV56071554; Tue, 2 Nov 2021 14:59:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2ExV1Y071553; Tue, 2 Nov 2021 14:59:31 GMT (envelope-from git) Date: Tue, 2 Nov 2021 14:59:31 GMT Message-Id: <202111021459.1A2ExV1Y071553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: 6d1e52462979 - internal/admin - Safekeep src bit of pjd@ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 6d1e52462979149ac33f5d7e11a3786d3dcb1853 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=6d1e52462979149ac33f5d7e11a3786d3dcb1853 commit 6d1e52462979149ac33f5d7e11a3786d3dcb1853 Author: Muhammad Moinur Rahman AuthorDate: 2021-11-02 14:59:10 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-11-02 14:59:10 +0000 Safekeep src bit of pjd@ Approved by: core --- access | 1 - 1 file changed, 1 deletion(-) diff --git a/access b/access index 45fb87fde6ba..a1eb7d2e987d 100644 --- a/access +++ b/access @@ -142,7 +142,6 @@ phil philip phk pho -pjd pkelsey pluknet pstef From nobody Tue Nov 2 15:54:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6DA1D1831ED8; Tue, 2 Nov 2021 15:54: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 4HkDx12gRcz3sfv; Tue, 2 Nov 2021 15:54: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 3C66827C6B; Tue, 2 Nov 2021 15:54: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 1A2FsTCo050904; Tue, 2 Nov 2021 15:54:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2FsTOi050903; Tue, 2 Nov 2021 15:54:29 GMT (envelope-from git) Date: Tue, 2 Nov 2021 15:54:29 GMT Message-Id: <202111021554.1A2FsTOi050903@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: 2390a1441eff - main - LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 2390a1441effaba0e3d0f2f447f448aaf20428f1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2390a1441effaba0e3d0f2f447f448aaf20428f1 commit 2390a1441effaba0e3d0f2f447f448aaf20428f1 Author: Hans Petter Selasky AuthorDate: 2021-11-02 15:52:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-02 15:53:34 +0000 LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. The purpose of this change is to reduce the amount of dmesg(8) noise when VT switching after a panic. Submitted by: Greg V MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30174 Sponsored by: NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/kernel.h | 25 +++++++++++++---------- sys/compat/linuxkpi/common/src/linux_compat.c | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 6cbd95c4ac64..94af8f29c4d7 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -121,28 +121,31 @@ extern const volatile int lkpi_build_bug_on_zero; } \ } while (0) +extern int linuxkpi_warn_dump_stack; #define WARN_ON(cond) ({ \ - bool __ret = (cond); \ - if (__ret) { \ + bool __ret = (cond); \ + if (__ret) { \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define WARN_ON_SMP(cond) WARN_ON(cond) #define WARN_ON_ONCE(cond) ({ \ - static bool __warn_on_once; \ - bool __ret = (cond); \ - if (__ret && !__warn_on_once) { \ + static bool __warn_on_once; \ + bool __ret = (cond); \ + if (__ret && !__warn_on_once) { \ __warn_on_once = 1; \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define oops_in_progress SCHEDULER_STOPPED() diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index a62cf93dbd82..6440f7bdcff4 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -103,6 +103,11 @@ int linuxkpi_debug; SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); +int linuxkpi_warn_dump_stack = 0; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, warn_dump_stack, CTLFLAG_RWTUN, + &linuxkpi_warn_dump_stack, 0, + "Set to enable stack traces from WARN_ON(). Clear to disable."); + static struct timeval lkpi_net_lastlog; static int lkpi_net_curpps; static int lkpi_net_maxpps = 99; From nobody Tue Nov 2 16:50:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9C713184AB97; Tue, 2 Nov 2021 16:50: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 4HkG9C45L6z4g3n; Tue, 2 Nov 2021 16:50: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 68D584C0; Tue, 2 Nov 2021 16:50: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 1A2Go7CC020620; Tue, 2 Nov 2021 16:50:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2Go7Wm020617; Tue, 2 Nov 2021 16:50:07 GMT (envelope-from git) Date: Tue, 2 Nov 2021 16:50:07 GMT Message-Id: <202111021650.1A2Go7Wm020617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: d30dc78f798a - main - llvm BPF target: add missed source files List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d30dc78f798adebda488d2b8e21290268d2fb501 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=d30dc78f798adebda488d2b8e21290268d2fb501 commit d30dc78f798adebda488d2b8e21290268d2fb501 Author: Dimitry Andric AuthorDate: 2021-11-02 16:49:34 +0000 Commit: Dimitry Andric CommitDate: 2021-11-02 16:49:50 +0000 llvm BPF target: add missed source files Otherwise, linking llvm binaries with this target enabled (which is not the default) will fail with a number of undefined symbol errors: ld: error: undefined symbol: llvm::initializeBPFAdjustOptPass(llvm::PassRegistry&) ld: error: undefined symbol: llvm::initializeBPFCheckAndAdjustIRPass(llvm::PassRegistry&) ld: error: undefined symbol: llvm::createBPFCheckAndAdjustIR() ld: error: undefined symbol: llvm::createBPFAdjustOpt() ld: error: undefined symbol: llvm::BPFAdjustOptPass::run(llvm::Module&, llvm::AnalysisManager&) Reported by: Michael Dexter MFC after: 3 days --- lib/clang/libllvm/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index bd0aee918ef3..43f6cfa9302d 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -1163,7 +1163,9 @@ SRCS_MIN+= Target/ARM/Utils/ARMBaseInfo.cpp .if ${MK_LLVM_TARGET_BPF} != "no" SRCS_MIN+= Target/BPF/AsmParser/BPFAsmParser.cpp SRCS_MIN+= Target/BPF/BPFAbstractMemberAccess.cpp +SRCS_MIN+= Target/BPF/BPFAdjustOpt.cpp SRCS_MIN+= Target/BPF/BPFAsmPrinter.cpp +SRCS_MIN+= Target/BPF/BPFCheckAndAdjustIR.cpp SRCS_MIN+= Target/BPF/BPFFrameLowering.cpp SRCS_MIN+= Target/BPF/BPFISelDAGToDAG.cpp SRCS_MIN+= Target/BPF/BPFISelLowering.cpp From nobody Tue Nov 2 16:53:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 769E3184B2B4; Tue, 2 Nov 2021 16:53: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 4HkGDt2xgmz4gts; Tue, 2 Nov 2021 16:53: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 4544883C; Tue, 2 Nov 2021 16:53: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 1A2GrIKx031116; Tue, 2 Nov 2021 16:53:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2GrI1H031115; Tue, 2 Nov 2021 16:53:18 GMT (envelope-from git) Date: Tue, 2 Nov 2021 16:53:18 GMT Message-Id: <202111021653.1A2GrI1H031115@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: 1a8f198fa665 - main - epair: remove "All rights reserved" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 1a8f198fa66518e6d249fa8aa765ec6e50a4fbab Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1a8f198fa66518e6d249fa8aa765ec6e50a4fbab commit 1a8f198fa66518e6d249fa8aa765ec6e50a4fbab Author: Bjoern A. Zeeb AuthorDate: 2021-11-02 16:48:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-11-02 16:50:26 +0000 epair: remove "All rights reserved" Remove "All rights reserved" from The FreeBSD Foundation owned copyrights on epair code and documentation. Approved by: emaste (FreeBSD Foundation) --- share/man/man4/epair.4 | 1 - sys/net/if_epair.c | 1 - 2 files changed, 2 deletions(-) diff --git a/share/man/man4/epair.4 b/share/man/man4/epair.4 index 3ea706cb02ac..e1018e4b177f 100644 --- a/share/man/man4/epair.4 +++ b/share/man/man4/epair.4 @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2008 The FreeBSD Foundation -.\" All rights reserved. .\" .\" This software was developed by CK Software GmbH under sponsorship .\" from the FreeBSD Foundation. diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index e46c5271cc0f..89483db46337 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2008 The FreeBSD Foundation - * All rights reserved. * Copyright (c) 2009-2021 Bjoern A. Zeeb * * This software was developed by CK Software GmbH under sponsorship From nobody Tue Nov 2 18:55:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 02F09183FC91; Tue, 2 Nov 2021 18:55: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 4HkJxR6by9z3vLN; Tue, 2 Nov 2021 18:55:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1DAA20E7; Tue, 2 Nov 2021 18:55:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A2It7qh091916; Tue, 2 Nov 2021 18:55:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2It7OP091915; Tue, 2 Nov 2021 18:55:07 GMT (envelope-from git) Date: Tue, 2 Nov 2021 18:55:07 GMT Message-Id: <202111021855.1A2It7OP091915@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: 3513df4bcc17 - main - fstyp: fix build WITHOUT_ICONV List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3513df4bcc172b2b7b923ba62591490d5df1bf5a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3513df4bcc172b2b7b923ba62591490d5df1bf5a commit 3513df4bcc172b2b7b923ba62591490d5df1bf5a Author: Ed Maste AuthorDate: 2021-11-02 13:43:56 +0000 Commit: Ed Maste CommitDate: 2021-11-02 18:54:45 +0000 fstyp: fix build WITHOUT_ICONV Reported by: Michael Dexter, Build Option Survey Sponsored by: The FreeBSD Foundation --- usr.sbin/fstyp/exfat.c | 5 +++++ usr.sbin/fstyp/ntfs.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/usr.sbin/fstyp/exfat.c b/usr.sbin/fstyp/exfat.c index 3f10cb6a9e5a..d92d9c828427 100644 --- a/usr.sbin/fstyp/exfat.c +++ b/usr.sbin/fstyp/exfat.c @@ -365,6 +365,11 @@ fstyp_exfat(FILE *fp, char *label, size_t size) #ifdef WITH_ICONV if (show_label) exfat_find_label(fp, ev, bytespersec, label, size); +#else + if (show_label) { + warnx("label not available without iconv support"); + memset(label, 0, size); + } #endif out: diff --git a/usr.sbin/fstyp/ntfs.c b/usr.sbin/fstyp/ntfs.c index 0ce1fa81181a..c286d950dc2b 100644 --- a/usr.sbin/fstyp/ntfs.c +++ b/usr.sbin/fstyp/ntfs.c @@ -179,6 +179,11 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) } ok: +#else + if (show_label) { + warnx("label not available without iconv support"); + memset(label, 0, size); + } #endif /* WITH_ICONV */ free(bf); free(filerecp); From nobody Tue Nov 2 19:18:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 98F9A1849FDC; Tue, 2 Nov 2021 19:18: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 4HkKSQ3wYMz4WpQ; Tue, 2 Nov 2021 19:18: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 667982A0A; Tue, 2 Nov 2021 19:18: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 1A2JIU7q019570; Tue, 2 Nov 2021 19:18:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2JIU9L019569; Tue, 2 Nov 2021 19:18:30 GMT (envelope-from git) Date: Tue, 2 Nov 2021 19:18:30 GMT Message-Id: <202111021918.1A2JIU9L019569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 717857819223 - main - crypto: Use a single "crypto" kproc for all of the OCF kthreads. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 717857819223d9c0f81eb38abd0df200532e1cdc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=717857819223d9c0f81eb38abd0df200532e1cdc commit 717857819223d9c0f81eb38abd0df200532e1cdc Author: John Baldwin AuthorDate: 2021-11-02 18:26:21 +0000 Commit: John Baldwin CommitDate: 2021-11-02 19:18:05 +0000 crypto: Use a single "crypto" kproc for all of the OCF kthreads. Reported by: julian Reviewed by: markj MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32739 --- sys/opencrypto/crypto.c | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 85c22fd51ee2..436444869e90 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -168,7 +168,7 @@ struct crypto_ret_worker { uint32_t reorder_ops; /* total ordered sym jobs received */ uint32_t reorder_cur_seq; /* current sym job dispatched */ - struct proc *cryptoretproc; + struct thread *td; }; static struct crypto_ret_worker *crypto_ret_workers = NULL; @@ -204,9 +204,9 @@ SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records"); -static void crypto_proc(void); -static struct proc *cryptoproc; -static void crypto_ret_proc(struct crypto_ret_worker *ret_worker); +static void crypto_dispatch_thread(void *arg); +static struct thread *cryptotd; +static void crypto_ret_thread(void *arg); static void crypto_destroy(void); static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint); static void crypto_task_invoke(void *ctx, int pending); @@ -296,6 +296,7 @@ static int crypto_init(void) { struct crypto_ret_worker *ret_worker; + struct proc *p; int error; mtx_init(&crypto_drivers_mtx, "crypto", "crypto driver table", @@ -321,8 +322,9 @@ crypto_init(void) taskqueue_start_threads(&crypto_tq, crypto_workers_num, PRI_MIN_KERN, "crypto"); - error = kproc_create((void (*)(void *)) crypto_proc, NULL, - &cryptoproc, 0, 0, "crypto"); + p = NULL; + error = kproc_kthread_add(crypto_dispatch_thread, NULL, &p, &cryptotd, + 0, 0, "crypto", "crypto"); if (error) { printf("crypto_init: cannot start crypto thread; error %d", error); @@ -341,8 +343,9 @@ crypto_init(void) mtx_init(&ret_worker->crypto_ret_mtx, "crypto", "crypto return queues", MTX_DEF); - error = kproc_create((void (*)(void *)) crypto_ret_proc, ret_worker, - &ret_worker->cryptoretproc, 0, 0, "crypto returns %td", CRYPTO_RETW_ID(ret_worker)); + error = kthread_add(crypto_ret_thread, ret_worker, p, + &ret_worker->td, 0, 0, "crypto returns %td", + CRYPTO_RETW_ID(ret_worker)); if (error) { printf("crypto_init: cannot start cryptoret thread; error %d", error); @@ -366,20 +369,16 @@ bad: * for the other half of this song-and-dance. */ static void -crypto_terminate(struct proc **pp, void *q) +crypto_terminate(struct thread **tdp, void *q) { - struct proc *p; + struct thread *td; mtx_assert(&crypto_drivers_mtx, MA_OWNED); - p = *pp; - *pp = NULL; - if (p) { + td = *tdp; + *tdp = NULL; + if (td != NULL) { wakeup_one(q); - PROC_LOCK(p); /* NB: insure we don't miss wakeup */ - CRYPTO_DRIVER_UNLOCK(); /* let crypto_finis progress */ - msleep(p, &p->p_mtx, PWAIT, "crypto_destroy", 0); - PROC_UNLOCK(p); - CRYPTO_DRIVER_LOCK(); + mtx_sleep(td, &crypto_drivers_mtx, PWAIT, "crypto_destroy", 0); } } @@ -442,9 +441,9 @@ crypto_destroy(void) if (crypto_tq != NULL) taskqueue_drain_all(crypto_tq); CRYPTO_DRIVER_LOCK(); - crypto_terminate(&cryptoproc, &crp_q); + crypto_terminate(&cryptotd, &crp_q); FOREACH_CRYPTO_RETW(ret_worker) - crypto_terminate(&ret_worker->cryptoretproc, &ret_worker->crp_ret_q); + crypto_terminate(&ret_worker->td, &ret_worker->crp_ret_q); CRYPTO_DRIVER_UNLOCK(); /* XXX flush queues??? */ @@ -1708,14 +1707,14 @@ crypto_finis(void *chan) CRYPTO_DRIVER_LOCK(); wakeup_one(chan); CRYPTO_DRIVER_UNLOCK(); - kproc_exit(0); + kthread_exit(); } /* * Crypto thread, dispatches crypto requests. */ static void -crypto_proc(void) +crypto_dispatch_thread(void *arg __unused) { struct cryptop *crp, *submit; struct cryptocap *cap; @@ -1804,7 +1803,7 @@ crypto_proc(void) crp_sleep = 1; msleep(&crp_q, &crypto_q_mtx, PWAIT, "crypto_wait", 0); crp_sleep = 0; - if (cryptoproc == NULL) + if (cryptotd == NULL) break; CRYPTOSTAT_INC(cs_intrs); } @@ -1820,8 +1819,9 @@ crypto_proc(void) * callbacks typically are expensive and would slow interrupt handling. */ static void -crypto_ret_proc(struct crypto_ret_worker *ret_worker) +crypto_ret_thread(void *arg) { + struct crypto_ret_worker *ret_worker = arg; struct cryptop *crpt; CRYPTO_RETW_LOCK(ret_worker); @@ -1858,7 +1858,7 @@ crypto_ret_proc(struct crypto_ret_worker *ret_worker) */ msleep(&ret_worker->crp_ret_q, &ret_worker->crypto_ret_mtx, PWAIT, "crypto_ret_wait", 0); - if (ret_worker->cryptoretproc == NULL) + if (ret_worker->td == NULL) break; CRYPTOSTAT_INC(cs_rets); } From nobody Tue Nov 2 19:18:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E90D51849FE1; Tue, 2 Nov 2021 19:18: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 4HkKSR5RHpz4WjG; Tue, 2 Nov 2021 19:18: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 95E7524F5; Tue, 2 Nov 2021 19:18: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 1A2JIVXC019594; Tue, 2 Nov 2021 19:18:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2JIVBn019593; Tue, 2 Nov 2021 19:18:31 GMT (envelope-from git) Date: Tue, 2 Nov 2021 19:18:31 GMT Message-Id: <202111021918.1A2JIVBn019593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4e057806cf56 - main - crypto: Cleanup mtx_init() calls. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e057806cf56b238a0a3ef7af140f447d7b67ab5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4e057806cf56b238a0a3ef7af140f447d7b67ab5 commit 4e057806cf56b238a0a3ef7af140f447d7b67ab5 Author: John Baldwin AuthorDate: 2021-11-02 18:27:20 +0000 Commit: John Baldwin CommitDate: 2021-11-02 19:18:05 +0000 crypto: Cleanup mtx_init() calls. Don't pass the same name to multiple mutexes while using unique types for WITNESS. Just use the unique types as the mutex names. Reviewed by: markj MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32740 --- sys/opencrypto/crypto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 436444869e90..8c5457a48f65 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -299,11 +299,10 @@ crypto_init(void) struct proc *p; int error; - mtx_init(&crypto_drivers_mtx, "crypto", "crypto driver table", - MTX_DEF|MTX_QUIET); + mtx_init(&crypto_drivers_mtx, "crypto driver table", NULL, MTX_DEF); TAILQ_INIT(&crp_q); - mtx_init(&crypto_q_mtx, "crypto", "crypto op queues", MTX_DEF); + mtx_init(&crypto_q_mtx, "crypto op queues", NULL, MTX_DEF); cryptop_zone = uma_zcreate("cryptop", sizeof(struct cryptop), NULL, NULL, NULL, NULL, @@ -341,7 +340,8 @@ crypto_init(void) ret_worker->reorder_ops = 0; ret_worker->reorder_cur_seq = 0; - mtx_init(&ret_worker->crypto_ret_mtx, "crypto", "crypto return queues", MTX_DEF); + mtx_init(&ret_worker->crypto_ret_mtx, "crypto return queues", + NULL, MTX_DEF); error = kthread_add(crypto_ret_thread, ret_worker, p, &ret_worker->td, 0, 0, "crypto returns %td", From nobody Tue Nov 2 19:49:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 08C86183096B; Tue, 2 Nov 2021 19:49: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 4HkL8c60zLz4htl; Tue, 2 Nov 2021 19:49: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 AD0892E57; Tue, 2 Nov 2021 19:49: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 1A2Jnq9L059250; Tue, 2 Nov 2021 19:49:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2JnqBS059249; Tue, 2 Nov 2021 19:49:52 GMT (envelope-from git) Date: Tue, 2 Nov 2021 19:49:52 GMT Message-Id: <202111021949.1A2JnqBS059249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 4bb6991531b5 - main - arm/pmu: add ACPI attachment. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4bb6991531b528c89fdadd3316d80b885a7f9bdb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=4bb6991531b528c89fdadd3316d80b885a7f9bdb commit 4bb6991531b528c89fdadd3316d80b885a7f9bdb Author: Ruslan Bukin AuthorDate: 2021-11-02 19:35:29 +0000 Commit: Ruslan Bukin CommitDate: 2021-11-02 19:35:29 +0000 arm/pmu: add ACPI attachment. This makes hwpmc(4) sampling work on ACPI-based AArch64 systems. Tested on ARM Neoverse N1. Submitted by: Greg V Reviewed by: jrtc27, mhorne Differential Revision: https://reviews.freebsd.org/D24423 --- sys/arm/arm/pmu.h | 2 +- sys/arm/arm/pmu_acpi.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 1 + 3 files changed, 197 insertions(+), 1 deletion(-) diff --git a/sys/arm/arm/pmu.h b/sys/arm/arm/pmu.h index bfad6d9da282..657faba28e74 100644 --- a/sys/arm/arm/pmu.h +++ b/sys/arm/arm/pmu.h @@ -33,7 +33,7 @@ #ifndef _ARM_PMU_H_ #define _ARM_PMU_H_ -#define MAX_RLEN 8 +#define MAX_RLEN MAXCPU struct pmu_intr { struct resource *res; diff --git a/sys/arm/arm/pmu_acpi.c b/sys/arm/arm/pmu_acpi.c new file mode 100644 index 000000000000..b1378c24e833 --- /dev/null +++ b/sys/arm/arm/pmu_acpi.c @@ -0,0 +1,195 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Greg V + * Copyright (c) 2021 Ruslan Bukin + * + * 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 +#include +#include +#include +#include +#include + +#include +#include + +#include "acpi_bus_if.h" +#include "pmu.h" + +struct madt_ctx { + struct pmu_softc *sc; + int error; + int i; +}; + +static void +madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_GENERIC_INTERRUPT *intr; + struct intr_map_data_acpi *ad; + struct intr_map_data *data; + struct madt_ctx *ctx; + struct pmu_softc *sc; + struct pcpu *pcpu; + int rid; + int cpuid; + int i; + + ctx = arg; + sc = ctx->sc; + rid = ctx->i; + cpuid = -1; + + if (ctx->error) + return; + + if (entry->Type != ACPI_MADT_TYPE_GENERIC_INTERRUPT) + return; + intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; + + for (i = 0; i < MAXCPU; i++) { + pcpu = pcpu_find(i); + if (pcpu != NULL && pcpu->pc_mpidr == intr->ArmMpidr) { + cpuid = i; + break; + } + } + + if (cpuid == -1) { + /* pcpu not found. */ + device_printf(sc->dev, "MADT: could not find pcpu, " + "ArmMpidr %lx\n", intr->ArmMpidr); + ctx->error = ENODEV; + return; + } + + if (bootverbose) + device_printf(sc->dev, "MADT: cpu %d (mpidr %lu) irq %d " + "%s-triggered\n", cpuid, intr->ArmMpidr, + intr->PerformanceInterrupt, + (intr->Flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) ? + "edge" : "level"); + + bus_set_resource(sc->dev, SYS_RES_IRQ, ctx->i, + intr->PerformanceInterrupt, 1); + + sc->irq[ctx->i].res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, + &rid, RF_ACTIVE | RF_SHAREABLE); + if (sc->irq[ctx->i].res == NULL) { + device_printf(sc->dev, "Failed to allocate IRQ %d\n", ctx->i); + ctx->error = ENXIO; + return; + } + + /* + * BUS_CONFIG_INTR does nothing on arm64, so we manually set trigger + * mode. + */ + data = rman_get_virtual(sc->irq[ctx->i].res); + KASSERT(data->type == INTR_MAP_DATA_ACPI, ("Wrong data type")); + ad = (struct intr_map_data_acpi *)data; + ad->trig = (intr->Flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) ? + INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL; + ad->pol = INTR_POLARITY_HIGH; + + if (!intr_is_per_cpu(sc->irq[ctx->i].res)) + sc->irq[ctx->i].cpuid = cpuid; + + ctx->i++; +} + +static void +pmu_acpi_identify(driver_t *driver, device_t parent) +{ + device_t dev; + + if (acpi_find_table(ACPI_SIG_MADT) == 0) + return; + + dev = BUS_ADD_CHILD(parent, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST, + "pmu", -1); + + if (dev == NULL) + device_printf(parent, "pmu: Unable to add pmu child\n"); +} + +static int +pmu_acpi_probe(device_t dev) +{ + + device_set_desc(dev, "Performance Monitoring Unit"); + + return (BUS_PROBE_NOWILDCARD); +} + +static int +pmu_acpi_attach(device_t dev) +{ + struct pmu_softc *sc; + struct madt_ctx ctx; + ACPI_TABLE_MADT *madt; + int i; + + sc = device_get_softc(dev); + sc->dev = dev; + + madt = acpi_map_table(acpi_find_table(ACPI_SIG_MADT), ACPI_SIG_MADT); + if (madt == NULL) { + device_printf(dev, "Unable to map the MADT table\n"); + return (ENXIO); + } + + /* We have to initialize cpuid to -1. */ + for (i = 0; i < MAX_RLEN; i++) + sc->irq[i].cpuid = -1; + + ctx.sc = sc; + ctx.i = 0; + ctx.error = 0; + acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, + madt_handler, &ctx); + + acpi_unmap_table(madt); + + if (ctx.error) + return (ctx.error); + + return (pmu_attach(dev)); +} + +static device_method_t pmu_acpi_methods[] = { + DEVMETHOD(device_identify, pmu_acpi_identify), + DEVMETHOD(device_probe, pmu_acpi_probe), + DEVMETHOD(device_attach, pmu_acpi_attach), + DEVMETHOD_END, +}; + +DEFINE_CLASS_0(pmu, pmu_acpi_driver, pmu_acpi_methods, + sizeof(struct pmu_softc)); + +static devclass_t pmu_acpi_devclass; + +DRIVER_MODULE(pmu, acpi, pmu_acpi_driver, pmu_acpi_devclass, 0, 0); diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 2d98568b3d9f..b363b800af67 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -22,6 +22,7 @@ arm/arm/gic_acpi.c optional acpi arm/arm/gic_fdt.c optional fdt arm/arm/gic_if.m standard arm/arm/pmu.c standard +arm/arm/pmu_acpi.c optional acpi arm/arm/pmu_fdt.c optional fdt arm64/acpica/acpi_iort.c optional acpi arm64/acpica/acpi_machdep.c optional acpi From nobody Tue Nov 2 23:09:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D16381842CEE; Tue, 2 Nov 2021 23:09: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 4HkQb85Z46z4lL8; Tue, 2 Nov 2021 23:09: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 9068B5DC8; Tue, 2 Nov 2021 23:09: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 1A2N9ebv025568; Tue, 2 Nov 2021 23:09:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2N9efq025567; Tue, 2 Nov 2021 23:09:40 GMT (envelope-from git) Date: Tue, 2 Nov 2021 23:09:40 GMT Message-Id: <202111022309.1A2N9efq025567@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: e3ab141fda6a - main - gpart: Move GPT efimedia reporting to a separate routine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: e3ab141fda6a999d6fcdf050e07174199eea5557 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e3ab141fda6a999d6fcdf050e07174199eea5557 commit e3ab141fda6a999d6fcdf050e07174199eea5557 Author: Warner Losh AuthorDate: 2021-11-02 23:08:37 +0000 Commit: Warner Losh CommitDate: 2021-11-02 23:09:17 +0000 gpart: Move GPT efimedia reporting to a separate routine Move the efimedia reporting to g_part_gpt_efimedia and use that from g_part_gpt_dumpconf to report it. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32780 --- sys/geom/part/g_part_gpt.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c index 89a92977dff6..1f6d3dff249d 100644 --- a/sys/geom/part/g_part_gpt.c +++ b/sys/geom/part/g_part_gpt.c @@ -734,6 +734,15 @@ g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) return (0); } +static void +g_part_gpt_efimedia(struct g_part_gpt_entry *entry, struct sbuf *sb) +{ + sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index); + sbuf_printf_uuid(sb, &entry->ent.ent_uuid); + sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start, + (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); +} + static void g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry, struct sbuf *sb, const char *indent) @@ -768,10 +777,7 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry, sbuf_printf_uuid(sb, &entry->ent.ent_uuid); sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); - sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index); - sbuf_printf_uuid(sb, &entry->ent.ent_uuid); - sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start, - (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); + g_part_gpt_efimedia(entry, sb); sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ From nobody Tue Nov 2 23:09:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0D0361842F89; Tue, 2 Nov 2021 23:09: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 4HkQb96Kxfz4lFg; Tue, 2 Nov 2021 23:09: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 B1D8A5D74; Tue, 2 Nov 2021 23:09: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 1A2N9fq0025592; Tue, 2 Nov 2021 23:09:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A2N9fmP025591; Tue, 2 Nov 2021 23:09:41 GMT (envelope-from git) Date: Tue, 2 Nov 2021 23:09:41 GMT Message-Id: <202111022309.1A2N9fmP025591@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: edfbbfd541ab - main - gpart: Move MBR efimedia reporting to a separate routine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: edfbbfd541ab9f7ba13b246d86bd0c36757ec660 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=edfbbfd541ab9f7ba13b246d86bd0c36757ec660 commit edfbbfd541ab9f7ba13b246d86bd0c36757ec660 Author: Warner Losh AuthorDate: 2021-11-02 23:08:48 +0000 Commit: Warner Losh CommitDate: 2021-11-02 23:09:17 +0000 gpart: Move MBR efimedia reporting to a separate routine Move the efimedia reporting to g_part_mbr_efimedia and use that from g_part_mbr_dumpconf to report it. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32781 --- sys/geom/part/g_part_mbr.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c index 750d417bba5d..d5d18e52456d 100644 --- a/sys/geom/part/g_part_mbr.c +++ b/sys/geom/part/g_part_mbr.c @@ -308,13 +308,24 @@ g_part_mbr_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) return (0); } +static void +g_part_mbr_efimedia(struct g_part_mbr_table *table, struct g_part_mbr_entry *entry, + struct sbuf *sb) +{ + uint32_t dsn; + + dsn = le32dec(table->mbr + DOSDSNOFF); + sbuf_printf(sb, "HD(%d,MBR,%#08x,%#jx,%#jx)", + entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start, + (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); +} + static void g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry *baseentry, struct sbuf *sb, const char *indent) { struct g_part_mbr_entry *entry; struct g_part_mbr_table *table; - uint32_t dsn; table = (struct g_part_mbr_table *)basetable; entry = (struct g_part_mbr_entry *)baseentry; @@ -327,10 +338,8 @@ g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry *baseent entry->ent.dp_typ); if (entry->ent.dp_flag & 0x80) sbuf_printf(sb, "%sactive\n", indent); - dsn = le32dec(table->mbr + DOSDSNOFF); - sbuf_printf(sb, "%sHD(%d,MBR,%#08x,%#jx,%#jx)", indent, - entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start, - (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); + sbuf_printf(sb, "%s", indent); + g_part_mbr_efimedia(table, entry, sb); sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ From nobody Wed Nov 3 00:31:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D846B1845146; Wed, 3 Nov 2021 00:31: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 4HkSPV5q1tz56Ct; Wed, 3 Nov 2021 00:31: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 A7C1F707F; Wed, 3 Nov 2021 00:31: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 1A30VQN7039566; Wed, 3 Nov 2021 00:31:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A30VQ2X039565; Wed, 3 Nov 2021 00:31:26 GMT (envelope-from git) Date: Wed, 3 Nov 2021 00:31:26 GMT Message-Id: <202111030031.1A30VQ2X039565@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: 331883a2f2e9 - main - nfscl: Check for a forced dismount in nfscl_getref() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 331883a2f2e9ae5567085e4cd3a7ae3db2a2b022 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=331883a2f2e9ae5567085e4cd3a7ae3db2a2b022 commit 331883a2f2e9ae5567085e4cd3a7ae3db2a2b022 Author: Rick Macklem AuthorDate: 2021-11-03 00:28:13 +0000 Commit: Rick Macklem CommitDate: 2021-11-03 00:28:13 +0000 nfscl: Check for a forced dismount in nfscl_getref() The nfscl_getref() function is called within nfscl_doiods() when the NFSv4.1/4.2 pNFS client is doing I/O on a DS. As such, nfscl_getref() needs to check for a forced dismount. This patch adds that check. Found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 523cc59039af..22c0da1bcef8 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4907,6 +4907,7 @@ int nfscl_getref(struct nfsmount *nmp) { struct nfsclclient *clp; + int ret; NFSLOCKCLSTATE(); clp = nfscl_findcl(nmp); @@ -4914,9 +4915,12 @@ nfscl_getref(struct nfsmount *nmp) NFSUNLOCKCLSTATE(); return (0); } - nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, NULL); + nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, nmp->nm_mountp); + ret = 1; + if (NFSCL_FORCEDISM(nmp->nm_mountp)) + ret = 0; NFSUNLOCKCLSTATE(); - return (1); + return (ret); } /* From nobody Wed Nov 3 07:34:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 95CA318387B7; Wed, 3 Nov 2021 07:34: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 4HkdnJ3hhpz4lKP; Wed, 3 Nov 2021 07:34: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 54132145F6; Wed, 3 Nov 2021 07:34: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 1A37YCSL002282; Wed, 3 Nov 2021 07:34:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A37YChn002281; Wed, 3 Nov 2021 07:34:12 GMT (envelope-from git) Date: Wed, 3 Nov 2021 07:34:12 GMT Message-Id: <202111030734.1A37YChn002281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 7771f2a0c94f - main - kern: physmem: improve region coalescing logic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d commit 7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d Author: Kyle Evans AuthorDate: 2021-10-28 04:40:08 +0000 Commit: Kyle Evans CommitDate: 2021-11-03 07:32:46 +0000 kern: physmem: improve region coalescing logic The existing logic didn't take into account newly inserted mappings wholly contained by an existing region (or vice versa), nor did it account for weird overlap scenarios. The latter is probably unlikely to happen, but the former may happen in UEFI: BootServicesData allocated within a large chunk of ConventionalMemory. This situation blows up vm initialization. While we're here, remove the "exact match" logic as it's likely wrong; if an exact match exists with conflicting flags, for instance, then we should probably be doing something else. The new logic takes into account exact matches as part of the overlapping efforts. Reviewed by: kib, mhorne (both earlier version) Differential Revision: https://reviews.freebsd.org/D32701 --- sys/kern/subr_physmem.c | 92 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_physmem.c b/sys/kern/subr_physmem.c index ea1ec12dd065..1cff1eb062c6 100644 --- a/sys/kern/subr_physmem.c +++ b/sys/kern/subr_physmem.c @@ -270,6 +270,67 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, return (acnt); } +/* + * Check if the region at idx can be merged with the region above it. + */ +static size_t +merge_upper_regions(struct region *regions, size_t rcnt, size_t idx) +{ + struct region *lower, *upper; + vm_paddr_t lend, uend; + size_t i, mergecnt, movecnt; + + lower = ®ions[idx]; + lend = lower->addr + lower->size; + + /* + * Continue merging in upper entries as long as we have entries to + * merge; the new block could have spanned more than one, although one + * is likely the common case. + */ + for (i = idx + 1; i < rcnt; i++) { + upper = ®ions[i]; + if (lend < upper->addr || lower->flags != upper->flags) + break; + + uend = upper->addr + upper->size; + if (uend > lend) { + lower->size += uend - lend; + lend = lower->addr + lower->size; + } + + if (uend >= lend) { + /* + * If we didn't move past the end of the upper region, + * then we don't need to bother checking for another + * merge because it would have been done already. Just + * increment i once more to maintain the invariant that + * i is one past the last entry merged. + */ + i++; + break; + } + } + + /* + * We merged in the entries from [idx + 1, i); physically move the tail + * end at [i, rcnt) if we need to. + */ + mergecnt = i - (idx + 1); + if (mergecnt > 0) { + movecnt = rcnt - i; + if (movecnt == 0) { + /* Merged all the way to the end, just decrease rcnt. */ + rcnt = idx + 1; + } else { + memmove(®ions[idx + 1], ®ions[idx + mergecnt + 1], + movecnt * sizeof(*regions)); + rcnt -= mergecnt; + } + } + return (rcnt); +} + /* * Insertion-sort a new entry into a regions list; sorted by start address. */ @@ -278,19 +339,38 @@ insert_region(struct region *regions, size_t rcnt, vm_paddr_t addr, vm_size_t size, uint32_t flags) { size_t i; + vm_paddr_t nend, rend; struct region *ep, *rp; + nend = addr + size; ep = regions + rcnt; for (i = 0, rp = regions; i < rcnt; ++i, ++rp) { - if (rp->addr == addr && rp->size == size) /* Pure dup. */ - return (rcnt); if (flags == rp->flags) { - if (addr + size == rp->addr) { + rend = rp->addr + rp->size; + if (addr <= rp->addr && nend >= rp->addr) { + /* + * New mapping overlaps at the beginning, shift + * for any difference in the beginning then + * shift if the new mapping extends past. + */ + rp->size += rp->addr - addr; rp->addr = addr; - rp->size += size; + if (nend > rend) { + rp->size += nend - rend; + rcnt = merge_upper_regions(regions, + rcnt, i); + } return (rcnt); - } else if (rp->addr + rp->size == addr) { - rp->size += size; + } else if (addr <= rend && nend > rp->addr) { + /* + * New mapping is either entirely contained + * within or it's overlapping at the end. + */ + if (nend > rend) { + rp->size += nend - rend; + rcnt = merge_upper_regions(regions, + rcnt, i); + } return (rcnt); } } From nobody Wed Nov 3 09:03:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A8C291818260; Wed, 3 Nov 2021 09:03: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 4HkgmL4MGHz3hGs; Wed, 3 Nov 2021 09:03: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 7640015F2C; Wed, 3 Nov 2021 09:03: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 1A393UZN022397; Wed, 3 Nov 2021 09:03:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A393UCA022396; Wed, 3 Nov 2021 09:03:30 GMT (envelope-from git) Date: Wed, 3 Nov 2021 09:03:30 GMT Message-Id: <202111030903.1A393UCA022396@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: 91be6286e2a7 - main - linprocfs: Fix formatting of Uid and Gid lines List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 91be6286e2a7ddad6dcf8d653fcd3f2c0b53072f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=91be6286e2a7ddad6dcf8d653fcd3f2c0b53072f commit 91be6286e2a7ddad6dcf8d653fcd3f2c0b53072f Author: Edward Tomasz Napierala AuthorDate: 2021-11-03 08:40:49 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-03 08:40:55 +0000 linprocfs: Fix formatting of Uid and Gid lines The separator here should be tabs, not spaces. This fixes a warning from chromium-browser on Bionic: [1022/162248.137612:ERROR:process_info_linux.cc(107)] format error: unrecognized Uid format Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32612 --- sys/compat/linprocfs/linprocfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 18dec7e01aae..66c6d1cf76ac 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -1089,12 +1089,12 @@ linprocfs_doprocstatus(PFS_FILL_ARGS) sbuf_printf(sb, "Pid:\t%d\n", p->p_pid); sbuf_printf(sb, "PPid:\t%d\n", kp.ki_ppid ); sbuf_printf(sb, "TracerPid:\t%d\n", kp.ki_tracer ); - sbuf_printf(sb, "Uid:\t%d %d %d %d\n", p->p_ucred->cr_ruid, + sbuf_printf(sb, "Uid:\t%d\t%d\t%d\t%d\n", p->p_ucred->cr_ruid, p->p_ucred->cr_uid, p->p_ucred->cr_svuid, /* FreeBSD doesn't have fsuid */ p->p_ucred->cr_uid); - sbuf_printf(sb, "Gid:\t%d %d %d %d\n", p->p_ucred->cr_rgid, + sbuf_printf(sb, "Gid:\t%d\t%d\t%d\t%d\n", p->p_ucred->cr_rgid, p->p_ucred->cr_gid, p->p_ucred->cr_svgid, /* FreeBSD doesn't have fsgid */ From nobody Wed Nov 3 09:08:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 40F75181C05B; Wed, 3 Nov 2021 09:08: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 4Hkgt40yT8z3kGp; Wed, 3 Nov 2021 09:08: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 00D73158D7; Wed, 3 Nov 2021 09:08: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 1A398ROC022840; Wed, 3 Nov 2021 09:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A398Rb8022839; Wed, 3 Nov 2021 09:08:27 GMT (envelope-from git) Date: Wed, 3 Nov 2021 09:08:27 GMT Message-Id: <202111030908.1A398Rb8022839@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: 4dfd612286ec - main - linux: mv sys/i386/linux/linux_ptrace{,_machdep}.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 4dfd612286ec2ecc7a05f3d4fd65a58f4b05f74c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=4dfd612286ec2ecc7a05f3d4fd65a58f4b05f74c commit 4dfd612286ec2ecc7a05f3d4fd65a58f4b05f74c Author: Edward Tomasz Napierala AuthorDate: 2021-11-03 08:49:41 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-03 08:50:17 +0000 linux: mv sys/i386/linux/linux_ptrace{,_machdep}.c In preparation for machine-independent sys/compat/linux/linux_ptrace.c, rename the i386-specific Linux ptrace(2) implementation. No functional changes. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32757 --- sys/i386/linux/{linux_ptrace.c => linux_ptrace_machdep.c} | 0 sys/modules/linux/Makefile | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/i386/linux/linux_ptrace.c b/sys/i386/linux/linux_ptrace_machdep.c similarity index 100% rename from sys/i386/linux/linux_ptrace.c rename to sys/i386/linux/linux_ptrace_machdep.c diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 373ec3dcae91..d2822a20c67a 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -40,8 +40,8 @@ SRCS+= opt_apic.h OBJS= linux${SFX}_vdso.so .if ${MACHINE_CPUARCH} == "i386" -SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c linux_mmap.c \ - linux_dummy.c linux_emul.c linux_errno.c opt_cpu.h linux.c +SRCS+= linux_ptrace_machdep.c imgact_linux.c linux_util.c linux_mib.c \ + linux_mmap.c linux_dummy.c linux_emul.c linux_errno.c opt_cpu.h linux.c .endif .if ${MACHINE_CPUARCH} == "i386" From nobody Wed Nov 3 09:11:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B8AE0181C8A2; Wed, 3 Nov 2021 09:11: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 4Hkgy04vVHz3kvn; Wed, 3 Nov 2021 09: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 87EC91636E; Wed, 3 Nov 2021 09: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 1A39BqhA033778; Wed, 3 Nov 2021 09: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 1A39BqFQ033777; Wed, 3 Nov 2021 09:11:52 GMT (envelope-from git) Date: Wed, 3 Nov 2021 09:11:52 GMT Message-Id: <202111030911.1A39BqFQ033777@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: c91d0e59be10 - main - linux: Make linux_ptrace.c portable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c91d0e59be10f9412cbce467b8b038f006bb6f18 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=c91d0e59be10f9412cbce467b8b038f006bb6f18 commit c91d0e59be10f9412cbce467b8b038f006bb6f18 Author: Edward Tomasz Napierala AuthorDate: 2021-11-03 08:54:30 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-03 08:54:35 +0000 linux: Make linux_ptrace.c portable Make sys/amd64/linux/linux_ptrace.c machine-independent, in preparation for moving it into sys/compat/linux/. No functional changes. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32756 --- sys/amd64/linux/linux_ptrace.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 191e6265b39c..2ebf1c2be997 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -108,6 +108,7 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_PEEKUSER_DS 184 #define LINUX_ARCH_AMD64 0xc000003e +#define LINUX_ARCH_AARCH64 0xc00000b7 static int map_signum(int lsig, int *bsigp) @@ -217,6 +218,7 @@ linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data) return (error); switch ((uintptr_t)addr) { +#ifdef __amd64__ case LINUX_PTRACE_PEEKUSER_ORIG_RAX: val = b_reg.r_rax; break; @@ -229,6 +231,7 @@ linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data) case LINUX_PTRACE_PEEKUSER_DS: val = b_reg.r_ds; break; +#endif /* __amd64__ */ default: linux_msg(td, "PTRACE_PEEKUSER offset %ld not implemented; " "returning EINVAL", (uintptr_t)addr); @@ -343,20 +346,25 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) struct ptrace_lwpinfo lwpinfo; struct reg b_reg; struct linux_pt_regset l_regset; +#ifdef __amd64__ struct pcb *pcb; +#endif int error; error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0); if (error != 0) return (error); + bsd_to_linux_regset(&b_reg, &l_regset); + +#ifdef __amd64__ pcb = td->td_pcb; if (td == curthread) update_pcb_bases(pcb); - bsd_to_linux_regset(&b_reg, &l_regset); l_regset.fs_base = pcb->pcb_fsbase; l_regset.gs_base = pcb->pcb_gsbase; +#endif error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { @@ -404,7 +412,9 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) struct reg b_reg; struct linux_pt_regset l_regset; struct iovec iov; +#ifdef __amd64__ struct pcb *pcb; +#endif size_t len; int error; @@ -418,13 +428,16 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) if (error != 0) return (error); + bsd_to_linux_regset(&b_reg, &l_regset); + +#ifdef __amd64__ pcb = td->td_pcb; if (td == curthread) update_pcb_bases(pcb); - bsd_to_linux_regset(&b_reg, &l_regset); l_regset.fs_base = pcb->pcb_fsbase; l_regset.gs_base = pcb->pcb_gsbase; +#endif error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { @@ -569,9 +582,17 @@ linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, if (error != 0) return (error); +#if defined(__amd64__) si.arch = LINUX_ARCH_AMD64; si.instruction_pointer = b_reg.r_rip; si.stack_pointer = b_reg.r_rsp; +#elif defined(__aarch64__) + si.arch = LINUX_ARCH_AARCH64; + si.instruction_pointer = b_reg.lr; + si.stack_pointer = b_reg.sp; +#else +#error "unknown architecture" +#endif len = MIN(len, sizeof(si)); error = copyout(&si, (void *)data, len); From nobody Wed Nov 3 09:14:49 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 24CED1828DA5; Wed, 3 Nov 2021 09:14: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 4Hkh1Q0VS1z3n3b; Wed, 3 Nov 2021 09:14: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 E4F8A15EDF; Wed, 3 Nov 2021 09:14: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 1A39EnRu035755; Wed, 3 Nov 2021 09:14:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A39Enne035754; Wed, 3 Nov 2021 09:14:49 GMT (envelope-from git) Date: Wed, 3 Nov 2021 09:14:49 GMT Message-Id: <202111030914.1A39Enne035754@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: e03813c3e1fd - main - development(7): Use a more common architecture for examples List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: e03813c3e1fd6aaac87eac3dd258cccb4238ed91 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e03813c3e1fd6aaac87eac3dd258cccb4238ed91 commit e03813c3e1fd6aaac87eac3dd258cccb4238ed91 Author: Edward Tomasz Napierala AuthorDate: 2021-10-31 13:27:29 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-03 08:59:26 +0000 development(7): Use a more common architecture for examples --- share/man/man7/development.7 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 805e3c948df9..71846b236ec2 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2021 +.Dd November 1, 2021 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -157,20 +157,20 @@ for another CPU architecture, first prepare your source tree by building the cross-toolchain: .Bd -literal -offset indent cd src -make -sj8 toolchain TARGET_ARCH=armv6 +make -sj8 toolchain TARGET_ARCH=aarch64 .Ed .Pp Afterwards, to build and install a single piece of userspace, use: .Bd -literal -offset indent cd src/bin/ls -make buildenv TARGET_ARCH=armv6 +make buildenv TARGET_ARCH=aarch64 make clean all install DESTDIR=/clients/arm .Ed .Pp Likewise, to quickly rebuild and reinstall the kernel, use: .Bd -literal -offset indent cd src -make buildenv TARGET_ARCH=armv6 +make buildenv TARGET_ARCH=aarch64 make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Ed .Sh SEE ALSO From nobody Wed Nov 3 09:49:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 57D8D1839544; Wed, 3 Nov 2021 09:49: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 4Hkhn96fyqz4SKC; Wed, 3 Nov 2021 09:49: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 BAF3E16A08; Wed, 3 Nov 2021 09:49: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 1A39nHae075910; Wed, 3 Nov 2021 09:49:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A39nHBP075909; Wed, 3 Nov 2021 09:49:17 GMT (envelope-from git) Date: Wed, 3 Nov 2021 09:49:17 GMT Message-Id: <202111030949.1A39nHBP075909@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: 11703705c2f7 - main - pf tests: route_to:icmp_nat_head requires scapy List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 11703705c2f77498246b9523aae44040bd346c00 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=11703705c2f77498246b9523aae44040bd346c00 commit 11703705c2f77498246b9523aae44040bd346c00 Author: Kristof Provost AuthorDate: 2021-11-03 09:34:20 +0000 Commit: Kristof Provost CommitDate: 2021-11-03 09:35:09 +0000 pf tests: route_to:icmp_nat_head requires scapy Document the requirement so the test is skipped if scapy is not installed. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/route_to.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index e7646a5fb7f7..570d1feb36ff 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -257,6 +257,7 @@ icmp_nat_head() { atf_set descr 'Test that ICMP packets are correct for route-to + NAT' atf_set require.user root + atf_set require.progs scapy } icmp_nat_body() From nobody Wed Nov 3 12:24:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 490B4183BA05; Wed, 3 Nov 2021 12:24: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 4HkmDd1JHJz3qjx; Wed, 3 Nov 2021 12:24: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 F1AB91877A; Wed, 3 Nov 2021 12:24: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 1A3COmZg087732; Wed, 3 Nov 2021 12:24:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3COmc0087731; Wed, 3 Nov 2021 12:24:48 GMT (envelope-from git) Date: Wed, 3 Nov 2021 12:24:48 GMT Message-Id: <202111031224.1A3COmc0087731@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 4a9e95286cac - main - ip_divert: calculate delayed checksum for IPv6 adress family List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a9e95286cacce5bf7cd193b43c4a461cf7d69b8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=4a9e95286cacce5bf7cd193b43c4a461cf7d69b8 commit 4a9e95286cacce5bf7cd193b43c4a461cf7d69b8 Author: Andrey V. Elsukov AuthorDate: 2021-11-02 16:59:06 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-11-03 12:20:51 +0000 ip_divert: calculate delayed checksum for IPv6 adress family Before passing an IPv6 packet to application apply delayed checksum calculation. Mbuf flags will be lost when divert listener will return a packet back, so we will not be able to do delayed checksum calculation later. Also an application will get a packet with correct checksum. Reviewed by: donner MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32807 --- sys/netinet/ip_divert.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index e156b77f44c7..3e1200b1ff1c 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -227,6 +227,25 @@ divert_packet(struct mbuf *m, bool incoming) m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif +#ifdef INET6 + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; + in6_delayed_cksum(m, m->m_pkthdr.len - + sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#if defined(SCTP) || defined(SCTP_SUPPORT) + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif +#endif /* INET6 */ bzero(&divsrc, sizeof(divsrc)); divsrc.sin_len = sizeof(divsrc); divsrc.sin_family = AF_INET; From nobody Wed Nov 3 12:50:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 286001845812; Wed, 3 Nov 2021 12: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 4HkmpH0cTjz4S3v; Wed, 3 Nov 2021 12: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 E936F18ED0; Wed, 3 Nov 2021 12: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 1A3CoUqv022949; Wed, 3 Nov 2021 12: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 1A3CoU2t022948; Wed, 3 Nov 2021 12:50:30 GMT (envelope-from git) Date: Wed, 3 Nov 2021 12:50:30 GMT Message-Id: <202111031250.1A3CoU2t022948@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: 7acd322ebe20 - main - devfs.rules: Correctly unhide pf in vnet jails List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 7acd322ebe2072b1d73b1d19c14ab12a300ba8e8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7acd322ebe2072b1d73b1d19c14ab12a300ba8e8 commit 7acd322ebe2072b1d73b1d19c14ab12a300ba8e8 Author: Zhenlei Huang AuthorDate: 2021-11-03 11:46:48 +0000 Commit: Kristof Provost CommitDate: 2021-11-03 11:50:13 +0000 devfs.rules: Correctly unhide pf in vnet jails Revision 9e9be081d8 introduced a new devfs rule devfsrules_jail_vnet. It includes rule devfsrules_jail which include other rules. Unfortunately devfs could not recursively parse the action include and thus devfsrules_jail_vnet will expose all nodes. PR: 255660 Reviewed by: kp Obtained from: Gijs Peskens MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D32814 --- sbin/devfs/devfs.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/devfs/devfs.rules b/sbin/devfs/devfs.rules index 01d8e5194c17..9543e20947d9 100644 --- a/sbin/devfs/devfs.rules +++ b/sbin/devfs/devfs.rules @@ -88,5 +88,8 @@ add path fuse unhide add path zfs unhide [devfsrules_jail_vnet=5] +add include $devfsrules_hide_all +add include $devfsrules_unhide_basic +add include $devfsrules_unhide_login add include $devfsrules_jail add path pf unhide From nobody Wed Nov 3 13:09:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 529C5182F16C; Wed, 3 Nov 2021 13:09: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 4HknDP1k34z4Yd1; Wed, 3 Nov 2021 13:09: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 1CA051932A; Wed, 3 Nov 2021 13:09: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 1A3D9fM5041723; Wed, 3 Nov 2021 13:09:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3D9fxk041722; Wed, 3 Nov 2021 13:09:41 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:09:41 GMT Message-Id: <202111031309.1A3D9fxk041722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: a12b16f48f74 - main - date: Clean up synopses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a12b16f48f747339ccae6dd80cc0c0c4ad5b7846 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a12b16f48f747339ccae6dd80cc0c0c4ad5b7846 commit a12b16f48f747339ccae6dd80cc0c0c4ad5b7846 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-03 11:58:09 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-03 13:09:36 +0000 date: Clean up synopses MFC after: 3 days --- bin/date/date.1 | 49 +++++++++++++++++++++++++++++++++++-------------- bin/date/date.c | 6 +++--- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index 05b180cceb2b..4e60d34c1f86 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -39,34 +39,55 @@ .Nm date .Nd display or set date and time .Sh SYNOPSIS +.\" Display time. .Nm -.Op Fl jnRu -.Op Fl r Ar seconds | Ar filename +.Op Fl nRu +.Op Fl I Ns Op Ar FMT +.Op Fl r Ar filename +.Op Fl r Ar seconds .Oo -.Fl v .Sm off +.Fl v .Op Cm + | - .Ar val Op Cm y | m | w | d | H | M | S .Sm on .Oc .Op Cm + Ns Ar output_fmt +.\" Set time with the default input format. .Nm -.Op Fl ju +.Op Fl jnRu +.Op Fl I Ns Op Ar FMT +.Oo .Sm off -.Op Oo Oo Oo Oo Ar cc Oc Ar yy Oc Ar mm Oc Ar dd Oc Ar HH -.Ar MM Op Ar .ss +.Fl v +.Op Cm + | - +.Ar val Op Cm y | m | w | d | H | M | S +.Sm on +.Oc +.Sm off +.Oo Oo Oo Oo Oo +.Ar cc Oc +.Ar yy Oc +.Ar mm Oc +.Ar dd Oc +.Ar HH +.Oc Ar MM Op Cm \&. Ar ss .Sm on -.Nm -.Op Fl jRu -.Fl f Ar input_fmt new_date .Op Cm + Ns Ar output_fmt +.\" Set time with the user-provided input format. .Nm -.Op Fl jnu +.Op Fl jnRu .Op Fl I Ns Op Ar FMT -.Op Fl f Ar input_fmt -.Op Fl r Ar ... -.Op Fl v Ar ... -.Op Ar new_date +.Oo +.Sm off +.Fl v +.Op Cm + | - +.Ar val Op Cm y | m | w | d | H | M | S +.Sm on +.Oc +.Fl f Ar input_fmt +.Ar new_date +.Op Cm + Ns Ar output_fmt .Sh DESCRIPTION When invoked without arguments, the .Nm diff --git a/bin/date/date.c b/bin/date/date.c index cde299f6de61..87f3dad28bd6 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -383,11 +383,11 @@ static void usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n", - "usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]]", + "usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]", " " - "[-I[date | hours | minutes | seconds]]", + "[-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]", " " - "[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]" + "[[[[[[cc]yy]mm]dd]HH]MM[.ss] | new_date] [+output_fmt]" ); exit(1); } From nobody Wed Nov 3 13:09:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 43ADB182F488; Wed, 3 Nov 2021 13:09: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 4HknDN1QDtz4Yqn; Wed, 3 Nov 2021 13:09: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 0C225195BC; Wed, 3 Nov 2021 13:09: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 1A3D9deD041699; Wed, 3 Nov 2021 13:09:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3D9d2J041698; Wed, 3 Nov 2021 13:09:39 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:09:39 GMT Message-Id: <202111031309.1A3D9d2J041698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 00133d5c5e6a - main - date.1: Fix some style issues and examples List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00133d5c5e6aae01663eca40993abd5e6137425b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=00133d5c5e6aae01663eca40993abd5e6137425b commit 00133d5c5e6aae01663eca40993abd5e6137425b Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-03 10:26:46 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-03 13:09:18 +0000 date.1: Fix some style issues and examples - Use Cm instead of Ar or Sq for command modifiers of the -v flag. - Remove unnecessary "Ar ..." from the synopsis. It's not clear what it was referring to. - Add missing arguments to the -f and -v flags. - Stylize the dot before "ss" with Cm in the default format in the -f flag description. - Set LC_ALL=C in the last example so that the output format of date(1) always matches the specified format of the -f flag not matter the locale. - List the -f flag as optional in all usage lines in the synopsis. MFC after: 3 days --- bin/date/date.1 | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index 8f187b311a82..05b180cceb2b 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd June 16, 2021 +.Dd November 3, 2021 .Dt DATE 1 .Os .Sh NAME @@ -46,10 +46,9 @@ .Fl v .Sm off .Op Cm + | - -.Ar val Op Ar ymwdHMS +.Ar val Op Cm y | m | w | d | H | M | S .Sm on .Oc -.Ar ... .Op Cm + Ns Ar output_fmt .Nm .Op Fl ju @@ -90,7 +89,7 @@ the time may not be changed by more than 1 second. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl f +.It Fl f Ar input_fmt Use .Ar input_fmt as the format string to parse the @@ -103,7 +102,7 @@ provided rather than using the default .Ar mm Oc .Ar dd Oc .Ar HH -.Oc Ar MM Op Ar .ss +.Oc Ar MM Op Cm \&. Ar ss .Sm on format. Parsing is done using @@ -114,24 +113,24 @@ Use output format. .Ar FMT may be omitted, in which case the default is -.Sq date . +.Cm date . Valid .Ar FMT values are -.Sq date , -.Sq hours , -.Sq minutes , +.Cm date , +.Cm hours , +.Cm minutes , and -.Sq seconds . +.Cm seconds . The date and time is formatted to the specified precision. When .Ar FMT is -.Sq hours +.Cm hours (or the more precise -.Sq minutes +.Cm minutes or -.Sq seconds ) , +.Cm seconds ) , the .St -iso8601 format includes the timezone. @@ -175,7 +174,13 @@ Print the date and time of the last modification of Display or set the date in .Tn UTC (Coordinated Universal) time. -.It Fl v +.It Xo +.Fl v +.Sm off +.Op Cm + | - +.Ar val Op Cm y | m | w | d | H | M | S +.Sm on +.Xc Adjust (i.e., take the current date and display the result of the adjustment; not actually set the date) the second, minute, hour, month day, week day, month or year according to @@ -199,14 +204,14 @@ and years are in the range 80-38 or 1980-2038. If .Ar val is numeric, one of either -.Ar y , -.Ar m , -.Ar w , -.Ar d , -.Ar H , -.Ar M +.Cm y , +.Cm m , +.Cm w , +.Cm d , +.Cm H , +.Cm M or -.Ar S +.Cm S must be used to specify which part of the date is to be adjusted. .Pp The week day or month may be specified using a name rather than a @@ -420,7 +425,7 @@ will display .Pp Finally the command: .Pp -.Dl "date -j -f ""%a %b %d %T %Z %Y"" ""`date`"" ""+%s""" +.Dl "date -j -f ""%a %b %d %T %Z %Y"" ""`LC_ALL=C date`"" ""+%s""" .Pp can be used to parse the output from .Nm From nobody Wed Nov 3 13:09:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A80E6182F52B; Wed, 3 Nov 2021 13:09: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 4HknDQ3m8Vz4Yqv; Wed, 3 Nov 2021 13:09: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 4E0BA18FEC; Wed, 3 Nov 2021 13:09: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 1A3D9gaA041747; Wed, 3 Nov 2021 13:09:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3D9gm8041746; Wed, 3 Nov 2021 13:09:42 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:09:42 GMT Message-Id: <202111031309.1A3D9gm8041746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: c537bf9d5903 - main - date: Capitalize seconds string in synopses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c537bf9d5903d0689321f83691341c93b5919172 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c537bf9d5903d0689321f83691341c93b5919172 commit c537bf9d5903d0689321f83691341c93b5919172 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-03 11:59:49 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-03 13:09:36 +0000 date: Capitalize seconds string in synopses This makes it consistent with other date(1) implementations. Also, it feels more consistent since hours and minutes are already represented as HH and MM respectively. MFC after: 3 days --- bin/date/date.1 | 6 +++--- bin/date/date.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index 4e60d34c1f86..0aaae1614327 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -71,7 +71,7 @@ .Ar mm Oc .Ar dd Oc .Ar HH -.Oc Ar MM Op Cm \&. Ar ss +.Oc Ar MM Op Cm \&. Ar SS .Sm on .Op Cm + Ns Ar output_fmt .\" Set time with the user-provided input format. @@ -123,7 +123,7 @@ provided rather than using the default .Ar mm Oc .Ar dd Oc .Ar HH -.Oc Ar MM Op Cm \&. Ar ss +.Oc Ar MM Op Cm \&. Ar SS .Sm on format. Parsing is done using @@ -330,7 +330,7 @@ Day, a number from 1 to 31. Hour, a number from 0 to 23. .It Ar MM Minutes, a number from 0 to 59. -.It Ar ss +.It Ar SS Seconds, a number from 0 to 60 (59 plus a potential leap second). .El diff --git a/bin/date/date.c b/bin/date/date.c index 87f3dad28bd6..4dc5df0dccfc 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -387,7 +387,7 @@ usage(void) " " "[-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]", " " - "[[[[[[cc]yy]mm]dd]HH]MM[.ss] | new_date] [+output_fmt]" + "[[[[[[cc]yy]mm]dd]HH]MM[.SS] | new_date] [+output_fmt]" ); exit(1); } From nobody Wed Nov 3 13:10:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AE5F91830727; Wed, 3 Nov 2021 13:10: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 4HknFV1t3Xz4ZnB; Wed, 3 Nov 2021 13:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF1B6193B8; Wed, 3 Nov 2021 13:10: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 1A3DAbce050193; Wed, 3 Nov 2021 13:10:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DAbMr050192; Wed, 3 Nov 2021 13:10:37 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:10:37 GMT Message-Id: <202111031310.1A3DAbMr050192@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: e4ce23b238a1 - main - fexecve(2): restore the attempts to calculate the executable path List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: e4ce23b238a162f5d36afe8ef49dcd66901138a1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e4ce23b238a162f5d36afe8ef49dcd66901138a1 commit e4ce23b238a162f5d36afe8ef49dcd66901138a1 Author: Konstantin Belousov AuthorDate: 2021-11-03 12:58:03 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-03 13:10:22 +0000 fexecve(2): restore the attempts to calculate the executable path vn_fullpath() call was not converted to pass newtextvp, instead it used imgp->vp which is still NULL there. As result vn_fullpath() always returned EINVAL and execpath was recorded from the value of arg0. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/kern_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 780b917ad21d..c5b450b04240 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -537,7 +537,7 @@ interpret: &newtextvp); if (error) goto exec_fail; - if (vn_fullpath(imgp->vp, &imgp->execpath, + if (vn_fullpath(newtextvp, &imgp->execpath, &imgp->freepath) != 0) imgp->execpath = args->fname; vn_lock(newtextvp, LK_SHARED | LK_RETRY); From nobody Wed Nov 3 13:15:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1B3201833BF2; Wed, 3 Nov 2021 13:15: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 4HknM603Zzz4cn7; Wed, 3 Nov 2021 13:15: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 D5D7C1944F; Wed, 3 Nov 2021 13:15: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 1A3DFTMS055297; Wed, 3 Nov 2021 13:15:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DFTXe055296; Wed, 3 Nov 2021 13:15:29 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:15:29 GMT Message-Id: <202111031315.1A3DFTXe055296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 380736a95d3d - stable/13 - amd64 pmap: Pre-set PG_M on 2MB KASAN shadow map entries List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 380736a95d3d6d5bec929936b08a0d998a660e39 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=380736a95d3d6d5bec929936b08a0d998a660e39 commit 380736a95d3d6d5bec929936b08a0d998a660e39 Author: Mark Johnston AuthorDate: 2021-08-10 20:23:42 +0000 Commit: Mark Johnston CommitDate: 2021-11-02 22:17:58 +0000 amd64 pmap: Pre-set PG_M on 2MB KASAN shadow map entries Also remove a redundant assertion in pmap_kasan_enter(). Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 4fd450a87df015fe85cadfac0e22c73e3c878d24) --- sys/amd64/amd64/pmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 62bc1bb22e96..a1f3a5cdc650 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -11340,7 +11340,7 @@ pmap_kasan_enter(vm_offset_t va) m = pmap_kasan_enter_alloc_2m(); if (m != NULL) { *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | - X86_PG_PS | X86_PG_V | pg_nx); + X86_PG_PS | X86_PG_V | X86_PG_A | X86_PG_M | pg_nx); } else { m = pmap_kasan_enter_alloc_4k(); *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | @@ -11352,8 +11352,6 @@ pmap_kasan_enter(vm_offset_t va) pte = pmap_pde_to_pte(pde, va); if ((*pte & X86_PG_V) != 0) return; - KASSERT((*pte & X86_PG_V) == 0, - ("%s: shadow address %#lx is already mapped", __func__, va)); m = pmap_kasan_enter_alloc_4k(); *pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | X86_PG_M | X86_PG_A | pg_nx); From nobody Wed Nov 3 13:15:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 41AAE1833F0C; Wed, 3 Nov 2021 13:15: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 4HknM70rxvz4d1Q; Wed, 3 Nov 2021 13:15: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 EF2DB196CF; Wed, 3 Nov 2021 13:15: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 1A3DFUk3055321; Wed, 3 Nov 2021 13:15:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DFUGL055320; Wed, 3 Nov 2021 13:15:30 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:15:30 GMT Message-Id: <202111031315.1A3DFUGL055320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 10d94487df58 - stable/13 - kasan: Use vm_offset_t for the first parameter to kasan_shadow_map() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10d94487df58e286a6d29b9adf39ebcc8fd2597e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=10d94487df58e286a6d29b9adf39ebcc8fd2597e commit 10d94487df58e286a6d29b9adf39ebcc8fd2597e Author: Mark Johnston AuthorDate: 2021-04-29 15:39:02 +0000 Commit: Mark Johnston CommitDate: 2021-11-02 22:17:58 +0000 kasan: Use vm_offset_t for the first parameter to kasan_shadow_map() No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit 20e3b9d8bd778445bb80b2be28d2fdedf7bae37e) --- sys/amd64/amd64/pmap.c | 2 +- sys/kern/subr_asan.c | 10 +++++----- sys/sys/asan.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index a1f3a5cdc650..353ee18a862a 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4892,7 +4892,7 @@ pmap_growkernel(vm_offset_t addr) if (addr - 1 >= vm_map_max(kernel_map)) addr = vm_map_max(kernel_map); if (kernel_vm_end < addr) - kasan_shadow_map((void *)kernel_vm_end, addr - kernel_vm_end); + kasan_shadow_map(kernel_vm_end, addr - kernel_vm_end); while (kernel_vm_end < addr) { pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end); if ((*pdpe & X86_PG_V) == 0) { diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 2967b443d5c8..825d7d4228c0 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -97,18 +97,18 @@ static bool kasan_enabled __read_mostly = false; /* -------------------------------------------------------------------------- */ void -kasan_shadow_map(void *addr, size_t size) +kasan_shadow_map(vm_offset_t addr, size_t size) { size_t sz, npages, i; vm_offset_t sva, eva; - KASSERT((vm_offset_t)addr % KASAN_SHADOW_SCALE == 0, - ("%s: invalid address %p", __func__, addr)); + KASSERT(addr % KASAN_SHADOW_SCALE == 0, + ("%s: invalid address %#lx", __func__, addr)); sz = roundup(size, KASAN_SHADOW_SCALE) / KASAN_SHADOW_SCALE; - sva = kasan_md_addr_to_shad((vm_offset_t)addr); - eva = kasan_md_addr_to_shad((vm_offset_t)addr) + sz; + sva = kasan_md_addr_to_shad(addr); + eva = kasan_md_addr_to_shad(addr) + sz; sva = rounddown(sva, PAGE_SIZE); eva = roundup(eva, PAGE_SIZE); diff --git a/sys/sys/asan.h b/sys/sys/asan.h index c86202222c72..caa6643bda68 100644 --- a/sys/sys/asan.h +++ b/sys/sys/asan.h @@ -56,7 +56,7 @@ #define KASAN_EXEC_ARGS_FREED 0xFF void kasan_init(void); -void kasan_shadow_map(void *, size_t); +void kasan_shadow_map(vm_offset_t, size_t); void kasan_mark(const void *, size_t, size_t, uint8_t); #else /* KASAN */ From nobody Wed Nov 3 13:15:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 076811833CDC; Wed, 3 Nov 2021 13:15: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 4HknM83CsYz4d6J; Wed, 3 Nov 2021 13:15: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 20064195D2; Wed, 3 Nov 2021 13:15: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 1A3DFWXK055345; Wed, 3 Nov 2021 13:15:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DFW1j055344; Wed, 3 Nov 2021 13:15:32 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:15:32 GMT Message-Id: <202111031315.1A3DFW1j055344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5fdfe78b42d0 - stable/13 - conf: Add a KMSAN kernel option List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5fdfe78b42d0995e3b6849c43cbe94eeb3c308d4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5fdfe78b42d0995e3b6849c43cbe94eeb3c308d4 commit 5fdfe78b42d0995e3b6849c43cbe94eeb3c308d4 Author: Mark Johnston AuthorDate: 2021-08-10 19:51:03 +0000 Commit: Mark Johnston CommitDate: 2021-11-02 22:17:58 +0000 conf: Add a KMSAN kernel option Sponsored by: The FreeBSD Foundation (cherry picked from commit 30d00832d7733e60f5e030d335c129bfa77dd77a) --- sys/conf/kern.pre.mk | 6 ++++++ sys/conf/options | 1 + 2 files changed, 7 insertions(+) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 8cab54d0763a..daba78135c79 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -122,6 +122,12 @@ KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo SAN_CFLAGS+= -fsanitize=thread .endif +KMSAN_ENABLED!= grep KMSAN opt_global.h || true ; echo +.if !empty(KMSAN_ENABLED) +SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kmsan \ + -fsanitize=kernel-memory +.endif + KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo .if !empty(KUBSAN_ENABLED) SAN_CFLAGS+= -fsanitize=undefined diff --git a/sys/conf/options b/sys/conf/options index 774850158221..c7fbbec08a9f 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -232,6 +232,7 @@ COVERAGE opt_global.h KASAN opt_global.h KCOV KCSAN opt_global.h +KMSAN opt_global.h KUBSAN opt_global.h # POSIX kernel options From nobody Wed Nov 3 13:15:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 994191833F27; Wed, 3 Nov 2021 13:15: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 4HknMB1c7Lz4cyJ; Wed, 3 Nov 2021 13:15: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 45FB5193ED; Wed, 3 Nov 2021 13:15: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 1A3DFXKW055369; Wed, 3 Nov 2021 13:15:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DFXde055368; Wed, 3 Nov 2021 13:15:33 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:15:33 GMT Message-Id: <202111031315.1A3DFXde055368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 36ca4b79b848 - stable/13 - amd64: Define KVA regions for KMSAN shadow maps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 36ca4b79b84870cd7da2fe59a359d2c299b54032 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=36ca4b79b84870cd7da2fe59a359d2c299b54032 commit 36ca4b79b84870cd7da2fe59a359d2c299b54032 Author: Mark Johnston AuthorDate: 2021-08-10 20:25:39 +0000 Commit: Mark Johnston CommitDate: 2021-11-02 22:17:58 +0000 amd64: Define KVA regions for KMSAN shadow maps KMSAN requires two shadow maps, each one-to-one with the kernel map. Allocate regions of the kernels PML4 page for them. Add functions to create mappings in the shadow map regions, these will be used by the KMSAN runtime. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit f95f780ea4e163ce9a0295a699f41f0a7e1591d4) --- sys/amd64/amd64/pmap.c | 78 +++++++++++++++++++++++++++++++++++++++++++++ sys/amd64/include/pmap.h | 13 ++++++++ sys/amd64/include/vmparam.h | 13 ++++++-- 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 353ee18a862a..d2a168ca7f70 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -11358,6 +11358,76 @@ pmap_kasan_enter(vm_offset_t va) } #endif +#ifdef KMSAN +static vm_page_t +pmap_kmsan_enter_alloc_4k(void) +{ + vm_page_t m; + + m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED | VM_ALLOC_ZERO); + if (m == NULL) + panic("%s: no memory to grow shadow map", __func__); + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + return (m); +} + +static vm_page_t +pmap_kmsan_enter_alloc_2m(void) +{ + vm_page_t m; + + m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT); + if (m != NULL) + memset((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), 0, NBPDR); + return (m); +} + +/* + * Grow the shadow or origin maps by at least one 4KB page at the specified + * address. Use 2MB pages when possible. + */ +void +pmap_kmsan_enter(vm_offset_t va) +{ + pdp_entry_t *pdpe; + pd_entry_t *pde; + pt_entry_t *pte; + vm_page_t m; + + mtx_assert(&kernel_map->system_mtx, MA_OWNED); + + pdpe = pmap_pdpe(kernel_pmap, va); + if ((*pdpe & X86_PG_V) == 0) { + m = pmap_kmsan_enter_alloc_4k(); + *pdpe = (pdp_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | + X86_PG_V | pg_nx); + } + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & X86_PG_V) == 0) { + m = pmap_kmsan_enter_alloc_2m(); + if (m != NULL) { + *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | + X86_PG_PS | X86_PG_V | X86_PG_A | X86_PG_M | pg_nx); + } else { + m = pmap_kmsan_enter_alloc_4k(); + *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | + X86_PG_V | pg_nx); + } + } + if ((*pde & X86_PG_PS) != 0) + return; + pte = pmap_pde_to_pte(pde, va); + if ((*pte & X86_PG_V) != 0) + return; + m = pmap_kmsan_enter_alloc_4k(); + *pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | + X86_PG_M | X86_PG_A | pg_nx); +} +#endif + /* * Track a range of the kernel's virtual address space that is contiguous * in various mapping attributes. @@ -11539,6 +11609,14 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS) case KASANPML4I: sbuf_printf(sb, "\nKASAN shadow map:\n"); break; +#endif +#ifdef KMSAN + case KMSANSHADPML4I: + sbuf_printf(sb, "\nKMSAN shadow map:\n"); + break; + case KMSANORIGPML4I: + sbuf_printf(sb, "\nKMSAN origin map:\n"); + break; #endif case KPML4BASE: sbuf_printf(sb, "\nKernel map:\n"); diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index c5c1714f2f94..bd6a8c006813 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -201,6 +201,13 @@ */ #define NKASANPML4E ((NKPML4E + 7) / 8) +/* + * Number of PML4 slots for the KMSAN shadow and origin maps. These are + * one-to-one with the kernel map. + */ +#define NKMSANSHADPML4E NKPML4E +#define NKMSANORIGPML4E NKPML4E + /* * We use the same numbering of the page table pages for 5-level and * 4-level paging structures. @@ -251,6 +258,9 @@ #define KASANPML4I (DMPML4I - NKASANPML4E) /* Below the direct map */ +#define KMSANSHADPML4I (KPML4BASE - NKMSANSHADPML4E) +#define KMSANORIGPML4I (DMPML4I - NKMSANORIGPML4E) + /* Large map: index of the first and max last pml4 entry */ #define LMSPML4I (PML4PML4I + 1) #define LMEPML4I (KASANPML4I - 1) @@ -521,6 +531,9 @@ vm_page_t pmap_page_alloc_below_4g(bool zeroed); #ifdef KASAN void pmap_kasan_enter(vm_offset_t); #endif +#ifdef KMSAN +void pmap_kmsan_enter(vm_offset_t); +#endif #endif /* _KERNEL */ diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index 88fd29b80be3..61d0dea54210 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -170,9 +170,10 @@ * 0xffff804020100fff - 0xffff807fffffffff unused * 0xffff808000000000 - 0xffff847fffffffff large map (can be tuned up) * 0xffff848000000000 - 0xfffff77fffffffff unused (large map extends there) - * 0xfffff78000000000 - 0xfffff7ffffffffff 512GB KASAN shadow map + * 0xfffff60000000000 - 0xfffff7ffffffffff 2TB KMSAN origin map, optional + * 0xfffff78000000000 - 0xfffff7bfffffffff 512GB KASAN shadow map, optional * 0xfffff80000000000 - 0xfffffbffffffffff 4TB direct map - * 0xfffffc0000000000 - 0xfffffdffffffffff unused + * 0xfffffc0000000000 - 0xfffffdffffffffff 2TB KMSAN shadow map, optional * 0xfffffe0000000000 - 0xffffffffffffffff 2TB kernel map * * Within the kernel map: @@ -191,6 +192,14 @@ #define KASAN_MIN_ADDRESS KV4ADDR(KASANPML4I, 0, 0, 0) #define KASAN_MAX_ADDRESS KV4ADDR(KASANPML4I + NKASANPML4E, 0, 0, 0) +#define KMSAN_SHAD_MIN_ADDRESS KV4ADDR(KMSANSHADPML4I, 0, 0, 0) +#define KMSAN_SHAD_MAX_ADDRESS KV4ADDR(KMSANSHADPML4I + NKMSANSHADPML4E, \ + 0, 0, 0) + +#define KMSAN_ORIG_MIN_ADDRESS KV4ADDR(KMSANORIGPML4I, 0, 0, 0) +#define KMSAN_ORIG_MAX_ADDRESS KV4ADDR(KMSANORIGPML4I + NKMSANORIGPML4E, \ + 0, 0, 0) + #define LARGEMAP_MIN_ADDRESS KV4ADDR(LMSPML4I, 0, 0, 0) #define LARGEMAP_MAX_ADDRESS KV4ADDR(LMEPML4I + 1, 0, 0, 0) From nobody Wed Nov 3 13:15:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F2B101833D54; Wed, 3 Nov 2021 13:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HknMB4lBxz4d1j; Wed, 3 Nov 2021 13:15: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 5DE32195D3; Wed, 3 Nov 2021 13:15: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 1A3DFYhv055393; Wed, 3 Nov 2021 13:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DFYBp055392; Wed, 3 Nov 2021 13:15:34 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:15:34 GMT Message-Id: <202111031315.1A3DFYBp055392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b5e502026085 - stable/13 - rmslock: Update td_locks during lock and unlock operations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b5e50202608587d8b3062be9078d24727e61b119 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b5e50202608587d8b3062be9078d24727e61b119 commit b5e50202608587d8b3062be9078d24727e61b119 Author: Mark Johnston AuthorDate: 2021-10-27 15:18:13 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 13:15:05 +0000 rmslock: Update td_locks during lock and unlock operations Reviewed by: mjg Sponsored by: The FreeBSD Foundation (cherry picked from commit 71f31d784e1816a155cafbccf4b28291200097aa) --- sys/kern/kern_rmlock.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 7230a00e357b..f9b5559a648c 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -1017,6 +1017,7 @@ rms_rlock_fallback(struct rmslock *rms) rms_int_readers_inc(rms, rms_int_pcpu(rms)); mtx_unlock(&rms->mtx); critical_exit(); + TD_LOCKS_INC(curthread); } void @@ -1040,6 +1041,7 @@ rms_rlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_INC(curthread); } int @@ -1063,6 +1065,7 @@ rms_try_rlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_INC(curthread); return (1); } @@ -1082,6 +1085,7 @@ rms_runlock_fallback(struct rmslock *rms) if (rms->readers == 0) wakeup_one(&rms->writers); mtx_unlock(&rms->mtx); + TD_LOCKS_DEC(curthread); } void @@ -1102,6 +1106,7 @@ rms_runlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_DEC(curthread); } struct rmslock_ipi { @@ -1219,6 +1224,7 @@ out_grab: rms_assert_no_pcpu_readers(rms); mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); + TD_LOCKS_INC(curthread); } void @@ -1239,6 +1245,7 @@ rms_wunlock(struct rmslock *rms) rms->owner = RMS_NOOWNER; } mtx_unlock(&rms->mtx); + TD_LOCKS_DEC(curthread); } void From nobody Wed Nov 3 13:15:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 141CE183410A; Wed, 3 Nov 2021 13: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 4HknMF36Vzz4d1s; Wed, 3 Nov 2021 13:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D14B193EE; Wed, 3 Nov 2021 13:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A3DFZ2D055424; Wed, 3 Nov 2021 13:15:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3DFZb9055423; Wed, 3 Nov 2021 13:15:35 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:15:35 GMT Message-Id: <202111031315.1A3DFZb9055423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 009b4d719039 - stable/13 - vlapic: Schedule callouts on the local CPU List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 009b4d7190397032d21a7470ddf0cc93482297e2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=009b4d7190397032d21a7470ddf0cc93482297e2 commit 009b4d7190397032d21a7470ddf0cc93482297e2 Author: Mark Johnston AuthorDate: 2021-10-20 00:50:06 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 13:15:18 +0000 vlapic: Schedule callouts on the local CPU The virtual LAPIC driver uses callouts to implement the LAPIC timer. Callouts are armed using callout_reset_sbt(), which currently puts everything on CPU 0. On systems running many bhyve VMs this results in a large amount of contention for CPU 0's callout lock. Modify vlapic to schedule callouts on the local CPU instead. This allows timer interrupts to be scheduled more evenly among CPUs where bhyve is running. Reviewed by: grehan, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 4c812fe61b7ce2f297a381950ff7bd87fd51f698) --- sys/amd64/vmm/io/vlapic.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 4e7ddbafd447..940e45cce458 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #define VLAPIC_BUS_FREQ (128 * 1024 * 1024) static void vlapic_set_error(struct vlapic *, uint32_t, bool); +static void vlapic_callout_handler(void *arg); static __inline uint32_t vlapic_get_id(struct vlapic *vlapic) @@ -710,6 +711,13 @@ vlapic_trigger_lvt(struct vlapic *vlapic, int vector) return (0); } +static void +vlapic_callout_reset(struct vlapic *vlapic, sbintime_t t) +{ + callout_reset_sbt_curcpu(&vlapic->callout, t, 0, + vlapic_callout_handler, vlapic, 0); +} + static void vlapic_callout_handler(void *arg) { @@ -765,8 +773,7 @@ vlapic_callout_handler(void *arg) } bintime_add(&vlapic->timer_fire_bt, &vlapic->timer_period_bt); - callout_reset_sbt(&vlapic->callout, rem_sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, rem_sbt); } done: VLAPIC_TIMER_UNLOCK(vlapic); @@ -792,8 +799,7 @@ vlapic_icrtmr_write_handler(struct vlapic *vlapic) bintime_add(&vlapic->timer_fire_bt, &vlapic->timer_period_bt); sbt = bttosbt(vlapic->timer_period_bt); - callout_reset_sbt(&vlapic->callout, sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, sbt); } else callout_stop(&vlapic->callout); @@ -1667,8 +1673,7 @@ vlapic_reset_callout(struct vlapic *vlapic, uint32_t ccr) bintime_add(&vlapic->timer_fire_bt, &bt); sbt = bttosbt(bt); - callout_reset_sbt(&vlapic->callout, sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, sbt); } else { /* even if the CCR was 0, periodic timers should be reset */ if (vlapic_periodic_timer(vlapic)) { @@ -1678,8 +1683,7 @@ vlapic_reset_callout(struct vlapic *vlapic, uint32_t ccr) sbt = bttosbt(vlapic->timer_period_bt); callout_stop(&vlapic->callout); - callout_reset_sbt(&vlapic->callout, sbt, 0, - vlapic_callout_handler, vlapic, 0); + vlapic_callout_reset(vlapic, sbt); } } From nobody Wed Nov 3 13:48:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A33071844775; Wed, 3 Nov 2021 13: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 4Hkp5Q4FZLz4qjT; Wed, 3 Nov 2021 13: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 7398019E30; Wed, 3 Nov 2021 13: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 1A3DmgbR094720; Wed, 3 Nov 2021 13: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 1A3Dmgdr094719; Wed, 3 Nov 2021 13:48:42 GMT (envelope-from git) Date: Wed, 3 Nov 2021 13:48:42 GMT Message-Id: <202111031348.1A3Dmgdr094719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: b042d10cdc71 - main - ofwfb: fix vga/hdmi console with ASMEDIA during boot on powerpc64(le) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b042d10cdc71ddd6ef3449261d712b05c648746e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=b042d10cdc71ddd6ef3449261d712b05c648746e commit b042d10cdc71ddd6ef3449261d712b05c648746e Author: Alfredo Dal'Ava Junior AuthorDate: 2021-11-03 16:42:28 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-11-03 16:42:28 +0000 ofwfb: fix vga/hdmi console with ASMEDIA during boot on powerpc64(le) On recent OpenBMC firmware, the onboard ASMEDIA video card framebuffer address was removed from device tree for security purposes (value is set to zero to avoid leaking the address). This patch works around the problem by taking framebuffer base address from the "ranges" property of a parent node. Reviewed by: luporl, jhibbits (on IRC) MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D30626 --- sys/dev/vt/hw/ofwfb/ofwfb.c | 116 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 6 deletions(-) diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c index 9dc674c0ebf9..e388356450d6 100644 --- a/sys/dev/vt/hw/ofwfb/ofwfb.c +++ b/sys/dev/vt/hw/ofwfb/ofwfb.c @@ -61,7 +61,8 @@ struct ofwfb_softc { uint32_t vendor_id; }; -#define PCI_VENDOR_ID_NVIDIA 0x10de +#define PCI_VID_NVIDIA 0x10de /* NVIDIA Corporation */ +#define PCI_VID_ASPEED 0x1a03 /* ASPEED Technology, Inc. */ static void ofwfb_initialize(struct vt_device *vd); static vd_probe_t ofwfb_probe; @@ -297,6 +298,104 @@ ofwfb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, #endif } + +/* + * Decode OpenFirmware/IEEE 1275-1994 "ranges" property + * + * XXX: this is similar to ofw_pcib_fill_ranges but cannot use it here because + * it's not possible to allocate memory at the moment this is funcion is + * used. Since there are other similar functions dealing with "ranges" + * property, a proper refactoring is suggested. + */ +static uint64_t +decode_pci_ranges_host_addr(phandle_t pcinode) +{ + struct simplebus_range { + uint64_t bus; + uint64_t host; + uint64_t size; + }; + + struct simplebus_range ranges[4]; + int nranges, host_address_cells; + pcell_t acells, scells; + cell_t base_ranges[64]; + + ssize_t nbase_ranges; + int i, j, k; + + if (!OF_hasprop(pcinode, "ranges")) + return (0); + + if (OF_getencprop(pcinode, "#address-cells", &acells, sizeof(acells)) != + sizeof(acells)) + return (0); + + if (OF_getencprop(pcinode, "#size-cells", &scells, sizeof(scells)) != + sizeof(scells)) + return (0); + + if (OF_searchencprop(OF_parent(pcinode), "#address-cells", + &host_address_cells, sizeof(host_address_cells)) != + sizeof(host_address_cells)) + return (0); + + nbase_ranges = OF_getproplen(pcinode, "ranges"); + nranges = nbase_ranges / sizeof(cell_t) / (acells + host_address_cells + scells); + + /* prevent buffer overflow during iteration */ + if (nranges > sizeof(ranges) / sizeof(ranges[0])) + nranges = sizeof(ranges) / sizeof(ranges[0]); + + /* decode range value and return the first valid address */ + OF_getencprop(pcinode, "ranges", base_ranges, nbase_ranges); + for (i = 0, j = 0; i < nranges; i++) { + ranges[i].bus = 0; + for (k = 0; k < acells; k++) { + ranges[i].bus <<= 32; + ranges[i].bus |= base_ranges[j++]; + } + + ranges[i].host = 0; + for (k = 0; k < host_address_cells; k++) { + ranges[i].host <<= 32; + ranges[i].host |= base_ranges[j++]; + } + ranges[i].size = 0; + for (k = 0; k < scells; k++) { + ranges[i].size <<= 32; + ranges[i].size |= base_ranges[j++]; + } + + if (ranges[i].host != 0) + return (ranges[i].host); + } + + return (0); +} + +static bus_addr_t +find_pci_host_address(phandle_t node) +{ + uint64_t addr; + + /* + * According to IEEE STD 1275, if property "ranges" exists but has a + * zero-length property value, the child address space is identical + * to the parent address space. + */ + while (node) { + if (OF_hasprop(node, "ranges")) { + addr = decode_pci_ranges_host_addr(node); + if (addr != 0) + return ((bus_addr_t)addr); + } + node = OF_parent(node); + } + + return (0); +} + static void ofwfb_initialize(struct vt_device *vd) { @@ -350,7 +449,7 @@ ofwfb_initialize(struct vt_device *vd) * There is no good way to determine the correct option, as this * is independent of endian swapping. */ - if (sc->vendor_id == PCI_VENDOR_ID_NVIDIA) + if (sc->vendor_id == PCI_VID_NVIDIA) sc->argb = 0; else sc->argb = 1; @@ -430,7 +529,6 @@ ofwfb_init(struct vt_device *vd) sizeof(vendor_id)) == sizeof(vendor_id)) sc->vendor_id = vendor_id; - /* Keep track of the OF node */ sc->sc_node = node; @@ -497,12 +595,18 @@ ofwfb_init(struct vt_device *vd) * Grab the physical address of the framebuffer, and then map it * into our memory space. If the MMU is not yet up, it will be * remapped for us when relocation turns on. + * + * The ASPEED driver on recent petitboot versions doesn't expose the + * physical address of framebuffer anymore for security. So it should + * retrieve the address from PCI device properties. */ user_phys = 0; TUNABLE_UINT64_FETCH("hw.ofwfb.physaddr", &user_phys); - fb_phys = (bus_addr_t)user_phys; - if (fb_phys) - sc->fb.fb_pbase = (vm_paddr_t)fb_phys; + + if (user_phys) + sc->fb.fb_pbase = (vm_paddr_t)user_phys; + else if (sc->vendor_id == PCI_VID_ASPEED) + sc->fb.fb_pbase = find_pci_host_address(node); else if (OF_hasprop(node, "address")) { switch (OF_getproplen(node, "address")) { From nobody Wed Nov 3 14:03:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B2A1C182BDE6; Wed, 3 Nov 2021 14:03: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 4HkpQk4H79z4vqx; Wed, 3 Nov 2021 14:03: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 72CFD19FAC; Wed, 3 Nov 2021 14:03: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 1A3E3g2P021952; Wed, 3 Nov 2021 14:03:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3E3g4T021951; Wed, 3 Nov 2021 14:03:42 GMT (envelope-from git) Date: Wed, 3 Nov 2021 14:03:42 GMT Message-Id: <202111031403.1A3E3g4T021951@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: dbfe5dd3f951 - main - cam_periph: style change List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: dbfe5dd3f95148dd14b95025182da371029c2e90 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dbfe5dd3f95148dd14b95025182da371029c2e90 commit dbfe5dd3f95148dd14b95025182da371029c2e90 Author: Warner Losh AuthorDate: 2021-11-03 14:03:07 +0000 Commit: Warner Losh CommitDate: 2021-11-03 14:03:07 +0000 cam_periph: style change wrap a long line at 80 columns Sponsored by: Netflix Reviewed by: chs Differential Revision: https://reviews.freebsd.org/D32679 --- sys/cam/cam_periph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 90ddf261cb12..d8fd41d77be7 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -279,7 +279,8 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, && cur_periph->unit_number < periph->unit_number) cur_periph = TAILQ_NEXT(cur_periph, unit_links); if (cur_periph != NULL) { - KASSERT(cur_periph->unit_number != periph->unit_number, ("duplicate units on periph list")); + KASSERT(cur_periph->unit_number != periph->unit_number, + ("duplicate units on periph list")); TAILQ_INSERT_BEFORE(cur_periph, periph, unit_links); } else { TAILQ_INSERT_TAIL(&(*p_drv)->units, periph, unit_links); From nobody Wed Nov 3 15:22:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B0EC9182227E; Wed, 3 Nov 2021 15:22: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 4Hkr9b4hd3z3wR6; Wed, 3 Nov 2021 15:22: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 81F271B06A; Wed, 3 Nov 2021 15:22: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 1A3FMR2H028066; Wed, 3 Nov 2021 15:22:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3FMRDv028063; Wed, 3 Nov 2021 15:22:27 GMT (envelope-from git) Date: Wed, 3 Nov 2021 15:22:27 GMT Message-Id: <202111031522.1A3FMRDv028063@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: 8da503495491 - main - ixgbe(4): Fix a few typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8da5034954911ecad0ce1e55acd3b50797bc338a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8da5034954911ecad0ce1e55acd3b50797bc338a commit 8da5034954911ecad0ce1e55acd3b50797bc338a Author: Gordon Bergling AuthorDate: 2021-11-03 15:16:20 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 15:16:20 +0000 ixgbe(4): Fix a few typos in source code comments - s/Manageblility/Managebility/ - s/alows/allows/ MFC after: 3 days Obtained from: NetBSD --- sys/dev/ixgbe/ixgbe_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 1eb446184990..769c47a143d8 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -1488,7 +1488,7 @@ struct ixgbe_dmac_config { #define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST) /* FACTPS */ -#define IXGBE_FACTPS_MNGCG 0x20000000 /* Manageblility Clock Gated */ +#define IXGBE_FACTPS_MNGCG 0x20000000 /* Managebility Clock Gated */ #define IXGBE_FACTPS_LFS 0x40000000 /* LAN Function Select */ /* MHADD Bit Masks */ @@ -2334,7 +2334,7 @@ enum { /* EEPROM Addressing bits based on type (0-small, 1-large) */ #define IXGBE_EEC_ADDR_SIZE 0x00000400 #define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */ -#define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD alows 14 bits for addr. */ +#define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD allows 14 bits for addr. */ #define IXGBE_EEC_SIZE_SHIFT 11 #define IXGBE_EEPROM_WORD_SIZE_SHIFT 6 From nobody Wed Nov 3 15:22:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0650D1822385; Wed, 3 Nov 2021 15:22: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 4Hkr9c6MJ0z4QmX; Wed, 3 Nov 2021 15:22: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 ABC8E1B06B; Wed, 3 Nov 2021 15:22: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 1A3FMS57028092; Wed, 3 Nov 2021 15:22:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3FMSix028091; Wed, 3 Nov 2021 15:22:28 GMT (envelope-from git) Date: Wed, 3 Nov 2021 15:22:28 GMT Message-Id: <202111031522.1A3FMSix028091@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: a506133ac91d - main - mana: Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: a506133ac91da01e901cacae92133f68803bafe1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a506133ac91da01e901cacae92133f68803bafe1 commit a506133ac91da01e901cacae92133f68803bafe1 Author: Gordon Bergling AuthorDate: 2021-11-03 15:20:11 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 15:20:11 +0000 mana: Fix a typo in a source code comment - s/maxium/maximum/ MFC after: 1 week --- sys/dev/mana/mana_en.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 7ad69457afc2..e57a2622d09f 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -2164,7 +2164,7 @@ mana_create_rxq(struct mana_port_context *apc, uint32_t rxq_idx, rxq->rxq_idx = rxq_idx; /* * Minimum size is MCLBYTES(2048) bytes for a mbuf cluster. - * Now we just allow maxium size of 4096. + * Now we just allow maximum size of 4096. */ rxq->datasize = ALIGN(apc->frame_size, MCLBYTES); if (rxq->datasize > MAX_FRAME_SIZE) From nobody Wed Nov 3 15:22:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 92E9A1822390; Wed, 3 Nov 2021 15:22: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 4Hkr9d6s4Lz4Qmk; Wed, 3 Nov 2021 15:22: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 CA9EB1AFC0; Wed, 3 Nov 2021 15:22: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 1A3FMTmv028116; Wed, 3 Nov 2021 15:22:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3FMTtt028115; Wed, 3 Nov 2021 15:22:29 GMT (envelope-from git) Date: Wed, 3 Nov 2021 15:22:29 GMT Message-Id: <202111031522.1A3FMTtt028115@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: bb91496a8517 - main - netinet: Fix a common typo in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: bb91496a85176cfc005cf141fe1262c9ad5507d4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bb91496a85176cfc005cf141fe1262c9ad5507d4 commit bb91496a85176cfc005cf141fe1262c9ad5507d4 Author: Gordon Bergling AuthorDate: 2021-11-03 15:21:49 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 15:21:49 +0000 netinet: Fix a common typo in source code comments - s/writting/writing/ MFC after: 3 days --- sys/netinet/sctputil.c | 4 ++-- sys/netinet/tcp_subr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index cff22394dda3..9283b1288dae 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -7458,7 +7458,7 @@ sctp_over_udp_stop(void) { /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() - * for writting! + * for writing! */ #ifdef INET if (SCTP_BASE_INFO(udp4_tun_socket) != NULL) { @@ -7487,7 +7487,7 @@ sctp_over_udp_start(void) #endif /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() - * for writting! + * for writing! */ port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port); if (ntohs(port) == 0) { diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index e12eb5682c14..2075c1d853c3 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -774,7 +774,7 @@ tcp_over_udp_stop(void) { /* * This function assumes sysctl caller holds inp_rinfo_lock() - * for writting! + * for writing! */ #ifdef INET if (V_udp4_tun_socket != NULL) { @@ -803,7 +803,7 @@ tcp_over_udp_start(void) #endif /* * This function assumes sysctl caller holds inp_info_rlock() - * for writting! + * for writing! */ port = V_tcp_udp_tunneling_port; if (ntohs(port) == 0) { From nobody Wed Nov 3 15:22:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 69B4D18228B0; Wed, 3 Nov 2021 15:22: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 4Hkr9z1BKSz4RFr; Wed, 3 Nov 2021 15:22: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 D69A41B3EF; Wed, 3 Nov 2021 15:22: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 1A3FMkZb028259; Wed, 3 Nov 2021 15:22:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3FMkce028258; Wed, 3 Nov 2021 15:22:46 GMT (envelope-from git) Date: Wed, 3 Nov 2021 15:22:46 GMT Message-Id: <202111031522.1A3FMkce028258@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: c75c1d2df9b3 - main - vmci: Avoid relying on macro expansion to provide correct syntax List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c75c1d2df9b3839319f6b5e2fad0b757eebd9c55 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c75c1d2df9b3839319f6b5e2fad0b757eebd9c55 commit c75c1d2df9b3839319f6b5e2fad0b757eebd9c55 Author: Mark Johnston AuthorDate: 2021-11-03 15:19:53 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 15:22:40 +0000 vmci: Avoid relying on macro expansion to provide correct syntax No functional change intended. MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/dev/vmware/vmci/vmci_kernel_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.c b/sys/dev/vmware/vmci/vmci_kernel_if.c index de54a8d1ca4f..f66e63f56fc7 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_if.c +++ b/sys/dev/vmware/vmci/vmci_kernel_if.c @@ -70,7 +70,7 @@ void vmci_cleanup_lock(vmci_lock *lock) { - if mtx_initialized(lock) + if (mtx_initialized(lock)) mtx_destroy(lock); } From nobody Wed Nov 3 15:30:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D1DA6182866E; Wed, 3 Nov 2021 15:30: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 4HkrMD5dbyz4Wqj; Wed, 3 Nov 2021 15:30: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 A19F21B29C; Wed, 3 Nov 2021 15:30: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 1A3FUme0037457; Wed, 3 Nov 2021 15:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3FUmUp037456; Wed, 3 Nov 2021 15:30:48 GMT (envelope-from git) Date: Wed, 3 Nov 2021 15:30:48 GMT Message-Id: <202111031530.1A3FUmUp037456@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: 02de91d74023 - main - proc_get_binpath(): return empty string instead of NULL List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 02de91d740235f186321d7d3e11d09737daba43e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=02de91d740235f186321d7d3e11d09737daba43e commit 02de91d740235f186321d7d3e11d09737daba43e Author: Konstantin Belousov AuthorDate: 2021-11-03 15:11:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-03 15:30:10 +0000 proc_get_binpath(): return empty string instead of NULL for strange case where queried process does not have text. Reported by: Michael Butler Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/kern_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 2156c5c465ba..d11f651960c0 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2252,7 +2252,7 @@ proc_get_binpath(struct proc *p, char *binname, char **retbuf, vp = p->p_textvp; if (vp == NULL) { PROC_UNLOCK(p); - *retbuf = NULL; + *retbuf = ""; *freebuf = NULL; return (0); } From nobody Wed Nov 3 16:02:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4CC4718372A1; Wed, 3 Nov 2021 16:02: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 4Hks481ZVvz4hbv; Wed, 3 Nov 2021 16:02: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 15B571B1F0; Wed, 3 Nov 2021 16:02: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 1A3G2mH4082443; Wed, 3 Nov 2021 16:02:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3G2mu7082442; Wed, 3 Nov 2021 16:02:48 GMT (envelope-from git) Date: Wed, 3 Nov 2021 16:02:48 GMT Message-Id: <202111031602.1A3G2mu7082442@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: be10c0a91015 - main - fexecve(2): allow O_PATH file descriptors opened without O_EXEC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: be10c0a910155709dc4e521db3349d50e0440018 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=be10c0a910155709dc4e521db3349d50e0440018 commit be10c0a910155709dc4e521db3349d50e0440018 Author: Konstantin Belousov AuthorDate: 2021-11-03 12:51:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-03 16:00:42 +0000 fexecve(2): allow O_PATH file descriptors opened without O_EXEC This improves compatibility with Linux. Noted by: Drew DeVault Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32821 --- lib/libc/sys/open.2 | 3 --- sys/kern/kern_descrip.c | 5 +++-- sys/kern/kern_exec.c | 13 ++++++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index da42c238a151..f6b061079ddf 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -334,9 +334,6 @@ but advisory locking is not allowed .It Xr close 2 .It Xr fstat 2 .It Xr fexecve 2 -requires that -.Dv O_EXEC -was also specified at open time .It Dv SCM_RIGHTS can be passed over a .Xr unix 4 diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a7e3785bc672..37d978e96de5 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3213,8 +3213,9 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, error = EBADF; break; case FEXEC: - if ((fp->f_flag & (FREAD | FEXEC)) == 0 || - ((fp->f_flag & FWRITE) != 0)) + if (fp->f_ops != &path_fileops && + ((fp->f_flag & (FREAD | FEXEC)) == 0 || + (fp->f_flag & FWRITE) != 0)) error = EBADF; break; case 0: diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c5b450b04240..575771346fd1 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -530,13 +530,20 @@ interpret: } } else { AUDIT_ARG_FD(args->fd); + /* - * Descriptors opened only with O_EXEC or O_RDONLY are allowed. + * If the descriptors was not opened with O_PATH, then + * we require that it was opened with O_EXEC or + * O_RDONLY. In either case, exec_check_permissions() + * below checks _current_ file access mode regardless + * of the permissions additionally checked at the + * open(2). */ error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, &newtextvp); - if (error) + if (error != 0) goto exec_fail; + if (vn_fullpath(newtextvp, &imgp->execpath, &imgp->freepath) != 0) imgp->execpath = args->fname; @@ -881,7 +888,7 @@ interpret: /* * Store the vp for use in kern.proc.pathname. This vnode was - * referenced by namei() or fgetvp_exec(). + * referenced by namei() or by fexecve variant of fname handling. */ oldtextvp = p->p_textvp; p->p_textvp = newtextvp; From nobody Wed Nov 3 16:18:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 22D3E183ED4F; Wed, 3 Nov 2021 16:18: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 4HksPq0Vqtz4mRx; Wed, 3 Nov 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 E0EBE1BE0F; Wed, 3 Nov 2021 16:18: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 1A3GI6fF096553; Wed, 3 Nov 2021 16:18:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3GI6J1096552; Wed, 3 Nov 2021 16:18:06 GMT (envelope-from git) Date: Wed, 3 Nov 2021 16:18:06 GMT Message-Id: <202111031618.1A3GI6J1096552@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: 9d2e51884ef2 - main - gjournal(8): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 9d2e51884ef286bab94d48d062cf71f6a74a3f99 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9d2e51884ef286bab94d48d062cf71f6a74a3f99 commit 9d2e51884ef286bab94d48d062cf71f6a74a3f99 Author: Gordon Bergling AuthorDate: 2021-11-03 16:14:00 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 16:14:00 +0000 gjournal(8): Fix a typo in a source code comment - s/writting/writing/ MFC after: 3 days --- sys/geom/journal/g_journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index 97516ed293e7..e57d58d6f7ca 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2445,7 +2445,7 @@ g_journal_destroy(struct g_journal_softc *sc) if (cp->acr + cp->acw + cp->ace > 0) g_access(cp, -1, -1, -1); /* - * We keep all consumers open for writting, so if I'll detach + * We keep all consumers open for writing, so if I'll detach * and destroy consumer here, I'll get providers for taste, so * journal will be started again. * Sending an event here, prevents this from happening. From nobody Wed Nov 3 16:18:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D9549183F091; Wed, 3 Nov 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 4HksPr13R6z4mjP; Wed, 3 Nov 2021 16:18: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 0273E1BCDE; Wed, 3 Nov 2021 16:18: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 1A3GI7dc096577; Wed, 3 Nov 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 1A3GI79b096576; Wed, 3 Nov 2021 16:18:07 GMT (envelope-from git) Date: Wed, 3 Nov 2021 16:18:07 GMT Message-Id: <202111031618.1A3GI79b096576@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: 40a57b00f9a7 - main - ng_pptpgre(4): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 40a57b00f9a76f32a271d258acec4075966eec32 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=40a57b00f9a76f32a271d258acec4075966eec32 commit 40a57b00f9a76f32a271d258acec4075966eec32 Author: Gordon Bergling AuthorDate: 2021-11-03 16:15:59 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 16:15:59 +0000 ng_pptpgre(4): Fix a typo in a source code comment - s/mimimum/minimum/ MFC after: 3 days --- sys/netgraph/ng_pptpgre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c index 4c3ccebd560f..f6d8a89b9fa3 100644 --- a/sys/netgraph/ng_pptpgre.c +++ b/sys/netgraph/ng_pptpgre.c @@ -128,7 +128,7 @@ typedef u_int64_t pptptime_t; #define PPTP_REORDER_TIMEOUT 1 /* When we receive a packet, we wait to see if there's an outgoing packet - we can piggy-back the ACK off of. These parameters determine the mimimum + we can piggy-back the ACK off of. These parameters determine the minimum and maxmimum length of time we're willing to wait in order to do that. These have no effect unless "enableDelayedAck" is turned on. */ #define PPTP_MIN_ACK_DELAY (PPTP_TIME_SCALE / 500) /* 2 milliseconds */ From nobody Wed Nov 3 16:18:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE4E0183ED63; Wed, 3 Nov 2021 16:18: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 4HksPs4mkBz4mSC; Wed, 3 Nov 2021 16:18: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 273D11BAF4; Wed, 3 Nov 2021 16:18: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 1A3GI9kB096601; Wed, 3 Nov 2021 16:18:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3GI9Si096600; Wed, 3 Nov 2021 16:18:09 GMT (envelope-from git) Date: Wed, 3 Nov 2021 16:18:09 GMT Message-Id: <202111031618.1A3GI9Si096600@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: 7b56cb0462c3 - main - ocs_fs: Fix two typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 7b56cb0462c39cb190fc23e0e1190bdc89c163c8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7b56cb0462c39cb190fc23e0e1190bdc89c163c8 commit 7b56cb0462c39cb190fc23e0e1190bdc89c163c8 Author: Gordon Bergling AuthorDate: 2021-11-03 16:17:51 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 16:17:51 +0000 ocs_fs: Fix two typos in source code comments - s/maxium/maximum/ - s/maxiumum/maximum/ MFC after: 3 days --- sys/dev/ocs_fc/ocs_os.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h index ae10b00cb465..a4efd0186984 100644 --- a/sys/dev/ocs_fc/ocs_os.h +++ b/sys/dev/ocs_fc/ocs_os.h @@ -100,7 +100,7 @@ #define OCS_RSVD_INI_IO 8 #define OCS_MIN_DMA_ALIGNMENT 16 -#define OCS_MAX_DMA_ALLOC (64*1024) /* maxium DMA allocation that is expected to reliably succeed */ +#define OCS_MAX_DMA_ALLOC (64*1024) /* maximum DMA allocation that is expected to reliably succeed */ /* * Macros used to size the CQ hash table. We want to round up to the next @@ -465,7 +465,7 @@ typedef struct ocs_dma_s { * Return maximum supported DMA allocation size, given alignment * requirement. * - * @return maxiumum supported DMA allocation size + * @return maximum supported DMA allocation size */ static inline uint32_t ocs_max_dma_alloc(ocs_os_handle_t os, size_t align) { From nobody Wed Nov 3 16:36:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2CAF11831694; Wed, 3 Nov 2021 16:36: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 4HksqM0gh4z4tw9; Wed, 3 Nov 2021 16:36: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 EB6CC1BDBE; Wed, 3 Nov 2021 16:36: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 1A3GakMT023014; Wed, 3 Nov 2021 16:36:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3GakDL023013; Wed, 3 Nov 2021 16:36:46 GMT (envelope-from git) Date: Wed, 3 Nov 2021 16:36:46 GMT Message-Id: <202111031636.1A3GakDL023013@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: 175d3380a367 - main - amd64: Deduplicate routines for expanding KASAN/KMSAN shadow maps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 175d3380a367954a5825ba7078f3bc948e9aca39 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=175d3380a367954a5825ba7078f3bc948e9aca39 commit 175d3380a367954a5825ba7078f3bc948e9aca39 Author: Mark Johnston AuthorDate: 2021-11-03 16:28:08 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 16:36:02 +0000 amd64: Deduplicate routines for expanding KASAN/KMSAN shadow maps When working on the ports these functions were slightly different, but now there's no reason for them to be separate. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/amd64/amd64/pmap.c | 83 ++++++------------------------------------------ sys/amd64/include/pmap.h | 7 ++-- sys/kern/subr_asan.c | 2 +- sys/kern/subr_msan.c | 4 +-- 4 files changed, 15 insertions(+), 81 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8526cc3031d2..3f1125cfc79f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -11424,9 +11424,9 @@ pmap_pkru_clear(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) return (error); } -#ifdef KASAN +#if defined(KASAN) || defined(KMSAN) static vm_page_t -pmap_kasan_enter_alloc_4k(void) +pmap_san_enter_alloc_4k(void) { vm_page_t m; @@ -11438,81 +11438,18 @@ pmap_kasan_enter_alloc_4k(void) } static vm_page_t -pmap_kasan_enter_alloc_2m(void) +pmap_san_enter_alloc_2m(void) { return (vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT)); } /* - * Grow the shadow map by at least one 4KB page at the specified address. Use - * 2MB pages when possible. - */ -void -pmap_kasan_enter(vm_offset_t va) -{ - pdp_entry_t *pdpe; - pd_entry_t *pde; - pt_entry_t *pte; - vm_page_t m; - - mtx_assert(&kernel_map->system_mtx, MA_OWNED); - - pdpe = pmap_pdpe(kernel_pmap, va); - if ((*pdpe & X86_PG_V) == 0) { - m = pmap_kasan_enter_alloc_4k(); - *pdpe = (pdp_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | - X86_PG_V | pg_nx); - } - pde = pmap_pdpe_to_pde(pdpe, va); - if ((*pde & X86_PG_V) == 0) { - m = pmap_kasan_enter_alloc_2m(); - if (m != NULL) { - *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | - X86_PG_PS | X86_PG_V | X86_PG_A | X86_PG_M | pg_nx); - } else { - m = pmap_kasan_enter_alloc_4k(); - *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | - X86_PG_V | pg_nx); - } - } - if ((*pde & X86_PG_PS) != 0) - return; - pte = pmap_pde_to_pte(pde, va); - if ((*pte & X86_PG_V) != 0) - return; - m = pmap_kasan_enter_alloc_4k(); - *pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | - X86_PG_M | X86_PG_A | pg_nx); -} -#endif - -#ifdef KMSAN -static vm_page_t -pmap_kmsan_enter_alloc_4k(void) -{ - vm_page_t m; - - m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (m == NULL) - panic("%s: no memory to grow shadow map", __func__); - return (m); -} - -static vm_page_t -pmap_kmsan_enter_alloc_2m(void) -{ - return (vm_page_alloc_noobj_contig(VM_ALLOC_ZERO | VM_ALLOC_WIRED, - NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT)); -} - -/* - * Grow the shadow or origin maps by at least one 4KB page at the specified - * address. Use 2MB pages when possible. + * Grow a shadow map by at least one 4KB page at the specified address. Use 2MB + * pages when possible. */ void -pmap_kmsan_enter(vm_offset_t va) +pmap_san_enter(vm_offset_t va) { pdp_entry_t *pdpe; pd_entry_t *pde; @@ -11523,18 +11460,18 @@ pmap_kmsan_enter(vm_offset_t va) pdpe = pmap_pdpe(kernel_pmap, va); if ((*pdpe & X86_PG_V) == 0) { - m = pmap_kmsan_enter_alloc_4k(); + m = pmap_san_enter_alloc_4k(); *pdpe = (pdp_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | pg_nx); } pde = pmap_pdpe_to_pde(pdpe, va); if ((*pde & X86_PG_V) == 0) { - m = pmap_kmsan_enter_alloc_2m(); + m = pmap_san_enter_alloc_2m(); if (m != NULL) { *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_PS | X86_PG_V | X86_PG_A | X86_PG_M | pg_nx); } else { - m = pmap_kmsan_enter_alloc_4k(); + m = pmap_san_enter_alloc_4k(); *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | pg_nx); } @@ -11544,7 +11481,7 @@ pmap_kmsan_enter(vm_offset_t va) pte = pmap_pde_to_pte(pde, va); if ((*pte & X86_PG_V) != 0) return; - m = pmap_kmsan_enter_alloc_4k(); + m = pmap_san_enter_alloc_4k(); *pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | X86_PG_M | X86_PG_A | pg_nx); } diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index bd6a8c006813..1e63ffb68099 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -528,11 +528,8 @@ int pmap_vmspace_copy(pmap_t dst_pmap, pmap_t src_pmap); void pmap_page_array_startup(long count); vm_page_t pmap_page_alloc_below_4g(bool zeroed); -#ifdef KASAN -void pmap_kasan_enter(vm_offset_t); -#endif -#ifdef KMSAN -void pmap_kmsan_enter(vm_offset_t); +#if defined(KASAN) || defined(KMSAN) +void pmap_san_enter(vm_offset_t); #endif #endif /* _KERNEL */ diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 5441d7be39a1..19496346ce7e 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -119,7 +119,7 @@ kasan_shadow_map(vm_offset_t addr, size_t size) ("%s: invalid address range %#lx-%#lx", __func__, sva, eva)); for (i = 0; i < npages; i++) - pmap_kasan_enter(sva + ptoa(i)); + pmap_san_enter(sva + ptoa(i)); } void diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c index 81322da2be6c..10ccc842012a 100644 --- a/sys/kern/subr_msan.c +++ b/sys/kern/subr_msan.c @@ -525,12 +525,12 @@ kmsan_shadow_map(vm_offset_t addr, size_t size) va = kmsan_md_addr_to_shad(addr); for (i = 0; i < npages; i++) { - pmap_kmsan_enter(va + ptoa(i)); + pmap_san_enter(va + ptoa(i)); } va = kmsan_md_addr_to_orig(addr); for (i = 0; i < npages; i++) { - pmap_kmsan_enter(va + ptoa(i)); + pmap_san_enter(va + ptoa(i)); } } From nobody Wed Nov 3 16:36:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6290618315AF; Wed, 3 Nov 2021 16:36: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 4HksqN1sxqz4tqH; Wed, 3 Nov 2021 16:36: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 1D4771C11E; Wed, 3 Nov 2021 16:36: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 1A3GamPb023038; Wed, 3 Nov 2021 16:36:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Gale1023037; Wed, 3 Nov 2021 16:36:47 GMT (envelope-from git) Date: Wed, 3 Nov 2021 16:36:47 GMT Message-Id: <202111031636.1A3Gale1023037@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: 2a519c3b14c2 - main - kasan: Disable validation of function parameters passed by value List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 2a519c3b14c29688e42d11f916655318b13c8409 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2a519c3b14c29688e42d11f916655318b13c8409 commit 2a519c3b14c29688e42d11f916655318b13c8409 Author: Mark Johnston AuthorDate: 2021-11-03 16:28:48 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 16:36:02 +0000 kasan: Disable validation of function parameters passed by value It appears that the emitted code in the caller does not update shadow state for values passed on the stack to the callee, which it seemingly ought to do after pushing values on the stack and prior to the call itself. This leaves open a window where an interrupt handler can cause regions of the stack containing these values to be poisoned, resulting in rare false positive reports. This happens particularly in the amd64 TLB invalidation code, where we liberally pass cpuset_t's around by value. LLVM has a flag to disable validation of accesses of function parameters passed by value. Such validation is itself a relatively new feature. Turn it off for now. Reported by: pho, syzkaller MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/conf/kern.pre.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 9d9e32027ec7..056963adcb2d 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -100,7 +100,8 @@ SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kasan \ -mllvm -asan-instrument-dynamic-allocas=true \ -mllvm -asan-globals=true \ -mllvm -asan-use-after-scope=true \ - -mllvm -asan-instrumentation-with-call-threshold=0 + -mllvm -asan-instrumentation-with-call-threshold=0 \ + -mllvm -asan-instrument-byval=false .endif KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo From nobody Wed Nov 3 17:31:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 73190184A129; Wed, 3 Nov 2021 17:31: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 4Hkv312dKpz3j3q; Wed, 3 Nov 2021 17:31: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 3ABB91C8E4; Wed, 3 Nov 2021 17:31: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 1A3HVvZn002034; Wed, 3 Nov 2021 17:31:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3HVvva002033; Wed, 3 Nov 2021 17:31:57 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:31:57 GMT Message-Id: <202111031731.1A3HVvva002033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: b788a226f6a2 - main - Document net.inet.tcp.nolocaltimewait enabled. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b788a226f6a274f9cb31014468700d0103974c07 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b788a226f6a274f9cb31014468700d0103974c07 commit b788a226f6a274f9cb31014468700d0103974c07 Author: Gleb Smirnoff AuthorDate: 2021-11-03 17:31:44 +0000 Commit: Gleb Smirnoff CommitDate: 2021-11-03 17:31:44 +0000 Document net.inet.tcp.nolocaltimewait enabled. --- RELNOTES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RELNOTES b/RELNOTES index 0c6c1c2f4ffc..d56e86623fa2 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +92b3e07229ba: + net.inet.tcp.nolocaltimewait enabled by default. It prevents + creation of timewait entries for TCP connections that were + terminated locally. + d410b585b6f0: sh(1) is now the default shell for the root user. From nobody Wed Nov 3 17:40:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AFCBB184D3C4; Wed, 3 Nov 2021 17:40: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 4HkvF94cxdz3lDl; Wed, 3 Nov 2021 17:40: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 7EF0B1CFAA; Wed, 3 Nov 2021 17:40: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 1A3HejOD011969; Wed, 3 Nov 2021 17:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3HejcS011968; Wed, 3 Nov 2021 17:40:45 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:40:45 GMT Message-Id: <202111031740.1A3HejcS011968@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: 791f88fff31d - releng/12.3 - usb(4): Fix for use after free in combination with EVDEV_SUPPORT. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 791f88fff31d8067ffbfc4f0670aff84f094549d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=791f88fff31d8067ffbfc4f0670aff84f094549d commit 791f88fff31d8067ffbfc4f0670aff84f094549d Author: Hans Petter Selasky AuthorDate: 2021-10-24 11:38:04 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-03 17:39:23 +0000 usb(4): Fix for use after free in combination with EVDEV_SUPPORT. When EVDEV_SUPPORT was introduced, the USB transfers may be running after the main FIFO is closed. In connection to this a race may appear which can lead to use-after-free scenarios. Fix this for all FIFO consumers by initializing and resetting the FIFO queues under the lock used by the client. Then the client driver will see an empty queue in all cases a race may appear. Approved by: re@ (gjb) Found by: pho@ Sponsored by: NVIDIA Networking (cherry picked from commit aad0c65d6b37364d8ba92ecb8c85e004398a5194) (cherry picked from commit bb9bee1ffbb27f903bfd2c11d681d331bea727ea) --- sys/dev/usb/usb_dev.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index 9cd54bf0032c..d1a65bf8561b 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -1951,18 +1951,30 @@ int usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, uint16_t nbuf) { + struct usb_ifqueue temp_q = {}; + void *queue_data; + usb_fifo_free_buffer(f); - /* allocate an endpoint */ - f->free_q.ifq_maxlen = nbuf; - f->used_q.ifq_maxlen = nbuf; + temp_q.ifq_maxlen = nbuf; - f->queue_data = usb_alloc_mbufs( - M_USBDEV, &f->free_q, bufsize, nbuf); + queue_data = usb_alloc_mbufs( + M_USBDEV, &temp_q, bufsize, nbuf); - if ((f->queue_data == NULL) && bufsize && nbuf) { + if (queue_data == NULL && bufsize != 0 && nbuf != 0) return (ENOMEM); - } + + mtx_lock(f->priv_mtx); + + /* + * Setup queues and sizes under lock to avoid early use by + * concurrent FIFO access: + */ + f->free_q = temp_q; + f->used_q.ifq_maxlen = nbuf; + f->queue_data = queue_data; + mtx_unlock(f->priv_mtx); + return (0); /* success */ } @@ -1975,15 +1987,24 @@ usb_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize, void usb_fifo_free_buffer(struct usb_fifo *f) { - if (f->queue_data) { - /* free old buffer */ - free(f->queue_data, M_USBDEV); - f->queue_data = NULL; - } - /* reset queues */ + void *queue_data; + + mtx_lock(f->priv_mtx); + + /* Get and clear pointer to free, if any. */ + queue_data = f->queue_data; + f->queue_data = NULL; + /* + * Reset queues under lock to avoid use of freed buffers by + * concurrent FIFO activity: + */ memset(&f->free_q, 0, sizeof(f->free_q)); memset(&f->used_q, 0, sizeof(f->used_q)); + mtx_unlock(f->priv_mtx); + + /* Free old buffer, if any. */ + free(queue_data, M_USBDEV); } void From nobody Wed Nov 3 17:45:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9916118205BA; Wed, 3 Nov 2021 17:45: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 4HkvLc417cz3n8m; Wed, 3 Nov 2021 17:45: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 5B4341CD53; Wed, 3 Nov 2021 17:45: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 1A3HjSw6016392; Wed, 3 Nov 2021 17:45:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3HjSi8016391; Wed, 3 Nov 2021 17:45:28 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:45:28 GMT Message-Id: <202111031745.1A3HjSi8016391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 3358df297325 - main - udp_input: remove a BSD stack relict List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3358df2973251b4de690f197640eca5d794e0194 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3358df2973251b4de690f197640eca5d794e0194 commit 3358df2973251b4de690f197640eca5d794e0194 Author: Gleb Smirnoff AuthorDate: 2021-10-28 07:07:02 +0000 Commit: Gleb Smirnoff CommitDate: 2021-11-03 17:39:34 +0000 udp_input: remove a BSD stack relict I should had removed it 9 years ago in 8ad458a471ca. That commit left save_ip as a write-only variable. With save_ip removed we got one case when IP header can be modified: the calculation of IP checksum with zeroed out header. This place already has had a header saver char b[9]. However, the b[9] saver didn't cover the ip_sum field, which we explicitly overwrite aliased as (struct ipovly *)->ih_len. This was fine in cb34210012d4e, since checksum doesn't need to be restored if packet is consumed. Now we need to extend up to ip_sum field. In collaboration with: ae Differential revision: https://reviews.freebsd.org/D32719 --- sys/netinet/udp_usrreq.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 46d687690713..7c5a642da040 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -398,7 +398,6 @@ udp_input(struct mbuf **mp, int *offp, int proto) struct inpcb *inp; uint16_t len, ip_len; struct inpcbinfo *pcbinfo; - struct ip save_ip; struct sockaddr_in udp_in[2]; struct mbuf *m; struct m_tag *fwd_tag; @@ -474,15 +473,6 @@ udp_input(struct mbuf **mp, int *offp, int proto) m_adj(m, len - ip_len); } - /* - * Save a copy of the IP header in case we want restore it for - * sending an ICMP error message in response. - */ - if (!V_udp_blackhole) - save_ip = *ip; - else - memset(&save_ip, 0, sizeof(save_ip)); - /* * Checksum extended UDP header and data. */ @@ -499,14 +489,15 @@ udp_input(struct mbuf **mp, int *offp, int proto) m->m_pkthdr.csum_data + proto)); uh_sum ^= 0xffff; } else { - char b[9]; + char b[offsetof(struct ipovly, ih_src)]; + struct ipovly *ipov = (struct ipovly *)ip; - bcopy(((struct ipovly *)ip)->ih_x1, b, 9); - bzero(((struct ipovly *)ip)->ih_x1, 9); - ((struct ipovly *)ip)->ih_len = (proto == IPPROTO_UDP) ? + bcopy(ipov, b, sizeof(b)); + bzero(ipov, sizeof(ipov->ih_x1)); + ipov->ih_len = (proto == IPPROTO_UDP) ? uh->uh_ulen : htons(ip_len); uh_sum = in_cksum(m, len + sizeof (struct ip)); - bcopy(b, ((struct ipovly *)ip)->ih_x1, 9); + bcopy(b, ipov, sizeof(b)); } if (uh_sum) { UDPSTAT_INC(udps_badsum); @@ -714,7 +705,6 @@ udp_input(struct mbuf **mp, int *offp, int proto) goto badunlocked; if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; - *ip = save_ip; icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return (IPPROTO_DONE); } From nobody Wed Nov 3 17:53:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 31743182432F; Wed, 3 Nov 2021 17:53: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 4HkvXR0vXnz3pqk; Wed, 3 Nov 2021 17:53: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 F2D4B1D28C; Wed, 3 Nov 2021 17:53: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 1A3Hrwlv029268; Wed, 3 Nov 2021 17:53:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Hrwn3029267; Wed, 3 Nov 2021 17:53:58 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:53:58 GMT Message-Id: <202111031753.1A3Hrwn3029267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8deb5f2f6415 - stable/13 - Add a VM flag to prevent reclaim on a failed contig allocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8deb5f2f641581fc547710e9db04e5d784f374b9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8deb5f2f641581fc547710e9db04e5d784f374b9 commit 8deb5f2f641581fc547710e9db04e5d784f374b9 Author: Ryan Stone AuthorDate: 2021-01-29 21:13:57 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:35:16 +0000 Add a VM flag to prevent reclaim on a failed contig allocation If a M_WAITOK contig alloc fails, the VM subsystem will try to reclaim contiguous memory twice before actually failing the request. On a system with 64GB of RAM I've observed this take 400-500ms before it finally gives up, and I believe that this will only be worse on systems with even more memory. In certain contexts this delay is extremely harmful, so add a flag that will skip reclaim for allocation requests to allow those paths to opt-out of doing an expensive reclaim. Sponsored by: Dell Inc Differential Revision: https://reviews.freebsd.org/D28422 Reviewed by: markj, kib (cherry picked from commit 660344ca44c63bfe4a16c3e57d0f6dbcbb5e083e) --- sys/sys/malloc.h | 1 + sys/vm/vm_kern.c | 9 +++++++-- sys/vm/vm_page.h | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 93ec81c252ff..3d88460a751e 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -54,6 +54,7 @@ */ #define M_NOWAIT 0x0001 /* do not block */ #define M_WAITOK 0x0002 /* ok to block */ +#define M_NORECLAIM 0x0080 /* do not reclaim after failure */ #define M_ZERO 0x0100 /* bzero the allocation */ #define M_NOVM 0x0200 /* don't ask VM for pages */ #define M_USE_RESERVE 0x0400 /* can alloc out of reserve memory */ diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index f25784857440..7ab1fdb8950e 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -178,17 +178,22 @@ kmem_alloc_contig_pages(vm_object_t object, vm_pindex_t pindex, int domain, { vm_page_t m; int tries; - bool wait; + bool wait, reclaim; VM_OBJECT_ASSERT_WLOCKED(object); + /* Disallow an invalid combination of flags. */ + MPASS((pflags & (VM_ALLOC_WAITOK | VM_ALLOC_NORECLAIM)) != + (VM_ALLOC_WAITOK | VM_ALLOC_NORECLAIM)); + wait = (pflags & VM_ALLOC_WAITOK) != 0; + reclaim = (pflags & VM_ALLOC_NORECLAIM) == 0; pflags &= ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL); pflags |= VM_ALLOC_NOWAIT; for (tries = wait ? 3 : 1;; tries--) { m = vm_page_alloc_contig_domain(object, pindex, domain, pflags, npages, low, high, alignment, boundary, memattr); - if (m != NULL || tries == 0) + if (m != NULL || tries == 0 || !reclaim) break; VM_OBJECT_WUNLOCK(object); diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index d897a088244f..6e0a4328e260 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -541,6 +541,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_WAITFAIL 0x0010 /* (acf) Sleep and return error */ #define VM_ALLOC_WIRED 0x0020 /* (acfgp) Allocate a wired page */ #define VM_ALLOC_ZERO 0x0040 /* (acfgp) Allocate a prezeroed page */ +#define VM_ALLOC_NORECLAIM 0x0080 /* (c) Do not reclaim after failure */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ #define VM_ALLOC_NOCREAT 0x0400 /* (gp) Don't create a page */ @@ -570,6 +571,8 @@ malloc2vm_flags(int malloc_flags) pflags |= VM_ALLOC_NOWAIT; if ((malloc_flags & M_WAITOK)) pflags |= VM_ALLOC_WAITOK; + if ((malloc_flags & M_NORECLAIM)) + pflags |= VM_ALLOC_NORECLAIM; return (pflags); } #endif From nobody Wed Nov 3 17:54:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6965118241BA; Wed, 3 Nov 2021 17:54: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 4HkvXS2Fs2z3qG6; Wed, 3 Nov 2021 17:54: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 2BC271D05C; Wed, 3 Nov 2021 17:54: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 1A3Hs0iH029292; Wed, 3 Nov 2021 17:54:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Hs02h029291; Wed, 3 Nov 2021 17:54:00 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:00 GMT Message-Id: <202111031754.1A3Hs02h029291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 24204bede3ad - stable/13 - vm_page: Add a new page allocator interface for unnamed pages List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 24204bede3ad8126348c568420a25d47e5bdfe42 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=24204bede3ad8126348c568420a25d47e5bdfe42 commit 24204bede3ad8126348c568420a25d47e5bdfe42 Author: Mark Johnston AuthorDate: 2021-10-20 00:22:12 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:35:25 +0000 vm_page: Add a new page allocator interface for unnamed pages The diff adds vm_page_alloc_noobj() and vm_page_alloc_noobj_domain(). These mostly correspond to vm_page_alloc() and vm_page_alloc_domain() when no VM object is specified, with the exception that they handle VM_ALLOC_ZERO by zeroing the page, rather than by preserving PG_ZERO. This simplifies callers and will permit simplification of the vm_page_alloc_domain() definition. Since the new allocator variant is similar to vm_page_alloc_freelist(), implement both of them using a common backend allocator function. No functional change intended. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit b498f71bc56af0069d9a4685b8385ee613a00727) --- sys/vm/vm_page.c | 141 +++++++++++++++++++++++++++++++++++-------------------- sys/vm/vm_page.h | 14 +++--- 2 files changed, 98 insertions(+), 57 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index b5c29b27bc2a..c0d0f2c43226 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2395,54 +2395,41 @@ found: } /* - * vm_page_alloc_freelist: - * - * Allocate a physical page from the specified free page list. - * - * The caller must always specify an allocation class. - * - * allocation classes: - * VM_ALLOC_NORMAL normal process request - * VM_ALLOC_SYSTEM system *really* needs a page - * VM_ALLOC_INTERRUPT interrupt time request - * - * optional allocation flags: - * VM_ALLOC_COUNT(number) the number of additional pages that the caller - * intends to allocate - * VM_ALLOC_WIRED wire the allocated page - * VM_ALLOC_ZERO prefer a zeroed page + * Allocate a physical page that is not intended to be inserted into a VM + * object. If the "freelist" parameter is not equal to VM_NFREELIST, then only + * pages from the specified vm_phys freelist will be returned. */ -vm_page_t -vm_page_alloc_freelist(int freelist, int req) -{ - struct vm_domainset_iter di; - vm_page_t m; - int domain; - - vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); - do { - m = vm_page_alloc_freelist_domain(domain, freelist, req); - if (m != NULL) - break; - } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); - - return (m); -} - -vm_page_t -vm_page_alloc_freelist_domain(int domain, int freelist, int req) +static __always_inline vm_page_t +_vm_page_alloc_noobj_domain(int domain, const int freelist, int req) { struct vm_domain *vmd; vm_page_t m; - u_int flags; + int flags; - m = NULL; + KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOOBJ)) == 0, + ("%s: invalid req %#x", __func__, req)); + + flags = (req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0; vmd = VM_DOMAIN(domain); again: + if (freelist == VM_NFREELIST && + vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone != NULL) { + m = uma_zalloc(vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone, + M_NOWAIT | M_NOVM); + if (m != NULL) { + flags |= PG_PCPU_CACHE; + goto found; + } + } + if (vm_domain_allocate(vmd, req, 1)) { vm_domain_free_lock(vmd); - m = vm_phys_alloc_freelist_pages(domain, freelist, - VM_FREEPOOL_DIRECT, 0); + if (freelist == VM_NFREELIST) + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DIRECT, 0); + else + m = vm_phys_alloc_freelist_pages(domain, freelist, + VM_FREEPOOL_DIRECT, 0); vm_domain_free_unlock(vmd); if (m == NULL) vm_domain_freecnt_inc(vmd, 1); @@ -2452,44 +2439,96 @@ again: goto again; return (NULL); } + +found: vm_page_dequeue(m); vm_page_alloc_check(m); - /* - * Initialize the page. Only the PG_ZERO flag is inherited. - */ + /* Consumers should not rely on a useful default pindex value. */ + m->pindex = 0xdeadc0dedeadc0de; + m->flags = (m->flags & PG_ZERO) | flags; m->a.flags = 0; - flags = 0; - if ((req & VM_ALLOC_ZERO) != 0) - flags = PG_ZERO; - m->flags &= flags; + m->oflags = VPO_UNMANAGED; + m->busy_lock = VPB_UNBUSIED; if ((req & VM_ALLOC_WIRED) != 0) { vm_wire_add(1); m->ref_count = 1; } - /* Unmanaged pages don't use "act_count". */ - m->oflags = VPO_UNMANAGED; + + if ((req & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + + return (m); +} + +vm_page_t +vm_page_alloc_freelist(int freelist, int req) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_freelist_domain(domain, freelist, req); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + + return (m); +} + +vm_page_t +vm_page_alloc_freelist_domain(int domain, int freelist, int req) +{ + KASSERT(freelist >= 0 && freelist < VM_NFREELIST, + ("%s: invalid freelist %d", __func__, freelist)); + + return (_vm_page_alloc_noobj_domain(domain, freelist, req)); +} + +vm_page_t +vm_page_alloc_noobj(int req) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_noobj_domain(domain, req); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + return (m); } +vm_page_t +vm_page_alloc_noobj_domain(int domain, int req) +{ + return (_vm_page_alloc_noobj_domain(domain, VM_NFREELIST, req)); +} + /* * Check a page that has been freshly dequeued from a freelist. */ static void vm_page_alloc_check(vm_page_t m) { + KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->ref_count == 0, ("page %p has references", m)); - KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); KASSERT(m->a.queue == PQ_NONE && (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, ("page %p has unexpected queue %d, flags %#x", m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); - KASSERT(m->valid == 0, ("free page %p is valid", m)); + KASSERT(m->ref_count == 0, ("page %p has references", m)); + KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); KASSERT(m->dirty == 0, ("page %p is dirty", m)); KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, ("page %p has unexpected memattr %d", m, pmap_page_get_memattr(m))); + KASSERT(m->valid == 0, ("free page %p is valid", m)); pmap_vm_page_alloc_check(m); } diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 6e0a4328e260..600619b00eaf 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -527,8 +527,8 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); * Legend: * (a) - vm_page_alloc() supports the flag. * (c) - vm_page_alloc_contig() supports the flag. - * (f) - vm_page_alloc_freelist() supports the flag. * (g) - vm_page_grab() supports the flag. + * (n) - vm_page_alloc_noobj() and vm_page_alloc_freelist() support the flag. * (p) - vm_page_grab_pages() supports the flag. * Bits above 15 define the count of additional pages that the caller * intends to allocate. @@ -537,10 +537,10 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_INTERRUPT 1 #define VM_ALLOC_SYSTEM 2 #define VM_ALLOC_CLASS_MASK 3 -#define VM_ALLOC_WAITOK 0x0008 /* (acf) Sleep and retry */ -#define VM_ALLOC_WAITFAIL 0x0010 /* (acf) Sleep and return error */ -#define VM_ALLOC_WIRED 0x0020 /* (acfgp) Allocate a wired page */ -#define VM_ALLOC_ZERO 0x0040 /* (acfgp) Allocate a prezeroed page */ +#define VM_ALLOC_WAITOK 0x0008 /* (acn) Sleep and retry */ +#define VM_ALLOC_WAITFAIL 0x0010 /* (acn) Sleep and return error */ +#define VM_ALLOC_WIRED 0x0020 /* (acgnp) Allocate a wired page */ +#define VM_ALLOC_ZERO 0x0040 /* (acgnp) Allocate a zeroed page */ #define VM_ALLOC_NORECLAIM 0x0080 /* (c) Do not reclaim after failure */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ @@ -548,7 +548,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ -#define VM_ALLOC_NOWAIT 0x8000 /* (acfgp) Do not sleep */ +#define VM_ALLOC_NOWAIT 0x8000 /* (acgnp) Do not sleep */ #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) @@ -614,6 +614,8 @@ vm_page_t vm_page_alloc_contig_domain(vm_object_t object, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_alloc_freelist_domain(int, int, int); +vm_page_t vm_page_alloc_noobj(int); +vm_page_t vm_page_alloc_noobj_domain(int, int); void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); vm_page_t vm_page_grab(vm_object_t, vm_pindex_t, int); From nobody Wed Nov 3 17:54:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E30491824148; Wed, 3 Nov 2021 17:54: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 4HkvXT4c0Tz3q9q; Wed, 3 Nov 2021 17:54: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 5C5F11D28D; Wed, 3 Nov 2021 17:54: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 1A3Hs1a0029320; Wed, 3 Nov 2021 17:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Hs1KZ029319; Wed, 3 Nov 2021 17:54:01 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:01 GMT Message-Id: <202111031754.1A3Hs1KZ029319@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 66cb1858f449 - stable/13 - Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 66cb1858f44992af73b6e1f9eeceb500bffd2534 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=66cb1858f44992af73b6e1f9eeceb500bffd2534 commit 66cb1858f44992af73b6e1f9eeceb500bffd2534 Author: Mark Johnston AuthorDate: 2021-10-20 00:23:39 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:39:36 +0000 Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply use VM_ALLOC_WAITOK. Similarly, convert vm_page_alloc_domain() callers. Note that callers are now responsible for assigning the pindex. Reviewed by: alc, hselasky, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit a4667e09e6520dc2c4b0b988051f060fed695a91) --- sys/amd64/amd64/mp_machdep.c | 3 +- sys/amd64/amd64/pmap.c | 44 +++++++++--------------- sys/amd64/amd64/uma_machdep.c | 6 ++-- sys/arm/arm/pmap-v6.c | 20 +++++------ sys/arm64/arm64/pmap.c | 44 +++++++++--------------- sys/arm64/arm64/uma_machdep.c | 6 ++-- sys/compat/linuxkpi/common/src/linux_page.c | 2 +- sys/dev/drm2/ttm/ttm_page_alloc.c | 7 +--- sys/dev/ti/if_ti.c | 3 +- sys/dev/virtio/balloon/virtio_balloon.c | 3 +- sys/dev/xen/balloon/balloon.c | 21 ++++-------- sys/dev/xen/gntdev/gntdev.c | 11 ++---- sys/fs/nfs/nfs_commonsubs.c | 9 ++--- sys/fs/nfsclient/nfs_clrpcops.c | 9 ++--- sys/i386/i386/pmap.c | 44 +++++++++--------------- sys/kern/kern_mbuf.c | 4 +-- sys/kern/uipc_ktls.c | 4 +-- sys/kern/uipc_mbuf.c | 5 ++- sys/kern/vfs_bio.c | 5 ++- sys/mips/mips/pmap.c | 4 --- sys/mips/mips/uma_machdep.c | 2 -- sys/powerpc/aim/mmu_oea64.c | 7 ++-- sys/powerpc/aim/mmu_radix.c | 36 ++++++++------------ sys/powerpc/booke/pmap_32.c | 4 +-- sys/powerpc/booke/pmap_64.c | 9 ++--- sys/powerpc/powerpc/uma_machdep.c | 7 ++-- sys/riscv/riscv/pmap.c | 52 ++++++++++------------------- sys/riscv/riscv/uma_machdep.c | 6 ++-- sys/vm/uma_core.c | 22 ++++++------ sys/vm/vm_kern.c | 5 +-- sys/vm/vm_page.c | 3 +- 31 files changed, 142 insertions(+), 265 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 14853ce56603..264cc5b3bef1 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -305,8 +305,7 @@ mp_realloc_pcpu(int cpuid, int domain) oa = (vm_offset_t)&__pcpu[cpuid]; if (vm_phys_domain(pmap_kextract(oa)) == domain) return; - m = vm_page_alloc_domain(NULL, 0, domain, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj_domain(domain, 0); if (m == NULL) return; na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d2a168ca7f70..c9de6a875cb7 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2308,10 +2308,9 @@ pmap_init_pv_table(void) highest = start + (s / sizeof(*pvd)) - 1; for (j = 0; j < s; j += PAGE_SIZE) { - vm_page_t m = vm_page_alloc_domain(NULL, 0, - domain, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + vm_page_t m = vm_page_alloc_noobj_domain(domain, 0); if (m == NULL) - panic("vm_page_alloc_domain failed for %lx\n", (vm_offset_t)pvd + j); + panic("failed to allocate PV table page"); pmap_qenter((vm_offset_t)pvd + j, &m, 1); } @@ -4260,15 +4259,11 @@ pmap_alloc_pt_page(pmap_t pmap, vm_pindex_t pindex, int flags) { vm_page_t m; - m = vm_page_alloc(NULL, pindex, flags | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj(flags); if (__predict_false(m == NULL)) return (NULL); - + m->pindex = pindex; pmap_pt_page_count_adj(pmap, 1); - - if ((flags & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - return (m); } @@ -4306,8 +4301,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) /* * allocate the page directory page */ - pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | + VM_ALLOC_WAITOK); pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4337,8 +4332,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { pmltop_pgu = pmap_alloc_pt_page(NULL, 0, - VM_ALLOC_WIRED | VM_ALLOC_NORMAL | - VM_ALLOC_WAITOK); + VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -5362,8 +5356,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(counter_u64_add(pc_chunk_tryfail, 1)); @@ -5466,8 +5459,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -5839,8 +5831,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, * priority is normal. */ mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), - (in_kernel ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_WIRED); + (in_kernel ? VM_ALLOC_INTERRUPT : 0) | VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -10238,8 +10229,7 @@ pmap_quick_remove_page(vm_offset_t addr) static vm_page_t pmap_large_map_getptp_unlocked(void) { - return (pmap_alloc_pt_page(kernel_pmap, 0, - VM_ALLOC_NORMAL | VM_ALLOC_ZERO)); + return (pmap_alloc_pt_page(kernel_pmap, 0, VM_ALLOC_ZERO)); } static vm_page_t @@ -11294,12 +11284,10 @@ pmap_kasan_enter_alloc_4k(void) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow shadow map", __func__); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); return (m); } @@ -11364,12 +11352,10 @@ pmap_kmsan_enter_alloc_4k(void) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow shadow map", __func__); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); return (m); } diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c index 2fc981f23c83..479cb4e37d9e 100644 --- a/sys/amd64/amd64/uma_machdep.c +++ b/sys/amd64/amd64/uma_machdep.c @@ -49,16 +49,14 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); pa = m->phys_addr; if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); return (va); } diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index c9b939f6ce34..445f750178a8 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2069,12 +2069,12 @@ pmap_growkernel(vm_offset_t addr) /* * Install new PT2s page into kernel PT2TAB. */ - m = vm_page_alloc(NULL, - pte1_index(kernel_vm_end) & ~PT2PG_MASK, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow kernel", __func__); + m->pindex = pte1_index(kernel_vm_end) & ~PT2PG_MASK; + /* * QQQ: To link all new L2 page tables from L1 page * table now and so pmap_kenter_pte1() them @@ -2488,8 +2488,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags) /* * Install new PT2s page into pmap PT2TAB. */ - m = vm_page_alloc(NULL, pte1_idx & ~PT2PG_MASK, - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) { if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); @@ -2505,6 +2504,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags) */ return (NULL); } + m->pindex = pte1_idx & ~PT2PG_MASK; pmap->pm_stats.resident_count++; pt2pg_pa = pmap_pt2pg_init(pmap, va, m); } else { @@ -3062,8 +3062,8 @@ retry: * global lock. If "pv_vafree" is currently non-empty, it will * remain non-empty until pmap_pte2list_alloc() completes. */ - if (pv_vafree == 0 || (m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if (pv_vafree == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); @@ -3711,9 +3711,8 @@ pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va) * "failure" if the mapping was never accessed or the * allocation of the new page table page fails. */ - if ((opte1 & PTE1_A) == 0 || (m = vm_page_alloc(NULL, - pte1_index(va) & ~PT2PG_MASK, VM_ALLOC_NOOBJ | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED)) == NULL) { + if ((opte1 & PTE1_A) == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); pmap_remove_pte1(pmap, pte1p, pte1_trunc(va), &free); vm_page_free_pages_toq(&free, false); @@ -3721,6 +3720,7 @@ pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va) __func__, va, pmap); return (FALSE); } + m->pindex = pte1_index(va) & ~PT2PG_MASK; if (va < VM_MAXUSER_ADDRESS) pmap->pm_stats.resident_count++; diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 176762b9bfff..2bceb293f3f2 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1766,16 +1766,11 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) /* * allocate the l0 page */ - while ((m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - vm_wait(NULL); - + m = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - if ((m->flags & PG_ZERO) == 0) - pagezero(pmap->pm_l0); - pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); @@ -1841,8 +1836,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); @@ -1856,8 +1850,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Because of AArch64's weak memory consistency model, we must have a @@ -2191,13 +2184,11 @@ pmap_growkernel(vm_offset_t addr) l1 = pmap_l0_to_l1(l0, kernel_vm_end); if (pmap_load(l1) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L1_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L1_SHIFT; /* See the dmb() in _pmap_alloc_l3(). */ dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -2214,13 +2205,11 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L2_SHIFT; /* See the dmb() in _pmap_alloc_l3(). */ dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -2565,8 +2554,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(pc_chunk_tryfail++); @@ -2631,8 +2619,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -6326,8 +6313,8 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va) return (NULL); } - if ((ml2 = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if ((ml2 = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED)) == + NULL) { CTR2(KTR_PMAP, "pmap_demote_l1: failure for va %#lx" " in pmap %p", va, pmap); l2 = NULL; @@ -6460,9 +6447,9 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, * priority (VM_ALLOC_INTERRUPT). Otherwise, the * priority is normal. */ - ml3 = vm_page_alloc(NULL, pmap_l2_pindex(va), - (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + ml3 = vm_page_alloc_noobj( + (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : 0) | + VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -6474,6 +6461,7 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, " in pmap %p", va, pmap); goto fail; } + ml3->pindex = pmap_l2_pindex(va); if (!ADDR_IS_KERNEL(va)) { ml3->ref_count = NL3PG; diff --git a/sys/arm64/arm64/uma_machdep.c b/sys/arm64/arm64/uma_machdep.c index 3ef3dd3cc9e9..d1c656a3b9f1 100644 --- a/sys/arm64/arm64/uma_machdep.c +++ b/sys/arm64/arm64/uma_machdep.c @@ -47,16 +47,14 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); pa = m->phys_addr; if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); return (va); } diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 8da4736ab7d5..f712c0c155a4 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -97,7 +97,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; if (order == 0 && (flags & GFP_DMA32) == 0) { - page = vm_page_alloc(NULL, 0, req); + page = vm_page_alloc_noobj(req); if (page == NULL) return (NULL); } else { diff --git a/sys/dev/drm2/ttm/ttm_page_alloc.c b/sys/dev/drm2/ttm/ttm_page_alloc.c index fbb830405de0..b35a06520e07 100644 --- a/sys/dev/drm2/ttm/ttm_page_alloc.c +++ b/sys/dev/drm2/ttm/ttm_page_alloc.c @@ -178,12 +178,7 @@ ttm_vm_page_alloc_any(int req, vm_memattr_t memattr) { vm_page_t p; - while (1) { - p = vm_page_alloc(NULL, 0, req); - if (p != NULL) - break; - vm_wait(NULL); - } + p = vm_page_alloc_noobj(req | VM_ALLOC_WAITOK); pmap_page_set_memattr(p, memattr); return (p); } diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 9871212d6379..e8b4eb537883 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1609,8 +1609,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) "failed -- packet dropped!\n"); goto nobufs; } - frame = vm_page_alloc(NULL, 0, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + frame = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); if (frame == NULL) { device_printf(sc->ti_dev, "buffer allocation " diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index 3e2d967dd9af..bf4e5cf916f7 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -460,8 +460,7 @@ vtballoon_alloc_page(struct vtballoon_softc *sc) { vm_page_t m; - m = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP); + m = vm_page_alloc_noobj(VM_ALLOC_NODUMP); if (m != NULL) sc->vtballoon_current_npages++; diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index 01d75204f5bf..007fada24259 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -228,25 +228,18 @@ decrease_reservation(unsigned long nr_pages) nr_pages = nitems(frame_list); for (i = 0; i < nr_pages; i++) { - if ((page = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_ZERO)) == NULL) { + /* + * Zero the page, or else we might be leaking important data to + * other domains on the same host. Xen doesn't scrub ballooned + * out memory pages, the guest is in charge of making sure that + * no information is leaked. + */ + if ((page = vm_page_alloc_noobj(VM_ALLOC_ZERO)) == NULL) { nr_pages = i; need_sleep = 1; break; } - if ((page->flags & PG_ZERO) == 0) { - /* - * Zero the page, or else we might be leaking - * important data to other domains on the same - * host. Xen doesn't scrub ballooned out memory - * pages, the guest is in charge of making - * sure that no information is leaked. - */ - pmap_zero_page(page); - } - frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); diff --git a/sys/dev/xen/gntdev/gntdev.c b/sys/dev/xen/gntdev/gntdev.c index 8249eaba8bcc..0c89133ca1b0 100644 --- a/sys/dev/xen/gntdev/gntdev.c +++ b/sys/dev/xen/gntdev/gntdev.c @@ -368,20 +368,13 @@ gntdev_alloc_gref(struct ioctl_gntdev_alloc_gref *arg) grefs[i].file_index = file_offset + i * PAGE_SIZE; grefs[i].gref_id = GRANT_REF_INVALID; grefs[i].notify = NULL; - grefs[i].page = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL - | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + grefs[i].page = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (grefs[i].page == NULL) { log(LOG_ERR, "Page allocation failed."); error = ENOMEM; break; } - if ((grefs[i].page->flags & PG_ZERO) == 0) { - /* - * Zero the allocated page, as we don't want to - * leak our memory to other domains. - */ - pmap_zero_page(grefs[i].page); - } grefs[i].page->valid = VM_PAGE_BITS_ALL; error = gnttab_grant_foreign_access(arg->domid, diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 42b839c8567e..c8534982ee0e 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4910,13 +4910,8 @@ nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *bextpg) *bextpg = 0; m->m_next = mp; } else { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) - vm_wait(NULL); - } while (pg == NULL); + pg = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); m->m_epg_pa[m->m_epg_npgs] = VM_PAGE_TO_PHYS(pg); *bextpg = m->m_epg_npgs; m->m_epg_npgs++; diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 211fd3523f34..30b68b1dcb1b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -8674,13 +8674,8 @@ nfsm_split(struct mbuf *mp, uint64_t xfer) * page. */ if (left < plen) { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) - vm_wait(NULL); - } while (pg == NULL); + pg = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); m2->m_epg_pa[0] = VM_PAGE_TO_PHYS(pg); m2->m_epg_npgs = 1; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index b39f1c6f0a55..31afca35c080 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2057,7 +2057,6 @@ __CONCAT(PMTYPE, pinit0)(pmap_t pmap) static int __CONCAT(PMTYPE, pinit)(pmap_t pmap) { - vm_page_t m; int i; /* @@ -2085,11 +2084,10 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) * allocate the page directory page(s) */ for (i = 0; i < NPGPTD; i++) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); - pmap->pm_ptdpg[i] = m; + pmap->pm_ptdpg[i] = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_ZERO | VM_ALLOC_WAITOK); #ifdef PMAP_PAE_COMP - pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(m) | PG_V; + pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(pmap->pm_ptdpg[i]) | PG_V; #endif } @@ -2103,10 +2101,6 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) } #endif - for (i = 0; i < NPGPTD; i++) - if ((pmap->pm_ptdpg[i]->flags & PG_ZERO) == 0) - pagezero(pmap->pm_pdir + (i * NPDEPG)); - /* Install the trampoline mapping. */ pmap->pm_pdir[TRPTDI] = PTD[TRPTDI]; @@ -2130,8 +2124,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); rw_wunlock(&pvh_global_lock); @@ -2146,8 +2139,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Map the pagetable page into the process address space, if @@ -2271,16 +2263,13 @@ __CONCAT(PMTYPE, growkernel)(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDRSHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - + nkpg->pindex = kernel_vm_end >> PDRSHIFT; nkpt++; - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); ptppaddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); pdir_pde(KPTD, kernel_vm_end) = newpdir; @@ -2575,8 +2564,8 @@ retry: * global lock. If "pv_vafree" is currently non-empty, it will * remain non-empty until pmap_ptelist_alloc() completes. */ - if (pv_vafree == 0 || (m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if (pv_vafree == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); @@ -2808,9 +2797,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) * "failure" if the mapping was never accessed or the * allocation of the new page table page fails. */ - if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | - VM_ALLOC_WIRED)) == NULL) { + if ((oldpde & PG_A) == 0 || + (mpte = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); sva = trunc_4mpage(va); pmap_remove_pde(pmap, pde, sva, &free); @@ -2821,6 +2809,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) " in pmap %p", va, pmap); return (FALSE); } + mpte->pindex = va >> PDRSHIFT; if (pmap != kernel_pmap) { mpte->ref_count = NPTEPG; pmap->pm_stats.resident_count++; @@ -5914,8 +5903,7 @@ pmap_trm_import(void *unused __unused, vmem_size_t size, int flags, prev_addr += trm_guard; trm_pte = PTmap + atop(prev_addr); for (af = prev_addr; af < addr; af += PAGE_SIZE) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pte_store(&trm_pte[atop(af - prev_addr)], VM_PAGE_TO_PHYS(m) | PG_M | PG_A | PG_RW | PG_V | pgeflag | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE)); @@ -5934,10 +5922,8 @@ pmap_init_trm(void) trm_guard = 0; pmap_trm_arena = vmem_create("i386trampoline", 0, 0, 1, 0, M_WAITOK); vmem_set_import(pmap_trm_arena, pmap_trm_import, NULL, NULL, PAGE_SIZE); - pd_m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_WAITOK | VM_ALLOC_ZERO); - if ((pd_m->flags & PG_ZERO) == 0) - pmap_zero_page(pd_m); + pd_m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK | + VM_ALLOC_ZERO); PTD[TRPTDI] = VM_PAGE_TO_PHYS(pd_m) | PG_M | PG_A | PG_RW | PG_V | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, TRUE); } diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 3b202bf3aab7..4e818d87a756 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1584,8 +1584,8 @@ mb_alloc_ext_plus_pages(int len, int how) npgs = howmany(len, PAGE_SIZE); for (i = 0; i < npgs; i++) { do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED); + pg = vm_page_alloc_noobj(VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); if (pg == NULL) { if (how == M_NOWAIT) { m->m_epg_npgs = i; diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index c6fc33b3109c..17c199230d0a 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2037,8 +2037,8 @@ ktls_encrypt(struct mbuf *top) continue; } retry_page: - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED); + pg = vm_page_alloc_noobj(VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); if (pg == NULL) { vm_wait(NULL); goto retry_page; diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 1a2098c7c536..5588da2dcd20 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1757,8 +1757,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) vm_page_t pg_array[MBUF_PEXT_MAX_PGS]; int error, length, i, needed; ssize_t total; - int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED; + int pflags = malloc2vm_flags(how) | VM_ALLOC_NODUMP | VM_ALLOC_WIRED; MPASS((flags & M_PKTHDR) == 0); MPASS((how & M_ZERO) == 0); @@ -1806,7 +1805,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) needed = length = MIN(maxseg, total); for (i = 0; needed > 0; i++, needed -= PAGE_SIZE) { retry_page: - pg_array[i] = vm_page_alloc(NULL, 0, pflags); + pg_array[i] = vm_page_alloc_noobj(pflags); if (pg_array[i] == NULL) { if (how & M_NOWAIT) { goto failed; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d610f391de98..6ce445cbf2ee 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4910,9 +4910,8 @@ vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to) * could interfere with paging I/O, no matter which * process we are. */ - p = vm_page_alloc(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) | - VM_ALLOC_WAITOK); + p = vm_page_alloc_noobj(VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | + VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) | VM_ALLOC_WAITOK); pmap_qenter(pg, &p, 1); bp->b_pages[index] = p; } diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index 8b0eb1a3ce0b..9ca43048ecca 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1115,10 +1115,6 @@ pmap_alloc_direct_page(unsigned int index, int req) VM_ALLOC_ZERO); if (m == NULL) return (NULL); - - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - m->pindex = index; return (m); } diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c index 5b57447edd6a..321804d634d5 100644 --- a/sys/mips/mips/uma_machdep.c +++ b/sys/mips/mips/uma_machdep.c @@ -75,8 +75,6 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)MIPS_PHYS_TO_DIRECT(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); return (va); } diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 3faa3d0752b8..2f7f6ce29422 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1922,8 +1922,8 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, *flags = UMA_SLAB_PRIV; needed_lock = !PMAP_LOCKED(kernel_pmap); - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); @@ -1945,9 +1945,6 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, if (needed_lock) PMAP_UNLOCK(kernel_pmap); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero((void *)va, PAGE_SIZE); - return (void *)va; } diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index b9ca10448f9f..6dba22f2cd0f 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -1206,8 +1206,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -1629,8 +1628,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(pc_chunk_tryfail++); @@ -3503,13 +3501,11 @@ mmu_radix_growkernel(vm_offset_t addr) l2e = pmap_pml2e(kernel_pmap, kernel_vm_end); if ((be64toh(*l2e) & PG_V) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_PAGE_SIZE_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - mmu_radix_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L2_PAGE_SIZE_SHIFT; paddr = VM_PAGE_TO_PHYS(nkpg); pde_store(l2e, paddr); continue; /* try again */ @@ -3524,13 +3520,11 @@ mmu_radix_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, pmap_l3e_pindex(kernel_vm_end), - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - mmu_radix_zero_page(nkpg); + nkpg->pindex = pmap_l3e_pindex(kernel_vm_end); paddr = VM_PAGE_TO_PHYS(nkpg); pde_store(l3e, paddr); @@ -4217,8 +4211,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); @@ -4231,8 +4224,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - mmu_radix_zero_page(m); + m->pindex = ptepindex; /* * Map the pagetable page into the process address space, if @@ -4889,10 +4881,9 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, * is the only part of the kernel address space that must be * handled here. */ - if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - pmap_l3e_pindex(va), (va >= DMAP_MIN_ADDRESS && va < - DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc_noobj( + (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS ? + VM_ALLOC_INTERRUPT : 0) | VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); sva = trunc_2mpage(va); pmap_remove_l3e(pmap, l3e, sva, &free, lockp); @@ -4902,6 +4893,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, " in pmap %p", va, pmap); return (FALSE); } + mpte->pindex = pmap_l3e_pindex(va); if (va < VM_MAXUSER_ADDRESS) pmap_resident_count_inc(pmap, 1); } @@ -5921,13 +5913,13 @@ pmap_demote_l2e(pmap_t pmap, pml2_entry_t *l2e, vm_offset_t va) oldpdpe = be64toh(*l2e); KASSERT((oldpdpe & (RPTE_LEAF | PG_V)) == (RPTE_LEAF | PG_V), ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); - pdpg = vm_page_alloc(NULL, va >> L2_PAGE_SIZE_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + pdpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); if (pdpg == NULL) { CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); } + pdpg->pindex = va >> L2_PAGE_SIZE_SHIFT; pdpgpa = VM_PAGE_TO_PHYS(pdpg); firstpde = (pml3_entry_t *)PHYS_TO_DMAP(pdpgpa); KASSERT((oldpdpe & PG_A) != 0, diff --git a/sys/powerpc/booke/pmap_32.c b/sys/powerpc/booke/pmap_32.c index a9f8af0565f0..fa9e0a6422d8 100644 --- a/sys/powerpc/booke/pmap_32.c +++ b/sys/powerpc/booke/pmap_32.c @@ -264,8 +264,7 @@ ptbl_alloc(pmap_t pmap, unsigned int pdir_idx, boolean_t nosleep) for (i = 0; i < PTBL_PAGES; i++) { pidx = (PTBL_PAGES * pdir_idx) + i; - while ((m = vm_page_alloc(NULL, pidx, - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + while ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (nosleep) { ptbl_free_pmap_ptbl(pmap, ptbl); for (j = 0; j < i; j++) @@ -279,6 +278,7 @@ ptbl_alloc(pmap_t pmap, unsigned int pdir_idx, boolean_t nosleep) rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); *** 314 LINES SKIPPED *** From nobody Wed Nov 3 17:54:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06CDB1824159; Wed, 3 Nov 2021 17: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 4HkvXV5Gswz3qGH; Wed, 3 Nov 2021 17:54: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 6CC471CE6D; Wed, 3 Nov 2021 17:54: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 1A3Hs2LJ029347; Wed, 3 Nov 2021 17:54:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Hs2YT029346; Wed, 3 Nov 2021 17:54:02 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:02 GMT Message-Id: <202111031754.1A3Hs2YT029346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fb3ba080a189 - stable/13 - Introduce vm_page_alloc_noobj_contig() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fb3ba080a18953ef512aee0b93e5185eda91d195 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fb3ba080a18953ef512aee0b93e5185eda91d195 commit fb3ba080a18953ef512aee0b93e5185eda91d195 Author: Mark Johnston AuthorDate: 2021-10-20 00:24:21 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:41:00 +0000 Introduce vm_page_alloc_noobj_contig() This is the same as vm_page_alloc_noobj(), but allocates physically contiguous runs of memory. For now it is implemented in terms of vm_page_alloc_contig(), with the difference that vm_page_alloc_noobj_contig() implements VM_ALLOC_ZERO by zeroing the page. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 92db9f3bb7623883231214e74ec38788c3dffc6a) --- sys/vm/vm_page.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/vm/vm_page.h | 6 ++++++ 2 files changed, 49 insertions(+) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index b257bc7f6db8..b27ada0700ee 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2509,6 +2509,49 @@ vm_page_alloc_noobj_domain(int domain, int req) return (_vm_page_alloc_noobj_domain(domain, VM_NFREELIST, req)); } +vm_page_t +vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_noobj_contig_domain(domain, req, npages, low, + high, alignment, boundary, memattr); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + + return (m); +} + +vm_page_t +vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + vm_page_t m; + u_long i; + + KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOOBJ)) == 0, + ("%s: invalid req %#x", __func__, req)); + + m = vm_page_alloc_contig_domain(NULL, 0, domain, req | VM_ALLOC_NOOBJ, + npages, low, high, alignment, boundary, memattr); + if (m != NULL && (req & VM_ALLOC_ZERO) != 0) { + for (i = 0; i < npages; i++) { + if ((m[i].flags & PG_ZERO) == 0) + pmap_zero_page(&m[i]); + } + } + return (m); +} + /* * Check a page that has been freshly dequeued from a freelist. */ diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 600619b00eaf..b31ea0241cc7 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -616,6 +616,12 @@ vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_alloc_freelist_domain(int, int, int); vm_page_t vm_page_alloc_noobj(int); vm_page_t vm_page_alloc_noobj_domain(int, int); +vm_page_t vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); +vm_page_t vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); vm_page_t vm_page_grab(vm_object_t, vm_pindex_t, int); From nobody Wed Nov 3 17:54:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4289C1824504; Wed, 3 Nov 2021 17: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 4HkvXX0DmSz3qCf; Wed, 3 Nov 2021 17: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 933101D21B; Wed, 3 Nov 2021 17: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 1A3Hs3Sb029371; Wed, 3 Nov 2021 17: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 1A3Hs3Er029370; Wed, 3 Nov 2021 17:54:03 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:03 GMT Message-Id: <202111031754.1A3Hs3Er029370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f86bda068cdd - stable/13 - Convert consumers to vm_page_alloc_noobj_contig() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f86bda068cdd148e773ed7e6cc201824eee7c126 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f86bda068cdd148e773ed7e6cc201824eee7c126 commit f86bda068cdd148e773ed7e6cc201824eee7c126 Author: Mark Johnston AuthorDate: 2021-10-20 00:25:04 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:41:40 +0000 Convert consumers to vm_page_alloc_noobj_contig() Remove now-unneeded page zeroing. No functional change intended. Reviewed by: alc, hselasky, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 84c3922243a7b7fd510dcfb100aec59c878c57d0) --- sys/amd64/amd64/mp_machdep.c | 3 +-- sys/amd64/amd64/pmap.c | 28 ++++++---------------------- sys/arm/nvidia/drm2/tegra_bo.c | 12 ++++-------- sys/compat/linuxkpi/common/src/linux_page.c | 17 +++-------------- sys/dev/drm2/ttm/ttm_bo.c | 11 +++++------ sys/dev/drm2/ttm/ttm_page_alloc.c | 6 +++--- sys/powerpc/aim/mmu_radix.c | 8 ++++---- sys/powerpc/aim/slb.c | 9 +++------ sys/riscv/riscv/pmap.c | 2 -- sys/vm/uma_core.c | 19 +++++++------------ sys/vm/vm_page.c | 28 ++++++++++++++-------------- 11 files changed, 50 insertions(+), 93 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 264cc5b3bef1..cf8408c2afb0 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -334,8 +334,7 @@ native_start_all_aps(void) mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); MPASS(bootMP_size <= PAGE_SIZE); - m_boottramp = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, 1, 0, + m_boottramp = vm_page_alloc_noobj_contig(0, 1, 0, (1ULL << 20), /* Trampoline should be below 1M for real mode */ PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); boot_address = VM_PAGE_TO_PHYS(m_boottramp); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index c9de6a875cb7..19219e4676cc 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2076,14 +2076,8 @@ pmap_init_pat(void) vm_page_t pmap_page_alloc_below_4g(bool zeroed) { - vm_page_t m; - - m = vm_page_alloc_contig(NULL, 0, (zeroed ? VM_ALLOC_ZERO : 0) | - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ, - 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - if (m != NULL && zeroed && (m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - return (m); + return (vm_page_alloc_noobj_contig((zeroed ? VM_ALLOC_ZERO : 0), + 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT)); } extern const char la57_trampoline[], la57_trampoline_gdt_desc[], @@ -11294,13 +11288,8 @@ pmap_kasan_enter_alloc_4k(void) static vm_page_t pmap_kasan_enter_alloc_2m(void) { - vm_page_t m; - - m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT); - if (m != NULL) - memset((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), 0, NBPDR); - return (m); + return (vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO, + NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT)); } /* @@ -11362,13 +11351,8 @@ pmap_kmsan_enter_alloc_4k(void) static vm_page_t pmap_kmsan_enter_alloc_2m(void) { - vm_page_t m; - - m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED, NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT); - if (m != NULL) - memset((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), 0, NBPDR); - return (m); + return (vm_page_alloc_noobj_contig(VM_ALLOC_ZERO | VM_ALLOC_WIRED, + NPTEPG, 0, ~0ul, NBPDR, 0, VM_MEMATTR_DEFAULT)); } /* diff --git a/sys/arm/nvidia/drm2/tegra_bo.c b/sys/arm/nvidia/drm2/tegra_bo.c index 7479fd8bc8da..be5177973f4f 100644 --- a/sys/arm/nvidia/drm2/tegra_bo.c +++ b/sys/arm/nvidia/drm2/tegra_bo.c @@ -97,21 +97,19 @@ tegra_bo_alloc_contig(size_t npages, u_long alignment, vm_memattr_t memattr, vm_page_t **ret_page) { vm_page_t m; - int pflags, tries, i; + int tries, i; vm_paddr_t low, high, boundary; low = 0; high = -1UL; boundary = 0; - pflags = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_WIRED | VM_ALLOC_ZERO; tries = 0; retry: - m = vm_page_alloc_contig(NULL, 0, pflags, npages, low, high, alignment, - boundary, memattr); + m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRE | VM_ALLOC_ZERO, npages, + low, high, alignment, boundary, memattr); if (m == NULL) { if (tries < 3) { - if (!vm_page_reclaim_contig(pflags, npages, low, high, + if (!vm_page_reclaim_contig(0, npages, low, high, alignment, boundary)) vm_wait(NULL); tries++; @@ -121,8 +119,6 @@ retry: } for (i = 0; i < npages; i++, m++) { - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; (*ret_page)[i] = m; } diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index f712c0c155a4..3c8bc2bd3c5b 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -92,7 +92,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if (PMAP_HAS_DMAP) { unsigned long npages = 1UL << order; - int req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_NORMAL; + int req = VM_ALLOC_WIRED; if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; @@ -104,9 +104,8 @@ linux_alloc_pages(gfp_t flags, unsigned int order) vm_paddr_t pmax = (flags & GFP_DMA32) ? BUS_SPACE_MAXADDR_32BIT : BUS_SPACE_MAXADDR; retry: - page = vm_page_alloc_contig(NULL, 0, req, - npages, 0, pmax, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); - + page = vm_page_alloc_noobj_contig(req, npages, 0, pmax, + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); if (page == NULL) { if (flags & M_WAITOK) { if (!vm_page_reclaim_contig(req, @@ -119,16 +118,6 @@ linux_alloc_pages(gfp_t flags, unsigned int order) return (NULL); } } - if (flags & M_ZERO) { - unsigned long x; - - for (x = 0; x != npages; x++) { - vm_page_t pgo = page + x; - - if ((pgo->flags & PG_ZERO) == 0) - pmap_zero_page(pgo); - } - } } else { vm_offset_t vaddr; diff --git a/sys/dev/drm2/ttm/ttm_bo.c b/sys/dev/drm2/ttm/ttm_bo.c index 010afe6d8b3b..d5c11ecff25d 100644 --- a/sys/dev/drm2/ttm/ttm_bo.c +++ b/sys/dev/drm2/ttm/ttm_bo.c @@ -1488,21 +1488,20 @@ int ttm_bo_global_init(struct drm_global_reference *ref) struct ttm_bo_global_ref *bo_ref = container_of(ref, struct ttm_bo_global_ref, ref); struct ttm_bo_global *glob = ref->object; - int req, ret; + int ret; int tries; sx_init(&glob->device_list_mutex, "ttmdlm"); mtx_init(&glob->lru_lock, "ttmlru", NULL, MTX_DEF); glob->mem_glob = bo_ref->mem_glob; - req = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ; tries = 0; retry: - glob->dummy_read_page = vm_page_alloc_contig(NULL, 0, req, - 1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); + glob->dummy_read_page = vm_page_alloc_noobj_contig(0, 1, 0, + VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); if (unlikely(glob->dummy_read_page == NULL)) { - if (tries < 1 && vm_page_reclaim_contig(req, 1, - 0, VM_MAX_ADDRESS, PAGE_SIZE, 0)) { + if (tries < 1 && vm_page_reclaim_contig(0, 1, 0, + VM_MAX_ADDRESS, PAGE_SIZE, 0)) { tries++; goto retry; } diff --git a/sys/dev/drm2/ttm/ttm_page_alloc.c b/sys/dev/drm2/ttm/ttm_page_alloc.c index b35a06520e07..6fc12cad121f 100644 --- a/sys/dev/drm2/ttm/ttm_page_alloc.c +++ b/sys/dev/drm2/ttm/ttm_page_alloc.c @@ -163,8 +163,8 @@ ttm_vm_page_alloc_dma32(int req, vm_memattr_t memattr) int tries; for (tries = 0; ; tries++) { - p = vm_page_alloc_contig(NULL, 0, req, 1, 0, 0xffffffff, - PAGE_SIZE, 0, memattr); + p = vm_page_alloc_noobj_contig(req, 1, 0, 0xffffffff, PAGE_SIZE, + 0, memattr); if (p != NULL || tries > 2) return (p); if (!vm_page_reclaim_contig(req, 1, 0, 0xffffffff, @@ -191,7 +191,7 @@ ttm_vm_page_alloc(int flags, enum ttm_caching_state cstate) int req; memattr = ttm_caching_state_to_vm(cstate); - req = VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ; + req = VM_ALLOC_WIRED; if ((flags & TTM_PAGE_FLAG_ZERO_ALLOC) != 0) req |= VM_ALLOC_ZERO; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 6dba22f2cd0f..3b90b2f33547 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -3544,14 +3544,14 @@ static int radix_pgd_import(void *arg __unused, void **store, int count, int domain __unused, int flags) { + int req; + req = VM_ALLOC_WIRED | malloc2vm_flags(flags); for (int i = 0; i < count; i++) { - vm_page_t m = vm_page_alloc_contig(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_WAITOK, RADIX_PGD_SIZE/PAGE_SIZE, + vm_page_t m = vm_page_alloc_noobj_contig(req, + RADIX_PGD_SIZE / PAGE_SIZE, 0, (vm_paddr_t)-1, RADIX_PGD_SIZE, L1_PAGE_SIZE, VM_MEMATTR_DEFAULT); - /* XXX zero on alloc here so we don't have to later */ store[i] = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); } return (count); diff --git a/sys/powerpc/aim/slb.c b/sys/powerpc/aim/slb.c index 886e11c9b356..c107fcbcfc43 100644 --- a/sys/powerpc/aim/slb.c +++ b/sys/powerpc/aim/slb.c @@ -500,9 +500,9 @@ slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, int domain, realmax = platform_real_maxaddr(); *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_contig_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED, - 1, 0, realmax, PAGE_SIZE, PAGE_SIZE, VM_MEMATTR_DEFAULT); + m = vm_page_alloc_noobj_contig_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED, 1, 0, realmax, PAGE_SIZE, PAGE_SIZE, + VM_MEMATTR_DEFAULT); if (m == NULL) return (NULL); @@ -513,9 +513,6 @@ slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, int domain, pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); } - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); - return (va); } diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index fd41c0bb858e..589628d0e350 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2757,8 +2757,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, VM_ALLOC_ZERO); if (l3_m == NULL) panic("pmap_enter: l3 pte_m == NULL"); - if ((l3_m->flags & PG_ZERO) == 0) - pmap_zero_page(l3_m); l3_pa = VM_PAGE_TO_PHYS(l3_m); l3_pn = (l3_pa / PAGE_SIZE); diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index f1d3c4e2797e..3e4e3c7c4ce1 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1830,17 +1830,15 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, { vm_paddr_t pa; vm_page_t m; - void *mem; - int pages; - int i; + int i, pages; pages = howmany(bytes, PAGE_SIZE); KASSERT(pages > 0, ("%s can't reserve 0 pages", __func__)); *pflag = UMA_SLAB_BOOT; - m = vm_page_alloc_contig_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED, pages, - (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_MEMATTR_DEFAULT); + m = vm_page_alloc_noobj_contig_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED, pages, (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, + VM_MEMATTR_DEFAULT); if (m == NULL) return (NULL); @@ -1852,13 +1850,10 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, dump_add_page(pa); #endif } - /* Allocate KVA and indirectly advance bootmem. */ - mem = (void *)pmap_map(&bootmem, m->phys_addr, - m->phys_addr + (pages * PAGE_SIZE), VM_PROT_READ | VM_PROT_WRITE); - if ((wait & M_ZERO) != 0) - bzero(mem, pages * PAGE_SIZE); - return (mem); + /* Allocate KVA and indirectly advance bootmem. */ + return ((void *)pmap_map(&bootmem, m->phys_addr, + m->phys_addr + (pages * PAGE_SIZE), VM_PROT_READ | VM_PROT_WRITE)); } static void diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index b27ada0700ee..90e45ffbde74 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2883,32 +2883,32 @@ vm_page_reclaim_run(int req_class, int domain, u_long npages, vm_page_t m_run, * "m_run" and "high" only as a last * resort. */ - req = req_class | VM_ALLOC_NOOBJ; + req = req_class; if ((m->flags & PG_NODUMP) != 0) req |= VM_ALLOC_NODUMP; if (trunc_page(high) != ~(vm_paddr_t)PAGE_MASK) { - m_new = vm_page_alloc_contig( - NULL, 0, req, 1, - round_page(high), - ~(vm_paddr_t)0, - PAGE_SIZE, 0, - VM_MEMATTR_DEFAULT); + m_new = + vm_page_alloc_noobj_contig( + req, 1, round_page(high), + ~(vm_paddr_t)0, PAGE_SIZE, + 0, VM_MEMATTR_DEFAULT); } else m_new = NULL; if (m_new == NULL) { pa = VM_PAGE_TO_PHYS(m_run); - m_new = vm_page_alloc_contig( - NULL, 0, req, 1, - 0, pa - 1, PAGE_SIZE, 0, + m_new = + vm_page_alloc_noobj_contig( + req, 1, 0, pa - 1, + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); } if (m_new == NULL) { pa += ptoa(npages); - m_new = vm_page_alloc_contig( - NULL, 0, req, 1, - pa, high, PAGE_SIZE, 0, - VM_MEMATTR_DEFAULT); + m_new = + vm_page_alloc_noobj_contig( + req, 1, pa, high, PAGE_SIZE, + 0, VM_MEMATTR_DEFAULT); } if (m_new == NULL) { vm_page_xunbusy(m); From nobody Wed Nov 3 17:54:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A4D9118241DA; Wed, 3 Nov 2021 17:54: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 4HkvXY06RPz3qMB; Wed, 3 Nov 2021 17: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 BA5921D19D; Wed, 3 Nov 2021 17: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 1A3Hs4UM029395; Wed, 3 Nov 2021 17: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 1A3Hs4Wk029394; Wed, 3 Nov 2021 17:54:04 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:04 GMT Message-Id: <202111031754.1A3Hs4Wk029394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0fcf472fd583 - stable/13 - amd64: Add comments to pmap_pinit_type() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0fcf472fd583c51d5d583305c10ba1430a378ba1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0fcf472fd583c51d5d583305c10ba1430a378ba1 commit 0fcf472fd583c51d5d583305c10ba1430a378ba1 Author: Mark Johnston AuthorDate: 2021-10-20 00:29:18 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:41:55 +0000 amd64: Add comments to pmap_pinit_type() ... explaining why we don't pass the pmap pointer to pmap_alloc_pt_page(). Reported by: alc Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 34fac29e98313fb0bfba0503e2e19e352b452516) --- sys/amd64/amd64/pmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 19219e4676cc..d7954b9444b5 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4293,7 +4293,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) int i; /* - * allocate the page directory page + * Allocate the page directory page. Pass NULL instead of a pointer to + * the pmap here to avoid recording this page in the resident count, as + * optimizations in pmap_remove() depend on this. */ pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); @@ -4325,6 +4327,10 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) else pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { + /* + * As with pmltop_pg, pass NULL instead of a pointer to + * the pmap to ensure that the PTI page isn't counted. + */ pmltop_pgu = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( From nobody Wed Nov 3 17:54:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D3D6318243C3; Wed, 3 Nov 2021 17:54: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 4HkvXZ5w8Lz3qJP; Wed, 3 Nov 2021 17:54: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 DE0D21D3A9; Wed, 3 Nov 2021 17:54: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 1A3Hs519029419; Wed, 3 Nov 2021 17:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Hs5HF029418; Wed, 3 Nov 2021 17:54:05 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:05 GMT Message-Id: <202111031754.1A3Hs5HF029418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a6922417a05e - stable/13 - Use the vm_radix_init() helper when initializing pmaps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6922417a05e813b7c779ccbdeec8427304ed73f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a6922417a05e813b7c779ccbdeec8427304ed73f commit a6922417a05e813b7c779ccbdeec8427304ed73f Author: Mark Johnston AuthorDate: 2021-10-20 00:29:05 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:42:21 +0000 Use the vm_radix_init() helper when initializing pmaps No functional change intended. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit ff93447d8ed61081adfe00a23a1e4c7bee479e53) --- sys/amd64/amd64/pmap.c | 4 ++-- sys/arm64/arm64/pmap.c | 4 ++-- sys/i386/i386/pmap.c | 4 ++-- sys/powerpc/aim/mmu_radix.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d7954b9444b5..de4cbd1da9e1 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4135,7 +4135,7 @@ pmap_pinit0(pmap_t pmap) pmap->pm_cr3 = kernel_pmap->pm_cr3; /* hack to keep pmap_pti_pcid_invalidate() alive */ pmap->pm_ucr3 = PMAP_NO_CR3; - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -4352,7 +4352,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) break; } - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 2bceb293f3f2..1b9c6e96286a 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1748,7 +1748,7 @@ pmap_pinit0(pmap_t pmap) bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_l0_paddr = READ_SPECIALREG(ttbr0_el1); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); pmap->pm_cookie = COOKIE_FROM(ASID_RESERVED_FOR_PID_0, INT_MIN); pmap->pm_stage = PM_STAGE1; pmap->pm_levels = 4; @@ -1771,7 +1771,7 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 31afca35c080..52008969308b 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2043,7 +2043,7 @@ __CONCAT(PMTYPE, pinit0)(pmap_t pmap) #ifdef PMAP_PAE_COMP pmap->pm_pdpt = IdlePDPT; #endif - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -2075,7 +2075,7 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) KASSERT(pmap_kextract((vm_offset_t)pmap->pm_pdpt) < (4ULL<<30), ("pmap_pinit: pdpt above 4g")); #endif - pmap->pm_root.rt_root = 0; + vm_radix_init(&pmap->pm_root); } KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_pinit: pmap has reserved page table page(s)")); diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 3b90b2f33547..f1903c69dddb 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -4176,7 +4176,7 @@ mmu_radix_pinit(pmap_t pmap) for (int j = 0; j < RADIX_PGD_SIZE_SHIFT; j++) pagezero((vm_offset_t)pmap->pm_pml1 + j * PAGE_SIZE); - pmap->pm_radix.rt_root = 0; + vm_radix_init(&pmap->pm_radix); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); pmap->pm_flags = PMAP_PDE_SUPERPAGE; @@ -4407,7 +4407,7 @@ mmu_radix_pinit0(pmap_t pmap) pmap->pm_pml1 = kernel_pmap->pm_pml1; pmap->pm_pid = kernel_pmap->pm_pid; - pmap->pm_radix.rt_root = 0; + vm_radix_init(&pmap->pm_radix); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); kernel_pmap->pm_flags = From nobody Wed Nov 3 17:54:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 191FD182453E; Wed, 3 Nov 2021 17:54: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 4HkvXc0vLFz3qTk; Wed, 3 Nov 2021 17:54: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 03F2C1D3AA; Wed, 3 Nov 2021 17:54: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 1A3Hs6bC029443; Wed, 3 Nov 2021 17:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3Hs6pC029442; Wed, 3 Nov 2021 17:54:06 GMT (envelope-from git) Date: Wed, 3 Nov 2021 17:54:06 GMT Message-Id: <202111031754.1A3Hs6pC029442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5dc9004b72cf - stable/13 - vm_page: Break reservations to handle noobj allocations List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5dc9004b72cf0fb312e9b1136375432d1b31449c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5dc9004b72cf0fb312e9b1136375432d1b31449c commit 5dc9004b72cf0fb312e9b1136375432d1b31449c Author: Mark Johnston AuthorDate: 2021-10-21 15:46:25 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 17:44:47 +0000 vm_page: Break reservations to handle noobj allocations vm_reserv_reclaim_*() will release pages to the default freepool, not the direct freepool from which noobj allocations are drawn. But if both pools are empty, the noobj allocator variants must break reservations to make progress. Reported by: cy Reviewed by: kib (previous version) Fixes: b498f71bc56a ("vm_page: Add a new page allocator interface for unnamed pages") Sponsored by: The FreeBSD Foundation (cherry picked from commit d7acbe481d17ccb81c2b879b9731c83b018f3094) --- sys/vm/vm_page.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 90e45ffbde74..6be310531924 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2430,8 +2430,14 @@ again: m = vm_phys_alloc_freelist_pages(domain, freelist, VM_FREEPOOL_DIRECT, 0); vm_domain_free_unlock(vmd); - if (m == NULL) + if (m == NULL) { vm_domain_freecnt_inc(vmd, 1); +#if VM_NRESERVLEVEL > 0 + if (freelist == VM_NFREELIST && + vm_reserv_reclaim_inactive(domain)) + goto again; +#endif + } } if (m == NULL) { if (vm_domain_alloc_fail(vmd, NULL, req)) From nobody Wed Nov 3 19:11:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 202341832A9F; Wed, 3 Nov 2021 19:11: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 4HkxG70SMxz4lBs; Wed, 3 Nov 2021 19:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3C7D1E2EF; Wed, 3 Nov 2021 19:11: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 1A3JBgZq033169; Wed, 3 Nov 2021 19:11:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3JBgYC033168; Wed, 3 Nov 2021 19:11:42 GMT (envelope-from git) Date: Wed, 3 Nov 2021 19:11:42 GMT Message-Id: <202111031911.1A3JBgYC033168@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: 6afabf00920f - main - scsi_cd: Improve TOC access validation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6afabf00920fb8d41b8f013090f282c17c117efc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6afabf00920fb8d41b8f013090f282c17c117efc commit 6afabf00920fb8d41b8f013090f282c17c117efc Author: Mark Johnston AuthorDate: 2021-11-03 19:09:17 +0000 Commit: Mark Johnston CommitDate: 2021-11-03 19:09:17 +0000 scsi_cd: Improve TOC access validation 1. During CD probing, we read the TOC header to find the number of entries, then read the TOC itself. The header determines the number of entries, which determines the amount of data to read from the device into the softc in the CD_STATE_MEDIA_TOC_FULL state. We hard-code a limit of 99 tracks (plus one for the lead-out) in the softc, but were not validating that the size reported by the media would fit in this hard-coded limit. Kernel memory corruption could occur if not.[1] Add validation to check this, and refuse to cache the TOC if it would not fit. 2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index into the TOC, but we only validate the starting index. Add validation of the ending index. Also, raise the hard-coded limit from 100 tracks to 170, per a suggestion from Ken. Reported by: C Turt [1] Reviewed by: ken, avg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32803 --- sys/cam/scsi/scsi_cd.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 3e8187544bff..3cca4bbf243b 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -136,9 +136,13 @@ typedef enum { #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 +/* + * According to the MMC-6 spec, 6.25.3.2.11, the lead-out is reported by + * READ_TOC as logical track 170, so at most 169 tracks may be reported. + */ struct cd_tocdata { struct ioc_toc_header header; - struct cd_toc_entry entries[100]; + struct cd_toc_entry entries[170]; }; struct cd_toc_single { @@ -1596,12 +1600,13 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) } /* Number of TOC entries, plus leadout */ - num_entries = (toch->ending_track - toch->starting_track) + 2; - cdindex = toch->starting_track + num_entries -1; + num_entries = toch->ending_track - toch->starting_track + 2; + cdindex = toch->starting_track + num_entries - 1; if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == CD_CCB_MEDIA_TOC_HDR) { - if (num_entries <= 0) { + if (num_entries <= 0 || + num_entries > nitems(softc->toc.entries)) { softc->flags &= ~CD_FLAG_VALID_TOC; bzero(&softc->toc, sizeof(softc->toc)); /* @@ -1838,23 +1843,19 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) */ if (softc->flags & CD_FLAG_VALID_TOC) { union msf_lba *sentry, *eentry; + struct ioc_toc_header *th; int st, et; - if (args->end_track < - softc->toc.header.ending_track + 1) + th = &softc->toc.header; + if (args->end_track < th->ending_track + 1) args->end_track++; - if (args->end_track > - softc->toc.header.ending_track + 1) - args->end_track = - softc->toc.header.ending_track + 1; - st = args->start_track - - softc->toc.header.starting_track; - et = args->end_track - - softc->toc.header.starting_track; - if ((st < 0) - || (et < 0) - || (st > (softc->toc.header.ending_track - - softc->toc.header.starting_track))) { + if (args->end_track > th->ending_track + 1) + args->end_track = th->ending_track + 1; + st = args->start_track - th->starting_track; + et = args->end_track - th->starting_track; + if (st < 0 || et < 0 || + st > th->ending_track - th->starting_track || + et > th->ending_track - th->starting_track) { error = EINVAL; cam_periph_unlock(periph); break; From nobody Wed Nov 3 19:19:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5DD0E183626F; Wed, 3 Nov 2021 19:19: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 4HkxR529b3z4n44; Wed, 3 Nov 2021 19:19: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 2683E1E3E8; Wed, 3 Nov 2021 19:19: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 1A3JJTcF038477; Wed, 3 Nov 2021 19:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3JJT98038476; Wed, 3 Nov 2021 19:19:29 GMT (envelope-from git) Date: Wed, 3 Nov 2021 19:19:29 GMT Message-Id: <202111031919.1A3JJT98038476@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: 441222585968 - main - nfscl: Fix use after free for forced dismount List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 441222585968517c595ef7f39e5c71a42d238acd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=441222585968517c595ef7f39e5c71a42d238acd commit 441222585968517c595ef7f39e5c71a42d238acd Author: Rick Macklem AuthorDate: 2021-11-03 19:15:40 +0000 Commit: Rick Macklem CommitDate: 2021-11-03 19:15:40 +0000 nfscl: Fix use after free for forced dismount When a forced dismount is done and delegations are being issued by the server (disabled by default for FreeBSD servers), the delegation structure is free'd before the loop calling vflush(). This could result in a use after free of the delegation structure. This patch changes the code so that the delegation structures are not free'd until after the vflush() loop for forced dismounts. Found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clstate.c | 16 +++++++++++----- sys/fs/nfsclient/nfs_clvfsops.c | 13 +++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 7f0ca990540d..7e4136a6ff67 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -596,7 +596,7 @@ void nfscl_lockrelease(struct nfscllockowner *, int, int); void nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t); void nfscl_filllockowner(void *, u_int8_t *, int); void nfscl_freeopen(struct nfsclopen *, int, bool); -void nfscl_umount(struct nfsmount *, NFSPROC_T *); +void nfscl_umount(struct nfsmount *, NFSPROC_T *, struct nfscldeleghead *); void nfscl_renewthread(struct nfsclclient *, NFSPROC_T *); void nfscl_initiate_recovery(struct nfsclclient *); int nfscl_hasexpired(struct nfsclclient *, u_int32_t, NFSPROC_T *); diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 22c0da1bcef8..42233ea7cf9d 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -119,7 +119,8 @@ static void nfscl_insertlock(struct nfscllockowner *, struct nfscllock *, struct nfscllock *, int); static int nfscl_updatelock(struct nfscllockowner *, struct nfscllock **, struct nfscllock **, int); -static void nfscl_delegreturnall(struct nfsclclient *, NFSPROC_T *); +static void nfscl_delegreturnall(struct nfsclclient *, NFSPROC_T *, + struct nfscldeleghead *); static u_int32_t nfscl_nextcbident(void); static mount_t nfscl_getmnt(int, uint8_t *, u_int32_t, struct nfsclclient **); static struct nfsclclient *nfscl_getclnt(u_int32_t); @@ -1985,7 +1986,7 @@ static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ * Called from nfs umount to free up the clientid. */ void -nfscl_umount(struct nfsmount *nmp, NFSPROC_T *p) +nfscl_umount(struct nfsmount *nmp, NFSPROC_T *p, struct nfscldeleghead *dhp) { struct nfsclclient *clp; struct ucred *cred; @@ -2047,7 +2048,7 @@ nfscl_umount(struct nfsmount *nmp, NFSPROC_T *p) * the server throws it away? */ LIST_REMOVE(clp, nfsc_list); - nfscl_delegreturnall(clp, p); + nfscl_delegreturnall(clp, p, dhp); cred = newnfs_getcred(); if (NFSHASNFSV4N(nmp)) { (void)nfsrpc_destroysession(nmp, clp, cred, p); @@ -3438,7 +3439,8 @@ lookformore: * (Must be called with client sleep lock.) */ static void -nfscl_delegreturnall(struct nfsclclient *clp, NFSPROC_T *p) +nfscl_delegreturnall(struct nfsclclient *clp, NFSPROC_T *p, + struct nfscldeleghead *dhp) { struct nfscldeleg *dp, *ndp; struct ucred *cred; @@ -3447,7 +3449,11 @@ nfscl_delegreturnall(struct nfsclclient *clp, NFSPROC_T *p) TAILQ_FOREACH_SAFE(dp, &clp->nfsc_deleg, nfsdl_list, ndp) { nfscl_cleandeleg(dp); (void) nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p); - nfscl_freedeleg(&clp->nfsc_deleg, dp, true); + if (dhp != NULL) { + nfscl_freedeleg(&clp->nfsc_deleg, dp, false); + TAILQ_INSERT_HEAD(dhp, dp, nfsdl_list); + } else + nfscl_freedeleg(&clp->nfsc_deleg, dp, true); } NFSFREECRED(cred); } diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index d5d9bb395c79..330279b9ef4d 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1767,8 +1767,11 @@ nfs_unmount(struct mount *mp, int mntflags) struct nfsmount *nmp; int error, flags = 0, i, trycnt = 0; struct nfsclds *dsp, *tdsp; + struct nfscldeleg *dp, *ndp; + struct nfscldeleghead dh; td = curthread; + TAILQ_INIT(&dh); if (mntflags & MNT_FORCE) flags |= FORCECLOSE; @@ -1792,7 +1795,7 @@ nfs_unmount(struct mount *mp, int mntflags) if (error) goto out; /* For a forced close, get rid of the renew thread now */ - nfscl_umount(nmp, td); + nfscl_umount(nmp, td, &dh); } /* We hold 1 extra ref on the root vnode; see comment in mountnfs(). */ do { @@ -1807,7 +1810,7 @@ nfs_unmount(struct mount *mp, int mntflags) * We are now committed to the unmount. */ if ((mntflags & MNT_FORCE) == 0) - nfscl_umount(nmp, td); + nfscl_umount(nmp, td, NULL); else { mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_FORCEDISM; @@ -1849,6 +1852,12 @@ nfs_unmount(struct mount *mp, int mntflags) } free(nmp->nm_tlscertname, M_NEWNFSMNT); free(nmp, M_NEWNFSMNT); + + /* Free up the delegation structures for forced dismounts. */ + TAILQ_FOREACH_SAFE(dp, &dh, nfsdl_list, ndp) { + TAILQ_REMOVE(&dh, dp, nfsdl_list); + free(dp, M_NFSCLDELEG); + } out: return (error); } From nobody Wed Nov 3 19:50:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A1CFE18455B1; Wed, 3 Nov 2021 19:50: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 4Hky7N4FT6z3Cpw; Wed, 3 Nov 2021 19:50: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 739141EABC; Wed, 3 Nov 2021 19:50: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 1A3JouUU087193; Wed, 3 Nov 2021 19:50:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3JouD2087192; Wed, 3 Nov 2021 19:50:56 GMT (envelope-from git) Date: Wed, 3 Nov 2021 19:50:56 GMT Message-Id: <202111031950.1A3JouD2087192@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: c28e39c3d6d1 - main - Fix a common typo in syctl descriptions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c28e39c3d6d10a72800b7f49c23453fcc1bca8cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c28e39c3d6d10a72800b7f49c23453fcc1bca8cc commit c28e39c3d6d10a72800b7f49c23453fcc1bca8cc Author: Gordon Bergling AuthorDate: 2021-11-03 19:49:24 +0000 Commit: Gordon Bergling CommitDate: 2021-11-03 19:49:24 +0000 Fix a common typo in syctl descriptions - s/maxiumum/maximum/ MFC after: 3 days --- sys/netinet/tcp_stacks/bbr.c | 2 +- sys/netinet/tcp_stacks/rack.c | 2 +- sys/vm/vm_glue.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 41f441da99a1..718f4ddc2a56 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -1666,7 +1666,7 @@ bbr_init_sysctls(void) SYSCTL_CHILDREN(bbr_timeout), OID_AUTO, "maxrto", CTLFLAG_RW, &bbr_rto_max_sec, 4, - "Maxiumum RTO in seconds -- should be at least as large as min_rto"); + "Maximum RTO in seconds -- should be at least as large as min_rto"); SYSCTL_ADD_S32(&bbr_sysctl_ctx, SYSCTL_CHILDREN(bbr_timeout), OID_AUTO, "tlp_retry", CTLFLAG_RW, diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 616e079df60c..3d065ef14c86 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -1316,7 +1316,7 @@ rack_init_sysctls(void) SYSCTL_CHILDREN(rack_timers), OID_AUTO, "maxrto", CTLFLAG_RW, &rack_rto_max, 4000000, - "Maxiumum RTO in microseconds -- should be at least as large as min_rto"); + "Maximum RTO in microseconds -- should be at least as large as min_rto"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_timers), OID_AUTO, "minto", CTLFLAG_RW, diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 5e118a7ad86e..e2f8f861b373 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -494,7 +494,7 @@ static int max_kstack_used; SYSCTL_INT(_debug, OID_AUTO, max_kstack_used, CTLFLAG_RD, &max_kstack_used, 0, - "Maxiumum stack depth used by a thread in kernel"); + "Maximum stack depth used by a thread in kernel"); void intr_prof_stack_use(struct thread *td, struct trapframe *frame) From nobody Wed Nov 3 19:51:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 28DAD1845ADB; Wed, 3 Nov 2021 19:51: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 4Hky8K0VDYz3DB9; Wed, 3 Nov 2021 19:51: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 DA8191E84D; Wed, 3 Nov 2021 19:51: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 1A3JpiXc089748; Wed, 3 Nov 2021 19:51:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3JpiNU089747; Wed, 3 Nov 2021 19:51:44 GMT (envelope-from git) Date: Wed, 3 Nov 2021 19:51:44 GMT Message-Id: <202111031951.1A3JpiNU089747@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: 626bd0970abf - main - ipsec: fix edge case detection in key_do_getnewspi List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 626bd0970abfdfba596bced3bc8a47adaf11a46d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=626bd0970abfdfba596bced3bc8a47adaf11a46d commit 626bd0970abfdfba596bced3bc8a47adaf11a46d Author: Mateusz Guzik AuthorDate: 2021-11-03 14:00:53 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-03 19:51:40 +0000 ipsec: fix edge case detection in key_do_getnewspi The 'count' variable would end up being -1 post loop, while the following condition would check for 0 instead. PR: 258849 Reported by: Herbie.Robinson@stratus.com Reviewed by: ae Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32826 --- sys/netipsec/key.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 72c598586d8e..48de29305b3c 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -5019,7 +5019,7 @@ static uint32_t key_do_getnewspi(struct sadb_spirange *spirange, struct secasindex *saidx) { uint32_t min, max, newspi, t; - int count = V_key_spi_trycnt; + int tries, limit; /* set spi range to allocate */ if (spirange != NULL) { @@ -5047,21 +5047,22 @@ key_do_getnewspi(struct sadb_spirange *spirange, struct secasindex *saidx) return 0; } - count--; /* taking one cost. */ + tries = 1; newspi = min; } else { /* init SPI */ newspi = 0; + limit = atomic_load_int(&V_key_spi_trycnt); /* when requesting to allocate spi ranged */ - while (count--) { + for (tries = 0; tries < limit; tries++) { /* generate pseudo-random SPI value ranged. */ newspi = min + (key_random() % (max - min + 1)); if (!key_checkspidup(htonl(newspi))) break; } - if (count == 0 || newspi == 0) { + if (tries == limit || newspi == 0) { ipseclog((LOG_DEBUG, "%s: failed to allocate SPI.\n", __func__)); return 0; @@ -5070,7 +5071,7 @@ key_do_getnewspi(struct sadb_spirange *spirange, struct secasindex *saidx) /* statistics */ keystat.getspi_count = - (keystat.getspi_count + V_key_spi_trycnt - count) / 2; + (keystat.getspi_count + tries) / 2; return (htonl(newspi)); } From nobody Wed Nov 3 19:51:45 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6C69E1845C97; Wed, 3 Nov 2021 19:51: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 4Hky8L1xj6z3DMh; Wed, 3 Nov 2021 19:51: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 0A69B1E55E; Wed, 3 Nov 2021 19:51: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 1A3JpjCs089775; Wed, 3 Nov 2021 19:51:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3JpjSC089774; Wed, 3 Nov 2021 19:51:45 GMT (envelope-from git) Date: Wed, 3 Nov 2021 19:51:45 GMT Message-Id: <202111031951.1A3JpjSC089774@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: 10ea195fa269 - main - ipsec: add a lock encompassing SPI allocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 10ea195fa269888d362f548279f3d3fa252662d7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=10ea195fa269888d362f548279f3d3fa252662d7 commit 10ea195fa269888d362f548279f3d3fa252662d7 Author: Mateusz Guzik AuthorDate: 2021-11-03 13:10:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-11-03 19:51:40 +0000 ipsec: add a lock encompassing SPI allocation SPIs get allocated and inserted in separate steps. Prior to the change there was nothing preventing 2 differnet threads from ending up with the same one. PR: 258849 Reported by: Herbie.Robinson@stratus.com Reviewed by: ae Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32826 --- sys/netipsec/key.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 48de29305b3c..9a810fa49931 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -216,6 +216,13 @@ VNET_DEFINE_STATIC(struct mtx *, spdcache_lock); #define SPDCACHE_LOCK(a) mtx_lock(&V_spdcache_lock[a]); #define SPDCACHE_UNLOCK(a) mtx_unlock(&V_spdcache_lock[a]); +static struct sx spi_alloc_lock; +#define SPI_ALLOC_LOCK_INIT() sx_init(&spi_alloc_lock, "spialloc") +#define SPI_ALLOC_LOCK_DESTROY() sx_destroy(&spi_alloc_lock) +#define SPI_ALLOC_LOCK() sx_xlock(&spi_alloc_lock) +#define SPI_ALLOC_UNLOCK() sx_unlock(&spi_alloc_lock) +#define SPI_ALLOC_LOCK_ASSERT() sx_assert(&spi_alloc_lock, SA_XLOCKED) + /* SAD */ TAILQ_HEAD(secashead_queue, secashead); LIST_HEAD(secashead_list, secashead); @@ -4902,6 +4909,7 @@ key_getspi(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) KEY_SETSECASIDX(proto, mode, reqid, src0 + 1, dst0 + 1, &saidx); /* SPI allocation */ + SPI_ALLOC_LOCK(); spi = key_do_getnewspi( (struct sadb_spirange *)mhp->ext[SADB_EXT_SPIRANGE], &saidx); if (spi == 0) { @@ -4909,10 +4917,12 @@ key_getspi(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) * Requested SPI or SPI range is not available or * already used. */ + SPI_ALLOC_UNLOCK(); error = EEXIST; goto fail; } sav = key_newsav(mhp, &saidx, spi, &error); + SPI_ALLOC_UNLOCK(); if (sav == NULL) goto fail; @@ -5021,6 +5031,8 @@ key_do_getnewspi(struct sadb_spirange *spirange, struct secasindex *saidx) uint32_t min, max, newspi, t; int tries, limit; + SPI_ALLOC_LOCK_ASSERT(); + /* set spi range to allocate */ if (spirange != NULL) { min = spirange->sadb_spirange_min; @@ -5629,9 +5641,11 @@ key_add(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) * secasindex. * XXXAE: IPComp seems also doesn't use SPI. */ + SPI_ALLOC_LOCK(); if (proto == IPPROTO_TCP) { sav = key_getsav_tcpmd5(&saidx, &spi); if (sav == NULL && spi == 0) { + SPI_ALLOC_UNLOCK(); /* Failed to allocate SPI */ ipseclog((LOG_DEBUG, "%s: SA already exists.\n", __func__)); @@ -5643,12 +5657,14 @@ key_add(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) sav = key_getsavbyspi(spi); } if (sav != NULL) { + SPI_ALLOC_UNLOCK(); key_freesav(&sav); ipseclog((LOG_DEBUG, "%s: SA already exists.\n", __func__)); return key_senderror(so, m, EEXIST); } sav = key_newsav(mhp, &saidx, spi, &error); + SPI_ALLOC_UNLOCK(); if (sav == NULL) return key_senderror(so, m, error); KEYDBG(KEY_STAMP, @@ -6023,10 +6039,12 @@ key_delete(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) return (key_senderror(so, m, EINVAL)); } sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA]; + SPI_ALLOC_LOCK(); if (proto == IPPROTO_TCP) sav = key_getsav_tcpmd5(&saidx, NULL); else sav = key_getsavbyspi(sa0->sadb_sa_spi); + SPI_ALLOC_UNLOCK(); if (sav == NULL) { ipseclog((LOG_DEBUG, "%s: no SA found for SPI %u.\n", __func__, ntohl(sa0->sadb_sa_spi))); @@ -6235,10 +6253,12 @@ key_get(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) } KEY_SETSECASIDX(proto, IPSEC_MODE_ANY, 0, src0 + 1, dst0 + 1, &saidx); + SPI_ALLOC_LOCK(); if (proto == IPPROTO_TCP) sav = key_getsav_tcpmd5(&saidx, NULL); else sav = key_getsavbyspi(sa0->sadb_sa_spi); + SPI_ALLOC_UNLOCK(); if (sav == NULL) { ipseclog((LOG_DEBUG, "%s: no SA found.\n", __func__)); return key_senderror(so, m, ESRCH); @@ -8318,6 +8338,7 @@ key_init(void) SAHTREE_LOCK_INIT(); ACQ_LOCK_INIT(); SPACQ_LOCK_INIT(); + SPI_ALLOC_LOCK_INIT(); #ifndef IPSEC_DEBUG2 callout_init(&key_timer, 1); @@ -8442,6 +8463,7 @@ key_destroy(void) SAHTREE_LOCK_DESTROY(); ACQ_LOCK_DESTROY(); SPACQ_LOCK_DESTROY(); + SPI_ALLOC_LOCK_DESTROY(); } #endif From nobody Wed Nov 3 19:54:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6A28F1846DBA; Wed, 3 Nov 2021 19:54: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 4HkyCy2WbBz3G3x; Wed, 3 Nov 2021 19:54: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 36A0E1E85C; Wed, 3 Nov 2021 19:54: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 1A3Jss9b091071; Wed, 3 Nov 2021 19:54:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3JssVx091070; Wed, 3 Nov 2021 19:54:54 GMT (envelope-from git) Date: Wed, 3 Nov 2021 19:54:54 GMT Message-Id: <202111031954.1A3JssVx091070@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: c47a4a237561 - main - arm: Remove unused items List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c47a4a23756167e40c6a9d1dfd0bf64258620171 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c47a4a23756167e40c6a9d1dfd0bf64258620171 commit c47a4a23756167e40c6a9d1dfd0bf64258620171 Author: Warner Losh AuthorDate: 2021-11-03 19:53:48 +0000 Commit: Warner Losh CommitDate: 2021-11-03 19:54:36 +0000 arm: Remove unused items Remote detritis copied, apparently, from sparc. utrap has never been used on arm, so it's safe to just remove it. Sponsored by: Netflix --- sys/arm/include/proc.h | 10 +---- sys/arm/include/utrap.h | 112 ------------------------------------------------ 2 files changed, 1 insertion(+), 121 deletions(-) diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index 9566c264731e..641b42280045 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -40,13 +40,6 @@ #ifndef _MACHINE_PROC_H_ #define _MACHINE_PROC_H_ -#include - -struct md_utrap { - utrap_entry_t *ut_precise[UT_MAX]; /* must be first */ - int ut_refcnt; -}; - struct mdthread { int md_spinlock_count; /* (k) */ register_t md_saved_cspr; /* (k) */ @@ -58,8 +51,7 @@ struct mdthread { }; struct mdproc { - struct md_utrap *md_utrap; - void *md_sigtramp; + long md_dummy; }; #define KINFO_PROC_SIZE 816 diff --git a/sys/arm/include/utrap.h b/sys/arm/include/utrap.h deleted file mode 100644 index b261d87d566f..000000000000 --- a/sys/arm/include/utrap.h +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_UTRAP_H_ -#define _MACHINE_UTRAP_H_ - -#define UT_INSTRUCTION_EXCEPTION 1 -#define UT_INSTRUCTION_ERROR 2 -#define UT_INSTRUCTION_PROTECTION 3 -#define UT_ILLTRAP_INSTRUCTION 4 -#define UT_ILLEGAL_INSTRUCTION 5 -#define UT_PRIVILEGED_OPCODE 6 -#define UT_FP_DISABLED 7 -#define UT_FP_EXCEPTION_IEEE_754 8 -#define UT_FP_EXCEPTION_OTHER 9 -#define UT_TAG_OFERFLOW 10 -#define UT_DIVISION_BY_ZERO 11 -#define UT_DATA_EXCEPTION 12 -#define UT_DATA_ERROR 13 -#define UT_DATA_PROTECTION 14 -#define UT_MEM_ADDRESS_NOT_ALIGNED 15 -#define UT_PRIVILEGED_ACTION 16 -#define UT_ASYNC_DATA_ERROR 17 -#define UT_TRAP_INSTRUCTION_16 18 -#define UT_TRAP_INSTRUCTION_17 19 -#define UT_TRAP_INSTRUCTION_18 20 -#define UT_TRAP_INSTRUCTION_19 21 -#define UT_TRAP_INSTRUCTION_20 22 -#define UT_TRAP_INSTRUCTION_21 23 -#define UT_TRAP_INSTRUCTION_22 24 -#define UT_TRAP_INSTRUCTION_23 25 -#define UT_TRAP_INSTRUCTION_24 26 -#define UT_TRAP_INSTRUCTION_25 27 -#define UT_TRAP_INSTRUCTION_26 28 -#define UT_TRAP_INSTRUCTION_27 29 -#define UT_TRAP_INSTRUCTION_28 30 -#define UT_TRAP_INSTRUCTION_29 31 -#define UT_TRAP_INSTRUCTION_30 32 -#define UT_TRAP_INSTRUCTION_31 33 -#define UT_INSTRUCTION_MISS 34 -#define UT_DATA_MISS 35 -#define UT_MAX 36 - -#define ST_SUNOS_SYSCALL 0 -#define ST_BREAKPOINT 1 -#define ST_DIVISION_BY_ZERO 2 -#define ST_FLUSH_WINDOWS 3 /* XXX implement! */ -#define ST_CLEAN_WINDOW 4 -#define ST_RANGE_CHECK 5 -#define ST_FIX_ALIGNMENT 6 -#define ST_INTEGER_OVERFLOW 7 -/* 8 is 32-bit ABI syscall (old solaris syscall?) */ -#define ST_BSD_SYSCALL 9 -#define ST_FP_RESTORE 10 -/* 11-15 are available */ -/* 16 is linux 32 bit syscall (but supposed to be reserved, grr) */ -/* 17 is old linux 64 bit syscall (but supposed to be reserved, grr) */ -/* 16-31 are reserved for user applications (utraps) */ -#define ST_GETCC 32 /* XXX implement! */ -#define ST_SETCC 33 /* XXX implement! */ -#define ST_GETPSR 34 /* XXX implement! */ -#define ST_SETPSR 35 /* XXX implement! */ -/* 36-63 are available */ -#define ST_SOLARIS_SYSCALL 64 -#define ST_SYSCALL 65 -#define ST_SYSCALL32 66 -/* 67 is reserved to OS source licensee */ -/* 68 is return from deferred trap (not supported) */ -/* 69-95 are reserved to SPARC international */ -/* 96-108 are available */ -/* 109 is linux 64 bit syscall */ -/* 110 is linux 64 bit getcontext (?) */ -/* 111 is linux 64 bit setcontext (?) */ -/* 112-255 are available */ - -#define UTH_NOCHANGE (-1) - -#ifndef __ASM__ - -typedef int utrap_entry_t; -typedef void *utrap_handler_t; - -#endif - -#endif From nobody Wed Nov 3 20:03:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 37B48184A9ED; Wed, 3 Nov 2021 20:03: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 4HkyPh12z7z3JXS; Wed, 3 Nov 2021 20:03: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 EFCF81ECF1; Wed, 3 Nov 2021 20:03: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 1A3K3JBR004906; Wed, 3 Nov 2021 20:03:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3K3JWl004905; Wed, 3 Nov 2021 20:03:19 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:03:19 GMT Message-Id: <202111032003.1A3K3JWl004905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 3ea9a7cf7b09 - main - blackhole(4): disable for locally originated TCP/UDP packets List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ea9a7cf7b09a355cde3a76824809402b99d0892 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3ea9a7cf7b09a355cde3a76824809402b99d0892 commit 3ea9a7cf7b09a355cde3a76824809402b99d0892 Author: Gleb Smirnoff AuthorDate: 2021-10-28 15:11:45 +0000 Commit: Gleb Smirnoff CommitDate: 2021-11-03 20:02:44 +0000 blackhole(4): disable for locally originated TCP/UDP packets In most cases blackholing for locally originated packets is undesired, leads to different kind of lags and delays. Provide sysctls to enforce it, e.g. for debugging purposes. Reviewed by: rrs Differential revision: https://reviews.freebsd.org/D32718 --- share/man/man4/blackhole.4 | 12 +++++++++++- sys/netinet/tcp_input.c | 19 +++++++++++++++++-- sys/netinet/udp_usrreq.c | 7 ++++++- sys/netinet/udp_var.h | 2 ++ sys/netinet6/udp6_usrreq.c | 3 ++- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/share/man/man4/blackhole.4 b/share/man/man4/blackhole.4 index 0bd7d03bcb50..17d1286525e4 100644 --- a/share/man/man4/blackhole.4 +++ b/share/man/man4/blackhole.4 @@ -12,7 +12,7 @@ .\" .\" .\" $FreeBSD$ -.Dd September 6, 2015 +.Dd November 3, 2021 .Dt BLACKHOLE 4 .Os .Sh NAME @@ -24,7 +24,9 @@ attempts .Sh SYNOPSIS .Cd sysctl net.inet.sctp.blackhole Ns Op = Ns Brq "0 | 1 | 2" .Cd sysctl net.inet.tcp.blackhole Ns Op = Ns Brq "0 | 1 | 2" +.Cd sysctl net.inet.tcp.blackhole_local Ns Op = Ns Brq "0 | 1" .Cd sysctl net.inet.udp.blackhole Ns Op = Ns Brq "0 | 1" +.Cd sysctl net.inet.udp.blackhole_local Ns Op = Ns Brq "0 | 1" .Sh DESCRIPTION The .Nm @@ -35,6 +37,14 @@ are received on SCTP, TCP, or UDP ports where there is no socket listening. The blackhole behaviour is useful to slow down an attacker who is port-scanning a system in an attempt to detect vulnerable services. It might also slow down an attempted denial of service attack. +.Pp +The blackhole behaviour is disabled by default. +If enabled, the locally originated packets would still be responded to, +unless also +.Va net.inet.tcp.blackhole_local +(for TCP) and/or +.Va net.inet.udp.blackhole_local +(for UDP) are enforced. .Ss SCTP Setting the SCTP blackhole MIB to a numeric value of one will prevent sending an ABORT packet in response to an incoming INIT. diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index a8fe6d9817d0..3ebac68c7c48 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -144,6 +144,12 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, blackhole, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(blackhole), 0, "Do not send RST on segments to closed ports"); +VNET_DEFINE(bool, blackhole_local) = false; +#define V_blackhole_local VNET(blackhole_local) +SYSCTL_BOOL(_net_inet_tcp, OID_AUTO, blackhole_local, CTLFLAG_VNET | + CTLFLAG_RW, &VNET_NAME(blackhole_local), false, + "Enforce net.inet.tcp.blackhole for locally originated packets"); + VNET_DEFINE(int, tcp_delack_enabled) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, delayed_ack, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_delack_enabled), 0, @@ -935,8 +941,17 @@ findpcb: * When blackholing do not respond with a RST but * completely ignore the segment and drop it. */ - if ((V_blackhole == 1 && (thflags & TH_SYN)) || - V_blackhole == 2) + if (((V_blackhole == 1 && (thflags & TH_SYN)) || + V_blackhole == 2) && (V_blackhole_local || +#ifdef INET6 + isipv6 ? !in6_localaddr(&ip6->ip6_src) : +#endif +#ifdef INET + !in_localip(ip->ip_src) +#else + true +#endif + )) goto dropunlock; rstreason = BANDLIM_RST_CLOSEDPORT; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 7c5a642da040..a9d534fbc8c0 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -127,6 +127,10 @@ VNET_DEFINE(int, udp_blackhole) = 0; SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(udp_blackhole), 0, "Do not send port unreachables for refused connects"); +VNET_DEFINE(bool, udp_blackhole_local) = false; +SYSCTL_BOOL(_net_inet_udp, OID_AUTO, blackhole_local, CTLFLAG_VNET | + CTLFLAG_RW, &VNET_NAME(udp_blackhole_local), false, + "Enforce net.inet.udp.blackhole for locally originated packets"); u_long udp_sendspace = 9216; /* really max datagram size */ SYSCTL_ULONG(_net_inet_udp, UDPCTL_MAXDGRAM, maxdgram, CTLFLAG_RW, @@ -701,7 +705,8 @@ udp_input(struct mbuf **mp, int *offp, int proto) UDPSTAT_INC(udps_noportbcast); goto badunlocked; } - if (V_udp_blackhole) + if (V_udp_blackhole && (V_udp_blackhole_local || + !in_localip(ip->ip_src))) goto badunlocked; if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 37bc0c846d99..eaafdb299233 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -149,9 +149,11 @@ extern u_long udp_sendspace; extern u_long udp_recvspace; VNET_DECLARE(int, udp_cksum); VNET_DECLARE(int, udp_blackhole); +VNET_DECLARE(bool, udp_blackhole_local); VNET_DECLARE(int, udp_log_in_vain); #define V_udp_cksum VNET(udp_cksum) #define V_udp_blackhole VNET(udp_blackhole) +#define V_udp_blackhole_local VNET(udp_blackhole_local) #define V_udp_log_in_vain VNET(udp_log_in_vain) VNET_DECLARE(int, zero_checksum_port); diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 6ee2abc4ea1b..5939b631a1ab 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -511,7 +511,8 @@ skip_checksum: UDPSTAT_INC(udps_noportmcast); goto badunlocked; } - if (V_udp_blackhole) + if (V_udp_blackhole && (V_udp_blackhole_local || + !in6_localaddr(&ip6->ip6_src))) goto badunlocked; icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0); *mp = NULL; From nobody Wed Nov 3 20:29:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 45BA2182E889; Wed, 3 Nov 2021 20:29: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 4Hkz0F1X9Tz3Qy7; Wed, 3 Nov 2021 20:29: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 146971F0B4; Wed, 3 Nov 2021 20:29: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 1A3KTmpW031921; Wed, 3 Nov 2021 20:29:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KTmGe031920; Wed, 3 Nov 2021 20:29:48 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:29:48 GMT Message-Id: <202111032029.1A3KTmGe031920@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: ae49051c033a - main - nfscl: Fix forced dismount when "nconnect" is specified List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: ae49051c033a2468af2f1f0079ecaf069b993245 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ae49051c033a2468af2f1f0079ecaf069b993245 commit ae49051c033a2468af2f1f0079ecaf069b993245 Author: Rick Macklem AuthorDate: 2021-11-03 20:26:38 +0000 Commit: Rick Macklem CommitDate: 2021-11-03 20:26:38 +0000 nfscl: Fix forced dismount when "nconnect" is specified When a forced dismount is done and the "nconnect" mount option was used, the additional connections must be closed. This patch does that. Found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfs/nfs_commonkrpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 2235f1077a03..358d77fe5b30 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -1298,9 +1298,13 @@ newnfs_nmcancelreqs(struct nfsmount *nmp) { struct nfsclds *dsp; struct __rpc_client *cl; + int i; if (nmp->nm_sockreq.nr_client != NULL) CLNT_CLOSE(nmp->nm_sockreq.nr_client); + for (i = 0; i < nmp->nm_aconnect; i++) + if (nmp->nm_aconn[i] != NULL) + CLNT_CLOSE(nmp->nm_aconn[i]); lookformore: NFSLOCKMNT(nmp); TAILQ_FOREACH(dsp, &nmp->nm_sess, nfsclds_list) { From nobody Wed Nov 3 20:48:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 30EF9183837A; Wed, 3 Nov 2021 20:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HkzPx0qthz3msy; Wed, 3 Nov 2021 20:48:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB80F1F5E7; Wed, 3 Nov 2021 20:48:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A3Kmamx057814; Wed, 3 Nov 2021 20:48:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KmagK057813; Wed, 3 Nov 2021 20:48:36 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:48:36 GMT Message-Id: <202111032048.1A3KmagK057813@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: 1da2deab7c2f - stable/13 - iscsid: set max_recv_data_segment_length to what we advertise List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 1da2deab7c2f195ea0e32878951833496f5a1a68 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1da2deab7c2f195ea0e32878951833496f5a1a68 commit 1da2deab7c2f195ea0e32878951833496f5a1a68 Author: Ed Maste AuthorDate: 2021-10-21 15:09:58 +0000 Commit: Ed Maste CommitDate: 2021-11-03 20:47:11 +0000 iscsid: set max_recv_data_segment_length to what we advertise Previously we updated the conection's conn_max_recv_data_segment_length only when we received a response containing MaxRecvDataSegmentLength from the target. If the target did not send MaxRecvDataSegmentLength then we left conn_max_recv_data_segment_length at the default (i.e., 8192). A target could then send more data than that defult (up to our advertised maximum), and we would drop the connection. RFC 7143 specifies that MaxRecvDataSegmentLength is Declarative, not negotiated. Just set conn_max_recv_data_segment_length to our advertised value in login_negotiate(). PR: 259355 Reviewed by: mav MFC after: 1 week Fixes: a15fbc904a4d ("Alike to r312190 decouple iSCSI...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32605 (cherry picked from commit fc79cf4fea7221fa62d480648f05e30f7df73f92) --- usr.sbin/iscsid/login.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/iscsid/login.c b/usr.sbin/iscsid/login.c index 864695dcbdb5..3f0020ef140b 100644 --- a/usr.sbin/iscsid/login.c +++ b/usr.sbin/iscsid/login.c @@ -403,9 +403,6 @@ login_negotiate_key(struct connection *conn, const char *name, tmp = isl->isl_max_send_data_segment_length; } conn->conn_max_send_data_segment_length = tmp; - /* We received target's limit, that means it accepted our's. */ - conn->conn_max_recv_data_segment_length = - isl->isl_max_recv_data_segment_length; } else if (strcmp(name, "MaxBurstLength") == 0) { tmp = strtoul(value, NULL, 10); if (tmp <= 0) @@ -538,6 +535,9 @@ login_negotiate(struct connection *conn) isl->isl_max_recv_data_segment_length); } + conn->conn_max_recv_data_segment_length = + isl->isl_max_recv_data_segment_length; + keys_add(request_keys, "DefaultTime2Wait", "0"); keys_add(request_keys, "DefaultTime2Retain", "0"); keys_add(request_keys, "ErrorRecoveryLevel", "0"); From nobody Wed Nov 3 20:54:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8780D183BC27; Wed, 3 Nov 2021 20:54: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 4HkzXT3Trlz3prj; Wed, 3 Nov 2021 20:54: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 574891FB84; Wed, 3 Nov 2021 20:54: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 1A3KsHv0071122; Wed, 3 Nov 2021 20:54:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsHJI071121; Wed, 3 Nov 2021 20:54:17 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:17 GMT Message-Id: <202111032054.1A3KsHJI071121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 5cd45ad4784b - releng/13.0 - Fix libevent1 ABI breakage. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 5cd45ad4784b493f44eee69001922c4df2ed3be7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.0 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=5cd45ad4784b493f44eee69001922c4df2ed3be7 commit 5cd45ad4784b493f44eee69001922c4df2ed3be7 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:23:13 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:37:22 +0000 Fix libevent1 ABI breakage. Approved by: so Security: EN-21:26.libevent --- contrib/pf/libevent/event.h | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/pf/libevent/event.h b/contrib/pf/libevent/event.h index 3f2032dd068e..0c19201611b5 100644 --- a/contrib/pf/libevent/event.h +++ b/contrib/pf/libevent/event.h @@ -73,7 +73,6 @@ struct { \ struct type *rbe_left; /* left element */ \ struct type *rbe_right; /* right element */ \ struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ } #endif /* !RB_ENTRY */ From nobody Wed Nov 3 20:54:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F208F183BCA6; Wed, 3 Nov 2021 20:54: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 4HkzXV4llrz3pjS; Wed, 3 Nov 2021 20:54: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 7B8531F83E; Wed, 3 Nov 2021 20:54: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 1A3KsIg3071147; Wed, 3 Nov 2021 20:54:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsIv3071146; Wed, 3 Nov 2021 20:54:18 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:18 GMT Message-Id: <202111032054.1A3KsIv3071146@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: b76aaa35423e - releng/13.0 - Root certificate bundle update. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: b76aaa35423e7a0f47029d9526149505828568c8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.0 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=b76aaa35423e7a0f47029d9526149505828568c8 commit b76aaa35423e7a0f47029d9526149505828568c8 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:30:05 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:37:26 +0000 Root certificate bundle update. Approved by: so Security: EN-21:27.caroot --- secure/caroot/MAca-bundle.pl | 55 ++++++-- .../Camerfirma_Chambers_of_Commerce_Root.pem | 0 .../Camerfirma_Global_Chambersign_Root.pem | 0 .../{trusted => blacklisted}/Certum_Root_CA.pem | 0 .../Chambers_of_Commerce_Root_-_2008.pem | 0 .../D-TRUST_Root_CA_3_2013.pem | 0 secure/caroot/{trusted => blacklisted}/EC-ACC.pem | 0 ...oTrust_Primary_Certification_Authority_-_G2.pem | 0 .../Global_Chambersign_Root_-_2008.pem | 0 .../OISTE_WISeKey_Global_Root_GA_CA.pem | 0 .../{trusted => blacklisted}/QuoVadis_Root_CA.pem | 2 + .../Sonera_Class_2_Root_CA.pem | 2 + .../Staat_der_Nederlanden_Root_CA_-_G3.pem | 0 .../SwissSign_Platinum_CA_-_G2.pem | 0 ...Public_Primary_Certification_Authority_-_G6.pem | 0 ...Public_Primary_Certification_Authority_-_G6.pem | 0 .../Trustis_FPS_Root_CA.pem | 0 ...Sign_Universal_Root_Certification_Authority.pem | 0 ...Public_Primary_Certification_Authority_-_G3.pem | 0 ...Public_Primary_Certification_Authority_-_G3.pem | 0 secure/caroot/trusted/ACCVRAIZ1.pem | 2 + secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem | 2 + .../AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem | 69 ++++++++++ .../caroot/trusted/ANF_Secure_Server_Root_CA.pem | 139 +++++++++++++++++++++ .../trusted/Actalis_Authentication_Root_CA.pem | 2 + secure/caroot/trusted/AffirmTrust_Commercial.pem | 2 + secure/caroot/trusted/AffirmTrust_Networking.pem | 2 + secure/caroot/trusted/AffirmTrust_Premium.pem | 2 + secure/caroot/trusted/AffirmTrust_Premium_ECC.pem | 2 + secure/caroot/trusted/Amazon_Root_CA_1.pem | 2 + secure/caroot/trusted/Amazon_Root_CA_2.pem | 2 + secure/caroot/trusted/Amazon_Root_CA_3.pem | 2 + secure/caroot/trusted/Amazon_Root_CA_4.pem | 2 + secure/caroot/trusted/Atos_TrustedRoot_2011.pem | 2 + ...ertificacion_Firmaprofesional_CIF_A62634068.pem | 2 + .../caroot/trusted/Baltimore_CyberTrust_Root.pem | 2 + secure/caroot/trusted/Buypass_Class_2_Root_CA.pem | 2 + secure/caroot/trusted/Buypass_Class_3_Root_CA.pem | 2 + secure/caroot/trusted/CA_Disig_Root_R2.pem | 2 + secure/caroot/trusted/CFCA_EV_ROOT.pem | 2 + .../trusted/COMODO_Certification_Authority.pem | 2 + .../trusted/COMODO_ECC_Certification_Authority.pem | 2 + .../trusted/COMODO_RSA_Certification_Authority.pem | 2 + secure/caroot/trusted/Certigna.pem | 2 + secure/caroot/trusted/Certigna_Root_CA.pem | 2 + secure/caroot/trusted/Certum_EC-384_CA.pem | 68 ++++++++++ .../caroot/trusted/Certum_Trusted_Network_CA.pem | 2 + .../caroot/trusted/Certum_Trusted_Network_CA_2.pem | 2 + secure/caroot/trusted/Certum_Trusted_Root_CA.pem | 136 ++++++++++++++++++++ secure/caroot/trusted/Comodo_AAA_Services_root.pem | 2 + secure/caroot/trusted/Cybertrust_Global_Root.pem | 2 + .../trusted/D-TRUST_Root_Class_3_CA_2_2009.pem | 2 + .../trusted/D-TRUST_Root_Class_3_CA_2_EV_2009.pem | 2 + secure/caroot/trusted/DST_Root_CA_X3.pem | 2 + .../caroot/trusted/DigiCert_Assured_ID_Root_CA.pem | 2 + .../caroot/trusted/DigiCert_Assured_ID_Root_G2.pem | 2 + .../caroot/trusted/DigiCert_Assured_ID_Root_G3.pem | 2 + secure/caroot/trusted/DigiCert_Global_Root_CA.pem | 2 + secure/caroot/trusted/DigiCert_Global_Root_G2.pem | 2 + secure/caroot/trusted/DigiCert_Global_Root_G3.pem | 2 + .../trusted/DigiCert_High_Assurance_EV_Root_CA.pem | 2 + secure/caroot/trusted/DigiCert_Trusted_Root_G4.pem | 2 + .../trusted/E-Tugra_Certification_Authority.pem | 2 + .../Entrust_Root_Certification_Authority.pem | 2 + .../Entrust_Root_Certification_Authority_-_EC1.pem | 2 + .../Entrust_Root_Certification_Authority_-_G2.pem | 2 + .../Entrust_Root_Certification_Authority_-_G4.pem | 2 + .../Entrust_net_Premium_2048_Secure_Server_CA.pem | 2 + secure/caroot/trusted/GDCA_TrustAUTH_R5_ROOT.pem | 2 + secure/caroot/trusted/GLOBALTRUST_2020.pem | 138 ++++++++++++++++++++ secure/caroot/trusted/GTS_Root_R1.pem | 2 + secure/caroot/trusted/GTS_Root_R2.pem | 2 + secure/caroot/trusted/GTS_Root_R3.pem | 2 + secure/caroot/trusted/GTS_Root_R4.pem | 2 + .../caroot/trusted/GlobalSign_ECC_Root_CA_-_R4.pem | 2 + .../caroot/trusted/GlobalSign_ECC_Root_CA_-_R5.pem | 2 + secure/caroot/trusted/GlobalSign_Root_CA.pem | 2 + secure/caroot/trusted/GlobalSign_Root_CA_-_R2.pem | 2 + secure/caroot/trusted/GlobalSign_Root_CA_-_R3.pem | 2 + secure/caroot/trusted/GlobalSign_Root_CA_-_R6.pem | 2 + secure/caroot/trusted/GlobalSign_Root_E46.pem | 66 ++++++++++ secure/caroot/trusted/GlobalSign_Root_R46.pem | 134 ++++++++++++++++++++ secure/caroot/trusted/Go_Daddy_Class_2_CA.pem | 2 + .../Go_Daddy_Root_Certificate_Authority_-_G2.pem | 2 + ...c_and_Research_Institutions_ECC_RootCA_2015.pem | 2 + ...demic_and_Research_Institutions_RootCA_2011.pem | 2 + ...demic_and_Research_Institutions_RootCA_2015.pem | 2 + secure/caroot/trusted/Hongkong_Post_Root_CA_1.pem | 2 + secure/caroot/trusted/Hongkong_Post_Root_CA_3.pem | 2 + secure/caroot/trusted/ISRG_Root_X1.pem | 2 + .../trusted/IdenTrust_Commercial_Root_CA_1.pem | 2 + .../trusted/IdenTrust_Public_Sector_Root_CA_1.pem | 2 + secure/caroot/trusted/Izenpe_com.pem | 2 + .../trusted/Microsec_e-Szigno_Root_CA_2009.pem | 2 + ...crosoft_ECC_Root_Certificate_Authority_2017.pem | 2 + ...crosoft_RSA_Root_Certificate_Authority_2017.pem | 2 + .../NAVER_Global_Root_Certification_Authority.pem | 2 + ...etLock_Arany__Class_Gold__F__tan__s__tv__ny.pem | 2 + .../Network_Solutions_Certificate_Authority.pem | 2 + .../trusted/OISTE_WISeKey_Global_Root_GB_CA.pem | 2 + .../trusted/OISTE_WISeKey_Global_Root_GC_CA.pem | 2 + secure/caroot/trusted/QuoVadis_Root_CA_1_G3.pem | 2 + secure/caroot/trusted/QuoVadis_Root_CA_2.pem | 2 + secure/caroot/trusted/QuoVadis_Root_CA_2_G3.pem | 2 + secure/caroot/trusted/QuoVadis_Root_CA_3.pem | 2 + secure/caroot/trusted/QuoVadis_Root_CA_3_G3.pem | 2 + ...SSL_com_EV_Root_Certification_Authority_ECC.pem | 2 + ..._com_EV_Root_Certification_Authority_RSA_R2.pem | 2 + .../SSL_com_Root_Certification_Authority_ECC.pem | 2 + .../SSL_com_Root_Certification_Authority_RSA.pem | 2 + secure/caroot/trusted/SZAFIR_ROOT_CA2.pem | 2 + secure/caroot/trusted/SecureSign_RootCA11.pem | 2 + secure/caroot/trusted/SecureTrust_CA.pem | 2 + secure/caroot/trusted/Secure_Global_CA.pem | 2 + .../trusted/Security_Communication_RootCA2.pem | 2 + .../trusted/Security_Communication_Root_CA.pem | 2 + .../trusted/Staat_der_Nederlanden_EV_Root_CA.pem | 2 + secure/caroot/trusted/Starfield_Class_2_CA.pem | 2 + .../Starfield_Root_Certificate_Authority_-_G2.pem | 2 + ...ld_Services_Root_Certificate_Authority_-_G2.pem | 2 + secure/caroot/trusted/SwissSign_Gold_CA_-_G2.pem | 2 + secure/caroot/trusted/SwissSign_Silver_CA_-_G2.pem | 2 + .../trusted/T-TeleSec_GlobalRoot_Class_2.pem | 2 + .../trusted/T-TeleSec_GlobalRoot_Class_3.pem | 2 + ...BITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem | 2 + secure/caroot/trusted/TWCA_Global_Root_CA.pem | 2 + .../trusted/TWCA_Root_Certification_Authority.pem | 2 + secure/caroot/trusted/TeliaSonera_Root_CA_v1.pem | 2 + secure/caroot/trusted/TrustCor_ECA-1.pem | 2 + secure/caroot/trusted/TrustCor_RootCert_CA-1.pem | 2 + secure/caroot/trusted/TrustCor_RootCert_CA-2.pem | 2 + .../Trustwave_Global_Certification_Authority.pem | 2 + ...ave_Global_ECC_P256_Certification_Authority.pem | 2 + ...ave_Global_ECC_P384_Certification_Authority.pem | 2 + .../trusted/UCA_Extended_Validation_Root.pem | 2 + secure/caroot/trusted/UCA_Global_G2_Root.pem | 2 + .../USERTrust_ECC_Certification_Authority.pem | 2 + .../USERTrust_RSA_Certification_Authority.pem | 2 + secure/caroot/trusted/XRamp_Global_CA_Root.pem | 2 + secure/caroot/trusted/certSIGN_ROOT_CA.pem | 2 + secure/caroot/trusted/certSIGN_Root_CA_G2.pem | 2 + secure/caroot/trusted/e-Szigno_Root_CA_2017.pem | 2 + .../trusted/ePKI_Root_Certification_Authority.pem | 2 + secure/caroot/trusted/emSign_ECC_Root_CA_-_C3.pem | 2 + secure/caroot/trusted/emSign_ECC_Root_CA_-_G3.pem | 2 + secure/caroot/trusted/emSign_Root_CA_-_C1.pem | 2 + secure/caroot/trusted/emSign_Root_CA_-_G1.pem | 2 + 147 files changed, 1037 insertions(+), 12 deletions(-) diff --git a/secure/caroot/MAca-bundle.pl b/secure/caroot/MAca-bundle.pl index bfac77c73941..8521b620337f 100755 --- a/secure/caroot/MAca-bundle.pl +++ b/secure/caroot/MAca-bundle.pl @@ -76,6 +76,8 @@ sub print_header($$) ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $VERSION ## @@ -91,6 +93,8 @@ EOFH ## Authorities (CA). These were automatically extracted from Mozilla's ## root CA list (the file `certdata.txt'). ## +## It contains certificates trusted for server authentication. +## ## Extracted from nss ## with $VERSION ## @@ -100,6 +104,13 @@ EOH } } +# returns a string like YYMMDDhhmmssZ of current time in GMT zone +sub timenow() +{ + my ($sec,$min,$hour,$mday,$mon,$year,undef,undef,undef) = gmtime(time); + return sprintf "%02d%02d%02d%02d%02d%02dZ", $year-100, $mon+1, $mday, $hour, $min, $sec; +} + sub printcert($$$) { my ($fh, $label, $certdata) = @_; @@ -110,6 +121,8 @@ sub printcert($$$) close(OUT) or die "openssl x509 failed with exit code $?"; } +# converts a datastream that is to be \177-style octal constants +# from <> to a (binary) string and returns it sub graboct($) { my $ifh = shift; @@ -125,13 +138,13 @@ sub graboct($) return $data; } - sub grabcert($) { my $ifh = shift; my $certdata; - my $cka_label; - my $serial; + my $cka_label = ''; + my $serial = 0; + my $distrust = 0; while (<$ifh>) { chomp; @@ -148,6 +161,19 @@ sub grabcert($) if (/^CKA_SERIAL_NUMBER MULTILINE_OCTAL/) { $serial = graboct($ifh); } + + if (/^CKA_NSS_SERVER_DISTRUST_AFTER MULTILINE_OCTAL/) + { + my $distrust_after = graboct($ifh); + my $time_now = timenow(); + if ($time_now >= $distrust_after) { $distrust = 1; } + if ($debug) { + printf STDERR "line $.: $cka_label ser #%d: distrust after %s, now: %s -> distrust $distrust\n", $serial, $distrust_after, timenow(); + } + if ($distrust) { + return undef; + } + } } return ($serial, $cka_label, $certdata); } @@ -171,13 +197,13 @@ sub grabtrust($) { $serial = graboct($ifh); } - if (/^CKA_TRUST_(SERVER_AUTH|EMAIL_PROTECTION|CODE_SIGNING) CK_TRUST (\S+)$/) + if (/^CKA_TRUST_SERVER_AUTH CK_TRUST (\S+)$/) { - if ($2 eq 'CKT_NSS_NOT_TRUSTED') { + if ($1 eq 'CKT_NSS_NOT_TRUSTED') { $distrust = 1; - } elsif ($2 eq 'CKT_NSS_TRUSTED_DELEGATOR') { + } elsif ($1 eq 'CKT_NSS_TRUSTED_DELEGATOR') { $maytrust = 1; - } elsif ($2 ne 'CKT_NSS_MUST_VERIFY_TRUST') { + } elsif ($1 ne 'CKT_NSS_MUST_VERIFY_TRUST') { confess "Unknown trust setting on line $.:\n" . "$_\n" . "Script must be updated:"; @@ -197,16 +223,22 @@ if (!$outputdir) { print_header(*STDOUT, ""); } +my $untrusted = 0; + while (<$inputfh>) { if (/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) { my ($serial, $label, $certdata) = grabcert($inputfh); if (defined $certs{$label."\0".$serial}) { warn "Certificate $label duplicated!\n"; } - $certs{$label."\0".$serial} = $certdata; - # We store the label in a separate hash because truncating the key - # with \0 was causing garbage data after the end of the text. - $labels{$label."\0".$serial} = $label; + if (defined $certdata) { + $certs{$label."\0".$serial} = $certdata; + # We store the label in a separate hash because truncating the key + # with \0 was causing garbage data after the end of the text. + $labels{$label."\0".$serial} = $label; + } else { # $certdata undefined? distrust_after in effect + $untrusted ++; + } } elsif (/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/) { my ($serial, $label, $trust) = grabtrust($inputfh); if (defined $trusts{$label."\0".$serial}) { @@ -226,7 +258,6 @@ sub label_to_filename(@) { } # weed out untrusted certificates -my $untrusted = 0; foreach my $it (keys %trusts) { if (!$trusts{$it}) { if (!exists($certs{$it})) { diff --git a/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem b/secure/caroot/blacklisted/Camerfirma_Chambers_of_Commerce_Root.pem similarity index 100% rename from secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem rename to secure/caroot/blacklisted/Camerfirma_Chambers_of_Commerce_Root.pem diff --git a/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem b/secure/caroot/blacklisted/Camerfirma_Global_Chambersign_Root.pem similarity index 100% rename from secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem rename to secure/caroot/blacklisted/Camerfirma_Global_Chambersign_Root.pem diff --git a/secure/caroot/trusted/Certum_Root_CA.pem b/secure/caroot/blacklisted/Certum_Root_CA.pem similarity index 100% rename from secure/caroot/trusted/Certum_Root_CA.pem rename to secure/caroot/blacklisted/Certum_Root_CA.pem diff --git a/secure/caroot/trusted/Chambers_of_Commerce_Root_-_2008.pem b/secure/caroot/blacklisted/Chambers_of_Commerce_Root_-_2008.pem similarity index 100% rename from secure/caroot/trusted/Chambers_of_Commerce_Root_-_2008.pem rename to secure/caroot/blacklisted/Chambers_of_Commerce_Root_-_2008.pem diff --git a/secure/caroot/trusted/D-TRUST_Root_CA_3_2013.pem b/secure/caroot/blacklisted/D-TRUST_Root_CA_3_2013.pem similarity index 100% rename from secure/caroot/trusted/D-TRUST_Root_CA_3_2013.pem rename to secure/caroot/blacklisted/D-TRUST_Root_CA_3_2013.pem diff --git a/secure/caroot/trusted/EC-ACC.pem b/secure/caroot/blacklisted/EC-ACC.pem similarity index 100% rename from secure/caroot/trusted/EC-ACC.pem rename to secure/caroot/blacklisted/EC-ACC.pem diff --git a/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G2.pem b/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G2.pem similarity index 100% rename from secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G2.pem rename to secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G2.pem diff --git a/secure/caroot/trusted/Global_Chambersign_Root_-_2008.pem b/secure/caroot/blacklisted/Global_Chambersign_Root_-_2008.pem similarity index 100% rename from secure/caroot/trusted/Global_Chambersign_Root_-_2008.pem rename to secure/caroot/blacklisted/Global_Chambersign_Root_-_2008.pem diff --git a/secure/caroot/trusted/OISTE_WISeKey_Global_Root_GA_CA.pem b/secure/caroot/blacklisted/OISTE_WISeKey_Global_Root_GA_CA.pem similarity index 100% rename from secure/caroot/trusted/OISTE_WISeKey_Global_Root_GA_CA.pem rename to secure/caroot/blacklisted/OISTE_WISeKey_Global_Root_GA_CA.pem diff --git a/secure/caroot/trusted/QuoVadis_Root_CA.pem b/secure/caroot/blacklisted/QuoVadis_Root_CA.pem similarity index 98% rename from secure/caroot/trusted/QuoVadis_Root_CA.pem rename to secure/caroot/blacklisted/QuoVadis_Root_CA.pem index 3619cd0cbd03..25e6300f5231 100644 --- a/secure/caroot/trusted/QuoVadis_Root_CA.pem +++ b/secure/caroot/blacklisted/QuoVadis_Root_CA.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Sonera_Class_2_Root_CA.pem b/secure/caroot/blacklisted/Sonera_Class_2_Root_CA.pem similarity index 98% rename from secure/caroot/trusted/Sonera_Class_2_Root_CA.pem rename to secure/caroot/blacklisted/Sonera_Class_2_Root_CA.pem index 7b38ef463d6a..b23c237e319f 100644 --- a/secure/caroot/trusted/Sonera_Class_2_Root_CA.pem +++ b/secure/caroot/blacklisted/Sonera_Class_2_Root_CA.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Staat_der_Nederlanden_Root_CA_-_G3.pem b/secure/caroot/blacklisted/Staat_der_Nederlanden_Root_CA_-_G3.pem similarity index 100% rename from secure/caroot/trusted/Staat_der_Nederlanden_Root_CA_-_G3.pem rename to secure/caroot/blacklisted/Staat_der_Nederlanden_Root_CA_-_G3.pem diff --git a/secure/caroot/trusted/SwissSign_Platinum_CA_-_G2.pem b/secure/caroot/blacklisted/SwissSign_Platinum_CA_-_G2.pem similarity index 100% rename from secure/caroot/trusted/SwissSign_Platinum_CA_-_G2.pem rename to secure/caroot/blacklisted/SwissSign_Platinum_CA_-_G2.pem diff --git a/secure/caroot/trusted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem b/secure/caroot/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem similarity index 100% rename from secure/caroot/trusted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem rename to secure/caroot/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem diff --git a/secure/caroot/trusted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem b/secure/caroot/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem similarity index 100% rename from secure/caroot/trusted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem rename to secure/caroot/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem diff --git a/secure/caroot/trusted/Trustis_FPS_Root_CA.pem b/secure/caroot/blacklisted/Trustis_FPS_Root_CA.pem similarity index 100% rename from secure/caroot/trusted/Trustis_FPS_Root_CA.pem rename to secure/caroot/blacklisted/Trustis_FPS_Root_CA.pem diff --git a/secure/caroot/trusted/VeriSign_Universal_Root_Certification_Authority.pem b/secure/caroot/blacklisted/VeriSign_Universal_Root_Certification_Authority.pem similarity index 100% rename from secure/caroot/trusted/VeriSign_Universal_Root_Certification_Authority.pem rename to secure/caroot/blacklisted/VeriSign_Universal_Root_Certification_Authority.pem diff --git a/secure/caroot/trusted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem b/secure/caroot/blacklisted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem similarity index 100% rename from secure/caroot/trusted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem rename to secure/caroot/blacklisted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem diff --git a/secure/caroot/trusted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem b/secure/caroot/blacklisted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem similarity index 100% rename from secure/caroot/trusted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem rename to secure/caroot/blacklisted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem diff --git a/secure/caroot/trusted/ACCVRAIZ1.pem b/secure/caroot/trusted/ACCVRAIZ1.pem index 0c7c7c41b57d..1c96e53b8f17 100644 --- a/secure/caroot/trusted/ACCVRAIZ1.pem +++ b/secure/caroot/trusted/ACCVRAIZ1.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem index 579f50d8d730..6a64be5ce138 100644 --- a/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem +++ b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem new file mode 100644 index 000000000000..71ee49574e84 --- /dev/null +++ b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem @@ -0,0 +1,69 @@ +## +## AC RAIZ FNMT-RCM SERVIDORES SEGUROS +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## It contains a certificate trusted for server authentication. +## +## Extracted from nss +## with $FreeBSD$ +## +## @generated +## +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 62:f6:32:6c:e5:c4:e3:68:5c:1b:62:dd:9c:2e:9d:95 + Signature Algorithm: ecdsa-with-SHA384 + Issuer: C = ES, O = FNMT-RCM, OU = Ceres, organizationIdentifier = VATES-Q2826004J, CN = AC RAIZ FNMT-RCM SERVIDORES SEGUROS + Validity + Not Before: Dec 20 09:37:33 2018 GMT + Not After : Dec 20 09:37:33 2043 GMT + Subject: C = ES, O = FNMT-RCM, OU = Ceres, organizationIdentifier = VATES-Q2826004J, CN = AC RAIZ FNMT-RCM SERVIDORES SEGUROS + Subject Public Key Info: + Public Key Algorithm: id-ecPublicKey + Public-Key: (384 bit) + pub: + 04:f6:ba:57:53:c8:ca:ab:df:36:4a:52:21:e4:97: + d2:83:67:9e:f0:65:51:d0:5e:87:c7:47:b1:59:f2: + 57:47:9b:00:02:93:44:17:69:db:42:c7:b1:b2:3a: + 18:0e:b4:5d:8c:b3:66:5d:a1:34:f9:36:2c:49:db: + f3:46:fc:b3:44:69:44:13:66:fd:d7:c5:fd:af:36: + 4d:ce:03:4d:07:71:cf:af:6a:05:d2:a2:43:5a:0a: + 52:6f:01:03:4e:8e:8b + ASN1 OID: secp384r1 + NIST CURVE: P-384 + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 01:B9:2F:EF:BF:11:86:60:F2:4F:D0:41:6E:AB:73:1F:E7:D2:6E:49 + Signature Algorithm: ecdsa-with-SHA384 + 30:66:02:31:00:ae:4a:e3:2b:40:c3:74:11:f2:95:ad:16:23: + de:4e:0c:1a:e6:5d:a5:24:5e:6b:44:7b:fc:38:e2:4f:cb:9c: + 45:17:11:4c:14:27:26:55:39:75:4a:03:cc:13:90:9f:92:02: + 31:00:fa:4a:6c:60:88:73:f3:ee:b8:98:62:a9:ce:2b:c2:d9: + 8a:a6:70:31:1d:af:b0:94:4c:eb:4f:c6:e3:d1:f3:62:a7:3c: + ff:93:2e:07:5c:49:01:67:69:12:02:72:bf:e7 +SHA1 Fingerprint=62:FF:D9:9E:C0:65:0D:03:CE:75:93:D2:ED:3F:2D:32:C9:E3:E5:4A +-----BEGIN CERTIFICATE----- +MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw +CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw +FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S +Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 +MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL +DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS +QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH +sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK +Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu +SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC +MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy +v+c= +-----END CERTIFICATE----- diff --git a/secure/caroot/trusted/ANF_Secure_Server_Root_CA.pem b/secure/caroot/trusted/ANF_Secure_Server_Root_CA.pem new file mode 100644 index 000000000000..6114a5ccdb2d --- /dev/null +++ b/secure/caroot/trusted/ANF_Secure_Server_Root_CA.pem @@ -0,0 +1,139 @@ +## +## ANF Secure Server Root CA +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## It contains a certificate trusted for server authentication. +## +## Extracted from nss +## with $FreeBSD$ +## +## @generated +## +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 996390341000653745 (0xdd3e3bc6cf96bb1) + Signature Algorithm: sha256WithRSAEncryption + Issuer: serialNumber = G63287510, C = ES, O = ANF Autoridad de Certificacion, OU = ANF CA Raiz, CN = ANF Secure Server Root CA + Validity + Not Before: Sep 4 10:00:38 2019 GMT + Not After : Aug 30 10:00:38 2039 GMT + Subject: serialNumber = G63287510, C = ES, O = ANF Autoridad de Certificacion, OU = ANF CA Raiz, CN = ANF Secure Server Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (4096 bit) + Modulus: + 00:db:eb:6b:2b:e6:64:54:95:82:90:a3:72:a4:19: + 01:9d:9c:0b:81:5f:73:49:ba:a7:ac:f3:04:4e:7b: + 96:0b:ec:11:e0:5b:a6:1c:ce:1b:d2:0d:83:1c:2b: + b8:9e:1d:7e:45:32:60:0f:07:e9:77:58:7e:9f:6a: + c8:61:4e:b6:26:c1:4c:8d:ff:4c:ef:34:b2:1f:65: + d8:b9:78:f5:ad:a9:71:b9:ef:4f:58:1d:a5:de:74: + 20:97:a1:ed:68:4c:de:92:17:4b:bc:ab:ff:65:9a: + 9e:fb:47:d9:57:72:f3:09:a1:ae:76:44:13:6e:9c: + 2d:44:39:bc:f9:c7:3b:a4:58:3d:41:bd:b4:c2:49: + a3:c8:0d:d2:97:2f:07:65:52:00:a7:6e:c8:af:68: + ec:f4:14:96:b6:57:1f:56:c3:39:9f:2b:6d:e4:f3: + 3e:f6:35:64:da:0c:1c:a1:84:4b:2f:4b:4b:e2:2c: + 24:9d:6d:93:40:eb:b5:23:8e:32:ca:6f:45:d3:a8: + 89:7b:1e:cf:1e:fa:5b:43:8b:cd:cd:a8:0f:6a:ca: + 0c:5e:b9:9e:47:8f:f0:d9:b6:0a:0b:58:65:17:33: + b9:23:e4:77:19:7d:cb:4a:2e:92:7b:4f:2f:10:77: + b1:8d:2f:68:9c:62:cc:e0:50:f8:ec:91:a7:54:4c: + 57:09:d5:76:63:c5:e8:65:1e:ee:6d:6a:cf:09:9d: + fa:7c:4f:ad:60:08:fd:56:99:0f:15:2c:7b:a9:80: + ab:8c:61:8f:4a:07:76:42:de:3d:f4:dd:b2:24:33: + 5b:b8:b5:a3:44:c9:ac:7f:77:3c:1d:23:ec:82:a9: + a6:e2:c8:06:4c:02:fe:ac:5c:99:99:0b:2f:10:8a: + a6:f4:7f:d5:87:74:0d:59:49:45:f6:f0:71:5c:39: + 29:d6:bf:4a:23:8b:f5:5f:01:63:d2:87:73:28:b5: + 4b:0a:f5:f8:ab:82:2c:7e:73:25:32:1d:0b:63:0a: + 17:81:00:ff:b6:76:5e:e7:b4:b1:40:ca:21:bb:d5: + 80:51:e5:48:52:67:2c:d2:61:89:07:0d:0f:ce:42: + 77:c0:44:73:9c:44:50:a0:db:10:0a:2d:95:1c:81: + af:e4:1c:e5:14:1e:f1:36:41:01:02:2f:7d:73:a7: + de:42:cc:4c:e9:89:0d:56:f7:9f:91:d4:03:c6:6c: + c9:8f:db:d8:1c:e0:40:98:5d:66:99:98:80:6e:2d: + ff:01:c5:ce:cb:46:1f:ac:02:c6:43:e6:ae:a2:84: + 3c:c5:4e:1e:3d:6d:c9:14:4c:e3:2e:41:bb:ca:39: + bf:36:3c:2a:19:aa:41:87:4e:a5:ce:4b:32:79:dd: + 90:49:7f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + keyid:9C:5F:D0:6C:63:A3:5F:93:CA:93:98:08:AD:8C:87:A5:2C:5C:C1:37 + + X509v3 Subject Key Identifier: + 9C:5F:D0:6C:63:A3:5F:93:CA:93:98:08:AD:8C:87:A5:2C:5C:C1:37 + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 4e:1e:b9:8a:c6:a0:98:3f:6e:c3:69:c0:6a:5c:49:52:ac:cb: + 2b:5d:78:38:c1:d5:54:84:9f:93:f0:87:19:3d:2c:66:89:eb: + 0d:42:fc:cc:f0:75:85:3f:8b:f4:80:5d:79:e5:17:67:bd:35: + 82:e2:f2:3c:8e:7d:5b:36:cb:5a:80:00:29:f2:ce:2b:2c:f1: + 8f:aa:6d:05:93:6c:72:c7:56:eb:df:50:23:28:e5:45:10:3d: + e8:67:a3:af:0e:55:0f:90:09:62:ef:4b:59:a2:f6:53:f1:c0: + 35:e4:2f:c1:24:bd:79:2f:4e:20:22:3b:fd:1a:20:b0:a4:0e: + 2c:70:ed:74:3f:b8:13:95:06:51:c8:e8:87:26:ca:a4:5b:6a: + 16:21:92:dd:73:60:9e:10:18:de:3c:81:ea:e8:18:c3:7c:89: + f2:8b:50:3e:bd:11:e2:15:03:a8:36:7d:33:01:6c:48:15:d7: + 88:90:99:04:c5:cc:e6:07:f4:bc:f4:90:ed:13:e2:ea:8b:c3: + 8f:a3:33:0f:c1:29:4c:13:4e:da:15:56:71:73:72:82:50:f6: + 9a:33:7c:a2:b1:a8:1a:34:74:65:5c:ce:d1:eb:ab:53:e0:1a: + 80:d8:ea:3a:49:e4:26:30:9b:e5:1c:8a:a8:a9:15:32:86:99: + 92:0a:10:23:56:12:e0:f6:ce:4c:e2:bb:be:db:8d:92:73:01: + 66:2f:62:3e:b2:72:27:45:36:ed:4d:56:e3:97:99:ff:3a:35: + 3e:a5:54:4a:52:59:4b:60:db:ee:fe:78:11:7f:4a:dc:14:79: + 60:b6:6b:64:03:db:15:83:e1:a2:be:f6:23:97:50:f0:09:33: + 36:a7:71:96:25:f3:b9:42:7d:db:38:3f:2c:58:ac:e8:42:e1: + 0e:d8:d3:3b:4c:2e:82:e9:83:2e:6b:31:d9:dd:47:86:4f:6d: + 97:91:2e:4f:e2:28:71:35:16:d1:f2:73:fe:25:2b:07:47:24: + 63:27:c8:f8:f6:d9:6b:fc:12:31:56:08:c0:53:42:af:9c:d0: + 33:7e:fc:06:f0:31:44:03:14:f1:58:ea:f2:6a:0d:a9:11:b2: + 83:be:c5:1a:bf:07:ea:59:dc:a3:88:35:ef:9c:76:32:3c:4d: + 06:22:ce:15:e5:dd:9e:d8:8f:da:de:d2:c4:39:e5:17:81:cf: + 38:47:eb:7f:88:6d:59:1b:df:9f:42:14:ae:7e:cf:a8:b0:66: + 65:da:37:af:9f:aa:3d:ea:28:b6:de:d5:31:58:16:82:5b:ea: + bb:19:75:02:73:1a:ca:48:1a:21:93:90:0a:8e:93:84:a7:7d: + 3b:23:18:92:89:a0:8d:ac +SHA1 Fingerprint=5B:6E:68:D0:CC:15:B6:A0:5F:1E:C1:5F:AE:02:FC:6B:2F:5D:6F:74 +-----BEGIN CERTIFICATE----- +MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV +BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk +YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV +BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN +MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF +UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD +VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v +dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj +cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q +yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH +2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX +H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL +zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR +p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz +W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ +SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn +LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 +n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B +u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj +o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L +9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej +rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK +pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 +vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq +OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ +/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 +2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI ++PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 +MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo +tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= +-----END CERTIFICATE----- diff --git a/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem b/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem index 7248545350e2..7c971e1229a2 100644 --- a/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem +++ b/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/AffirmTrust_Commercial.pem b/secure/caroot/trusted/AffirmTrust_Commercial.pem index 1d85c32853c8..282d1a5dcf6f 100644 --- a/secure/caroot/trusted/AffirmTrust_Commercial.pem +++ b/secure/caroot/trusted/AffirmTrust_Commercial.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/AffirmTrust_Networking.pem b/secure/caroot/trusted/AffirmTrust_Networking.pem index 222bde26c934..830cf3f0c3c2 100644 --- a/secure/caroot/trusted/AffirmTrust_Networking.pem +++ b/secure/caroot/trusted/AffirmTrust_Networking.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/AffirmTrust_Premium.pem b/secure/caroot/trusted/AffirmTrust_Premium.pem index dc1447429465..725747aafdaf 100644 --- a/secure/caroot/trusted/AffirmTrust_Premium.pem +++ b/secure/caroot/trusted/AffirmTrust_Premium.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem b/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem index a6f01409a2ef..6fe75939863e 100644 --- a/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem +++ b/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_1.pem b/secure/caroot/trusted/Amazon_Root_CA_1.pem index 6bf1acafd4c7..2aca2eee3e9b 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_1.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_1.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_2.pem b/secure/caroot/trusted/Amazon_Root_CA_2.pem index 80a1eb66bee2..95ca81db30bb 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_2.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_2.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_3.pem b/secure/caroot/trusted/Amazon_Root_CA_3.pem index 6b61b3e18fa0..294f7dc8f0b6 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_3.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_3.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_4.pem b/secure/caroot/trusted/Amazon_Root_CA_4.pem index df7aa6f1c165..649917b9638a 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_4.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_4.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Atos_TrustedRoot_2011.pem b/secure/caroot/trusted/Atos_TrustedRoot_2011.pem index 21b229561733..7058d3fb6edf 100644 --- a/secure/caroot/trusted/Atos_TrustedRoot_2011.pem +++ b/secure/caroot/trusted/Atos_TrustedRoot_2011.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem b/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem index 4d2eaa61962f..db4f44195dbd 100644 --- a/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem +++ b/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem b/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem index 3dc1de849346..0f356d59962f 100644 --- a/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem +++ b/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem b/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem index dc2c86edbed1..0168f641fd42 100644 --- a/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem +++ b/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem b/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem index fda39f8731d1..7ae24799e638 100644 --- a/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem +++ b/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/CA_Disig_Root_R2.pem b/secure/caroot/trusted/CA_Disig_Root_R2.pem index 0ecc9d1ee08d..0dda6d97e2aa 100644 --- a/secure/caroot/trusted/CA_Disig_Root_R2.pem +++ b/secure/caroot/trusted/CA_Disig_Root_R2.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/CFCA_EV_ROOT.pem b/secure/caroot/trusted/CFCA_EV_ROOT.pem index 7eb37baa3bed..722499b9ed42 100644 --- a/secure/caroot/trusted/CFCA_EV_ROOT.pem +++ b/secure/caroot/trusted/CFCA_EV_ROOT.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/COMODO_Certification_Authority.pem b/secure/caroot/trusted/COMODO_Certification_Authority.pem index 7aa1237bb8e1..fc3e4b554cc3 100644 --- a/secure/caroot/trusted/COMODO_Certification_Authority.pem +++ b/secure/caroot/trusted/COMODO_Certification_Authority.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem b/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem index 215581b14fdf..5f839a858d00 100644 --- a/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem +++ b/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem b/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem index 38e275f1365e..7faefe98b8bf 100644 --- a/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem +++ b/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Certigna.pem b/secure/caroot/trusted/Certigna.pem index bbcd413be511..e9104ef6c3da 100644 --- a/secure/caroot/trusted/Certigna.pem +++ b/secure/caroot/trusted/Certigna.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Certigna_Root_CA.pem b/secure/caroot/trusted/Certigna_Root_CA.pem index c1a0286ab2a0..a0a7248b51ea 100644 --- a/secure/caroot/trusted/Certigna_Root_CA.pem +++ b/secure/caroot/trusted/Certigna_Root_CA.pem @@ -5,6 +5,8 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $FreeBSD$ ## diff --git a/secure/caroot/trusted/Certum_EC-384_CA.pem b/secure/caroot/trusted/Certum_EC-384_CA.pem new file mode 100644 index 000000000000..67b5d644f809 --- /dev/null +++ b/secure/caroot/trusted/Certum_EC-384_CA.pem @@ -0,0 +1,68 @@ +## +## Certum EC-384 CA +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## It contains a certificate trusted for server authentication. +## +## Extracted from nss +## with $FreeBSD$ +## +## @generated +## +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 78:8f:27:5c:81:12:52:20:a5:04:d0:2d:dd:ba:73:f4 + Signature Algorithm: ecdsa-with-SHA384 + Issuer: C = PL, O = Asseco Data Systems S.A., OU = Certum Certification Authority, CN = Certum EC-384 CA + Validity + Not Before: Mar 26 07:24:54 2018 GMT + Not After : Mar 26 07:24:54 2043 GMT + Subject: C = PL, O = Asseco Data Systems S.A., OU = Certum Certification Authority, CN = Certum EC-384 CA + Subject Public Key Info: + Public Key Algorithm: id-ecPublicKey + Public-Key: (384 bit) + pub: + 04:c4:28:8e:ab:18:5b:6a:be:6e:64:37:63:e4:cd: + ec:ab:3a:f7:cc:a1:b8:0e:82:49:d7:86:29:9f:a1: + 94:f2:e3:60:78:98:81:78:06:4d:f2:ec:9a:0e:57: + 60:83:9f:b4:e6:17:2f:1a:b3:5d:02:5b:89:23:3c: + c2:11:05:2a:a7:88:13:18:f3:50:84:d7:bd:34:2c: + 27:89:55:ff:ce:4c:e7:df:a6:1f:28:c4:f0:54:c3: + b9:7c:b7:53:ad:eb:c2 + ASN1 OID: secp384r1 + NIST CURVE: P-384 + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 8D:06:66:74:24:76:3A:F3:89:F7:BC:D6:BD:47:7D:2F:BC:10:5F:4B + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: ecdsa-with-SHA384 + 30:65:02:30:03:55:2d:a6:e6:18:c4:7c:ef:c9:50:6e:c1:27: + 0f:9c:87:af:6e:d5:1b:08:18:bd:92:29:c1:ef:94:91:78:d2: + 3a:1c:55:89:62:e5:1b:09:1e:ba:64:6b:f1:76:b4:d4:02:31: + 00:b4:42:84:99:ff:ab:e7:9e:fb:91:97:27:5d:dc:b0:5b:30: + 71:ce:5e:38:1a:6a:d9:25:e7:ea:f7:61:92:56:f8:ea:da:36: + c2:87:65:96:2e:72:25:2f:7f:df:c3:13:c9 +SHA1 Fingerprint=F3:3E:78:3C:AC:DF:F4:A2:CC:AC:67:55:69:56:D7:E5:16:3C:E1:ED +-----BEGIN CERTIFICATE----- +MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw +CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw +JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT +EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 +WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT +LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX +BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE +KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm +Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj *** 1764 LINES SKIPPED *** From nobody Wed Nov 3 20:54:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 13E5F183BC39; Wed, 3 Nov 2021 20:54: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 4HkzXW6LZpz3ppV; Wed, 3 Nov 2021 20:54: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 9851A1F65F; Wed, 3 Nov 2021 20:54: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 1A3KsJwc071171; Wed, 3 Nov 2021 20:54:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsJ5i071170; Wed, 3 Nov 2021 20:54:19 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:19 GMT Message-Id: <202111032054.1A3KsJ5i071170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 847819dca14d - releng/13.0 - Fix kernel panic in vmci driver initialization. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 847819dca14d55994540013439eadd0d6f48eb97 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.0 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=847819dca14d55994540013439eadd0d6f48eb97 commit 847819dca14d55994540013439eadd0d6f48eb97 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:40:19 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:40:19 +0000 Fix kernel panic in vmci driver initialization. Approved by: so Security: EN-21:28.vmci --- sys/dev/vmware/vmci/vmci.c | 9 ++++--- sys/dev/vmware/vmci/vmci_event.c | 3 +++ sys/dev/vmware/vmci/vmci_kernel_if.c | 48 ++++++++++++++++++++++++++++++++++- sys/dev/vmware/vmci/vmci_kernel_if.h | 2 ++ sys/dev/vmware/vmci/vmci_queue_pair.c | 3 +++ 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c index 91fcb39ed6ed..f30147499199 100644 --- a/sys/dev/vmware/vmci/vmci.c +++ b/sys/dev/vmware/vmci/vmci.c @@ -242,8 +242,10 @@ vmci_detach(device_t dev) vmci_components_cleanup(); - taskqueue_drain(taskqueue_thread, &sc->vmci_delayed_work_task); - mtx_destroy(&sc->vmci_delayed_work_lock); + if mtx_initialized(&sc->vmci_spinlock) { + taskqueue_drain(taskqueue_thread, &sc->vmci_delayed_work_task); + mtx_destroy(&sc->vmci_delayed_work_lock); + } if (sc->vmci_res0 != NULL) bus_space_write_4(sc->vmci_iot0, sc->vmci_ioh0, @@ -254,7 +256,8 @@ vmci_detach(device_t dev) vmci_unmap_bars(sc); - mtx_destroy(&sc->vmci_spinlock); + if mtx_initialized(&sc->vmci_spinlock) + mtx_destroy(&sc->vmci_spinlock); pci_disable_busmaster(dev); diff --git a/sys/dev/vmware/vmci/vmci_event.c b/sys/dev/vmware/vmci/vmci_event.c index 7f3bf9039e12..192828cc6f6a 100644 --- a/sys/dev/vmware/vmci/vmci_event.c +++ b/sys/dev/vmware/vmci/vmci_event.c @@ -593,6 +593,9 @@ vmci_event_unregister_subscription(vmci_id sub_id) { struct vmci_subscription *s; + if (!vmci_initialized_lock(&subscriber_lock)) + return NULL; + vmci_grab_lock_bh(&subscriber_lock); s = vmci_event_find(sub_id); if (s != NULL) { diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.c b/sys/dev/vmware/vmci/vmci_kernel_if.c index e845650873b5..de54a8d1ca4f 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_if.c +++ b/sys/dev/vmware/vmci/vmci_kernel_if.c @@ -70,7 +70,8 @@ void vmci_cleanup_lock(vmci_lock *lock) { - mtx_destroy(lock); + if mtx_initialized(lock) + mtx_destroy(lock); } /* @@ -165,6 +166,29 @@ vmci_release_lock_bh(vmci_lock *lock) mtx_unlock(lock); } +/* + *------------------------------------------------------------------------------ + * + * vmci_initialized_lock + * + * Returns whether a lock has been initialized. + * + * Results: + * Return 1 if initialized or 0 if unininitialized. + * + * Side effects: + * None + * + *------------------------------------------------------------------------------ + */ + +int +vmci_initialized_lock(vmci_lock *lock) +{ + + return mtx_initialized(lock); +} + /* *------------------------------------------------------------------------------ * @@ -446,6 +470,28 @@ vmci_mutex_release(vmci_mutex *mutex) mtx_unlock(mutex); } +/* + *------------------------------------------------------------------------------ + * + * vmci_mutex_initialized + * + * Returns whether a mutex has been initialized. + * + * Results: + * Return 1 if initialized or 0 if unininitialized. + * + * Side effects: + * None + * + *------------------------------------------------------------------------------ + */ + +int +vmci_mutex_initialized(vmci_mutex *mutex) +{ + + return mtx_initialized(mutex); +} /* *------------------------------------------------------------------------------ * diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.h b/sys/dev/vmware/vmci/vmci_kernel_if.h index fc23eefe98e0..048e480b0698 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_if.h +++ b/sys/dev/vmware/vmci/vmci_kernel_if.h @@ -48,6 +48,7 @@ void vmci_grab_lock(vmci_lock *lock); void vmci_release_lock(vmci_lock *lock); void vmci_grab_lock_bh(vmci_lock *lock); void vmci_release_lock_bh(vmci_lock *lock); +int vmci_initialized_lock(vmci_lock *lock); void *vmci_alloc_kernel_mem(size_t size, int flags); void vmci_free_kernel_mem(void *ptr, size_t size); @@ -72,6 +73,7 @@ int vmci_mutex_init(vmci_mutex *mutex, char *name); void vmci_mutex_destroy(vmci_mutex *mutex); void vmci_mutex_acquire(vmci_mutex *mutex); void vmci_mutex_release(vmci_mutex *mutex); +int vmci_mutex_initialized(vmci_mutex *mutex); void *vmci_alloc_queue(uint64_t size, uint32_t flags); void vmci_free_queue(void *q, uint64_t size); diff --git a/sys/dev/vmware/vmci/vmci_queue_pair.c b/sys/dev/vmware/vmci/vmci_queue_pair.c index 2ff963c691d0..0e2f83b20c67 100644 --- a/sys/dev/vmware/vmci/vmci_queue_pair.c +++ b/sys/dev/vmware/vmci/vmci_queue_pair.c @@ -338,6 +338,9 @@ vmci_qp_guest_endpoints_exit(void) { struct qp_guest_endpoint *entry; + if (!vmci_mutex_initialized(&qp_guest_endpoints.mutex)) + return; + vmci_mutex_acquire(&qp_guest_endpoints.mutex); while ((entry = From nobody Wed Nov 3 20:54:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9A053183BBCC; Wed, 3 Nov 2021 20:54: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 4HkzXY191fz3ppc; Wed, 3 Nov 2021 20:54: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 BE2831FB85; Wed, 3 Nov 2021 20:54: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 1A3KsKAO071195; Wed, 3 Nov 2021 20:54:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsKDq071194; Wed, 3 Nov 2021 20:54:20 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:20 GMT Message-Id: <202111032054.1A3KsKDq071194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 11754a61115f - releng/13.0 - Timezone database information update. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 11754a61115f60d16d022ae54ea6e0a2a85b81ba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.0 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=11754a61115f60d16d022ae54ea6e0a2a85b81ba commit 11754a61115f60d16d022ae54ea6e0a2a85b81ba Author: Gordon Tetlow AuthorDate: 2021-11-03 20:44:52 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:44:52 +0000 Timezone database information update. Approved by: so Security: EN-21:29.tzdata --- contrib/tzdata/asia | 30 +++++++++++++++++++++++------- contrib/tzdata/australasia | 32 +++++++++++++++++++++++++------- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index ed944130e99f..ea59f5270b51 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -2234,6 +2234,14 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u # From Paul Eggert (2013-12-11): # As Steffen suggested, consider the past 21-month experiment to be DST. +# From Steffen Thorsen (2021-09-24): +# The Jordanian Government announced yesterday that they will start DST +# in February instead of March: +# https://petra.gov.jo/Include/InnerPage.jsp?ID=37683&lang=en&name=en_news (English) +# https://petra.gov.jo/Include/InnerPage.jsp?ID=189969&lang=ar&name=news (Arabic) +# From the Arabic version, it seems to say it would be at midnight +# (assume 24:00) on the last Thursday in February, starting from 2022. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S Rule Jordan 1973 1975 - Oct 1 0:00 0 - @@ -2264,8 +2272,9 @@ Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - Rule Jordan 2013 only - Dec 20 0:00 0 - -Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S +Rule Jordan 2014 2021 - Mar lastThu 24:00 1:00 S Rule Jordan 2014 max - Oct lastFri 0:00s 0 - +Rule Jordan 2022 max - Feb lastThu 24:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT @@ -3379,11 +3388,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. # http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 -# From Tim Parenti (2020-10-20): -# Predict future fall transitions at 01:00 on the Saturday preceding October's -# last Sunday (i.e., Sat>=24). This is consistent with our predictions since -# 2016, although the time of the change differed slightly in 2019. - # From Pierre Cashon (2020-10-20): # The summer time this year started on March 28 at 00:00. # https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ @@ -3396,6 +3400,17 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # For now, guess spring-ahead transitions are at 00:00 on the Saturday # preceding March's last Sunday (i.e., Sat>=24). +# From P Chan (2021-10-18): +# http://wafa.ps/Pages/Details/34701 +# Palestine winter time will start from midnight 2021-10-29 (Thursday-Friday). +# +# From Heba Hemad, Palestine Ministry of Telecom & IT (2021-10-20): +# ... winter time will begin in Palestine from Friday 10-29, 01:00 AM +# by 60 minutes backwards. +# +# From Paul Eggert (2021-10-20): +# Guess future fall transitions on October's last Friday at 01:00. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3431,7 +3446,8 @@ Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - Rule Palestine 2019 only - Mar 29 0:00 1:00 S Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S -Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - +Rule Palestine 2020 only - Oct 24 1:00 0 - +Rule Palestine 2021 max - Oct lastFri 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index cf8a0638f831..eba0fad1c213 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -385,9 +385,22 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # "Minister for Employment, Parveen Bala says they had never thought of # stopping daylight saving. He says it was just to decide on when it should # start and end. Bala says it is a short period..." -# Since the end date is still in line with our ongoing predictions, assume for -# now that the later-than-usual start date is a one-time departure from the -# recent second Sunday in November pattern. +# +# From Tim Parenti (2021-10-11), per Jashneel Kumar (2021-10-11) and P Chan +# (2021-10-12): +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/PM-BAINIMARAMA-S-COVID-19-ANNOUNCEMENT-10-10-21 +# https://www.fbcnews.com.fj/news/covid-19/curfew-moved-back-to-11pm/ +# In a 2021-10-10 speech concerning updated Covid-19 mitigation measures in +# Fiji, prime minister Josaia Voreqe "Frank" Bainimarama announced the +# suspension of DST for the 2021/2022 season: "Given that we are in the process +# of readjusting in the midst of so many changes, we will also put Daylight +# Savings Time on hold for this year. It will also make the reopening of +# scheduled commercial air service much smoother if we don't have to be +# concerned shifting arrival and departure times, which may look like a simple +# thing but requires some significant logistical adjustments domestically and +# internationally." +# Assume for now that DST will resume with the recent pre-2020 rules for the +# 2022/2023 season. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -399,10 +412,11 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2015 2021 - Jan Sun>=12 3:00 0 - Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - -Rule Fiji 2021 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2022 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2023 max - Jan Sun>=12 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 @@ -742,13 +756,17 @@ Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands # From Paul Eggert (2014-07-08): # That web page currently lists transitions for 2012/3 and 2013/4. # Assume the pattern instituted in 2012 will continue indefinitely. +# +# From Geoffrey D. Bennett (2021-09-20): +# https://www.mcil.gov.ws/storage/2021/09/MCIL-Scan_20210920_120553.pdf +# DST has been cancelled for this year. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule WS 2010 only - Sep lastSun 0:00 1 - Rule WS 2011 only - Apr Sat>=1 4:00 0 - Rule WS 2011 only - Sep lastSat 3:00 1 - -Rule WS 2012 max - Apr Sun>=1 4:00 0 - -Rule WS 2012 max - Sep lastSun 3:00 1 - +Rule WS 2012 2021 - Apr Sun>=1 4:00 0 - +Rule WS 2012 2020 - Sep lastSun 3:00 1 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index bba4d5648228..d91e0ce5f8f7 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -822,7 +822,7 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. -# From Alois Triendl (2019-07-22): +# From Alois Treindl (2019-07-22): # In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. # Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. @@ -1736,19 +1736,22 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # -# From Alois Triendl (2019-07-02): +# From Alois Treindl (2019-07-02): # I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, # for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 # am, put forward the clock by one hour. Remember that in the night between # today and Monday the 'ora legale' will come in force again." That makes it # clear that in Rome the change was on Monday, 3 April 1944 at 2 am. # -# From Paul Eggert (2016-10-27): +# From Paul Eggert (2021-10-05): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. # Model Rome's occupation by using C-Eur rules from 1943-09-10 # to 1944-06-04; although Rome was an open city during this period, it -# was effectively controlled by Germany. +# was effectively controlled by Germany. Using C-Eur is consistent +# with Treindl's comment about Rome in April 1944, as the "Rule Italy" +# lines during German occupation do not affect Europe/Rome +# (though they do affect Europe/Malta). # # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Italy 1916 only - Jun 3 24:00 1:00 S @@ -2618,7 +2621,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Although Shanks lists 1945-01-01 as the date for transition from # +01/+02 to +02/+03, more likely this is a placeholder. Guess that # the transition occurred at 1945-04-10 00:00, which is about when -# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) +# Königsberg surrendered to Soviet troops. (Thanks to Alois Treindl.) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index ddc575976e59..75e115418a1e 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -970,7 +970,7 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. -# From Alois Triendl (2019-07-09): +# From Alois Treindl (2019-07-09): # The Indianapolis News, Friday 27 October 1967 states that Perry County # returned to CST. It went again to EST on 27 April 1969, as documented by the # Indianapolis star of Saturday 26 April. @@ -1998,7 +1998,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep # Alberta -# From Alois Triendl (2019-07-19): +# From Alois Treindl (2019-07-19): # There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. # 1969, no DST, from Edmonton Journal 18 April 1969 # @@ -2107,7 +2107,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep # # From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. -# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Alois Treindl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily # Province. He also cited the 1946-09-28 Victoria Daily Times, which said # that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, # guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. From nobody Wed Nov 3 20:54:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4FE70183BBE0; Wed, 3 Nov 2021 20:54: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 4HkzXZ5Ypdz3pmW; Wed, 3 Nov 2021 20:54: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 E2A111FA90; Wed, 3 Nov 2021 20:54: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 1A3KsL9q071219; Wed, 3 Nov 2021 20:54:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsLWI071218; Wed, 3 Nov 2021 20:54:21 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:21 GMT Message-Id: <202111032054.1A3KsLWI071218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 2646dd665909 - releng/13.0 - Add UPDATING entries and bump version. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2646dd665909e60a369015c17cb602515e6025dc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.0 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=2646dd665909e60a369015c17cb602515e6025dc commit 2646dd665909e60a369015c17cb602515e6025dc Author: Gordon Tetlow AuthorDate: 2021-11-03 20:53:11 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:53:11 +0000 Add UPDATING entries and bump version. Approved by: so --- UPDATING | 14 ++++++++++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 804f8d7af263..ffdb6f389e68 100644 --- a/UPDATING +++ b/UPDATING @@ -11,6 +11,20 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20211103: + 13.0-RELEASE-p5 FreeBSD-EN-21:26.libevent + FreeBSD-EN-21:27.caroot + FreeBSD-EN-21:28.vmci + FreeBSD-EN-21:29.tzdata + + Fix libevent1 ABI breakage. [EN-21:26.libevent] + + Root certificate bundle update. [EN-21:27.caroot] + + Fix kernel panic in vmci driver initialization. [EN-21:28.vmci] + + Timezone database information update. [EN-21:29.tzdata] + 20210824: 13.0-RELEASE-p4 FreeBSD-EN-21:23.virtio_blk FreeBSD-EN-21:24.libcrypto diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 83b0c973bc13..6c2cdf194ac3 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RELEASE-p4" +BRANCH="RELEASE-p5" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Wed Nov 3 20:54:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 63255183BFE9; Wed, 3 Nov 2021 20:54: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 4HkzXm58B1z3pwB; Wed, 3 Nov 2021 20:54: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 AC4441F72C; Wed, 3 Nov 2021 20:54: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 1A3KsVLd071518; Wed, 3 Nov 2021 20:54:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsVYV071517; Wed, 3 Nov 2021 20:54:31 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:31 GMT Message-Id: <202111032054.1A3KsVYV071517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: a8c4f99a6723 - releng/12.2 - Root certificate bundle update. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.2 X-Git-Reftype: branch X-Git-Commit: a8c4f99a6723ec7a9de6830c47f650ba2f978f31 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=a8c4f99a6723ec7a9de6830c47f650ba2f978f31 commit a8c4f99a6723ec7a9de6830c47f650ba2f978f31 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:34:51 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:35:48 +0000 Root certificate bundle update. Approved by: so Security: EN-21:27.caroot --- secure/caroot/MAca-bundle.pl | 55 ++++++-- .../Camerfirma_Chambers_of_Commerce_Root.pem | 2 +- .../Camerfirma_Global_Chambersign_Root.pem | 2 +- .../{trusted => blacklisted}/Certum_Root_CA.pem | 2 +- .../Chambers_of_Commerce_Root_-_2008.pem | 2 +- .../D-TRUST_Root_CA_3_2013.pem | 2 +- secure/caroot/{trusted => blacklisted}/EC-ACC.pem | 2 +- ...oTrust_Primary_Certification_Authority_-_G2.pem | 2 +- .../Global_Chambersign_Root_-_2008.pem | 2 +- .../OISTE_WISeKey_Global_Root_GA_CA.pem | 2 +- .../{trusted => blacklisted}/QuoVadis_Root_CA.pem | 4 +- .../Sonera_Class_2_Root_CA.pem | 4 +- .../Staat_der_Nederlanden_Root_CA_-_G3.pem | 2 +- .../SwissSign_Platinum_CA_-_G2.pem | 2 +- ...Public_Primary_Certification_Authority_-_G6.pem | 2 +- ...Public_Primary_Certification_Authority_-_G6.pem | 2 +- .../Trustis_FPS_Root_CA.pem | 2 +- ...Sign_Universal_Root_Certification_Authority.pem | 2 +- ...Public_Primary_Certification_Authority_-_G3.pem | 2 +- ...Public_Primary_Certification_Authority_-_G3.pem | 2 +- secure/caroot/trusted/ACCVRAIZ1.pem | 4 +- secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem | 4 +- .../AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem | 69 ++++++++++ .../caroot/trusted/ANF_Secure_Server_Root_CA.pem | 139 +++++++++++++++++++++ .../trusted/Actalis_Authentication_Root_CA.pem | 4 +- secure/caroot/trusted/AffirmTrust_Commercial.pem | 4 +- secure/caroot/trusted/AffirmTrust_Networking.pem | 4 +- secure/caroot/trusted/AffirmTrust_Premium.pem | 4 +- secure/caroot/trusted/AffirmTrust_Premium_ECC.pem | 4 +- secure/caroot/trusted/Amazon_Root_CA_1.pem | 4 +- secure/caroot/trusted/Amazon_Root_CA_2.pem | 4 +- secure/caroot/trusted/Amazon_Root_CA_3.pem | 4 +- secure/caroot/trusted/Amazon_Root_CA_4.pem | 4 +- secure/caroot/trusted/Atos_TrustedRoot_2011.pem | 4 +- ...ertificacion_Firmaprofesional_CIF_A62634068.pem | 4 +- .../caroot/trusted/Baltimore_CyberTrust_Root.pem | 4 +- secure/caroot/trusted/Buypass_Class_2_Root_CA.pem | 4 +- secure/caroot/trusted/Buypass_Class_3_Root_CA.pem | 4 +- secure/caroot/trusted/CA_Disig_Root_R2.pem | 4 +- secure/caroot/trusted/CFCA_EV_ROOT.pem | 4 +- .../trusted/COMODO_Certification_Authority.pem | 4 +- .../trusted/COMODO_ECC_Certification_Authority.pem | 4 +- .../trusted/COMODO_RSA_Certification_Authority.pem | 4 +- secure/caroot/trusted/Certigna.pem | 4 +- secure/caroot/trusted/Certigna_Root_CA.pem | 4 +- secure/caroot/trusted/Certum_EC-384_CA.pem | 68 ++++++++++ .../caroot/trusted/Certum_Trusted_Network_CA.pem | 4 +- .../caroot/trusted/Certum_Trusted_Network_CA_2.pem | 4 +- secure/caroot/trusted/Certum_Trusted_Root_CA.pem | 136 ++++++++++++++++++++ secure/caroot/trusted/Comodo_AAA_Services_root.pem | 4 +- secure/caroot/trusted/Cybertrust_Global_Root.pem | 4 +- .../trusted/D-TRUST_Root_Class_3_CA_2_2009.pem | 4 +- .../trusted/D-TRUST_Root_Class_3_CA_2_EV_2009.pem | 4 +- secure/caroot/trusted/DST_Root_CA_X3.pem | 4 +- .../caroot/trusted/DigiCert_Assured_ID_Root_CA.pem | 4 +- .../caroot/trusted/DigiCert_Assured_ID_Root_G2.pem | 4 +- .../caroot/trusted/DigiCert_Assured_ID_Root_G3.pem | 4 +- secure/caroot/trusted/DigiCert_Global_Root_CA.pem | 4 +- secure/caroot/trusted/DigiCert_Global_Root_G2.pem | 4 +- secure/caroot/trusted/DigiCert_Global_Root_G3.pem | 4 +- .../trusted/DigiCert_High_Assurance_EV_Root_CA.pem | 4 +- secure/caroot/trusted/DigiCert_Trusted_Root_G4.pem | 4 +- .../trusted/E-Tugra_Certification_Authority.pem | 4 +- .../Entrust_Root_Certification_Authority.pem | 4 +- .../Entrust_Root_Certification_Authority_-_EC1.pem | 4 +- .../Entrust_Root_Certification_Authority_-_G2.pem | 4 +- .../Entrust_Root_Certification_Authority_-_G4.pem | 4 +- .../Entrust_net_Premium_2048_Secure_Server_CA.pem | 4 +- secure/caroot/trusted/GDCA_TrustAUTH_R5_ROOT.pem | 4 +- secure/caroot/trusted/GLOBALTRUST_2020.pem | 138 ++++++++++++++++++++ secure/caroot/trusted/GTS_Root_R1.pem | 4 +- secure/caroot/trusted/GTS_Root_R2.pem | 4 +- secure/caroot/trusted/GTS_Root_R3.pem | 4 +- secure/caroot/trusted/GTS_Root_R4.pem | 4 +- .../caroot/trusted/GlobalSign_ECC_Root_CA_-_R4.pem | 4 +- .../caroot/trusted/GlobalSign_ECC_Root_CA_-_R5.pem | 4 +- secure/caroot/trusted/GlobalSign_Root_CA.pem | 4 +- secure/caroot/trusted/GlobalSign_Root_CA_-_R2.pem | 4 +- secure/caroot/trusted/GlobalSign_Root_CA_-_R3.pem | 4 +- secure/caroot/trusted/GlobalSign_Root_CA_-_R6.pem | 4 +- secure/caroot/trusted/GlobalSign_Root_E46.pem | 66 ++++++++++ secure/caroot/trusted/GlobalSign_Root_R46.pem | 134 ++++++++++++++++++++ secure/caroot/trusted/Go_Daddy_Class_2_CA.pem | 4 +- .../Go_Daddy_Root_Certificate_Authority_-_G2.pem | 4 +- ...c_and_Research_Institutions_ECC_RootCA_2015.pem | 4 +- ...demic_and_Research_Institutions_RootCA_2011.pem | 4 +- ...demic_and_Research_Institutions_RootCA_2015.pem | 4 +- secure/caroot/trusted/Hongkong_Post_Root_CA_1.pem | 4 +- secure/caroot/trusted/Hongkong_Post_Root_CA_3.pem | 4 +- secure/caroot/trusted/ISRG_Root_X1.pem | 4 +- .../trusted/IdenTrust_Commercial_Root_CA_1.pem | 4 +- .../trusted/IdenTrust_Public_Sector_Root_CA_1.pem | 4 +- secure/caroot/trusted/Izenpe_com.pem | 4 +- .../trusted/Microsec_e-Szigno_Root_CA_2009.pem | 4 +- ...crosoft_ECC_Root_Certificate_Authority_2017.pem | 4 +- ...crosoft_RSA_Root_Certificate_Authority_2017.pem | 4 +- .../NAVER_Global_Root_Certification_Authority.pem | 4 +- ...etLock_Arany__Class_Gold__F__tan__s__tv__ny.pem | 4 +- .../Network_Solutions_Certificate_Authority.pem | 4 +- .../trusted/OISTE_WISeKey_Global_Root_GB_CA.pem | 4 +- .../trusted/OISTE_WISeKey_Global_Root_GC_CA.pem | 4 +- secure/caroot/trusted/QuoVadis_Root_CA_1_G3.pem | 4 +- secure/caroot/trusted/QuoVadis_Root_CA_2.pem | 4 +- secure/caroot/trusted/QuoVadis_Root_CA_2_G3.pem | 4 +- secure/caroot/trusted/QuoVadis_Root_CA_3.pem | 4 +- secure/caroot/trusted/QuoVadis_Root_CA_3_G3.pem | 4 +- ...SSL_com_EV_Root_Certification_Authority_ECC.pem | 4 +- ..._com_EV_Root_Certification_Authority_RSA_R2.pem | 4 +- .../SSL_com_Root_Certification_Authority_ECC.pem | 4 +- .../SSL_com_Root_Certification_Authority_RSA.pem | 4 +- secure/caroot/trusted/SZAFIR_ROOT_CA2.pem | 4 +- secure/caroot/trusted/SecureSign_RootCA11.pem | 4 +- secure/caroot/trusted/SecureTrust_CA.pem | 4 +- secure/caroot/trusted/Secure_Global_CA.pem | 4 +- .../trusted/Security_Communication_RootCA2.pem | 4 +- .../trusted/Security_Communication_Root_CA.pem | 4 +- .../trusted/Staat_der_Nederlanden_EV_Root_CA.pem | 4 +- secure/caroot/trusted/Starfield_Class_2_CA.pem | 4 +- .../Starfield_Root_Certificate_Authority_-_G2.pem | 4 +- ...ld_Services_Root_Certificate_Authority_-_G2.pem | 4 +- secure/caroot/trusted/SwissSign_Gold_CA_-_G2.pem | 4 +- secure/caroot/trusted/SwissSign_Silver_CA_-_G2.pem | 4 +- .../trusted/T-TeleSec_GlobalRoot_Class_2.pem | 4 +- .../trusted/T-TeleSec_GlobalRoot_Class_3.pem | 4 +- ...BITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem | 4 +- secure/caroot/trusted/TWCA_Global_Root_CA.pem | 4 +- .../trusted/TWCA_Root_Certification_Authority.pem | 4 +- secure/caroot/trusted/TeliaSonera_Root_CA_v1.pem | 4 +- secure/caroot/trusted/TrustCor_ECA-1.pem | 4 +- secure/caroot/trusted/TrustCor_RootCert_CA-1.pem | 4 +- secure/caroot/trusted/TrustCor_RootCert_CA-2.pem | 4 +- .../Trustwave_Global_Certification_Authority.pem | 4 +- ...ave_Global_ECC_P256_Certification_Authority.pem | 4 +- ...ave_Global_ECC_P384_Certification_Authority.pem | 4 +- .../trusted/UCA_Extended_Validation_Root.pem | 4 +- secure/caroot/trusted/UCA_Global_G2_Root.pem | 4 +- .../USERTrust_ECC_Certification_Authority.pem | 4 +- .../USERTrust_RSA_Certification_Authority.pem | 4 +- secure/caroot/trusted/XRamp_Global_CA_Root.pem | 4 +- secure/caroot/trusted/certSIGN_ROOT_CA.pem | 4 +- secure/caroot/trusted/certSIGN_Root_CA_G2.pem | 4 +- secure/caroot/trusted/e-Szigno_Root_CA_2017.pem | 4 +- .../trusted/ePKI_Root_Certification_Authority.pem | 4 +- secure/caroot/trusted/emSign_ECC_Root_CA_-_C3.pem | 4 +- secure/caroot/trusted/emSign_ECC_Root_CA_-_G3.pem | 4 +- secure/caroot/trusted/emSign_Root_CA_-_C1.pem | 4 +- secure/caroot/trusted/emSign_Root_CA_-_G1.pem | 4 +- 147 files changed, 1176 insertions(+), 151 deletions(-) diff --git a/secure/caroot/MAca-bundle.pl b/secure/caroot/MAca-bundle.pl index bfac77c73941..8521b620337f 100755 --- a/secure/caroot/MAca-bundle.pl +++ b/secure/caroot/MAca-bundle.pl @@ -76,6 +76,8 @@ sub print_header($$) ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss ## with $VERSION ## @@ -91,6 +93,8 @@ EOFH ## Authorities (CA). These were automatically extracted from Mozilla's ## root CA list (the file `certdata.txt'). ## +## It contains certificates trusted for server authentication. +## ## Extracted from nss ## with $VERSION ## @@ -100,6 +104,13 @@ EOH } } +# returns a string like YYMMDDhhmmssZ of current time in GMT zone +sub timenow() +{ + my ($sec,$min,$hour,$mday,$mon,$year,undef,undef,undef) = gmtime(time); + return sprintf "%02d%02d%02d%02d%02d%02dZ", $year-100, $mon+1, $mday, $hour, $min, $sec; +} + sub printcert($$$) { my ($fh, $label, $certdata) = @_; @@ -110,6 +121,8 @@ sub printcert($$$) close(OUT) or die "openssl x509 failed with exit code $?"; } +# converts a datastream that is to be \177-style octal constants +# from <> to a (binary) string and returns it sub graboct($) { my $ifh = shift; @@ -125,13 +138,13 @@ sub graboct($) return $data; } - sub grabcert($) { my $ifh = shift; my $certdata; - my $cka_label; - my $serial; + my $cka_label = ''; + my $serial = 0; + my $distrust = 0; while (<$ifh>) { chomp; @@ -148,6 +161,19 @@ sub grabcert($) if (/^CKA_SERIAL_NUMBER MULTILINE_OCTAL/) { $serial = graboct($ifh); } + + if (/^CKA_NSS_SERVER_DISTRUST_AFTER MULTILINE_OCTAL/) + { + my $distrust_after = graboct($ifh); + my $time_now = timenow(); + if ($time_now >= $distrust_after) { $distrust = 1; } + if ($debug) { + printf STDERR "line $.: $cka_label ser #%d: distrust after %s, now: %s -> distrust $distrust\n", $serial, $distrust_after, timenow(); + } + if ($distrust) { + return undef; + } + } } return ($serial, $cka_label, $certdata); } @@ -171,13 +197,13 @@ sub grabtrust($) { $serial = graboct($ifh); } - if (/^CKA_TRUST_(SERVER_AUTH|EMAIL_PROTECTION|CODE_SIGNING) CK_TRUST (\S+)$/) + if (/^CKA_TRUST_SERVER_AUTH CK_TRUST (\S+)$/) { - if ($2 eq 'CKT_NSS_NOT_TRUSTED') { + if ($1 eq 'CKT_NSS_NOT_TRUSTED') { $distrust = 1; - } elsif ($2 eq 'CKT_NSS_TRUSTED_DELEGATOR') { + } elsif ($1 eq 'CKT_NSS_TRUSTED_DELEGATOR') { $maytrust = 1; - } elsif ($2 ne 'CKT_NSS_MUST_VERIFY_TRUST') { + } elsif ($1 ne 'CKT_NSS_MUST_VERIFY_TRUST') { confess "Unknown trust setting on line $.:\n" . "$_\n" . "Script must be updated:"; @@ -197,16 +223,22 @@ if (!$outputdir) { print_header(*STDOUT, ""); } +my $untrusted = 0; + while (<$inputfh>) { if (/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) { my ($serial, $label, $certdata) = grabcert($inputfh); if (defined $certs{$label."\0".$serial}) { warn "Certificate $label duplicated!\n"; } - $certs{$label."\0".$serial} = $certdata; - # We store the label in a separate hash because truncating the key - # with \0 was causing garbage data after the end of the text. - $labels{$label."\0".$serial} = $label; + if (defined $certdata) { + $certs{$label."\0".$serial} = $certdata; + # We store the label in a separate hash because truncating the key + # with \0 was causing garbage data after the end of the text. + $labels{$label."\0".$serial} = $label; + } else { # $certdata undefined? distrust_after in effect + $untrusted ++; + } } elsif (/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/) { my ($serial, $label, $trust) = grabtrust($inputfh); if (defined $trusts{$label."\0".$serial}) { @@ -226,7 +258,6 @@ sub label_to_filename(@) { } # weed out untrusted certificates -my $untrusted = 0; foreach my $it (keys %trusts) { if (!$trusts{$it}) { if (!exists($certs{$it})) { diff --git a/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem b/secure/caroot/blacklisted/Camerfirma_Chambers_of_Commerce_Root.pem similarity index 98% rename from secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem rename to secure/caroot/blacklisted/Camerfirma_Chambers_of_Commerce_Root.pem index 601df8f89e10..cf7de6cc122b 100644 --- a/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem +++ b/secure/caroot/blacklisted/Camerfirma_Chambers_of_Commerce_Root.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem b/secure/caroot/blacklisted/Camerfirma_Global_Chambersign_Root.pem similarity index 98% rename from secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem rename to secure/caroot/blacklisted/Camerfirma_Global_Chambersign_Root.pem index 203fb13108c8..b1fa96bc405e 100644 --- a/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem +++ b/secure/caroot/blacklisted/Camerfirma_Global_Chambersign_Root.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Certum_Root_CA.pem b/secure/caroot/blacklisted/Certum_Root_CA.pem similarity index 97% rename from secure/caroot/trusted/Certum_Root_CA.pem rename to secure/caroot/blacklisted/Certum_Root_CA.pem index ec03a0f913de..f815c49ddae0 100644 --- a/secure/caroot/trusted/Certum_Root_CA.pem +++ b/secure/caroot/blacklisted/Certum_Root_CA.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Chambers_of_Commerce_Root_-_2008.pem b/secure/caroot/blacklisted/Chambers_of_Commerce_Root_-_2008.pem similarity index 98% rename from secure/caroot/trusted/Chambers_of_Commerce_Root_-_2008.pem rename to secure/caroot/blacklisted/Chambers_of_Commerce_Root_-_2008.pem index b705886574c8..1e3864180a66 100644 --- a/secure/caroot/trusted/Chambers_of_Commerce_Root_-_2008.pem +++ b/secure/caroot/blacklisted/Chambers_of_Commerce_Root_-_2008.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/D-TRUST_Root_CA_3_2013.pem b/secure/caroot/blacklisted/D-TRUST_Root_CA_3_2013.pem similarity index 98% rename from secure/caroot/trusted/D-TRUST_Root_CA_3_2013.pem rename to secure/caroot/blacklisted/D-TRUST_Root_CA_3_2013.pem index ab9d138bd3e1..debf7b30c2ef 100644 --- a/secure/caroot/trusted/D-TRUST_Root_CA_3_2013.pem +++ b/secure/caroot/blacklisted/D-TRUST_Root_CA_3_2013.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/EC-ACC.pem b/secure/caroot/blacklisted/EC-ACC.pem similarity index 98% rename from secure/caroot/trusted/EC-ACC.pem rename to secure/caroot/blacklisted/EC-ACC.pem index 7fca8890028f..a4b43b39414b 100644 --- a/secure/caroot/trusted/EC-ACC.pem +++ b/secure/caroot/blacklisted/EC-ACC.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G2.pem b/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G2.pem similarity index 97% rename from secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G2.pem rename to secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G2.pem index 65a90850db69..b03758a63c98 100644 --- a/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G2.pem +++ b/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G2.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Global_Chambersign_Root_-_2008.pem b/secure/caroot/blacklisted/Global_Chambersign_Root_-_2008.pem similarity index 98% rename from secure/caroot/trusted/Global_Chambersign_Root_-_2008.pem rename to secure/caroot/blacklisted/Global_Chambersign_Root_-_2008.pem index cceb29ac1bfd..cd9bebaf8c0f 100644 --- a/secure/caroot/trusted/Global_Chambersign_Root_-_2008.pem +++ b/secure/caroot/blacklisted/Global_Chambersign_Root_-_2008.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/OISTE_WISeKey_Global_Root_GA_CA.pem b/secure/caroot/blacklisted/OISTE_WISeKey_Global_Root_GA_CA.pem similarity index 98% rename from secure/caroot/trusted/OISTE_WISeKey_Global_Root_GA_CA.pem rename to secure/caroot/blacklisted/OISTE_WISeKey_Global_Root_GA_CA.pem index 266b87d98081..08ea553a9e80 100644 --- a/secure/caroot/trusted/OISTE_WISeKey_Global_Root_GA_CA.pem +++ b/secure/caroot/blacklisted/OISTE_WISeKey_Global_Root_GA_CA.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/QuoVadis_Root_CA.pem b/secure/caroot/blacklisted/QuoVadis_Root_CA.pem similarity index 98% rename from secure/caroot/trusted/QuoVadis_Root_CA.pem rename to secure/caroot/blacklisted/QuoVadis_Root_CA.pem index f4e14f9874e5..25e6300f5231 100644 --- a/secure/caroot/trusted/QuoVadis_Root_CA.pem +++ b/secure/caroot/blacklisted/QuoVadis_Root_CA.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Sonera_Class_2_Root_CA.pem b/secure/caroot/blacklisted/Sonera_Class_2_Root_CA.pem similarity index 98% rename from secure/caroot/trusted/Sonera_Class_2_Root_CA.pem rename to secure/caroot/blacklisted/Sonera_Class_2_Root_CA.pem index 77e8b4210f9a..b23c237e319f 100644 --- a/secure/caroot/trusted/Sonera_Class_2_Root_CA.pem +++ b/secure/caroot/blacklisted/Sonera_Class_2_Root_CA.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Staat_der_Nederlanden_Root_CA_-_G3.pem b/secure/caroot/blacklisted/Staat_der_Nederlanden_Root_CA_-_G3.pem similarity index 98% rename from secure/caroot/trusted/Staat_der_Nederlanden_Root_CA_-_G3.pem rename to secure/caroot/blacklisted/Staat_der_Nederlanden_Root_CA_-_G3.pem index ff3bcb131967..14a79c4c3e24 100644 --- a/secure/caroot/trusted/Staat_der_Nederlanden_Root_CA_-_G3.pem +++ b/secure/caroot/blacklisted/Staat_der_Nederlanden_Root_CA_-_G3.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/SwissSign_Platinum_CA_-_G2.pem b/secure/caroot/blacklisted/SwissSign_Platinum_CA_-_G2.pem similarity index 98% rename from secure/caroot/trusted/SwissSign_Platinum_CA_-_G2.pem rename to secure/caroot/blacklisted/SwissSign_Platinum_CA_-_G2.pem index 0fddbbde022d..f4678f629684 100644 --- a/secure/caroot/trusted/SwissSign_Platinum_CA_-_G2.pem +++ b/secure/caroot/blacklisted/SwissSign_Platinum_CA_-_G2.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem b/secure/caroot/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem similarity index 98% rename from secure/caroot/trusted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem rename to secure/caroot/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem index c0ff22d1acb5..019c97a13d34 100644 --- a/secure/caroot/trusted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem +++ b/secure/caroot/blacklisted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G6.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem b/secure/caroot/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem similarity index 98% rename from secure/caroot/trusted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem rename to secure/caroot/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem index 1d31c4641235..df9468c1249e 100644 --- a/secure/caroot/trusted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem +++ b/secure/caroot/blacklisted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G6.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Trustis_FPS_Root_CA.pem b/secure/caroot/blacklisted/Trustis_FPS_Root_CA.pem similarity index 98% rename from secure/caroot/trusted/Trustis_FPS_Root_CA.pem rename to secure/caroot/blacklisted/Trustis_FPS_Root_CA.pem index 7ae0c7994c61..476ba64dfd63 100644 --- a/secure/caroot/trusted/Trustis_FPS_Root_CA.pem +++ b/secure/caroot/blacklisted/Trustis_FPS_Root_CA.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/VeriSign_Universal_Root_Certification_Authority.pem b/secure/caroot/blacklisted/VeriSign_Universal_Root_Certification_Authority.pem similarity index 98% rename from secure/caroot/trusted/VeriSign_Universal_Root_Certification_Authority.pem rename to secure/caroot/blacklisted/VeriSign_Universal_Root_Certification_Authority.pem index a0e4b718c98d..353f709ad531 100644 --- a/secure/caroot/trusted/VeriSign_Universal_Root_Certification_Authority.pem +++ b/secure/caroot/blacklisted/VeriSign_Universal_Root_Certification_Authority.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem b/secure/caroot/blacklisted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem similarity index 98% rename from secure/caroot/trusted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem rename to secure/caroot/blacklisted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem index 615a72ad485b..d060de75b329 100644 --- a/secure/caroot/trusted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem +++ b/secure/caroot/blacklisted/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem b/secure/caroot/blacklisted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem similarity index 98% rename from secure/caroot/trusted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem rename to secure/caroot/blacklisted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem index c6c9b2ff5c6f..89400caf7eb6 100644 --- a/secure/caroot/trusted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem +++ b/secure/caroot/blacklisted/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem @@ -6,7 +6,7 @@ ## root CA list (the file `certdata.txt' in security/nss). ## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/ACCVRAIZ1.pem b/secure/caroot/trusted/ACCVRAIZ1.pem index 136f7bddb6f3..1c96e53b8f17 100644 --- a/secure/caroot/trusted/ACCVRAIZ1.pem +++ b/secure/caroot/trusted/ACCVRAIZ1.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem index d327b3ecf2cb..6a64be5ce138 100644 --- a/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem +++ b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem new file mode 100644 index 000000000000..71ee49574e84 --- /dev/null +++ b/secure/caroot/trusted/AC_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem @@ -0,0 +1,69 @@ +## +## AC RAIZ FNMT-RCM SERVIDORES SEGUROS +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## It contains a certificate trusted for server authentication. +## +## Extracted from nss +## with $FreeBSD$ +## +## @generated +## +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 62:f6:32:6c:e5:c4:e3:68:5c:1b:62:dd:9c:2e:9d:95 + Signature Algorithm: ecdsa-with-SHA384 + Issuer: C = ES, O = FNMT-RCM, OU = Ceres, organizationIdentifier = VATES-Q2826004J, CN = AC RAIZ FNMT-RCM SERVIDORES SEGUROS + Validity + Not Before: Dec 20 09:37:33 2018 GMT + Not After : Dec 20 09:37:33 2043 GMT + Subject: C = ES, O = FNMT-RCM, OU = Ceres, organizationIdentifier = VATES-Q2826004J, CN = AC RAIZ FNMT-RCM SERVIDORES SEGUROS + Subject Public Key Info: + Public Key Algorithm: id-ecPublicKey + Public-Key: (384 bit) + pub: + 04:f6:ba:57:53:c8:ca:ab:df:36:4a:52:21:e4:97: + d2:83:67:9e:f0:65:51:d0:5e:87:c7:47:b1:59:f2: + 57:47:9b:00:02:93:44:17:69:db:42:c7:b1:b2:3a: + 18:0e:b4:5d:8c:b3:66:5d:a1:34:f9:36:2c:49:db: + f3:46:fc:b3:44:69:44:13:66:fd:d7:c5:fd:af:36: + 4d:ce:03:4d:07:71:cf:af:6a:05:d2:a2:43:5a:0a: + 52:6f:01:03:4e:8e:8b + ASN1 OID: secp384r1 + NIST CURVE: P-384 + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 01:B9:2F:EF:BF:11:86:60:F2:4F:D0:41:6E:AB:73:1F:E7:D2:6E:49 + Signature Algorithm: ecdsa-with-SHA384 + 30:66:02:31:00:ae:4a:e3:2b:40:c3:74:11:f2:95:ad:16:23: + de:4e:0c:1a:e6:5d:a5:24:5e:6b:44:7b:fc:38:e2:4f:cb:9c: + 45:17:11:4c:14:27:26:55:39:75:4a:03:cc:13:90:9f:92:02: + 31:00:fa:4a:6c:60:88:73:f3:ee:b8:98:62:a9:ce:2b:c2:d9: + 8a:a6:70:31:1d:af:b0:94:4c:eb:4f:c6:e3:d1:f3:62:a7:3c: + ff:93:2e:07:5c:49:01:67:69:12:02:72:bf:e7 +SHA1 Fingerprint=62:FF:D9:9E:C0:65:0D:03:CE:75:93:D2:ED:3F:2D:32:C9:E3:E5:4A +-----BEGIN CERTIFICATE----- +MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw +CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw +FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S +Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 +MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL +DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS +QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH +sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK +Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu +SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC +MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy +v+c= +-----END CERTIFICATE----- diff --git a/secure/caroot/trusted/ANF_Secure_Server_Root_CA.pem b/secure/caroot/trusted/ANF_Secure_Server_Root_CA.pem new file mode 100644 index 000000000000..6114a5ccdb2d --- /dev/null +++ b/secure/caroot/trusted/ANF_Secure_Server_Root_CA.pem @@ -0,0 +1,139 @@ +## +## ANF Secure Server Root CA +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## It contains a certificate trusted for server authentication. +## +## Extracted from nss +## with $FreeBSD$ +## +## @generated +## +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 996390341000653745 (0xdd3e3bc6cf96bb1) + Signature Algorithm: sha256WithRSAEncryption + Issuer: serialNumber = G63287510, C = ES, O = ANF Autoridad de Certificacion, OU = ANF CA Raiz, CN = ANF Secure Server Root CA + Validity + Not Before: Sep 4 10:00:38 2019 GMT + Not After : Aug 30 10:00:38 2039 GMT + Subject: serialNumber = G63287510, C = ES, O = ANF Autoridad de Certificacion, OU = ANF CA Raiz, CN = ANF Secure Server Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (4096 bit) + Modulus: + 00:db:eb:6b:2b:e6:64:54:95:82:90:a3:72:a4:19: + 01:9d:9c:0b:81:5f:73:49:ba:a7:ac:f3:04:4e:7b: + 96:0b:ec:11:e0:5b:a6:1c:ce:1b:d2:0d:83:1c:2b: + b8:9e:1d:7e:45:32:60:0f:07:e9:77:58:7e:9f:6a: + c8:61:4e:b6:26:c1:4c:8d:ff:4c:ef:34:b2:1f:65: + d8:b9:78:f5:ad:a9:71:b9:ef:4f:58:1d:a5:de:74: + 20:97:a1:ed:68:4c:de:92:17:4b:bc:ab:ff:65:9a: + 9e:fb:47:d9:57:72:f3:09:a1:ae:76:44:13:6e:9c: + 2d:44:39:bc:f9:c7:3b:a4:58:3d:41:bd:b4:c2:49: + a3:c8:0d:d2:97:2f:07:65:52:00:a7:6e:c8:af:68: + ec:f4:14:96:b6:57:1f:56:c3:39:9f:2b:6d:e4:f3: + 3e:f6:35:64:da:0c:1c:a1:84:4b:2f:4b:4b:e2:2c: + 24:9d:6d:93:40:eb:b5:23:8e:32:ca:6f:45:d3:a8: + 89:7b:1e:cf:1e:fa:5b:43:8b:cd:cd:a8:0f:6a:ca: + 0c:5e:b9:9e:47:8f:f0:d9:b6:0a:0b:58:65:17:33: + b9:23:e4:77:19:7d:cb:4a:2e:92:7b:4f:2f:10:77: + b1:8d:2f:68:9c:62:cc:e0:50:f8:ec:91:a7:54:4c: + 57:09:d5:76:63:c5:e8:65:1e:ee:6d:6a:cf:09:9d: + fa:7c:4f:ad:60:08:fd:56:99:0f:15:2c:7b:a9:80: + ab:8c:61:8f:4a:07:76:42:de:3d:f4:dd:b2:24:33: + 5b:b8:b5:a3:44:c9:ac:7f:77:3c:1d:23:ec:82:a9: + a6:e2:c8:06:4c:02:fe:ac:5c:99:99:0b:2f:10:8a: + a6:f4:7f:d5:87:74:0d:59:49:45:f6:f0:71:5c:39: + 29:d6:bf:4a:23:8b:f5:5f:01:63:d2:87:73:28:b5: + 4b:0a:f5:f8:ab:82:2c:7e:73:25:32:1d:0b:63:0a: + 17:81:00:ff:b6:76:5e:e7:b4:b1:40:ca:21:bb:d5: + 80:51:e5:48:52:67:2c:d2:61:89:07:0d:0f:ce:42: + 77:c0:44:73:9c:44:50:a0:db:10:0a:2d:95:1c:81: + af:e4:1c:e5:14:1e:f1:36:41:01:02:2f:7d:73:a7: + de:42:cc:4c:e9:89:0d:56:f7:9f:91:d4:03:c6:6c: + c9:8f:db:d8:1c:e0:40:98:5d:66:99:98:80:6e:2d: + ff:01:c5:ce:cb:46:1f:ac:02:c6:43:e6:ae:a2:84: + 3c:c5:4e:1e:3d:6d:c9:14:4c:e3:2e:41:bb:ca:39: + bf:36:3c:2a:19:aa:41:87:4e:a5:ce:4b:32:79:dd: + 90:49:7f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + keyid:9C:5F:D0:6C:63:A3:5F:93:CA:93:98:08:AD:8C:87:A5:2C:5C:C1:37 + + X509v3 Subject Key Identifier: + 9C:5F:D0:6C:63:A3:5F:93:CA:93:98:08:AD:8C:87:A5:2C:5C:C1:37 + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 4e:1e:b9:8a:c6:a0:98:3f:6e:c3:69:c0:6a:5c:49:52:ac:cb: + 2b:5d:78:38:c1:d5:54:84:9f:93:f0:87:19:3d:2c:66:89:eb: + 0d:42:fc:cc:f0:75:85:3f:8b:f4:80:5d:79:e5:17:67:bd:35: + 82:e2:f2:3c:8e:7d:5b:36:cb:5a:80:00:29:f2:ce:2b:2c:f1: + 8f:aa:6d:05:93:6c:72:c7:56:eb:df:50:23:28:e5:45:10:3d: + e8:67:a3:af:0e:55:0f:90:09:62:ef:4b:59:a2:f6:53:f1:c0: + 35:e4:2f:c1:24:bd:79:2f:4e:20:22:3b:fd:1a:20:b0:a4:0e: + 2c:70:ed:74:3f:b8:13:95:06:51:c8:e8:87:26:ca:a4:5b:6a: + 16:21:92:dd:73:60:9e:10:18:de:3c:81:ea:e8:18:c3:7c:89: + f2:8b:50:3e:bd:11:e2:15:03:a8:36:7d:33:01:6c:48:15:d7: + 88:90:99:04:c5:cc:e6:07:f4:bc:f4:90:ed:13:e2:ea:8b:c3: + 8f:a3:33:0f:c1:29:4c:13:4e:da:15:56:71:73:72:82:50:f6: + 9a:33:7c:a2:b1:a8:1a:34:74:65:5c:ce:d1:eb:ab:53:e0:1a: + 80:d8:ea:3a:49:e4:26:30:9b:e5:1c:8a:a8:a9:15:32:86:99: + 92:0a:10:23:56:12:e0:f6:ce:4c:e2:bb:be:db:8d:92:73:01: + 66:2f:62:3e:b2:72:27:45:36:ed:4d:56:e3:97:99:ff:3a:35: + 3e:a5:54:4a:52:59:4b:60:db:ee:fe:78:11:7f:4a:dc:14:79: + 60:b6:6b:64:03:db:15:83:e1:a2:be:f6:23:97:50:f0:09:33: + 36:a7:71:96:25:f3:b9:42:7d:db:38:3f:2c:58:ac:e8:42:e1: + 0e:d8:d3:3b:4c:2e:82:e9:83:2e:6b:31:d9:dd:47:86:4f:6d: + 97:91:2e:4f:e2:28:71:35:16:d1:f2:73:fe:25:2b:07:47:24: + 63:27:c8:f8:f6:d9:6b:fc:12:31:56:08:c0:53:42:af:9c:d0: + 33:7e:fc:06:f0:31:44:03:14:f1:58:ea:f2:6a:0d:a9:11:b2: + 83:be:c5:1a:bf:07:ea:59:dc:a3:88:35:ef:9c:76:32:3c:4d: + 06:22:ce:15:e5:dd:9e:d8:8f:da:de:d2:c4:39:e5:17:81:cf: + 38:47:eb:7f:88:6d:59:1b:df:9f:42:14:ae:7e:cf:a8:b0:66: + 65:da:37:af:9f:aa:3d:ea:28:b6:de:d5:31:58:16:82:5b:ea: + bb:19:75:02:73:1a:ca:48:1a:21:93:90:0a:8e:93:84:a7:7d: + 3b:23:18:92:89:a0:8d:ac +SHA1 Fingerprint=5B:6E:68:D0:CC:15:B6:A0:5F:1E:C1:5F:AE:02:FC:6B:2F:5D:6F:74 +-----BEGIN CERTIFICATE----- +MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV +BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk +YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV +BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN +MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF +UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD +VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v +dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj +cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q +yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH +2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX +H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL +zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR +p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz +W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ +SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn +LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 +n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B +u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj +o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L +9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej +rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK +pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 +vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq +OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ +/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 +2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI ++PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 +MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo +tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= +-----END CERTIFICATE----- diff --git a/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem b/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem index 6e7823d4b81f..7c971e1229a2 100644 --- a/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem +++ b/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/AffirmTrust_Commercial.pem b/secure/caroot/trusted/AffirmTrust_Commercial.pem index e0a8ebdf12e1..282d1a5dcf6f 100644 --- a/secure/caroot/trusted/AffirmTrust_Commercial.pem +++ b/secure/caroot/trusted/AffirmTrust_Commercial.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/AffirmTrust_Networking.pem b/secure/caroot/trusted/AffirmTrust_Networking.pem index a96b036f4153..830cf3f0c3c2 100644 --- a/secure/caroot/trusted/AffirmTrust_Networking.pem +++ b/secure/caroot/trusted/AffirmTrust_Networking.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/AffirmTrust_Premium.pem b/secure/caroot/trusted/AffirmTrust_Premium.pem index ee259e197476..725747aafdaf 100644 --- a/secure/caroot/trusted/AffirmTrust_Premium.pem +++ b/secure/caroot/trusted/AffirmTrust_Premium.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem b/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem index 5f600162a941..6fe75939863e 100644 --- a/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem +++ b/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_1.pem b/secure/caroot/trusted/Amazon_Root_CA_1.pem index 9221de0cea44..2aca2eee3e9b 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_1.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_1.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_2.pem b/secure/caroot/trusted/Amazon_Root_CA_2.pem index 418ffc0b8de0..95ca81db30bb 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_2.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_2.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## ## @generated ## diff --git a/secure/caroot/trusted/Amazon_Root_CA_3.pem b/secure/caroot/trusted/Amazon_Root_CA_3.pem index 36ff13dc4708..294f7dc8f0b6 100644 --- a/secure/caroot/trusted/Amazon_Root_CA_3.pem +++ b/secure/caroot/trusted/Amazon_Root_CA_3.pem @@ -5,8 +5,10 @@ ## Authority (CA). It was automatically extracted from Mozilla's ## root CA list (the file `certdata.txt' in security/nss). ## +## It contains a certificate trusted for server authentication. +## ## Extracted from nss -## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## with $FreeBSD$ ## *** 2334 LINES SKIPPED *** From nobody Wed Nov 3 20:54:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B7A14183C2A7; Wed, 3 Nov 2021 20:54: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 4HkzXn59SLz3pwC; Wed, 3 Nov 2021 20:54: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 D06331FB86; Wed, 3 Nov 2021 20:54: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 1A3KsW9f071542; Wed, 3 Nov 2021 20:54:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsWiP071541; Wed, 3 Nov 2021 20:54:32 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:32 GMT Message-Id: <202111032054.1A3KsWiP071541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: b13a6827931f - releng/12.2 - Fix kernel panic in vmci driver initialization. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.2 X-Git-Reftype: branch X-Git-Commit: b13a6827931f159ab616c5395bed207059347284 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=b13a6827931f159ab616c5395bed207059347284 commit b13a6827931f159ab616c5395bed207059347284 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:43:03 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:43:03 +0000 Fix kernel panic in vmci driver initialization. Approved by: so Security: EN-21:28.vmci --- sys/dev/vmware/vmci/vmci.c | 9 ++++--- sys/dev/vmware/vmci/vmci_event.c | 3 +++ sys/dev/vmware/vmci/vmci_kernel_if.c | 48 ++++++++++++++++++++++++++++++++++- sys/dev/vmware/vmci/vmci_kernel_if.h | 2 ++ sys/dev/vmware/vmci/vmci_queue_pair.c | 3 +++ 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c index dc029419e20d..90e28f95cc7a 100644 --- a/sys/dev/vmware/vmci/vmci.c +++ b/sys/dev/vmware/vmci/vmci.c @@ -233,8 +233,10 @@ vmci_detach(device_t dev) vmci_components_cleanup(); - taskqueue_drain(taskqueue_thread, &sc->vmci_delayed_work_task); - mtx_destroy(&sc->vmci_delayed_work_lock); + if mtx_initialized(&sc->vmci_spinlock) { + taskqueue_drain(taskqueue_thread, &sc->vmci_delayed_work_task); + mtx_destroy(&sc->vmci_delayed_work_lock); + } if (sc->vmci_res0 != NULL) bus_space_write_4(sc->vmci_iot0, sc->vmci_ioh0, @@ -245,7 +247,8 @@ vmci_detach(device_t dev) vmci_unmap_bars(sc); - mtx_destroy(&sc->vmci_spinlock); + if mtx_initialized(&sc->vmci_spinlock) + mtx_destroy(&sc->vmci_spinlock); pci_disable_busmaster(dev); diff --git a/sys/dev/vmware/vmci/vmci_event.c b/sys/dev/vmware/vmci/vmci_event.c index 9a932340a7b6..c34ff113978b 100644 --- a/sys/dev/vmware/vmci/vmci_event.c +++ b/sys/dev/vmware/vmci/vmci_event.c @@ -594,6 +594,9 @@ vmci_event_unregister_subscription(vmci_id sub_id) { struct vmci_subscription *s; + if (!vmci_initialized_lock(&subscriber_lock)) + return NULL; + vmci_grab_lock_bh(&subscriber_lock); s = vmci_event_find(sub_id); if (s != NULL) { diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.c b/sys/dev/vmware/vmci/vmci_kernel_if.c index 851c4c9df214..a550277500aa 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_if.c +++ b/sys/dev/vmware/vmci/vmci_kernel_if.c @@ -70,7 +70,8 @@ void vmci_cleanup_lock(vmci_lock *lock) { - mtx_destroy(lock); + if mtx_initialized(lock) + mtx_destroy(lock); } /* @@ -165,6 +166,29 @@ vmci_release_lock_bh(vmci_lock *lock) mtx_unlock(lock); } +/* + *------------------------------------------------------------------------------ + * + * vmci_initialized_lock + * + * Returns whether a lock has been initialized. + * + * Results: + * Return 1 if initialized or 0 if unininitialized. + * + * Side effects: + * None + * + *------------------------------------------------------------------------------ + */ + +int +vmci_initialized_lock(vmci_lock *lock) +{ + + return mtx_initialized(lock); +} + /* *------------------------------------------------------------------------------ * @@ -446,6 +470,28 @@ vmci_mutex_release(vmci_mutex *mutex) mtx_unlock(mutex); } +/* + *------------------------------------------------------------------------------ + * + * vmci_mutex_initialized + * + * Returns whether a mutex has been initialized. + * + * Results: + * Return 1 if initialized or 0 if unininitialized. + * + * Side effects: + * None + * + *------------------------------------------------------------------------------ + */ + +int +vmci_mutex_initialized(vmci_mutex *mutex) +{ + + return mtx_initialized(mutex); +} /* *------------------------------------------------------------------------------ * diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.h b/sys/dev/vmware/vmci/vmci_kernel_if.h index fc23eefe98e0..048e480b0698 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_if.h +++ b/sys/dev/vmware/vmci/vmci_kernel_if.h @@ -48,6 +48,7 @@ void vmci_grab_lock(vmci_lock *lock); void vmci_release_lock(vmci_lock *lock); void vmci_grab_lock_bh(vmci_lock *lock); void vmci_release_lock_bh(vmci_lock *lock); +int vmci_initialized_lock(vmci_lock *lock); void *vmci_alloc_kernel_mem(size_t size, int flags); void vmci_free_kernel_mem(void *ptr, size_t size); @@ -72,6 +73,7 @@ int vmci_mutex_init(vmci_mutex *mutex, char *name); void vmci_mutex_destroy(vmci_mutex *mutex); void vmci_mutex_acquire(vmci_mutex *mutex); void vmci_mutex_release(vmci_mutex *mutex); +int vmci_mutex_initialized(vmci_mutex *mutex); void *vmci_alloc_queue(uint64_t size, uint32_t flags); void vmci_free_queue(void *q, uint64_t size); diff --git a/sys/dev/vmware/vmci/vmci_queue_pair.c b/sys/dev/vmware/vmci/vmci_queue_pair.c index 65ae00c8d167..ebf2824f8d04 100644 --- a/sys/dev/vmware/vmci/vmci_queue_pair.c +++ b/sys/dev/vmware/vmci/vmci_queue_pair.c @@ -338,6 +338,9 @@ vmci_qp_guest_endpoints_exit(void) { struct qp_guest_endpoint *entry; + if (!vmci_mutex_initialized(&qp_guest_endpoints.mutex)) + return; + vmci_mutex_acquire(&qp_guest_endpoints.mutex); while ((entry = From nobody Wed Nov 3 20:54:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6860F183C38D; Wed, 3 Nov 2021 20:54: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 4HkzXp4Kbhz3q15; Wed, 3 Nov 2021 20:54: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 045561F661; Wed, 3 Nov 2021 20:54: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 1A3KsXfo071566; Wed, 3 Nov 2021 20:54:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsXDe071565; Wed, 3 Nov 2021 20:54:33 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:33 GMT Message-Id: <202111032054.1A3KsXDe071565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 1bb617ba2bb9 - releng/12.2 - Timezone database information update. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.2 X-Git-Reftype: branch X-Git-Commit: 1bb617ba2bb9ebdd79c5b0511e723535ba2f4fc2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=1bb617ba2bb9ebdd79c5b0511e723535ba2f4fc2 commit 1bb617ba2bb9ebdd79c5b0511e723535ba2f4fc2 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:46:24 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:46:24 +0000 Timezone database information update. Approved by: so Security: EN-21:29.tzdata --- contrib/tzdata/asia | 30 +++++++++++++++++++++++------- contrib/tzdata/australasia | 32 +++++++++++++++++++++++++------- contrib/tzdata/europe | 13 ++++++++----- contrib/tzdata/northamerica | 6 +++--- 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index ed944130e99f..ea59f5270b51 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -2234,6 +2234,14 @@ Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u # From Paul Eggert (2013-12-11): # As Steffen suggested, consider the past 21-month experiment to be DST. +# From Steffen Thorsen (2021-09-24): +# The Jordanian Government announced yesterday that they will start DST +# in February instead of March: +# https://petra.gov.jo/Include/InnerPage.jsp?ID=37683&lang=en&name=en_news (English) +# https://petra.gov.jo/Include/InnerPage.jsp?ID=189969&lang=ar&name=news (Arabic) +# From the Arabic version, it seems to say it would be at midnight +# (assume 24:00) on the last Thursday in February, starting from 2022. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Jordan 1973 only - Jun 6 0:00 1:00 S Rule Jordan 1973 1975 - Oct 1 0:00 0 - @@ -2264,8 +2272,9 @@ Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Sep lastFri 0:00s 0 - Rule Jordan 2006 2011 - Oct lastFri 0:00s 0 - Rule Jordan 2013 only - Dec 20 0:00 0 - -Rule Jordan 2014 max - Mar lastThu 24:00 1:00 S +Rule Jordan 2014 2021 - Mar lastThu 24:00 1:00 S Rule Jordan 2014 max - Oct lastFri 0:00s 0 - +Rule Jordan 2022 max - Feb lastThu 24:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT @@ -3379,11 +3388,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. # http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 -# From Tim Parenti (2020-10-20): -# Predict future fall transitions at 01:00 on the Saturday preceding October's -# last Sunday (i.e., Sat>=24). This is consistent with our predictions since -# 2016, although the time of the change differed slightly in 2019. - # From Pierre Cashon (2020-10-20): # The summer time this year started on March 28 at 00:00. # https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ @@ -3396,6 +3400,17 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # For now, guess spring-ahead transitions are at 00:00 on the Saturday # preceding March's last Sunday (i.e., Sat>=24). +# From P Chan (2021-10-18): +# http://wafa.ps/Pages/Details/34701 +# Palestine winter time will start from midnight 2021-10-29 (Thursday-Friday). +# +# From Heba Hemad, Palestine Ministry of Telecom & IT (2021-10-20): +# ... winter time will begin in Palestine from Friday 10-29, 01:00 AM +# by 60 minutes backwards. +# +# From Paul Eggert (2021-10-20): +# Guess future fall transitions on October's last Friday at 01:00. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3431,7 +3446,8 @@ Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - Rule Palestine 2019 only - Mar 29 0:00 1:00 S Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S -Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - +Rule Palestine 2020 only - Oct 24 1:00 0 - +Rule Palestine 2021 max - Oct lastFri 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index cf8a0638f831..eba0fad1c213 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -385,9 +385,22 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # "Minister for Employment, Parveen Bala says they had never thought of # stopping daylight saving. He says it was just to decide on when it should # start and end. Bala says it is a short period..." -# Since the end date is still in line with our ongoing predictions, assume for -# now that the later-than-usual start date is a one-time departure from the -# recent second Sunday in November pattern. +# +# From Tim Parenti (2021-10-11), per Jashneel Kumar (2021-10-11) and P Chan +# (2021-10-12): +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/PM-BAINIMARAMA-S-COVID-19-ANNOUNCEMENT-10-10-21 +# https://www.fbcnews.com.fj/news/covid-19/curfew-moved-back-to-11pm/ +# In a 2021-10-10 speech concerning updated Covid-19 mitigation measures in +# Fiji, prime minister Josaia Voreqe "Frank" Bainimarama announced the +# suspension of DST for the 2021/2022 season: "Given that we are in the process +# of readjusting in the midst of so many changes, we will also put Daylight +# Savings Time on hold for this year. It will also make the reopening of +# scheduled commercial air service much smoother if we don't have to be +# concerned shifting arrival and departure times, which may look like a simple +# thing but requires some significant logistical adjustments domestically and +# internationally." +# Assume for now that DST will resume with the recent pre-2020 rules for the +# 2022/2023 season. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -399,10 +412,11 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2015 2021 - Jan Sun>=12 3:00 0 - Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - -Rule Fiji 2021 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2022 max - Nov Sun>=8 2:00 1:00 - +Rule Fiji 2023 max - Jan Sun>=12 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 @@ -742,13 +756,17 @@ Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands # From Paul Eggert (2014-07-08): # That web page currently lists transitions for 2012/3 and 2013/4. # Assume the pattern instituted in 2012 will continue indefinitely. +# +# From Geoffrey D. Bennett (2021-09-20): +# https://www.mcil.gov.ws/storage/2021/09/MCIL-Scan_20210920_120553.pdf +# DST has been cancelled for this year. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule WS 2010 only - Sep lastSun 0:00 1 - Rule WS 2011 only - Apr Sat>=1 4:00 0 - Rule WS 2011 only - Sep lastSat 3:00 1 - -Rule WS 2012 max - Apr Sun>=1 4:00 0 - -Rule WS 2012 max - Sep lastSun 3:00 1 - +Rule WS 2012 2021 - Apr Sun>=1 4:00 0 - +Rule WS 2012 2020 - Sep lastSun 3:00 1 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index bba4d5648228..d91e0ce5f8f7 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -822,7 +822,7 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. -# From Alois Triendl (2019-07-22): +# From Alois Treindl (2019-07-22): # In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. # Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. @@ -1736,19 +1736,22 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # -# From Alois Triendl (2019-07-02): +# From Alois Treindl (2019-07-02): # I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, # for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 # am, put forward the clock by one hour. Remember that in the night between # today and Monday the 'ora legale' will come in force again." That makes it # clear that in Rome the change was on Monday, 3 April 1944 at 2 am. # -# From Paul Eggert (2016-10-27): +# From Paul Eggert (2021-10-05): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. # Model Rome's occupation by using C-Eur rules from 1943-09-10 # to 1944-06-04; although Rome was an open city during this period, it -# was effectively controlled by Germany. +# was effectively controlled by Germany. Using C-Eur is consistent +# with Treindl's comment about Rome in April 1944, as the "Rule Italy" +# lines during German occupation do not affect Europe/Rome +# (though they do affect Europe/Malta). # # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Italy 1916 only - Jun 3 24:00 1:00 S @@ -2618,7 +2621,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Although Shanks lists 1945-01-01 as the date for transition from # +01/+02 to +02/+03, more likely this is a placeholder. Guess that # the transition occurred at 1945-04-10 00:00, which is about when -# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) +# Königsberg surrendered to Soviet troops. (Thanks to Alois Treindl.) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). diff --git a/contrib/tzdata/northamerica b/contrib/tzdata/northamerica index ddc575976e59..75e115418a1e 100644 --- a/contrib/tzdata/northamerica +++ b/contrib/tzdata/northamerica @@ -970,7 +970,7 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov 18 12:09:53 -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. -# From Alois Triendl (2019-07-09): +# From Alois Treindl (2019-07-09): # The Indianapolis News, Friday 27 October 1967 states that Perry County # returned to CST. It went again to EST on 27 April 1969, as documented by the # Indianapolis star of Saturday 26 April. @@ -1998,7 +1998,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep # Alberta -# From Alois Triendl (2019-07-19): +# From Alois Treindl (2019-07-19): # There was no DST in Alberta in 1967... Calgary Herald, 29 April 1967. # 1969, no DST, from Edmonton Journal 18 April 1969 # @@ -2107,7 +2107,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep # # From Paul Eggert (2019-07-25): # Shanks says Fort Nelson did not observe DST in 1946, unlike Vancouver. -# Alois Triendl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily +# Alois Treindl confirmed this on 07-22, citing the 1946-04-27 Vancouver Daily # Province. He also cited the 1946-09-28 Victoria Daily Times, which said # that Vancouver, Victoria, etc. "change at midnight Saturday"; for now, # guess they meant 02:00 Sunday since 02:00 was common practice in Vancouver. From nobody Wed Nov 3 20:54:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 037D8183C2C2; Wed, 3 Nov 2021 20:54: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 4HkzXq5gdvz3pwM; Wed, 3 Nov 2021 20:54: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 284EB1FA92; Wed, 3 Nov 2021 20:54: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 1A3KsZ3a071593; Wed, 3 Nov 2021 20:54:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KsZkx071592; Wed, 3 Nov 2021 20:54:35 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:54:35 GMT Message-Id: <202111032054.1A3KsZkx071592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 6be068e85747 - releng/12.2 - Add UPDATING entries and bump version. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.2 X-Git-Reftype: branch X-Git-Commit: 6be068e8574765c1aede3f004b9fa65d04fdc3a4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=6be068e8574765c1aede3f004b9fa65d04fdc3a4 commit 6be068e8574765c1aede3f004b9fa65d04fdc3a4 Author: Gordon Tetlow AuthorDate: 2021-11-03 20:53:20 +0000 Commit: Gordon Tetlow CommitDate: 2021-11-03 20:53:20 +0000 Add UPDATING entries and bump version. Approved by: so --- UPDATING | 10 ++++++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index d3ee5af37087..868e2106c692 100644 --- a/UPDATING +++ b/UPDATING @@ -16,6 +16,16 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20211103: p11 FreeBSD-EN-21:27.caroot + FreeBSD-EN-21:28.vmci + FreeBSD-EN-21:29.tzdata + + Root certificate bundle update. [EN-21:27.caroot] + + Fix kernel panic in vmci driver initialization. [EN-21:28.vmci] + + Timezone database information update. [EN-21:29.tzdata] + 20210824: p10 FreeBSD-EN-21:24.libcrypto FreeBSD-EN-21:25.bhyve FreeBSD-SA-21:13.bhyve diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index df86d0be3b91..50e4783dd221 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.2" -BRANCH="RELEASE-p10" +BRANCH="RELEASE-p11" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Wed Nov 3 20:55:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 05537183D2D2; Wed, 3 Nov 2021 20:55: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 4HkzYk0zqfz3qSh; Wed, 3 Nov 2021 20:55: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 C8C2B1FA94; Wed, 3 Nov 2021 20:55: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 1A3KtL9n071806; Wed, 3 Nov 2021 20:55:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3KtLQX071805; Wed, 3 Nov 2021 20:55:21 GMT (envelope-from git) Date: Wed, 3 Nov 2021 20:55:21 GMT Message-Id: <202111032055.1A3KtLQX071805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 589aed00e36c - main - sched: separate out schedinit_ap() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 589aed00e36c22733d3fd9c9016deccf074830b1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=589aed00e36c22733d3fd9c9016deccf074830b1 commit 589aed00e36c22733d3fd9c9016deccf074830b1 Author: Kyle Evans AuthorDate: 2021-11-02 18:06:47 +0000 Commit: Kyle Evans CommitDate: 2021-11-03 20:54:59 +0000 sched: separate out schedinit_ap() schedinit_ap() sets up an AP for a later call to sched_throw(NULL). Currently, ULE sets up some pcpu bits and fixes the idlethread lock with a call to sched_throw(NULL); this results in a window where curthread is setup in platforms' init_secondary(), but it has the wrong td_lock. Typical platform AP startup procedure looks something like: - Setup curthread - ... other stuff, including cpu_initclocks_ap() - Signal smp_started - sched_throw(NULL) to enter the scheduler cpu_initclocks_ap() may have callouts to process (e.g., nvme) and attempt to sched_add() for this AP, but this attempt fails because of the noted violated assumption leading to locking heartburn in sched_setpreempt(). Interrupts are still disabled until cpu_throw() so we're not really at risk of being preempted -- just let the scheduler in on it a little earlier as part of setting up curthread. Reviewed by: alfredo, kib, markj Triage help from: andrew, markj Smoke-tested by: alfredo (ppc), kevans (arm64, x86), mhorne (arm) Differential Revision: https://reviews.freebsd.org/D32797 --- sys/arm/arm/mp_machdep.c | 1 + sys/arm64/arm64/mp_machdep.c | 1 + sys/kern/sched_4bsd.c | 7 +++++++ sys/kern/sched_ule.c | 29 ++++++++++++++++++++++------- sys/mips/mips/mp_machdep.c | 1 + sys/powerpc/aim/mp_cpudep.c | 2 ++ sys/powerpc/booke/mp_cpudep.c | 2 ++ sys/riscv/riscv/mp_machdep.c | 1 + sys/sys/sched.h | 5 +++++ sys/x86/x86/mp_x86.c | 1 + 10 files changed, 43 insertions(+), 7 deletions(-) diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c index 6368f7b72da9..4089af5929eb 100644 --- a/sys/arm/arm/mp_machdep.c +++ b/sys/arm/arm/mp_machdep.c @@ -182,6 +182,7 @@ init_secondary(int cpu) pc->pc_curthread = pc->pc_idlethread; pc->pc_curpcb = pc->pc_idlethread->td_pcb; set_curthread(pc->pc_idlethread); + schedinit_ap(); #ifdef VFP vfp_init(); #endif diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 15e05ef46262..b42f65b9e399 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -255,6 +255,7 @@ init_secondary(uint64_t cpu) /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pcpup->pc_curthread = pcpup->pc_idlethread; + schedinit_ap(); /* Initialize curpmap to match TTBR0's current setting. */ pmap0 = vmspace_pmap(&vmspace0); diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index ddd65b94f0ff..6ba41eb80dcc 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -678,6 +678,13 @@ schedinit(void) mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN); } +void +schedinit_ap(void) +{ + + /* Nothing needed. */ +} + int sched_runnable(void) { diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 1b9473b93773..ce7ce4cd2bd8 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1743,6 +1743,26 @@ schedinit(void) ts0->ts_cpu = curcpu; /* set valid CPU number */ } +/* + * schedinit_ap() is needed prior to calling sched_throw(NULL) to ensure that + * the pcpu requirements are met for any calls in the period between curthread + * initialization and sched_throw(). One can safely add threads to the queue + * before sched_throw(), for instance, as long as the thread lock is setup + * correctly. + * + * TDQ_SELF() relies on the below sched pcpu setting; it may be used only + * after schedinit_ap(). + */ +void +schedinit_ap(void) +{ + +#ifdef SMP + PCPU_SET(sched, DPCPU_PTR(tdq)); +#endif + PCPU_GET(idlethread)->td_lock = TDQ_LOCKPTR(TDQ_SELF()); +} + /* * This is only somewhat accurate since given many processes of the same * priority they will switch when their slices run out, which will be @@ -2973,19 +2993,14 @@ sched_throw(struct thread *td) struct thread *newtd; struct tdq *tdq; + tdq = TDQ_SELF(); if (__predict_false(td == NULL)) { -#ifdef SMP - PCPU_SET(sched, DPCPU_PTR(tdq)); -#endif - /* Correct spinlock nesting and acquire the correct lock. */ - tdq = TDQ_SELF(); TDQ_LOCK(tdq); + /* Correct spinlock nesting. */ spinlock_exit(); PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); - PCPU_GET(idlethread)->td_lock = TDQ_LOCKPTR(tdq); } else { - tdq = TDQ_SELF(); THREAD_LOCK_ASSERT(td, MA_OWNED); THREAD_LOCKPTR_ASSERT(td, TDQ_LOCKPTR(tdq)); tdq_load_rem(tdq, td); diff --git a/sys/mips/mips/mp_machdep.c b/sys/mips/mips/mp_machdep.c index 1a5a023db381..dc089db1d189 100644 --- a/sys/mips/mips/mp_machdep.c +++ b/sys/mips/mips/mp_machdep.c @@ -311,6 +311,7 @@ smp_init_secondary(u_int32_t cpuid) /* Initialize curthread. */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); PCPU_SET(curthread, PCPU_GET(idlethread)); + schedinit_ap(); mtx_lock_spin(&ap_boot_mtx); diff --git a/sys/powerpc/aim/mp_cpudep.c b/sys/powerpc/aim/mp_cpudep.c index 33aae520c4b2..a73246487683 100644 --- a/sys/powerpc/aim/mp_cpudep.c +++ b/sys/powerpc/aim/mp_cpudep.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -134,6 +135,7 @@ cpudep_ap_bootstrap(void) #endif pcpup->pc_curpcb = pcpup->pc_curthread->td_pcb; sp = pcpup->pc_curpcb->pcb_sp; + schedinit_ap(); return (sp); } diff --git a/sys/powerpc/booke/mp_cpudep.c b/sys/powerpc/booke/mp_cpudep.c index c07e8c06ce05..709578d8e1b4 100644 --- a/sys/powerpc/booke/mp_cpudep.c +++ b/sys/powerpc/booke/mp_cpudep.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -85,6 +86,7 @@ cpudep_ap_bootstrap() #endif pcpup->pc_curpcb = pcpup->pc_curthread->td_pcb; sp = pcpup->pc_curpcb->pcb_sp; + schedinit_ap(); /* XXX shouldn't the pcb_sp be checked/forced for alignment here?? */ diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index 1dadf19ce51f..57d5606a3b88 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -248,6 +248,7 @@ init_secondary(uint64_t hart) /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pcpup->pc_curthread = pcpup->pc_idlethread; + schedinit_ap(); /* * Identify current CPU. This is necessary to setup diff --git a/sys/sys/sched.h b/sys/sys/sched.h index 64651ffa9c90..8041a2bc12d4 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -226,6 +226,11 @@ SYSINIT(name, SI_SUB_LAST, SI_ORDER_MIDDLE, name ## _add_proc, NULL); * Fixup scheduler state for proc0 and thread0 */ void schedinit(void); + +/* + * Fixup scheduler state for secondary APs + */ +void schedinit_ap(void); #endif /* _KERNEL */ /* POSIX 1003.1b Process Scheduling */ diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index ca1125886619..1fac244cbed7 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1040,6 +1040,7 @@ init_secondary_tail(void) /* Initialize curthread. */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); PCPU_SET(curthread, PCPU_GET(idlethread)); + schedinit_ap(); mtx_lock_spin(&ap_boot_mtx); From nobody Wed Nov 3 21:29:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3EA39182E38A; Wed, 3 Nov 2021 21:29: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 4Hl0KB12cKz4Zhc; Wed, 3 Nov 2021 21:29: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 F20AC20115; Wed, 3 Nov 2021 21:29: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 1A3LTXfr012912; Wed, 3 Nov 2021 21:29:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3LTXJg012911; Wed, 3 Nov 2021 21:29:33 GMT (envelope-from git) Date: Wed, 3 Nov 2021 21:29:33 GMT Message-Id: <202111032129.1A3LTXJg012911@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: 6b67753488cb - main - nfscl: Fix forced dismount from looping on commit List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6b67753488cb506f05694c5f6d2e74cf53497c54 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=6b67753488cb506f05694c5f6d2e74cf53497c54 commit 6b67753488cb506f05694c5f6d2e74cf53497c54 Author: Rick Macklem AuthorDate: 2021-11-03 21:25:44 +0000 Commit: Rick Macklem CommitDate: 2021-11-03 21:25:44 +0000 nfscl: Fix forced dismount from looping on commit When a forced dismount is in progress, it is possible to end up looping, retrying commits that fail. This patch fixes the problem by pretending that commits succeeded when a forced dismount is in prgress. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clbio.c | 2 +- sys/fs/nfsclient/nfs_clvnops.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 250d01d88948..73f559ad82f8 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -1738,7 +1738,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td, off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff; retv = ncl_commit(vp, off, bp->b_dirtyend-bp->b_dirtyoff, bp->b_wcred, td); - if (retv == 0) { + if (NFSCL_FORCEDISM(vp->v_mount) || retv == 0) { bp->b_dirtyoff = bp->b_dirtyend = 0; bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); bp->b_resid = 0; diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 1685edf5b2de..abccf82e3ff0 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3067,7 +3067,7 @@ again: for (i = 0; i < bvecpos; i++) { bp = bvec[i]; bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); - if (retv) { + if (!NFSCL_FORCEDISM(vp->v_mount) && retv) { /* * Error, leave B_DELWRI intact */ From nobody Wed Nov 3 22:04:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1ED1A183E12E; Wed, 3 Nov 2021 22:04: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 4Hl15F0KRDz4lmv; Wed, 3 Nov 2021 22:04: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 E083E20927; Wed, 3 Nov 2021 22:04: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 1A3M4G16066311; Wed, 3 Nov 2021 22:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3M4Gjj066310; Wed, 3 Nov 2021 22:04:16 GMT (envelope-from git) Date: Wed, 3 Nov 2021 22:04:16 GMT Message-Id: <202111032204.1A3M4Gjj066310@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: 072d5b98c431 - main - sysbeep: Adjust interface to take a duration as a sbt List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 072d5b98c4318e20248a6fbea4a5ca7c96992cac Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=072d5b98c4318e20248a6fbea4a5ca7c96992cac commit 072d5b98c4318e20248a6fbea4a5ca7c96992cac Author: Warner Losh AuthorDate: 2021-11-03 21:55:32 +0000 Commit: Warner Losh CommitDate: 2021-11-03 22:03:51 +0000 sysbeep: Adjust interface to take a duration as a sbt Change the 'period' argument to 'duration' and change its type to sbintime_t so we can more easily express different durations. Reviewed by: tsoome, glebius Differential Revision: https://reviews.freebsd.org/D32619 --- sys/dev/mlx/mlx.c | 6 +++--- sys/dev/syscons/syscons.c | 7 ++++++- sys/dev/vt/vt_core.c | 8 ++++---- sys/i386/i386/trap.c | 4 ++-- sys/kern/kern_cons.c | 13 +++++++------ sys/sys/systm.h | 2 +- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index bafd0902e09a..f5b023eafc9c 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -1083,7 +1083,7 @@ mlx_periodic(void *data) mlx_pause_action(sc); /* pause is running */ sc->mlx_pause.mp_when = 0; - sysbeep(500, hz); + sysbeep(500, SBT_1S); /* * Bus pause still running? @@ -1095,9 +1095,9 @@ mlx_periodic(void *data) if (time_second >= sc->mlx_pause.mp_howlong) { mlx_pause_action(sc); sc->mlx_pause.mp_which = 0; /* pause is complete */ - sysbeep(500, hz); + sysbeep(500, SBT_1S); } else { - sysbeep((time_second % 5) * 100 + 500, hz/8); + sysbeep((time_second % 5) * 100 + 500, SBT_1S / 8); } /* diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 6a389604d3ab..6c349668410d 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -4258,6 +4258,11 @@ sc_respond(scr_stat *scp, const u_char *p, int count, int wakeup) } } +/* + * pitch is the divisor for 1.193182MHz PIT clock. By dividing 1193172 / pitch, + * we convert it back to Hz. + * duration is in ticks of 1/hz. + */ void sc_bell(scr_stat *scp, int pitch, int duration) { @@ -4277,7 +4282,7 @@ sc_bell(scr_stat *scp, int pitch, int duration) } else if (duration != 0 && pitch != 0) { if (scp != scp->sc->cur_scp) pitch *= 2; - sysbeep(1193182 / pitch, duration); + sysbeep(1193182 / pitch, SBT_1S * duration / hz); } } diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 075b23597f68..567cdd2890d5 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -118,8 +118,8 @@ const struct terminal_class vt_termclass = { #define VT_TIMERFREQ 25 /* Bell pitch/duration. */ -#define VT_BELLDURATION ((5 * hz + 99) / 100) -#define VT_BELLPITCH 800 +#define VT_BELLDURATION (SBT_1S / 20) +#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */ #define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS + \ (vw)->vw_number) @@ -1100,7 +1100,7 @@ vtterm_bell(struct terminal *tm) if (vd->vd_flags & VDF_QUIET_BELL) return; - sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); + sysbeep(VT_BELLPITCH, VT_BELLDURATION); } static void @@ -1116,7 +1116,7 @@ vtterm_beep(struct terminal *tm, u_int param) return; } - period = ((param >> 16) & 0xffff) * hz / 1000; + period = ((param >> 16) & 0xffff) * SBT_1MS; freq = 1193182 / (param & 0xffff); sysbeep(freq, period); diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 07abac23c9da..d770cf808f5f 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -414,7 +414,7 @@ user_trctrap_out: #endif if (time_second - lastalert > 10) { log(LOG_WARNING, "NMI: power fail\n"); - sysbeep(880, hz); + sysbeep(880, SBT_1S); lastalert = time_second; } return; @@ -671,7 +671,7 @@ kernel_trctrap: #ifdef POWERFAIL_NMI if (time_second - lastalert > 10) { log(LOG_WARNING, "NMI: power fail\n"); - sysbeep(880, hz); + sysbeep(880, SBT_1S); lastalert = time_second; } return; diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c index 780fce00387d..d33811f1e3c8 100644 --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -658,7 +658,7 @@ constty_timeout(void *arg) #ifdef HAS_TIMER_SPKR -static int beeping; +static bool beeping; static struct callout beeping_timer; static void @@ -666,11 +666,11 @@ sysbeepstop(void *chan) { timer_spkr_release(); - beeping = 0; + beeping = false; } int -sysbeep(int pitch, int period) +sysbeep(int pitch, sbintime_t duration) { if (timer_spkr_acquire()) { @@ -681,8 +681,9 @@ sysbeep(int pitch, int period) } timer_spkr_setfreq(pitch); if (!beeping) { - beeping = period; - callout_reset(&beeping_timer, period, sysbeepstop, NULL); + beeping = true; + callout_reset_sbt(&beeping_timer, duration, 0, sysbeepstop, + NULL, C_PREL(5)); } return (0); } @@ -701,7 +702,7 @@ SYSINIT(sysbeep, SI_SUB_SOFTINTR, SI_ORDER_ANY, sysbeep_init, NULL); */ int -sysbeep(int pitch __unused, int period __unused) +sysbeep(int pitch __unused, sbintime_t duration __unused) { return (ENODEV); diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 497e09f86488..ffe014eb8b42 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -467,7 +467,7 @@ int SAN_INTERCEPTOR(casueword)(volatile u_long *p, u_long oldval, void realitexpire(void *); -int sysbeep(int hertz, int period); +int sysbeep(int hertz, sbintime_t duration); void hardclock(int cnt, int usermode); void hardclock_sync(int cpu); From nobody Wed Nov 3 22:04:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 818F8183E0D8; Wed, 3 Nov 2021 22:04: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 4Hl15G1zPsz4lsb; Wed, 3 Nov 2021 22:04: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 1897E20457; Wed, 3 Nov 2021 22:04: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 1A3M4HGq066335; Wed, 3 Nov 2021 22:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3M4HtB066334; Wed, 3 Nov 2021 22:04:17 GMT (envelope-from git) Date: Wed, 3 Nov 2021 22:04:17 GMT Message-Id: <202111032204.1A3M4HtB066334@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: 2533eca1c2b9 - main - vt(4): Connect to teken's TP_SETBELLPD List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 2533eca1c2b9d561c42d28bcb6f1c1c35562fbcc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2533eca1c2b9d561c42d28bcb6f1c1c35562fbcc commit 2533eca1c2b9d561c42d28bcb6f1c1c35562fbcc Author: Warner Losh AuthorDate: 2021-11-03 21:55:42 +0000 Commit: Warner Losh CommitDate: 2021-11-03 22:03:51 +0000 vt(4): Connect to teken's TP_SETBELLPD Add the glue needed to listen to TP_SETBELLPD which teken uses to inform its client drivers about the results of parsing \e[=;B. It converts these to a Hz value for the tone/pitch of the bell and a duration in ms. There's some loss of precision because in the escape seuquence is defined to be (1193182 / pitch) Hz and is in 10ms units. Also note that kbdcontrol also parses 'off' but then doesn't send the proper escape sequence, leading me to wonder if that's another bug since teken appears to parse that sequence properly and I've added code here to treat that as the same as quiet or disabled. In general, Hz from 100 to 2000 is good. Outside that range is possible, but even at 100Hz the square wave is starting to sound bad and above 2000Hz the speaker may not respond. Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32620 --- sys/dev/vt/vt.h | 2 ++ sys/dev/vt/vt_core.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 8a74fd97a4e0..5ba64388bd27 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -308,6 +308,8 @@ struct vt_window { struct vt_mode vw_smode; /* switch mode */ struct callout vw_proc_dead_timer; struct vt_window *vw_switch_to; + int vw_bell_pitch; /* (?) Bell pitch */ + sbintime_t vw_bell_duration; /* (?) Bell duration */ }; #define VT_AUTO 0 /* switching is automatic */ diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 567cdd2890d5..a197c8e8be68 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -257,6 +257,8 @@ static struct vt_window vt_conswindow = { .vw_terminal = &vt_consterm, .vw_kbdmode = K_XLATE, .vw_grabbed = 0, + .vw_bell_pitch = VT_BELLPITCH, + .vw_bell_duration = VT_BELLDURATION, }; struct terminal vt_consterm = { .tm_class = &vt_termclass, @@ -1100,7 +1102,11 @@ vtterm_bell(struct terminal *tm) if (vd->vd_flags & VDF_QUIET_BELL) return; - sysbeep(VT_BELLPITCH, VT_BELLDURATION); + if (vw->vw_bell_pitch == 0 || + vw->vw_bell_duration == 0) + return; + + sysbeep(vw->vw_bell_pitch, vw->vw_bell_duration); } static void @@ -1177,6 +1183,11 @@ vtterm_param(struct terminal *tm, int cmd, unsigned int arg) case TP_MOUSE: vw->vw_mouse_level = arg; break; + case TP_SETBELLPD: + vw->vw_bell_pitch = TP_SETBELLPD_PITCH(arg); + vw->vw_bell_duration = + TICKS_2_MSEC(TP_SETBELLPD_DURATION(arg)) * SBT_1MS; + break; } } From nobody Wed Nov 3 22:04:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E2421183E13C; Wed, 3 Nov 2021 22:04: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 4Hl15H3mJ2z4lqT; Wed, 3 Nov 2021 22:04: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 3A3B420458; Wed, 3 Nov 2021 22:04: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 1A3M4J6j066365; Wed, 3 Nov 2021 22:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3M4JLL066364; Wed, 3 Nov 2021 22:04:19 GMT (envelope-from git) Date: Wed, 3 Nov 2021 22:04:19 GMT Message-Id: <202111032204.1A3M4JLL066364@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: 4ac3d08a9693 - main - vt: Add devctl message for bells List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 4ac3d08a9693c27c1bd2ddd67b2808ac9e18f4c5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ac3d08a9693c27c1bd2ddd67b2808ac9e18f4c5 commit 4ac3d08a9693c27c1bd2ddd67b2808ac9e18f4c5 Author: Warner Losh AuthorDate: 2021-11-03 21:55:48 +0000 Commit: Warner Losh CommitDate: 2021-11-03 22:03:51 +0000 vt: Add devctl message for bells Generate VT events when the bell beeps. When coupled with disabling the bell,this allows custom bells to be rung when we'd otherwise beep. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D32656 --- sbin/devd/devd.conf.5 | 9 +++++++++ share/man/man4/vt.4 | 14 ++++++++++++++ sys/dev/vt/vt_core.c | 36 ++++++++++++++++++++++++++++++++---- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index f6579ac3f20f..887ce5ec9a3d 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -604,6 +604,15 @@ Notification of a filesystem being unmounted. .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" +.It Li VT Ta BELL Ta RING Ta +Notifcation that the console bell has run. +See +.Xr vt 4 +for details. +.El +.Pp +.Bl -column "System" "Subsystem" "1234567" -compact +.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li ZFS Ta ZFS Ta Ta Events about the ZFS subsystem. See diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 index 8584706dc1aa..d0672ff9e5a0 100644 --- a/share/man/man4/vt.4 +++ b/share/man/man4/vt.4 @@ -297,6 +297,20 @@ console fonts .It Pa /usr/share/vt/keymaps/*.kbd keyboard layouts .El +.Sh DEVCTL MESSAGES +.Bl -column "System" "Subsystem" "1234567" -compact +.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" +.It Li VT Ta BELL Ta RING Ta +Notifcation that the console bell has run. +.El +.Pp +.Bl -column "Variable" "Meaning" -compact +.Sy "Variable" Ta Sy "Meaning" +.It Li duration_ms Ta Length of time the bell was requested to ring in milliseconds. +.It Li enabled Ta true or false indicating whether or not the bell was enabled when rung. +.It Li hz Ta Tone that was requested in Hz. +.El +.Pp .Sh EXAMPLES This example changes the default color of normal text to green on a black background, or black on a green background when reversed. diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index a197c8e8be68..38efd1e5501c 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1090,12 +1092,35 @@ vt_allocate_keyboard(struct vt_device *vd) return (idx0); } +#define DEVCTL_LEN 64 +static void +vtterm_devctl(bool enabled, int hz, sbintime_t duration) +{ + struct sbuf sb; + char *buf; + + buf = malloc(DEVCTL_LEN, M_VT, M_NOWAIT); + if (buf == NULL) + return; + sbuf_new(&sb, buf, DEVCTL_LEN, SBUF_FIXEDLEN); + sbuf_printf(&sb, "enabled=%s hz=%d duration_ms=%d", + enabled ? "true" : "false", hz, (int)(duration / SBT_1MS)); + sbuf_finish(&sb); + if (sbuf_error(&sb) == 0) + devctl_notify("VT", "BELL", "RING", sbuf_data(&sb)); + sbuf_delete(&sb); + free(buf, M_VT); +} + static void vtterm_bell(struct terminal *tm) { struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; + vtterm_devctl(vt_enable_bell, vw->vw_bell_pitch, + vw->vw_bell_duration); + if (!vt_enable_bell) return; @@ -1112,10 +1137,8 @@ vtterm_bell(struct terminal *tm) static void vtterm_beep(struct terminal *tm, u_int param) { - u_int freq, period; - - if (!vt_enable_bell) - return; + u_int freq; + sbintime_t period; if ((param == 0) || ((param & 0xffff) == 0)) { vtterm_bell(tm); @@ -1125,6 +1148,11 @@ vtterm_beep(struct terminal *tm, u_int param) period = ((param >> 16) & 0xffff) * SBT_1MS; freq = 1193182 / (param & 0xffff); + vtterm_devctl(vt_enable_bell, freq, period); + + if (!vt_enable_bell) + return; + sysbeep(freq, period); } From nobody Wed Nov 3 22:04:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 27B8F183E1A7; Wed, 3 Nov 2021 22:04: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 4Hl15J4VpXz4lnQ; Wed, 3 Nov 2021 22:04: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 6B49920928; Wed, 3 Nov 2021 22:04: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 1A3M4KAl066390; Wed, 3 Nov 2021 22:04:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3M4K5R066389; Wed, 3 Nov 2021 22:04:20 GMT (envelope-from git) Date: Wed, 3 Nov 2021 22:04:20 GMT Message-Id: <202111032204.1A3M4K5R066389@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: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: ba48d52ca6c867559156dd916631f9ac47abe80f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba48d52ca6c867559156dd916631f9ac47abe80f commit ba48d52ca6c867559156dd916631f9ac47abe80f Author: Warner Losh AuthorDate: 2021-11-03 21:55:55 +0000 Commit: Warner Losh CommitDate: 2021-11-03 22:03:51 +0000 vt: Fix frequency calcuation for bell 386BSD provided a MD function sysbeep. This took two arguments (pitch and period). Pitch was jammed into the PIT's divisor directly (which means the argument was expected to sound a tone at '1193182 / pitch' Hz). FreeBSD inherited this interface. In commit e46598588587 (svn 177642, Mar 26 2008), phk changed this function to take a tone to sound in hz. He converted all in-tree instances of 1193182 / hz to just hz (and kept the few misguided folks that passed hz directly unchanged -- this was part of what motivated the change). He converted the places where we pre-computed the 8254 divisor from being pitch to 1193182 / pitch (since that converts the divisor to the frequency and the interfaces that were exposed to userland exposed it in these units in places, continuing the tradition inherited from SCO System V/386 Unix in spots). In 2009, Ed Shouten was contracted by the FreeBSD Foundation to write / finish newcons. This work was done in perforce and was imported into subversion in user/ed/newcons in revision 199072 (https://svnweb.freebsd.org/base?view=revision&revision=199072) which was later imported into FreeBSD by ray@ (Aleksandr Rybalko). From that earliest import into svn import to this date, we ring the bell with: sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); where VT_BELLPITCH was defined to be 800. This results in a bell frequency of 1491Hz, more or less today. This is similar to the frequency that syscons and pcvt used (1493Hz and 1500Hz respectively). This in turn was inherited from 386BSD, it seems, which used the hard coded value 0x31b which is 795 -> 1500Hz. This '800' was intended to be the bell tone (eg 800Hz) and this interface was one that wasn't converted. The most common terminal prior to the rise of PCs was the VT100, which had an approximately 800Hz bell. Ed Shouten has confirmed that the original intent was 800Hz and changing this was overlooked after the change to -current was made. This restors that original intent and makes the bell less obnoxious in the process. Reviewed by: des, adrian Differential Revision: https://reviews.freebsd.org/D32594 Sponsored by: Netflix --- sys/dev/vt/vt_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 38efd1e5501c..06f5827078ca 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -121,7 +121,7 @@ const struct terminal_class vt_termclass = { /* Bell pitch/duration. */ #define VT_BELLDURATION (SBT_1S / 20) -#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */ +#define VT_BELLPITCH 800 #define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS + \ (vw)->vw_number) From nobody Wed Nov 3 22:13:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 324DE1843A7E; Wed, 3 Nov 2021 22:13: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 4Hl1Hz0yZwz4r6x; Wed, 3 Nov 2021 22:13: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 019B420C8D; Wed, 3 Nov 2021 22:13: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 1A3MDYhG079540; Wed, 3 Nov 2021 22:13:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3MDYsI079539; Wed, 3 Nov 2021 22:13:34 GMT (envelope-from git) Date: Wed, 3 Nov 2021 22:13:34 GMT Message-Id: <202111032213.1A3MDYsI079539@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: cc48eb70d10d - main - vt: fix typo List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: cc48eb70d10da7310750930a153616f38afe28d6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cc48eb70d10da7310750930a153616f38afe28d6 commit cc48eb70d10da7310750930a153616f38afe28d6 Author: Warner Losh AuthorDate: 2021-11-03 22:12:55 +0000 Commit: Warner Losh CommitDate: 2021-11-03 22:12:55 +0000 vt: fix typo Notifcation -> Notification --- sbin/devd/devd.conf.5 | 2 +- share/man/man4/vt.4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index 887ce5ec9a3d..5c7d129a6054 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -605,7 +605,7 @@ Notification of a filesystem being unmounted. .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li VT Ta BELL Ta RING Ta -Notifcation that the console bell has run. +Notification that the console bell has run. See .Xr vt 4 for details. diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 index d0672ff9e5a0..1ed344237eb9 100644 --- a/share/man/man4/vt.4 +++ b/share/man/man4/vt.4 @@ -301,7 +301,7 @@ keyboard layouts .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li VT Ta BELL Ta RING Ta -Notifcation that the console bell has run. +Notification that the console bell has run. .El .Pp .Bl -column "Variable" "Meaning" -compact From nobody Wed Nov 3 22:22:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CAB65184885B; Wed, 3 Nov 2021 22:22: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 4Hl1VM5MLHz4ttL; Wed, 3 Nov 2021 22:22: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 97F2620CDA; Wed, 3 Nov 2021 22:22: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 1A3MMZkl092428; Wed, 3 Nov 2021 22:22:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3MMZbI092427; Wed, 3 Nov 2021 22:22:35 GMT (envelope-from git) Date: Wed, 3 Nov 2021 22:22:35 GMT Message-Id: <202111032222.1A3MMZbI092427@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: 80f21bb039ce - main - vt: fix git mismerge List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 80f21bb039cef279e50e1b791b2808b916009bf6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=80f21bb039cef279e50e1b791b2808b916009bf6 commit 80f21bb039cef279e50e1b791b2808b916009bf6 Author: Warner Losh AuthorDate: 2021-11-03 22:20:41 +0000 Commit: Warner Losh CommitDate: 2021-11-03 22:20:41 +0000 vt: fix git mismerge I made a mistaking in merging the final commits for the devctl changes. This adds the 'hushed' variable and has the correct dates for the manuals. Pointy hat to: imp --- sbin/devd/devd.conf.5 | 4 ++-- share/man/man4/vt.4 | 7 ++++--- sys/dev/vt/vt_core.c | 18 +++++++++++------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index 5c7d129a6054..dd9faa05c869 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -40,7 +40,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd June 23, 2021 +.Dd November 3, 2021 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -605,7 +605,7 @@ Notification of a filesystem being unmounted. .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li VT Ta BELL Ta RING Ta -Notification that the console bell has run. +Notification that the console bell has rung. See .Xr vt 4 for details. diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 index 1ed344237eb9..c31eae0ec274 100644 --- a/share/man/man4/vt.4 +++ b/share/man/man4/vt.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2020 +.Dd November 3, 2021 .Dt "VT" 4 .Os .Sh NAME @@ -301,13 +301,14 @@ keyboard layouts .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li VT Ta BELL Ta RING Ta -Notification that the console bell has run. +Notification that the console bell has rung. .El .Pp .Bl -column "Variable" "Meaning" -compact .Sy "Variable" Ta Sy "Meaning" .It Li duration_ms Ta Length of time the bell was requested to ring in milliseconds. -.It Li enabled Ta true or false indicating whether or not the bell was enabled when rung. +.It Li enabled Ta true or false indicating whether or not the bell was administratively enabled when rung. +.It Li hushed Ta true or false indicating whether or not the bell was quieted by the user when rung. .It Li hz Ta Tone that was requested in Hz. .El .Pp diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 06f5827078ca..0fab05ff4096 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -121,7 +121,7 @@ const struct terminal_class vt_termclass = { /* Bell pitch/duration. */ #define VT_BELLDURATION (SBT_1S / 20) -#define VT_BELLPITCH 800 +#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */ #define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS + \ (vw)->vw_number) @@ -1094,7 +1094,7 @@ vt_allocate_keyboard(struct vt_device *vd) #define DEVCTL_LEN 64 static void -vtterm_devctl(bool enabled, int hz, sbintime_t duration) +vtterm_devctl(bool enabled, bool hushed, int hz, sbintime_t duration) { struct sbuf sb; char *buf; @@ -1103,8 +1103,9 @@ vtterm_devctl(bool enabled, int hz, sbintime_t duration) if (buf == NULL) return; sbuf_new(&sb, buf, DEVCTL_LEN, SBUF_FIXEDLEN); - sbuf_printf(&sb, "enabled=%s hz=%d duration_ms=%d", - enabled ? "true" : "false", hz, (int)(duration / SBT_1MS)); + sbuf_printf(&sb, "enabled=%s hushed=%s hz=%d duration_ms=%d", + enabled ? "true" : "false", hushed ? "true" : "false", + hz, (int)(duration / SBT_1MS)); sbuf_finish(&sb); if (sbuf_error(&sb) == 0) devctl_notify("VT", "BELL", "RING", sbuf_data(&sb)); @@ -1118,8 +1119,8 @@ vtterm_bell(struct terminal *tm) struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; - vtterm_devctl(vt_enable_bell, vw->vw_bell_pitch, - vw->vw_bell_duration); + vtterm_devctl(vt_enable_bell, vd->vd_flags & VDF_QUIET_BELL, + vw->vw_bell_pitch, vw->vw_bell_duration); if (!vt_enable_bell) return; @@ -1139,6 +1140,8 @@ vtterm_beep(struct terminal *tm, u_int param) { u_int freq; sbintime_t period; + struct vt_window *vw = tm->tm_softc; + struct vt_device *vd = vw->vw_device; if ((param == 0) || ((param & 0xffff) == 0)) { vtterm_bell(tm); @@ -1148,7 +1151,8 @@ vtterm_beep(struct terminal *tm, u_int param) period = ((param >> 16) & 0xffff) * SBT_1MS; freq = 1193182 / (param & 0xffff); - vtterm_devctl(vt_enable_bell, freq, period); + vtterm_devctl(vt_enable_bell, vd->vd_flags & VDF_QUIET_BELL, + freq, period); if (!vt_enable_bell) return; From nobody Wed Nov 3 23:38:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7D36B1841A07; Wed, 3 Nov 2021 23:38: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 4Hl3B134H4z3lv0; Wed, 3 Nov 2021 23:38: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 45D0E21BB7; Wed, 3 Nov 2021 23:38: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 1A3NcXtL086194; Wed, 3 Nov 2021 23:38:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A3NcXe8086193; Wed, 3 Nov 2021 23:38:33 GMT (envelope-from git) Date: Wed, 3 Nov 2021 23:38:33 GMT Message-Id: <202111032338.1A3NcXe8086193@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: 9d63429fa163 - main - ssh: move common Makefile boilerplate to a new ssh.mk List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 9d63429fa16352f58037ac2aa6ddc734b25e8331 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9d63429fa16352f58037ac2aa6ddc734b25e8331 commit 9d63429fa16352f58037ac2aa6ddc734b25e8331 Author: Ed Maste AuthorDate: 2021-11-02 18:48:33 +0000 Commit: Ed Maste CommitDate: 2021-11-03 23:38:05 +0000 ssh: move common Makefile boilerplate to a new ssh.mk This moves SSHDIR and ssh_namespace.h handling to a common location, and will simplify future work such as adding U2F support (D32509). Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32808 --- secure/Makefile.inc | 6 ------ secure/lib/libssh/Makefile | 4 +--- secure/libexec/sftp-server/Makefile | 3 +-- secure/libexec/ssh-keysign/Makefile | 3 +-- secure/libexec/ssh-pkcs11-helper/Makefile | 3 +-- secure/ssh.mk | 6 ++++++ secure/usr.bin/scp/Makefile | 3 +-- secure/usr.bin/sftp/Makefile | 3 +-- secure/usr.bin/ssh-add/Makefile | 3 +-- secure/usr.bin/ssh-agent/Makefile | 3 +-- secure/usr.bin/ssh-keygen/Makefile | 3 +-- secure/usr.bin/ssh-keyscan/Makefile | 3 +-- secure/usr.bin/ssh/Makefile | 4 +--- secure/usr.sbin/sshd/Makefile | 3 +-- 14 files changed, 18 insertions(+), 32 deletions(-) diff --git a/secure/Makefile.inc b/secure/Makefile.inc index 6c298be0223f..5de6eed37faf 100644 --- a/secure/Makefile.inc +++ b/secure/Makefile.inc @@ -1,15 +1,9 @@ # $FreeBSD$ -.include - .if exists(${.CURDIR:H:H}/lib/libcrypt/obj) CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt/obj .else CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt .endif -.if ${MK_OPENSSH} != "no" -SSHDIR= ${SRCTOP}/crypto/openssh -.endif - WARNS?= 0 diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index 49b5319d2b54..f6ea5c211a03 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" LIB= ssh PRIVATELIB= true @@ -50,9 +51,6 @@ SRCS+= getrrsetbyname-ldns.c LIBADD+= ldns .endif -CFLAGS+= -I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - .if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" CFLAGS+= -include krb5_config.h SRCS+= krb5_config.h diff --git a/secure/libexec/sftp-server/Makefile b/secure/libexec/sftp-server/Makefile index 24d675e0cf16..97408d332d34 100644 --- a/secure/libexec/sftp-server/Makefile +++ b/secure/libexec/sftp-server/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp-server SRCS= sftp-server.c sftp-common.c sftp-server-main.c MAN= sftp-server.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/libexec/ssh-keysign/Makefile b/secure/libexec/ssh-keysign/Makefile index e3fc51c66432..72acf1c2d75e 100644 --- a/secure/libexec/ssh-keysign/Makefile +++ b/secure/libexec/ssh-keysign/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keysign SRCS= ssh-keysign.c readconf.c uidswap.c MAN= ssh-keysign.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h BINMODE=4555 LIBADD= ssh diff --git a/secure/libexec/ssh-pkcs11-helper/Makefile b/secure/libexec/ssh-pkcs11-helper/Makefile index 19e114be935d..c4ae4f503197 100644 --- a/secure/libexec/ssh-pkcs11-helper/Makefile +++ b/secure/libexec/ssh-pkcs11-helper/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-pkcs11-helper SRCS= ssh-pkcs11.c ssh-pkcs11-helper.c MAN= ssh-pkcs11-helper.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/ssh.mk b/secure/ssh.mk new file mode 100644 index 000000000000..4ab8cd399ae8 --- /dev/null +++ b/secure/ssh.mk @@ -0,0 +1,6 @@ +# Common Make variables for OpenSSH + +SSHDIR= ${SRCTOP}/crypto/openssh + +CFLAGS+= -I${SSHDIR} -include ssh_namespace.h +SRCS+= ssh_namespace.h diff --git a/secure/usr.bin/scp/Makefile b/secure/usr.bin/scp/Makefile index a4e55c1bf86b..c071f5198902 100644 --- a/secure/usr.bin/scp/Makefile +++ b/secure/usr.bin/scp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= scp SRCS= scp.c sftp-common.c sftp-client.c sftp-glob.c progressmeter.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/sftp/Makefile b/secure/usr.bin/sftp/Makefile index 249fef233d37..868f7a23bfde 100644 --- a/secure/usr.bin/sftp/Makefile +++ b/secure/usr.bin/sftp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp SRCS= sftp.c sftp-client.c sftp-common.c sftp-glob.c progressmeter.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh edit diff --git a/secure/usr.bin/ssh-add/Makefile b/secure/usr.bin/ssh-add/Makefile index c76e50a4a91a..162ea60a29d0 100644 --- a/secure/usr.bin/ssh-add/Makefile +++ b/secure/usr.bin/ssh-add/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-add SRCS+= ssh-add.c ssh-sk-client.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-agent/Makefile b/secure/usr.bin/ssh-agent/Makefile index 95ccd05811fe..c8139ec376c3 100644 --- a/secure/usr.bin/ssh-agent/Makefile +++ b/secure/usr.bin/ssh-agent/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-agent SRCS= ssh-agent.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keygen/Makefile b/secure/usr.bin/ssh-keygen/Makefile index eec0b23e1b3f..b53b645e8576 100644 --- a/secure/usr.bin/ssh-keygen/Makefile +++ b/secure/usr.bin/ssh-keygen/Makefile @@ -1,13 +1,12 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keygen # XXX ssh-sk-client.c in libssh maybe? SRCS= ssh-keygen.c sshsig.c ssh-sk-client.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keyscan/Makefile b/secure/usr.bin/ssh-keyscan/Makefile index ade1e4237ff5..130e5f61ec64 100644 --- a/secure/usr.bin/ssh-keyscan/Makefile +++ b/secure/usr.bin/ssh-keyscan/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keyscan SRCS= ssh-keyscan.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile index 614cc7627fc5..5528aceed5ee 100644 --- a/secure/usr.bin/ssh/Makefile +++ b/secure/usr.bin/ssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= ssh_config CONFSDIR= /etc/ssh @@ -16,9 +17,6 @@ SRCS= ssh.c readconf.c clientloop.c sshtty.c \ # gss-genr.c really belongs in libssh; see src/secure/lib/libssh/Makefile SRCS+= gss-genr.c -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - LIBADD= ssh .if ${MK_LDNS} != "no" diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile index b374e737a139..a34732f868c7 100644 --- a/secure/usr.sbin/sshd/Makefile +++ b/secure/usr.sbin/sshd/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= moduli sshd_config CONFSDIR= /etc/ssh @@ -25,8 +26,6 @@ PACKAGE= ssh SRCS+= gss-genr.c MAN= sshd.8 sshd_config.5 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h # Don't rebuild based on moduli.c moduli: .MADE From nobody Thu Nov 4 00:32:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B6EA8183A6A1; Thu, 4 Nov 2021 00:32: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 4Hl4Nb4lKdz4WTb; Thu, 4 Nov 2021 00:32: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 8322022A90; Thu, 4 Nov 2021 00:32: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 1A40Wllp066175; Thu, 4 Nov 2021 00:32:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A40WlMg066174; Thu, 4 Nov 2021 00:32:47 GMT (envelope-from git) Date: Thu, 4 Nov 2021 00:32:47 GMT Message-Id: <202111040032.1A40WlMg066174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 34d8fffff313 - main - SIFTR: Fix compilation with -DSIFTR_IPV6 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34d8fffff313d026ed3bb5c0befc8212eaa27d2d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=34d8fffff313d026ed3bb5c0befc8212eaa27d2d commit 34d8fffff313d026ed3bb5c0befc8212eaa27d2d Author: Allan Jude AuthorDate: 2021-11-04 00:31:13 +0000 Commit: Allan Jude CommitDate: 2021-11-04 00:32:17 +0000 SIFTR: Fix compilation with -DSIFTR_IPV6 A few pieces of the SIFTR code that are behind #ifdef SIFTR_IPV6 have not been updated as APIs have changed, etc. Reported by: Alexander Sideropoulos Reviewed by: rscheff, lstewart Sponsored by: NetApp Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D32698 --- sys/netinet/siftr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index 2a6bf5e71151..00a4f477ad2e 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -99,7 +99,7 @@ __FBSDID("$FreeBSD$"); #ifdef SIFTR_IPV6 #include -#include +#include #include #endif /* SIFTR_IPV6 */ @@ -1007,8 +1007,9 @@ ret: } #ifdef SIFTR_IPV6 -static int -siftr_chkpkt6(struct mbuf **m, struct ifnet *ifp, int flags, struct inpcb *inp) +static pfil_return_t +siftr_chkpkt6(struct mbuf **m, struct ifnet *ifp, int flags, + void *ruleset __unused, struct inpcb *inp) { struct pkt_node *pn; struct ip6_hdr *ip6; @@ -1134,7 +1135,7 @@ ret6: VNET_DEFINE_STATIC(pfil_hook_t, siftr_inet_hook); #define V_siftr_inet_hook VNET(siftr_inet_hook) -#ifdef INET6 +#ifdef SIFTR_IPV6 VNET_DEFINE_STATIC(pfil_hook_t, siftr_inet6_hook); #define V_siftr_inet6_hook VNET(siftr_inet6_hook) #endif From nobody Thu Nov 4 00:42:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8693C183DEE0; Thu, 4 Nov 2021 00:42: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 4Hl4bM3Q6Lz4Yvf; Thu, 4 Nov 2021 00:42: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 56F9A22476; Thu, 4 Nov 2021 00:42: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 1A40g7Q0076066; Thu, 4 Nov 2021 00:42:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A40g7wd076065; Thu, 4 Nov 2021 00:42:07 GMT (envelope-from git) Date: Thu, 4 Nov 2021 00:42:07 GMT Message-Id: <202111040042.1A40g7wd076065@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: 70cb6c34bb52 - stable/13 - Force WITHOUT_OPENSSL_KTLS off when WITHOUT_OPENSSL List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 70cb6c34bb52b9ce05def5d2ef6a8a49b2362348 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=70cb6c34bb52b9ce05def5d2ef6a8a49b2362348 commit 70cb6c34bb52b9ce05def5d2ef6a8a49b2362348 Author: Ed Maste AuthorDate: 2021-10-28 21:07:34 +0000 Commit: Ed Maste CommitDate: 2021-11-04 00:41:11 +0000 Force WITHOUT_OPENSSL_KTLS off when WITHOUT_OPENSSL Discussed with: jhb MFC after: 1 week Reported by: Michael Dexter, Build Option Survey Sponsored by: The FreeBSD Foundation (cherry picked from commit 6940d0e4703e72b8ea445541567d0ef64c2bb94b) --- share/mk/src.opts.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index fa007cb4bfda..9c1138a446ca 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -424,6 +424,7 @@ MK_NLS_CATALOGS:= no .if ${MK_OPENSSL} == "no" MK_DMAGENT:= no MK_OPENSSH:= no +MK_OPENSSL_KTLS:= no MK_KERBEROS:= no MK_KERBEROS_SUPPORT:= no MK_LDNS:= no From nobody Thu Nov 4 00:55:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 24686184427B; Thu, 4 Nov 2021 00:55: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 4Hl4vK0Vzxz4f20; Thu, 4 Nov 2021 00:55: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 E531322BCE; Thu, 4 Nov 2021 00:55: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 1A40tuCv092783; Thu, 4 Nov 2021 00:55:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A40tuiE092782; Thu, 4 Nov 2021 00:55:56 GMT (envelope-from git) Date: Thu, 4 Nov 2021 00:55:56 GMT Message-Id: <202111040055.1A40tuiE092782@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: 7ac82c96fe79 - main - proc_get_binpath(): provide syntaxically correct value for unused NDINIT arg List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 7ac82c96fe79a6a9dcf595ef4860ed75d3511414 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7ac82c96fe79a6a9dcf595ef4860ed75d3511414 commit 7ac82c96fe79a6a9dcf595ef4860ed75d3511414 Author: Konstantin Belousov AuthorDate: 2021-11-04 00:53:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-04 00:55:33 +0000 proc_get_binpath(): provide syntaxically correct value for unused NDINIT arg Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/kern_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index d11f651960c0..21af09265dd2 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2276,7 +2276,7 @@ proc_get_binpath(struct proc *p, char *binname, char **retbuf, * which case we should not report old name. */ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf, - req->td); + curthread); error = namei(&nd); if (error == 0) { if (nd.ni_vp == vp) From nobody Thu Nov 4 01:07:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 50018184A0F0; Thu, 4 Nov 2021 01:07: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 4Hl58g1n64z4j3R; Thu, 4 Nov 2021 01:07: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 18FB923083; Thu, 4 Nov 2021 01:07: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 1A417U7Z007554; Thu, 4 Nov 2021 01:07:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A417UqP007553; Thu, 4 Nov 2021 01:07:30 GMT (envelope-from git) Date: Thu, 4 Nov 2021 01:07:30 GMT Message-Id: <202111040107.1A417UqP007553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: aab2bfc1274f - releng/12.3 - 12.3: update to BETA3 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: aab2bfc1274f4eebefac44f86cc7ee79bf5121a8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=aab2bfc1274f4eebefac44f86cc7ee79bf5121a8 commit aab2bfc1274f4eebefac44f86cc7ee79bf5121a8 Author: Glen Barber AuthorDate: 2021-11-04 01:07:01 +0000 Commit: Glen Barber CommitDate: 2021-11-04 01:07:01 +0000 12.3: update to BETA3 Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index b4ca2d22d495..5a8f7e6432c5 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.3" -BRANCH="BETA2" +BRANCH="BETA3" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Thu Nov 4 01:07:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C6085184A6A7; Thu, 4 Nov 2021 01:07: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 4Hl59B44Sqz4jWK; Thu, 4 Nov 2021 01:07: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 588E82307F; Thu, 4 Nov 2021 01:07: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 1A417wfg007706; Thu, 4 Nov 2021 01:07:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A417wuY007705; Thu, 4 Nov 2021 01:07:58 GMT (envelope-from git) Date: Thu, 4 Nov 2021 01:07:58 GMT Message-Id: <202111040107.1A417wuY007705@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: b765d3da06b6 - stable/13 - kern_tc.c: Scaling/large delta recalculation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: b765d3da06b66c06c3370728824cee48dc70af10 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b765d3da06b66c06c3370728824cee48dc70af10 commit b765d3da06b66c06c3370728824cee48dc70af10 Author: Sebastian Huber AuthorDate: 2021-10-28 08:22:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-04 00:56:38 +0000 kern_tc.c: Scaling/large delta recalculation (cherry picked from commit ae750fbac72387c05c8e13623c2465b20497b4be) --- sys/kern/kern_tc.c | 88 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index bd1e44c44bd8..135279d48a22 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1305,6 +1305,40 @@ tc_setclock(struct timespec *ts) } } +/* + * Recalculate the scaling factor. We want the number of 1/2^64 + * fractions of a second per period of the hardware counter, taking + * into account the th_adjustment factor which the NTP PLL/adjtime(2) + * processing provides us with. + * + * The th_adjustment is nanoseconds per second with 32 bit binary + * fraction and we want 64 bit binary fraction of second: + * + * x = a * 2^32 / 10^9 = a * 4.294967296 + * + * The range of th_adjustment is +/- 5000PPM so inside a 64bit int + * we can only multiply by about 850 without overflowing, that + * leaves no suitably precise fractions for multiply before divide. + * + * Divide before multiply with a fraction of 2199/512 results in a + * systematic undercompensation of 10PPM of th_adjustment. On a + * 5000PPM adjustment this is a 0.05PPM error. This is acceptable. + * + * We happily sacrifice the lowest of the 64 bits of our result + * to the goddess of code clarity. + */ +static void +recalculate_scaling_factor_and_large_delta(struct timehands *th) +{ + uint64_t scale; + + scale = (uint64_t)1 << 63; + scale += (th->th_adjustment / 1024) * 2199; + scale /= th->th_counter->tc_frequency; + th->th_scale = scale * 2; + th->th_large_delta = MIN(((uint64_t)1 << 63) / scale, UINT_MAX); +} + /* * Initialize the next struct timehands in the ring and make * it the active timehands. Along the way we might switch to a different @@ -1315,7 +1349,6 @@ tc_windup(struct bintime *new_boottimebin) { struct bintime bt; struct timehands *th, *tho; - uint64_t scale; u_int delta, ncount, ogen; int i; time_t t; @@ -1377,7 +1410,7 @@ tc_windup(struct bintime *new_boottimebin) tho->th_counter->tc_poll_pps(tho->th_counter); /* - * Deal with NTP second processing. The for loop normally + * Deal with NTP second processing. The loop normally * iterates at most once, but in extreme situations it might * keep NTP sane if timeouts are not run for several seconds. * At boot, the time step can be large when the TOD hardware @@ -1388,14 +1421,21 @@ tc_windup(struct bintime *new_boottimebin) bt = th->th_offset; bintime_add(&bt, &th->th_boottime); i = bt.sec - tho->th_microtime.tv_sec; - if (i > LARGE_STEP) - i = 2; - for (; i > 0; i--) { - t = bt.sec; - ntp_update_second(&th->th_adjustment, &bt.sec); - if (bt.sec != t) - th->th_boottime.sec += bt.sec - t; + if (i > 0) { + if (i > LARGE_STEP) + i = 2; + + do { + t = bt.sec; + ntp_update_second(&th->th_adjustment, &bt.sec); + if (bt.sec != t) + th->th_boottime.sec += bt.sec - t; + --i; + } while (i > 0); + + recalculate_scaling_factor_and_large_delta(th); } + /* Update the UTC timestamps used by the get*() functions. */ th->th_bintime = bt; bintime2timeval(&bt, &th->th_microtime); @@ -1413,40 +1453,12 @@ tc_windup(struct bintime *new_boottimebin) th->th_offset_count = ncount; tc_min_ticktock_freq = max(1, timecounter->tc_frequency / (((uint64_t)timecounter->tc_counter_mask + 1) / 3)); + recalculate_scaling_factor_and_large_delta(th); #ifdef FFCLOCK ffclock_change_tc(th); #endif } - /*- - * Recalculate the scaling factor. We want the number of 1/2^64 - * fractions of a second per period of the hardware counter, taking - * into account the th_adjustment factor which the NTP PLL/adjtime(2) - * processing provides us with. - * - * The th_adjustment is nanoseconds per second with 32 bit binary - * fraction and we want 64 bit binary fraction of second: - * - * x = a * 2^32 / 10^9 = a * 4.294967296 - * - * The range of th_adjustment is +/- 5000PPM so inside a 64bit int - * we can only multiply by about 850 without overflowing, that - * leaves no suitably precise fractions for multiply before divide. - * - * Divide before multiply with a fraction of 2199/512 results in a - * systematic undercompensation of 10PPM of th_adjustment. On a - * 5000PPM adjustment this is a 0.05PPM error. This is acceptable. - * - * We happily sacrifice the lowest of the 64 bits of our result - * to the goddess of code clarity. - * - */ - scale = (uint64_t)1 << 63; - scale += (th->th_adjustment / 1024) * 2199; - scale /= th->th_counter->tc_frequency; - th->th_scale = scale * 2; - th->th_large_delta = MIN(((uint64_t)1 << 63) / scale, UINT_MAX); - /* * Now that the struct timehands is again consistent, set the new * generation number, making sure to not make it zero. From nobody Thu Nov 4 01:07:59 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C9413184A6B5; Thu, 4 Nov 2021 01:07: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 4Hl59C4t2rz4jWP; Thu, 4 Nov 2021 01:07: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 8650822F3A; Thu, 4 Nov 2021 01:07: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 1A417xY9007730; Thu, 4 Nov 2021 01:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A417xqk007729; Thu, 4 Nov 2021 01:07:59 GMT (envelope-from git) Date: Thu, 4 Nov 2021 01:07:59 GMT Message-Id: <202111040107.1A417xqk007729@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: 2f71c973efdf - stable/13 - amd64 pmap: account for the top-level pages List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 2f71c973efdf37be562a3f5ff75adfd2ed8d796d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f71c973efdf37be562a3f5ff75adfd2ed8d796d commit 2f71c973efdf37be562a3f5ff75adfd2ed8d796d Author: Konstantin Belousov AuthorDate: 2021-10-20 01:03:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-04 00:56:39 +0000 amd64 pmap: account for the top-level pages (cherry picked from commit e93b5adb6bb83d487eaa4211ac26e116db748c63) --- sys/amd64/amd64/pmap.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index de4cbd1da9e1..c759ff840a24 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1483,6 +1483,15 @@ pmap_resident_count_adj(pmap_t pmap, int count) pmap->pm_stats.resident_count += count; } +static __inline void +pmap_pt_page_count_pinit(pmap_t pmap, int count) +{ + KASSERT(pmap->pm_stats.resident_count + count >= 0, + ("pmap %p resident count underflow %ld %d", pmap, + pmap->pm_stats.resident_count, count)); + pmap->pm_stats.resident_count += count; +} + static __inline void pmap_pt_page_count_adj(pmap_t pmap, int count) { @@ -4292,13 +4301,24 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) vm_paddr_t pmltop_phys; int i; + bzero(&pmap->pm_stats, sizeof pmap->pm_stats); + /* - * Allocate the page directory page. Pass NULL instead of a pointer to - * the pmap here to avoid recording this page in the resident count, as - * optimizations in pmap_remove() depend on this. + * Allocate the page directory page. Pass NULL instead of a + * pointer to the pmap here to avoid calling + * pmap_resident_count_adj() through pmap_pt_page_count_adj(), + * since that requires pmap lock. Instead do the accounting + * manually. + * + * Note that final call to pmap_remove() optimization that + * checks for zero resident_count is basically disabled by + * accounting for top-level page. But the optimization was + * not effective since we started using non-managed mapping of + * the shared page. */ pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + pmap_pt_page_count_pinit(pmap, 1); pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4328,11 +4348,13 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { /* - * As with pmltop_pg, pass NULL instead of a pointer to - * the pmap to ensure that the PTI page isn't counted. + * As with pmltop_pg, pass NULL instead of a + * pointer to the pmap to ensure that the PTI + * page counted explicitly. */ pmltop_pgu = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + pmap_pt_page_count_pinit(pmap, 1); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -4355,7 +4377,6 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) vm_radix_init(&pmap->pm_root); CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); - bzero(&pmap->pm_stats, sizeof pmap->pm_stats); pmap->pm_flags = flags; pmap->pm_eptgen = 0; @@ -4747,9 +4768,6 @@ pmap_release(pmap_t pmap) vm_page_t m; int i; - KASSERT(pmap->pm_stats.resident_count == 0, - ("pmap_release: pmap %p resident count %ld != 0", - pmap, pmap->pm_stats.resident_count)); KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap %p has reserved page table page(s)", pmap)); @@ -4776,15 +4794,21 @@ pmap_release(pmap_t pmap) } pmap_free_pt_page(NULL, m, true); + pmap_pt_page_count_pinit(pmap, -1); if (pmap->pm_pmltopu != NULL) { m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap-> pm_pmltopu)); pmap_free_pt_page(NULL, m, false); + pmap_pt_page_count_pinit(pmap, -1); } if (pmap->pm_type == PT_X86 && (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) rangeset_fini(&pmap->pm_pkru); + + KASSERT(pmap->pm_stats.resident_count == 0, + ("pmap_release: pmap %p resident count %ld != 0", + pmap, pmap->pm_stats.resident_count)); } static int From nobody Thu Nov 4 01:08:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5C14B184A79B; Thu, 4 Nov 2021 01:08: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 4Hl59D6P7Vz4jZB; Thu, 4 Nov 2021 01:08: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 AD6E822EC2; Thu, 4 Nov 2021 01:08: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 1A4180UM007754; Thu, 4 Nov 2021 01:08:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A418074007753; Thu, 4 Nov 2021 01:08:00 GMT (envelope-from git) Date: Thu, 4 Nov 2021 01:08:00 GMT Message-Id: <202111040108.1A418074007753@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: 077d3c4c467e - stable/13 - amd64 pmap: adjust the empty pmap optimization in pmap_remove() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 077d3c4c467e5e27f88b8d70864000f3eb0dab3c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=077d3c4c467e5e27f88b8d70864000f3eb0dab3c commit 077d3c4c467e5e27f88b8d70864000f3eb0dab3c Author: Konstantin Belousov AuthorDate: 2021-10-20 20:30:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-04 00:56:39 +0000 amd64 pmap: adjust the empty pmap optimization in pmap_remove() (cherry picked from commit 0b3bc7288984c17da00d9f8c29f116d56bf44d35) --- sys/amd64/amd64/pmap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index c759ff840a24..524b40ed2fee 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -6160,9 +6160,14 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) PG_V = pmap_valid_bit(pmap); /* + * If there are no resident pages besides the top level page + * table page(s), there is nothing to do. Kernel pmap always + * accounts whole preloaded area as resident, which makes its + * resident count > 2. * Perform an unsynchronized read. This is, however, safe. */ - if (pmap->pm_stats.resident_count == 0) + if (pmap->pm_stats.resident_count <= 1 + (pmap->pm_pmltopu != NULL ? + 1 : 0)) return; anyvalid = 0; From nobody Thu Nov 4 01:08:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BD68D184A82A; Thu, 4 Nov 2021 01:08: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 4Hl59G5gwkz4jZP; Thu, 4 Nov 2021 01:08: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 C979523084; Thu, 4 Nov 2021 01:08: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 1A4181tS007778; Thu, 4 Nov 2021 01:08:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A41819T007777; Thu, 4 Nov 2021 01:08:01 GMT (envelope-from git) Date: Thu, 4 Nov 2021 01:08:01 GMT Message-Id: <202111040108.1A41819T007777@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: 3e322ded35f7 - stable/13 - Unmap shared page manually before doing vm_map_remove() on exit or exec List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3e322ded35f72e0851ab9cfe0c0d37f479c1347e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3e322ded35f72e0851ab9cfe0c0d37f479c1347e commit 3e322ded35f72e0851ab9cfe0c0d37f479c1347e Author: Konstantin Belousov AuthorDate: 2021-10-20 20:32:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-04 00:56:39 +0000 Unmap shared page manually before doing vm_map_remove() on exit or exec (cherry picked from commit 1c69690319c5bb7deae6ce1add6ea25bb40b3b91) --- sys/kern/kern_exec.c | 25 +++++++++++++++++++++++++ sys/kern/kern_exit.c | 1 + sys/sys/sysent.h | 1 + 3 files changed, 27 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index eb2d7d9986e2..4a405637be4a 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1047,6 +1047,30 @@ exec_onexec_old(struct thread *td) umtx_exec(td->td_proc); } +/* + * This is an optimization which removes the unmanaged shared page + * mapping. In combination with pmap_remove_pages(), which cleans all + * managed mappings in the process' vmspace pmap, no work will be left + * for pmap_remove(min, max). + */ +void +exec_free_abi_mappings(struct proc *p) +{ + struct vmspace *vmspace; + struct sysentvec *sv; + + vmspace = p->p_vmspace; + if (refcount_load(&vmspace->vm_refcnt) != 1) + return; + + sv = p->p_sysent; + if (sv->sv_shared_page_obj == NULL) + return; + + pmap_remove(vmspace_pmap(vmspace), sv->sv_shared_page_base, + sv->sv_shared_page_base + sv->sv_shared_page_len); +} + /* * Destroy old address space, and allocate a new stack. * The new stack is only sgrowsiz large because it is grown @@ -1091,6 +1115,7 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser && cpu_exec_vmspace_reuse(p, map)) { + exec_free_abi_mappings(p); shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index bfd25366b49c..47ead49bb202 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -416,6 +416,7 @@ exit1(struct thread *td, int rval, int signo) mtx_unlock(&ppeers_lock); } + exec_free_abi_mappings(p); vmspace_exit(td); (void)acct_process(td); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index a6b4b9fe9378..3e87bc7c3744 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -318,6 +318,7 @@ void exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2); void exec_inittk(void); void exit_onexit(struct proc *p); +void exec_free_abi_mappings(struct proc *p); void exec_onexec_old(struct thread *td); #define INIT_SYSENTVEC(name, sv) \ From nobody Thu Nov 4 04:14:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C1578184FB39; Thu, 4 Nov 2021 04:14: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 4Hl9JD52ZMz3ncg; Thu, 4 Nov 2021 04:14: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 8CDEC25989; Thu, 4 Nov 2021 04:14: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 1A44EK14059874; Thu, 4 Nov 2021 04:14:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A44EK4m059873; Thu, 4 Nov 2021 04:14:20 GMT (envelope-from git) Date: Thu, 4 Nov 2021 04:14:20 GMT Message-Id: <202111040414.1A44EK4m059873@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: 15bd9fa3bea7 - main - procfs_doprocfile(): simplify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 15bd9fa3bea794054b4a5bd2f4bb71b0ba3aa3ba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=15bd9fa3bea794054b4a5bd2f4bb71b0ba3aa3ba commit 15bd9fa3bea794054b4a5bd2f4bb71b0ba3aa3ba Author: Konstantin Belousov AuthorDate: 2021-11-04 03:58:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-04 04:13:47 +0000 procfs_doprocfile(): simplify Now that proc_get_binpath() does not return NULL in fullpath on success, directly use sbuf_cat() over the value. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/fs/procfs/procfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index 697bbfc9877a..38cfb4752279 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -77,7 +77,7 @@ procfs_doprocfile(PFS_FILL_ARGS) PROC_LOCK(p); error = proc_get_binpath(p, binpath, &fullpath, &freepath); if (error == 0) - sbuf_printf(sb, "%s", fullpath == NULL ? "" : fullpath); + sbuf_cat(sb, fullpath); free(binpath, M_TEMP); free(freepath, M_TEMP); return (error); From nobody Thu Nov 4 05:09:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AD19818278BA; Thu, 4 Nov 2021 05:09: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 4HlBX84WX6z4VYg; Thu, 4 Nov 2021 05:09: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 7AC7726482; Thu, 4 Nov 2021 05:09: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 1A459i9x026577; Thu, 4 Nov 2021 05:09:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A459ilB026576; Thu, 4 Nov 2021 05:09:44 GMT (envelope-from git) Date: Thu, 4 Nov 2021 05:09:44 GMT Message-Id: <202111040509.1A459ilB026576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 890cae197737 - main - fsck_msdosfs: truncate directory entry when the head pointer is invalid. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 890cae197737b463e56d1cc5a3f61f84cb49c807 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=890cae197737b463e56d1cc5a3f61f84cb49c807 commit 890cae197737b463e56d1cc5a3f61f84cb49c807 Author: Xin LI AuthorDate: 2021-11-04 05:09:32 +0000 Commit: Xin LI CommitDate: 2021-11-04 05:09:32 +0000 fsck_msdosfs: truncate directory entry when the head pointer is invalid. As far as we know, there is no FAT implementation that supported hard links, and our msdosfs driver assumed one cluster chain is only referenced by one directory entry and clears it out when the file is deleted. On the other hand, the current code would proceed with checkchain() when the directory entry's head cluster is a valid numbered cluster without checking if it was a valid head node of a cluster chain. So if the cluster do not being a chain (e.g. CLUST_FREE, CLUST_BAD), or was already referenced by another directory entry, this would trigger an assertion in check_chain() at a later time. Fix this by giving the user an option to truncate the directory entry when the head cluster is an invalid cluster, an visited head node, or not a head node. Reported by: NetApp (kevans@) Reviewed by: kevans, emaste (no objection) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D32699 --- sbin/fsck_msdosfs/dir.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c index 471f6cc0335e..dbe4e0c7db2f 100644 --- a/sbin/fsck_msdosfs/dir.c +++ b/sbin/fsck_msdosfs/dir.c @@ -400,8 +400,21 @@ checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir) if (dir->head == CLUST_FREE) { physicalSize = 0; } else { - if (!fat_is_valid_cl(fat, dir->head)) - return FSERROR; + if (!fat_is_valid_cl(fat, dir->head) || !fat_is_cl_head(fat, dir->head)) { + pwarn("Directory entry %s of size %u referencing invalid cluster %u\n", + fullpath(dir), dir->size, dir->head); + if (ask(1, "Truncate")) { + p[28] = p[29] = p[30] = p[31] = 0; + p[26] = p[27] = 0; + if (boot->ClustMask == CLUST32_MASK) + p[20] = p[21] = 0; + dir->size = 0; + dir->head = CLUST_FREE; + return FSDIRMOD; + } else { + return FSERROR; + } + } ret = checkchain(fat, dir->head, &chainsize); /* * Upon return, chainsize would hold the chain length From nobody Thu Nov 4 08:02:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3DE641843447; Thu, 4 Nov 2021 08:02: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 4HlGMY1Dk4z4sH9; Thu, 4 Nov 2021 08:02: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 0ADB328898; Thu, 4 Nov 2021 08:02: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 1A482W4J064502; Thu, 4 Nov 2021 08:02:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A482W2D064501; Thu, 4 Nov 2021 08:02:32 GMT (envelope-from git) Date: Thu, 4 Nov 2021 08:02:32 GMT Message-Id: <202111040802.1A482W2D064501@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: 8abfbe5a79b1 - main - beep(1): Initial version of utility to create terminal beep via soundcard. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8abfbe5a79b19bb95430f574d970843607f5809c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8abfbe5a79b19bb95430f574d970843607f5809c commit 8abfbe5a79b19bb95430f574d970843607f5809c Author: Hans Petter Selasky AuthorDate: 2021-10-26 17:13:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-04 08:00:46 +0000 beep(1): Initial version of utility to create terminal beep via soundcard. Reviewed by: imp@, emaste@ and pstef@ Differential Revision: https://reviews.freebsd.org/D32672 MFC after: 1 week Sponsored by: NVIDIA Networking --- usr.bin/Makefile | 1 + usr.bin/beep/Makefile | 8 ++ usr.bin/beep/beep.1 | 84 +++++++++++++++ usr.bin/beep/beep.c | 275 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 368 insertions(+) diff --git a/usr.bin/Makefile b/usr.bin/Makefile index e8be161db01a..ab93df2abd19 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -10,6 +10,7 @@ SUBDIR= alias \ backlight \ banner \ basename \ + beep \ brandelf \ bsdcat \ bsdiff \ diff --git a/usr.bin/beep/Makefile b/usr.bin/beep/Makefile new file mode 100644 index 000000000000..754656ef059b --- /dev/null +++ b/usr.bin/beep/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= beep +MAN= beep.1 + +LDFLAGS= -lm + +.include diff --git a/usr.bin/beep/beep.1 b/usr.bin/beep/beep.1 new file mode 100644 index 000000000000..55fe0173272a --- /dev/null +++ b/usr.bin/beep/beep.1 @@ -0,0 +1,84 @@ +.\"- +.\" Copyright (c) 2021 Hans Petter Selasky +.\" +.\" 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 4, 2021 +.Dt beep 1 +.Os +.Sh NAME +.Nm beep +.Nd play a beep sound +.Sh SYNOPSIS +.Nm +.Op Fl F Ar frequency +.Op Fl D Ar duration_ms +.Op Fl r Ar sample_rate_hz +.Op Fl d Ar oss_device +.Op Fl g Ar gain +.Op Fl B +.Op Fl h +.Sh DESCRIPTION +The +.Nm +utility is used to playback a beep on the soundcard. +.Pp +The options are as follows: +.Bl -tag -width "-f device" +.It Fl F +Sets the center frequency of the beep in Hz. +The default is 440 Hz . +.It Fl D +Sets the duration of the beep in milliseconds. +The default is 150 ms . +.It Fl d +Sets the soundcard to use. +The default is /dev/dsp . +.It Fl r +Sets the soundcard samplerate in Hz. +The default is 48000 Hz. +.It Fl g +Sets the waveform gain, between 0 and 100 inclusively. +The default is 75. +.It Fl B +Runs the +.Nm +utility in the background. +.It Fl h +Display summary of options. +.El +.Sh EXAMPLES +.Pp +Playback default beep sound using /dev/dsp . +.Bl -tag -width Ds -offset indent +.It $ beep +.El +.Sh SEE ALSO +.Xr mixer 3 , +.Xr sound 4 , +.Sh HISTORY +The +.Nm +utility first appeared in FreeBSD 14.0. +.Sh AUTHORS +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org diff --git a/usr.bin/beep/beep.c b/usr.bin/beep/beep.c new file mode 100644 index 000000000000..151236b4825b --- /dev/null +++ b/usr.bin/beep/beep.c @@ -0,0 +1,275 @@ +/*- + * Copyright (c) 2021 Hans Petter Selasky + * + * 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SAMPLE_RATE_DEF 48000 /* hz */ +#define SAMPLE_RATE_MAX 48000 /* hz */ +#define SAMPLE_RATE_MIN 8000 /* hz */ + +#define DURATION_DEF 150 /* ms */ +#define DURATION_MAX 2000 /* ms */ +#define DURATION_MIN 50 /* ms */ + +#define GAIN_DEF 75 +#define GAIN_MAX 100 +#define GAIN_MIN 0 + +#define WAVE_POWER 1.25f + +#define DEFAULT_HZ 440 + +#define DEFAULT_DEVICE _PATH_DEV "dsp" + +static int frequency = DEFAULT_HZ; +static int duration_ms = DURATION_DEF; +static int sample_rate = SAMPLE_RATE_DEF; +static int gain = GAIN_DEF; +static const char *oss_dev = DEFAULT_DEVICE; +static bool background; + +/* + * wave_function_16 + * + * "phase" should be in the range [0.0f .. 1.0f> + * "power" should be in the range <0.0f .. 2.0f> + * + * The return value is in the range [-1.0f .. 1.0f] + */ +static float +wave_function_16(float phase, float power) +{ + uint16_t x = phase * (1U << 16); + float retval; + uint8_t num; + + /* Handle special cases, if any */ + switch (x) { + case 0xffff: + case 0x0000: + return (1.0f); + case 0x3fff: + case 0x4000: + case 0xBfff: + case 0xC000: + return (0.0f); + case 0x7FFF: + case 0x8000: + return (-1.0f); + default: + break; + } + + /* Apply Gray coding */ + for (uint16_t mask = 1U << 15; mask != 1; mask /= 2) { + if (x & mask) + x ^= (mask - 1); + } + + /* Find first set bit */ + for (num = 0; num != 14; num++) { + if (x & (1U << num)) { + num++; + break; + } + } + + /* Initialize return value */ + retval = 0.0; + + /* Compute the rest of the power series */ + for (; num != 14; num++) { + if (x & (1U << num)) { + retval = (1.0f - retval) / 2.0f; + retval = powf(retval, power); + } else { + retval = (1.0f + retval) / 2.0f; + retval = powf(retval, power); + } + } + + /* Check if halfway */ + if (x & (1ULL << 14)) + retval = -retval; + + return (retval); +} + +static void +usage(void) +{ + fprintf(stderr, "Usage: %s [parameters]\n" + "\t" "-F \n" + "\t" "-D \n" + "\t" "-r \n" + "\t" "-d \n" + "\t" "-g \n" + "\t" "-B Run in background\n" + "\t" "-h Show usage\n", + getprogname(), + DEFAULT_HZ, + DURATION_MIN, DURATION_MAX, DURATION_DEF, + SAMPLE_RATE_MIN, SAMPLE_RATE_MAX, SAMPLE_RATE_DEF, + DEFAULT_DEVICE, + GAIN_MIN, GAIN_MAX, GAIN_DEF); + exit(1); +} + +int +main(int argc, char **argv) +{ + int32_t *buffer; + size_t slope; + size_t size; + size_t off; + float a; + float d; + float p; + int c; + int f; + + while ((c = getopt(argc, argv, "BF:D:r:g:d:h")) != -1) { + switch (c) { + case 'F': + frequency = strtol(optarg, NULL, 10); + break; + case 'D': + duration_ms = strtol(optarg, NULL, 10); + if (duration_ms < DURATION_MIN || + duration_ms > DURATION_MAX) + usage(); + break; + case 'r': + sample_rate = strtol(optarg, NULL, 10); + if (sample_rate < SAMPLE_RATE_MIN || + sample_rate > SAMPLE_RATE_MAX) + usage(); + break; + case 'g': + gain = strtol(optarg, NULL, 10); + if (gain < GAIN_MIN || + gain > GAIN_MAX) + usage(); + break; + case 'd': + oss_dev = optarg; + break; + case 'B': + background = true; + break; + default: + usage(); + break; + } + } + + if (background && daemon(0, 0) != 0) + errx(1, "daemon(0,0) failed"); + + f = open(oss_dev, O_WRONLY); + if (f < 0) + errx(1, "Failed to open '%s'", oss_dev); + + c = 1; /* mono */ + if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &c) != 0) + errx(1, "ioctl SOUND_PCM_WRITE_CHANNELS(1) failed"); + + c = AFMT_S32_NE; + if (ioctl(f, SNDCTL_DSP_SETFMT, &c) != 0) + errx(1, "ioctl SNDCTL_DSP_SETFMT(AFMT_S32_NE) failed"); + + if (ioctl(f, SNDCTL_DSP_SPEED, &sample_rate) != 0) + errx(1, "ioctl SNDCTL_DSP_SPEED(%d) failed", sample_rate); + + c = (2 << 16); + while ((1ULL << (c & 63)) < (size_t)(4 * sample_rate / 50)) + c++; + if (ioctl(f, SNDCTL_DSP_SETFRAGMENT, &c)) + errx(1, "ioctl SNDCTL_DSP_SETFRAGMENT(0x%x) failed", c); + + if (ioctl(f, SNDCTL_DSP_GETODELAY, &c) != 0) + errx(1, "ioctl SNDCTL_DSP_GETODELAY failed"); + + size = ((sample_rate * duration_ms) + 999) / 1000; + buffer = malloc(sizeof(buffer[0]) * size); + if (buffer == NULL) + errx(1, "out of memory"); + + /* compute slope duration in samples */ + slope = (DURATION_MIN * sample_rate) / 2000; + + /* compute base gain */ + a = powf(65536.0f, (float)gain / (float)GAIN_MAX) / 65536.0f; + + /* set initial phase and delta */ + p = 0; + d = (float)frequency / (float)sample_rate; + + /* compute wave */ + for (p = off = 0; off != size; off++, p += d) { + float sample; + + p = p - floorf(p); + sample = a * wave_function_16(p, WAVE_POWER); + + if (off < slope) + sample = sample * off / (float)slope; + else if (off > (size - slope)) + sample = sample * (size - off - 1) / (float)slope; + + buffer[off] = sample * 0x7fffff00; + } + + if (write(f, buffer, size * sizeof(buffer[0])) != + (ssize_t)(size * sizeof(buffer[0]))) + errx(1, "failed writing to DSP device(%s)", oss_dev); + + free(buffer); + + /* wait for data to be written */ + while (ioctl(f, SNDCTL_DSP_GETODELAY, &c) == 0) { + if (c == 0) + break; + usleep(10000); + } + + /* wait for audio to go out */ + usleep(50000); + close(f); + + return (0); +} From nobody Thu Nov 4 08:44:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 770F61835C41; Thu, 4 Nov 2021 08:44: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 4HlHHg2hvFz3QgV; Thu, 4 Nov 2021 08:44: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 3C47228EFA; Thu, 4 Nov 2021 08:44: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 1A48iFxj017449; Thu, 4 Nov 2021 08:44:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A48iF7V017448; Thu, 4 Nov 2021 08:44:15 GMT (envelope-from git) Date: Thu, 4 Nov 2021 08:44:15 GMT Message-Id: <202111040844.1A48iF7V017448@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: 9c0287e0920a - main - release: Remove unused variables in azure Makefile List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 9c0287e0920ad7a16c75e62e914cd69c439dba1c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=9c0287e0920ad7a16c75e62e914cd69c439dba1c commit 9c0287e0920ad7a16c75e62e914cd69c439dba1c Author: Li-Wen Hsu AuthorDate: 2021-11-04 08:42:38 +0000 Commit: Li-Wen Hsu CommitDate: 2021-11-04 08:42:38 +0000 release: Remove unused variables in azure Makefile Approved by: re (gjb) Sponsored by: The FreeBSD Foundation --- release/Makefile.azure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/Makefile.azure b/release/Makefile.azure index bc6f8859dea9..4e9e33184dfc 100644 --- a/release/Makefile.azure +++ b/release/Makefile.azure @@ -11,7 +11,7 @@ AZURE_UPLOAD_TGTS= azure-check-depends \ CLEANFILES+= ${AZURE_UPLOAD_TGTS} .if defined(AZURE_UPLOAD_CONF) && !empty(AZURE_UPLOAD_CONF) -. for VAR in _STORAGE _ACCOUNT _RESOURCEGROUP _KEY _LOCATION +. for VAR in _STORAGE _ACCOUNT _KEY AZURE${VAR}!= grep -E '^AZURE${VAR}' ${AZURE_UPLOAD_CONF} | awk -F ' ' '{print $$2}' . endfor .endif @@ -28,7 +28,7 @@ EXPIRY_DATE!= date -v+1m -I -u azure-upload: ${AZURE_UPLOAD_TGTS} azure-check-depends: -.for VAR in _STORAGE _ACCOUNT _RESOURCEGROUP _KEY _LOCATION +.for VAR in _STORAGE _ACCOUNT _KEY . if !defined(AZURE${VAR}) || empty(AZURE${VAR}) @echo "Variable AZURE${VAR} cannot be empty." @false From nobody Thu Nov 4 12:56:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 56586183B40F; Thu, 4 Nov 2021 12: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 4HlNtt2047z4l4w; Thu, 4 Nov 2021 12:56:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 230A82C7BF; Thu, 4 Nov 2021 12:56: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 1A4CucvJ049983; Thu, 4 Nov 2021 12:56:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4CucBg049982; Thu, 4 Nov 2021 12:56:38 GMT (envelope-from git) Date: Thu, 4 Nov 2021 12:56:38 GMT Message-Id: <202111041256.1A4CucBg049982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: c441592a0e15 - main - Allow kern.ipc.maxsockets to be set to current value without error List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c441592a0e1591591665cd037a8a5e9b54675f99 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=c441592a0e1591591665cd037a8a5e9b54675f99 commit c441592a0e1591591665cd037a8a5e9b54675f99 Author: Allan Jude AuthorDate: 2021-11-04 12:55:33 +0000 Commit: Allan Jude CommitDate: 2021-11-04 12:56:09 +0000 Allow kern.ipc.maxsockets to be set to current value without error Normally setting kern.ipc.maxsockets returns EINVAL if the new value is not greater than the previous value. This can cause spurious error messages when sysctl.conf is processed multiple times, or when automation systems try to ensure the sysctl is set to the correct value. If the value is unchanged, then just do nothing. PR: 243532 Reviewed by: markj MFC after: 3 days Sponsored by: Modirum MDPay Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D32775 --- sys/kern/uipc_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 267a33feac3b..e033b2d77f1d 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -364,7 +364,7 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) newmaxsockets = maxsockets; error = sysctl_handle_int(oidp, &newmaxsockets, 0, req); - if (error == 0 && req->newptr) { + if (error == 0 && req->newptr && newmaxsockets != maxsockets) { if (newmaxsockets > maxsockets && newmaxsockets <= maxfiles) { maxsockets = newmaxsockets; From nobody Thu Nov 4 14:55:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 61EB5183B3D1; Thu, 4 Nov 2021 14:55:04 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HlRWW44yTz4Y7V; Thu, 4 Nov 2021 14:55:03 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 1A4Et1FE029820; Thu, 4 Nov 2021 07:55:01 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 1A4Et1pX029819; Thu, 4 Nov 2021 07:55:01 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell In-Reply-To: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> To: Warner Losh Date: Thu, 4 Nov 2021 07:55:01 -0700 (PDT) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4HlRWW44yTz4Y7V X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Thank you Warner for all the legwork on tracking this down and getting a proper bell tone working on FreeBSD-Current. I do not see any MFC plans for this, can you please consider merging this to all supported releases? Oh and RELNOTES: YES? Thanks, Rod > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ba48d52ca6c867559156dd916631f9ac47abe80f > > commit ba48d52ca6c867559156dd916631f9ac47abe80f > Author: Warner Losh > AuthorDate: 2021-11-03 21:55:55 +0000 > Commit: Warner Losh > CommitDate: 2021-11-03 22:03:51 +0000 > > vt: Fix frequency calcuation for bell > > 386BSD provided a MD function sysbeep. This took two arguments (pitch > and period). Pitch was jammed into the PIT's divisor directly (which > means the argument was expected to sound a tone at '1193182 / pitch' > Hz). FreeBSD inherited this interface. > > In commit e46598588587 (svn 177642, Mar 26 2008), phk changed this > function to take a tone to sound in hz. He converted all in-tree > instances of 1193182 / hz to just hz (and kept the few misguided folks > that passed hz directly unchanged -- this was part of what motivated the > change). He converted the places where we pre-computed the 8254 divisor > from being pitch to 1193182 / pitch (since that converts the divisor to > the frequency and the interfaces that were exposed to userland exposed > it in these units in places, continuing the tradition inherited from SCO > System V/386 Unix in spots). > > In 2009, Ed Shouten was contracted by the FreeBSD Foundation to write / > finish newcons. This work was done in perforce and was imported into > subversion in user/ed/newcons in revision 199072 > (https://svnweb.freebsd.org/base?view=revision&revision=199072) which > was later imported into FreeBSD by ray@ (Aleksandr Rybalko). > > From that earliest import into svn import to this date, we ring the bell > with: > sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); > where VT_BELLPITCH was defined to be 800. This results in a bell > frequency of 1491Hz, more or less today. This is similar to the > frequency that syscons and pcvt used (1493Hz and 1500Hz respectively). > This in turn was inherited from 386BSD, it seems, which used the hard > coded value 0x31b which is 795 -> 1500Hz. > > This '800' was intended to be the bell tone (eg 800Hz) and this > interface was one that wasn't converted. The most common terminal prior > to the rise of PCs was the VT100, which had an approximately 800Hz > bell. Ed Shouten has confirmed that the original intent was 800Hz and > changing this was overlooked after the change to -current was made. > This restors that original intent and makes the bell less obnoxious in > the process. > > Reviewed by: des, adrian > Differential Revision: https://reviews.freebsd.org/D32594 > Sponsored by: Netflix > --- > sys/dev/vt/vt_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c > index 38efd1e5501c..06f5827078ca 100644 > --- a/sys/dev/vt/vt_core.c > +++ b/sys/dev/vt/vt_core.c > @@ -121,7 +121,7 @@ const struct terminal_class vt_termclass = { > > /* Bell pitch/duration. */ > #define VT_BELLDURATION (SBT_1S / 20) > -#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */ > +#define VT_BELLPITCH 800 > > #define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS + \ > (vw)->vw_number) > -- Rod Grimes rgrimes@freebsd.org From nobody Thu Nov 4 15:16:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C29471846960; Thu, 4 Nov 2021 15:16: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 4HlRzr57r0z4hNN; Thu, 4 Nov 2021 15: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 902402E427; Thu, 4 Nov 2021 15: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 1A4FG8Yu037225; Thu, 4 Nov 2021 15: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 1A4FG8O8037224; Thu, 4 Nov 2021 15:16:08 GMT (envelope-from git) Date: Thu, 4 Nov 2021 15:16:08 GMT Message-Id: <202111041516.1A4FG8O8037224@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: aa80581c195e - main - Add notes about vt beeping List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: aa80581c195eb3d29caa632213f363041be36c1f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=aa80581c195eb3d29caa632213f363041be36c1f commit aa80581c195eb3d29caa632213f363041be36c1f Author: Warner Losh AuthorDate: 2021-11-04 15:15:38 +0000 Commit: Warner Losh CommitDate: 2021-11-04 15:15:38 +0000 Add notes about vt beeping Sponsored by: Netflix --- RELNOTES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RELNOTES b/RELNOTES index d56e86623fa2..44b777e9b7ab 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +ba48d52ca6c8,4ac3d08a9693,2533eca1c2b9: + The default bell tone is now 800Hz. It may be set with kbdcontrol + again. There's devd integration for people wishing to use their sound + cards for the beep. + 92b3e07229ba: net.inet.tcp.nolocaltimewait enabled by default. It prevents creation of timewait entries for TCP connections that were From nobody Thu Nov 4 15:17:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 572AC1849043 for ; Thu, 4 Nov 2021 15:17:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vk1-xa36.google.com (mail-vk1-xa36.google.com [IPv6:2607:f8b0:4864:20::a36]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HlS1q0xskz4jK2 for ; Thu, 4 Nov 2021 15:17:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vk1-xa36.google.com with SMTP id f78so1074877vka.5 for ; Thu, 04 Nov 2021 08:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LALnhJbIsUnZ9H28sEKaL65MU0snYLeHfJVy3yvBaJ0=; b=NODCVkkrjL70tMzuHS8jTdDzq7jFTX01QdIwkDJbNMDvrzYNLgkWTyWYOEOBskx+sq h7GUwOLKIrrZ+/qBGmeQsNG7KZ3T7UFqZSw+Y5Z3SQ4DfrLuHUsJGu58s662rjEeYvc1 Q7df3HV0IhmJ3EIce7SHCtcjV0os3KeqLq9YLPlRTU6m/cdOqSiqUrBILfivJ27k1Ooq NRRIhXfD/YprAl95geXeazQCiQvzYx4sdW649yVhmxXMILnKbGa7NZRS+bStTAiUQOZ9 PhYBZlqJB65ZWbsc0W21OCv4C71G7Qg8OPIvu2j8F2zrYh2srIFj/ykZcILsGNvgSRWB uMRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LALnhJbIsUnZ9H28sEKaL65MU0snYLeHfJVy3yvBaJ0=; b=DhATXTGU+gUWGVZxCc7Gt4T9fYyEtFeJU96MrUJZkMtwfrMKidbKu5YVtQFJeE/O3+ 7CDAqns4A8uSS4QWFbYatc5xD/J+Dyh0L0yD9uI1PtDGvxIH0xN5LohjkW70EOg0n6To Y9I8vnwnaJPnAm809PPeVMs/fxmj256BFAZ1FqCODgznBUZV3zQtlk5VPmLRXLjZJq8I m6RCdkl+ohxtfeewEfhC6LX/pBYG3Q7pBRyjEOVwJ3LX+gNngJUpn75YteAVfhgT2KOP UT4cvVrcn179PBo+06rtZxY5UfCKb/3Sgh3Nk8lLqYYzH5ukqEaEYvO7XfXu1MrFn46m UsSw== X-Gm-Message-State: AOAM533h97ElSbYxZEsacQz0D8l+WghrxxtAdzH1iM1oKCLZUTweTNTH PVWpAjKwIl2ZaFqWpiXESDGBhBqidIo84Wc5Fh0USBNZx8A= X-Google-Smtp-Source: ABdhPJyUtawuilGtRikN5NT+i+TvQUZaUMkDGXv1jnAJ3+KIrcG2sYF0g7DDEjalMqUW08Koz07blxBSOQPup3DxV20= X-Received: by 2002:a05:6122:20a5:: with SMTP id i37mr13222595vkd.18.1636039070488; Thu, 04 Nov 2021 08:17:50 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> In-Reply-To: <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> From: Warner Losh Date: Thu, 4 Nov 2021 09:17:38 -0600 Message-ID: Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell To: "Rodney W. Grimes" Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000a2ab7805cff80759" X-Rspamd-Queue-Id: 4HlS1q0xskz4jK2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000a2ab7805cff80759 Content-Type: text/plain; charset="UTF-8" On Thu, Nov 4, 2021 at 8:55 AM Rodney W. Grimes wrote: > Thank you Warner for all the legwork on tracking this down and > getting a proper bell tone working on FreeBSD-Current. I do not > see any MFC plans for this, can you please consider merging this > to all supported releases? > I'm merging to 13. The merge was easy. I'm unlikely to merge to 12, though, because some of these changes are dependent on changing a system interface that I got conflicts with. If there's a lot of demand I can plow through the conflicts. > Oh and RELNOTES: YES? > Added. > Thanks, > Rod > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=ba48d52ca6c867559156dd916631f9ac47abe80f > > > > commit ba48d52ca6c867559156dd916631f9ac47abe80f > > Author: Warner Losh > > AuthorDate: 2021-11-03 21:55:55 +0000 > > Commit: Warner Losh > > CommitDate: 2021-11-03 22:03:51 +0000 > > > > vt: Fix frequency calcuation for bell > > > > 386BSD provided a MD function sysbeep. This took two arguments (pitch > > and period). Pitch was jammed into the PIT's divisor directly (which > > means the argument was expected to sound a tone at '1193182 / pitch' > > Hz). FreeBSD inherited this interface. > > > > In commit e46598588587 (svn 177642, Mar 26 2008), phk changed this > > function to take a tone to sound in hz. He converted all in-tree > > instances of 1193182 / hz to just hz (and kept the few misguided > folks > > that passed hz directly unchanged -- this was part of what motivated > the > > change). He converted the places where we pre-computed the 8254 > divisor > > from being pitch to 1193182 / pitch (since that converts the divisor > to > > the frequency and the interfaces that were exposed to userland > exposed > > it in these units in places, continuing the tradition inherited from > SCO > > System V/386 Unix in spots). > > > > In 2009, Ed Shouten was contracted by the FreeBSD Foundation to > write / > > finish newcons. This work was done in perforce and was imported into > > subversion in user/ed/newcons in revision 199072 > > (https://svnweb.freebsd.org/base?view=revision&revision=199072) > which > > was later imported into FreeBSD by ray@ (Aleksandr Rybalko). > > > > From that earliest import into svn import to this date, we ring the > bell > > with: > > sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); > > where VT_BELLPITCH was defined to be 800. This results in a bell > > frequency of 1491Hz, more or less today. This is similar to the > > frequency that syscons and pcvt used (1493Hz and 1500Hz > respectively). > > This in turn was inherited from 386BSD, it seems, which used the hard > > coded value 0x31b which is 795 -> 1500Hz. > > > > This '800' was intended to be the bell tone (eg 800Hz) and this > > interface was one that wasn't converted. The most common terminal > prior > > to the rise of PCs was the VT100, which had an approximately 800Hz > > bell. Ed Shouten has confirmed that the original intent was 800Hz and > > changing this was overlooked after the change to -current was made. > > This restors that original intent and makes the bell less obnoxious > in > > the process. > > > > Reviewed by: des, adrian > > Differential Revision: https://reviews.freebsd.org/D32594 > > Sponsored by: Netflix > > --- > > sys/dev/vt/vt_core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c > > index 38efd1e5501c..06f5827078ca 100644 > > --- a/sys/dev/vt/vt_core.c > > +++ b/sys/dev/vt/vt_core.c > > @@ -121,7 +121,7 @@ const struct terminal_class vt_termclass = { > > > > /* Bell pitch/duration. */ > > #define VT_BELLDURATION (SBT_1S / 20) > > -#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */ > > +#define VT_BELLPITCH 800 > > > > #define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS > + \ > > (vw)->vw_number) > > > > -- > Rod Grimes > rgrimes@freebsd.org > --000000000000a2ab7805cff80759-- From nobody Thu Nov 4 15:54:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ED3521837935; Thu, 4 Nov 2021 15:54:35 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 4HlSrC54MDz3Cws; Thu, 4 Nov 2021 15:54:35 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1mif4N-0005QR-1C; Thu, 04 Nov 2021 18:54:27 +0300 Date: Thu, 4 Nov 2021 18:54:26 +0300 From: Slawa Olhovchenkov To: Warner Losh Cc: "Rodney W. Grimes" , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell Message-ID: <20211104155426.GD77338@zxy.spb.ru> References: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HlSrC54MDz3Cws X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Nov 04, 2021 at 09:17:38AM -0600, Warner Losh wrote: > On Thu, Nov 4, 2021 at 8:55 AM Rodney W. Grimes > wrote: > > > Thank you Warner for all the legwork on tracking this down and > > getting a proper bell tone working on FreeBSD-Current. I do not > > see any MFC plans for this, can you please consider merging this > > to all supported releases? > > > > I'm merging to 13. The merge was easy. I'm unlikely to merge to 12, > though, because some of these changes are dependent on changing > a system interface that I got conflicts with. If there's a lot of demand > I can plow through the conflicts. > > > > Oh and RELNOTES: YES? > > > > Added. May be now enable bell by default back? From nobody Thu Nov 4 16:02:50 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4EC8F183D9A2; Thu, 4 Nov 2021 16:02: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 4HlT1k1n6dz3HFl; Thu, 4 Nov 2021 16:02: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 1E5FE2EF9A; Thu, 4 Nov 2021 16:02: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 1A4G2ovR003621; Thu, 4 Nov 2021 16:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2o3b003620; Thu, 4 Nov 2021 16:02:50 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:50 GMT Message-Id: <202111041602.1A4G2o3b003620@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 6325f105aad2 - main - ipq4018: toggle ps-hold to allow SoC reset List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6325f105aad2d6d8ba08efe5aff1c860cc7df198 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=6325f105aad2d6d8ba08efe5aff1c860cc7df198 commit 6325f105aad2d6d8ba08efe5aff1c860cc7df198 Author: Adrian Chadd AuthorDate: 2021-10-20 05:33:27 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:21 +0000 ipq4018: toggle ps-hold to allow SoC reset This is enough to allow this ASUS router to reboot successfully. I tried the watchdog path and although it fires, it isn't rebooting! It's just hanging, likely somewhere in TZ. Tested: * ASUS RT-AC58U router, IPQ4019 Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 --- sys/arm/qualcomm/ipq4018_machdep.c | 42 ++++++++++++++++++++++++++++++++++++++ sys/arm/qualcomm/ipq4018_reg.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/sys/arm/qualcomm/ipq4018_machdep.c b/sys/arm/qualcomm/ipq4018_machdep.c index b3f841575ebb..39510c8294ae 100644 --- a/sys/arm/qualcomm/ipq4018_machdep.c +++ b/sys/arm/qualcomm/ipq4018_machdep.c @@ -36,10 +36,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -94,12 +96,52 @@ ipq4018_devmap_init(platform_t plat) * a call to pmap_mapdev() when the bus space code is doing its thing. */ devmap_add_entry(IPQ4018_MEM_UART1_START, IPQ4018_MEM_UART1_SIZE); + + /* + * This covers a bunch of the reset block, which includes the PS-HOLD + * register for dropping power. + */ + devmap_add_entry(IPQ4018_MEM_PSHOLD_START, IPQ4018_MEM_PSHOLD_SIZE); + return (0); } +/* + * This toggles the PS-HOLD register which on most IPQ devices will toggle + * the power control block and reset the SoC. + * + * However, there are apparently some units out there where this is not + * appropriate and instead the watchdog needs to be used. + * + * For now since there's only going to be one or two initial supported boards + * this will be fine. But if this doesn't reboot cleanly, now you know. + */ +static void +ipq4018_cpu_reset_pshold(void) +{ + bus_space_handle_t pshold; + + printf("%s: called\n", __func__); + + bus_space_map(fdtbus_bs_tag, IPQ4018_MEM_PSHOLD_START, + IPQ4018_MEM_PSHOLD_SIZE, 0, &pshold); + bus_space_write_4(fdtbus_bs_tag, pshold, 0, 0); + bus_space_barrier(fdtbus_bs_tag, pshold, 0, 0x4, + BUS_SPACE_BARRIER_WRITE); +} + static void ipq4018_cpu_reset(platform_t plat) { + spinlock_enter(); + dsb(); + + ipq4018_cpu_reset_pshold(); + + /* Spin */ + printf("%s: spinning\n", __func__); + while(1) + ; } /* diff --git a/sys/arm/qualcomm/ipq4018_reg.h b/sys/arm/qualcomm/ipq4018_reg.h index 945d650dcfd6..9c09605eab1a 100644 --- a/sys/arm/qualcomm/ipq4018_reg.h +++ b/sys/arm/qualcomm/ipq4018_reg.h @@ -39,4 +39,7 @@ #define IPQ4018_MEM_UART1_START 0x078af000 #define IPQ4018_MEM_UART1_SIZE 0x00001000 +#define IPQ4018_MEM_PSHOLD_START 0x004ab000 +#define IPQ4018_MEM_PSHOLD_SIZE 0x00001000 + #endif From nobody Thu Nov 4 16:02:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E0CE6183D9BB; Thu, 4 Nov 2021 16:02: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 4HlT1m58QXz3HFx; Thu, 4 Nov 2021 16:02: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 5B1072EF9B; Thu, 4 Nov 2021 16:02: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 1A4G2qIR003678; Thu, 4 Nov 2021 16:02:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2qvY003677; Thu, 4 Nov 2021 16:02:52 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:52 GMT Message-Id: <202111041602.1A4G2qvY003677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: a516ccc4ae04 - main - ipq4018: add SoC reset and qcom_rnd driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a516ccc4ae04975a54882651104c4a0369c3eaba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=a516ccc4ae04975a54882651104c4a0369c3eaba commit a516ccc4ae04975a54882651104c4a0369c3eaba Author: Adrian Chadd AuthorDate: 2021-10-21 03:08:56 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:30 +0000 ipq4018: add SoC reset and qcom_rnd driver Summary: This is enough to allow this ASUS router to reboot successfully. I tried the watchdog path and although it fires, it isn't rebooting! It's just hanging, likely somewhere in TZ. This is the MVP required to initialise and consume random data from the QCA PRNG hardware found on the IPQ401x. Test Plan: * ASUS RT-AC58U router, IPQ4019 Subscribers: imp, andrew Differential Revision: https://reviews.freebsd.org/D32723 --- sys/arm/conf/std.qca | 3 +++ sys/arm/qualcomm/std.ipq4018 | 2 ++ 2 files changed, 5 insertions(+) diff --git a/sys/arm/conf/std.qca b/sys/arm/conf/std.qca index cabd5f309121..091de6178094 100644 --- a/sys/arm/conf/std.qca +++ b/sys/arm/conf/std.qca @@ -12,6 +12,9 @@ files "../qualcomm/std.ipq4018" device uart device uart_msm # Qualcomm MSM UART driver +# Random +device qcom_rnd + device gic # MMC/SD/SDIO Card slot support diff --git a/sys/arm/qualcomm/std.ipq4018 b/sys/arm/qualcomm/std.ipq4018 index 9a9801fa6415..823d7e74cb50 100644 --- a/sys/arm/qualcomm/std.ipq4018 +++ b/sys/arm/qualcomm/std.ipq4018 @@ -1,2 +1,4 @@ arm/qualcomm/ipq4018_machdep.c standard arm/qualcomm/ipq4018_mp.c optional smp + +dev/qcom_rnd/qcom_rnd.c optional qcom_rnd From nobody Thu Nov 4 16:02:51 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 76EF0183DA27; Thu, 4 Nov 2021 16:02: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 4HlT1l3tswz3HDG; Thu, 4 Nov 2021 16:02: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 4D21D2F0F9; Thu, 4 Nov 2021 16:02: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 1A4G2pxk003654; Thu, 4 Nov 2021 16:02:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2p7J003653; Thu, 4 Nov 2021 16:02:51 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:51 GMT Message-Id: <202111041602.1A4G2p7J003653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 1492c8c0d825 - main - qcom_rnd: add initial qualcomm prng driver. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1492c8c0d825d1dcd8a2b2975fe35e4269b0b7de Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=1492c8c0d825d1dcd8a2b2975fe35e4269b0b7de commit 1492c8c0d825d1dcd8a2b2975fe35e4269b0b7de Author: Adrian Chadd AuthorDate: 2021-10-21 03:05:10 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:27 +0000 qcom_rnd: add initial qualcomm prng driver. This is the MVP required to initialise and consume random data from the QCA PRNG hardware found on the IPQ401x. Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 --- sys/dev/qcom_rnd/qcom_rnd.c | 257 ++++++++++++++++++++++++++++++++++++++++ sys/dev/qcom_rnd/qcom_rnd_reg.h | 43 +++++++ sys/sys/random.h | 1 + 3 files changed, 301 insertions(+) diff --git a/sys/dev/qcom_rnd/qcom_rnd.c b/sys/dev/qcom_rnd/qcom_rnd.c new file mode 100644 index 000000000000..c78438a29ba0 --- /dev/null +++ b/sys/dev/qcom_rnd/qcom_rnd.c @@ -0,0 +1,257 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021, Adrian Chadd + * + * 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 unmodified, 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 ``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 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. + */ + +/* Driver for Qualcomm MSM entropy device. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +struct qcom_rnd_softc { + device_t dev; + int reg_rid; + struct resource *reg; +}; + +static int qcom_rnd_modevent(module_t, int, void *); + +static int qcom_rnd_probe(device_t); +static int qcom_rnd_attach(device_t); +static int qcom_rnd_detach(device_t); + +static int qcom_rnd_harvest(struct qcom_rnd_softc *, void *, size_t *); +static unsigned qcom_rnd_read(void *, unsigned); + +static struct random_source random_qcom_rnd = { + .rs_ident = "Qualcomm Entropy Adapter", + .rs_source = RANDOM_PURE_QUALCOMM, + .rs_read = qcom_rnd_read, +}; + +/* Kludge for API limitations of random(4). */ +static _Atomic(struct qcom_rnd_softc *) g_qcom_rnd_softc; + +static int +qcom_rnd_modevent(module_t mod, int type, void *unused) +{ + int error; + + switch (type) { + case MOD_LOAD: + case MOD_QUIESCE: + case MOD_UNLOAD: + case MOD_SHUTDOWN: + error = 0; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + +static int +qcom_rnd_probe(device_t dev) +{ + if (! ofw_bus_status_okay(dev)) { + return (ENXIO); + } + + if (ofw_bus_is_compatible(dev, "qcom,prng") == 0) { + return (ENXIO); + } + + return (0); +} + +static int +qcom_rnd_attach(device_t dev) +{ + struct qcom_rnd_softc *sc, *exp; + uint32_t reg; + + sc = device_get_softc(dev); + + + /* Found a compatible device! */ + + sc->dev = dev; + + exp = NULL; + if (!atomic_compare_exchange_strong_explicit(&g_qcom_rnd_softc, &exp, + sc, memory_order_release, memory_order_acquire)) { + return (ENXIO); + } + + sc->reg_rid = 0; + sc->reg = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, + &sc->reg_rid, 0x140, RF_ACTIVE); + if (sc->reg == NULL) { + device_printf(dev, "Couldn't allocate memory resource!\n"); + return (ENXIO); + } + + device_set_desc(dev, "Qualcomm PRNG"); + + /* + * Check to see whether the PRNG has already been setup or not. + */ + bus_barrier(sc->reg, 0, 0x120, BUS_SPACE_BARRIER_READ); + reg = bus_read_4(sc->reg, QCOM_RND_PRNG_CONFIG); + if (reg & QCOM_RND_PRNG_CONFIG_HW_ENABLE) { + device_printf(dev, "PRNG HW already enabled\n"); + } else { + /* + * Do PRNG setup and then enable it. + */ + reg = bus_read_4(sc->reg, QCOM_RND_PRNG_LFSR_CFG); + reg &= QCOM_RND_PRNG_LFSR_CFG_MASK; + reg |= QCOM_RND_PRNG_LFSR_CFG_CLOCKS; + bus_write_4(sc->reg, QCOM_RND_PRNG_LFSR_CFG, reg); + bus_barrier(sc->reg, 0, 0x120, BUS_SPACE_BARRIER_WRITE); + + reg = bus_read_4(sc->reg, QCOM_RND_PRNG_CONFIG); + reg |= QCOM_RND_PRNG_CONFIG_HW_ENABLE; + bus_write_4(sc->reg, QCOM_RND_PRNG_CONFIG, reg); + bus_barrier(sc->reg, 0, 0x120, BUS_SPACE_BARRIER_WRITE); + } + + random_source_register(&random_qcom_rnd); + return (0); + +} + +static int +qcom_rnd_detach(device_t dev) +{ + struct qcom_rnd_softc *sc; + + sc = device_get_softc(dev); + KASSERT( + atomic_load_explicit(&g_qcom_rnd_softc, memory_order_acquire) == sc, + ("only one global instance at a time")); + + random_source_deregister(&random_qcom_rnd); + if (sc->reg != NULL) { + bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->reg_rid, sc->reg); + } + atomic_store_explicit(&g_qcom_rnd_softc, NULL, memory_order_release); + return (0); +} + +static int +qcom_rnd_harvest(struct qcom_rnd_softc *sc, void *buf, size_t *sz) +{ + /* + * Add data to buf until we either run out of entropy or we + * fill the buffer. + * + * Note - be mindful of the provided buffer size; we're reading + * 4 bytes at a time but we only want to supply up to the max + * buffer size, so don't write past it! + */ + size_t rz = 0; + uint32_t reg; + + while (rz < *sz) { + bus_barrier(sc->reg, 0, 0x120, BUS_SPACE_BARRIER_READ); + reg = bus_read_4(sc->reg, QCOM_RND_PRNG_STATUS); + if ((reg & QCOM_RND_PRNG_STATUS_DATA_AVAIL) == 0) + break; + reg = bus_read_4(sc->reg, QCOM_RND_PRNG_DATA_OUT); + memcpy(((char *) buf) + rz, ®, sizeof(uint32_t)); + rz += sizeof(uint32_t); + } + + if (rz == 0) + return (EAGAIN); + *sz = rz; + return (0); +} + +static unsigned +qcom_rnd_read(void *buf, unsigned usz) +{ + struct qcom_rnd_softc *sc; + size_t sz; + int error; + + sc = g_qcom_rnd_softc; + if (sc == NULL) + return (0); + + sz = usz; + error = qcom_rnd_harvest(sc, buf, &sz); + if (error != 0) + return (0); + + return (sz); +} + +static device_method_t qcom_rnd_methods[] = { + /* Device methods. */ + DEVMETHOD(device_probe, qcom_rnd_probe), + DEVMETHOD(device_attach, qcom_rnd_attach), + DEVMETHOD(device_detach, qcom_rnd_detach), + + DEVMETHOD_END +}; + +static driver_t qcom_rnd_driver = { + "qcom_rnd", + qcom_rnd_methods, + sizeof(struct qcom_rnd_softc) +}; +static devclass_t qcom_rnd_devclass; + +DRIVER_MODULE(qcom_rnd_random, simplebus, qcom_rnd_driver, qcom_rnd_devclass, + qcom_rnd_modevent, 0); +DRIVER_MODULE(qcom_rnd_random, ofwbus, qcom_rnd_driver, qcom_rnd_devclass, + qcom_rnd_modevent, 0); +MODULE_DEPEND(qcom_rnd_random, random_device, 1, 1, 1); +MODULE_VERSION(qcom_rnd_random, 1); diff --git a/sys/dev/qcom_rnd/qcom_rnd_reg.h b/sys/dev/qcom_rnd/qcom_rnd_reg.h new file mode 100644 index 000000000000..64cb0d678b6b --- /dev/null +++ b/sys/dev/qcom_rnd/qcom_rnd_reg.h @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021, Adrian Chadd + * + * 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 unmodified, 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 ``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 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 __QCOM_RND_REG_H__ +#define __QCOM_RND_REG_H__ + +#define QCOM_RND_PRNG_DATA_OUT 0x0000 + +#define QCOM_RND_PRNG_STATUS 0x0004 +#define QCOM_RND_PRNG_STATUS_DATA_AVAIL (1 << 0) + +#define QCOM_RND_PRNG_LFSR_CFG 0x0100 +#define QCOM_RND_PRNG_LFSR_CFG_MASK 0x0000ffff +#define QCOM_RND_PRNG_LFSR_CFG_CLOCKS 0x0000dddd + +#define QCOM_RND_PRNG_CONFIG 0x0104 +#define QCOM_RND_PRNG_CONFIG_HW_ENABLE (1 << 1) + +#endif /* __QCOM_RND_REG_H__ */ diff --git a/sys/sys/random.h b/sys/sys/random.h index e2c4ab144d2a..cfcf4b30e698 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -102,6 +102,7 @@ enum random_entropy_source { RANDOM_PURE_DARN, RANDOM_PURE_TPM, RANDOM_PURE_VMGENID, + RANDOM_PURE_QUALCOMM, ENTROPYSOURCE }; _Static_assert(ENTROPYSOURCE <= 32, From nobody Thu Nov 4 16:02:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A80E3183DB20; Thu, 4 Nov 2021 16:02: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 4HlT1p0czBz3HDb; Thu, 4 Nov 2021 16:02: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 60B772EA76; Thu, 4 Nov 2021 16:02: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 1A4G2ri1003704; Thu, 4 Nov 2021 16:02:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2rEo003703; Thu, 4 Nov 2021 16:02:53 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:53 GMT Message-Id: <202111041602.1A4G2rEo003703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 960e65d23aaa - main - qcom: add initial SCM legacy API List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 960e65d23aaa55dd00255e95f14c2f6256a4fce3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=960e65d23aaa55dd00255e95f14c2f6256a4fce3 commit 960e65d23aaa55dd00255e95f14c2f6256a4fce3 Author: Adrian Chadd AuthorDate: 2021-10-30 03:34:08 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:33 +0000 qcom: add initial SCM legacy API This is a very simple implementation of Qualcomm's SCM API. It is just the structure/field definitions and the atomic SCM call which doesn't use the structs yet - it uses the field definitions inside registers. I've tested that setting the cold boot address via the atomic API is fine - Linux does the same thing. But not all SCM calls can be done via the legacy API. This is a reimplementation based on the Linux qualcomm SCM legacy code and definitions. Tested: * Qualcomm IPQ4018 AP, as part of other changes for doing SMP bring-up Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 --- sys/arm/conf/std.qca | 3 + sys/arm/qualcomm/qcom_scm_defs.h | 122 ++++++++++++++++++++++++++ sys/arm/qualcomm/qcom_scm_legacy.c | 88 +++++++++++++++++++ sys/arm/qualcomm/qcom_scm_legacy.h | 41 +++++++++ sys/arm/qualcomm/qcom_scm_legacy_defs.h | 149 ++++++++++++++++++++++++++++++++ sys/arm/qualcomm/std.ipq4018 | 1 + 6 files changed, 404 insertions(+) diff --git a/sys/arm/conf/std.qca b/sys/arm/conf/std.qca index 091de6178094..00d627b77b7b 100644 --- a/sys/arm/conf/std.qca +++ b/sys/arm/conf/std.qca @@ -25,6 +25,9 @@ device sdhci device generic_timer device mpcore_timer +# PSCI - SMC calls, needed for qualcomm SCM +device psci + options FDT # Disable CP14 work in DDB as TZ won't let us by default diff --git a/sys/arm/qualcomm/qcom_scm_defs.h b/sys/arm/qualcomm/qcom_scm_defs.h new file mode 100644 index 000000000000..f4fe0fd76b52 --- /dev/null +++ b/sys/arm/qualcomm/qcom_scm_defs.h @@ -0,0 +1,122 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __QCOM_SCM_DEFS_H__ +#define __QCOM_SCM_DEFS_H__ + +/* + * Maximum SCM arguments and return values. + */ +#define MAX_QCOM_SCM_ARGS 10 +#define MAX_QCOM_SCM_RETS 3 + +/* + * SCM argument type definitions. + */ +#define QCOM_SCM_ARGTYPE_VAL 0x00 +#define QCOM_SCM_ARGTYPE_RO 0x01 +#define QCOM_SCM_ARGTYPE_RW 0x02 +#define QCOM_SCM_ARGTYPE_BUFVAL 0x03 + +/* + * SCM calls + arguments. + */ +#define QCOM_SCM_SVC_BOOT 0x01 +#define QCOM_SCM_BOOT_SET_ADDR 0x01 +#define QCOM_SCM_BOOT_TERMINATE_PC 0x02 +#define QCOM_SCM_BOOT_SET_DLOAD_MODE 0x10 +#define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a +#define QCOM_SCM_FLUSH_FLAG_MASK 0x3 + +/* Flags for QCOM_SCM_BOOT_SET_ADDR argv[0] */ +/* Note: no COLDBOOT for CPU0, it's already booted */ +#define QCOM_SCM_FLAG_COLDBOOT_CPU1 0x01 +#define QCOM_SCM_FLAG_WARMBOOT_CPU1 0x02 +#define QCOM_SCM_FLAG_WARMBOOT_CPU0 0x04 +#define QCOM_SCM_FLAG_COLDBOOT_CPU2 0x08 +#define QCOM_SCM_FLAG_WARMBOOT_CPU2 0x10 +#define QCOM_SCM_FLAG_COLDBOOT_CPU3 0x20 +#define QCOM_SCM_FLAG_WARMBOOT_CPU3 0x40 + +#define QCOM_SCM_SVC_PIL 0x02 +#define QCOM_SCM_PIL_PAS_INIT_IMAGE 0x01 +#define QCOM_SCM_PIL_PAS_MEM_SETUP 0x02 +#define QCOM_SCM_PIL_PAS_AUTH_AND_RESET 0x05 +#define QCOM_SCM_PIL_PAS_SHUTDOWN 0x06 +#define QCOM_SCM_PIL_PAS_IS_SUPPORTED 0x07 +#define QCOM_SCM_PIL_PAS_MSS_RESET 0x0a + +#define QCOM_SCM_SVC_IO 0x05 +#define QCOM_SCM_IO_READ 0x01 +#define QCOM_SCM_IO_WRITE 0x02 + +/* + * Fetch SCM call availability information. + */ +#define QCOM_SCM_SVC_INFO 0x06 +#define QCOM_SCM_INFO_IS_CALL_AVAIL 0x01 + +#define QCOM_SCM_SVC_MP 0x0c +#define QCOM_SCM_MP_RESTORE_SEC_CFG 0x02 +#define QCOM_SCM_MP_IOMMU_SECURE_PTBL_SIZE 0x03 +#define QCOM_SCM_MP_IOMMU_SECURE_PTBL_INIT 0x04 +#define QCOM_SCM_MP_VIDEO_VAR 0x08 +#define QCOM_SCM_MP_ASSIGN 0x16 + +#define QCOM_SCM_SVC_OCMEM 0x0f +#define QCOM_SCM_OCMEM_LOCK_CMD 0x01 +#define QCOM_SCM_OCMEM_UNLOCK_CMD 0x02 + +#define QCOM_SCM_SVC_ES 0x10 +#define QCOM_SCM_ES_INVALIDATE_ICE_KEY 0x03 +#define QCOM_SCM_ES_CONFIG_SET_ICE_KEY 0x04 + +#define QCOM_SCM_SVC_HDCP 0x11 +#define QCOM_SCM_HDCP_INVOKE 0x01 + +#define QCOM_SCM_SVC_LMH 0x13 +#define QCOM_SCM_LMH_LIMIT_PROFILE_CHANGE 0x01 +#define QCOM_SCM_LMH_LIMIT_DCVSH 0x10 + +#define QCOM_SCM_SVC_SMMU_PROGRAM 0x15 +#define QCOM_SCM_SMMU_CONFIG_ERRATA1 0x03 +#define QCOM_SCM_SMMU_CONFIG_ERRATA1_CLIENT_ALL 0x02 + +/* + * Return values from the SCM calls. + */ +#define QCOM_SCM_RETVAL_V2_EBUSY -12 +#define QCOM_SCM_RETVAL_ENOMEM -5 +#define QCOM_SCM_RETVAL_EOPNOTSUPP -4 +#define QCOM_SCM_RETVAL_EINVAL_ADDR -3 +#define QCOM_SCM_RETVAL_EINVAL_ARG -2 +#define QCOM_SCM_RETVAL_ERROR -1 +#define QCOM_SCM_RETVAL_INTERRUPTED 1 + +#endif /* __QCOM_SCM_DEFS_H__ */ diff --git a/sys/arm/qualcomm/qcom_scm_legacy.c b/sys/arm/qualcomm/qcom_scm_legacy.c new file mode 100644 index 000000000000..d773e095185b --- /dev/null +++ b/sys/arm/qualcomm/qcom_scm_legacy.c @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* + * Set the cold boot address for (later) a mask of CPUs. + * + * Don't set it for CPU0, that CPU is the boot CPU and is already alive. + * + * For now it sets it on CPU1..3. + * + * This works on the IPQ4019 as tested; the retval is 0x0. + */ +uint32_t +qcom_scm_legacy_mp_set_cold_boot_address(vm_offset_t mp_entry_func) +{ + struct arm_smccc_res res; + int ret; + int context_id; + + uint32_t scm_arg0 = QCOM_SCM_LEGACY_ATOMIC_ID(QCOM_SCM_SVC_BOOT, + QCOM_SCM_BOOT_SET_ADDR, 2); + + uint32_t scm_arg1 = QCOM_SCM_FLAG_COLDBOOT_CPU1 + | QCOM_SCM_FLAG_COLDBOOT_CPU2 + | QCOM_SCM_FLAG_COLDBOOT_CPU3; + uint32_t scm_arg2 = pmap_kextract((vm_offset_t)mp_entry_func); + + ret = arm_smccc_smc(scm_arg0, (uint32_t) &context_id, scm_arg1, + scm_arg2, 0, 0, 0, 0, &res); + + if (ret == 0 && res.a0 == 0) + return (0); + printf("%s: called; error; ret=0x%08x; retval[0]=0x%08x\n", + __func__, ret, res.a0); + + return (0); +} diff --git a/sys/arm/qualcomm/qcom_scm_legacy.h b/sys/arm/qualcomm/qcom_scm_legacy.h new file mode 100644 index 000000000000..a0f9d44062cf --- /dev/null +++ b/sys/arm/qualcomm/qcom_scm_legacy.h @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __QCOM_SCM_LEGACY_H__ +#define __QCOM_SCM_LEGACY_H__ + +/* + * These functions are specific to the 32 bit legacy SCM interface + * used by the IPQ806x and IPQ401x SoCs. + */ + +extern uint32_t qcom_scm_legacy_mp_set_cold_boot_address( + vm_offset_t mp_entry_func); + +#endif /* __QCOM_SCM_LEGACY_H__ */ diff --git a/sys/arm/qualcomm/qcom_scm_legacy_defs.h b/sys/arm/qualcomm/qcom_scm_legacy_defs.h new file mode 100644 index 000000000000..d34a552d4b80 --- /dev/null +++ b/sys/arm/qualcomm/qcom_scm_legacy_defs.h @@ -0,0 +1,149 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __QCOM_SCM_LEGACY_DEFS_H__ +#define __QCOM_SCM_LEGACY_DEFS_H__ + +/* + * These definitions are specific to the 32 bit legacy SCM interface + * used by the IPQ806x and IPQ401x SoCs. + */ + +/* + * Mapping of the SCM service/command fields into the a0 argument + * in an SMC instruction call. + * + * This is particular to the legacy SCM interface, and is not the + * same as the non-legacy 32/64 bit FNID mapping layout. + */ +#define QCOM_SCM_LEGACY_SMC_FNID(s, c) (((s) << 10) | ((c) & 0x3ff)) + +/* + * There are two kinds of SCM calls in this legacy path. + * + * The first kind are the normal ones - up to a defined max of arguments, + * a defined max of responses and some identifiers for all of it. + * They can be issues in parallel on different cores, can be interrupted, + * etc. + * + * The second kind are what are termed "atomic" SCM calls - + * up to 5 argument DWORDs, up to 3 response DWORDs, done atomically, + * not interruptable/parallel. + * + * The former use the structures below to represent the request and response + * in memory. The latter use defines and a direct SMC call with the + * arguments in registers. + */ + +struct qcom_scm_legacy_smc_args { + uint32_t args[8]; +}; + +/* + * Atomic SCM call command/response buffer definitions. + */ +#define QCOM_SCM_LEGACY_ATOMIC_MAX_ARGCOUNT 5 +#define QCOM_SCM_LEGACY_CLASS_REGISTER (0x2 << 8) +#define QCOM_SCM_LEGACY_MASK_IRQS (1U << 5) + +/* + * Mapping an SCM service/command/argcount into the a0 register + * for an SMC instruction call. + */ +#define QCOM_SCM_LEGACY_ATOMIC_ID(svc, cmd, n) \ + ((QCOM_SCM_LEGACY_SMC_FNID((svc), cmd) << 12) | \ + QCOM_SCM_LEGACY_CLASS_REGISTER | \ + QCOM_SCM_LEGACY_MASK_IRQS | \ + ((n) & 0xf)) + +/* + * Legacy command/response buffer definitions. + * + * The legacy path contains up to the defined maximum arguments + * but only a single command/response pair per call. + * + * A command and response buffer is laid out in memory as such: + * + * | command header | + * | (buffer payload) | + * | response header | + * | (response payload) | + */ + +/* + * The command header. + * + * len - the length of the total command and response, including + * the headers. + * + * buf_offset - the offset inside the buffer, starting at the + * beginning of this command header, where the command buffer + * is found. The end is the byte before the response_header_offset. + * + * response_header_offset - the offset inside the buffer where + * the response header is found. + * + * id - the QCOM_SCM_LEGACY_SMC_FNID() - service/command ids + */ +struct qcom_scm_legacy_command_header { + uint32_t len; + uint32_t buf_offset; + uint32_t response_header_offset; + uint32_t id; +}; + +/* + * The response header. + * + * This is found immediately after the command header and command + * buffer payload. + * + * len - the total amount of memory available for the response. + * Linux doesn't set this; it always passes in a response + * buffer large enough to store MAX_QCOM_SCM_RETS * DWORD + * bytes. + * + * It's also possible this is set by the firmware. + * + * buf_offset - start of response buffer, relative to the beginning + * of the command header. This also isn't set in Linux before + * calling the SMC instruction, but it is checked afterwards + * to assemble a pointer to the response data. The firmware + * likely sets this. + * + * is_complete - true if complete. Linux loops over DMA sync to + * check if this is complete even after the SMC call returns. + */ +struct qcom_scm_legacy_response_header { + uint32_t len; + uint32_t buf_offset; + uint32_t is_complete; +}; + +#endif /* __QCOM_SCM_LEGACY_DEFS_H__ */ diff --git a/sys/arm/qualcomm/std.ipq4018 b/sys/arm/qualcomm/std.ipq4018 index 823d7e74cb50..6492dbd06b1b 100644 --- a/sys/arm/qualcomm/std.ipq4018 +++ b/sys/arm/qualcomm/std.ipq4018 @@ -1,4 +1,5 @@ arm/qualcomm/ipq4018_machdep.c standard arm/qualcomm/ipq4018_mp.c optional smp +arm/qualcomm/qcom_scm_legacy.c standard dev/qcom_rnd/qcom_rnd.c optional qcom_rnd From nobody Thu Nov 4 16:02:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6D63D183D9E2; Thu, 4 Nov 2021 16:02: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 4HlT1q69Ytz3HP8; Thu, 4 Nov 2021 16:02: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 72FF82F181; Thu, 4 Nov 2021 16:02: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 1A4G2sqM003735; Thu, 4 Nov 2021 16:02:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2sDd003734; Thu, 4 Nov 2021 16:02:54 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:54 GMT Message-Id: <202111041602.1A4G2sDd003734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: d3514c294207 - main - ipq401x: add MP core start-up path for the CPU regulator/clock gate used List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3514c294207bd5cda7f4276ebff5235bb239b8a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=d3514c294207bd5cda7f4276ebff5235bb239b8a commit d3514c294207bd5cda7f4276ebff5235bb239b8a Author: Adrian Chadd AuthorDate: 2021-10-30 04:27:02 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:36 +0000 ipq401x: add MP core start-up path for the CPU regulator/clock gate used This code implements the "kpssv2" flavour of CPU regulator/clock gating in Linux. It's used by at least the ipq4018/4019 to power on and off CPU cores. This is based on the Linux implementation - the register definitions and values are from Linux and I've reverse engineered the sequencing requirements. The MP bring-up is: * set cold boot address via an SCM call - this is the address used by the bootloader/TZ firmware to jump to when the CPUs boot * power down the LDO feeding the CPU core and wait for it to settle * program in the right set of LDO and power tree configuration for the CPU regulator to power up the core. Unfortunately these are magic numbers that I've not found documented anywhere. * (I think) power up the shared L2 cache connect if it isn't. * Clamp the power into the core down; put the core into reset * Unclamp the power rail; release reset; and then set the core to boot. The MP core will then boot the bootloader/TZ firmware and then will wait until an incoming interrupt kicks it to start @ mpentry. Tested: * IPQ4019, 4 CPUs Release APs CPU(3) applied BP hardening: not necessary CPU(1) applied BP hardening: not necessary CPU(2) applied BP hardening: not necessary Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 --- sys/arm/qualcomm/ipq4018_mp.c | 55 +++++++++ sys/arm/qualcomm/qcom_cpu_kpssv2.c | 211 +++++++++++++++++++++++++++++++++ sys/arm/qualcomm/qcom_cpu_kpssv2.h | 35 ++++++ sys/arm/qualcomm/qcom_cpu_kpssv2_reg.h | 58 +++++++++ sys/arm/qualcomm/std.ipq4018 | 1 + 5 files changed, 360 insertions(+) diff --git a/sys/arm/qualcomm/ipq4018_mp.c b/sys/arm/qualcomm/ipq4018_mp.c index 37b7cc3e097d..a7ebb7d7d6c8 100644 --- a/sys/arm/qualcomm/ipq4018_mp.c +++ b/sys/arm/qualcomm/ipq4018_mp.c @@ -35,27 +35,82 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include #include +#include #include #include +#include #include +#include +#include #include "platform_if.h" void ipq4018_mp_setmaxid(platform_t plat) { + int ncpu; + + /* If we've already set the global vars don't bother to do it again. */ + if (mp_ncpus != 0) + return; + + /* Read current CP15 Cache Size ID Register */ + ncpu = cp15_l2ctlr_get(); + ncpu = CPUV7_L2CTLR_NPROC(ncpu); + + mp_ncpus = ncpu; + mp_maxid = ncpu - 1; + + printf("SMP: ncpu=%d\n", ncpu); +} + +static boolean_t +ipq4018_start_ap(u_int id, phandle_t node, u_int addr_cells, pcell_t *arg) +{ + + /* + * For the IPQ401x we assume the enable method is + * "qcom,kpss-acc-v2". If this path gets turned into + * something more generic for other 32 bit qualcomm + * SoCs then we'll likely want to turn this into a + * switch based on "enable-method". + */ + return qcom_cpu_kpssv2_regulator_start(id, node); } void ipq4018_mp_start_ap(platform_t plat) { + int ret; + + /* + * First step - SCM call to set the cold boot address to mpentry, so + * CPUs hopefully start in the MP path. + */ + ret = qcom_scm_legacy_mp_set_cold_boot_address((vm_offset_t) mpentry); + if (ret != 0) + panic("%s: Couldn't set cold boot address via SCM " + "(error 0x%08x)", __func__, ret); + + /* + * Next step - loop over the CPU nodes and do the per-CPU setup + * required to power on the CPUs themselves. + */ + ofw_cpu_early_foreach(ipq4018_start_ap, true); + + /* + * The next set of IPIs to the CPUs will wake them up and enter + * mpentry. + */ } diff --git a/sys/arm/qualcomm/qcom_cpu_kpssv2.c b/sys/arm/qualcomm/qcom_cpu_kpssv2.c new file mode 100644 index 000000000000..4193f952549b --- /dev/null +++ b/sys/arm/qualcomm/qcom_cpu_kpssv2.c @@ -0,0 +1,211 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "platform_if.h" + +/* + * Since DELAY() hangs this early, we need some way to + * delay things to settle. + */ +static inline void +loop_delay(int usec) +{ + int lcount = usec * 100000; + + for (volatile int i = 0; i < lcount; i++) + ; +} + +/* + * This is the KPSSv2 (eg IPQ4018) regulator path for CPU + * and shared L2 cache power-on. + */ +boolean_t +qcom_cpu_kpssv2_regulator_start(u_int id, phandle_t node) +{ + phandle_t acc_phandle, l2_phandle, saw_phandle; + bus_space_tag_t acc_tag, saw_tag; + bus_space_handle_t acc_handle, saw_handle; + bus_size_t acc_sz, saw_sz; + ssize_t sret; + int ret; + uint32_t reg_val; + + /* + * We don't need to power up CPU 0! This will power it + * down first and ... then everything hangs. + */ + if (id == 0) + return true; + + /* + * Walk the qcom,acc and next-level-cache entries to find their + * child phandles and thus regulators. + * + * The qcom,acc is a phandle to a node. + * + * The next-level-cache actually is a phandle through to a qcom,saw + * entry. + */ + sret = OF_getencprop(node, "qcom,acc", (void *) &acc_phandle, + sizeof(acc_phandle)); + if (sret != sizeof(acc_phandle)) + panic("***couldn't get phandle for qcom,acc"); + acc_phandle = OF_node_from_xref(acc_phandle); + + sret = OF_getencprop(node, "next-level-cache", (void *) &l2_phandle, + sizeof(l2_phandle)); + if (sret != sizeof(l2_phandle)) + panic("***couldn't get phandle for next-level-cache"); + l2_phandle = OF_node_from_xref(l2_phandle); + + sret = OF_getencprop(l2_phandle, "qcom,saw", (void *) &saw_phandle, + sizeof(saw_phandle)); + if (sret != sizeof(saw_phandle)) + panic("***couldn't get phandle for qcom,saw"); + l2_phandle = OF_node_from_xref(l2_phandle); + + /* + * Now that we have the phandles referencing the correct locations, + * do some KVA mappings so we can go access the registers. + */ + ret = OF_decode_addr(acc_phandle, 0, &acc_tag, &acc_handle, &acc_sz); + if (ret != 0) + panic("*** couldn't map qcom,acc space (%d)", ret); + ret = OF_decode_addr(saw_phandle, 0, &saw_tag, &saw_handle, &saw_sz); + if (ret != 0) + panic("*** couldn't map next-level-cache -> " + "qcom,saw space (%d)", ret); + + /* + * Power sequencing to ensure the cores are off, then power them on + * and bring them out of reset. + */ + + /* + * BHS: off + * LDO: bypassed, powered off + */ + reg_val = (64 << QCOM_APC_PWR_GATE_CTL_BHS_CNT_SHIFT) + | (0x3f << QCOM_APC_PWR_GATE_CTL_LDO_PWR_DWN_SHIFT) + | QCOM_APC_PWR_GATE_CTL_BHS_EN; + bus_space_write_4(acc_tag, acc_handle, QCOM_APC_PWR_GATE_CTL, reg_val); + mb(); + /* Settle time */ + loop_delay(1); + + /* + * Start up BHS segments. + */ + reg_val |= 0x3f << QCOM_APC_PWR_GATE_CTL_BHS_SEG_SHIFT; + bus_space_write_4(acc_tag, acc_handle, QCOM_APC_PWR_GATE_CTL, reg_val); + mb(); + /* Settle time */ + loop_delay(1); + + /* + * Switch on the LDO bypass; BHS will now supply power. + */ + reg_val |= 0x3f << QCOM_APC_PWR_GATE_CTL_LDO_BYP_SHIFT; + bus_space_write_4(acc_tag, acc_handle, QCOM_APC_PWR_GATE_CTL, reg_val); + + /* + * Shared L2 regulator control. + */ + bus_space_write_4(saw_tag, saw_handle, QCOM_APCS_SAW2_2_VCTL, 0x10003); + mb(); + /* Settle time */ + loop_delay(50); + + /* + * Put the core in reset. + */ + reg_val = QCOM_APCS_CPU_PWR_CTL_COREPOR_RST + | QCOM_APCS_CPU_PWR_CTL_CLAMP; + bus_space_write_4(acc_tag, acc_handle, QCOM_APCS_CPU_PWR_CTL, reg_val); + mb(); + loop_delay(2); + + /* + * Remove power-down clamp. + */ + reg_val &= ~QCOM_APCS_CPU_PWR_CTL_CLAMP; + bus_space_write_4(acc_tag, acc_handle, QCOM_APCS_CPU_PWR_CTL, reg_val); + mb(); + loop_delay(2); + + /* + * Clear core power reset. + */ + reg_val &= ~QCOM_APCS_CPU_PWR_CTL_COREPOR_RST; + bus_space_write_4(acc_tag, acc_handle, QCOM_APCS_CPU_PWR_CTL, reg_val); + mb(); + + /* + * The power is ready, the core is out of reset, signal the core + * to power up. + */ + reg_val |= QCOM_APCS_CPU_PWR_CTL_CORE_PWRD_UP; + bus_space_write_4(acc_tag, acc_handle, QCOM_APCS_CPU_PWR_CTL, reg_val); + mb(); + + /* + * Finished with these KVA mappings, so release them. + */ + bus_space_unmap(acc_tag, acc_handle, acc_sz); + bus_space_unmap(saw_tag, saw_handle, saw_sz); + + return true; +} diff --git a/sys/arm/qualcomm/qcom_cpu_kpssv2.h b/sys/arm/qualcomm/qcom_cpu_kpssv2.h new file mode 100644 index 000000000000..18e4affc208e --- /dev/null +++ b/sys/arm/qualcomm/qcom_cpu_kpssv2.h @@ -0,0 +1,35 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __QCOM_CPU_KPSSV2_H__ +#define __QCOM_CPU_KPSSV2_H__ + +extern boolean_t qcom_cpu_kpssv2_regulator_start(u_int id, phandle_t node); + +#endif /* __QCOM_CPU_KPSSV2_H__ */ diff --git a/sys/arm/qualcomm/qcom_cpu_kpssv2_reg.h b/sys/arm/qualcomm/qcom_cpu_kpssv2_reg.h new file mode 100644 index 000000000000..b966571e9fdd --- /dev/null +++ b/sys/arm/qualcomm/qcom_cpu_kpssv2_reg.h @@ -0,0 +1,58 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __QCOM_CPU_KPSSV2_REG_H__ +#define __QCOM_CPU_KPSSV2_REG_H__ + + +/* + * APCS CPU core regulator registers. + */ +#define QCOM_APCS_CPU_PWR_CTL 0x04 +#define QCOM_APCS_CPU_PWR_CTL_PLL_CLAMP (1U << 8) +#define QCOM_APCS_CPU_PWR_CTL_CORE_PWRD_UP (1U << 7) +#define QCOM_APCS_CPU_PWR_CTL_COREPOR_RST (1U << 5) +#define QCOM_APCS_CPU_PWR_CTL_CORE_RST (1U << 4) +#define QCOM_APCS_CPU_PWR_CTL_L2DT_SLP (1U << 3) +#define QCOM_APCS_CPU_PWR_CTL_CLAMP (1U << 0) + +#define QCOM_APC_PWR_GATE_CTL 0x14 +#define QCOM_APC_PWR_GATE_CTL_BHS_CNT_SHIFT 24 +#define QCOM_APC_PWR_GATE_CTL_LDO_PWR_DWN_SHIFT 16 +#define QCOM_APC_PWR_GATE_CTL_LDO_BYP_SHIFT 8 +#define QCOM_APC_PWR_GATE_CTL_BHS_SEG_SHIFT 1 +#define QCOM_APC_PWR_GATE_CTL_BHS_EN (1U << 0) + + +/* + * L2 cache regulator registers. + */ +#define QCOM_APCS_SAW2_2_VCTL 0x1c + +#endif /* __QCOM_CPU_KPSSV2_REG_H__ */ diff --git a/sys/arm/qualcomm/std.ipq4018 b/sys/arm/qualcomm/std.ipq4018 index 6492dbd06b1b..099fd81b5171 100644 --- a/sys/arm/qualcomm/std.ipq4018 +++ b/sys/arm/qualcomm/std.ipq4018 @@ -1,5 +1,6 @@ arm/qualcomm/ipq4018_machdep.c standard arm/qualcomm/ipq4018_mp.c optional smp arm/qualcomm/qcom_scm_legacy.c standard +arm/qualcomm/qcom_cpu_kpssv2.c optional smp dev/qcom_rnd/qcom_rnd.c optional qcom_rnd From nobody Thu Nov 4 16:02:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4DD42183DC10; Thu, 4 Nov 2021 16:02: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 4HlT1r48btz3HPL; Thu, 4 Nov 2021 16:02: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 855C42F182; Thu, 4 Nov 2021 16:02: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 1A4G2t5W003768; Thu, 4 Nov 2021 16:02:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2tXq003767; Thu, 4 Nov 2021 16:02:55 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:55 GMT Message-Id: <202111041602.1A4G2tXq003767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: bc06496744a1 - main - ipq401x: flip on SMP for the ASUS AC1300 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc06496744a1a658c1cd9c6488dd23326b52390e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=bc06496744a1a658c1cd9c6488dd23326b52390e commit bc06496744a1a658c1cd9c6488dd23326b52390e Author: Adrian Chadd AuthorDate: 2021-10-30 04:31:50 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:38 +0000 ipq401x: flip on SMP for the ASUS AC1300 This actually enables SMP and yes it boots. Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 --- sys/arm/conf/ASUS_AC1300 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/conf/ASUS_AC1300 b/sys/arm/conf/ASUS_AC1300 index 73d3d9f37eb7..67ee0b541c2e 100644 --- a/sys/arm/conf/ASUS_AC1300 +++ b/sys/arm/conf/ASUS_AC1300 @@ -38,8 +38,7 @@ makeoptions FDT_DTS_FILE=qcom-ipq4018-rt-ac58u.dts options LINUX_BOOT_ABI options SCHED_ULE -# DEFINITELY not ready for SMP yet! -# options SMP +options SMP options PLATFORM device loop @@ -50,3 +49,4 @@ device gpio device ether device mii device bpf + From nobody Thu Nov 4 16:02:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AD7A0183DC50; Thu, 4 Nov 2021 16:03: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 4HlT1w1bGMz3HRy; Thu, 4 Nov 2021 16:03: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 BEAB42EF9C; Thu, 4 Nov 2021 16:02: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 1A4G2vXJ003816; Thu, 4 Nov 2021 16:02:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2vMG003815; Thu, 4 Nov 2021 16:02:57 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:57 GMT Message-Id: <202111041602.1A4G2vMG003815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: cfd06987029a - main - ipq4018: add qcom-gcc-ipq4018 and dependencies into the build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfd06987029ac1bf5f6a6be2d87ade7358bd59ca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=cfd06987029ac1bf5f6a6be2d87ade7358bd59ca commit cfd06987029ac1bf5f6a6be2d87ade7358bd59ca Author: Adrian Chadd AuthorDate: 2021-10-31 03:45:17 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:43 +0000 ipq4018: add qcom-gcc-ipq4018 and dependencies into the build * add the extres stuff into the build, I'm going to end up leveraging all of it * include the qcom-gcc-ipq4018 driver which currently implements the hwreset side of the API. Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 --- sys/arm/conf/std.qca | 12 +++++ sys/arm/qualcomm/qcom_gcc_ipq4018_clock.c | 82 +++++++++++++++++++++++++++++++ sys/arm/qualcomm/std.ipq4018 | 1 + 3 files changed, 95 insertions(+) diff --git a/sys/arm/conf/std.qca b/sys/arm/conf/std.qca index 00d627b77b7b..09cd61078870 100644 --- a/sys/arm/conf/std.qca +++ b/sys/arm/conf/std.qca @@ -12,6 +12,15 @@ files "../qualcomm/std.ipq4018" device uart device uart_msm # Qualcomm MSM UART driver +# EXT_RESOURCES pseudo devices +options EXT_RESOURCES +device clk +device phy +device hwreset +device nvmem +device regulator +device syscon + # Random device qcom_rnd @@ -28,6 +37,9 @@ device mpcore_timer # PSCI - SMC calls, needed for qualcomm SCM device psci +# Clock/Reset provider +device qcom_gcc_ipq4018 + options FDT # Disable CP14 work in DDB as TZ won't let us by default diff --git a/sys/arm/qualcomm/qcom_gcc_ipq4018_clock.c b/sys/arm/qualcomm/qcom_gcc_ipq4018_clock.c new file mode 100644 index 000000000000..f7f7a6c348ba --- /dev/null +++ b/sys/arm/qualcomm/qcom_gcc_ipq4018_clock.c @@ -0,0 +1,82 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021, Adrian Chadd + * + * 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 unmodified, 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 ``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 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. + */ + +/* Driver for Qualcomm IPQ4018 clock and reset device */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include + + +/* + * Fixed frequency clock sources: + * + * P_XO - 48MHz + * sleep-clk - is really 32KHz, although older DTS have it as 32.768KHz + */ + +/* + * PLL derived sources: + * + * P_FEPLL125 - 125MHz + * P_FEPLL125DLY - 125MHz + * P_FEPLL200 - 200MHz + * P_FEPLL500 - 500MHz + * P_FEPLLWCSS2G - TBD + * P_FEPLLWCSS5G - TBD + * + * Then there are two DDR PLLs which are treated/configured slightly + * differently: + * + * P_DDRPLLAPSS - TBD + * P_DDRPLLSDCC - TBD + */ + +/* + * Interesting stuff in Linux whilst I reverse engineer + figure it out: + * /sys/kernel/debug/clk + */ diff --git a/sys/arm/qualcomm/std.ipq4018 b/sys/arm/qualcomm/std.ipq4018 index 7e8ac39e7222..913314e92301 100644 --- a/sys/arm/qualcomm/std.ipq4018 +++ b/sys/arm/qualcomm/std.ipq4018 @@ -6,4 +6,5 @@ arm/qualcomm/qcom_cpu_kpssv2.c optional smp dev/qcom_rnd/qcom_rnd.c optional qcom_rnd arm/qualcomm/qcom_gcc_ipq4018.c optional qcom_gcc_ipq4018 arm/qualcomm/qcom_gcc_ipq4018_reset.c optional qcom_gcc_ipq4018 +arm/qualcomm/qcom_gcc_ipq4018_clock.c optional qcom_gcc_ipq4018 From nobody Thu Nov 4 16:02:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 19B75183DB5A; Thu, 4 Nov 2021 16:02: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 4HlT1t3MPLz3HPS; Thu, 4 Nov 2021 16:02: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 9B87C2EF4F; Thu, 4 Nov 2021 16:02: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 1A4G2uQN003792; Thu, 4 Nov 2021 16:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G2ubJ003791; Thu, 4 Nov 2021 16:02:56 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:02:56 GMT Message-Id: <202111041602.1A4G2ubJ003791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: b12a863a1e14 - main - ipq4018: add initial reset driver support for the clock/reset controller. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b12a863a1e14610f6b145f235aa7452602038f9a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=b12a863a1e14610f6b145f235aa7452602038f9a commit b12a863a1e14610f6b145f235aa7452602038f9a Author: Adrian Chadd AuthorDate: 2021-10-31 03:43:27 +0000 Commit: Adrian Chadd CommitDate: 2021-11-04 16:02:41 +0000 ipq4018: add initial reset driver support for the clock/reset controller. This implements the "reset controller" side of the clock/reset controller. It's a simple array of registers and bits to set. The register table itself comes from Linux; the rest of the code is a reimplementation. It doesn't yet implement or expose the clock side - I have a lot of reverse engineering to do before that! Reviewed by: andrew, manu, imp Differential Revision: https://reviews.freebsd.org/D32723 Obtained from: Linux (registers) --- sys/arm/qualcomm/qcom_gcc_ipq4018.c | 167 +++++++++++++++++++++++++++ sys/arm/qualcomm/qcom_gcc_ipq4018_reset.c | 181 ++++++++++++++++++++++++++++++ sys/arm/qualcomm/qcom_gcc_ipq4018_var.h | 50 +++++++++ sys/arm/qualcomm/std.ipq4018 | 3 + 4 files changed, 401 insertions(+) diff --git a/sys/arm/qualcomm/qcom_gcc_ipq4018.c b/sys/arm/qualcomm/qcom_gcc_ipq4018.c new file mode 100644 index 000000000000..3002ae32a597 --- /dev/null +++ b/sys/arm/qualcomm/qcom_gcc_ipq4018.c @@ -0,0 +1,167 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021, Adrian Chadd + * + * 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 unmodified, 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 ``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 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. + */ + +/* Driver for Qualcomm IPQ4018 clock and reset device */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include "hwreset_if.h" + +#include + +#include + + +static int qcom_gcc_ipq4018_modevent(module_t, int, void *); + +static int qcom_gcc_ipq4018_probe(device_t); +static int qcom_gcc_ipq4018_attach(device_t); +static int qcom_gcc_ipq4018_detach(device_t); + +static int +qcom_gcc_ipq4018_modevent(module_t mod, int type, void *unused) +{ + int error; + + switch (type) { + case MOD_LOAD: + case MOD_QUIESCE: + case MOD_UNLOAD: + case MOD_SHUTDOWN: + error = 0; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + +static int +qcom_gcc_ipq4018_probe(device_t dev) +{ + if (! ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_is_compatible(dev, "qcom,gcc-ipq4019") == 0) + return (ENXIO); + + return (0); +} + +static int +qcom_gcc_ipq4018_attach(device_t dev) +{ + struct qcom_gcc_ipq4018_softc *sc; + + sc = device_get_softc(dev); + + /* Found a compatible device! */ + sc->dev = dev; + + sc->reg_rid = 0; + sc->reg = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, + &sc->reg_rid, 0x60000, RF_ACTIVE); + if (sc->reg == NULL) { + device_printf(dev, "Couldn't allocate memory resource!\n"); + return (ENXIO); + } + + device_set_desc(dev, "Qualcomm IPQ4018 Clock/Reset Controller"); + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + /* + * Register as a reset provider. + */ + hwreset_register_ofw_provider(dev); + + return (0); +} + +static int +qcom_gcc_ipq4018_detach(device_t dev) +{ + struct qcom_gcc_ipq4018_softc *sc; + + sc = device_get_softc(dev); + + if (sc->reg != NULL) { + bus_release_resource(sc->dev, SYS_RES_MEMORY, + sc->reg_rid, sc->reg); + } + return (0); +} + +static device_method_t qcom_gcc_ipq4018_methods[] = { + /* Device methods. */ + DEVMETHOD(device_probe, qcom_gcc_ipq4018_probe), + DEVMETHOD(device_attach, qcom_gcc_ipq4018_attach), + DEVMETHOD(device_detach, qcom_gcc_ipq4018_detach), + + /* Reset interface */ + DEVMETHOD(hwreset_assert, qcom_gcc_ipq4018_hwreset_assert), + DEVMETHOD(hwreset_is_asserted, qcom_gcc_ipq4018_hwreset_is_asserted), + + DEVMETHOD_END +}; + +static driver_t qcom_gcc_ipq4018_driver = { + "qcom_gcc", + qcom_gcc_ipq4018_methods, + sizeof(struct qcom_gcc_ipq4018_softc) +}; +static devclass_t qcom_gcc_ipq4018_devclass; + +EARLY_DRIVER_MODULE(qcom_gcc_ipq4018, simplebus, qcom_gcc_ipq4018_driver, + qcom_gcc_ipq4018_devclass, qcom_gcc_ipq4018_modevent, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(qcom_gcc_ipq4018, ofwbus, qcom_gcc_ipq4018_driver, + qcom_gcc_ipq4018_devclass, qcom_gcc_ipq4018_modevent, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +MODULE_VERSION(qcom_gcc_ipq4018_random, 1); diff --git a/sys/arm/qualcomm/qcom_gcc_ipq4018_reset.c b/sys/arm/qualcomm/qcom_gcc_ipq4018_reset.c new file mode 100644 index 000000000000..754e7636ff6e --- /dev/null +++ b/sys/arm/qualcomm/qcom_gcc_ipq4018_reset.c @@ -0,0 +1,181 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021, Adrian Chadd + * + * 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 unmodified, 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 ``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 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. + */ + +/* Driver for Qualcomm IPQ4018 clock and reset device */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include "hwreset_if.h" + +#include + +#include + + +static const struct qcom_gcc_ipq4018_reset_entry gcc_ipq4019_reset_list[] = { + [WIFI0_CPU_INIT_RESET] = { 0x1f008, 5 }, + [WIFI0_RADIO_SRIF_RESET] = { 0x1f008, 4 }, + [WIFI0_RADIO_WARM_RESET] = { 0x1f008, 3 }, + [WIFI0_RADIO_COLD_RESET] = { 0x1f008, 2 }, + [WIFI0_CORE_WARM_RESET] = { 0x1f008, 1 }, + [WIFI0_CORE_COLD_RESET] = { 0x1f008, 0 }, + [WIFI1_CPU_INIT_RESET] = { 0x20008, 5 }, + [WIFI1_RADIO_SRIF_RESET] = { 0x20008, 4 }, + [WIFI1_RADIO_WARM_RESET] = { 0x20008, 3 }, + [WIFI1_RADIO_COLD_RESET] = { 0x20008, 2 }, + [WIFI1_CORE_WARM_RESET] = { 0x20008, 1 }, + [WIFI1_CORE_COLD_RESET] = { 0x20008, 0 }, + [USB3_UNIPHY_PHY_ARES] = { 0x1e038, 5 }, + [USB3_HSPHY_POR_ARES] = { 0x1e038, 4 }, + [USB3_HSPHY_S_ARES] = { 0x1e038, 2 }, + [USB2_HSPHY_POR_ARES] = { 0x1e01c, 4 }, + [USB2_HSPHY_S_ARES] = { 0x1e01c, 2 }, + [PCIE_PHY_AHB_ARES] = { 0x1d010, 11 }, + [PCIE_AHB_ARES] = { 0x1d010, 10 }, + [PCIE_PWR_ARES] = { 0x1d010, 9 }, + [PCIE_PIPE_STICKY_ARES] = { 0x1d010, 8 }, + [PCIE_AXI_M_STICKY_ARES] = { 0x1d010, 7 }, + [PCIE_PHY_ARES] = { 0x1d010, 6 }, + [PCIE_PARF_XPU_ARES] = { 0x1d010, 5 }, + [PCIE_AXI_S_XPU_ARES] = { 0x1d010, 4 }, + [PCIE_AXI_M_VMIDMT_ARES] = { 0x1d010, 3 }, + [PCIE_PIPE_ARES] = { 0x1d010, 2 }, + [PCIE_AXI_S_ARES] = { 0x1d010, 1 }, + [PCIE_AXI_M_ARES] = { 0x1d010, 0 }, + [ESS_RESET] = { 0x12008, 0}, + [GCC_BLSP1_BCR] = {0x01000, 0}, + [GCC_BLSP1_QUP1_BCR] = {0x02000, 0}, + [GCC_BLSP1_UART1_BCR] = {0x02038, 0}, + [GCC_BLSP1_QUP2_BCR] = {0x03008, 0}, + [GCC_BLSP1_UART2_BCR] = {0x03028, 0}, + [GCC_BIMC_BCR] = {0x04000, 0}, + [GCC_TLMM_BCR] = {0x05000, 0}, + [GCC_IMEM_BCR] = {0x0E000, 0}, + [GCC_ESS_BCR] = {0x12008, 0}, + [GCC_PRNG_BCR] = {0x13000, 0}, + [GCC_BOOT_ROM_BCR] = {0x13008, 0}, + [GCC_CRYPTO_BCR] = {0x16000, 0}, + [GCC_SDCC1_BCR] = {0x18000, 0}, + [GCC_SEC_CTRL_BCR] = {0x1A000, 0}, + [GCC_AUDIO_BCR] = {0x1B008, 0}, + [GCC_QPIC_BCR] = {0x1C000, 0}, + [GCC_PCIE_BCR] = {0x1D000, 0}, + [GCC_USB2_BCR] = {0x1E008, 0}, + [GCC_USB2_PHY_BCR] = {0x1E018, 0}, + [GCC_USB3_BCR] = {0x1E024, 0}, + [GCC_USB3_PHY_BCR] = {0x1E034, 0}, + [GCC_SYSTEM_NOC_BCR] = {0x21000, 0}, + [GCC_PCNOC_BCR] = {0x2102C, 0}, + [GCC_DCD_BCR] = {0x21038, 0}, + [GCC_SNOC_BUS_TIMEOUT0_BCR] = {0x21064, 0}, + [GCC_SNOC_BUS_TIMEOUT1_BCR] = {0x2106C, 0}, + [GCC_SNOC_BUS_TIMEOUT2_BCR] = {0x21074, 0}, + [GCC_SNOC_BUS_TIMEOUT3_BCR] = {0x2107C, 0}, + [GCC_PCNOC_BUS_TIMEOUT0_BCR] = {0x21084, 0}, + [GCC_PCNOC_BUS_TIMEOUT1_BCR] = {0x2108C, 0}, + [GCC_PCNOC_BUS_TIMEOUT2_BCR] = {0x21094, 0}, + [GCC_PCNOC_BUS_TIMEOUT3_BCR] = {0x2109C, 0}, + [GCC_PCNOC_BUS_TIMEOUT4_BCR] = {0x210A4, 0}, + [GCC_PCNOC_BUS_TIMEOUT5_BCR] = {0x210AC, 0}, + [GCC_PCNOC_BUS_TIMEOUT6_BCR] = {0x210B4, 0}, + [GCC_PCNOC_BUS_TIMEOUT7_BCR] = {0x210BC, 0}, + [GCC_PCNOC_BUS_TIMEOUT8_BCR] = {0x210C4, 0}, + [GCC_PCNOC_BUS_TIMEOUT9_BCR] = {0x210CC, 0}, + [GCC_TCSR_BCR] = {0x22000, 0}, + [GCC_MPM_BCR] = {0x24000, 0}, + [GCC_SPDM_BCR] = {0x25000, 0}, +}; + +int +qcom_gcc_ipq4018_hwreset_assert(device_t dev, intptr_t id, bool reset) +{ + struct qcom_gcc_ipq4018_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (id > nitems(gcc_ipq4019_reset_list)) { + device_printf(dev, "%s: invalid id (%d)\n", __func__, id); + return (EINVAL); + } + + device_printf(dev, "%s: called; id=%d, reset=%d\n", __func__, id, reset); + mtx_lock(&sc->mtx); + reg = bus_read_4(sc->reg, gcc_ipq4019_reset_list[id].reg); + if (reset) + reg |= (1U << gcc_ipq4019_reset_list[id].bit); + else + reg &= ~(1U << gcc_ipq4019_reset_list[id].bit); + bus_write_4(sc->reg, gcc_ipq4019_reset_list[id].reg, reg); + mtx_unlock(&sc->mtx); + return (0); +} + +int +qcom_gcc_ipq4018_hwreset_is_asserted(device_t dev, intptr_t id, bool *reset) +{ + struct qcom_gcc_ipq4018_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (id > nitems(gcc_ipq4019_reset_list)) { + device_printf(dev, "%s: invalid id (%d)\n", __func__, id); + return (EINVAL); + } + mtx_lock(&sc->mtx); + reg = bus_read_4(sc->reg, gcc_ipq4019_reset_list[id].reg); + if (reg & ((1U << gcc_ipq4019_reset_list[id].bit))) + *reset = true; + else + *reset = false; + mtx_unlock(&sc->mtx); + + device_printf(dev, "called; id=%d\n", id); + return (0); +} + diff --git a/sys/arm/qualcomm/qcom_gcc_ipq4018_var.h b/sys/arm/qualcomm/qcom_gcc_ipq4018_var.h new file mode 100644 index 000000000000..3997e1860e43 --- /dev/null +++ b/sys/arm/qualcomm/qcom_gcc_ipq4018_var.h @@ -0,0 +1,50 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Adrian Chadd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __QCOM_GCC_IPQ4018_VAR_H__ +#define __QCOM_GCC_IPQ4018_VAR_H__ + +struct qcom_gcc_ipq4018_reset_entry { + uint32_t reg; + uint32_t bit; +}; + +struct qcom_gcc_ipq4018_softc { + device_t dev; + int reg_rid; + struct resource *reg; + struct mtx mtx; +}; + +extern int qcom_gcc_ipq4018_hwreset_assert(device_t dev, intptr_t id, + bool reset); +extern int qcom_gcc_ipq4018_hwreset_is_asserted(device_t dev, intptr_t id, + bool *reset); + +#endif /* __QCOM_GCC_IPQ4018_VAR_H__ */ diff --git a/sys/arm/qualcomm/std.ipq4018 b/sys/arm/qualcomm/std.ipq4018 index 099fd81b5171..7e8ac39e7222 100644 --- a/sys/arm/qualcomm/std.ipq4018 +++ b/sys/arm/qualcomm/std.ipq4018 @@ -4,3 +4,6 @@ arm/qualcomm/qcom_scm_legacy.c standard arm/qualcomm/qcom_cpu_kpssv2.c optional smp dev/qcom_rnd/qcom_rnd.c optional qcom_rnd +arm/qualcomm/qcom_gcc_ipq4018.c optional qcom_gcc_ipq4018 +arm/qualcomm/qcom_gcc_ipq4018_reset.c optional qcom_gcc_ipq4018 + From nobody Thu Nov 4 16:05:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1CBC4183FC7D; Thu, 4 Nov 2021 16:05:42 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HlT5153Zcz3LPL; Thu, 4 Nov 2021 16:05:41 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1636041941; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/UHDU30xqs/5RLhpR0Y4IMl6Ktb7yxW5jDl5Ul8J44s=; b=k8rKAykDi5HMmWP0K7xRIbr10iX2MynYsD+76VJgpvIqhAcEhNAniLHDjm79AMvvkfgNpF Ys7mMa4HCTp55vaQ4PL/LlXFnziZdgKeMSWrBOLg6nYe2jwKHByEZhPZAfLB7m+snK+th4 zY62zooqXg64NJoABp4MYaMpluWIJoHyNvd9wF3J7TCkU2y1iB6c8rvX/lgpAicNooIwjz lAFSGVakf4whqlf/LjhFPC+x/0jNAs/ANfWTzYOpY6i0ZWJmqN6qxScNy7MKLlT5Fcm2gP TxT2Au3A0rZkIiPAyDg+8RtIsHI6GlwX0KagO4BGuhJHQXbmYufzCiLIJ8o2ng== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 790D61D18A; Thu, 4 Nov 2021 16:05:41 +0000 (UTC) Date: Thu, 4 Nov 2021 16:05:41 +0000 From: Alexey Dokuchaev To: Slawa Olhovchenkov Cc: Warner Losh , "Rodney W. Grimes" , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell Message-ID: References: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> <20211104155426.GD77338@zxy.spb.ru> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211104155426.GD77338@zxy.spb.ru> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1636041941; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/UHDU30xqs/5RLhpR0Y4IMl6Ktb7yxW5jDl5Ul8J44s=; b=I2XxOKuZL1/mCR6VwxC02ZSeF2hArgr6tEXNp4nJgq9nmILbCviCil89HTgUw06sCVulWB tI52aLxqAdfkMKBjrXlDgJbKu6kKABGAhXJ2pwd9rcA8mcg6dbldHZ8inyhZmh3nDe9EEK StkDcWc6UNzPGY5Mf371k0kRbS/VdtWu4i5Ns+QYpUSNFvasmPegDUjL6cGKBYeAF6cWv4 lnp2giWMz4E4ssaa63mIGTtoH1I6iJXUYSvjtfL+g1JKQOlx6OvlWGKqHGIv4T/Kcm/vlY u1WcZeuT20cpL1s1RmZS8Y5M1di9ORty1UweTMqiBzeEObieH8ZDEgLZ7KfnXw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1636041941; a=rsa-sha256; cv=none; b=e6Ekff73tyMzOOAfoI/D61MX8/A8O5cJgisz7qqo31lkZ2au/Z+ujp19iJ5y+MtmiHK/Hb z82cCpW5non5ulF0VYJ/tx8KrGWox8GeVzCfoBCn+L9p8ILgo+X1e84acR9V/721KHdIXi PFXUuQVKSVIAw4jTzNqrFwggahpFtGKF99FJdG1fCipiUeqniSjJoJ5ylvoKBJ6Rxv2llE bM8NxKU4GrSmesH+JejCtiZkdLeLPXr/YGkcUWP9QNS1e6OnGurQLg9qZi7Ez45fO3SVMV 14OSZB9Ip/L27R+PrsuuQWRuDMV1i7SwLRL8hJf5MGtgzL3Rwh9TdVEnWtmKcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Thu, Nov 04, 2021 at 06:54:26PM +0300, Slawa Olhovchenkov wrote: > On Thu, Nov 04, 2021 at 09:17:38AM -0600, Warner Losh wrote: > > On Thu, Nov 4, 2021 at 8:55 AM Rodney W. Grimes wrote: > > > Thank you Warner for all the legwork on tracking this down and > > > getting a proper bell tone working on FreeBSD-Current. I do not > > > see any MFC plans for this, can you please consider merging this > > > to all supported releases? > > > > I'm merging to 13. The merge was easy. > > Maybe now enable bell by default back? Yes please. ./danfe From nobody Thu Nov 4 16:08:57 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5D5C21840EB8; Thu, 4 Nov 2021 16:08: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 4HlT8n29qbz3MQM; Thu, 4 Nov 2021 16:08: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 2C5D32EFA1; Thu, 4 Nov 2021 16:08: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 1A4G8vjx004402; Thu, 4 Nov 2021 16:08:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4G8vGX004401; Thu, 4 Nov 2021 16:08:57 GMT (envelope-from git) Date: Thu, 4 Nov 2021 16:08:57 GMT Message-Id: <202111041608.1A4G8vGX004401@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: 305ef653bcf3 - main - efi: switch boot_services_gone to boot_services_active List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 305ef653bcf349c7dea83c90add6f2d97910e545 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=305ef653bcf349c7dea83c90add6f2d97910e545 commit 305ef653bcf349c7dea83c90add6f2d97910e545 Author: Warner Losh AuthorDate: 2021-11-04 15:34:20 +0000 Commit: Warner Losh CommitDate: 2021-11-04 16:07:54 +0000 efi: switch boot_services_gone to boot_services_active Turn the presence or absence of boot services into a positive bool (and change its type to bool). Move declaration to efi.h in the global variables section. Sponsored by: Netflix Reviewed by: tsoome, kib Differential Revision: https://reviews.freebsd.org/D31814 --- stand/common/gfx_fb.c | 10 ++++++---- stand/efi/include/efi.h | 2 ++ stand/efi/libefi/efi_console.c | 23 +++++++++++------------ stand/efi/loader/bootinfo.c | 4 +--- stand/efi/loader/copy.c | 4 +--- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 99968e10d8fe..d13a627e1a74 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -751,14 +751,16 @@ gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, #if defined(EFI) EFI_STATUS status; EFI_GRAPHICS_OUTPUT *gop = gfx_state.tg_private; - extern int boot_services_gone; EFI_TPL tpl; /* - * We assume Blt() does work, if not, we will need to build - * exception list case by case. + * We assume Blt() does work, if not, we will need to build exception + * list case by case. We only have boot services during part of our + * exectution. Once terminate boot services, these operations cannot be + * done as they are provided by protocols that disappear when exit + * boot services. */ - if (gop != NULL && boot_services_gone == 0) { + if (gop != NULL && boot_services_active) { tpl = BS->RaiseTPL(TPL_NOTIFY); switch (BltOperation) { case GfxFbBltVideoFill: diff --git a/stand/efi/include/efi.h b/stand/efi/include/efi.h index fe8d78286529..7e44a5b819fc 100644 --- a/stand/efi/include/efi.h +++ b/stand/efi/include/efi.h @@ -60,11 +60,13 @@ Revision History #include "efitcp.h" #include "efipoint.h" #include "efiuga.h" +#include /* * Global variables */ extern EFI_LOADED_IMAGE *boot_img; +extern bool boot_services_active; /* * FreeBSD UUID diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index bacc2546e070..a63cba5e3f34 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -37,14 +37,15 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" -extern int boot_services_gone; extern EFI_GUID gop_guid; + +bool boot_services_active = true; /* boot services active first thing in main */ + static EFI_GUID simple_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; static SIMPLE_TEXT_OUTPUT_INTERFACE *conout; static SIMPLE_INPUT_INTERFACE *conin; static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex; static bool efi_started; - static int mode; /* Does ConOut have serial console? */ static uint32_t utf8_left; @@ -177,7 +178,7 @@ efi_text_cursor(void *arg, const teken_pos_t *p) teken_gfx_t *state = arg; UINTN col, row; - if (boot_services_gone) + if (!boot_services_active) return; row = p->tp_row; @@ -238,7 +239,7 @@ efi_text_putchar(void *s, const teken_pos_t *p, teken_char_t c, EFI_STATUS status; int idx; - if (boot_services_gone) + if (!boot_services_active) return; idx = p->tp_col + p->tp_row * state->tg_tp.tp_col; @@ -258,7 +259,7 @@ efi_text_fill(void *arg, const teken_rect_t *r, teken_char_t c, teken_gfx_t *state = arg; teken_pos_t p; - if (boot_services_gone) + if (!boot_services_active) return; if (state->tg_cursor_visible) @@ -313,7 +314,7 @@ efi_text_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p) int nrow, ncol, x, y; /* Has to be signed - >= 0 comparison */ bool scroll = false; - if (boot_services_gone) + if (!boot_services_active) return; /* @@ -369,7 +370,7 @@ efi_text_param(void *arg, int cmd, unsigned int value) { teken_gfx_t *state = arg; - if (boot_services_gone) + if (!boot_services_active) return; switch (cmd) { @@ -739,6 +740,8 @@ get_arg(int c) static void efi_term_emu(int c) { + if (!boot_services_active) + return; #ifdef TERM_EMU static int ansi_col[] = { 0, 4, 2, 6, 1, 5, 3, 7 @@ -746,9 +749,6 @@ efi_term_emu(int c) int t, i; EFI_STATUS status; - if (boot_services_gone) - return; - switch (esc) { case 0: switch (c) { @@ -858,8 +858,7 @@ efi_term_emu(int c) break; } #else - if (!boot_services_gone) - efi_cons_rawputchar(c); + efi_cons_rawputchar(c); #endif } diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 15b5d86f82b6..5213b328d712 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -63,8 +63,6 @@ __FBSDID("$FreeBSD$"); int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs); -int boot_services_gone; - static int bi_getboothowto(char *kargs) { @@ -397,7 +395,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs) break; status = BS->ExitBootServices(IH, efi_mapkey); if (!EFI_ERROR(status)) { - boot_services_gone = 1; + boot_services_active = false; break; } } diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index 2552ae86d966..47e613ccc2f3 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #define M(x) ((x) * 1024 * 1024) #define G(x) (1UL * (x) * 1024 * 1024 * 1024) -extern int boot_services_gone; - #if defined(__i386__) || defined(__amd64__) #include #include @@ -370,7 +368,7 @@ efi_check_space(vm_offset_t end) if (end + staging_slop <= staging_end) return (true); - if (boot_services_gone) { + if (!boot_services_active) { if (end <= staging_end) return (true); panic("efi_check_space: cannot expand staging area " From nobody Thu Nov 4 17:01:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 38FE4183C148; Thu, 4 Nov 2021 17:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HlVKz0zBXz4RxH; Thu, 4 Nov 2021 17: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 01DCF2FBBD; Thu, 4 Nov 2021 17: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 1A4H1wCU080136; Thu, 4 Nov 2021 17: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 1A4H1wRK080135; Thu, 4 Nov 2021 17:01:58 GMT (envelope-from git) Date: Thu, 4 Nov 2021 17:01:58 GMT Message-Id: <202111041701.1A4H1wRK080135@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: e9a994639b2a - main - ssh: enable FIDO/U2F keys List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: e9a994639b2af232f994ba2ad23ca45a17718d2b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e9a994639b2af232f994ba2ad23ca45a17718d2b commit e9a994639b2af232f994ba2ad23ca45a17718d2b Author: Ed Maste AuthorDate: 2021-10-07 03:31:17 +0000 Commit: Ed Maste CommitDate: 2021-11-04 17:01:44 +0000 ssh: enable FIDO/U2F keys Description of FIDO/U2F support (from OpenSSH 8.2 release notes, https://www.openssh.com/txt/release-8.2): This release adds support for FIDO/U2F hardware authenticators to OpenSSH. U2F/FIDO are open standards for inexpensive two-factor authentication hardware that are widely used for website authentication. In OpenSSH FIDO devices are supported by new public key types "ecdsa-sk" and "ed25519-sk", along with corresponding certificate types. ssh-keygen(1) may be used to generate a FIDO token-backed key, after which they may be used much like any other key type supported by OpenSSH, so long as the hardware token is attached when the keys are used. FIDO tokens also generally require the user explicitly authorise operations by touching or tapping them. Generating a FIDO key requires the token be attached, and will usually require the user tap the token to confirm the operation: $ ssh-keygen -t ecdsa-sk -f ~/.ssh/id_ecdsa_sk Generating public/private ecdsa-sk key pair. You may need to touch your security key to authorize key generation. Enter file in which to save the key (/home/djm/.ssh/id_ecdsa_sk): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/djm/.ssh/id_ecdsa_sk Your public key has been saved in /home/djm/.ssh/id_ecdsa_sk.pub This will yield a public and private key-pair. The private key file should be useless to an attacker who does not have access to the physical token. After generation, this key may be used like any other supported key in OpenSSH and may be listed in authorized_keys, added to ssh-agent(1), etc. The only additional stipulation is that the FIDO token that the key belongs to must be attached when the key is used. To enable FIDO/U2F support, this change regenerates ssh_namespace.h, adds ssh-sk-helper, and sets ENABLE_SK_INTERNAL (unless building WITHOUT_USB). devd integration is not included in this change, and is under investigation for the base system. In the interim the security/u2f-devd port can be installed to provide appropriate devd rules. Reviewed by: delphij, kevans Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32509 --- crypto/openssh/ssh_namespace.h | 12 ++++++++++++ secure/libexec/Makefile | 2 +- secure/libexec/ssh-sk-helper/Makefile | 16 ++++++++++++++++ secure/ssh.mk | 6 ++++++ tools/build/mk/OptionalObsoleteFiles.inc | 2 ++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/ssh_namespace.h b/crypto/openssh/ssh_namespace.h index 2c2060567460..94a391ee5f45 100644 --- a/crypto/openssh/ssh_namespace.h +++ b/crypto/openssh/ssh_namespace.h @@ -87,6 +87,10 @@ #define chacha_encrypt_bytes Fssh_chacha_encrypt_bytes #define chacha_ivsetup Fssh_chacha_ivsetup #define chacha_keysetup Fssh_chacha_keysetup +#define chachapoly_crypt Fssh_chachapoly_crypt +#define chachapoly_free Fssh_chachapoly_free +#define chachapoly_get_length Fssh_chachapoly_get_length +#define chachapoly_new Fssh_chachapoly_new #define chan_ibuf_empty Fssh_chan_ibuf_empty #define chan_is_dead Fssh_chan_is_dead #define chan_mark_dead Fssh_chan_mark_dead @@ -553,8 +557,10 @@ #define ssh_dss_sign Fssh_ssh_dss_sign #define ssh_dss_verify Fssh_ssh_dss_verify #define ssh_ecdsa_sign Fssh_ssh_ecdsa_sign +#define ssh_ecdsa_sk_verify Fssh_ssh_ecdsa_sk_verify #define ssh_ecdsa_verify Fssh_ssh_ecdsa_verify #define ssh_ed25519_sign Fssh_ssh_ed25519_sign +#define ssh_ed25519_sk_verify Fssh_ssh_ed25519_sk_verify #define ssh_ed25519_verify Fssh_ssh_ed25519_verify #define ssh_err Fssh_ssh_err #define ssh_fetch_identitylist Fssh_ssh_fetch_identitylist @@ -871,6 +877,12 @@ #define sshpkt_start Fssh_sshpkt_start #define sshpkt_vfatal Fssh_sshpkt_vfatal #define sshsigdie Fssh_sshsigdie +#define sshsk_add_option Fssh_sshsk_add_option +#define sshsk_enroll Fssh_sshsk_enroll +#define sshsk_key_from_response Fssh_sshsk_key_from_response +#define sshsk_load_resident Fssh_sshsk_load_resident +#define sshsk_open Fssh_sshsk_open +#define sshsk_sign Fssh_sshsk_sign #define start_progress_meter Fssh_start_progress_meter #define stdfd_devnull Fssh_stdfd_devnull #define stop_progress_meter Fssh_stop_progress_meter diff --git a/secure/libexec/Makefile b/secure/libexec/Makefile index 3438b412d5da..f07454db3643 100644 --- a/secure/libexec/Makefile +++ b/secure/libexec/Makefile @@ -4,7 +4,7 @@ SUBDIR= .if ${MK_OPENSSH} != "no" -SUBDIR+=sftp-server ssh-keysign ssh-pkcs11-helper +SUBDIR+=sftp-server ssh-keysign ssh-pkcs11-helper ssh-sk-helper .endif SUBDIR.${MK_TESTS}+= tests diff --git a/secure/libexec/ssh-sk-helper/Makefile b/secure/libexec/ssh-sk-helper/Makefile new file mode 100644 index 000000000000..622b0ac682bd --- /dev/null +++ b/secure/libexec/ssh-sk-helper/Makefile @@ -0,0 +1,16 @@ +.include +.include "${SRCTOP}/secure/ssh.mk" + +PROG= ssh-sk-helper +SRCS= ssh-sk-helper.c ssh-sk.c sk-usbhid.c +MAN= ssh-sk-helper.8 +CFLAGS+=-I${SRCTOP}/contrib/libfido2/src + +LIBADD= ssh crypto z +.if ${MK_USB} != "no" +LIBADD+= fido2 cbor +.endif + +.include + +.PATH: ${SSHDIR} diff --git a/secure/ssh.mk b/secure/ssh.mk index 4ab8cd399ae8..822946253263 100644 --- a/secure/ssh.mk +++ b/secure/ssh.mk @@ -1,6 +1,12 @@ # Common Make variables for OpenSSH +.include + SSHDIR= ${SRCTOP}/crypto/openssh CFLAGS+= -I${SSHDIR} -include ssh_namespace.h SRCS+= ssh_namespace.h + +.if ${MK_USB} != "no" +CFLAGS+= -DENABLE_SK_INTERNAL=1 +.endif diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 91822aac492a..96156a80f2e3 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -7141,6 +7141,7 @@ OLD_FILES+=usr/lib32/libprivatessh_p.a OLD_FILES+=usr/libexec/sftp-server OLD_FILES+=usr/libexec/ssh-keysign OLD_FILES+=usr/libexec/ssh-pkcs11-helper +OLD_FILES+=usr/libexec/ssh-sk-helper OLD_FILES+=usr/sbin/sshd OLD_FILES+=usr/share/man/man1/scp.1.gz OLD_FILES+=usr/share/man/man1/sftp.1.gz @@ -7157,6 +7158,7 @@ OLD_FILES+=usr/share/man/man8/pam_ssh.8.gz OLD_FILES+=usr/share/man/man8/sftp-server.8.gz OLD_FILES+=usr/share/man/man8/ssh-keysign.8.gz OLD_FILES+=usr/share/man/man8/ssh-pkcs11-helper.8.gz +OLD_FILES+=usr/share/man/man8/ssh-sk-helper.8.gz OLD_FILES+=usr/share/man/man8/sshd.8.gz .endif From nobody Thu Nov 4 17:13:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D94B518415B7 for ; Thu, 4 Nov 2021 17:13:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HlVb44Y2wz4WS3 for ; Thu, 4 Nov 2021 17:13:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x92c.google.com with SMTP id p37so11082671uae.8 for ; Thu, 04 Nov 2021 10:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Pur7pSCBUCkSAYliscyD5iYykSOcBsCsq78cgO0rawg=; b=ZbF+eABZvySoS42Vffy1ktSlEucBhvs/fn19i3FnDp1m/acy8tdLK2ljqfV/bPcPWt Y1NsbXpwfOC5C2Z+CviM0b5NCPHiUzHl7XYOxVsM1rKC2NDdRygLgwbWZt95HRDAJ+kc V+g9KRi+HIYp+5MDFGgjIktVPwU6CDnr31Anezd9oau6vBgqBNKcem6wK+Nl6fH71Lke XkIwQ4ObPLeu1bmJV5iqZrS/AL6nAiEu3mbuZYlDulh02GU8//bPpOeOefWaH0oFIK4S Mhz8AVdXEC2uWPRz67eW38kONSOk9tVxZTKI16c2B3dRcEyH69qX12aDSeYgaU/NnvEO 6ytg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Pur7pSCBUCkSAYliscyD5iYykSOcBsCsq78cgO0rawg=; b=mllGiz+37eyEUY356kwo137fhhsNtiFJtuDKiSFzU8TJTHOPB4JNkb69kosSo7U7ve XEgUHBLr1DCHK/QKjWfPuwcBTLHsoPXasJnQYJkh1/zshyokZA1lqa73oDW8rJsVXA1N q7TxwYwedLBoTpTTglLAmrHWBHorwp92EZRV26J5ImrmNZNQCvOvyWJegNIDEhNkywAD Z1asEIkrNYUpcrGTkxTO8ARdQdBsqu+oNrhAoEZZ8/CdvyZFKH+52VMgAlHZ/DDt2ZiY EQZjj8cPKEs3Q40GDU9Suqn6nowMWeyl0P/YyaQ/3Y6L2cj2xVgarG5ipjv81xUdYqHk XB4Q== X-Gm-Message-State: AOAM531CAg2kJxYBbKUZrQzuUG+bjSktIM0Ba3gqrHO2Kjqz5RnH/n+A UNRl/EV1fOGS1XAvogLIppq1d+0BeYfhp8+nhJqeeVPDdIM= X-Google-Smtp-Source: ABdhPJz39rtufKtXgVk9CAa4SNv/Ik0ExRqEvD2BUMZvEir1T2jKIz9Bgr5Asrly8iInwViaaaLGHWgMFx9qSfqfeQ0= X-Received: by 2002:ab0:3d07:: with SMTP id f7mr38062335uax.11.1636046000133; Thu, 04 Nov 2021 10:13:20 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> <20211104155426.GD77338@zxy.spb.ru> In-Reply-To: From: Warner Losh Date: Thu, 4 Nov 2021 11:13:09 -0600 Message-ID: Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell To: Alexey Dokuchaev Cc: Slawa Olhovchenkov , "Rodney W. Grimes" , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000acabda05cff9a4db" X-Rspamd-Queue-Id: 4HlVb44Y2wz4WS3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000acabda05cff9a4db Content-Type: text/plain; charset="UTF-8" On Thu, Nov 4, 2021 at 10:05 AM Alexey Dokuchaev wrote: > On Thu, Nov 04, 2021 at 06:54:26PM +0300, Slawa Olhovchenkov wrote: > > On Thu, Nov 04, 2021 at 09:17:38AM -0600, Warner Losh wrote: > > > On Thu, Nov 4, 2021 at 8:55 AM Rodney W. Grimes wrote: > > > > Thank you Warner for all the legwork on tracking this down and > > > > getting a proper bell tone working on FreeBSD-Current. I do not > > > > see any MFC plans for this, can you please consider merging this > > > > to all supported releases? > > > > > > I'm merging to 13. The merge was easy. > > > > Maybe now enable bell by default back? > > Yes please. > Given the last shitstorm over this, I'm not touching that issue with a 10' pole. Warner --000000000000acabda05cff9a4db-- From nobody Thu Nov 4 17:22:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A2F9D184657B for ; Thu, 4 Nov 2021 17:22: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 4HlVp84B2Yz4bJG; Thu, 4 Nov 2021 17:22: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 658752D8; Thu, 4 Nov 2021 17:22: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 1A4HMuNo010243; Thu, 4 Nov 2021 17:22:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4HMu2C010242; Thu, 4 Nov 2021 17:22:56 GMT (envelope-from git) Date: Thu, 4 Nov 2021 17:22:56 GMT Message-Id: <202111041722.1A4HMu2C010242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Ed Maste Subject: git: 66719ee573ac..4f19900354cc - vendor/openssh - vendor branch updated List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/vendor/openssh X-Git-Reftype: branch X-Git-Commit: 4f19900354cc6b4531038e294d8ad1d115118e9d X-Git-Oldrev: 66719ee573ac2290622db642f6e89ab35b179f3d X-Git-Newrev: 4f19900354cc6b4531038e294d8ad1d115118e9d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch vendor/openssh has been updated by emaste: URL: https://cgit.FreeBSD.org/src/log/?id=66719ee573ac..4f19900354cc 4f19900354cc Vendor import of OpenSSH 8.8p1 From nobody Thu Nov 4 17:54:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DB508183BDFC; Thu, 4 Nov 2021 17:54: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 4HlWVZ4GN3z4np1; Thu, 4 Nov 2021 17:54: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 739BE889; Thu, 4 Nov 2021 17:54: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 1A4HsUiW050098; Thu, 4 Nov 2021 17:54:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4HsUsu050097; Thu, 4 Nov 2021 17:54:30 GMT (envelope-from git) Date: Thu, 4 Nov 2021 17:54:30 GMT Message-Id: <202111041754.1A4HsUsu050097@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: 63378c84b4ec - main - Remove unused ocf_operation structure from stack. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 63378c84b4ec580257683ef9596cf6f8b49d327c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=63378c84b4ec580257683ef9596cf6f8b49d327c commit 63378c84b4ec580257683ef9596cf6f8b49d327c Author: Hans Petter Selasky AuthorDate: 2021-11-04 17:30:57 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-04 17:52:06 +0000 Remove unused ocf_operation structure from stack. Reviewed by: jhb@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/opencrypto/ktls_ocf.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 0096b4189533..3b944e302a8d 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -458,15 +458,11 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, struct tls_aead_data ad; struct cryptop crp; struct ktls_ocf_session *os; - struct ocf_operation oo; int error; uint16_t tls_comp_len; os = tls->ocf_session; - oo.os = os; - oo.done = false; - crypto_initreq(&crp, os->sid); /* Setup the IV. */ From nobody Thu Nov 4 17:54:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 03E86183C00D; Thu, 4 Nov 2021 17:54: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 4HlWVb5k7Hz4np5; Thu, 4 Nov 2021 17:54: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 9E25F82F; Thu, 4 Nov 2021 17:54: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 1A4HsVOF050122; Thu, 4 Nov 2021 17:54:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4HsVkY050121; Thu, 4 Nov 2021 17:54:31 GMT (envelope-from git) Date: Thu, 4 Nov 2021 17:54:31 GMT Message-Id: <202111041754.1A4HsVkY050121@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: 10a62eb109ce - main - Use layer five checksum flags in the mbuf packet header to pass on crypto state. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 10a62eb109ceafce32aa2b18ec835b3b7285c2dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=10a62eb109ceafce32aa2b18ec835b3b7285c2dd commit 10a62eb109ceafce32aa2b18ec835b3b7285c2dd Author: Hans Petter Selasky AuthorDate: 2021-11-04 17:43:24 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-04 17:52:06 +0000 Use layer five checksum flags in the mbuf packet header to pass on crypto state. The mbuf protocol flags get cleared between layers, and also it was discovered that M_DECRYPTED conflicts with M_HASFCS when receiving ethernet patckets. Add the proper CSUM_TLS_MASK and CSUM_TLS_DECRYPTED defines, and start using these instead of M_DECRYPTED inside the TCP LRO code. This change is needed by coming TLS RX hardware offload support patches. Suggested by: kib@ Reviewed by: jhb@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/netinet/tcp_lro.c | 11 ++++++++++- sys/sys/mbuf.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index cb9681559777..ea23ad75994d 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -395,7 +395,8 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo htons(m->m_pkthdr.ether_vtag) & htons(EVL_VLID_MASK); } /* Store decrypted flag, if any. */ - if (__predict_false(m->m_flags & M_DECRYPTED)) + if (__predict_false((m->m_pkthdr.csum_flags & + CSUM_TLS_MASK) == CSUM_TLS_DECRYPTED)) po->data.lro_flags |= LRO_FLAG_DECRYPTED; } @@ -833,6 +834,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; le->m_head->m_pkthdr.csum_data = 0xffff; + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; break; case LRO_TYPE_IPV6_TCP: csum = tcp_lro_update_checksum(&le->inner, le, @@ -844,6 +847,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | CSUM_PSEUDO_HDR; le->m_head->m_pkthdr.csum_data = 0xffff; + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; break; case LRO_TYPE_NONE: switch (le->outer.data.lro_type) { @@ -854,6 +859,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; le->m_head->m_pkthdr.csum_data = 0xffff; + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; break; case LRO_TYPE_IPV6_TCP: csum = tcp_lro_update_checksum(&le->outer, le, @@ -862,6 +869,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | CSUM_PSEUDO_HDR; le->m_head->m_pkthdr.csum_data = 0xffff; + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; break; default: break; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 413854cc9a57..d0f90805fa78 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -721,6 +721,8 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) #define CSUM_UDP_IPV6 CSUM_IP6_UDP #define CSUM_TCP_IPV6 CSUM_IP6_TCP #define CSUM_SCTP_IPV6 CSUM_IP6_SCTP +#define CSUM_TLS_MASK (CSUM_L5_CALC|CSUM_L5_VALID) +#define CSUM_TLS_DECRYPTED CSUM_L5_CALC /* * mbuf types describing the content of the mbuf (including external storage). From nobody Thu Nov 4 17:54:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2BE61183BF9D; Thu, 4 Nov 2021 17:54: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 4HlWVd1ZcQz4nbK; Thu, 4 Nov 2021 17:54: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 B7FE391C; Thu, 4 Nov 2021 17:54: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 1A4HsWUj050146; Thu, 4 Nov 2021 17:54:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4HsW5c050145; Thu, 4 Nov 2021 17:54:32 GMT (envelope-from git) Date: Thu, 4 Nov 2021 17:54:32 GMT Message-Id: <202111041754.1A4HsW5c050145@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: dd31400c3c2a - main - Factor out flags preserved during mbuf demote into a separate define. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: dd31400c3c2aa941d057e78296c193959a6d9ed3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=dd31400c3c2aa941d057e78296c193959a6d9ed3 commit dd31400c3c2aa941d057e78296c193959a6d9ed3 Author: Hans Petter Selasky AuthorDate: 2021-11-04 17:48:23 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-04 17:53:49 +0000 Factor out flags preserved during mbuf demote into a separate define. This define will later on be used by coming TLS RX hardware offload patches. No functional change intended. Reviewed by: jhb@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/kern/uipc_mbuf.c | 5 +++-- sys/sys/mbuf.h | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index e0793a16d76f..0196023bc601 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -278,13 +278,14 @@ m_demote(struct mbuf *m0, int all, int flags) { struct mbuf *m; + flags |= M_DEMOTEFLAGS; + for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) { KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p", __func__, m, m0)); if (m->m_flags & M_PKTHDR) m_demote_pkthdr(m); - m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | - M_EXTPG | flags); + m->m_flags &= flags; } } diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index d0f90805fa78..07a75bd5b47b 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -496,6 +496,12 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_TSTMP| \ M_TSTMP_HPREC|M_TSTMP_LRO|M_PROTOFLAGS) +/* + * Flags preserved during demote. + */ +#define M_DEMOTEFLAGS \ + (M_EXT | M_RDONLY | M_NOFREE | M_EXTPG) + /* * Mbuf flag description for use with printf(9) %b identifier. */ From nobody Thu Nov 4 18:20:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E3B0A17DBB09; Thu, 4 Nov 2021 18:20:20 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 4HlX4N4z76z3Fhr; Thu, 4 Nov 2021 18:20:20 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1mihLU-000633-Qf; Thu, 04 Nov 2021 21:20:16 +0300 Date: Thu, 4 Nov 2021 21:20:16 +0300 From: Slawa Olhovchenkov To: Warner Losh Cc: Alexey Dokuchaev , "Rodney W. Grimes" , Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell Message-ID: <20211104182016.GE77338@zxy.spb.ru> References: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> <20211104155426.GD77338@zxy.spb.ru> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 4HlX4N4z76z3Fhr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Nov 04, 2021 at 11:13:09AM -0600, Warner Losh wrote: > On Thu, Nov 4, 2021 at 10:05 AM Alexey Dokuchaev wrote: > > > On Thu, Nov 04, 2021 at 06:54:26PM +0300, Slawa Olhovchenkov wrote: > > > On Thu, Nov 04, 2021 at 09:17:38AM -0600, Warner Losh wrote: > > > > On Thu, Nov 4, 2021 at 8:55 AM Rodney W. Grimes wrote: > > > > > Thank you Warner for all the legwork on tracking this down and > > > > > getting a proper bell tone working on FreeBSD-Current. I do not > > > > > see any MFC plans for this, can you please consider merging this > > > > > to all supported releases? > > > > > > > > I'm merging to 13. The merge was easy. > > > > > > Maybe now enable bell by default back? > > > > Yes please. > > > > Given the last shitstorm over this, I'm not touching that issue with a 10' > pole. May be option in bsdinstall? From nobody Thu Nov 4 18:32:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1BFAF180B21C; Thu, 4 Nov 2021 18:32: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 4HlXL103PXz3LFL; Thu, 4 Nov 2021 18:32: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 D7416F26; Thu, 4 Nov 2021 18:32: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 1A4IW8VR004008; Thu, 4 Nov 2021 18:32:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4IW7rA004003; Thu, 4 Nov 2021 18:32:07 GMT (envelope-from git) Date: Thu, 4 Nov 2021 18:32:07 GMT Message-Id: <202111041832.1A4IW7rA004003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 0a6760a1de32 - stable/13 - wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a6760a1de32bf5df91ef926eba25b3f74b4f84f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=0a6760a1de32bf5df91ef926eba25b3f74b4f84f commit 0a6760a1de32bf5df91ef926eba25b3f74b4f84f Author: Cy Schubert AuthorDate: 2021-09-03 13:07:19 +0000 Commit: Cy Schubert CommitDate: 2021-11-04 18:30:24 +0000 wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff Merge vendor commits 40c7ff83e74eabba5a7e2caefeea12372b2d3f9a, efec8223892b3e677acb46eae84ec3534989971f, and 2f6c3ea9600b494d24cac5a38c1cea0ac192245e. Tested by: philip (cherry picked from commit c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5) --- contrib/wpa/CONTRIBUTIONS | 5 +- contrib/wpa/hostapd/Android.mk | 1152 ++ contrib/wpa/hostapd/ChangeLog | 4 +- contrib/wpa/hostapd/Makefile | 1375 +++ contrib/wpa/hostapd/android.config | 214 + contrib/wpa/hostapd/config_file.c | 453 +- contrib/wpa/hostapd/ctrl_iface.c | 908 +- contrib/wpa/hostapd/defconfig | 35 +- contrib/wpa/hostapd/hostapd.android.rc | 19 + contrib/wpa/hostapd/hostapd.conf | 367 +- contrib/wpa/hostapd/hostapd.wpa_psk | 6 + contrib/wpa/hostapd/hostapd_cli.c | 128 +- contrib/wpa/hostapd/main.c | 22 +- contrib/wpa/hostapd/sae_pk_gen.c | 196 + contrib/wpa/hs20/client/Makefile | 55 +- contrib/wpa/hs20/client/est.c | 7 +- contrib/wpa/hs20/client/oma_dm_client.c | 2 +- contrib/wpa/hs20/client/osu_client.c | 27 +- contrib/wpa/hs20/client/osu_client.h | 2 + contrib/wpa/hs20/client/spp_client.c | 2 +- contrib/wpa/hs20/server/Makefile | 42 + contrib/wpa/hs20/server/ca/clean.sh | 13 + contrib/wpa/hs20/server/ca/est-csrattrs.cnf | 17 + contrib/wpa/hs20/server/ca/est-csrattrs.sh | 4 + contrib/wpa/hs20/server/ca/hs20.oid | 7 + contrib/wpa/hs20/server/ca/ocsp-req.sh | 11 + contrib/wpa/hs20/server/ca/ocsp-responder-ica.sh | 3 + contrib/wpa/hs20/server/ca/ocsp-responder.sh | 3 + contrib/wpa/hs20/server/ca/ocsp-update-cache.sh | 11 + contrib/wpa/hs20/server/ca/openssl-root.cnf | 125 + contrib/wpa/hs20/server/ca/openssl.cnf | 200 + contrib/wpa/hs20/server/ca/setup.sh | 209 + contrib/wpa/hs20/server/ca/w1fi_logo.png | Bin 0 -> 7549 bytes contrib/wpa/hs20/server/hs20-osu-server.txt | 262 + contrib/wpa/hs20/server/hs20_spp_server.c | 207 + contrib/wpa/hs20/server/spp_server.c | 2933 +++++ contrib/wpa/hs20/server/spp_server.h | 36 + contrib/wpa/hs20/server/sql-example.txt | 17 + contrib/wpa/hs20/server/sql.txt | 108 + contrib/wpa/hs20/server/www/add-free.php | 50 + contrib/wpa/hs20/server/www/add-mo.php | 56 + contrib/wpa/hs20/server/www/cert-enroll.php | 39 + contrib/wpa/hs20/server/www/config.php | 7 + contrib/wpa/hs20/server/www/est.php | 232 + contrib/wpa/hs20/server/www/free-remediation.php | 19 + contrib/wpa/hs20/server/www/free.php | 23 + contrib/wpa/hs20/server/www/redirect.php | 32 + contrib/wpa/hs20/server/www/remediation-pw.php | 41 + contrib/wpa/hs20/server/www/remediation.php | 55 + contrib/wpa/hs20/server/www/signup.php | 59 + contrib/wpa/hs20/server/www/spp.php | 168 + contrib/wpa/hs20/server/www/terms.php | 87 + contrib/wpa/hs20/server/www/users.php | 377 + contrib/wpa/src/Makefile | 12 + contrib/wpa/src/ap/Makefile | 60 + contrib/wpa/src/ap/acs.c | 357 +- contrib/wpa/src/ap/airtime_policy.c | 12 +- contrib/wpa/src/ap/ap_config.c | 298 +- contrib/wpa/src/ap/ap_config.h | 135 +- contrib/wpa/src/ap/ap_drv_ops.c | 158 +- contrib/wpa/src/ap/ap_drv_ops.h | 51 +- contrib/wpa/src/ap/ap_list.c | 4 - contrib/wpa/src/ap/authsrv.c | 87 +- contrib/wpa/src/ap/beacon.c | 609 +- contrib/wpa/src/ap/beacon.h | 2 + contrib/wpa/src/ap/ctrl_iface_ap.c | 85 +- contrib/wpa/src/ap/dfs.c | 330 +- contrib/wpa/src/ap/dfs.h | 3 + contrib/wpa/src/ap/dhcp_snoop.c | 8 +- contrib/wpa/src/ap/dpp_hostapd.c | 1025 +- contrib/wpa/src/ap/dpp_hostapd.h | 11 + contrib/wpa/src/ap/drv_callbacks.c | 362 +- contrib/wpa/src/ap/fils_hlp.c | 36 +- contrib/wpa/src/ap/gas_serv.c | 10 +- contrib/wpa/src/ap/hostapd.c | 282 +- contrib/wpa/src/ap/hostapd.h | 59 +- contrib/wpa/src/ap/hs20.c | 6 +- contrib/wpa/src/ap/hw_features.c | 373 +- contrib/wpa/src/ap/hw_features.h | 22 +- contrib/wpa/src/ap/ieee802_11.c | 2516 +++- contrib/wpa/src/ap/ieee802_11.h | 24 +- contrib/wpa/src/ap/ieee802_11_auth.c | 172 +- contrib/wpa/src/ap/ieee802_11_auth.h | 17 +- contrib/wpa/src/ap/ieee802_11_he.c | 189 +- contrib/wpa/src/ap/ieee802_11_ht.c | 30 +- contrib/wpa/src/ap/ieee802_11_shared.c | 189 +- contrib/wpa/src/ap/ieee802_11_vht.c | 176 +- contrib/wpa/src/ap/ieee802_1x.c | 482 +- contrib/wpa/src/ap/ieee802_1x.h | 7 +- contrib/wpa/src/ap/neighbor_db.c | 58 +- contrib/wpa/src/ap/neighbor_db.h | 1 + contrib/wpa/src/ap/pmksa_cache_auth.c | 6 + contrib/wpa/src/ap/preauth_auth.c | 2 +- contrib/wpa/src/ap/sta_info.c | 111 +- contrib/wpa/src/ap/sta_info.h | 54 +- contrib/wpa/src/ap/utils.c | 4 + contrib/wpa/src/ap/vlan_init.c | 5 +- contrib/wpa/src/ap/wmm.c | 14 +- contrib/wpa/src/ap/wnm_ap.c | 83 +- contrib/wpa/src/ap/wpa_auth.c | 1415 ++- contrib/wpa/src/ap/wpa_auth.h | 103 +- contrib/wpa/src/ap/wpa_auth_ft.c | 385 +- contrib/wpa/src/ap/wpa_auth_glue.c | 343 +- contrib/wpa/src/ap/wpa_auth_i.h | 71 +- contrib/wpa/src/ap/wpa_auth_ie.c | 444 +- contrib/wpa/src/ap/wpa_auth_ie.h | 35 - contrib/wpa/src/ap/wpa_auth_kay.c | 12 +- contrib/wpa/src/ap/wps_hostapd.c | 237 +- contrib/wpa/src/build.rules | 109 + contrib/wpa/src/common/Makefile | 16 + contrib/wpa/src/common/brcm_vendor.h | 156 + contrib/wpa/src/common/common_module_tests.c | 513 +- contrib/wpa/src/common/defs.h | 86 +- contrib/wpa/src/common/dhcp.h | 2 +- contrib/wpa/src/common/dpp.c | 11695 +++++------------- contrib/wpa/src/common/dpp.h | 248 +- contrib/wpa/src/common/dpp_auth.c | 1977 +++ contrib/wpa/src/common/dpp_backup.c | 1265 ++ contrib/wpa/src/common/dpp_crypto.c | 3329 +++++ contrib/wpa/src/common/dpp_i.h | 160 + contrib/wpa/src/common/dpp_pkex.c | 1324 ++ contrib/wpa/src/common/dpp_reconfig.c | 958 ++ contrib/wpa/src/common/dpp_tcp.c | 1824 +++ contrib/wpa/src/common/gas_server.c | 140 +- contrib/wpa/src/common/gas_server.h | 9 +- contrib/wpa/src/common/hw_features_common.c | 427 +- contrib/wpa/src/common/hw_features_common.h | 26 +- contrib/wpa/src/common/ieee802_11_common.c | 789 +- contrib/wpa/src/common/ieee802_11_common.h | 70 +- contrib/wpa/src/common/ieee802_11_defs.h | 249 +- contrib/wpa/src/common/linux_bridge.h | 39 + contrib/wpa/src/common/linux_vlan.h | 52 + contrib/wpa/src/common/ocv.c | 39 +- contrib/wpa/src/common/ocv.h | 13 +- contrib/wpa/src/common/privsep_commands.h | 1 + contrib/wpa/src/common/ptksa_cache.c | 321 + contrib/wpa/src/common/ptksa_cache.h | 79 + contrib/wpa/src/common/qca-vendor.h | 4187 ++++++- contrib/wpa/src/common/sae.c | 1387 ++- contrib/wpa/src/common/sae.h | 109 +- contrib/wpa/src/common/sae_pk.c | 884 ++ contrib/wpa/src/common/version.h | 2 +- contrib/wpa/src/common/wpa_common.c | 1240 +- contrib/wpa/src/common/wpa_common.h | 207 +- contrib/wpa/src/common/wpa_ctrl.c | 5 +- contrib/wpa/src/common/wpa_ctrl.h | 41 +- contrib/wpa/src/crypto/Makefile | 60 + contrib/wpa/src/crypto/crypto.h | 49 +- contrib/wpa/src/crypto/crypto_module_tests.c | 150 + contrib/wpa/src/crypto/crypto_openssl.c | 250 + contrib/wpa/src/crypto/crypto_wolfssl.c | 77 +- contrib/wpa/src/crypto/sha256.c | 6 +- contrib/wpa/src/crypto/sha384-tlsprf.c | 71 + contrib/wpa/src/crypto/sha384.c | 6 +- contrib/wpa/src/crypto/sha384.h | 3 + contrib/wpa/src/crypto/sha512.c | 6 +- contrib/wpa/src/crypto/tls.h | 14 + contrib/wpa/src/crypto/tls_openssl.c | 304 +- contrib/wpa/src/crypto/tls_wolfssl.c | 65 +- contrib/wpa/src/drivers/Makefile | 9 + contrib/wpa/src/drivers/android_drv.h | 56 + contrib/wpa/src/drivers/driver.h | 716 +- contrib/wpa/src/drivers/driver_atheros.c | 41 +- contrib/wpa/src/drivers/driver_bsd.c | 659 +- contrib/wpa/src/drivers/driver_common.c | 21 + contrib/wpa/src/drivers/driver_hostap.c | 24 +- contrib/wpa/src/drivers/driver_hostap.h | 210 + contrib/wpa/src/drivers/driver_macsec_linux.c | 87 +- contrib/wpa/src/drivers/driver_macsec_qca.c | 34 +- contrib/wpa/src/drivers/driver_ndis.c | 47 +- contrib/wpa/src/drivers/driver_nl80211.c | 12229 +++++++++++++++++++ contrib/wpa/src/drivers/driver_nl80211.h | 65 +- contrib/wpa/src/drivers/driver_nl80211_android.c | 4 +- contrib/wpa/src/drivers/driver_nl80211_capa.c | 579 +- contrib/wpa/src/drivers/driver_nl80211_event.c | 580 +- contrib/wpa/src/drivers/driver_nl80211_monitor.c | 3 + contrib/wpa/src/drivers/driver_nl80211_scan.c | 51 +- contrib/wpa/src/drivers/driver_none.c | 77 + contrib/wpa/src/drivers/driver_openbsd.c | 10 +- contrib/wpa/src/drivers/driver_privsep.c | 18 +- contrib/wpa/src/drivers/driver_roboswitch.c | 487 + contrib/wpa/src/drivers/driver_wext.c | 2499 ++++ contrib/wpa/src/drivers/driver_wext.h | 77 + contrib/wpa/src/drivers/drivers.mak | 220 + contrib/wpa/src/drivers/drivers.mk | 196 + contrib/wpa/src/drivers/linux_ioctl.c | 237 + contrib/wpa/src/drivers/linux_ioctl.h | 23 + contrib/wpa/src/drivers/linux_wext.h | 45 + contrib/wpa/src/drivers/netlink.c | 226 + contrib/wpa/src/drivers/netlink.h | 28 + contrib/wpa/src/drivers/nl80211_copy.h | 973 +- contrib/wpa/src/drivers/priv_netlink.h | 109 + contrib/wpa/src/drivers/rfkill.c | 224 + contrib/wpa/src/drivers/rfkill.h | 25 + contrib/wpa/src/eap_common/Makefile | 18 + contrib/wpa/src/eap_common/eap_common.c | 8 +- contrib/wpa/src/eap_common/eap_common.h | 8 +- contrib/wpa/src/eap_common/eap_defs.h | 4 +- contrib/wpa/src/eap_common/eap_sim_common.c | 28 + contrib/wpa/src/eap_common/eap_teap_common.c | 72 +- contrib/wpa/src/eap_common/eap_teap_common.h | 22 +- contrib/wpa/src/eap_peer/Makefile | 7 + contrib/wpa/src/eap_peer/eap.c | 220 +- contrib/wpa/src/eap_peer/eap.h | 13 +- contrib/wpa/src/eap_peer/eap_aka.c | 48 +- contrib/wpa/src/eap_peer/eap_config.h | 408 +- contrib/wpa/src/eap_peer/eap_eke.c | 16 +- contrib/wpa/src/eap_peer/eap_fast.c | 54 +- contrib/wpa/src/eap_peer/eap_gpsk.c | 14 +- contrib/wpa/src/eap_peer/eap_gtc.c | 8 +- contrib/wpa/src/eap_peer/eap_i.h | 42 +- contrib/wpa/src/eap_peer/eap_ikev2.c | 28 +- contrib/wpa/src/eap_peer/eap_leap.c | 44 +- contrib/wpa/src/eap_peer/eap_md5.c | 12 +- contrib/wpa/src/eap_peer/eap_methods.c | 12 +- contrib/wpa/src/eap_peer/eap_methods.h | 14 +- contrib/wpa/src/eap_peer/eap_mschapv2.c | 32 +- contrib/wpa/src/eap_peer/eap_otp.c | 8 +- contrib/wpa/src/eap_peer/eap_pax.c | 50 +- contrib/wpa/src/eap_peer/eap_peap.c | 71 +- contrib/wpa/src/eap_peer/eap_psk.c | 22 +- contrib/wpa/src/eap_peer/eap_pwd.c | 22 +- contrib/wpa/src/eap_peer/eap_sake.c | 26 +- contrib/wpa/src/eap_peer/eap_sim.c | 44 +- contrib/wpa/src/eap_peer/eap_teap.c | 201 +- contrib/wpa/src/eap_peer/eap_tls.c | 42 +- contrib/wpa/src/eap_peer/eap_tls_common.c | 103 +- contrib/wpa/src/eap_peer/eap_tls_common.h | 10 +- contrib/wpa/src/eap_peer/eap_tnc.c | 32 +- contrib/wpa/src/eap_peer/eap_ttls.c | 88 +- contrib/wpa/src/eap_peer/eap_vendor_test.c | 16 +- contrib/wpa/src/eap_peer/eap_wsc.c | 24 +- contrib/wpa/src/eap_peer/ikev2.c | 10 +- contrib/wpa/src/eap_peer/tncc.c | 5 +- contrib/wpa/src/eap_server/Makefile | 8 + contrib/wpa/src/eap_server/eap.h | 172 +- contrib/wpa/src/eap_server/eap_i.h | 67 +- contrib/wpa/src/eap_server/eap_methods.h | 9 +- contrib/wpa/src/eap_server/eap_server.c | 291 +- contrib/wpa/src/eap_server/eap_server_aka.c | 74 +- contrib/wpa/src/eap_server/eap_server_eke.c | 39 +- contrib/wpa/src/eap_server/eap_server_fast.c | 106 +- contrib/wpa/src/eap_server/eap_server_gpsk.c | 37 +- contrib/wpa/src/eap_server/eap_server_gtc.c | 12 +- contrib/wpa/src/eap_server/eap_server_identity.c | 14 +- contrib/wpa/src/eap_server/eap_server_ikev2.c | 22 +- contrib/wpa/src/eap_server/eap_server_md5.c | 14 +- contrib/wpa/src/eap_server/eap_server_methods.c | 10 +- contrib/wpa/src/eap_server/eap_server_mschapv2.c | 22 +- contrib/wpa/src/eap_server/eap_server_pax.c | 32 +- contrib/wpa/src/eap_server/eap_server_peap.c | 103 +- contrib/wpa/src/eap_server/eap_server_psk.c | 34 +- contrib/wpa/src/eap_server/eap_server_pwd.c | 22 +- contrib/wpa/src/eap_server/eap_server_sake.c | 38 +- contrib/wpa/src/eap_server/eap_server_sim.c | 66 +- contrib/wpa/src/eap_server/eap_server_teap.c | 309 +- contrib/wpa/src/eap_server/eap_server_tls.c | 54 +- contrib/wpa/src/eap_server/eap_server_tls_common.c | 93 +- contrib/wpa/src/eap_server/eap_server_tnc.c | 26 +- contrib/wpa/src/eap_server/eap_server_ttls.c | 96 +- .../wpa/src/eap_server/eap_server_vendor_test.c | 12 +- contrib/wpa/src/eap_server/eap_server_wsc.c | 32 +- contrib/wpa/src/eap_server/eap_tls_common.h | 2 +- contrib/wpa/src/eap_server/tncs.c | 5 +- contrib/wpa/src/eapol_auth/Makefile | 2 + contrib/wpa/src/eapol_auth/eapol_auth_sm.c | 206 +- contrib/wpa/src/eapol_auth/eapol_auth_sm.h | 26 +- contrib/wpa/src/eapol_auth/eapol_auth_sm_i.h | 40 +- contrib/wpa/src/eapol_supp/Makefile | 5 + contrib/wpa/src/eapol_supp/eapol_supp_sm.c | 218 +- contrib/wpa/src/eapol_supp/eapol_supp_sm.h | 29 +- contrib/wpa/src/fst/fst.c | 25 +- contrib/wpa/src/fst/fst.h | 23 +- contrib/wpa/src/fst/fst_ctrl_aux.h | 4 +- contrib/wpa/src/fst/fst_ctrl_iface.c | 48 +- contrib/wpa/src/fst/fst_ctrl_iface.h | 2 +- contrib/wpa/src/fst/fst_group.c | 10 +- contrib/wpa/src/fst/fst_group.h | 4 +- contrib/wpa/src/fst/fst_iface.c | 8 +- contrib/wpa/src/fst/fst_iface.h | 8 +- contrib/wpa/src/fst/fst_session.c | 96 +- contrib/wpa/src/fst/fst_session.h | 12 +- contrib/wpa/src/l2_packet/Makefile | 3 + contrib/wpa/src/l2_packet/l2_packet.h | 4 + contrib/wpa/src/l2_packet/l2_packet_freebsd.c | 5 +- contrib/wpa/src/l2_packet/l2_packet_linux.c | 515 + contrib/wpa/src/l2_packet/l2_packet_ndis.c | 3 +- contrib/wpa/src/l2_packet/l2_packet_none.c | 4 +- contrib/wpa/src/l2_packet/l2_packet_pcap.c | 400 + contrib/wpa/src/l2_packet/l2_packet_privsep.c | 3 +- contrib/wpa/src/l2_packet/l2_packet_winpcap.c | 350 + contrib/wpa/src/lib.rules | 29 + contrib/wpa/src/objs.mk | 3 + contrib/wpa/src/p2p/Makefile | 16 + contrib/wpa/src/p2p/p2p.c | 147 +- contrib/wpa/src/p2p/p2p.h | 31 +- contrib/wpa/src/p2p/p2p_go_neg.c | 9 + contrib/wpa/src/p2p/p2p_i.h | 5 + contrib/wpa/src/p2p/p2p_invitation.c | 5 +- contrib/wpa/src/p2p/p2p_utils.c | 39 + contrib/wpa/src/pae/ieee802_1x_cp.c | 177 +- contrib/wpa/src/pae/ieee802_1x_cp.h | 10 +- contrib/wpa/src/pae/ieee802_1x_kay.c | 608 +- contrib/wpa/src/pae/ieee802_1x_kay.h | 68 +- contrib/wpa/src/pae/ieee802_1x_kay_i.h | 40 +- contrib/wpa/src/pae/ieee802_1x_secy_ops.c | 22 +- contrib/wpa/src/pae/ieee802_1x_secy_ops.h | 8 +- contrib/wpa/src/radius/Makefile | 9 + contrib/wpa/src/radius/radius.c | 2 +- contrib/wpa/src/radius/radius.h | 3 + contrib/wpa/src/radius/radius_client.c | 55 +- contrib/wpa/src/radius/radius_client.h | 5 + contrib/wpa/src/radius/radius_server.c | 283 +- contrib/wpa/src/radius/radius_server.h | 142 +- contrib/wpa/src/rsn_supp/Makefile | 14 + contrib/wpa/src/rsn_supp/pmksa_cache.c | 54 +- contrib/wpa/src/rsn_supp/pmksa_cache.h | 7 +- contrib/wpa/src/rsn_supp/preauth.c | 24 +- contrib/wpa/src/rsn_supp/tdls.c | 71 +- contrib/wpa/src/rsn_supp/wpa.c | 759 +- contrib/wpa/src/rsn_supp/wpa.h | 93 +- contrib/wpa/src/rsn_supp/wpa_ft.c | 399 +- contrib/wpa/src/rsn_supp/wpa_i.h | 88 +- contrib/wpa/src/rsn_supp/wpa_ie.c | 317 +- contrib/wpa/src/rsn_supp/wpa_ie.h | 52 +- contrib/wpa/src/tls/Makefile | 25 + contrib/wpa/src/tls/asn1.c | 396 +- contrib/wpa/src/tls/asn1.h | 146 +- contrib/wpa/src/tls/pkcs1.c | 55 +- contrib/wpa/src/tls/pkcs5.c | 78 +- contrib/wpa/src/tls/pkcs8.c | 59 +- contrib/wpa/src/tls/rsa.c | 23 +- contrib/wpa/src/tls/tlsv1_client.c | 29 +- contrib/wpa/src/tls/tlsv1_client_i.h | 4 +- contrib/wpa/src/tls/tlsv1_client_ocsp.c | 180 +- contrib/wpa/src/tls/tlsv1_client_read.c | 10 +- contrib/wpa/src/tls/tlsv1_client_write.c | 18 +- contrib/wpa/src/tls/tlsv1_cred.c | 247 +- contrib/wpa/src/tls/x509v3.c | 419 +- contrib/wpa/src/tls/x509v3.h | 7 + contrib/wpa/src/utils/Makefile | 30 + contrib/wpa/src/utils/base64.c | 59 +- contrib/wpa/src/utils/base64.h | 13 +- contrib/wpa/src/utils/browser-android.c | 2 +- contrib/wpa/src/utils/browser-system.c | 2 +- contrib/wpa/src/utils/browser-wpadebug.c | 2 +- contrib/wpa/src/utils/browser.c | 210 +- contrib/wpa/src/utils/browser.h | 4 +- contrib/wpa/src/utils/common.c | 38 +- contrib/wpa/src/utils/common.h | 8 +- contrib/wpa/src/utils/config.c | 97 + contrib/wpa/src/utils/config.h | 29 + contrib/wpa/src/utils/eloop.c | 47 +- contrib/wpa/src/utils/eloop_win.c | 8 +- contrib/wpa/src/utils/ext_password.c | 3 + contrib/wpa/src/utils/ext_password_file.c | 136 + contrib/wpa/src/utils/ext_password_i.h | 4 + contrib/wpa/src/utils/http-utils.h | 6 +- contrib/wpa/src/utils/includes.h | 1 + contrib/wpa/src/utils/json.c | 122 +- contrib/wpa/src/utils/json.h | 15 + contrib/wpa/src/utils/list.h | 8 +- contrib/wpa/src/utils/os_internal.c | 6 + contrib/wpa/src/utils/os_unix.c | 46 +- contrib/wpa/src/utils/platform.h | 23 +- contrib/wpa/src/utils/radiotap.c | 12 +- contrib/wpa/src/utils/radiotap.h | 407 +- contrib/wpa/src/utils/state_machine.h | 8 +- contrib/wpa/src/utils/trace.c | 11 + contrib/wpa/src/utils/utils_module_tests.c | 39 +- contrib/wpa/src/utils/wpa_debug.c | 147 +- contrib/wpa/src/utils/wpa_debug.h | 3 - contrib/wpa/src/utils/wpabuf.h | 27 + contrib/wpa/src/utils/xml_libxml2.c | 2 +- contrib/wpa/src/wps/Makefile | 28 + contrib/wpa/src/wps/upnp_xml.c | 2 +- contrib/wpa/src/wps/wps.h | 23 +- contrib/wpa/src/wps/wps_attr_build.c | 15 +- contrib/wpa/src/wps/wps_attr_process.c | 9 +- contrib/wpa/src/wps/wps_dev_attr.c | 17 + contrib/wpa/src/wps/wps_dev_attr.h | 1 + contrib/wpa/src/wps/wps_enrollee.c | 11 + contrib/wpa/src/wps/wps_er.c | 4 +- contrib/wpa/src/wps/wps_registrar.c | 139 +- contrib/wpa/src/wps/wps_upnp.c | 28 +- contrib/wpa/src/wps/wps_upnp_ap.c | 4 +- contrib/wpa/src/wps/wps_upnp_event.c | 27 +- contrib/wpa/src/wps/wps_upnp_i.h | 9 +- contrib/wpa/src/wps/wps_upnp_web.c | 4 +- contrib/wpa/wpa_supplicant/Android.mk | 114 +- contrib/wpa/wpa_supplicant/ChangeLog | 10 +- contrib/wpa/wpa_supplicant/Makefile | 2073 ++++ contrib/wpa/wpa_supplicant/README | 4 +- contrib/wpa/wpa_supplicant/README-DPP | 71 +- contrib/wpa/wpa_supplicant/README-HS20 | 2 +- contrib/wpa/wpa_supplicant/android.config | 16 +- contrib/wpa/wpa_supplicant/ap.c | 257 +- contrib/wpa/wpa_supplicant/binder/binder.h | 2 +- contrib/wpa/wpa_supplicant/bss.c | 145 +- contrib/wpa/wpa_supplicant/bss.h | 25 +- contrib/wpa/wpa_supplicant/bssid_ignore.c | 221 + contrib/wpa/wpa_supplicant/bssid_ignore.h | 33 + contrib/wpa/wpa_supplicant/config.c | 644 +- contrib/wpa/wpa_supplicant/config.h | 129 +- contrib/wpa/wpa_supplicant/config_file.c | 243 +- contrib/wpa/wpa_supplicant/config_ssid.h | 155 +- contrib/wpa/wpa_supplicant/config_winreg.c | 1061 ++ contrib/wpa/wpa_supplicant/ctrl_iface.c | 1375 ++- contrib/wpa/wpa_supplicant/ctrl_iface.h | 16 +- contrib/wpa/wpa_supplicant/ctrl_iface_named_pipe.c | 7 +- contrib/wpa/wpa_supplicant/ctrl_iface_udp.c | 63 +- contrib/wpa/wpa_supplicant/ctrl_iface_unix.c | 73 +- contrib/wpa/wpa_supplicant/dbus/dbus_common.c | 23 +- contrib/wpa/wpa_supplicant/dbus/dbus_new.c | 76 +- .../wpa/wpa_supplicant/dbus/dbus_new_handlers.c | 424 +- .../wpa/wpa_supplicant/dbus/dbus_new_handlers.h | 6 + .../wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 84 +- .../wpa/wpa_supplicant/dbus/dbus_new_introspect.c | 2 +- contrib/wpa/wpa_supplicant/defconfig | 45 +- contrib/wpa/wpa_supplicant/doc/docbook/Makefile | 28 + .../wpa/wpa_supplicant/doc/docbook/eapol_test.sgml | 209 + .../wpa_supplicant/doc/docbook/wpa_background.sgml | 105 + .../wpa/wpa_supplicant/doc/docbook/wpa_cli.sgml | 360 + .../wpa/wpa_supplicant/doc/docbook/wpa_gui.sgml | 106 + .../wpa_supplicant/doc/docbook/wpa_passphrase.sgml | 77 + .../wpa/wpa_supplicant/doc/docbook/wpa_priv.sgml | 152 + .../doc/docbook/wpa_supplicant.conf.sgml | 243 + .../wpa_supplicant/doc/docbook/wpa_supplicant.sgml | 764 ++ contrib/wpa/wpa_supplicant/dpp_supplicant.c | 1808 ++- contrib/wpa/wpa_supplicant/dpp_supplicant.h | 15 + contrib/wpa/wpa_supplicant/driver_i.h | 109 +- contrib/wpa/wpa_supplicant/eapol_test.c | 15 +- contrib/wpa/wpa_supplicant/events.c | 1537 ++- contrib/wpa/wpa_supplicant/examples/dpp-nfc.py | 1186 ++ .../wpa_supplicant/examples/p2p-action-udhcp.sh | 4 +- contrib/wpa/wpa_supplicant/examples/p2p-action.sh | 4 +- .../wpa/wpa_supplicant/examples/p2p/p2p_connect.py | 18 +- .../wpa_supplicant/examples/p2p/p2p_disconnect.py | 2 +- .../wpa/wpa_supplicant/examples/p2p/p2p_find.py | 2 +- .../wpa/wpa_supplicant/examples/p2p/p2p_flush.py | 2 +- .../wpa_supplicant/examples/p2p/p2p_group_add.py | 14 +- .../wpa/wpa_supplicant/examples/p2p/p2p_invite.py | 10 +- .../wpa/wpa_supplicant/examples/p2p/p2p_listen.py | 2 +- .../wpa_supplicant/examples/p2p/p2p_stop_find.py | 2 +- .../wpa/wpa_supplicant/examples/udhcpd-p2p.conf | 12 +- contrib/wpa/wpa_supplicant/gas_query.c | 62 +- contrib/wpa/wpa_supplicant/gas_query.h | 2 +- contrib/wpa/wpa_supplicant/hs20_supplicant.c | 30 +- contrib/wpa/wpa_supplicant/ibss_rsn.c | 45 +- contrib/wpa/wpa_supplicant/interworking.c | 66 +- contrib/wpa/wpa_supplicant/interworking.h | 2 +- contrib/wpa/wpa_supplicant/main.c | 10 +- contrib/wpa/wpa_supplicant/main_winmain.c | 78 + contrib/wpa/wpa_supplicant/main_winsvc.c | 458 + contrib/wpa/wpa_supplicant/mbo.c | 30 + contrib/wpa/wpa_supplicant/mesh.c | 243 +- contrib/wpa/wpa_supplicant/mesh.h | 6 +- contrib/wpa/wpa_supplicant/mesh_mpm.c | 49 +- contrib/wpa/wpa_supplicant/mesh_rsn.c | 27 +- contrib/wpa/wpa_supplicant/nmake.mak | 2 +- contrib/wpa/wpa_supplicant/notify.c | 10 +- contrib/wpa/wpa_supplicant/offchannel.c | 6 +- contrib/wpa/wpa_supplicant/op_classes.c | 239 +- contrib/wpa/wpa_supplicant/p2p_supplicant.c | 667 +- contrib/wpa/wpa_supplicant/p2p_supplicant.h | 32 +- contrib/wpa/wpa_supplicant/pasn_supplicant.c | 1714 +++ contrib/wpa/wpa_supplicant/preauth_test.c | 20 +- contrib/wpa/wpa_supplicant/robust_av.c | 155 + contrib/wpa/wpa_supplicant/rrm.c | 91 +- contrib/wpa/wpa_supplicant/scan.c | 703 +- contrib/wpa/wpa_supplicant/scan.h | 33 + contrib/wpa/wpa_supplicant/sme.c | 531 +- contrib/wpa/wpa_supplicant/sme.h | 8 +- .../systemd/wpa_supplicant-nl80211.service.arg.in | 2 +- .../systemd/wpa_supplicant-wired.service.arg.in | 2 +- .../systemd/wpa_supplicant.service.arg.in | 2 +- contrib/wpa/wpa_supplicant/twt.c | 142 + .../vs2005/eapol_test/eapol_test.vcproj | 6 +- .../vs2005/wpa_supplicant/wpa_supplicant.vcproj | 6 +- .../wpa/wpa_supplicant/vs2005/wpasvc/wpasvc.vcproj | 6 +- contrib/wpa/wpa_supplicant/wmm_ac.c | 2 +- contrib/wpa/wpa_supplicant/wnm_sta.c | 33 +- contrib/wpa/wpa_supplicant/wpa_cli.c | 339 +- contrib/wpa/wpa_supplicant/wpa_passphrase.c | 8 +- contrib/wpa/wpa_supplicant/wpa_priv.c | 32 +- contrib/wpa/wpa_supplicant/wpa_supplicant.c | 1283 +- contrib/wpa/wpa_supplicant/wpa_supplicant.conf | 196 +- contrib/wpa/wpa_supplicant/wpa_supplicant_i.h | 249 +- contrib/wpa/wpa_supplicant/wpas_glue.c | 222 +- contrib/wpa/wpa_supplicant/wpas_glue.h | 2 + contrib/wpa/wpa_supplicant/wpas_kay.c | 12 +- contrib/wpa/wpa_supplicant/wpas_module_tests.c | 85 +- contrib/wpa/wpa_supplicant/wps_supplicant.c | 85 +- contrib/wpa/wpa_supplicant/wps_supplicant.h | 5 + usr.sbin/wpa/src/common/Makefile | 2 + usr.sbin/wpa/src/crypto/Makefile | 5 +- usr.sbin/wpa/src/utils/Makefile | 2 + usr.sbin/wpa/wpa_supplicant/Makefile | 7 +- 498 files changed, 92625 insertions(+), 20522 deletions(-) diff --git a/contrib/wpa/CONTRIBUTIONS b/contrib/wpa/CONTRIBUTIONS index c81ad640995a..1b4caf7ac811 100644 --- a/contrib/wpa/CONTRIBUTIONS +++ b/contrib/wpa/CONTRIBUTIONS @@ -56,6 +56,9 @@ In general, the best way of generating a suitable formatted patch file is by committing the changes to a cloned git repository and using git format-patch. The patch can then be sent, e.g., with git send-email. +A list of pending patches waiting for review is available in +Patchwork: https://patchwork.ozlabs.org/project/hostap/list/ + History of license and contributions terms ------------------------------------------ @@ -140,7 +143,7 @@ The license terms used for hostap.git files Modified BSD license (no advertisement clause): -Copyright (c) 2002-2019, Jouni Malinen and contributors +Copyright (c) 2002-2021, Jouni Malinen and contributors All Rights Reserved. Redistribution and use in source and binary forms, with or without diff --git a/contrib/wpa/hostapd/Android.mk b/contrib/wpa/hostapd/Android.mk new file mode 100644 index 000000000000..dd8aa2450d7e --- /dev/null +++ b/contrib/wpa/hostapd/Android.mk @@ -0,0 +1,1152 @@ +# Copyright (C) 2008 The Android Open Source Project +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. +# + +LOCAL_PATH := $(call my-dir) + +WPA_BUILD_HOSTAPD := false +ifneq ($(BOARD_HOSTAPD_DRIVER),) + WPA_BUILD_HOSTAPD := true + CONFIG_DRIVER_$(BOARD_HOSTAPD_DRIVER) := y +endif + +ifeq ($(WPA_BUILD_HOSTAPD),true) + +include $(LOCAL_PATH)/android.config + +# To ignore possible wrong network configurations +L_CFLAGS = -DWPA_IGNORE_CONFIG_ERRORS + +L_CFLAGS += -DVERSION_STR_POSTFIX=\"-$(PLATFORM_VERSION)\" + +# Set Android log name +L_CFLAGS += -DANDROID_LOG_NAME=\"hostapd\" + +# Disable unused parameter warnings +L_CFLAGS += -Wno-unused-parameter + +# Set Android extended P2P functionality +L_CFLAGS += -DANDROID_P2P + +ifeq ($(BOARD_HOSTAPD_PRIVATE_LIB),) +L_CFLAGS += -DANDROID_LIB_STUB +endif + +ifneq ($(BOARD_HOSTAPD_PRIVATE_LIB_EVENT),) +L_CFLAGS += -DANDROID_LIB_EVENT +endif + +# Use Android specific directory for control interface sockets +L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\" +L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/hostapd\" + +# Use Android specific directory for hostapd_cli command completion history +L_CFLAGS += -DCONFIG_HOSTAPD_CLI_HISTORY_DIR=\"/data/misc/wifi\" + +# To force sizeof(enum) = 4 +ifeq ($(TARGET_ARCH),arm) +L_CFLAGS += -mabi=aapcs-linux +endif + +INCLUDES = $(LOCAL_PATH) +INCLUDES += $(LOCAL_PATH)/src +INCLUDES += $(LOCAL_PATH)/src/utils +INCLUDES += system/security/keystore/include +ifdef CONFIG_DRIVER_NL80211 +ifneq ($(wildcard external/libnl),) +INCLUDES += external/libnl/include +else +INCLUDES += external/libnl-headers +endif +endif + + +ifndef CONFIG_OS +ifdef CONFIG_NATIVE_WINDOWS +CONFIG_OS=win32 +else +CONFIG_OS=unix +endif +endif + +ifeq ($(CONFIG_OS), internal) +L_CFLAGS += -DOS_NO_C_LIB_DEFINES +endif + +ifdef CONFIG_NATIVE_WINDOWS +L_CFLAGS += -DCONFIG_NATIVE_WINDOWS +LIBS += -lws2_32 +endif + +OBJS = main.c +OBJS += config_file.c + +OBJS += src/ap/hostapd.c +OBJS += src/ap/wpa_auth_glue.c +OBJS += src/ap/drv_callbacks.c +OBJS += src/ap/ap_drv_ops.c +OBJS += src/ap/utils.c +OBJS += src/ap/authsrv.c +OBJS += src/ap/ieee802_1x.c +OBJS += src/ap/ap_config.c +OBJS += src/ap/eap_user_db.c +OBJS += src/ap/ieee802_11_auth.c +OBJS += src/ap/sta_info.c +OBJS += src/ap/wpa_auth.c +OBJS += src/ap/tkip_countermeasures.c +OBJS += src/ap/ap_mlme.c +OBJS += src/ap/wpa_auth_ie.c +OBJS += src/ap/preauth_auth.c +OBJS += src/ap/pmksa_cache_auth.c +OBJS += src/ap/ieee802_11_shared.c +OBJS += src/ap/beacon.c +OBJS += src/ap/bss_load.c +OBJS += src/ap/neighbor_db.c +OBJS += src/ap/rrm.c +OBJS_d = +OBJS_p = +LIBS = +LIBS_c = +HOBJS = +LIBS_h = + +NEED_RC4=y +NEED_AES=y +NEED_MD5=y +NEED_SHA1=y + +OBJS += src/drivers/drivers.c +L_CFLAGS += -DHOSTAPD + +ifdef CONFIG_WPA_TRACE +L_CFLAGS += -DWPA_TRACE +OBJS += src/utils/trace.c +HOBJS += src/utils/trace.c +LDFLAGS += -rdynamic +L_CFLAGS += -funwind-tables +ifdef CONFIG_WPA_TRACE_BFD +L_CFLAGS += -DWPA_TRACE_BFD +LIBS += -lbfd +LIBS_c += -lbfd +LIBS_h += -lbfd +endif +endif + +OBJS += src/utils/eloop.c + +ifdef CONFIG_ELOOP_POLL +L_CFLAGS += -DCONFIG_ELOOP_POLL +endif + +ifdef CONFIG_ELOOP_EPOLL +L_CFLAGS += -DCONFIG_ELOOP_EPOLL +endif + +OBJS += src/utils/common.c +OBJS += src/utils/wpa_debug.c +OBJS += src/utils/wpabuf.c +OBJS += src/utils/os_$(CONFIG_OS).c +OBJS += src/utils/ip_addr.c +OBJS += src/utils/crc32.c + +OBJS += src/common/ieee802_11_common.c +OBJS += src/common/wpa_common.c +OBJS += src/common/hw_features_common.c + +OBJS += src/eapol_auth/eapol_auth_sm.c + + +ifndef CONFIG_NO_DUMP_STATE +# define HOSTAPD_DUMP_STATE to include support for dumping internal state +# through control interface commands (undefine it, if you want to save in +# binary size) +L_CFLAGS += -DHOSTAPD_DUMP_STATE +OBJS += src/eapol_auth/eapol_auth_dump.c +endif + +ifdef CONFIG_NO_RADIUS +L_CFLAGS += -DCONFIG_NO_RADIUS +CONFIG_NO_ACCOUNTING=y +else +OBJS += src/radius/radius.c +OBJS += src/radius/radius_client.c +OBJS += src/radius/radius_das.c +endif + +ifdef CONFIG_NO_ACCOUNTING +L_CFLAGS += -DCONFIG_NO_ACCOUNTING +else +OBJS += src/ap/accounting.c +endif + +ifdef CONFIG_NO_VLAN +L_CFLAGS += -DCONFIG_NO_VLAN +else +OBJS += src/ap/vlan_init.c +OBJS += src/ap/vlan_ifconfig.c +OBJS += src/ap/vlan.c +ifdef CONFIG_FULL_DYNAMIC_VLAN +# Define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges +# and VLAN interfaces for the VLAN feature. +L_CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN +OBJS += src/ap/vlan_full.c +ifdef CONFIG_VLAN_NETLINK +OBJS += src/ap/vlan_util.c +else +OBJS += src/ap/vlan_ioctl.c +endif +endif +endif + +ifdef CONFIG_NO_CTRL_IFACE +L_CFLAGS += -DCONFIG_NO_CTRL_IFACE +else +OBJS += src/common/ctrl_iface_common.c +OBJS += ctrl_iface.c +OBJS += src/ap/ctrl_iface_ap.c +endif + +L_CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX + +ifdef CONFIG_RSN_PREAUTH +L_CFLAGS += -DCONFIG_RSN_PREAUTH +CONFIG_L2_PACKET=y +endif + +ifdef CONFIG_HS20 +CONFIG_PROXYARP=y +endif + +ifdef CONFIG_PROXYARP +CONFIG_L2_PACKET=y +endif + +ifdef CONFIG_SUITEB +L_CFLAGS += -DCONFIG_SUITEB +endif + +ifdef CONFIG_SUITEB192 +L_CFLAGS += -DCONFIG_SUITEB192 +NEED_SHA384=y +endif + +ifdef CONFIG_OCV +L_CFLAGS += -DCONFIG_OCV +OBJS += src/common/ocv.c +endif + +ifdef CONFIG_IEEE80211R +L_CFLAGS += -DCONFIG_IEEE80211R -DCONFIG_IEEE80211R_AP +OBJS += src/ap/wpa_auth_ft.c +NEED_AES_UNWRAP=y +NEED_AES_SIV=y +NEED_ETH_P_OUI=y +NEED_HMAC_SHA256_KDF=y +endif + +ifdef NEED_ETH_P_OUI +L_CFLAGS += -DCONFIG_ETH_P_OUI +OBJS += src/ap/eth_p_oui.c +endif + +ifdef CONFIG_SAE +L_CFLAGS += -DCONFIG_SAE +OBJS += src/common/sae.c +ifdef CONFIG_SAE_PK +L_CFLAGS += -DCONFIG_SAE_PK +OBJS += src/common/sae_pk.c +endif +NEED_ECC=y +NEED_DH_GROUPS=y +NEED_HMAC_SHA256_KDF=y +NEED_DRAGONFLY=y +endif + +ifdef CONFIG_OWE +L_CFLAGS += -DCONFIG_OWE +NEED_ECC=y +NEED_HMAC_SHA256_KDF=y +NEED_HMAC_SHA384_KDF=y +NEED_HMAC_SHA512_KDF=y +NEED_SHA384=y +NEED_SHA512=y +endif + +ifdef CONFIG_FILS +L_CFLAGS += -DCONFIG_FILS +OBJS += src/ap/fils_hlp.c +NEED_SHA384=y +NEED_AES_SIV=y +ifdef CONFIG_FILS_SK_PFS +L_CFLAGS += -DCONFIG_FILS_SK_PFS +NEED_ECC=y +endif +endif + +ifdef CONFIG_WNM +L_CFLAGS += -DCONFIG_WNM -DCONFIG_WNM_AP +OBJS += src/ap/wnm_ap.c +endif + +ifdef CONFIG_IEEE80211AC +L_CFLAGS += -DCONFIG_IEEE80211AC +endif + +ifdef CONFIG_IEEE80211AX +L_CFLAGS += -DCONFIG_IEEE80211AX +endif + +ifdef CONFIG_MBO +L_CFLAGS += -DCONFIG_MBO +OBJS += src/ap/mbo_ap.c +endif + +ifdef CONFIG_FST +L_CFLAGS += -DCONFIG_FST +OBJS += src/fst/fst.c +OBJS += src/fst/fst_group.c +OBJS += src/fst/fst_iface.c +OBJS += src/fst/fst_session.c +OBJS += src/fst/fst_ctrl_aux.c +ifdef CONFIG_FST_TEST +L_CFLAGS += -DCONFIG_FST_TEST +endif +ifndef CONFIG_NO_CTRL_IFACE +OBJS += src/fst/fst_ctrl_iface.c +endif +endif + +ifdef CONFIG_WEP +L_CFLAGS += -DCONFIG_WEP +endif + +ifdef CONFIG_NO_TKIP +L_CFLAGS += -DCONFIG_NO_TKIP +endif + + +include $(LOCAL_PATH)/src/drivers/drivers.mk + +OBJS += $(DRV_AP_OBJS) +L_CFLAGS += $(DRV_AP_CFLAGS) +LDFLAGS += $(DRV_AP_LDFLAGS) +LIBS += $(DRV_AP_LIBS) + +ifdef CONFIG_L2_PACKET +ifdef CONFIG_DNET_PCAP +ifdef CONFIG_L2_FREEBSD +LIBS += -lpcap +OBJS += src/l2_packet/l2_packet_freebsd.c +else +LIBS += -ldnet -lpcap +OBJS += src/l2_packet/l2_packet_pcap.c +endif +else +OBJS += src/l2_packet/l2_packet_linux.c +endif +else +OBJS += src/l2_packet/l2_packet_none.c +endif + + +ifdef CONFIG_EAP_MD5 +L_CFLAGS += -DEAP_SERVER_MD5 +OBJS += src/eap_server/eap_server_md5.c +CHAP=y +endif + +ifdef CONFIG_EAP_TLS +L_CFLAGS += -DEAP_SERVER_TLS +OBJS += src/eap_server/eap_server_tls.c +TLS_FUNCS=y +endif + +ifdef CONFIG_EAP_UNAUTH_TLS +L_CFLAGS += -DEAP_SERVER_UNAUTH_TLS +ifndef CONFIG_EAP_TLS +OBJS += src/eap_server/eap_server_tls.c +TLS_FUNCS=y +endif +endif + +ifdef CONFIG_EAP_PEAP +L_CFLAGS += -DEAP_SERVER_PEAP +OBJS += src/eap_server/eap_server_peap.c +OBJS += src/eap_common/eap_peap_common.c +TLS_FUNCS=y +CONFIG_EAP_MSCHAPV2=y +endif + +ifdef CONFIG_EAP_TTLS +L_CFLAGS += -DEAP_SERVER_TTLS +OBJS += src/eap_server/eap_server_ttls.c +TLS_FUNCS=y +CHAP=y +endif + +ifdef CONFIG_EAP_MSCHAPV2 +L_CFLAGS += -DEAP_SERVER_MSCHAPV2 +OBJS += src/eap_server/eap_server_mschapv2.c +MS_FUNCS=y +endif + +ifdef CONFIG_EAP_GTC +L_CFLAGS += -DEAP_SERVER_GTC +OBJS += src/eap_server/eap_server_gtc.c +endif + +ifdef CONFIG_EAP_SIM +L_CFLAGS += -DEAP_SERVER_SIM +OBJS += src/eap_server/eap_server_sim.c +CONFIG_EAP_SIM_COMMON=y +NEED_AES_CBC=y +endif + +ifdef CONFIG_EAP_AKA +L_CFLAGS += -DEAP_SERVER_AKA +OBJS += src/eap_server/eap_server_aka.c +CONFIG_EAP_SIM_COMMON=y +NEED_AES_CBC=y +endif + +ifdef CONFIG_EAP_AKA_PRIME +L_CFLAGS += -DEAP_SERVER_AKA_PRIME +endif + +ifdef CONFIG_EAP_SIM_COMMON +OBJS += src/eap_common/eap_sim_common.c +# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be +# replaced with another file implementing the interface specified in +# eap_sim_db.h. +OBJS += src/eap_server/eap_sim_db.c +NEED_FIPS186_2_PRF=y +endif + +ifdef CONFIG_EAP_PAX +L_CFLAGS += -DEAP_SERVER_PAX +OBJS += src/eap_server/eap_server_pax.c src/eap_common/eap_pax_common.c +endif + +ifdef CONFIG_EAP_PSK +L_CFLAGS += -DEAP_SERVER_PSK +OBJS += src/eap_server/eap_server_psk.c src/eap_common/eap_psk_common.c +NEED_AES_ENCBLOCK=y +NEED_AES_EAX=y +endif + *** 156373 LINES SKIPPED *** From nobody Thu Nov 4 18:32:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C3BE9180B23F; Thu, 4 Nov 2021 18:32: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 4HlXL23Tp8z3L7R; Thu, 4 Nov 2021 18:32: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 148D01180; Thu, 4 Nov 2021 18:32: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 1A4IW9mU004032; Thu, 4 Nov 2021 18:32:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4IW9bT004031; Thu, 4 Nov 2021 18:32:09 GMT (envelope-from git) Date: Thu, 4 Nov 2021 18:32:09 GMT Message-Id: <202111041832.1A4IW9bT004031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 3f3676a71266 - stable/13 - wpa: Enable MBO List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f3676a71266033b9cff54cca1e92caa0b51ea5c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=3f3676a71266033b9cff54cca1e92caa0b51ea5c commit 3f3676a71266033b9cff54cca1e92caa0b51ea5c Author: Cy Schubert AuthorDate: 2021-09-03 13:14:01 +0000 Commit: Cy Schubert CommitDate: 2021-11-04 18:30:24 +0000 wpa: Enable MBO Enable WiFi 6 MBO (Multi Band Operation). MBO is a prereq to 802.11ax. MBO allows the efficient use of multiple frequency bands (channels). To facilitate MBO, WNM (Wireless Network Monitoring) is a prerequisite. It is required to build. Tested by: philip (cherry picked from commit 3968b47cd974e503df303265f3be9ba5865499ab) --- usr.sbin/wpa/Makefile.inc | 3 +++ usr.sbin/wpa/src/ap/Makefile | 2 ++ usr.sbin/wpa/wpa_supplicant/Makefile | 2 ++ 3 files changed, 7 insertions(+) diff --git a/usr.sbin/wpa/Makefile.inc b/usr.sbin/wpa/Makefile.inc index 49c7344e8957..a43792d97403 100644 --- a/usr.sbin/wpa/Makefile.inc +++ b/usr.sbin/wpa/Makefile.inc @@ -68,6 +68,9 @@ CFLAGS+=-DEAP_SERVER_TLS CFLAGS+=-DEAP_SERVER_TTLS CFLAGS+=-DEAP_SERVER_WSC CFLAGS+=-DEAP_TLS_FUNCS +CFLAGS+=-DCONFIG_WNM +CFLAGS+=-DCONFIG_WNM_AP +CFLAGS+=-DCONFIG_MBO .if ${MK_WPA_SUPPLICANT_EAPOL} != "no" CFLAGS+=-DCONFIG_HS20 \ diff --git a/usr.sbin/wpa/src/ap/Makefile b/usr.sbin/wpa/src/ap/Makefile index b6d53b0d5dbb..162b8b5444aa 100644 --- a/usr.sbin/wpa/src/ap/Makefile +++ b/usr.sbin/wpa/src/ap/Makefile @@ -28,6 +28,7 @@ SRCS= accounting.c \ ieee802_11_shared.c \ ieee802_11_vht.c \ ieee802_1x.c \ + mbo_ap.c \ neighbor_db.c \ pmksa_cache_auth.c \ preauth_auth.c \ @@ -39,6 +40,7 @@ SRCS= accounting.c \ vlan_ifconfig.c \ vlan_init.c \ wmm.c \ + wnm_ap.c \ wpa_auth.c \ wpa_auth_glue.c \ wpa_auth_ie.c \ diff --git a/usr.sbin/wpa/wpa_supplicant/Makefile b/usr.sbin/wpa/wpa_supplicant/Makefile index b437d2991360..8e7edfcf7720 100644 --- a/usr.sbin/wpa/wpa_supplicant/Makefile +++ b/usr.sbin/wpa/wpa_supplicant/Makefile @@ -23,6 +23,7 @@ SRCS= bss.c \ events.c \ gas_query.c \ main.c \ + mbo.c \ notify.c \ op_classes.c \ offchannel.c \ @@ -32,6 +33,7 @@ SRCS= bss.c \ scan.c \ twt.c \ wmm_ac.c \ + wnm_sta.c \ wpa_supplicant.c \ wpas_glue.c From nobody Thu Nov 4 18:32:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2733F180B2D2; Thu, 4 Nov 2021 18: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 4HlXL357H4z3LFg; Thu, 4 Nov 2021 18:32: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 29F29F28; Thu, 4 Nov 2021 18:32: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 1A4IWB5S004057; Thu, 4 Nov 2021 18:32:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4IWBoU004056; Thu, 4 Nov 2021 18:32:11 GMT (envelope-from git) Date: Thu, 4 Nov 2021 18:32:11 GMT Message-Id: <202111041832.1A4IWBoU004056@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 580c04df4db6 - stable/13 - wpa: Enable RSN Preauthentication List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 580c04df4db670a023a2f8e95ae4889b8e3dc4bf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=580c04df4db670a023a2f8e95ae4889b8e3dc4bf commit 580c04df4db670a023a2f8e95ae4889b8e3dc4bf Author: Cy Schubert AuthorDate: 2021-09-03 13:14:59 +0000 Commit: Cy Schubert CommitDate: 2021-11-04 18:30:24 +0000 wpa: Enable RSN Preauthentication RSN Preauthentication allows a station autnetnicate to an AP that it is not associated with yet while associated with a different AP. This allows athentication to multiple APs simulteneously. Tested by: philip (cherry picked from commit bd452dcbede69b1862c769f244948f94b86448b5) --- usr.sbin/wpa/Makefile.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/wpa/Makefile.inc b/usr.sbin/wpa/Makefile.inc index a43792d97403..915b5312f02f 100644 --- a/usr.sbin/wpa/Makefile.inc +++ b/usr.sbin/wpa/Makefile.inc @@ -71,6 +71,7 @@ CFLAGS+=-DEAP_TLS_FUNCS CFLAGS+=-DCONFIG_WNM CFLAGS+=-DCONFIG_WNM_AP CFLAGS+=-DCONFIG_MBO +CFLAGS+=-DCONFIG_RSN_PREAUTH .if ${MK_WPA_SUPPLICANT_EAPOL} != "no" CFLAGS+=-DCONFIG_HS20 \ From nobody Thu Nov 4 18:32:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6DA8F180B329; Thu, 4 Nov 2021 18: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 4HlXL45qw4z3LC2; Thu, 4 Nov 2021 18:32: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 4D81C774; Thu, 4 Nov 2021 18:32: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 1A4IWCEb004081; Thu, 4 Nov 2021 18:32:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4IWC9O004080; Thu, 4 Nov 2021 18:32:12 GMT (envelope-from git) Date: Thu, 4 Nov 2021 18:32:12 GMT Message-Id: <202111041832.1A4IWC9O004080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: f9d2cbc6a526 - stable/13 - wpa: Address CTRL-EVENT-SCAN-FAILED List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9d2cbc6a5267003042663e0311d1b9d86ba4e36 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=f9d2cbc6a5267003042663e0311d1b9d86ba4e36 commit f9d2cbc6a5267003042663e0311d1b9d86ba4e36 Author: Cy Schubert AuthorDate: 2021-09-07 01:48:39 +0000 Commit: Cy Schubert CommitDate: 2021-11-04 18:30:25 +0000 wpa: Address CTRL-EVENT-SCAN-FAILED Some installations may experience CTRL-EVENT-SCAN-FAILED when associating to an AP. Installations that specify ifconfig_wlan0="WPA ... up" in rc.conf do not experience the problem whereas those which specify ifconfig_wlan0="WPA" without the "up" will experience CTRL-EVENT-SCAN_FAILED. However those that specify "up" in ifconfig_wlan0 will be able to reproduce this problem by service netif stop wlan0; service netif start wlan0. Interestingly The service netif stop/start problem is reproducible on the older wpa 2.9 as well. Reported by: dhw Reported by: "Oleg V. Nauman" Reported by: Filipe da Silva Santos Reported by: Jakob Alvermark (cherry picked from commit 5fcdc19a81115d975e238270754e28557a2fcfc5) --- libexec/rc/rc.d/wpa_supplicant | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rc/rc.d/wpa_supplicant b/libexec/rc/rc.d/wpa_supplicant index 8a86fec90e4d..3c5c9d243f68 100755 --- a/libexec/rc/rc.d/wpa_supplicant +++ b/libexec/rc/rc.d/wpa_supplicant @@ -12,6 +12,7 @@ name="wpa_supplicant" desc="WPA/802.11i Supplicant for wireless network devices" +start_postcmd="wpa_poststart" rcvar= ifn="$2" @@ -27,6 +28,10 @@ is_ndis_interface() esac } +wpa_poststart() { + ifconfig ${ifn} up +} + if is_wired_interface ${ifn} ; then driver="wired" elif is_ndis_interface ${ifn} ; then From nobody Thu Nov 4 18:32:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6A8FE180B445; Thu, 4 Nov 2021 18:32: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 4HlXL650m7z3LFw; Thu, 4 Nov 2021 18:32: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 67BE7110A; Thu, 4 Nov 2021 18: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 1A4IWDIr004105; Thu, 4 Nov 2021 18: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 1A4IWDd8004104; Thu, 4 Nov 2021 18:32:13 GMT (envelope-from git) Date: Thu, 4 Nov 2021 18:32:13 GMT Message-Id: <202111041832.1A4IWDd8004104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 33b73d010d01 - stable/13 - wpa: Address CTRL-EVENT-SCAN-FAILED List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 33b73d010d01ef24739562f93e7156448045d720 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=33b73d010d01ef24739562f93e7156448045d720 commit 33b73d010d01ef24739562f93e7156448045d720 Author: Cy Schubert AuthorDate: 2021-09-09 00:20:52 +0000 Commit: Cy Schubert CommitDate: 2021-11-04 18:30:25 +0000 wpa: Address CTRL-EVENT-SCAN-FAILED 5fcdc19a8111 didn't fully resolve the issue. There remains a report that an ifconfig wlan0 up by itself is insufficient. Ifconfig down must precede it. Reported by: Filipe da Silva Santos Fixes: 5fcdc19a8111 (cherry picked from commit d06d7eb09131edea666bf049d6c0c55672726f76) --- libexec/rc/rc.d/wpa_supplicant | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexec/rc/rc.d/wpa_supplicant b/libexec/rc/rc.d/wpa_supplicant index 3c5c9d243f68..9e5f64a5373f 100755 --- a/libexec/rc/rc.d/wpa_supplicant +++ b/libexec/rc/rc.d/wpa_supplicant @@ -29,6 +29,8 @@ is_ndis_interface() } wpa_poststart() { + ifconfig ${ifn} down + sleep 2 ifconfig ${ifn} up } From nobody Thu Nov 4 18:32:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DC86E180B530; Thu, 4 Nov 2021 18:32: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 4HlXL7366Lz3L9l; Thu, 4 Nov 2021 18:32: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 919C2110C; Thu, 4 Nov 2021 18:32: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 1A4IWEfv004129; Thu, 4 Nov 2021 18:32:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A4IWExb004128; Thu, 4 Nov 2021 18:32:14 GMT (envelope-from git) Date: Thu, 4 Nov 2021 18:32:14 GMT Message-Id: <202111041832.1A4IWExb004128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: ef1134110e80 - stable/13 - wpa: Fix WITHOUT_CRYPT build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ef1134110e80fe31792d01758b055a4bbec7de69 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=ef1134110e80fe31792d01758b055a4bbec7de69 commit ef1134110e80fe31792d01758b055a4bbec7de69 Author: Cy Schubert AuthorDate: 2021-10-28 23:55:48 +0000 Commit: Cy Schubert CommitDate: 2021-11-04 18:30:25 +0000 wpa: Fix WITHOUT_CRYPT build PASN requires CRYPT and when built WITHOUT_CRYPT buildworld fails. Only enable PASN when MK_CRYPT is enabled (default). PR: 259517 Reported by: emaste Fixes: c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 (cherry picked from commit a30e8044aa4753858c189f3384dae2b2f25a150b) --- usr.sbin/wpa/Makefile.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/wpa/Makefile.inc b/usr.sbin/wpa/Makefile.inc index 915b5312f02f..e43a6f539d92 100644 --- a/usr.sbin/wpa/Makefile.inc +++ b/usr.sbin/wpa/Makefile.inc @@ -56,7 +56,6 @@ CFLAGS+=-DCONFIG_TDLS CFLAGS+=-DCONFIG_TERMINATE_ONLASTIF CFLAGS+=-DCONFIG_TLS=openssl CFLAGS+=-DCONFIG_MATCH_IFACE -CFLAGS+=-DCONFIG_PASN CFLAGS+=-DCONFIG_PTKSA_CACHE CFLAGS+=-DEAP_SERVER CFLAGS+=-DEAP_SERVER_GTC @@ -91,6 +90,10 @@ NEED_AES_ENCBLOCK=y NEED_AES_OMAC1=y .endif +.if ${MK_CRYPT} != "no" +CFLAGS+=-DCONFIG_PASN +.endif + .if !empty(CFLAGS:M*-DEAP_AKA) NEED_SIM_COMMON=y NEED_AES_CBC=y From nobody Fri Nov 5 00:09:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE19B1847B01; Fri, 5 Nov 2021 00:09: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 4Hlgqj5rgdz4xLF; Fri, 5 Nov 2021 00:09: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 7F01059ED; Fri, 5 Nov 2021 00:09: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 1A509rEo044738; Fri, 5 Nov 2021 00:09:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A509rSV044737; Fri, 5 Nov 2021 00:09:53 GMT (envelope-from git) Date: Fri, 5 Nov 2021 00:09:53 GMT Message-Id: <202111050009.1A509rSV044737@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: 80e5955b085a - main - nfscl: Fix NFSv4.1/4.2 pnfs mounts using nconnect List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 80e5955b085af20e65ef84066a164936413748e3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=80e5955b085af20e65ef84066a164936413748e3 commit 80e5955b085af20e65ef84066a164936413748e3 Author: Rick Macklem AuthorDate: 2021-11-05 00:06:34 +0000 Commit: Rick Macklem CommitDate: 2021-11-05 00:06:34 +0000 nfscl: Fix NFSv4.1/4.2 pnfs mounts using nconnect When a mount with the "pnfs" and "nconnect" options specified does an I/O operation, it erroneously uses a TCP connection to the MDS when it is meant to be a DS operation and, as such, needs to use a TCP connection to the DS. This patch fixes this. When the "pnfs" and "nconnect" options are specified for a NFSv4.1/4.2 mount, there probably should be N connections established to each DS for I/O RPCs. This is a fair amount of work and may be done in a future commit. This problem was found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfs/nfs_commonkrpc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 358d77fe5b30..c1a5fab2a358 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -639,8 +639,17 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, if (nrp->nr_client == NULL) newnfs_connect(nmp, nrp, cred, td, 0, false, &nrp->nr_client); + /* + * If the "nconnect" mount option was specified and this RPC is + * one that can have a large RPC message and is being done through + * the NFS/MDS server, use an additional connection. (When the RPC is + * being done through the server/MDS, nrp == &nmp->nm_sockreq.) + * The "nconnect" mount option normally has minimal effect when the + * "pnfs" mount option is specified, since only Readdir RPCs are + * normally done through the NFS/MDS server. + */ nextconn_set = false; - if (nmp != NULL && nmp->nm_aconnect > 0 && + if (nmp != NULL && nmp->nm_aconnect > 0 && nrp == &nmp->nm_sockreq && (nd->nd_procnum == NFSPROC_READ || nd->nd_procnum == NFSPROC_READDIR || nd->nd_procnum == NFSPROC_READDIRPLUS || From nobody Fri Nov 5 04:55:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 155CA182F8C9; Fri, 5 Nov 2021 04:55: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 4Hlp8m05Z1z3lMf; Fri, 5 Nov 2021 04:55: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 D3AF811C75; Fri, 5 Nov 2021 04:55: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 1A54t3fC030045; Fri, 5 Nov 2021 04:55:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A54t3mC030044; Fri, 5 Nov 2021 04:55:03 GMT (envelope-from git) Date: Fri, 5 Nov 2021 04:55:03 GMT Message-Id: <202111050455.1A54t3mC030044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: 78bec4ed648f - stable/13 - devinfo(8): Remove cross-reference to pnpinfo(8) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 78bec4ed648f030b821be10920b636fc9788a735 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=78bec4ed648f030b821be10920b636fc9788a735 commit 78bec4ed648f030b821be10920b636fc9788a735 Author: Felix Johnson AuthorDate: 2021-11-01 16:29:12 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-05 04:54:33 +0000 devinfo(8): Remove cross-reference to pnpinfo(8) devinfo(8) manpage contains reference to pnpinfo(8) which existed at the time. Remove it. PR: 232587 Reported by: Graham Perrin (cherry picked from commit dde6071adcf203b185c185289f687c2bd51532fb) --- usr.sbin/devinfo/devinfo.8 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.sbin/devinfo/devinfo.8 b/usr.sbin/devinfo/devinfo.8 index 72fd73dba82c..091248250830 100644 --- a/usr.sbin/devinfo/devinfo.8 +++ b/usr.sbin/devinfo/devinfo.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2017 +.Dd November 1, 2021 .Dt DEVINFO 8 .Os .Sh NAME @@ -75,7 +75,6 @@ back to the root of the device tree. .Xr devinfo 3 , .Xr iostat 8 , .Xr pciconf 8 , -.Xr pnpinfo 8 , .Xr vmstat 8 , .Xr devclass 9 , .Xr device 9 From nobody Fri Nov 5 05:00:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8F15B1833CC5; Fri, 5 Nov 2021 05:00: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 4HlpHG3hG8z3ngK; Fri, 5 Nov 2021 05:00: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 5EE0D11C8A; Fri, 5 Nov 2021 05:00: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 1A550g19040461; Fri, 5 Nov 2021 05:00:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A550geQ040460; Fri, 5 Nov 2021 05:00:42 GMT (envelope-from git) Date: Fri, 5 Nov 2021 05:00:42 GMT Message-Id: <202111050500.1A550geQ040460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: 3530ba8cc1e7 - stable/13 - efirt(9): Correct efi_var_set definition in the manpage List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3530ba8cc1e7c601e01cf1d49f7943f421844745 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3530ba8cc1e7c601e01cf1d49f7943f421844745 commit 3530ba8cc1e7c601e01cf1d49f7943f421844745 Author: Lakshman AuthorDate: 2021-11-02 07:17:38 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-05 04:59:54 +0000 efirt(9): Correct efi_var_set definition in the manpage PR: 257531 (cherry picked from commit 2fe85640b2a3bf5c377dd180e40cd3d6e1a4f1f4) --- share/man/man9/efirt.9 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man9/efirt.9 b/share/man/man9/efirt.9 index fd5aee83656b..cdf0ea21ad8d 100644 --- a/share/man/man9/efirt.9 +++ b/share/man/man9/efirt.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2018 +.Dd November 2, 2021 .Dt EFIRT 9 .Os .Sh NAME @@ -63,8 +63,8 @@ .Ft int .Fn efi_var_nextname "size_t *namesize" "uint16_t *name" "struct uuid *vendor" .Ft int -.Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t *attrib" \ - "size_t *datasize" "void *data" +.Fn efi_var_set "uint16_t *name" "struct uuid *vendor" "uint32_t attrib" \ + "size_t datasize" "void *data" .Sh DESCRIPTION All of the following calls will return .Dv ENXIO From nobody Fri Nov 5 05:08:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A514B18383C2; Fri, 5 Nov 2021 05:08:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_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 4HlpSX345Hz3rCR; Fri, 5 Nov 2021 05:08:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 1A558Upt010453 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 5 Nov 2021 07:08:33 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 1A558Upt010453 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 1A558UU1010452; Fri, 5 Nov 2021 07:08:30 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 5 Nov 2021 07:08:30 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 10a62eb109ce - main - Use layer five checksum flags in the mbuf packet header to pass on crypto state. Message-ID: References: <202111041754.1A4HsVkY050121@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202111041754.1A4HsVkY050121@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HlpSX345Hz3rCR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Nov 04, 2021 at 05:54:31PM +0000, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=10a62eb109ceafce32aa2b18ec835b3b7285c2dd > > commit 10a62eb109ceafce32aa2b18ec835b3b7285c2dd > Author: Hans Petter Selasky > AuthorDate: 2021-11-04 17:43:24 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-11-04 17:52:06 +0000 > > Use layer five checksum flags in the mbuf packet header to pass on crypto state. > > The mbuf protocol flags get cleared between layers, and also it was discovered > that M_DECRYPTED conflicts with M_HASFCS when receiving ethernet patckets. > > Add the proper CSUM_TLS_MASK and CSUM_TLS_DECRYPTED defines, and start using > these instead of M_DECRYPTED inside the TCP LRO code. > > This change is needed by coming TLS RX hardware offload support patches. > > Suggested by: kib@ > Reviewed by: jhb@ > MFC after: 1 week > Sponsored by: NVIDIA Networking > --- > sys/netinet/tcp_lro.c | 11 ++++++++++- > sys/sys/mbuf.h | 2 ++ > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c > index cb9681559777..ea23ad75994d 100644 > --- a/sys/netinet/tcp_lro.c > +++ b/sys/netinet/tcp_lro.c > @@ -395,7 +395,8 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo > htons(m->m_pkthdr.ether_vtag) & htons(EVL_VLID_MASK); > } > /* Store decrypted flag, if any. */ > - if (__predict_false(m->m_flags & M_DECRYPTED)) > + if (__predict_false((m->m_pkthdr.csum_flags & > + CSUM_TLS_MASK) == CSUM_TLS_DECRYPTED)) > po->data.lro_flags |= LRO_FLAG_DECRYPTED; > } > > @@ -833,6 +834,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) > le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | > CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; > le->m_head->m_pkthdr.csum_data = 0xffff; > + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) > + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; > break; > case LRO_TYPE_IPV6_TCP: > csum = tcp_lro_update_checksum(&le->inner, le, > @@ -844,6 +847,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) > le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | > CSUM_PSEUDO_HDR; > le->m_head->m_pkthdr.csum_data = 0xffff; > + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) > + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; > break; > case LRO_TYPE_NONE: > switch (le->outer.data.lro_type) { > @@ -854,6 +859,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) > le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | > CSUM_PSEUDO_HDR | CSUM_IP_CHECKED | CSUM_IP_VALID; > le->m_head->m_pkthdr.csum_data = 0xffff; > + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) > + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; > break; > case LRO_TYPE_IPV6_TCP: > csum = tcp_lro_update_checksum(&le->outer, le, > @@ -862,6 +869,8 @@ tcp_flush_out_entry(struct lro_ctrl *lc, struct lro_entry *le) > le->m_head->m_pkthdr.csum_flags = CSUM_DATA_VALID | > CSUM_PSEUDO_HDR; > le->m_head->m_pkthdr.csum_data = 0xffff; > + if (__predict_false(le->outer.data.lro_flags & LRO_FLAG_DECRYPTED)) > + le->m_head->m_pkthdr.csum_flags |= CSUM_TLS_DECRYPTED; > break; > default: > break; > diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h > index 413854cc9a57..d0f90805fa78 100644 > --- a/sys/sys/mbuf.h > +++ b/sys/sys/mbuf.h > @@ -721,6 +721,8 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) > #define CSUM_UDP_IPV6 CSUM_IP6_UDP > #define CSUM_TCP_IPV6 CSUM_IP6_TCP > #define CSUM_SCTP_IPV6 CSUM_IP6_SCTP > +#define CSUM_TLS_MASK (CSUM_L5_CALC|CSUM_L5_VALID) > +#define CSUM_TLS_DECRYPTED CSUM_L5_CALC It is worth explaining in a comment that selection of the value for CSUM_TLS_DECRYPTED does not reuse previous value, in the sense that correct use of the CSUM_L5 flags from drivers (are there any?) is still correct. We usurp a value for L5 CSUM flags which should not be returned from driver, to mean something new. It also may be worth discussing do we need L5 flags in its present form, and are there any existing consumers that do not abuse there semi-free flags for something else. If no external consumers exist (*) then perhaps officially re-purposing them is better route. We could define them as something extensible or at least context (inpcb etc)-dependent. (*) it seems that there is no in-tree users > > /* > * mbuf types describing the content of the mbuf (including external storage). From nobody Fri Nov 5 09:17:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CC9B718492E8; Fri, 5 Nov 2021 09:17: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 4Hlvz45QBtz4gxh; Fri, 5 Nov 2021 09:17: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 99A0415236; Fri, 5 Nov 2021 09:17: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 1A59H4kN077862; Fri, 5 Nov 2021 09:17:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A59H4BZ077861; Fri, 5 Nov 2021 09:17:04 GMT (envelope-from git) Date: Fri, 5 Nov 2021 09:17:04 GMT Message-Id: <202111050917.1A59H4BZ077861@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: 76c5eecc3490 - main - pf: Introduce ridentifier List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 76c5eecc3490d89a9a3492ed2354802b69d69602 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=76c5eecc3490d89a9a3492ed2354802b69d69602 commit 76c5eecc3490d89a9a3492ed2354802b69d69602 Author: Kristof Provost AuthorDate: 2021-10-29 15:40:53 +0000 Commit: Kristof Provost CommitDate: 2021-11-05 08:39:56 +0000 pf: Introduce ridentifier Allow users to set a number on rules which will be exposed as part of the pflog header. The intent behind this is to allow users to correlate rules across updates (remember that pf rules continue to exist and match existing states, even if they're removed from the active ruleset) and pflog. Obtained from: pfSense MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32750 --- contrib/tcpdump/print-pflog.c | 7 ++++++- lib/libpfctl/libpfctl.c | 2 ++ lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/parse.y | 15 ++++++++++++++- sbin/pfctl/pfctl_parser.c | 2 ++ share/man/man4/pflog.4 | 3 ++- share/man/man5/pf.conf.5 | 7 ++++++- sys/net/if_pflog.h | 1 + sys/net/pfvar.h | 1 + sys/netpfil/ipfw/nat64/nat64clat.c | 2 +- sys/netpfil/ipfw/nat64/nat64lsn.c | 2 +- sys/netpfil/ipfw/nat64/nat64stl.c | 2 +- sys/netpfil/pf/if_pflog.c | 3 ++- sys/netpfil/pf/pf_nv.c | 2 ++ 14 files changed, 42 insertions(+), 8 deletions(-) diff --git a/contrib/tcpdump/print-pflog.c b/contrib/tcpdump/print-pflog.c index 38201c55ee3f..49994507e728 100644 --- a/contrib/tcpdump/print-pflog.c +++ b/contrib/tcpdump/print-pflog.c @@ -88,10 +88,12 @@ static const struct tok pf_directions[] = { static void pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) { - uint32_t rulenr, subrulenr; + uint32_t rulenr, subrulenr, ridentifier; rulenr = EXTRACT_32BITS(&hdr->rulenr); subrulenr = EXTRACT_32BITS(&hdr->subrulenr); + ridentifier = EXTRACT_32BITS(&hdr->ridentifier); + if (subrulenr == (uint32_t)-1) ND_PRINT((ndo, "rule %u/", rulenr)); else @@ -102,6 +104,9 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) if (hdr->uid != UID_MAX) ND_PRINT((ndo, " [uid %u]", (unsigned)hdr->uid)); + if (ridentifier != 0) + ND_PRINT((ndo, " [ridentifier %u]", ridentifier)); + ND_PRINT((ndo, ": %s %s on %s: ", tok2str(pf_actions, "unkn(%u)", hdr->action), tok2str(pf_directions, "unkn(%u)", hdr->dir), diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index aaf5998ed0d6..9abfbdce8cf1 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -455,6 +455,7 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) assert(labelcount <= PF_RULE_MAX_LABEL_COUNT); for (size_t i = 0; i < labelcount; i++) strlcpy(rule->label[i], labels[i], PF_RULE_LABEL_SIZE); + rule->ridentifier = nvlist_get_number(nvl, "ridentifier"); strlcpy(rule->ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); strlcpy(rule->qname, nvlist_get_string(nvl, "qname"), PF_QNAME_SIZE); strlcpy(rule->pqname, nvlist_get_string(nvl, "pqname"), PF_QNAME_SIZE); @@ -569,6 +570,7 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, r->label[labelcount]); labelcount++; } + nvlist_add_number(nvlr, "ridentifier", r->ridentifier); nvlist_add_string(nvlr, "ifname", r->ifname); nvlist_add_string(nvlr, "qname", r->qname); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 1f7259ee8d32..71806ed217ee 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -81,6 +81,7 @@ struct pfctl_rule { struct pf_rule_addr dst; union pf_rule_ptr skip[PF_SKIP_COUNT]; char label[PF_RULE_MAX_LABEL_COUNT][PF_RULE_LABEL_SIZE]; + u_int32_t ridentifier; char ifname[IFNAMSIZ]; char qname[PF_QNAME_SIZE]; char pqname[PF_QNAME_SIZE]; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index e22e60182c73..a21643070028 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -236,6 +236,7 @@ static struct filter_opts { struct node_icmp *icmpspec; u_int32_t tos; u_int32_t prob; + u_int32_t ridentifier; struct { int action; struct node_state_opt *options; @@ -263,6 +264,7 @@ static struct filter_opts { static struct antispoof_opts { char *label[PF_RULE_MAX_LABEL_COUNT]; int labelcount; + u_int32_t ridentifier; u_int rtableid; } antispoof_opts; @@ -471,7 +473,7 @@ int parseport(char *, struct range *r, int); %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL -%token DNPIPE DNQUEUE +%token DNPIPE DNQUEUE RIDENTIFIER %token LOAD RULESET_OPTIMIZATION PRIO %token STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE %token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY @@ -927,6 +929,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto r.af = $6; r.prob = $9.prob; r.rtableid = $9.rtableid; + r.ridentifier = $9.ridentifier; if ($9.tag) if (strlcpy(r.tagname, $9.tag, @@ -1326,6 +1329,7 @@ antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { r.logif = $2.logif; r.quick = $2.quick; r.af = $4; + r.ridentifier = $5.ridentifier; if (rule_label(&r, $5.label)) YYERROR; r.rtableid = $5.rtableid; @@ -1378,6 +1382,7 @@ antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { r.logif = $2.logif; r.quick = $2.quick; r.af = $4; + r.ridentifier = $5.ridentifier; if (rule_label(&r, $5.label)) YYERROR; r.rtableid = $5.rtableid; @@ -1440,6 +1445,9 @@ antispoof_opt : label { } antispoof_opts.label[antispoof_opts.labelcount++] = $1; } + | RIDENTIFIER number { + antispoof_opts.ridentifier = $2; + } | RTABLE NUMBER { if ($2 < 0 || $2 > rt_tableid_max()) { yyerror("invalid rtable id"); @@ -2155,6 +2163,7 @@ pfrule : action dir logquick interface route af proto fromto YYERROR; for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) free($9.label[i]); + r.ridentifier = $9.ridentifier; r.flags = $9.flags.b1; r.flagset = $9.flags.b2; if (($9.flags.b1 & $9.flags.b2) != $9.flags.b1) { @@ -2594,6 +2603,9 @@ filter_opt : USER uids { filter_opts.keep.action = $1.action; filter_opts.keep.options = $1.options; } + | RIDENTIFIER number { + filter_opts.ridentifier = $2; + } | FRAGMENT { filter_opts.fragment = 1; } @@ -5736,6 +5748,7 @@ lookup(char *s) { "return-icmp", RETURNICMP}, { "return-icmp6", RETURNICMP6}, { "return-rst", RETURNRST}, + { "ridentifier", RIDENTIFIER}, { "round-robin", ROUNDROBIN}, { "route", ROUTE}, { "route-to", ROUTETO}, diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 91a3a38ef016..a9bea39a6771 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1019,6 +1019,8 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer i = 0; while (r->label[i][0]) printf(" label \"%s\"", r->label[i++]); + if (r->ridentifier) + printf(" ridentifier %u", r->ridentifier); /* Only dnrpipe as we might do (0, 42) to only queue return traffic. */ if (r->dnrpipe) printf(" %s(%d, %d)", diff --git a/share/man/man4/pflog.4 b/share/man/man4/pflog.4 index 300092a9532b..19eb7012bca3 100644 --- a/share/man/man4/pflog.4 +++ b/share/man/man4/pflog.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2019 +.Dd October 29, 2021 .Dt PFLOG 4 .Os .Sh NAME @@ -84,6 +84,7 @@ struct pfloghdr { pid_t rule_pid; u_int8_t dir; u_int8_t pad[3]; + u_int32_t ridentifier; }; .Ed .Sh EXAMPLES diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 9f69db70d90b..63b8acaef358 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -1896,6 +1896,9 @@ pass in inet proto tcp from any to 1.2.3.5 \e The macro expansion for the .Ar label directive occurs only at configuration file parse time, not during runtime. +.It Ar ridentifier Aq Ar number +Add an identifier (number) to the rule, which can be used to correlate the rule +to pflog entries, even after ruleset updates. .It Xo Ar queue Aq Ar queue .No \*(Ba ( Aq Ar queue , .Aq Ar queue ) @@ -3000,7 +3003,8 @@ filteropt = user | group | flags | icmp-type | icmp6-type | "tos" tos | "queue" ( string | "(" string [ [ "," ] string ] ")" ) | "rtable" number | "probability" number"%" | "prio" number | "dnpipe" ( number | "(" number "," number ")" ) | - "dnqueue" ( number | "(" number "," number ")" ) + "dnqueue" ( number | "(" number "," number ")" ) | + "ridentifier" number nat-rule = [ "no" ] "nat" [ "pass" [ "log" [ "(" logopts ")" ] ] ] [ "on" ifspec ] [ af ] @@ -3024,6 +3028,7 @@ rdr-rule = [ "no" ] "rdr" [ "pass" [ "log" [ "(" logopts ")" ] ] ] antispoof-rule = "antispoof" [ "log" ] [ "quick" ] "for" ifspec [ af ] [ "label" string ] + [ "ridentifier" number ] table-rule = "table" "\*(Lt" string "\*(Gt" [ tableopts-list ] tableopts-list = tableopts-list tableopts | tableopts diff --git a/sys/net/if_pflog.h b/sys/net/if_pflog.h index 5ed341a85d86..c77d8da1440a 100644 --- a/sys/net/if_pflog.h +++ b/sys/net/if_pflog.h @@ -50,6 +50,7 @@ struct pfloghdr { pid_t rule_pid; u_int8_t dir; u_int8_t pad[3]; + u_int32_t ridentifier; }; #define PFLOG_HDRLEN sizeof(struct pfloghdr) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e9277dce4963..a6994e8b1846 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -578,6 +578,7 @@ struct pf_krule { struct pf_rule_addr dst; union pf_krule_ptr skip[PF_SKIP_COUNT]; char label[PF_RULE_MAX_LABEL_COUNT][PF_RULE_LABEL_SIZE]; + uint32_t ridentifier; char ifname[IFNAMSIZ]; char qname[PF_QNAME_SIZE]; char pqname[PF_QNAME_SIZE]; diff --git a/sys/netpfil/ipfw/nat64/nat64clat.c b/sys/netpfil/ipfw/nat64/nat64clat.c index fcc922726d02..c48c68183e08 100644 --- a/sys/netpfil/ipfw/nat64/nat64clat.c +++ b/sys/netpfil/ipfw/nat64/nat64clat.c @@ -71,7 +71,7 @@ nat64clat_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, static uint32_t pktid = 0; memset(plog, 0, sizeof(*plog)); - plog->length = PFLOG_REAL_HDRLEN; + plog->length = PFLOG_HDRLEN; plog->af = family; plog->action = PF_NAT; plog->dir = PF_IN; diff --git a/sys/netpfil/ipfw/nat64/nat64lsn.c b/sys/netpfil/ipfw/nat64/nat64lsn.c index bde42eeb18d6..90c27cabdf29 100644 --- a/sys/netpfil/ipfw/nat64/nat64lsn.c +++ b/sys/netpfil/ipfw/nat64/nat64lsn.c @@ -181,7 +181,7 @@ nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, { memset(plog, 0, sizeof(*plog)); - plog->length = PFLOG_REAL_HDRLEN; + plog->length = PFLOG_HDRLEN; plog->af = family; plog->action = PF_NAT; plog->dir = PF_IN; diff --git a/sys/netpfil/ipfw/nat64/nat64stl.c b/sys/netpfil/ipfw/nat64/nat64stl.c index 286876e553e3..a3451a107579 100644 --- a/sys/netpfil/ipfw/nat64/nat64stl.c +++ b/sys/netpfil/ipfw/nat64/nat64stl.c @@ -70,7 +70,7 @@ nat64stl_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, static uint32_t pktid = 0; memset(plog, 0, sizeof(*plog)); - plog->length = PFLOG_REAL_HDRLEN; + plog->length = PFLOG_HDRLEN; plog->af = family; plog->action = PF_NAT; plog->dir = PF_IN; diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 9eb168b9a74f..4853c1301d6f 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -215,7 +215,7 @@ pflog_packet(struct pfi_kkif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, return (0); bzero(&hdr, sizeof(hdr)); - hdr.length = PFLOG_REAL_HDRLEN; + hdr.length = PFLOG_HDRLEN; hdr.af = af; hdr.action = rm->action; hdr.reason = reason; @@ -231,6 +231,7 @@ pflog_packet(struct pfi_kkif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, strlcpy(hdr.ruleset, ruleset->anchor->name, sizeof(hdr.ruleset)); } + hdr.ridentifier = htonl(rm->ridentifier); /* * XXXGL: we avoid pf_socket_lookup() when we are holding * state lock, since this leads to unsafe LOR. diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 933603066e21..143d84416542 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -531,6 +531,7 @@ pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule *rule) } } + PFNV_CHK(pf_nvuint32_opt(nvl, "ridentifier", &rule->ridentifier, 0)); PFNV_CHK(pf_nvstring(nvl, "ifname", rule->ifname, sizeof(rule->ifname))); PFNV_CHK(pf_nvstring(nvl, "qname", rule->qname, sizeof(rule->qname))); @@ -696,6 +697,7 @@ pf_krule_to_nvrule(struct pf_krule *rule) nvlist_append_string_array(nvl, "labels", rule->label[i]); } nvlist_add_string(nvl, "label", rule->label[0]); + nvlist_add_number(nvl, "ridentifier", rule->ridentifier); nvlist_add_string(nvl, "ifname", rule->ifname); nvlist_add_string(nvl, "qname", rule->qname); nvlist_add_string(nvl, "pqname", rule->pqname); From nobody Fri Nov 5 09:17:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E9F7D1849345; Fri, 5 Nov 2021 09:17: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 4Hlvz564QFz4gvT; Fri, 5 Nov 2021 09:17: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 AB85A14D21; Fri, 5 Nov 2021 09:17: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 1A59H56Q077886; Fri, 5 Nov 2021 09:17:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A59H523077885; Fri, 5 Nov 2021 09:17:05 GMT (envelope-from git) Date: Fri, 5 Nov 2021 09:17:05 GMT Message-Id: <202111050917.1A59H523077885@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: 508161111dc2 - main - pf tests: basic test for ridentifier List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 508161111dc23cee0a41fa70de865743c694502f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=508161111dc23cee0a41fa70de865743c694502f commit 508161111dc23cee0a41fa70de865743c694502f Author: Kristof Provost AuthorDate: 2021-10-29 15:52:59 +0000 Commit: Kristof Provost CommitDate: 2021-11-05 08:39:56 +0000 pf tests: basic test for ridentifier MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32751 --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/ridentifier.sh | 108 ++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/pf/utils.subr | 7 +++ 3 files changed, 116 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 246c267e7d2b..e62f3485d26d 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -22,6 +22,7 @@ ATF_TESTS_SH+= altq \ pfsync \ proxy \ rdr \ + ridentifier \ route_to \ rules_counter \ set_skip \ diff --git a/tests/sys/netpfil/pf/ridentifier.sh b/tests/sys/netpfil/pf/ridentifier.sh new file mode 100644 index 000000000000..da2f40c7ae98 --- /dev/null +++ b/tests/sys/netpfil/pf/ridentifier.sh @@ -0,0 +1,108 @@ +# $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_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Test ridentifier keyword' + atf_set require.user root +} + +basic_body() +{ + pft_init + pflog_init + + epair=$(vnet_mkepair) + + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig lo0 up + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz /usr/sbin/inetd -p inetd-alcatraz.pid $(atf_get_srcdir)/echo_inetd.conf + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + jexec alcatraz pfctl -e + jexec alcatraz ifconfig pflog0 up + pft_set_rules alcatraz \ + "pass in log" \ + "pass in log proto tcp ridentifier 1234" + + jexec alcatraz tcpdump --immediate-mode -n -e -i pflog0 > tcpdump.log & + sleep 1 + + echo "test" | nc -N 192.0.2.2 7 + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + sleep 1 + jexec alcatraz killall tcpdump + + # Make sure we spotted the ridentifier + atf_check -s exit:0 -o ignore \ + grep 'rule 1/0.*ridentifier 1234' tcpdump.log + # But not on the !TCP traffic + atf_check -s exit:1 -o ignore \ + grep 'rule 0/0.*ridentifier' tcpdump.log + + # Now try with antispoof rules + pft_set_rules alcatraz \ + "pass in log" \ + "antispoof log for ${epair}b ridentifier 4321" + + jexec alcatraz tcpdump --immediate-mode -n -e -i pflog0 > tcpdump.log & + sleep 1 + + # Without explicit rules for lo0 we're going to drop packets to ourself + atf_check -s exit:2 -o ignore -e ignore \ + jexec alcatraz ping -c 1 -t 1 192.0.2.2 + + sleep 1 + jexec alcatraz killall tcpdump + + cat tcpdump.log + + # Make sure we spotted the ridentifier + atf_check -s exit:0 -o ignore \ + grep 'rule 2/0.*ridentifier 4321' tcpdump.log +} + +basic_cleanup() +{ + pft_cleanup + rm -f inetd-alcatraz.pid + rm -f tcpdump.log +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +} diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index d7df2a6747da..c9a404c8012e 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -46,6 +46,13 @@ pfsynct_init() fi } +pflog_init() +{ + if ! kldstat -q -m pflog; then + atf_skip "This test requires pflog" + fi +} + pft_set_rules() { jname=$1 From nobody Fri Nov 5 09:17:06 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D1AFE1849351; Fri, 5 Nov 2021 09:17: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 4Hlvz70gDrz4h5k; Fri, 5 Nov 2021 09:17: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 DC61B14D22; Fri, 5 Nov 2021 09:17: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 1A59H6Ls077917; Fri, 5 Nov 2021 09:17:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A59H6Yb077916; Fri, 5 Nov 2021 09:17:06 GMT (envelope-from git) Date: Fri, 5 Nov 2021 09:17:06 GMT Message-Id: <202111050917.1A59H6Yb077916@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: 7bb3c927f7d9 - main - libpfct: be consistent with u_int vs. uint List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 7bb3c927f7d9c48b356b4d20907b813f9b83273b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7bb3c927f7d9c48b356b4d20907b813f9b83273b commit 7bb3c927f7d9c48b356b4d20907b813f9b83273b Author: Kristof Provost AuthorDate: 2021-11-05 08:37:56 +0000 Commit: Kristof Provost CommitDate: 2021-11-05 08:39:56 +0000 libpfct: be consistent with u_int vs. uint Always use uint64_t over u_int64_t, for the sake of consistency. No functional change. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libpfctl/libpfctl.c | 34 ++++++------- lib/libpfctl/libpfctl.h | 128 ++++++++++++++++++++++++------------------------ 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 9abfbdce8cf1..da7c27522fd2 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -61,7 +61,7 @@ static int _pfctl_clear_states(int , const struct pfctl_kill *, static void pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, - u_int8_t *numbers, size_t *nelems) + uint8_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -78,7 +78,7 @@ pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, static void pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, - u_int16_t *numbers, size_t *nelems) + uint16_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -95,7 +95,7 @@ pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, static void pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, - u_int32_t *numbers, size_t *nelems) + uint32_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -112,7 +112,7 @@ pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, static void pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, - u_int64_t *numbers, size_t *nelems) + uint64_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -304,7 +304,7 @@ static void pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, const struct pf_rule_addr *addr) { - u_int64_t ports[2]; + uint64_t ports[2]; nvlist_t *nvl = nvlist_create(0); pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); @@ -345,7 +345,7 @@ static void pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, const struct pfctl_pool *pool) { - u_int64_t ports[2]; + uint64_t ports[2]; nvlist_t *nvl = nvlist_create(0); nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); @@ -394,7 +394,7 @@ static void pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, const struct pf_rule_uid *uid) { - u_int64_t uids[2]; + uint64_t uids[2]; nvlist_t *nvl = nvlist_create(0); uids[0] = uid->uid[0]; @@ -542,11 +542,11 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) int pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) + const char *anchor_call, uint32_t ticket, uint32_t pool_ticket) { struct pfioc_nv nv; - u_int64_t timeouts[PFTM_MAX]; - u_int64_t set_prio[2]; + uint64_t timeouts[PFTM_MAX]; + uint64_t set_prio[2]; nvlist_t *nvl, *nvlr; size_t labelcount; int ret; @@ -662,15 +662,15 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, } int -pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, - u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call) +pfctl_get_rule(int dev, uint32_t nr, uint32_t ticket, const char *anchor, + uint32_t ruleset, struct pfctl_rule *rule, char *anchor_call) { return (pfctl_get_clear_rule(dev, nr, ticket, anchor, ruleset, rule, anchor_call, false)); } -int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, +int pfctl_get_clear_rule(int dev, uint32_t nr, uint32_t ticket, + const char *anchor, uint32_t ruleset, struct pfctl_rule *rule, char *anchor_call, bool clear) { struct pfioc_nv nv; @@ -947,7 +947,7 @@ pfctl_kill_states(int dev, const struct pfctl_kill *kill, unsigned int *killed) } static int -pfctl_get_limit(int dev, const int index, u_int *limit) +pfctl_get_limit(int dev, const int index, uint *limit) { struct pfioc_limit pl; @@ -968,7 +968,7 @@ pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) struct pfioc_nv nv; nvlist_t *nvl; int ret; - u_int state_limit; + uint state_limit; ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); if (ret != 0) @@ -998,7 +998,7 @@ pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) struct pfioc_nv nv; nvlist_t *nvl; int ret; - u_int state_limit; + uint state_limit; bool enabled, adaptive; ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 71806ed217ee..6b516b0a7649 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -72,8 +72,8 @@ struct pfctl_pool { struct pf_addr counter; struct pf_mape_portset mape; int tblidx; - u_int16_t proxy_port[2]; - u_int8_t opts; + uint16_t proxy_port[2]; + uint8_t opts; }; struct pfctl_rule { @@ -81,7 +81,7 @@ struct pfctl_rule { struct pf_rule_addr dst; union pf_rule_ptr skip[PF_SKIP_COUNT]; char label[PF_RULE_MAX_LABEL_COUNT][PF_RULE_LABEL_SIZE]; - u_int32_t ridentifier; + uint32_t ridentifier; char ifname[IFNAMSIZ]; char qname[PF_QNAME_SIZE]; char pqname[PF_QNAME_SIZE]; @@ -93,9 +93,9 @@ struct pfctl_rule { TAILQ_ENTRY(pfctl_rule) entries; struct pfctl_pool rpool; - u_int64_t evaluations; - u_int64_t packets[2]; - u_int64_t bytes[2]; + uint64_t evaluations; + uint64_t packets[2]; + uint64_t bytes[2]; struct pfi_kif *kif; struct pfctl_anchor *anchor; @@ -104,22 +104,22 @@ struct pfctl_rule { pf_osfp_t os_fingerprint; int rtableid; - u_int32_t timeout[PFTM_MAX]; - u_int32_t max_states; - u_int32_t max_src_nodes; - u_int32_t max_src_states; - u_int32_t max_src_conn; + uint32_t timeout[PFTM_MAX]; + uint32_t max_states; + uint32_t max_src_nodes; + uint32_t max_src_states; + uint32_t max_src_conn; struct { - u_int32_t limit; - u_int32_t seconds; + uint32_t limit; + uint32_t seconds; } max_src_conn_rate; - u_int32_t qid; - u_int32_t pqid; - u_int16_t dnpipe; - u_int16_t dnrpipe; - u_int32_t free_flags; - u_int32_t nr; - u_int32_t prob; + uint32_t qid; + uint32_t pqid; + uint16_t dnpipe; + uint16_t dnrpipe; + uint32_t free_flags; + uint32_t nr; + uint32_t prob; uid_t cuid; pid_t cpid; @@ -127,49 +127,49 @@ struct pfctl_rule { uint64_t states_tot; uint64_t src_nodes; - u_int16_t return_icmp; - u_int16_t return_icmp6; - u_int16_t max_mss; - u_int16_t tag; - u_int16_t match_tag; - u_int16_t scrub_flags; + uint16_t return_icmp; + uint16_t return_icmp6; + uint16_t max_mss; + uint16_t tag; + uint16_t match_tag; + uint16_t scrub_flags; struct pf_rule_uid uid; struct pf_rule_gid gid; - u_int32_t rule_flag; - u_int8_t action; - u_int8_t direction; - u_int8_t log; - u_int8_t logif; - u_int8_t quick; - u_int8_t ifnot; - u_int8_t match_tag_not; - u_int8_t natpass; - - u_int8_t keep_state; + uint32_t rule_flag; + uint8_t action; + uint8_t direction; + uint8_t log; + uint8_t logif; + uint8_t quick; + uint8_t ifnot; + uint8_t match_tag_not; + uint8_t natpass; + + uint8_t keep_state; sa_family_t af; - u_int8_t proto; - u_int8_t type; - u_int8_t code; - u_int8_t flags; - u_int8_t flagset; - u_int8_t min_ttl; - u_int8_t allow_opts; - u_int8_t rt; - u_int8_t return_ttl; - u_int8_t tos; - u_int8_t set_tos; - u_int8_t anchor_relative; - u_int8_t anchor_wildcard; - - u_int8_t flush; - u_int8_t prio; - u_int8_t set_prio[2]; + uint8_t proto; + uint8_t type; + uint8_t code; + uint8_t flags; + uint8_t flagset; + uint8_t min_ttl; + uint8_t allow_opts; + uint8_t rt; + uint8_t return_ttl; + uint8_t tos; + uint8_t set_tos; + uint8_t anchor_relative; + uint8_t anchor_wildcard; + + uint8_t flush; + uint8_t prio; + uint8_t set_prio[2]; struct { struct pf_addr addr; - u_int16_t port; + uint16_t port; } divert; }; @@ -181,13 +181,13 @@ struct pfctl_ruleset { struct { struct pfctl_rulequeue *ptr; struct pfctl_rule **ptr_array; - u_int32_t rcount; - u_int32_t ticket; + uint32_t rcount; + uint32_t ticket; int open; } active, inactive; } rules[PF_RULESET_MAX]; struct pfctl_anchor *anchor; - u_int32_t tticket; + uint32_t tticket; int tables; int topen; }; @@ -291,15 +291,15 @@ struct pfctl_syncookies { struct pfctl_status* pfctl_get_status(int dev); void pfctl_free_status(struct pfctl_status *status); -int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, +int pfctl_get_rule(int dev, uint32_t nr, uint32_t ticket, + const char *anchor, uint32_t ruleset, struct pfctl_rule *rule, char *anchor_call); -int pfctl_get_clear_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, +int pfctl_get_clear_rule(int dev, uint32_t nr, uint32_t ticket, + const char *anchor, uint32_t ruleset, struct pfctl_rule *rule, char *anchor_call, bool clear); int pfctl_add_rule(int dev, const struct pfctl_rule *r, - const char *anchor, const char *anchor_call, u_int32_t ticket, - u_int32_t pool_ticket); + const char *anchor, const char *anchor_call, uint32_t ticket, + uint32_t pool_ticket); int pfctl_set_keepcounters(int dev, bool keep); int pfctl_get_states(int dev, struct pfctl_states *states); void pfctl_free_states(struct pfctl_states *states); From nobody Fri Nov 5 09:19:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3FAE3184C04F; Fri, 5 Nov 2021 09:19: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 4Hlw1g10S8z4kCM; Fri, 5 Nov 2021 09:19: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 02B04150CF; Fri, 5 Nov 2021 09:19: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 1A59JIHV078224; Fri, 5 Nov 2021 09:19:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A59JIGD078223; Fri, 5 Nov 2021 09:19:18 GMT (envelope-from git) Date: Fri, 5 Nov 2021 09:19:18 GMT Message-Id: <202111050919.1A59JIGD078223@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: b8f94506f2d4 - main - sdhci: Provide devmethod for software reset List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: b8f94506f2d4b0ae811f27c244896d044d8780bf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=b8f94506f2d4b0ae811f27c244896d044d8780bf commit b8f94506f2d4b0ae811f27c244896d044d8780bf Author: Artur Rojek AuthorDate: 2021-11-05 09:14:25 +0000 Commit: Wojciech Macek CommitDate: 2021-11-05 09:18:57 +0000 sdhci: Provide devmethod for software reset Some sdhci controllers require custom software reset logic. Accommodate this need by introducing a new SDHCI_RESET devmethod. Move the existing reset logic into sdhci_generic_reset and use it as a default for the aforementioned method. Obtained from: Semihalf Sponsored by: Alstom Group Differeential revision: https://reviews.freebsd.org/D32704 --- sys/dev/sdhci/sdhci.c | 157 ++++++++++++++++++++++++----------------------- sys/dev/sdhci/sdhci.h | 1 + sys/dev/sdhci/sdhci_if.m | 6 ++ 3 files changed, 87 insertions(+), 77 deletions(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 4a59a73a7e26..22618ca0a822 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -106,7 +106,6 @@ static void sdhci_init(struct sdhci_slot *slot); static void sdhci_read_block_pio(struct sdhci_slot *slot); static void sdhci_req_done(struct sdhci_slot *slot); static void sdhci_req_wakeup(struct mmc_request *req); -static void sdhci_reset(struct sdhci_slot *slot, uint8_t mask); static void sdhci_retune(void *arg); static void sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock); static void sdhci_set_power(struct sdhci_slot *slot, u_char power); @@ -370,66 +369,6 @@ sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS) return (0); } -static void -sdhci_reset(struct sdhci_slot *slot, uint8_t mask) -{ - int timeout; - uint32_t clock; - - if (slot->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) { - if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot)) - return; - } - - /* Some controllers need this kick or reset won't work. */ - if ((mask & SDHCI_RESET_ALL) == 0 && - (slot->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET)) { - /* This is to force an update */ - clock = slot->clock; - slot->clock = 0; - sdhci_set_clock(slot, clock); - } - - if (mask & SDHCI_RESET_ALL) { - slot->clock = 0; - slot->power = 0; - } - - WR1(slot, SDHCI_SOFTWARE_RESET, mask); - - if (slot->quirks & SDHCI_QUIRK_WAITFOR_RESET_ASSERTED) { - /* - * Resets on TI OMAPs and AM335x are incompatible with SDHCI - * specification. The reset bit has internal propagation delay, - * so a fast read after write returns 0 even if reset process is - * in progress. The workaround is to poll for 1 before polling - * for 0. In the worst case, if we miss seeing it asserted the - * time we spent waiting is enough to ensure the reset finishes. - */ - timeout = 10000; - while ((RD1(slot, SDHCI_SOFTWARE_RESET) & mask) != mask) { - if (timeout <= 0) - break; - timeout--; - DELAY(1); - } - } - - /* Wait max 100 ms */ - timeout = 10000; - /* Controller clears the bits when it's done */ - while (RD1(slot, SDHCI_SOFTWARE_RESET) & mask) { - if (timeout <= 0) { - slot_printf(slot, "Reset 0x%x never completed.\n", - mask); - sdhci_dumpregs(slot); - return; - } - timeout--; - DELAY(10); - } -} - static uint32_t sdhci_tuning_intmask(const struct sdhci_slot *slot) { @@ -449,7 +388,7 @@ static void sdhci_init(struct sdhci_slot *slot) { - sdhci_reset(slot, SDHCI_RESET_ALL); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_ALL); /* Enable interrupts. */ slot->intmask = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | @@ -1256,7 +1195,7 @@ sdhci_cleanup_slot(struct sdhci_slot *slot) device_delete_child(slot->bus, d); SDHCI_LOCK(slot); - sdhci_reset(slot, SDHCI_RESET_ALL); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_ALL); SDHCI_UNLOCK(slot); if (slot->opt & SDHCI_HAVE_DMA) sdhci_dma_free(slot); @@ -1283,7 +1222,7 @@ sdhci_generic_suspend(struct sdhci_slot *slot) callout_drain(&slot->retune_callout); SDHCI_LOCK(slot); slot->opt &= ~SDHCI_TUNING_ENABLED; - sdhci_reset(slot, SDHCI_RESET_ALL); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_ALL); SDHCI_UNLOCK(slot); return (0); @@ -1300,6 +1239,67 @@ sdhci_generic_resume(struct sdhci_slot *slot) return (0); } +void +sdhci_generic_reset(device_t brdev __unused, struct sdhci_slot *slot, + uint8_t mask) +{ + int timeout; + uint32_t clock; + + if (slot->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) { + if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot)) + return; + } + + /* Some controllers need this kick or reset won't work. */ + if ((mask & SDHCI_RESET_ALL) == 0 && + (slot->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET)) { + /* This is to force an update */ + clock = slot->clock; + slot->clock = 0; + sdhci_set_clock(slot, clock); + } + + if (mask & SDHCI_RESET_ALL) { + slot->clock = 0; + slot->power = 0; + } + + WR1(slot, SDHCI_SOFTWARE_RESET, mask); + + if (slot->quirks & SDHCI_QUIRK_WAITFOR_RESET_ASSERTED) { + /* + * Resets on TI OMAPs and AM335x are incompatible with SDHCI + * specification. The reset bit has internal propagation delay, + * so a fast read after write returns 0 even if reset process is + * in progress. The workaround is to poll for 1 before polling + * for 0. In the worst case, if we miss seeing it asserted the + * time we spent waiting is enough to ensure the reset finishes. + */ + timeout = 10000; + while ((RD1(slot, SDHCI_SOFTWARE_RESET) & mask) != mask) { + if (timeout <= 0) + break; + timeout--; + DELAY(1); + } + } + + /* Wait max 100 ms */ + timeout = 10000; + /* Controller clears the bits when it's done */ + while (RD1(slot, SDHCI_SOFTWARE_RESET) & mask) { + if (timeout <= 0) { + slot_printf(slot, "Reset 0x%x never completed.\n", + mask); + sdhci_dumpregs(slot); + return; + } + timeout--; + DELAY(10); + } +} + uint32_t sdhci_generic_min_freq(device_t brdev __unused, struct sdhci_slot *slot) { @@ -1391,7 +1391,8 @@ sdhci_generic_update_ios(device_t brdev, device_t reqdev) SDHCI_SET_UHS_TIMING(brdev, slot); /* Some controllers like reset after bus changes. */ if (slot->quirks & SDHCI_QUIRK_RESET_ON_IOS) - sdhci_reset(slot, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, + SDHCI_RESET_CMD | SDHCI_RESET_DATA); SDHCI_UNLOCK(slot); return (0); @@ -1634,7 +1635,7 @@ sdhci_exec_tuning(struct sdhci_slot *slot, bool reset) slot_printf(slot, "Tuning failed, using fixed sampling clock\n"); WR2(slot, SDHCI_HOST_CONTROL2, hostctrl2 & ~(SDHCI_CTRL2_EXEC_TUNING | SDHCI_CTRL2_SAMPLING_CLOCK)); - sdhci_reset(slot, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_CMD | SDHCI_RESET_DATA); return (EIO); } @@ -1703,7 +1704,8 @@ sdhci_timeout(void *arg) if (slot->curcmd != NULL) { slot_printf(slot, "Controller timeout\n"); sdhci_dumpregs(slot); - sdhci_reset(slot, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, + SDHCI_RESET_CMD | SDHCI_RESET_DATA); slot->curcmd->error = MMC_ERR_TIMEOUT; sdhci_req_done(slot); } else { @@ -1881,8 +1883,8 @@ sdhci_finish_command(struct sdhci_slot *slot) if (slot->curcmd->error) { if (slot->curcmd->error == MMC_ERR_BADCRC) slot->retune_req |= SDHCI_RETUNE_REQ_RESET; - sdhci_reset(slot, SDHCI_RESET_CMD); - sdhci_reset(slot, SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_CMD); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_DATA); sdhci_start(slot); return; } @@ -2041,8 +2043,8 @@ sdhci_finish_data(struct sdhci_slot *slot) if (slot->curcmd->error) { if (slot->curcmd->error == MMC_ERR_BADCRC) slot->retune_req |= SDHCI_RETUNE_REQ_RESET; - sdhci_reset(slot, SDHCI_RESET_CMD); - sdhci_reset(slot, SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_CMD); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_DATA); sdhci_start(slot); return; } @@ -2084,8 +2086,8 @@ sdhci_start(struct sdhci_slot *slot) slot_printf(slot, "result: %d\n", mmcio->cmd.error); if (mmcio->cmd.error == 0 && (slot->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST)) { - sdhci_reset(slot, SDHCI_RESET_CMD); - sdhci_reset(slot, SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_CMD); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_DATA); } sdhci_req_done(slot); @@ -2117,8 +2119,8 @@ sdhci_start(struct sdhci_slot *slot) ((slot->curcmd == req->stop && (slot->quirks & SDHCI_QUIRK_BROKEN_AUTO_STOP)) || (slot->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) { - sdhci_reset(slot, SDHCI_RESET_CMD); - sdhci_reset(slot, SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_CMD); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_DATA); } sdhci_req_done(slot); @@ -2343,7 +2345,7 @@ sdhci_acmd_irq(struct sdhci_slot *slot, uint16_t acmd_err) return; } slot_printf(slot, "Got AutoCMD12 error 0x%04x\n", acmd_err); - sdhci_reset(slot, SDHCI_RESET_CMD); + SDHCI_RESET(slot->bus, slot, SDHCI_RESET_CMD); } void @@ -2849,7 +2851,8 @@ sdhci_cam_update_ios(struct sdhci_slot *slot) WR1(slot, SDHCI_HOST_CONTROL, slot->hostctrl); /* Some controllers like reset after bus changes. */ if(slot->quirks & SDHCI_QUIRK_RESET_ON_IOS) - sdhci_reset(slot, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + SDHCI_RESET(slot->bus, slot, + SDHCI_RESET_CMD | SDHCI_RESET_DATA); SDHCI_UNLOCK(slot); return (0); diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h index 9d68a14b28a2..4feb272bb359 100644 --- a/sys/dev/sdhci/sdhci.h +++ b/sys/dev/sdhci/sdhci.h @@ -431,6 +431,7 @@ void sdhci_finish_data(struct sdhci_slot *slot); int sdhci_cleanup_slot(struct sdhci_slot *slot); int sdhci_generic_suspend(struct sdhci_slot *slot); int sdhci_generic_resume(struct sdhci_slot *slot); +void sdhci_generic_reset(device_t brdev, struct sdhci_slot *slot, uint8_t mask); int sdhci_generic_update_ios(device_t brdev, device_t reqdev); int sdhci_generic_tune(device_t brdev, device_t reqdev, bool hs400); int sdhci_generic_switch_vccq(device_t brdev, device_t reqdev); diff --git a/sys/dev/sdhci/sdhci_if.m b/sys/dev/sdhci/sdhci_if.m index 93c97a155fb1..c888f35bdaf0 100644 --- a/sys/dev/sdhci/sdhci_if.m +++ b/sys/dev/sdhci/sdhci_if.m @@ -164,3 +164,9 @@ METHOD void set_uhs_timing { device_t brdev; struct sdhci_slot *slot; } DEFAULT null_set_uhs_timing; + +METHOD void reset { + device_t brdev; + struct sdhci_slot *slot; + uint8_t mask; +} DEFAULT sdhci_generic_reset; From nobody Fri Nov 5 09:19:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C3879184C061; Fri, 5 Nov 2021 09:19: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 4Hlw1h33s1z4k9F; Fri, 5 Nov 2021 09:19: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 3689915247; Fri, 5 Nov 2021 09:19: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 1A59JKkQ078254; Fri, 5 Nov 2021 09:19:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A59JK1T078253; Fri, 5 Nov 2021 09:19:20 GMT (envelope-from git) Date: Fri, 5 Nov 2021 09:19:20 GMT Message-Id: <202111050919.1A59JK1T078253@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: 36b80dba1742 - main - sdhci_fsl_fdt: Add full support for software reset List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 36b80dba1742acfeecfe8c26516c5cf16fd1346d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=36b80dba1742acfeecfe8c26516c5cf16fd1346d commit 36b80dba1742acfeecfe8c26516c5cf16fd1346d Author: Artur Rojek AuthorDate: 2021-11-05 09:16:30 +0000 Commit: Wojciech Macek CommitDate: 2021-11-05 09:18:57 +0000 sdhci_fsl_fdt: Add full support for software reset When performing software reset, this controller does not clear all the required hw registers. In particular, tuning block is left in enabled state, inhibiting operation of some eMMC cards. The existing solution was to disable the ability to call SDHCI_RESET_ALL. As this issue is now better understood, enable the SDHCI_RESET_ALL flag, provide a custom reset devmethod and clear selected registers by hand. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D32705 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 5aec394b9192..77af367c5366 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -86,6 +86,9 @@ __FBSDID("$FreeBSD$"); #define SDHCI_FSL_HOST_VERSION 0xfc #define SDHCI_FSL_CAPABILITIES2 0x114 +#define SDHCI_FSL_TBCTL 0x120 +#define SDHCI_FSL_TBCTL_TBEN (1 << 2) + #define SDHCI_FSL_ESDHC_CTRL 0x40c #define SDHCI_FSL_ESDHC_CTRL_SNOOP (1 << 6) #define SDHCI_FSL_ESDHC_CTRL_CLK_DIV2 (1 << 19) @@ -347,9 +350,6 @@ sdhci_fsl_fdt_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, return; case SDHCI_POWER_CONTROL: return; - case SDHCI_SOFTWARE_RESET: - val &= ~SDHCI_RESET_ALL; - /* FALLTHROUGH. */ default: val32 = RD4(sc, off & ~3); val32 &= ~(UINT8_MAX << (off & 3) * 8); @@ -803,6 +803,27 @@ sdhci_fsl_fdt_read_ivar(device_t bus, device_t child, int which, return (sdhci_generic_read_ivar(bus, child, which, result)); } +static void +sdhci_fsl_fdt_reset(device_t dev, struct sdhci_slot *slot, uint8_t mask) +{ + struct sdhci_fsl_fdt_softc *sc; + uint32_t val; + + sdhci_generic_reset(dev, slot, mask); + + if (!(mask & SDHCI_RESET_ALL)) + return; + + sc = device_get_softc(dev); + + /* Some registers have to be cleared by hand. */ + if (slot->version >= SDHCI_SPEC_300) { + val = RD4(sc, SDHCI_FSL_TBCTL); + val &= ~SDHCI_FSL_TBCTL_TBEN; + WR4(sc, SDHCI_FSL_TBCTL, val); + } +} + static const device_method_t sdhci_fsl_fdt_methods[] = { /* Device interface. */ DEVMETHOD(device_probe, sdhci_fsl_fdt_probe), @@ -831,6 +852,7 @@ static const device_method_t sdhci_fsl_fdt_methods[] = { DEVMETHOD(sdhci_write_4, sdhci_fsl_fdt_write_4), DEVMETHOD(sdhci_write_multi_4, sdhci_fsl_fdt_write_multi_4), DEVMETHOD(sdhci_get_card_present, sdhci_fsl_fdt_get_card_present), + DEVMETHOD(sdhci_reset, sdhci_fsl_fdt_reset), DEVMETHOD_END }; From nobody Fri Nov 5 09:19:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EA34A184C309; Fri, 5 Nov 2021 09:19: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 4Hlw1j3s33z4kJK; Fri, 5 Nov 2021 09:19: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 48B38152EC; Fri, 5 Nov 2021 09:19: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 1A59JLhX078280; Fri, 5 Nov 2021 09:19:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A59JL4h078279; Fri, 5 Nov 2021 09:19:21 GMT (envelope-from git) Date: Fri, 5 Nov 2021 09:19:21 GMT Message-Id: <202111050919.1A59JL4h078279@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: 8b57ee7e0107 - main - sdhci_fsl_fdt: Provide more accurate clk calculation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8b57ee7e0107695403702cca2b5ac0dfa452b5ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=8b57ee7e0107695403702cca2b5ac0dfa452b5ee commit 8b57ee7e0107695403702cca2b5ac0dfa452b5ee Author: Artur Rojek AuthorDate: 2021-11-05 09:17:49 +0000 Commit: Wojciech Macek CommitDate: 2021-11-05 09:18:57 +0000 sdhci_fsl_fdt: Provide more accurate clk calculation SDHCI controllers found in the QorIQ SoCs offer improved accuracy of the clock frequency selection, compared to the SDHCI standard. Frequency selection is performed using two divider registers, named prescaler and divisor, according to the following formula: frequency = base clock / (prescaler * divisor), where prescaler can be bypassed (set to 1) and divisor permitted to take odd values. Rather than depend on clock division precalculated by sdhci core, make use of this property of the divider registers and achieve frequencies closer to the ones requested. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D32706 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 74 +++++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 77af367c5366..06e3afeb4b09 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #define SDHCI_FSL_WTMK_WR_512B (0 << 15) #define SDHCI_FSL_HOST_VERSION 0xfc +#define SDHCI_FSL_VENDOR_V23 0x13 #define SDHCI_FSL_CAPABILITIES2 0x114 #define SDHCI_FSL_TBCTL 0x120 @@ -110,6 +111,7 @@ struct sdhci_fsl_fdt_softc { uint32_t cmd_and_mode; uint16_t sdclk_bits; struct mmc_helper fdt_helper; + uint8_t vendor_ver; uint32_t (* read)(struct sdhci_fsl_fdt_softc *, bus_size_t); void (* write)(struct sdhci_fsl_fdt_softc *, bus_size_t, uint32_t); @@ -186,10 +188,26 @@ sdhci_fsl_fdt_get_clock(struct sdhci_fsl_fdt_softc *sc) return (val); } +/* + * Calculate clock prescaler and divisor values based on the following formula: + * `frequency = base clock / (prescaler * divisor)`. + */ +#define SDHCI_FSL_FDT_CLK_DIV(sc, base, freq, pre, div) \ + do { \ + (pre) = (sc)->vendor_ver < SDHCI_FSL_VENDOR_V23 ? 2 : 1;\ + while ((freq) < (base) / ((pre) * 16) && (pre) < 256) \ + (pre) <<= 1; \ + /* div/pre can't both be set to 1, according to PM. */ \ + (div) = ((pre) == 1 ? 2 : 1); \ + while ((freq) < (base) / ((pre) * (div)) && (div) < 16) \ + ++(div); \ + } while (0) + static void -fsl_sdhc_fdt_set_clock(struct sdhci_fsl_fdt_softc *sc, uint16_t val) +fsl_sdhc_fdt_set_clock(struct sdhci_fsl_fdt_softc *sc, struct sdhci_slot *slot, + uint16_t val) { - uint32_t div, freq, prescale, val32; + uint32_t prescale, div, val32; sc->sdclk_bits = val & SDHCI_DIVIDERS_MASK; val32 = RD4(sc, SDHCI_CLOCK_CONTROL); @@ -199,23 +217,16 @@ fsl_sdhc_fdt_set_clock(struct sdhci_fsl_fdt_softc *sc, uint16_t val) return; } - div = ((val >> SDHCI_DIVIDER_SHIFT) & SDHCI_DIVIDER_MASK) | - ((val >> SDHCI_DIVIDER_HI_SHIFT) & SDHCI_DIVIDER_HI_MASK) << - SDHCI_DIVIDER_MASK_LEN; - if (div == 0) - freq = sc->maxclk_hz; - else - freq = sc->maxclk_hz / (2 * div); - - for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16); ) - prescale <<= 1; - for (div = 1; freq < sc->baseclk_hz / (prescale * div); ) - ++div; + /* + * Ignore dividers provided by core in `sdhci_set_clock` and calculate + * them anew with higher accuracy. + */ + SDHCI_FSL_FDT_CLK_DIV(sc, sc->baseclk_hz, slot->clock, prescale, div); #ifdef DEBUG device_printf(sc->dev, "Desired SD/MMC freq: %d, actual: %d; base %d prescale %d divisor %d\n", - freq, sc->baseclk_hz / (prescale * div), + slot->clock, sc->baseclk_hz / (prescale * div), sc->baseclk_hz, prescale, div); #endif @@ -370,7 +381,7 @@ sdhci_fsl_fdt_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, switch (off) { case SDHCI_CLOCK_CONTROL: - fsl_sdhc_fdt_set_clock(sc, val); + fsl_sdhc_fdt_set_clock(sc, slot, val); return; /* * eSDHC hardware combines command and mode into a single @@ -689,6 +700,9 @@ sdhci_fsl_fdt_attach(device_t dev) buf_order = SDHCI_FSL_PROT_CTRL_BYTE_SWAP; } + sc->vendor_ver = (RD4(sc, SDHCI_FSL_HOST_VERSION) & + SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; + sdhci_fsl_fdt_of_parse(dev); sc->maxclk_hz = host->f_max ? host->f_max : sc->baseclk_hz; @@ -803,6 +817,32 @@ sdhci_fsl_fdt_read_ivar(device_t bus, device_t child, int which, return (sdhci_generic_read_ivar(bus, child, which, result)); } +static int +sdhci_fsl_fdt_write_ivar(device_t bus, device_t child, int which, + uintptr_t value) +{ + struct sdhci_fsl_fdt_softc *sc; + struct sdhci_slot *slot = device_get_ivars(child); + uint32_t prescale, div; + + /* Don't depend on clock resolution limits from sdhci core. */ + if (which == MMCBR_IVAR_CLOCK) { + if (value == 0) { + slot->host.ios.clock = 0; + return (0); + } + + sc = device_get_softc(bus); + + SDHCI_FSL_FDT_CLK_DIV(sc, sc->baseclk_hz, value, prescale, div); + slot->host.ios.clock = sc->baseclk_hz / (prescale * div); + + return (0); + } + + return (sdhci_generic_write_ivar(bus, child, which, value)); +} + static void sdhci_fsl_fdt_reset(device_t dev, struct sdhci_slot *slot, uint8_t mask) { @@ -832,7 +872,7 @@ static const device_method_t sdhci_fsl_fdt_methods[] = { /* Bus interface. */ DEVMETHOD(bus_read_ivar, sdhci_fsl_fdt_read_ivar), - DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), + DEVMETHOD(bus_write_ivar, sdhci_fsl_fdt_write_ivar), /* MMC bridge interface. */ DEVMETHOD(mmcbr_request, sdhci_generic_request), From nobody Fri Nov 5 11:53:01 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9A4A9182922D; Fri, 5 Nov 2021 11:53: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 4HlzR13cgHz4XjX; Fri, 5 Nov 2021 11:53: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 5861317557; Fri, 5 Nov 2021 11:53: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 1A5Br1VW090498; Fri, 5 Nov 2021 11:53:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5Br1Aq090497; Fri, 5 Nov 2021 11:53:01 GMT (envelope-from git) Date: Fri, 5 Nov 2021 11:53:01 GMT Message-Id: <202111051153.1A5Br1Aq090497@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: 046e2d5db1e8 - main - Implementations of cexpl() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 046e2d5db1e8afd2d09ea28e5d2a7550535d4b77 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=046e2d5db1e8afd2d09ea28e5d2a7550535d4b77 commit 046e2d5db1e8afd2d09ea28e5d2a7550535d4b77 Author: Steve Kargl AuthorDate: 2021-11-05 02:04:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-05 11:51:42 +0000 Implementations of cexpl() The change implements cexpl() for both ld80 and ld128 architectures. Testing was done on x86_64 and aarch64 systems. Along the way sincos[fl]() use an optimization that reduces the argument to being done one rather than twice. This optimization actually pointed to a bug in the ld128 version of sincosl(), which is now fixed. In addition, the minmax polynomial coefficients for sincosl() have been updated. A concise log of the file-by-file changes follows. * include/complex.h: . Add a prototype for cexpl(). * lib/msun/Makefile: . Add s_cexpl.c to the build. . Setup a link for cexpl.3 to cexp.3. * lib/msun/Symbol.map: . Expose cexpl symbol in libm shared library. * lib/msun/ld128/s_cexpl.c: * Implementation of cexpl() for 128-bit long double architectures. Tested on an aarch64 system. * lib/msun/ld80/s_cexpl.c: * Implementation of cexpl() for Intel 80-bit long double. * lib/msun/man/cexp.3: . Document cexpl(). * lib/msun/man/complex.3: . Add a BUGS section about cpow[fl]. * lib/msun/src/s_cexp.c: . Include float.h for weak references on 53-bit long double targets. . Use sincos() to reduce argument reduction cost. * lib/msun/src/s_cexpf.c: . Use sincosf() to reduce argument reduction cost. * lib/msun/src/k_sincosl.h: . Catch up with the new minmax polynomial coefficients for the kernel for the 128-bit cosl() implementation. . BUG FIX: *cs was used where *sn should have been. This means that sinl() was no computed correctly when iy != 0. * lib/msun/src/s_cosl.c: . Include fpmath.h to get access to IEEEl2bits. . Replace M_PI_4 with pio4, a 64-bit or 113-bit approximation for pi / 4. PR: 216862 MFC after: 1 week --- include/complex.h | 2 + lib/msun/Makefile | 4 +- lib/msun/Symbol.map | 1 + lib/msun/ld128/s_cexpl.c | 94 +++++++++++++++++++++++++++++++++++++++++ lib/msun/ld80/s_cexpl.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++ lib/msun/man/cexp.3 | 17 +++++--- lib/msun/man/complex.3 | 8 +++- lib/msun/src/k_sincosl.h | 29 +++++++------ lib/msun/src/s_cexp.c | 16 +++++-- lib/msun/src/s_cexpf.c | 11 +++-- lib/msun/src/s_cosl.c | 7 +++- 11 files changed, 265 insertions(+), 31 deletions(-) diff --git a/include/complex.h b/include/complex.h index 892bc55e5145..c31c15d9da4b 100644 --- a/include/complex.h +++ b/include/complex.h @@ -98,6 +98,8 @@ double complex ccosh(double complex); float complex ccoshf(float complex); double complex cexp(double complex); float complex cexpf(float complex); +long double complex + cexpl(long double complex); double cimag(double complex) __pure2; float cimagf(float complex) __pure2; long double cimagl(long double complex) __pure2; diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 1d94e371e61f..d7c0e2f88358 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -117,7 +117,7 @@ COMMON_SRCS+= catrigl.c \ e_lgammal.c e_lgammal_r.c e_powl.c \ e_remainderl.c e_sinhl.c e_sqrtl.c \ invtrig.c k_cosl.c k_sinl.c k_tanl.c \ - s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c \ + s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cexpl.c \ s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \ s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \ @@ -189,7 +189,7 @@ MLINKS+=ccos.3 ccosf.3 ccos.3 csin.3 ccos.3 csinf.3 ccos.3 ctan.3 ccos.3 ctanf.3 MLINKS+=ccosh.3 ccoshf.3 ccosh.3 csinh.3 ccosh.3 csinhf.3 \ ccosh.3 ctanh.3 ccosh.3 ctanhf.3 MLINKS+=ceil.3 ceilf.3 ceil.3 ceill.3 -MLINKS+=cexp.3 cexpf.3 +MLINKS+=cexp.3 cexpf.3 cexp.3 cexpl.3 MLINKS+=cimag.3 cimagf.3 cimag.3 cimagl.3 \ cimag.3 conj.3 cimag.3 conjf.3 cimag.3 conjl.3 \ cimag.3 cproj.3 cimag.3 cprojf.3 cimag.3 cprojl.3 \ diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index 7229e7ef31fd..8650d56eb9d5 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -307,6 +307,7 @@ FBSD_1.5 { /* First added in 14.0-CURRENT */ FBSD_1.7 { + cexpl; cospi; cospif; cospil; diff --git a/lib/msun/ld128/s_cexpl.c b/lib/msun/ld128/s_cexpl.c new file mode 100644 index 000000000000..24f5e3792115 --- /dev/null +++ b/lib/msun/ld128/s_cexpl.c @@ -0,0 +1,94 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Steven G. Kargl + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "fpmath.h" +#include "math_private.h" +#include "k_expl.h" + +/* XXX cexpl() should be converted to use bits likeo src/s_cexp.c. */ + +static const long double +cexp_ovfl = 2.27892930024498818830197576893019292e+04L, +exp_ovfl = 1.13565234062941439494919310779707649e+04L; + +long double complex +cexpl(long double complex z) +{ + long double c, exp_x, s, x, y; + + x = creall(z); + y = cimagl(z); + + /* cexp(x + I 0) = exp(x) + I 0 */ + if (y == 0) + return (CMPLXL(expl(x), y)); + /* cexp(0 + I y) = cos(y) + I sin(y) */ + if (x == 0) { + sincosl(y, &s, &c); + return (CMPLXL(c, s)); + } + + if (!isfinite(y)) { + if (isfinite(x) || isnan(x)) { + /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ + return (CMPLXL(y - y, y - y)); + } else if (isinf(x) && copysignl(1.L, x) < 0) { + /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ + return (CMPLXL(0.0, 0.0)); + } else { + /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ + return (CMPLXL(x, y - y)); + } + } + + if (x > exp_ovfl && x < cexp_ovfl) { + /* + * x is between exp_ovfl and cexp_ovfl, so we must scale to + * avoid overflow in exp(x). + */ + return (__ldexp_cexpl(z, 0)); + } else { + /* + * Cases covered here: + * - x < exp_ovfl and exp(x) won't overflow (common case) + * - x > cexp_ovfl, so exp(x) * s overflows for all s > 0 + * - x = +-Inf (generated by exp()) + * - x = NaN (spurious inexact exception from y) + */ + exp_x = expl(x); + sincosl(y, &s, &c); + return (CMPLXL(exp_x * c, exp_x * s)); + } +} diff --git a/lib/msun/ld80/s_cexpl.c b/lib/msun/ld80/s_cexpl.c new file mode 100644 index 000000000000..5cc35f6d2514 --- /dev/null +++ b/lib/msun/ld80/s_cexpl.c @@ -0,0 +1,107 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2011 David Schultz + * 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. + * + * src/s_cexp.c converted to long double complex by Steven G. Kargl + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" +#include "k_expl.h" + +long double complex +cexpl (long double complex z) +{ + long double c, exp_x, s, x, y; + uint64_t lx, ly; + uint16_t hx, hy; + + ENTERI(); + + x = creall(z); + y = cimagl(z); + + EXTRACT_LDBL80_WORDS(hy, ly, y); + hy &= 0x7fff; + + /* cexp(x + I 0) = exp(x) + I 0 */ + if ((hy | ly) == 0) + RETURNI(CMPLXL(expl(x), y)); + EXTRACT_LDBL80_WORDS(hx, lx, x); + /* cexp(0 + I y) = cos(y) + I sin(y) */ + if (((hx & 0x7fff) | lx) == 0) { + sincosl(y, &s, &c); + RETURNI(CMPLXL(c, s)); + } + + if (hy >= 0x7fff) { + if ((hx & 0x7fff) < 0x7fff || ((hx & 0x7fff) == 0x7fff && + (lx & 0x7fffffffffffffffULL) != 0)) { + /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ + RETURNI(CMPLXL(y - y, y - y)); + } else if (hx & 0x8000) { + /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ + RETURNI(CMPLXL(0.0, 0.0)); + } else { + /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ + RETURNI(CMPLXL(x, y - y)); + } + } + + /* + * exp_ovfl = 11356.5234062941439497 + * cexp_ovfl = 22755.3287906024445633 + */ + if ((hx == 0x400c && lx > 0xb17217f7d1cf79acULL) || + (hx == 0x400d && lx < 0xb1c6a8573de9768cULL)) { + /* + * x is between exp_ovfl and cexp_ovfl, so we must scale to + * avoid overflow in exp(x). + */ + RETURNI(__ldexp_cexpl(z, 0)); + } else { + /* + * Cases covered here: + * - x < exp_ovfl and exp(x) won't overflow (common case) + * - x > cexp_ovfl, so exp(x) * s overflows for all s > 0 + * - x = +-Inf (generated by exp()) + * - x = NaN (spurious inexact exception from y) + */ + exp_x = expl(x); + sincosl(y, &s, &c); + RETURNI(CMPLXL(exp_x * c, exp_x * s)); + } +} diff --git a/lib/msun/man/cexp.3 b/lib/msun/man/cexp.3 index 776e6cee823e..27ab3e9c2098 100644 --- a/lib/msun/man/cexp.3 +++ b/lib/msun/man/cexp.3 @@ -24,12 +24,13 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2011 +.Dd November 3, 2021 .Dt CEXP 3 .Os .Sh NAME .Nm cexp , -.Nm cexpf +.Nm cexpf , +.Nm cexpl .Nd complex exponential functions .Sh LIBRARY .Lb libm @@ -39,11 +40,14 @@ .Fn cexp "double complex z" .Ft float complex .Fn cexpf "float complex z" +.Ft long double complex +.Fn cexpl "long double complex z" .Sh DESCRIPTION The -.Fn cexp +.Fn cexp , +.Fn cexpf , and -.Fn cexpf +.Fn cexpl functions compute the complex exponential of .Fa z , also known as @@ -106,8 +110,9 @@ is not finite, the sign of the result is indeterminate. .Xr math 3 .Sh STANDARDS The -.Fn cexp +.Fn cexp , +.Fn cexpf , and -.Fn cexpf +.Fn cexpl functions conform to .St -isoC-99 . diff --git a/lib/msun/man/complex.3 b/lib/msun/man/complex.3 index f1acfbe6da74..8cc0b7f97c52 100644 --- a/lib/msun/man/complex.3 +++ b/lib/msun/man/complex.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2018 +.Dd November 3, 2021 .Dt COMPLEX 3 .Os .Sh NAME @@ -121,3 +121,9 @@ The .In complex.h functions described here conform to .St -isoC-99 . +.Sh BUGS +The power functions, +.Fn cpowf, cpow , +and +.Fn cpowl , +are implemented, but the code was neither reviewed nor tested. diff --git a/lib/msun/src/k_sincosl.h b/lib/msun/src/k_sincosl.h index 4d4dc69f7820..6425f14a1ea0 100644 --- a/lib/msun/src/k_sincosl.h +++ b/lib/msun/src/k_sincosl.h @@ -76,13 +76,6 @@ __kernel_sincosl(long double x, long double y, int iy, long double *sn, #elif LDBL_MANT_DIG == 113 /* ld128 version of k_sincosl.c. */ static const long double -C1 = 0.04166666666666666666666666666666658424671L, -C2 = -0.001388888888888888888888888888863490893732L, -C3 = 0.00002480158730158730158730158600795304914210L, -C4 = -0.2755731922398589065255474947078934284324e-6L, -C5 = 0.2087675698786809897659225313136400793948e-8L, -C6 = -0.1147074559772972315817149986812031204775e-10L, -C7 = 0.4779477332386808976875457937252120293400e-13L, S1 = -0.16666666666666666666666666666666666606732416116558L, S2 = 0.0083333333333333333333333333333331135404851288270047L, S3 = -0.00019841269841269841269841269839935785325638310428717L, @@ -93,15 +86,25 @@ S7 = -0.76471637318198151807063387954939213287488216303768e-12L, S8 = 0.28114572543451292625024967174638477283187397621303e-14L; static const double -C8 = -0.1561920696721507929516718307820958119868e-15, -C9 = 0.4110317413744594971475941557607804508039e-18, -C10 = -0.8896592467191938803288521958313920156409e-21, -C11 = 0.1601061435794535138244346256065192782581e-23, S9 = -0.82206352458348947812512122163446202498005154296863e-17, S10 = 0.19572940011906109418080609928334380560135358385256e-19, S11 = -0.38680813379701966970673724299207480965452616911420e-22, S12 = 0.64038150078671872796678569586315881020659912139412e-25; +static const long double +C1 = 4.16666666666666666666666666666666667e-02L, +C2 = -1.38888888888888888888888888888888834e-03L, +C3 = 2.48015873015873015873015873015446795e-05L, +C4 = -2.75573192239858906525573190949988493e-07L, +C5 = 2.08767569878680989792098886701451072e-09L, +C6 = -1.14707455977297247136657111139971865e-11L, +C7 = 4.77947733238738518870113294139830239e-14L, +C8 = -1.56192069685858079920640872925306403e-16L, +C9 = 4.11031762320473354032038893429515732e-19L, +C10= -8.89679121027589608738005163931958096e-22L, +C11= 1.61171797801314301767074036661901531e-24L, +C12= -2.46748624357670948912574279501044295e-27L; + static inline void __kernel_sincosl(long double x, long double y, int iy, long double *sn, long double *cs) @@ -120,12 +123,12 @@ __kernel_sincosl(long double x, long double y, int iy, long double *sn, if (iy == 0) *sn = x + v * (S1 + z * r); else - *cs = x - ((z * (y / 2 - v * r) - y) - v * S1); + *sn = x - ((z * (y / 2 - v * r) - y) - v * S1); hz = z / 2; w = 1 - hz; r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * (C6 + - z * (C7 + z * (C8 + z * (C9 + z * (C10 + z * C11)))))))))); + z * (C7 + z * (C8 + z * (C9 + z * (C10 + z * (C11+z*C12))))))))))); *cs = w + (((1 - w) - hz) + (z * r - x * y)); } diff --git a/lib/msun/src/s_cexp.c b/lib/msun/src/s_cexp.c index 2ef8ba1972ca..a1f853eca4cc 100644 --- a/lib/msun/src/s_cexp.c +++ b/lib/msun/src/s_cexp.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include "math_private.h" @@ -41,7 +42,7 @@ cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ double complex cexp(double complex z) { - double x, y, exp_x; + double c, exp_x, s, x, y; uint32_t hx, hy, lx, ly; x = creal(z); @@ -55,8 +56,10 @@ cexp(double complex z) return (CMPLX(exp(x), y)); EXTRACT_WORDS(hx, lx, x); /* cexp(0 + I y) = cos(y) + I sin(y) */ - if (((hx & 0x7fffffff) | lx) == 0) - return (CMPLX(cos(y), sin(y))); + if (((hx & 0x7fffffff) | lx) == 0) { + sincos(y, &s, &c); + return (CMPLX(c, s)); + } if (hy >= 0x7ff00000) { if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) { @@ -86,6 +89,11 @@ cexp(double complex z) * - x = NaN (spurious inexact exception from y) */ exp_x = exp(x); - return (CMPLX(exp_x * cos(y), exp_x * sin(y))); + sincos(y, &s, &c); + return (CMPLX(exp_x * c, exp_x * s)); } } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(cexp, cexpl); +#endif diff --git a/lib/msun/src/s_cexpf.c b/lib/msun/src/s_cexpf.c index b815c99af89f..d905b74ff4bd 100644 --- a/lib/msun/src/s_cexpf.c +++ b/lib/msun/src/s_cexpf.c @@ -41,7 +41,7 @@ cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ float complex cexpf(float complex z) { - float x, y, exp_x; + float c, exp_x, s, x, y; uint32_t hx, hy; x = crealf(z); @@ -55,8 +55,10 @@ cexpf(float complex z) return (CMPLXF(expf(x), y)); GET_FLOAT_WORD(hx, x); /* cexp(0 + I y) = cos(y) + I sin(y) */ - if ((hx & 0x7fffffff) == 0) - return (CMPLXF(cosf(y), sinf(y))); + if ((hx & 0x7fffffff) == 0) { + sincosf(y, &s, &c); + return (CMPLXF(c, s)); + } if (hy >= 0x7f800000) { if ((hx & 0x7fffffff) != 0x7f800000) { @@ -86,6 +88,7 @@ cexpf(float complex z) * - x = NaN (spurious inexact exception from y) */ exp_x = expf(x); - return (CMPLXF(exp_x * cosf(y), exp_x * sinf(y))); + sincosf(y, &s, &c); + return (CMPLXF(exp_x * c, exp_x * s)); } } diff --git a/lib/msun/src/s_cosl.c b/lib/msun/src/s_cosl.c index 46a2e8620a22..3d066483f227 100644 --- a/lib/msun/src/s_cosl.c +++ b/lib/msun/src/s_cosl.c @@ -39,12 +39,17 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "fpmath.h" #include "math.h" #include "math_private.h" #if LDBL_MANT_DIG == 64 #include "../ld80/e_rem_pio2l.h" +static const union IEEEl2bits +pio4u = LD80C(0xc90fdaa22168c235, -00001, 7.85398163397448309628e-01L); +#define pio4 (pio4u.e) #elif LDBL_MANT_DIG == 113 #include "../ld128/e_rem_pio2l.h" +long double pio4 = 7.85398163397448309615660845819875721e-1L; #else #error "Unsupported long double format" #endif @@ -71,7 +76,7 @@ cosl(long double x) ENTERI(); /* Optimize the case where x is already within range. */ - if (z.e < M_PI_4) + if (z.e < pio4) RETURNI(__kernel_cosl(z.e, 0)); e0 = __ieee754_rem_pio2l(x, y); From nobody Fri Nov 5 12:41:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6DF4418418F9; Fri, 5 Nov 2021 12:41:15 +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 4Hm0Vg1Yl1z4mdL; Fri, 5 Nov 2021 12:41:15 +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 F02926715; Fri, 5 Nov 2021 12:41:14 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 5C1B738921; Fri, 5 Nov 2021 13:41:12 +0100 (CET) From: "Kristof Provost" To: "Kirk McKusick" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 68bff4a07e3f - main - Allow GEOM utilities to specify a -v option. Date: Fri, 05 Nov 2021 13:41:11 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <5C3D57AA-5771-42FF-924B-3A09818F869D@FreeBSD.org> References: <202110290552.19T5qOjx061844@gitrepo.freebsd.org> <5C3D57AA-5771-42FF-924B-3A09818F869D@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N Hi Kirk, On 29 Oct 2021, at 22:12, Kristof Provost wrote: > On 29 Oct 2021, at 7:52, Kirk McKusick wrote: >> The branch main has been updated by mckusick: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3D68bff4a07e3fa6c30a0c0ff6cf5f= 0bef95dcbd72 >> >> commit 68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72 >> Author: Kirk McKusick >> AuthorDate: 2021-10-29 05:49:48 +0000 >> Commit: Kirk McKusick >> CommitDate: 2021-10-29 05:50:50 +0000 >> >> Allow GEOM utilities to specify a -v option. >> >> Geom utilities (geli(8), glabel(8), gmirror(8), gpart(8), = >> gmirror(8), >> gmountver(8), etc) all use the geom(8) utility as their back end >> to process their commands and pass them into the kernel. Creating >> a new utility requires no more than filling out a template = >> describing >> the commands and arguments that the utility supports. Consider = >> the >> specification for the very simple gmountver(8) utility: >> >> struct g_command class_commands[] =3D { >> { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, >> { >> G_OPT_SENTINEL >> }, >> "[-v] prov ..." >> }, >> { "destroy", G_FLAG_VERBOSE, NULL, >> { >> { 'f', "force", NULL, G_TYPE_BOOL }, >> G_OPT_SENTINEL >> }, >> "[-fv] name" >> }, >> G_CMD_SENTINEL >> }; >> >> It has just two commands of its own: "create" and "destroy" along >> with the four standard commands "list", "status", "load", and >> "unload" provided by the base geom(8) utility. The base geom(8) >> utility allows each command to use the G_FLAG_VERBOSE flag to = >> specify >> that a command should accept the -v flag and when the -v flag is >> given the utility prints "Done." if the command completes = >> successfully. >> In the above example, both of the commands set the = >> G_FLAG_VERBOSE, >> so have the -v option available. In addition the "destroy" = >> command >> accepts the -f boolean flag to force the destruction. >> >> If the "destroy" command wanted to also print out verbose = >> information, >> it would need to explicitly declare its intent by adding a line: >> >> { 'v', "verbose", NULL, G_TYPE_BOOL }, >> >> Before this change, the geom utility would silently ignore the = >> above >> line in the configuration file, so it was impossible for the = >> utility >> to know that the -v flag had been set on the command. With this >> change a geom command can explicitly specify a -v option with a >> line as given above and handle it as it would any other option. = >> If >> both a -v option and G_FLAG_VERBOSE are specified for a command >> then both types of verbose information will be output when that >> command is run with -v. >> >> MFC after: 1 week >> Sponsored by: Netflix >> --- >> sbin/geom/core/geom.c | 19 ++++++++++++------- >> sbin/geom/core/geom.h | 13 +++++++++++++ >> 2 files changed, 25 insertions(+), 7 deletions(-) >> >> diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c >> index 58b33a067700..2e0d8683df49 100644 >> --- a/sbin/geom/core/geom.c >> +++ b/sbin/geom/core/geom.c > >> @@ -440,7 +445,7 @@ set_flags(struct g_command *cmd) >> { >> unsigned flags =3D 0; >> >> - if ((cmd->gc_flags & G_FLAG_VERBOSE) !=3D 0 && verbose) >> + if ((cmd->gc_flags & G_FLAG_VERBOSE) !=3D 0) >> flags |=3D G_FLAG_VERBOSE; >> >> return (flags); > > Given https://reviews.freebsd.org/D32736 I wonder if the removal of = > the verbose check here was correct. > > If I'm reading this code right we now always set the verbose flag for = > any subcommand that supports it (i.e. has G_FLAG_VERBOSE set). > > That leads to commands such as glabel always acting as if '-v' was = > specified. > > The set_flags() output is only used if g_func is set, which isn't the = > case in any of the examples in the commit message, so I wonder if that = > case was overlooked. > Have you had a chance to look at this? It=E2=80=99s causing multiple fail= ures = in the geom regression tests. Thanks, Kristof From nobody Fri Nov 5 14:09:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5C68E184FD37; Fri, 5 Nov 2021 14:09: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 4Hm2Sk2Bv4z3lt2; Fri, 5 Nov 2021 14:09: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 2095B187F7; Fri, 5 Nov 2021 14:09: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 1A5E9gR0066319; Fri, 5 Nov 2021 14:09:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5E9gv7066318; Fri, 5 Nov 2021 14:09:42 GMT (envelope-from git) Date: Fri, 5 Nov 2021 14:09:42 GMT Message-Id: <202111051409.1A5E9gv7066318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: 84800daacf33 - stable/13 - powerpc64: fix OFWFB with Radix MMU List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 84800daacf331192138b226db7d839a46fb2d642 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=84800daacf331192138b226db7d839a46fb2d642 commit 84800daacf331192138b226db7d839a46fb2d642 Author: Leandro Lupori AuthorDate: 2021-10-14 13:39:52 +0000 Commit: Leandro Lupori CommitDate: 2021-11-05 14:08:27 +0000 powerpc64: fix OFWFB with Radix MMU Current implementation of Radix MMU doesn't support mapping arbitrary virtual addresses, such as the ones generated by "direct mapping" I/O addresses. This caused the system to hang, when early I/O addresses, such as those used by OpenFirmware Frame Buffer, were remapped after the MMU was up. To avoid having to modify mmu_radix_kenter_attr just to support this use case, this change makes early I/O map use virtual addresses from KVA area instead (similar to what mmu_radix_mapdev_attr does), as these can be safely remapped later. Reviewed by: alfredo (earlier version), jhibbits (in irc) Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31232 (cherry picked from commit 76384bd10fdbb97be2803d969905f15a84255d6a) --- sys/powerpc/aim/aim_machdep.c | 42 +++++++++++++++++++++++++++++++++--------- sys/powerpc/aim/mmu_radix.c | 8 +------- sys/powerpc/include/pmap.h | 3 +++ sys/powerpc/powerpc/machdep.c | 9 +++++++++ 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c index 784207e9a70d..bfbea09781a6 100644 --- a/sys/powerpc/aim/aim_machdep.c +++ b/sys/powerpc/aim/aim_machdep.c @@ -477,14 +477,9 @@ aim_cpu_init(vm_offset_t toc) * in case the platform module had a better idea of what we * should do. */ - if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) { - radix_mmu = 0; - TUNABLE_INT_FETCH("radix_mmu", &radix_mmu); - if (radix_mmu) - pmap_mmu_install(MMU_TYPE_RADIX, BUS_PROBE_GENERIC); - else - pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); - } else if (cpu_features & PPC_FEATURE_64) + if (radix_mmu) + pmap_mmu_install(MMU_TYPE_RADIX, BUS_PROBE_GENERIC); + else if (cpu_features & PPC_FEATURE_64) pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); else pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); @@ -587,6 +582,25 @@ va_to_vsid(pmap_t pm, vm_offset_t va) #endif +void +pmap_early_io_map_init(void) +{ + if ((cpu_features2 & PPC_FEATURE2_ARCH_3_00) == 0) + radix_mmu = 0; + else + TUNABLE_INT_FETCH("radix_mmu", &radix_mmu); + + /* + * When using Radix, set the start and end of kva early, to be able to + * use KVAs on pmap_early_io_map and avoid issues when remapping them + * later. + */ + if (radix_mmu) { + virtual_avail = VM_MIN_KERNEL_ADDRESS; + virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; + } +} + /* * These functions need to provide addresses that both (a) work in real mode * (or whatever mode/circumstances the kernel is in in early boot (now)) and @@ -602,10 +616,20 @@ pmap_early_io_map(vm_paddr_t pa, vm_size_t size) * If we have the MMU up in early boot, assume it is 1:1. Otherwise, * try to get the address in a memory region compatible with the * direct map for efficiency later. + * Except for Radix MMU, for which current implementation doesn't + * support mapping arbitrary virtual addresses, such as the ones + * generated by "direct mapping" I/O addresses. In this case, use + * addresses from KVA area. */ if (mfmsr() & PSL_DR) return (pa); - else + else if (radix_mmu) { + vm_offset_t va; + + va = virtual_avail; + virtual_avail += round_page(size + pa - trunc_page(pa)); + return (va); + } else return (DMAP_BASE_ADDRESS + pa); } diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index f1903c69dddb..333fa234fb4b 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -899,7 +899,7 @@ kvtopte(vm_offset_t va) pt_entry_t *l3e; l3e = pmap_pml3e(kernel_pmap, va); - if ((be64toh(*l3e) & RPTE_VALID) == 0) + if (l3e == NULL || (be64toh(*l3e) & RPTE_VALID) == 0) return (NULL); return (pmap_l3e_to_pte(l3e, va)); } @@ -2058,12 +2058,6 @@ mmu_radix_late_bootstrap(vm_offset_t start, vm_offset_t end) for (i = 0; phys_avail[i + 2] != 0; i += 2) Maxmem = MAX(Maxmem, powerpc_btop(phys_avail[i + 1])); - /* - * Set the start and end of kva. - */ - virtual_avail = VM_MIN_KERNEL_ADDRESS; - virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; - /* * Remap any early IO mappings (console framebuffer, etc.) */ diff --git a/sys/powerpc/include/pmap.h b/sys/powerpc/include/pmap.h index 2f1886a27093..d14398750080 100644 --- a/sys/powerpc/include/pmap.h +++ b/sys/powerpc/include/pmap.h @@ -340,6 +340,9 @@ extern int pmap_bootstrapped; extern int radix_mmu; extern int superpages_enabled; +#ifdef AIM +void pmap_early_io_map_init(void); +#endif vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size); void pmap_early_io_unmap(vm_offset_t va, vm_size_t size); void pmap_track_page(pmap_t pmap, vm_offset_t va); diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 716f7e43db48..797f25747479 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -415,6 +415,15 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, if (ofw_bootargs) ofw_parse_bootargs(); +#ifdef AIM + /* + * Early I/O map needs to be initialized before console, in order to + * map frame buffers properly, and after boot args have been parsed, + * to handle tunables properly. + */ + pmap_early_io_map_init(); +#endif + /* * Initialize the console before printing anything. */ From nobody Fri Nov 5 14:31:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 42E3E180417B; Fri, 5 Nov 2021 14:31: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 4Hm2xn10ZCz3spJ; Fri, 5 Nov 2021 14:31: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 029D019363; Fri, 5 Nov 2021 14:31: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 1A5EVOb2002746; Fri, 5 Nov 2021 14:31:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5EVOpD002745; Fri, 5 Nov 2021 14:31:24 GMT (envelope-from git) Date: Fri, 5 Nov 2021 14:31:24 GMT Message-Id: <202111051431.1A5EVOpD002745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: 8a62b07bce7b - stable/13 - powerpc64le: stand fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a62b07bce7ba43caa7a345be30ab3a8afc220b0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=8a62b07bce7ba43caa7a345be30ab3a8afc220b0 commit 8a62b07bce7ba43caa7a345be30ab3a8afc220b0 Author: Leandro Lupori AuthorDate: 2021-10-20 18:48:33 +0000 Commit: Leandro Lupori CommitDate: 2021-11-05 14:29:40 +0000 powerpc64le: stand fixes Fix boot1 and loader on PowerPC64 little-endian (LE). Due to endian issues, boot1 couldn't find the UFS boot partition and loader wasn't able to load the kernel. Most of the issues happened because boot1 and loader were BE binaries trying to access LE UFS partitions and because loader expects the kernel ELF image to use the same endian as itself. To fix these issues, boot1 and loader are now built as LE binaries on PPC64LE. To support this, the functions that call OpenFirmware were enhanced to correctly perform endian conversion on its input and output arguments and to change the CPU into BE mode before making the calls, as OpenFirmware always runs in BE. Besides that, some other small fixes were needed. Submitted by: bdragon (initial version) Reviewed by: alfredo, jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32160 (cherry picked from commit f83288645cd9726c24ca67292fbc3abb4eb65a36) --- stand/common/load_elf.c | 18 -- stand/defs.mk | 8 +- stand/libofw/openfirm.c | 344 +++++++++++++++-------------------- stand/libofw/openfirm.h | 7 +- stand/powerpc/Makefile | 6 +- stand/powerpc/boot1.chrp/boot1.c | 102 ++++++++++- stand/powerpc/ofw/Makefile | 14 +- stand/powerpc/ofw/cas.c | 14 +- stand/powerpc/ofw/ldscript.powerpcle | 142 +++++++++++++++ stand/powerpc/ofw/main.c | 37 +++- stand/powerpc/ofw/ofwfdt.c | 7 +- stand/powerpc/ofw/trampolineLE.S | 71 ++++++++ 12 files changed, 525 insertions(+), 245 deletions(-) diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index c163b50c9737..a213b34970f0 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -750,13 +750,6 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) } #endif size = shdr[i].sh_size; -#if defined(__powerpc__) - #if __ELF_WORD_SIZE == 64 - size = htobe64(size); - #else - size = htobe32(size); - #endif -#endif archsw.arch_copyin(&size, lastaddr, sizeof(size)); lastaddr += sizeof(size); @@ -802,17 +795,6 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) printf("]"); #endif -#if defined(__powerpc__) - /* On PowerPC we always need to provide BE data to the kernel */ - #if __ELF_WORD_SIZE == 64 - ssym = htobe64((uint64_t)ssym); - esym = htobe64((uint64_t)esym); - #else - ssym = htobe32((uint32_t)ssym); - esym = htobe32((uint32_t)esym); - #endif -#endif - file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); diff --git a/stand/defs.mk b/stand/defs.mk index 2b0201b940b5..bbebf270c7ef 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -114,10 +114,12 @@ CFLAGS+= -DLOADER_DISK_SUPPORT # Machine specific flags for all builds here -# Ensure PowerPC64 and PowerPC64LE boot loaders are compiled as 32 bit -# and in big endian. -.if ${MACHINE_ARCH:Mpowerpc64*} != "" +# Ensure PowerPC64 and PowerPC64LE boot loaders are compiled as 32 bit. +# PowerPC64LE boot loaders are 32-bit little-endian. +.if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -mcpu=powerpc -mbig-endian +.elif ${MACHINE_ARCH} == "powerpc64le" +CFLAGS+= -m32 -mcpu=powerpc -mlittle-endian .endif # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is diff --git a/stand/libofw/openfirm.c b/stand/libofw/openfirm.c index 0b4198d281fd..b2b89581ae70 100644 --- a/stand/libofw/openfirm.c +++ b/stand/libofw/openfirm.c @@ -58,6 +58,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include @@ -71,6 +73,13 @@ ihandle_t mmu; ihandle_t memory; int real_mode = 0; +#define IN(x) htobe32((cell_t)x) +#define OUT(x) be32toh(x) +#define SETUP(a, b, c, d) \ + a.name = IN( (b) ); \ + a.nargs = IN( (c) ); \ + a.nreturns = IN( (d) ); + /* Initialiser */ void @@ -117,16 +126,13 @@ OF_test(char *name) cell_t nreturns; cell_t service; cell_t missing; - } args = { - (cell_t)"test", - 1, - 1, - }; + } args = {}; + SETUP(args, "test", 1, 1); - args.service = (cell_t)name; + args.service = IN(name); if (openfirmware(&args) == -1) return (-1); - return (args.missing); + return (OUT(args.missing)); } /* Return firmware millisecond count. */ @@ -138,14 +144,11 @@ OF_milliseconds() cell_t nargs; cell_t nreturns; cell_t ms; - } args = { - (cell_t)"milliseconds", - 0, - 1, - }; + } args = {}; + SETUP(args, "milliseconds", 0, 1); openfirmware(&args); - return (args.ms); + return (OUT(args.ms)); } /* @@ -162,11 +165,8 @@ OF_peer(phandle_t node) cell_t nreturns; cell_t node; cell_t next; - } args = { - (cell_t)"peer", - 1, - 1, - }; + } args = {}; + SETUP(args, "peer", 1, 1); args.node = node; if (openfirmware(&args) == -1) @@ -184,11 +184,8 @@ OF_child(phandle_t node) cell_t nreturns; cell_t node; cell_t child; - } args = { - (cell_t)"child", - 1, - 1, - }; + } args = {}; + SETUP(args, "child", 1, 1); args.node = node; if (openfirmware(&args) == -1) @@ -206,11 +203,8 @@ OF_parent(phandle_t node) cell_t nreturns; cell_t node; cell_t parent; - } args = { - (cell_t)"parent", - 1, - 1, - }; + } args = {}; + SETUP(args, "parent", 1, 1); args.node = node; if (openfirmware(&args) == -1) @@ -228,11 +222,8 @@ OF_instance_to_package(ihandle_t instance) cell_t nreturns; cell_t instance; cell_t package; - } args = { - (cell_t)"instance-to-package", - 1, - 1, - }; + } args = {}; + SETUP(args, "instance-to-package", 1, 1); args.instance = instance; if (openfirmware(&args) == -1) @@ -251,17 +242,14 @@ OF_getproplen(phandle_t package, const char *propname) cell_t package; cell_t propname; cell_t proplen; - } args = { - (cell_t)"getproplen", - 2, - 1, - }; + } args = {}; + SETUP(args, "getproplen", 2, 1); args.package = package; - args.propname = (cell_t)propname; + args.propname = IN(propname); if (openfirmware(&args) == -1) return (-1); - return (args.proplen); + return (OUT(args.proplen)); } /* Get the value of a property of a package. */ @@ -277,19 +265,31 @@ OF_getprop(phandle_t package, const char *propname, void *buf, int buflen) cell_t buf; cell_t buflen; cell_t size; - } args = { - (cell_t)"getprop", - 4, - 1, - }; + } args = {}; + SETUP(args, "getprop", 4, 1); args.package = package; - args.propname = (cell_t)propname; - args.buf = (cell_t)buf; - args.buflen = buflen; + args.propname = IN(propname); + args.buf = IN(buf); + args.buflen = IN(buflen); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); +} + +/* Decode a binary property from a package. */ +int +OF_getencprop(phandle_t package, const char *propname, cell_t *buf, int buflen) +{ + int retval, i; + retval = OF_getprop(package, propname, buf, buflen); + if (retval == -1) + return (retval); + + for (i = 0; i < buflen/4; i++) + buf[i] = be32toh((uint32_t)buf[i]); + + return (retval); } /* Get the next property of a package. */ @@ -304,18 +304,15 @@ OF_nextprop(phandle_t package, const char *previous, char *buf) cell_t previous; cell_t buf; cell_t flag; - } args = { - (cell_t)"nextprop", - 3, - 1, - }; + } args = {}; + SETUP(args, "nextprop", 3, 1); args.package = package; - args.previous = (cell_t)previous; - args.buf = (cell_t)buf; + args.previous = IN(previous); + args.buf = IN(buf); if (openfirmware(&args) == -1) return (-1); - return (args.flag); + return (OUT(args.flag)); } /* Set the value of a property of a package. */ @@ -332,19 +329,16 @@ OF_setprop(phandle_t package, const char *propname, void *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"setprop", - 4, - 1, - }; + } args = {}; + SETUP(args, "setprop", 4, 1); args.package = package; - args.propname = (cell_t)propname; - args.buf = (cell_t)buf; - args.len = len; + args.propname = IN(propname); + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Convert a device specifier to a fully qualified pathname. */ @@ -359,18 +353,15 @@ OF_canon(const char *device, char *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"canon", - 3, - 1, - }; - - args.device = (cell_t)device; - args.buf = (cell_t)buf; - args.len = len; + } args = {}; + SETUP(args, "canon", 3, 1); + + args.device = IN(device); + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Return a package handle for the specified device. */ @@ -383,13 +374,10 @@ OF_finddevice(const char *device) cell_t nreturns; cell_t device; cell_t package; - } args = { - (cell_t)"finddevice", - 1, - 1, - }; + } args = {}; + SETUP(args, "finddevice", 1, 1); - args.device = (cell_t)device; + args.device = IN(device); if (openfirmware(&args) == -1) return (-1); return (args.package); @@ -407,18 +395,15 @@ OF_instance_to_path(ihandle_t instance, char *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"instance-to-path", - 3, - 1, - }; + } args = {}; + SETUP(args, "instance-to-path", 3, 1); args.instance = instance; - args.buf = (cell_t)buf; - args.len = len; + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Return the fully qualified pathname corresponding to a package. */ @@ -433,18 +418,15 @@ OF_package_to_path(phandle_t package, char *buf, int len) cell_t buf; cell_t len; cell_t size; - } args = { - (cell_t)"package-to-path", - 3, - 1, - }; + } args = {}; + SETUP(args, "package-to-path", 3, 1); args.package = package; - args.buf = (cell_t)buf; - args.len = len; + args.buf = IN(buf); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.size); + return (OUT(args.size)); } /* Call the method in the scope of a given instance. */ @@ -459,30 +441,26 @@ OF_call_method(char *method, ihandle_t instance, int nargs, int nreturns, ...) cell_t method; cell_t instance; cell_t args_n_results[12]; - } args = { - (cell_t)"call-method", - 2, - 1, - }; + } args = {}; + SETUP(args, "call-method", nargs + 2, nreturns + 1); cell_t *cp; int n; if (nargs > 6) return (-1); - args.nargs = nargs + 2; - args.nreturns = nreturns + 1; - args.method = (cell_t)method; + args.method = IN(method); args.instance = instance; va_start(ap, nreturns); for (cp = (cell_t *)(args.args_n_results + (n = nargs)); --n >= 0;) - *--cp = va_arg(ap, cell_t); + *--cp = IN(va_arg(ap, cell_t)); if (openfirmware(&args) == -1) return (-1); if (args.args_n_results[nargs]) - return (args.args_n_results[nargs]); - for (cp = (cell_t *)(args.args_n_results + nargs + (n = args.nreturns)); - --n > 0;) - *va_arg(ap, cell_t *) = *--cp; + return (OUT(args.args_n_results[nargs])); + /* XXX what if ihandles or phandles are returned */ + for (cp = (cell_t *)(args.args_n_results + nargs + + (n = be32toh(args.nreturns))); --n > 0;) + *va_arg(ap, cell_t *) = OUT(*--cp); va_end(ap); return (0); } @@ -501,13 +479,10 @@ OF_open(char *device) cell_t nreturns; cell_t device; cell_t instance; - } args = { - (cell_t)"open", - 1, - 1, - }; + } args = {}; + SETUP(args, "open", 1, 1); - args.device = (cell_t)device; + args.device = IN(device); if (openfirmware(&args) == -1 || args.instance == 0) { return (-1); } @@ -523,10 +498,8 @@ OF_close(ihandle_t instance) cell_t nargs; cell_t nreturns; cell_t instance; - } args = { - (cell_t)"close", - 1, - }; + } args = {}; + SETUP(args, "close", 1, 0); args.instance = instance; openfirmware(&args); @@ -544,19 +517,16 @@ OF_read(ihandle_t instance, void *addr, int len) cell_t addr; cell_t len; cell_t actual; - } args = { - (cell_t)"read", - 3, - 1, - }; + } args = {}; + SETUP(args, "read", 3, 1); args.instance = instance; - args.addr = (cell_t)addr; - args.len = len; + args.addr = IN(addr); + args.len = IN(len); #if defined(OPENFIRM_DEBUG) printf("OF_read: called with instance=%08x, addr=%p, len=%d\n", - args.instance, args.addr, args.len); + instance, addr, len); #endif if (openfirmware(&args) == -1) @@ -564,10 +534,10 @@ OF_read(ihandle_t instance, void *addr, int len) #if defined(OPENFIRM_DEBUG) printf("OF_read: returning instance=%d, addr=%p, len=%d, actual=%d\n", - args.instance, args.addr, args.len, args.actual); + args.instance, OUT(args.addr), OUT(args.len), OUT(args.actual)); #endif - return (args.actual); + return (OUT(args.actual)); } /* Write to an instance. */ @@ -582,18 +552,15 @@ OF_write(ihandle_t instance, void *addr, int len) cell_t addr; cell_t len; cell_t actual; - } args = { - (cell_t)"write", - 3, - 1, - }; + } args = {}; + SETUP(args, "write", 3, 1); args.instance = instance; - args.addr = (cell_t)addr; - args.len = len; + args.addr = IN(addr); + args.len = IN(len); if (openfirmware(&args) == -1) return (-1); - return (args.actual); + return (OUT(args.actual)); } /* Seek to a position. */ @@ -608,18 +575,15 @@ OF_seek(ihandle_t instance, uint64_t pos) cell_t poshi; cell_t poslo; cell_t status; - } args = { - (cell_t)"seek", - 3, - 1, - }; + } args = {}; + SETUP(args, "seek", 3, 1); args.instance = instance; - args.poshi = pos >> 32; - args.poslo = pos; + args.poshi = IN(((uint64_t)pos >> 32)); + args.poslo = IN(pos); if (openfirmware(&args) == -1) return (-1); - return (args.status); + return (OUT(args.status)); } /* Blocks. */ @@ -633,16 +597,13 @@ OF_blocks(ihandle_t instance) cell_t instance; cell_t result; cell_t blocks; - } args = { - (cell_t)"#blocks", - 2, - 1, - }; + } args = {}; + SETUP(args, "#blocks", 2, 1); args.instance = instance; if (openfirmware(&args) == -1) return ((unsigned int)-1); - return (args.blocks); + return (OUT(args.blocks)); } /* Block size. */ @@ -656,16 +617,13 @@ OF_block_size(ihandle_t instance) cell_t instance; cell_t result; cell_t size; - } args = { - (cell_t)"block-size", - 2, - 1, - }; + } args = {}; + SETUP(args, "block-size", 2, 1); args.instance = instance; if (openfirmware(&args) == -1) return (512); - return (args.size); + return (OUT(args.size)); } /* @@ -684,18 +642,15 @@ OF_claim(void *virt, u_int size, u_int align) cell_t size; cell_t align; cell_t baseaddr; - } args = { - (cell_t)"claim", - 3, - 1, - }; - - args.virt = (cell_t)virt; - args.size = size; - args.align = align; + } args = {}; + SETUP(args, "claim", 3, 1); + + args.virt = IN(virt); + args.size = IN(size); + args.align = IN(align); if (openfirmware(&args) == -1) return ((void *)-1); - return ((void *)args.baseaddr); + return ((void *)OUT(args.baseaddr)); } /* Release an area of memory. */ @@ -708,13 +663,11 @@ OF_release(void *virt, u_int size) cell_t nreturns; cell_t virt; cell_t size; - } args = { - (cell_t)"release", - 2, - }; + } args = {}; + SETUP(args, "release", 2, 0); - args.virt = (cell_t)virt; - args.size = size; + args.virt = IN(virt); + args.size = IN(size); openfirmware(&args); } @@ -731,12 +684,10 @@ OF_boot(char *bootspec) cell_t nargs; cell_t nreturns; cell_t bootspec; - } args = { - (cell_t)"boot", - 1, - }; + } args = {}; + SETUP(args, "boot", 1, 0); - args.bootspec = (cell_t)bootspec; + args.bootspec = IN(bootspec); openfirmware(&args); for (;;) /* just in case */ ; @@ -750,9 +701,8 @@ OF_enter() cell_t name; cell_t nargs; cell_t nreturns; - } args = { - (cell_t)"enter", - }; + } args = {}; + SETUP(args, "enter", 0, 0); openfirmware(&args); /* We may come back. */ @@ -766,9 +716,8 @@ OF_exit() cell_t name; cell_t nargs; cell_t nreturns; - } args = { - (cell_t)"exit", - }; + } args = {}; + SETUP(args, "exit", 0, 0); openfirmware(&args); for (;;) /* just in case */ @@ -782,9 +731,8 @@ OF_quiesce() cell_t name; cell_t nargs; cell_t nreturns; - } args = { - (cell_t)"quiesce", - }; + } args = {}; + SETUP(args, "quiesce", 0, 0); openfirmware(&args); } @@ -803,16 +751,14 @@ OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len) cell_t entry; cell_t arg; cell_t len; - } args = { - (cell_t)"chain", - 5, - }; - - args.virt = (cell_t)virt; - args.size = size; - args.entry = (cell_t)entry; - args.arg = (cell_t)arg; - args.len = len; + } args = {}; + SETUP(args, "chain", 5, 0); + + args.virt = IN(virt); + args.size = IN(size); + args.entry = IN(entry); + args.arg = IN(arg); + args.len = IN(len); openfirmware(&args); } #else diff --git a/stand/libofw/openfirm.h b/stand/libofw/openfirm.h index b83cf4b0b27f..0981dbf093eb 100644 --- a/stand/libofw/openfirm.h +++ b/stand/libofw/openfirm.h @@ -65,9 +65,9 @@ #include #include -typedef unsigned int ihandle_t; -typedef unsigned int phandle_t; -typedef unsigned long int cell_t; +typedef uint32_t ihandle_t; +typedef uint32_t phandle_t; +typedef uint32_t cell_t; extern int (*openfirmware)(void *); extern phandle_t chosen; @@ -91,6 +91,7 @@ phandle_t OF_parent(phandle_t); phandle_t OF_instance_to_package(ihandle_t); int OF_getproplen(phandle_t, const char *); int OF_getprop(phandle_t, const char *, void *, int); +int OF_getencprop(phandle_t, const char *, cell_t *, int); int OF_nextprop(phandle_t, const char *, char *); int OF_setprop(phandle_t, const char *, void *, int); int OF_canon(const char *, char *, int); diff --git a/stand/powerpc/Makefile b/stand/powerpc/Makefile index 888fe0e97028..a16d3933ff7e 100644 --- a/stand/powerpc/Makefile +++ b/stand/powerpc/Makefile @@ -4,7 +4,11 @@ NO_OBJ=t .include -SUBDIR.yes= boot1.chrp ofw uboot +SUBDIR.yes= boot1.chrp ofw + +.if "${MACHINE_ARCH}" != "powerpc64le" +SUBDIR.${MK_FDT}+= uboot +.endif .if "${MACHINE_ARCH}" == "powerpc64" SUBDIR.${MK_FDT}+= kboot diff --git a/stand/powerpc/boot1.chrp/boot1.c b/stand/powerpc/boot1.chrp/boot1.c index 4d152efe1a70..ed7c55d11d6f 100644 --- a/stand/powerpc/boot1.chrp/boot1.c +++ b/stand/powerpc/boot1.chrp/boot1.c @@ -20,6 +20,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -82,11 +83,11 @@ static char *__ultoa(char *buf, u_long val, int base); */ typedef uint32_t ofwcell_t; typedef uint32_t u_ofwh_t; -typedef int (*ofwfp_t)(void *); +typedef int (*ofwfp_t)(ofwcell_t *); ofwfp_t ofw; /* the prom Open Firmware entry */ ofwh_t chosenh; -void ofw_init(void *, int, int (*)(void *), char *, int); +void ofw_init(void *, int, ofwfp_t, char *, int); static ofwh_t ofw_finddevice(const char *); static ofwh_t ofw_open(const char *); static int ofw_close(ofwh_t); @@ -101,6 +102,16 @@ static void ofw_exit(void) __dead2; ofwh_t bootdevh; ofwh_t stdinh, stdouth; +/* + * Note about the entry point: + * + * For some odd reason, the first page of the load appears to have trouble + * when entering in LE. The first five instructions decode weirdly. + * I suspect it is some cache weirdness between the ELF headers and .text. + * + * Ensure we have a gap between the start of .text and the entry as a + * workaround. + */ __asm(" \n\ .data \n\ .align 4 \n\ @@ -108,6 +119,8 @@ stack: \n\ .space 16384 \n\ \n\ .text \n\ + /* SLOF cache hack */ \n\ + .space 4096 \n\ .globl _start \n\ _start: \n\ lis %r1,stack@ha \n\ @@ -117,18 +130,95 @@ _start: \n\ b ofw_init \n\ "); +ofwfp_t realofw; + +#if BYTE_ORDER == LITTLE_ENDIAN +/* + * Minimal endianness-swap trampoline for LE. + */ +__attribute__((naked)) int +ofwtramp(void *buf, ofwfp_t cb) +{ +__asm(" \n\ + mflr %r0 \n\ + stw %r0, 4(%r1) \n\ + stwu %r1, -16(%r1) \n\ + stw %r30, 8(%r1) \n\ + /* Save current MSR for restoration post-call. */ \n\ + mfmsr %r30 \n\ + mr %r5, %r30 \n\ + /* Remove LE bit from MSR. */ \n\ + clrrwi %r5, %r5, 1 \n\ + mtsrr0 %r4 \n\ + mtsrr1 %r5 \n\ + bcl 20, 31, .+4 /* LOAD_LR_NIA */ \n\ +1: \n\ + mflr %r4 \n\ + addi %r4, %r4, (2f - 1b) \n\ + mtlr %r4 \n\ + /* Switch to BE and transfer control to OF entry */ \n\ + rfid \n\ +2: \n\ + /* Control is returned here, but in BE. */ \n\ + .long 0x05009f42 /* LOAD_LR_NIA */\n\ + /* 0: */\n\ + .long 0xa603db7f /* mtsrr1 %r30 */\n\ + .long 0xa602c87f /* mflr %r30 */\n\ + .long 0x1400de3b /* addi %r30, %r30, (1f - 0b) */\n\ + .long 0xa603da7f /* mtsrr0 %r30 */\n\ + .long 0x2400004c /* rfid */\n\ + /* 1: */\n\ +1: \n\ + /* Back to normal. Tidy up for return. */ \n\ + lwz %r30, 8(%r1) \n\ + lwz %r0, 20(%r1) \n\ + addi %r1, %r1, 16 \n\ + mtlr %r0 \n\ + blr \n\ +"); +} + +/* + * Little-endian OFW entrypoint replacement. + * + * We are doing all the byteswapping in one place here to save space. + * This means instance handles will be byteswapped as well. + */ +int +call_ofw(ofwcell_t* buf) +{ + int ret, i, ncells; + + ncells = 3 + buf[1] + buf[2]; + for (i = 0; i < ncells; i++) + buf[i] = htobe32(buf[i]); + + ret = (ofwtramp(buf, realofw)); + for (i = 0; i < ncells; i++) + buf[i] = be32toh(buf[i]); + return (ret); +} +#endif + void -ofw_init(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) +ofw_init(void *vpd, int res, ofwfp_t openfirm, char *arg, int argl) { char *av[16]; char *p; int ac; - ofw = openfirm; +#if BYTE_ORDER == LITTLE_ENDIAN + realofw = openfirm; + ofw = call_ofw; +#else + realofw = ofw = openfirm; +#endif chosenh = ofw_finddevice("/chosen"); ofw_getprop(chosenh, "stdin", &stdinh, sizeof(stdinh)); + stdinh = be32toh(stdinh); ofw_getprop(chosenh, "stdout", &stdouth, sizeof(stdouth)); + stdouth = be32toh(stdouth); ofw_getprop(chosenh, "bootargs", bootargs, sizeof(bootargs)); ofw_getprop(chosenh, "bootpath", bootpath, sizeof(bootpath)); @@ -537,8 +627,8 @@ load(const char *fname) __syncicache(p, ph.p_memsz); } ofw_close(bootdev); - (*(void (*)(void *, int, ofwfp_t, char *, int))eh.e_entry)(NULL, 0, - ofw,NULL,0); + (*(void (*)(void *, int, ofwfp_t, char *, int))eh.e_entry)(NULL, 0, + realofw, NULL, 0); } static int diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index a35a7c7c56bf..6d75bb882d2b 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -28,11 +28,15 @@ CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/teken SRCS+= ofwfdt.c .endif -.if ${MACHINE_ARCH} == "powerpc64" +.if ${MACHINE_ARCH:Mpowerpc64*} != "" SRCS+= cas.c CFLAGS+= -DCAS .endif +.if ${MACHINE_ARCH} == "powerpc64le" +SRCS+= trampolineLE.S +.endif + HELP_FILES= ${FDTSRC}/help.fdt # Always add MI sources @@ -44,7 +48,13 @@ HELP_FILES= ${FDTSRC}/help.fdt RELOC?= 0x1C00000 CFLAGS+= -DRELOC=${RELOC} -g -LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc +LDFLAGS= -nostdlib -static + +.if ${MACHINE_ARCH} == "powerpc64le" +LDFLAGS+= -T ${.CURDIR}/ldscript.powerpcle +.else +LDFLAGS+= -T ${.CURDIR}/ldscript.powerpc +.endif # Open Firmware standalone support library LIBOFW= ${BOOTOBJ}/libofw/libofw.a diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c *** 374 LINES SKIPPED *** From nobody Fri Nov 5 14:54:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E7518183462D; Fri, 5 Nov 2021 14:54: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 4Hm3SQ5C22z4YSc; Fri, 5 Nov 2021 14:54: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 8598219C13; Fri, 5 Nov 2021 14:54: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 1A5EsUZi032188; Fri, 5 Nov 2021 14:54:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5EsUpV032187; Fri, 5 Nov 2021 14:54:30 GMT (envelope-from git) Date: Fri, 5 Nov 2021 14:54:30 GMT Message-Id: <202111051454.1A5EsUpV032187@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: 517e52b6c21c - main - awk: Move to using two sets of tests List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 517e52b6c21ccff22c46df0dcd15c19baee3d86c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=517e52b6c21ccff22c46df0dcd15c19baee3d86c commit 517e52b6c21ccff22c46df0dcd15c19baee3d86c Author: Warner Losh AuthorDate: 2021-11-04 16:09:16 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:53:36 +0000 awk: Move to using two sets of tests Upstream one-true-awk has two sets of tests. These are in addition to NetBSD's tests we're using. The 'bugs-fixed' tests from upstream are ready to use as-is (more or less). However, the 'tests' from upstream are not, so for now we'll just use the netbsd and bugs-fixed tests. They provide an OK workout and are better than nothing, though the tests themselves are for specific esoteric things. The upstream bugs-fixed tests are *ALMOST* a drop in. However, 3 test for errors and the upstream test jig mashes stdout and stderr together, which atf doesn't do, so make a tiny tweak to the upstream tests that I hope to upstream. Plus upstream has ../a.out: instead of awk: in the output. Not sure how to deal with this yet, so I've not proposed anything upstream and have changed the test locally. In addition, the system-status.awk test is not suitable to run in ATF. It wants to force sh to dump core, but kyua doesn't seem to allow that sometimes so the test will fail or pass based on whether or not a core dump can be created. Since it's unstable, remove it. This required moving the netbsd tests to a new direcotry, so update mtree files as well. The change is useless for 'make check' without it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31376 --- .../one-true-awk/bugs-fixed/missing-precision.err | 2 + .../one-true-awk/bugs-fixed/missing-precision.ok | 2 - contrib/one-true-awk/bugs-fixed/negative-nf.err | 2 + contrib/one-true-awk/bugs-fixed/negative-nf.ok | 2 - contrib/one-true-awk/bugs-fixed/pfile-overflow.ok | 4 -- 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 - etc/mtree/BSD.tests.dist | 4 ++ usr.bin/awk/tests/Makefile | 31 +-------- usr.bin/awk/tests/bugs-fixed/Makefile | 14 ++++ usr.bin/awk/tests/bugs-fixed/bug_fix_test.sh | 75 ++++++++++++++++++++++ usr.bin/awk/tests/netbsd/Makefile | 36 +++++++++++ 13 files changed, 136 insertions(+), 61 deletions(-) diff --git a/contrib/one-true-awk/bugs-fixed/missing-precision.err b/contrib/one-true-awk/bugs-fixed/missing-precision.err new file mode 100644 index 000000000000..c08632787d9a --- /dev/null +++ b/contrib/one-true-awk/bugs-fixed/missing-precision.err @@ -0,0 +1,2 @@ +awk: not enough args in printf(%*s) + source line number 1 diff --git a/contrib/one-true-awk/bugs-fixed/missing-precision.ok b/contrib/one-true-awk/bugs-fixed/missing-precision.ok deleted file mode 100644 index 75e1e3d00446..000000000000 --- a/contrib/one-true-awk/bugs-fixed/missing-precision.ok +++ /dev/null @@ -1,2 +0,0 @@ -../a.out: not enough args in printf(%*s) - source line number 1 diff --git a/contrib/one-true-awk/bugs-fixed/negative-nf.err b/contrib/one-true-awk/bugs-fixed/negative-nf.err new file mode 100644 index 000000000000..5b941f526dd8 --- /dev/null +++ b/contrib/one-true-awk/bugs-fixed/negative-nf.err @@ -0,0 +1,2 @@ +awk: cannot set NF to a negative value + source line number 1 diff --git a/contrib/one-true-awk/bugs-fixed/negative-nf.ok b/contrib/one-true-awk/bugs-fixed/negative-nf.ok deleted file mode 100644 index de97f8b27def..000000000000 --- a/contrib/one-true-awk/bugs-fixed/negative-nf.ok +++ /dev/null @@ -1,2 +0,0 @@ -../a.out: cannot set NF to a negative value - source line number 1 diff --git a/contrib/one-true-awk/bugs-fixed/pfile-overflow.ok b/contrib/one-true-awk/bugs-fixed/pfile-overflow.ok deleted file mode 100644 index a0de50f9007f..000000000000 --- a/contrib/one-true-awk/bugs-fixed/pfile-overflow.ok +++ /dev/null @@ -1,4 +0,0 @@ -../a.out: syntax error at source line 1 source file pfile-overflow.awk - context is - >>> <<< -../a.out: bailing out at source line 1 source file pfile-overflow.awk diff --git a/contrib/one-true-awk/bugs-fixed/system-status.awk b/contrib/one-true-awk/bugs-fixed/system-status.awk deleted file mode 100644 index 8daf563e6f4f..000000000000 --- a/contrib/one-true-awk/bugs-fixed/system-status.awk +++ /dev/null @@ -1,19 +0,0 @@ -# Unmodified nawk prints the 16 bit exit status divided by 256, but -# does so using floating point arithmetic, yielding strange results. -# -# The fix is to use the various macros defined for wait(2) and to -# use the signal number + 256 for death by signal, or signal number + 512 -# for death by signal with core dump. - -BEGIN { - status = system("exit 42") - print "normal status", status - - status = system("kill -HUP $$") - print "death by signal status", status - - status = system("kill -ABRT $$") - print "death by signal with core dump status", status - - system("rm -f core*") -} diff --git a/contrib/one-true-awk/bugs-fixed/system-status.bad b/contrib/one-true-awk/bugs-fixed/system-status.bad deleted file mode 100644 index a1317dba54a8..000000000000 --- a/contrib/one-true-awk/bugs-fixed/system-status.bad +++ /dev/null @@ -1,3 +0,0 @@ -normal status 42 -death by signal status 0.00390625 -death by signal with core dump status 0.523438 diff --git a/contrib/one-true-awk/bugs-fixed/system-status.ok b/contrib/one-true-awk/bugs-fixed/system-status.ok deleted file mode 100644 index 737828f5ed7a..000000000000 --- a/contrib/one-true-awk/bugs-fixed/system-status.ok +++ /dev/null @@ -1,3 +0,0 @@ -normal status 42 -death by signal status 257 -death by signal with core dump status 518 diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index b21256c8563c..08ad8e41a527 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -873,6 +873,10 @@ apply .. awk + bugs-fixed + .. + netbsd + .. .. basename .. diff --git a/usr.bin/awk/tests/Makefile b/usr.bin/awk/tests/Makefile index 79a0bc14de80..d9bef1bf2365 100644 --- a/usr.bin/awk/tests/Makefile +++ b/usr.bin/awk/tests/Makefile @@ -1,33 +1,8 @@ # $FreeBSD$ -PACKAGE= tests +.include -NETBSD_ATF_TESTS_SH= awk_test - -${PACKAGE}FILES+= d_assign_NF.awk -${PACKAGE}FILES+= d_assign_NF.in -${PACKAGE}FILES+= d_assign_NF.out -${PACKAGE}FILES+= d_big_regexp.awk -${PACKAGE}FILES+= d_big_regexp.in -${PACKAGE}FILES+= d_big_regexp.out -${PACKAGE}FILES+= d_end1.awk -${PACKAGE}FILES+= d_end1.in -${PACKAGE}FILES+= d_end1.out -${PACKAGE}FILES+= d_end2.awk -${PACKAGE}FILES+= d_end2.in -${PACKAGE}FILES+= d_end2.out -${PACKAGE}FILES+= d_period.awk -${PACKAGE}FILES+= d_period.in -${PACKAGE}FILES+= d_period.out -${PACKAGE}FILES+= d_string1.awk -${PACKAGE}FILES+= d_string1.out -${PACKAGE}FILES+= d_tolower.awk -${PACKAGE}FILES+= d_tolower.in -${PACKAGE}FILES+= d_tolower.out -${PACKAGE}FILES+= d_toupper.awk -${PACKAGE}FILES+= d_toupper.in -${PACKAGE}FILES+= d_toupper.out - -.include +TESTS_SUBDIRS+= bugs-fixed +TESTS_SUBDIRS+= netbsd .include diff --git a/usr.bin/awk/tests/bugs-fixed/Makefile b/usr.bin/awk/tests/bugs-fixed/Makefile new file mode 100644 index 000000000000..b53195baa55c --- /dev/null +++ b/usr.bin/awk/tests/bugs-fixed/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/usr.bin/awk/${.CURDIR:T} +TESTSRC= ${SRCTOP}/contrib/one-true-awk/bugs-fixed + +ATF_TESTS_SH= bug_fix_test + +.PATH: ${TESTSRC} +# Upstream controls the list of tests, so generate it dynamically +${PACKAGE}FILES!=(cd ${TESTSRC} ; ls *.awk *.ok *.in *.err) + +.include diff --git a/usr.bin/awk/tests/bugs-fixed/bug_fix_test.sh b/usr.bin/awk/tests/bugs-fixed/bug_fix_test.sh new file mode 100644 index 000000000000..a22f112ce4b1 --- /dev/null +++ b/usr.bin/awk/tests/bugs-fixed/bug_fix_test.sh @@ -0,0 +1,75 @@ +# +# Copyright 2014 EMC Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +SRCDIR=$(atf_get_srcdir) + +check() +{ + local tc=${1%.awk}; shift + local in_flag out_flag err_flag + + awk=awk + + local out_file="${SRCDIR}/${tc}.ok" + [ -f "${out_file}" ] && out_flag="-o file:${out_file}" + local err_file="${SRCDIR}/${tc}.err" + [ -f "${err_file}" ] && err_flag="-e file:${err_file} -s exit:2" + local in_file="${SRCDIR}/${tc}.in" + [ -f "${in_file}" ] && in_flag="${in_file}" + + (cd ${SRCDIR} ; atf_check ${out_flag} ${err_flag} ${awk} -f "${tc}.awk" ${in_flag}) +} + +add_testcase() +{ + local tc=${1%.awk} + local tc_escaped word + + case "${tc%.*}" in + *-*) + local IFS="-" + for word in ${tc}; do + tc_escaped="${tc_escaped:+${tc_escaped}_}${word}" + done + ;; + *) + tc_escaped=${tc} + ;; + esac + + atf_test_case ${tc_escaped} + eval "${tc_escaped}_body() { check ${tc}; }" + atf_add_test_case ${tc_escaped} +} + +atf_init_test_cases() +{ + for path in $(find -s "${SRCDIR}" -name '*.awk'); do + add_testcase ${path##*/} + done +} diff --git a/usr.bin/awk/tests/netbsd/Makefile b/usr.bin/awk/tests/netbsd/Makefile new file mode 100644 index 000000000000..5fecc4e947a1 --- /dev/null +++ b/usr.bin/awk/tests/netbsd/Makefile @@ -0,0 +1,36 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/usr.bin/awk/${.CURDIR:T} +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/usr.bin/awk + +NETBSD_ATF_TESTS_SH= awk_test + +${PACKAGE}FILES+= d_assign_NF.awk +${PACKAGE}FILES+= d_assign_NF.in +${PACKAGE}FILES+= d_assign_NF.out +${PACKAGE}FILES+= d_big_regexp.awk +${PACKAGE}FILES+= d_big_regexp.in +${PACKAGE}FILES+= d_big_regexp.out +${PACKAGE}FILES+= d_end1.awk +${PACKAGE}FILES+= d_end1.in +${PACKAGE}FILES+= d_end1.out +${PACKAGE}FILES+= d_end2.awk +${PACKAGE}FILES+= d_end2.in +${PACKAGE}FILES+= d_end2.out +${PACKAGE}FILES+= d_period.awk +${PACKAGE}FILES+= d_period.in +${PACKAGE}FILES+= d_period.out +${PACKAGE}FILES+= d_string1.awk +${PACKAGE}FILES+= d_string1.out +${PACKAGE}FILES+= d_tolower.awk +${PACKAGE}FILES+= d_tolower.in +${PACKAGE}FILES+= d_tolower.out +${PACKAGE}FILES+= d_toupper.awk +${PACKAGE}FILES+= d_toupper.in +${PACKAGE}FILES+= d_toupper.out + +.include + +.include From nobody Fri Nov 5 15:25:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0DFB91836605; Fri, 5 Nov 2021 15:25: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 4Hm48J6yNLz4kgr; Fri, 5 Nov 2021 15:25: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 CA1131A19E; Fri, 5 Nov 2021 15:25: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 1A5FPaXN073195; Fri, 5 Nov 2021 15:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPaUn073194; Fri, 5 Nov 2021 15:25:36 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:36 GMT Message-Id: <202111051525.1A5FPaUn073194@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: 00f79c97a4f2 - main - cam_periph: Remove vestigial "scbus" comparison List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 00f79c97a4f265f8d653a11fdb764cd999b7d0a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=00f79c97a4f265f8d653a11fdb764cd999b7d0a9 commit 00f79c97a4f265f8d653a11fdb764cd999b7d0a9 Author: Warner Losh AuthorDate: 2021-11-05 14:56:13 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:13 +0000 cam_periph: Remove vestigial "scbus" comparison The code in camperiphunit rejects "scbus" as an 'at' location that would allow any other wiring to use that unit number. Yet in camperiphunitnext, if we have a no target and the 'at' location of 'scbus' it would be excluded on the basis that it's a wiring cadidate. This is improper and appears to be a hold-over of the pre-hints / pre-newbus config system, so remove it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32680 --- sys/cam/cam_periph.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index d8fd41d77be7..990854f992c3 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -568,9 +568,10 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, break; /* - * Don't match entries like "da 4" as a wired down - * device, but do match entries like "da 4 target 5" - * or even "da 4 scbus 1". + * Don't allow the mere presence of any attributes of a device + * means that it is for a wired down entry. Instead, insist that + * one of the matching criteria from camperiphunit be present + * for the device. */ i = 0; dname = periph_name; @@ -580,8 +581,7 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, break; /* if no "target" and no specific scbus, skip */ if (resource_int_value(dname, dunit, "target", &val) && - (resource_string_value(dname, dunit, "at",&strval)|| - strcmp(strval, "scbus") == 0)) + resource_string_value(dname, dunit, "at",&strval)) continue; if (newunit == dunit) break; From nobody Fri Nov 5 15:25:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D2A11183650D; Fri, 5 Nov 2021 15:25: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 4Hm48L17bwz4kpV; Fri, 5 Nov 2021 15:25:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3B261A260; Fri, 5 Nov 2021 15:25: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 1A5FPbfL073219; Fri, 5 Nov 2021 15:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPb07073218; Fri, 5 Nov 2021 15:25:37 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:37 GMT Message-Id: <202111051525.1A5FPb07073218@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: bee0133fb937 - main - cam_periph: switch from negative logic to positive logic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: bee0133fb937e519623324fd1ae7214d59a03aca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bee0133fb937e519623324fd1ae7214d59a03aca commit bee0133fb937e519623324fd1ae7214d59a03aca Author: Warner Losh AuthorDate: 2021-11-05 14:56:22 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:22 +0000 cam_periph: switch from negative logic to positive logic When scanning the resources that are wired for this driver, skip any that whose number doesn't match newunit. They aren't relevant. Switch to positive logic to break out of the loop (and thus go to the next unit) if we find either a target resource or an at resource. This makes the code easier to read and modify. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32681 --- sys/cam/cam_periph.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 990854f992c3..37a54a2d992b 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -579,11 +579,11 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, r = resource_find_dev(&i, dname, &dunit, NULL, NULL); if (r != 0) break; - /* if no "target" and no specific scbus, skip */ - if (resource_int_value(dname, dunit, "target", &val) && - resource_string_value(dname, dunit, "at",&strval)) + + if (newunit != dunit) continue; - if (newunit == dunit) + if (resource_int_value(dname, dunit, "target", &val) == 0 || + resource_string_value(dname, dunit, "at", &strval) == 0) break; } if (r != 0) From nobody Fri Nov 5 15:25:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 12917183603D; Fri, 5 Nov 2021 15:25: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 4Hm48N4fy0z4kmN; Fri, 5 Nov 2021 15:25: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 4104E19AF7; Fri, 5 Nov 2021 15:25: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 1A5FPd5b073245; Fri, 5 Nov 2021 15:25:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPdnW073244; Fri, 5 Nov 2021 15:25:39 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:39 GMT Message-Id: <202111051525.1A5FPdnW073244@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: 710a519ebbe3 - main - cam_periph: fix bug in camperiphunitnext logic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 710a519ebbe34850ee37e688896a761606be5009 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=710a519ebbe34850ee37e688896a761606be5009 commit 710a519ebbe34850ee37e688896a761606be5009 Author: Warner Losh AuthorDate: 2021-11-05 14:56:27 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:27 +0000 cam_periph: fix bug in camperiphunitnext logic If we assigned just a lun as a wired unit (something that camperiphunit will accept), we failed to properly skip over that unit when computing a next unit number. Add lun so the code matches the comments that we have to skip all the same criteria that camperiphunit uses to select wired units for a driver. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32682 --- sys/cam/cam_periph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 37a54a2d992b..8fbc2e3926fa 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -582,7 +582,8 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, if (newunit != dunit) continue; - if (resource_int_value(dname, dunit, "target", &val) == 0 || + if (resource_int_value(dname, dunit, "lun", &val) == 0 || + resource_int_value(dname, dunit, "target", &val) == 0 || resource_string_value(dname, dunit, "at", &strval) == 0) break; } From nobody Fri Nov 5 15:25:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2316A18364A0; Fri, 5 Nov 2021 15:25: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 4Hm48N51zqz4kmP; Fri, 5 Nov 2021 15:25: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 5726119AF8; Fri, 5 Nov 2021 15:25: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 1A5FPee8073269; Fri, 5 Nov 2021 15:25:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPepL073268; Fri, 5 Nov 2021 15:25:40 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:40 GMT Message-Id: <202111051525.1A5FPepL073268@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: 577f9aa266e3 - main - cam_periph: Add ability to wire units to a serial number List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 577f9aa266e3407a2de9d6bd6d836a9ba984e944 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=577f9aa266e3407a2de9d6bd6d836a9ba984e944 commit 577f9aa266e3407a2de9d6bd6d836a9ba984e944 Author: Warner Losh AuthorDate: 2021-11-05 14:56:33 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:33 +0000 cam_periph: Add ability to wire units to a serial number For scsi, ata and nvme, at least, we read a serial number from the device (if the device supports it, some scsi drives do not) and record it during the *_xpt probe device state machine before it posts the AC_FOUND_DEVICE async event. For mmc, no serial number is ever retrieved, so it's always NULL. Add the ability to match this serial number during device wiring. This mechanism is competely optional, and often times using a label and/or some other attribute of the device is easier. However, other times wiring a unit to a serial number simplifies management as most monitoring tools require the *daX device and having it stable from boot to boot helps with data continuity. It can be especially helpful for nvme where no other means exists to reliably tie a ndaX device to an underlying nvme drive and namespace. A similar mechanism exists in Linux to mange device unit numbers with udev. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32683 --- sys/cam/cam_periph.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 8fbc2e3926fa..bb4baaf0888f 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -69,7 +69,8 @@ static u_int camperiphnextunit(struct periph_driver *p_drv, lun_id_t lun); static u_int camperiphunit(struct periph_driver *p_drv, path_id_t pathid, target_id_t target, - lun_id_t lun); + lun_id_t lun, + const char *sn); static void camperiphdone(struct cam_periph *periph, union ccb *done_ccb); static void camperiphfree(struct cam_periph *periph); @@ -273,7 +274,8 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, free(periph, M_CAMPERIPH); return (CAM_REQ_INVALID); } - periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id); + periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id, + path->device->serial_num); cur_periph = TAILQ_FIRST(&(*p_drv)->units); while (cur_periph != NULL && cur_periph->unit_number < periph->unit_number) @@ -582,7 +584,8 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, if (newunit != dunit) continue; - if (resource_int_value(dname, dunit, "lun", &val) == 0 || + if (resource_string_value(dname, dunit, "sn", &strval) == 0 || + resource_int_value(dname, dunit, "lun", &val) == 0 || resource_int_value(dname, dunit, "target", &val) == 0 || resource_string_value(dname, dunit, "at", &strval) == 0) break; @@ -595,7 +598,7 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, static u_int camperiphunit(struct periph_driver *p_drv, path_id_t pathid, - target_id_t target, lun_id_t lun) + target_id_t target, lun_id_t lun, const char *sn) { u_int unit; int wired, i, val, dunit; @@ -624,6 +627,11 @@ camperiphunit(struct periph_driver *p_drv, path_id_t pathid, continue; wired++; } + if (resource_string_value(dname, dunit, "sn", &strval) == 0) { + if (sn == NULL || strcmp(strval, sn) != 0) + continue; + wired++; + } if (wired != 0) { unit = dunit; break; From nobody Fri Nov 5 15:25:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5EFC81836592; Fri, 5 Nov 2021 15:25: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 4Hm48P5VVwz4kmS; Fri, 5 Nov 2021 15:25: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 619A619D53; Fri, 5 Nov 2021 15:25: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 1A5FPfZ6073295; Fri, 5 Nov 2021 15:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPfc3073294; Fri, 5 Nov 2021 15:25:41 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:41 GMT Message-Id: <202111051525.1A5FPfc3073294@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: bd82711aff98 - main - cam: Remove trailing spaces from serial numbers too List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: bd82711aff986b66e9fae60847a79d9db938a467 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bd82711aff986b66e9fae60847a79d9db938a467 commit bd82711aff986b66e9fae60847a79d9db938a467 Author: Warner Losh AuthorDate: 2021-11-05 14:56:41 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:41 +0000 cam: Remove trailing spaces from serial numbers too The SanDisk SD8SB8U1 and likely others pad their serial number with spaces on the end rather than the start (at least when connected to a SAS3008). This makes them difficult to wire unit numbers to with the serial because you have to specify the trailing spaces. Instead, strip out the trailing spaces. We already strip leading spaces both here. In addition, when glabel creates the devfs device nodes, leading and trailing spaces are removed already (so there will be no change there either). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32684 --- sys/cam/scsi/scsi_xpt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 6bcf95506963..77c47d578ae3 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -1615,6 +1615,14 @@ probe_device_check: */ slen = 0; } + /* + * In apparent violation of the spec, some + * devices pad their serial numbers with + * trailing spaces. Remove them. + */ + while (slen > 0 && + serial_buf->serial_num[slen - 1] == ' ') + slen--; memcpy(path->device->serial_num, &serial_buf->serial_num[start], slen); path->device->serial_num_len = slen; From nobody Fri Nov 5 15:25:42 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D60761836046; Fri, 5 Nov 2021 15:25: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 4Hm48R37VTz4l15; Fri, 5 Nov 2021 15:25:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A43051A324; Fri, 5 Nov 2021 15:25: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 1A5FPg8D073326; Fri, 5 Nov 2021 15:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPgwj073325; Fri, 5 Nov 2021 15:25:42 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:42 GMT Message-Id: <202111051525.1A5FPgwj073325@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: d836c48e7110 - main - cam_periph: wired is really a bool, update it to a bool. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: d836c48e7110f2894885cf84ce8990f7916663cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d836c48e7110f2894885cf84ce8990f7916663cc commit d836c48e7110f2894885cf84ce8990f7916663cc Author: Warner Losh AuthorDate: 2021-11-05 14:56:48 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:48 +0000 cam_periph: wired is really a bool, update it to a bool. Sponsored by: Netflix Reviewed by: scottl Differential Revision: https://reviews.freebsd.org/D32823 --- sys/cam/cam_periph.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index bb4baaf0888f..54fe9a0ef40c 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #include static u_int camperiphnextunit(struct periph_driver *p_drv, - u_int newunit, int wired, + u_int newunit, bool wired, path_id_t pathid, target_id_t target, lun_id_t lun); static u_int camperiphunit(struct periph_driver *p_drv, @@ -539,7 +539,7 @@ cam_periph_unhold(struct cam_periph *periph) * numbers that did not match a wiring entry. */ static u_int -camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, +camperiphnextunit(struct periph_driver *p_drv, u_int newunit, bool wired, path_id_t pathid, target_id_t target, lun_id_t lun) { struct cam_periph *periph; @@ -555,14 +555,14 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired, ; if (periph != NULL && periph->unit_number == newunit) { - if (wired != 0) { + if (wired) { xpt_print(periph->path, "Duplicate Wired " "Device entry!\n"); xpt_print(periph->path, "Second device (%s " "device at scbus%d target %d lun %d) will " "not be wired\n", periph_name, pathid, target, lun); - wired = 0; + wired = false; } continue; } @@ -600,8 +600,9 @@ static u_int camperiphunit(struct periph_driver *p_drv, path_id_t pathid, target_id_t target, lun_id_t lun, const char *sn) { + bool wired; u_int unit; - int wired, i, val, dunit; + int i, val, dunit; const char *dname, *strval; char pathbuf[32], *periph_name; @@ -610,29 +611,29 @@ camperiphunit(struct periph_driver *p_drv, path_id_t pathid, unit = 0; i = 0; dname = periph_name; - for (wired = 0; resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0; - wired = 0) { + while (resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0) { + wired = false; if (resource_string_value(dname, dunit, "at", &strval) == 0) { if (strcmp(strval, pathbuf) != 0) continue; - wired++; + wired = true; } if (resource_int_value(dname, dunit, "target", &val) == 0) { if (val != target) continue; - wired++; + wired = true; } if (resource_int_value(dname, dunit, "lun", &val) == 0) { if (val != lun) continue; - wired++; + wired = true; } if (resource_string_value(dname, dunit, "sn", &strval) == 0) { if (sn == NULL || strcmp(strval, sn) != 0) continue; - wired++; + wired = true; } - if (wired != 0) { + if (wired) { unit = dunit; break; } From nobody Fri Nov 5 15:25:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B036A1836639; Fri, 5 Nov 2021 15:25: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 4Hm48W2Ytqz4kmd; Fri, 5 Nov 2021 15:25: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 A098619F72; Fri, 5 Nov 2021 15:25: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 1A5FPhRT073350; Fri, 5 Nov 2021 15:25:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPh3d073349; Fri, 5 Nov 2021 15:25:43 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:43 GMT Message-Id: <202111051525.1A5FPh3d073349@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: c688a2eb2f24 - main - scsi.4: Remove untrue paragraph List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c688a2eb2f2481da6a4b57913e3ea261daa73f32 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c688a2eb2f2481da6a4b57913e3ea261daa73f32 commit c688a2eb2f2481da6a4b57913e3ea261daa73f32 Author: Warner Losh AuthorDate: 2021-11-05 14:56:57 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:56:57 +0000 scsi.4: Remove untrue paragraph Unwired units start with the first avaialble unit that hasn't been wired, not one greater than the largest wired unit. wired units are skipped when assigning unwired units a number. Sponsored by: Netflix Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D32824 --- share/man/man4/scsi.4 | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4 index d3f92fd6b8bb..29b8a48cd48d 100644 --- a/share/man/man4/scsi.4 +++ b/share/man/man4/scsi.4 @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 18, 2020 +.Dd November 3, 2021 .Dt CAM 4 .Os .Sh NAME @@ -252,14 +252,6 @@ The namespace id 1 is exported as .Tn nda10 and namespace id 2 is exported as .Tn nda11 . -.Pp -When you have a mixture of wired down and counted devices then the -counting begins with the first non-wired down unit for a particular -type. -That is, if you have a disk wired down as -.Em "device da1" , -then the first non-wired disk shall come on line as -.Em da2 . .Sh ADAPTERS The system allows common device drivers to work through many different types of adapters. From nobody Fri Nov 5 15:25:44 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 844EF18365C4; Fri, 5 Nov 2021 15:25: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 4Hm48W6YC4z4kvT; Fri, 5 Nov 2021 15:25: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 EA3C71A0A2; Fri, 5 Nov 2021 15:25: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 1A5FPi16073374; Fri, 5 Nov 2021 15:25:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5FPiA0073373; Fri, 5 Nov 2021 15:25:44 GMT (envelope-from git) Date: Fri, 5 Nov 2021 15:25:44 GMT Message-Id: <202111051525.1A5FPiA0073373@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: 15d4459cb2d3 - main - scsi.4: Document serial numbers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 15d4459cb2d3d2fa8f3831fa5cc99d133cbae48d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=15d4459cb2d3d2fa8f3831fa5cc99d133cbae48d commit 15d4459cb2d3d2fa8f3831fa5cc99d133cbae48d Author: Warner Losh AuthorDate: 2021-11-05 14:57:05 +0000 Commit: Warner Losh CommitDate: 2021-11-05 14:57:05 +0000 scsi.4: Document serial numbers You can wire da, ada and nda device units to serial numbers. sdda cannot be wired like this because SD and MMC cards lack serial numbers (or at the very least CAMMMC does not query or retain them). Sponsored by: Netflix Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D32825 --- share/man/man4/scsi.4 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4 index 29b8a48cd48d..e4c6d9a53eb4 100644 --- a/share/man/man4/scsi.4 +++ b/share/man/man4/scsi.4 @@ -242,16 +242,32 @@ hint.nda.11.target="1" hint.nda.11.unit="2" .Ed .Pp -This assigns the NVMe card living at PCI bus 7 to scbus 10 (in PCIe, -slot and function are rarely used and usually 0). +This assigns the NVMe card living at PCI bus 7 slot 0 function 1 to scbus 10. The target for .Xr nda 4 devices is always 1. The unit is the namespace identifier from the drive. The namespace id 1 is exported as -.Tn nda10 +.Em nda10 and namespace id 2 is exported as -.Tn nda11 . +.Em nda11 . +.Pp +For devices that provide a serial number, units may be wired to that serial +number without regard where the drive is attached: +.Bd -literal -offset indent +hint.nda.3.sn="CY0AN07101120B12P" +hint.da.44.sn="143282400011" +hint.ada.2.sn="A065D591" +.Ed +wires +.Em nda3 , +.Em da44 , +and +.Em ada2 +to drives with the specified serial numbers. +One need not specify an +.Em at +line when serial numbers are used. .Sh ADAPTERS The system allows common device drivers to work through many different types of adapters. From nobody Fri Nov 5 16:10:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0337D184FBB9; Fri, 5 Nov 2021 16: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 4Hm58H6kfCz3Mql; Fri, 5 Nov 2021 16:10: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 C6F591A9CE; Fri, 5 Nov 2021 16:10: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 1A5GAdQc037133; Fri, 5 Nov 2021 16:10:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5GAdfP037131; Fri, 5 Nov 2021 16:10:39 GMT (envelope-from git) Date: Fri, 5 Nov 2021 16:10:39 GMT Message-Id: <202111051610.1A5GAdfP037131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 344691934f0c - stable/13 - llvm BPF target: add missed source files List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 344691934f0c594b9cdf788e0a1390f3ca9dd2ea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=344691934f0c594b9cdf788e0a1390f3ca9dd2ea commit 344691934f0c594b9cdf788e0a1390f3ca9dd2ea Author: Dimitry Andric AuthorDate: 2021-11-02 16:49:34 +0000 Commit: Dimitry Andric CommitDate: 2021-11-05 16:10:14 +0000 llvm BPF target: add missed source files Otherwise, linking llvm binaries with this target enabled (which is not the default) will fail with a number of undefined symbol errors: ld: error: undefined symbol: llvm::initializeBPFAdjustOptPass(llvm::PassRegistry&) ld: error: undefined symbol: llvm::initializeBPFCheckAndAdjustIRPass(llvm::PassRegistry&) ld: error: undefined symbol: llvm::createBPFCheckAndAdjustIR() ld: error: undefined symbol: llvm::createBPFAdjustOpt() ld: error: undefined symbol: llvm::BPFAdjustOptPass::run(llvm::Module&, llvm::AnalysisManager&) Reported by: Michael Dexter (cherry picked from commit d30dc78f798adebda488d2b8e21290268d2fb501) --- lib/clang/libllvm/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 09d6336c01d9..caca02399c42 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -1157,7 +1157,9 @@ SRCS_MIN+= Target/ARM/Utils/ARMBaseInfo.cpp .if ${MK_LLVM_TARGET_BPF} != "no" SRCS_MIN+= Target/BPF/AsmParser/BPFAsmParser.cpp SRCS_MIN+= Target/BPF/BPFAbstractMemberAccess.cpp +SRCS_MIN+= Target/BPF/BPFAdjustOpt.cpp SRCS_MIN+= Target/BPF/BPFAsmPrinter.cpp +SRCS_MIN+= Target/BPF/BPFCheckAndAdjustIR.cpp SRCS_MIN+= Target/BPF/BPFFrameLowering.cpp SRCS_MIN+= Target/BPF/BPFISelDAGToDAG.cpp SRCS_MIN+= Target/BPF/BPFISelLowering.cpp From nobody Fri Nov 5 20:46:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B2066184296E; Fri, 5 Nov 2021 20:46: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 4HmCG74cpjz3JWP; Fri, 5 Nov 2021 20:46: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 7B0AE1E881; Fri, 5 Nov 2021 20:46: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 1A5Kk7uc016583; Fri, 5 Nov 2021 20:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5Kk7nl016582; Fri, 5 Nov 2021 20:46:07 GMT (envelope-from git) Date: Fri, 5 Nov 2021 20:46:07 GMT Message-Id: <202111052046.1A5Kk7nl016582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6a8ea6d17498 - main - sched: split sched_ap_entry() out of sched_throw() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a8ea6d17498f07c702e2acf4072cf4436037a6a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6a8ea6d17498f07c702e2acf4072cf4436037a6a commit 6a8ea6d17498f07c702e2acf4072cf4436037a6a Author: Kyle Evans AuthorDate: 2021-11-04 00:09:56 +0000 Commit: Kyle Evans CommitDate: 2021-11-05 20:45:51 +0000 sched: split sched_ap_entry() out of sched_throw() sched_throw() can no longer take a NULL thread, APs enter through sched_ap_entry() instead. This completely removes branching in the common case and cleans up both paths. No functional change intended. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D32829 --- sys/arm/arm/mp_machdep.c | 2 +- sys/arm64/arm64/mp_machdep.c | 2 +- sys/kern/sched_4bsd.c | 51 +++++++++++++++++-------- sys/kern/sched_ule.c | 81 ++++++++++++++++++++++++++++------------ sys/mips/mips/mp_machdep.c | 2 +- sys/powerpc/powerpc/mp_machdep.c | 2 +- sys/riscv/riscv/mp_machdep.c | 2 +- sys/sys/sched.h | 1 + sys/x86/x86/mp_x86.c | 2 +- 9 files changed, 100 insertions(+), 45 deletions(-) diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c index 4089af5929eb..6f772deee2d4 100644 --- a/sys/arm/arm/mp_machdep.c +++ b/sys/arm/arm/mp_machdep.c @@ -217,7 +217,7 @@ init_secondary(int cpu) CTR0(KTR_SMP, "go into scheduler"); /* Enter the scheduler */ - sched_throw(NULL); + sched_ap_entry(); panic("scheduler returned us to %s", __func__); /* NOTREACHED */ diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index b42f65b9e399..4eebfe219934 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -293,7 +293,7 @@ init_secondary(uint64_t cpu) MPASS(PCPU_GET(curpcb) == NULL); /* Enter the scheduler */ - sched_throw(NULL); + sched_ap_entry(); panic("scheduler returned us to init_secondary"); /* NOTREACHED */ diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 6ba41eb80dcc..25f8bfc04d48 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1662,12 +1662,22 @@ sched_idletd(void *dummy) } } +static void +sched_throw_tail(struct thread *td) +{ + + mtx_assert(&sched_lock, MA_OWNED); + KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); + cpu_throw(td, choosethread()); /* doesn't return */ +} + /* - * A CPU is entering for the first time or a thread is exiting. + * A CPU is entering for the first time. */ void -sched_throw(struct thread *td) +sched_ap_entry(void) { + /* * Correct spinlock nesting. The idle thread context that we are * borrowing was created so that it would start out with a single @@ -1677,20 +1687,29 @@ sched_throw(struct thread *td) * spinlock_exit() will simply adjust the counts without allowing * spin lock using code to interrupt us. */ - if (td == NULL) { - mtx_lock_spin(&sched_lock); - spinlock_exit(); - PCPU_SET(switchtime, cpu_ticks()); - PCPU_SET(switchticks, ticks); - } else { - lock_profile_release_lock(&sched_lock.lock_object, true); - MPASS(td->td_lock == &sched_lock); - td->td_lastcpu = td->td_oncpu; - td->td_oncpu = NOCPU; - } - mtx_assert(&sched_lock, MA_OWNED); - KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); - cpu_throw(td, choosethread()); /* doesn't return */ + mtx_lock_spin(&sched_lock); + spinlock_exit(); + PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchticks, ticks); + + sched_throw_tail(NULL); +} + +/* + * A thread is exiting. + */ +void +sched_throw(struct thread *td) +{ + + MPASS(td != NULL); + MPASS(td->td_lock == &sched_lock); + + lock_profile_release_lock(&sched_lock.lock_object, true); + td->td_lastcpu = td->td_oncpu; + td->td_oncpu = NOCPU; + + sched_throw_tail(td); } void diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index ce7ce4cd2bd8..e311c8da8bac 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2985,39 +2985,74 @@ sched_idletd(void *dummy) } /* - * A CPU is entering for the first time or a thread is exiting. + * sched_throw_grab() chooses a thread from the queue to switch to + * next. It returns with the tdq lock dropped in a spinlock section to + * keep interrupts disabled until the CPU is running in a proper threaded + * context. */ -void -sched_throw(struct thread *td) +static struct thread * +sched_throw_grab(struct tdq *tdq) { struct thread *newtd; - struct tdq *tdq; - tdq = TDQ_SELF(); - if (__predict_false(td == NULL)) { - TDQ_LOCK(tdq); - /* Correct spinlock nesting. */ - spinlock_exit(); - PCPU_SET(switchtime, cpu_ticks()); - PCPU_SET(switchticks, ticks); - } else { - THREAD_LOCK_ASSERT(td, MA_OWNED); - THREAD_LOCKPTR_ASSERT(td, TDQ_LOCKPTR(tdq)); - tdq_load_rem(tdq, td); - td->td_lastcpu = td->td_oncpu; - td->td_oncpu = NOCPU; - thread_lock_block(td); - } newtd = choosethread(); spinlock_enter(); TDQ_UNLOCK(tdq); KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count %d", curthread->td_md.md_spinlock_count)); + return (newtd); +} + +/* + * A CPU is entering for the first time. + */ +void +sched_ap_entry(void) +{ + struct thread *newtd; + struct tdq *tdq; + + tdq = TDQ_SELF(); + + /* This should have been setup in schedinit_ap(). */ + THREAD_LOCKPTR_ASSERT(curthread, TDQ_LOCKPTR(tdq)); + + TDQ_LOCK(tdq); + /* Correct spinlock nesting. */ + spinlock_exit(); + PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchticks, ticks); + + newtd = sched_throw_grab(tdq); + /* doesn't return */ - if (__predict_false(td == NULL)) - cpu_throw(td, newtd); /* doesn't return */ - else - cpu_switch(td, newtd, TDQ_LOCKPTR(tdq)); + cpu_throw(NULL, newtd); +} + +/* + * A thread is exiting. + */ +void +sched_throw(struct thread *td) +{ + struct thread *newtd; + struct tdq *tdq; + + tdq = TDQ_SELF(); + + MPASS(td != NULL); + THREAD_LOCK_ASSERT(td, MA_OWNED); + THREAD_LOCKPTR_ASSERT(td, TDQ_LOCKPTR(tdq)); + + tdq_load_rem(tdq, td); + td->td_lastcpu = td->td_oncpu; + td->td_oncpu = NOCPU; + thread_lock_block(td); + + newtd = sched_throw_grab(tdq); + + /* doesn't return */ + cpu_switch(td, newtd, TDQ_LOCKPTR(tdq)); } /* diff --git a/sys/mips/mips/mp_machdep.c b/sys/mips/mips/mp_machdep.c index dc089db1d189..2582c2b65e78 100644 --- a/sys/mips/mips/mp_machdep.c +++ b/sys/mips/mips/mp_machdep.c @@ -335,7 +335,7 @@ smp_init_secondary(u_int32_t cpuid) cpu_initclocks_ap(); /* enter the scheduler */ - sched_throw(NULL); + sched_ap_entry(); panic("scheduler returned us to %s", __func__); /* NOTREACHED */ diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index 627cde77adbf..33ef870b8180 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -112,7 +112,7 @@ machdep_ap_bootstrap(void) cpu_initclocks_ap(); /* Announce ourselves awake, and enter the scheduler */ - sched_throw(NULL); + sched_ap_entry(); } void diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index 57d5606a3b88..74647b8fcba4 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -291,7 +291,7 @@ init_secondary(uint64_t hart) MPASS(PCPU_GET(curpcb) == NULL); /* Enter the scheduler */ - sched_throw(NULL); + sched_ap_entry(); panic("scheduler returned us to init_secondary"); /* NOTREACHED */ diff --git a/sys/sys/sched.h b/sys/sys/sched.h index 8041a2bc12d4..a9598767e4cb 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -91,6 +91,7 @@ void sched_nice(struct proc *p, int nice); * Threads are switched in and out, block on resources, have temporary * priorities inherited from their procs, and use up cpu time. */ +void sched_ap_entry(void); void sched_exit_thread(struct thread *td, struct thread *child); u_int sched_estcpu(struct thread *td); void sched_fork_thread(struct thread *td, struct thread *child); diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 1fac244cbed7..7a72c501ff25 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1099,7 +1099,7 @@ init_secondary_tail(void) */ MPASS(PCPU_GET(curpcb) == NULL); - sched_throw(NULL); + sched_ap_entry(); panic("scheduler returned us to %s", __func__); /* NOTREACHED */ From nobody Fri Nov 5 21:27:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2C1691856E77; Fri, 5 Nov 2021 21:27: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 4HmD9z0fWDz3nQj; Fri, 5 Nov 2021 21:27: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 EC6111F189; Fri, 5 Nov 2021 21:27: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 1A5LRYGP070855; Fri, 5 Nov 2021 21:27:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5LRYAt070854; Fri, 5 Nov 2021 21:27:34 GMT (envelope-from git) Date: Fri, 5 Nov 2021 21:27:34 GMT Message-Id: <202111052127.1A5LRYAt070854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: e2157cd0000f - main - Partially revert ac76bc1145dd because it is no longer necessary List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb commit e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb Author: Dimitry Andric AuthorDate: 2021-11-05 21:26:16 +0000 Commit: Dimitry Andric CommitDate: 2021-11-05 21:27:20 +0000 Partially revert ac76bc1145dd because it is no longer necessary In ac76bc1145dd, I added a few volatiles to work around ctrig_test failures with {inf,inf}. This is not necessary anymore now, since in 3b00222f156d we added -fp-exception-behavior=maytrap for clang >= 10 in libm's Makefile. (The flag tells clang to use stricter floating point semantics, which libm depends on.) PR: 244732, 254911 Fixes: ac76bc1145dd MFC after: 3 days --- lib/msun/src/s_ccoshf.c | 2 +- lib/msun/src/s_ctanh.c | 2 +- lib/msun/src/s_ctanhf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index e72395c277d5..5d7a09ba5f8d 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -43,7 +43,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - volatile float x, y, h; + float x, y, h; int32_t hx, hy, ix, iy; x = crealf(z); diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 93e5ad444501..e5840a1bf67b 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); double complex ctanh(double complex z) { - volatile double x, y; + double x, y; double t, beta, s, rho, denom; uint32_t hx, ix, lx; diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index 164a2c23df9e..c46f86d2e116 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); float complex ctanhf(float complex z) { - volatile float x, y; + float x, y; float t, beta, s, rho, denom; uint32_t hx, ix; From nobody Fri Nov 5 22:36:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 82F99184B600; Fri, 5 Nov 2021 22:36: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 4HmFjM3GCKz4h66; Fri, 5 Nov 2021 22:36: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 4CB421FFB9; Fri, 5 Nov 2021 22:36: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 1A5MaNYW064060; Fri, 5 Nov 2021 22:36:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5MaNEf064059; Fri, 5 Nov 2021 22:36:23 GMT (envelope-from git) Date: Fri, 5 Nov 2021 22:36:23 GMT Message-Id: <202111052236.1A5MaNEf064059@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: f5d5164fb607 - main - nfscl: Fix two more cases for forced dismount List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: f5d5164fb607ab9c51c52ace4ec241f6cac7cc5c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f5d5164fb607ab9c51c52ace4ec241f6cac7cc5c commit f5d5164fb607ab9c51c52ace4ec241f6cac7cc5c Author: Rick Macklem AuthorDate: 2021-11-05 22:33:19 +0000 Commit: Rick Macklem CommitDate: 2021-11-05 22:33:19 +0000 nfscl: Fix two more cases for forced dismount Although I was not able to cause a failure during testing, there are places in nfscl_removedeleg() and nfscl_renamedeleg() where I think a forced dismount could get hung. This patch fixes those. This patch only affects forced dismount and only if the NFSv4 server is issuing delegations to the client. Found by code inspection. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 54 +++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 42233ea7cf9d..1df8530d0e39 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4669,6 +4669,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) struct nfsclowner *owp; struct nfscllockowner *lp; struct nfsmount *nmp; + struct mount *mp; struct ucred *cred; struct nfsnode *np; int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; @@ -4683,6 +4684,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) } NFSUNLOCKMNT(nmp); np = VTONFS(vp); + mp = nmp->nm_mountp; NFSLOCKCLSTATE(); /* * Loop around waiting for: @@ -4709,8 +4711,13 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) igotlock = 0; } dp->nfsdl_rwlock.nfslock_lock |= NFSV4LOCK_WANTED; - (void) nfsmsleep(&dp->nfsdl_rwlock, - NFSCLSTATEMUTEXPTR, PZERO, "nfscld", NULL); + msleep(&dp->nfsdl_rwlock, NFSCLSTATEMUTEXPTR, PZERO, + "nfscld", hz); + if (NFSCL_FORCEDISM(mp)) { + dp->nfsdl_flags &= ~NFSCLDL_DELEGRET; + NFSUNLOCKCLSTATE(); + return (0); + } continue; } needsrecall = 0; @@ -4733,7 +4740,14 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) islept = 0; while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, - &islept, NFSCLSTATEMUTEXPTR, NULL); + &islept, NFSCLSTATEMUTEXPTR, mp); + if (NFSCL_FORCEDISM(mp)) { + dp->nfsdl_flags &= ~NFSCLDL_DELEGRET; + if (igotlock) + nfsv4_unlock(&clp->nfsc_lock, 0); + NFSUNLOCKCLSTATE(); + return (0); + } if (islept) break; } @@ -4774,6 +4788,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, struct nfsclowner *owp; struct nfscllockowner *lp; struct nfsmount *nmp; + struct mount *mp; struct ucred *cred; struct nfsnode *np; int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; @@ -4789,6 +4804,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, return (retcnt); } NFSUNLOCKMNT(nmp); + mp = nmp->nm_mountp; NFSLOCKCLSTATE(); /* * Loop around waiting for: @@ -4816,8 +4832,15 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, igotlock = 0; } dp->nfsdl_rwlock.nfslock_lock |= NFSV4LOCK_WANTED; - (void) nfsmsleep(&dp->nfsdl_rwlock, - NFSCLSTATEMUTEXPTR, PZERO, "nfscld", NULL); + msleep(&dp->nfsdl_rwlock, NFSCLSTATEMUTEXPTR, PZERO, + "nfscld", hz); + if (NFSCL_FORCEDISM(mp)) { + dp->nfsdl_flags &= ~NFSCLDL_DELEGRET; + NFSUNLOCKCLSTATE(); + *gotfdp = 0; + *gottdp = 0; + return (0); + } continue; } needsrecall = 0; @@ -4840,7 +4863,16 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, islept = 0; while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, - &islept, NFSCLSTATEMUTEXPTR, NULL); + &islept, NFSCLSTATEMUTEXPTR, mp); + if (NFSCL_FORCEDISM(mp)) { + dp->nfsdl_flags &= ~NFSCLDL_DELEGRET; + if (igotlock) + nfsv4_unlock(&clp->nfsc_lock, 0); + NFSUNLOCKCLSTATE(); + *gotfdp = 0; + *gottdp = 0; + return (0); + } if (islept) break; } @@ -4877,8 +4909,14 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, */ if (dp->nfsdl_rwlock.nfslock_usecnt > 0) { dp->nfsdl_rwlock.nfslock_lock |= NFSV4LOCK_WANTED; - (void) nfsmsleep(&dp->nfsdl_rwlock, - NFSCLSTATEMUTEXPTR, PZERO, "nfscld", NULL); + msleep(&dp->nfsdl_rwlock, NFSCLSTATEMUTEXPTR, PZERO, + "nfscld", hz); + if (NFSCL_FORCEDISM(mp)) { + NFSUNLOCKCLSTATE(); + *gotfdp = 0; + *gottdp = 0; + return (0); + } continue; } LIST_FOREACH(owp, &dp->nfsdl_owner, nfsow_list) { From nobody Fri Nov 5 23:39:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E46031845D45; Fri, 5 Nov 2021 23:39: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 4HmH6P62rPz3Hqb; Fri, 5 Nov 2021 23:39: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 A576C20770; Fri, 5 Nov 2021 23:39: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 1A5Ndf70044195; Fri, 5 Nov 2021 23:39:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5Ndf4R044194; Fri, 5 Nov 2021 23:39:41 GMT (envelope-from git) Date: Fri, 5 Nov 2021 23:39:41 GMT Message-Id: <202111052339.1A5Ndf4R044194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e900338c0987 - main - Move the ICL_CONN_*LOCK* macros to . List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e900338c0987603456df8d9a8aeec5c239106d0b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e900338c0987603456df8d9a8aeec5c239106d0b commit e900338c0987603456df8d9a8aeec5c239106d0b Author: John Baldwin AuthorDate: 2021-11-05 23:38:25 +0000 Commit: John Baldwin CommitDate: 2021-11-05 23:38:25 +0000 Move the ICL_CONN_*LOCK* macros to . These macros are not backend-specific but reference a backend-independent field in struct icl_conn. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32858 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 5 ----- sys/dev/iscsi/icl.h | 5 +++++ sys/dev/iscsi/icl_soft.c | 5 ----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index cf1032f2a3a2..de8f2547f29a 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -129,11 +129,6 @@ SYSCTL_INT(_kern_icl_cxgbei, OID_AUTO, recvspace, CTLFLAG_RWTUN, static volatile u_int icl_cxgbei_ncons; -#define ICL_CONN_LOCK(X) mtx_lock(X->ic_lock) -#define ICL_CONN_UNLOCK(X) mtx_unlock(X->ic_lock) -#define ICL_CONN_LOCK_ASSERT(X) mtx_assert(X->ic_lock, MA_OWNED) -#define ICL_CONN_LOCK_ASSERT_NOT(X) mtx_assert(X->ic_lock, MA_NOTOWNED) - static icl_conn_new_pdu_t icl_cxgbei_conn_new_pdu; static icl_conn_pdu_data_segment_length_t icl_cxgbei_conn_pdu_data_segment_length; diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index 07dcbbf2a0b5..edd43a45ba2e 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -120,6 +120,11 @@ struct icl_conn { void *ic_prv0; }; +#define ICL_CONN_LOCK(X) mtx_lock(X->ic_lock) +#define ICL_CONN_UNLOCK(X) mtx_unlock(X->ic_lock) +#define ICL_CONN_LOCK_ASSERT(X) mtx_assert(X->ic_lock, MA_OWNED) +#define ICL_CONN_LOCK_ASSERT_NOT(X) mtx_assert(X->ic_lock, MA_NOTOWNED) + struct icl_drv_limits { int idl_max_recv_data_segment_length; int idl_max_send_data_segment_length; diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 95c4c87dd6f3..37f3911204c4 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -123,11 +123,6 @@ static uma_zone_t icl_soft_pdu_zone; static volatile u_int icl_ncons; -#define ICL_CONN_LOCK(X) mtx_lock(X->ic_lock) -#define ICL_CONN_UNLOCK(X) mtx_unlock(X->ic_lock) -#define ICL_CONN_LOCK_ASSERT(X) mtx_assert(X->ic_lock, MA_OWNED) -#define ICL_CONN_LOCK_ASSERT_NOT(X) mtx_assert(X->ic_lock, MA_NOTOWNED) - STAILQ_HEAD(icl_pdu_stailq, icl_pdu); static icl_conn_new_pdu_t icl_soft_conn_new_pdu; From nobody Sat Nov 6 02:25:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E7414183BDBD; Sat, 6 Nov 2021 02:25: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 4HmLnR6Gjdz3jP3; Sat, 6 Nov 2021 02:25: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 B8B012318E; Sat, 6 Nov 2021 02:25: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 1A62PFSR077345; Sat, 6 Nov 2021 02:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PFjb077344; Sat, 6 Nov 2021 02:25:15 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:15 GMT Message-Id: <202111060225.1A62PFjb077344@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: 0b06c284ae63 - stable/13 - kern_exec.c: style List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 0b06c284ae631fcca562e9ff13350b71362df6e5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0b06c284ae631fcca562e9ff13350b71362df6e5 commit 0b06c284ae631fcca562e9ff13350b71362df6e5 Author: Konstantin Belousov AuthorDate: 2021-10-22 23:49:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:31 +0000 kern_exec.c: style (cherry picked from commit 143dba3a914294c2f4de80a46ffd04cd8b25246f) --- sys/kern/kern_exec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 4a405637be4a..15af8f402b05 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -212,9 +212,9 @@ static const struct execsw **execsw; #ifndef _SYS_SYSPROTO_H_ struct execve_args { - char *fname; + char *fname; char **argv; - char **envv; + char **envv; }; #endif @@ -477,7 +477,8 @@ interpret: /* * Descriptors opened only with O_EXEC or O_RDONLY are allowed. */ - error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, &newtextvp); + error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, + &newtextvp); if (error) goto exec_fail; vn_lock(newtextvp, LK_SHARED | LK_RETRY); @@ -595,7 +596,8 @@ interpret: imgp->execpath = args->fname; else { VOP_UNLOCK(imgp->vp); - if (vn_fullpath(imgp->vp, &imgp->execpath, &imgp->freepath) != 0) + if (vn_fullpath(imgp->vp, &imgp->execpath, + &imgp->freepath) != 0) imgp->execpath = args->fname; vn_lock(imgp->vp, LK_SHARED | LK_RETRY); } @@ -1017,7 +1019,7 @@ exec_map_first_page(struct image_params *imgp) #endif error = vm_page_grab_valid_unlocked(&m, object, 0, VM_ALLOC_COUNT(VM_INITIAL_PAGEIN) | - VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED); + VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED); if (error != VM_PAGER_OK) return (EIO); From nobody Sat Nov 6 02:25:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 39321183BD7E; Sat, 6 Nov 2021 02:25: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 4HmLnT0WpNz3j9m; Sat, 6 Nov 2021 02:25: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 DB08722FB8; Sat, 6 Nov 2021 02:25: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 1A62PGp5077369; Sat, 6 Nov 2021 02:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PG3S077368; Sat, 6 Nov 2021 02:25:16 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:16 GMT Message-Id: <202111060225.1A62PG3S077368@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: 3b4baefca925 - stable/13 - do_execve(): switch boolean locals to use bool type List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3b4baefca9256b976963add91e8e8082c3e281fd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3b4baefca9256b976963add91e8e8082c3e281fd commit 3b4baefca9256b976963add91e8e8082c3e281fd Author: Konstantin Belousov AuthorDate: 2021-10-23 14:47:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:31 +0000 do_execve(): switch boolean locals to use bool type (cherry picked from commit 9d58243fbc4a1931aba618f8f5f6872779656c42) --- sys/kern/kern_exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 15af8f402b05..1fd11e34a048 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -391,10 +391,10 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, struct ktr_io_params *kiop; #endif struct vnode *oldtextvp = NULL, *newtextvp; - int credential_changing; + bool credential_changing; #ifdef MAC struct label *interpvplabel = NULL; - int will_transition; + bool will_transition; #endif #ifdef HWPMC_HOOKS struct pmckern_procexec pe; @@ -525,14 +525,14 @@ interpret: * XXXMAC: For the time being, use NOSUID to also prohibit * transitions on the file system. */ - credential_changing = 0; + credential_changing = false; credential_changing |= (attr.va_mode & S_ISUID) && oldcred->cr_uid != attr.va_uid; credential_changing |= (attr.va_mode & S_ISGID) && oldcred->cr_gid != attr.va_gid; #ifdef MAC will_transition = mac_vnode_execve_will_transition(oldcred, imgp->vp, - interpvplabel, imgp); + interpvplabel, imgp) != 0; credential_changing |= will_transition; #endif From nobody Sat Nov 6 02:25:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1FF84183BED9; Sat, 6 Nov 2021 02:25: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 4HmLnV1wLnz3jDB; Sat, 6 Nov 2021 02:25: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 1005322F6A; Sat, 6 Nov 2021 02:25: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 1A62PHJk077393; Sat, 6 Nov 2021 02:25:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PH05077392; Sat, 6 Nov 2021 02:25:17 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:17 GMT Message-Id: <202111060225.1A62PH05077392@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: 184936164435 - stable/13 - struct image_params: use bool type for boolean members List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 18493616443539ccef910e7af0c8f65c9208ba9f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=18493616443539ccef910e7af0c8f65c9208ba9f commit 18493616443539ccef910e7af0c8f65c9208ba9f Author: Konstantin Belousov AuthorDate: 2021-10-23 15:05:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:31 +0000 struct image_params: use bool type for boolean members (cherry picked from commit 15bf81f354a428723d7e9ea61ea215d4195aa050) --- sys/kern/kern_exec.c | 6 +++--- sys/sys/imgact.h | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 1fd11e34a048..9b8ee7025a94 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -654,7 +654,7 @@ interpret: #endif if (imgp->opened) { VOP_CLOSE(newtextvp, FREAD, td->td_ucred, td); - imgp->opened = 0; + imgp->opened = false; } vput(newtextvp); vm_object_deallocate(imgp->object); @@ -1092,7 +1092,7 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) vm_prot_t stack_prot; u_long ssiz; - imgp->vmspace_destroyed = 1; + imgp->vmspace_destroyed = true; imgp->sysent = sv; if (p->p_sysent->sv_onexec_old != NULL) @@ -1855,7 +1855,7 @@ exec_check_permissions(struct image_params *imgp) */ error = VOP_OPEN(vp, FREAD, td->td_ucred, td, NULL); if (error == 0) - imgp->opened = 1; + imgp->opened = true; return (error); } diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index cd130551c050..9e884ef08d96 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -59,21 +59,16 @@ struct image_args { }; struct image_params { - struct proc *proc; /* our process struct */ + struct proc *proc; /* our process */ struct label *execlabel; /* optional exec label */ - struct vnode *vp; /* pointer to vnode of file to exec */ + struct vnode *vp; /* pointer to vnode of file to exec */ struct vm_object *object; /* The vm object for this vp */ - struct vattr *attr; /* attributes of file */ - const char *image_header; /* head of file to exec */ - unsigned long entry_addr; /* entry address of target executable */ - unsigned long reloc_base; /* load address of image */ - char vmspace_destroyed; /* flag - we've blown away original vm space */ -#define IMGACT_SHELL 0x1 -#define IMGACT_BINMISC 0x2 - unsigned char interpreted; /* mask of interpreters that have run */ - char opened; /* flag - we have opened executable vnode */ - char *interpreter_name; /* name of the interpreter */ - void *auxargs; /* ELF Auxinfo structure pointer */ + struct vattr *attr; /* attributes of file */ + const char *image_header; /* header of file to exec */ + unsigned long entry_addr; /* entry address of target executable */ + unsigned long reloc_base; /* load address of image */ + char *interpreter_name; /* name of the interpreter */ + void *auxargs; /* ELF Auxinfo structure pointer */ struct sf_buf *firstpage; /* first page that we mapped */ void *ps_strings; /* pointer to ps_string (user space) */ struct image_args *args; /* system call arguments */ @@ -91,7 +86,12 @@ struct image_params { u_long stack_sz; u_long eff_stack_sz; struct ucred *newcred; /* new credentials if changing */ +#define IMGACT_SHELL 0x1 +#define IMGACT_BINMISC 0x2 + unsigned char interpreted; /* mask of interpreters that have run */ bool credential_setid; /* true if becoming setid */ + bool vmspace_destroyed; /* we've blown away original vm space */ + bool opened; /* we have opened executable vnode */ bool textset; u_int map_flags; }; From nobody Sat Nov 6 02:25:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 08822183C225; Sat, 6 Nov 2021 02:25: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 4HmLnX4mV3z3jRk; Sat, 6 Nov 2021 02:25: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 480DE229DD; Sat, 6 Nov 2021 02:25: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 1A62PKkF077448; Sat, 6 Nov 2021 02:25:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PKxg077447; Sat, 6 Nov 2021 02:25:20 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:20 GMT Message-Id: <202111060225.1A62PKxg077447@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: a69fb7452ef9 - stable/13 - exec: provide right hardlink name in AT_EXECPATH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: a69fb7452ef97b5690f1811d4fb3b7b9f8ad78f8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a69fb7452ef97b5690f1811d4fb3b7b9f8ad78f8 commit a69fb7452ef97b5690f1811d4fb3b7b9f8ad78f8 Author: Konstantin Belousov AuthorDate: 2021-10-23 00:24:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:31 +0000 exec: provide right hardlink name in AT_EXECPATH PR: 248184 (cherry picked from commit 0c10648fbb758bb76fd29330b7fe1bc519252325) --- sys/kern/kern_exec.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 9b8ee7025a94..a82eefca62b7 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -401,6 +401,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, #endif int error, i, orig_osrel; uint32_t orig_fctl0; + size_t freepath_size; static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; @@ -447,7 +448,8 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, */ if (args->fname != NULL) { NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); + SAVENAME | AUDITVNODE1 | WANTPARENT, + UIO_SYSSPACE, args->fname, td); } SDT_PROBE1(proc, , , exec, args->fname); @@ -592,9 +594,18 @@ interpret: /* * Do the best to calculate the full path to the image file. */ - if (args->fname != NULL && args->fname[0] == '/') - imgp->execpath = args->fname; - else { + if (args->fname != NULL) { + if (args->fname[0] == '/') { + imgp->execpath = args->fname; + } else { + VOP_UNLOCK(imgp->vp); + freepath_size = MAXPATHLEN; + if (vn_fullpath_hardlink(&nd, &imgp->execpath, + &imgp->freepath, &freepath_size) != 0) + imgp->execpath = args->fname; + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + } + } else { VOP_UNLOCK(imgp->vp); if (vn_fullpath(imgp->vp, &imgp->execpath, &imgp->freepath) != 0) @@ -647,8 +658,6 @@ interpret: VOP_UNSET_TEXT_CHECKED(newtextvp); imgp->textset = false; /* free name buffer and old vnode */ - if (args->fname != NULL) - NDFREE(&nd, NDF_ONLY_PNBUF); #ifdef MAC mac_execve_interpreter_enter(newtextvp, &interpvplabel); #endif @@ -657,6 +666,11 @@ interpret: imgp->opened = false; } vput(newtextvp); + if (args->fname != NULL) { + if (nd.ni_dvp != NULL) + vrele(nd.ni_dvp); + NDFREE(&nd, NDF_ONLY_PNBUF); + } vm_object_deallocate(imgp->object); imgp->object = NULL; execve_nosetid(imgp); @@ -664,9 +678,10 @@ interpret: free(imgp->freepath, M_TEMP); imgp->freepath = NULL; /* set new name to that of the interpreter */ - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME, UIO_SYSSPACE, imgp->interpreter_name, td); args->fname = imgp->interpreter_name; + NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | + SAVENAME | WANTPARENT, + UIO_SYSSPACE, imgp->interpreter_name, td); goto interpret; } @@ -907,8 +922,6 @@ exec_fail_dealloc: exec_unmap_first_page(imgp); if (imgp->vp != NULL) { - if (args->fname) - NDFREE(&nd, NDF_ONLY_PNBUF); if (imgp->opened) VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td); if (imgp->textset) @@ -917,6 +930,11 @@ exec_fail_dealloc: vput(imgp->vp); else VOP_UNLOCK(imgp->vp); + if (args->fname != NULL) { + if (nd.ni_dvp != NULL) + vrele(nd.ni_dvp); + NDFREE(&nd, NDF_ONLY_PNBUF); + } } if (imgp->object != NULL) From nobody Sat Nov 6 02:25:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8D039183BEE7; Sat, 6 Nov 2021 02:25: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 4HmLnW4VGxz3j4y; Sat, 6 Nov 2021 02:25: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 20A1822FB9; Sat, 6 Nov 2021 02:25: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 1A62PJ2G077417; Sat, 6 Nov 2021 02:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PJrd077416; Sat, 6 Nov 2021 02:25:19 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:19 GMT Message-Id: <202111060225.1A62PJrd077416@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: b94df11d52f1 - stable/13 - Make vn_fullpath_hardlink() externally callable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: b94df11d52f13bea30af86500692fd268d049748 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b94df11d52f13bea30af86500692fd268d049748 commit b94df11d52f13bea30af86500692fd268d049748 Author: Konstantin Belousov AuthorDate: 2021-10-23 00:23:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:31 +0000 Make vn_fullpath_hardlink() externally callable (cherry picked from commit 9a0bee9f6a77a85e4dfb27c9a33d4e210d05b469) --- sys/kern/vfs_cache.c | 28 +++++++++++++--------------- sys/sys/vnode.h | 3 +++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 54a87ced2218..cf2e2dd72e63 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -581,8 +581,6 @@ DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); static void cache_zap_locked(struct namecache *ncp); -static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, - char **freebuf, size_t *buflen); static int vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *buflen, size_t addend); static int vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, @@ -3134,7 +3132,8 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) return (error); - error = vn_fullpath_hardlink(&nd, &retbuf, &freebuf, &size); + error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, nd.ni_cnd.cn_nameptr, + nd.ni_cnd.cn_namelen, &retbuf, &freebuf, &size); if (error == 0) { error = copyout(retbuf, buf, size); free(freebuf, M_TEMP); @@ -3595,8 +3594,9 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, /* * Resolve an arbitrary vnode to a pathname (taking care of hardlinks). * - * Since the namecache does not track hardlinks, the caller is expected to first - * look up the target vnode with SAVENAME | WANTPARENT flags passed to namei. + * Since the namecache does not track hardlinks, the caller is + * expected to first look up the target vnode with SAVENAME | + * WANTPARENT flags passed to namei to get dvp and vp. * * Then we have 2 cases: * - if the found vnode is a directory, the path can be constructed just by @@ -3604,14 +3604,13 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, * - otherwise we populate the buffer with the saved name and start resolving * from the parent */ -static int -vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, - size_t *buflen) +int +vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp, + const char *hrdl_name, size_t hrdl_name_length, + char **retbuf, char **freebuf, size_t *buflen) { char *buf, *tmpbuf; struct pwd *pwd; - struct componentname *cnp; - struct vnode *vp; size_t addend; int error; enum vtype type; @@ -3624,7 +3623,7 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, buf = malloc(*buflen, M_TEMP, M_WAITOK); addend = 0; - vp = ndp->ni_vp; + /* * Check for VBAD to work around the vp_crossmp bug in lookup(). * @@ -3650,8 +3649,7 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, goto out_bad; } if (type != VDIR) { - cnp = &ndp->ni_cnd; - addend = cnp->cn_namelen + 2; + addend = hrdl_name_length + 2; if (*buflen < addend) { error = ENOMEM; goto out_bad; @@ -3659,9 +3657,9 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, *buflen -= addend; tmpbuf = buf + *buflen; tmpbuf[0] = '/'; - memcpy(&tmpbuf[1], cnp->cn_nameptr, cnp->cn_namelen); + memcpy(&tmpbuf[1], hrdl_name, hrdl_name_length); tmpbuf[addend - 1] = '\0'; - vp = ndp->ni_dvp; + vp = dvp; } vfs_smr_enter(); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 4a2581cb3db3..ebd9577004fc 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -694,6 +694,9 @@ int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); int vn_getcwd(char *buf, char **retbuf, size_t *buflen); int vn_fullpath(struct vnode *vp, char **retbuf, char **freebuf); int vn_fullpath_global(struct vnode *vp, char **retbuf, char **freebuf); +int vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp, + const char *hdrl_name, size_t hrdl_name_length, char **retbuf, + char **freebuf, size_t *buflen); struct vnode * vn_dir_dd_ino(struct vnode *vp); int vn_commname(struct vnode *vn, char *buf, u_int buflen); From nobody Sat Nov 6 02:25:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 69FC9183BE60; Sat, 6 Nov 2021 02:25: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 4HmLnY5y3Gz3jDS; Sat, 6 Nov 2021 02:25: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 689A02311E; Sat, 6 Nov 2021 02:25: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 1A62PLqf077472; Sat, 6 Nov 2021 02:25:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PLl1077471; Sat, 6 Nov 2021 02:25:21 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:21 GMT Message-Id: <202111060225.1A62PLl1077471@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: d39bd6d14d4e - stable/13 - exec: store parent directory and hardlink name of the binary in struct proc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: d39bd6d14d4ebf185a5557bb2206eb2cd7b4cb0f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d39bd6d14d4ebf185a5557bb2206eb2cd7b4cb0f commit d39bd6d14d4ebf185a5557bb2206eb2cd7b4cb0f Author: Konstantin Belousov AuthorDate: 2021-10-23 18:44:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 exec: store parent directory and hardlink name of the binary in struct proc (cherry picked from commit 351d5f7fc5161ededeaa226ee3f21a438ee4a632) --- sys/kern/kern_exec.c | 108 +++++++++++++++++++++++++++++---------------------- sys/kern/kern_exit.c | 10 ++++- sys/kern/kern_fork.c | 12 +++++- sys/sys/proc.h | 2 + 4 files changed, 82 insertions(+), 50 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index a82eefca62b7..cf7af148f5c8 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -390,7 +390,9 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, #ifdef KTRACE struct ktr_io_params *kiop; #endif - struct vnode *oldtextvp = NULL, *newtextvp; + struct vnode *oldtextvp, *newtextvp; + struct vnode *oldtextdvp, *newtextdvp; + char *oldbinname, *newbinname; bool credential_changing; #ifdef MAC struct label *interpvplabel = NULL; @@ -405,6 +407,9 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; + oldtextvp = oldtextdvp = NULL; + newtextvp = newtextdvp = NULL; + newbinname = oldbinname = NULL; #ifdef KTRACE kiop = NULL; #endif @@ -439,19 +444,6 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, goto exec_fail; #endif - /* - * Translate the file name. namei() returns a vnode pointer - * in ni_vp among other things. - * - * XXXAUDIT: It would be desirable to also audit the name of the - * interpreter if this is an interpreted binary. - */ - if (args->fname != NULL) { - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME | AUDITVNODE1 | WANTPARENT, - UIO_SYSSPACE, args->fname, td); - } - SDT_PROBE1(proc, , , exec, args->fname); interpret: @@ -468,12 +460,42 @@ interpret: goto exec_fail; } #endif + + /* + * Translate the file name. namei() returns a vnode + * pointer in ni_vp among other things. + */ + NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | + SAVENAME | AUDITVNODE1 | WANTPARENT, UIO_SYSSPACE, + args->fname, td); + error = namei(&nd); if (error) goto exec_fail; newtextvp = nd.ni_vp; + newtextdvp = nd.ni_dvp; + nd.ni_dvp = NULL; + newbinname = malloc(nd.ni_cnd.cn_namelen + 1, M_PARGS, + M_WAITOK); + memcpy(newbinname, nd.ni_cnd.cn_nameptr, nd.ni_cnd.cn_namelen); + newbinname[nd.ni_cnd.cn_namelen] = '\0'; imgp->vp = newtextvp; + + /* + * Do the best to calculate the full path to the image file. + */ + if (args->fname[0] == '/') { + imgp->execpath = args->fname; + } else { + VOP_UNLOCK(imgp->vp); + freepath_size = MAXPATHLEN; + if (vn_fullpath_hardlink(newtextvp, newtextdvp, + newbinname, nd.ni_cnd.cn_namelen, &imgp->execpath, + &imgp->freepath, &freepath_size) != 0) + imgp->execpath = args->fname; + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + } } else { AUDIT_ARG_FD(args->fd); /* @@ -483,6 +505,9 @@ interpret: &newtextvp); if (error) goto exec_fail; + if (vn_fullpath(imgp->vp, &imgp->execpath, + &imgp->freepath) != 0) + imgp->execpath = args->fname; vn_lock(newtextvp, LK_SHARED | LK_RETRY); AUDIT_ARG_VNODE1(newtextvp); imgp->vp = newtextvp; @@ -591,28 +616,6 @@ interpret: } /* The new credentials are installed into the process later. */ - /* - * Do the best to calculate the full path to the image file. - */ - if (args->fname != NULL) { - if (args->fname[0] == '/') { - imgp->execpath = args->fname; - } else { - VOP_UNLOCK(imgp->vp); - freepath_size = MAXPATHLEN; - if (vn_fullpath_hardlink(&nd, &imgp->execpath, - &imgp->freepath, &freepath_size) != 0) - imgp->execpath = args->fname; - vn_lock(imgp->vp, LK_SHARED | LK_RETRY); - } - } else { - VOP_UNLOCK(imgp->vp); - if (vn_fullpath(imgp->vp, &imgp->execpath, - &imgp->freepath) != 0) - imgp->execpath = args->fname; - vn_lock(imgp->vp, LK_SHARED | LK_RETRY); - } - /* * If the current process has a special image activator it * wants to try first, call it. For example, emulating shell @@ -666,10 +669,15 @@ interpret: imgp->opened = false; } vput(newtextvp); + imgp->vp = newtextvp = NULL; if (args->fname != NULL) { - if (nd.ni_dvp != NULL) - vrele(nd.ni_dvp); + if (newtextdvp != NULL) { + vrele(newtextdvp); + newtextdvp = NULL; + } NDFREE(&nd, NDF_ONLY_PNBUF); + free(newbinname, M_PARGS); + newbinname = NULL; } vm_object_deallocate(imgp->object); imgp->object = NULL; @@ -679,9 +687,6 @@ interpret: imgp->freepath = NULL; /* set new name to that of the interpreter */ args->fname = imgp->interpreter_name; - NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | - SAVENAME | WANTPARENT, - UIO_SYSSPACE, imgp->interpreter_name, td); goto interpret; } @@ -853,11 +858,17 @@ interpret: } /* - * Store the vp for use in procfs. This vnode was referenced by namei - * or fgetvp_exec. + * Store the vp for use in kern.proc.pathname. This vnode was + * referenced by namei() or fgetvp_exec(). */ oldtextvp = p->p_textvp; p->p_textvp = newtextvp; + oldtextdvp = p->p_textdvp; + p->p_textdvp = newtextdvp; + newtextdvp = NULL; + oldbinname = p->p_binname; + p->p_binname = newbinname; + newbinname = NULL; #ifdef KDTRACE_HOOKS /* @@ -930,11 +941,11 @@ exec_fail_dealloc: vput(imgp->vp); else VOP_UNLOCK(imgp->vp); - if (args->fname != NULL) { - if (nd.ni_dvp != NULL) - vrele(nd.ni_dvp); + if (args->fname != NULL) NDFREE(&nd, NDF_ONLY_PNBUF); - } + if (newtextdvp != NULL) + vrele(newtextdvp); + free(newbinname, M_PARGS); } if (imgp->object != NULL) @@ -973,6 +984,9 @@ exec_fail: */ if (oldtextvp != NULL) vrele(oldtextvp); + if (oldtextdvp != NULL) + vrele(oldtextdvp); + free(oldbinname, M_PARGS); #ifdef KTRACE ktr_io_params_free(kiop); #endif diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 47ead49bb202..0b3265cac6f1 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -424,12 +424,20 @@ exit1(struct thread *td, int rval, int signo) ktrprocexit(td); #endif /* - * Release reference to text vnode + * Release reference to text vnode etc */ if (p->p_textvp != NULL) { vrele(p->p_textvp); p->p_textvp = NULL; } + if (p->p_textdvp != NULL) { + vrele(p->p_textdvp); + p->p_textdvp = NULL; + } + if (p->p_binname != NULL) { + free(p->p_binname, M_PARGS); + p->p_binname = NULL; + } /* * Release our limits structure. diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index b2d58e804123..74b415a838ee 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -526,6 +526,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * } p2->p_textvp = p1->p_textvp; + p2->p_textdvp = p1->p_textdvp; p2->p_fd = fd; p2->p_fdtol = fdtol; p2->p_pd = pd; @@ -547,9 +548,16 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * PROC_UNLOCK(p1); PROC_UNLOCK(p2); - /* Bump references to the text vnode (for procfs). */ - if (p2->p_textvp) + /* + * Bump references to the text vnode and directory, and copy + * the hardlink name. + */ + if (p2->p_textvp != NULL) vrefact(p2->p_textvp); + if (p2->p_textdvp != NULL) + vrefact(p2->p_textdvp); + p2->p_binname = p1->p_binname == NULL ? NULL : + strdup(p1->p_binname, M_PARGS); /* * Set up linkage for kernel based threading. diff --git a/sys/sys/proc.h b/sys/sys/proc.h index b647cb1c33ef..df09f3f5d86d 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -723,6 +723,8 @@ struct proc { LIST_HEAD(, proc) p_orphans; /* (e) Pointer to list of orphans. */ TAILQ_HEAD(, kq_timer_cb_data) p_kqtim_stop; /* (c) */ + struct vnode *p_textdvp; /* (b) Dir containing textvp. */ + char *p_binname; /* (b) Binary hardlink name. */ }; #define p_session p_pgrp->pg_session From nobody Sat Nov 6 02:25:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DF076183C24E; Sat, 6 Nov 2021 02:25: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 4HmLnZ6qSWz3jPb; Sat, 6 Nov 2021 02:25: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 91D2A22BF1; Sat, 6 Nov 2021 02:25: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 1A62PMh0077496; Sat, 6 Nov 2021 02:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PMY5077495; Sat, 6 Nov 2021 02:25:22 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:22 GMT Message-Id: <202111060225.1A62PMY5077495@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: ea4e8e191c0e - stable/13 - sysctl kern.proc.procname: report right hardlink name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: ea4e8e191c0ecb12da16c34c2d14f04bc7f955c7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ea4e8e191c0ecb12da16c34c2d14f04bc7f955c7 commit ea4e8e191c0ecb12da16c34c2d14f04bc7f955c7 Author: Konstantin Belousov AuthorDate: 2021-10-23 19:01:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 sysctl kern.proc.procname: report right hardlink name PR: 248184 (cherry picked from commit ee92c8a842d61ffda8d111e1b0e398085c5bfb3a) --- sys/kern/kern_proc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 2649d1d3a58f..c4c01da1faea 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2233,32 +2235,74 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) pid_t *pidp = (pid_t *)arg1; unsigned int arglen = arg2; struct proc *p; - struct vnode *vp; - char *retbuf, *freebuf; + struct vnode *vp, *dvp; + char *retbuf, *freebuf, *binname; + struct nameidata nd; + size_t freepath_size; int error; + bool do_fullpath; if (arglen != 1) return (EINVAL); + binname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + binname[0] = '\0'; if (*pidp == -1) { /* -1 means this process */ p = req->td->td_proc; } else { error = pget(*pidp, PGET_CANSEE, &p); - if (error != 0) + if (error != 0) { + free(binname, M_TEMP); return (error); + } } vp = p->p_textvp; if (vp == NULL) { if (*pidp != -1) PROC_UNLOCK(p); + free(binname, M_TEMP); return (0); } vref(vp); + dvp = p->p_textdvp; + if (dvp != NULL) + vref(dvp); + if (p->p_binname != NULL) + strlcpy(binname, p->p_binname, MAXPATHLEN); if (*pidp != -1) PROC_UNLOCK(p); - error = vn_fullpath(vp, &retbuf, &freebuf); + do_fullpath = true; + freebuf = NULL; + if (dvp != NULL && binname[0] != '\0') { + freepath_size = MAXPATHLEN; + if (vn_fullpath_hardlink(vp, dvp, binname, strlen(binname), + &retbuf, &freebuf, &freepath_size) == 0) { + /* + * Recheck the looked up path. The binary + * might have been renamed or replaced, in + * which case we should not report old name. + */ + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, retbuf, + req->td); + error = namei(&nd); + if (error == 0) { + if (nd.ni_vp == vp) + do_fullpath = false; + vrele(nd.ni_vp); + NDFREE(&nd, NDF_ONLY_PNBUF); + } + } + } + if (do_fullpath) { + free(freebuf, M_TEMP); + freebuf = NULL; + error = vn_fullpath(vp, &retbuf, &freebuf); + } vrele(vp); - if (error) + if (dvp != NULL) + vrele(dvp); + free(binname, M_TEMP); + if (error != 0) return (error); error = SYSCTL_OUT(req, retbuf, strlen(retbuf) + 1); free(freebuf, M_TEMP); From nobody Sat Nov 6 02:25:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B0D25183C3AA; Sat, 6 Nov 2021 02:25: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 4HmLnc32M9z3jDj; Sat, 6 Nov 2021 02:25: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 AA38D22FBA; Sat, 6 Nov 2021 02:25: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 1A62PNZu077520; Sat, 6 Nov 2021 02:25:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PNok077519; Sat, 6 Nov 2021 02:25:23 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:23 GMT Message-Id: <202111060225.1A62PNok077519@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: 52e2887d1dcb - stable/13 - sys/proc.h: put proc_add_orphan() into proper place List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 52e2887d1dcb1e214eeacf09b9af401194053754 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=52e2887d1dcb1e214eeacf09b9af401194053754 commit 52e2887d1dcb1e214eeacf09b9af401194053754 Author: Konstantin Belousov AuthorDate: 2021-10-29 22:02:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 sys/proc.h: put proc_add_orphan() into proper place (cherry picked from commit b4c7d45c849071b31936fec6ec43f3d4df3ef3d8) --- sys/sys/proc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index df09f3f5d86d..a09a006b836b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1114,6 +1114,7 @@ int p_canwait(struct thread *td, struct proc *p); struct pargs *pargs_alloc(int len); void pargs_drop(struct pargs *pa); void pargs_hold(struct pargs *pa); +void proc_add_orphan(struct proc *child, struct proc *parent); int proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb); @@ -1124,7 +1125,6 @@ void proc_linkup(struct proc *p, struct thread *td); struct proc *proc_realparent(struct proc *child); void proc_reap(struct thread *td, struct proc *p, int *status, int options); void proc_reparent(struct proc *child, struct proc *newparent, bool set_oppid); -void proc_add_orphan(struct proc *child, struct proc *parent); void proc_set_traced(struct proc *p, bool stop); void proc_wkilled(struct proc *p); struct pstats *pstats_alloc(void); From nobody Sat Nov 6 02:25:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A63E7183C595; Sat, 6 Nov 2021 02:25: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 4HmLnd4TpMz3j7Z; Sat, 6 Nov 2021 02:25: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 D147B22F6B; Sat, 6 Nov 2021 02:25: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 1A62POI0077544; Sat, 6 Nov 2021 02:25:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62POhA077543; Sat, 6 Nov 2021 02:25:24 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:24 GMT Message-Id: <202111060225.1A62POhA077543@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: 0303cc4be853 - stable/13 - Extract proc_get_binpath() from sysctl_kern_proc_pathname() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 0303cc4be8538ae16c577cdeda30823ada76f802 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0303cc4be8538ae16c577cdeda30823ada76f802 commit 0303cc4be8538ae16c577cdeda30823ada76f802 Author: Konstantin Belousov AuthorDate: 2021-10-29 01:42:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 Extract proc_get_binpath() from sysctl_kern_proc_pathname() (cherry picked from commit f34fc6ba06a10e0f2a505ec0dd2f2fab2a79e53d) --- sys/kern/kern_proc.c | 89 +++++++++++++++++++++++++++++++++------------------- sys/sys/proc.h | 2 ++ 2 files changed, 58 insertions(+), 33 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index c4c01da1faea..2156c5c465ba 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2226,41 +2226,34 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARGS) } /* - * This sysctl allows a process to retrieve the path of the executable for - * itself or another process. + * Look up the canonical executable path running in the specified process. + * It tries to return the same hardlink name as was used for execve(2). + * This allows the programs that modify their behavior based on their progname, + * to operate correctly. + * + * Result is returned in retbuf, it must not be freed, similar to vn_fullpath() + * calling conventions. + * binname is a pointer to temporary string buffer of length MAXPATHLEN, + * allocated and freed by caller. + * freebuf should be freed by caller, from the M_TEMP malloc type. */ -static int -sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) +int +proc_get_binpath(struct proc *p, char *binname, char **retbuf, + char **freebuf) { - pid_t *pidp = (pid_t *)arg1; - unsigned int arglen = arg2; - struct proc *p; - struct vnode *vp, *dvp; - char *retbuf, *freebuf, *binname; struct nameidata nd; + struct vnode *vp, *dvp; size_t freepath_size; int error; bool do_fullpath; - if (arglen != 1) - return (EINVAL); - binname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - binname[0] = '\0'; - if (*pidp == -1) { /* -1 means this process */ - p = req->td->td_proc; - } else { - error = pget(*pidp, PGET_CANSEE, &p); - if (error != 0) { - free(binname, M_TEMP); - return (error); - } - } + PROC_LOCK_ASSERT(p, MA_OWNED); vp = p->p_textvp; if (vp == NULL) { - if (*pidp != -1) - PROC_UNLOCK(p); - free(binname, M_TEMP); + PROC_UNLOCK(p); + *retbuf = NULL; + *freebuf = NULL; return (0); } vref(vp); @@ -2269,20 +2262,20 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) vref(dvp); if (p->p_binname != NULL) strlcpy(binname, p->p_binname, MAXPATHLEN); - if (*pidp != -1) - PROC_UNLOCK(p); + PROC_UNLOCK(p); + do_fullpath = true; - freebuf = NULL; + *freebuf = NULL; if (dvp != NULL && binname[0] != '\0') { freepath_size = MAXPATHLEN; if (vn_fullpath_hardlink(vp, dvp, binname, strlen(binname), - &retbuf, &freebuf, &freepath_size) == 0) { + retbuf, freebuf, &freepath_size) == 0) { /* * Recheck the looked up path. The binary * might have been renamed or replaced, in * which case we should not report old name. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, retbuf, + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf, req->td); error = namei(&nd); if (error == 0) { @@ -2294,13 +2287,43 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) } } if (do_fullpath) { - free(freebuf, M_TEMP); - freebuf = NULL; - error = vn_fullpath(vp, &retbuf, &freebuf); + free(*freebuf, M_TEMP); + *freebuf = NULL; + error = vn_fullpath(vp, retbuf, freebuf); } vrele(vp); if (dvp != NULL) vrele(dvp); + return (error); +} + +/* + * This sysctl allows a process to retrieve the path of the executable for + * itself or another process. + */ +static int +sysctl_kern_proc_pathname(SYSCTL_HANDLER_ARGS) +{ + pid_t *pidp = (pid_t *)arg1; + unsigned int arglen = arg2; + struct proc *p; + char *retbuf, *freebuf, *binname; + int error; + + if (arglen != 1) + return (EINVAL); + binname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + binname[0] = '\0'; + if (*pidp == -1) { /* -1 means this process */ + error = 0; + p = req->td->td_proc; + PROC_LOCK(p); + } else { + error = pget(*pidp, PGET_CANSEE, &p); + } + + if (error == 0) + error = proc_get_binpath(p, binname, &retbuf, &freebuf); free(binname, M_TEMP); if (error != 0) return (error); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index a09a006b836b..96bd2cc8a6ce 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1115,6 +1115,8 @@ struct pargs *pargs_alloc(int len); void pargs_drop(struct pargs *pa); void pargs_hold(struct pargs *pa); void proc_add_orphan(struct proc *child, struct proc *parent); +int proc_get_binpath(struct proc *p, char *binname, char **fullpath, + char **freepath); int proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb); int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb); From nobody Sat Nov 6 02:25:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 06736183C2E3; Sat, 6 Nov 2021 02:25: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 4HmLnh1ttnz3jQ4; Sat, 6 Nov 2021 02:25: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 1CB992318F; Sat, 6 Nov 2021 02:25: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 1A62PR9B077598; Sat, 6 Nov 2021 02:25:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PRD1077597; Sat, 6 Nov 2021 02:25:27 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:27 GMT Message-Id: <202111060225.1A62PRD1077597@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: 17aab23bf799 - stable/13 - fexecve(2): restore the attempts to calculate the executable path List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 17aab23bf7996f80a52b6471d752ef1320ec25c7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=17aab23bf7996f80a52b6471d752ef1320ec25c7 commit 17aab23bf7996f80a52b6471d752ef1320ec25c7 Author: Konstantin Belousov AuthorDate: 2021-11-03 12:58:03 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 fexecve(2): restore the attempts to calculate the executable path (cherry picked from commit e4ce23b238a162f5d36afe8ef49dcd66901138a1) --- sys/kern/kern_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index cf7af148f5c8..06812a7a93d1 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -505,7 +505,7 @@ interpret: &newtextvp); if (error) goto exec_fail; - if (vn_fullpath(imgp->vp, &imgp->execpath, + if (vn_fullpath(newtextvp, &imgp->execpath, &imgp->freepath) != 0) imgp->execpath = args->fname; vn_lock(newtextvp, LK_SHARED | LK_RETRY); From nobody Sat Nov 6 02:25:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 20653183C471; Sat, 6 Nov 2021 02:25: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 4HmLnh55vvz3jSR; Sat, 6 Nov 2021 02: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 42C7022F6C; Sat, 6 Nov 2021 02: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 1A62PSas077622; Sat, 6 Nov 2021 02: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 1A62PSjf077621; Sat, 6 Nov 2021 02:25:28 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:28 GMT Message-Id: <202111060225.1A62PSjf077621@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: 392fbf5cce85 - stable/13 - proc_get_binpath(): return empty string instead of NULL List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 392fbf5cce85547824a6d514f5f8b1125094baea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=392fbf5cce85547824a6d514f5f8b1125094baea commit 392fbf5cce85547824a6d514f5f8b1125094baea Author: Konstantin Belousov AuthorDate: 2021-11-03 15:11:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 proc_get_binpath(): return empty string instead of NULL (cherry picked from commit 02de91d740235f186321d7d3e11d09737daba43e) --- sys/kern/kern_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 2156c5c465ba..d11f651960c0 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2252,7 +2252,7 @@ proc_get_binpath(struct proc *p, char *binname, char **retbuf, vp = p->p_textvp; if (vp == NULL) { PROC_UNLOCK(p); - *retbuf = NULL; + *retbuf = ""; *freebuf = NULL; return (0); } From nobody Sat Nov 6 02:25:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EBED5183C443; Sat, 6 Nov 2021 02:25: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 4HmLnf1Gclz3jX9; Sat, 6 Nov 2021 02:25: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 F15DC230DB; Sat, 6 Nov 2021 02:25: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 1A62PP5i077574; Sat, 6 Nov 2021 02:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PPen077573; Sat, 6 Nov 2021 02:25:25 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:25 GMT Message-Id: <202111060225.1A62PPen077573@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: f61af036ab29 - stable/13 - procfs: return right hardlink from /proc/curproc/file List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: f61af036ab291b558e8632bc58290b3321c2bafc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f61af036ab291b558e8632bc58290b3321c2bafc commit f61af036ab291b558e8632bc58290b3321c2bafc Author: Konstantin Belousov AuthorDate: 2021-10-29 01:43:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 procfs: return right hardlink from /proc/curproc/file PR: 248184 (cherry picked from commit e5248548f95ff1c89667847e0d945dea38adeca7) --- sys/fs/procfs/procfs.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index c492533c52bb..697bbfc9877a 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -69,22 +69,17 @@ int procfs_doprocfile(PFS_FILL_ARGS) { - char *fullpath; - char *freepath; - struct vnode *textvp; + char *fullpath, *freepath, *binpath; int error; freepath = NULL; + binpath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); PROC_LOCK(p); - textvp = p->p_textvp; - vhold(textvp); - PROC_UNLOCK(p); - error = vn_fullpath(textvp, &fullpath, &freepath); - vdrop(textvp); + error = proc_get_binpath(p, binpath, &fullpath, &freepath); if (error == 0) - sbuf_printf(sb, "%s", fullpath); - if (freepath != NULL) - free(freepath, M_TEMP); + sbuf_printf(sb, "%s", fullpath == NULL ? "" : fullpath); + free(binpath, M_TEMP); + free(freepath, M_TEMP); return (error); } From nobody Sat Nov 6 02:25:29 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BDB04183C4E3; Sat, 6 Nov 2021 02:25: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 4HmLnk05Vpz3jXZ; Sat, 6 Nov 2021 02:25: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 8D92922BF2; Sat, 6 Nov 2021 02:25: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 1A62PTYU077646; Sat, 6 Nov 2021 02:25:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PTGC077645; Sat, 6 Nov 2021 02:25:29 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:29 GMT Message-Id: <202111060225.1A62PTGC077645@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: 5291b294d323 - stable/13 - proc_get_binpath(): provide syntaxically correct value for unused NDINIT arg List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 5291b294d3237eec5a4fb625b09db624b4abf7ba Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5291b294d3237eec5a4fb625b09db624b4abf7ba commit 5291b294d3237eec5a4fb625b09db624b4abf7ba Author: Konstantin Belousov AuthorDate: 2021-11-04 00:53:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 proc_get_binpath(): provide syntaxically correct value for unused NDINIT arg (cherry picked from commit 7ac82c96fe79a6a9dcf595ef4860ed75d3511414) --- sys/kern/kern_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index d11f651960c0..21af09265dd2 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2276,7 +2276,7 @@ proc_get_binpath(struct proc *p, char *binname, char **retbuf, * which case we should not report old name. */ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf, - req->td); + curthread); error = namei(&nd); if (error == 0) { if (nd.ni_vp == vp) From nobody Sat Nov 6 02:25:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B61CF183C4E1; Sat, 6 Nov 2021 02:25: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 4HmLnk50X2z3jdJ; Sat, 6 Nov 2021 02:25: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 7F6532311F; Sat, 6 Nov 2021 02:25: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 1A62PUH5077670; Sat, 6 Nov 2021 02:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PUJs077669; Sat, 6 Nov 2021 02:25:30 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:30 GMT Message-Id: <202111060225.1A62PUJs077669@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: ba058d44b372 - stable/13 - procfs_doprocfile(): simplify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: ba058d44b3724ba3516e71ee204f806d1031eb1f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ba058d44b3724ba3516e71ee204f806d1031eb1f commit ba058d44b3724ba3516e71ee204f806d1031eb1f Author: Konstantin Belousov AuthorDate: 2021-11-04 03:58:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:32 +0000 procfs_doprocfile(): simplify (cherry picked from commit 15bd9fa3bea794054b4a5bd2f4bb71b0ba3aa3ba) --- sys/fs/procfs/procfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index 697bbfc9877a..38cfb4752279 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -77,7 +77,7 @@ procfs_doprocfile(PFS_FILL_ARGS) PROC_LOCK(p); error = proc_get_binpath(p, binpath, &fullpath, &freepath); if (error == 0) - sbuf_printf(sb, "%s", fullpath == NULL ? "" : fullpath); + sbuf_cat(sb, fullpath); free(binpath, M_TEMP); free(freepath, M_TEMP); return (error); From nobody Sat Nov 6 02:25:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6B33C183C639; Sat, 6 Nov 2021 02: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 4HmLnm24c6z3jY3; Sat, 6 Nov 2021 02:25: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 9E1E522F6D; Sat, 6 Nov 2021 02:25: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 1A62PVJf077700; Sat, 6 Nov 2021 02:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A62PV8o077699; Sat, 6 Nov 2021 02:25:31 GMT (envelope-from git) Date: Sat, 6 Nov 2021 02:25:31 GMT Message-Id: <202111060225.1A62PV8o077699@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: 9de9a3305064 - stable/13 - fexecve(2): allow O_PATH file descriptors opened without O_EXEC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 9de9a33050640a96d4ebea8d4da7089d0dfa3947 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9de9a33050640a96d4ebea8d4da7089d0dfa3947 commit 9de9a33050640a96d4ebea8d4da7089d0dfa3947 Author: Konstantin Belousov AuthorDate: 2021-11-03 12:51:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 02:12:33 +0000 fexecve(2): allow O_PATH file descriptors opened without O_EXEC (cherry picked from commit be10c0a910155709dc4e521db3349d50e0440018) --- lib/libc/sys/open.2 | 3 --- sys/kern/kern_descrip.c | 5 +++-- sys/kern/kern_exec.c | 13 ++++++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index da42c238a151..f6b061079ddf 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -334,9 +334,6 @@ but advisory locking is not allowed .It Xr close 2 .It Xr fstat 2 .It Xr fexecve 2 -requires that -.Dv O_EXEC -was also specified at open time .It Dv SCM_RIGHTS can be passed over a .Xr unix 4 diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 755b5df51c6a..794d72824cc9 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3302,8 +3302,9 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, error = EBADF; break; case FEXEC: - if ((fp->f_flag & (FREAD | FEXEC)) == 0 || - ((fp->f_flag & FWRITE) != 0)) + if (fp->f_ops != &path_fileops && + ((fp->f_flag & (FREAD | FEXEC)) == 0 || + (fp->f_flag & FWRITE) != 0)) error = EBADF; break; case 0: diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 06812a7a93d1..7b27e5b8a885 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -498,13 +498,20 @@ interpret: } } else { AUDIT_ARG_FD(args->fd); + /* - * Descriptors opened only with O_EXEC or O_RDONLY are allowed. + * If the descriptors was not opened with O_PATH, then + * we require that it was opened with O_EXEC or + * O_RDONLY. In either case, exec_check_permissions() + * below checks _current_ file access mode regardless + * of the permissions additionally checked at the + * open(2). */ error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, &newtextvp); - if (error) + if (error != 0) goto exec_fail; + if (vn_fullpath(newtextvp, &imgp->execpath, &imgp->freepath) != 0) imgp->execpath = args->fname; @@ -859,7 +866,7 @@ interpret: /* * Store the vp for use in kern.proc.pathname. This vnode was - * referenced by namei() or fgetvp_exec(). + * referenced by namei() or by fexecve variant of fname handling. */ oldtextvp = p->p_textvp; p->p_textvp = newtextvp; From nobody Sat Nov 6 03:07:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5520C1834D23; Sat, 6 Nov 2021 03:07: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 4HmMjq21CCz4Wpk; Sat, 6 Nov 2021 03:07: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 1A87823653; Sat, 6 Nov 2021 03:07: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 1A637B6m032567; Sat, 6 Nov 2021 03:07:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A637Bvn032565; Sat, 6 Nov 2021 03:07:11 GMT (envelope-from git) Date: Sat, 6 Nov 2021 03:07:11 GMT Message-Id: <202111060307.1A637Bvn032565@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: dc238358f9f4 - main - Add some of Intel Alder Lake device IDs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: dc238358f9f48ee4c983e2131656edb15636ab9e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=dc238358f9f48ee4c983e2131656edb15636ab9e commit dc238358f9f48ee4c983e2131656edb15636ab9e Author: Alexander Motin AuthorDate: 2021-11-06 03:05:15 +0000 Commit: Alexander Motin CommitDate: 2021-11-06 03:06:59 +0000 Add some of Intel Alder Lake device IDs. MFC after: 1 week --- sys/dev/ahci/ahci_pci.c | 1 + sys/dev/sound/pci/hda/hdac.c | 1 + sys/dev/sound/pci/hda/hdac.h | 3 +++ sys/dev/sound/pci/hda/hdacc.c | 2 ++ sys/dev/usb/controller/xhci_pci.c | 2 ++ 5 files changed, 9 insertions(+) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index b60119f3ab64..9e4987e38bfb 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -191,6 +191,7 @@ static const struct { {0x23a38086, 0x00, "Intel Coleto Creek", 0}, {0x31e38086, 0x00, "Intel Gemini Lake", 0}, {0x5ae38086, 0x00, "Intel Apollo Lake", 0}, + {0x7ae28086, 0x00, "Intel Alder Lake", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index cad631f4ee5d..5d3f1d85a2ad 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -112,6 +112,7 @@ static const struct { { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, { HDA_INTEL_TGLK, "Intel Tiger Lake", 0, 0 }, { HDA_INTEL_GMLK, "Intel Gemini Lake", 0, 0 }, + { HDA_INTEL_ALLK, "Intel Alder Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 06ac0371df6b..37744065fdc1 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -71,6 +71,7 @@ #define HDA_INTEL_JLK2 HDA_MODEL_CONSTRUCT(INTEL, 0x4dc8) #define HDA_INTEL_BXTNP HDA_MODEL_CONSTRUCT(INTEL, 0x5a98) #define HDA_INTEL_MACBOOKPRO92 HDA_MODEL_CONSTRUCT(INTEL, 0x7270) +#define HDA_INTEL_ALLK HDA_MODEL_CONSTRUCT(INTEL, 0x7ad0) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) #define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) #define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) @@ -575,6 +576,7 @@ #define HDA_CODEC_ALC888 HDA_CODEC_CONSTRUCT(REALTEK, 0x0888) #define HDA_CODEC_ALC889 HDA_CODEC_CONSTRUCT(REALTEK, 0x0889) #define HDA_CODEC_ALC892 HDA_CODEC_CONSTRUCT(REALTEK, 0x0892) +#define HDA_CODEC_ALC897 HDA_CODEC_CONSTRUCT(REALTEK, 0x0897) #define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899) #define HDA_CODEC_ALC1150 HDA_CODEC_CONSTRUCT(REALTEK, 0x0900) #define HDA_CODEC_ALCS1200A HDA_CODEC_CONSTRUCT(REALTEK, 0x0b00) @@ -871,6 +873,7 @@ #define HDA_CODEC_INTELGMLK1 HDA_CODEC_CONSTRUCT(INTEL, 0x280d) #define HDA_CODEC_INTELICLK HDA_CODEC_CONSTRUCT(INTEL, 0x280f) #define HDA_CODEC_INTELTGLK HDA_CODEC_CONSTRUCT(INTEL, 0x2812) +#define HDA_CODEC_INTELALLK HDA_CODEC_CONSTRUCT(INTEL, 0x2815) #define HDA_CODEC_INTELJLK HDA_CODEC_CONSTRUCT(INTEL, 0x281a) #define HDA_CODEC_INTELELLK HDA_CODEC_CONSTRUCT(INTEL, 0x281b) #define HDA_CODEC_INTELCT HDA_CODEC_CONSTRUCT(INTEL, 0x2880) diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index e663ffa3dbcf..dba60e5101bd 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -147,6 +147,7 @@ static const struct { { HDA_CODEC_ALC888, 0, "Realtek ALC888" }, { HDA_CODEC_ALC889, 0, "Realtek ALC889" }, { HDA_CODEC_ALC892, 0, "Realtek ALC892" }, + { HDA_CODEC_ALC897, 0, "Realtek ALC897" }, { HDA_CODEC_ALC899, 0, "Realtek ALC899" }, { HDA_CODEC_ALC1150, 0, "Realtek ALC1150" }, { HDA_CODEC_ALCS1200A, 0, "Realtek ALCS1200A" }, @@ -392,6 +393,7 @@ static const struct { { HDA_CODEC_INTELGMLK1, 0, "Intel Gemini Lake" }, { HDA_CODEC_INTELICLK, 0, "Intel Ice Lake" }, { HDA_CODEC_INTELTGLK, 0, "Intel Tiger Lake" }, + { HDA_CODEC_INTELALLK, 0, "Intel Alder Lake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index 615d16ee3740..7ed0420b7664 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -134,6 +134,8 @@ xhci_pci_match(device_t self) return ("Intel Gemini Lake USB 3.0 controller"); case 0x5aa88086: return ("Intel Apollo Lake USB 3.0 controller"); + case 0x7ae08086: + return ("Intel Alder Lake USB 3.2 controller"); case 0x8c318086: return ("Intel Lynx Point USB 3.0 controller"); case 0x8cb18086: From nobody Sat Nov 6 04:40:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2D3BB183AA71; Sat, 6 Nov 2021 04:40: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 4HmPnS0NhKz3GHn; Sat, 6 Nov 2021 04:40: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 E16E424EEB; Sat, 6 Nov 2021 04:40: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 1A64eRK2059863; Sat, 6 Nov 2021 04:40:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A64eRVa059862; Sat, 6 Nov 2021 04:40:27 GMT (envelope-from git) Date: Sat, 6 Nov 2021 04:40:27 GMT Message-Id: <202111060440.1A64eRVa059862@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: 8363963a8f3f - main - rtld: fix dangerous_ld_env calculation for ld_dynamic_weak List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 8363963a8f3fc8226b1e3aa627e2fdd09688704e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8363963a8f3fc8226b1e3aa627e2fdd09688704e commit 8363963a8f3fc8226b1e3aa627e2fdd09688704e Author: Konstantin Belousov AuthorDate: 2021-11-06 03:00:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 04:40:17 +0000 rtld: fix dangerous_ld_env calculation for ld_dynamic_weak Default value for ld_dynamic_weak is true, non-default settings should be activated for the false value. Reported by: obiwac@gmail.com Sponsored by: The FreeBSD Foundation MFC after: 3 days --- libexec/rtld-elf/rtld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 05afe5f42c3e..5a8e4f6bbc96 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -726,7 +726,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) } dangerous_ld_env = libmap_disable || libmap_override != NULL || ld_library_path != NULL || ld_preload != NULL || - ld_elf_hints_path != NULL || ld_loadfltr || ld_dynamic_weak; + ld_elf_hints_path != NULL || ld_loadfltr || !ld_dynamic_weak; ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); ld_utrace = ld_get_env_var(LD_UTRACE); From nobody Sat Nov 6 04:40:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 00F7A183ADF1; Sat, 6 Nov 2021 04:40: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 4HmPnT1Sd1z3GQ5; Sat, 6 Nov 2021 04:40: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 1055424EEC; Sat, 6 Nov 2021 04:40: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 1A64eSa3059887; Sat, 6 Nov 2021 04:40:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A64eSK1059886; Sat, 6 Nov 2021 04:40:28 GMT (envelope-from git) Date: Sat, 6 Nov 2021 04:40:28 GMT Message-Id: <202111060440.1A64eSK1059886@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: c5637b8be8a5 - main - rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: c5637b8be8a5b6aaf663a58b0027f7f924d78b04 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c5637b8be8a5b6aaf663a58b0027f7f924d78b04 commit c5637b8be8a5b6aaf663a58b0027f7f924d78b04 Author: Konstantin Belousov AuthorDate: 2021-11-06 03:06:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 04:40:17 +0000 rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag File descriptor we operate on might reference something that is not a file, e.g. shmfd. In this case, we cannot check MNT_NOEXEC in principle. If fstatfs(2) caused some failure on normal filesystem, then typical expectation is that read or mmap of this file would also fail. If not, mmap(2) PROT_EXEC on MNT_NOEXEC filesystem returns EACCES. Reported by: obiwac@gmail.com Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 5a8e4f6bbc96..db89a878c5f9 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2773,19 +2773,17 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp, struct statfs fs; /* - * but first, make sure that environment variables haven't been + * First, make sure that environment variables haven't been * used to circumvent the noexec flag on a filesystem. + * We ignore fstatfs(2) failures, since fd might reference + * not a file, e.g. shmfd. */ - if (dangerous_ld_env) { - if (fstatfs(fd, &fs) != 0) { - _rtld_error("Cannot fstatfs \"%s\"", printable_path(path)); - return NULL; - } - if (fs.f_flags & MNT_NOEXEC) { + if (dangerous_ld_env && fstatfs(fd, &fs) == 0 && + (fs.f_flags & MNT_NOEXEC) != 0) { _rtld_error("Cannot execute objects on %s", fs.f_mntonname); - return NULL; - } + return (NULL); } + dbg("loading \"%s\"", printable_path(path)); obj = map_object(fd, printable_path(path), sbp); if (obj == NULL) From nobody Sat Nov 6 04:40:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BFE3F183AF88; Sat, 6 Nov 2021 04:40: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 4HmPnV2XLvz3GBq; Sat, 6 Nov 2021 04:40: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 3072F24A7A; Sat, 6 Nov 2021 04:40: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 1A64eUwv059911; Sat, 6 Nov 2021 04:40:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A64eUcn059910; Sat, 6 Nov 2021 04:40:30 GMT (envelope-from git) Date: Sat, 6 Nov 2021 04:40:30 GMT Message-Id: <202111060440.1A64eUcn059910@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: 74aec9618fd7 - main - rtld: style adjustments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 74aec9618fd709513ef2d319598dd82801c29726 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=74aec9618fd709513ef2d319598dd82801c29726 commit 74aec9618fd709513ef2d319598dd82801c29726 Author: Konstantin Belousov AuthorDate: 2021-11-06 03:20:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-06 04:40:18 +0000 rtld: style adjustments Consistently use `return ()'. Fix some spacing issues with types formatting, and around binary ops. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 126 +++++++++++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index db89a878c5f9..c173c5a6e22e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -974,7 +974,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) /* Return the exit procedure and the program entry point. */ *exit_proc = rtld_exit_ptr; *objp = obj_main; - return (func_ptr_type) obj_main->entry; + return ((func_ptr_type)obj_main->entry); } void * @@ -1035,7 +1035,7 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff) */ target = reloc_jmpslot(where, target, defobj, obj, rel); lock_release(rtld_bind_lock, &lockstate); - return target; + return (target); } /* @@ -1092,8 +1092,10 @@ errmsg_restore(struct dlerror_save *saved_msg) static const char * basename(const char *name) { - const char *p = strrchr(name, '/'); - return p != NULL ? p + 1 : name; + const char *p; + + p = strrchr(name, '/'); + return (p != NULL ? p + 1 : name); } static struct utsname uts; @@ -1696,11 +1698,11 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) } if (nsegs < 1) { _rtld_error("%s: too few PT_LOAD segments", path); - return NULL; + return (NULL); } obj->entry = entry; - return obj; + return (obj); } void @@ -1761,9 +1763,9 @@ dlcheck(void *handle) if (obj == NULL || obj->refcount == 0 || obj->dl_refcount == 0) { _rtld_error("Invalid shared object handle %p", handle); - return NULL; + return (NULL); } - return obj; + return (obj); } /* @@ -1777,7 +1779,7 @@ donelist_check(DoneList *dlp, const Obj_Entry *obj) for (i = 0; i < dlp->num_used; i++) if (dlp->objs[i] == obj) - return true; + return (true); /* * Our donelist allocation should always be sufficient. But if * our threads locking isn't working properly, more shared objects @@ -1786,7 +1788,7 @@ donelist_check(DoneList *dlp, const Obj_Entry *obj) */ if (dlp->num_used < dlp->num_alloc) dlp->objs[dlp->num_used++] = obj; - return false; + return (false); } /* @@ -1806,7 +1808,7 @@ elf_hash(const char *name) h ^= g >> 24; h &= ~g; } - return h; + return (h); } /* @@ -1975,10 +1977,10 @@ find_symdef(unsigned long symnum, const Obj_Entry *refobj, * the cache. */ if (symnum >= refobj->dynsymcount) - return NULL; /* Bad object */ + return (NULL); /* Bad object */ if (cache != NULL && cache[symnum].sym != NULL) { *defobj_out = cache[symnum].obj; - return cache[symnum].sym; + return (cache[symnum].sym); } ref = refobj->symtab + symnum; @@ -2035,7 +2037,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *refobj, _rtld_error("%s: Undefined symbol \"%s%s%s\"", refobj->path, name, ve != NULL ? "@" : "", ve != NULL ? ve->name : ""); } - return def; + return (def); } /* @@ -2736,7 +2738,7 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) _rtld_error("Cannot fstat \"%s\"", printable_path(path)); close(fd); free(path); - return NULL; + return (NULL); } TAILQ_FOREACH(obj, &obj_list, next) { if (obj->marker || obj->doomed) @@ -2748,7 +2750,7 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) object_add_name(obj, name); free(path); close(fd); - return obj; + return (obj); } if (flags & RTLD_LO_NOLOAD) { free(path); @@ -2762,7 +2764,7 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) free(path); close(fd); - return obj; + return (obj); } static Obj_Entry * @@ -2787,7 +2789,7 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp, dbg("loading \"%s\"", printable_path(path)); obj = map_object(fd, printable_path(path), sbp); if (obj == NULL) - return NULL; + return (NULL); /* * If DT_SONAME is present in the object, digest_dynamic2 already @@ -2847,7 +2849,7 @@ obj_from_addr(const void *addr) if (addr < (void *)(obj->mapbase + obj->mapsize)) return obj; } - return NULL; + return (NULL); } static void @@ -3049,7 +3051,7 @@ objlist_find(Objlist *list, const Obj_Entry *obj) STAILQ_FOREACH(elm, list, link) if (elm->obj == obj) return elm; - return NULL; + return (NULL); } static void @@ -3429,7 +3431,7 @@ search_library_path(const char *name, const char *path, struct try_library_args arg; if (path == NULL) - return NULL; + return (NULL); arg.name = name; arg.namelen = strlen(name); @@ -3530,7 +3532,7 @@ dlclose_locked(void *handle, RtldLockState *lockstate) root = dlcheck(handle); if (root == NULL) - return -1; + return (-1); LD_UTRACE(UTRACE_DLCLOSE_START, handle, NULL, 0, root->dl_refcount, root->path); @@ -3554,7 +3556,7 @@ dlclose_locked(void *handle, RtldLockState *lockstate) unref_dag(root); LD_UTRACE(UTRACE_DLCLOSE_STOP, handle, NULL, 0, 0, NULL); - return 0; + return (0); } char * @@ -3772,7 +3774,7 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, objlist_clear(&initlist); if (lockstate == &mlockstate) lock_release(rtld_bind_lock, lockstate); - return obj; + return (obj); trace: trace_loaded_objects(obj); if (lockstate == &mlockstate) @@ -3811,7 +3813,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, _rtld_error("Cannot determine caller's shared object"); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); - return NULL; + return (NULL); } if (handle == NULL) { /* Just the caller's shared object. */ res = symlook_obj(&req, obj); @@ -3864,7 +3866,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, if ((obj = dlcheck(handle)) == NULL) { lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); - return NULL; + return (NULL); } donelist_init(&donelist); @@ -3924,14 +3926,14 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, ve != NULL ? ve->name : ""); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); - return NULL; + return (NULL); } void * dlsym(void *handle, const char *name) { - return do_dlsym(handle, name, __builtin_return_address(0), NULL, - SYMLOOK_DLSYM); + return (do_dlsym(handle, name, __builtin_return_address(0), NULL, + SYMLOOK_DLSYM)); } dlfunc_t @@ -3956,8 +3958,8 @@ dlvsym(void *handle, const char *name, const char *version) ventry.file = NULL; ventry.hash = elf_hash(version); ventry.flags= 0; - return do_dlsym(handle, name, __builtin_return_address(0), &ventry, - SYMLOOK_DLSYM); + return (do_dlsym(handle, name, __builtin_return_address(0), &ventry, + SYMLOOK_DLSYM)); } int @@ -3992,7 +3994,7 @@ dladdr(const void *addr, Dl_info *info) if (obj == NULL) { _rtld_error("No shared object contains address"); lock_release(rtld_bind_lock, &lockstate); - return 0; + return (0); } info->dli_fname = obj->path; info->dli_fbase = obj->mapbase; @@ -4031,7 +4033,7 @@ dladdr(const void *addr, Dl_info *info) break; } lock_release(rtld_bind_lock, &lockstate); - return 1; + return (1); } int @@ -5258,8 +5260,8 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) dtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); segbase = (Elf_Addr)(tls + roundup(tls_static_space, ralign)); - ((Elf_Addr*)segbase)[0] = segbase; - ((Elf_Addr*)segbase)[1] = (Elf_Addr) dtv; + ((Elf_Addr *)segbase)[0] = segbase; + ((Elf_Addr *)segbase)[1] = (Elf_Addr) dtv; dtv[0] = tls_dtv_generation; dtv[1] = tls_max_index; @@ -5270,18 +5272,19 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) */ oldsegbase = (Elf_Addr) oldtls; memcpy((void *)(segbase - tls_static_space), - (const void *)(oldsegbase - tls_static_space), - tls_static_space); + (const void *)(oldsegbase - tls_static_space), + tls_static_space); /* * If any dynamic TLS blocks have been created tls_get_addr(), * move them over. */ - olddtv = ((Elf_Addr**)oldsegbase)[1]; + olddtv = ((Elf_Addr **)oldsegbase)[1]; for (i = 0; i < olddtv[1]; i++) { - if (olddtv[i+2] < oldsegbase - size || olddtv[i+2] > oldsegbase) { - dtv[i+2] = olddtv[i+2]; - olddtv[i+2] = 0; + if (olddtv[i + 2] < oldsegbase - size || + olddtv[i + 2] > oldsegbase) { + dtv[i + 2] = olddtv[i + 2]; + olddtv[i + 2] = 0; } } @@ -5289,23 +5292,23 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) * We assume that this block was the one we created with * allocate_initial_tls(). */ - free_tls(oldtls, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); + free_tls(oldtls, 2 * sizeof(Elf_Addr), sizeof(Elf_Addr)); } else { for (obj = objs; obj != NULL; obj = TAILQ_NEXT(obj, next)) { if (obj->marker || obj->tlsoffset == 0) continue; addr = segbase - obj->tlsoffset; - memset((void*)(addr + obj->tlsinitsize), - 0, obj->tlssize - obj->tlsinitsize); + memset((void *)(addr + obj->tlsinitsize), + 0, obj->tlssize - obj->tlsinitsize); if (obj->tlsinit) { - memcpy((void*) addr, obj->tlsinit, obj->tlsinitsize); - obj->static_tls_copied = true; + memcpy((void *)addr, obj->tlsinit, obj->tlsinitsize); + obj->static_tls_copied = true; } dtv[obj->tlsindex + 1] = addr; } } - return (void*) segbase; + return ((void *)segbase); } void @@ -5325,18 +5328,19 @@ free_tls(void *tls, size_t tcbsize __unused, size_t tcbalign) ralign = tls_static_max_align; size = roundup(tls_static_space, ralign); - dtv = ((Elf_Addr**)tls)[1]; + dtv = ((Elf_Addr **)tls)[1]; dtvsize = dtv[1]; - tlsend = (Elf_Addr) tls; + tlsend = (Elf_Addr)tls; tlsstart = tlsend - size; for (i = 0; i < dtvsize; i++) { - if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart || dtv[i + 2] > tlsend)) { - free_aligned((void *)dtv[i + 2]); + if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart || + dtv[i + 2] > tlsend)) { + free_aligned((void *)dtv[i + 2]); } } free_aligned((void *)tlsstart); - free((void*) dtv); + free((void *)dtv); } #endif /* TLS_VARIANT_II */ @@ -5373,11 +5377,11 @@ allocate_tls_offset(Obj_Entry *obj) size_t off; if (obj->tls_done) - return true; + return (true); if (obj->tlssize == 0) { obj->tls_done = true; - return true; + return (true); } if (tls_last_offset == 0) @@ -5400,7 +5404,7 @@ allocate_tls_offset(Obj_Entry *obj) */ if (tls_static_space != 0) { if (off > tls_static_space) - return false; + return (false); } else if (obj->tlsalign > tls_static_max_align) { tls_static_max_align = obj->tlsalign; } @@ -5409,7 +5413,7 @@ allocate_tls_offset(Obj_Entry *obj) tls_last_size = obj->tlssize; obj->tls_done = true; - return true; + return (true); } void @@ -5490,7 +5494,7 @@ locate_dependency(const Obj_Entry *obj, const char *name) STAILQ_FOREACH(entry, &list_main, link) { if (object_match_name(entry->obj, name)) - return entry->obj; + return (entry->obj); } for (needed = obj->needed; needed != NULL; needed = needed->next) { @@ -5655,7 +5659,7 @@ rtld_verify_object_versions(Obj_Entry *obj) break; vn = (const Elf_Verneed *)((const char *)vn + vn->vn_next); } - return 0; + return (0); } static int @@ -5680,7 +5684,7 @@ rtld_verify_versions(const Objlist *objlist) } if (rc == 0 || ld_tracing != NULL) rc = rtld_verify_object_versions(&obj_rtld); - return rc; + return (rc); } const Ver_Entry * @@ -5694,10 +5698,10 @@ fetch_ventry(const Obj_Entry *obj, unsigned long symnum) _rtld_error("%s: symbol %s has wrong verneed value %d", obj->path, obj->strtab + symnum, vernum); } else if (obj->vertab[vernum].hash != 0) { - return &obj->vertab[vernum]; + return (&obj->vertab[vernum]); } } - return NULL; + return (NULL); } int From nobody Sat Nov 6 04:54:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A483B184195F; Sat, 6 Nov 2021 04:54: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 4HmQ5H3PM9z3LZK; Sat, 6 Nov 2021 04:54: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 5590D24BEB; Sat, 6 Nov 2021 04:54: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 1A64sBmB077958; Sat, 6 Nov 2021 04:54:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A64sB3B077957; Sat, 6 Nov 2021 04:54:11 GMT (envelope-from git) Date: Sat, 6 Nov 2021 04:54:11 GMT Message-Id: <202111060454.1A64sB3B077957@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: 6badb512a94d - main - Prefer CPUID leaf 1Fh for Intel CPU topology detection. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6badb512a94df667f0df1484fb288ece186305bd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6badb512a94df667f0df1484fb288ece186305bd commit 6badb512a94df667f0df1484fb288ece186305bd Author: Alexander Motin AuthorDate: 2021-11-06 04:48:37 +0000 Commit: Alexander Motin CommitDate: 2021-11-06 04:53:52 +0000 Prefer CPUID leaf 1Fh for Intel CPU topology detection. Leaf 1Fh is a prefered extended version of 0Bh. It is supported by new Lader Lake CPUs, though does not report anything new so far. MFC after: 2 weeks --- sys/x86/x86/mp_x86.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 7a72c501ff25..3b0e25172d0d 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -380,7 +380,7 @@ topo_probe_intel_0x4(void) /* * Determine topology of processing units for Intel CPUs - * using CPUID Leaf 11, if supported. + * using CPUID Leaf 1Fh or 0Bh, if supported. * See: * - Intel 64 Architecture Processor Topology Enumeration * - Intel 64 and IA-32 ArchitecturesSoftware Developer’s Manual, @@ -390,13 +390,23 @@ topo_probe_intel_0x4(void) static void topo_probe_intel_0xb(void) { - u_int p[4]; + u_int leaf; + u_int p[4] = { 0 }; int bits; int type; int i; - /* Fall back if CPU leaf 11 doesn't really exist. */ - cpuid_count(0x0b, 0, p); + /* Prefer leaf 1Fh (V2 Extended Topology Enumeration). */ + if (cpu_high >= 0x1f) { + leaf = 0x1f; + cpuid_count(leaf, 0, p); + } + /* Fall back to leaf 0Bh (Extended Topology Enumeration). */ + if (p[1] == 0) { + leaf = 0x0b; + cpuid_count(leaf, 0, p); + } + /* Fall back to leaf 04h (Deterministic Cache Parameters). */ if (p[1] == 0) { topo_probe_intel_0x4(); return; @@ -404,7 +414,7 @@ topo_probe_intel_0xb(void) /* We only support three levels for now. */ for (i = 0; ; i++) { - cpuid_count(0x0b, i, p); + cpuid_count(leaf, i, p); bits = p[0] & 0x1f; type = (p[2] >> 8) & 0xff; @@ -412,13 +422,12 @@ topo_probe_intel_0xb(void) if (type == 0) break; - /* TODO: check for duplicate (re-)assignment */ if (type == CPUID_TYPE_SMT) core_id_shift = bits; else if (type == CPUID_TYPE_CORE) pkg_id_shift = bits; - else - printf("unknown CPU level type %d\n", type); + else if (bootverbose) + printf("Topology level type %d shift: %d\n", type, bits); } if (pkg_id_shift < core_id_shift) { From nobody Sat Nov 6 07:53:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 83F8B184EED9; Sat, 6 Nov 2021 07:53: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 4HmV3m3LyYz3G5s; Sat, 6 Nov 2021 07:53: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 52E0027805; Sat, 6 Nov 2021 07:53: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 1A67r8Ij017328; Sat, 6 Nov 2021 07:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A67r8cO017327; Sat, 6 Nov 2021 07:53:08 GMT (envelope-from git) Date: Sat, 6 Nov 2021 07:53:08 GMT Message-Id: <202111060753.1A67r8cO017327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 0a5b6cde28dd - stable/13 - ixgbe(4): Fix a few typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a5b6cde28dd71553ddc49c0035863159f015f2d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0a5b6cde28dd71553ddc49c0035863159f015f2d commit 0a5b6cde28dd71553ddc49c0035863159f015f2d Author: Gordon Bergling AuthorDate: 2021-11-03 15:16:20 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 07:50:23 +0000 ixgbe(4): Fix a few typos in source code comments - s/Manageblility/Managebility/ - s/alows/allows/ Obtained from: NetBSD (cherry picked from commit 8da5034954911ecad0ce1e55acd3b50797bc338a) --- sys/dev/ixgbe/ixgbe_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 1eb446184990..769c47a143d8 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -1488,7 +1488,7 @@ struct ixgbe_dmac_config { #define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST) /* FACTPS */ -#define IXGBE_FACTPS_MNGCG 0x20000000 /* Manageblility Clock Gated */ +#define IXGBE_FACTPS_MNGCG 0x20000000 /* Managebility Clock Gated */ #define IXGBE_FACTPS_LFS 0x40000000 /* LAN Function Select */ /* MHADD Bit Masks */ @@ -2334,7 +2334,7 @@ enum { /* EEPROM Addressing bits based on type (0-small, 1-large) */ #define IXGBE_EEC_ADDR_SIZE 0x00000400 #define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */ -#define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD alows 14 bits for addr. */ +#define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD allows 14 bits for addr. */ #define IXGBE_EEC_SIZE_SHIFT 11 #define IXGBE_EEPROM_WORD_SIZE_SHIFT 6 From nobody Sat Nov 6 07:53:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AF951184ED53; Sat, 6 Nov 2021 07:53: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 4HmV3n4QNhz3G3K; Sat, 6 Nov 2021 07:53: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 7622527642; Sat, 6 Nov 2021 07:53: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 1A67r9P5017359; Sat, 6 Nov 2021 07:53:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A67r9RP017358; Sat, 6 Nov 2021 07:53:09 GMT (envelope-from git) Date: Sat, 6 Nov 2021 07:53:09 GMT Message-Id: <202111060753.1A67r9RP017358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: beaf14a65bb8 - stable/13 - ng_pptpgre(4): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: beaf14a65bb8c9a10328a3dd9623007ce4fecd05 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=beaf14a65bb8c9a10328a3dd9623007ce4fecd05 commit beaf14a65bb8c9a10328a3dd9623007ce4fecd05 Author: Gordon Bergling AuthorDate: 2021-11-03 16:15:59 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 07:50:54 +0000 ng_pptpgre(4): Fix a typo in a source code comment - s/mimimum/minimum/ (cherry picked from commit 40a57b00f9a76f32a271d258acec4075966eec32) --- sys/netgraph/ng_pptpgre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c index 4c3ccebd560f..f6d8a89b9fa3 100644 --- a/sys/netgraph/ng_pptpgre.c +++ b/sys/netgraph/ng_pptpgre.c @@ -128,7 +128,7 @@ typedef u_int64_t pptptime_t; #define PPTP_REORDER_TIMEOUT 1 /* When we receive a packet, we wait to see if there's an outgoing packet - we can piggy-back the ACK off of. These parameters determine the mimimum + we can piggy-back the ACK off of. These parameters determine the minimum and maxmimum length of time we're willing to wait in order to do that. These have no effect unless "enableDelayedAck" is turned on. */ #define PPTP_MIN_ACK_DELAY (PPTP_TIME_SCALE / 500) /* 2 milliseconds */ From nobody Sat Nov 6 07:53:10 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E64D1184EEE2; Sat, 6 Nov 2021 07:53: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 4HmV3q2Q3Qz3G3V; Sat, 6 Nov 2021 07:53: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 BA4F627643; Sat, 6 Nov 2021 07:53: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 1A67rATk017383; Sat, 6 Nov 2021 07:53:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A67rAiS017382; Sat, 6 Nov 2021 07:53:10 GMT (envelope-from git) Date: Sat, 6 Nov 2021 07:53:10 GMT Message-Id: <202111060753.1A67rAiS017382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 946bce41ed10 - stable/13 - gjournal(8): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 946bce41ed10cc7f9cab661d66d38fc24ee754e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=946bce41ed10cc7f9cab661d66d38fc24ee754e6 commit 946bce41ed10cc7f9cab661d66d38fc24ee754e6 Author: Gordon Bergling AuthorDate: 2021-11-03 16:14:00 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 07:51:45 +0000 gjournal(8): Fix a typo in a source code comment - s/writting/writing/ (cherry picked from commit 9d2e51884ef286bab94d48d062cf71f6a74a3f99) --- sys/geom/journal/g_journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index 97516ed293e7..e57d58d6f7ca 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2445,7 +2445,7 @@ g_journal_destroy(struct g_journal_softc *sc) if (cp->acr + cp->acw + cp->ace > 0) g_access(cp, -1, -1, -1); /* - * We keep all consumers open for writting, so if I'll detach + * We keep all consumers open for writing, so if I'll detach * and destroy consumer here, I'll get providers for taste, so * journal will be started again. * Sending an event here, prevents this from happening. From nobody Sat Nov 6 07:53:11 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6F65E184EE30; Sat, 6 Nov 2021 07:53: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 4HmV3r1C8gz3G82; Sat, 6 Nov 2021 07:53: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 C179327644; Sat, 6 Nov 2021 07:53: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 1A67rBiW017407; Sat, 6 Nov 2021 07:53:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A67rBjP017406; Sat, 6 Nov 2021 07:53:11 GMT (envelope-from git) Date: Sat, 6 Nov 2021 07:53:11 GMT Message-Id: <202111060753.1A67rBjP017406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 16f3658c7d25 - stable/13 - ocs_fs: Fix two typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 16f3658c7d250edbef7aed19f3923f0a5bc73218 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=16f3658c7d250edbef7aed19f3923f0a5bc73218 commit 16f3658c7d250edbef7aed19f3923f0a5bc73218 Author: Gordon Bergling AuthorDate: 2021-11-03 16:17:51 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 07:52:09 +0000 ocs_fs: Fix two typos in source code comments - s/maxium/maximum/ - s/maxiumum/maximum/ (cherry picked from commit 7b56cb0462c39cb190fc23e0e1190bdc89c163c8) --- sys/dev/ocs_fc/ocs_os.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h index acc1a9b1cc19..a7ad51257641 100644 --- a/sys/dev/ocs_fc/ocs_os.h +++ b/sys/dev/ocs_fc/ocs_os.h @@ -100,7 +100,7 @@ #define OCS_RSVD_INI_IO 8 #define OCS_MIN_DMA_ALIGNMENT 16 -#define OCS_MAX_DMA_ALLOC (64*1024) /* maxium DMA allocation that is expected to reliably succeed */ +#define OCS_MAX_DMA_ALLOC (64*1024) /* maximum DMA allocation that is expected to reliably succeed */ /* * Macros used to size the CQ hash table. We want to round up to the next @@ -465,7 +465,7 @@ typedef struct ocs_dma_s { * Return maximum supported DMA allocation size, given alignment * requirement. * - * @return maxiumum supported DMA allocation size + * @return maximum supported DMA allocation size */ static inline uint32_t ocs_max_dma_alloc(ocs_os_handle_t os, size_t align) { From nobody Sat Nov 6 07:53:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A7D3C184EDE2; Sat, 6 Nov 2021 07:53: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 4HmV3s0fkBz3G4D; Sat, 6 Nov 2021 07:53: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 DB92726E75; Sat, 6 Nov 2021 07:53: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 1A67rCuB017431; Sat, 6 Nov 2021 07:53:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A67rCDc017430; Sat, 6 Nov 2021 07:53:12 GMT (envelope-from git) Date: Sat, 6 Nov 2021 07:53:12 GMT Message-Id: <202111060753.1A67rCDc017430@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: d843e777a5f3 - stable/13 - netinet: Fix a common typo in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d843e777a5f321d9eac702bf85f580faee1291cd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d843e777a5f321d9eac702bf85f580faee1291cd commit d843e777a5f321d9eac702bf85f580faee1291cd Author: Gordon Bergling AuthorDate: 2021-11-03 15:21:49 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 07:52:38 +0000 netinet: Fix a common typo in source code comments - s/writting/writing/ (cherry picked from commit bb91496a85176cfc005cf141fe1262c9ad5507d4) --- sys/netinet/sctputil.c | 4 ++-- sys/netinet/tcp_subr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index a598741f062f..42e91e10a0d9 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -7456,7 +7456,7 @@ sctp_over_udp_stop(void) { /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() - * for writting! + * for writing! */ #ifdef INET if (SCTP_BASE_INFO(udp4_tun_socket) != NULL) { @@ -7485,7 +7485,7 @@ sctp_over_udp_start(void) #endif /* * This function assumes sysctl caller holds sctp_sysctl_info_lock() - * for writting! + * for writing! */ port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port); if (ntohs(port) == 0) { diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index c3afb3a1567a..f435ced03e09 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -719,7 +719,7 @@ tcp_over_udp_stop(void) { /* * This function assumes sysctl caller holds inp_rinfo_lock() - * for writting! + * for writing! */ #ifdef INET if (V_udp4_tun_socket != NULL) { @@ -748,7 +748,7 @@ tcp_over_udp_start(void) #endif /* * This function assumes sysctl caller holds inp_info_rlock() - * for writting! + * for writing! */ port = V_tcp_udp_tunneling_port; if (ntohs(port) == 0) { From nobody Sat Nov 6 07:53:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2BC45184EEFE; Sat, 6 Nov 2021 07:53: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 4HmV3t2SDJz3GY1; Sat, 6 Nov 2021 07:53: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 10687275E7; Sat, 6 Nov 2021 07:53: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 1A67rDbM017455; Sat, 6 Nov 2021 07:53:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A67rDuu017454; Sat, 6 Nov 2021 07:53:13 GMT (envelope-from git) Date: Sat, 6 Nov 2021 07:53:13 GMT Message-Id: <202111060753.1A67rDuu017454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: e3f2519c5ca8 - stable/13 - Fix a common typo in syctl descriptions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e3f2519c5ca8acee483c5ae2b097e43cc3c81c39 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e3f2519c5ca8acee483c5ae2b097e43cc3c81c39 commit e3f2519c5ca8acee483c5ae2b097e43cc3c81c39 Author: Gordon Bergling AuthorDate: 2021-11-03 19:49:24 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 07:52:57 +0000 Fix a common typo in syctl descriptions - s/maxiumum/maximum/ (cherry picked from commit c28e39c3d6d10a72800b7f49c23453fcc1bca8cc) --- sys/netinet/tcp_stacks/bbr.c | 2 +- sys/netinet/tcp_stacks/rack.c | 2 +- sys/vm/vm_glue.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index ac8e3423ebbb..c9266aa81d13 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -1666,7 +1666,7 @@ bbr_init_sysctls(void) SYSCTL_CHILDREN(bbr_timeout), OID_AUTO, "maxrto", CTLFLAG_RW, &bbr_rto_max_sec, 4, - "Maxiumum RTO in seconds -- should be at least as large as min_rto"); + "Maximum RTO in seconds -- should be at least as large as min_rto"); SYSCTL_ADD_S32(&bbr_sysctl_ctx, SYSCTL_CHILDREN(bbr_timeout), OID_AUTO, "tlp_retry", CTLFLAG_RW, diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 2f4668b027da..a09789bacfbd 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -1313,7 +1313,7 @@ rack_init_sysctls(void) SYSCTL_CHILDREN(rack_timers), OID_AUTO, "maxrto", CTLFLAG_RW, &rack_rto_max, 4000000, - "Maxiumum RTO in microseconds -- should be at least as large as min_rto"); + "Maximum RTO in microseconds -- should be at least as large as min_rto"); SYSCTL_ADD_S32(&rack_sysctl_ctx, SYSCTL_CHILDREN(rack_timers), OID_AUTO, "minto", CTLFLAG_RW, diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 7cfb08246f9e..a5d837456986 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -492,7 +492,7 @@ static int max_kstack_used; SYSCTL_INT(_debug, OID_AUTO, max_kstack_used, CTLFLAG_RD, &max_kstack_used, 0, - "Maxiumum stack depth used by a thread in kernel"); + "Maximum stack depth used by a thread in kernel"); void intr_prof_stack_use(struct thread *td, struct trapframe *frame) From nobody Sat Nov 6 08:02:02 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 626F7182C199; Sat, 6 Nov 2021 08:02: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 4HmVG22PVRz3KbG; Sat, 6 Nov 2021 08: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 3398727B00; Sat, 6 Nov 2021 08: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 1A6822GY028841; Sat, 6 Nov 2021 08: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 1A6822Zg028840; Sat, 6 Nov 2021 08:02:02 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:02:02 GMT Message-Id: <202111060802.1A6822Zg028840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 491b53157918 - stable/12 - ixgbe(4): Fix a few typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 491b531579183756ca53964c0930d3c65d40299d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=491b531579183756ca53964c0930d3c65d40299d commit 491b531579183756ca53964c0930d3c65d40299d Author: Gordon Bergling AuthorDate: 2021-11-03 15:16:20 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 08:00:09 +0000 ixgbe(4): Fix a few typos in source code comments - s/Manageblility/Managebility/ - s/alows/allows/ Obtained from: NetBSD (cherry picked from commit 8da5034954911ecad0ce1e55acd3b50797bc338a) --- sys/dev/ixgbe/ixgbe_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 1eb446184990..769c47a143d8 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -1488,7 +1488,7 @@ struct ixgbe_dmac_config { #define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST) /* FACTPS */ -#define IXGBE_FACTPS_MNGCG 0x20000000 /* Manageblility Clock Gated */ +#define IXGBE_FACTPS_MNGCG 0x20000000 /* Managebility Clock Gated */ #define IXGBE_FACTPS_LFS 0x40000000 /* LAN Function Select */ /* MHADD Bit Masks */ @@ -2334,7 +2334,7 @@ enum { /* EEPROM Addressing bits based on type (0-small, 1-large) */ #define IXGBE_EEC_ADDR_SIZE 0x00000400 #define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */ -#define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD alows 14 bits for addr. */ +#define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD allows 14 bits for addr. */ #define IXGBE_EEC_SIZE_SHIFT 11 #define IXGBE_EEPROM_WORD_SIZE_SHIFT 6 From nobody Sat Nov 6 08:02:03 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E385C182C3C0; Sat, 6 Nov 2021 08: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 4HmVG34XgKz3L5s; Sat, 6 Nov 2021 08: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 5A267276CF; Sat, 6 Nov 2021 08: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 1A6823UF029876; Sat, 6 Nov 2021 08:02:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6823Lr029864; Sat, 6 Nov 2021 08:02:03 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:02:03 GMT Message-Id: <202111060802.1A6823Lr029864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 38294bd79689 - stable/12 - ng_pptpgre(4): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 38294bd796896332fe0e9df82cc09aae8e0accda Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=38294bd796896332fe0e9df82cc09aae8e0accda commit 38294bd796896332fe0e9df82cc09aae8e0accda Author: Gordon Bergling AuthorDate: 2021-11-03 16:15:59 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 08:00:35 +0000 ng_pptpgre(4): Fix a typo in a source code comment - s/mimimum/minimum/ (cherry picked from commit 40a57b00f9a76f32a271d258acec4075966eec32) --- sys/netgraph/ng_pptpgre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c index 6ad7516a5dbc..21570afcbb77 100644 --- a/sys/netgraph/ng_pptpgre.c +++ b/sys/netgraph/ng_pptpgre.c @@ -128,7 +128,7 @@ typedef u_int64_t pptptime_t; #define PPTP_REORDER_TIMEOUT 1 /* When we receive a packet, we wait to see if there's an outgoing packet - we can piggy-back the ACK off of. These parameters determine the mimimum + we can piggy-back the ACK off of. These parameters determine the minimum and maxmimum length of time we're willing to wait in order to do that. These have no effect unless "enableDelayedAck" is turned on. */ #define PPTP_MIN_ACK_DELAY (PPTP_TIME_SCALE / 500) /* 2 milliseconds */ From nobody Sat Nov 6 08:02:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D1A14182BF77; Sat, 6 Nov 2021 08:02: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 4HmVG444MXz3KnS; Sat, 6 Nov 2021 08: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 66E9027B02; Sat, 6 Nov 2021 08: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 1A68244d031158; Sat, 6 Nov 2021 08: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 1A6824qZ031147; Sat, 6 Nov 2021 08:02:04 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:02:04 GMT Message-Id: <202111060802.1A6824qZ031147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 7c2c8a529aea - stable/12 - gjournal(8): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 7c2c8a529aeacc370310faaaf8a265a90dad8e61 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7c2c8a529aeacc370310faaaf8a265a90dad8e61 commit 7c2c8a529aeacc370310faaaf8a265a90dad8e61 Author: Gordon Bergling AuthorDate: 2021-11-03 16:14:00 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 08:00:57 +0000 gjournal(8): Fix a typo in a source code comment - s/writting/writing/ (cherry picked from commit 9d2e51884ef286bab94d48d062cf71f6a74a3f99) --- sys/geom/journal/g_journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index 0f23926254bd..6532c2cd03e6 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2437,7 +2437,7 @@ g_journal_destroy(struct g_journal_softc *sc) if (cp->acr + cp->acw + cp->ace > 0) g_access(cp, -1, -1, -1); /* - * We keep all consumers open for writting, so if I'll detach + * We keep all consumers open for writing, so if I'll detach * and destroy consumer here, I'll get providers for taste, so * journal will be started again. * Sending an event here, prevents this from happening. From nobody Sat Nov 6 08:02:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A12AF182C054; Sat, 6 Nov 2021 08:02: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 4HmVG65Vb2z3KyB; Sat, 6 Nov 2021 08:02: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 85706271E6; Sat, 6 Nov 2021 08: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 1A6825Ts031299; Sat, 6 Nov 2021 08: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 1A6825eL031298; Sat, 6 Nov 2021 08:02:05 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:02:05 GMT Message-Id: <202111060802.1A6825eL031298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: de4dfbccbc00 - stable/12 - ocs_fs: Fix two typos in source code comments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/12 X-Git-Reftype: branch X-Git-Commit: de4dfbccbc00633d86e20c844687487efde2ab08 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=de4dfbccbc00633d86e20c844687487efde2ab08 commit de4dfbccbc00633d86e20c844687487efde2ab08 Author: Gordon Bergling AuthorDate: 2021-11-03 16:17:51 +0000 Commit: Gordon Bergling CommitDate: 2021-11-06 08:01:21 +0000 ocs_fs: Fix two typos in source code comments - s/maxium/maximum/ - s/maxiumum/maximum/ (cherry picked from commit 7b56cb0462c39cb190fc23e0e1190bdc89c163c8) --- sys/dev/ocs_fc/ocs_os.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_os.h b/sys/dev/ocs_fc/ocs_os.h index b59e242b3456..26da70cc3207 100644 --- a/sys/dev/ocs_fc/ocs_os.h +++ b/sys/dev/ocs_fc/ocs_os.h @@ -100,7 +100,7 @@ #define OCS_RSVD_INI_IO 8 #define OCS_MIN_DMA_ALIGNMENT 16 -#define OCS_MAX_DMA_ALLOC (64*1024) /* maxium DMA allocation that is expected to reliably succeed */ +#define OCS_MAX_DMA_ALLOC (64*1024) /* maximum DMA allocation that is expected to reliably succeed */ /* * Macros used to size the CQ hash table. We want to round up to the next @@ -466,7 +466,7 @@ typedef struct ocs_dma_s { * Return maximum supported DMA allocation size, given alignment * requirement. * - * @return maxiumum supported DMA allocation size + * @return maximum supported DMA allocation size */ static inline uint32_t ocs_max_dma_alloc(ocs_os_handle_t os, size_t align) { From nobody Sat Nov 6 08:11:27 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 544E71834377; Sat, 6 Nov 2021 08:11: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 4HmVSw0VF5z3Q6q; Sat, 6 Nov 2021 08:11: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 DCD2B2794D; Sat, 6 Nov 2021 08:11: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 1A68BRc6041041; Sat, 6 Nov 2021 08:11:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68BRPA041040; Sat, 6 Nov 2021 08:11:27 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:11:27 GMT Message-Id: <202111060811.1A68BRPA041040@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: 849faf4e0ba9 - main - ossl: Add support for AES-CBC cipher List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 849faf4e0ba9a8b8f24ff34da93a0fd46c14eda9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=849faf4e0ba9a8b8f24ff34da93a0fd46c14eda9 commit 849faf4e0ba9a8b8f24ff34da93a0fd46c14eda9 Author: Kornel Duleba AuthorDate: 2021-11-02 11:53:22 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 08:08:44 +0000 ossl: Add support for AES-CBC cipher AES-CBC OpenSSL assembly is used underneath. The glue layer(ossl_aes.c) is based on CHACHA20 implementation. Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic does not have a fallback implementation in case CPU doesn't support required instructions. Because of that CPU caps are checked during initialization and AES support is advertised only if available. The feature is available on all architectures that ossl supports: i386, amd64, arm64. The biggest advantage of this patch over existing solutions (aesni(4) and armv8crypto(4)) is that it supports SHA, allowing for ETA operations. Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: jhb Differential revision: https://reviews.freebsd.org/D32099 --- share/man/man4/ossl.4 | 4 +- sys/conf/files | 1 + sys/conf/files.amd64 | 1 + sys/conf/files.arm64 | 4 + sys/conf/files.i386 | 1 + sys/crypto/openssl/ossl.c | 94 +++++++++++++++++------ sys/crypto/openssl/ossl.h | 36 ++++++++- sys/crypto/openssl/ossl_aarch64.c | 23 +++++- sys/crypto/openssl/ossl_aarch64.h | 31 ++++++++ sys/crypto/openssl/ossl_aes.c | 153 +++++++++++++++++++++++++++++++++++++ sys/crypto/openssl/ossl_chacha20.c | 18 ++++- sys/crypto/openssl/ossl_cipher.h | 53 +++++++++++++ sys/crypto/openssl/ossl_x86.c | 15 +++- sys/crypto/openssl/ossl_x86.h | 20 +++++ sys/modules/ossl/Makefile | 14 ++++ tests/sys/opencrypto/cryptotest.py | 2 +- 16 files changed, 436 insertions(+), 34 deletions(-) diff --git a/share/man/man4/ossl.4 b/share/man/man4/ossl.4 index 5929e46e9fe3..039ce301ac29 100644 --- a/share/man/man4/ossl.4 +++ b/share/man/man4/ossl.4 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2021 +.Dd September 24, 2021 .Dt OSSL 4 .Os .Sh NAME @@ -74,6 +74,8 @@ driver includes support for the following algorithms: .Pp .Bl -bullet -compact .It +AES-CBC +.It ChaCha20 .It ChaCha20-Poly1305 (RFC 8439) diff --git a/sys/conf/files b/sys/conf/files index f2663fd1c6c0..9743341f6e45 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -716,6 +716,7 @@ crypto/chacha20/chacha-sw.c optional crypto | ipsec | ipsec_support crypto/des/des_ecb.c optional netsmb crypto/des/des_setkey.c optional netsmb crypto/openssl/ossl.c optional ossl +crypto/openssl/ossl_aes.c optional ossl crypto/openssl/ossl_chacha20.c optional ossl crypto/openssl/ossl_poly1305.c optional ossl crypto/openssl/ossl_sha1.c optional ossl diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 37ff6404cdba..6b51c1a5a55d 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -88,6 +88,7 @@ cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/des/des_enc.c optional netsmb +crypto/openssl/amd64/aesni-x86_64.S optional ossl crypto/openssl/amd64/chacha-x86_64.S optional ossl crypto/openssl/amd64/poly1305-x86_64.S optional ossl crypto/openssl/amd64/sha1-x86_64.S optional ossl diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index b363b800af67..c1f99382863a 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -128,6 +128,8 @@ ghashv8-armx.o optional armv8crypto \ crypto/des/des_enc.c optional netsmb crypto/openssl/ossl_aarch64.c optional ossl +crypto/openssl/aarch64/aesv8-armx.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} -march=armv8-a+crypto ${.IMPSRC}" crypto/openssl/aarch64/chacha-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" crypto/openssl/aarch64/poly1305-armv8.S optional ossl \ @@ -138,6 +140,8 @@ crypto/openssl/aarch64/sha256-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" crypto/openssl/aarch64/sha512-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" +crypto/openssl/aarch64/vpaes-armv8.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" dev/acpica/acpi_bus_if.m optional acpi dev/acpica/acpi_if.m optional acpi diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index e83bcd5a3492..0c681d6a84a0 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -15,6 +15,7 @@ cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_i386.S optional aesni crypto/des/arch/i386/des_enc.S optional netsmb +crypto/openssl/i386/aesni-x86.S optional ossl crypto/openssl/i386/chacha-x86.S optional ossl crypto/openssl/i386/poly1305-x86.S optional ossl crypto/openssl/i386/sha1-586.S optional ossl diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index ad9b93dd960d..f46b5a966bb1 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -49,24 +49,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "cryptodev_if.h" -struct ossl_softc { - int32_t sc_cid; -}; - -struct ossl_session_hash { - struct ossl_hash_context ictx; - struct ossl_hash_context octx; - struct auth_hash *axf; - u_int mlen; -}; - -struct ossl_session { - struct ossl_session_hash hash; -}; - static MALLOC_DEFINE(M_OSSL, "ossl", "OpenSSL crypto"); static void @@ -92,7 +78,7 @@ ossl_attach(device_t dev) sc = device_get_softc(dev); - ossl_cpuid(); + ossl_cpuid(sc); sc->sc_cid = crypto_get_driverid(dev, sizeof(struct ossl_session), CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | CRYPTOCAP_F_ACCEL_SOFTWARE); @@ -143,9 +129,34 @@ ossl_lookup_hash(const struct crypto_session_params *csp) } } +static struct ossl_cipher* +ossl_lookup_cipher(const struct crypto_session_params *csp) +{ + + switch (csp->csp_cipher_alg) { + case CRYPTO_AES_CBC: + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + return (NULL); + } + return (&ossl_cipher_aes_cbc); + case CRYPTO_CHACHA20: + if (csp->csp_cipher_klen != CHACHA_KEY_SIZE) + return (NULL); + return (&ossl_cipher_chacha20); + default: + return (NULL); + } +} + static int ossl_probesession(device_t dev, const struct crypto_session_params *csp) { + struct ossl_softc *sc = device_get_softc(dev); if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) != 0) @@ -156,14 +167,10 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); break; case CSP_MODE_CIPHER: - switch (csp->csp_cipher_alg) { - case CRYPTO_CHACHA20: - if (csp->csp_cipher_klen != CHACHA_KEY_SIZE) - return (EINVAL); - break; - default: + if (csp->csp_cipher_alg != CRYPTO_CHACHA20 && !sc->has_aes) + return (EINVAL); + if (ossl_lookup_cipher(csp) == NULL) return (EINVAL); - } break; case CSP_MODE_AEAD: switch (csp->csp_cipher_alg) { @@ -213,20 +220,57 @@ ossl_newsession_hash(struct ossl_session *s, } } +static int +ossl_newsession_cipher(struct ossl_session *s, + const struct crypto_session_params *csp) +{ + struct ossl_cipher *cipher; + int error = 0; + + cipher = ossl_lookup_cipher(csp); + if (cipher == NULL) + return (EINVAL); + + s->cipher.cipher = cipher; + + if (csp->csp_cipher_key == NULL) + return (0); + + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); + if (cipher->set_encrypt_key != NULL) { + error = cipher->set_encrypt_key(csp->csp_cipher_key, + 8 * csp->csp_cipher_klen, &s->cipher.enc_ctx); + if (error != 0) { + fpu_kern_leave(curthread, NULL); + return (error); + } + } + if (cipher->set_decrypt_key != NULL) + error = cipher->set_decrypt_key(csp->csp_cipher_key, + 8 * csp->csp_cipher_klen, &s->cipher.dec_ctx); + fpu_kern_leave(curthread, NULL); + + return (error); +} + static int ossl_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { struct ossl_session *s; + int error = 0; s = crypto_get_driver_session(cses); switch (csp->csp_mode) { case CSP_MODE_DIGEST: ossl_newsession_hash(s, csp); break; + case CSP_MODE_CIPHER: + error = ossl_newsession_cipher(s, csp); + break; } - return (0); + return (error); } static int @@ -320,7 +364,7 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) error = ossl_process_hash(s, crp, csp); break; case CSP_MODE_CIPHER: - error = ossl_chacha20(crp, csp); + error = s->cipher.cipher->process(&s->cipher, crp, csp); break; case CSP_MODE_AEAD: if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) diff --git a/sys/crypto/openssl/ossl.h b/sys/crypto/openssl/ossl.h index 11793dca037a..4f5353818add 100644 --- a/sys/crypto/openssl/ossl.h +++ b/sys/crypto/openssl/ossl.h @@ -36,20 +36,47 @@ struct cryptop; struct crypto_session_params; +struct ossl_softc; +struct ossl_session; -int ossl_chacha20(struct cryptop *crp, - const struct crypto_session_params *csp); int ossl_chacha20_poly1305_decrypt(struct cryptop *crp, const struct crypto_session_params *csp); int ossl_chacha20_poly1305_encrypt(struct cryptop *crp, const struct crypto_session_params *csp); -void ossl_cpuid(void); +void ossl_cpuid(struct ossl_softc *sc); + +struct ossl_softc { + int32_t sc_cid; + bool has_aes; +}; /* Needs to be big enough to hold any hash context. */ struct ossl_hash_context { uint32_t dummy[61]; } __aligned(32); +struct ossl_cipher_context { + uint32_t dummy[61]; +} __aligned(32); + +struct ossl_session_hash { + struct ossl_hash_context ictx; + struct ossl_hash_context octx; + struct auth_hash *axf; + u_int mlen; +}; + +struct ossl_session_cipher { + struct ossl_cipher_context dec_ctx; + struct ossl_cipher_context enc_ctx; + struct ossl_cipher *cipher; +}; + +struct ossl_session { + struct ossl_session_cipher cipher; + struct ossl_session_hash hash; +}; + extern struct auth_hash ossl_hash_poly1305; extern struct auth_hash ossl_hash_sha1; extern struct auth_hash ossl_hash_sha224; @@ -57,4 +84,7 @@ extern struct auth_hash ossl_hash_sha256; extern struct auth_hash ossl_hash_sha384; extern struct auth_hash ossl_hash_sha512; +extern struct ossl_cipher ossl_cipher_aes_cbc; +extern struct ossl_cipher ossl_cipher_chacha20; + #endif /* !__OSSL_H__ */ diff --git a/sys/crypto/openssl/ossl_aarch64.c b/sys/crypto/openssl/ossl_aarch64.c index 2a45a848808a..e4b87a75a403 100644 --- a/sys/crypto/openssl/ossl_aarch64.c +++ b/sys/crypto/openssl/ossl_aarch64.c @@ -36,6 +36,7 @@ #include #include +#include #include /* @@ -43,8 +44,14 @@ */ unsigned int OPENSSL_armcap_P; +ossl_cipher_setkey_t aes_v8_set_encrypt_key; +ossl_cipher_setkey_t aes_v8_set_decrypt_key; + +ossl_cipher_setkey_t vpaes_set_encrypt_key; +ossl_cipher_setkey_t vpaes_set_decrypt_key; + void -ossl_cpuid(void) +ossl_cpuid(struct ossl_softc *sc) { /* SHA features */ if ((elf_hwcap & HWCAP_SHA1) != 0) @@ -59,4 +66,18 @@ ossl_cpuid(void) OPENSSL_armcap_P |= ARMV8_AES; if ((elf_hwcap & HWCAP_PMULL) != 0) OPENSSL_armcap_P |= ARMV8_PMULL; + + if ((OPENSSL_armcap_P & ARMV8_AES) == 0 && + (OPENSSL_armcap_P & ARMV7_NEON) == 0) { + sc->has_aes = false; + return; + } + sc->has_aes = true; + if (OPENSSL_armcap_P & ARMV8_AES) { + ossl_cipher_aes_cbc.set_encrypt_key = aes_v8_set_encrypt_key; + ossl_cipher_aes_cbc.set_decrypt_key = aes_v8_set_decrypt_key; + } else { + ossl_cipher_aes_cbc.set_encrypt_key = vpaes_set_encrypt_key; + ossl_cipher_aes_cbc.set_decrypt_key = vpaes_set_decrypt_key; + } } diff --git a/sys/crypto/openssl/ossl_aarch64.h b/sys/crypto/openssl/ossl_aarch64.h new file mode 100644 index 000000000000..f933f862d009 --- /dev/null +++ b/sys/crypto/openssl/ossl_aarch64.h @@ -0,0 +1,31 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef __OSSL_AARCH64__ +#define __OSSL_AARCH64__ + +#include +#include +#include + +/* aesv8-armx.S */ +ossl_cipher_encrypt_t aes_v8_cbc_encrypt; +/* vpaes-armv8.S */ +ossl_cipher_encrypt_t vpaes_cbc_encrypt; + +static void +AES_CBC_ENCRYPT(const unsigned char *in, unsigned char *out, + size_t length, const void *key, unsigned char *iv, int encrypt) +{ + if (OPENSSL_armcap_P & ARMV8_AES) + aes_v8_cbc_encrypt(in, out, length, key, iv, encrypt); + else + vpaes_cbc_encrypt(in, out, length, key, iv, encrypt); +} +#endif diff --git a/sys/crypto/openssl/ossl_aes.c b/sys/crypto/openssl/ossl_aes.c new file mode 100644 index 000000000000..93f16e7dce55 --- /dev/null +++ b/sys/crypto/openssl/ossl_aes.c @@ -0,0 +1,153 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Stormshield. + * Copyright (c) 2021 Semihalf. + * + * 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 ``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 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 + +#if defined(__amd64__) || defined(__i386__) +#include +#elif defined (__aarch64__) +#include +#endif + +static ossl_cipher_process_t ossl_aes_cbc; + +struct ossl_cipher ossl_cipher_aes_cbc = { + .type = CRYPTO_AES_CBC, + .blocksize = AES_BLOCK_LEN, + .ivsize = AES_BLOCK_LEN, + + /* Filled during initialization based on CPU caps. */ + .set_encrypt_key = NULL, + .set_decrypt_key = NULL, + .process = ossl_aes_cbc +}; + +static int +ossl_aes_cbc(struct ossl_session_cipher *s, struct cryptop *crp, + const struct crypto_session_params *csp) +{ + struct crypto_buffer_cursor cc_in, cc_out; + unsigned char block[EALG_MAX_BLOCK_LEN]; + unsigned char iv[EALG_MAX_BLOCK_LEN]; + const unsigned char *in, *inseg; + unsigned char *out, *outseg; + size_t plen, seglen, inlen, outlen; + struct ossl_cipher_context key; + struct ossl_cipher *cipher; + int blocklen, error; + bool encrypt; + + cipher = s->cipher; + encrypt = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); + plen = crp->crp_payload_length; + blocklen = cipher->blocksize; + + if (plen % blocklen) + return (EINVAL); + + if (crp->crp_cipher_key != NULL) { + if (encrypt) + error = cipher->set_encrypt_key(crp->crp_cipher_key, + 8 * csp->csp_cipher_klen, &key); + else + error = cipher->set_decrypt_key(crp->crp_cipher_key, + 8 * csp->csp_cipher_klen, &key); + if (error) + return (error); + } else { + if (encrypt) + key = s->enc_ctx; + else + key = s->dec_ctx; + } + + crypto_read_iv(crp, iv); + + /* Derived from ossl_chacha20.c */ + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + inseg = crypto_cursor_segment(&cc_in, &inlen); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + crypto_cursor_init(&cc_out, &crp->crp_obuf); + crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); + } else { + cc_out = cc_in; + } + outseg = crypto_cursor_segment(&cc_out, &outlen); + + while (plen >= blocklen) { + if (inlen < blocklen) { + crypto_cursor_copydata(&cc_in, blocklen, block); + in = block; + inlen = blocklen; + } else { + in = inseg; + } + if (outlen < blocklen) { + out = block; + outlen = blocklen; + } else { + out = outseg; + } + + /* Figure out how many blocks we can encrypt/decrypt at once. */ + seglen = rounddown(MIN(plen, MIN(inlen, outlen)), blocklen); + + AES_CBC_ENCRYPT(in, out, seglen, &key, iv, encrypt); + + if (out == block) { + crypto_cursor_copyback(&cc_out, blocklen, block); + outseg = crypto_cursor_segment(&cc_out, &outlen); + } else { + crypto_cursor_advance(&cc_out, seglen); + outseg += seglen; + outlen -= seglen; + } + if (in == block) { + inseg = crypto_cursor_segment(&cc_in, &inlen); + } else { + crypto_cursor_advance(&cc_in, seglen); + inseg += seglen; + inlen -= seglen; + } + plen -= seglen; + } + + explicit_bzero(block, sizeof(block)); + explicit_bzero(iv, sizeof(iv)); + explicit_bzero(&key, sizeof(key)); + return (0); +} diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index aa125121e8b4..c21a28470a26 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -37,10 +37,24 @@ #include #include +#include #include -int -ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) +static ossl_cipher_process_t ossl_chacha20; + +struct ossl_cipher ossl_cipher_chacha20 = { + .type = CRYPTO_CHACHA20, + .blocksize = CHACHA_BLK_SIZE, + .ivsize = CHACHA_CTR_SIZE, + + .set_encrypt_key = NULL, + .set_decrypt_key = NULL, + .process = ossl_chacha20 +}; + +static int +ossl_chacha20(struct ossl_session_cipher *s, struct cryptop *crp, + const struct crypto_session_params *csp) { _Alignas(8) unsigned int key[CHACHA_KEY_SIZE / 4]; unsigned int counter[CHACHA_CTR_SIZE / 4]; diff --git a/sys/crypto/openssl/ossl_cipher.h b/sys/crypto/openssl/ossl_cipher.h new file mode 100644 index 000000000000..d9e6ec29aafc --- /dev/null +++ b/sys/crypto/openssl/ossl_cipher.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Stormshield. + * Copyright (c) 2021 Semihalf. + * + * 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 ``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 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 __OSSL_CIPHER_H__ +#define __OSSL_CIPHER_H__ + +struct ossl_session_cipher; +struct cryptop; +struct crypto_session_params; + +typedef int (ossl_cipher_setkey_t)(const unsigned char*, int, void*); +typedef int (ossl_cipher_process_t)(struct ossl_session_cipher*, struct cryptop*, + const struct crypto_session_params*); +typedef void (ossl_cipher_encrypt_t)(const unsigned char*, unsigned char*, size_t, + const void*, unsigned char*, int); + +ossl_cipher_encrypt_t ossl_aes_cbc_encrypt; + +struct ossl_cipher { + int type; + uint16_t blocksize; + uint16_t ivsize; + + ossl_cipher_setkey_t *set_encrypt_key; + ossl_cipher_setkey_t *set_decrypt_key; + ossl_cipher_process_t *process; +}; + +#endif diff --git a/sys/crypto/openssl/ossl_x86.c b/sys/crypto/openssl/ossl_x86.c index 60ff6fa0c759..a1e9a995948b 100644 --- a/sys/crypto/openssl/ossl_x86.c +++ b/sys/crypto/openssl/ossl_x86.c @@ -39,6 +39,7 @@ #include #include +#include /* * See OPENSSL_ia32cap(3). @@ -49,9 +50,13 @@ * [3] = 0 */ unsigned int OPENSSL_ia32cap_P[4]; +#define AESNI_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32))) + +ossl_cipher_setkey_t aesni_set_encrypt_key; +ossl_cipher_setkey_t aesni_set_decrypt_key; void -ossl_cpuid(void) +ossl_cpuid(struct ossl_softc *sc) { uint64_t xcr0; u_int regs[4]; @@ -112,4 +117,12 @@ ossl_cpuid(void) OPENSSL_ia32cap_P[1] &= ~(CPUID2_AVX | AMDID2_XOP | CPUID2_FMA); OPENSSL_ia32cap_P[2] &= ~CPUID_STDEXT_AVX2; } + + if (!AESNI_CAPABLE) { + sc->has_aes = false; + return; + } + sc->has_aes = true; + ossl_cipher_aes_cbc.set_encrypt_key = aesni_set_encrypt_key; + ossl_cipher_aes_cbc.set_decrypt_key = aesni_set_decrypt_key; } diff --git a/sys/crypto/openssl/ossl_x86.h b/sys/crypto/openssl/ossl_x86.h new file mode 100644 index 000000000000..12bd5a4eaddb --- /dev/null +++ b/sys/crypto/openssl/ossl_x86.h @@ -0,0 +1,20 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef __OSSL_X86__ +#define __OSSL_X86__ + +#include +#include + +/* aesni-x86_64.S, aesni-x86.S */ +ossl_cipher_encrypt_t aesni_cbc_encrypt; + +#define AES_CBC_ENCRYPT aesni_cbc_encrypt +#endif diff --git a/sys/modules/ossl/Makefile b/sys/modules/ossl/Makefile index dfd82dcf6e1f..765e70a03edd 100644 --- a/sys/modules/ossl/Makefile +++ b/sys/modules/ossl/Makefile @@ -4,10 +4,12 @@ .PATH: ${SRCTOP}/sys/crypto/openssl/${MACHINE_CPUARCH} KMOD= ossl +OBJS+= ${OBJS.${MACHINE_CPUARCH}} SRCS= bus_if.h \ cryptodev_if.h \ device_if.h \ ossl.c \ + ossl_aes.c \ ossl_chacha20.c \ ossl_poly1305.c \ ossl_sha1.c \ @@ -21,9 +23,11 @@ SRCS.aarch64= \ sha1-armv8.S \ sha256-armv8.S \ sha512-armv8.S \ + vpaes-armv8.S \ ossl_aarch64.c SRCS.amd64= \ + aesni-x86_64.S \ chacha-x86_64.S \ poly1305-x86_64.S \ sha1-x86_64.S \ @@ -32,6 +36,7 @@ SRCS.amd64= \ ossl_x86.c SRCS.i386= \ + aesni-x86.S \ chacha-x86.S \ poly1305-x86.S \ sha1-586.S \ @@ -45,4 +50,13 @@ ${SRCS.aarch64:M*.S:S/S/o/}: ${.TARGET:R}.S ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC} ${CTFCONVERT_CMD} +# Based on modules/armv8crypto/Makefile. +# Clang doesn't recognize "aes*" instructions without -march set. +aesv8-armx.o: aesv8-armx.S + ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} \ + -march=armv8-a+crypto ${.IMPSRC} + ${CTFCONVERT_CMD} + +OBJS.aarch64= aesv8-armx.o + .include diff --git a/tests/sys/opencrypto/cryptotest.py b/tests/sys/opencrypto/cryptotest.py index 74ce62cee33d..447a7854b246 100644 --- a/tests/sys/opencrypto/cryptotest.py +++ b/tests/sys/opencrypto/cryptotest.py @@ -50,7 +50,7 @@ def katg(base, glob): raise unittest.SkipTest("Missing %s test vectors" % (base)) return iglob(os.path.join(katdir, base, glob)) -aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'safexcel0', 'qat0' ] +aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'ossl0', 'safexcel0', 'qat0' ] shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'ossl0', 'safexcel0', 'qat0' ] def GenTestCase(cname): From nobody Sat Nov 6 08:11:28 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CA6891834726; Sat, 6 Nov 2021 08:11: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 4HmVSx1mt1z3QFb; Sat, 6 Nov 2021 08:11: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 0BD5E27B1F; Sat, 6 Nov 2021 08:11: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 1A68BSrA041065; Sat, 6 Nov 2021 08:11:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68BSCq041064; Sat, 6 Nov 2021 08:11:28 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:11:28 GMT Message-Id: <202111060811.1A68BSCq041064@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: 048a71b46e81 - main - ossl: Add support for ETA mode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 048a71b46e816de8fb95b553a8ad0e98c0d51e12 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=048a71b46e816de8fb95b553a8ad0e98c0d51e12 commit 048a71b46e816de8fb95b553a8ad0e98c0d51e12 Author: Kornel Duleba AuthorDate: 2021-11-02 11:57:20 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 08:08:44 +0000 ossl: Add support for ETA mode Now that the AES-CBC is supported we can handle ETA requests. Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: jhb(previous version) Differential revision: https://reviews.freebsd.org/D32100 --- sys/crypto/openssl/ossl.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index f46b5a966bb1..f41ff09c371d 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -172,6 +172,13 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) if (ossl_lookup_cipher(csp) == NULL) return (EINVAL); break; + case CSP_MODE_ETA: + if (!sc->has_aes || + csp->csp_cipher_alg == CRYPTO_CHACHA20 || + ossl_lookup_hash(csp) == NULL || + ossl_lookup_cipher(csp) == NULL) + return (EINVAL); + break; case CSP_MODE_AEAD: switch (csp->csp_cipher_alg) { case CRYPTO_CHACHA20_POLY1305: @@ -268,6 +275,10 @@ ossl_newsession(device_t dev, crypto_session_t cses, case CSP_MODE_CIPHER: error = ossl_newsession_cipher(s, csp); break; + case CSP_MODE_ETA: + ossl_newsession_hash(s, csp); + error = ossl_newsession_cipher(s, csp); + break; } return (error); @@ -341,6 +352,25 @@ out: return (error); } +static int +ossl_process_eta(struct ossl_session *s, struct cryptop *crp, + const struct crypto_session_params *csp) +{ + int error; + + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + error = s->cipher.cipher->process(&s->cipher, crp, csp); + if (error == 0) + error = ossl_process_hash(s, crp, csp); + } else { + error = ossl_process_hash(s, crp, csp); + if (error == 0) + error = s->cipher.cipher->process(&s->cipher, crp, csp); + } + + return (error); +} + static int ossl_process(device_t dev, struct cryptop *crp, int hint) { @@ -366,6 +396,9 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) case CSP_MODE_CIPHER: error = s->cipher.cipher->process(&s->cipher, crp, csp); break; + case CSP_MODE_ETA: + error = ossl_process_eta(s, crp, csp); + break; case CSP_MODE_AEAD: if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) error = ossl_chacha20_poly1305_encrypt(crp, csp); From nobody Sat Nov 6 08:11:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F2D021834738; Sat, 6 Nov 2021 08:11: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 4HmVSz0M9qz3QC3; Sat, 6 Nov 2021 08:11: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 2BEE72794E; Sat, 6 Nov 2021 08:11: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 1A68BUJe041089; Sat, 6 Nov 2021 08:11:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68BUBo041088; Sat, 6 Nov 2021 08:11:30 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:11:30 GMT Message-Id: <202111060811.1A68BUBo041088@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: b8b7c0dda9a0 - main - qoriq_gpio: Add support for driver inheritance List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: b8b7c0dda9a085902f702f8c89271b852aa898a4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=b8b7c0dda9a085902f702f8c89271b852aa898a4 commit b8b7c0dda9a085902f702f8c89271b852aa898a4 Author: Kornel Duleba AuthorDate: 2021-10-29 14:06:35 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 08:08:45 +0000 qoriq_gpio: Add support for driver inheritance Expose softc and other necessary things in a separate header. This is needed for an armv8 specific driver, that will inherit from this one. Driver mutex was converted to a spin lock, so that it can be later used in interrupt filter context. Obtained from: Semihalf Sponsored by: Alstom Group Differential revision: https://reviews.freebsd.org/D32587 --- sys/dev/gpio/qoriq_gpio.c | 44 +++++--------------------------- sys/dev/gpio/qoriq_gpio.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 38 deletions(-) diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c index dc4813e07b8e..eb790eb50d29 100644 --- a/sys/dev/gpio/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -46,40 +46,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include "gpio_if.h" -#define MAXPIN (31) - -#define VALID_PIN(u) ((u) >= 0 && (u) <= MAXPIN) -#define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ - GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL) - -#define GPIO_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define GPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) -#define GPIO_LOCK_INIT(sc) \ - mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ - "gpio", MTX_DEF) -#define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); - -#define GPIO_GPDIR 0x0 -#define GPIO_GPODR 0x4 -#define GPIO_GPDAT 0x8 -#define GPIO_GPIER 0xc -#define GPIO_GPIMR 0x10 -#define GPIO_GPICR 0x14 -#define GPIO_GPIBE 0x18 - -struct qoriq_gpio_softc { - device_t dev; - device_t busdev; - struct mtx sc_mtx; - struct resource *sc_mem; /* Memory resource */ - struct gpio_pin sc_pins[MAXPIN + 1]; -}; - static device_t qoriq_gpio_get_bus(device_t dev) { @@ -379,9 +351,7 @@ qoriq_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, return (err); } -static int qoriq_gpio_detach(device_t dev); - -static int +int qoriq_gpio_attach(device_t dev) { struct qoriq_gpio_softc *sc = device_get_softc(dev); @@ -422,7 +392,7 @@ qoriq_gpio_attach(device_t dev) return (0); } -static int +int qoriq_gpio_detach(device_t dev) { struct qoriq_gpio_softc *sc = device_get_softc(dev); @@ -464,13 +434,11 @@ static device_method_t qoriq_gpio_methods[] = { DEVMETHOD_END }; -static driver_t qoriq_gpio_driver = { - "gpio", - qoriq_gpio_methods, - sizeof(struct qoriq_gpio_softc), -}; static devclass_t qoriq_gpio_devclass; +DEFINE_CLASS_0(gpio, qoriq_gpio_driver, qoriq_gpio_methods, + sizeof(struct qoriq_gpio_softc)); + EARLY_DRIVER_MODULE(qoriq_gpio, simplebus, qoriq_gpio_driver, qoriq_gpio_devclass, NULL, NULL, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); diff --git a/sys/dev/gpio/qoriq_gpio.h b/sys/dev/gpio/qoriq_gpio.h new file mode 100644 index 000000000000..6b401e1d3f44 --- /dev/null +++ b/sys/dev/gpio/qoriq_gpio.h @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2020 Alstom Group. + * Copyright (c) 2020 Semihalf. + * Copyright (c) 2015 Justin Hibbits + * 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. + * + * $FreeBSD$ + */ + +#define MAXPIN (31) + +#define BIT(x) (1 << (x)) + +#define VALID_PIN(u) ((u) >= 0 && (u) <= MAXPIN) +#define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ + GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL) + +#define GPIO_LOCK(sc) mtx_lock_spin(&(sc)->sc_mtx) +#define GPIO_UNLOCK(sc) mtx_unlock_spin(&(sc)->sc_mtx) +#define GPIO_LOCK_INIT(sc) \ + mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ + "gpio", MTX_SPIN) +#define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); + +#define GPIO_GPDIR 0x0 +#define GPIO_GPODR 0x4 +#define GPIO_GPDAT 0x8 +#define GPIO_GPIER 0xc +#define GPIO_GPIMR 0x10 +#define GPIO_GPICR 0x14 +#define GPIO_GPIBE 0x18 + +struct qoriq_gpio_softc { + device_t dev; + device_t busdev; + struct mtx sc_mtx; + struct resource *sc_mem; + struct gpio_pin sc_pins[MAXPIN + 1]; +}; + +device_attach_t qoriq_gpio_attach; +device_detach_t qoriq_gpio_detach; + +DECLARE_CLASS(qoriq_gpio_driver); From nobody Sat Nov 6 08:11:31 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9D29F18346DB; Sat, 6 Nov 2021 08:11: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 4HmVT01mw1z3QL4; Sat, 6 Nov 2021 08:11: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 55602276FE; Sat, 6 Nov 2021 08:11: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 1A68BVD5041114; Sat, 6 Nov 2021 08:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68BVEF041113; Sat, 6 Nov 2021 08:11:31 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:11:31 GMT Message-Id: <202111060811.1A68BVEF041113@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: 463b6ba05a69 - main - Introduce qoriq_gpio_pic driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 463b6ba05a69edbdaaf79425ba9fdc9dc64eae70 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=463b6ba05a69edbdaaf79425ba9fdc9dc64eae70 commit 463b6ba05a69edbdaaf79425ba9fdc9dc64eae70 Author: Kornel Duleba AuthorDate: 2021-11-02 10:30:01 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 08:08:45 +0000 Introduce qoriq_gpio_pic driver It adds the PIC functionality on top of qoriq_gpio driver. We need a separate module since the powerpc PIC API is completely different than on other architectures. Two types of intr_map_data are supported: INTR_MAP_DATA_GPIO and INTR_MAP_DATA_FDT. This way interrupts can be allocated using the userspace gpio interrupt allocation method, as well as directly from simplebus. The latter can be used by devices that have its irq routed to a GPIO pin. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/arm64/qoriq/qoriq_gpio_pic.c | 439 +++++++++++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 1 + sys/dev/gpio/qoriq_gpio.c | 1 - 3 files changed, 440 insertions(+), 1 deletion(-) diff --git a/sys/arm64/qoriq/qoriq_gpio_pic.c b/sys/arm64/qoriq/qoriq_gpio_pic.c new file mode 100644 index 000000000000..c2f462bf7787 --- /dev/null +++ b/sys/arm64/qoriq/qoriq_gpio_pic.c @@ -0,0 +1,439 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "gpio_if.h" +#include "pic_if.h" + +struct qoriq_gpio_pic_irqsrc { + struct intr_irqsrc isrc; + int pin; +}; + +struct qoriq_gpio_pic_softc { + struct qoriq_gpio_softc base; + + struct resource *res_irq; + void *irq_cookie; + struct qoriq_gpio_pic_irqsrc isrcs[MAXPIN + 1]; + struct intr_map_data_gpio gdata; +}; + +#define RD4(sc, off) bus_read_4((sc)->base.sc_mem, (off)) +#define WR4(sc, off, data) bus_write_4((sc)->base.sc_mem, (off), (data)) + +static device_probe_t qoriq_gpio_pic_probe; +static device_attach_t qoriq_gpio_pic_attach; +static device_detach_t qoriq_gpio_pic_detach; + +static void +qoriq_gpio_pic_set_intr(struct qoriq_gpio_pic_softc *sc, int pin, bool enable) +{ + uint32_t reg; + + reg = RD4(sc, GPIO_GPIMR); + if (enable) + reg |= BIT(31 - pin); + else + reg &= ~BIT(31 - pin); + WR4(sc, GPIO_GPIMR, reg); +} + +static void +qoriq_gpio_pic_ack_intr(struct qoriq_gpio_pic_softc *sc, int pin) +{ + uint32_t reg; + + reg = BIT(31 - pin); + WR4(sc, GPIO_GPIER, reg); +} + +static int +qoriq_gpio_pic_intr(void *arg) +{ + struct qoriq_gpio_pic_softc *sc; + struct trapframe *tf; + uint32_t status; + int pin; + + sc = (struct qoriq_gpio_pic_softc *)arg; + tf = curthread->td_intr_frame; + + status = RD4(sc, GPIO_GPIER); + status &= RD4(sc, GPIO_GPIMR); + while (status != 0) { + pin = ffs(status) - 1; + status &= ~BIT(pin); + pin = 31 - pin; + + if (intr_isrc_dispatch(&sc->isrcs[pin].isrc, tf) != 0) { + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_set_intr(sc, pin, false); + qoriq_gpio_pic_ack_intr(sc, pin); + GPIO_UNLOCK(&sc->base); + device_printf(sc->base.dev, + "Masking spurious pin interrupt %d\n", + pin); + } + } + + return (FILTER_HANDLED); +} + +static void +qoriq_gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_pic_softc *sc; + struct qoriq_gpio_pic_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_set_intr(sc, qisrc->pin, false); + GPIO_UNLOCK(&sc->base); +} + +static void +qoriq_gpio_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_pic_softc *sc; + struct qoriq_gpio_pic_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_set_intr(sc, qisrc->pin, true); + GPIO_UNLOCK(&sc->base); +} + +static struct intr_map_data_gpio* +qoriq_gpio_pic_convert_map_data(struct qoriq_gpio_pic_softc *sc, struct intr_map_data *data) +{ + struct intr_map_data_gpio *gdata; + struct intr_map_data_fdt *daf; + + switch (data->type) { + case INTR_MAP_DATA_GPIO: + gdata = (struct intr_map_data_gpio *)data; + break; + case INTR_MAP_DATA_FDT: + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 2) + return (NULL); + + gdata = &sc->gdata; + gdata->gpio_pin_num = daf->cells[0]; + switch (daf->cells[1]) { + case IRQ_TYPE_LEVEL_LOW: + gdata->gpio_intr_mode = GPIO_INTR_LEVEL_LOW; + break; + case IRQ_TYPE_LEVEL_HIGH: + gdata->gpio_intr_mode = GPIO_INTR_LEVEL_HIGH; + break; + case IRQ_TYPE_EDGE_RISING: + gdata->gpio_intr_mode = GPIO_INTR_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_FALLING: + gdata->gpio_intr_mode = GPIO_INTR_EDGE_FALLING; + break; + case IRQ_TYPE_EDGE_BOTH: + gdata->gpio_intr_mode = GPIO_INTR_EDGE_BOTH; + break; + default: + return (NULL); + } + break; + default: + return (NULL); + } + + return (gdata); +} + + +static int +qoriq_gpio_pic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct qoriq_gpio_pic_softc *sc; + struct intr_map_data_gpio *gdata; + int pin; + + sc = device_get_softc(dev); + + gdata = qoriq_gpio_pic_convert_map_data(sc, data); + if (gdata == NULL) + return (EINVAL); + + pin = gdata->gpio_pin_num; + if (pin > MAXPIN) + return (EINVAL); + + *isrcp = &sc->isrcs[pin].isrc; + return (0); +} + +static int +qoriq_gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct qoriq_gpio_pic_softc *sc; + struct intr_map_data_gpio *gdata; + struct qoriq_gpio_pic_irqsrc *qisrc; + bool falling; + uint32_t reg; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + gdata = qoriq_gpio_pic_convert_map_data(sc, data); + if (gdata == NULL) + return (EINVAL); + + if (gdata->gpio_intr_mode & GPIO_INTR_EDGE_BOTH) + falling = false; + else if (gdata->gpio_intr_mode & GPIO_INTR_EDGE_FALLING) + falling = true; + else + return (EOPNOTSUPP); + + GPIO_LOCK(&sc->base); + reg = RD4(sc, GPIO_GPICR); + if (falling) + reg |= BIT(31 - qisrc->pin); + else + reg &= ~BIT(31 - qisrc->pin); + WR4(sc, GPIO_GPICR, reg); + GPIO_UNLOCK(&sc->base); + + return (0); +} + +static int +qoriq_gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct qoriq_gpio_pic_softc *sc; + struct qoriq_gpio_pic_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + if (isrc->isrc_handlers > 0) + return (0); + + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_set_intr(sc, qisrc->pin, false); + GPIO_UNLOCK(&sc->base); + return (0); +} + +static void +qoriq_gpio_pic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_pic_softc *sc; + struct qoriq_gpio_pic_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_ack_intr(sc, qisrc->pin); + GPIO_UNLOCK(&sc->base); +} + + +static void +qoriq_gpio_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_pic_softc *sc; + struct qoriq_gpio_pic_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_ack_intr(sc, qisrc->pin); + qoriq_gpio_pic_set_intr(sc, qisrc->pin, true); + GPIO_UNLOCK(&sc->base); +} + +static void +qoriq_gpio_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct qoriq_gpio_pic_softc *sc; + struct qoriq_gpio_pic_irqsrc *qisrc; + + sc = device_get_softc(dev); + qisrc = (struct qoriq_gpio_pic_irqsrc *)isrc; + + GPIO_LOCK(&sc->base); + qoriq_gpio_pic_set_intr(sc, qisrc->pin, false); + GPIO_UNLOCK(&sc->base); + +} +static int +qoriq_gpio_pic_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "fsl,qoriq-gpio")) + return (ENXIO); + + device_set_desc(dev, "Freescale QorIQ GPIO PIC driver"); + + return (BUS_PROBE_DEFAULT); +} + +static int +qoriq_gpio_pic_attach(device_t dev) +{ + struct qoriq_gpio_pic_softc *sc; + int error, rid, i; + const char *name; + intptr_t xref; + + sc = device_get_softc(dev); + + error = qoriq_gpio_attach(dev); + if (error != 0) + return (error); + + rid = 0; + sc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->res_irq == NULL) { + device_printf(dev, "Can't allocate interrupt resource.\n"); + error = ENOMEM; + goto fail; + } + + error = bus_setup_intr(dev, sc->res_irq, INTR_TYPE_MISC | INTR_MPSAFE, + qoriq_gpio_pic_intr, NULL, sc, &sc->irq_cookie); + if (error != 0) { + device_printf(dev, "Failed to setup interrupt.\n"); + goto fail; + } + + name = device_get_nameunit(dev); + for (i = 0; i <= MAXPIN; i++) { + sc->isrcs[i].pin = i; + error = intr_isrc_register(&sc->isrcs[i].isrc, + dev, 0, "%s,%u", name, i); + if (error != 0) + goto fail; + } + + xref = OF_xref_from_node(ofw_bus_get_node(dev)); + if (intr_pic_register(dev, xref) == NULL) { + error = ENXIO; + goto fail; + } + + /* ACK and mask all interrupts. */ + WR4(sc, GPIO_GPIER, 0xffffffff); + WR4(sc, GPIO_GPIMR, 0); + + return (0); +fail: + qoriq_gpio_pic_detach(dev); + return (error); +} + +static int +qoriq_gpio_pic_detach(device_t dev) +{ + struct qoriq_gpio_pic_softc *sc; + + sc = device_get_softc(dev); + + if (sc->irq_cookie != NULL) + bus_teardown_intr(dev, sc->res_irq, sc->irq_cookie); + + if (sc->res_irq != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->res_irq), sc->res_irq); + + return (qoriq_gpio_detach(dev)); +} + + +static device_method_t qoriq_gpio_pic_methods[] = { + DEVMETHOD(device_probe, qoriq_gpio_pic_probe), + DEVMETHOD(device_attach, qoriq_gpio_pic_attach), + DEVMETHOD(device_detach, qoriq_gpio_pic_detach), + + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + + DEVMETHOD(pic_disable_intr, qoriq_gpio_pic_disable_intr), + DEVMETHOD(pic_enable_intr, qoriq_gpio_pic_enable_intr), + DEVMETHOD(pic_map_intr, qoriq_gpio_pic_map_intr), + DEVMETHOD(pic_setup_intr, qoriq_gpio_pic_setup_intr), + DEVMETHOD(pic_teardown_intr, qoriq_gpio_pic_teardown_intr), + DEVMETHOD(pic_post_filter, qoriq_gpio_pic_post_filter), + DEVMETHOD(pic_post_ithread, qoriq_gpio_pic_post_ithread), + DEVMETHOD(pic_pre_ithread, qoriq_gpio_pic_pre_ithread), + + DEVMETHOD_END +}; + +static devclass_t qoriq_gpio_pic_devclass; + +DEFINE_CLASS_1(gpio, qoriq_gpio_pic_driver, qoriq_gpio_pic_methods, + sizeof(struct qoriq_gpio_pic_softc), qoriq_gpio_driver); +EARLY_DRIVER_MODULE(qoriq_gpio_pic, simplebus, qoriq_gpio_pic_driver, + qoriq_gpio_pic_devclass, NULL, NULL, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index c1f99382863a..e718e9b93847 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -522,6 +522,7 @@ tegra210_xusb.fw optional tegra210_xusb_fw \ # NXP arm/freescale/vybrid/vf_i2c.c optional vf_i2c iicbus SOC_NXP_LS arm64/qoriq/qoriq_dw_pci.c optional pci fdt SOC_NXP_LS +arm64/qoriq/qoriq_gpio_pic.c optional gpio fdt SOC_NXP_LS arm64/qoriq/qoriq_therm.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm_if.m optional pci fdt SOC_NXP_LS arm64/qoriq/clk/ls1028a_clkgen.c optional clk SOC_NXP_LS diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c index eb790eb50d29..8300a45aa249 100644 --- a/sys/dev/gpio/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -233,7 +233,6 @@ qoriq_gpio_pin_toggle(device_t dev, uint32_t pin) } static struct ofw_compat_data gpio_matches[] = { - {"fsl,qoriq-gpio", 1}, {"fsl,pq3-gpio", 1}, {"fsl,mpc8572-gpio", 1}, {0, 0} From nobody Sat Nov 6 08:11:32 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1A1E18346F2; Sat, 6 Nov 2021 08:11: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 4HmVT05rQFz3QCC; Sat, 6 Nov 2021 08:11: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 5E85827B99; Sat, 6 Nov 2021 08:11: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 1A68BWV8041143; Sat, 6 Nov 2021 08:11:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68BWQD041142; Sat, 6 Nov 2021 08:11:32 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:11:32 GMT Message-Id: <202111060811.1A68BWQD041142@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: 4b843e7f0319 - main - mii_fdt: Add support for switch PHY node lookup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 4b843e7f0319867c412070e7752dbb47f195b322 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=4b843e7f0319867c412070e7752dbb47f195b322 commit 4b843e7f0319867c412070e7752dbb47f195b322 Author: Kornel Duleba AuthorDate: 2021-10-27 08:34:17 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 08:08:45 +0000 mii_fdt: Add support for switch PHY node lookup Previously we would only search for a PHY xref in node of the miibus parent. That didn't work very well with switches. Fix that by searching through "ports" subnode, checking if any of its children have a valid PHY xref. Since switches tend to have multiple ports we also have multiple candidates. Use the PHY address read from mii_attach_args to find the right one. Obtained from: Semihalf Sponsored by: Alstom Group Reviewed by: mw Differential revision: https://reviews.freebsd.org/D32690 --- sys/dev/mii/mii_fdt.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/sys/dev/mii/mii_fdt.c b/sys/dev/mii/mii_fdt.c index 009a523e32ce..18ed9c8e749c 100644 --- a/sys/dev/mii/mii_fdt.c +++ b/sys/dev/mii/mii_fdt.c @@ -99,6 +99,44 @@ mii_fdt_get_phynode(phandle_t macnode) return (-1); } +static phandle_t +mii_fdt_lookup_phy(phandle_t node, int addr) +{ + phandle_t ports, phynode, child; + int reg; + + /* First try to see if we have a direct xref pointing to a PHY. */ + phynode = mii_fdt_get_phynode(node); + if (phynode != -1) + return (phynode); + + /* + * Now handle the "switch" case. + * Search "ports" subnode for nodes that describe a switch port + * including a PHY xref. + * Since we have multiple candidates select one based on PHY address. + */ + ports = ofw_bus_find_child(node, "ports"); + if (ports <= 0) + return (-1); + + for (child = OF_child(ports); child != 0; child = OF_peer(child)) { + if (ofw_bus_node_status_okay(child) == 0) + continue; + + phynode = mii_fdt_get_phynode(child); + if (phynode <= 0) + continue; + + if (OF_getencprop(phynode, "reg", ®, sizeof(reg)) <= 0) + continue; + + if (reg == addr) + return (phynode); + } + return (-1); +} + mii_contype_t mii_fdt_contype_from_name(const char *name) { @@ -145,10 +183,12 @@ mii_fdt_free_config(struct mii_fdt_phy_config *cfg) mii_fdt_phy_config_t * mii_fdt_get_config(device_t phydev) { + struct mii_attach_args *ma; mii_fdt_phy_config_t *cfg; device_t miibus, macdev; pcell_t val; + ma = device_get_ivars(phydev); miibus = device_get_parent(phydev); macdev = device_get_parent(miibus); @@ -167,7 +207,8 @@ mii_fdt_get_config(device_t phydev) * If we can't find our own PHY node, there's nothing more we can fill * in, just return what we've got. */ - if ((cfg->phynode = mii_fdt_get_phynode(cfg->macnode)) == -1) + cfg->phynode = mii_fdt_lookup_phy(cfg->macnode, ma->mii_phyno); + if (cfg->phynode == -1) return (cfg); if (OF_getencprop(cfg->phynode, "max-speed", &val, sizeof(val)) > 0) From nobody Sat Nov 6 08:28:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 25AEA183E0BD; Sat, 6 Nov 2021 08:28: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 4HmVrL6lRxz3n9f; Sat, 6 Nov 2021 08:28: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 B907027DC5; Sat, 6 Nov 2021 08:28: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 1A68SIIe058502; Sat, 6 Nov 2021 08:28:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68SIDs058501; Sat, 6 Nov 2021 08:28:18 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:28:18 GMT Message-Id: <202111060828.1A68SIDs058501@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: 3be6e606d787 - main - linux: Fix another amd64-specific piece of linux_ptrace.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3be6e606d7870a79baa7a4c5947dffd333defa79 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=3be6e606d7870a79baa7a4c5947dffd333defa79 commit 3be6e606d7870a79baa7a4c5947dffd333defa79 Author: Edward Tomasz Napierala AuthorDate: 2021-11-06 07:56:51 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-06 08:28:11 +0000 linux: Fix another amd64-specific piece of linux_ptrace.c This was missed in c91d0e59be1. No functional changes. Sponsored By: EPSRC --- sys/amd64/linux/linux_ptrace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 2ebf1c2be997..5910e4ec3d4f 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$"); #include -#include -#include +#include +#include #include #include #include @@ -343,10 +343,10 @@ linux_ptrace_getsiginfo(struct thread *td, pid_t pid, l_ulong data) static int linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) { - struct ptrace_lwpinfo lwpinfo; struct reg b_reg; struct linux_pt_regset l_regset; #ifdef __amd64__ + struct ptrace_lwpinfo lwpinfo; struct pcb *pcb; #endif int error; @@ -364,7 +364,6 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) l_regset.fs_base = pcb->pcb_fsbase; l_regset.gs_base = pcb->pcb_gsbase; -#endif error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { @@ -385,6 +384,7 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) */ l_regset.orig_rax = lwpinfo.pl_syscall_code; } +#endif error = copyout(&l_regset, (void *)data, sizeof(l_regset)); return (error); @@ -408,11 +408,11 @@ linux_ptrace_setregs(struct thread *td, pid_t pid, void *data) static int linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) { - struct ptrace_lwpinfo lwpinfo; struct reg b_reg; struct linux_pt_regset l_regset; struct iovec iov; #ifdef __amd64__ + struct ptrace_lwpinfo lwpinfo; struct pcb *pcb; #endif size_t len; @@ -437,7 +437,6 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) l_regset.fs_base = pcb->pcb_fsbase; l_regset.gs_base = pcb->pcb_gsbase; -#endif error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { @@ -459,6 +458,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) */ l_regset.orig_rax = lwpinfo.pl_syscall_code; } +#endif len = MIN(iov.iov_len, sizeof(l_regset)); error = copyout(&l_regset, (void *)iov.iov_base, len); From nobody Sat Nov 6 08:35:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5F92B1841A71; Sat, 6 Nov 2021 08:35: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 4HmW0z2CQPz3qXn; Sat, 6 Nov 2021 08:35: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 27C3B199; Sat, 6 Nov 2021 08:35: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 1A68ZlL0072318; Sat, 6 Nov 2021 08:35:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A68Zl3B072317; Sat, 6 Nov 2021 08:35:47 GMT (envelope-from git) Date: Sat, 6 Nov 2021 08:35:47 GMT Message-Id: <202111060835.1A68Zl3B072317@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: 6f397bc0fbe3 - main - linux: Implement linux_to_bsd_regset() on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 6f397bc0fbe378664bbbc7c2296043e3b9673e2a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6f397bc0fbe378664bbbc7c2296043e3b9673e2a commit 6f397bc0fbe378664bbbc7c2296043e3b9673e2a Author: Edward Tomasz Napierala AuthorDate: 2021-11-06 08:35:04 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-06 08:35:04 +0000 linux: Implement linux_to_bsd_regset() on arm64 This will be used by ptrace. Sponsored By: EPSRC --- sys/arm64/linux/linux.h | 2 ++ sys/arm64/linux/linux_machdep.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index 5e4bf3ae0680..05e5bd189b36 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -324,5 +324,7 @@ struct reg; void bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset); +void linux_to_bsd_regset(struct reg *b_reg, + const struct linux_pt_regset *l_regset); #endif /* _ARM64_LINUX_H_ */ diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index c874f86a5f0c..0bcc05ff06de 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -145,3 +145,16 @@ bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset) l_regset->pc = b_reg->elr; l_regset->cpsr = b_reg->spsr; } + +void +linux_to_bsd_regset(struct reg *b_reg, const struct linux_pt_regset *l_regset) +{ + + KASSERT(sizeof(l_regset->x) == sizeof(b_reg->x) + sizeof(l_ulong), + ("%s: size mismatch\n", __func__)); + + memcpy(b_reg->x, l_regset->x, sizeof(b_reg->x)); + b_reg->sp = l_regset->sp; + b_reg->elr = l_regset->pc; + b_reg->spsr = l_regset->cpsr; +} From nobody Sat Nov 6 09:43:26 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1BDF5184DC85; Sat, 6 Nov 2021 09:43: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 4HmXW30GM5z4grt; Sat, 6 Nov 2021 09:43: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 DCCF3B4C; Sat, 6 Nov 2021 09:43: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 1A69hQCA067784; Sat, 6 Nov 2021 09:43:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A69hQ5G067783; Sat, 6 Nov 2021 09:43:26 GMT (envelope-from git) Date: Sat, 6 Nov 2021 09:43:26 GMT Message-Id: <202111060943.1A69hQ5G067783@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: acdfc0963946 - main - lagg: update capabilites on SIOCSIFMTU List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: acdfc09639467714e4ac2080d346251e266ea4a6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=acdfc09639467714e4ac2080d346251e266ea4a6 commit acdfc09639467714e4ac2080d346251e266ea4a6 Author: Wojciech Macek AuthorDate: 2021-11-06 09:41:43 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 09:43:08 +0000 lagg: update capabilites on SIOCSIFMTU Some NICs might have limited capabilities when Jumbo frames are used. For exampe some neta interfaces only support TX csum offload when the packet size is lower than a value specified in DT. Fix it by re-reading capabilities of children interfaces after MTU has been successfully changed. Found by: Jerome Tomczyk Reviewed by: jhb Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D32724 --- sys/net/if_lagg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 8f7900277f01..87227136e667 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -1726,7 +1726,9 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) (*lp->lp_ioctl)(lp->lp_ifp, cmd, data); } } + lagg_capabilities(sc); LAGG_XUNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: From nobody Sat Nov 6 14:02:17 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 85EB21843F3F; Sat, 6 Nov 2021 14:02: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 4HmfFj3H8lz3Khb; Sat, 6 Nov 2021 14:02: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 51F05499D; Sat, 6 Nov 2021 14:02: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 1A6E2HFk023179; Sat, 6 Nov 2021 14:02:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6E2HbB023178; Sat, 6 Nov 2021 14:02:17 GMT (envelope-from git) Date: Sat, 6 Nov 2021 14:02:17 GMT Message-Id: <202111061402.1A6E2HbB023178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 866dd6335a6c - main - unionfs: various locking fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 866dd6335a6c74cc7615a8ad8ae2f2b2ec4ece94 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=866dd6335a6c74cc7615a8ad8ae2f2b2ec4ece94 commit 866dd6335a6c74cc7615a8ad8ae2f2b2ec4ece94 Author: Jason A. Harmening AuthorDate: 2021-10-24 17:24:18 +0000 Commit: Jason A. Harmening CommitDate: 2021-11-06 14:08:33 +0000 unionfs: various locking fixes --Clearing cached subdirectories in unionfs_noderem() should be done under the vnode interlock --When preparing to switch the vnode lock in both unionfs_node_update() and unionfs_noderem(), the incoming lock should be acquired before updating the v_vnlock field to point to it. Otherwise we effectively break the locking contract for a brief window. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D32629 --- sys/fs/unionfs/union_subr.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 326483bcc400..7bde71bb17b1 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -439,6 +439,9 @@ unionfs_noderem(struct vnode *vp, struct thread *td) struct vnode *dvp; int count; + if (lockmgr(&(vp->v_lock), LK_EXCLUSIVE, NULL) != 0) + panic("the lock for deletion is unacquirable."); + /* * Use the interlock to protect the clearing of v_data to * prevent faults in unionfs_lock(). @@ -459,6 +462,22 @@ unionfs_noderem(struct vnode *vp, struct thread *td) VOP_ADD_WRITECOUNT(lvp, -vp->v_writecount); } else if (vp->v_writecount < 0) vp->v_writecount = 0; + if (unp->un_hashtbl != NULL) { + /* + * Clear out any cached child vnodes. This should only + * be necessary during forced unmount, when the vnode may + * be reclaimed with a non-zero use count. Otherwise the + * reference held by each child should prevent reclamation. + */ + for (count = 0; count <= UNIONFSHASHMASK; count++) { + hd = unp->un_hashtbl + count; + LIST_FOREACH_SAFE(unp_t1, hd, un_hash, unp_t2) { + LIST_REMOVE(unp_t1, un_hash); + unp_t1->un_hash.le_next = NULL; + unp_t1->un_hash.le_prev = NULL; + } + } + } VI_UNLOCK(vp); if (lvp != NULLVP) @@ -469,9 +488,6 @@ unionfs_noderem(struct vnode *vp, struct thread *td) if (dvp != NULLVP) unionfs_rem_cached_vnode(unp, dvp); - if (lockmgr(vp->v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0) - panic("the lock for deletion is unacquirable."); - if (lvp != NULLVP) vrele(lvp); if (uvp != NULLVP) @@ -483,14 +499,6 @@ unionfs_noderem(struct vnode *vp, struct thread *td) } if (unp->un_hashtbl != NULL) { - for (count = 0; count <= UNIONFSHASHMASK; count++) { - hd = unp->un_hashtbl + count; - LIST_FOREACH_SAFE(unp_t1, hd, un_hash, unp_t2) { - LIST_REMOVE(unp_t1, un_hash); - unp_t1->un_hash.le_next = NULL; - unp_t1->un_hash.le_prev = NULL; - } - } hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, UNIONFSHASHMASK); } @@ -798,15 +806,16 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, dvp = unp->un_dvp; /* - * lock update + * Uppdate the upper vnode's lock state to match the lower vnode, + * and then switch the unionfs vnode's lock to the upper vnode. */ + lockrec = lvp->v_vnlock->lk_recurse; + for (count = 0; count < lockrec; count++) + vn_lock(uvp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY); VI_LOCK(vp); unp->un_uppervp = uvp; vp->v_vnlock = uvp->v_vnlock; VI_UNLOCK(vp); - lockrec = lvp->v_vnlock->lk_recurse; - for (count = 0; count < lockrec; count++) - vn_lock(uvp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY); /* * Re-cache the unionfs vnode against the upper vnode From nobody Sat Nov 6 14:02:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 273631843E7A; Sat, 6 Nov 2021 14:02: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 4HmfFk4qmVz3KfV; Sat, 6 Nov 2021 14:02: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 6F385499F; Sat, 6 Nov 2021 14:02: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 1A6E2IuO023209; Sat, 6 Nov 2021 14:02:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6E2IKS023208; Sat, 6 Nov 2021 14:02:18 GMT (envelope-from git) Date: Sat, 6 Nov 2021 14:02:18 GMT Message-Id: <202111061402.1A6E2IKS023208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 3ecefc4a61cc - main - unionfs: assorted style fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ecefc4a61cc3df506b38bfdf2dac843859a23a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=3ecefc4a61cc3df506b38bfdf2dac843859a23a7 commit 3ecefc4a61cc3df506b38bfdf2dac843859a23a7 Author: Jason A. Harmening AuthorDate: 2021-10-24 20:26:49 +0000 Commit: Jason A. Harmening CommitDate: 2021-11-06 14:08:33 +0000 unionfs: assorted style fixes No functional change intended, beyond slightly different panic strings Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D32629 --- sys/fs/unionfs/union.h | 8 +++---- sys/fs/unionfs/union_subr.c | 55 +++++++++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index fe611dea1461..5708998c6043 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -137,15 +137,15 @@ int unionfs_relookup(struct vnode *, struct vnode **, struct componentname *, struct componentname *, struct thread *, char *, int, u_long); int unionfs_relookup_for_create(struct vnode *, struct componentname *, - struct thread *td); + struct thread *); int unionfs_relookup_for_delete(struct vnode *, struct componentname *, struct thread *); int unionfs_relookup_for_rename(struct vnode *, struct componentname *, - struct thread *td); + struct thread *); #ifdef DIAGNOSTIC -struct vnode *unionfs_checklowervp(struct vnode *vp, char *fil, int lno); -struct vnode *unionfs_checkuppervp(struct vnode *vp, char *fil, int lno); +struct vnode *unionfs_checklowervp(struct vnode *, char *, int); +struct vnode *unionfs_checkuppervp(struct vnode *, char *, int); #define UNIONFSVPTOLOWERVP(vp) unionfs_checklowervp((vp), __FILE__, __LINE__) #define UNIONFSVPTOUPPERVP(vp) unionfs_checkuppervp((vp), __FILE__, __LINE__) #else diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 7bde71bb17b1..449e171d52cf 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -153,8 +153,8 @@ unionfs_get_cached_vnode_locked(struct vnode *lookup, struct vnode *dvp) hd = unionfs_get_hashhead(dvp, lookup); LIST_FOREACH(unp, hd, un_hash) { - if ((unp->un_uppervp == lookup) || - (unp->un_lowervp == lookup)) { + if (unp->un_uppervp == lookup || + unp->un_lowervp == lookup) { vp = UNIONFSTOV(unp); VI_LOCK_FLAGS(vp, MTX_DUPOK); vp->v_iflag &= ~VI_OWEINACT; @@ -183,10 +183,10 @@ unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp, { struct vnode *vp; - KASSERT((uvp == NULLVP || uvp->v_type == VDIR), - ("unionfs_get_cached_vnode: v_type != VDIR")); - KASSERT((lvp == NULLVP || lvp->v_type == VDIR), - ("unionfs_get_cached_vnode: v_type != VDIR")); + KASSERT(uvp == NULLVP || uvp->v_type == VDIR, + ("%s: v_type != VDIR", __func__)); + KASSERT(lvp == NULLVP || lvp->v_type == VDIR, + ("%s: v_type != VDIR", __func__)); vp = NULLVP; VI_LOCK(dvp); @@ -209,10 +209,10 @@ unionfs_ins_cached_vnode(struct unionfs_node *uncp, struct unionfs_node_hashhead *hd; struct vnode *vp; - KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR), - ("unionfs_ins_cached_vnode: v_type != VDIR")); - KASSERT((uncp->un_lowervp==NULLVP || uncp->un_lowervp->v_type==VDIR), - ("unionfs_ins_cached_vnode: v_type != VDIR")); + KASSERT(uncp->un_uppervp == NULLVP || uncp->un_uppervp->v_type == VDIR, + ("%s: v_type != VDIR", __func__)); + KASSERT(uncp->un_lowervp == NULLVP || uncp->un_lowervp->v_type == VDIR, + ("%s: v_type != VDIR", __func__)); vp = NULLVP; VI_LOCK(dvp); @@ -236,9 +236,9 @@ unionfs_ins_cached_vnode(struct unionfs_node *uncp, static void unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp) { - KASSERT((unp != NULL), ("unionfs_rem_cached_vnode: null node")); - KASSERT((dvp != NULLVP), - ("unionfs_rem_cached_vnode: null parent vnode")); + KASSERT(unp != NULL, ("%s: null node", __func__)); + KASSERT(dvp != NULLVP, + ("%s: null parent vnode", __func__)); VI_LOCK(dvp); if (unp->un_hash.le_prev != NULL) { @@ -320,7 +320,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, *vpp = NULLVP; if (uppervp == NULLVP && lowervp == NULLVP) - panic("unionfs_nodeget: upper and lower is null"); + panic("%s: upper and lower is null", __func__); vt = (uppervp != NULLVP ? uppervp->v_type : lowervp->v_type); @@ -440,7 +440,7 @@ unionfs_noderem(struct vnode *vp, struct thread *td) int count; if (lockmgr(&(vp->v_lock), LK_EXCLUSIVE, NULL) != 0) - panic("the lock for deletion is unacquirable."); + panic("%s: failed to acquire lock for vnode lock", __func__); /* * Use the interlock to protect the clearing of v_data to @@ -529,8 +529,8 @@ unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, pid = td->td_proc->p_pid; - KASSERT(NULL != unspp, ("null pointer")); - ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status"); + KASSERT(NULL != unspp, ("%s: NULL status", __func__)); + ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), __func__); LIST_FOREACH(unsp, &(unp->un_unshead), uns_list) { if (unsp->uns_pid == pid) { @@ -557,8 +557,8 @@ void unionfs_tryrem_node_status(struct unionfs_node *unp, struct unionfs_node_status *unsp) { - KASSERT(NULL != unsp, ("null pointer")); - ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status"); + KASSERT(NULL != unsp, ("%s: NULL status", __func__)); + ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), __func__); if (0 < unsp->uns_lower_opencnt || 0 < unsp->uns_upper_opencnt) return; @@ -802,7 +802,7 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, vp = UNIONFSTOV(unp); lvp = unp->un_lowervp; - ASSERT_VOP_ELOCKED(lvp, "unionfs_node_update"); + ASSERT_VOP_ELOCKED(lvp, __func__); dvp = unp->un_dvp; /* @@ -991,7 +991,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, unionfs_create_uppervattr_core(ump, &lva, uvap, td); if (unp->un_path == NULL) - panic("unionfs: un_path is null"); + panic("%s: NULL un_path", __func__); nd.ni_cnd.cn_namelen = unp->un_pathlen; nd.ni_cnd.cn_pnbuf = unp->un_path; @@ -1211,7 +1211,7 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) */ char buf[256 * 6]; - ASSERT_VOP_ELOCKED(vp, "unionfs_check_rmdir"); + ASSERT_VOP_ELOCKED(vp, __func__); eofflag = 0; uvp = UNIONFSVPTOUPPERVP(vp); @@ -1253,7 +1253,8 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) break; if (eofflag == 0 && uio.uio_resid == sizeof(buf)) { #ifdef DIAGNOSTIC - panic("bad readdir response from lower FS."); + panic("%s: bad readdir response from lower FS", + __func__); #endif break; } @@ -1325,12 +1326,12 @@ unionfs_checkuppervp(struct vnode *vp, char *fil, int lno) #ifdef notyet if (vp->v_op != unionfs_vnodeop_p) { - printf("unionfs_checkuppervp: on non-unionfs-node.\n"); + printf("%s: on non-unionfs-node.\n", __func__); #ifdef KDB kdb_enter(KDB_WHY_UNIONFS, "unionfs_checkuppervp: on non-unionfs-node.\n"); #endif - panic("unionfs_checkuppervp"); + panic("%s", __func__); } #endif return (unp->un_uppervp); @@ -1345,12 +1346,12 @@ unionfs_checklowervp(struct vnode *vp, char *fil, int lno) #ifdef notyet if (vp->v_op != unionfs_vnodeop_p) { - printf("unionfs_checklowervp: on non-unionfs-node.\n"); + printf("%s: on non-unionfs-node.\n", __func__); #ifdef KDB kdb_enter(KDB_WHY_UNIONFS, "unionfs_checklowervp: on non-unionfs-node.\n"); #endif - panic("unionfs_checklowervp"); + panic("%s", __func__); } #endif return (unp->un_lowervp); From nobody Sat Nov 6 14:02:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2B1691843E85; Sat, 6 Nov 2021 14:02: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 4HmfFl5h3lz3KcK; Sat, 6 Nov 2021 14:02: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 979D2493E; Sat, 6 Nov 2021 14:02: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 1A6E2J9S023234; Sat, 6 Nov 2021 14:02:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6E2JUj023233; Sat, 6 Nov 2021 14:02:19 GMT (envelope-from git) Date: Sat, 6 Nov 2021 14:02:19 GMT Message-Id: <202111061402.1A6E2JUj023233@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 66191a76ace5 - main - unionfs: Improve locking assertions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66191a76ace56af6603b343ad2e9a003e0589d70 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=66191a76ace56af6603b343ad2e9a003e0589d70 commit 66191a76ace56af6603b343ad2e9a003e0589d70 Author: Jason A. Harmening AuthorDate: 2021-10-28 05:31:16 +0000 Commit: Jason A. Harmening CommitDate: 2021-11-06 14:08:33 +0000 unionfs: Improve locking assertions Add an assertion to unionfs_node_update() that the upper vnode is exclusively locked; we already make the same assertion for the lower vnode. Also, assert in unionfs_noderem() that the vnode lock is not recursed and acquire v_lock with LK_NOWAIT. Since v_lock is not the active lock for the vnode at this point, it should not be contended. Finally, remove VDIR assertions from unionfs_get_cached_vnode(). lvp/uvp will be referenced but not locked at this point, so v_type may concurrently change due to vgonel(). The cached unionfs node, if one exists, would only have made it into the cache if lvp/uvp were of type VDIR at the time of insertion; the corresponding VDIR assert in unionfs_ins_cached_vnode() should be safe because lvp/uvp will be locked by that time and will not be used if either is doomed. Noted by: kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D32629 --- sys/fs/unionfs/union_subr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 449e171d52cf..0ca209c47502 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -183,11 +183,6 @@ unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp, { struct vnode *vp; - KASSERT(uvp == NULLVP || uvp->v_type == VDIR, - ("%s: v_type != VDIR", __func__)); - KASSERT(lvp == NULLVP || lvp->v_type == VDIR, - ("%s: v_type != VDIR", __func__)); - vp = NULLVP; VI_LOCK(dvp); if (uvp != NULLVP) @@ -209,6 +204,8 @@ unionfs_ins_cached_vnode(struct unionfs_node *uncp, struct unionfs_node_hashhead *hd; struct vnode *vp; + ASSERT_VOP_ELOCKED(uncp->un_uppervp, __func__); + ASSERT_VOP_ELOCKED(uncp->un_lowervp, __func__); KASSERT(uncp->un_uppervp == NULLVP || uncp->un_uppervp->v_type == VDIR, ("%s: v_type != VDIR", __func__)); KASSERT(uncp->un_lowervp == NULLVP || uncp->un_lowervp->v_type == VDIR, @@ -439,7 +436,9 @@ unionfs_noderem(struct vnode *vp, struct thread *td) struct vnode *dvp; int count; - if (lockmgr(&(vp->v_lock), LK_EXCLUSIVE, NULL) != 0) + KASSERT(vp->v_vnlock->lk_recurse == 0, + ("%s: vnode %p locked recursively", __func__, vp)); + if (lockmgr(&vp->v_lock, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0) panic("%s: failed to acquire lock for vnode lock", __func__); /* @@ -803,6 +802,7 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, vp = UNIONFSTOV(unp); lvp = unp->un_lowervp; ASSERT_VOP_ELOCKED(lvp, __func__); + ASSERT_VOP_ELOCKED(uvp, __func__); dvp = unp->un_dvp; /* From nobody Sat Nov 6 14:02:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6F4641843F58; Sat, 6 Nov 2021 14:02: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 4HmfFn0SJWz3KHq; Sat, 6 Nov 2021 14:02: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 95E3A4657; Sat, 6 Nov 2021 14:02: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 1A6E2KWw023370; Sat, 6 Nov 2021 14:02:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6E2KcX023358; Sat, 6 Nov 2021 14:02:20 GMT (envelope-from git) Date: Sat, 6 Nov 2021 14:02:20 GMT Message-Id: <202111061402.1A6E2KcX023358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: fb273fe70f8b - main - unionfs: replace zero-length read check with KASSERT List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb273fe70f8be66bb946c5a2ea1e53042bbada48 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=fb273fe70f8be66bb946c5a2ea1e53042bbada48 commit fb273fe70f8be66bb946c5a2ea1e53042bbada48 Author: Jason A. Harmening AuthorDate: 2021-10-28 05:31:52 +0000 Commit: Jason A. Harmening CommitDate: 2021-11-06 14:08:34 +0000 unionfs: replace zero-length read check with KASSERT The lower FS VOP_READDIR() shouldn't return an empty read without setting EOF; don't try to handle this case only for non-DIAGNOSTIC builds. Noted by: kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D32629 --- sys/fs/unionfs/union_subr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 0ca209c47502..8269b1e11fa4 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -1251,13 +1251,8 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) error = VOP_READDIR(lvp, &uio, cred, &eofflag, NULL, NULL); if (error != 0) break; - if (eofflag == 0 && uio.uio_resid == sizeof(buf)) { -#ifdef DIAGNOSTIC - panic("%s: bad readdir response from lower FS", - __func__); -#endif - break; - } + KASSERT(eofflag != 0 || uio.uio_resid < sizeof(buf), + ("%s: empty read from lower FS", __func__)); edp = (struct dirent*)&buf[sizeof(buf) - uio.uio_resid]; for (dp = (struct dirent*)buf; !error && dp < edp; From nobody Sat Nov 6 14:02:21 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C6A671843FE9; Sat, 6 Nov 2021 14:02: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 4HmfFq1yG0z3KlZ; Sat, 6 Nov 2021 14:02: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 C1A764659; Sat, 6 Nov 2021 14:02: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 1A6E2LTS024004; Sat, 6 Nov 2021 14:02:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6E2LbF024003; Sat, 6 Nov 2021 14:02:21 GMT (envelope-from git) Date: Sat, 6 Nov 2021 14:02:21 GMT Message-Id: <202111061402.1A6E2LbF024003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 5f73b3338ee1 - main - unionfs: Improve vnode validation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f73b3338ee10ea843da3ae8b241320b8293a35b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=5f73b3338ee10ea843da3ae8b241320b8293a35b commit 5f73b3338ee10ea843da3ae8b241320b8293a35b Author: Jason A. Harmening AuthorDate: 2021-10-28 05:37:48 +0000 Commit: Jason A. Harmening CommitDate: 2021-11-06 14:08:34 +0000 unionfs: Improve vnode validation Instead of validating that a vnode belongs to unionfs only when the caller attempts to extract the upper or lower vnode pointers, do this validation any time the caller tries to extract a unionfs_node from the vnode private data. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D32629 --- sys/fs/unionfs/union.h | 26 ++++++++++++++++---------- sys/fs/unionfs/union_subr.c | 42 ------------------------------------------ 2 files changed, 16 insertions(+), 52 deletions(-) diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index 5708998c6043..eda24c1b8333 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -108,8 +108,23 @@ struct unionfs_node { #define UNIONFS_OPENEXTL 0x01 /* openextattr (lower) */ #define UNIONFS_OPENEXTU 0x02 /* openextattr (upper) */ +extern struct vop_vector unionfs_vnodeops; + +static inline struct unionfs_node * +unionfs_check_vnode(struct vnode *vp, const char *file __unused, + int line __unused) +{ + /* + * unionfs_lock() needs the NULL check here, as it explicitly + * handles the case in which the vnode has been vgonel()'ed. + */ + KASSERT(vp->v_op == &unionfs_vnodeops || vp->v_data == NULL, + ("%s:%d: non-unionfs vnode %p", file, line, vp)); + return ((struct unionfs_node *)vp->v_data); +} + #define MOUNTTOUNIONFSMOUNT(mp) ((struct unionfs_mount *)((mp)->mnt_data)) -#define VTOUNIONFS(vp) ((struct unionfs_node *)(vp)->v_data) +#define VTOUNIONFS(vp) unionfs_check_vnode(vp, __FILE__, __LINE__) #define UNIONFSTOV(xp) ((xp)->un_vnode) int unionfs_init(struct vfsconf *); @@ -143,17 +158,8 @@ int unionfs_relookup_for_delete(struct vnode *, struct componentname *, int unionfs_relookup_for_rename(struct vnode *, struct componentname *, struct thread *); -#ifdef DIAGNOSTIC -struct vnode *unionfs_checklowervp(struct vnode *, char *, int); -struct vnode *unionfs_checkuppervp(struct vnode *, char *, int); -#define UNIONFSVPTOLOWERVP(vp) unionfs_checklowervp((vp), __FILE__, __LINE__) -#define UNIONFSVPTOUPPERVP(vp) unionfs_checkuppervp((vp), __FILE__, __LINE__) -#else #define UNIONFSVPTOLOWERVP(vp) (VTOUNIONFS(vp)->un_lowervp) #define UNIONFSVPTOUPPERVP(vp) (VTOUNIONFS(vp)->un_uppervp) -#endif - -extern struct vop_vector unionfs_vnodeops; #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_UNIONFSNODE); diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 8269b1e11fa4..195d74583443 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -1310,45 +1310,3 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td) return (error); } -#ifdef DIAGNOSTIC - -struct vnode * -unionfs_checkuppervp(struct vnode *vp, char *fil, int lno) -{ - struct unionfs_node *unp; - - unp = VTOUNIONFS(vp); - -#ifdef notyet - if (vp->v_op != unionfs_vnodeop_p) { - printf("%s: on non-unionfs-node.\n", __func__); -#ifdef KDB - kdb_enter(KDB_WHY_UNIONFS, - "unionfs_checkuppervp: on non-unionfs-node.\n"); -#endif - panic("%s", __func__); - } -#endif - return (unp->un_uppervp); -} - -struct vnode * -unionfs_checklowervp(struct vnode *vp, char *fil, int lno) -{ - struct unionfs_node *unp; - - unp = VTOUNIONFS(vp); - -#ifdef notyet - if (vp->v_op != unionfs_vnodeop_p) { - printf("%s: on non-unionfs-node.\n", __func__); -#ifdef KDB - kdb_enter(KDB_WHY_UNIONFS, - "unionfs_checklowervp: on non-unionfs-node.\n"); -#endif - panic("%s", __func__); - } -#endif - return (unp->un_lowervp); -} -#endif From nobody Sat Nov 6 15:03:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AE37B183E2AB; Sat, 6 Nov 2021 15:03: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 4HmgcF4P7Yz4RVt; Sat, 6 Nov 2021 15:03: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 76B7D56AF; Sat, 6 Nov 2021 15:03: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 1A6F3Px3004204; Sat, 6 Nov 2021 15:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6F3P2t004203; Sat, 6 Nov 2021 15:03:25 GMT (envelope-from git) Date: Sat, 6 Nov 2021 15:03:25 GMT Message-Id: <202111061503.1A6F3P2t004203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: b6b91760300b - stable/13 - rtld: Do not install libmap.conf when installing the COMPAT32 version List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b6b91760300b684d46ba84f8500b2dffe2e5e274 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b6b91760300b684d46ba84f8500b2dffe2e5e274 commit b6b91760300b684d46ba84f8500b2dffe2e5e274 Author: Emmanuel Vadot AuthorDate: 2021-10-13 12:40:26 +0000 Commit: Emmanuel Vadot CommitDate: 2021-11-06 15:03:06 +0000 rtld: Do not install libmap.conf when installing the COMPAT32 version This has the effect of installing the same file twice at the same location and confuse pkgbase as we add this file twice in the package config part. MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit d0f0e0bd741af867582ceede8ac1b0aec90eae2d) --- libexec/rtld-elf/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 9ae998942a12..b8354e1b6f2d 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -11,7 +11,9 @@ PACKAGE= clibs MK_PIE= no # Always position independent using local rules MK_SSP= no +.if !defined(NEED_COMPAT) CONFS= libmap.conf +.endif PROG?= ld-elf.so.1 .if (${PROG:M*ld-elf32*} != "") TAGS+= lib32 From nobody Sat Nov 6 15:16:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 704FF1846505; Sat, 6 Nov 2021 15:17:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hmgw10xmZz4X20; Sat, 6 Nov 2021 15:17:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 1A6FGudA038008; Sat, 6 Nov 2021 08:16:56 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 1A6FGuAe038007; Sat, 6 Nov 2021 08:16:56 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202111061516.1A6FGuAe038007@gndrsh.dnsmgr.net> Subject: Re: git: 6badb512a94d - main - Prefer CPUID leaf 1Fh for Intel CPU topology detection. In-Reply-To: <202111060454.1A64sB3B077957@gitrepo.freebsd.org> To: Alexander Motin Date: Sat, 6 Nov 2021 08:16:56 -0700 (PDT) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4Hmgw10xmZz4X20 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N > The branch main has been updated by mav: > > URL: https://cgit.FreeBSD.org/src/commit/?id=6badb512a94df667f0df1484fb288ece186305bd > > commit 6badb512a94df667f0df1484fb288ece186305bd > Author: Alexander Motin > AuthorDate: 2021-11-06 04:48:37 +0000 > Commit: Alexander Motin > CommitDate: 2021-11-06 04:53:52 +0000 > > Prefer CPUID leaf 1Fh for Intel CPU topology detection. > > Leaf 1Fh is a prefered extended version of 0Bh. It is supported by > new Lader Lake CPUs, though does not report anything new so far. > > MFC after: 2 weeks > --- > sys/x86/x86/mp_x86.c | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c > index 7a72c501ff25..3b0e25172d0d 100644 > --- a/sys/x86/x86/mp_x86.c > +++ b/sys/x86/x86/mp_x86.c > @@ -380,7 +380,7 @@ topo_probe_intel_0x4(void) > > /* > * Determine topology of processing units for Intel CPUs > - * using CPUID Leaf 11, if supported. > + * using CPUID Leaf 1Fh or 0Bh, if supported. > * See: > * - Intel 64 Architecture Processor Topology Enumeration > * - Intel 64 and IA-32 ArchitecturesSoftware Developer?s Manual, > @@ -390,13 +390,23 @@ topo_probe_intel_0x4(void) > static void > topo_probe_intel_0xb(void) > { > - u_int p[4]; > + u_int leaf; > + u_int p[4] = { 0 }; > int bits; > int type; > int i; > > - /* Fall back if CPU leaf 11 doesn't really exist. */ > - cpuid_count(0x0b, 0, p); > + /* Prefer leaf 1Fh (V2 Extended Topology Enumeration). */ > + if (cpu_high >= 0x1f) { > + leaf = 0x1f; > + cpuid_count(leaf, 0, p); > + } > + /* Fall back to leaf 0Bh (Extended Topology Enumeration). */ > + if (p[1] == 0) { > + leaf = 0x0b; > + cpuid_count(leaf, 0, p); > + } > + /* Fall back to leaf 04h (Deterministic Cache Parameters). */ > if (p[1] == 0) { > topo_probe_intel_0x4(); > return; > @@ -404,7 +414,7 @@ topo_probe_intel_0xb(void) > > /* We only support three levels for now. */ > for (i = 0; ; i++) { > - cpuid_count(0x0b, i, p); > + cpuid_count(leaf, i, p); > > bits = p[0] & 0x1f; > type = (p[2] >> 8) & 0xff; > @@ -412,13 +422,12 @@ topo_probe_intel_0xb(void) > if (type == 0) > break; > > - /* TODO: check for duplicate (re-)assignment */ > if (type == CPUID_TYPE_SMT) > core_id_shift = bits; > else if (type == CPUID_TYPE_CORE) > pkg_id_shift = bits; > - else > - printf("unknown CPU level type %d\n", type); Why do we loose this potential diagnostic message, and isnt its trailing \n needed to close the probe message? It would need to be come an else of the if (bootverbose) if I am reading things correctly. > + else if (bootverbose) > + printf("Topology level type %d shift: %d\n", type, bits); > } > > if (pkg_id_shift < core_id_shift) { > -- Rod Grimes rgrimes@freebsd.org From nobody Sat Nov 6 15:45:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6EB7317DCE29; Sat, 6 Nov 2021 15:45:38 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HmhXy2VGGz4gqw; Sat, 6 Nov 2021 15:45:38 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x72e.google.com with SMTP id c20so1519634qko.10; Sat, 06 Nov 2021 08:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mRGa7237yGXvKFxbS0Vk5p++Rip/FNAm6c5lyxezwPs=; b=F2pGVDSHfoicWYbWuiWc/T0o6VfQBz1svc4M5wMKIeBFAGFY+srnxY+KOgq3uD7de1 ojY9VeV22Tfp+NN2vHq7FXu2FS2aKg2giwneBTVLCzwDamLXUtI6r6zXpQMYrSt1CwR9 4Sd6dX8LH7G6MWdCGeSS5dfdZUXtsvU89kwpzzne9CeZDPZDJl4MXNpBViG4UAKcLEcj OePO+Z8ShdFpJRevhCHyHbZrRY4q7tNdikA+VF5KN5LT1NjfjVTDqo8QTAjbIfDEvC3T LrM29/V9pAz8OvUmFh4KnFMfuFLPFB5ivL9HQYGDe4FDgpIFHbfP80sxX7ZAHvB6nZbS nizA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mRGa7237yGXvKFxbS0Vk5p++Rip/FNAm6c5lyxezwPs=; b=E2xxADtTXUL10J4D1pOp4eldgzl+rnjcq96HaPluHFRnIUGBT1k43SM0EQQT9BMTTf Miltj6EqKkMlk/4KWNFM5udMGKZlbgm4JHRpP7OK7ESn6y4/0xRaGOPwWxNOjEMVhmnd pFePpb+TVtcxNVHhN5nVi6EFT5nJJIP2JLDnd01nwjXmskv5uogWRJpyjGdbdI74QrKK x8Kf8NyIYNDkQxUkbsblLwFnC+1fobXv88KGorrMZ99oquDHU8odYV8f2jb7hqAOm2Rp g7fjBm2fYGRyNtFqvarUmMxTBtG1enVFG5JUYxh34Js3VK2/Iu8uXlPwfKZzG9D7wk9i BzDA== X-Gm-Message-State: AOAM533ivI4U7AQGit9ahYzB87CpgmNCt9AXeA58/6phljgcFLP5qRZr VSHelpd+XbOBPB6lU76tMqm9ajVvjcM= X-Google-Smtp-Source: ABdhPJy7gxh4V39+dDVOu58JYPWrnSGpV3eOvq+LnffQ9/hfhkOinhuFlSwVFFAs9XHjduK9BGoiaA== X-Received: by 2002:a05:620a:4550:: with SMTP id u16mr32559019qkp.112.1636213537576; Sat, 06 Nov 2021 08:45:37 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id v18sm1921868qta.56.2021.11.06.08.45.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Nov 2021 08:45:36 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: 6badb512a94d - main - Prefer CPUID leaf 1Fh for Intel CPU topology detection. To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202111061516.1A6FGuAe038007@gndrsh.dnsmgr.net> From: Alexander Motin Message-ID: <2eeb65b1-4f75-9c92-f885-0a9bb2b6cf99@FreeBSD.org> Date: Sat, 6 Nov 2021 11:45:36 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 In-Reply-To: <202111061516.1A6FGuAe038007@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HmhXy2VGGz4gqw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi Rodney, On 06.11.2021 11:16, Rodney W. Grimes wrote: >> /* We only support three levels for now. */ >> for (i = 0; ; i++) { >> - cpuid_count(0x0b, i, p); >> + cpuid_count(leaf, i, p); >> >> bits = p[0] & 0x1f; >> type = (p[2] >> 8) & 0xff; >> @@ -412,13 +422,12 @@ topo_probe_intel_0xb(void) >> if (type == 0) >> break; >> >> - /* TODO: check for duplicate (re-)assignment */ >> if (type == CPUID_TYPE_SMT) >> core_id_shift = bits; >> else if (type == CPUID_TYPE_CORE) >> pkg_id_shift = bits; >> - else >> - printf("unknown CPU level type %d\n", type); > > Why do we loose this potential diagnostic message, Because it is not an error and not important for average user. New specifications list addition of such levels as Module, Tile and Die, meaning of which and OS use is unclear at this point. I've actually made the new message more informative under the bootverbose to help later developers when the time of those types come. > and isnt its trailing \n needed to close the probe message? > It would need to be come an else of the if (bootverbose) if > I am reading things correctly. It does not close any probe message, it is a full line, so there is nothing for "else". >> + else if (bootverbose) >> + printf("Topology level type %d shift: %d\n", type, bits); >> } >> >> if (pkg_id_shift < core_id_shift) { >> > -- Alexander Motin From nobody Sat Nov 6 16:46:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F3FD7184F244; Sat, 6 Nov 2021 16:46: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 4Hmjty6Z7Hz3JMl; Sat, 6 Nov 2021 16:46: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 C252B6BC5; Sat, 6 Nov 2021 16:46: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 1A6GkIoH036878; Sat, 6 Nov 2021 16:46:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6GkIj4036877; Sat, 6 Nov 2021 16:46:18 GMT (envelope-from git) Date: Sat, 6 Nov 2021 16:46:18 GMT Message-Id: <202111061646.1A6GkIj4036877@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: 0dedcdaa1a02 - main - Revert "ossl: Add support for ETA mode" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 0dedcdaa1a023d46c8951f03cd2f9df7ae025675 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=0dedcdaa1a023d46c8951f03cd2f9df7ae025675 commit 0dedcdaa1a023d46c8951f03cd2f9df7ae025675 Author: Wojciech Macek AuthorDate: 2021-11-06 16:45:50 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 16:45:50 +0000 Revert "ossl: Add support for ETA mode" This reverts commit 048a71b46e816de8fb95b553a8ad0e98c0d51e12. --- sys/crypto/openssl/ossl.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index f41ff09c371d..f46b5a966bb1 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -172,13 +172,6 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) if (ossl_lookup_cipher(csp) == NULL) return (EINVAL); break; - case CSP_MODE_ETA: - if (!sc->has_aes || - csp->csp_cipher_alg == CRYPTO_CHACHA20 || - ossl_lookup_hash(csp) == NULL || - ossl_lookup_cipher(csp) == NULL) - return (EINVAL); - break; case CSP_MODE_AEAD: switch (csp->csp_cipher_alg) { case CRYPTO_CHACHA20_POLY1305: @@ -275,10 +268,6 @@ ossl_newsession(device_t dev, crypto_session_t cses, case CSP_MODE_CIPHER: error = ossl_newsession_cipher(s, csp); break; - case CSP_MODE_ETA: - ossl_newsession_hash(s, csp); - error = ossl_newsession_cipher(s, csp); - break; } return (error); @@ -352,25 +341,6 @@ out: return (error); } -static int -ossl_process_eta(struct ossl_session *s, struct cryptop *crp, - const struct crypto_session_params *csp) -{ - int error; - - if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - error = s->cipher.cipher->process(&s->cipher, crp, csp); - if (error == 0) - error = ossl_process_hash(s, crp, csp); - } else { - error = ossl_process_hash(s, crp, csp); - if (error == 0) - error = s->cipher.cipher->process(&s->cipher, crp, csp); - } - - return (error); -} - static int ossl_process(device_t dev, struct cryptop *crp, int hint) { @@ -396,9 +366,6 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) case CSP_MODE_CIPHER: error = s->cipher.cipher->process(&s->cipher, crp, csp); break; - case CSP_MODE_ETA: - error = ossl_process_eta(s, crp, csp); - break; case CSP_MODE_AEAD: if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) error = ossl_chacha20_poly1305_encrypt(crp, csp); From nobody Sat Nov 6 16:46:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 48279184F29F; Sat, 6 Nov 2021 16:46: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 4Hmjv00Fw4z3JCL; Sat, 6 Nov 2021 16:46: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 DE1906A3E; Sat, 6 Nov 2021 16:46: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 1A6GkJkq036908; Sat, 6 Nov 2021 16:46:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6GkJtc036907; Sat, 6 Nov 2021 16:46:19 GMT (envelope-from git) Date: Sat, 6 Nov 2021 16:46:19 GMT Message-Id: <202111061646.1A6GkJtc036907@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: 200bc58953f0 - main - Revert "ossl: Add support for AES-CBC cipher" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 200bc58953f0f5403d5ae57691f34500afe4c614 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=200bc58953f0f5403d5ae57691f34500afe4c614 commit 200bc58953f0f5403d5ae57691f34500afe4c614 Author: Wojciech Macek AuthorDate: 2021-11-06 16:46:01 +0000 Commit: Wojciech Macek CommitDate: 2021-11-06 16:46:01 +0000 Revert "ossl: Add support for AES-CBC cipher" This reverts commit 849faf4e0ba9a8b8f24ff34da93a0fd46c14eda9. --- share/man/man4/ossl.4 | 4 +- sys/conf/files | 1 - sys/conf/files.amd64 | 1 - sys/conf/files.arm64 | 4 - sys/conf/files.i386 | 1 - sys/crypto/openssl/ossl.c | 94 ++++++----------------- sys/crypto/openssl/ossl.h | 36 +-------- sys/crypto/openssl/ossl_aarch64.c | 23 +----- sys/crypto/openssl/ossl_aarch64.h | 31 -------- sys/crypto/openssl/ossl_aes.c | 153 ------------------------------------- sys/crypto/openssl/ossl_chacha20.c | 18 +---- sys/crypto/openssl/ossl_cipher.h | 53 ------------- sys/crypto/openssl/ossl_x86.c | 15 +--- sys/crypto/openssl/ossl_x86.h | 20 ----- sys/modules/ossl/Makefile | 14 ---- tests/sys/opencrypto/cryptotest.py | 2 +- 16 files changed, 34 insertions(+), 436 deletions(-) diff --git a/share/man/man4/ossl.4 b/share/man/man4/ossl.4 index 039ce301ac29..5929e46e9fe3 100644 --- a/share/man/man4/ossl.4 +++ b/share/man/man4/ossl.4 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2021 +.Dd March 3, 2021 .Dt OSSL 4 .Os .Sh NAME @@ -74,8 +74,6 @@ driver includes support for the following algorithms: .Pp .Bl -bullet -compact .It -AES-CBC -.It ChaCha20 .It ChaCha20-Poly1305 (RFC 8439) diff --git a/sys/conf/files b/sys/conf/files index 9743341f6e45..f2663fd1c6c0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -716,7 +716,6 @@ crypto/chacha20/chacha-sw.c optional crypto | ipsec | ipsec_support crypto/des/des_ecb.c optional netsmb crypto/des/des_setkey.c optional netsmb crypto/openssl/ossl.c optional ossl -crypto/openssl/ossl_aes.c optional ossl crypto/openssl/ossl_chacha20.c optional ossl crypto/openssl/ossl_poly1305.c optional ossl crypto/openssl/ossl_sha1.c optional ossl diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 6b51c1a5a55d..37ff6404cdba 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -88,7 +88,6 @@ cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/des/des_enc.c optional netsmb -crypto/openssl/amd64/aesni-x86_64.S optional ossl crypto/openssl/amd64/chacha-x86_64.S optional ossl crypto/openssl/amd64/poly1305-x86_64.S optional ossl crypto/openssl/amd64/sha1-x86_64.S optional ossl diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index e718e9b93847..a0bdaeb475d6 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -128,8 +128,6 @@ ghashv8-armx.o optional armv8crypto \ crypto/des/des_enc.c optional netsmb crypto/openssl/ossl_aarch64.c optional ossl -crypto/openssl/aarch64/aesv8-armx.S optional ossl \ - compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} -march=armv8-a+crypto ${.IMPSRC}" crypto/openssl/aarch64/chacha-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" crypto/openssl/aarch64/poly1305-armv8.S optional ossl \ @@ -140,8 +138,6 @@ crypto/openssl/aarch64/sha256-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" crypto/openssl/aarch64/sha512-armv8.S optional ossl \ compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" -crypto/openssl/aarch64/vpaes-armv8.S optional ossl \ - compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC}" dev/acpica/acpi_bus_if.m optional acpi dev/acpica/acpi_if.m optional acpi diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 0c681d6a84a0..e83bcd5a3492 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -15,7 +15,6 @@ cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_i386.S optional aesni crypto/des/arch/i386/des_enc.S optional netsmb -crypto/openssl/i386/aesni-x86.S optional ossl crypto/openssl/i386/chacha-x86.S optional ossl crypto/openssl/i386/poly1305-x86.S optional ossl crypto/openssl/i386/sha1-586.S optional ossl diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c index f46b5a966bb1..ad9b93dd960d 100644 --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -49,10 +49,24 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "cryptodev_if.h" +struct ossl_softc { + int32_t sc_cid; +}; + +struct ossl_session_hash { + struct ossl_hash_context ictx; + struct ossl_hash_context octx; + struct auth_hash *axf; + u_int mlen; +}; + +struct ossl_session { + struct ossl_session_hash hash; +}; + static MALLOC_DEFINE(M_OSSL, "ossl", "OpenSSL crypto"); static void @@ -78,7 +92,7 @@ ossl_attach(device_t dev) sc = device_get_softc(dev); - ossl_cpuid(sc); + ossl_cpuid(); sc->sc_cid = crypto_get_driverid(dev, sizeof(struct ossl_session), CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | CRYPTOCAP_F_ACCEL_SOFTWARE); @@ -129,34 +143,9 @@ ossl_lookup_hash(const struct crypto_session_params *csp) } } -static struct ossl_cipher* -ossl_lookup_cipher(const struct crypto_session_params *csp) -{ - - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_CBC: - switch (csp->csp_cipher_klen * 8) { - case 128: - case 192: - case 256: - break; - default: - return (NULL); - } - return (&ossl_cipher_aes_cbc); - case CRYPTO_CHACHA20: - if (csp->csp_cipher_klen != CHACHA_KEY_SIZE) - return (NULL); - return (&ossl_cipher_chacha20); - default: - return (NULL); - } -} - static int ossl_probesession(device_t dev, const struct crypto_session_params *csp) { - struct ossl_softc *sc = device_get_softc(dev); if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) != 0) @@ -167,10 +156,14 @@ ossl_probesession(device_t dev, const struct crypto_session_params *csp) return (EINVAL); break; case CSP_MODE_CIPHER: - if (csp->csp_cipher_alg != CRYPTO_CHACHA20 && !sc->has_aes) - return (EINVAL); - if (ossl_lookup_cipher(csp) == NULL) + switch (csp->csp_cipher_alg) { + case CRYPTO_CHACHA20: + if (csp->csp_cipher_klen != CHACHA_KEY_SIZE) + return (EINVAL); + break; + default: return (EINVAL); + } break; case CSP_MODE_AEAD: switch (csp->csp_cipher_alg) { @@ -220,57 +213,20 @@ ossl_newsession_hash(struct ossl_session *s, } } -static int -ossl_newsession_cipher(struct ossl_session *s, - const struct crypto_session_params *csp) -{ - struct ossl_cipher *cipher; - int error = 0; - - cipher = ossl_lookup_cipher(csp); - if (cipher == NULL) - return (EINVAL); - - s->cipher.cipher = cipher; - - if (csp->csp_cipher_key == NULL) - return (0); - - fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); - if (cipher->set_encrypt_key != NULL) { - error = cipher->set_encrypt_key(csp->csp_cipher_key, - 8 * csp->csp_cipher_klen, &s->cipher.enc_ctx); - if (error != 0) { - fpu_kern_leave(curthread, NULL); - return (error); - } - } - if (cipher->set_decrypt_key != NULL) - error = cipher->set_decrypt_key(csp->csp_cipher_key, - 8 * csp->csp_cipher_klen, &s->cipher.dec_ctx); - fpu_kern_leave(curthread, NULL); - - return (error); -} - static int ossl_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { struct ossl_session *s; - int error = 0; s = crypto_get_driver_session(cses); switch (csp->csp_mode) { case CSP_MODE_DIGEST: ossl_newsession_hash(s, csp); break; - case CSP_MODE_CIPHER: - error = ossl_newsession_cipher(s, csp); - break; } - return (error); + return (0); } static int @@ -364,7 +320,7 @@ ossl_process(device_t dev, struct cryptop *crp, int hint) error = ossl_process_hash(s, crp, csp); break; case CSP_MODE_CIPHER: - error = s->cipher.cipher->process(&s->cipher, crp, csp); + error = ossl_chacha20(crp, csp); break; case CSP_MODE_AEAD: if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) diff --git a/sys/crypto/openssl/ossl.h b/sys/crypto/openssl/ossl.h index 4f5353818add..11793dca037a 100644 --- a/sys/crypto/openssl/ossl.h +++ b/sys/crypto/openssl/ossl.h @@ -36,47 +36,20 @@ struct cryptop; struct crypto_session_params; -struct ossl_softc; -struct ossl_session; +int ossl_chacha20(struct cryptop *crp, + const struct crypto_session_params *csp); int ossl_chacha20_poly1305_decrypt(struct cryptop *crp, const struct crypto_session_params *csp); int ossl_chacha20_poly1305_encrypt(struct cryptop *crp, const struct crypto_session_params *csp); -void ossl_cpuid(struct ossl_softc *sc); - -struct ossl_softc { - int32_t sc_cid; - bool has_aes; -}; +void ossl_cpuid(void); /* Needs to be big enough to hold any hash context. */ struct ossl_hash_context { uint32_t dummy[61]; } __aligned(32); -struct ossl_cipher_context { - uint32_t dummy[61]; -} __aligned(32); - -struct ossl_session_hash { - struct ossl_hash_context ictx; - struct ossl_hash_context octx; - struct auth_hash *axf; - u_int mlen; -}; - -struct ossl_session_cipher { - struct ossl_cipher_context dec_ctx; - struct ossl_cipher_context enc_ctx; - struct ossl_cipher *cipher; -}; - -struct ossl_session { - struct ossl_session_cipher cipher; - struct ossl_session_hash hash; -}; - extern struct auth_hash ossl_hash_poly1305; extern struct auth_hash ossl_hash_sha1; extern struct auth_hash ossl_hash_sha224; @@ -84,7 +57,4 @@ extern struct auth_hash ossl_hash_sha256; extern struct auth_hash ossl_hash_sha384; extern struct auth_hash ossl_hash_sha512; -extern struct ossl_cipher ossl_cipher_aes_cbc; -extern struct ossl_cipher ossl_cipher_chacha20; - #endif /* !__OSSL_H__ */ diff --git a/sys/crypto/openssl/ossl_aarch64.c b/sys/crypto/openssl/ossl_aarch64.c index e4b87a75a403..2a45a848808a 100644 --- a/sys/crypto/openssl/ossl_aarch64.c +++ b/sys/crypto/openssl/ossl_aarch64.c @@ -36,7 +36,6 @@ #include #include -#include #include /* @@ -44,14 +43,8 @@ */ unsigned int OPENSSL_armcap_P; -ossl_cipher_setkey_t aes_v8_set_encrypt_key; -ossl_cipher_setkey_t aes_v8_set_decrypt_key; - -ossl_cipher_setkey_t vpaes_set_encrypt_key; -ossl_cipher_setkey_t vpaes_set_decrypt_key; - void -ossl_cpuid(struct ossl_softc *sc) +ossl_cpuid(void) { /* SHA features */ if ((elf_hwcap & HWCAP_SHA1) != 0) @@ -66,18 +59,4 @@ ossl_cpuid(struct ossl_softc *sc) OPENSSL_armcap_P |= ARMV8_AES; if ((elf_hwcap & HWCAP_PMULL) != 0) OPENSSL_armcap_P |= ARMV8_PMULL; - - if ((OPENSSL_armcap_P & ARMV8_AES) == 0 && - (OPENSSL_armcap_P & ARMV7_NEON) == 0) { - sc->has_aes = false; - return; - } - sc->has_aes = true; - if (OPENSSL_armcap_P & ARMV8_AES) { - ossl_cipher_aes_cbc.set_encrypt_key = aes_v8_set_encrypt_key; - ossl_cipher_aes_cbc.set_decrypt_key = aes_v8_set_decrypt_key; - } else { - ossl_cipher_aes_cbc.set_encrypt_key = vpaes_set_encrypt_key; - ossl_cipher_aes_cbc.set_decrypt_key = vpaes_set_decrypt_key; - } } diff --git a/sys/crypto/openssl/ossl_aarch64.h b/sys/crypto/openssl/ossl_aarch64.h deleted file mode 100644 index f933f862d009..000000000000 --- a/sys/crypto/openssl/ossl_aarch64.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef __OSSL_AARCH64__ -#define __OSSL_AARCH64__ - -#include -#include -#include - -/* aesv8-armx.S */ -ossl_cipher_encrypt_t aes_v8_cbc_encrypt; -/* vpaes-armv8.S */ -ossl_cipher_encrypt_t vpaes_cbc_encrypt; - -static void -AES_CBC_ENCRYPT(const unsigned char *in, unsigned char *out, - size_t length, const void *key, unsigned char *iv, int encrypt) -{ - if (OPENSSL_armcap_P & ARMV8_AES) - aes_v8_cbc_encrypt(in, out, length, key, iv, encrypt); - else - vpaes_cbc_encrypt(in, out, length, key, iv, encrypt); -} -#endif diff --git a/sys/crypto/openssl/ossl_aes.c b/sys/crypto/openssl/ossl_aes.c deleted file mode 100644 index 93f16e7dce55..000000000000 --- a/sys/crypto/openssl/ossl_aes.c +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2021 Stormshield. - * Copyright (c) 2021 Semihalf. - * - * 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 ``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 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 - -#if defined(__amd64__) || defined(__i386__) -#include -#elif defined (__aarch64__) -#include -#endif - -static ossl_cipher_process_t ossl_aes_cbc; - -struct ossl_cipher ossl_cipher_aes_cbc = { - .type = CRYPTO_AES_CBC, - .blocksize = AES_BLOCK_LEN, - .ivsize = AES_BLOCK_LEN, - - /* Filled during initialization based on CPU caps. */ - .set_encrypt_key = NULL, - .set_decrypt_key = NULL, - .process = ossl_aes_cbc -}; - -static int -ossl_aes_cbc(struct ossl_session_cipher *s, struct cryptop *crp, - const struct crypto_session_params *csp) -{ - struct crypto_buffer_cursor cc_in, cc_out; - unsigned char block[EALG_MAX_BLOCK_LEN]; - unsigned char iv[EALG_MAX_BLOCK_LEN]; - const unsigned char *in, *inseg; - unsigned char *out, *outseg; - size_t plen, seglen, inlen, outlen; - struct ossl_cipher_context key; - struct ossl_cipher *cipher; - int blocklen, error; - bool encrypt; - - cipher = s->cipher; - encrypt = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); - plen = crp->crp_payload_length; - blocklen = cipher->blocksize; - - if (plen % blocklen) - return (EINVAL); - - if (crp->crp_cipher_key != NULL) { - if (encrypt) - error = cipher->set_encrypt_key(crp->crp_cipher_key, - 8 * csp->csp_cipher_klen, &key); - else - error = cipher->set_decrypt_key(crp->crp_cipher_key, - 8 * csp->csp_cipher_klen, &key); - if (error) - return (error); - } else { - if (encrypt) - key = s->enc_ctx; - else - key = s->dec_ctx; - } - - crypto_read_iv(crp, iv); - - /* Derived from ossl_chacha20.c */ - crypto_cursor_init(&cc_in, &crp->crp_buf); - crypto_cursor_advance(&cc_in, crp->crp_payload_start); - inseg = crypto_cursor_segment(&cc_in, &inlen); - if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { - crypto_cursor_init(&cc_out, &crp->crp_obuf); - crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); - } else { - cc_out = cc_in; - } - outseg = crypto_cursor_segment(&cc_out, &outlen); - - while (plen >= blocklen) { - if (inlen < blocklen) { - crypto_cursor_copydata(&cc_in, blocklen, block); - in = block; - inlen = blocklen; - } else { - in = inseg; - } - if (outlen < blocklen) { - out = block; - outlen = blocklen; - } else { - out = outseg; - } - - /* Figure out how many blocks we can encrypt/decrypt at once. */ - seglen = rounddown(MIN(plen, MIN(inlen, outlen)), blocklen); - - AES_CBC_ENCRYPT(in, out, seglen, &key, iv, encrypt); - - if (out == block) { - crypto_cursor_copyback(&cc_out, blocklen, block); - outseg = crypto_cursor_segment(&cc_out, &outlen); - } else { - crypto_cursor_advance(&cc_out, seglen); - outseg += seglen; - outlen -= seglen; - } - if (in == block) { - inseg = crypto_cursor_segment(&cc_in, &inlen); - } else { - crypto_cursor_advance(&cc_in, seglen); - inseg += seglen; - inlen -= seglen; - } - plen -= seglen; - } - - explicit_bzero(block, sizeof(block)); - explicit_bzero(iv, sizeof(iv)); - explicit_bzero(&key, sizeof(key)); - return (0); -} diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index c21a28470a26..aa125121e8b4 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -37,24 +37,10 @@ #include #include -#include #include -static ossl_cipher_process_t ossl_chacha20; - -struct ossl_cipher ossl_cipher_chacha20 = { - .type = CRYPTO_CHACHA20, - .blocksize = CHACHA_BLK_SIZE, - .ivsize = CHACHA_CTR_SIZE, - - .set_encrypt_key = NULL, - .set_decrypt_key = NULL, - .process = ossl_chacha20 -}; - -static int -ossl_chacha20(struct ossl_session_cipher *s, struct cryptop *crp, - const struct crypto_session_params *csp) +int +ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) { _Alignas(8) unsigned int key[CHACHA_KEY_SIZE / 4]; unsigned int counter[CHACHA_CTR_SIZE / 4]; diff --git a/sys/crypto/openssl/ossl_cipher.h b/sys/crypto/openssl/ossl_cipher.h deleted file mode 100644 index d9e6ec29aafc..000000000000 --- a/sys/crypto/openssl/ossl_cipher.h +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2021 Stormshield. - * Copyright (c) 2021 Semihalf. - * - * 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 ``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 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 __OSSL_CIPHER_H__ -#define __OSSL_CIPHER_H__ - -struct ossl_session_cipher; -struct cryptop; -struct crypto_session_params; - -typedef int (ossl_cipher_setkey_t)(const unsigned char*, int, void*); -typedef int (ossl_cipher_process_t)(struct ossl_session_cipher*, struct cryptop*, - const struct crypto_session_params*); -typedef void (ossl_cipher_encrypt_t)(const unsigned char*, unsigned char*, size_t, - const void*, unsigned char*, int); - -ossl_cipher_encrypt_t ossl_aes_cbc_encrypt; - -struct ossl_cipher { - int type; - uint16_t blocksize; - uint16_t ivsize; - - ossl_cipher_setkey_t *set_encrypt_key; - ossl_cipher_setkey_t *set_decrypt_key; - ossl_cipher_process_t *process; -}; - -#endif diff --git a/sys/crypto/openssl/ossl_x86.c b/sys/crypto/openssl/ossl_x86.c index a1e9a995948b..60ff6fa0c759 100644 --- a/sys/crypto/openssl/ossl_x86.c +++ b/sys/crypto/openssl/ossl_x86.c @@ -39,7 +39,6 @@ #include #include -#include /* * See OPENSSL_ia32cap(3). @@ -50,13 +49,9 @@ * [3] = 0 */ unsigned int OPENSSL_ia32cap_P[4]; -#define AESNI_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32))) - -ossl_cipher_setkey_t aesni_set_encrypt_key; -ossl_cipher_setkey_t aesni_set_decrypt_key; void -ossl_cpuid(struct ossl_softc *sc) +ossl_cpuid(void) { uint64_t xcr0; u_int regs[4]; @@ -117,12 +112,4 @@ ossl_cpuid(struct ossl_softc *sc) OPENSSL_ia32cap_P[1] &= ~(CPUID2_AVX | AMDID2_XOP | CPUID2_FMA); OPENSSL_ia32cap_P[2] &= ~CPUID_STDEXT_AVX2; } - - if (!AESNI_CAPABLE) { - sc->has_aes = false; - return; - } - sc->has_aes = true; - ossl_cipher_aes_cbc.set_encrypt_key = aesni_set_encrypt_key; - ossl_cipher_aes_cbc.set_decrypt_key = aesni_set_decrypt_key; } diff --git a/sys/crypto/openssl/ossl_x86.h b/sys/crypto/openssl/ossl_x86.h deleted file mode 100644 index 12bd5a4eaddb..000000000000 --- a/sys/crypto/openssl/ossl_x86.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef __OSSL_X86__ -#define __OSSL_X86__ - -#include -#include - -/* aesni-x86_64.S, aesni-x86.S */ -ossl_cipher_encrypt_t aesni_cbc_encrypt; - -#define AES_CBC_ENCRYPT aesni_cbc_encrypt -#endif diff --git a/sys/modules/ossl/Makefile b/sys/modules/ossl/Makefile index 765e70a03edd..dfd82dcf6e1f 100644 --- a/sys/modules/ossl/Makefile +++ b/sys/modules/ossl/Makefile @@ -4,12 +4,10 @@ .PATH: ${SRCTOP}/sys/crypto/openssl/${MACHINE_CPUARCH} KMOD= ossl -OBJS+= ${OBJS.${MACHINE_CPUARCH}} SRCS= bus_if.h \ cryptodev_if.h \ device_if.h \ ossl.c \ - ossl_aes.c \ ossl_chacha20.c \ ossl_poly1305.c \ ossl_sha1.c \ @@ -23,11 +21,9 @@ SRCS.aarch64= \ sha1-armv8.S \ sha256-armv8.S \ sha512-armv8.S \ - vpaes-armv8.S \ ossl_aarch64.c SRCS.amd64= \ - aesni-x86_64.S \ chacha-x86_64.S \ poly1305-x86_64.S \ sha1-x86_64.S \ @@ -36,7 +32,6 @@ SRCS.amd64= \ ossl_x86.c SRCS.i386= \ - aesni-x86.S \ chacha-x86.S \ poly1305-x86.S \ sha1-586.S \ @@ -50,13 +45,4 @@ ${SRCS.aarch64:M*.S:S/S/o/}: ${.TARGET:R}.S ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC} ${CTFCONVERT_CMD} -# Based on modules/armv8crypto/Makefile. -# Clang doesn't recognize "aes*" instructions without -march set. -aesv8-armx.o: aesv8-armx.S - ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} \ - -march=armv8-a+crypto ${.IMPSRC} - ${CTFCONVERT_CMD} - -OBJS.aarch64= aesv8-armx.o - .include diff --git a/tests/sys/opencrypto/cryptotest.py b/tests/sys/opencrypto/cryptotest.py index 447a7854b246..74ce62cee33d 100644 --- a/tests/sys/opencrypto/cryptotest.py +++ b/tests/sys/opencrypto/cryptotest.py @@ -50,7 +50,7 @@ def katg(base, glob): raise unittest.SkipTest("Missing %s test vectors" % (base)) return iglob(os.path.join(katdir, base, glob)) -aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'ossl0', 'safexcel0', 'qat0' ] +aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'safexcel0', 'qat0' ] shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'ossl0', 'safexcel0', 'qat0' ] def GenTestCase(cname): From nobody Sat Nov 6 16:59:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B90CE1837577 for ; Sat, 6 Nov 2021 16:59:54 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HmkBf4H2Vz3NZG for ; Sat, 6 Nov 2021 16:59:54 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x735.google.com with SMTP id r8so11690257qkp.4 for ; Sat, 06 Nov 2021 09:59:54 -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=DidsRh1rAlXrRH78UbHf9A5/66Ez2oYJ3SzbowwAdX4=; b=RBCmzyhz1yHhiPR/UTstrNWDJJZZakoYs7lsqQQw2z/jTvjeP79X6SgYGCh+OZe5uN qisBnqbGKiVRSMa4uuKHYjizVkeo9GgiAP9v/lFMiiJLxZ2/HmyIZeJVt3x5/cYjRXk7 hLo6AYH50H3i7Zkgz7DivmalXkLF/wdo5JGwiu1YhYKbWjHAxYfD8hb9EBV2HddPD3LF Wsotf3rIsM4GUFJrBH49TPledEGBP3eJjTCrTLOqK/c7krnskEf1mipTTzbiE002HOc0 VuJtkXtuY/SE8lB6J1Z+DbW6U6hqDgv3kx/iT9YTXSwJ2o7AxgDfmGrklZFAKZMbP582 R6hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DidsRh1rAlXrRH78UbHf9A5/66Ez2oYJ3SzbowwAdX4=; b=PAkAGj0AChXuNuLKrJpKA0/hsGv9EqZX4+HaWfT9wHSKSuk4Ak9fJ3P/EeLtLFADxH CPvxuGVlDO/4zmIiJy+IMz64JVSxH32rM5JfnJP3ViSLCz+sUnAoXAi1k4wWRyK331+H m3trDhzmAdletpEfs1/Jrm3C2Z/+dK1DXbQFCSGm1C2linvDbcAfaXCuvUN1Vaa/QSL+ AaejHvonSzXOjuWRt9Q/4Fcuv004iVv4cHXj3Mt3Er5nlb+QTwwc63FcuyeMrb+K0RYe KEj03fKrzL5gi8ciENWqre6isGFeIxzN992uNLqOew/fTinqLRPN9x72zUDmL4sLtzj2 1mkA== X-Gm-Message-State: AOAM5318mLsonG6bJp10R3GZp+m3gh4qrqW6TXDW3q3c0BmmcIkJDkdM XhdCZBIbIXqSq0ue1zGGUHboSw== X-Google-Smtp-Source: ABdhPJwkQa+job+VlJUbhAR0/2KfUtE7frniuI0xu5zATgnMJOpG5Q9L7LhrV9BmkmUq/NGpwGX71Q== X-Received: by 2002:a37:660f:: with SMTP id a15mr25917296qkc.73.1636217987853; Sat, 06 Nov 2021 09:59:47 -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 v7sm2548387qki.98.2021.11.06.09.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Nov 2021 09:59:47 -0700 (PDT) Date: Sat, 6 Nov 2021 12:59:46 -0400 From: Shawn Webb To: Wojciech Macek Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0dedcdaa1a02 - main - Revert "ossl: Add support for ETA mode" Message-ID: <20211106165946.zrj7fonoxbca3cj2@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: <202111061646.1A6GkIj4036877@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xlg5tbx6jxdstqa2" Content-Disposition: inline In-Reply-To: <202111061646.1A6GkIj4036877@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HmkBf4H2Vz3NZG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --xlg5tbx6jxdstqa2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 06, 2021 at 04:46:18PM +0000, Wojciech Macek wrote: > The branch main has been updated by wma: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D0dedcdaa1a023d46c8951f03cd= 2f9df7ae025675 >=20 > commit 0dedcdaa1a023d46c8951f03cd2f9df7ae025675 > Author: Wojciech Macek > AuthorDate: 2021-11-06 16:45:50 +0000 > Commit: Wojciech Macek > CommitDate: 2021-11-06 16:45:50 +0000 >=20 > Revert "ossl: Add support for ETA mode" > =20 > This reverts commit 048a71b46e816de8fb95b553a8ad0e98c0d51e12. Why? --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --xlg5tbx6jxdstqa2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmGGtH8ACgkQ/y5nonf4 4frimA/+PVCoFFh0I9SL9RCpZyYLXkjvVo+xWJW63j98phx9N92XwTBN1mkA+Q4m xo2Y+jOAspYlQbyiwpiLnVc/YsaDbwFNFywwUMFWRHXk6WwtShNSqrzDw0OxAov/ 02lKS55duHM/XGmMhGUEWrsMzcTWLEo/d8Xxj86M+03UWK1c0O5jlinTwh53h+O3 aLtHB0UeUW4r2dAP/UV7QjHKd7I2WPq0J/QS6kTxRsuIYKhN5uA2JXIESVaPBUeo kif+r5T6zCH+H5xgZ3/wAWPk0bsq2W3ZpryxklIubp6z/o6DRNugCL7a3liDdogt K50bKf9kC0Ow3KR33LnRwimnqIAQCK+zjZUiMqADTywU7iDsK+RzoscYWqii+35j DBJExNqTTGcnmr9kArRs4gl/xpGTWOjQlYU21xJcLxK0x/KLjZRPoza3Y9h3RiK0 vwMmZlS8/IA+JhIq/5ksuy/VddzcYRGYCNcR9rfJTHSUVIJuZs3AsXrIj0ETAorJ asjk8g2smCM7xPkk4/wXVT7G+dNFP15Y90l/hbFDTUF76Pc/Kb6TeNumzxszhy4g IbW5lnRH/WCa61Jp9aXzbGMq3JB1XMUSr+0SrnrYbmmTk1017QO5HWEzmujQPJGj IwV9NSNkoEd5IVlEg5W0i02xHO1u4BHA8Z319Z0usKdCFJ6lm+o= =kU1P -----END PGP SIGNATURE----- --xlg5tbx6jxdstqa2-- From nobody Sat Nov 6 17:15:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B6AC4183F278; Sat, 6 Nov 2021 17:15: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 4HmkXD4nfZz3jK7; Sat, 6 Nov 2021 17:15: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 7FEBE7171; Sat, 6 Nov 2021 17:15: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 1A6HF80Q077338; Sat, 6 Nov 2021 17:15:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HF8iM077337; Sat, 6 Nov 2021 17:15:08 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:15:08 GMT Message-Id: <202111061715.1A6HF8iM077337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: a60b30469741 - main - pcf8591: driver for adc/dac with i2c interface List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a60b30469741392e66ec6fd21a8d5c4810a2d407 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=a60b30469741392e66ec6fd21a8d5c4810a2d407 commit a60b30469741392e66ec6fd21a8d5c4810a2d407 Author: Andriy Gapon AuthorDate: 2020-08-17 10:05:11 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:14:50 +0000 pcf8591: driver for adc/dac with i2c interface --- share/man/man4/Makefile | 1 + share/man/man4/pcf8591.4 | 122 ++++++++++++++++++ sys/conf/files | 1 + sys/dev/iicbus/pcf8591.c | 271 +++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 1 + sys/modules/i2c/pcf8591/Makefile | 17 +++ 6 files changed, 413 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 742a758f1ec0..bf7f265e7551 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -420,6 +420,7 @@ MAN= aac.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ + pcf8591.4 \ ${_pchtherm.4} \ pci.4 \ pcib.4 \ diff --git a/share/man/man4/pcf8591.4 b/share/man/man4/pcf8591.4 new file mode 100644 index 000000000000..2876ad057f90 --- /dev/null +++ b/share/man/man4/pcf8591.4 @@ -0,0 +1,122 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020 Andriy Gapon +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: head/share/man/man4/cp2112.4 364144 2020-08-12 09:42:05Z avg $ +.\" +.Dd November 6, 2021 +.Dt PCF8591 4 +.Os +.Sh NAME +.Nm pcf8591 +.Nd driver for the PCF8591 8-bit A/D and D/A converter +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pcf8591" +.Cd "device iicbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +pcf8591_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports reading four inputs and setting one output over I2C. +The hardware supports configuring the input lines as: +.Bl -bullet +.It +four single-ended inputs +.It +three differential inputs (one input line is shared between all three inputs) +.It +two single-ended inputs and one differential input +.It +two differential inputs. +.El +.Pp +The +.Nm +driver reports data via +.Xr sysctl 8 +entries in the device's node in the +.Xr sysctl 8 +tree: +.Bl -tag -width inputs.%d +.It Va inputs.%d +The input level of the corresponding input in steps between 0 and 255. +Absolute voltage depends on an actual reference voltage. +.El +.Pp +On an +.Xr FDT 4 +based system the following properties must be set: +.Bl -tag -width "compatible" +.It Va compatible +Must be set to "nxp,pcf8591". +.It Va reg +The I2C address of +.Nm . +It should be in the range from 0x40 to 0x4f (7-bit). +.El +.Pp +The DTS part for a +.Nm +device usually looks like: +.Bd -literal +/ { + + ... + pcf8591adc { + compatible = "nxp,pcf8591"; + reg = <0x48>; + }; +}; +.Ed +.Sh SEE ALSO +.Xr fdt 4 , +.Xr iicbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh BUGS +The +.Nm +driver does not support changing the input configuration. +All input lines are configured as single-ended inputs. +.Pp +The +.Nm +driver does not support setting the output. +It is always disabled (tri-state). diff --git a/sys/conf/files b/sys/conf/files index f2663fd1c6c0..434a783ebbbe 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1855,6 +1855,7 @@ dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt dev/iicbus/mux/ltc430x.c optional ltc430x dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus +dev/iicbus/pcf8591.c optional pcf8591 dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/s35390a.c optional s35390a diff --git a/sys/dev/iicbus/pcf8591.c b/sys/dev/iicbus/pcf8591.c new file mode 100644 index 000000000000..ff769b368d91 --- /dev/null +++ b/sys/dev/iicbus/pcf8591.c @@ -0,0 +1,271 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) Andriy Gapon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef FDT +#include +#include +#endif + +/* + * Driver for PCF8591 I2C 8-bit ADC and DAC. + */ +#define CTRL_CH_SELECT_MASK 0x03 +#define CTRL_AUTOINC_EN 0x04 +#define CTRL_CH_CONFIG_MASK 0x30 +#define CTRL_CH_CONFIG_4_SINGLE 0x00 +#define CTRL_CH_CONFIG_3_DIFF 0x10 +#define CTRL_CH_CONFIG_2_SINGLE_1_DIFF 0x20 +#define CTRL_CH_CONFIG_2_DIFF 0x30 +#define CTRL_OUTPUT_EN 0x40 + +struct pcf8591_softc { + device_t sc_dev; + int sc_ch_count; + uint8_t sc_addr; + uint8_t sc_cfg; + uint8_t sc_output; +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + { "nxp,pcf8591", true }, + { NULL, false } +}; +#endif + +static int +pcf8591_set_config(device_t dev) +{ + + struct iic_msg msg; + uint8_t data[2]; + struct pcf8591_softc *sc; + int error; + + sc = device_get_softc(dev); + data[0] = sc->sc_cfg; + data[1] = sc->sc_output; + msg.slave = sc->sc_addr; + msg.flags = IIC_M_WR; + msg.len = nitems(data); + msg.buf = data; + + error = iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT); + return (error); +} + +static int +pcf8591_get_reading(device_t dev, uint8_t *reading) +{ + struct iic_msg msg; + struct pcf8591_softc *sc; + int error; + + sc = device_get_softc(dev); + + msg.slave = sc->sc_addr; + msg.flags = IIC_M_RD; + msg.len = 1; + msg.buf = reading; + + error = iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT); + return (error); +} + +static int +pcf8591_select_channel(device_t dev, int channel) +{ + struct pcf8591_softc *sc; + int error; + uint8_t unused; + + sc = device_get_softc(dev); + if (channel >= sc->sc_ch_count) + return (EINVAL); + sc->sc_cfg &= ~CTRL_CH_SELECT_MASK; + sc->sc_cfg += channel; + error = pcf8591_set_config(dev); + if (error != 0) + return (error); + + /* + * The next read is still for the old channel, + * so do it and discard. + */ + error = pcf8591_get_reading(dev, &unused); + return (error); +} + +static int +pcf8591_channel_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct pcf8591_softc *sc; + device_t dev; + int error, channel, val; + uint8_t reading; + + dev = arg1; + channel = arg2; + sc = device_get_softc(dev); + + if (req->oldptr != NULL) { + error = pcf8591_select_channel(dev, channel); + if (error != 0) + return (EIO); + error = pcf8591_get_reading(dev, &reading); + if (error != 0) + return (EIO); + val = reading; + } + error = sysctl_handle_int(oidp, &val, 0, req); + return (error); +} + +static void +pcf8591_start(void *arg) +{ + device_t dev; + struct pcf8591_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + struct sysctl_oid *inputs_node; + struct sysctl_oid_list *inputs; + int error; + + sc = arg; + dev = sc->sc_dev; + + /* + * Set initial -- and, for the time being, fixed -- configuration. + * Channel auto-incrementi is disabled, although it could be more + * performant and precise for bulk channel queries. + * The inputs are configured as four single channels. + * The output is disabled. + */ + sc->sc_cfg = 0; + sc->sc_output = 0; + sc->sc_ch_count = 4; + error = pcf8591_set_config(dev); + + ctx = device_get_sysctl_ctx(dev); + tree_node = device_get_sysctl_tree(dev); + tree = SYSCTL_CHILDREN(tree_node); + + inputs_node = SYSCTL_ADD_NODE(ctx, tree, OID_AUTO, "inputs", + CTLTYPE_NODE, NULL, "Input channels"); + inputs = SYSCTL_CHILDREN(inputs_node); + for (int i = 0; i < sc->sc_ch_count; i++) { + char buf[4]; + + snprintf(buf, sizeof(buf), "%d", i); + SYSCTL_ADD_PROC(ctx, inputs, OID_AUTO, buf, + CTLTYPE_INT | CTLFLAG_RD, dev, i, + pcf8591_channel_sysctl, "I", "Input level from 0 to 255 " + "(relative to Vref)"); + } +} + +static int +pcf8591_probe(device_t dev) +{ +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); +#endif + device_set_desc(dev, "PCF8591 8-bit ADC / DAC"); +#ifdef FDT + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (BUS_PROBE_GENERIC); +#endif + return (BUS_PROBE_NOWILDCARD); +} + +static int +pcf8591_attach(device_t dev) +{ + struct pcf8591_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + /* + * We have to wait until interrupts are enabled. Usually I2C read + * and write only works when the interrupts are available. + */ + config_intrhook_oneshot(pcf8591_start, sc); + return (0); +} + +static int +pcf8591_detach(device_t dev) +{ + return (0); +} + +static device_method_t pcf8591_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, pcf8591_probe), + DEVMETHOD(device_attach, pcf8591_attach), + DEVMETHOD(device_detach, pcf8591_detach), + + DEVMETHOD_END +}; + +static driver_t pcf8591_driver = { + "pcf8591", + pcf8591_methods, + sizeof(struct pcf8591_softc) +}; + +static devclass_t pcf8591_devclass; + +DRIVER_MODULE(pcf8591, iicbus, pcf8591_driver, pcf8591_devclass, 0, 0); +MODULE_DEPEND(pcf8591, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(pcf8591, 1); +#ifdef FDT +IICBUS_FDT_PNP_INFO(compat_data); +#endif diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index edd92943c6c1..b79e2a98fc7d 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -20,6 +20,7 @@ SUBDIR = \ jedec_dimm \ mux \ nxprtc \ + pcf8591 \ rtc8583 \ s35390a \ smb \ diff --git a/sys/modules/i2c/pcf8591/Makefile b/sys/modules/i2c/pcf8591/Makefile new file mode 100644 index 000000000000..82148867a00f --- /dev/null +++ b/sys/modules/i2c/pcf8591/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD= pcf8591 +SRCS= pcf8591.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From nobody Sat Nov 6 17:19:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 35D5D1843510; Sat, 6 Nov 2021 17:19: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 4Hmkd70qDxz3lhS; Sat, 6 Nov 2021 17:19: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 F06566F9E; Sat, 6 Nov 2021 17:19: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 1A6HJMiD077851; Sat, 6 Nov 2021 17:19:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HJM5U077850; Sat, 6 Nov 2021 17:19:22 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:19:22 GMT Message-Id: <202111061719.1A6HJM5U077850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: ff6fe2983550 - main - driver for MAX44009 I2C illuminance sensor List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff6fe2983550aeab0852e982e7fe5ac4c672c205 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=ff6fe2983550aeab0852e982e7fe5ac4c672c205 commit ff6fe2983550aeab0852e982e7fe5ac4c672c205 Author: Andriy Gapon AuthorDate: 2020-08-20 08:11:31 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:19:04 +0000 driver for MAX44009 I2C illuminance sensor --- share/man/man4/Makefile | 1 + share/man/man4/max44009.4 | 92 ++++++++++++++++++ sys/conf/files | 1 + sys/dev/iicbus/max44009.c | 193 ++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 1 + sys/modules/i2c/max44009/Makefile | 17 ++++ 6 files changed, 305 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index bf7f265e7551..f19e11ba62aa 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -292,6 +292,7 @@ MAN= aac.4 \ mac_stub.4 \ mac_test.4 \ malo.4 \ + max44009.4 \ md.4 \ mdio.4 \ me.4 \ diff --git a/share/man/man4/max44009.4 b/share/man/man4/max44009.4 new file mode 100644 index 000000000000..fa399c52cec3 --- /dev/null +++ b/share/man/man4/max44009.4 @@ -0,0 +1,92 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020 Andriy Gapon +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 6, 2021 +.Dt MAX44009 4 +.Os +.Sh NAME +.Nm max44009 +.Nd driver for MAX44009 Ambient Light Sensor +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device max44009" +.Cd "device iicbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +max44009_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver reports illuminance data from MAX44009 Ambient Light Sensor. +.Pp +The +.Nm +driver reports data via +.Xr sysctl 8 +entry in the device's node in the +.Xr sysctl 8 +tree: +.Bl -tag -width illuminance +.It Va illuminance +The illuminance, in lux units. +.El +.Pp +On an +.Xr FDT 4 +based system the following properties must be set: +.Bl -tag -width "compatible" +.It Va compatible +Must be set to +.Qq maxim,max44009 . +.It Va reg +The I2C address of +.Nm +which can be either 0x4a or 0x4b. +.El +.Sh SEE ALSO +.Xr fdt 4 , +.Xr iicbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh BUGS +The +.Nm +driver does not support illuminance thresholds and the corresponding +interrupt. diff --git a/sys/conf/files b/sys/conf/files index 434a783ebbbe..5229484dc076 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1848,6 +1848,7 @@ dev/iicbus/iicoc_fdt.c optional iicoc ext_resources fdt dev/iicbus/iicoc_pci.c optional iicoc pci dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 +dev/iicbus/max44009.c optional max44009 dev/iicbus/mux/pca9547.c optional pca9547 iicmux fdt dev/iicbus/mux/iicmux.c optional iicmux dev/iicbus/mux/iicmux_if.m optional iicmux diff --git a/sys/dev/iicbus/max44009.c b/sys/dev/iicbus/max44009.c new file mode 100644 index 000000000000..739b43ed9055 --- /dev/null +++ b/sys/dev/iicbus/max44009.c @@ -0,0 +1,193 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) Andriy Gapon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef FDT +#include +#include +#endif + +/* + * Driver for MAX44009 Ambient Light Sensor with ADC. + */ +#define REG_LUX_HIGH 0x03 +#define REG_LUX_LOW 0x04 + +struct max44009_softc { + device_t sc_dev; + uint8_t sc_addr; +}; + +#ifdef FDT +static const struct ofw_compat_data compat_data[] = { + { "maxim,max44009", true }, + { NULL, false }, +}; +#endif + +static int +max44009_get_reading(device_t dev, u_int *reading) +{ + struct iic_msg msgs[4]; + struct max44009_softc *sc; + u_int val; + uint8_t reghi, reglo, valhi, vallo; + int error; + + sc = device_get_softc(dev); + + reghi = REG_LUX_HIGH; + reglo = REG_LUX_LOW; + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®hi; + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD | IIC_M_NOSTOP; + msgs[1].len = 1; + msgs[1].buf = &valhi; + msgs[2].slave = sc->sc_addr; + msgs[2].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[2].len = 1; + msgs[2].buf = ®lo; + msgs[3].slave = sc->sc_addr; + msgs[3].flags = IIC_M_RD; + msgs[3].len = 1; + msgs[3].buf = &vallo; + + error = iicbus_transfer_excl(dev, msgs, nitems(msgs), IIC_INTRWAIT); + if (error != 0) + return (error); + + val = ((valhi & 0x0f) << 4) | (vallo & 0x0f); + val <<= (valhi & 0xf0) >> 4; + val = val * 72 / 100; + *reading = val; + return (0); +} + +static int +max44009_lux_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev; + u_int reading; + int error, val; + + if (req->oldptr != NULL) { + dev = arg1; + error = max44009_get_reading(dev, &reading); + if (error != 0) + return (EIO); + val = reading; + } + error = sysctl_handle_int(oidp, &val, 0, req); + return (error); +} + +static int +max44009_probe(device_t dev) +{ + int rc; + +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rc = BUS_PROBE_GENERIC; + else +#endif + rc = BUS_PROBE_NOWILDCARD; + device_set_desc(dev, "MAX44009 light intensity sensor"); + return (rc); +} + +static int +max44009_attach(device_t dev) +{ + struct max44009_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + ctx = device_get_sysctl_ctx(dev); + tree_node = device_get_sysctl_tree(dev); + tree = SYSCTL_CHILDREN(tree_node); + + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "illuminance", + CTLTYPE_INT | CTLFLAG_RD, dev, 0, + max44009_lux_sysctl, "I", "Light intensity, lux"); + return (0); +} + +static int +max44009_detach(device_t dev) +{ + return (0); +} + +static device_method_t max44009_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, max44009_probe), + DEVMETHOD(device_attach, max44009_attach), + DEVMETHOD(device_detach, max44009_detach), + + DEVMETHOD_END +}; + +static driver_t max44009_driver = { + "max44009", + max44009_methods, + sizeof(struct max44009_softc) +}; + +static devclass_t max44009_devclass; + +DRIVER_MODULE(max44009, iicbus, max44009_driver, max44009_devclass, 0, 0); +MODULE_DEPEND(max44009, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(max44009, 1); +IICBUS_FDT_PNP_INFO(compat_data); diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index b79e2a98fc7d..483eb012bb95 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -18,6 +18,7 @@ SUBDIR = \ isl \ isl12xx \ jedec_dimm \ + max44009 \ mux \ nxprtc \ pcf8591 \ diff --git a/sys/modules/i2c/max44009/Makefile b/sys/modules/i2c/max44009/Makefile new file mode 100644 index 000000000000..1e201c5aaba4 --- /dev/null +++ b/sys/modules/i2c/max44009/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD= max44009 +SRCS= max44009.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From nobody Sat Nov 6 17:21:12 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6EC5D1843B63; Sat, 6 Nov 2021 17:21: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 4HmkgD2kvtz3ltJ; Sat, 6 Nov 2021 17:21: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 3A7556EB7; Sat, 6 Nov 2021 17:21: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 1A6HLCok087162; Sat, 6 Nov 2021 17:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HLC9c087161; Sat, 6 Nov 2021 17:21:12 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:21:12 GMT Message-Id: <202111061721.1A6HLC9c087161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 832503063e32 - main - gpioled: allow the driver to be disabled via fdt List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 832503063e32a449f8ed6ecf865d01e575559971 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=832503063e32a449f8ed6ecf865d01e575559971 commit 832503063e32a449f8ed6ecf865d01e575559971 Author: Andriy Gapon AuthorDate: 2020-09-25 07:32:47 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:21:05 +0000 gpioled: allow the driver to be disabled via fdt --- sys/dev/gpio/gpioled_fdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/gpio/gpioled_fdt.c b/sys/dev/gpio/gpioled_fdt.c index 3f627706860a..58bcd0fbd2bb 100644 --- a/sys/dev/gpio/gpioled_fdt.c +++ b/sys/dev/gpio/gpioled_fdt.c @@ -144,6 +144,8 @@ gpioleds_detach_led(struct gpioled *led) static int gpioled_probe(device_t dev) { + if (!ofw_bus_status_okay(dev)) + return (ENXIO); if (!ofw_bus_is_compatible(dev, "gpio-leds")) return (ENXIO); From nobody Sat Nov 6 17:24:14 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9B705184614D; Sat, 6 Nov 2021 17:24: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 4Hmkkl1Kqjz3nZk; Sat, 6 Nov 2021 17:24: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 EA64F73BB; Sat, 6 Nov 2021 17:24: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 1A6HOEjA090595; Sat, 6 Nov 2021 17:24:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HOEgo090594; Sat, 6 Nov 2021 17:24:14 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:24:14 GMT Message-Id: <202111061724.1A6HOEgo090594@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 6354154ef520 - main - pcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6354154ef520d359492badf0de9c8ae5d7080ae7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=6354154ef520d359492badf0de9c8ae5d7080ae7 commit 6354154ef520d359492badf0de9c8ae5d7080ae7 Author: Andriy Gapon AuthorDate: 2020-10-01 09:48:56 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:23:27 +0000 pcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C MFC after: 2 weeks --- share/man/man4/Makefile | 1 + share/man/man4/pcf8574.4 | 98 +++++++++ sys/conf/files | 1 + sys/dev/iicbus/gpio/pcf8574.c | 425 +++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 1 + sys/modules/i2c/pcf8574/Makefile | 18 ++ 6 files changed, 544 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index f19e11ba62aa..d3cd58b495f4 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -421,6 +421,7 @@ MAN= aac.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ + pcf8574.4 \ pcf8591.4 \ ${_pchtherm.4} \ pci.4 \ diff --git a/share/man/man4/pcf8574.4 b/share/man/man4/pcf8574.4 new file mode 100644 index 000000000000..9fdf71874063 --- /dev/null +++ b/share/man/man4/pcf8574.4 @@ -0,0 +1,98 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020 Andriy Gapon +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 6, 2021 +.Dt PCF8574 4 +.Os +.Sh NAME +.Nm pcf8574 +.Nd driver for the PCF8574 8-bit I2C IO expander +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pcf8574" +.Cd "device gpio" +.Cd "device iicbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +pcf8574_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr gpiobus 4 +control over 8 GPIO pins. +The pins are quasi-bidirectional. +Only low output can be actively driven. +High output is equivalent to input. +.Pp +On an +.Xr FDT 4 +based system the following properties must be set: +.Bl -tag -width "compatible" +.It Va compatible +Must be set to "nxp,pcf8574". +.It Va reg +The I2C address of +.Nm . +.El +.Pp +The DTS part for a +.Nm +device usually looks like: +.Bd -literal +/ { + + ... + pcf8574@27 { + compatible = "nxp,pcf8574"; + reg = <0x27>; + }; +}; +.Ed +.Sh SEE ALSO +.Xr fdt 4 , +.Xr gpiobus 4 , +.Xr iicbus 4 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh BUGS +The +.Nm +driver does not support the input change interrupt +that the hardware provides. diff --git a/sys/conf/files b/sys/conf/files index 5229484dc076..5fa918b59f62 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1856,6 +1856,7 @@ dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt dev/iicbus/mux/ltc430x.c optional ltc430x dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus +dev/iicbus/pcf8574.c optional pcf8574 dev/iicbus/pcf8591.c optional pcf8591 dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt diff --git a/sys/dev/iicbus/gpio/pcf8574.c b/sys/dev/iicbus/gpio/pcf8574.c new file mode 100644 index 000000000000..6fa544ac3283 --- /dev/null +++ b/sys/dev/iicbus/gpio/pcf8574.c @@ -0,0 +1,425 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) Andriy Gapon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Driver for PCF8574 / PCF8574A 8-bit I/O expander + * with quasi-bidirectional I/O. + * There is no separate mode / configuration register. + * Pins are set and queried via a single register. + * Because of that we have to maintain the state in the driver + * and assume that there is no outside meddling with the device. + * See the datasheet for details. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include +#include + +#include + +#include "gpio_if.h" + +#define NUM_PINS 8 +#define PIN_CAPS (GPIO_PIN_OUTPUT | GPIO_PIN_INPUT) + +#define dbg_dev_printf(dev, fmt, args...) \ + if (bootverbose) device_printf(dev, fmt, ##args) + +struct pcf8574_softc { + device_t dev; + device_t busdev; + struct sx lock; + uint8_t addr; + uint8_t output_mask; + uint8_t output_state; +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + { "nxp,pcf8574", 1 }, + { "nxp,pcf8574a", 1 }, + { NULL, 0 } +}; +#endif + +static int +pcf8574_read(struct pcf8574_softc *sc, uint8_t *val) +{ + struct iic_msg msg; + int error; + + msg.slave = sc->addr; + msg.flags = IIC_M_RD; + msg.len = 1; + msg.buf = val; + + error = iicbus_transfer_excl(sc->dev, &msg, 1, IIC_WAIT); + return (iic2errno(error)); +} + +static int +pcf8574_write(struct pcf8574_softc *sc, uint8_t val) +{ + struct iic_msg msg; + int error; + + msg.slave = sc->addr; + msg.flags = IIC_M_WR; + msg.len = 1; + msg.buf = &val; + + error = iicbus_transfer_excl(sc->dev, &msg, 1, IIC_WAIT); + return (iic2errno(error)); +} + +static int +pcf8574_probe(device_t dev) +{ + +#ifdef FDT + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); +#endif + device_set_desc(dev, "PCF8574 I/O expander"); + return (BUS_PROBE_DEFAULT); +} + +static int +pcf8574_attach(device_t dev) +{ + struct pcf8574_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->addr = iicbus_get_addr(dev); + + /* Treat everything as input because there is no way to tell. */ + sc->output_mask = 0; + sc->output_state = 0xff; + + /* Put the device to a safe, known state. */ + (void)pcf8574_write(sc, 0xff); + + sx_init(&sc->lock, "pcf8574"); + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) { + device_printf(dev, "Could not create busdev child\n"); + sx_destroy(&sc->lock); + return (ENXIO); + } + return (0); +} + +static int +pcf8574_detach(device_t dev) +{ + struct pcf8574_softc *sc; + + sc = device_get_softc(dev); + + if (sc->busdev != NULL) + gpiobus_detach_bus(sc->busdev); + + sx_destroy(&sc->lock); + return (0); +} + +static device_t +pcf8574_get_bus(device_t dev) +{ + struct pcf8574_softc *sc; + + sc = device_get_softc(dev); + return (sc->busdev); +} + +static int +pcf8574_pin_max(device_t dev __unused, int *maxpin) +{ + *maxpin = NUM_PINS - 1; + return (0); +} + +static int +pcf8574_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + + if (pin >= NUM_PINS) + return (EINVAL); + *caps = PIN_CAPS; + return (0); +} + +static int +pcf8574_pin_getflags(device_t dev, uint32_t pin, uint32_t *pflags) +{ + struct pcf8574_softc *sc; + uint8_t val, stale; + int error; + + sc = device_get_softc(dev); + + if (pin >= NUM_PINS) + return (EINVAL); + + sx_xlock(&sc->lock); + error = pcf8574_read(sc, &val); + if (error != 0) { + dbg_dev_printf(dev, "failed to read from device: %d\n", + error); + sx_xunlock(&sc->lock); + return (error); + } + + /* + * Check for pins whose read value is one, but they are configured + * as outputs with low signal. This is an impossible combination, + * so change their view to be inputs. + */ + stale = val & sc->output_mask & ~sc->output_state; + sc->output_mask &= ~stale; + sc->output_state |= stale; + + if ((sc->output_mask & (1 << pin)) != 0) + *pflags = GPIO_PIN_OUTPUT; + else + *pflags = GPIO_PIN_INPUT; + sx_xunlock(&sc->lock); + + return (0); +} + +static int +pcf8574_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct pcf8574_softc *sc; + int error; + uint8_t val; + bool update_needed; + + sc = device_get_softc(dev); + + if (pin >= NUM_PINS) + return (EINVAL); + if ((flags & ~PIN_CAPS) != 0) + return (EINVAL); + + sx_xlock(&sc->lock); + if ((flags & GPIO_PIN_OUTPUT) != 0) { + sc->output_mask |= 1 << pin; + update_needed = false; + } else if ((flags & GPIO_PIN_INPUT) != 0) { + sc->output_mask &= ~(1 << pin); + sc->output_state |= 1 << pin; + update_needed = true; + } else { + KASSERT(false, ("both input and output modes requested")); + update_needed = false; + } + + if (update_needed) { + val = sc->output_state | ~sc->output_mask; + error = pcf8574_write(sc, val); + if (error != 0) + dbg_dev_printf(dev, "failed to write to device: %d\n", + error); + } + sx_xunlock(&sc->lock); + + return (0); +} + +static int +pcf8574_pin_getname(device_t dev, uint32_t pin, char *name) +{ + + if (pin >= NUM_PINS) + return (EINVAL); + snprintf(name, GPIOMAXNAME, "P%d", pin); + return (0); +} + +static int +pcf8574_pin_get(device_t dev, uint32_t pin, unsigned int *on) +{ + struct pcf8574_softc *sc; + uint8_t val; + int error; + + sc = device_get_softc(dev); + + sx_xlock(&sc->lock); + if ((sc->output_mask & (1 << pin)) != 0) { + *on = (sc->output_state & (1 << pin)) != 0; + sx_xunlock(&sc->lock); + return (0); + } + + error = pcf8574_read(sc, &val); + if (error != 0) { + dbg_dev_printf(dev, "failed to read from device: %d\n", error); + sx_xunlock(&sc->lock); + return (error); + } + sx_xunlock(&sc->lock); + + *on = (val & (1 << pin)) != 0; + return (0); +} + +static int +pcf8574_pin_set(device_t dev, uint32_t pin, unsigned int on) +{ + struct pcf8574_softc *sc; + uint8_t val; + int error; + + sc = device_get_softc(dev); + + if (pin >= NUM_PINS) + return (EINVAL); + + sx_xlock(&sc->lock); + + if ((sc->output_mask & (1 << pin)) == 0) { + sx_xunlock(&sc->lock); + return (EINVAL); + } + + /* + * Algorithm: + * - set all outputs to their recorded state; + * - set all inputs to the high state; + * - apply the requested change. + */ + val = sc->output_state | ~sc->output_mask; + val &= ~(1 << pin); + val |= (on != 0) << pin; + + error = pcf8574_write(sc, val); + if (error != 0) { + dbg_dev_printf(dev, "failed to write to device: %d\n", error); + sx_xunlock(&sc->lock); + return (error); + } + + /* + * NB: we can record anything as "output" state of input pins. + * By convention and for convenience it will be recorded as 1. + */ + sc->output_state = val; + sx_xunlock(&sc->lock); + return (0); +} + +static int +pcf8574_pin_toggle(device_t dev, uint32_t pin) +{ + struct pcf8574_softc *sc; + uint8_t val; + int error; + + sc = device_get_softc(dev); + + if (pin >= NUM_PINS) + return (EINVAL); + + sx_xlock(&sc->lock); + + if ((sc->output_mask & (1 << pin)) == 0) { + sx_xunlock(&sc->lock); + return (EINVAL); + } + + val = sc->output_state | ~sc->output_mask; + val ^= 1 << pin; + + error = pcf8574_write(sc, val); + if (error != 0) { + dbg_dev_printf(dev, "failed to write to device: %d\n", error); + sx_xunlock(&sc->lock); + return (error); + } + + sc->output_state = val; + sx_xunlock(&sc->lock); + return (0); +} + +static device_method_t pcf8574_methods[] = { + DEVMETHOD(device_probe, pcf8574_probe), + DEVMETHOD(device_attach, pcf8574_attach), + DEVMETHOD(device_detach, pcf8574_detach), + + /* GPIO methods */ + DEVMETHOD(gpio_get_bus, pcf8574_get_bus), + DEVMETHOD(gpio_pin_max, pcf8574_pin_max), + DEVMETHOD(gpio_pin_getcaps, pcf8574_pin_getcaps), + DEVMETHOD(gpio_pin_getflags, pcf8574_pin_getflags), + DEVMETHOD(gpio_pin_setflags, pcf8574_pin_setflags), + DEVMETHOD(gpio_pin_getname, pcf8574_pin_getname), + DEVMETHOD(gpio_pin_get, pcf8574_pin_get), + DEVMETHOD(gpio_pin_set, pcf8574_pin_set), + DEVMETHOD(gpio_pin_toggle, pcf8574_pin_toggle), + + DEVMETHOD_END +}; + +static driver_t pcf8574_driver = { + "gpio", + pcf8574_methods, + sizeof(struct pcf8574_softc) +}; + +static devclass_t pcf8574_devclass; + +DRIVER_MODULE(pcf8574, iicbus, pcf8574_driver, pcf8574_devclass, 0, 0); +MODULE_DEPEND(pcf8574, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_DEPEND(pcf8574, gpiobus, 1, 1, 1); +MODULE_VERSION(pcf8574, 1); +#ifdef FDT +IICBUS_FDT_PNP_INFO(compat_data); +#endif diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index 483eb012bb95..9fea714975f7 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -21,6 +21,7 @@ SUBDIR = \ max44009 \ mux \ nxprtc \ + pcf8574 \ pcf8591 \ rtc8583 \ s35390a \ diff --git a/sys/modules/i2c/pcf8574/Makefile b/sys/modules/i2c/pcf8574/Makefile new file mode 100644 index 000000000000..7c4fe37297e4 --- /dev/null +++ b/sys/modules/i2c/pcf8574/Makefile @@ -0,0 +1,18 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus/gpio/ +KMOD = pcf8574 +SRCS = pcf8574.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + gpio_if.h \ + iicbus_if.h \ + opt_platform.h \ + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From nobody Sat Nov 6 17:25:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3DEB81847919; Sat, 6 Nov 2021 17:25: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 4Hmkm41JgGz3pbX; Sat, 6 Nov 2021 17:25: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 0E3FE741C; Sat, 6 Nov 2021 17:25: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 1A6HPNaW090928; Sat, 6 Nov 2021 17:25:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HPN5S090927; Sat, 6 Nov 2021 17:25:23 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:25:23 GMT Message-Id: <202111061725.1A6HPN5S090927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: a75159eabc90 - main - htu21: allow configuration via hints on FDT-based systems List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a75159eabc90dc35af68c92f7d5eb72e087f6131 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=a75159eabc90dc35af68c92f7d5eb72e087f6131 commit a75159eabc90dc35af68c92f7d5eb72e087f6131 Author: Andriy Gapon AuthorDate: 2021-11-04 11:56:12 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:24:44 +0000 htu21: allow configuration via hints on FDT-based systems On-board devices should be configured via the FDT and overlays. Hints are primarily useful for external and temporarily attached devices. Adding hints is much easier and faster than writing and compiling an overlay. MFC after: 1 week --- sys/dev/iicbus/htu21.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/iicbus/htu21.c b/sys/dev/iicbus/htu21.c index 5c59ebe8f54a..aa8507bf7437 100644 --- a/sys/dev/iicbus/htu21.c +++ b/sys/dev/iicbus/htu21.c @@ -458,11 +458,17 @@ static int htu21_probe(device_t dev) { uint8_t addr; + int rc; #ifdef FDT - if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + if (!ofw_bus_status_okay(dev)) return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rc = BUS_PROBE_GENERIC; + else #endif + rc = BUS_PROBE_NOWILDCARD; + addr = iicbus_get_addr(dev); if (addr != (HTU21_ADDR << 1)) { device_printf(dev, "non-standard slave address 0x%02x\n", @@ -470,7 +476,7 @@ htu21_probe(device_t dev) } device_set_desc(dev, "HTU21 temperature and humidity sensor"); - return (BUS_PROBE_GENERIC); + return (rc); } static int @@ -516,6 +522,4 @@ static devclass_t htu21_devclass; DRIVER_MODULE(htu21, iicbus, htu21_driver, htu21_devclass, 0, 0); MODULE_DEPEND(htu21, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(htu21, 1); -#ifdef FDT IICBUS_FDT_PNP_INFO(compat_data); -#endif From nobody Sat Nov 6 17:29:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 777601847F56; Sat, 6 Nov 2021 17:29: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 4Hmkrp2xmCz3q6c; Sat, 6 Nov 2021 17:29: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 4569D73C1; Sat, 6 Nov 2021 17:29: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 1A6HTUNY091435; Sat, 6 Nov 2021 17:29:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HTUY0091434; Sat, 6 Nov 2021 17:29:30 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:29:30 GMT Message-Id: <202111061729.1A6HTUY0091434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: c01a46d4acab - main - camcontrol: dump received data for MMC command even if it is unknown List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c01a46d4acab923961dfb7e4605b9ca6e775e616 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=c01a46d4acab923961dfb7e4605b9ca6e775e616 commit c01a46d4acab923961dfb7e4605b9ca6e775e616 Author: Andriy Gapon AuthorDate: 2021-11-06 10:23:55 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:25:57 +0000 camcontrol: dump received data for MMC command even if it is unknown For example, EXT_CSD can be read like this: # camcontrol mmcsdcmd 2:0:0 -c 8 -a 0 -f 0x35 -l 512 CMD 8 arg 0 flags 35 MMCIO: error 0, 00000900 00000000 00000000 00000000 No command-specific decoder for CMD 8 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0010 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |9...............| ... 0100 00 00 00 00 00 00 00 00 01 08 00 01 02 02 00 00 |................| ... 01e0 00 00 00 00 00 00 00 00 00 81 c7 00 00 01 03 07 |................| 01f0 05 00 03 01 3f 3f 01 01 01 00 00 00 00 00 00 00 |....??..........| MFC after: 2 weeks --- sbin/camcontrol/camcontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index e560eb349f79..facabbe2ecdc 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -8140,6 +8140,8 @@ mmcsdcmd(struct cam_device *device, int argc, char **argv, char *combinedopt, break; default: printf("No command-specific decoder for CMD %d\n", mmc_opcode); + if (mmc_data_len > 0) + hexdump(mmc_data, mmc_data_len, NULL, 0); } } mmccmd_bailout: From nobody Sat Nov 6 17:33:25 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 82915184B7FD for ; Sat, 6 Nov 2021 17:33:37 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HmkxY351Vz3sHR for ; Sat, 6 Nov 2021 17:33:37 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-yb1-xb32.google.com with SMTP id v138so31393030ybb.8 for ; Sat, 06 Nov 2021 10:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=majW1KXXaPsF+NjDDTZdwnlp1r/RoWVnziUW3gy36U0=; b=uIN3CtbMMKSfp0bfMKDZjxT58EmTQg7lf4mNPGOf0RoraT+bTP2wYf4LYGeqEJRxi3 8ALR9Mo24nfj1OG+9txo5E5JK02BwSrbgKTDnMJhuMyXzdLxk2SwswhExK2UUX/q/dsS g36bN7nPEgxpWMh/+ipYE9H11nTVnJeMPSyXYjnwZhtjsBQq/coiPqvvEbF11VNQfg45 +qEhBxmIyVdAo+eNvybCMDoXJcISmX8vTr3fySDSzIYdyryxdfyTFDaC4/5nsoYHnXld Y+1VqidRANsjtL5K6hmmdGBtvlo9z5NwTxuaoi9WBJg95QUaidmw/70I/XjRxhijfYxU pFlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=majW1KXXaPsF+NjDDTZdwnlp1r/RoWVnziUW3gy36U0=; b=BvhfoXUiKSOD3melEBmFxLeER4mu3qBVVBqjf015xlIjh0KZ3PF9i2XBJtr4pIBzQh nNOCePn9KRhZZw92fT3KbRn5AHsIEimLASbRUCDZlJRfBPcu0VhDW8rInD6v/BK+FJam lvsxKNO/kPuE7g77dXckC+iarOfj0XaHqixqgDPSo05V70C6hkhWnA/9nvVzist3GB55 FzEuGdfSpDpHrXLAQoRYSz9M2VJYZU6UxnwQuN3yPfrLXwQMgX3YclDf9da/qRAgUivU WJqnmT8nmEzxFx3CcqalOfK850HydojNfsLoFe6b2gcu3IXx4myhAtlygH0EjMiVTue4 GUEA== X-Gm-Message-State: AOAM532s4BZZW87ZuWFKMr2mxqR6qEl9wovhBSlrrXFpKkw8hO1VREyy XG/+pGdlRsQqHIQt7J2+1DUljHNAODXk+HRXoB6nCw== X-Google-Smtp-Source: ABdhPJwe/2J6gS9bUcsuBdDc5iz6dqPEdwSrLDjuRONpmEHlcryi5Nk78S3SYx3RbHshQDlKeOYxLOpcwSEkx+nChy0= X-Received: by 2002:a25:b213:: with SMTP id i19mr52891425ybj.393.1636220016855; Sat, 06 Nov 2021 10:33:36 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202111061646.1A6GkIj4036877@gitrepo.freebsd.org> <20211106165946.zrj7fonoxbca3cj2@mutt-hbsd> In-Reply-To: <20211106165946.zrj7fonoxbca3cj2@mutt-hbsd> From: Wojciech Macek Date: Sat, 6 Nov 2021 18:33:25 +0100 Message-ID: Subject: Re: git: 0dedcdaa1a02 - main - Revert "ossl: Add support for ETA mode" To: Shawn Webb Cc: Wojciech Macek , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000e1216d05d0222833" X-Rspamd-Queue-Id: 4HmkxY351Vz3sHR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000e1216d05d0222833 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It breaks linker for arm64-LINT kernel. Will fix and push it back next week= . sob., 6 lis 2021, 17:59 u=C5=BCytkownik Shawn Webb napisa=C5=82: > On Sat, Nov 06, 2021 at 04:46:18PM +0000, Wojciech Macek wrote: > > The branch main has been updated by wma: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D0dedcdaa1a023d46c8951f03cd2f9df= 7ae025675 > > > > commit 0dedcdaa1a023d46c8951f03cd2f9df7ae025675 > > Author: Wojciech Macek > > AuthorDate: 2021-11-06 16:45:50 +0000 > > Commit: Wojciech Macek > > CommitDate: 2021-11-06 16:45:50 +0000 > > > > Revert "ossl: Add support for ETA mode" > > > > This reverts commit 048a71b46e816de8fb95b553a8ad0e98c0d51e12. > > Why? > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/0= 3A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > --000000000000e1216d05d0222833-- From nobody Sat Nov 6 17:41:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AD525184F489; Sat, 6 Nov 2021 17:41: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 4Hml6k4Zh1z3vM9; Sat, 6 Nov 2021 17:41: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 7E020775B; Sat, 6 Nov 2021 17:41: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 1A6HfYS9017301; Sat, 6 Nov 2021 17:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HfYMn017300; Sat, 6 Nov 2021 17:41:34 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:41:34 GMT Message-Id: <202111061741.1A6HfYMn017300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 43b031a371eb - main - htu21: don't needlessly bother hardware when measurements are not needed List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43b031a371eb90c15c390c26202f5f58d09300ef Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=43b031a371eb90c15c390c26202f5f58d09300ef commit 43b031a371eb90c15c390c26202f5f58d09300ef Author: Andriy Gapon AuthorDate: 2021-11-06 16:47:32 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:39:52 +0000 htu21: don't needlessly bother hardware when measurements are not needed sysctl(8) first queries a sysctl to get a size of its value even if the sysctl is of a fixed size, e.g. it has an integer type. Only after that sysctl(8) queries an actual value of the sysctl. Previosuly the driver would needlessly read a sensor in the first step. MFC after: 1 week --- sys/dev/iicbus/htu21.c | 88 +++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/sys/dev/iicbus/htu21.c b/sys/dev/iicbus/htu21.c index aa8507bf7437..6b834354d73f 100644 --- a/sys/dev/iicbus/htu21.c +++ b/sys/dev/iicbus/htu21.c @@ -192,21 +192,24 @@ htu21_temp_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - if (sc->sc_hold) - error = htu21_get_measurement(dev, HTU21_GET_TEMP, - raw_data, nitems(raw_data)); - else - error = htu21_get_measurement_nohold(dev, HTU21_GET_TEMP_NH, - raw_data, nitems(raw_data)); - - if (error != 0) { - return (EIO); - } else if (!check_crc_16(raw_data, raw_data[2])) { - temp = -1; - sc->sc_errcount++; - } else { - temp = (((uint16_t)raw_data[0]) << 8) | (raw_data[1] & 0xfc); - temp = ((temp * 17572) >> 16 ) + 27315 - 4685; + if (req->oldptr != NULL) { + if (sc->sc_hold) + error = htu21_get_measurement(dev, HTU21_GET_TEMP, + raw_data, nitems(raw_data)); + else + error = htu21_get_measurement_nohold(dev, + HTU21_GET_TEMP_NH, raw_data, nitems(raw_data)); + + if (error != 0) { + return (EIO); + } else if (!check_crc_16(raw_data, raw_data[2])) { + temp = -1; + sc->sc_errcount++; + } else { + temp = (((uint16_t)raw_data[0]) << 8) | + (raw_data[1] & 0xfc); + temp = ((temp * 17572) >> 16 ) + 27315 - 4685; + } } error = sysctl_handle_int(oidp, &temp, 0, req); @@ -224,21 +227,24 @@ htu21_rh_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - if (sc->sc_hold) - error = htu21_get_measurement(dev, HTU21_GET_HUM, - raw_data, nitems(raw_data)); - else - error = htu21_get_measurement_nohold(dev, HTU21_GET_HUM_NH, - raw_data, nitems(raw_data)); - - if (error != 0) { - return (EIO); - } else if (!check_crc_16(raw_data, raw_data[2])) { - rh = -1; - sc->sc_errcount++; - } else { - rh = (((uint16_t)raw_data[0]) << 8) | (raw_data[1] & 0xfc); - rh = ((rh * 12500) >> 16 ) - 600; + if (req->oldptr != NULL) { + if (sc->sc_hold) + error = htu21_get_measurement(dev, HTU21_GET_HUM, + raw_data, nitems(raw_data)); + else + error = htu21_get_measurement_nohold(dev, + HTU21_GET_HUM_NH, raw_data, nitems(raw_data)); + + if (error != 0) { + return (EIO); + } else if (!check_crc_16(raw_data, raw_data[2])) { + rh = -1; + sc->sc_errcount++; + } else { + rh = (((uint16_t)raw_data[0]) << 8) | + (raw_data[1] & 0xfc); + rh = ((rh * 12500) >> 16 ) - 600; + } } error = sysctl_handle_int(oidp, &rh, 0, req); @@ -302,11 +308,12 @@ htu21_heater_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - error = htu21_get_cfg(dev, &cfg); - if (error != 0) - return (EIO); - - heater = (cfg & 0x04) != 0; + if (req->oldptr != NULL) { + error = htu21_get_cfg(dev, &cfg); + if (error != 0) + return (EIO); + heater = (cfg & 0x04) != 0; + } error = sysctl_handle_int(oidp, &heater, 0, req); if (error != 0 || req->newptr == NULL) return (error); @@ -328,11 +335,12 @@ htu21_power_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - error = htu21_get_cfg(dev, &cfg); - if (error != 0) - return (EIO); - - power = (cfg & 0x40) == 0; + if (req->oldptr != NULL) { + error = htu21_get_cfg(dev, &cfg); + if (error != 0) + return (EIO); + power = (cfg & 0x40) == 0; + } error = sysctl_handle_int(oidp, &power, 0, req); return (error); } From nobody Sat Nov 6 17:46:09 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 86ABB1852767; Sat, 6 Nov 2021 17:46: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 4HmlD13PRgz4RYh; Sat, 6 Nov 2021 17:46: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 5581D6FF3; Sat, 6 Nov 2021 17:46: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 1A6Hk9Qs017751; Sat, 6 Nov 2021 17:46:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6Hk9Bc017750; Sat, 6 Nov 2021 17:46:09 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:46:09 GMT Message-Id: <202111061746.1A6Hk9Bc017750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 24f567bb0e50 - main - files.arm64: fix sort order for aw_i2s.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24f567bb0e5060adb21bed24b00effec4f37f034 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=24f567bb0e5060adb21bed24b00effec4f37f034 commit 24f567bb0e5060adb21bed24b00effec4f37f034 Author: Andriy Gapon AuthorDate: 2021-09-24 17:26:07 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:45:49 +0000 files.arm64: fix sort order for aw_i2s.c --- sys/conf/files.arm64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index a0bdaeb475d6..4e96cd7a76f6 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -322,8 +322,8 @@ arm/allwinner/a64/sun50i_a64_acodec.c optional fdt sound a64_codec arm/allwinner/sunxi_dma_if.m optional a31_dmac arm/allwinner/aw_cir.c optional evdev aw_cir fdt arm/allwinner/aw_dwc3.c optional aw_dwc3 fdt -arm/allwinner/aw_i2s.c optional fdt sound aw_i2s arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt +arm/allwinner/aw_i2s.c optional fdt sound aw_i2s arm/allwinner/aw_mmc.c optional mmc aw_mmc fdt | mmccam aw_mmc fdt arm/allwinner/aw_nmi.c optional aw_nmi fdt \ compile-with "${NORMAL_C} -I$S/contrib/device-tree/include" From nobody Sat Nov 6 17:49:52 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7A09C1852D29; Sat, 6 Nov 2021 17:49: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 4HmlJJ2yPPz4SDw; Sat, 6 Nov 2021 17:49: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 450E47880; Sat, 6 Nov 2021 17:49: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 1A6HnqAo018143; Sat, 6 Nov 2021 17:49:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HnqCP018142; Sat, 6 Nov 2021 17:49:52 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:49:52 GMT Message-Id: <202111061749.1A6HnqCP018142@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: aa917184a9c0 - main - add rk3328_codec and rk_i2s from gonzoua/socaudio List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa917184a9c04b41e055e13b1ab158dfacca4c66 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=aa917184a9c04b41e055e13b1ab158dfacca4c66 commit aa917184a9c04b41e055e13b1ab158dfacca4c66 Author: Oleksandr Tymoshenko AuthorDate: 2021-06-04 12:18:06 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:47:10 +0000 add rk3328_codec and rk_i2s from gonzoua/socaudio Not sure why these haven't been committed with the rest of the SoC Audio project. They work sufficiently well for me. Discussed with: manu MFC after: 1 month --- sys/arm64/rockchip/rk3328_codec.c | 593 ++++++++++++++++++++++++++++++++++ sys/arm64/rockchip/rk_i2s.c | 657 ++++++++++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 2 + 3 files changed, 1252 insertions(+) diff --git a/sys/arm64/rockchip/rk3328_codec.c b/sys/arm64/rockchip/rk3328_codec.c new file mode 100644 index 000000000000..940b3b8bb9e8 --- /dev/null +++ b/sys/arm64/rockchip/rk3328_codec.c @@ -0,0 +1,593 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Oleksandr Tymoshenko + * Copyright (c) 2018 Jared McNeill + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "syscon_if.h" + +#include "opt_snd.h" +#include +#include +#include "audio_dai_if.h" +#include "mixer_if.h" + +#define RKCODEC_MIXER_DEVS (1 << SOUND_MIXER_VOLUME) + +#define GRF_SOC_CON2 0x0408 +#define SOC_CON2_I2S_ACODEC_EN (1 << 14) +#define SOC_CON2_I2S_ACODEC_EN_MASK ((1 << 14) << 16) +#define GRF_SOC_CON10 0x0428 +#define SOC_CON10_GPIOMUT (1 << 1) +#define SOC_CON10_GPIOMUT_MASK ((1 << 1) << 16) +#define SOC_CON10_GPIOMUT_EN (1 << 0) +#define SOC_CON10_GPIOMUT_EN_MASK ((1 << 0) << 16) + +#define CODEC_RESET 0x00 +#define RESET_DIG_CORE_RST (1 << 1) +#define RESET_SYS_RST (1 << 0) +#define CODEC_DAC_INIT_CTRL1 0x0c +#define DAC_INIT_CTRL1_DIRECTION_IN (0 << 5) +#define DAC_INIT_CTRL1_DIRECTION_OUT (1 << 5) +#define DAC_INIT_CTRL1_DAC_I2S_MODE_SLAVE (0 << 4) +#define DAC_INIT_CTRL1_DAC_I2S_MODE_MASTER (1 << 4) +#define DAC_INIT_CTRL1_MODE_MASK (3 << 4) +#define CODEC_DAC_INIT_CTRL2 0x10 +#define DAC_INIT_CTRL2_DAC_VDL_16BITS (0 << 5) +#define DAC_INIT_CTRL2_DAC_VDL_20BITS (1 << 5) +#define DAC_INIT_CTRL2_DAC_VDL_24BITS (2 << 5) +#define DAC_INIT_CTRL2_DAC_VDL_32BITS (3 << 5) +#define DAC_INIT_CTRL2_DAC_VDL_MASK (3 << 5) +#define DAC_INIT_CTRL2_DAC_MODE_RJM (0 << 3) +#define DAC_INIT_CTRL2_DAC_MODE_LJM (1 << 3) +#define DAC_INIT_CTRL2_DAC_MODE_I2S (2 << 3) +#define DAC_INIT_CTRL2_DAC_MODE_PCM (3 << 3) +#define DAC_INIT_CTRL2_DAC_MODE_MASK (3 << 3) +#define CODEC_DAC_INIT_CTRL3 0x14 +#define DAC_INIT_CTRL3_WL_16BITS (0 << 2) +#define DAC_INIT_CTRL3_WL_20BITS (1 << 2) +#define DAC_INIT_CTRL3_WL_24BITS (2 << 2) +#define DAC_INIT_CTRL3_WL_32BITS (3 << 2) +#define DAC_INIT_CTRL3_WL_MASK (3 << 2) +#define DAC_INIT_CTRL3_RST_MASK (1 << 1) +#define DAC_INIT_CTRL3_RST_DIS (1 << 1) +#define DAC_INIT_CTRL3_DAC_BCP_REVERSAL (1 << 0) +#define DAC_INIT_CTRL3_DAC_BCP_NORMAL (0 << 0) +#define DAC_INIT_CTRL3_DAC_BCP_MASK (1 << 0) +#define CODEC_DAC_PRECHARGE_CTRL 0x88 +#define DAC_PRECHARGE_CTRL_DAC_CHARGE_PRECHARGE (1 << 7) +#define DAC_PRECHARGE_CTRL_DAC_CHARGE_CURRENT_I (1 << 0) +#define DAC_PRECHARGE_CTRL_DAC_CHARGE_CURRENT_ALL (0x7f) +#define CODEC_DAC_PWR_CTRL 0x8c +#define DAC_PWR_CTRL_DAC_PWR (1 << 6) +#define DAC_PWR_CTRL_DACL_PATH_REFV (1 << 5) +#define DAC_PWR_CTRL_HPOUTL_ZERO_CROSSING (1 << 4) +#define DAC_PWR_CTRL_DACR_PATH_REFV (1 << 1) +#define DAC_PWR_CTRL_HPOUTR_ZERO_CROSSING (1 << 0) +#define CODEC_DAC_CLK_CTRL 0x90 +#define DAC_CLK_CTRL_DACL_REFV_ON (1 << 7) +#define DAC_CLK_CTRL_DACL_CLK_ON (1 << 6) +#define DAC_CLK_CTRL_DACL_ON (1 << 5) +#define DAC_CLK_CTRL_DACL_INIT_ON (1 << 4) +#define DAC_CLK_CTRL_DACR_REFV_ON (1 << 3) +#define DAC_CLK_CTRL_DACR_CLK_ON (1 << 2) +#define DAC_CLK_CTRL_DACR_ON (1 << 1) +#define DAC_CLK_CTRL_DACR_INIT_ON (1 << 0) +#define CODEC_HPMIX_CTRL 0x94 +#define HPMIX_CTRL_HPMIXL_EN (1 << 6) +#define HPMIX_CTRL_HPMIXL_INIT_EN (1 << 5) +#define HPMIX_CTRL_HPMIXL_INIT2_EN (1 << 4) +#define HPMIX_CTRL_HPMIXR_EN (1 << 2) +#define HPMIX_CTRL_HPMIXR_INIT_EN (1 << 1) +#define HPMIX_CTRL_HPMIXR_INIT2_EN (1 << 0) +#define CODEC_DAC_SELECT 0x98 +#define DAC_SELECT_DACL_SELECT (1 << 4) +#define DAC_SELECT_DACR_SELECT (1 << 0) +#define CODEC_HPOUT_CTRL 0x9c +#define HPOUT_CTRL_HPOUTL_EN (1 << 7) +#define HPOUT_CTRL_HPOUTL_INIT_EN (1 << 6) +#define HPOUT_CTRL_HPOUTL_UNMUTE (1 << 5) +#define HPOUT_CTRL_HPOUTR_EN (1 << 4) +#define HPOUT_CTRL_HPOUTR_INIT_EN (1 << 3) +#define HPOUT_CTRL_HPOUTR_UNMUTE (1 << 2) +#define CODEC_HPOUTL_GAIN_CTRL 0xa0 +#define CODEC_HPOUTR_GAIN_CTRL 0xa4 +#define CODEC_HPOUT_POP_CTRL 0xa8 +#define HPOUT_POP_CTRL_HPOUTR_POP (1 << 5) +#define HPOUT_POP_CTRL_HPOUTR_POP_XCHARGE (1 << 4) +#define HPOUT_POP_CTRL_HPOUTL_POP (1 << 1) +#define HPOUT_POP_CTRL_HPOUTL_POP_XCHARGE (1 << 0) + +#define DEFAULT_RATE (48000 * 256) + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3328-codec", 1}, + { NULL, 0 } +}; + +struct rkcodec_softc { + device_t dev; + struct resource *res; + struct mtx mtx; + clk_t mclk; + clk_t pclk; + struct syscon *grf; + u_int regaddr; /* address for the sysctl */ +}; + +#define RKCODEC_LOCK(sc) mtx_lock(&(sc)->mtx) +#define RKCODEC_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define RKCODEC_READ(sc, reg) bus_read_4((sc)->res, (reg)) +#define RKCODEC_WRITE(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +static int rkcodec_probe(device_t dev); +static int rkcodec_attach(device_t dev); +static int rkcodec_detach(device_t dev); + +static void +rkcodec_set_power(struct rkcodec_softc *sc, bool poweron) +{ + uint32_t val; + val = RKCODEC_READ(sc, CODEC_DAC_PRECHARGE_CTRL); + if (poweron) + val |= DAC_PRECHARGE_CTRL_DAC_CHARGE_PRECHARGE; + else + val &= ~(DAC_PRECHARGE_CTRL_DAC_CHARGE_PRECHARGE); + RKCODEC_WRITE(sc, CODEC_DAC_PRECHARGE_CTRL, val); + DELAY(10); + if (poweron) + val |= DAC_PRECHARGE_CTRL_DAC_CHARGE_CURRENT_ALL; + else + val &= ~(DAC_PRECHARGE_CTRL_DAC_CHARGE_CURRENT_ALL); + RKCODEC_WRITE(sc, CODEC_DAC_PRECHARGE_CTRL, val); + +} + +static void +rkcodec_set_mute(struct rkcodec_softc *sc, bool muted) +{ + uint32_t val; + val = SOC_CON10_GPIOMUT_MASK; + if (!muted) + val |= SOC_CON10_GPIOMUT; + SYSCON_WRITE_4(sc->grf, GRF_SOC_CON10, val); +} + +static void +rkcodec_reset(struct rkcodec_softc *sc) +{ + + RKCODEC_WRITE(sc, CODEC_RESET, 0); + DELAY(10); + RKCODEC_WRITE(sc, CODEC_RESET, RESET_DIG_CORE_RST | RESET_SYS_RST); +} + +static int +rkcodec_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "Rockchip RK3328 CODEC"); + return (BUS_PROBE_DEFAULT); +} + +static int +rkcodec_attach(device_t dev) +{ + struct rkcodec_softc *sc; + int error, rid; + phandle_t node; + uint32_t val; + + sc = device_get_softc(dev); + sc->dev = dev; + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + rid = 0; + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (!sc->res) { + device_printf(dev, "could not allocate resource for device\n"); + error = ENXIO; + goto fail; + } + + node = ofw_bus_get_node(dev); + if (syscon_get_by_ofw_property(dev, node, + "rockchip,grf", &sc->grf) != 0) { + device_printf(dev, "cannot get rockchip,grf handle\n"); + return (ENXIO); + } + + val = SOC_CON2_I2S_ACODEC_EN_MASK | (SOC_CON2_I2S_ACODEC_EN << 16); + SYSCON_WRITE_4(sc->grf, GRF_SOC_CON2, val); + + val = 0 | (SOC_CON10_GPIOMUT_EN << 16); + SYSCON_WRITE_4(sc->grf, GRF_SOC_CON10, val); + + error = clk_get_by_ofw_name(dev, 0, "pclk", &sc->pclk); + if (error != 0) { + device_printf(dev, "could not get pclk clock\n"); + goto fail; + } + + error = clk_get_by_ofw_name(dev, 0, "mclk", &sc->mclk); + if (error != 0) { + device_printf(dev, "could not get mclk clock\n"); + goto fail; + } + + error = clk_enable(sc->pclk); + if (error != 0) { + device_printf(sc->dev, "could not enable pclk clock\n"); + goto fail; + } + + error = clk_enable(sc->mclk); + if (error != 0) { + device_printf(sc->dev, "could not enable mclk clock\n"); + goto fail; + } + +#if 0 + error = clk_set_freq(sc->mclk, DEFAULT_RATE, 0); + if (error != 0) { + device_printf(sc->dev, "could not set frequency for mclk clock\n"); + goto fail; + } +#endif + + /* TODO: handle mute-gpios */ + + rkcodec_reset(sc); + rkcodec_set_power(sc, true); + + val = RKCODEC_READ(sc, CODEC_DAC_PWR_CTRL); + val |= DAC_PWR_CTRL_DAC_PWR; + RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val); + + val |= DAC_PWR_CTRL_DACL_PATH_REFV | + DAC_PWR_CTRL_DACR_PATH_REFV; + RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val); + + val |= DAC_PWR_CTRL_HPOUTL_ZERO_CROSSING | + DAC_PWR_CTRL_HPOUTR_ZERO_CROSSING; + RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val); + + val = RKCODEC_READ(sc, CODEC_HPOUT_POP_CTRL); + val |= HPOUT_POP_CTRL_HPOUTR_POP | HPOUT_POP_CTRL_HPOUTL_POP; + val &= ~(HPOUT_POP_CTRL_HPOUTR_POP_XCHARGE | HPOUT_POP_CTRL_HPOUTL_POP_XCHARGE); + RKCODEC_WRITE(sc, CODEC_HPOUT_POP_CTRL, val); + + val = RKCODEC_READ(sc, CODEC_HPMIX_CTRL); + val |= HPMIX_CTRL_HPMIXL_EN | HPMIX_CTRL_HPMIXR_EN; + RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val); + + val |= HPMIX_CTRL_HPMIXL_INIT_EN | HPMIX_CTRL_HPMIXR_INIT_EN; + RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val); + + val = RKCODEC_READ(sc, CODEC_HPOUT_CTRL); + val |= HPOUT_CTRL_HPOUTL_EN | HPOUT_CTRL_HPOUTR_EN; + RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); + + val |= HPOUT_CTRL_HPOUTL_INIT_EN | HPOUT_CTRL_HPOUTR_INIT_EN; + RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); + + val = RKCODEC_READ(sc, CODEC_DAC_CLK_CTRL); + val |= DAC_CLK_CTRL_DACL_REFV_ON | DAC_CLK_CTRL_DACR_REFV_ON; + RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + + val |= DAC_CLK_CTRL_DACL_CLK_ON | DAC_CLK_CTRL_DACR_CLK_ON; + RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + + val |= DAC_CLK_CTRL_DACL_ON | DAC_CLK_CTRL_DACR_ON; + RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + + val |= DAC_CLK_CTRL_DACL_INIT_ON | DAC_CLK_CTRL_DACR_INIT_ON; + RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + + val = RKCODEC_READ(sc, CODEC_DAC_SELECT); + val |= DAC_SELECT_DACL_SELECT | DAC_SELECT_DACR_SELECT; + RKCODEC_WRITE(sc, CODEC_DAC_SELECT, val); + + val = RKCODEC_READ(sc, CODEC_HPMIX_CTRL); + val |= HPMIX_CTRL_HPMIXL_INIT2_EN | HPMIX_CTRL_HPMIXR_INIT2_EN; + RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val); + + val = RKCODEC_READ(sc, CODEC_HPOUT_CTRL); + val |= HPOUT_CTRL_HPOUTL_UNMUTE | HPOUT_CTRL_HPOUTR_UNMUTE; + RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); + + RKCODEC_WRITE(sc, CODEC_HPOUTL_GAIN_CTRL, 0x1f); + RKCODEC_WRITE(sc, CODEC_HPOUTR_GAIN_CTRL, 0x1f); + + rkcodec_set_mute(sc, false); + + node = ofw_bus_get_node(dev); + OF_device_register_xref(OF_xref_from_node(node), dev); + + return (0); + +fail: + rkcodec_detach(dev); + return (error); +} + +static int +rkcodec_detach(device_t dev) +{ + struct rkcodec_softc *sc; + + sc = device_get_softc(dev); + + if (sc->res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + mtx_destroy(&sc->mtx); + + return (0); +} + +static int +rkcodec_mixer_init(struct snd_mixer *m) +{ + + mix_setdevs(m, RKCODEC_MIXER_DEVS); + + return (0); +} + +static int +rkcodec_mixer_uninit(struct snd_mixer *m) +{ + + return (0); +} + +static int +rkcodec_mixer_reinit(struct snd_mixer *m) +{ + + return (0); +} + +static int +rkcodec_mixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) +{ + struct rkcodec_softc *sc; + struct mtx *mixer_lock; + uint8_t do_unlock; + + sc = device_get_softc(mix_getdevinfo(m)); + mixer_lock = mixer_get_lock(m); + + if (mtx_owned(mixer_lock)) { + do_unlock = 0; + } else { + do_unlock = 1; + mtx_lock(mixer_lock); + } + + right = left; + + RKCODEC_LOCK(sc); + switch(dev) { + case SOUND_MIXER_VOLUME: + printf("[%s] %s:%d\n", __func__, __FILE__, __LINE__); + break; + + case SOUND_MIXER_MIC: + printf("[%s] %s:%d\n", __func__, __FILE__, __LINE__); + break; + default: + break; + } + RKCODEC_UNLOCK(sc); + + if (do_unlock) { + mtx_unlock(mixer_lock); + } + + return (left | (right << 8)); +} + +static unsigned +rkcodec_mixer_setrecsrc(struct snd_mixer *m, unsigned src) +{ + + return (0); +} + +static kobj_method_t rkcodec_mixer_methods[] = { + KOBJMETHOD(mixer_init, rkcodec_mixer_init), + KOBJMETHOD(mixer_uninit, rkcodec_mixer_uninit), + KOBJMETHOD(mixer_reinit, rkcodec_mixer_reinit), + KOBJMETHOD(mixer_set, rkcodec_mixer_set), + KOBJMETHOD(mixer_setrecsrc, rkcodec_mixer_setrecsrc), + KOBJMETHOD_END +}; + +MIXER_DECLARE(rkcodec_mixer); + +static int +rkcodec_dai_init(device_t dev, uint32_t format) +{ + struct rkcodec_softc *sc; + int fmt, pol, clk; + uint32_t ctrl1, ctrl2, ctrl3; + + sc = device_get_softc(dev); + + fmt = AUDIO_DAI_FORMAT_FORMAT(format); + pol = AUDIO_DAI_FORMAT_POLARITY(format); + clk = AUDIO_DAI_FORMAT_CLOCK(format); + + ctrl1 = RKCODEC_READ(sc, CODEC_DAC_INIT_CTRL1); + ctrl2 = RKCODEC_READ(sc, CODEC_DAC_INIT_CTRL2); + ctrl3 = RKCODEC_READ(sc, CODEC_DAC_INIT_CTRL3); + + ctrl3 &= ~(DAC_INIT_CTRL3_DAC_BCP_MASK); + switch (pol) { + case AUDIO_DAI_POLARITY_IB_NF: + ctrl3 |= DAC_INIT_CTRL3_DAC_BCP_REVERSAL; + break; + case AUDIO_DAI_POLARITY_NB_NF: + ctrl3 |= DAC_INIT_CTRL3_DAC_BCP_NORMAL; + break; + default: + return (EINVAL); + } + + ctrl1 &= ~(DAC_INIT_CTRL1_MODE_MASK); + switch (clk) { + case AUDIO_DAI_CLOCK_CBM_CFM: + ctrl1 |= DAC_INIT_CTRL1_DIRECTION_OUT | + DAC_INIT_CTRL1_DAC_I2S_MODE_SLAVE; + break; + case AUDIO_DAI_CLOCK_CBS_CFS: + ctrl1 |= DAC_INIT_CTRL1_DIRECTION_IN | + DAC_INIT_CTRL1_DAC_I2S_MODE_SLAVE; + break; + default: + return (EINVAL); + } + + ctrl2 &= ~(DAC_INIT_CTRL2_DAC_VDL_MASK | DAC_INIT_CTRL2_DAC_MODE_MASK); + ctrl2 |= DAC_INIT_CTRL2_DAC_VDL_16BITS; + ctrl3 &= ~(DAC_INIT_CTRL3_WL_MASK); + ctrl3 |= DAC_INIT_CTRL3_WL_32BITS; + switch (fmt) { + case AUDIO_DAI_FORMAT_I2S: + ctrl2 |= DAC_INIT_CTRL2_DAC_MODE_I2S; + break; + case AUDIO_DAI_FORMAT_LJ: + ctrl2 |= DAC_INIT_CTRL2_DAC_MODE_LJM; + break; + case AUDIO_DAI_FORMAT_RJ: + ctrl2 |= DAC_INIT_CTRL2_DAC_MODE_RJM; + break; + default: + return EINVAL; + } + + ctrl3 &= ~(DAC_INIT_CTRL3_RST_MASK); + ctrl3 |= DAC_INIT_CTRL3_RST_DIS; + + RKCODEC_WRITE(sc, CODEC_DAC_INIT_CTRL1, ctrl1); + RKCODEC_WRITE(sc, CODEC_DAC_INIT_CTRL2, ctrl2); + RKCODEC_WRITE(sc, CODEC_DAC_INIT_CTRL3, ctrl3); + + return (0); +} + +static int +rkcodec_dai_trigger(device_t dev, int go, int pcm_dir) +{ + // struct rkcodec_softc *sc = device_get_softc(dev); + + if ((pcm_dir != PCMDIR_PLAY) && (pcm_dir != PCMDIR_REC)) + return (EINVAL); + + switch (go) { + case PCMTRIG_START: + if (pcm_dir == PCMDIR_PLAY) { + printf("[%s] %s:%d\n", __func__, __FILE__, __LINE__); + } + else if (pcm_dir == PCMDIR_REC) { + printf("[%s] %s:%d\n", __func__, __FILE__, __LINE__); + } + break; + + case PCMTRIG_STOP: + case PCMTRIG_ABORT: + if (pcm_dir == PCMDIR_PLAY) { + printf("[%s] %s:%d\n", __func__, __FILE__, __LINE__); + } + else if (pcm_dir == PCMDIR_REC) { + printf("[%s] %s:%d\n", __func__, __FILE__, __LINE__); + } + break; + } + + return (0); +} + +static int +rkcodec_dai_setup_mixer(device_t dev, device_t pcmdev) +{ + + mixer_init(pcmdev, &rkcodec_mixer_class, dev); + + return (0); +} + +static device_method_t rkcodec_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rkcodec_probe), + DEVMETHOD(device_attach, rkcodec_attach), + DEVMETHOD(device_detach, rkcodec_detach), + + DEVMETHOD(audio_dai_init, rkcodec_dai_init), + DEVMETHOD(audio_dai_setup_mixer, rkcodec_dai_setup_mixer), + DEVMETHOD(audio_dai_trigger, rkcodec_dai_trigger), + + DEVMETHOD_END +}; + +static driver_t rkcodec_driver = { + "rk3328codec", + rkcodec_methods, + sizeof(struct rkcodec_softc), +}; + +static devclass_t rkcodec_devclass; + +DRIVER_MODULE(rkcodec, simplebus, rkcodec_driver, rkcodec_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); diff --git a/sys/arm64/rockchip/rk_i2s.c b/sys/arm64/rockchip/rk_i2s.c new file mode 100644 index 000000000000..8f53d8581d5c --- /dev/null +++ b/sys/arm64/rockchip/rk_i2s.c @@ -0,0 +1,657 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Oleksandr Tymoshenko + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "syscon_if.h" + +#include "opt_snd.h" +#include +#include +#include "audio_dai_if.h" + +#define AUDIO_BUFFER_SIZE 48000 * 4 + +#define I2S_TXCR 0x0000 +#define I2S_CSR_2 (0 << 15) +#define I2S_CSR_4 (1 << 15) +#define I2S_CSR_6 (2 << 15) +#define I2S_CSR_8 (3 << 15) +#define I2S_TXCR_IBM_NORMAL (0 << 9) +#define I2S_TXCR_IBM_LJ (1 << 9) +#define I2S_TXCR_IBM_RJ (2 << 9) +#define I2S_TXCR_PBM_NODELAY (0 << 7) +#define I2S_TXCR_PBM_1 (1 << 7) +#define I2S_TXCR_PBM_2 (2 << 7) +#define I2S_TXCR_PBM_3 (3 << 7) +#define I2S_TXCR_TFS_I2S (0 << 5) +#define I2S_TXCR_TFS_PCM (1 << 5) +#define I2S_TXCR_VDW_16 (0xf << 0) +#define I2S_RXCR 0x0004 +#define I2S_RXCR_IBM_NORMAL (0 << 9) +#define I2S_RXCR_IBM_LJ (1 << 9) +#define I2S_RXCR_IBM_RJ (2 << 9) +#define I2S_RXCR_PBM_NODELAY (0 << 7) +#define I2S_RXCR_PBM_1 (1 << 7) +#define I2S_RXCR_PBM_2 (2 << 7) +#define I2S_RXCR_PBM_3 (3 << 7) +#define I2S_RXCR_TFS_I2S (0 << 5) +#define I2S_RXCR_TFS_PCM (1 << 5) +#define I2S_RXCR_VDW_16 (0xf << 0) +#define I2S_CKR 0x0008 +#define I2S_CKR_MSS_MASK (1 << 27) +#define I2S_CKR_MSS_MASTER (0 << 27) +#define I2S_CKR_MSS_SLAVE (1 << 27) +#define I2S_CKR_CKP (1 << 26) +#define I2S_CKR_MDIV(n) (((n) - 1) << 16) +#define I2S_CKR_MDIV_MASK (0xff << 16) +#define I2S_CKR_RSD(n) (((n) - 1) << 8) +#define I2S_CKR_RSD_MASK (0xff << 8) +#define I2S_CKR_TSD(n) (((n) - 1) << 0) +#define I2S_CKR_TSD_MASK (0xff << 0) +#define I2S_TXFIFOLR 0x000c +#define TXFIFO0LR_MASK 0x3f +#define I2S_DMACR 0x0010 +#define I2S_DMACR_RDE_ENABLE (1 << 24) +#define I2S_DMACR_RDL(n) ((n) << 16) +#define I2S_DMACR_TDE_ENABLE (1 << 8) +#define I2S_DMACR_TDL(n) ((n) << 0) +#define I2S_INTCR 0x0014 +#define I2S_INTCR_RFT(n) (((n) - 1) << 20) +#define I2S_INTCR_TFT(n) (((n) - 1) << 4) +#define I2S_INTCR_RXFIE (1 << 16) +#define I2S_INTCR_TXUIC (1 << 2) +#define I2S_INTCR_TXEIE (1 << 0) +#define I2S_INTSR 0x0018 +#define I2S_INTSR_RXFI (1 << 16) +#define I2S_INTSR_TXUI (1 << 1) +#define I2S_INTSR_TXEI (1 << 0) +#define I2S_XFER 0x001c +#define I2S_XFER_RXS_START (1 << 1) +#define I2S_XFER_TXS_START (1 << 0) +#define I2S_CLR 0x0020 +#define I2S_CLR_RXC (1 << 1) +#define I2S_CLR_TXC (1 << 0) +#define I2S_TXDR 0x0024 +#define I2S_RXDR 0x0028 +#define I2S_RXFIFOLR 0x002c +#define RXFIFO0LR_MASK 0x3f + +/* syscon */ +#define GRF_SOC_CON8 0xe220 +#define I2S_IO_DIRECTION_MASK 7 +#define I2S_IO_DIRECTION_SHIFT 11 +#define I2S_IO_8CH_OUT_2CH_IN 0 +#define I2S_IO_6CH_OUT_4CH_IN 4 +#define I2S_IO_4CH_OUT_6CH_IN 6 +#define I2S_IO_2CH_OUT_8CH_IN 7 + +#define DIV_ROUND_CLOSEST(n,d) (((n) + (d) / 2) / (d)) + +#define RK_I2S_SAMPLING_RATE 48000 +#define FIFO_SIZE 32 + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3066-i2s", 1 }, + { "rockchip,rk3399-i2s", 1 }, + { NULL, 0 } +}; + +static struct resource_spec rk_i2s_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +struct rk_i2s_softc { + device_t dev; + struct resource *res[2]; + struct mtx mtx; + clk_t clk; + clk_t hclk; + void * intrhand; + struct syscon *grf; + /* pointers to playback/capture buffers */ + uint32_t play_ptr; + uint32_t rec_ptr; +}; + +#define RK_I2S_LOCK(sc) mtx_lock(&(sc)->mtx) +#define RK_I2S_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define RK_I2S_READ_4(sc, reg) bus_read_4((sc)->res[0], (reg)) +#define RK_I2S_WRITE_4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) + +static int rk_i2s_probe(device_t dev); +static int rk_i2s_attach(device_t dev); +static int rk_i2s_detach(device_t dev); + +static uint32_t sc_fmt[] = { + SND_FORMAT(AFMT_S16_LE, 2, 0), + 0 +}; +static struct pcmchan_caps rk_i2s_caps = {RK_I2S_SAMPLING_RATE, RK_I2S_SAMPLING_RATE, sc_fmt, 0}; + + +static int +rk_i2s_init(struct rk_i2s_softc *sc) +{ + uint32_t val; + int error; + + clk_set_freq(sc->clk, RK_I2S_SAMPLING_RATE * 256, + CLK_SET_ROUND_DOWN); + error = clk_enable(sc->clk); + if (error != 0) { + device_printf(sc->dev, "cannot enable i2s_clk clock\n"); + return (ENXIO); + } + + val = I2S_INTCR_TFT(FIFO_SIZE/2); + val |= I2S_INTCR_RFT(FIFO_SIZE/2); + RK_I2S_WRITE_4(sc, I2S_INTCR, val); + + if (sc->grf) { + val = (I2S_IO_2CH_OUT_8CH_IN << I2S_IO_DIRECTION_SHIFT); + val |= (I2S_IO_DIRECTION_MASK << I2S_IO_DIRECTION_SHIFT) << 16; + SYSCON_WRITE_4(sc->grf, GRF_SOC_CON8, val); + + #if 0 + // HACK: enable IO domain + val = (1 << 1); + val |= (1 << 1) << 16; + SYSCON_WRITE_4(sc->grf, 0xe640, val); + #endif + } + + RK_I2S_WRITE_4(sc, I2S_XFER, 0); + + return (0); +} + +static int +rk_i2s_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "Rockchip I2S"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_i2s_attach(device_t dev) +{ + struct rk_i2s_softc *sc; + int error; + phandle_t node; + + sc = device_get_softc(dev); + sc->dev = dev; + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + if (bus_alloc_resources(dev, rk_i2s_spec, sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + error = ENXIO; + goto fail; + } + + error = clk_get_by_ofw_name(dev, 0, "i2s_hclk", &sc->hclk); + if (error != 0) { + device_printf(dev, "cannot get i2s_hclk clock\n"); + goto fail; + } + + error = clk_get_by_ofw_name(dev, 0, "i2s_clk", &sc->clk); + if (error != 0) { + device_printf(dev, "cannot get i2s_clk clock\n"); + goto fail; + } + + /* Activate the module clock. */ + error = clk_enable(sc->hclk); + if (error != 0) { + device_printf(dev, "cannot enable i2s_hclk clock\n"); + goto fail; + } + + node = ofw_bus_get_node(dev); + if (OF_hasprop(node, "rockchip,grf") && + syscon_get_by_ofw_property(dev, node, + "rockchip,grf", &sc->grf) != 0) { + device_printf(dev, "cannot get grf driver handle\n"); + return (ENXIO); + } + + rk_i2s_init(sc); + + OF_device_register_xref(OF_xref_from_node(node), dev); + + return (0); + +fail: + rk_i2s_detach(dev); + return (error); +} + +static int +rk_i2s_detach(device_t dev) +{ + struct rk_i2s_softc *i2s; + + i2s = device_get_softc(dev); + + if (i2s->hclk != NULL) + clk_release(i2s->hclk); + if (i2s->clk) + clk_release(i2s->clk); + + if (i2s->intrhand != NULL) + bus_teardown_intr(i2s->dev, i2s->res[1], i2s->intrhand); + + bus_release_resources(dev, rk_i2s_spec, i2s->res); + mtx_destroy(&i2s->mtx); + + return (0); +} + +static int +rk_i2s_dai_init(device_t dev, uint32_t format) +{ + uint32_t val, txcr, rxcr; + struct rk_i2s_softc *sc; + int fmt, pol, clk; + + sc = device_get_softc(dev); + + fmt = AUDIO_DAI_FORMAT_FORMAT(format); + pol = AUDIO_DAI_FORMAT_POLARITY(format); + clk = AUDIO_DAI_FORMAT_CLOCK(format); + + /* Set format */ + val = RK_I2S_READ_4(sc, I2S_CKR); + + val &= ~(I2S_CKR_MSS_MASK); + switch (clk) { + case AUDIO_DAI_CLOCK_CBM_CFM: + val |= I2S_CKR_MSS_MASTER; + break; + case AUDIO_DAI_CLOCK_CBS_CFS: + val |= I2S_CKR_MSS_SLAVE; + break; + default: + return (EINVAL); + } + + switch (pol) { + case AUDIO_DAI_POLARITY_IB_NF: + val |= I2S_CKR_CKP; + break; + case AUDIO_DAI_POLARITY_NB_NF: + val &= ~I2S_CKR_CKP; + break; + default: + return (EINVAL); + } + + RK_I2S_WRITE_4(sc, I2S_CKR, val); + + txcr = I2S_TXCR_VDW_16 | I2S_CSR_2; + rxcr = I2S_RXCR_VDW_16 | I2S_CSR_2; + + switch (fmt) { + case AUDIO_DAI_FORMAT_I2S: + txcr |= I2S_TXCR_IBM_NORMAL; + rxcr |= I2S_RXCR_IBM_NORMAL; + break; + case AUDIO_DAI_FORMAT_LJ: + txcr |= I2S_TXCR_IBM_LJ; + rxcr |= I2S_RXCR_IBM_LJ; + break; + case AUDIO_DAI_FORMAT_RJ: *** 314 LINES SKIPPED *** From nobody Sat Nov 6 17:52:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0945A185596B; Sat, 6 Nov 2021 17:52: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 4HmlM76Zb9z4V6P; Sat, 6 Nov 2021 17:52: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 C3505781F; Sat, 6 Nov 2021 17:52: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 1A6HqJvT030367; Sat, 6 Nov 2021 17:52:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HqJbV030366; Sat, 6 Nov 2021 17:52:19 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:52:19 GMT Message-Id: <202111061752.1A6HqJbV030366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 8c9bdaf227b1 - main - rk3328_codec: fix a problem with the enable value List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c9bdaf227b1b83279ff76446e5fc226e19088d0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=8c9bdaf227b1b83279ff76446e5fc226e19088d0 commit 8c9bdaf227b1b83279ff76446e5fc226e19088d0 Author: Andriy Gapon AuthorDate: 2021-06-09 07:51:00 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:51:14 +0000 rk3328_codec: fix a problem with the enable value The previous value contained only the mask bit ("twice"), but not the value bit. While here, make a couple of lines a little bit prettier. MFC after: 1 month --- sys/arm64/rockchip/rk3328_codec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/rockchip/rk3328_codec.c b/sys/arm64/rockchip/rk3328_codec.c index 940b3b8bb9e8..c2ffe1e8089f 100644 --- a/sys/arm64/rockchip/rk3328_codec.c +++ b/sys/arm64/rockchip/rk3328_codec.c @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); #define SOC_CON10_GPIOMUT (1 << 1) #define SOC_CON10_GPIOMUT_MASK ((1 << 1) << 16) #define SOC_CON10_GPIOMUT_EN (1 << 0) -#define SOC_CON10_GPIOMUT_EN_MASK ((1 << 0) << 16) +#define SOC_CON10_GPIOMUT_EN_MASK ((1 << 0) << 16) #define CODEC_RESET 0x00 #define RESET_DIG_CORE_RST (1 << 1) @@ -247,10 +247,10 @@ rkcodec_attach(device_t dev) return (ENXIO); } - val = SOC_CON2_I2S_ACODEC_EN_MASK | (SOC_CON2_I2S_ACODEC_EN << 16); + val = SOC_CON2_I2S_ACODEC_EN | SOC_CON2_I2S_ACODEC_EN_MASK; SYSCON_WRITE_4(sc->grf, GRF_SOC_CON2, val); - val = 0 | (SOC_CON10_GPIOMUT_EN << 16); + val = 0 | SOC_CON10_GPIOMUT_EN_MASK; SYSCON_WRITE_4(sc->grf, GRF_SOC_CON10, val); error = clk_get_by_ofw_name(dev, 0, "pclk", &sc->pclk); From nobody Sat Nov 6 17:52:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 980CE18559E6; Sat, 6 Nov 2021 17:52: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 4HmlM926Fvz4VFg; Sat, 6 Nov 2021 17:52: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 05B3B7A11; Sat, 6 Nov 2021 17:52: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 1A6HqK5J030391; Sat, 6 Nov 2021 17:52:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HqKR6030390; Sat, 6 Nov 2021 17:52:20 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:52:20 GMT Message-Id: <202111061752.1A6HqKR6030390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 5d1a2edeec2e - main - rk_i2s: modify GRF_SOC_CON8 only for rk3399 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d1a2edeec2eb8221b42a7c887f9b2b8e0a17423 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1a2edeec2eb8221b42a7c887f9b2b8e0a17423 commit 5d1a2edeec2eb8221b42a7c887f9b2b8e0a17423 Author: Andriy Gapon AuthorDate: 2021-06-09 08:02:36 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:51:36 +0000 rk_i2s: modify GRF_SOC_CON8 only for rk3399 The register definition has nothing to do with, e.g., rk3328. MFC after: 1 month --- sys/arm64/rockchip/rk_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/rockchip/rk_i2s.c b/sys/arm64/rockchip/rk_i2s.c index 8f53d8581d5c..52f80789a795 100644 --- a/sys/arm64/rockchip/rk_i2s.c +++ b/sys/arm64/rockchip/rk_i2s.c @@ -195,7 +195,7 @@ rk_i2s_init(struct rk_i2s_softc *sc) val |= I2S_INTCR_RFT(FIFO_SIZE/2); RK_I2S_WRITE_4(sc, I2S_INTCR, val); - if (sc->grf) { + if (sc->grf && ofw_bus_is_compatible(sc->dev, "rockchip,rk3399-i2s")) { val = (I2S_IO_2CH_OUT_8CH_IN << I2S_IO_DIRECTION_SHIFT); val |= (I2S_IO_DIRECTION_MASK << I2S_IO_DIRECTION_SHIFT) << 16; SYSCON_WRITE_4(sc->grf, GRF_SOC_CON8, val); From nobody Sat Nov 6 17:52:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 02E741855859; Sat, 6 Nov 2021 17:52: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 4HmlMB3zvPz4VCc; Sat, 6 Nov 2021 17:52: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 1BA22777C; Sat, 6 Nov 2021 17:52: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 1A6HqMrK030422; Sat, 6 Nov 2021 17:52:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HqMXV030420; Sat, 6 Nov 2021 17:52:22 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:52:22 GMT Message-Id: <202111061752.1A6HqMXV030420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 69d202f22400 - main - rk3328_codec: bump delays in set_power and set_mute List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69d202f22400c5b64331fbbcd37b66df8d265c64 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=69d202f22400c5b64331fbbcd37b66df8d265c64 commit 69d202f22400c5b64331fbbcd37b66df8d265c64 Author: Andriy Gapon AuthorDate: 2021-06-09 08:58:42 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:51:44 +0000 rk3328_codec: bump delays in set_power and set_mute According to Linux they should be 10 ms, not 10 us. Also, add a read before the second write in set_power. MFC after: 1 month --- sys/arm64/rockchip/rk3328_codec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/arm64/rockchip/rk3328_codec.c b/sys/arm64/rockchip/rk3328_codec.c index c2ffe1e8089f..22f36389e1c6 100644 --- a/sys/arm64/rockchip/rk3328_codec.c +++ b/sys/arm64/rockchip/rk3328_codec.c @@ -178,7 +178,10 @@ rkcodec_set_power(struct rkcodec_softc *sc, bool poweron) else val &= ~(DAC_PRECHARGE_CTRL_DAC_CHARGE_PRECHARGE); RKCODEC_WRITE(sc, CODEC_DAC_PRECHARGE_CTRL, val); - DELAY(10); + + DELAY(10000); + + val = RKCODEC_READ(sc, CODEC_DAC_PRECHARGE_CTRL); if (poweron) val |= DAC_PRECHARGE_CTRL_DAC_CHARGE_CURRENT_ALL; else @@ -202,7 +205,7 @@ rkcodec_reset(struct rkcodec_softc *sc) { RKCODEC_WRITE(sc, CODEC_RESET, 0); - DELAY(10); + DELAY(10000); RKCODEC_WRITE(sc, CODEC_RESET, RESET_DIG_CORE_RST | RESET_SYS_RST); } From nobody Sat Nov 6 17:52:23 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2D0251855CC3; Sat, 6 Nov 2021 17:52: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 4HmlMD38fmz4V6l; Sat, 6 Nov 2021 17:52: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 443B377E6; Sat, 6 Nov 2021 17:52: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 1A6HqNEH030446; Sat, 6 Nov 2021 17:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HqNgg030445; Sat, 6 Nov 2021 17:52:23 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:52:23 GMT Message-Id: <202111061752.1A6HqNgg030445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 507fdedd83cd - main - rk3328_codec: add delays between register writes in the initial setup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 507fdedd83cd7aca7f1b208e93e9128d7da02b11 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=507fdedd83cd7aca7f1b208e93e9128d7da02b11 commit 507fdedd83cd7aca7f1b208e93e9128d7da02b11 Author: Andriy Gapon AuthorDate: 2021-06-09 09:10:50 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:51:50 +0000 rk3328_codec: add delays between register writes in the initial setup MFC after: 1 month --- sys/arm64/rockchip/rk3328_codec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/arm64/rockchip/rk3328_codec.c b/sys/arm64/rockchip/rk3328_codec.c index 22f36389e1c6..b00a61f58054 100644 --- a/sys/arm64/rockchip/rk3328_codec.c +++ b/sys/arm64/rockchip/rk3328_codec.c @@ -296,61 +296,77 @@ rkcodec_attach(device_t dev) val = RKCODEC_READ(sc, CODEC_DAC_PWR_CTRL); val |= DAC_PWR_CTRL_DAC_PWR; RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val); + DELAY(1000); val |= DAC_PWR_CTRL_DACL_PATH_REFV | DAC_PWR_CTRL_DACR_PATH_REFV; RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val); + DELAY(1000); val |= DAC_PWR_CTRL_HPOUTL_ZERO_CROSSING | DAC_PWR_CTRL_HPOUTR_ZERO_CROSSING; RKCODEC_WRITE(sc, CODEC_DAC_PWR_CTRL, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_HPOUT_POP_CTRL); val |= HPOUT_POP_CTRL_HPOUTR_POP | HPOUT_POP_CTRL_HPOUTL_POP; val &= ~(HPOUT_POP_CTRL_HPOUTR_POP_XCHARGE | HPOUT_POP_CTRL_HPOUTL_POP_XCHARGE); RKCODEC_WRITE(sc, CODEC_HPOUT_POP_CTRL, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_HPMIX_CTRL); val |= HPMIX_CTRL_HPMIXL_EN | HPMIX_CTRL_HPMIXR_EN; RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val); + DELAY(1000); val |= HPMIX_CTRL_HPMIXL_INIT_EN | HPMIX_CTRL_HPMIXR_INIT_EN; RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_HPOUT_CTRL); val |= HPOUT_CTRL_HPOUTL_EN | HPOUT_CTRL_HPOUTR_EN; RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); + DELAY(1000); val |= HPOUT_CTRL_HPOUTL_INIT_EN | HPOUT_CTRL_HPOUTR_INIT_EN; RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_DAC_CLK_CTRL); val |= DAC_CLK_CTRL_DACL_REFV_ON | DAC_CLK_CTRL_DACR_REFV_ON; RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + DELAY(1000); val |= DAC_CLK_CTRL_DACL_CLK_ON | DAC_CLK_CTRL_DACR_CLK_ON; RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + DELAY(1000); val |= DAC_CLK_CTRL_DACL_ON | DAC_CLK_CTRL_DACR_ON; RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + DELAY(1000); val |= DAC_CLK_CTRL_DACL_INIT_ON | DAC_CLK_CTRL_DACR_INIT_ON; RKCODEC_WRITE(sc, CODEC_DAC_CLK_CTRL, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_DAC_SELECT); val |= DAC_SELECT_DACL_SELECT | DAC_SELECT_DACR_SELECT; RKCODEC_WRITE(sc, CODEC_DAC_SELECT, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_HPMIX_CTRL); val |= HPMIX_CTRL_HPMIXL_INIT2_EN | HPMIX_CTRL_HPMIXR_INIT2_EN; RKCODEC_WRITE(sc, CODEC_HPMIX_CTRL, val); + DELAY(1000); val = RKCODEC_READ(sc, CODEC_HPOUT_CTRL); val |= HPOUT_CTRL_HPOUTL_UNMUTE | HPOUT_CTRL_HPOUTR_UNMUTE; RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); + DELAY(1000); RKCODEC_WRITE(sc, CODEC_HPOUTL_GAIN_CTRL, 0x1f); RKCODEC_WRITE(sc, CODEC_HPOUTR_GAIN_CTRL, 0x1f); + DELAY(1000); rkcodec_set_mute(sc, false); From nobody Sat Nov 6 17:52:24 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 410671855E81; Sat, 6 Nov 2021 17:52: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 4HmlMF4Tlkz4VCw; Sat, 6 Nov 2021 17:52: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 63CFE77E7; Sat, 6 Nov 2021 17:52: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 1A6HqOaP030470; Sat, 6 Nov 2021 17:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6HqOJM030469; Sat, 6 Nov 2021 17:52:24 GMT (envelope-from git) Date: Sat, 6 Nov 2021 17:52:24 GMT Message-Id: <202111061752.1A6HqOJM030469@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 2d1de2d55320 - main - rk3328_codec: set output gain to the value found in linux List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d1de2d55320fdc218a82ccb5116ab61aeb20fca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=2d1de2d55320fdc218a82ccb5116ab61aeb20fca commit 2d1de2d55320fdc218a82ccb5116ab61aeb20fca Author: Andriy Gapon AuthorDate: 2021-06-09 08:50:55 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:52:00 +0000 rk3328_codec: set output gain to the value found in linux According to Linux code the new value should correspond to 0dB gain while the original value corresponded to 6dB gain which may be uncomfortable for some output types. MFC after: 1 month --- sys/arm64/rockchip/rk3328_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/rockchip/rk3328_codec.c b/sys/arm64/rockchip/rk3328_codec.c index b00a61f58054..2a5f652fa8c2 100644 --- a/sys/arm64/rockchip/rk3328_codec.c +++ b/sys/arm64/rockchip/rk3328_codec.c @@ -364,8 +364,8 @@ rkcodec_attach(device_t dev) RKCODEC_WRITE(sc, CODEC_HPOUT_CTRL, val); DELAY(1000); - RKCODEC_WRITE(sc, CODEC_HPOUTL_GAIN_CTRL, 0x1f); - RKCODEC_WRITE(sc, CODEC_HPOUTR_GAIN_CTRL, 0x1f); + RKCODEC_WRITE(sc, CODEC_HPOUTL_GAIN_CTRL, 0x18); + RKCODEC_WRITE(sc, CODEC_HPOUTR_GAIN_CTRL, 0x18); DELAY(1000); rkcodec_set_mute(sc, false); From nobody Sat Nov 6 18:00:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1476E1833163; Sat, 6 Nov 2021 18:00: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 4HmlY507Hhz4ZTR; Sat, 6 Nov 2021 18:00: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 D84A97828; Sat, 6 Nov 2021 18:00: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 1A6I0u9A044311; Sat, 6 Nov 2021 18:00:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6I0uQh044310; Sat, 6 Nov 2021 18:00:56 GMT (envelope-from git) Date: Sat, 6 Nov 2021 18:00:56 GMT Message-Id: <202111061800.1A6I0uQh044310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: cc0b35259aed - main - rk805: add system poweroff support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc0b35259aed73747721718415fa1854108a276a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=cc0b35259aed73747721718415fa1854108a276a commit cc0b35259aed73747721718415fa1854108a276a Author: Andriy Gapon AuthorDate: 2021-11-06 17:58:43 +0000 Commit: Andriy Gapon CommitDate: 2021-11-06 17:58:43 +0000 rk805: add system poweroff support On my Rock64 neither EFI nor PSCI shutdown actually power off the board. RK805 does the job. Reviewed by: manu, peterj Differential Revision: https://reviews.freebsd.org/D30786 --- sys/arm64/rockchip/rk805.c | 36 ++++++++++++++++++++++++++++++++++++ sys/arm64/rockchip/rk805reg.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/sys/arm64/rockchip/rk805.c b/sys/arm64/rockchip/rk805.c index a2ee53b35a07..d3bda29ae362 100644 --- a/sys/arm64/rockchip/rk805.c +++ b/sys/arm64/rockchip/rk805.c @@ -31,8 +31,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -844,6 +846,29 @@ rk805_settime(device_t dev, struct timespec *ts) return (error); } +static void +rk805_poweroff(void *arg, int howto) +{ + device_t dev = arg; + int error; + uint8_t val; + + if ((howto & RB_POWEROFF) == 0) + return; + + device_printf(dev, "Powering off...\n"); + error = rk805_read(dev, RK805_DEV_CTRL, &val, 1); + if (error == 0) { + val |= RK805_DEV_CTRL_OFF; + error = rk805_write(dev, RK805_DEV_CTRL, &val, 1); + + /* Wait a bit for the command to take effect. */ + if (error == 0) + DELAY(100); + } + device_printf(dev, "Power off failed\n"); +} + static int rk805_attach(device_t dev) { @@ -907,6 +932,17 @@ rk805_attach(device_t dev) } } + if (OF_hasprop(ofw_bus_get_node(dev), + "rockchip,system-power-controller")) { + /* + * The priority is chosen to override PSCI and EFI shutdown + * methods as those two just hang without powering off on Rock64 + * at least. + */ + EVENTHANDLER_REGISTER(shutdown_final, rk805_poweroff, dev, + SHUTDOWN_PRI_LAST - 2); + } + return (0); } diff --git a/sys/arm64/rockchip/rk805reg.h b/sys/arm64/rockchip/rk805reg.h index b1f4481a5b68..61c6f49abd2c 100644 --- a/sys/arm64/rockchip/rk805reg.h +++ b/sys/arm64/rockchip/rk805reg.h @@ -93,6 +93,10 @@ #define RK808_LDO8_ON_VSEL 0x49 #define RK808_LDO8_SLEEP_VSEL 0x4A +#define RK805_DEV_CTRL 0x4B +#define RK805_DEV_CTRL_OFF (1 << 0) +#define RK805_DEV_CTRL_SLP (1 << 1) + enum rk805_regulator { RK805_DCDC1 = 0, RK805_DCDC2, From nobody Sat Nov 6 20:30:43 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 31E16183979B; Sat, 6 Nov 2021 20:30: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 4Hmpsw0qYJz3Mcw; Sat, 6 Nov 2021 20:30: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 F1C5611A21; Sat, 6 Nov 2021 20:30: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 1A6KUhoX039747; Sat, 6 Nov 2021 20:30:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6KUht7039746; Sat, 6 Nov 2021 20:30:43 GMT (envelope-from git) Date: Sat, 6 Nov 2021 20:30:43 GMT Message-Id: <202111062030.1A6KUht7039746@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: f0c9847a6c47 - main - vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: f0c9847a6c477430d6fff647b12e9e9e2b461f2a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f0c9847a6c477430d6fff647b12e9e9e2b461f2a commit f0c9847a6c477430d6fff647b12e9e9e2b461f2a Author: Rick Macklem AuthorDate: 2021-11-06 20:26:43 +0000 Commit: Rick Macklem CommitDate: 2021-11-06 20:26:43 +0000 vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE When the NFSv4.2 server does a VOP_ALLOCATE(), it needs the operation to be done for the RPC's credential and not td_ucred. It also needs the writing to be done synchronously. This patch adds "ioflag" and "cred" arguments to VOP_ALLOCATE() and modifies vop_stdallocate() to use these arguments. The VOP_ALLOCATE.9 man page will be patched separately. Reviewed by: khng, kib Differential Revision: https://reviews.freebsd.org/D32865 --- sys/fs/nfsclient/nfs_clvnops.c | 2 +- sys/fs/nfsserver/nfs_nfsdport.c | 2 +- sys/kern/vfs_default.c | 10 +++++----- sys/kern/vfs_vnops.c | 3 ++- sys/kern/vnode_if.src | 2 ++ 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index abccf82e3ff0..d4545cf2d840 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3731,7 +3731,7 @@ nfs_allocate(struct vop_allocate_args *ap) if ((uint64_t)alen > nfs_maxalloclen) alen = nfs_maxalloclen; error = nfsrpc_allocate(vp, *ap->a_offset, alen, - &nfsva, &attrflag, td->td_ucred, td, NULL); + &nfsva, &attrflag, ap->a_cred, td, NULL); } if (error == 0) { *ap->a_offset += alen; diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 5fa6853446ae..806f4a8545b8 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -6598,7 +6598,7 @@ nfsvno_allocate(struct vnode *vp, off_t off, off_t len, struct ucred *cred, */ do { olen = len; - error = VOP_ALLOCATE(vp, &off, &len); + error = VOP_ALLOCATE(vp, &off, &len, IO_SYNC, cred); if (error == 0 && len > 0 && olen > len) maybe_yield(); } while (error == 0 && len > 0 && olen > len); diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index d66443e6d6f0..02fae41e3404 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -963,7 +963,7 @@ vop_stdallocate(struct vop_allocate_args *ap) len = *ap->a_len; offset = *ap->a_offset; - error = VOP_GETATTR(vp, vap, td->td_ucred); + error = VOP_GETATTR(vp, vap, ap->a_cred); if (error != 0) goto out; fsize = vap->va_size; @@ -1000,12 +1000,12 @@ vop_stdallocate(struct vop_allocate_args *ap) */ VATTR_NULL(vap); vap->va_size = offset + len; - error = VOP_SETATTR(vp, vap, td->td_ucred); + error = VOP_SETATTR(vp, vap, ap->a_cred); if (error != 0) goto out; VATTR_NULL(vap); vap->va_size = fsize; - error = VOP_SETATTR(vp, vap, td->td_ucred); + error = VOP_SETATTR(vp, vap, ap->a_cred); if (error != 0) goto out; } @@ -1031,7 +1031,7 @@ vop_stdallocate(struct vop_allocate_args *ap) auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_READ; auio.uio_td = td; - error = VOP_READ(vp, &auio, 0, td->td_ucred); + error = VOP_READ(vp, &auio, ap->a_ioflag, ap->a_cred); if (error != 0) break; if (auio.uio_resid > 0) { @@ -1052,7 +1052,7 @@ vop_stdallocate(struct vop_allocate_args *ap) auio.uio_rw = UIO_WRITE; auio.uio_td = td; - error = VOP_WRITE(vp, &auio, 0, td->td_ucred); + error = VOP_WRITE(vp, &auio, ap->a_ioflag, ap->a_cred); if (error != 0) break; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d6c472995489..79d422aacfef 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3466,7 +3466,8 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, struct thread *td) error = mac_vnode_check_write(td->td_ucred, fp->f_cred, vp); if (error == 0) #endif - error = VOP_ALLOCATE(vp, &offset, &len); + error = VOP_ALLOCATE(vp, &offset, &len, 0, + td->td_ucred); VOP_UNLOCK(vp); vn_finished_write(mp); diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index d10758019b87..276382738504 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -702,6 +702,8 @@ vop_allocate { IN struct vnode *vp; INOUT off_t *offset; INOUT off_t *len; + IN int ioflag; + IN struct ucred *cred; }; From nobody Sat Nov 6 20:38:07 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4AAED183D8C2; Sat, 6 Nov 2021 20:38: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 4Hmq2S1VJMz3Q7v; Sat, 6 Nov 2021 20:38: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 0CE7C11CC2; Sat, 6 Nov 2021 20:38: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 1A6Kc76a044441; Sat, 6 Nov 2021 20:38:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6Kc7G6044440; Sat, 6 Nov 2021 20:38:07 GMT (envelope-from git) Date: Sat, 6 Nov 2021 20:38:07 GMT Message-Id: <202111062038.1A6Kc7G6044440@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: 0c276dee030b - main - param.h: Bump __FreeBSD_version for commit f0c9847a6c47 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 0c276dee030b241e12e1ceb1b2ab619004f08ce1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=0c276dee030b241e12e1ceb1b2ab619004f08ce1 commit 0c276dee030b241e12e1ceb1b2ab619004f08ce1 Author: Rick Macklem AuthorDate: 2021-11-06 20:34:56 +0000 Commit: Rick Macklem CommitDate: 2021-11-06 20:34:56 +0000 param.h: Bump __FreeBSD_version for commit f0c9847a6c47 Commit f0c9847a6c47 changed the arguments for VOP_ALLOCATE. Bump __FreeBSD_version to 1400041. --- 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 f4beaf0ec408..61774a80e2f9 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 1400040 +#define __FreeBSD_version 1400041 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Sat Nov 6 20:43:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C055F183F60F; Sat, 6 Nov 2021 20: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 4Hmq9B52SDz3h0G; Sat, 6 Nov 2021 20: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 8DE1D11D56; Sat, 6 Nov 2021 20: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 1A6Khwnv058031; Sat, 6 Nov 2021 20: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 1A6KhwlB058030; Sat, 6 Nov 2021 20:43:58 GMT (envelope-from git) Date: Sat, 6 Nov 2021 20:43:58 GMT Message-Id: <202111062043.1A6KhwlB058030@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: 25b0021d401b - main - UPDATING: Add entry for commit f0c9847a6c47 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 25b0021d401bdbc28980255f69dfadbd64e58564 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=25b0021d401bdbc28980255f69dfadbd64e58564 commit 25b0021d401bdbc28980255f69dfadbd64e58564 Author: Rick Macklem AuthorDate: 2021-11-06 20:40:50 +0000 Commit: Rick Macklem CommitDate: 2021-11-06 20:40:50 +0000 UPDATING: Add entry for commit f0c9847a6c47 --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index 765722b62617..bd79cda17aa3 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,12 @@ 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".) +20211106: + Commit f0c9847a6c47 changed the arguments for VOP_ALLOCATE. + The NFS modules must be rebuilt from sources and any out + of tree file systems that implement their own VOP_ALLOCATE + may need to be modified. + 20211022: The synchronous PPP kernel driver sppp(4) has been removed. The cp(4) and ce(4) drivers are now always compiled with netgraph(4) From nobody Sat Nov 6 22:25:22 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3CE641856126; Sat, 6 Nov 2021 22:25: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 4HmsQC1CBDz4lR3; Sat, 6 Nov 2021 22:25: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 056B31354C; Sat, 6 Nov 2021 22:25: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 1A6MPMZW091595; Sat, 6 Nov 2021 22:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A6MPMbu091594; Sat, 6 Nov 2021 22:25:22 GMT (envelope-from git) Date: Sat, 6 Nov 2021 22:25:22 GMT Message-Id: <202111062225.1A6MPMbu091594@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: 3fe0a5d2f6e3 - main - Awk: Add error file List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3fe0a5d2f6e3b13320732f21aa51141333ef92b9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3fe0a5d2f6e3b13320732f21aa51141333ef92b9 commit 3fe0a5d2f6e3b13320732f21aa51141333ef92b9 Author: Warner Losh AuthorDate: 2021-11-06 22:24:36 +0000 Commit: Warner Losh CommitDate: 2021-11-06 22:24:36 +0000 Awk: Add error file Add the expected output on stderr file. Sponsored by: Netflix --- contrib/one-true-awk/bugs-fixed/pfile-overflow.err | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/one-true-awk/bugs-fixed/pfile-overflow.err b/contrib/one-true-awk/bugs-fixed/pfile-overflow.err new file mode 100644 index 000000000000..d2507df70e0c --- /dev/null +++ b/contrib/one-true-awk/bugs-fixed/pfile-overflow.err @@ -0,0 +1,4 @@ +awk: syntax error at source line 1 source file pfile-overflow.awk + context is + >>> <<< +awk: bailing out at source line 1 source file pfile-overflow.awk From nobody Sun Nov 7 01:53:47 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 28A1B1854D50; Sun, 7 Nov 2021 01:53:52 +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 4Hmy2l6psmz4v2p; Sun, 7 Nov 2021 01:53:51 +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 jTsPm4JcFps7PjXNXmRA2l; Sun, 07 Nov 2021 01:53:51 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id jXNVm2Gkc1ykvjXNWmXCjB; Sun, 07 Nov 2021 01:53:51 +0000 X-Authority-Analysis: v=2.4 cv=DLqcXgBb c=1 sm=1 tr=0 ts=618731af a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=vIxV3rELxO4A:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=ypVJL4-jAAAA:8 a=7wxGZsl52zzSAFj4mXEA:9 a=JOWeiY5itpwPQvuQ8dm/GawRuwE=:19 a=sSj7MGH7lQmzwXWU:21 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=khIbc0fXALFIcTpOSxgJ:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 2C97B6DE; Sat, 6 Nov 2021 18:53:48 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 1A71rl5H004446; Sat, 6 Nov 2021 18:53:47 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202111070153.1A71rl5H004446@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: Wojciech Macek cc: Shawn Webb , Wojciech Macek , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0dedcdaa1a02 - main - Revert "ossl: Add support for ETA mode" In-reply-to: References: <202111061646.1A6GkIj4036877@gitrepo.freebsd.org> <20211106165946.zrj7fonoxbca3cj2@mutt-hbsd> Comments: In-reply-to Wojciech Macek message dated "Sat, 06 Nov 2021 18:33:25 +0100." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 06 Nov 2021 18:53:47 -0700 X-CMAE-Envelope: MS4xfDLT9x1qZz0KDFTaoU9CDL+BsqEbl3mPMGxvMK/iu7H3vLZShDjRoolnOWppGK653+BjG4x5Tt5ZkoPpAYpd6MWodracObc/vKmct7+TFAHWuLfbtY1o zDUVZOPp5erORcu2dERKsAZNL/tcpz8+jJM389tpsMlJp8PgsmGiFRvDPYD/f2GSrPDw2m4SeOdUO0ZODy2b8xkSVmz5Tv3DWlM8DRCSNF5rfs088Z+KK7Hr eVyCAIGmoA6ZObMZs1uTV88G4JtzGfOCfgnAtdlmgGzCtkiqZWX8X2VPhJVtWQSrsCdYK/BcugqAhN8cQ52uM8HZZqQZZGa5AWHPz/Dmy1NC79yoDFuSfwFj 9XkOu7u9lBtM0+Zf/YfNidSviLbFW2NEZ9NgHvAJ8/Gb1XH9eRA= X-Rspamd-Queue-Id: 4Hmy2l6psmz4v2p X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N This should have been documented in the commit log message. Now people reading the log months from now will be left wondering. -- 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. In message , Wojciech Macek writes: > --000000000000e1216d05d0222833 > Content-Type: text/plain; charset="UTF-8" > Content-Transfer-Encoding: quoted-printable > > It breaks linker for arm64-LINT kernel. Will fix and push it back next week= > . > > sob., 6 lis 2021, 17:59 u=C5=BCytkownik Shawn Webb org> > napisa=C5=82: > > > On Sat, Nov 06, 2021 at 04:46:18PM +0000, Wojciech Macek wrote: > > > The branch main has been updated by wma: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3D0dedcdaa1a023d46c8951f03cd2f9df= > 7ae025675 > > > > > > commit 0dedcdaa1a023d46c8951f03cd2f9df7ae025675 > > > Author: Wojciech Macek > > > AuthorDate: 2021-11-06 16:45:50 +0000 > > > Commit: Wojciech Macek > > > CommitDate: 2021-11-06 16:45:50 +0000 > > > > > > Revert "ossl: Add support for ETA mode" > > > > > > This reverts commit 048a71b46e816de8fb95b553a8ad0e98c0d51e12. > > > > Why? > > > > -- > > Shawn Webb > > Cofounder / Security Engineer > > HardenedBSD > > > > > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/0= > 3A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > > > > --000000000000e1216d05d0222833 > Content-Type: text/html; charset="UTF-8" > Content-Transfer-Encoding: quoted-printable > >
It breaks linker for arm64-LINT kernel. Will fix and push= > it back next week.

ass=3D"gmail_attr">sob., 6 lis 2021, 17:59 u=C5=BCytkownik Shawn Webb <<= > a href=3D"mailto:shawn.webb@hardenedbsd.org">shawn.webb@hardenedbsd.org= > > napisa=C5=82:
in:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Nov 06, = > 2021 at 04:46:18PM +0000, Wojciech Macek wrote:
> > The branch main has been updated by wma:
> >
> > URL: 3d46c8951f03cd2f9df7ae025675" rel=3D"noreferrer noreferrer" target=3D"_blan= > k">https://cgit.FreeBSD.org/src/commit/?id=3D0dedcdaa1a023d46c8951f03cd2f9d= > f7ae025675
> >
> > commit 0dedcdaa1a023d46c8951f03cd2f9df7ae025675
> > Author:=C2=A0 =C2=A0 =C2=A0Wojciech Macek <wma@FreeBSD.org>
> > AuthorDate: 2021-11-06 16:45:50 +0000
> > Commit:=C2=A0 =C2=A0 =C2=A0Wojciech Macek <wma@FreeBSD.org>
> > CommitDate: 2021-11-06 16:45:50 +0000
> >
> >=C2=A0 =C2=A0 =C2=A0Revert "ossl: Add support for ETA mode" r> > >=C2=A0 =C2=A0 =C2=A0
> >=C2=A0 =C2=A0 =C2=A0This reverts commit 048a71b46e816de8fb95b553a8ad0e9= > 8c0d51e12.
>
> Why?
>
> --
> Shawn Webb
> Cofounder / Security Engineer
> HardenedBSD
>
> wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc" rel=3D"noreferrer= > noreferrer" target=3D"_blank">https://git.hardenedbsd.org/hardenedbsd/pubk= > eys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.as= > c
>
> > --000000000000e1216d05d0222833-- > From nobody Sun Nov 7 02:44:54 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EDBBB1846F07; Sun, 7 Nov 2021 02:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hmz9f6P19z3QWM; Sun, 7 Nov 2021 02:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B819F167A6; Sun, 7 Nov 2021 02:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A72isoi037337; Sun, 7 Nov 2021 02:44:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A72isYX037336; Sun, 7 Nov 2021 02:44:54 GMT (envelope-from git) Date: Sun, 7 Nov 2021 02:44:54 GMT Message-Id: <202111070244.1A72isYX037336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: ec071430a782 - main - powerd(8): Add rc.conf(5) to see also List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ec071430a7822997619fe6d99853d8f49ea10b20 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ec071430a7822997619fe6d99853d8f49ea10b20 commit ec071430a7822997619fe6d99853d8f49ea10b20 Author: Felix Johnson AuthorDate: 2021-11-07 02:39:23 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-07 02:43:30 +0000 powerd(8): Add rc.conf(5) to see also powerd_flags is mentioned in rc.conf(5) and can be set there and pass to powerd. PR: 258320 MFC after: 3 days Reported by: Michael --- usr.sbin/powerd/powerd.8 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/powerd/powerd.8 b/usr.sbin/powerd/powerd.8 index eb0d84292207..9c5133f536d7 100644 --- a/usr.sbin/powerd/powerd.8 +++ b/usr.sbin/powerd/powerd.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2020 +.Dd November 6, 2021 .Dt POWERD 8 .Os .Sh NAME @@ -143,7 +143,8 @@ The default PID file. .Sh SEE ALSO .Xr acpi 4 , .Xr apm 4 , -.Xr cpufreq 4 +.Xr cpufreq 4 , +.Xr rc.conf 5 .Sh HISTORY The .Nm From nobody Sun Nov 7 09:19:53 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0E4FC183C657; Sun, 7 Nov 2021 09:19: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 4Hn7xP6xShz3hdb; Sun, 7 Nov 2021 09:19: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 C97A61BC8A; Sun, 7 Nov 2021 09:19: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 1A79JrZf056688; Sun, 7 Nov 2021 09:19:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A79JrgM056687; Sun, 7 Nov 2021 09:19:53 GMT (envelope-from git) Date: Sun, 7 Nov 2021 09:19:53 GMT Message-Id: <202111070919.1A79JrgM056687@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: a90ff3c4bc90 - main - linux: Add ptrace(2) support on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: a90ff3c4bc901947a040717f39d5b3b8778047fe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=a90ff3c4bc901947a040717f39d5b3b8778047fe commit a90ff3c4bc901947a040717f39d5b3b8778047fe Author: Edward Tomasz Napierala AuthorDate: 2021-11-07 08:22:41 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-11-07 08:39:24 +0000 linux: Add ptrace(2) support on arm64 This moves linux_ptrace.c from sys/amd64/linux/ to sys/compat/linux/, making it possible to use it on architectures other than amd64. It also enables Linux ptrace(2) on arm64. Relnotes: yes Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32868 --- sys/arm64/linux/linux_ptrace.c | 56 ------------------------------ sys/compat/linux/linux_misc.c | 2 +- sys/compat/linux/linux_misc.h | 2 +- sys/{amd64 => compat}/linux/linux_ptrace.c | 0 4 files changed, 2 insertions(+), 58 deletions(-) diff --git a/sys/arm64/linux/linux_ptrace.c b/sys/arm64/linux/linux_ptrace.c deleted file mode 100644 index a7d53470a12d..000000000000 --- a/sys/arm64/linux/linux_ptrace.c +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (C) 2018 Turing Robotic Industries 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 THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include -#include - -/* DTrace init */ -LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); - -/* DTrace probes */ -LIN_SDT_PROBE_DEFINE0(ptrace, linux_ptrace, todo); - -int -linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) -{ - - /* LINUXTODO: implement arm64 linux_ptrace */ - LIN_SDT_PROBE0(ptrace, linux_ptrace, todo); - return (EDOOFUS); -} diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 559eb6463da0..5ae4051aaf38 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1024,7 +1024,7 @@ linux_common_wait(struct thread *td, int pid, int *statusp, } else if (WIFSTOPPED(tmpstat)) { tmpstat = (tmpstat & 0xffff00ff) | (bsd_to_linux_signal(WSTOPSIG(tmpstat)) << 8); -#if defined(__amd64__) && !defined(COMPAT_LINUX32) +#if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32)) if (WSTOPSIG(status) == SIGTRAP) { tmpstat = linux_ptrace_status(td, siginfo.si_pid, tmpstat); diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index ceb140d3da75..bf8f3dd2f0cd 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -153,7 +153,7 @@ extern int stclohz; /* Linux syslog flags */ #define LINUX_SYSLOG_ACTION_READ_ALL 3 -#if defined(__amd64__) && !defined(COMPAT_LINUX32) +#if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32)) int linux_ptrace_status(struct thread *td, int pid, int status); #endif void linux_to_bsd_waitopts(int options, int *bsdopts); diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/compat/linux/linux_ptrace.c similarity index 100% rename from sys/amd64/linux/linux_ptrace.c rename to sys/compat/linux/linux_ptrace.c From nobody Sun Nov 7 13:04:58 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 699001841EDF; Sun, 7 Nov 2021 13:04: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 4HnDx62Vx4z3tFg; Sun, 7 Nov 2021 13:04: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 35DCD1ED08; Sun, 7 Nov 2021 13:04: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 1A7D4wjv061878; Sun, 7 Nov 2021 13:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7D4wSj061877; Sun, 7 Nov 2021 13:04:58 GMT (envelope-from git) Date: Sun, 7 Nov 2021 13:04:58 GMT Message-Id: <202111071304.1A7D4wSj061877@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: 3d6ed119e3fe - main - usb_audio: Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 3d6ed119e3fe123b7e18adf8672c45ab81068527 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3d6ed119e3fe123b7e18adf8672c45ab81068527 commit 3d6ed119e3fe123b7e18adf8672c45ab81068527 Author: Gordon Bergling AuthorDate: 2021-11-07 13:04:26 +0000 Commit: Gordon Bergling CommitDate: 2021-11-07 13:04:26 +0000 usb_audio: Fix a typo in a source code comment - s/maxium/maximum/ MFC after: 3 days --- sys/dev/sound/usb/uaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 538e4180f6de..3a7d4189b9ef 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1588,7 +1588,7 @@ uaudio20_check_rate(struct usb_device *udev, uint8_t iface_no, { struct usb_device_request req; usb_error_t error; -#define UAUDIO20_MAX_RATES 32 /* we support at maxium 32 rates */ +#define UAUDIO20_MAX_RATES 32 /* we support at maximum 32 rates */ uint8_t data[2 + UAUDIO20_MAX_RATES * 12]; uint16_t actlen; uint16_t rates; From nobody Sun Nov 7 13:08:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5B0E1184299D; Sun, 7 Nov 2021 13:08: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 4HnF1026v2z3tQr; Sun, 7 Nov 2021 13:08: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 257221ECF4; Sun, 7 Nov 2021 13:08: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 1A7D8KZn062209; Sun, 7 Nov 2021 13:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7D8K6j062208; Sun, 7 Nov 2021 13:08:20 GMT (envelope-from git) Date: Sun, 7 Nov 2021 13:08:20 GMT Message-Id: <202111071308.1A7D8K6j062208@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: 2b0f6ad444c0 - main - efi(8): Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2b0f6ad444c0ec82facf55c0ee4806c2ba217daa commit 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa Author: Gordon Bergling AuthorDate: 2021-11-07 13:07:24 +0000 Commit: Gordon Bergling CommitDate: 2021-11-07 13:07:24 +0000 efi(8): Fix a typo in a source code comment - s/writting/writing/ MFC after: 3 days --- stand/efi/include/efiuga.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/include/efiuga.h b/stand/efi/include/efiuga.h index 28c738e7fbc4..00464b7cb4c0 100644 --- a/stand/efi/include/efiuga.h +++ b/stand/efi/include/efiuga.h @@ -139,7 +139,7 @@ typedef enum { @retval EFI_SUCCESS - The Blt operation completed. @retval EFI_INVALID_PARAMETER - BltOperation is not valid. - @retval EFI_DEVICE_ERROR - A hardware error occurred writting to the video buffer. + @retval EFI_DEVICE_ERROR - A hardware error occurred writing to the video buffer. --*/ typedef From nobody Sun Nov 7 13:13:15 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6534518463BC; Sun, 7 Nov 2021 13:13: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 4HnF6g2H3nz3wRL; Sun, 7 Nov 2021 13:13: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 2C1051EAB3; Sun, 7 Nov 2021 13:13: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 1A7DDFtj074935; Sun, 7 Nov 2021 13:13:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7DDFlV074934; Sun, 7 Nov 2021 13:13:15 GMT (envelope-from git) Date: Sun, 7 Nov 2021 13:13:15 GMT Message-Id: <202111071313.1A7DDFlV074934@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: e9c7c6f5a021 - main - e1000: Fix a typo in a source code comment List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: e9c7c6f5a021a02c5af2fa446d31cf3756b58d62 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e9c7c6f5a021a02c5af2fa446d31cf3756b58d62 commit e9c7c6f5a021a02c5af2fa446d31cf3756b58d62 Author: Gordon Bergling AuthorDate: 2021-11-07 13:12:23 +0000 Commit: Gordon Bergling CommitDate: 2021-11-07 13:12:23 +0000 e1000: Fix a typo in a source code comment - s/overwritting/overwriting/ MFC after: 3 days --- sys/dev/e1000/e1000_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 872a5267bfdb..5c346b2163de 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -474,7 +474,7 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_i2c"); - /* Prevent overwritting SFP I2C EEPROM which is at A0 address.*/ + /* Prevent overwriting SFP I2C EEPROM which is at A0 address.*/ if ((hw->phy.addr == 0) || (hw->phy.addr > 7)) { DEBUGOUT1("PHY I2C Address %d is out of range.\n", hw->phy.addr); From nobody Sun Nov 7 15:19:48 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 34074183F013; Sun, 7 Nov 2021 15:19: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 4HnHwj0nvpz3L6w; Sun, 7 Nov 2021 15:19: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 EF9D020060; Sun, 7 Nov 2021 15:19: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 1A7FJmqj034547; Sun, 7 Nov 2021 15:19:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7FJmf9034546; Sun, 7 Nov 2021 15:19:48 GMT (envelope-from git) Date: Sun, 7 Nov 2021 15:19:48 GMT Message-Id: <202111071519.1A7FJmf9034546@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: 597b02675751 - main - libc: add clearenv function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 597b02675751e48dd04777f1e91fee382bf3a966 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=597b02675751e48dd04777f1e91fee382bf3a966 commit 597b02675751e48dd04777f1e91fee382bf3a966 Author: Mariusz Zaborski AuthorDate: 2021-11-07 15:15:28 +0000 Commit: Mariusz Zaborski CommitDate: 2021-11-07 15:20:15 +0000 libc: add clearenv function The clearenv(3) function allows us to clear all environment variable in one shot. This may be useful for security programs that want to control the environment or what variables are passed to new spawned programs. Reviewed by: scf, markj (secteam), 0mp (manpages) Differential Revision: https://reviews.freebsd.org/D28223 --- include/stdlib.h | 2 + lib/libc/stdlib/Makefile.inc | 3 +- lib/libc/stdlib/Symbol.map | 4 + lib/libc/stdlib/getenv.3 | 20 +++- lib/libc/stdlib/getenv.c | 25 +++++ lib/libc/tests/stdlib/Makefile | 1 + lib/libc/tests/stdlib/clearenv_test.c | 176 ++++++++++++++++++++++++++++++++++ 7 files changed, 228 insertions(+), 3 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index ca96c06b83b7..bf1a612190ee 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -283,6 +283,8 @@ int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); +int clearenv(void); + int daemon(int, int); int daemonfd(int, int); char *devname(__dev_t, __mode_t); diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 361761e73fdd..a658fd78e862 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -46,7 +46,8 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 \ MLINKS+=a64l.3 l64a.3 a64l.3 l64a_r.3 MLINKS+=atol.3 atoll.3 MLINKS+=exit.3 _Exit.3 -MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3 +MLINKS+=getenv.3 clearenv.3 getenv.3 putenv.3 getenv.3 setenv.3 \ + getenv.3 unsetenv.3 MLINKS+=getopt_long.3 getopt_long_only.3 MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3 MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3 diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map index 2be23390e333..6524c6097b96 100644 --- a/lib/libc/stdlib/Symbol.map +++ b/lib/libc/stdlib/Symbol.map @@ -128,6 +128,10 @@ FBSD_1.6 { srand; }; +FBSD_1.7 { + clearenv; +}; + FBSDprivate_1.0 { __system; _system; diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3 index e662b86d214b..5566d7b01dcd 100644 --- a/lib/libc/stdlib/getenv.3 +++ b/lib/libc/stdlib/getenv.3 @@ -32,10 +32,11 @@ .\" @(#)getenv.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd June 20, 2007 +.Dd November 7, 2021 .Dt GETENV 3 .Os .Sh NAME +.Nm clearenv , .Nm getenv , .Nm putenv , .Nm setenv , @@ -45,6 +46,8 @@ .Lb libc .Sh SYNOPSIS .In stdlib.h +.Ft int +.Fn clearenv "void" .Ft char * .Fn getenv "const char *name" .Ft int @@ -59,6 +62,14 @@ host .Em environment list . .Pp The +.Fn clearenv +function clears all environment variables. +New variables can be added using +.Fn setenv +and +.Fn putenv . +.Pp +The .Fn getenv function obtains the current value of the environment variable, .Fa name . @@ -128,7 +139,7 @@ is not in the current environment, .Dv NULL is returned. .Pp -.Rv -std setenv putenv unsetenv +.Rv -std clearenv setenv putenv unsetenv .Sh ERRORS .Bl -tag -width Er .It Bq Er EINVAL @@ -211,6 +222,11 @@ This was changed to use as the memory location of the ``name=value'' pair to follow the .Tn POSIX specification. +.Pp +The +.Fn clearenv +was added in +.Fx 14 . .Sh BUGS Successive calls to .Fn setenv diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 5d445e18d93b..bf79cb6b0d79 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -691,3 +691,28 @@ unsetenv(const char *name) return (0); } + +/* + * Unset all variable by flagging them as inactive. No variable is + * ever freed. + */ +int +clearenv(void) +{ + int ndx; + + /* Initialize environment. */ + if (__merge_environ() == -1 || (envVars == NULL && __build_env() == -1)) + return (-1); + + /* Remove from the end to not shuffle memory too much. */ + for (ndx = envVarsTotal - 1; ndx >= 0; ndx--) { + envVars[ndx].active = false; + if (envVars[ndx].putenv) + __remove_putenv(ndx); + } + + __rebuild_environ(0); + + return (0); +} diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index bd85efcb1b95..ffba83443a9e 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -2,6 +2,7 @@ .include +ATF_TESTS_C+= clearenv_test ATF_TESTS_C+= dynthr_test ATF_TESTS_C+= heapsort_test ATF_TESTS_C+= mergesort_test diff --git a/lib/libc/tests/stdlib/clearenv_test.c b/lib/libc/tests/stdlib/clearenv_test.c new file mode 100644 index 000000000000..0c705bfece1e --- /dev/null +++ b/lib/libc/tests/stdlib/clearenv_test.c @@ -0,0 +1,176 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2021 Mariusz Zaborski + * + * 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. + */ + +/* + * Test for clearenv(3) routine. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include + +#define TEST_VARIABLE "TEST_VAR" +#define TEST_SYSTEM_VARIABLE "PWD" + +extern char **environ; + +void +create_multiple_variables(int num) +{ + char name[64]; + char value[64]; + int i; + + for (i = 0; i < num; i++) { + snprintf(name, sizeof(name), "%s_%d", TEST_VARIABLE, i); + snprintf(value, sizeof(value), "%d", i); + ATF_CHECK(getenv(name) == NULL); + ATF_CHECK(setenv(name, value, 0) != -1); + ATF_CHECK_STREQ(getenv(name), value); + } +} + +void +check_if_nulled_variables(int num) +{ + char name[64]; + int i; + + for (i = 0; i < num; i++) { + snprintf(name, sizeof(name), "%s_%d", TEST_VARIABLE, i); + ATF_CHECK(getenv(name) == NULL); + } +} + +ATF_TC_WITHOUT_HEAD(clearenv__single_var_test); +ATF_TC_BODY(clearenv__single_var_test, tc) +{ + + ATF_CHECK(setenv(TEST_VARIABLE, "true", 0) != -1); + ATF_CHECK_STREQ(getenv(TEST_VARIABLE), "true"); + ATF_CHECK(clearenv() == 0); + ATF_CHECK(getenv(TEST_VARIABLE) == NULL); +} + +ATF_TC_WITHOUT_HEAD(clearenv__multiple_vars_test); +ATF_TC_BODY(clearenv__multiple_vars_test, tc) +{ + + create_multiple_variables(10); + ATF_CHECK(clearenv() == 0); + check_if_nulled_variables(10); +} + +ATF_TC_WITHOUT_HEAD(clearenv__recreated_vars_test); +ATF_TC_BODY(clearenv__recreated_vars_test, tc) +{ + + create_multiple_variables(10); + ATF_CHECK(clearenv() == 0); + check_if_nulled_variables(10); + create_multiple_variables(10); +} + +ATF_TC_WITHOUT_HEAD(clearenv__system_var_test); +ATF_TC_BODY(clearenv__system_var_test, tc) +{ + + ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) != NULL); + ATF_CHECK(clearenv() == 0); + ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) == NULL); +} + +ATF_TC_WITHOUT_HEAD(clearenv__recreated_system_var_test); +ATF_TC_BODY(clearenv__recreated_system_var_test, tc) +{ + + ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) != NULL); + ATF_CHECK(clearenv() == 0); + ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) == NULL); + ATF_CHECK(setenv(TEST_SYSTEM_VARIABLE, "test", 0) != -1); + ATF_CHECK_STREQ(getenv(TEST_SYSTEM_VARIABLE), "test"); +} + +ATF_TC_WITHOUT_HEAD(clearenv__double_clear_vars); +ATF_TC_BODY(clearenv__double_clear_vars, tc) +{ + + create_multiple_variables(10); + ATF_CHECK(clearenv() == 0); + check_if_nulled_variables(10); + ATF_CHECK(clearenv() == 0); + check_if_nulled_variables(10); + create_multiple_variables(10); +} + +ATF_TC_WITHOUT_HEAD(clearenv__environ_null); +ATF_TC_BODY(clearenv__environ_null, tc) +{ + + ATF_CHECK(clearenv() == 0); + ATF_CHECK(environ == NULL); +} + +ATF_TC_WITHOUT_HEAD(clearenv__putenv_vars); +ATF_TC_BODY(clearenv__putenv_vars, tc) +{ + char buf[64], ref[64]; + + snprintf(buf, sizeof(buf), "%s=1", TEST_VARIABLE); + strcpy(ref, buf); + + ATF_CHECK(getenv(TEST_VARIABLE) == NULL); + ATF_CHECK(putenv(buf) != -1); + ATF_CHECK(strcmp(getenv(TEST_VARIABLE), "1") == 0); + + ATF_CHECK(clearenv() == 0); + + ATF_CHECK(getenv(TEST_VARIABLE) == NULL); + ATF_CHECK(strcmp(buf, ref) == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, clearenv__single_var_test); + ATF_TP_ADD_TC(tp, clearenv__multiple_vars_test); + ATF_TP_ADD_TC(tp, clearenv__recreated_vars_test); + + ATF_TP_ADD_TC(tp, clearenv__system_var_test); + ATF_TP_ADD_TC(tp, clearenv__recreated_system_var_test); + + ATF_TP_ADD_TC(tp, clearenv__double_clear_vars); + ATF_TP_ADD_TC(tp, clearenv__environ_null); + + ATF_TP_ADD_TC(tp, clearenv__putenv_vars); + + return (atf_no_error()); +} From nobody Sun Nov 7 17:55:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BE742184B16B; Sun, 7 Nov 2021 17:55: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 4HnMNQ50jfz3CYt; Sun, 7 Nov 2021 17:55: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 8B89222831; Sun, 7 Nov 2021 17:55: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 1A7HtY1j046334; Sun, 7 Nov 2021 17:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7HtYXp046333; Sun, 7 Nov 2021 17:55:34 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:34 GMT Message-Id: <202111071755.1A7HtYXp046333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: b6f39b843659 - stable/12 - dpv.1: Fix an example List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b6f39b843659eca082d5db54fb1f6f4ffe367d35 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b6f39b843659eca082d5db54fb1f6f4ffe367d35 commit b6f39b843659eca082d5db54fb1f6f4ffe367d35 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:11:50 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:49:51 +0000 dpv.1: Fix an example dpv(1) requires a label to be specified. MFC after: 3 days (cherry picked from commit f7c7a6ac00f13e2d47d50844dd92071933c33a56) --- usr.bin/dpv/dpv.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index 992251c88ab9..d18eff24343b 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -360,7 +360,7 @@ dpv -o /dev/ada0 -m label disk-image.img .Pp Zeroing a disk: .Bd -literal -offset indent -dpv -o /dev/md42 < /dev/zero +dpv -o /dev/md42 "Zeroing md42" < /dev/zero .Ed .Sh SEE ALSO .Xr dialog 1 , From nobody Sun Nov 7 17:55:34 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2AF3C184B48E; Sun, 7 Nov 2021 17:55: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 4HnMNR0hVHz3CYv; Sun, 7 Nov 2021 17:55: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 EBAA922B07; Sun, 7 Nov 2021 17:55: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 1A7HtYZi046426; Sun, 7 Nov 2021 17:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7HtYeF046425; Sun, 7 Nov 2021 17:55:34 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:34 GMT Message-Id: <202111071755.1A7HtYeF046425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 01144e8cef13 - stable/13 - dpv.1: Fix an example List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 01144e8cef13154ebccb369a4c9e9cecc2db30ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=01144e8cef13154ebccb369a4c9e9cecc2db30ec commit 01144e8cef13154ebccb369a4c9e9cecc2db30ec Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:11:50 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:49:10 +0000 dpv.1: Fix an example dpv(1) requires a label to be specified. MFC after: 3 days (cherry picked from commit f7c7a6ac00f13e2d47d50844dd92071933c33a56) --- usr.bin/dpv/dpv.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index 8c0dce79d2d1..7d3e622398dc 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -361,7 +361,7 @@ dpv -o /dev/ada0 -m label disk-image.img .Pp Zeroing a disk: .Bd -literal -offset indent -dpv -o /dev/md42 < /dev/zero +dpv -o /dev/md42 "Zeroing md42" < /dev/zero .Ed .Sh SEE ALSO .Xr dialog 1 , From nobody Sun Nov 7 17:55:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 25260184B0E3; Sun, 7 Nov 2021 17:55: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 4HnMNR6ym0z3CNf; Sun, 7 Nov 2021 17:55: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 B901522AA6; Sun, 7 Nov 2021 17:55: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 1A7HtZ8a046450; Sun, 7 Nov 2021 17:55:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7HtZIG046449; Sun, 7 Nov 2021 17:55:35 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:35 GMT Message-Id: <202111071755.1A7HtZIG046449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: a1fd2f2a144b - stable/12 - dpv.1: Do not use mdoc macros for Bl width List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a1fd2f2a144b67589e8b8ad17cd4879389bc285b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a1fd2f2a144b67589e8b8ad17cd4879389bc285b commit a1fd2f2a144b67589e8b8ad17cd4879389bc285b Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:17:19 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:50:09 +0000 dpv.1: Do not use mdoc macros for Bl width Macros do not expand there. MFC after: 3 days (cherry picked from commit 3693250e8a746053291849d8442f912336f0bf1b) --- usr.bin/dpv/dpv.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index d18eff24343b..2697aed62a24 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -81,7 +81,7 @@ or instead .Pq see Ql Fl X . .Pp The following options are available: -.Bl -tag -width ".Fl b Ar backtitle" +.Bl -tag -width "-b backtitle" .It Fl a Ar text Display .Ar text @@ -309,7 +309,7 @@ If using .Xr Xdialog 1 is required. .Sh FILES -.Bl -tag -width ".Pa $HOME/.dialogrc" -compact +.Bl -tag -width "$HOME/.dialogrc" -compact .It Pa $HOME/.dialogrc .El .Sh EXAMPLES From nobody Sun Nov 7 17:55:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B6427184B0EC; Sun, 7 Nov 2021 17:55: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 4HnMNS2FKgz3CW1; Sun, 7 Nov 2021 17:55: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 1E79122832; Sun, 7 Nov 2021 17:55: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 1A7HtaoR046474; Sun, 7 Nov 2021 17:55:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7Hta5e046473; Sun, 7 Nov 2021 17:55:36 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:36 GMT Message-Id: <202111071755.1A7Hta5e046473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 69a40537eb4b - stable/13 - dpv.1: Do not use mdoc macros for Bl width List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 69a40537eb4b5a160d5be3e97453b0c7913462b6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=69a40537eb4b5a160d5be3e97453b0c7913462b6 commit 69a40537eb4b5a160d5be3e97453b0c7913462b6 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:17:19 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:50:13 +0000 dpv.1: Do not use mdoc macros for Bl width Macros do not expand there. MFC after: 3 days (cherry picked from commit 3693250e8a746053291849d8442f912336f0bf1b) --- usr.bin/dpv/dpv.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index 7d3e622398dc..bf97f9555ea8 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -81,7 +81,7 @@ or instead .Pq see Ql Fl X . .Pp The following options are available: -.Bl -tag -width ".Fl b Ar backtitle" +.Bl -tag -width "-b backtitle" .It Fl a Ar text Display .Ar text @@ -310,7 +310,7 @@ If using .Xr Xdialog 1 is required. .Sh FILES -.Bl -tag -width ".Pa $HOME/.dialogrc" -compact +.Bl -tag -width "$HOME/.dialogrc" -compact .It Pa $HOME/.dialogrc .El .Sh EXAMPLES From nobody Sun Nov 7 17:55:37 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 55165184B41E; Sun, 7 Nov 2021 17:55: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 4HnMNT6SPBz3Cc0; Sun, 7 Nov 2021 17:55: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 4FDD0228BF; Sun, 7 Nov 2021 17:55: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 1A7HtblD046528; Sun, 7 Nov 2021 17:55:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7HtbG2046527; Sun, 7 Nov 2021 17:55:37 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:37 GMT Message-Id: <202111071755.1A7HtbG2046527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: e41e2d586618 - stable/13 - dpv: Fix synopsis formatting & sort options List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e41e2d5866180787697051a5a16bf48e085d3fa2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e41e2d5866180787697051a5a16bf48e085d3fa2 commit e41e2d5866180787697051a5a16bf48e085d3fa2 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:05:48 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:50:23 +0000 dpv: Fix synopsis formatting & sort options MFC after: 3 days (cherry picked from commit a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20) --- usr.bin/dpv/dpv.1 | 97 +++++++++++++++++++++++++++++++------------------------ usr.bin/dpv/dpv.c | 30 ++++++++--------- 2 files changed, 70 insertions(+), 57 deletions(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index bf97f9555ea8..801389529946 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2016 +.Dd November 2, 2021 .Dt DPV 1 .Os .Sh NAME @@ -33,13 +33,26 @@ .Sh SYNOPSIS .Nm .Op options -.Ar [bytes:]label +.Sm off +.Op Ar bytes Cm \&: +.Ar label +.Sm on .Nm .Op options .Fl m -.Ar [bytes1:]label1 +.Sm off +.Op Ar bytes1 Cm \& : +. Ar label1 +.Sm on .Ar path1 -.Op Ar [bytes2:]label2 path2 ... +.Oo +.Sm off +.Op Ar bytes2 Cm \&: +.Ar label2 +.Sm on +.Ar path2 +.Ar ... +.Oc .Sh DESCRIPTION .Nm provides a dialog progress view, allowing a user to see current throughput rate @@ -95,10 +108,6 @@ When using this is displayed inside the window .Pq at the top followed by a separator line. -.It Fl d -Debug mode. -Print dialog prompt data to standard out and provide additional debugging on -standard error. .It Fl D Do not use the default interface of .Xr dialog 3 , @@ -111,11 +120,15 @@ is taken from the environment variable or simply .Dq Li dialog if unset or NULL. +.It Fl d +Debug mode. +Print dialog prompt data to standard out and provide additional debugging on +standard error. .It Fl h Produce a short syntax usage with brief option descriptions and exit. Output is produced on standard error. -.It Fl i Ar format -Customize the single-file format string used to update the status line. +.It Fl I Ar format +Customize the multi-file format string used to update the status line. Ignored when using either .Ql Fl D or @@ -124,10 +137,10 @@ which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is -.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . -This format is used when handling one file. -.It Fl I Ar format -Customize the multi-file format string used to update the status line. +.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . +This format is used when handling more than one file. +.It Fl i Ar format +Customize the single-file format string used to update the status line. Ignored when using either .Ql Fl D or @@ -136,24 +149,27 @@ which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is -.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . -This format is used when handling more than one file. +.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . +This format is used when handling one file. .It Fl k Keep tite. Prevent visually distracting initialization/exit routines for scripts running .Xr dialog 1 several times. -.It Fl l -Line mode. -Read lines from input instead of bytes. .It Fl L Ar size Label size. If negative, shrink to longest label width. +.It Fl l +Line mode. +Read lines from input instead of bytes. .It Fl m Multi-input mode. Instead of reading bytes from standard input, read from a set of paths .Pq one for each label . By default, each path is processed sequentially in the order given. +.It Fl N +No overrun. +If enabled, stop reading known-length inputs when input reaches stated length. .It Fl n Ar num Display at-most .Ar num @@ -162,9 +178,6 @@ If zero, display as many as possible. If negative, only display the main progress indicator. Default is 0. Maximum value is 10. -.It Fl N -No overrun. -If enabled, stop reading known-length inputs when input reaches stated length. .It Fl o Ar file Output data to .Ar file . @@ -176,10 +189,6 @@ in will be replaced with the .Ar label text. -.It Fl p Ar text -Display -.Ar text -above the file progress indicator(s). .It Fl P Ar size Mini-progressbar size. If negative, don't display mini-progressbars @@ -187,6 +196,19 @@ If negative, don't display mini-progressbars If zero, auto-adjust based on number of files to read. When zero and only one file to read, defaults to -1. When zero and more than one file to read, defaults to 17. +.It Fl p Ar text +Display +.Ar text +above the file progress indicator(s). +.It Fl T +Test mode. +Simulate reading a number of bytes, divided evenly across the number of files, +while stepping through each percent value of each file to process. +Appends +.Dq Li [TEST MODE] +to the status line +.Pq to override, use Ql Fl u Ar format . +No data is actually read. .It Fl t Ar title Display .Ar title @@ -201,15 +223,6 @@ and .Ar title are effectively switched .Pq see BUGS section below . -.It Fl T -Test mode. -Simulate reading a number of bytes, divided evenly across the number of files, -while stepping through each percent value of each file to process. -Appends -.Dq Li [TEST MODE] -to the status line -.Pq to override, use Ql Fl u Ar format . -No data is actually read. .It Fl U Ar num Update status line .Ar num @@ -237,6 +250,13 @@ and to bump the dialog width. Prompts wider than the maximum width will wrap .Pq unless using Xr Xdialog 1 ; see BUGS section below . +.It Fl X +Enable X11 mode by using +.Xr Xdialog 1 +instead of +.Xr dialog 1 +or +.Xr dialog 3 . .It Fl x Ar cmd Execute .Ar cmd @@ -259,13 +279,6 @@ in will be replaced with the .Ar label text. -.It Fl X -Enable X11 mode by using -.Xr Xdialog 1 -instead of -.Xr dialog 1 -or -.Xr dialog 3 . .El .Sh ENVIRONMENT The following environment variables are referenced by diff --git a/usr.bin/dpv/dpv.c b/usr.bin/dpv/dpv.c index 440b5ab6de0f..725b24f6bbe9 100644 --- a/usr.bin/dpv/dpv.c +++ b/usr.bin/dpv/dpv.c @@ -496,50 +496,50 @@ usage(void) if (debug) /* No need for usage */ exit(EXIT_FAILURE); - fprintf(stderr, "Usage: %s [options] bytes:label\n", pgm); - fprintf(stderr, " %s [options] -m bytes1:label1 path1 " - "[bytes2:label2 path2 ...]\n", pgm); + fprintf(stderr, "Usage: %s [options] [bytes:]label\n", pgm); + fprintf(stderr, " %s [options] -m [bytes1:]label1 path1 " + "[[bytes2:]label2 path2 ...]\n", pgm); fprintf(stderr, "OPTIONS:\n"); #define OPTFMT "\t%-14s %s\n" fprintf(stderr, OPTFMT, "-a text", "Append text. Displayed below file progress indicators."); fprintf(stderr, OPTFMT, "-b backtitle", "String to be displayed on the backdrop, at top-left."); - fprintf(stderr, OPTFMT, "-d", - "Debug. Write to standard output instead of dialog."); fprintf(stderr, OPTFMT, "-D", "Use dialog(1) instead of dialog(3) [default]."); + fprintf(stderr, OPTFMT, "-d", + "Debug. Write to standard output instead of dialog."); fprintf(stderr, OPTFMT, "-h", "Produce this output on standard error and exit."); - fprintf(stderr, OPTFMT, "-i format", - "Customize status line format. See fdpv(1) for details."); fprintf(stderr, OPTFMT, "-I format", "Customize status line format. See fdpv(1) for details."); + fprintf(stderr, OPTFMT, "-i format", + "Customize status line format. See fdpv(1) for details."); fprintf(stderr, OPTFMT, "-L size", "Label size. Must be a number greater than 0, or -1."); fprintf(stderr, OPTFMT, "-m", "Enable processing of multiple file argiments."); - fprintf(stderr, OPTFMT, "-n num", - "Display at-most num files per screen. Default is -1."); fprintf(stderr, OPTFMT, "-N", "No overrun. Stop reading input at stated length, if any."); + fprintf(stderr, OPTFMT, "-n num", + "Display at-most num files per screen. Default is -1."); fprintf(stderr, OPTFMT, "-o file", "Output data to file. First %s replaced with label text."); - fprintf(stderr, OPTFMT, "-p text", - "Prefix text. Displayed above file progress indicators."); fprintf(stderr, OPTFMT, "-P size", "Mini-progressbar size. Must be a number greater than 3."); - fprintf(stderr, OPTFMT, "-t title", - "Title string to be displayed at top of dialog(1) box."); + fprintf(stderr, OPTFMT, "-p text", + "Prefix text. Displayed above file progress indicators."); fprintf(stderr, OPTFMT, "-T", "Test mode. Don't actually read any data, but fake it."); + fprintf(stderr, OPTFMT, "-t title", + "Title string to be displayed at top of dialog(1) box."); fprintf(stderr, OPTFMT, "-U num", "Update status line num times per-second. Default is 2."); fprintf(stderr, OPTFMT, "-w", "Wide. Width of `-p' and `-a' text bump dialog(1) width."); - fprintf(stderr, OPTFMT, "-x cmd", - "Send data to executed cmd. First %s replaced with label."); fprintf(stderr, OPTFMT, "-X", "X11. Use Xdialog(1) instead of dialog(1)."); + fprintf(stderr, OPTFMT, "-x cmd", + "Send data to executed cmd. First %s replaced with label."); exit(EXIT_FAILURE); } From nobody Sun Nov 7 17:55:38 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 448A2184B595; Sun, 7 Nov 2021 17:55: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 4HnMNW0DP2z3CWK; Sun, 7 Nov 2021 17:55:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7108A22833; Sun, 7 Nov 2021 17:55: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 1A7HtcLA046586; Sun, 7 Nov 2021 17:55:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7Htc3N046585; Sun, 7 Nov 2021 17:55:38 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:38 GMT Message-Id: <202111071755.1A7Htc3N046585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 513348e821c3 - stable/13 - date: Clean up synopses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 513348e821c3ddc3c1f51c3928954fa469d0cfbc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=513348e821c3ddc3c1f51c3928954fa469d0cfbc commit 513348e821c3ddc3c1f51c3928954fa469d0cfbc Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-03 11:58:09 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:54:03 +0000 date: Clean up synopses MFC after: 3 days (cherry picked from commit a12b16f48f747339ccae6dd80cc0c0c4ad5b7846) --- bin/date/date.1 | 49 +++++++++++++++++++++++++++++++++++-------------- bin/date/date.c | 6 +++--- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index a7b6265d1195..931363cc86fb 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -39,35 +39,56 @@ .Nm date .Nd display or set date and time .Sh SYNOPSIS +.\" Display time. .Nm -.Op Fl jnRu -.Op Fl r Ar seconds | Ar filename +.Op Fl nRu +.Op Fl I Ns Op Ar FMT +.Op Fl r Ar filename +.Op Fl r Ar seconds .Oo -.Fl v .Sm off +.Fl v .Op Cm + | - .Ar val Op Ar ymwdHMS .Sm on .Oc .Ar ... .Op Cm + Ns Ar output_fmt +.\" Set time with the default input format. .Nm -.Op Fl ju +.Op Fl jnRu +.Op Fl I Ns Op Ar FMT +.Oo .Sm off -.Op Oo Oo Oo Oo Ar cc Oc Ar yy Oc Ar mm Oc Ar dd Oc Ar HH -.Ar MM Op Ar .ss +.Fl v +.Op Cm + | - +.Ar val Op Cm y | m | w | d | H | M | S +.Sm on +.Oc +.Sm off +.Oo Oo Oo Oo Oo +.Ar cc Oc +.Ar yy Oc +.Ar mm Oc +.Ar dd Oc +.Ar HH +.Oc Ar MM Op Cm \&. Ar ss .Sm on -.Nm -.Op Fl jRu -.Fl f Ar input_fmt new_date .Op Cm + Ns Ar output_fmt +.\" Set time with the user-provided input format. .Nm -.Op Fl jnu +.Op Fl jnRu .Op Fl I Ns Op Ar FMT -.Op Fl f Ar input_fmt -.Op Fl r Ar ... -.Op Fl v Ar ... -.Op Ar new_date +.Oo +.Sm off +.Fl v +.Op Cm + | - +.Ar val Op Cm y | m | w | d | H | M | S +.Sm on +.Oc +.Fl f Ar input_fmt +.Ar new_date +.Op Cm + Ns Ar output_fmt .Sh DESCRIPTION When invoked without arguments, the .Nm diff --git a/bin/date/date.c b/bin/date/date.c index cde299f6de61..87f3dad28bd6 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -383,11 +383,11 @@ static void usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n", - "usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]]", + "usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]", " " - "[-I[date | hours | minutes | seconds]]", + "[-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]", " " - "[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]" + "[[[[[[cc]yy]mm]dd]HH]MM[.ss] | new_date] [+output_fmt]" ); exit(1); } From nobody Sun Nov 7 17:55:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 16797184B4B2; Sun, 7 Nov 2021 17:55: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 4HnMNT6TdVz3Cc4; Sun, 7 Nov 2021 17:55: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 D035E228BE; Sun, 7 Nov 2021 17:55: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 1A7HtavR046500; Sun, 7 Nov 2021 17:55:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7Htalv046499; Sun, 7 Nov 2021 17:55:36 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:36 GMT Message-Id: <202111071755.1A7Htalv046499@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: cef881a6e8db - stable/12 - dpv: Fix synopsis formatting & sort options List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cef881a6e8db8d852717755b02620a3ce6cc58d8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=cef881a6e8db8d852717755b02620a3ce6cc58d8 commit cef881a6e8db8d852717755b02620a3ce6cc58d8 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-02 07:05:48 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:52:32 +0000 dpv: Fix synopsis formatting & sort options MFC after: 3 days (cherry picked from commit a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20) --- usr.bin/dpv/dpv.1 | 96 +++++++++++++++++++++++++++++++------------------------ usr.bin/dpv/dpv.c | 30 ++++++++--------- 2 files changed, 70 insertions(+), 56 deletions(-) diff --git a/usr.bin/dpv/dpv.1 b/usr.bin/dpv/dpv.1 index 2697aed62a24..801389529946 100644 --- a/usr.bin/dpv/dpv.1 +++ b/usr.bin/dpv/dpv.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2016 +.Dd November 2, 2021 .Dt DPV 1 .Os .Sh NAME @@ -33,13 +33,26 @@ .Sh SYNOPSIS .Nm .Op options -.Ar [bytes:]label +.Sm off +.Op Ar bytes Cm \&: +.Ar label +.Sm on .Nm .Op options .Fl m -.Ar [bytes1:]label1 +.Sm off +.Op Ar bytes1 Cm \& : +. Ar label1 +.Sm on .Ar path1 -.Op Ar [bytes2:]label2 path2 ... +.Oo +.Sm off +.Op Ar bytes2 Cm \&: +.Ar label2 +.Sm on +.Ar path2 +.Ar ... +.Oc .Sh DESCRIPTION .Nm provides a dialog progress view, allowing a user to see current throughput rate @@ -95,10 +108,6 @@ When using this is displayed inside the window .Pq at the top followed by a separator line. -.It Fl d -Debug mode. -Print dialog prompt data to standard out and provide additional debugging on -standard error. .It Fl D Do not use the default interface of .Xr dialog 3 , @@ -111,11 +120,15 @@ is taken from the environment variable or simply .Dq Li dialog if unset or NULL. +.It Fl d +Debug mode. +Print dialog prompt data to standard out and provide additional debugging on +standard error. .It Fl h Produce a short syntax usage with brief option descriptions and exit. Output is produced on standard error. -.It Fl i Ar format -Customize the single-file format string used to update the status line. +.It Fl I Ar format +Customize the multi-file format string used to update the status line. Ignored when using either .Ql Fl D or @@ -124,10 +137,10 @@ which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is -.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . -This format is used when handling one file. -.It Fl I Ar format -Customize the multi-file format string used to update the status line. +.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . +This format is used when handling more than one file. +.It Fl i Ar format +Customize the single-file format string used to update the status line. Ignored when using either .Ql Fl D or @@ -136,23 +149,27 @@ which lack the ability to display the status line .Pq containing bytes/rate/thread information . Default value is -.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. [%i/%i busy/wait] . -This format is used when handling more than one file. +.Dq Li %'10lli bytes read @ %'9.1f bytes/sec. . +This format is used when handling one file. .It Fl k Keep tite. Prevent visually distracting initialization/exit routines for scripts running .Xr dialog 1 several times. -.It Fl l -Line mode. Read lines from input instead of bytes. .It Fl L Ar size Label size. If negative, shrink to longest label width. +.It Fl l +Line mode. +Read lines from input instead of bytes. .It Fl m Multi-input mode. Instead of reading bytes from standard input, read from a set of paths .Pq one for each label . By default, each path is processed sequentially in the order given. +.It Fl N +No overrun. +If enabled, stop reading known-length inputs when input reaches stated length. .It Fl n Ar num Display at-most .Ar num @@ -161,9 +178,6 @@ If zero, display as many as possible. If negative, only display the main progress indicator. Default is 0. Maximum value is 10. -.It Fl N -No overrun. -If enabled, stop reading known-length inputs when input reaches stated length. .It Fl o Ar file Output data to .Ar file . @@ -175,10 +189,6 @@ in will be replaced with the .Ar label text. -.It Fl p Ar text -Display -.Ar text -above the file progress indicator(s). .It Fl P Ar size Mini-progressbar size. If negative, don't display mini-progressbars @@ -186,6 +196,19 @@ If negative, don't display mini-progressbars If zero, auto-adjust based on number of files to read. When zero and only one file to read, defaults to -1. When zero and more than one file to read, defaults to 17. +.It Fl p Ar text +Display +.Ar text +above the file progress indicator(s). +.It Fl T +Test mode. +Simulate reading a number of bytes, divided evenly across the number of files, +while stepping through each percent value of each file to process. +Appends +.Dq Li [TEST MODE] +to the status line +.Pq to override, use Ql Fl u Ar format . +No data is actually read. .It Fl t Ar title Display .Ar title @@ -200,15 +223,6 @@ and .Ar title are effectively switched .Pq see BUGS section below . -.It Fl T -Test mode. -Simulate reading a number of bytes, divided evenly across the number of files, -while stepping through each percent value of each file to process. -Appends -.Dq Li [TEST MODE] -to the status line -.Pq to override, use Ql Fl u Ar format . -No data is actually read. .It Fl U Ar num Update status line .Ar num @@ -236,6 +250,13 @@ and to bump the dialog width. Prompts wider than the maximum width will wrap .Pq unless using Xr Xdialog 1 ; see BUGS section below . +.It Fl X +Enable X11 mode by using +.Xr Xdialog 1 +instead of +.Xr dialog 1 +or +.Xr dialog 3 . .It Fl x Ar cmd Execute .Ar cmd @@ -258,13 +279,6 @@ in will be replaced with the .Ar label text. -.It Fl X -Enable X11 mode by using -.Xr Xdialog 1 -instead of -.Xr dialog 1 -or -.Xr dialog 3 . .El .Sh ENVIRONMENT The following environment variables are referenced by diff --git a/usr.bin/dpv/dpv.c b/usr.bin/dpv/dpv.c index 440b5ab6de0f..725b24f6bbe9 100644 --- a/usr.bin/dpv/dpv.c +++ b/usr.bin/dpv/dpv.c @@ -496,50 +496,50 @@ usage(void) if (debug) /* No need for usage */ exit(EXIT_FAILURE); - fprintf(stderr, "Usage: %s [options] bytes:label\n", pgm); - fprintf(stderr, " %s [options] -m bytes1:label1 path1 " - "[bytes2:label2 path2 ...]\n", pgm); + fprintf(stderr, "Usage: %s [options] [bytes:]label\n", pgm); + fprintf(stderr, " %s [options] -m [bytes1:]label1 path1 " + "[[bytes2:]label2 path2 ...]\n", pgm); fprintf(stderr, "OPTIONS:\n"); #define OPTFMT "\t%-14s %s\n" fprintf(stderr, OPTFMT, "-a text", "Append text. Displayed below file progress indicators."); fprintf(stderr, OPTFMT, "-b backtitle", "String to be displayed on the backdrop, at top-left."); - fprintf(stderr, OPTFMT, "-d", - "Debug. Write to standard output instead of dialog."); fprintf(stderr, OPTFMT, "-D", "Use dialog(1) instead of dialog(3) [default]."); + fprintf(stderr, OPTFMT, "-d", + "Debug. Write to standard output instead of dialog."); fprintf(stderr, OPTFMT, "-h", "Produce this output on standard error and exit."); - fprintf(stderr, OPTFMT, "-i format", - "Customize status line format. See fdpv(1) for details."); fprintf(stderr, OPTFMT, "-I format", "Customize status line format. See fdpv(1) for details."); + fprintf(stderr, OPTFMT, "-i format", + "Customize status line format. See fdpv(1) for details."); fprintf(stderr, OPTFMT, "-L size", "Label size. Must be a number greater than 0, or -1."); fprintf(stderr, OPTFMT, "-m", "Enable processing of multiple file argiments."); - fprintf(stderr, OPTFMT, "-n num", - "Display at-most num files per screen. Default is -1."); fprintf(stderr, OPTFMT, "-N", "No overrun. Stop reading input at stated length, if any."); + fprintf(stderr, OPTFMT, "-n num", + "Display at-most num files per screen. Default is -1."); fprintf(stderr, OPTFMT, "-o file", "Output data to file. First %s replaced with label text."); - fprintf(stderr, OPTFMT, "-p text", - "Prefix text. Displayed above file progress indicators."); fprintf(stderr, OPTFMT, "-P size", "Mini-progressbar size. Must be a number greater than 3."); - fprintf(stderr, OPTFMT, "-t title", - "Title string to be displayed at top of dialog(1) box."); + fprintf(stderr, OPTFMT, "-p text", + "Prefix text. Displayed above file progress indicators."); fprintf(stderr, OPTFMT, "-T", "Test mode. Don't actually read any data, but fake it."); + fprintf(stderr, OPTFMT, "-t title", + "Title string to be displayed at top of dialog(1) box."); fprintf(stderr, OPTFMT, "-U num", "Update status line num times per-second. Default is 2."); fprintf(stderr, OPTFMT, "-w", "Wide. Width of `-p' and `-a' text bump dialog(1) width."); - fprintf(stderr, OPTFMT, "-x cmd", - "Send data to executed cmd. First %s replaced with label."); fprintf(stderr, OPTFMT, "-X", "X11. Use Xdialog(1) instead of dialog(1)."); + fprintf(stderr, OPTFMT, "-x cmd", + "Send data to executed cmd. First %s replaced with label."); exit(EXIT_FAILURE); } From nobody Sun Nov 7 17:55:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 472AC184B5B5; Sun, 7 Nov 2021 17:55: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 4HnMNY1rYMz3CTg; Sun, 7 Nov 2021 17:55: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 B533022B08; Sun, 7 Nov 2021 17:55: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 1A7HteSi046634; Sun, 7 Nov 2021 17:55:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7HteGZ046633; Sun, 7 Nov 2021 17:55:40 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:40 GMT Message-Id: <202111071755.1A7HteGZ046633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 014ae00ef6ed - stable/13 - date: Capitalize seconds string in synopses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 014ae00ef6edca2687d618e0bda138086a1e1230 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=014ae00ef6edca2687d618e0bda138086a1e1230 commit 014ae00ef6edca2687d618e0bda138086a1e1230 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-03 11:59:49 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:55:22 +0000 date: Capitalize seconds string in synopses This makes it consistent with other date(1) implementations. Also, it feels more consistent since hours and minutes are already represented as HH and MM respectively. MFC after: 3 days (cherry picked from commit c537bf9d5903d0689321f83691341c93b5919172) --- bin/date/date.1 | 6 +++--- bin/date/date.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index 7dcf77c88b39..f9ced543c0d8 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -71,7 +71,7 @@ .Ar mm Oc .Ar dd Oc .Ar HH -.Oc Ar MM Op Cm \&. Ar ss +.Oc Ar MM Op Cm \&. Ar SS .Sm on .Op Cm + Ns Ar output_fmt .\" Set time with the user-provided input format. @@ -123,7 +123,7 @@ provided rather than using the default .Ar mm Oc .Ar dd Oc .Ar HH -.Oc Ar MM Op Cm \&. Ar ss +.Oc Ar MM Op Cm \&. Ar SS .Sm on format. Parsing is done using @@ -330,7 +330,7 @@ Day, a number from 1 to 31. Hour, a number from 0 to 23. .It Ar MM Minutes, a number from 0 to 59. -.It Ar ss +.It Ar SS Seconds, a number from 0 to 60 (59 plus a potential leap second). .El diff --git a/bin/date/date.c b/bin/date/date.c index 87f3dad28bd6..4dc5df0dccfc 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -387,7 +387,7 @@ usage(void) " " "[-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]", " " - "[[[[[[cc]yy]mm]dd]HH]MM[.ss] | new_date] [+output_fmt]" + "[[[[[[cc]yy]mm]dd]HH]MM[.SS] | new_date] [+output_fmt]" ); exit(1); } From nobody Sun Nov 7 17:55:39 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ECE9A184B442; Sun, 7 Nov 2021 17:55: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 4HnMNX4WNfz3CfS; Sun, 7 Nov 2021 17:55: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 9B0A522918; Sun, 7 Nov 2021 17:55: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 1A7HtdSp046610; Sun, 7 Nov 2021 17:55:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7Htd65046609; Sun, 7 Nov 2021 17:55:39 GMT (envelope-from git) Date: Sun, 7 Nov 2021 17:55:39 GMT Message-Id: <202111071755.1A7Htd65046609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 5bee300aefb1 - stable/13 - date.1: Fix some style issues and examples List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5bee300aefb1f9d3ec9a5cd2150b1b5c7374f3ae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5bee300aefb1f9d3ec9a5cd2150b1b5c7374f3ae commit 5bee300aefb1f9d3ec9a5cd2150b1b5c7374f3ae Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-11-03 10:26:46 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-11-07 17:54:59 +0000 date.1: Fix some style issues and examples - Use Cm instead of Ar or Sq for command modifiers of the -v flag. - Remove unnecessary "Ar ..." from the synopsis. It's not clear what it was referring to. - Add missing arguments to the -f and -v flags. - Stylize the dot before "ss" with Cm in the default format in the -f flag description. - Set LC_ALL=C in the last example so that the output format of date(1) always matches the specified format of the -f flag not matter the locale. - List the -f flag as optional in all usage lines in the synopsis. MFC after: 3 days (cherry picked from commit 00133d5c5e6aae01663eca40993abd5e6137425b) --- bin/date/date.1 | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index 931363cc86fb..7dcf77c88b39 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd August 25, 2020 +.Dd November 3, 2021 .Dt DATE 1 .Os .Sh NAME @@ -49,10 +49,9 @@ .Sm off .Fl v .Op Cm + | - -.Ar val Op Ar ymwdHMS +.Ar val Op Cm y | m | w | d | H | M | S .Sm on .Oc -.Ar ... .Op Cm + Ns Ar output_fmt .\" Set time with the default input format. .Nm @@ -111,7 +110,7 @@ the time may not be changed by more than 1 second. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl f +.It Fl f Ar input_fmt Use .Ar input_fmt as the format string to parse the @@ -124,7 +123,7 @@ provided rather than using the default .Ar mm Oc .Ar dd Oc .Ar HH -.Oc Ar MM Op Ar .ss +.Oc Ar MM Op Cm \&. Ar ss .Sm on format. Parsing is done using @@ -135,24 +134,24 @@ Use output format. .Ar FMT may be omitted, in which case the default is -.Sq date . +.Cm date . Valid .Ar FMT values are -.Sq date , -.Sq hours , -.Sq minutes , +.Cm date , +.Cm hours , +.Cm minutes , and -.Sq seconds . +.Cm seconds . The date and time is formatted to the specified precision. When .Ar FMT is -.Sq hours +.Cm hours (or the more precise -.Sq minutes +.Cm minutes or -.Sq seconds ) , +.Cm seconds ) , the .St -iso8601 format includes the timezone. @@ -196,7 +195,13 @@ Print the date and time of the last modification of Display or set the date in .Tn UTC (Coordinated Universal) time. -.It Fl v +.It Xo +.Fl v +.Sm off +.Op Cm + | - +.Ar val Op Cm y | m | w | d | H | M | S +.Sm on +.Xc Adjust (i.e., take the current date and display the result of the adjustment; not actually set the date) the second, minute, hour, month day, week day, month or year according to @@ -220,14 +225,14 @@ and years are in the range 80-38 or 1980-2038. If .Ar val is numeric, one of either -.Ar y , -.Ar m , -.Ar w , -.Ar d , -.Ar H , -.Ar M +.Cm y , +.Cm m , +.Cm w , +.Cm d , +.Cm H , +.Cm M or -.Ar S +.Cm S must be used to specify which part of the date is to be adjusted. .Pp The week day or month may be specified using a name rather than a @@ -441,7 +446,7 @@ will display .Pp Finally the command: .Pp -.Dl "date -j -f ""%a %b %d %T %Z %Y"" ""`date`"" ""+%s""" +.Dl "date -j -f ""%a %b %d %T %Z %Y"" ""`LC_ALL=C date`"" ""+%s""" .Pp can be used to parse the output from .Nm From nobody Sun Nov 7 19:41:30 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E1C1E1831712; Sun, 7 Nov 2021 19:41: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 4HnPkf5xfMz4XFK; Sun, 7 Nov 2021 19:41: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 ABD0D23EBF; Sun, 7 Nov 2021 19:41: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 1A7JfUmm089607; Sun, 7 Nov 2021 19:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7JfULT089606; Sun, 7 Nov 2021 19:41:30 GMT (envelope-from git) Date: Sun, 7 Nov 2021 19:41:30 GMT Message-Id: <202111071941.1A7JfULT089606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5df48c0fa5cd - stable/13 - vmci: Avoid relying on macro expansion to provide correct syntax List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5df48c0fa5cd005853afa7017c12a7d3f32c16e5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5df48c0fa5cd005853afa7017c12a7d3f32c16e5 commit 5df48c0fa5cd005853afa7017c12a7d3f32c16e5 Author: Mark Johnston AuthorDate: 2021-11-03 15:19:53 +0000 Commit: Mark Johnston CommitDate: 2021-11-07 19:39:38 +0000 vmci: Avoid relying on macro expansion to provide correct syntax No functional change intended. Sponsored by: The FreeBSD Foundation (cherry picked from commit c75c1d2df9b3839319f6b5e2fad0b757eebd9c55) --- sys/dev/vmware/vmci/vmci_kernel_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/vmware/vmci/vmci_kernel_if.c b/sys/dev/vmware/vmci/vmci_kernel_if.c index de54a8d1ca4f..f66e63f56fc7 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_if.c +++ b/sys/dev/vmware/vmci/vmci_kernel_if.c @@ -70,7 +70,7 @@ void vmci_cleanup_lock(vmci_lock *lock) { - if mtx_initialized(lock) + if (mtx_initialized(lock)) mtx_destroy(lock); } From nobody Sun Nov 7 19:46:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 040CE1835AAA; Sun, 7 Nov 2021 19:46:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HnPr56jyDz4Zh5; Sun, 7 Nov 2021 19:46: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 C4A0F23ECE; Sun, 7 Nov 2021 19:46: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 1A7JkD5M093252; Sun, 7 Nov 2021 19:46:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A7JkDrS093251; Sun, 7 Nov 2021 19:46:13 GMT (envelope-from git) Date: Sun, 7 Nov 2021 19:46:13 GMT Message-Id: <202111071946.1A7JkDrS093251@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: a7e014eee5d4 - main - nfsd: Fix the NFSv4 pNFS MDS server for DS NFSERR_NOSPC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: a7e014eee5d47d6eb13bc98c71e65d00a6de8ed3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a7e014eee5d47d6eb13bc98c71e65d00a6de8ed3 commit a7e014eee5d47d6eb13bc98c71e65d00a6de8ed3 Author: Rick Macklem AuthorDate: 2021-11-07 19:43:03 +0000 Commit: Rick Macklem CommitDate: 2021-11-07 19:43:03 +0000 nfsd: Fix the NFSv4 pNFS MDS server for DS NFSERR_NOSPC If a pNFS server's DS runs out of disk space, it replies NFSERR_NOSPC to the client doing writing. For the Linux client, it then sends a LayoutError RPC to the server to tell it about the error and keeps retrying, doing repeated LayoutGet and Write RPCs to the DS. The Linux client is "stuck" until disk space on the DS is free'd up. For a mirrored server configuration, the first mirror that ran out of space was taken offline. This does not make much sense, since the other mirror(s) will run out of space soon and the fix is a manual cleanup up disk space. This patch changes the pNFS server to not disable a mirror for the mirrored case when this occurs. Further work is needed, since the Linux client expects the MDS to reply NFSERR_NOSPC to LayoutGets once the DS is out of space. Without this further change, the above mentioned looping occurs. Found during a recent IEFT NFSv4 working group testing event. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 7 ++++--- sys/fs/nfsserver/nfs_nfsdstate.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index fca1df3a716a..4d92cb61614d 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -5046,10 +5046,11 @@ nfsrvd_layouterror(struct nfsrv_descript *nd, __unused int isdgram, opnum = fxdr_unsigned(int, *tl); NFSD_DEBUG(4, "nfsrvd_layouterr op=%d stat=%d\n", opnum, stat); /* - * Except for NFSERR_ACCES and NFSERR_STALE errors, - * disable the mirror. + * Except for NFSERR_ACCES, NFSERR_STALE and NFSERR_NOSPC + * errors, disable the mirror. */ - if (stat != NFSERR_ACCES && stat != NFSERR_STALE) + if (stat != NFSERR_ACCES && stat != NFSERR_STALE && + stat != NFSERR_NOSPC) nfsrv_delds(devid, curthread); } nfsmout: diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 750eda2027ec..797b9b0a466e 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -7009,10 +7009,11 @@ nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t *layp, int maxcnt, NFSD_DEBUG(4, "flexlayouterr op=%d stat=%d\n", opnum, stat); /* - * Except for NFSERR_ACCES and NFSERR_STALE errors, - * disable the mirror. + * Except for NFSERR_ACCES, NFSERR_STALE and + * NFSERR_NOSPC errors, disable the mirror. */ - if (stat != NFSERR_ACCES && stat != NFSERR_STALE) + if (stat != NFSERR_ACCES && stat != NFSERR_STALE && + stat != NFSERR_NOSPC) nfsrv_delds(devid, p); } }