From nobody Mon Nov 1 00:45:56 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:59 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:57 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:45:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:46:01 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 13:23:05 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 14:32:54 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:01 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:03 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:02 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:04 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:05 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:07 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:13 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:11 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:09 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:12 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:14 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:18 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Tue Nov 2 00:24:47 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 01:16:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 08:42:40 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Wed Nov 3 13:15:29 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 17:40:45 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:53:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 20:48:36 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:20 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:31 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Thu Nov 4 00:42:07 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 01:07:30 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 18:32:07 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 04:55:03 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 14:09:42 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 16:10:39 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Sat Nov 6 02:25:15 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:22 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:23 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:25 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:28 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:29 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 02:25:27 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 07:53:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 15:03:25 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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 Sun Nov 7 17:55:34 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:36 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:38 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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:40 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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-branches@mlmmj.nyi.freebsd.org 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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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); }