From owner-svn-src-stable-12@freebsd.org Sun Apr 5 02:01:11 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1B382A943B; Sun, 5 Apr 2020 02:01:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48vxjK0d9Hz3Q2q; Sun, 5 Apr 2020 02:01:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CB8F3F58; Sun, 5 Apr 2020 01:53:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0351rai6043899; Sun, 5 Apr 2020 01:53:36 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0351raSR043897; Sun, 5 Apr 2020 01:53:36 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004050153.0351raSR043897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Apr 2020 01:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359635 - in stable/12: contrib/xz contrib/xz/src/common contrib/xz/src/liblzma/api contrib/xz/src/liblzma/api/lzma contrib/xz/src/liblzma/check contrib/xz/src/liblzma/common contrib/xz... X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/xz contrib/xz/src/common contrib/xz/src/liblzma/api contrib/xz/src/liblzma/api/lzma contrib/xz/src/liblzma/check contrib/xz/src/liblzma/common contrib/xz/src/liblzma/delta contri... X-SVN-Commit-Revision: 359635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 02:01:12 -0000 Author: delphij Date: Sun Apr 5 01:53:35 2020 New Revision: 359635 URL: https://svnweb.freebsd.org/changeset/base/359635 Log: MFC r359201: MFV r359197: xz 5.2.5. Relnotes: yes Modified: stable/12/contrib/xz/ChangeLog stable/12/contrib/xz/FREEBSD-Xlist stable/12/contrib/xz/README stable/12/contrib/xz/THANKS stable/12/contrib/xz/src/common/sysdefs.h stable/12/contrib/xz/src/common/tuklib_cpucores.c stable/12/contrib/xz/src/common/tuklib_exit.c stable/12/contrib/xz/src/common/tuklib_integer.h stable/12/contrib/xz/src/common/tuklib_mbstr.h stable/12/contrib/xz/src/common/tuklib_mbstr_fw.c stable/12/contrib/xz/src/common/tuklib_mbstr_width.c stable/12/contrib/xz/src/liblzma/api/lzma.h stable/12/contrib/xz/src/liblzma/api/lzma/block.h stable/12/contrib/xz/src/liblzma/api/lzma/filter.h stable/12/contrib/xz/src/liblzma/api/lzma/hardware.h stable/12/contrib/xz/src/liblzma/api/lzma/lzma12.h stable/12/contrib/xz/src/liblzma/api/lzma/version.h stable/12/contrib/xz/src/liblzma/api/lzma/vli.h stable/12/contrib/xz/src/liblzma/check/crc32_fast.c stable/12/contrib/xz/src/liblzma/check/crc32_table.c stable/12/contrib/xz/src/liblzma/check/crc64_fast.c stable/12/contrib/xz/src/liblzma/check/crc64_table.c stable/12/contrib/xz/src/liblzma/common/alone_decoder.c stable/12/contrib/xz/src/liblzma/common/alone_encoder.c stable/12/contrib/xz/src/liblzma/common/block_header_decoder.c stable/12/contrib/xz/src/liblzma/common/block_header_encoder.c stable/12/contrib/xz/src/liblzma/common/block_util.c stable/12/contrib/xz/src/liblzma/common/common.c stable/12/contrib/xz/src/liblzma/common/filter_common.h stable/12/contrib/xz/src/liblzma/common/filter_decoder.h stable/12/contrib/xz/src/liblzma/common/filter_flags_encoder.c stable/12/contrib/xz/src/liblzma/common/hardware_physmem.c stable/12/contrib/xz/src/liblzma/common/index.c stable/12/contrib/xz/src/liblzma/common/memcmplen.h stable/12/contrib/xz/src/liblzma/common/stream_encoder_mt.c stable/12/contrib/xz/src/liblzma/common/stream_flags_decoder.c stable/12/contrib/xz/src/liblzma/common/stream_flags_encoder.c stable/12/contrib/xz/src/liblzma/common/vli_decoder.c stable/12/contrib/xz/src/liblzma/delta/delta_decoder.c stable/12/contrib/xz/src/liblzma/lz/lz_decoder.c stable/12/contrib/xz/src/liblzma/lz/lz_encoder_hash.h stable/12/contrib/xz/src/liblzma/lz/lz_encoder_mf.c stable/12/contrib/xz/src/liblzma/lzma/fastpos.h stable/12/contrib/xz/src/liblzma/lzma/fastpos_tablegen.c stable/12/contrib/xz/src/liblzma/lzma/lzma2_decoder.c stable/12/contrib/xz/src/liblzma/lzma/lzma_common.h stable/12/contrib/xz/src/liblzma/lzma/lzma_decoder.c stable/12/contrib/xz/src/liblzma/lzma/lzma_encoder.c stable/12/contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c stable/12/contrib/xz/src/liblzma/lzma/lzma_encoder_private.h stable/12/contrib/xz/src/liblzma/simple/arm.c stable/12/contrib/xz/src/liblzma/simple/armthumb.c stable/12/contrib/xz/src/liblzma/simple/ia64.c stable/12/contrib/xz/src/liblzma/simple/powerpc.c stable/12/contrib/xz/src/liblzma/simple/simple_coder.c stable/12/contrib/xz/src/liblzma/simple/simple_decoder.c stable/12/contrib/xz/src/liblzma/simple/simple_encoder.c stable/12/contrib/xz/src/liblzma/simple/x86.c stable/12/contrib/xz/src/xz/args.c stable/12/contrib/xz/src/xz/coder.c stable/12/contrib/xz/src/xz/file_io.c stable/12/contrib/xz/src/xz/file_io.h stable/12/contrib/xz/src/xz/main.c stable/12/contrib/xz/src/xz/message.c stable/12/contrib/xz/src/xz/message.h stable/12/contrib/xz/src/xz/mytime.c stable/12/contrib/xz/src/xz/mytime.h stable/12/contrib/xz/src/xz/options.c stable/12/contrib/xz/src/xz/private.h stable/12/contrib/xz/src/xz/signals.c stable/12/contrib/xz/src/xz/util.c stable/12/contrib/xz/src/xz/xz.1 stable/12/contrib/xz/src/xzdec/xzdec.c stable/12/lib/liblzma/config.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/xz/ChangeLog ============================================================================== --- stable/12/contrib/xz/ChangeLog Sat Apr 4 22:37:50 2020 (r359634) +++ stable/12/contrib/xz/ChangeLog Sun Apr 5 01:53:35 2020 (r359635) @@ -1,3 +1,1335 @@ +commit 2327a461e1afce862c22269b80d3517801103c1b +Author: Lasse Collin +Date: 2020-03-17 16:27:42 +0200 + + Bump version and soname for 5.2.5. + + src/liblzma/Makefile.am | 2 +- + src/liblzma/api/lzma/version.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 3be82d2f7dc882258caf0f0a69214e5916b2bdda +Author: Lasse Collin +Date: 2020-03-17 16:26:04 +0200 + + Update NEWS for 5.2.5. + + NEWS | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 105 insertions(+) + +commit ab3e57539c7337f0653b13b75dbc5d03ade9700e +Author: Lasse Collin +Date: 2020-03-16 21:57:21 +0200 + + Translations: Rebuild cs.po to avoid incorrect fuzzy strings. + + "make dist" updates the .po files and the fuzzy strings would + result in multiple very wrong translations. + + po/cs.po | 592 ++++++++++++++++++++++++++++++++++----------------------------- + 1 file changed, 322 insertions(+), 270 deletions(-) + +commit 3a6f38309dc5d44d8a63ebb337b6b2028561c93e +Author: Lasse Collin +Date: 2020-03-16 20:01:37 +0200 + + README: Update outdated sections. + + README | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +commit 9cc0901798217e258e91c13cf6fda7ad42ba108c +Author: Lasse Collin +Date: 2020-03-16 19:46:27 +0200 + + README: Mention that translatable strings will change after 5.2.x. + + README | 74 +++--------------------------------------------------------------- + 1 file changed, 3 insertions(+), 71 deletions(-) + +commit cc163574249f6a4a66f3dc09d6fe5a71bee24fab +Author: Lasse Collin +Date: 2020-03-16 19:39:45 +0200 + + README: Mention that man pages can be translated. + + README | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +commit ca261994edc3f2d03d5589c037171c63471ee9dc +Author: Lasse Collin +Date: 2020-03-16 17:30:39 +0200 + + Translations: Add partial Danish translation. + + I made a few minor white space changes without getting them + approved by the Danish translation team. + + po/LINGUAS | 1 + + po/da.po | 896 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 897 insertions(+) + +commit 51cd5d051fc730d61411dee292e863582784e189 +Author: Lasse Collin +Date: 2020-03-16 16:43:29 +0200 + + Update INSTALL.generic from Automake 1.16.1. + + INSTALL.generic | 321 ++++++++++++++++++++++++++++---------------------------- + 1 file changed, 162 insertions(+), 159 deletions(-) + +commit 69d694e5f1beae2bbfa3b6c348ec0ec5f14b5cd0 +Author: Lasse Collin +Date: 2020-03-15 15:27:22 +0200 + + Update INSTALL for Windows and DOS and add preliminary info for z/OS. + + INSTALL | 51 +++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 41 insertions(+), 10 deletions(-) + +commit 2c3b1bb80a3ca7e09728fe4d7a1d8648a5cb9bca +Author: Lasse Collin +Date: 2020-03-15 15:26:20 +0200 + + Build: Update m4/ax_pthread.m4 from Autoconf Archive (again). + + m4/ax_pthread.m4 | 219 +++++++++++++++++++++++++++++-------------------------- + 1 file changed, 117 insertions(+), 102 deletions(-) + +commit 74a5af180a6a6c4b8c90cefb37ee900d3fea7dc6 +Author: Lasse Collin +Date: 2020-03-11 21:15:35 +0200 + + xz: Never use thousand separators in DJGPP builds. + + DJGPP 2.05 added support for thousands separators but it's + broken at least under WinXP with Finnish locale that uses + a non-breaking space as the thousands separator. Workaround + by disabling thousands separators for DJGPP builds. + + src/xz/util.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +commit ceba0d25e826bcdbf64bb4cb03385a2a66f8cbcb +Author: Lasse Collin +Date: 2020-03-11 19:38:08 +0200 + + DOS: Update dos/Makefile for DJGPP 2.05. + + It doesn't need -fgnu89-inline like 2.04beta did. + + dos/Makefile | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +commit 29e5bd71612253281fb22bbaa0a566990a74dcc3 +Author: Lasse Collin +Date: 2020-03-11 19:36:07 +0200 + + DOS: Update instructions in dos/INSTALL.txt. + + dos/INSTALL.txt | 59 ++++++++++++++++++++++++++++----------------------------- + 1 file changed, 29 insertions(+), 30 deletions(-) + +commit 00a037ee9c8ee5a03cf9744e05570ae93d56b875 +Author: Lasse Collin +Date: 2020-03-11 17:58:51 +0200 + + DOS: Update config.h. + + The added defines assume GCC >= 4.8. + + dos/config.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +commit 4ec2feaefa310b4249eb41893caf526e5c51ee39 +Author: Lasse Collin +Date: 2020-03-11 22:37:54 +0200 + + Translations: Add hu, zh_CN, and zh_TW. + + I made a few white space changes to these without getting them + approved by the translation teams. (I tried to contact the hu and + zh_TW teams but didn't succeed. I didn't contact the zh_CN team.) + + po/LINGUAS | 3 + + po/hu.po | 985 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + po/zh_CN.po | 963 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + po/zh_TW.po | 956 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 2907 insertions(+) + +commit b6ed09729ae408be4533a0ddbc7df3d6f566846a +Author: Lasse Collin +Date: 2020-03-11 14:33:30 +0200 + + Translations: Update vi.po to match the file from the TP. + + The translated strings haven't been updated but word wrapping + is different. + + po/vi.po | 407 ++++++++++++++++++++++++++++----------------------------------- + 1 file changed, 179 insertions(+), 228 deletions(-) + +commit 7c85e8953ced204c858101872a15183e4639e9fb +Author: Lasse Collin +Date: 2020-03-11 14:18:03 +0200 + + Translations: Add fi and pt_BR, and update de, fr, it, and pl. + + The German translation isn't identical to the file in + the Translation Project but the changes (white space changes + only) were approved by the translator Mario Blättermann. + + po/LINGUAS | 2 + + po/de.po | 476 ++++++++++++++-------------- + po/fi.po | 974 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + po/fr.po | 272 ++++++++-------- + po/it.po | 479 ++++++++++++---------------- + po/pl.po | 239 +++++++------- + po/pt_BR.po | 1001 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 7 files changed, 2697 insertions(+), 746 deletions(-) + +commit 7da3ebc67fb5414034685ec16c7a29dad03dfa9b +Author: Lasse Collin +Date: 2020-02-25 21:35:14 +0200 + + Update THANKS. + + THANKS | 1 + + 1 file changed, 1 insertion(+) + +commit 1acc48794364606c9091cae6fa56db75a1325114 +Author: Lasse Collin +Date: 2020-03-11 13:05:29 +0200 + + Build: Add very limited experimental CMake support. + + This version matches CMake files in the master branch (commit + 265daa873c0d871f5f23f9b56e133a6f20045a0a) except that this omits + two source files that aren't in v5.2 and in the beginning of + CMakeLists.txt the first paragraph in the comment is slightly + different to point out possible issues in building shared liblzma. + + CMakeLists.txt | 659 ++++++++++++++++++++++++++++++++++++++++++++ + cmake/tuklib_common.cmake | 49 ++++ + cmake/tuklib_cpucores.cmake | 175 ++++++++++++ + cmake/tuklib_integer.cmake | 102 +++++++ + cmake/tuklib_mbstr.cmake | 20 ++ + cmake/tuklib_physmem.cmake | 150 ++++++++++ + cmake/tuklib_progname.cmake | 19 ++ + 7 files changed, 1174 insertions(+) + +commit 9acc6abea1552803c74c1486fbb10af119550772 +Author: Lasse Collin +Date: 2020-02-27 20:24:27 +0200 + + Build: Add support for --no-po4a option to autogen.sh. + + Normally, if po4a isn't available, autogen.sh will return + with non-zero exit status. The option --no-po4a can be useful + when one knows that po4a isn't available but wants autogen.sh + to still return with zero exit status. + + autogen.sh | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +commit c8853b31545db7bd0551be85949624b1261efd47 +Author: Lasse Collin +Date: 2020-02-24 23:37:07 +0200 + + Update m4/.gitignore. + + m4/.gitignore | 1 + + 1 file changed, 1 insertion(+) + +commit 901eb4a8c992354c3ea482f5bad60a1f8ad6fcc8 +Author: Lasse Collin +Date: 2020-02-24 23:01:00 +0200 + + liblzma: Remove unneeded from fastpos_tablegen.c. + + This file only generates fastpos_table.c. + It isn't built as a part of liblzma. + + src/liblzma/lzma/fastpos_tablegen.c | 1 - + 1 file changed, 1 deletion(-) + +commit ac35c9585fb734b7a19785d490c152e0b8cd4663 +Author: Lasse Collin +Date: 2020-02-22 14:15:07 +0200 + + Use defined(__GNUC__) before __GNUC__ in preprocessor lines. + + This should silence the equivalent of -Wundef in compilers that + don't define __GNUC__. + + src/common/sysdefs.h | 3 ++- + src/liblzma/api/lzma.h | 5 +++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +commit fb9cada7cfade1156d6277717280e05b5cd342d6 +Author: Lasse Collin +Date: 2020-02-21 17:40:02 +0200 + + liblzma: Add more uses of lzma_memcmplen() to the normal mode of LZMA. + + This gives a tiny encoder speed improvement. This could have been done + in 2014 after the commit 544aaa3d13554e8640f9caf7db717a96360ec0f6 but + it was forgotten. + + src/liblzma/lzma/lzma_encoder_optimum_normal.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +commit 6117955af0b9cef5acde7859e86f773692b5f43c +Author: Lasse Collin +Date: 2020-02-21 17:01:15 +0200 + + Build: Add visibility.m4 from gnulib. + + Appears that this file used to get included as a side effect of + gettext. After the change to gettext version requirements this file + no longer got copied to the package and so the build was broken. + + m4/.gitignore | 1 - + m4/visibility.m4 | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 77 insertions(+), 1 deletion(-) + +commit c2cc64d78c098834231f9cfd7d852c9cd8950d74 +Author: Lasse Collin +Date: 2020-02-21 16:10:44 +0200 + + xz: Silence a warning when sig_atomic_t is long int. + + It can be true at least on z/OS. + + src/xz/signals.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b6314aa275b35c714e0a191d0b2e9b6106129ea9 +Author: Lasse Collin +Date: 2020-02-21 15:59:26 +0200 + + xz: Avoid unneeded access of a volatile variable. + + src/xz/signals.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f772a1572f723e5dc7d2d32e1d4287ac7a0da55e +Author: Lasse Collin +Date: 2020-02-21 01:24:18 +0200 + + tuklib_integer.m4: Optimize the check order. + + The __builtin byteswapping is the preferred one so check for it first. + + m4/tuklib_integer.m4 | 56 +++++++++++++++++++++++++++------------------------- + 1 file changed, 29 insertions(+), 27 deletions(-) + +commit 641042e63f665f3231c2fd1241fd3dddda3fb313 +Author: Lasse Collin +Date: 2020-02-20 18:54:04 +0200 + + tuklib_exit: Add missing header. + + strerror() needs which happened to be included via + tuklib_common.h -> tuklib_config.h -> sysdefs.h if HAVE_CONFIG_H + was defined. This wasn't tested without config.h before so it + had worked fine. + + src/common/tuklib_exit.c | 1 + + 1 file changed, 1 insertion(+) + +commit dbd55a69e530fec9ae866aaf6c3ccc0b4daf1f1f +Author: Lasse Collin +Date: 2020-02-16 11:18:28 +0200 + + sysdefs.h: Omit the conditionals around string.h and limits.h. + + string.h is used unconditionally elsewhere in the project and + configure has always stopped if limits.h is missing, so these + headers must have been always available even on the weirdest + systems. + + src/common/sysdefs.h | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +commit 9294909861e6d22b32418467e0e988f953a82264 +Author: Lasse Collin +Date: 2020-02-15 15:07:11 +0200 + + Build: Bump Autoconf and Libtool version requirements. + + There is no specific reason for this other than blocking + the most ancient versions. These are still old: + + Autoconf 2.69 (2012) + Automake 1.12 (2012) + gettext 0.19.6 (2015) + Libtool 2.4 (2010) + + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit bd09081bbdf552f730030d2fd0e5e39ccb3936af +Author: Lasse Collin +Date: 2020-02-15 03:08:32 +0200 + + Build: Use AM_GNU_GETTEXT_REQUIRE_VERSION and require 0.19.6. + + This bumps the version requirement from 0.19 (from 2014) to + 0.19.6 (2015). + + Using only the old AM_GNU_GETTEXT_VERSION results in old + gettext infrastructure being placed in the package. By using + both macros we get the latest gettext files while the other + programs in the Autotools family can still see the old macro. + + configure.ac | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +commit 1e5e08d86534aec7ca957982c7f6e90203c19e9f +Author: Lasse Collin +Date: 2020-02-14 20:42:06 +0200 + + Translations: Add German translation of the man pages. + + Thanks to Mario Blättermann. + + po4a/de.po | 5532 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + po4a/po4a.conf | 2 +- + 2 files changed, 5533 insertions(+), 1 deletion(-) + +commit 4b1447809ffbc0d77c0ad456bd6b3afcf0b8623e +Author: Lasse Collin +Date: 2020-02-07 15:32:21 +0200 + + Build: Add support for translated man pages using po4a. + + The dependency on po4a is optional. It's never required to install + the translated man pages when xz is built from a release tarball. + If po4a is missing when building from xz.git, the translated man + pages won't be generated but otherwise the build will work normally. + + The translations are only updated automatically by autogen.sh and + by "make mydist". This makes it easy to keep po4a as an optional + dependency and ensures that I won't forget to put updated + translations to a release tarball. + + The translated man pages aren't installed if --disable-nls is used. + + The installation of translated man pages abuses Automake internals + by calling "install-man" with redefined dist_man_MANS and man_MANS. + This makes the hairy script code slightly less hairy. If it breaks + some day, this code needs to be fixed; don't blame Automake developers. + + Also, this adds more quotes to the existing shell script code in + the Makefile.am "-hook"s. + + Makefile.am | 4 ++++ + autogen.sh | 8 ++++--- + po4a/.gitignore | 2 ++ + po4a/po4a.conf | 14 +++++++++++ + po4a/update-po | 45 ++++++++++++++++++++++++++++++++++ + src/scripts/Makefile.am | 64 +++++++++++++++++++++++++++++++++++++------------ + src/xz/Makefile.am | 50 +++++++++++++++++++++++++++----------- + src/xzdec/Makefile.am | 55 ++++++++++++++++++++++++++++++++---------- + 8 files changed, 197 insertions(+), 45 deletions(-) + +commit 882fcfdcd86525cc5c6f6d0bf0230d0089206d13 +Author: Lasse Collin +Date: 2020-02-06 00:04:42 +0200 + + Update THANKS (sync with the master branch). + + THANKS | 3 +++ + 1 file changed, 3 insertions(+) + +commit 134bb7765815d5f265eb0bc9e6ebacd9ae4a52bc +Author: Lasse Collin +Date: 2020-02-05 22:35:06 +0200 + + Update tests/.gitignore. + + .gitignore | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 6912472fafb656be8f4c5b4ac9ea28fea3065de4 +Author: Lasse Collin +Date: 2020-02-05 22:28:51 +0200 + + Update m4/.gitignore. + + m4/.gitignore | 1 + + 1 file changed, 1 insertion(+) + +commit 68c60735bbb6e51d4205ba8a9fde307bcfb22f8c +Author: Lasse Collin +Date: 2020-02-05 20:47:38 +0200 + + Update THANKS. + + THANKS | 1 + + 1 file changed, 1 insertion(+) + +commit e1beaa74bc7cb5a409d59b55870e01ae7784ce3a +Author: Lasse Collin +Date: 2020-02-05 20:33:50 +0200 + + xz: Comment out annoying sandboxing messages. + + src/xz/file_io.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +commit 8238192652290df78bd728b20e3f6542d1a2819e +Author: Lasse Collin +Date: 2020-02-05 19:33:37 +0200 + + Build: Workaround a POSIX shell detection problem on Solaris. + + I don't know if the problem is in gnulib's gl_POSIX_SHELL macro + or if xzgrep does something that isn't in POSIX. The workaround + adds a special case for Solaris: if /usr/xpg4/bin/sh exists and + gl_cv_posix_shell wasn't overriden on the configure command line, + use that shell for xzgrep and other scripts. That shell is known + to work and exists on most Solaris systems. + + configure.ac | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +commit 93a1f61e892e145607dd938e3b30098af19a1672 +Author: Lasse Collin +Date: 2020-02-03 22:03:50 +0200 + + Build: Update m4/ax_pthread.m4 from Autoconf Archive. + + m4/ax_pthread.m4 | 398 ++++++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 279 insertions(+), 119 deletions(-) + +commit d0daa21792ff861e5423bbd82aaa6c8ba9fa0462 +Author: Lasse Collin +Date: 2020-02-01 19:56:18 +0200 + + xz: Limit --memlimit-compress to at most 4020 MiB for 32-bit xz. + + See the code comment for reasoning. It's far from perfect but + hopefully good enough for certain cases while hopefully doing + nothing bad in other situations. + + At presets -5 ... -9, 4020 MiB vs. 4096 MiB makes no difference + on how xz scales down the number of threads. + + The limit has to be a few MiB below 4096 MiB because otherwise + things like "xz --lzma2=dict=500MiB" won't scale down the dict + size enough and xz cannot allocate enough memory. With + "ulimit -v $((4096 * 1024))" on x86-64, the limit in xz had + to be no more than 4085 MiB. Some safety margin is good though. + + This is hack but it should be useful when running 32-bit xz on + a 64-bit kernel that gives full 4 GiB address space to xz. + Hopefully this is enough to solve this: + + https://bugzilla.redhat.com/show_bug.cgi?id=1196786 + + FreeBSD has a patch that limits the result in tuklib_physmem() + to SIZE_MAX on 32-bit systems. While I think it's not the way + to do it, the results on --memlimit-compress have been good. This + commit should achieve practically identical results for compression + while leaving decompression and tuklib_physmem() and thus + lzma_physmem() unaffected. + + src/xz/hardware.c | 32 +++++++++++++++++++++++++++++++- + src/xz/xz.1 | 21 ++++++++++++++++++++- + 2 files changed, 51 insertions(+), 2 deletions(-) + +commit 4433c2dc5727ee6aef570e001a5a024e0d94e609 +Author: Lasse Collin +Date: 2020-01-26 20:53:25 +0200 + + xz: Set the --flush-timeout deadline when the first input byte arrives. + + xz --flush-timeout=2000, old version: + + 1. xz is started. The next flush will happen after two seconds. + 2. No input for one second. + 3. A burst of a few kilobytes of input. + 4. No input for one second. + 5. Two seconds have passed and flushing starts. + + The first second counted towards the flush-timeout even though + there was no pending data. This can cause flushing to occur more + often than needed. + + xz --flush-timeout=2000, after this commit: + + 1. xz is started. + 2. No input for one second. + 3. A burst of a few kilobytes of input. The next flush will + happen after two seconds counted from the time when the + first bytes of the burst were read. + 4. No input for one second. + 5. No input for another second. + 6. Two seconds have passed and flushing starts. + + src/xz/coder.c | 6 +----- + src/xz/file_io.c | 6 +++++- + src/xz/mytime.c | 1 - + 3 files changed, 6 insertions(+), 7 deletions(-) + +commit acc0ef3ac80f18e349c6d0252177707105c0a29c +Author: Lasse Collin +Date: 2020-01-26 20:19:19 +0200 + + xz: Move flush_needed from mytime.h to file_pair struct in file_io.h. + + src/xz/coder.c | 3 ++- + src/xz/file_io.c | 3 ++- + src/xz/file_io.h | 3 +++ + src/xz/mytime.c | 3 --- + src/xz/mytime.h | 4 ---- + 5 files changed, 7 insertions(+), 9 deletions(-) + +commit 4afe69d30b66812682a2016ee18441958019cbb2 +Author: Lasse Collin +Date: 2020-01-26 14:49:22 +0200 + + xz: coder.c: Make writing output a separate function. + + The same code sequence repeats so it's nicer as a separate function. + Note that in one case there was no test for opt_mode != MODE_TEST, + but that was only because that condition would always be true, so + this commit doesn't change the behavior there. + + src/xz/coder.c | 30 +++++++++++++++++------------- + 1 file changed, 17 insertions(+), 13 deletions(-) + +commit ec26f3ace5f9b260ca91508030f07465ae2f9f78 +Author: Lasse Collin +Date: 2020-01-26 14:13:42 +0200 + + xz: Fix semi-busy-waiting in xz --flush-timeout. + + When input blocked, xz --flush-timeout=1 would wake up every + millisecond and initiate flushing which would have nothing to + flush and thus would just waste CPU time. The fix disables the + timeout when no input has been seen since the previous flush. + + src/xz/coder.c | 4 ++++ + src/xz/file_io.c | 15 +++++++++++---- + src/xz/file_io.h | 4 ++++ + 3 files changed, 19 insertions(+), 4 deletions(-) + +commit 38915703241e69a64f133ff9a02ec9100c6019c6 +Author: Lasse Collin +Date: 2020-01-26 13:47:31 +0200 + + xz: Refactor io_read() a bit. + + src/xz/file_io.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +commit f6d24245349cecfae6ec0d2366fa80716c9f6d37 +Author: Lasse Collin +Date: 2020-01-26 13:37:08 +0200 + + xz: Update a comment in file_io.h. + + src/xz/file_io.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +commit 15b55d5c63d27f81776edb1abc05872a751fc674 +Author: Lasse Collin +Date: 2020-01-26 13:27:51 +0200 + + xz: Move the setting of flush_needed in file_io.c to a nicer location. + + src/xz/file_io.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +commit 609c7067859146ffc62ac655f6ba53599c891801 +Author: Lasse Collin +Date: 2020-02-05 19:56:09 +0200 + + xz: Enable Capsicum sandboxing by default if available. + + It has been enabled in FreeBSD for a while and reported to work fine. + + Thanks to Xin Li. + + INSTALL | 6 ------ + configure.ac | 8 ++++---- + 2 files changed, 4 insertions(+), 10 deletions(-) + +commit 00517d125cc26ecece0eebb84c1c3975cd19bee0 +Author: Lasse Collin +Date: 2019-12-31 22:41:45 +0200 + + Rename unaligned_read32ne to read32ne, and similarly for the others. + + src/common/tuklib_integer.h | 64 +++++++++++++++---------------- + src/liblzma/common/alone_encoder.c | 2 +- + src/liblzma/common/block_header_decoder.c | 2 +- + src/liblzma/common/block_header_encoder.c | 2 +- + src/liblzma/common/memcmplen.h | 9 ++--- + src/liblzma/common/stream_flags_decoder.c | 6 +-- + src/liblzma/common/stream_flags_encoder.c | 8 ++-- + src/liblzma/lz/lz_encoder_hash.h | 2 +- + src/liblzma/lzma/lzma_decoder.c | 2 +- + src/liblzma/lzma/lzma_encoder.c | 2 +- + src/liblzma/lzma/lzma_encoder_private.h | 3 +- + src/liblzma/simple/simple_decoder.c | 2 +- + src/liblzma/simple/simple_encoder.c | 2 +- + tests/test_block_header.c | 4 +- + tests/test_stream_flags.c | 6 +-- + 15 files changed, 54 insertions(+), 62 deletions(-) + +commit 52d89d8443c4a31a69c0701062f2c7711d82bbed +Author: Lasse Collin +Date: 2019-12-31 00:29:48 +0200 + + Rename read32ne to aligned_read32ne, and similarly for the others. + + Using the aligned methods requires more care to ensure that + the address really is aligned, so it's nicer if the aligned + methods are prefixed. The next commit will remove the unaligned_ + prefix from the unaligned methods which in liblzma are used in + more places than the aligned ones. + + src/common/tuklib_integer.h | 56 +++++++++++++++++++++--------------------- + src/liblzma/check/crc32_fast.c | 4 +-- + src/liblzma/check/crc64_fast.c | 4 +-- + 3 files changed, 32 insertions(+), 32 deletions(-) + +commit 850620468b57d49f16093e5870d1050886fcb37a +Author: Lasse Collin +Date: 2019-12-31 00:18:24 +0200 + + Revise tuklib_integer.h and .m4. + + Add a configure option --enable-unsafe-type-punning to get the + old non-conforming memory access methods. It can be useful with + old compilers or in some other less typical situations but + shouldn't normally be used. + + Omit the packed struct trick for unaligned access. While it's + best in some cases, this is simpler. If the memcpy trick doesn't + work, one can request unsafe type punning from configure. + + Because CRC32/CRC64 code needs fast aligned reads, if no very + safe way to do it is found, type punning is used as a fallback. + This sucks but since it currently works in practice, it seems to + be the least bad option. It's never needed with GCC >= 4.7 or + Clang >= 3.6 since these support __builtin_assume_aligned and + thus fast aligned access can be done with the memcpy trick. + + Other things: + - Support GCC/Clang __builtin_bswapXX + - Cleaner bswap fallback macros + - Minor cleanups + + m4/tuklib_integer.m4 | 43 ++++ + src/common/tuklib_integer.h | 488 ++++++++++++++++++++++++-------------------- + 2 files changed, 314 insertions(+), 217 deletions(-) + +commit a45badf0342666462cc6a7107a071418570ab773 +Author: Lasse Collin +Date: 2019-12-29 22:51:58 +0200 + + Tests: Hopefully fix test_check.c to work on EBCDIC systems. + + Thanks to Daniel Richard G. + + tests/test_check.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +commit c9a8071e6690a8db8a485c075920df254e7c70ea +Author: Lasse Collin +Date: 2019-09-24 23:02:40 +0300 + + Scripts: Put /usr/xpg4/bin to the beginning of PATH on Solaris. + + This adds a configure option --enable-path-for-scripts=PREFIX + which defaults to empty except on Solaris it is /usr/xpg4/bin + to make POSIX grep and others available. The Solaris case had + been documented in INSTALL with a manual fix but it's better + to do this automatically since it is needed on most Solaris + systems anyway. + + Thanks to Daniel Richard G. + + INSTALL | 43 +++++++++++++++++++++++++++++++++++-------- + configure.ac | 26 ++++++++++++++++++++++++++ + src/scripts/xzdiff.in | 1 + + src/scripts/xzgrep.in | 1 + + src/scripts/xzless.in | 1 + + src/scripts/xzmore.in | 1 + + 6 files changed, 65 insertions(+), 8 deletions(-) + +commit aba140e2df3ff63ad124ae997de16d517b98ca50 +Author: Lasse Collin +Date: 2019-07-12 18:57:43 +0300 + + Fix comment typos in tuklib_mbstr* files. + + src/common/tuklib_mbstr.h | 2 +- + src/common/tuklib_mbstr_fw.c | 2 +- + src/common/tuklib_mbstr_width.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +commit 710f5bd769a5d2bd8684256c2727d15350ee2ab8 +Author: Lasse Collin +Date: 2019-07-12 18:30:46 +0300 + + Add missing include to tuklib_mbstr_width.c. + + It didn't matter in XZ Utils because sysdefs.h + includes string.h anyway. + + src/common/tuklib_mbstr_width.c | 1 + + 1 file changed, 1 insertion(+) + +commit 0e491aa8cd72e0100cd15c1b9469cd57fae500b0 +Author: Lasse Collin +Date: 2019-06-25 23:15:21 +0300 + + liblzma: Fix a buggy comment. + + src/liblzma/lz/lz_encoder_mf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit bfc245569f340a75bd71ad32a6beba786712683b +Author: Lasse Collin +Date: 2019-06-25 00:16:06 +0300 + + configure.ac: Fix a typo in a comment. + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f18eee9d15a22c8449ef395a05f0eb637c4ad253 +Author: Lasse Collin +Date: 2019-06-25 00:08:13 +0300 + + Tests: Silence warnings from clang -Wassign-enum. + + Also changed 999 to 99 so it fits even if lzma_check happened + to be 8 bits wide. + + tests/test_block_header.c | 3 ++- + tests/test_stream_flags.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +commit 25f74554723e8deabc66fed1abf0ec27a4ed19d5 +Author: Lasse Collin +Date: 2019-06-24 23:52:17 +0300 + + liblzma: Add a comment. + + src/liblzma/common/stream_encoder_mt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 44eb961f2a51d02420d017bc5ff470360663650c +Author: Lasse Collin +Date: 2019-06-24 23:45:21 +0300 + + liblzma: Silence clang -Wmissing-variable-declarations. + + src/liblzma/check/crc32_table.c | 3 +++ + src/liblzma/check/crc64_table.c | 3 +++ + 2 files changed, 6 insertions(+) + +commit 267afcd9955e668c1532b069230c21c348eb4f82 +Author: Lasse Collin +Date: 2019-06-24 22:57:43 +0300 + + xz: Silence a warning from clang -Wsign-conversion in main.c. + + src/xz/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 0e3c4002f809311ecef239b05e556d9c462b5703 +Author: Lasse Collin +Date: 2019-06-24 22:47:39 +0300 + + liblzma: Remove incorrect uses of lzma_attribute((__unused__)). + + Caught by clang -Wused-but-marked-unused. + + src/liblzma/common/alone_decoder.c | 3 +-- + src/liblzma/common/alone_encoder.c | 3 +-- + src/liblzma/lz/lz_decoder.c | 3 +-- + 3 files changed, 3 insertions(+), 6 deletions(-) + +commit cb708e8fa3405ec13a0ebfebbbf2793f927deab1 +Author: Lasse Collin +Date: 2019-06-24 20:53:55 +0300 + + Tests: Silence a warning from -Wsign-conversion. + + tests/create_compress_files.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit c8cace3d6e965c0fb537591372bf71b9357dd76c +Author: Lasse Collin +Date: 2019-06-24 20:45:49 +0300 + + xz: Fix an integer overflow with 32-bit off_t. + + Or any off_t which isn't very big (like signed 64 bit integer + that most system have). A small off_t could overflow if the + file being decompressed had long enough run of zero bytes, + which would result in corrupt output. + + src/xz/file_io.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +commit 65a42741e290fbcd85dfc5db8a62c4bce5f7712c +Author: Lasse Collin +Date: 2019-06-24 00:57:23 +0300 + + Tests: Remove a duplicate branch from tests/tests.h. + + The duplication was introduced about eleven years ago and + should have been cleaned up back then already. + + This was caught by -Wduplicated-branches. + + tests/tests.h | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +commit 5c4fb60e8df026e933afab0cfe0a8b55be20036c +Author: Lasse Collin +Date: 2019-06-23 23:22:45 +0300 + + tuklib_mbstr_width: Fix a warning from -Wsign-conversion. + + src/common/tuklib_mbstr_width.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 37df03ce52ce53710e1513387648763f8a744154 +Author: Lasse Collin +Date: 2019-06-23 23:19:34 +0300 + + xz: Fix some of the warnings from -Wsign-conversion. + + src/xz/args.c | 4 ++-- + src/xz/coder.c | 4 ++-- + src/xz/file_io.c | 5 +++-- + src/xz/message.c | 4 ++-- + src/xz/mytime.c | 4 ++-- + src/xz/options.c | 2 +- + src/xz/util.c | 4 ++-- + 7 files changed, 14 insertions(+), 13 deletions(-) + +commit 7c65ae0f5f2e2431f88621e8fe6d1dc7907e30c1 +Author: Lasse Collin +Date: 2019-06-23 22:27:45 +0300 + + tuklib_cpucores: Silence warnings from -Wsign-conversion. + + src/common/tuklib_cpucores.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +commit a502dd1d000b598406637d452f535f4bbd43e2a4 +Author: Lasse Collin +Date: 2019-06-23 21:40:47 +0300 + + xzdec: Fix warnings from -Wsign-conversion. + + src/xzdec/xzdec.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit a45d1a5374ceb22e23255b0b595b9e641e9860af +Author: Lasse Collin +Date: 2019-06-23 21:38:56 +0300 + + liblzma: Fix warnings from -Wsign-conversion. + + Also, more parentheses were added to the literal_subcoder + macro in lzma_comon.h (better style but no functional change + in the current usage). + + src/liblzma/common/block_header_decoder.c | 2 +- + src/liblzma/delta/delta_decoder.c | 2 +- + src/liblzma/lzma/fastpos.h | 2 +- + src/liblzma/lzma/lzma2_decoder.c | 8 ++++---- + src/liblzma/lzma/lzma_common.h | 3 ++- + src/liblzma/lzma/lzma_decoder.c | 16 ++++++++-------- + src/liblzma/simple/arm.c | 6 +++--- + src/liblzma/simple/armthumb.c | 8 ++++---- + src/liblzma/simple/ia64.c | 2 +- + src/liblzma/simple/powerpc.c | 9 +++++---- + src/liblzma/simple/x86.c | 2 +- + 11 files changed, 31 insertions(+), 29 deletions(-) + +commit 4ff87ddf80ed7cb233444cddd86ab1940b5b55ec +Author: Lasse Collin +Date: 2019-06-23 19:33:55 +0300 + + tuklib_integer: Silence warnings from -Wsign-conversion. + + src/common/tuklib_integer.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit ed1a9d33984a3a37ae9a775a46859850d98ea4d0 +Author: Lasse Collin +Date: 2019-06-20 19:40:30 +0300 + + tuklib_integer: Fix usage of conv macros. + + Use a temporary variable instead of e.g. + conv32le(unaligned_read32ne(buf)) because the macro can + evaluate its argument multiple times. + + src/common/tuklib_integer.h | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +commit 612c88dfc08e2c572623954ecfde541d21c84882 +Author: Lasse Collin +Date: 2019-06-03 20:44:19 +0300 + + Update THANKS. + + THANKS | 1 + + 1 file changed, 1 insertion(+) + +commit 85da31d8b882b8b9671ab3e3d74d88bd945cd0bb +Author: Lasse Collin +Date: 2019-06-03 20:41:54 +0300 + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Sun Apr 5 02:15:45 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C15FE2A9867; Sun, 5 Apr 2020 02:15:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48vy280Gh4z414v; Sun, 5 Apr 2020 02:15:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 056BD41D2; Sun, 5 Apr 2020 02:08:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03528HiB050371; Sun, 5 Apr 2020 02:08:17 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03528HYH050368; Sun, 5 Apr 2020 02:08:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004050208.03528HYH050368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Apr 2020 02:08:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359636 - in stable/12/contrib/xz/src: common xz X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12/contrib/xz/src: common xz X-SVN-Commit-Revision: 359636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 02:15:46 -0000 Author: delphij Date: Sun Apr 5 02:08:17 2020 New Revision: 359636 URL: https://svnweb.freebsd.org/changeset/base/359636 Log: MFC r357609: MFV r357608: Limit memory usage in xz(1) instead of in tuklib. Modified: stable/12/contrib/xz/src/common/tuklib_physmem.c stable/12/contrib/xz/src/xz/hardware.c stable/12/contrib/xz/src/xz/xz.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/xz/src/common/tuklib_physmem.c ============================================================================== --- stable/12/contrib/xz/src/common/tuklib_physmem.c Sun Apr 5 01:53:35 2020 (r359635) +++ stable/12/contrib/xz/src/common/tuklib_physmem.c Sun Apr 5 02:08:17 2020 (r359636) @@ -45,7 +45,6 @@ # include #elif defined(TUKLIB_PHYSMEM_SYSCONF) -# include # include #elif defined(TUKLIB_PHYSMEM_SYSCTL) @@ -146,16 +145,13 @@ tuklib_physmem(void) #elif defined(TUKLIB_PHYSMEM_SYSCONF) const long pagesize = sysconf(_SC_PAGESIZE); const long pages = sysconf(_SC_PHYS_PAGES); - if (pagesize != -1 && pages != -1) { + if (pagesize != -1 && pages != -1) // According to docs, pagesize * pages can overflow. // Simple case is 32-bit box with 4 GiB or more RAM, // which may report exactly 4 GiB of RAM, and "long" // being 32-bit will overflow. Casting to uint64_t // hopefully avoids overflows in the near future. ret = (uint64_t)pagesize * (uint64_t)pages; - if (ret > SIZE_T_MAX) - ret = SIZE_T_MAX; - } #elif defined(TUKLIB_PHYSMEM_SYSCTL) int name[2] = { Modified: stable/12/contrib/xz/src/xz/hardware.c ============================================================================== --- stable/12/contrib/xz/src/xz/hardware.c Sun Apr 5 01:53:35 2020 (r359635) +++ stable/12/contrib/xz/src/xz/hardware.c Sun Apr 5 02:08:17 2020 (r359636) @@ -68,8 +68,38 @@ hardware_memlimit_set(uint64_t new_memlimit, new_memlimit = (uint32_t)new_memlimit * total_ram / 100; } - if (set_compress) + if (set_compress) { memlimit_compress = new_memlimit; + +#if SIZE_MAX == UINT32_MAX + // FIXME? + // + // When running a 32-bit xz on a system with a lot of RAM and + // using a percentage-based memory limit, the result can be + // bigger than the 32-bit address space. Limiting the limit + // below SIZE_MAX for compression (not decompression) makes + // xz lower the compression settings (or number of threads) + // to a level that *might* work. In practice it has worked + // when using a 64-bit kernel that gives full 4 GiB address + // space to 32-bit programs. In other situations this might + // still be too high, like 32-bit kernels that may give much + // less than 4 GiB to a single application. + // + // So this is an ugly hack but I will keep it here while + // it does more good than bad. + // + // Use a value less than SIZE_MAX so that there's some room + // for the xz program and so on. Don't use 4000 MiB because + // it could look like someone mixed up base-2 and base-10. + const uint64_t limit_max = UINT64_C(4020) << 20; + + // UINT64_MAX is a special case for the string "max" so + // that has to be handled specially. + if (memlimit_compress != UINT64_MAX + && memlimit_compress > limit_max) + memlimit_compress = limit_max; +#endif + } if (set_decompress) memlimit_decompress = new_memlimit; Modified: stable/12/contrib/xz/src/xz/xz.1 ============================================================================== --- stable/12/contrib/xz/src/xz/xz.1 Sun Apr 5 01:53:35 2020 (r359635) +++ stable/12/contrib/xz/src/xz/xz.1 Sun Apr 5 02:08:17 2020 (r359636) @@ -1005,6 +1005,25 @@ instead of until the details have been decided. .RE .IP "" +For 32-bit +.BR xz +there is a special case: if the +.I limit +would be over +.BR "4020\ MiB" , +the +.I limit +is set to +.BR "4020\ MiB" . +(The values +.B 0 +and +.B max +aren't affected by this. +A similar feature doesn't exist for decompression.) +This can be helpful when a 32-bit executable has access +to 4\ GiB address space while hopefully doing no harm in other situations. +.IP "" See also the section .BR "Memory usage" . .TP From owner-svn-src-stable-12@freebsd.org Sun Apr 5 02:28:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D670E2A9AD8; Sun, 5 Apr 2020 02:28:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48vyJJ0NlFz44xV; Sun, 5 Apr 2020 02:28:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2B5F45DA; Sun, 5 Apr 2020 02:27:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0352RoIc062889; Sun, 5 Apr 2020 02:27:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0352RnxY062882; Sun, 5 Apr 2020 02:27:49 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004050227.0352RnxY062882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Apr 2020 02:27:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359637 - in stable/12: contrib/file contrib/file/doc contrib/file/m4 contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/file contrib/file/doc contrib/file/m4 contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/tests lib/libmagic X-SVN-Commit-Revision: 359637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 02:28:01 -0000 Author: delphij Date: Sun Apr 5 02:27:49 2020 New Revision: 359637 URL: https://svnweb.freebsd.org/changeset/base/359637 Log: MFC r357757: MFV r357712: file 5.38. Added: stable/12/contrib/file/magic/Magdir/forth - copied unchanged from r357757, head/contrib/file/magic/Magdir/forth stable/12/contrib/file/magic/Magdir/git - copied unchanged from r357757, head/contrib/file/magic/Magdir/git stable/12/contrib/file/magic/Magdir/modulefile - copied unchanged from r357757, head/contrib/file/magic/Magdir/modulefile stable/12/contrib/file/magic/Magdir/openfst - copied unchanged from r357757, head/contrib/file/magic/Magdir/openfst stable/12/contrib/file/magic/Magdir/opentimestamps - copied unchanged from r357757, head/contrib/file/magic/Magdir/opentimestamps stable/12/contrib/file/magic/Magdir/pmem - copied unchanged from r357757, head/contrib/file/magic/Magdir/pmem stable/12/contrib/file/magic/Magdir/rst - copied unchanged from r357757, head/contrib/file/magic/Magdir/rst stable/12/contrib/file/magic/Magdir/sosi - copied unchanged from r357757, head/contrib/file/magic/Magdir/sosi stable/12/contrib/file/src/is_csv.c - copied unchanged from r357757, head/contrib/file/src/is_csv.c Modified: stable/12/contrib/file/ChangeLog stable/12/contrib/file/Makefile.in stable/12/contrib/file/README stable/12/contrib/file/aclocal.m4 stable/12/contrib/file/compile stable/12/contrib/file/config.guess stable/12/contrib/file/config.h.in stable/12/contrib/file/config.sub stable/12/contrib/file/configure stable/12/contrib/file/configure.ac stable/12/contrib/file/depcomp stable/12/contrib/file/doc/Makefile.in stable/12/contrib/file/doc/file.man stable/12/contrib/file/doc/libmagic.man stable/12/contrib/file/doc/magic.man stable/12/contrib/file/ltmain.sh stable/12/contrib/file/m4/libtool.m4 stable/12/contrib/file/m4/ltoptions.m4 stable/12/contrib/file/m4/ltsugar.m4 stable/12/contrib/file/m4/ltversion.m4 stable/12/contrib/file/m4/lt~obsolete.m4 stable/12/contrib/file/magic/Magdir/android stable/12/contrib/file/magic/Magdir/animation stable/12/contrib/file/magic/Magdir/apple stable/12/contrib/file/magic/Magdir/archive stable/12/contrib/file/magic/Magdir/audio stable/12/contrib/file/magic/Magdir/bsi stable/12/contrib/file/magic/Magdir/c-lang stable/12/contrib/file/magic/Magdir/cad stable/12/contrib/file/magic/Magdir/commands stable/12/contrib/file/magic/Magdir/compress stable/12/contrib/file/magic/Magdir/console stable/12/contrib/file/magic/Magdir/database stable/12/contrib/file/magic/Magdir/elf stable/12/contrib/file/magic/Magdir/espressif stable/12/contrib/file/magic/Magdir/filesystems stable/12/contrib/file/magic/Magdir/fonts stable/12/contrib/file/magic/Magdir/frame stable/12/contrib/file/magic/Magdir/games stable/12/contrib/file/magic/Magdir/gimp stable/12/contrib/file/magic/Magdir/icc stable/12/contrib/file/magic/Magdir/images stable/12/contrib/file/magic/Magdir/javascript stable/12/contrib/file/magic/Magdir/kml stable/12/contrib/file/magic/Magdir/linux stable/12/contrib/file/magic/Magdir/macintosh stable/12/contrib/file/magic/Magdir/mail.news stable/12/contrib/file/magic/Magdir/map stable/12/contrib/file/magic/Magdir/msdos stable/12/contrib/file/magic/Magdir/msooxml stable/12/contrib/file/magic/Magdir/ole2compounddocs stable/12/contrib/file/magic/Magdir/pdf stable/12/contrib/file/magic/Magdir/python stable/12/contrib/file/magic/Magdir/rpi stable/12/contrib/file/magic/Magdir/ruby stable/12/contrib/file/magic/Magdir/sgml stable/12/contrib/file/magic/Magdir/sniffer stable/12/contrib/file/magic/Magdir/ssh stable/12/contrib/file/magic/Magdir/uuencode stable/12/contrib/file/magic/Magdir/varied.script stable/12/contrib/file/magic/Magdir/vax stable/12/contrib/file/magic/Magdir/windows stable/12/contrib/file/magic/Magdir/wordprocessors stable/12/contrib/file/magic/Magdir/zip stable/12/contrib/file/magic/Makefile.am stable/12/contrib/file/magic/Makefile.in stable/12/contrib/file/missing stable/12/contrib/file/python/Makefile.in stable/12/contrib/file/src/Makefile.am stable/12/contrib/file/src/Makefile.in stable/12/contrib/file/src/apprentice.c stable/12/contrib/file/src/ascmagic.c stable/12/contrib/file/src/buffer.c stable/12/contrib/file/src/compress.c stable/12/contrib/file/src/encoding.c stable/12/contrib/file/src/file.c stable/12/contrib/file/src/file.h stable/12/contrib/file/src/file_opts.h stable/12/contrib/file/src/fsmagic.c stable/12/contrib/file/src/funcs.c stable/12/contrib/file/src/magic.h.in stable/12/contrib/file/src/readcdf.c stable/12/contrib/file/src/readelf.c stable/12/contrib/file/src/seccomp.c stable/12/contrib/file/src/vasprintf.c stable/12/contrib/file/tests/JW07022A.mp3.result stable/12/contrib/file/tests/Makefile.in stable/12/contrib/file/tests/test.c stable/12/lib/libmagic/Makefile stable/12/lib/libmagic/config.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/file/ChangeLog ============================================================================== --- stable/12/contrib/file/ChangeLog Sun Apr 5 02:08:17 2020 (r359636) +++ stable/12/contrib/file/ChangeLog Sun Apr 5 02:27:49 2020 (r359637) @@ -1,3 +1,23 @@ +2019-12-16 21:11 Christos Zoulas + + * release 5.38 + +2019-12-15 22:13 Christos Zoulas + Document changes since the previous release: + - Always accept -S (no sandbox) even if we don't support sandboxing + - More syscalls elided for sandboxiing + - For ELF dynamic means having an interpreter not just PT_DYNAMIC + - Check for large ELF session header offset + - When saving and restoring a locale, keep the locale name in our + own storage. + - Add a flag to disable CSV file detection. + - Don't pass NULL/0 to memset to appease sanitizers. + - Avoid spurious prints when looks for extensions or apple strings + in fsmagic. + - Add builtin decompressors for xz and and bzip. + - Add a limit for the number of CDF elements. + - More checks for overflow in CDF. + 2019-05-14 22:26 Christos Zoulas * release 5.37 Modified: stable/12/contrib/file/Makefile.in ============================================================================== --- stable/12/contrib/file/Makefile.in Sun Apr 5 02:08:17 2020 (r359636) +++ stable/12/contrib/file/Makefile.in Sun Apr 5 02:27:49 2020 (r359637) @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -136,7 +136,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck + cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, @@ -161,7 +161,7 @@ CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \ COPYING ChangeLog INSTALL NEWS README TODO compile \ - config.guess config.sub depcomp install-sh ltmain.sh missing + config.guess config.sub install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -246,6 +246,7 @@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINGW = @MINGW@ @@ -352,8 +353,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -495,7 +496,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -560,7 +564,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -586,7 +590,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -604,7 +608,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -614,7 +618,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac Modified: stable/12/contrib/file/README ============================================================================== --- stable/12/contrib/file/README Sun Apr 5 02:08:17 2020 (r359636) +++ stable/12/contrib/file/README Sun Apr 5 02:27:49 2020 (r359637) @@ -1,6 +1,6 @@ ## README for file(1) Command and the libmagic(3) library ## - @(#) $File: README,v 1.57 2019/02/06 00:20:56 christos Exp $ + @(#) $File: README,v 1.59 2019/09/19 01:04:01 christos Exp $ Mailing List: file@astron.com Mailing List archives: http://mailman.astron.com/pipermail/file/ @@ -24,6 +24,10 @@ A public read-only git repository of the same sources https://github.com/file/file +We are continuously being fuzzed by OSS-FUZZ: + + https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:file + The major changes for 5.x are CDF file parsing, indirect magic, name/use (recursion) and overhaul in mime and ascii encoding handling. @@ -91,6 +95,7 @@ src/funcs.c - utilility functions src/getline.c - replacement for OS's that don't have it. src/getopt_long.c - replacement for OS's that don't have it. src/gmtime_r.c - replacement for OS's that don't have it. +src/is_csv.c - knows about Comma Separated Value file format (RFC 4180). src/is_json.c - knows about JavaScript Object Notation format (RFC 8259). src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). src/localtime_r.c - replacement for OS's that don't have it. Modified: stable/12/contrib/file/aclocal.m4 ============================================================================== --- stable/12/contrib/file/aclocal.m4 Sun Apr 5 02:08:17 2020 (r359636) +++ stable/12/contrib/file/aclocal.m4 Sun Apr 5 02:27:49 2020 (r359637) @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,8 +20,8 @@ You have another version of autoconf. It may work, bu If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# visibility.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010-2016 Free Software Foundation, Inc. +# visibility.m4 serial 6 +dnl Copyright (C) 2005, 2008, 2010-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -51,42 +51,42 @@ AC_DEFUN([gl_VISIBILITY], dnl First, check whether -Werror can be added to the command line, or dnl whether it leads to an error because of some other option that the dnl user has put into $CC $CFLAGS $CPPFLAGS. - AC_MSG_CHECKING([whether the -Werror option is usable]) - AC_CACHE_VAL([gl_cv_cc_vis_werror], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [gl_cv_cc_vis_werror=yes], - [gl_cv_cc_vis_werror=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_vis_werror]) + AC_CACHE_CHECK([whether the -Werror option is usable], + [gl_cv_cc_vis_werror], + [gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_vis_werror=yes], + [gl_cv_cc_vis_werror=no]) + CFLAGS="$gl_save_CFLAGS" + ]) dnl Now check whether visibility declarations are supported. - AC_MSG_CHECKING([for simple visibility declarations]) - AC_CACHE_VAL([gl_cv_cc_visibility], [ - gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - dnl We use the option -Werror and a function dummyfunc, because on some - dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning - dnl "visibility attribute not supported in this configuration; ignored" - dnl at the first function definition in every compilation unit, and we - dnl don't want to use the option in this case. - if test $gl_cv_cc_vis_werror = yes; then - CFLAGS="$CFLAGS -Werror" - fi - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; - extern __attribute__((__visibility__("default"))) int exportedvar; - extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void); - void dummyfunc (void) {} - ]], - [[]])], - [gl_cv_cc_visibility=yes], - [gl_cv_cc_visibility=no]) - CFLAGS="$gl_save_CFLAGS"]) - AC_MSG_RESULT([$gl_cv_cc_visibility]) + AC_CACHE_CHECK([for simple visibility declarations], + [gl_cv_cc_visibility], + [gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + dnl We use the option -Werror and a function dummyfunc, because on some + dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning + dnl "visibility attribute not supported in this configuration; ignored" + dnl at the first function definition in every compilation unit, and we + dnl don't want to use the option in this case. + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void) {} + ]], + [[]])], + [gl_cv_cc_visibility=yes], + [gl_cv_cc_visibility=no]) + CFLAGS="$gl_save_CFLAGS" + ]) if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" HAVE_VISIBILITY=1 @@ -98,7 +98,7 @@ AC_DEFUN([gl_VISIBILITY], [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) ]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,10 +110,10 @@ AC_DEFUN([gl_VISIBILITY], # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -129,14 +129,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -188,7 +188,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -219,7 +219,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -410,13 +410,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], @@ -424,49 +423,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -475,18 +466,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -573,8 +563,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -641,7 +631,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -683,7 +673,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -704,7 +694,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -725,7 +715,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -733,49 +723,42 @@ AC_SUBST([am__leading_dot])]) # AM_MAKE_INCLUDE() # ----------------- -# Check to see how make treats includes. +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -814,7 +797,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -843,7 +826,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -890,7 +873,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -909,7 +892,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -990,7 +973,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1050,7 +1033,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1078,7 +1061,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1097,7 +1080,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, Modified: stable/12/contrib/file/compile ============================================================================== --- stable/12/contrib/file/compile Sun Apr 5 02:08:17 2020 (r359636) +++ stable/12/contrib/file/compile Sun Apr 5 02:27:49 2020 (r359637) @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: Modified: stable/12/contrib/file/config.guess ============================================================================== --- stable/12/contrib/file/config.guess Sun Apr 5 02:08:17 2020 (r359636) +++ stable/12/contrib/file/config.guess Sun Apr 5 02:27:49 2020 (r359637) @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2017 Free Software Foundation, Inc. +# Copyright 1992-2019 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2019-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2017-01-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ timestamp='2017-01-01' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . @@ -39,7 +39,7 @@ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2017 Free Software Foundation, Inc. +Copyright 1992-2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,8 +84,6 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 - # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -96,34 +94,38 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 +set_cc_for_build() { + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi @@ -132,14 +134,14 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEAS UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in +case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu - eval $set_cc_for_build - cat <<-EOF > $dummy.c + set_cc_for_build + cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc @@ -149,13 +151,20 @@ Linux|GNU|GNU/*) LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -169,30 +178,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown + earm*) + arch="${UNAME_MACHINE_ARCH#e}" + arch="${arch%eb}" + arch="${arch%hf}" + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -208,10 +219,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE ;; esac # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + expr='s/v[0-9]//;s/earm/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release @@ -219,46 +230,55 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in + case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) - echo ${UNAME_MACHINE}-unknown-sortix + echo "$UNAME_MACHINE"-unknown-sortix exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -310,28 +330,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos + echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos + echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -343,7 +354,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} + echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos @@ -370,19 +381,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE sparc) echo sparc-icl-nx7; exit ;; esac ;; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Sun Apr 5 03:02:31 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68DE22AA9D1; Sun, 5 Apr 2020 03:02:31 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48vz441dtkz4JRH; Sun, 5 Apr 2020 03:02:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64B084A04; Sun, 5 Apr 2020 02:45:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0352jsUT075221; Sun, 5 Apr 2020 02:45:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0352js2Z075220; Sun, 5 Apr 2020 02:45:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004050245.0352js2Z075220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Apr 2020 02:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359638 - stable/12/sbin/fsck_msdosfs X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/sbin/fsck_msdosfs X-SVN-Commit-Revision: 359638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 03:02:31 -0000 Author: delphij Date: Sun Apr 5 02:45:54 2020 New Revision: 359638 URL: https://svnweb.freebsd.org/changeset/base/359638 Log: MFC r357716: Use humanize_number to format available and bad space size Modified: stable/12/sbin/fsck_msdosfs/Makefile stable/12/sbin/fsck_msdosfs/check.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/fsck_msdosfs/Makefile ============================================================================== --- stable/12/sbin/fsck_msdosfs/Makefile Sun Apr 5 02:27:49 2020 (r359637) +++ stable/12/sbin/fsck_msdosfs/Makefile Sun Apr 5 02:45:54 2020 (r359638) @@ -9,6 +9,7 @@ PROG= fsck_msdosfs MAN= fsck_msdosfs.8 SRCS= main.c check.c boot.c fat.c dir.c fsutil.c -CFLAGS+= -I${FSCK} +CFLAGS+= -I${FSCK} -DHAVE_LIBUTIL_H +LIBADD= util .include Modified: stable/12/sbin/fsck_msdosfs/check.c ============================================================================== --- stable/12/sbin/fsck_msdosfs/check.c Sun Apr 5 02:27:49 2020 (r359637) +++ stable/12/sbin/fsck_msdosfs/check.c Sun Apr 5 02:45:54 2020 (r359638) @@ -33,6 +33,9 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#ifdef HAVE_LIBUTIL_H +#include +#endif #include #include #include @@ -126,15 +129,38 @@ checkfilesys(const char *fname) mod |= FSERROR; } +#ifdef HAVE_LIBUTIL_H + char freestr[7], badstr[7]; + + int64_t freebytes = boot.NumFree * boot.ClusterSize; + humanize_number(freestr, sizeof(freestr), freebytes, "", + HN_AUTOSCALE, HN_DECIMAL | HN_IEC_PREFIXES); + if (boot.NumBad) { + int64_t badbytes = boot.NumBad * boot.ClusterSize; + + humanize_number(badstr, sizeof(badstr), badbytes, "", + HN_AUTOSCALE, HN_B | HN_DECIMAL | HN_IEC_PREFIXES); + + pwarn("%d files, %sB free (%d clusters), %sB bad (%d clusters)\n", + boot.NumFiles, + freestr, boot.NumFree, + badstr, boot.NumBad); + } else { + pwarn("%d files, %sB free (%d clusters)\n", + boot.NumFiles, + freestr, boot.NumFree); + } +#else if (boot.NumBad) - pwarn("%d files, %d free (%d clusters), %d bad (%d clusters)\n", + pwarn("%d files, %d KiB free (%d clusters), %d KiB bad (%d clusters)\n", boot.NumFiles, boot.NumFree * boot.ClusterSize / 1024, boot.NumFree, boot.NumBad * boot.ClusterSize / 1024, boot.NumBad); else - pwarn("%d files, %d free (%d clusters)\n", + pwarn("%d files, %d KiB free (%d clusters)\n", boot.NumFiles, boot.NumFree * boot.ClusterSize / 1024, boot.NumFree); +#endif if (mod && (mod & FSERROR) == 0) { if (mod & FSDIRTY) { From owner-svn-src-stable-12@freebsd.org Sun Apr 5 03:26:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BCC22AB132; Sun, 5 Apr 2020 03:26:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48vzc85KfSz4S09; Sun, 5 Apr 2020 03:26:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A431352DB; Sun, 5 Apr 2020 03:26:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0353QeT4000829; Sun, 5 Apr 2020 03:26:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0353QeWU000828; Sun, 5 Apr 2020 03:26:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004050326.0353QeWU000828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Apr 2020 03:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359639 - stable/12/lib/liblzma X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/lib/liblzma X-SVN-Commit-Revision: 359639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 03:26:50 -0000 Author: delphij Date: Sun Apr 5 03:26:40 2020 New Revision: 359639 URL: https://svnweb.freebsd.org/changeset/base/359639 Log: Workaround for GCC. Modified: stable/12/lib/liblzma/config.h Modified: stable/12/lib/liblzma/config.h ============================================================================== --- stable/12/lib/liblzma/config.h Sun Apr 5 02:45:54 2020 (r359638) +++ stable/12/lib/liblzma/config.h Sun Apr 5 03:26:40 2020 (r359639) @@ -314,7 +314,9 @@ /* Define to 1 if the GNU C extension __builtin_assume_aligned is supported. */ +#if defined(__clang__) && defined(__FreeBSD__) #define HAVE___BUILTIN_ASSUME_ALIGNED 1 +#endif /* Define to 1 if the GNU C extensions __builtin_bswap16/32/64 are supported. */ From owner-svn-src-stable-12@freebsd.org Sun Apr 5 04:02:57 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A12122ABB5A; Sun, 5 Apr 2020 04:02:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48w0Pq5xYtz4g90; Sun, 5 Apr 2020 04:02:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EA195B5C; Sun, 5 Apr 2020 04:01:12 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03541CT0020673; Sun, 5 Apr 2020 04:01:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03541Cq6020671; Sun, 5 Apr 2020 04:01:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004050401.03541Cq6020671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 5 Apr 2020 04:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359640 - stable/12/lib/liblzma X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/lib/liblzma X-SVN-Commit-Revision: 359640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 04:02:57 -0000 Author: delphij Date: Sun Apr 5 04:01:11 2020 New Revision: 359640 URL: https://svnweb.freebsd.org/changeset/base/359640 Log: Disable use of bswapxx with GCC. Modified: stable/12/lib/liblzma/config.h Modified: stable/12/lib/liblzma/config.h ============================================================================== --- stable/12/lib/liblzma/config.h Sun Apr 5 03:26:40 2020 (r359639) +++ stable/12/lib/liblzma/config.h Sun Apr 5 04:01:11 2020 (r359640) @@ -312,15 +312,15 @@ #define HAVE__MM_MOVEMASK_EPI8 1 #endif +#if defined(__clang__) && defined(__FreeBSD__) /* Define to 1 if the GNU C extension __builtin_assume_aligned is supported. */ -#if defined(__clang__) && defined(__FreeBSD__) #define HAVE___BUILTIN_ASSUME_ALIGNED 1 -#endif /* Define to 1 if the GNU C extensions __builtin_bswap16/32/64 are supported. */ #define HAVE___BUILTIN_BSWAPXX 1 +#endif /* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" From owner-svn-src-stable-12@freebsd.org Mon Apr 6 04:06:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4030A27FDEC; Mon, 6 Apr 2020 04:06:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wcRD0WKgz4S72; Mon, 6 Apr 2020 04:06:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C74C21E30; Mon, 6 Apr 2020 04:06:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03646FRT004755; Mon, 6 Apr 2020 04:06:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03646FTc004754; Mon, 6 Apr 2020 04:06:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004060406.03646FTc004754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 6 Apr 2020 04:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359646 - stable/12/libexec/flua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/libexec/flua X-SVN-Commit-Revision: 359646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 04:06:16 -0000 Author: kevans Date: Mon Apr 6 04:06:15 2020 New Revision: 359646 URL: https://svnweb.freebsd.org/changeset/base/359646 Log: MFC r359453, r359455 r359453: flua: enable readline bits, courtesy of libedit This is a nicer experience when attempting to run ad-hoc lua bits in the flua REPL. r359455: flua: follow-up to r359453, don't bother with libedit in bootstrap The bootstrap flua should not be used for REPL-like activities; exclude it to save the dependency on libedit and not waste time with it. PR: 245121 Modified: stable/12/libexec/flua/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/flua/Makefile ============================================================================== --- stable/12/libexec/flua/Makefile Mon Apr 6 01:28:03 2020 (r359645) +++ stable/12/libexec/flua/Makefile Mon Apr 6 04:06:15 2020 (r359646) @@ -35,4 +35,12 @@ SRCS+= lfs.c lposix.c CFLAGS+= -I${.CURDIR} -I${.CURDIR}/modules -I${LUASRC} CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" +# readline bits; these aren't needed if we're building a bootstrap flua, as we +# don't expect that one to see any REPL usage. +.if !defined(BOOTSTRAPPING) +CFLAGS+= -DLUA_USE_READLINE +CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit +LIBADD+= edit +.endif + .include From owner-svn-src-stable-12@freebsd.org Mon Apr 6 06:34:46 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 758EF2A4543; Mon, 6 Apr 2020 06:34:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wgkZ1jmFz4ZMk; Mon, 6 Apr 2020 06:34:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1923823AAE; Mon, 6 Apr 2020 06:34:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0366Yjp2095893; Mon, 6 Apr 2020 06:34:45 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0366YjGR095890; Mon, 6 Apr 2020 06:34:45 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202004060634.0366YjGR095890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 6 Apr 2020 06:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359648 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 359648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 06:34:46 -0000 Author: ae Date: Mon Apr 6 06:34:45 2020 New Revision: 359648 URL: https://svnweb.freebsd.org/changeset/base/359648 Log: MFC r359271: Use IP_FW_NAT44_DESTROY opcode for IP_FW3 socket option to destroy NAT instance. The NAT44 group of opcodes for IP_FW3 socket option is modern way to control NAT instances and this method can be used in future to switch from numeric to named NAT instances, like was done for ipfw tables. The IP_FW_NAT_DEL opcode is the last remnant of old ipfw_ctl control plane that doesn't support versioned operations. This interface will be retired soon. Modified: stable/12/sbin/ipfw/ipfw2.c stable/12/sbin/ipfw/ipfw2.h stable/12/sbin/ipfw/nat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw2.c ============================================================================== --- stable/12/sbin/ipfw/ipfw2.c Mon Apr 6 05:48:58 2020 (r359647) +++ stable/12/sbin/ipfw/ipfw2.c Mon Apr 6 06:34:45 2020 (r359648) @@ -3328,13 +3328,7 @@ ipfw_delete(char *av[]) j = strtol(sep + 1, NULL, 10); av++; if (co.do_nat) { - exitval = do_cmd(IP_FW_NAT_DEL, &i, sizeof i); - if (exitval) { - exitval = EX_UNAVAILABLE; - if (co.do_quiet) - continue; - warn("nat %u not available", i); - } + exitval = ipfw_delete_nat(i); } else if (co.do_pipe) { exitval = ipfw_delete_pipe(co.do_pipe, i); } else { Modified: stable/12/sbin/ipfw/ipfw2.h ============================================================================== --- stable/12/sbin/ipfw/ipfw2.h Mon Apr 6 05:48:58 2020 (r359647) +++ stable/12/sbin/ipfw/ipfw2.h Mon Apr 6 06:34:45 2020 (r359648) @@ -386,6 +386,7 @@ extern int resvd_set_number; /* first-level command handlers */ void ipfw_add(char *av[]); void ipfw_show_nat(int ac, char **av); +int ipfw_delete_nat(int i); void ipfw_config_pipe(int ac, char **av); void ipfw_config_nat(int ac, char **av); void ipfw_sets_handler(char *av[]); Modified: stable/12/sbin/ipfw/nat.c ============================================================================== --- stable/12/sbin/ipfw/nat.c Mon Apr 6 05:48:58 2020 (r359647) +++ stable/12/sbin/ipfw/nat.c Mon Apr 6 06:34:45 2020 (r359648) @@ -931,6 +931,34 @@ ipfw_config_nat(int ac, char **av) } } +static void +nat_fill_ntlv(ipfw_obj_ntlv *ntlv, int i) +{ + + ntlv->head.type = IPFW_TLV_EACTION_NAME(1); /* it doesn't matter */ + ntlv->head.length = sizeof(ipfw_obj_ntlv); + ntlv->idx = 1; + ntlv->set = 0; /* not yet */ + snprintf(ntlv->name, sizeof(ntlv->name), "%d", i); +} + +int +ipfw_delete_nat(int i) +{ + ipfw_obj_header oh; + int ret; + + memset(&oh, 0, sizeof(oh)); + nat_fill_ntlv(&oh.ntlv, i); + ret = do_set3(IP_FW_NAT44_DESTROY, &oh.opheader, sizeof(oh)); + if (ret == -1) { + if (!co.do_quiet) + warn("nat %u not available", i); + return (EX_UNAVAILABLE); + } + return (EX_OK); +} + struct nat_list_arg { uint16_t cmd; int is_all; From owner-svn-src-stable-12@freebsd.org Mon Apr 6 07:07:27 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFABF2A5124; Mon, 6 Apr 2020 07:07:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48whSH4JW2z4bks; Mon, 6 Apr 2020 07:07:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ED0D2406B; Mon, 6 Apr 2020 07:07:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03677RXf014377; Mon, 6 Apr 2020 07:07:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03677Rh9014376; Mon, 6 Apr 2020 07:07:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004060707.03677Rh9014376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 6 Apr 2020 07:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359650 - stable/12/sys/fs/cuse X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/fs/cuse X-SVN-Commit-Revision: 359650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 07:07:27 -0000 Author: hselasky Date: Mon Apr 6 07:07:27 2020 New Revision: 359650 URL: https://svnweb.freebsd.org/changeset/base/359650 Log: MFC r359452: Fine grain locking inside the cuse(3) kernel module. Implement one mutex per cuse(3) server instance which also cover the clients belonging to the given server instance. This should significantly reduce the mutex congestion inside the cuse(3) kernel module when multiple servers are in use. Sponsored by: Mellanox Technologies Modified: stable/12/sys/fs/cuse/cuse.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/cuse/cuse.c ============================================================================== --- stable/12/sys/fs/cuse/cuse.c Mon Apr 6 06:38:54 2020 (r359649) +++ stable/12/sys/fs/cuse/cuse.c Mon Apr 6 07:07:27 2020 (r359650) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2010-2017 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2010-2020 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -114,6 +114,7 @@ struct cuse_server { TAILQ_HEAD(, cuse_server_dev) hdev; TAILQ_HEAD(, cuse_client) hcli; TAILQ_HEAD(, cuse_memory) hmem; + struct mtx mtx; struct cv cv; struct selinfo selinfo; pid_t pid; @@ -145,7 +146,7 @@ struct cuse_client { static MALLOC_DEFINE(M_CUSE, "cuse", "CUSE memory"); static TAILQ_HEAD(, cuse_server) cuse_server_head; -static struct mtx cuse_mtx; +static struct mtx cuse_global_mtx; static struct cdev *cuse_dev; static struct cuse_server *cuse_alloc_unit[CUSE_DEVICES_MAX]; static int cuse_alloc_unit_id[CUSE_DEVICES_MAX]; @@ -216,18 +217,30 @@ static void cuse_client_is_closing(struct cuse_client static int cuse_free_unit_by_id_locked(struct cuse_server *, int); static void -cuse_lock(void) +cuse_global_lock(void) { - mtx_lock(&cuse_mtx); + mtx_lock(&cuse_global_mtx); } static void -cuse_unlock(void) +cuse_global_unlock(void) { - mtx_unlock(&cuse_mtx); + mtx_unlock(&cuse_global_mtx); } static void +cuse_server_lock(struct cuse_server *pcs) +{ + mtx_lock(&pcs->mtx); +} + +static void +cuse_server_unlock(struct cuse_server *pcs) +{ + mtx_unlock(&pcs->mtx); +} + +static void cuse_cmd_lock(struct cuse_client_command *pccmd) { sx_xlock(&pccmd->sx); @@ -244,7 +257,7 @@ cuse_kern_init(void *arg) { TAILQ_INIT(&cuse_server_head); - mtx_init(&cuse_mtx, "cuse-mtx", NULL, MTX_DEF); + mtx_init(&cuse_global_mtx, "cuse-global-mtx", NULL, MTX_DEF); cuse_dev = make_dev(&cuse_server_devsw, 0, UID_ROOT, GID_OPERATOR, 0600, "cuse"); @@ -267,9 +280,9 @@ cuse_kern_uninit(void *arg) pause("DRAIN", 2 * hz); - cuse_lock(); + cuse_global_lock(); ptr = TAILQ_FIRST(&cuse_server_head); - cuse_unlock(); + cuse_global_unlock(); if (ptr == NULL) break; @@ -278,7 +291,7 @@ cuse_kern_uninit(void *arg) if (cuse_dev != NULL) destroy_dev(cuse_dev); - mtx_destroy(&cuse_mtx); + mtx_destroy(&cuse_global_mtx); } SYSUNINIT(cuse_kern_uninit, SI_SUB_DEVFS, SI_ORDER_ANY, cuse_kern_uninit, 0); @@ -293,14 +306,10 @@ cuse_server_get(struct cuse_server **ppcs) *ppcs = NULL; return (error); } - /* check if closing */ - cuse_lock(); if (pcs->is_closing) { - cuse_unlock(); *ppcs = NULL; return (EINVAL); } - cuse_unlock(); *ppcs = pcs; return (0); } @@ -426,14 +435,14 @@ cuse_server_alloc_memory(struct cuse_server *pcs, uint goto error_0; } - cuse_lock(); + cuse_server_lock(pcs); /* check if allocation number already exists */ TAILQ_FOREACH(temp, &pcs->hmem, entry) { if (temp->alloc_nr == alloc_nr) break; } if (temp != NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); error = EBUSY; goto error_1; } @@ -441,7 +450,7 @@ cuse_server_alloc_memory(struct cuse_server *pcs, uint mem->page_count = page_count; mem->alloc_nr = alloc_nr; TAILQ_INSERT_TAIL(&pcs->hmem, mem, entry); - cuse_unlock(); + cuse_server_unlock(pcs); return (0); @@ -457,17 +466,17 @@ cuse_server_free_memory(struct cuse_server *pcs, uint3 { struct cuse_memory *mem; - cuse_lock(); + cuse_server_lock(pcs); TAILQ_FOREACH(mem, &pcs->hmem, entry) { if (mem->alloc_nr == alloc_nr) break; } if (mem == NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); return (EINVAL); } TAILQ_REMOVE(&pcs->hmem, mem, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_vm_memory_free(mem); @@ -486,14 +495,10 @@ cuse_client_get(struct cuse_client **ppcc) *ppcc = NULL; return (error); } - /* check if closing */ - cuse_lock(); if (CUSE_CLIENT_CLOSING(pcc) || pcc->server->is_closing) { - cuse_unlock(); *ppcc = NULL; return (EINVAL); } - cuse_unlock(); *ppcc = pcc; return (0); } @@ -578,28 +583,28 @@ static int cuse_client_receive_command_locked(struct cuse_client_command *pccmd, uint8_t *arg_ptr, uint32_t arg_len) { + struct cuse_server *pcs; int error; + pcs = pccmd->client->server; error = 0; pccmd->proc_curr = curthread->td_proc; - if (CUSE_CLIENT_CLOSING(pccmd->client) || - pccmd->client->server->is_closing) { + if (CUSE_CLIENT_CLOSING(pccmd->client) || pcs->is_closing) { error = CUSE_ERR_OTHER; goto done; } while (pccmd->command == CUSE_CMD_NONE) { if (error != 0) { - cv_wait(&pccmd->cv, &cuse_mtx); + cv_wait(&pccmd->cv, &pcs->mtx); } else { - error = cv_wait_sig(&pccmd->cv, &cuse_mtx); + error = cv_wait_sig(&pccmd->cv, &pcs->mtx); if (error != 0) cuse_client_got_signal(pccmd); } - if (CUSE_CLIENT_CLOSING(pccmd->client) || - pccmd->client->server->is_closing) { + if (CUSE_CLIENT_CLOSING(pccmd->client) || pcs->is_closing) { error = CUSE_ERR_OTHER; goto done; } @@ -616,7 +621,7 @@ done: pccmd->proc_curr = NULL; while (pccmd->proc_refs != 0) - cv_wait(&pccmd->cv, &cuse_mtx); + cv_wait(&pccmd->cv, &pcs->mtx); return (error); } @@ -635,7 +640,7 @@ cuse_server_free_dev(struct cuse_server_dev *pcsd) pcs = pcsd->server; /* prevent creation of more devices */ - cuse_lock(); + cuse_server_lock(pcs); if (pcsd->kern_dev != NULL) pcsd->kern_dev->si_drv1 = NULL; @@ -643,7 +648,7 @@ cuse_server_free_dev(struct cuse_server_dev *pcsd) if (pcc->server_dev == pcsd) cuse_client_is_closing(pcc); } - cuse_unlock(); + cuse_server_unlock(pcs); /* destroy device, if any */ if (pcsd->kern_dev != NULL) { @@ -659,43 +664,46 @@ cuse_server_unref(struct cuse_server *pcs) struct cuse_server_dev *pcsd; struct cuse_memory *mem; - cuse_lock(); - pcs->refs--; - if (pcs->refs != 0) { - cuse_unlock(); + cuse_server_lock(pcs); + if (--(pcs->refs) != 0) { + cuse_server_unlock(pcs); return; } cuse_server_is_closing(pcs); /* final client wakeup, if any */ cuse_server_wakeup_all_client_locked(pcs); + cuse_global_lock(); TAILQ_REMOVE(&cuse_server_head, pcs, entry); + cuse_global_unlock(); while ((pcsd = TAILQ_FIRST(&pcs->hdev)) != NULL) { TAILQ_REMOVE(&pcs->hdev, pcsd, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_server_free_dev(pcsd); - cuse_lock(); + cuse_server_lock(pcs); } cuse_free_unit_by_id_locked(pcs, -1); while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) { TAILQ_REMOVE(&pcs->hmem, mem, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_vm_memory_free(mem); - cuse_lock(); + cuse_server_lock(pcs); } knlist_clear(&pcs->selinfo.si_note, 1); knlist_destroy(&pcs->selinfo.si_note); - cuse_unlock(); + cuse_server_unlock(pcs); seldrain(&pcs->selinfo); cv_destroy(&pcs->cv); + mtx_destroy(&pcs->mtx); + free(pcs, M_CUSE); } @@ -704,7 +712,7 @@ cuse_server_do_close(struct cuse_server *pcs) { int retval; - cuse_lock(); + cuse_server_lock(pcs); cuse_server_is_closing(pcs); /* final client wakeup, if any */ cuse_server_wakeup_all_client_locked(pcs); @@ -712,7 +720,7 @@ cuse_server_do_close(struct cuse_server *pcs) knlist_clear(&pcs->selinfo.si_note, 1); retval = pcs->refs; - cuse_unlock(); + cuse_server_unlock(pcs); return (retval); } @@ -758,12 +766,14 @@ cuse_server_open(struct cdev *dev, int fflags, int dev cv_init(&pcs->cv, "cuse-server-cv"); - knlist_init_mtx(&pcs->selinfo.si_note, &cuse_mtx); + mtx_init(&pcs->mtx, "cuse-server-mtx", NULL, MTX_DEF); - cuse_lock(); + knlist_init_mtx(&pcs->selinfo.si_note, &pcs->mtx); + + cuse_global_lock(); pcs->refs++; TAILQ_INSERT_TAIL(&cuse_server_head, pcs, entry); - cuse_unlock(); + cuse_global_unlock(); return (0); } @@ -792,7 +802,8 @@ cuse_server_write(struct cdev *dev, struct uio *uio, i } static int -cuse_server_ioctl_copy_locked(struct cuse_client_command *pccmd, +cuse_server_ioctl_copy_locked(struct cuse_server *pcs, + struct cuse_client_command *pccmd, struct cuse_data_chunk *pchk, int isread) { struct proc *p_proc; @@ -819,7 +830,7 @@ cuse_server_ioctl_copy_locked(struct cuse_client_comma pccmd->proc_refs++; - cuse_unlock(); + cuse_server_unlock(pcs); if (isread == 0) { error = copyin( @@ -833,7 +844,7 @@ cuse_server_ioctl_copy_locked(struct cuse_client_comma pchk->length); } - cuse_lock(); + cuse_server_lock(pcs); pccmd->proc_refs--; @@ -898,7 +909,8 @@ cuse_proc2proc_copy(struct proc *proc_s, vm_offset_t d } static int -cuse_server_data_copy_locked(struct cuse_client_command *pccmd, +cuse_server_data_copy_locked(struct cuse_server *pcs, + struct cuse_client_command *pccmd, struct cuse_data_chunk *pchk, int isread) { struct proc *p_proc; @@ -913,7 +925,7 @@ cuse_server_data_copy_locked(struct cuse_client_comman pccmd->proc_refs++; - cuse_unlock(); + cuse_server_unlock(pcs); if (isread == 0) { error = cuse_proc2proc_copy( @@ -927,7 +939,7 @@ cuse_server_data_copy_locked(struct cuse_client_comman pchk->length); } - cuse_lock(); + cuse_server_lock(pcs); pccmd->proc_refs--; @@ -1031,16 +1043,16 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, case CUSE_IOCTL_GET_COMMAND: pcmd = (void *)data; - cuse_lock(); + cuse_server_lock(pcs); while ((pccmd = TAILQ_FIRST(&pcs->head)) == NULL) { - error = cv_wait_sig(&pcs->cv, &cuse_mtx); + error = cv_wait_sig(&pcs->cv, &pcs->mtx); if (pcs->is_closing) error = ENXIO; if (error) { - cuse_unlock(); + cuse_server_unlock(pcs); return (error); } } @@ -1052,13 +1064,13 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, *pcmd = pccmd->sub; - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_SYNC_COMMAND: - cuse_lock(); + cuse_server_lock(pcs); while ((pccmd = cuse_server_find_command(pcs, curthread)) != NULL) { /* send sync command */ @@ -1069,16 +1081,16 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, /* signal peer, if any */ cv_signal(&pccmd->cv); } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_ALLOC_UNIT: - cuse_lock(); + cuse_server_lock(pcs); n = cuse_alloc_unit_by_id_locked(pcs, CUSE_ID_DEFAULT(0)); - cuse_unlock(); + cuse_server_unlock(pcs); if (n < 0) error = ENOMEM; @@ -1092,9 +1104,9 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, n = (n & CUSE_ID_MASK); - cuse_lock(); + cuse_server_lock(pcs); n = cuse_alloc_unit_by_id_locked(pcs, n); - cuse_unlock(); + cuse_server_unlock(pcs); if (n < 0) error = ENOMEM; @@ -1108,18 +1120,18 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, n = CUSE_ID_DEFAULT(n); - cuse_lock(); + cuse_server_lock(pcs); error = cuse_free_unit_by_id_locked(pcs, n); - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_FREE_UNIT_BY_ID: n = *(int *)data; - cuse_lock(); + cuse_server_lock(pcs); error = cuse_free_unit_by_id_locked(pcs, n); - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_ALLOC_MEMORY: @@ -1150,7 +1162,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, case CUSE_IOCTL_GET_SIG: - cuse_lock(); + cuse_server_lock(pcs); pccmd = cuse_server_find_command(pcs, curthread); if (pccmd != NULL) { @@ -1159,7 +1171,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } else { n = 0; } - cuse_unlock(); + cuse_server_unlock(pcs); *(int *)data = n; @@ -1167,7 +1179,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, case CUSE_IOCTL_SET_PFH: - cuse_lock(); + cuse_server_lock(pcs); pccmd = cuse_server_find_command(pcs, curthread); if (pccmd != NULL) { @@ -1178,7 +1190,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } else { error = ENXIO; } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_CREATE_DEV: @@ -1224,9 +1236,9 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } pcsd->kern_dev->si_drv1 = pcsd; - cuse_lock(); + cuse_server_lock(pcs); TAILQ_INSERT_TAIL(&pcs->hdev, pcsd, entry); - cuse_unlock(); + cuse_server_unlock(pcs); break; @@ -1236,7 +1248,7 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, if (error) break; - cuse_lock(); + cuse_server_lock(pcs); error = EINVAL; @@ -1244,9 +1256,9 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, while (pcsd != NULL) { if (pcsd->user_dev == *(struct cuse_dev **)data) { TAILQ_REMOVE(&pcs->hdev, pcsd, entry); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_server_free_dev(pcsd); - cuse_lock(); + cuse_server_lock(pcs); error = 0; pcsd = TAILQ_FIRST(&pcs->hdev); } else { @@ -1254,13 +1266,13 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_WRITE_DATA: case CUSE_IOCTL_READ_DATA: - cuse_lock(); + cuse_server_lock(pcs); pchk = (struct cuse_data_chunk *)data; pccmd = cuse_server_find_command(pcs, curthread); @@ -1270,23 +1282,23 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, } else if (pchk->peer_ptr < CUSE_BUF_MIN_PTR) { error = EFAULT; /* NULL pointer */ } else if (pchk->peer_ptr < CUSE_BUF_MAX_PTR) { - error = cuse_server_ioctl_copy_locked(pccmd, + error = cuse_server_ioctl_copy_locked(pcs, pccmd, pchk, cmd == CUSE_IOCTL_READ_DATA); } else { - error = cuse_server_data_copy_locked(pccmd, + error = cuse_server_data_copy_locked(pcs, pccmd, pchk, cmd == CUSE_IOCTL_READ_DATA); } - cuse_unlock(); + cuse_server_unlock(pcs); break; case CUSE_IOCTL_SELWAKEUP: - cuse_lock(); + cuse_server_lock(pcs); /* * We don't know which direction caused the event. * Wakeup both! */ cuse_server_wakeup_all_client_locked(pcs); - cuse_unlock(); + cuse_server_unlock(pcs); break; default: @@ -1317,31 +1329,31 @@ cuse_server_mmap_single(struct cdev *dev, vm_ooffset_t if (error != 0) return (error); - cuse_lock(); + cuse_server_lock(pcs); /* lookup memory structure */ TAILQ_FOREACH(mem, &pcs->hmem, entry) { if (mem->alloc_nr == alloc_nr) break; } if (mem == NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENOMEM); } /* verify page offset */ page_nr %= CUSE_ALLOC_PAGES_MAX; if (page_nr >= mem->page_count) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENXIO); } /* verify mmap size */ if ((size % PAGE_SIZE) != 0 || (size < PAGE_SIZE) || (size > ((mem->page_count - page_nr) * PAGE_SIZE))) { - cuse_unlock(); + cuse_server_unlock(pcs); return (EINVAL); } vm_object_reference(mem->object); *object = mem->object; - cuse_unlock(); + cuse_server_unlock(pcs); /* set new VM object offset to use */ *offset = page_nr * PAGE_SIZE; @@ -1361,10 +1373,12 @@ cuse_client_free(void *arg) struct cuse_server *pcs; int n; - cuse_lock(); + pcs = pcc->server; + + cuse_server_lock(pcs); cuse_client_is_closing(pcc); - TAILQ_REMOVE(&pcc->server->hcli, pcc, entry); - cuse_unlock(); + TAILQ_REMOVE(&pcs->hcli, pcc, entry); + cuse_server_unlock(pcs); for (n = 0; n != CUSE_CMD_MAX; n++) { @@ -1374,8 +1388,6 @@ cuse_client_free(void *arg) cv_destroy(&pccmd->cv); } - pcs = pcc->server; - free(pcc, M_CUSE); /* drop reference on server */ @@ -1393,11 +1405,12 @@ cuse_client_open(struct cdev *dev, int fflags, int dev int error; int n; - cuse_lock(); pcsd = dev->si_drv1; if (pcsd != NULL) { pcs = pcsd->server; pcd = pcsd->user_dev; + + cuse_server_lock(pcs); /* * Check that the refcount didn't wrap and that the * same process is not both client and server. This @@ -1408,17 +1421,14 @@ cuse_client_open(struct cdev *dev, int fflags, int dev if (pcs->refs < 0 || pcs->pid == curproc->p_pid) { /* overflow or wrong PID */ pcs->refs--; - pcsd = NULL; + cuse_server_unlock(pcs); + return (EINVAL); } + cuse_server_unlock(pcs); } else { - pcs = NULL; - pcd = NULL; + return (EINVAL); } - cuse_unlock(); - if (pcsd == NULL) - return (EINVAL); - pcc = malloc(sizeof(*pcc), M_CUSE, M_WAITOK | M_ZERO); if (pcc == NULL) { /* drop reference on server */ @@ -1448,7 +1458,7 @@ cuse_client_open(struct cdev *dev, int fflags, int dev cv_init(&pccmd->cv, "cuse-client-cv"); } - cuse_lock(); + cuse_server_lock(pcs); /* cuse_client_free() assumes that the client is listed somewhere! */ /* always enqueue */ @@ -1461,7 +1471,7 @@ cuse_client_open(struct cdev *dev, int fflags, int dev } else { error = 0; } - cuse_unlock(); + cuse_server_unlock(pcs); if (error) { devfs_clear_cdevpriv(); /* XXX bugfix */ @@ -1471,11 +1481,11 @@ cuse_client_open(struct cdev *dev, int fflags, int dev cuse_cmd_lock(pccmd); - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, 0, 0, pcc->fflags, 0); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1496,6 +1506,7 @@ cuse_client_close(struct cdev *dev, int fflag, int dev { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; error = cuse_client_get(&pcc); @@ -1503,20 +1514,18 @@ cuse_client_close(struct cdev *dev, int fflag, int dev return (0); pccmd = &pcc->cmds[CUSE_CMD_CLOSE]; + pcs = pcc->server; cuse_cmd_lock(pccmd); - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, 0, 0, pcc->fflags, 0); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); - cuse_cmd_unlock(pccmd); - cuse_lock(); cuse_client_is_closing(pcc); - cuse_unlock(); + cuse_server_unlock(pcs); return (0); } @@ -1524,21 +1533,22 @@ cuse_client_close(struct cdev *dev, int fflag, int dev static void cuse_client_kqfilter_poll(struct cdev *dev, struct cuse_client *pcc) { + struct cuse_server *pcs = pcc->server; int temp; - cuse_lock(); + cuse_server_lock(pcs); temp = (pcc->cflags & (CUSE_CLI_KNOTE_HAS_READ | CUSE_CLI_KNOTE_HAS_WRITE)); pcc->cflags &= ~(CUSE_CLI_KNOTE_NEED_READ | CUSE_CLI_KNOTE_NEED_WRITE); - cuse_unlock(); + cuse_server_unlock(pcs); if (temp != 0) { /* get the latest polling state from the server */ temp = cuse_client_poll(dev, POLLIN | POLLOUT, NULL); if (temp & (POLLIN | POLLOUT)) { - cuse_lock(); + cuse_server_lock(pcs); if (temp & POLLIN) pcc->cflags |= CUSE_CLI_KNOTE_NEED_READ; if (temp & POLLOUT) @@ -1546,7 +1556,7 @@ cuse_client_kqfilter_poll(struct cdev *dev, struct cus /* make sure the "knote" gets woken up */ cuse_server_wakeup_locked(pcc->server); - cuse_unlock(); + cuse_server_unlock(pcs); } } } @@ -1556,6 +1566,7 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; int len; @@ -1564,6 +1575,7 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in return (error); pccmd = &pcc->cmds[CUSE_CMD_READ]; + pcs = pcc->server; if (uio->uio_segflg != UIO_USERSPACE) { return (EINVAL); @@ -1580,13 +1592,13 @@ cuse_client_read(struct cdev *dev, struct uio *uio, in } len = uio->uio_iov->iov_len; - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, (uintptr_t)uio->uio_iov->iov_base, (unsigned long)(unsigned int)len, pcc->fflags, ioflag); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1615,6 +1627,7 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; int len; @@ -1623,6 +1636,7 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i return (error); pccmd = &pcc->cmds[CUSE_CMD_WRITE]; + pcs = pcc->server; if (uio->uio_segflg != UIO_USERSPACE) { return (EINVAL); @@ -1639,13 +1653,13 @@ cuse_client_write(struct cdev *dev, struct uio *uio, i } len = uio->uio_iov->iov_len; - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, (uintptr_t)uio->uio_iov->iov_base, (unsigned long)(unsigned int)len, pcc->fflags, ioflag); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1675,6 +1689,7 @@ cuse_client_ioctl(struct cdev *dev, unsigned long cmd, { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; int error; int len; @@ -1687,6 +1702,7 @@ cuse_client_ioctl(struct cdev *dev, unsigned long cmd, return (ENOMEM); pccmd = &pcc->cmds[CUSE_CMD_IOCTL]; + pcs = pcc->server; cuse_cmd_lock(pccmd); @@ -1699,14 +1715,14 @@ cuse_client_ioctl(struct cdev *dev, unsigned long cmd, * is forwarded to the driver. */ - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, (len == 0) ? *(long *)data : CUSE_BUF_MIN_PTR, (unsigned long)cmd, pcc->fflags, (fflag & O_NONBLOCK) ? IO_NDELAY : 0); error = cuse_client_receive_command_locked(pccmd, data, len); - cuse_unlock(); + cuse_server_unlock(pcs); if (error < 0) { error = cuse_convert_error(error); @@ -1730,6 +1746,7 @@ cuse_client_poll(struct cdev *dev, int events, struct { struct cuse_client_command *pccmd; struct cuse_client *pcc; + struct cuse_server *pcs; unsigned long temp; int error; int revents; @@ -1739,6 +1756,7 @@ cuse_client_poll(struct cdev *dev, int events, struct goto pollnval; temp = 0; + pcs = pcc->server; if (events & (POLLPRI | POLLIN | POLLRDNORM)) temp |= CUSE_POLL_READ; @@ -1755,14 +1773,14 @@ cuse_client_poll(struct cdev *dev, int events, struct /* Need to selrecord() first to not loose any events. */ if (temp != 0 && td != NULL) - selrecord(td, &pcc->server->selinfo); + selrecord(td, &pcs->selinfo); - cuse_lock(); + cuse_server_lock(pcs); cuse_client_send_command_locked(pccmd, 0, temp, pcc->fflags, IO_NDELAY); error = cuse_client_receive_command_locked(pccmd, 0, 0); - cuse_unlock(); + cuse_server_unlock(pcs); cuse_cmd_unlock(pccmd); @@ -1793,37 +1811,40 @@ cuse_client_mmap_single(struct cdev *dev, vm_ooffset_t uint32_t alloc_nr = page_nr / CUSE_ALLOC_PAGES_MAX; struct cuse_memory *mem; struct cuse_client *pcc; + struct cuse_server *pcs; int error; error = cuse_client_get(&pcc); if (error != 0) return (error); - cuse_lock(); + pcs = pcc->server; + + cuse_server_lock(pcs); /* lookup memory structure */ - TAILQ_FOREACH(mem, &pcc->server->hmem, entry) { + TAILQ_FOREACH(mem, &pcs->hmem, entry) { if (mem->alloc_nr == alloc_nr) break; } if (mem == NULL) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENOMEM); } /* verify page offset */ page_nr %= CUSE_ALLOC_PAGES_MAX; if (page_nr >= mem->page_count) { - cuse_unlock(); + cuse_server_unlock(pcs); return (ENXIO); } /* verify mmap size */ if ((size % PAGE_SIZE) != 0 || (size < PAGE_SIZE) || (size > ((mem->page_count - page_nr) * PAGE_SIZE))) { - cuse_unlock(); + cuse_server_unlock(pcs); return (EINVAL); } vm_object_reference(mem->object); *object = mem->object; - cuse_unlock(); + cuse_server_unlock(pcs); /* set new VM object offset to use */ *offset = page_nr * PAGE_SIZE; @@ -1836,22 +1857,28 @@ static void cuse_client_kqfilter_read_detach(struct knote *kn) { struct cuse_client *pcc; + struct cuse_server *pcs; - cuse_lock(); pcc = kn->kn_hook; - knlist_remove(&pcc->server->selinfo.si_note, kn, 1); - cuse_unlock(); + pcs = pcc->server; + + cuse_server_lock(pcs); + knlist_remove(&pcs->selinfo.si_note, kn, 1); + cuse_server_unlock(pcs); } static void cuse_client_kqfilter_write_detach(struct knote *kn) { struct cuse_client *pcc; + struct cuse_server *pcs; - cuse_lock(); pcc = kn->kn_hook; - knlist_remove(&pcc->server->selinfo.si_note, kn, 1); - cuse_unlock(); + pcs = pcc->server; + + cuse_server_lock(pcs); + knlist_remove(&pcs->selinfo.si_note, kn, 1); + cuse_server_unlock(pcs); } static int @@ -1859,9 +1886,10 @@ cuse_client_kqfilter_read_event(struct knote *kn, long { struct cuse_client *pcc; - mtx_assert(&cuse_mtx, MA_OWNED); - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Mon Apr 6 14:56:20 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1472F2B25E9; Mon, 6 Apr 2020 14:56:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wtsH6dYfz49cw; Mon, 6 Apr 2020 14:56:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF04029B79; Mon, 6 Apr 2020 14:56:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036EuJvJ099295; Mon, 6 Apr 2020 14:56:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036EuJSS099294; Mon, 6 Apr 2020 14:56:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004061456.036EuJSS099294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Apr 2020 14:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359658 - stable/12/usr.bin/top X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/top X-SVN-Commit-Revision: 359658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 14:56:20 -0000 Author: markj Date: Mon Apr 6 14:56:19 2020 New Revision: 359658 URL: https://svnweb.freebsd.org/changeset/base/359658 Log: MFC r359594, r359597: Fix the description of the -m flag in top.1. PR: 244153 Modified: stable/12/usr.bin/top/top.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/top/top.1 ============================================================================== --- stable/12/usr.bin/top/top.1 Mon Apr 6 13:58:13 2020 (r359657) +++ stable/12/usr.bin/top/top.1 Mon Apr 6 14:56:19 2020 (r359658) @@ -100,7 +100,7 @@ Toggle displaying thread ID (tid) instead of process i Do not display the .Nm process itself. -.It Fl display +.It Fl m Ar display Display either 'cpu' or 'io' statistics. Default is 'cpu'. .It Fl n From owner-svn-src-stable-12@freebsd.org Mon Apr 6 14:58:25 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 287AC2B26B6; Mon, 6 Apr 2020 14:58:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wtvj0F4Gz49qx; Mon, 6 Apr 2020 14:58:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0359629B8D; Mon, 6 Apr 2020 14:58:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036EwOUC099467; Mon, 6 Apr 2020 14:58:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036EwOdp099466; Mon, 6 Apr 2020 14:58:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004061458.036EwOdp099466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Apr 2020 14:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359659 - stable/12/sys/dev/hwpmc X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/hwpmc X-SVN-Commit-Revision: 359659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 14:58:25 -0000 Author: markj Date: Mon Apr 6 14:58:24 2020 New Revision: 359659 URL: https://svnweb.freebsd.org/changeset/base/359659 Log: MFC r359437: Fix accounting of hwpmc's thread descriptor freelist. Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_mod.c Mon Apr 6 14:56:19 2020 (r359658) +++ stable/12/sys/dev/hwpmc/hwpmc_mod.c Mon Apr 6 14:58:24 2020 (r359659) @@ -2426,12 +2426,13 @@ pmc_thread_descriptor_pool_free_task(void *arg __unuse int delta; LIST_INIT(&tmplist); + /* Determine what changes, if any, we need to make. */ mtx_lock_spin(&pmc_threadfreelist_mtx); delta = pmc_threadfreelist_entries - pmc_threadfreelist_max; - while (delta > 0 && - (pt = LIST_FIRST(&pmc_threadfreelist)) != NULL) { + while (delta > 0 && (pt = LIST_FIRST(&pmc_threadfreelist)) != NULL) { delta--; + pmc_threadfreelist_entries--; LIST_REMOVE(pt, pt_next); LIST_INSERT_HEAD(&tmplist, pt, pt_next); } From owner-svn-src-stable-12@freebsd.org Mon Apr 6 18:45:05 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4A5D2B7E54; Mon, 6 Apr 2020 18:45:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wzxF4lgnz4S9T; Mon, 6 Apr 2020 18:45:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99E832C8F3; Mon, 6 Apr 2020 18:45:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036Ij5dc044343; Mon, 6 Apr 2020 18:45:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036Ij57b044342; Mon, 6 Apr 2020 18:45:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004061845.036Ij57b044342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 6 Apr 2020 18:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359663 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 359663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 18:45:05 -0000 Author: kib Date: Mon Apr 6 18:45:05 2020 New Revision: 359663 URL: https://svnweb.freebsd.org/changeset/base/359663 Log: MFC r359463: kern_sendfile.c style: order headers alphabetically. Modified: stable/12/sys/kern/kern_sendfile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sendfile.c ============================================================================== --- stable/12/sys/kern/kern_sendfile.c Mon Apr 6 18:42:01 2020 (r359662) +++ stable/12/sys/kern/kern_sendfile.c Mon Apr 6 18:45:05 2020 (r359663) @@ -36,12 +36,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include +#include #include #include #include @@ -49,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-stable-12@freebsd.org Mon Apr 6 18:47:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FA092B7EFA; Mon, 6 Apr 2020 18:47:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48wzzm2Nbpz4SSZ; Mon, 6 Apr 2020 18:47:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A4D42C8F8; Mon, 6 Apr 2020 18:47:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036IlGEi044496; Mon, 6 Apr 2020 18:47:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036IlGFH044495; Mon, 6 Apr 2020 18:47:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004061847.036IlGFH044495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 6 Apr 2020 18:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359664 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 359664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 18:47:16 -0000 Author: kib Date: Mon Apr 6 18:47:15 2020 New Revision: 359664 URL: https://svnweb.freebsd.org/changeset/base/359664 Log: MFC r359464: buffer pager: skip bogus pages. PR: 244713 Modified: stable/12/sys/kern/vfs_bio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_bio.c ============================================================================== --- stable/12/sys/kern/vfs_bio.c Mon Apr 6 18:45:05 2020 (r359663) +++ stable/12/sys/kern/vfs_bio.c Mon Apr 6 18:47:15 2020 (r359664) @@ -5185,13 +5185,17 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int != 0) ? GB_UNMAPPED : 0; VM_OBJECT_WLOCK(object); again: - for (i = 0; i < count; i++) - vm_page_busy_downgrade(ma[i]); + for (i = 0; i < count; i++) { + if (ma[i] != bogus_page) + vm_page_busy_downgrade(ma[i]); + } VM_OBJECT_WUNLOCK(object); lbnp = -1; for (i = 0; i < count; i++) { m = ma[i]; + if (m == bogus_page) + continue; /* * Pages are shared busy and the object lock is not @@ -5263,6 +5267,8 @@ end_pages: VM_OBJECT_WLOCK(object); redo = false; for (i = 0; i < count; i++) { + if (ma[i] == bogus_page) + continue; vm_page_sunbusy(ma[i]); ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); From owner-svn-src-stable-12@freebsd.org Mon Apr 6 18:48:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5032C27802E; Mon, 6 Apr 2020 18:48:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48x01h1Q2hz4Sdr; Mon, 6 Apr 2020 18:48:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BC122C903; Mon, 6 Apr 2020 18:48:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036ImuHG044644; Mon, 6 Apr 2020 18:48:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036Imtph044642; Mon, 6 Apr 2020 18:48:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004061848.036Imtph044642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 6 Apr 2020 18:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359665 - in stable/12/sys: kern ufs/ffs vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: kern ufs/ffs vm X-SVN-Commit-Revision: 359665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 18:48:56 -0000 Author: kib Date: Mon Apr 6 18:48:55 2020 New Revision: 359665 URL: https://svnweb.freebsd.org/changeset/base/359665 Log: MFC r359466: VOP_GETPAGES_ASYNC(): consistently call iodone() callback in case of error. Modified: stable/12/sys/kern/vfs_default.c stable/12/sys/ufs/ffs/ffs_vnops.c stable/12/sys/vm/vnode_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_default.c ============================================================================== --- stable/12/sys/kern/vfs_default.c Mon Apr 6 18:47:15 2020 (r359664) +++ stable/12/sys/kern/vfs_default.c Mon Apr 6 18:48:55 2020 (r359665) @@ -682,7 +682,8 @@ vop_stdgetpages_async(struct vop_getpages_async_args * error = VOP_GETPAGES(ap->a_vp, ap->a_m, ap->a_count, ap->a_rbehind, ap->a_rahead); - ap->a_iodone(ap->a_arg, ap->a_m, ap->a_count, error); + if (ap->a_iodone != NULL) + ap->a_iodone(ap->a_arg, ap->a_m, ap->a_count, error); return (error); } Modified: stable/12/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_vnops.c Mon Apr 6 18:47:15 2020 (r359664) +++ stable/12/sys/ufs/ffs/ffs_vnops.c Mon Apr 6 18:48:55 2020 (r359665) @@ -1749,18 +1749,25 @@ ffs_getpages_async(struct vop_getpages_async_args *ap) { struct vnode *vp; struct ufsmount *um; + bool do_iodone; int error; vp = ap->a_vp; um = VFSTOUFS(vp->v_mount); + do_iodone = true; - if (um->um_devvp->v_bufobj.bo_bsize <= PAGE_SIZE) - return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, - ap->a_rbehind, ap->a_rahead, ap->a_iodone, ap->a_arg)); - - error = vfs_bio_getpages(vp, ap->a_m, ap->a_count, ap->a_rbehind, - ap->a_rahead, ffs_gbp_getblkno, ffs_gbp_getblksz); - ap->a_iodone(ap->a_arg, ap->a_m, ap->a_count, error); + if (um->um_devvp->v_bufobj.bo_bsize <= PAGE_SIZE) { + error = vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, ap->a_iodone, ap->a_arg); + if (error == 0) + do_iodone = false; + } else { + error = vfs_bio_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, ffs_gbp_getblkno, + ffs_gbp_getblksz); + } + if (do_iodone && ap->a_iodone != NULL) + ap->a_iodone(ap->a_arg, ap->a_m, ap->a_count, error); return (error); } Modified: stable/12/sys/vm/vnode_pager.c ============================================================================== --- stable/12/sys/vm/vnode_pager.c Mon Apr 6 18:47:15 2020 (r359664) +++ stable/12/sys/vm/vnode_pager.c Mon Apr 6 18:48:55 2020 (r359665) @@ -767,9 +767,13 @@ vnode_pager_local_getpages(struct vop_getpages_args *a int vnode_pager_local_getpages_async(struct vop_getpages_async_args *ap) { + int error; - return (vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, - ap->a_rbehind, ap->a_rahead, ap->a_iodone, ap->a_arg)); + error = vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, ap->a_iodone, ap->a_arg); + if (error != 0 && ap->a_iodone != NULL) + ap->a_iodone(ap->a_arg, ap->a_m, ap->a_count, error); + return (error); } /* From owner-svn-src-stable-12@freebsd.org Mon Apr 6 18:52:41 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16EF32782E8; Mon, 6 Apr 2020 18:52:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48x0606tVfz4T5n; Mon, 6 Apr 2020 18:52:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E77EA2CAF0; Mon, 6 Apr 2020 18:52:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036Iqe3S050567; Mon, 6 Apr 2020 18:52:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036IqeBv050566; Mon, 6 Apr 2020 18:52:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004061852.036IqeBv050566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 6 Apr 2020 18:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359666 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 359666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 18:52:41 -0000 Author: kib Date: Mon Apr 6 18:52:40 2020 New Revision: 359666 URL: https://svnweb.freebsd.org/changeset/base/359666 Log: MFC r359468: kern_sendfile.c: add specific malloc type. Modified: stable/12/sys/kern/kern_sendfile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sendfile.c ============================================================================== --- stable/12/sys/kern/kern_sendfile.c Mon Apr 6 18:48:55 2020 (r359665) +++ stable/12/sys/kern/kern_sendfile.c Mon Apr 6 18:52:40 2020 (r359666) @@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$"); #include #include +static MALLOC_DEFINE(M_SENDFILE, "sendfile", "sendfile dynamic memory"); + #define EXT_FLAG_SYNC EXT_FLAG_VENDOR1 #define EXT_FLAG_NOCACHE EXT_FLAG_VENDOR2 @@ -255,7 +257,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i SOCK_LOCK(so); sorele(so); CURVNET_RESTORE(); - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); } /* @@ -530,7 +532,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h SFSTAT_ADD(sf_rhpages_requested, SF_READAHEAD(flags)); if (flags & SF_SYNC) { - sfs = malloc(sizeof *sfs, M_TEMP, M_WAITOK | M_ZERO); + sfs = malloc(sizeof(*sfs), M_SENDFILE, M_WAITOK | M_ZERO); mtx_init(&sfs->mtx, "sendfile", NULL, MTX_DEF); cv_init(&sfs->cv, "sendfile"); } @@ -695,7 +697,7 @@ retry_space: npages, rhpages); sfio = malloc(sizeof(struct sf_io) + - npages * sizeof(vm_page_t), M_TEMP, M_WAITOK); + npages * sizeof(vm_page_t), M_SENDFILE, M_WAITOK); refcount_init(&sfio->nios, 1); sfio->so = so; sfio->error = 0; @@ -705,7 +707,7 @@ retry_space: if (error != 0) { if (vp != NULL) VOP_UNLOCK(vp, 0); - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); goto done; } @@ -817,7 +819,7 @@ prepend_header: if (m == NULL) { KASSERT(softerr, ("%s: m NULL, no error", __func__)); error = softerr; - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); goto done; } @@ -834,7 +836,7 @@ prepend_header: * we can send data right now without the * PRUS_NOTREADY flag. */ - free(sfio, M_TEMP); + free(sfio, M_SENDFILE); error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, td); } else { @@ -898,7 +900,7 @@ out: KASSERT(sfs->count == 0, ("sendfile sync still busy")); cv_destroy(&sfs->cv); mtx_destroy(&sfs->mtx); - free(sfs, M_TEMP); + free(sfs, M_SENDFILE); } if (error == ERESTART) From owner-svn-src-stable-12@freebsd.org Mon Apr 6 22:12:43 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53B7227DA55; Mon, 6 Apr 2020 22:12:43 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48x4Xq1WNgz4g2f; Mon, 6 Apr 2020 22:12:43 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F28E2F19D; Mon, 6 Apr 2020 22:12:43 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 036MChcn072147; Mon, 6 Apr 2020 22:12:43 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 036MCht3072146; Mon, 6 Apr 2020 22:12:43 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <202004062212.036MCht3072146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 6 Apr 2020 22:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359669 - stable/12/sys/ufs/ufs X-SVN-Group: stable-12 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/12/sys/ufs/ufs X-SVN-Commit-Revision: 359669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 22:12:43 -0000 Author: mckusick Date: Mon Apr 6 22:12:42 2020 New Revision: 359669 URL: https://svnweb.freebsd.org/changeset/base/359669 Log: MFC of 359612 Use proper boolean expressions for soft update macros. Sponsored by: Netflix Modified: stable/12/sys/ufs/ufs/inode.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ufs/ufs/inode.h ============================================================================== --- stable/12/sys/ufs/ufs/inode.h Mon Apr 6 20:23:47 2020 (r359668) +++ stable/12/sys/ufs/ufs/inode.h Mon Apr 6 22:12:42 2020 (r359669) @@ -192,10 +192,11 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) -#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) -#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) -#define MOUNTEDSUJ(mp) ((mp)->mnt_flag & MNT_SUJ) +#define DOINGSOFTDEP(vp) \ + (((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) +#define MOUNTEDSOFTDEP(mp) (((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) +#define DOINGSUJ(vp) (((vp)->v_mount->mnt_flag & MNT_SUJ) != 0) +#define MOUNTEDSUJ(mp) (((mp)->mnt_flag & MNT_SUJ) != 0) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-svn-src-stable-12@freebsd.org Tue Apr 7 16:15:35 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF6DE273EDB; Tue, 7 Apr 2020 16:15:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xXZH4lLvz3NPH; Tue, 7 Apr 2020 16:15:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E2A8C7EF; Tue, 7 Apr 2020 16:15:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GFZZ0035402; Tue, 7 Apr 2020 16:15:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GFZHi035401; Tue, 7 Apr 2020 16:15:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004071615.037GFZHi035401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 7 Apr 2020 16:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359692 - stable/12/usr.sbin/newsyslog X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.sbin/newsyslog X-SVN-Commit-Revision: 359692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:15:35 -0000 Author: markj Date: Tue Apr 7 16:15:35 2020 New Revision: 359692 URL: https://svnweb.freebsd.org/changeset/base/359692 Log: MFC r359276: newsyslog: Fix stack corruption when initializing a zipwork structure. Modified: stable/12/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/12/usr.sbin/newsyslog/newsyslog.c Tue Apr 7 15:32:08 2020 (r359691) +++ stable/12/usr.sbin/newsyslog/newsyslog.c Tue Apr 7 16:15:35 2020 (r359692) @@ -1829,17 +1829,23 @@ do_rotate(const struct conf_entry *ent) else { /* XXX - Ought to be checking for failure! */ (void)rename(zfile1, zfile2); - change_attrs(zfile2, ent); - if (ent->compress && !strlen(logfile_suffix)) { - /* compress old rotation */ - struct zipwork_entry zwork; + } + change_attrs(zfile2, ent); + if (ent->compress && strlen(logfile_suffix) == 0) { + /* compress old rotation */ + struct zipwork_entry *zwork; + size_t sz; - memset(&zwork, 0, sizeof(zwork)); - zwork.zw_conf = ent; - zwork.zw_fsize = sizefile(zfile2); - strcpy(zwork.zw_fname, zfile2); - do_zipwork(&zwork); - } + sz = sizeof(*zwork) + strlen(zfile2) + 1; + zwork = calloc(1, sz); + if (zwork == NULL) + err(1, "calloc"); + + zwork->zw_conf = ent; + zwork->zw_fsize = sizefile(zfile2); + strcpy(zwork->zw_fname, zfile2); + do_zipwork(zwork); + free(zwork); } } From owner-svn-src-stable-12@freebsd.org Tue Apr 7 16:15:54 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82AC7273F52; Tue, 7 Apr 2020 16:15:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xXZf2yzTz3NVy; Tue, 7 Apr 2020 16:15:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47DCBC7F0; Tue, 7 Apr 2020 16:15:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GFsVW035464; Tue, 7 Apr 2020 16:15:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GFsdY035463; Tue, 7 Apr 2020 16:15:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004071615.037GFsdY035463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 7 Apr 2020 16:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359693 - stable/12/usr.sbin/newsyslog/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.sbin/newsyslog/tests X-SVN-Commit-Revision: 359693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:15:54 -0000 Author: markj Date: Tue Apr 7 16:15:53 2020 New Revision: 359693 URL: https://svnweb.freebsd.org/changeset/base/359693 Log: MFC r359277: Add regression tests for newsyslog.conf's p flag. Modified: stable/12/usr.sbin/newsyslog/tests/legacy_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/newsyslog/tests/legacy_test.sh ============================================================================== --- stable/12/usr.sbin/newsyslog/tests/legacy_test.sh Tue Apr 7 16:15:35 2020 (r359692) +++ stable/12/usr.sbin/newsyslog/tests/legacy_test.sh Tue Apr 7 16:15:53 2020 (r359693) @@ -194,7 +194,8 @@ ckstr() tmpdir_create() { - mkdir -p ${TMPDIR}/log ${TMPDIR}/alog + rm -rf ${TMPDIR}/log ${TMPDIR}/alog + mkdir ${TMPDIR}/log ${TMPDIR}/alog cd ${TMPDIR}/log } @@ -211,6 +212,8 @@ run_newsyslog() } tests_normal_rotate() { + local dir ext name_postfix newsyslog_args + ext="$1" dir="$2" @@ -286,6 +289,8 @@ tests_normal_rotate() { } tests_normal_rotate_keepn() { + local cnt dir ext name_postfix newsyslog_args + cnt="$1" ext="$2" dir="$3" @@ -354,6 +359,8 @@ tests_normal_rotate_keepn() { } tests_time_rotate() { + local dir ext name_postfix newsyslog_args + ext="$1" dir="$2" @@ -413,6 +420,8 @@ tests_time_rotate() { } tests_rfc5424() { + local dir ext name_postfix newsyslog_args + ext="$1" dir="$2" @@ -451,7 +460,73 @@ tests_rfc5424() { tmpdir_clean } -echo 1..180 +tests_p_flag_rotate() { + local ext + + ext="$1" + + tmpdir_create + + begin "create file" + run_newsyslog -C + ckfe $LOGFNAME + cknt ${LOGFNAME}.0 + cknt ${LOGFNAME}.0${ext} + end + + begin "rotate p flag 1 ${ext}" + run_newsyslog + ckfe $LOGFNAME + ckfe ${LOGFNAME}.0 + cknt ${LOGFNAME}.0${ext} + run_newsyslog + ckfe $LOGFNAME + ckfe ${LOGFNAME}.0 + cknt ${LOGFNAME}.0${ext} + ckfe ${LOGFNAME}.1${ext} + run_newsyslog + ckfe $LOGFNAME + ckfe ${LOGFNAME}.0 + cknt ${LOGFNAME}.0${ext} + ckfe ${LOGFNAME}.1${ext} + ckfe ${LOGFNAME}.2${ext} + end + + tmpdir_clean +} + +tests_normal_rotate_recompress() { + local ext + + ext=".gz" + + tmpdir_create + + begin "create file recompress" + run_newsyslog -C + ckfe $LOGFNAME + cknt ${LOGFNAME}.0${ext} + end + + begin "rotate normal 1" + run_newsyslog + ckfe $LOGFNAME + ckfe ${LOGFNAME}.0${ext} + cknt ${LOGFNAME}.1${ext} + end + + begin "rotate recompress 1" + gunzip ${LOGFNAME}.0${ext} + ckfe ${LOGFNAME}.0 + cknt ${LOGFNAME}.0${ext} + run_newsyslog + ckfe $LOGFNAME + ckfe ${LOGFNAME}.0${ext} + ckfe ${LOGFNAME}.1${ext} + end +} + +echo 1..185 mkdir -p ${TMPDIR} cd ${TMPDIR} @@ -556,5 +631,11 @@ tests_time_rotate "zst" "${TMPDIR}/alog/" echo "$LOGFPATH5424 640 3 * @T00 NCT" > newsyslog.conf echo "$LOGFPATH 640 3 * @T00 NC" >> newsyslog.conf tests_rfc5424 + +echo "$LOGFPATH 640 3 * @T00 NCpZ" > newsyslog.conf +tests_p_flag_rotate ".gz" + +echo "$LOGFPATH 640 3 * @T00 NCZ" > newsyslog.conf +tests_normal_rotate_recompress rm -rf "${TMPDIR}" From owner-svn-src-stable-12@freebsd.org Tue Apr 7 16:28:00 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 367BD274501; Tue, 7 Apr 2020 16:28:00 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xXrc0kl7z3PG5; Tue, 7 Apr 2020 16:28:00 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E93C0C9E7; Tue, 7 Apr 2020 16:27:59 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GRx2e042027; Tue, 7 Apr 2020 16:27:59 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GRwTS042020; Tue, 7 Apr 2020 16:27:58 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071627.037GRwTS042020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 16:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359694 - in stable/12: sbin/ipfw sys/netinet/libalias X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/12: sbin/ipfw sys/netinet/libalias X-SVN-Commit-Revision: 359694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:28:00 -0000 Author: eugen Date: Tue Apr 7 16:27:58 2020 New Revision: 359694 URL: https://svnweb.freebsd.org/changeset/base/359694 Log: MFC r357092,357787: Add support for RFC 6598/Carrier Grade NAT subnets to libalias and ipfw. In libalias, a new flag PKT_ALIAS_UNREGISTERED_RFC6598 is added. This is like PKT_ALIAS_UNREGISTERED_ONLY, but also is RFC 6598 aware. Also, we add a new NAT option to ipfw called unreg_cgn, which is like unreg_only, but also is RFC 6598-aware. The reason for the new flags/options is to avoid breaking existing networks, especially those which rely on RFC 6598 as an external address. Submitted by: Neel Chauhan Reviewed by: melifaro, rgrimes, Lutz Donnerhacke Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22877 Differential Revision: https://reviews.freebsd.org/D23448 Modified: stable/12/sbin/ipfw/ipfw.8 stable/12/sbin/ipfw/ipfw2.h stable/12/sbin/ipfw/main.c stable/12/sbin/ipfw/nat.c stable/12/sys/netinet/libalias/alias.c stable/12/sys/netinet/libalias/alias.h stable/12/sys/netinet/libalias/libalias.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw.8 ============================================================================== --- stable/12/sbin/ipfw/ipfw.8 Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sbin/ipfw/ipfw.8 Tue Apr 7 16:27:58 2020 (r359694) @@ -3233,8 +3233,11 @@ Deny any incoming connection from outside world. Try to leave the alias port numbers unchanged from the actual local port numbers. .It Cm unreg_only -Traffic on the local network not originating from an +Traffic on the local network not originating from a RFC 1918 unregistered address spaces will be ignored. +.It Cm unreg_cgn +Like unreg_only, but includes the RFC 6598 (Carrier Grade NAT) +address range. .It Cm reset Reset table of the packet aliasing engine on address change. .It Cm reverse Modified: stable/12/sbin/ipfw/ipfw2.h ============================================================================== --- stable/12/sbin/ipfw/ipfw2.h Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sbin/ipfw/ipfw2.h Tue Apr 7 16:27:58 2020 (r359694) @@ -220,6 +220,7 @@ enum tokens { TOK_DENY_INC, TOK_SAME_PORTS, TOK_UNREG_ONLY, + TOK_UNREG_CGN, TOK_SKIP_GLOBAL, TOK_RESET_ADDR, TOK_ALIAS_REV, Modified: stable/12/sbin/ipfw/main.c ============================================================================== --- stable/12/sbin/ipfw/main.c Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sbin/ipfw/main.c Tue Apr 7 16:27:58 2020 (r359694) @@ -43,8 +43,8 @@ help(void) "add [num] [set N] [prob x] RULE-BODY\n" "{pipe|queue} N config PIPE-BODY\n" "[pipe|queue] {zero|delete|show} [N{,N}]\n" -"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|reset|\n" -" reverse|proxy_only|redirect_addr linkspec|\n" +"nat N config {ip IPADDR|if IFNAME|log|deny_in|same_ports|unreg_only|unreg_cgn|\n" +" reset|reverse|proxy_only|redirect_addr linkspec|\n" " redirect_port linkspec|redirect_proto linkspec}\n" "set [disable N... enable N...] | move [rule] X to Y | swap X Y | show\n" "set N {show|list|zero|resetlog|delete} [N{,N}] | flush\n" Modified: stable/12/sbin/ipfw/nat.c ============================================================================== --- stable/12/sbin/ipfw/nat.c Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sbin/ipfw/nat.c Tue Apr 7 16:27:58 2020 (r359694) @@ -60,6 +60,7 @@ static struct _s_x nat_params[] = { { "deny_in", TOK_DENY_INC }, { "same_ports", TOK_SAME_PORTS }, { "unreg_only", TOK_UNREG_ONLY }, + { "unreg_cgn", TOK_UNREG_CGN }, { "skip_global", TOK_SKIP_GLOBAL }, { "reset", TOK_RESET_ADDR }, { "reverse", TOK_ALIAS_REV }, @@ -663,6 +664,9 @@ nat_show_cfg(struct nat44_cfg_nat *n, void *arg) } else if (n->mode & PKT_ALIAS_UNREGISTERED_ONLY) { printf(" unreg_only"); n->mode &= ~PKT_ALIAS_UNREGISTERED_ONLY; + } else if (n->mode & PKT_ALIAS_UNREGISTERED_CGN) { + printf(" unreg_cgn"); + n->mode &= ~PKT_ALIAS_UNREGISTERED_CGN; } else if (n->mode & PKT_ALIAS_RESET_ON_ADDR_CHANGE) { printf(" reset"); n->mode &= ~PKT_ALIAS_RESET_ON_ADDR_CHANGE; @@ -789,6 +793,7 @@ ipfw_config_nat(int ac, char **av) case TOK_SAME_PORTS: case TOK_SKIP_GLOBAL: case TOK_UNREG_ONLY: + case TOK_UNREG_CGN: case TOK_RESET_ADDR: case TOK_ALIAS_REV: case TOK_PROXY_ONLY: @@ -882,6 +887,9 @@ ipfw_config_nat(int ac, char **av) break; case TOK_UNREG_ONLY: n->mode |= PKT_ALIAS_UNREGISTERED_ONLY; + break; + case TOK_UNREG_CGN: + n->mode |= PKT_ALIAS_UNREGISTERED_CGN; break; case TOK_SKIP_GLOBAL: n->mode |= PKT_ALIAS_SKIP_GLOBAL; Modified: stable/12/sys/netinet/libalias/alias.c ============================================================================== --- stable/12/sys/netinet/libalias/alias.c Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sys/netinet/libalias/alias.c Tue Apr 7 16:27:58 2020 (r359694) @@ -1413,6 +1413,10 @@ getout: #define UNREG_ADDR_C_LOWER 0xc0a80000 #define UNREG_ADDR_C_UPPER 0xc0a8ffff +/* 100.64.0.0 -> 100.127.255.255 (RFC 6598 - Carrier Grade NAT) */ +#define UNREG_ADDR_CGN_LOWER 0x64400000 +#define UNREG_ADDR_CGN_UPPER 0x647fffff + int LibAliasOut(struct libalias *la, char *ptr, int maxpacketsize) { @@ -1464,7 +1468,8 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* v } addr_save = GetDefaultAliasAddress(la); - if (la->packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY) { + if (la->packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY || + la->packetAliasMode & PKT_ALIAS_UNREGISTERED_CGN) { u_long addr; int iclass; @@ -1476,6 +1481,9 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* v iclass = 2; else if (addr >= UNREG_ADDR_A_LOWER && addr <= UNREG_ADDR_A_UPPER) iclass = 1; + else if (addr >= UNREG_ADDR_CGN_LOWER && addr <= UNREG_ADDR_CGN_UPPER && + la->packetAliasMode & PKT_ALIAS_UNREGISTERED_CGN) + iclass = 4; if (iclass == 0) { SetDefaultAliasAddress(la, pip->ip_src); Modified: stable/12/sys/netinet/libalias/alias.h ============================================================================== --- stable/12/sys/netinet/libalias/alias.h Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sys/netinet/libalias/alias.h Tue Apr 7 16:27:58 2020 (r359694) @@ -228,6 +228,14 @@ struct mbuf *m_megapullup(struct mbuf *, int); */ #define PKT_ALIAS_SKIP_GLOBAL 0x200 +/* + * Like PKT_ALIAS_UNREGISTERED_ONLY, but includes the RFC 6598 + * (Carrier Grade NAT) address range as follows: + * + * 100.64.0.0 -> 100.127.255.255 + */ +#define PKT_ALIAS_UNREGISTERED_CGN 0x400 + /* Function return codes. */ #define PKT_ALIAS_ERROR -1 #define PKT_ALIAS_OK 1 Modified: stable/12/sys/netinet/libalias/libalias.3 ============================================================================== --- stable/12/sys/netinet/libalias/libalias.3 Tue Apr 7 16:15:53 2020 (r359693) +++ stable/12/sys/netinet/libalias/libalias.3 Tue Apr 7 16:27:58 2020 (r359694) @@ -212,6 +212,11 @@ This option is useful in the case that the packet alia registered and unregistered subnets on different interfaces. The registered subnet is fully accessible to the outside world, so traffic from it does not need to be passed through the packet aliasing engine. +.It Dv PKT_ALIAS_UNREGISTERED_CGN +Like PKT_ALIAS_UNREGISTERED_ONLY, but includes the RFC 6598 (Carrier Grade +NAT) subnet as follows: +.Pp +100.64.0.0 -> 100.127.255.255 (RFC 6598 subnet) .It Dv PKT_ALIAS_RESET_ON_ADDR_CHANGE When this mode bit is set and .Fn LibAliasSetAddress From owner-svn-src-stable-12@freebsd.org Tue Apr 7 16:44:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82CE2274E63; Tue, 7 Apr 2020 16:44:15 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xYCM2tw1z3QQL; Tue, 7 Apr 2020 16:44:15 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E077CDB3; Tue, 7 Apr 2020 16:44:15 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GiFDo053860; Tue, 7 Apr 2020 16:44:15 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GiEV3053857; Tue, 7 Apr 2020 16:44:14 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071644.037GiEV3053857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 16:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359697 - in stable/12: share/man/man4 sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 359697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:44:15 -0000 Author: eugen Date: Tue Apr 7 16:44:14 2020 New Revision: 359697 URL: https://svnweb.freebsd.org/changeset/base/359697 Log: MFC r342168,357786: Allow ng_nat to be attached to a ethernet interface Allow ng_nat to be attached to a ethernet interface directly via ng_ether(4) or the likes. Add new control message types: setdlt and getdlt to switch from default DLT_RAW (no encapsulation) to DLT_EN10MB (ethernet). Submitted by: sobomax Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D18535 Relnotes: yes Modified: stable/12/share/man/man4/ng_nat.4 stable/12/sys/netgraph/ng_nat.c stable/12/sys/netgraph/ng_nat.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ng_nat.4 ============================================================================== --- stable/12/share/man/man4/ng_nat.4 Tue Apr 7 16:40:41 2020 (r359696) +++ stable/12/share/man/man4/ng_nat.4 Tue Apr 7 16:44:14 2020 (r359697) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 21, 2013 +.Dd December 12, 2018 .Dt NG_NAT 4 .Os .Sh NAME @@ -264,6 +264,38 @@ from its .Xr libalias instance, the corresponding field is returned as .Va UINT32_MAX . +.It Dv NGM_NAT_SET_DLT Pq Ic setdlt +Sets the data link type on the +.Va in +and +.Va out +hooks. +Currently, supported types are +.Cm DLT_RAW +(raw IP datagrams , no offset applied, the default) and +.Cm DLT_EN10MB +(Ethernet). DLT_ definitions can be found in +.In net/bpf.h . +If you want to work on the +.Xr ipfw 8 +level you must use no additional offset by specifying +.Cm DLT_RAW . +If, however, you attach +.Nm +to a network interface directly and +.Cm EN10MB +is specified, then the extra offset will be applied to take into account +link-level header. +In this mode the +.Nm +would also inspect appropriate type field in the Ethernet header and +pass-through any datagrams that are not IP packets. +.It Dv NGM_NAT_GET_DLT Pq Ic getdlt +This control message returns the current data link type of the +.Va in +and +.Va out +hooks. .El .Pp In all redirection messages @@ -336,11 +368,31 @@ serial line with HDLC encapsulation. SEQ ifconfig ng0 x.y.8.35 x.y.8.1 .Ed +.Pp +The +.Nm +node can also be attached directly to the physical interface +via +.Xr ng_ether 4 +node in the graph. +In the following example, we perform masquerading on a +Ethernet interface connected to a public network. +.Bd -literal -offset indent +ifconfig igb0 inet x.y.8.35 netmask 0xfffff000 +route add default x.y.0.1 +/usr/sbin/ngctl -f- <<-SEQ + mkpeer igb0: nat lower in + name igb0:lower igb0_NAT + connect igb0: igb0_NAT: upper out + msg igb0_NAT: setdlt 1 + msg igb0_NAT: setaliasaddr x.y.8.35 +SEQ .Sh SEE ALSO .Xr libalias 3 , .Xr ng_ipfw 4 , .Xr natd 8 , -.Xr ngctl 8 +.Xr ngctl 8 , +.Xr ng_ether 8 .Sh HISTORY The .Nm Modified: stable/12/sys/netgraph/ng_nat.c ============================================================================== --- stable/12/sys/netgraph/ng_nat.c Tue Apr 7 16:40:41 2020 (r359696) +++ stable/12/sys/netgraph/ng_nat.c Tue Apr 7 16:44:14 2020 (r359697) @@ -44,6 +44,9 @@ #include #include +#include +#include + #include #include @@ -241,6 +244,20 @@ static const struct ng_cmdlist ng_nat_cmdlist[] = { NULL, &ng_nat_libalias_info_type }, + { + NGM_NAT_COOKIE, + NGM_NAT_SET_DLT, + "setdlt", + &ng_parse_uint8_type, + NULL + }, + { + NGM_NAT_COOKIE, + NGM_NAT_GET_DLT, + "getdlt", + NULL, + &ng_parse_uint8_type + }, { 0 } }; @@ -277,6 +294,7 @@ struct ng_nat_priv { uint32_t rdrcount; /* number or redirects in list */ uint32_t nextid; /* for next in turn in list */ struct rdrhead redirhead; /* redirect list header */ + uint8_t dlt; /* DLT_XXX from bpf.h */ }; typedef struct ng_nat_priv *priv_p; @@ -302,6 +320,7 @@ ng_nat_constructor(node_p node) /* Init redirects housekeeping. */ priv->rdrcount = 0; priv->nextid = 1; + priv->dlt = DLT_RAW; STAILQ_INIT(&priv->redirhead); /* Link structs together. */ @@ -694,11 +713,34 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthoo #undef COPY } break; + case NGM_NAT_SET_DLT: + if (msg->header.arglen != sizeof(uint8_t)) { + error = EINVAL; + break; + } + switch (*(uint8_t *) msg->data) { + case DLT_EN10MB: + case DLT_RAW: + priv->dlt = *(uint8_t *) msg->data; + break; + default: + error = EINVAL; + break; + } + break; default: error = EINVAL; /* unknown command */ break; } break; + case NGM_NAT_GET_DLT: + NG_MKRESPONSE(resp, msg, sizeof(uint8_t), M_WAITOK); + if (resp == NULL) { + error = ENOMEM; + break; + } + *((uint8_t *) resp->data) = priv->dlt; + break; default: error = EINVAL; /* unknown cookie type */ break; @@ -715,7 +757,7 @@ ng_nat_rcvdata(hook_p hook, item_p item ) const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); struct mbuf *m; struct ip *ip; - int rval, error = 0; + int rval, ipofs, error = 0; char *c; /* We have no required hooks. */ @@ -738,12 +780,44 @@ ng_nat_rcvdata(hook_p hook, item_p item ) NGI_M(item) = m; - c = mtod(m, char *); - ip = mtod(m, struct ip *); + switch (priv->dlt) { + case DLT_RAW: + ipofs = 0; + break; + case DLT_EN10MB: + { + struct ether_header *eh; - KASSERT(m->m_pkthdr.len == ntohs(ip->ip_len), - ("ng_nat: ip_len != m_pkthdr.len")); + if (m->m_pkthdr.len < sizeof(struct ether_header)) { + NG_FREE_ITEM(item); + return (ENXIO); + } + eh = mtod(m, struct ether_header *); + switch (ntohs(eh->ether_type)) { + case ETHERTYPE_IP: + case ETHERTYPE_IPV6: + ipofs = sizeof(struct ether_header); + break; + default: + goto send; + } + break; + } + default: + panic("Corrupted priv->dlt: %u", priv->dlt); + } + if (m->m_pkthdr.len < ipofs + sizeof(struct ip)) + goto send; /* packet too short to hold IP */ + + c = (char *)mtodo(m, ipofs); + ip = (struct ip *)mtodo(m, ipofs); + + if (ip->ip_v != IPVERSION) + goto send; /* other IP version, let it pass */ + if (m->m_pkthdr.len < ipofs + ntohs(ip->ip_len)) + goto send; /* packet too short (i.e. fragmented or broken) */ + /* * We drop packet when: * 1. libalias returns PKT_ALIAS_ERROR; @@ -753,7 +827,8 @@ ng_nat_rcvdata(hook_p hook, item_p item ) * PKT_ALIAS_DENY_INCOMING flag is set. */ if (hook == priv->in) { - rval = LibAliasIn(priv->lib, c, m->m_len + M_TRAILINGSPACE(m)); + rval = LibAliasIn(priv->lib, c, m->m_len - ipofs + + M_TRAILINGSPACE(m)); if (rval == PKT_ALIAS_ERROR || rval == PKT_ALIAS_UNRESOLVED_FRAGMENT || (rval == PKT_ALIAS_IGNORED && @@ -763,7 +838,8 @@ ng_nat_rcvdata(hook_p hook, item_p item ) return (EINVAL); } } else if (hook == priv->out) { - rval = LibAliasOut(priv->lib, c, m->m_len + M_TRAILINGSPACE(m)); + rval = LibAliasOut(priv->lib, c, m->m_len - ipofs + + M_TRAILINGSPACE(m)); if (rval == PKT_ALIAS_ERROR) { NG_FREE_ITEM(item); return (EINVAL); @@ -773,7 +849,7 @@ ng_nat_rcvdata(hook_p hook, item_p item ) if (rval == PKT_ALIAS_RESPOND) m->m_flags |= M_SKIP_FIREWALL; - m->m_pkthdr.len = m->m_len = ntohs(ip->ip_len); + m->m_pkthdr.len = m->m_len = ntohs(ip->ip_len) + ipofs; if ((ip->ip_off & htons(IP_OFFMASK)) == 0 && ip->ip_p == IPPROTO_TCP) { Modified: stable/12/sys/netgraph/ng_nat.h ============================================================================== --- stable/12/sys/netgraph/ng_nat.h Tue Apr 7 16:40:41 2020 (r359696) +++ stable/12/sys/netgraph/ng_nat.h Tue Apr 7 16:44:14 2020 (r359697) @@ -205,6 +205,8 @@ enum { NGM_NAT_SET_IPADDR = 1, NGM_NAT_SET_MODE, NGM_NAT_SET_TARGET, + NGM_NAT_SET_DLT, + NGM_NAT_GET_DLT, NGM_NAT_REDIRECT_PORT, NGM_NAT_REDIRECT_ADDR, NGM_NAT_REDIRECT_PROTO, From owner-svn-src-stable-12@freebsd.org Tue Apr 7 16:52:45 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC6F12751EB; Tue, 7 Apr 2020 16:52:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xYP95ypzz3R4C; Tue, 7 Apr 2020 16:52:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7D0ACFD2; Tue, 7 Apr 2020 16:52:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037GqjFT059809; Tue, 7 Apr 2020 16:52:45 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037GqjMF059808; Tue, 7 Apr 2020 16:52:45 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071652.037GqjMF059808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 16:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359699 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 359699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:52:46 -0000 Author: eugen Date: Tue Apr 7 16:52:45 2020 New Revision: 359699 URL: https://svnweb.freebsd.org/changeset/base/359699 Log: MFC r356943,356944: Correct "service ipfw status" for INET6-only systems. Modified: stable/12/libexec/rc/rc.d/ipfw Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/ipfw ============================================================================== --- stable/12/libexec/rc/rc.d/ipfw Tue Apr 7 16:47:35 2020 (r359698) +++ stable/12/libexec/rc/rc.d/ipfw Tue Apr 7 16:52:45 2020 (r359699) @@ -127,7 +127,11 @@ ipfw_stop() ipfw_status() { status=$(sysctl -i -n net.inet.ip.fw.enable) - if [ ${status:-0} -eq 0 ]; then + : ${status:=0} + if afexists inet6; then + status=$((${status} + $(sysctl -i -n net.inet6.ip6.fw.enable))) + fi + if [ ${status} -eq 0 ]; then echo "ipfw is not enabled" exit 1 else From owner-svn-src-stable-12@freebsd.org Tue Apr 7 17:49:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C98C5277A1D; Tue, 7 Apr 2020 17:49:37 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xZfn4vPxz41p8; Tue, 7 Apr 2020 17:49:37 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ED0FD9B2; Tue, 7 Apr 2020 17:49:37 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037HnbHj090521; Tue, 7 Apr 2020 17:49:37 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037Hnb9R090519; Tue, 7 Apr 2020 17:49:37 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202004071749.037Hnb9R090519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 7 Apr 2020 17:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359707 - in stable/12: share/man/man4 sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 359707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:49:37 -0000 Author: eugen Date: Tue Apr 7 17:49:36 2020 New Revision: 359707 URL: https://svnweb.freebsd.org/changeset/base/359707 Log: MFC r357053 by markj: ng_nat: Pass IPv6 packets through. ng_nat implements NAT for IPv4 traffic only. When connected to an ng_ether node it erroneously handled IPv6 packets as well. This change is not sufficient: ng_nat does not do any validation of IP packets in this mode, even though they have not yet passed through ip_input(). PR: 243096 Reported by: Robert James Hernandez Reviewed by: julian Differential Revision: https://reviews.freebsd.org/D23080 Modified: stable/12/share/man/man4/ng_nat.4 stable/12/sys/netgraph/ng_nat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ng_nat.4 ============================================================================== --- stable/12/share/man/man4/ng_nat.4 Tue Apr 7 17:18:22 2020 (r359706) +++ stable/12/share/man/man4/ng_nat.4 Tue Apr 7 17:49:36 2020 (r359707) @@ -35,7 +35,7 @@ .Sh DESCRIPTION An .Nm -node performs network address translation (NAT) of packets +node performs network address translation (NAT) of IPv4 packets passing through it. A .Nm nat Modified: stable/12/sys/netgraph/ng_nat.c ============================================================================== --- stable/12/sys/netgraph/ng_nat.c Tue Apr 7 17:18:22 2020 (r359706) +++ stable/12/sys/netgraph/ng_nat.c Tue Apr 7 17:49:36 2020 (r359707) @@ -795,7 +795,6 @@ ng_nat_rcvdata(hook_p hook, item_p item ) eh = mtod(m, struct ether_header *); switch (ntohs(eh->ether_type)) { case ETHERTYPE_IP: - case ETHERTYPE_IPV6: ipofs = sizeof(struct ether_header); break; default: From owner-svn-src-stable-12@freebsd.org Tue Apr 7 18:41:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E515D279353; Tue, 7 Apr 2020 18:41:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xbq45nRHz44Xl; Tue, 7 Apr 2020 18:41:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1CA9E514; Tue, 7 Apr 2020 18:41:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037IfqVR023883; Tue, 7 Apr 2020 18:41:52 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037IfqDr023882; Tue, 7 Apr 2020 18:41:52 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202004071841.037IfqDr023882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 7 Apr 2020 18:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359709 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 359709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 18:41:53 -0000 Author: mhorne Date: Tue Apr 7 18:41:52 2020 New Revision: 359709 URL: https://svnweb.freebsd.org/changeset/base/359709 Log: MFC r359289: Makefile.inc1: override MACHINE for native-xtools Modified: stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Tue Apr 7 17:50:18 2020 (r359708) +++ stable/12/Makefile.inc1 Tue Apr 7 18:41:52 2020 (r359709) @@ -2474,6 +2474,7 @@ NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \ XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp" .endif NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \ + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \ TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \ TARGET_TRIPLE=${MACHINE_TRIPLE:Q} # NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to From owner-svn-src-stable-12@freebsd.org Tue Apr 7 19:39:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86C8F27B2D4; Tue, 7 Apr 2020 19:39:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xd5934Sqz47j2; Tue, 7 Apr 2020 19:39:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64C97EF25; Tue, 7 Apr 2020 19:39:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037Jd9cP056644; Tue, 7 Apr 2020 19:39:09 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037Jd9vb056643; Tue, 7 Apr 2020 19:39:09 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004071939.037Jd9vb056643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 7 Apr 2020 19:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359710 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 359710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:39:09 -0000 Author: bdrewery Date: Tue Apr 7 19:39:08 2020 New Revision: 359710 URL: https://svnweb.freebsd.org/changeset/base/359710 Log: MFC r357353: make all is needed to generate .depend.* Modified: stable/12/sys/conf/kern.post.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/kern.post.mk ============================================================================== --- stable/12/sys/conf/kern.post.mk Tue Apr 7 18:41:52 2020 (r359709) +++ stable/12/sys/conf/kern.post.mk Tue Apr 7 19:39:08 2020 (r359710) @@ -356,7 +356,7 @@ kernel-cleandepend: .PHONY kernel-tags: @ls .depend.* > /dev/null 2>&1 || \ - { echo "you must make depend first"; exit 1; } + { echo "you must make all first"; exit 1; } sh $S/conf/systags.sh kernel-install: .PHONY From owner-svn-src-stable-12@freebsd.org Tue Apr 7 19:40:11 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DB8127B408; Tue, 7 Apr 2020 19:40:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xd6M3GCXz47xX; Tue, 7 Apr 2020 19:40:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B251EF2B; Tue, 7 Apr 2020 19:40:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037JeBuM056823; Tue, 7 Apr 2020 19:40:11 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037JeBkI056822; Tue, 7 Apr 2020 19:40:11 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004071940.037JeBkI056822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 7 Apr 2020 19:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359712 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 359712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:40:11 -0000 Author: bdrewery Date: Tue Apr 7 19:40:11 2020 New Revision: 359712 URL: https://svnweb.freebsd.org/changeset/base/359712 Log: MFC r353771: Fix spelling of DPSRCS. Modified: stable/12/share/mk/bsd.dep.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/bsd.dep.mk ============================================================================== --- stable/12/share/mk/bsd.dep.mk Tue Apr 7 19:39:41 2020 (r359711) +++ stable/12/share/mk/bsd.dep.mk Tue Apr 7 19:40:11 2020 (r359712) @@ -182,7 +182,7 @@ DEPEND_MP?= -MP # avoid collisions. DEPEND_FILTER= C,/,_,g DEPENDSRCS+= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} -DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} +DEPENDSRCS+= ${DPSRCS:M*.[cSC]} ${DPSRCS:M*.cxx} ${DPSRCS:M*.cpp} ${DPSRCS:M*.cc} .if !empty(DEPENDSRCS) DEPENDOBJS+= ${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,} .endif From owner-svn-src-stable-12@freebsd.org Tue Apr 7 19:44:38 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCB0627B8B4; Tue, 7 Apr 2020 19:44:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xdCV4ZGgz48Wy; Tue, 7 Apr 2020 19:44:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9826CF119; Tue, 7 Apr 2020 19:44:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037Jicis062643; Tue, 7 Apr 2020 19:44:38 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037Jicj8062641; Tue, 7 Apr 2020 19:44:38 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004071944.037Jicj8062641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 7 Apr 2020 19:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359714 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 359714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 19:44:38 -0000 Author: bdrewery Date: Tue Apr 7 19:44:37 2020 New Revision: 359714 URL: https://svnweb.freebsd.org/changeset/base/359714 Log: MFC r349729: Consider *clean targets as non-build targets as well. Modified: stable/12/share/mk/bsd.init.mk stable/12/share/mk/bsd.sys.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/bsd.init.mk ============================================================================== --- stable/12/share/mk/bsd.init.mk Tue Apr 7 19:40:14 2020 (r359713) +++ stable/12/share/mk/bsd.init.mk Tue Apr 7 19:44:37 2020 (r359714) @@ -58,11 +58,12 @@ $xGRP= ${_gid} # things like 'make all install' or 'make foo install'. # - non-build targets are called .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \ - ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) + ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) && !make(*clean) _SKIP_BUILD= not building at level 0 .elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ ${.TARGETS:M*install*} == ${.TARGETS} || \ ${.TARGETS:Mclean*} == ${.TARGETS} || \ + ${.TARGETS:M*clean} == ${.TARGETS} || \ ${.TARGETS:Mdestroy*} == ${.TARGETS} || \ ${.TARGETS:Mobj} == ${.TARGETS} || \ make(analyze) || make(print-dir) Modified: stable/12/share/mk/bsd.sys.mk ============================================================================== --- stable/12/share/mk/bsd.sys.mk Tue Apr 7 19:40:14 2020 (r359713) +++ stable/12/share/mk/bsd.sys.mk Tue Apr 7 19:44:37 2020 (r359714) @@ -284,7 +284,7 @@ PHONY_NOTMAIN = analyze afterdepend afterinstall all b .NOTMAIN: ${PHONY_NOTMAIN:Nall} .if ${MK_STAGING} != "no" -.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*)) +.if defined(_SKIP_BUILD) || (!make(all) && !make(clean*) && !make(*clean)) _SKIP_STAGING?= yes .endif .if ${_SKIP_STAGING:Uno} == "yes" From owner-svn-src-stable-12@freebsd.org Wed Apr 8 06:06:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DE432AAA75; Wed, 8 Apr 2020 06:06:15 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xv0l2NWnz3JFx; Wed, 8 Apr 2020 06:06:15 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47D681E967; Wed, 8 Apr 2020 06:06:15 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03866FlL044319; Wed, 8 Apr 2020 06:06:15 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03866DuD044311; Wed, 8 Apr 2020 06:06:13 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202004080606.03866DuD044311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Wed, 8 Apr 2020 06:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359721 - in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Group: stable-12 X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 359721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2020 06:06:15 -0000 Author: freqlabs Date: Wed Apr 8 06:06:13 2020 New Revision: 359721 URL: https://svnweb.freebsd.org/changeset/base/359721 Log: MFC r359303 MFOpenZFS: ZVOLs should not be allowed to have children zfs create, receive and rename can bypass this hierarchy rule. Update both userland and kernel module to prevent this issue and use pyzfs unit tests to exercise the ioctls directly. Note: this commit slightly changes zfs_ioc_create() ABI. This allow to differentiate a generic error (EINVAL) from the specific case where we tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT). Reviewed-by: Paul Dagnelie Reviewed-by: Matt Ahrens Reviewed-by: Brian Behlendorf Reviewed-by: Tom Caputi Signed-off-by: loli10K Approved by: mav (mentor) openzfs/zfs@d8d418ff0cc90776182534bce10b01e9487b63e4 Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Apr 8 06:06:13 2020 (r359721) @@ -140,6 +140,7 @@ typedef enum zfs_error { EZFS_TOOMANY, /* argument list too long */ EZFS_INITIALIZING, /* currently initializing */ EZFS_NO_INITIALIZE, /* no active initialize */ + EZFS_WRONG_PARENT, /* invalid parent dataset (e.g ZVOL) */ EZFS_UNKNOWN } zfs_error_t; Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Apr 8 06:06:13 2020 (r359721) @@ -3622,11 +3622,6 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs "no such parent '%s'"), parent); return (zfs_error(hdl, EZFS_NOENT, errbuf)); - case EINVAL: - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "parent '%s' is not a filesystem"), parent); - return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); - case ENOTSUP: zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "pool must be upgraded to set this " Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Apr 8 06:06:13 2020 (r359721) @@ -28,6 +28,7 @@ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov + * Copyright (c) 2018, loli10K . All rights reserved. * Copyright (c) 2019 Datto Inc. */ @@ -3375,6 +3376,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const * - we are resuming a failed receive. */ if (stream_wantsnewfs) { + boolean_t is_volume = drrb->drr_type == DMU_OST_ZVOL; if (!flags->force) { zcmd_free_nvlists(&zc); zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -3392,6 +3394,25 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const zc.zc_name); return (zfs_error(hdl, EZFS_EXISTS, errbuf)); } + if (is_volume && strrchr(zc.zc_name, '/') == NULL) { + zcmd_free_nvlists(&zc); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "destination '%s' is the root dataset\n" + "cannot overwrite with a ZVOL"), + zc.zc_name); + return (zfs_error(hdl, EZFS_EXISTS, errbuf)); + } + if (is_volume && + ioctl(hdl->libzfs_fd, ZFS_IOC_DATASET_LIST_NEXT, + &zc) == 0) { + zcmd_free_nvlists(&zc); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "destination has children (eg. %s)\n" + "cannot overwrite with a ZVOL"), + zc.zc_name); + return (zfs_error(hdl, EZFS_WRONG_PARENT, + errbuf)); + } } if ((zhp = zfs_open(hdl, zc.zc_name, @@ -3441,6 +3462,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const zfs_close(zhp); } else { + zfs_handle_t *zhp; + /* * Destination filesystem does not exist. Therefore we better * be creating a new filesystem (either from a full backup, or @@ -3467,6 +3490,21 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const zcmd_free_nvlists(&zc); return (zfs_error(hdl, EZFS_BADRESTORE, errbuf)); } + + /* validate parent */ + zhp = zfs_open(hdl, zc.zc_name, ZFS_TYPE_DATASET); + if (zhp == NULL) { + zcmd_free_nvlists(&zc); + return (zfs_error(hdl, EZFS_BADRESTORE, errbuf)); + } + if (zfs_get_type(zhp) != ZFS_TYPE_FILESYSTEM) { + zcmd_free_nvlists(&zc); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "parent '%s' is not a filesystem"), zc.zc_name); + zfs_close(zhp); + return (zfs_error(hdl, EZFS_WRONG_PARENT, errbuf)); + } + zfs_close(zhp); newfs = B_TRUE; } Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Wed Apr 8 06:06:13 2020 (r359721) @@ -261,6 +261,8 @@ libzfs_error_description(libzfs_handle_t *hdl) case EZFS_NO_INITIALIZE: return (dgettext(TEXT_DOMAIN, "there is no active " "initialization")); + case EZFS_WRONG_PARENT: + return (dgettext(TEXT_DOMAIN, "invalid parent dataset")); case EZFS_UNKNOWN: return (dgettext(TEXT_DOMAIN, "unknown error")); default: @@ -526,6 +528,9 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int err break; case ZFS_ERR_VDEV_TOO_BIG: zfs_verror(hdl, EZFS_VDEV_TOO_BIG, fmt, ap); + break; + case ZFS_ERR_WRONG_PARENT: + zfs_verror(hdl, EZFS_WRONG_PARENT, fmt, ap); break; default: zfs_error_aux(hdl, strerror(error)); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Wed Apr 8 06:06:13 2020 (r359721) @@ -28,6 +28,7 @@ * Copyright (c) 2015, STRATO AG, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. + * Copyright (c) 2018, loli10K . All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -951,6 +952,8 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx) dmu_objset_create_arg_t *doca = arg; dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dir_t *pdd; + dsl_dataset_t *parentds; + objset_t *parentos; const char *tail; int error; @@ -972,6 +975,30 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx) } error = dsl_fs_ss_limit_check(pdd, 1, ZFS_PROP_FILESYSTEM_LIMIT, NULL, doca->doca_cred); + if (error != 0) { + dsl_dir_rele(pdd, FTAG); + return (error); + } + + /* can't create below anything but filesystems (eg. no ZVOLs) */ + error = dsl_dataset_hold_obj(pdd->dd_pool, + dsl_dir_phys(pdd)->dd_head_dataset_obj, FTAG, &parentds); + if (error != 0) { + dsl_dir_rele(pdd, FTAG); + return (error); + } + error = dmu_objset_from_ds(parentds, &parentos); + if (error != 0) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(pdd, FTAG); + return (error); + } + if (dmu_objset_type(parentos) != DMU_OST_ZFS) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(pdd, FTAG); + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); + } + dsl_dataset_rele(parentds, FTAG); dsl_dir_rele(pdd, FTAG); return (error); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Wed Apr 8 06:06:13 2020 (r359721) @@ -27,6 +27,7 @@ * Copyright 2014 HybridCluster. All rights reserved. * Copyright 2016 RackTop Systems. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2018, loli10K . All rights reserved. */ #include @@ -1308,6 +1309,7 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d uint64_t fromguid) { uint64_t val; + uint64_t children; int error; dsl_pool_t *dp = ds->ds_dir->dd_pool; @@ -1329,6 +1331,15 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *d if (error != ENOENT) return (error == 0 ? SET_ERROR(EEXIST) : error); + /* must not have children if receiving a ZVOL */ + error = zap_count(dp->dp_meta_objset, + dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, &children); + if (error != 0) + return (error); + if (drba->drba_cookie->drc_drrb->drr_type != DMU_OST_ZFS && + children > 0) + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); + /* * Check snapshot limit before receiving. We'll recheck again at the * end, but might as well abort before receiving if we're already over @@ -1466,6 +1477,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) } else if (error == ENOENT) { /* target fs does not exist; must be a full backup or clone */ char buf[ZFS_MAX_DATASET_NAME_LEN]; + objset_t *os; /* * If it's a non-clone incremental, we are missing the @@ -1510,6 +1522,17 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) return (error); } + /* can't recv below anything but filesystems (eg. no ZVOLs) */ + error = dmu_objset_from_ds(ds, &os); + if (error != 0) { + dsl_dataset_rele(ds, FTAG); + return (error); + } + if (dmu_objset_type(os) != DMU_OST_ZFS) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); + } + if (drba->drba_origin != NULL) { dsl_dataset_t *origin; error = dsl_dataset_hold(dp, drba->drba_origin, @@ -1531,6 +1554,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx) } dsl_dataset_rele(origin, FTAG); } + dsl_dataset_rele(ds, FTAG); error = 0; } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Wed Apr 8 06:06:13 2020 (r359721) @@ -26,6 +26,7 @@ * Copyright (c) 2014 Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2018, loli10K . All rights reserved. */ #include @@ -1852,6 +1853,8 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dir_t *dd, *newparent; dsl_valid_rename_arg_t dvra; + dsl_dataset_t *parentds; + objset_t *parentos; const char *mynewname; int error; @@ -1881,6 +1884,29 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx) dsl_dir_rele(dd, FTAG); return (SET_ERROR(EEXIST)); } + + /* can't rename below anything but filesystems (eg. no ZVOLs) */ + error = dsl_dataset_hold_obj(newparent->dd_pool, + dsl_dir_phys(newparent)->dd_head_dataset_obj, FTAG, &parentds); + if (error != 0) { + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); + return (error); + } + error = dmu_objset_from_ds(parentds, &parentos); + if (error != 0) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); + return (error); + } + if (dmu_objset_type(parentos) != DMU_OST_ZFS) { + dsl_dataset_rele(parentds, FTAG); + dsl_dir_rele(newparent, FTAG); + dsl_dir_rele(dd, FTAG); + return (error); + } + dsl_dataset_rele(parentds, FTAG); ASSERT3U(strnlen(ddra->ddra_newname, ZFS_MAX_DATASET_NAME_LEN), <, ZFS_MAX_DATASET_NAME_LEN); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Apr 8 06:06:13 2020 (r359721) @@ -33,6 +33,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2017 RackTop Systems. + * Copyright (c) 2018, loli10K . All rights reserved. * Copyright (c) 2019 Datto Inc. */ @@ -3172,8 +3173,9 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver, ASSERT(zplprops != NULL); + /* parent dataset must be a filesystem */ if (os != NULL && os->os_phys->os_type != DMU_OST_ZFS) - return (SET_ERROR(EINVAL)); + return (SET_ERROR(ZFS_ERR_WRONG_PARENT)); /* * Pull out creator prop choices, if any. @@ -3249,15 +3251,11 @@ zfs_fill_zplprops(const char *dataset, nvlist_t *creat uint64_t zplver = ZPL_VERSION; objset_t *os = NULL; char parentname[ZFS_MAX_DATASET_NAME_LEN]; - char *cp; spa_t *spa; uint64_t spa_vers; int error; - (void) strlcpy(parentname, dataset, sizeof (parentname)); - cp = strrchr(parentname, '/'); - ASSERT(cp != NULL); - cp[0] = '\0'; + zfs_get_parent(dataset, parentname, sizeof (parentname)); if ((error = spa_open(dataset, &spa, FTAG)) != 0) return (error); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Apr 8 01:12:54 2020 (r359720) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Apr 8 06:06:13 2020 (r359721) @@ -1033,7 +1033,8 @@ typedef enum { ZFS_ERR_DISCARDING_CHECKPOINT, ZFS_ERR_NO_CHECKPOINT, ZFS_ERR_DEVRM_IN_PROGRESS, - ZFS_ERR_VDEV_TOO_BIG + ZFS_ERR_VDEV_TOO_BIG, + ZFS_ERR_WRONG_PARENT, } zfs_errno_t; /* From owner-svn-src-stable-12@freebsd.org Thu Apr 9 04:50:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 927BB2ADF2C; Thu, 9 Apr 2020 04:50:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yTGk3b93z44vc; Thu, 9 Apr 2020 04:50:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 762597224; Thu, 9 Apr 2020 04:50:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0394oMYx080526; Thu, 9 Apr 2020 04:50:22 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0394oJgJ080510; Thu, 9 Apr 2020 04:50:19 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202004090450.0394oJgJ080510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 9 Apr 2020 04:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359735 - in stable/12: lib/libsecureboot lib/libsecureboot/h lib/libsecureboot/tests share/mk stand stand/common stand/efi/loader stand/efi/loader/arch/i386 stand/ficl stand/i386/libi3... X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/12: lib/libsecureboot lib/libsecureboot/h lib/libsecureboot/tests share/mk stand stand/common stand/efi/loader stand/efi/loader/arch/i386 stand/ficl stand/i386/libi386 stand/i386/loader stan... X-SVN-Commit-Revision: 359735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 04:50:22 -0000 Author: sjg Date: Thu Apr 9 04:50:19 2020 New Revision: 359735 URL: https://svnweb.freebsd.org/changeset/base/359735 Log: veloader use vectx API for kernel and modules The vectx API, computes the hash for verifying a file as it is read. This avoids the overhead of reading files twice - once to verify, then again to load. For doing an install via loader, avoiding the need to rewind large files is critical. This API is only used for modules, kernel and mdimage as these are the biggest files read by the loader. The reduction in boot time depends on how expensive the I/O is on any given platform. On a fast VM we see 6% improvement. For install via loader the first file to be verified is likely to be the kernel, so some of the prep work (finding manifest etc) done by verify_file() needs to be factored so it can be reused for vectx_open(). For missing or unrecognized fingerprint entries, we fail in vectx_open() unless verifying is disabled. Otherwise fingerprint check happens in vectx_close() and since this API is only used for files which must be verified (VE_MUST) we panic if we get an incorrect hash. Fix pkgfs stat so it satisfies libsecureboot We need a valid st_dev, st_ino and st_mtime to correctly track which files have been verified and to update our notion of time. ve_utc_set(): ignore utc if it would jump our current time by more than VE_UTC_MAX_JUMP (20 years). Allow testing of install command via userboot. Need to fix its stat implementation too. bhyveload also needs stat fixed - due to change to userboot.h Call ve_error_get() from vectx_close() when hash is wrong. Track the names of files we have hashed into pcr For the purposes of measured boot, it is important to be able to reproduce the hash reflected in loader.ve.pcr so loader.ve.hashed provides a list of names in the order they were added. Avoid unused vars when VE_ECDSA_HASH_AGAIN undefined MFC of r358744 r358767 r359307 r355962 Reviewed by: imp,tsoome,emaste Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D23827 https://reviews.freebsd.org//D24027 Added: stable/12/stand/common/readin.h - copied unchanged from r358767, head/stand/common/readin.h Modified: stable/12/lib/libsecureboot/h/libsecureboot.h stable/12/lib/libsecureboot/h/verify_file.h stable/12/lib/libsecureboot/tests/tvo.c stable/12/lib/libsecureboot/vectx.c stable/12/lib/libsecureboot/veopen.c stable/12/lib/libsecureboot/vepcr.c stable/12/lib/libsecureboot/verify_file.c stable/12/lib/libsecureboot/vets.c stable/12/share/mk/src.opts.mk stable/12/stand/common/bootstrap.h stable/12/stand/common/install.c stable/12/stand/common/interp_forth.c stable/12/stand/common/interp_simple.c stable/12/stand/common/load_elf.c stable/12/stand/common/load_elf_obj.c stable/12/stand/common/misc.c stable/12/stand/common/module.c stable/12/stand/efi/loader/arch/i386/i386_copy.c stable/12/stand/efi/loader/copy.c stable/12/stand/efi/loader/loader_efi.h stable/12/stand/efi/loader/main.c stable/12/stand/ficl/loader.c stable/12/stand/i386/libi386/i386_copy.c stable/12/stand/i386/libi386/libi386.h stable/12/stand/i386/loader/chain.c stable/12/stand/libsa/pkgfs.c stable/12/stand/loader.mk stable/12/stand/mips/beri/loader/arch.c stable/12/stand/powerpc/kboot/main.c stable/12/stand/uboot/lib/copy.c stable/12/stand/uboot/lib/libuboot.h stable/12/stand/userboot/test/test.c stable/12/stand/userboot/userboot.h stable/12/stand/userboot/userboot/conf.c stable/12/stand/userboot/userboot/copy.c stable/12/stand/userboot/userboot/host.c stable/12/stand/userboot/userboot/libuserboot.h stable/12/usr.sbin/bhyveload/bhyveload.c Modified: stable/12/lib/libsecureboot/h/libsecureboot.h ============================================================================== --- stable/12/lib/libsecureboot/h/libsecureboot.h Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/h/libsecureboot.h Thu Apr 9 04:50:19 2020 (r359735) @@ -69,12 +69,6 @@ void fingerprint_info_add(const char *, const char *, int ve_check_hash(br_hash_compat_context *, const br_hash_class *, const char *, const char *, size_t); -struct vectx; -struct vectx* vectx_open(int, const char *, off_t, struct stat *, int *); -ssize_t vectx_read(struct vectx *, void *, size_t); -off_t vectx_lseek(struct vectx *, off_t, int); -int vectx_close(struct vectx *); - char * hexdigest(char *, size_t, unsigned char *, size_t); int verify_fd(int, const char *, off_t, struct stat *); int verify_open(const char *, int); @@ -84,10 +78,11 @@ unsigned char *verify_sig(const char *, int); unsigned char *verify_asc(const char *, int); /* OpenPGP */ void ve_pcr_init(void); -void ve_pcr_update(unsigned char *, size_t); +void ve_pcr_update(const char *, unsigned char *, size_t); ssize_t ve_pcr_get(unsigned char *, size_t); int ve_pcr_updating_get(void); void ve_pcr_updating_set(int); +char * ve_pcr_hashed_get(int); /* flags for verify_{asc,sig,signed} */ #define VEF_VERBOSE 1 Modified: stable/12/lib/libsecureboot/h/verify_file.h ============================================================================== --- stable/12/lib/libsecureboot/h/verify_file.h Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/h/verify_file.h Thu Apr 9 04:50:19 2020 (r359735) @@ -39,13 +39,21 @@ struct stat; -void ve_debug_set(int); -int ve_status_get(int); -void ve_efi_init(void); -int load_manifest(const char *, const char *, const char *, struct stat *); -int pass_manifest(const char *, const char *); -int pass_manifest_export_envs(void); -int verify_file(int, const char *, off_t, int); -void verify_pcr_export(void); +int verify_prep(int, const char *, off_t, struct stat *, const char *); +void ve_debug_set(int); +char *ve_error_get(void); +void ve_efi_init(void); +int ve_status_get(int); +int load_manifest(const char *, const char *, const char *, struct stat *); +int pass_manifest(const char *, const char *); +int pass_manifest_export_envs(void); +int verify_file(int, const char *, off_t, int, const char *); +void verify_pcr_export(void); + +struct vectx; +struct vectx* vectx_open(int, const char *, off_t, struct stat *, int *, const char *); +ssize_t vectx_read(struct vectx *, void *, size_t); +off_t vectx_lseek(struct vectx *, off_t, int); +int vectx_close(struct vectx *, int, const char *); #endif /* _VERIFY_FILE_H_ */ Modified: stable/12/lib/libsecureboot/tests/tvo.c ============================================================================== --- stable/12/lib/libsecureboot/tests/tvo.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/tests/tvo.c Thu Apr 9 04:50:19 2020 (r359735) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include +size_t DestdirLen; +char *Destdir; char *Skip; int @@ -42,7 +44,10 @@ main(int argc, char *argv[]) int Vflag; char *cp; char *prefix; + char *destdir; + Destdir = NULL; + DestdirLen = 0; prefix = NULL; Skip = NULL; @@ -50,8 +55,12 @@ main(int argc, char *argv[]) printf("Trust %d\n", n); Vflag = 0; - while ((c = getopt(argc, argv, "dp:s:T:V")) != -1) { + while ((c = getopt(argc, argv, "D:dp:s:T:V")) != -1) { switch (c) { + case 'D': + Destdir = optarg; + DestdirLen = strlen(optarg); + break; case 'd': DebugVe++; break; @@ -92,7 +101,7 @@ main(int argc, char *argv[]) */ int x; - x = verify_file(fd, argv[optind], 0, VE_GUESS); + x = verify_file(fd, argv[optind], 0, VE_GUESS, __func__); printf("verify_file(%s) = %d\n", argv[optind], x); close(fd); } @@ -147,7 +156,7 @@ main(int argc, char *argv[]) lseek(fd, 0, SEEK_SET); off = st.st_size % 512; vp = vectx_open(fd, argv[optind], off, - &st, &error); + &st, &error, __func__); if (!vp) { printf("vectx_open(%s) failed: %d %s\n", argv[optind], error, @@ -155,7 +164,8 @@ main(int argc, char *argv[]) } else { off = vectx_lseek(vp, (st.st_size % 1024), SEEK_SET); - + /* we can seek backwards! */ + off = vectx_lseek(vp, off/2, SEEK_SET); if (off < st.st_size) { n = vectx_read(vp, buf, sizeof(buf)); @@ -165,7 +175,7 @@ main(int argc, char *argv[]) off = vectx_lseek(vp, 0, SEEK_END); /* repeating that should be harmless */ off = vectx_lseek(vp, 0, SEEK_END); - error = vectx_close(vp); + error = vectx_close(vp, VE_MUST, __func__); if (error) { printf("vectx_close(%s) == %d %s\n", argv[optind], error, Modified: stable/12/lib/libsecureboot/vectx.c ============================================================================== --- stable/12/lib/libsecureboot/vectx.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/vectx.c Thu Apr 9 04:50:19 2020 (r359735) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #endif #include "libsecureboot-priv.h" +#include /** * @file vectx.c @@ -50,12 +51,14 @@ struct vectx { const char *vec_path; /* path we are verifying */ const char *vec_want; /* hash value we want */ off_t vec_off; /* current offset */ + off_t vec_hashed; /* where we have hashed to */ size_t vec_size; /* size of path */ size_t vec_hashsz; /* size of hash */ int vec_fd; /* file descriptor */ int vec_status; /* verification status */ }; + /** * @brief * verify an open file as we read it @@ -86,24 +89,31 @@ struct vectx { * NULL is only returned for non-files or out-of-memory. */ struct vectx * -vectx_open(int fd, const char *path, off_t off, struct stat *stp, int *error) +vectx_open(int fd, const char *path, off_t off, struct stat *stp, + int *error, const char *caller) { struct vectx *ctx; struct stat st; size_t hashsz; char *cp; + int rc; - if (!stp) { - if (fstat(fd, &st) == 0) - stp = &st; - } + if (!stp) + stp = &st; - /* we *should* only get called for files */ - if (stp && !S_ISREG(stp->st_mode)) { - *error = 0; + rc = verify_prep(fd, path, off, stp, __func__); + + DEBUG_PRINTF(2, + ("vectx_open: caller=%s,fd=%d,name='%s',prep_rc=%d\n", + caller, fd, path, rc)); + + switch (rc) { + case VE_FINGERPRINT_NONE: + case VE_FINGERPRINT_UNKNOWN: + case VE_FINGERPRINT_WRONG: + *error = rc; return (NULL); } - ctx = malloc(sizeof(struct vectx)); if (!ctx) goto enomem; @@ -111,10 +121,16 @@ vectx_open(int fd, const char *path, off_t off, struct ctx->vec_path = path; ctx->vec_size = stp->st_size; ctx->vec_off = 0; + ctx->vec_hashed = 0; ctx->vec_want = NULL; ctx->vec_status = 0; - hashsz = 0; + ctx->vec_hashsz = hashsz = 0; + if (rc == 0) { + /* we are not verifying this */ + *error = 0; + return (ctx); + } cp = fingerprint_info_lookup(fd, path); if (!cp) { ctx->vec_status = VE_FINGERPRINT_NONE; @@ -161,6 +177,10 @@ vectx_open(int fd, const char *path, off_t off, struct vectx_lseek(ctx, off, SEEK_SET); } } + DEBUG_PRINTF(2, + ("vectx_open: caller=%s,name='%s',hashsz=%lu,status=%d\n", + caller, path, (unsigned long)ctx->vec_hashsz, + ctx->vec_status)); return (ctx); enomem: /* unlikely */ @@ -175,6 +195,8 @@ enomem: /* unlikely */ * * It is critical that all file I/O comes through here. * We keep track of current offset. + * We also track what offset we have hashed to, + * so we won't replay data if we seek backwards. * * @param[in] pctx * pointer to ctx @@ -190,6 +212,8 @@ vectx_read(struct vectx *ctx, void *buf, size_t nbytes { unsigned char *bp = buf; int n; + int delta; + int x; size_t off; if (ctx->vec_hashsz == 0) /* nothing to do */ @@ -201,9 +225,20 @@ vectx_read(struct vectx *ctx, void *buf, size_t nbytes if (n < 0) return (n); if (n > 0) { - ctx->vec_md->update(&ctx->vec_ctx.vtable, &bp[off], n); - off += n; - ctx->vec_off += n; + /* we may have seeked backwards! */ + delta = ctx->vec_hashed - ctx->vec_off; + if (delta > 0) { + x = MIN(delta, n); + off += x; + n -= x; + ctx->vec_off += x; + } + if (n > 0) { + ctx->vec_md->update(&ctx->vec_ctx.vtable, &bp[off], n); + off += n; + ctx->vec_off += n; + ctx->vec_hashed += n; + } } } while (n > 0 && off < nbytes); return (off); @@ -213,10 +248,10 @@ vectx_read(struct vectx *ctx, void *buf, size_t nbytes * @brief * vectx equivalent of lseek * - * We do not actually, seek, but call vectx_read + * When seeking forwards we actually call vectx_read * to reach the desired offset. * - * We do not support seeking backwards. + * We support seeking backwards. * * @param[in] pctx * pointer to ctx @@ -225,6 +260,8 @@ vectx_read(struct vectx *ctx, void *buf, size_t nbytes * desired offset * * @param[in] whence + * We try to convert whence to ``SEEK_SET``. + * We do not support ``SEEK_DATA`` or ``SEEK_HOLE``. * * @return offset or error. */ @@ -239,22 +276,26 @@ vectx_lseek(struct vectx *ctx, off_t off, int whence) return (lseek(ctx->vec_fd, off, whence)); /* - * Try to convert whence to SEEK_SET - * but we cannot support seeking backwards! - * Nor beyond end of file. + * Convert whence to SEEK_SET */ if (whence == SEEK_END && off <= 0) { whence = SEEK_SET; off += ctx->vec_size; - } else if (whence == SEEK_CUR && off >= 0) { + } else if (whence == SEEK_CUR) { whence = SEEK_SET; off += ctx->vec_off; } - if (whence != SEEK_SET || off < ctx->vec_off || + if (whence != SEEK_SET || (size_t)off > ctx->vec_size) { - printf("ERROR: %s: unsupported operation\n", __func__); + printf("ERROR: %s: unsupported operation: whence=%d off=%lld -> %lld\n", + __func__, whence, (long long)ctx->vec_off, (long long)off); return (-1); } + if (off < ctx->vec_hashed) { + /* seeking backwards! just do it */ + ctx->vec_off = lseek(ctx->vec_fd, off, whence); + return (ctx->vec_off); + } n = 0; do { delta = off - ctx->vec_off; @@ -275,21 +316,48 @@ vectx_lseek(struct vectx *ctx, off_t off, int whence) * We have finished reading file, compare the hash with what * we wanted. * + * Be sure to call this before closing the file, since we may + * need to seek to the end to ensure hashing is complete. + * * @param[in] pctx * pointer to ctx * * @return 0 or an error. */ int -vectx_close(struct vectx *ctx) +vectx_close(struct vectx *ctx, int severity, const char *caller) { int rc; if (ctx->vec_hashsz == 0) { rc = ctx->vec_status; } else { +#ifdef VE_PCR_SUPPORT + /* + * Only update pcr with things that must verify + * these tend to be processed in a more deterministic + * order, which makes our pseudo pcr more useful. + */ + ve_pcr_updating_set((severity == VE_MUST)); +#endif + /* make sure we have hashed it all */ + vectx_lseek(ctx, 0, SEEK_END); rc = ve_check_hash(&ctx->vec_ctx, ctx->vec_md, ctx->vec_path, ctx->vec_want, ctx->vec_hashsz); + } + DEBUG_PRINTF(2, + ("vectx_close: caller=%s,name='%s',rc=%d,severity=%d\n", + caller,ctx->vec_path, rc, severity)); + if (rc == VE_FINGERPRINT_WRONG) { + printf("Unverified: %s\n", ve_error_get()); +#if !defined(UNIT_TEST) && !defined(DEBUG_VECTX) + /* we are generally called with VE_MUST */ + if (severity > VE_WANT) + panic("cannot continue"); +#endif + } else if (severity > VE_WANT) { + printf("%serified %s\n", (rc <= 0) ? "Unv" : "V", + ctx->vec_path); } free(ctx); return ((rc < 0) ? rc : 0); Modified: stable/12/lib/libsecureboot/veopen.c ============================================================================== --- stable/12/lib/libsecureboot/veopen.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/veopen.c Thu Apr 9 04:50:19 2020 (r359735) @@ -86,9 +86,11 @@ fingerprint_info_add(const char *filename, const char } nfip->fi_prefix = strdup(filename); cp = strrchr(nfip->fi_prefix, '/'); - if (cp) + if (cp == nfip->fi_prefix) { + cp[1] = '\0'; + } else if (cp) { *cp = '\0'; - else { + } else { free(nfip->fi_prefix); free(nfip); return; @@ -96,7 +98,7 @@ fingerprint_info_add(const char *filename, const char } /* collapse any trailing ..[/] */ n = 0; - while ((cp = strrchr(nfip->fi_prefix, '/')) != NULL) { + while ((cp = strrchr(nfip->fi_prefix, '/')) > nfip->fi_prefix) { if (cp[1] == '\0') { /* trailing "/" */ *cp = '\0'; continue; Modified: stable/12/lib/libsecureboot/vepcr.c ============================================================================== --- stable/12/lib/libsecureboot/vepcr.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/vepcr.c Thu Apr 9 04:50:19 2020 (r359735) @@ -25,6 +25,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include "libsecureboot-priv.h" /* @@ -43,8 +44,17 @@ __FBSDID("$FreeBSD$"); static const br_hash_class *pcr_md = NULL; static br_hash_compat_context pcr_ctx; static size_t pcr_hlen = 0; -static int pcr_updating; +static int pcr_updating = -1; +struct hashed_info { + const char *hi_path; + const char *hi_basename; + STAILQ_ENTRY(hashed_info) entries; +}; + +static STAILQ_HEAD(, hashed_info) hi_list; + + /** * @brief initialize pcr context * @@ -54,10 +64,13 @@ static int pcr_updating; void ve_pcr_init(void) { - pcr_updating = 0; - pcr_hlen = br_sha256_SIZE; - pcr_md = &br_sha256_vtable; - pcr_md->init(&pcr_ctx.vtable); + if (pcr_updating < 0) { + pcr_updating = 0; + pcr_hlen = br_sha256_SIZE; + pcr_md = &br_sha256_vtable; + pcr_md->init(&pcr_ctx.vtable); + STAILQ_INIT(&hi_list); + } } /** @@ -82,10 +95,28 @@ ve_pcr_updating_set(int updating) * @brief update pcr context */ void -ve_pcr_update(unsigned char *data, size_t dlen) +ve_pcr_update(const char *path, unsigned char *data, size_t dlen) { - if (pcr_updating != 0 && pcr_md != NULL) + struct hashed_info *hip; + + if (pcr_updating > 0 && pcr_md != NULL) { pcr_md->update(&pcr_ctx.vtable, data, dlen); + /* if mallocs fail, measured boot will likely fail too */ + if ((hip = malloc(sizeof(struct hashed_info)))) { + hip->hi_path = strdup(path); + if (!hip->hi_path) { + free(hip); + return; + } + hip->hi_basename = strrchr(hip->hi_path, '/'); + if (hip->hi_basename) { + hip->hi_basename++; + } else { + hip->hi_basename = hip->hi_path; + } + STAILQ_INSERT_TAIL(&hi_list, hip, entries); + } + } } /** @@ -102,3 +133,37 @@ ve_pcr_get(unsigned char *buf, size_t sz) return (pcr_hlen); } +/** + * @brief get list of paths in prc + */ +char * +ve_pcr_hashed_get(int flags) +{ + const char *cp; + char *hinfo; + struct hashed_info *hip; + size_t nbytes; + size_t x; + int n; + + n = 0; + nbytes = x = 0; + hinfo = NULL; + STAILQ_FOREACH(hip, &hi_list, entries) { + nbytes += 1 + strlen(flags ? hip->hi_basename : hip->hi_path); + } + if (nbytes > 1) { + hinfo = malloc(nbytes + 2); + if (hinfo) { + STAILQ_FOREACH(hip, &hi_list, entries) { + cp = flags ? hip->hi_basename : hip->hi_path; + n = snprintf(&hinfo[x], nbytes - x, "%s,", cp); + x += n; + } + if (x > 0) { + hinfo[x-1] = '\0'; + } + } + } + return hinfo; +} Modified: stable/12/lib/libsecureboot/verify_file.c ============================================================================== --- stable/12/lib/libsecureboot/verify_file.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/verify_file.c Thu Apr 9 04:50:19 2020 (r359735) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); * define MANIFEST_SKIP to Skip - in tests/tvo.c so that * tvo can control the value we use in find_manifest() */ +extern char *Destdir; +extern size_t DestdirLen; extern char *Skip; # undef MANIFEST_SKIP # define MANIFEST_SKIP Skip @@ -115,10 +117,12 @@ is_verified(struct stat *stp) { struct verify_status *vsp; - for (vsp = verified_files; vsp != NULL; vsp = vsp->vs_next) { - if (stp->st_dev == vsp->vs_dev && - stp->st_ino == vsp->vs_ino) - return (vsp->vs_status); + if (stp->st_ino > 0) { + for (vsp = verified_files; vsp != NULL; vsp = vsp->vs_next) { + if (stp->st_dev == vsp->vs_dev && + stp->st_ino == vsp->vs_ino) + return (vsp->vs_status); + } } return (VE_NOT_CHECKED); } @@ -167,12 +171,21 @@ load_manifest(const char *name, const char *prefix, ve_utc_set(stp->st_mtime); content = (char *)verify_signed(name, VEF_VERBOSE); if (content) { +#ifdef UNIT_TEST + if (DestdirLen > 0 && + strncmp(name, Destdir, DestdirLen) == 0) { + name += DestdirLen; + if (prefix && + strncmp(prefix, Destdir, DestdirLen) == 0) + prefix += DestdirLen; + } +#endif fingerprint_info_add(name, prefix, skip, content, stp); add_verify_status(stp, VE_VERIFIED); loaded_manifests = 1; /* we are verifying! */ DEBUG_PRINTF(3, ("loaded: %s %s %s\n", name, prefix, skip)); - rc = 0; + rc = VE_VERIFIED; } else { rc = VE_FINGERPRINT_WRONG; add_verify_status(stp, rc); /* remember */ @@ -245,13 +258,15 @@ severity_guess(const char *filename) return (VE_WANT); } +static int Verifying = -1; /* 0 if not verifying */ + static void verify_tweak(int fd, off_t off, struct stat *stp, char *tweak, int *accept_no_fp, - int *verbose, int *verifying) + int *verbose) { if (strcmp(tweak, "off") == 0) { - *verifying = 0; + Verifying = 0; } else if (strcmp(tweak, "strict") == 0) { /* anything caller wants verified must be */ *accept_no_fp = VE_WANT; @@ -314,7 +329,60 @@ getenv_int(const char *var, int def) return (int)val; } + /** + * @brief prepare to verify an open file + * + * @param[in] fd + * open descriptor + * + * @param[in] filename + * path we opened and will use to lookup fingerprint + * + * @param[in] stp + * stat pointer so we can check file type + */ +int +verify_prep(int fd, const char *filename, off_t off, struct stat *stp, + const char *caller) +{ + int rc; + + if (Verifying < 0) { + Verifying = ve_trust_init(); +#ifndef UNIT_TEST + ve_debug_set(getenv_int("VE_DEBUG_LEVEL", VE_DEBUG_LEVEL)); +#endif + /* initialize ve_status with default result */ + rc = Verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING; + ve_status_set(0, rc); + ve_status_state = VE_STATUS_NONE; + if (Verifying) { + ve_self_tests(); + ve_anchor_verbose_set(1); + } + } + if (!Verifying || fd < 0) + return (0); + if (stp) { + if (fstat(fd, stp) < 0 || !S_ISREG(stp->st_mode)) + return (0); + } + DEBUG_PRINTF(2, + ("verify_prep: caller=%s,fd=%d,name='%s',off=%lld,dev=%lld,ino=%lld\n", + caller, fd, filename, (long long)off, (long long)stp->st_dev, + (long long)stp->st_ino)); + rc = is_verified(stp); + DEBUG_PRINTF(4,("verify_prep: is_verified()->%d\n", rc)); + if (rc == VE_NOT_CHECKED) { + rc = find_manifest(filename); + } else { + ve_status_set(fd, rc); + } + return (rc); +} + +/** * @brief verify an open file * * @param[in] fd @@ -342,45 +410,26 @@ getenv_int(const char *var, int def) * @return >= 0 on success < 0 on failure */ int -verify_file(int fd, const char *filename, off_t off, int severity) +verify_file(int fd, const char *filename, off_t off, int severity, + const char *caller) { - static int verifying = -1; + static int once; static int accept_no_fp = ACCEPT_NO_FP_DEFAULT; static int verbose = VE_VERBOSE_DEFAULT; struct stat st; char *cp; int rc; - if (verifying < 0) { - verifying = ve_trust_init(); - verbose = getenv_int("VE_VERBOSE", VE_VERBOSE_DEFAULT); - ve_debug_set(getenv_int("VE_DEBUG_LEVEL", VE_DEBUG_LEVEL)); - /* initialize ve_status with default result */ - rc = verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING; - ve_status_set(0, rc); - ve_status_state = VE_STATUS_NONE; - if (verifying) { - ve_self_tests(); - ve_anchor_verbose_set(1); - } - } - if (!verifying) - return (0); + rc = verify_prep(fd, filename, off, &st, caller); - if (fd < 0 || fstat(fd, &st) < 0 || !S_ISREG(st.st_mode)) + if (!rc) return (0); - DEBUG_PRINTF(3, ("fd=%d,name='%s',off=%lld,dev=%lld,ino=%lld\n", - fd, filename, (long long)off, (long long)st.st_dev, - (long long)st.st_ino)); - - - rc = is_verified(&st); - if (rc != VE_NOT_CHECKED) { - ve_status_set(fd, rc); - return (rc); + if (!once) { + once++; + verbose = getenv_int("VE_VERBOSE", VE_VERBOSE_DEFAULT); } - rc = find_manifest(filename); + if (rc != VE_FINGERPRINT_WRONG && loaded_manifests) { if (severity <= VE_GUESS) severity = severity_guess(filename); @@ -392,6 +441,12 @@ verify_file(int fd, const char *filename, off_t off, i */ ve_pcr_updating_set((severity == VE_MUST)); #endif +#ifdef UNIT_TEST + if (DestdirLen > 0 && + strncmp(filename, Destdir, DestdirLen) == 0) { + filename += DestdirLen; + } +#endif if ((rc = verify_fd(fd, filename, off, &st)) >= 0) { if (verbose || severity > VE_WANT) { #if defined(VE_DEBUG_LEVEL) && VE_DEBUG_LEVEL > 0 @@ -406,14 +461,12 @@ verify_file(int fd, const char *filename, off_t off, i #endif } if (severity < VE_MUST) { /* not a kernel or module */ - if ((cp = strrchr(filename, '/'))) { cp++; if (strncmp(cp, "loader.ve.", 10) == 0) { cp += 10; verify_tweak(fd, off, &st, cp, - &accept_no_fp, &verbose, - &verifying); + &accept_no_fp, &verbose); } } } @@ -460,6 +513,7 @@ verify_pcr_export(void) #ifdef VE_PCR_SUPPORT char hexbuf[br_sha256_SIZE * 2 + 2]; unsigned char hbuf[br_sha256_SIZE]; + char *hinfo; char *hex; ssize_t hlen; @@ -469,6 +523,17 @@ verify_pcr_export(void) if (hex) { hex[hlen*2] = '\0'; /* clobber newline */ setenv("loader.ve.pcr", hex, 1); + DEBUG_PRINTF(1, + ("%s: setenv(loader.ve.pcr, %s\n", __func__, + hex)); + hinfo = ve_pcr_hashed_get(1); + if (hinfo) { + setenv("loader.ve.hashed", hinfo, 1); + DEBUG_PRINTF(1, + ("%s: setenv(loader.ve.hashed, %s\n", + __func__, hinfo)); + free(hinfo); + } } } #endif Modified: stable/12/lib/libsecureboot/vets.c ============================================================================== --- stable/12/lib/libsecureboot/vets.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/lib/libsecureboot/vets.c Thu Apr 9 04:50:19 2020 (r359735) @@ -44,6 +44,10 @@ __FBSDID("$FreeBSD$"); #endif #define SECONDS_PER_DAY 86400 +#define SECONDS_PER_YEAR 365 * SECONDS_PER_DAY +#ifndef VE_UTC_MAX_JUMP +# define VE_UTC_MAX_JUMP 20 * SECONDS_PER_YEAR +#endif #define X509_DAYS_TO_UTC0 719528 int DebugVe = 0; @@ -113,12 +117,14 @@ static time_t ve_utc = 0; * set ve_utc used for certificate verification * * @param[in] utc - * time - ignored unless greater than current value. + * time - ignored unless greater than current value + * and not a leap of 20 years or more. */ void ve_utc_set(time_t utc) { - if (utc > ve_utc) { + if (utc > ve_utc && + (ve_utc == 0 || (utc - ve_utc) < VE_UTC_MAX_JUMP)) { DEBUG_PRINTF(2, ("Set ve_utc=%jd\n", (intmax_t)utc)); ve_utc = utc; } @@ -345,11 +351,11 @@ ve_trust_init(void) if (once >= 0) return (once); - - ve_utc_set(time(NULL)); + once = 0; /* to be sure */ #ifdef BUILD_UTC - ve_utc_set(BUILD_UTC); /* just in case */ + ve_utc_set(BUILD_UTC); /* ensure sanity */ #endif + ve_utc_set(time(NULL)); ve_error_set(NULL); /* make sure it is empty */ #ifdef VE_PCR_SUPPORT ve_pcr_init(); @@ -642,9 +648,10 @@ hexdigest(char *buf, size_t bufsz, unsigned char *foo, static unsigned char * verify_ec(br_x509_pkey *pk, const char *file, const char *sigfile) { - char hexbuf[br_sha512_SIZE * 2 + 2]; +#ifdef VE_ECDSA_HASH_AGAIN + char *hex, hexbuf[br_sha512_SIZE * 2 + 2]; +#endif unsigned char rhbuf[br_sha512_SIZE]; - char *hex; br_sha256_context ctx; unsigned char *fcp, *scp; size_t flen, slen, plen; @@ -902,7 +909,7 @@ ve_check_hash(br_hash_compat_context *ctx, const br_ha md->out(&ctx->vtable, hbuf); #ifdef VE_PCR_SUPPORT - ve_pcr_update(hbuf, hlen); + ve_pcr_update(path, hbuf, hlen); #endif hex = hexdigest(hexbuf, sizeof(hexbuf), hbuf, hlen); if (!hex) Modified: stable/12/share/mk/src.opts.mk ============================================================================== --- stable/12/share/mk/src.opts.mk Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/share/mk/src.opts.mk Thu Apr 9 04:50:19 2020 (r359735) @@ -221,6 +221,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \ CLANG_FULL/CLANG \ LOADER_VERIEXEC/BEARSSL \ LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \ + LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \ VERIEXEC/BEARSSL \ # MK_*_SUPPORT options which default to "yes" unless their corresponding Modified: stable/12/stand/common/bootstrap.h ============================================================================== --- stable/12/stand/common/bootstrap.h Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/stand/common/bootstrap.h Thu Apr 9 04:50:19 2020 (r359735) @@ -33,6 +33,8 @@ #include #include +#include "readin.h" + /* Commands and return values; nonzero return sets command_errmsg != NULL */ typedef int (bootblk_cmd_t)(int argc, char *argv[]); #define COMMAND_ERRBUFSZ (256) @@ -70,8 +72,8 @@ void hexdump(caddr_t region, size_t len); size_t strlenout(vm_offset_t str); char *strdupout(vm_offset_t str); void kern_bzero(vm_offset_t dest, size_t len); -int kern_pread(int fd, vm_offset_t dest, size_t len, off_t off); -void *alloc_pread(int fd, off_t off, size_t len); +int kern_pread(readin_handle_t fd, vm_offset_t dest, size_t len, off_t off); +void *alloc_pread(readin_handle_t fd, off_t off, size_t len); /* bcache.c */ void bcache_init(size_t nblks, size_t bsize); @@ -303,7 +305,7 @@ struct arch_switch ssize_t (*arch_copyout)(const vm_offset_t src, void *dest, const size_t len); /* Read from file to module address space, same semantics as read() */ - ssize_t (*arch_readin)(const int fd, vm_offset_t dest, + ssize_t (*arch_readin)(readin_handle_t fd, vm_offset_t dest, const size_t len); /* Perform ISA byte port I/O (only for systems with ISA) */ int (*arch_isainb)(int port); @@ -347,10 +349,6 @@ time_t time(time_t *tloc); #ifndef CTASSERT #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") -#endif - -#ifdef LOADER_VERIEXEC -#include #endif #endif /* !_BOOTSTRAP_H_ */ Modified: stable/12/stand/common/install.c ============================================================================== --- stable/12/stand/common/install.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/stand/common/install.c Thu Apr 9 04:50:19 2020 (r359735) @@ -210,6 +210,13 @@ install(char *pkgname) if (currdev != NULL && strcmp(currdev, "pxe0:") == 0) { devname = "pxe0"; proto = NULL; +#ifdef HOSTPROG + } else if (currdev != NULL && strcmp(currdev, "host0:") == 0) { + extern struct fs_ops host_fsops; + + devname = "host0"; + proto = &host_fsops; +#endif } else { devname = "disk1"; proto = &dosfs_fsops; @@ -236,6 +243,10 @@ install(char *pkgname) goto invalid_url; setenv("serverip", inet_ntoa(servip), 1); + + if (proto == &tftp_fsops) { + tftpip.s_addr = servip.s_addr; + } *pkgname = '/'; } else Modified: stable/12/stand/common/interp_forth.c ============================================================================== --- stable/12/stand/common/interp_forth.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/stand/common/interp_forth.c Thu Apr 9 04:50:19 2020 (r359735) @@ -284,7 +284,7 @@ bf_init(void) /* try to load and run init file if present */ if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) { #ifdef LOADER_VERIEXEC - if (verify_file(fd, "/boot/boot.4th", 0, VE_GUESS) < 0) { + if (verify_file(fd, "/boot/boot.4th", 0, VE_GUESS, __func__) < 0) { close(fd); return; } @@ -386,7 +386,7 @@ interp_include(const char *filename) } #ifdef LOADER_VERIEXEC - if (verify_file(fd, filename, 0, VE_GUESS) < 0) { + if (verify_file(fd, filename, 0, VE_GUESS, __func__) < 0) { close(fd); sprintf(command_errbuf,"can't verify '%s'", filename); return(CMD_ERROR); Modified: stable/12/stand/common/interp_simple.c ============================================================================== --- stable/12/stand/common/interp_simple.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/stand/common/interp_simple.c Thu Apr 9 04:50:19 2020 (r359735) @@ -97,7 +97,7 @@ interp_include(const char *filename) } #ifdef LOADER_VERIEXEC - if (verify_file(fd, filename, 0, VE_GUESS) < 0) { + if (verify_file(fd, filename, 0, VE_GUESS, __func__) < 0) { close(fd); sprintf(command_errbuf,"can't verify '%s'", filename); return(CMD_ERROR); Modified: stable/12/stand/common/load_elf.c ============================================================================== --- stable/12/stand/common/load_elf.c Thu Apr 9 02:00:59 2020 (r359734) +++ stable/12/stand/common/load_elf.c Thu Apr 9 04:50:19 2020 (r359735) @@ -71,8 +71,17 @@ typedef struct elf_file { size_t firstlen; int kernel; uint64_t off; +#ifdef LOADER_VERIEXEC_VECTX + struct vectx *vctx; +#endif } *elf_file_t; +#ifdef LOADER_VERIEXEC_VECTX +#define VECTX_HANDLE(ef) (ef)->vctx +#else +#define VECTX_HANDLE(ef) (ef)->fd +#endif + static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, uint64_t loadaddr); static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, @@ -214,7 +223,20 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) close(ef->fd); return (ENOMEM); } - bytes_read = read(ef->fd, ef->firstpage, PAGE_SIZE); +#ifdef LOADER_VERIEXEC_VECTX + { + int verror; + + ef->vctx = vectx_open(ef->fd, filename, 0L, NULL, &verror, __func__); + if (verror) { + printf("Unverified %s: %s\n", filename, ve_error_get()); + close(ef->fd); + free(ef->vctx); + return (EAUTH); + } + } +#endif + bytes_read = VECTX_READ(VECTX_HANDLE(ef), ef->firstpage, PAGE_SIZE); ef->firstlen = (size_t)bytes_read; if (bytes_read < 0 || ef->firstlen <= sizeof(Elf_Ehdr)) { err = EFTYPE; /* could be EIO, but may be small file */ @@ -245,10 +267,10 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) goto error; } -#ifdef LOADER_VERIEXEC - if (verify_file(ef->fd, filename, bytes_read, VE_MUST) < 0) { - err = EAUTH; - goto error; +#if defined(LOADER_VERIEXEC) && !defined(LOADER_VERIEXEC_VECTX) + if (verify_file(ef->fd, filename, bytes_read, VE_MUST, __func__) < 0) { + err = EAUTH; + goto error; } #endif return (0); @@ -259,6 +281,9 @@ error: ef->firstpage = NULL; } if (ef->fd != -1) { +#ifdef LOADER_VERIEXEC_VECTX + free(ef->vctx); +#endif close(ef->fd); ef->fd = -1; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Thu Apr 9 06:32:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 338EA2AFDBB; Thu, 9 Apr 2020 06:32:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yWY00c0yz49QG; Thu, 9 Apr 2020 06:32:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1026486D0; Thu, 9 Apr 2020 06:32:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0396WphR047013; Thu, 9 Apr 2020 06:32:51 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0396WpQD047012; Thu, 9 Apr 2020 06:32:51 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <202004090632.0396WpQD047012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 9 Apr 2020 06:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359737 - stable/12/sys/ufs/ufs X-SVN-Group: stable-12 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/12/sys/ufs/ufs X-SVN-Commit-Revision: 359737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 06:32:52 -0000 Author: mckusick Date: Thu Apr 9 06:32:51 2020 New Revision: 359737 URL: https://svnweb.freebsd.org/changeset/base/359737 Log: Revert MFC of 359612 due to reported problems. Modified: stable/12/sys/ufs/ufs/inode.h Modified: stable/12/sys/ufs/ufs/inode.h ============================================================================== --- stable/12/sys/ufs/ufs/inode.h Thu Apr 9 05:11:18 2020 (r359736) +++ stable/12/sys/ufs/ufs/inode.h Thu Apr 9 06:32:51 2020 (r359737) @@ -192,11 +192,10 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) \ - (((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) -#define MOUNTEDSOFTDEP(mp) (((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) -#define DOINGSUJ(vp) (((vp)->v_mount->mnt_flag & MNT_SUJ) != 0) -#define MOUNTEDSUJ(mp) (((mp)->mnt_flag & MNT_SUJ) != 0) +#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) +#define MOUNTEDSUJ(mp) ((mp)->mnt_flag & MNT_SUJ) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-svn-src-stable-12@freebsd.org Thu Apr 9 07:12:00 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFB242B0A8F; Thu, 9 Apr 2020 07:12:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yXQ84dC5z4Cl8; Thu, 9 Apr 2020 07:12:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99EC68E6C; Thu, 9 Apr 2020 07:12:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0397C0iU069517; Thu, 9 Apr 2020 07:12:00 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0397C05w069515; Thu, 9 Apr 2020 07:12:00 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202004090712.0397C05w069515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 9 Apr 2020 07:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359739 - stable/12/usr.sbin/syslogd X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/usr.sbin/syslogd X-SVN-Commit-Revision: 359739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 07:12:00 -0000 Author: ae Date: Thu Apr 9 07:11:59 2020 New Revision: 359739 URL: https://svnweb.freebsd.org/changeset/base/359739 Log: MFC r359327,359328: Add property-based filters for syslogd. Property-based filters allow substring and regular expressions (see re_format(7)) matching against various message attributes. Filter specification starts with '#:' or ':' followed by three comma-separated fields property, operator, "value". Value must be double-quoted. A double quote and backslash must be escaped by a backslash. Following properties are supported as test value: o msg - body of the message received; o programname - program name sent the message; o hostname - hostname of message's originator; o source - an alias for hostname. Supported operators: o contains - true if filter value is found as a substring of property; o isequal - true if filter value is equal to property; o startswith - true if property starts with filter value; o regex - true if property matches basic regular expression defined in filter value; o ereregex - true if property matches extended regular expression defined in filter value; Operator may be prefixed by '!' to invert compare logic or by 'icase_' to make comparison function case insensitive. Submitted by: Boris N. Lytochkin Relnotes: yes Differential Revision: https://reviews.freebsd.org/D23468 Modified: stable/12/usr.sbin/syslogd/syslog.conf.5 stable/12/usr.sbin/syslogd/syslogd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/syslogd/syslog.conf.5 ============================================================================== --- stable/12/usr.sbin/syslogd/syslog.conf.5 Thu Apr 9 06:35:50 2020 (r359738) +++ stable/12/usr.sbin/syslogd/syslog.conf.5 Thu Apr 9 07:11:59 2020 (r359739) @@ -28,7 +28,7 @@ .\" @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 1, 2016 +.Dd March 26, 2020 .Dt SYSLOG.CONF 5 .Os .Sh NAME @@ -44,9 +44,10 @@ file is the configuration file for the program. It consists of blocks of lines separated by -.Em program -and +.Em program , .Em hostname +or +.Em property-based filter specifications (separations appear alone on their lines), with each line containing two fields: the .Em selector @@ -154,14 +155,16 @@ values specified to the library routine. .Pp Each block of lines is separated from the previous block by a -.Em program -or +.Em program , .Em hostname +or +.Em property-based filter specification. A block will only log messages corresponding to the most recent -.Em program -and +.Em program , .Em hostname +and +.Em property-based filter specifications given. Thus, with a block which selects .Ql ppp @@ -236,11 +239,24 @@ As for program specifications, multiple comma-separate values may be specified for hostname specifications. .Pp A -.Em program +.Em property-based filter +specification is a line beginning with +.Ql #: or +.Ql \&: +and the following blocks will be applied only when filter value +matches given filter propertie's value. See +.Sx PROPERTY-BASED FILTERS +section for more details. +.Pp +A +.Em program , .Em hostname -specification may be reset by giving the program or hostname as -.Ql * . +or +.Em property-based filter +specification may be reset by giving +.Ql * +as an argument. .Pp See .Xr syslog 3 @@ -434,6 +450,78 @@ in this case preceding is removed and .Ql # is treated as an ordinary character. +.Sh PROPERTY-BASED FILTERS +.Em program , +.Em hostname +specifications performs exact match filtering against explicit field only. +.Em Property-based filters +feature substring and regular expressions (see +.Xr re_format 7 ) +matching against various message attributes. +Filter specification starts with +.Ql #: +or +.Ql \&: +followed by three comma-separated fields +.Em property , operator , \&"value\&" . +Value must be double-quoted. A double quote and backslash must be escaped by +a backslash. +.Pp +Following +.Em properties +are supported as test value: +.Pp +.Bl -bullet -compact +.It +.Ql msg +- body of the message received. +.It +.Ql programname +- program name sent the message +.It +.Ql hostname +- hostname of message's originator +.It +.Ql source +- an alias for hostname +.El +.Pp +Operator specifies a comparison function between +.Em propertie's + value against filter's value. +Possible operators: +.Pp +.Bl -bullet -compact +.It +.Ql contains +- true if filter value is found as a substring of +.Em property +.It +.Ql isequal +- true if filter value is equal to +.Em property +.It +.Ql startswith +- true if property starts with filter value +.It +.Ql regex +- true if property matches basic regular expression defined in filter value +.It +.Ql ereregex +- true if property matches extended regular expression defined in filter value +.El +.Pp +Operator may be prefixed by +.Pp +.Bl -bullet -compact +.It +.Ql \&! +- to invert compare logic +.It +.Ql icase_ +- to make comparison function case insensitive +.El +.Pp .Sh IMPLEMENTATION NOTES The .Dq kern @@ -503,6 +591,21 @@ console.* /var/log/console.log # Log ipfw messages without syncing after every message. !ipfw *.* -/var/log/ipfw + +# Log ipfw messages with "Deny" in the message body. +:msg, contains, ".*Deny.*" +*.* /var/log/ipfw.deny + +# Reset program name filtering +!* + +# Log messages from bird or bird6 into one file +:processname, regex, "^bird6?$" +*.* /var/log/bird-all.log + +# Log messages from servers in racks 10-19 in multiple locations, case insensitive +:hostname, icase_ereregex, "^server-(dcA|podB|cdn)-rack1[0-9]{2}\\..*" +*.* /var/log/racks10..19.log .Ed .Sh SEE ALSO .Xr syslog 3 , Modified: stable/12/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/12/usr.sbin/syslogd/syslogd.c Thu Apr 9 06:35:50 2020 (r359738) +++ stable/12/usr.sbin/syslogd/syslogd.c Thu Apr 9 07:11:59 2020 (r359739) @@ -143,6 +143,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "pathnames.h" #include "ttymsg.h" @@ -214,6 +215,37 @@ struct logtime { #define RFC3164_DATEFMT "%b %e %H:%M:%S" /* + * This structure holds a property-based filter + */ + +struct prop_filter { + uint8_t prop_type; +#define PROP_TYPE_NOOP 0 +#define PROP_TYPE_MSG 1 +#define PROP_TYPE_HOSTNAME 2 +#define PROP_TYPE_PROGNAME 3 + + uint8_t cmp_type; +#define PROP_CMP_CONTAINS 1 +#define PROP_CMP_EQUAL 2 +#define PROP_CMP_STARTS 3 +#define PROP_CMP_REGEX 4 + + uint16_t cmp_flags; +#define PROP_FLAG_EXCLUDE (1 << 0) +#define PROP_FLAG_ICASE (1 << 1) + + union { + char *p_strval; + regex_t *p_re; + } pflt_uniptr; +#define pflt_strval pflt_uniptr.p_strval +#define pflt_re pflt_uniptr.p_re + + size_t pflt_strlen; +}; + +/* * This structure represents the files that will have log * copies printed. * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY @@ -232,6 +264,7 @@ struct filed { #define PRI_EQ 0x2 #define PRI_GT 0x4 char *f_program; /* program this applies to */ + struct prop_filter *f_prop_filter; /* property-based filter */ union { char f_uname[MAXUNAMES][MAXLOGNAME]; struct { @@ -378,7 +411,8 @@ static int allowaddr(char *); static int addfile(struct filed *); static int addpeer(struct peer *); static int addsock(struct sockaddr *, socklen_t, struct socklist *); -static struct filed *cfline(const char *, const char *, const char *); +static struct filed *cfline(const char *, const char *, const char *, + const char *); static const char *cvthname(struct sockaddr *); static void deadq_enter(pid_t, const char *); static int deadq_remove(struct deadq_entry *); @@ -404,6 +438,10 @@ static int socklist_recv_sock(struct socklist *); static int socklist_recv_signal(struct socklist *); static void sighandler(int); static int skip_message(const char *, const char *, int); +static int evaluate_prop_filter(const struct prop_filter *filter, + const char *value); +static int prop_filter_compile(struct prop_filter *pfilter, + char *filterstr); static void parsemsg(const char *, char *); static void printsys(char *); static int p_open(const char *, pid_t *); @@ -1425,6 +1463,69 @@ skip_message(const char *name, const char *spec, int c } /* + * Match some property of the message against a filter. + * Return a non-0 value if the message must be ignored + * based on the filter. + */ +static int +evaluate_prop_filter(const struct prop_filter *filter, const char *value) +{ + const char *s = NULL; + const int exclude = ((filter->cmp_flags & PROP_FLAG_EXCLUDE) > 0); + size_t valuelen; + + if (value == NULL) + return (-1); + + if (filter->cmp_type == PROP_CMP_REGEX) { + if (regexec(filter->pflt_re, value, 0, NULL, 0) == 0) + return (exclude); + else + return (!exclude); + } + + valuelen = strlen(value); + + /* a shortcut for equal with different length is always false */ + if (filter->cmp_type == PROP_CMP_EQUAL && + valuelen != filter->pflt_strlen) + return (!exclude); + + if (filter->cmp_flags & PROP_FLAG_ICASE) + s = strcasestr(value, filter->pflt_strval); + else + s = strstr(value, filter->pflt_strval); + + /* + * PROP_CMP_CONTAINS true if s + * PROP_CMP_STARTS true if s && s == value + * PROP_CMP_EQUAL true if s && s == value && + * valuelen == filter->pflt_strlen + * (and length match is checked + * already) + */ + + switch (filter->cmp_type) { + case PROP_CMP_STARTS: + case PROP_CMP_EQUAL: + if (s != value) + return (!exclude); + /* FALLTHROUGH */ + case PROP_CMP_CONTAINS: + if (s) + return (exclude); + else + return (!exclude); + break; + default: + /* unknown cmp_type */ + break; + } + + return (-1); +} + +/* * Logs a message to the appropriate log files, users, etc. based on the * priority. Log messages are always formatted according to RFC 3164, * even if they were in RFC 5424 format originally, The MSGID and @@ -1515,6 +1616,30 @@ logmsg(int pri, const struct logtime *timestamp, const f->f_program, 1)) continue; + /* skip messages if a property does not match filter */ + if (f->f_prop_filter != NULL && + f->f_prop_filter->prop_type != PROP_TYPE_NOOP) { + switch (f->f_prop_filter->prop_type) { + case PROP_TYPE_MSG: + if (evaluate_prop_filter(f->f_prop_filter, + msg)) + continue; + break; + case PROP_TYPE_HOSTNAME: + if (evaluate_prop_filter(f->f_prop_filter, + hostname)) + continue; + break; + case PROP_TYPE_PROGNAME: + if (evaluate_prop_filter(f->f_prop_filter, + app_name == NULL ? "" : app_name)) + continue; + break; + default: + continue; + } + } + /* skip message to console if it has already been printed */ if (f->f_type == F_CONSOLE && (flags & IGN_CONS)) continue; @@ -2204,6 +2329,7 @@ readconfigfile(FILE *cf, int allow_includes) char host[MAXHOSTNAMELEN]; char prog[LINE_MAX]; char file[MAXPATHLEN]; + char pfilter[LINE_MAX]; char *p, *tmp; int i, nents; size_t include_len; @@ -2214,6 +2340,7 @@ readconfigfile(FILE *cf, int allow_includes) include_len = sizeof(include_str) -1; (void)strlcpy(host, "*", sizeof(host)); (void)strlcpy(prog, "*", sizeof(prog)); + (void)strlcpy(pfilter, "*", sizeof(pfilter)); while (fgets(cline, sizeof(cline), cf) != NULL) { /* * check for end-of-section, comments, strip off trailing @@ -2262,7 +2389,7 @@ readconfigfile(FILE *cf, int allow_includes) } if (*p == '#') { p++; - if (*p != '!' && *p != '+' && *p != '-') + if (*p == '\0' || strchr("!+-:", *p) == NULL) continue; } if (*p == '+' || *p == '-') { @@ -2299,6 +2426,17 @@ readconfigfile(FILE *cf, int allow_includes) prog[i] = 0; continue; } + if (*p == ':') { + p++; + while (isspace(*p)) + p++; + if ((!*p) || (*p == '*')) { + (void)strlcpy(pfilter, "*", sizeof(pfilter)); + continue; + } + (void)strlcpy(pfilter, p, sizeof(pfilter)); + continue; + } for (p = cline + 1; *p != '\0'; p++) { if (*p != '#') continue; @@ -2312,7 +2450,7 @@ readconfigfile(FILE *cf, int allow_includes) } for (i = strlen(cline) - 1; i >= 0 && isspace(cline[i]); i--) cline[i] = '\0'; - f = cfline(cline, prog, host); + f = cfline(cline, prog, host, pfilter); if (f != NULL) addfile(f); free(f); @@ -2406,17 +2544,31 @@ init(int signo) STAILQ_REMOVE_HEAD(&fhead, next); free(f->f_program); free(f->f_host); + if (f->f_prop_filter) { + switch (f->f_prop_filter->cmp_type) { + case PROP_CMP_REGEX: + regfree(f->f_prop_filter->pflt_re); + free(f->f_prop_filter->pflt_re); + break; + case PROP_CMP_CONTAINS: + case PROP_CMP_EQUAL: + case PROP_CMP_STARTS: + free(f->f_prop_filter->pflt_strval); + break; + } + free(f->f_prop_filter); + } free(f); } /* open the configuration file */ if ((cf = fopen(ConfFile, "r")) == NULL) { dprintf("cannot open %s\n", ConfFile); - f = cfline("*.ERR\t/dev/console", "*", "*"); + f = cfline("*.ERR\t/dev/console", "*", "*", "*"); if (f != NULL) addfile(f); free(f); - f = cfline("*.PANIC\t*", "*", "*"); + f = cfline("*.PANIC\t*", "*", "*", "*"); if (f != NULL) addfile(f); free(f); @@ -2517,19 +2669,165 @@ init(int signo) } /* + * Compile property-based filter. + * Returns 0 on success, -1 otherwise. + */ +static int +prop_filter_compile(struct prop_filter *pfilter, char *filter) +{ + char *filter_endpos, *p; + char **ap, *argv[2] = {NULL, NULL}; + int re_flags = REG_NOSUB; + int escaped; + + bzero(pfilter, sizeof(struct prop_filter)); + + /* + * Here's some filter examples mentioned in syslog.conf(5) + * 'msg, contains, ".*Deny.*"' + * 'processname, regex, "^bird6?$"' + * 'hostname, icase_ereregex, "^server-(dcA|podB)-rack1[0-9]{2}\\..*"' + */ + + /* + * Split filter into 3 parts: property name (argv[0]), + * cmp type (argv[1]) and lvalue for comparison (filter). + */ + for (ap = argv; (*ap = strsep(&filter, ", \t\n")) != NULL;) { + if (**ap != '\0') + if (++ap >= &argv[2]) + break; + } + + if (argv[0] == NULL || argv[1] == NULL) { + logerror("filter parse error"); + return (-1); + } + + /* fill in prop_type */ + if (strcasecmp(argv[0], "msg") == 0) + pfilter->prop_type = PROP_TYPE_MSG; + else if(strcasecmp(argv[0], "hostname") == 0) + pfilter->prop_type = PROP_TYPE_HOSTNAME; + else if(strcasecmp(argv[0], "source") == 0) + pfilter->prop_type = PROP_TYPE_HOSTNAME; + else if(strcasecmp(argv[0], "programname") == 0) + pfilter->prop_type = PROP_TYPE_PROGNAME; + else { + logerror("unknown property"); + return (-1); + } + + /* full in cmp_flags (i.e. !contains, icase_regex, etc.) */ + if (*argv[1] == '!') { + pfilter->cmp_flags |= PROP_FLAG_EXCLUDE; + argv[1]++; + } + if (strncasecmp(argv[1], "icase_", (sizeof("icase_") - 1)) == 0) { + pfilter->cmp_flags |= PROP_FLAG_ICASE; + argv[1] += sizeof("icase_") - 1; + } + + /* fill in cmp_type */ + if (strcasecmp(argv[1], "contains") == 0) + pfilter->cmp_type = PROP_CMP_CONTAINS; + else if (strcasecmp(argv[1], "isequal") == 0) + pfilter->cmp_type = PROP_CMP_EQUAL; + else if (strcasecmp(argv[1], "startswith") == 0) + pfilter->cmp_type = PROP_CMP_STARTS; + else if (strcasecmp(argv[1], "regex") == 0) + pfilter->cmp_type = PROP_CMP_REGEX; + else if (strcasecmp(argv[1], "ereregex") == 0) { + pfilter->cmp_type = PROP_CMP_REGEX; + re_flags |= REG_EXTENDED; + } else { + logerror("unknown cmp function"); + return (-1); + } + + /* + * Handle filter value + */ + + /* ' ".*Deny.*"' */ + /* remove leading whitespace and check for '"' next character */ + filter += strspn(filter, ", \t\n"); + if (*filter != '"' || strlen(filter) < 3) { + logerror("property value parse error"); + return (-1); + } + filter++; + + /* '.*Deny.*"' */ + /* process possible backslash (\") escaping */ + escaped = 0; + filter_endpos = filter; + for (p = filter; *p != '\0'; p++) { + if (*p == '\\' && !escaped) { + escaped = 1; + /* do not shift filter_endpos */ + continue; + } + if (*p == '"' && !escaped) { + p++; + break; + } + /* we've seen some esc symbols, need to compress the line */ + if (filter_endpos != p) + *filter_endpos = *p; + + filter_endpos++; + escaped = 0; + } + + *filter_endpos = '\0'; + /* '.*Deny.*' */ + + /* We should not have anything but whitespace left after closing '"' */ + if (*p != '\0' && strspn(p, " \t\n") != strlen(p)) { + logerror("property value parse error"); + return (-1); + } + + if (pfilter->cmp_type == PROP_CMP_REGEX) { + pfilter->pflt_re = calloc(1, sizeof(*pfilter->pflt_re)); + if (pfilter->pflt_re == NULL) { + logerror("RE calloc() error"); + free(pfilter->pflt_re); + return (-1); + } + if (pfilter->cmp_flags & PROP_FLAG_ICASE) + re_flags |= REG_ICASE; + if (regcomp(pfilter->pflt_re, filter, re_flags) != 0) { + logerror("RE compilation error"); + free(pfilter->pflt_re); + return (-1); + } + } else { + pfilter->pflt_strval = strdup(filter); + pfilter->pflt_strlen = strlen(filter); + } + + return (0); + +} + +/* * Crack a configuration file line */ static struct filed * -cfline(const char *line, const char *prog, const char *host) +cfline(const char *line, const char *prog, const char *host, + const char *pfilter) { struct filed *f; struct addrinfo hints, *res; int error, i, pri, syncfile; const char *p, *q; - char *bp; + char *bp, *pfilter_dup; char buf[MAXLINE], ebuf[100]; - dprintf("cfline(\"%s\", f, \"%s\", \"%s\")\n", line, prog, host); + dprintf("cfline(\"%s\", f, \"%s\", \"%s\", \"%s\")\n", line, prog, + host, pfilter); f = calloc(1, sizeof(*f)); if (f == NULL) { @@ -2566,6 +2864,27 @@ cfline(const char *line, const char *prog, const char if (f->f_program == NULL) { logerror("strdup"); exit(1); + } + } + + if (pfilter) { + f->f_prop_filter = calloc(1, sizeof(*(f->f_prop_filter))); + if (f->f_prop_filter == NULL) { + logerror("pfilter calloc"); + exit(1); + } + if (*pfilter == '*') + f->f_prop_filter->prop_type = PROP_TYPE_NOOP; + else { + pfilter_dup = strdup(pfilter); + if (pfilter_dup == NULL) { + logerror("strdup"); + exit(1); + } + if (prop_filter_compile(f->f_prop_filter, pfilter_dup)) { + logerror("filter compile error"); + exit(1); + } } } From owner-svn-src-stable-12@freebsd.org Thu Apr 9 15:58:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C62D2BE31C; Thu, 9 Apr 2020 15:58:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ym5D70CFz3HmP; Thu, 9 Apr 2020 15:58:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB482F4D0; Thu, 9 Apr 2020 15:58:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039Fw8a6093483; Thu, 9 Apr 2020 15:58:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039Fw8bK093478; Thu, 9 Apr 2020 15:58:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004091558.039Fw8bK093478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 15:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359748 - in stable: 11/lib/clang 11/share/mk 11/tools/build/options 12/lib/clang 12/share/mk 12/tools/build/options X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/clang 11/share/mk 11/tools/build/options 12/lib/clang 12/share/mk 12/tools/build/options X-SVN-Commit-Revision: 359748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 15:58:09 -0000 Author: kevans Date: Thu Apr 9 15:58:06 2020 New Revision: 359748 URL: https://svnweb.freebsd.org/changeset/base/359748 Log: MFC r359644: llvm: add a build knob for enabling assertions For head/, this will remain eternally default-on to maintain the status quo. For stable/ branches, it should be flipped to default-off to maintain the status quo. There's value in being able to flip it one way or the other easily on head or stable branches, whether you want to gain some performance back on head/ (for machines there's little chance you'll actually hit an assertion) or potentially diagnose a problem with the version of llvm on an older branch. Currently, stable branches get the CFLAGS+= -ndebug line uncommented; going forward, they will instead have the default of LLVM_ASSERTIONS flipped. [MFC note: that last comment just happened for these two branches] Added: stable/12/tools/build/options/WITHOUT_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS stable/12/tools/build/options/WITH_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS Modified: stable/12/lib/clang/llvm.build.mk stable/12/share/mk/src.opts.mk Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/tools/build/options/WITHOUT_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS stable/11/tools/build/options/WITH_LLVM_ASSERTIONS - copied unchanged from r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS Modified: stable/11/lib/clang/llvm.build.mk stable/11/share/mk/src.opts.mk Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/clang/llvm.build.mk ============================================================================== --- stable/12/lib/clang/llvm.build.mk Thu Apr 9 15:33:13 2020 (r359747) +++ stable/12/lib/clang/llvm.build.mk Thu Apr 9 15:58:06 2020 (r359748) @@ -22,7 +22,9 @@ CFLAGS+= -D__STDC_CONSTANT_MACROS CFLAGS+= -D__STDC_FORMAT_MACROS CFLAGS+= -D__STDC_LIMIT_MACROS CFLAGS+= -DHAVE_VCS_VERSION_INC +.if ${MK_LLVM_ASSERTIONS} == "no" CFLAGS+= -DNDEBUG +.endif TARGET_ARCH?= ${MACHINE_ARCH} BUILD_ARCH?= ${MACHINE_ARCH} Modified: stable/12/share/mk/src.opts.mk ============================================================================== --- stable/12/share/mk/src.opts.mk Thu Apr 9 15:33:13 2020 (r359747) +++ stable/12/share/mk/src.opts.mk Thu Apr 9 15:58:06 2020 (r359748) @@ -202,6 +202,7 @@ __DEFAULT_NO_OPTIONS = \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ + LLVM_ASSERTIONS \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ LOADER_VERIEXEC_PASS_MANIFEST \ Copied: stable/12/tools/build/options/WITHOUT_LLVM_ASSERTIONS (from r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_LLVM_ASSERTIONS Thu Apr 9 15:58:06 2020 (r359748, copy of r359644, head/tools/build/options/WITHOUT_LLVM_ASSERTIONS) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to disable debugging assertions in LLVM. Copied: stable/12/tools/build/options/WITH_LLVM_ASSERTIONS (from r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_LLVM_ASSERTIONS Thu Apr 9 15:58:06 2020 (r359748, copy of r359644, head/tools/build/options/WITH_LLVM_ASSERTIONS) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to enable debugging assertions in LLVM. From owner-svn-src-stable-12@freebsd.org Thu Apr 9 16:02:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B872B2BE577; Thu, 9 Apr 2020 16:02:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ymB54QQXz3JQT; Thu, 9 Apr 2020 16:02:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92DA4F6A8; Thu, 9 Apr 2020 16:02:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039G2LqL098748; Thu, 9 Apr 2020 16:02:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039G2LL9098745; Thu, 9 Apr 2020 16:02:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004091602.039G2LL9098745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 16:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359749 - in stable: 11/contrib/openbsm/bin/auditreduce 12/contrib/openbsm/bin/auditreduce X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/contrib/openbsm/bin/auditreduce 12/contrib/openbsm/bin/auditreduce X-SVN-Commit-Revision: 359749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 16:02:21 -0000 Author: kevans Date: Thu Apr 9 16:02:20 2020 New Revision: 359749 URL: https://svnweb.freebsd.org/changeset/base/359749 Log: MFV r359401: OpenBSM: import ee79d73e8df5: auditreduce: add a zone filter This allows one to select audit records that match a -z zone glob. Modified: stable/12/contrib/openbsm/bin/auditreduce/auditreduce.1 stable/12/contrib/openbsm/bin/auditreduce/auditreduce.c stable/12/contrib/openbsm/bin/auditreduce/auditreduce.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/openbsm/bin/auditreduce/auditreduce.1 stable/11/contrib/openbsm/bin/auditreduce/auditreduce.c stable/11/contrib/openbsm/bin/auditreduce/auditreduce.h Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/openbsm/bin/auditreduce/auditreduce.1 ============================================================================== --- stable/12/contrib/openbsm/bin/auditreduce/auditreduce.1 Thu Apr 9 15:58:06 2020 (r359748) +++ stable/12/contrib/openbsm/bin/auditreduce/auditreduce.1 Thu Apr 9 16:02:20 2020 (r359749) @@ -25,7 +25,7 @@ .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 24, 2004 +.Dd February 20, 2020 .Dt AUDITREDUCE 1 .Os .Sh NAME @@ -47,6 +47,7 @@ .Op Fl r Ar ruid .Op Fl u Ar auid .Op Fl v +.Op Fl z Ar zone .Op Ar .Sh DESCRIPTION The @@ -129,6 +130,10 @@ Select records with the given real user ID or name. Select records with the given audit ID. .It Fl v Invert sense of matching, to select records that do not match. +.It Fl z Ar zone +Select records from the given zone(s). +.Ar zone +is a glob for zones to match. .El .Sh EXAMPLES To select all records associated with effective user ID root from the audit Modified: stable/12/contrib/openbsm/bin/auditreduce/auditreduce.c ============================================================================== --- stable/12/contrib/openbsm/bin/auditreduce/auditreduce.c Thu Apr 9 15:58:06 2020 (r359748) +++ stable/12/contrib/openbsm/bin/auditreduce/auditreduce.c Thu Apr 9 16:02:20 2020 (r359749) @@ -62,6 +62,7 @@ #include #include +#include #include #include #include @@ -94,6 +95,7 @@ static int p_egid; /* Effective group id. */ static int p_rgid; /* Real group id. */ static int p_ruid; /* Real user id. */ static int p_subid; /* Subject id. */ +static const char *p_zone; /* Zone. */ /* * Maintain a dynamically sized array of events for -m @@ -114,6 +116,8 @@ static char *p_sockobj = NULL; static uint32_t opttochk = 0; +static int select_zone(const char *zone, uint32_t *optchkd); + static void parse_regexp(char *re_string) { @@ -186,6 +190,7 @@ usage(const char *msg) fprintf(stderr, "\t-r : real user\n"); fprintf(stderr, "\t-u : audit user\n"); fprintf(stderr, "\t-v : select non-matching records\n"); + fprintf(stderr, "\t-z : zone name\n"); exit(EX_USAGE); } @@ -493,6 +498,21 @@ select_subj32(tokenstr_t tok, uint32_t *optchkd) } /* + * Check if the given zone matches the selection criteria. + */ +static int +select_zone(const char *zone, uint32_t *optchkd) +{ + + SETOPT((*optchkd), OPT_z); + if (ISOPTSET(opttochk, OPT_z) && p_zone != NULL) { + if (fnmatch(p_zone, zone, FNM_PATHNAME) != 0) + return (0); + } + return (1); +} + +/* * Read each record from the audit trail. Check if it is selected after * passing through each of the options */ @@ -559,6 +579,10 @@ select_records(FILE *fp) tok_hdr32_copy, &optchkd); break; + case AUT_ZONENAME: + selected = select_zone(tok.tt.zonename.zonename, &optchkd); + break; + default: break; } @@ -629,7 +653,7 @@ main(int argc, char **argv) converr = NULL; - while ((ch = getopt(argc, argv, "Aa:b:c:d:e:f:g:j:m:o:r:u:v")) != -1) { + while ((ch = getopt(argc, argv, "Aa:b:c:d:e:f:g:j:m:o:r:u:vz:")) != -1) { switch(ch) { case 'A': SETOPT(opttochk, OPT_A); @@ -781,6 +805,11 @@ main(int argc, char **argv) case 'v': SETOPT(opttochk, OPT_v); + break; + + case 'z': + p_zone = optarg; + SETOPT(opttochk, OPT_z); break; case '?': Modified: stable/12/contrib/openbsm/bin/auditreduce/auditreduce.h ============================================================================== --- stable/12/contrib/openbsm/bin/auditreduce/auditreduce.h Thu Apr 9 15:58:06 2020 (r359748) +++ stable/12/contrib/openbsm/bin/auditreduce/auditreduce.h Thu Apr 9 16:02:20 2020 (r359749) @@ -57,6 +57,7 @@ struct re_entry { #define OPT_u 0x00010000 #define OPT_A 0x00020000 #define OPT_v 0x00040000 +#define OPT_z 0x00080000 #define FILEOBJ "file" #define MSGQIDOBJ "msgqid" From owner-svn-src-stable-12@freebsd.org Thu Apr 9 16:24:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D64D2BED37; Thu, 9 Apr 2020 16:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ymhB3n88z3Lh2; Thu, 9 Apr 2020 16:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CF94FA95; Thu, 9 Apr 2020 16:24:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039GOwP0012893; Thu, 9 Apr 2020 16:24:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039GOwwP012892; Thu, 9 Apr 2020 16:24:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004091624.039GOwwP012892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 16:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359750 - in stable: 11/share/man/man5 12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/share/man/man5 12/share/man/man5 X-SVN-Commit-Revision: 359750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 16:24:58 -0000 Author: kevans Date: Thu Apr 9 16:24:57 2020 New Revision: 359750 URL: https://svnweb.freebsd.org/changeset/base/359750 Log: MFC (effectively) r359645: src.conf(5): re-roll after LLVM_ASSERTIONS On stable/12, this ends up including just a couple other things that src.conf(5) hadn't been regenerated for. Modified: stable/12/share/man/man5/src.conf.5 Directory Properties: stable/12/ (props changed) stable/12/contrib/llvm-project/clang/ (props changed) stable/12/contrib/llvm-project/compiler-rt/ (props changed) stable/12/contrib/llvm-project/libcxx/ (props changed) stable/12/contrib/llvm-project/libunwind/ (props changed) stable/12/contrib/llvm-project/lld/ (props changed) stable/12/contrib/llvm-project/lldb/ (props changed) stable/12/contrib/llvm-project/llvm/ (props changed) stable/12/contrib/llvm-project/openmp/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/man/man5/src.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/12/share/man/man5/src.conf.5 ============================================================================== --- stable/12/share/man/man5/src.conf.5 Thu Apr 9 16:02:20 2020 (r359749) +++ stable/12/share/man/man5/src.conf.5 Thu Apr 9 16:24:57 2020 (r359750) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd March 8, 2020 +.Dd April 9, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -159,6 +159,10 @@ is set explicitly) (unless .Va WITHOUT_LOADER_VERIEXEC is set explicitly) +.It Va WITH_LOADER_VERIEXEC_VECTX +(unless +.Va WITHOUT_LOADER_VERIEXEC_VECTX +is set explicitly) .It Va WITH_VERIEXEC (unless .Va WITHOUT_VERIEXEC @@ -452,9 +456,15 @@ When set, it enforces these options: .It .Va WITHOUT_KERBEROS .It +.Va WITHOUT_LDNS +.It +.Va WITHOUT_LDNS_UTILS +.It .Va WITHOUT_OPENSSH .It .Va WITHOUT_OPENSSL +.It +.Va WITHOUT_UNBOUND .El .Pp When set, these options are also in effect: @@ -1040,6 +1050,8 @@ Set to use LLVM's LLD as the system linker, instead of .Pp This is a default setting on amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386. +.It Va WITH_LLVM_ASSERTIONS +Set to enable debugging assertions in LLVM. .It Va WITHOUT_LLVM_COV Set to not build the .Xr llvm-cov 1 @@ -1251,6 +1263,10 @@ When set, these options are also in effect: (unless .Va WITHOUT_LOADER_EFI_SECUREBOOT is set explicitly) +.It Va WITH_LOADER_VERIEXEC_VECTX +(unless +.Va WITHOUT_LOADER_VERIEXEC_VECTX +is set explicitly) .El .It Va WITH_LOADER_VERIEXEC_PASS_MANIFEST Enable building @@ -1508,7 +1524,13 @@ When set, it enforces these options: .It .Va WITHOUT_KERBEROS .It +.Va WITHOUT_LDNS +.It +.Va WITHOUT_LDNS_UTILS +.It .Va WITHOUT_OPENSSH +.It +.Va WITHOUT_UNBOUND .El .Pp When set, these options are also in effect: From owner-svn-src-stable-12@freebsd.org Thu Apr 9 18:17:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88F0227978F; Thu, 9 Apr 2020 18:17:09 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yq9d2yrDz3ykl; Thu, 9 Apr 2020 18:17:09 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60DD818FB2; Thu, 9 Apr 2020 18:17:09 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039IH9wZ080051; Thu, 9 Apr 2020 18:17:09 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039IH7sr080044; Thu, 9 Apr 2020 18:17:07 GMT (envelope-from dab@FreeBSD.org) Message-Id: <202004091817.039IH7sr080044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Thu, 9 Apr 2020 18:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359751 - in stable/12/sbin/nvmecontrol: . modules/wdc X-SVN-Group: stable-12 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: in stable/12/sbin/nvmecontrol: . modules/wdc X-SVN-Commit-Revision: 359751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 18:17:09 -0000 Author: dab Date: Thu Apr 9 18:17:07 2020 New Revision: 359751 URL: https://svnweb.freebsd.org/changeset/base/359751 Log: MFC r359562: Fix various Coverity-detected errors in nvmecontrol This fixes several Coverity-detected errors in nvmecontrol. While in here, a couple additional errors with shift/mask confusion that were not diagnosed by Coverity are also fixed. CIDs addressed: 1040299, 1040300, 1403972, 1403973, 1403985, 1403988, 1403990, 1404374, 1404427, 1404469, 1404510, 1404534, 1418118 CID 1403657 (resource leak of shared library handle) was marked "intentional" in the Coverity scan database. Sponsored by: Dell EMC Isilon Modified: stable/12/sbin/nvmecontrol/firmware.c stable/12/sbin/nvmecontrol/identify.c stable/12/sbin/nvmecontrol/logpage.c stable/12/sbin/nvmecontrol/modules/wdc/wdc.c stable/12/sbin/nvmecontrol/nsid.c stable/12/sbin/nvmecontrol/passthru.c stable/12/sbin/nvmecontrol/power.c stable/12/sbin/nvmecontrol/reset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/nvmecontrol/firmware.c ============================================================================== --- stable/12/sbin/nvmecontrol/firmware.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/firmware.c Thu Apr 9 18:17:07 2020 (r359751) @@ -151,6 +151,7 @@ read_image_file(const char *path, void **buf, int32_t errx(1, "error reading '%s' (read %d bytes, requested %d bytes)", path, *size, filesize); + close(fd); } static void @@ -188,6 +189,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl resid -= size; off += size; } + free(chunk); } static int Modified: stable/12/sbin/nvmecontrol/identify.c ============================================================================== --- stable/12/sbin/nvmecontrol/identify.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/identify.c Thu Apr 9 18:17:07 2020 (r359751) @@ -94,7 +94,7 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_DPC_PIT3_MASK) ? "Type 3, " : "", ((nsdata->dpc >> NVME_NS_DATA_DPC_PIT2_SHIFT) & NVME_NS_DATA_DPC_PIT2_MASK) ? "Type 2, " : "", - ((nsdata->dpc >> NVME_NS_DATA_DPC_PIT2_MASK) & + ((nsdata->dpc >> NVME_NS_DATA_DPC_PIT1_SHIFT) & NVME_NS_DATA_DPC_PIT1_MASK) ? "Type 1" : ""); printf("Data Protection Settings: "); ptype = (nsdata->dps >> NVME_NS_DATA_DPS_PIT_SHIFT) & @@ -238,7 +238,8 @@ identify(const struct cmd *f, int argc, char *argv[]) int fd; uint32_t nsid; - arg_parse(argc, argv, f); + if (arg_parse(argc, argv, f)) + return; open_dev(opt.dev, &fd, 1, 1); get_nsid(fd, &path, &nsid); Modified: stable/12/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/12/sbin/nvmecontrol/logpage.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/logpage.c Thu Apr 9 18:17:07 2020 (r359751) @@ -570,11 +570,11 @@ print_log_sanitize_status(const struct nvme_controller printf("Unknown"); break; } - p = (ss->sstat & NVME_SS_PAGE_SSTAT_PASSES_SHIFT) >> + p = (ss->sstat >> NVME_SS_PAGE_SSTAT_PASSES_SHIFT) & NVME_SS_PAGE_SSTAT_PASSES_MASK; if (p > 0) printf(", %d passes", p); - if ((ss->sstat & NVME_SS_PAGE_SSTAT_GDE_SHIFT) >> + if ((ss->sstat >> NVME_SS_PAGE_SSTAT_GDE_SHIFT) & NVME_SS_PAGE_SSTAT_GDE_MASK) printf(", Global Data Erased"); printf("\n"); Modified: stable/12/sbin/nvmecontrol/modules/wdc/wdc.c ============================================================================== --- stable/12/sbin/nvmecontrol/modules/wdc/wdc.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/modules/wdc/wdc.c Thu Apr 9 18:17:07 2020 (r359751) @@ -275,7 +275,7 @@ print_hgst_info_subpage_gen(void *buf, uint16_t subtyp wsp++; /* Flags, just ignore */ plen = *wsp++; param = 0; - for (i = 0; i < plen; i++) + for (i = 0; i < plen && wsp < esp; i++) param |= (uint64_t)*wsp++ << (i * 8); printf(" %-30s: %jd\n", kv_lookup(kv, kv_count, ptype), (uintmax_t)param); } Modified: stable/12/sbin/nvmecontrol/nsid.c ============================================================================== --- stable/12/sbin/nvmecontrol/nsid.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/nsid.c Thu Apr 9 18:17:07 2020 (r359751) @@ -70,7 +70,8 @@ gnsid(const struct cmd *f, int argc, char *argv[]) int fd; uint32_t nsid; - arg_parse(argc, argv, f); + if (arg_parse(argc, argv, f)) + return; open_dev(nsid_opt.dev, &fd, 1, 1); get_nsid(fd, &path, &nsid); Modified: stable/12/sbin/nvmecontrol/passthru.c ============================================================================== --- stable/12/sbin/nvmecontrol/passthru.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/passthru.c Thu Apr 9 18:17:07 2020 (r359751) @@ -158,10 +158,12 @@ static void passthru(const struct cmd *f, int argc, char *argv[]) { int fd = -1, ifd = -1; + size_t bytes_read; void *data = NULL, *metadata = NULL; struct nvme_pt_command pt; - arg_parse(argc, argv, f); + if (arg_parse(argc, argv, f)) + return; open_dev(argv[optind], &fd, 1, 1); if (opt.read && opt.write) @@ -189,8 +191,12 @@ passthru(const struct cmd *f, int argc, char *argv[]) goto cleanup; } memset(data, opt.prefill, opt.data_len); - if (opt.write && read(ifd, data, opt.data_len) < 0) { - warn("read %s", *opt.ifn ? opt.ifn : "stdin"); + if (opt.write && + (bytes_read = read(ifd, data, opt.data_len)) != + opt.data_len) { + warn("read %s; expected %u bytes; got %zd", + *opt.ifn ? opt.ifn : "stdin", + opt.data_len, bytes_read); goto cleanup; } } @@ -249,6 +255,10 @@ passthru(const struct cmd *f, int argc, char *argv[]) } } cleanup: + free(data); + close(fd); + if (ifd > -1) + close(ifd); if (errno) exit(1); } Modified: stable/12/sbin/nvmecontrol/power.c ============================================================================== --- stable/12/sbin/nvmecontrol/power.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/power.c Thu Apr 9 18:17:07 2020 (r359751) @@ -145,7 +145,8 @@ power(const struct cmd *f, int argc, char *argv[]) struct nvme_controller_data cdata; int fd; - arg_parse(argc, argv, f); + if (arg_parse(argc, argv, f)) + return; if (opt.list && opt.power != POWER_NONE) { fprintf(stderr, "Can't set power and list power states\n"); Modified: stable/12/sbin/nvmecontrol/reset.c ============================================================================== --- stable/12/sbin/nvmecontrol/reset.c Thu Apr 9 16:24:57 2020 (r359750) +++ stable/12/sbin/nvmecontrol/reset.c Thu Apr 9 18:17:07 2020 (r359751) @@ -57,7 +57,8 @@ reset(const struct cmd *f, int argc, char *argv[]) { int fd; - arg_parse(argc, argv, f); + if (arg_parse(argc, argv, f)) + return; open_dev(opt.dev, &fd, 1, 1); if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) From owner-svn-src-stable-12@freebsd.org Thu Apr 9 20:35:47 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A59527E132; Thu, 9 Apr 2020 20:35:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ytFZ6pPlz4FG6; Thu, 9 Apr 2020 20:35:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E42F61AAFA; Thu, 9 Apr 2020 20:35:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039KZkCe071861; Thu, 9 Apr 2020 20:35:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039KZZ0q071806; Thu, 9 Apr 2020 20:35:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004092035.039KZZ0q071806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 20:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359753 - in stable/12: bin/sh cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool contrib/bmake contrib/ipfilter contrib/ipfilter/tools contrib/ntp/include contrib/ntp/... X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: bin/sh cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool contrib/bmake contrib/ipfilter contrib/ipfilter/tools contrib/ntp/include contrib/ntp/ntpd contrib/tcsh contrib... X-SVN-Commit-Revision: 359753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 20:35:47 -0000 Author: kevans Date: Thu Apr 9 20:35:35 2020 New Revision: 359753 URL: https://svnweb.freebsd.org/changeset/base/359753 Log: MFC -fno-common fixes: r359389, r359394, r359397-r359399, r359403-r359404, r359406, r359413-r359416, r359424-r359425, r359427, r359432-r359433, r359443, r359675-r359678 Note: this is not necessarily a complete fix to get these programs to build with -fno-common applied; further work may be needed in this branch. r359389: config(8): fixes for -fno-common Move this handful of definitions into main.c, properly declare these as extern in config.h. This fixes the config(8) build with -fno-common. Unexplained in my previous commit to gas, -fno-common will become the default in GCC10 and LLVM11, so it's worth addressing these in advance. r359394: MFV r359393: tcsh: import 6974bc35a5cd This removes an extra variable definition that causes the -fno-common build to fail, which will be a new default in GCC10/LLVM11. r359397: zfs: fix -fno-common issues A similar (or identical?) fix has already landed in OpenZFS. -fno-common will become the default in GCC10/LLVM11. r359398: sh: remove duplicate el definition el is declared extern in myhistedit.h and defined in histedit.c. Remove the duplicate definition in input.c to appease the -fno-common build. -fno-common will become the default in GCC10/LLVM11. r359399: telnet: remove some duplicate definitions, mark terminaltype extern Most of these were already properly declared and defined elsewhere, this is effectively just a minor cleanup that fixes the -fno-common build. -fno-common will become the default in GCC10/LLVM11. r359403: Revert 359399: telnet -fno-common bits There was a large misfire from my local diff that I need to investigate, and this version committed did not build. r359404: Re-apply r359399: telnet -fno-common fix line and auth_level's redefinitions are just extraneous telnetd will #define extern and then include ext.h to allocate storage for all of these extern'd vars; however, two of them are actually defined in libtelnet instead. Instead of doing an #ifdef extern dance around those function pointers, just add an EXTERN macro to make it easier to differentiate by sight which ones will get allocated in globals.c and which ones are defined elsewhere. r359406: telnet: kill off remaining duplicate definition r359413: ipfilter: remove duplicate definition of 'thishost' thishost is already defined in lib/initparse.c; no need for this one. This fixes the ipfilter build with -fno-common. -fno-common will become the default in GCC10/LLVM11. r359414: iscontrol: move definition of vflag/iscsidev to iscontrol.c Mark the declaration extern as these are used elsewhere; this fixes the build with -fno-common. r359415: userboot: mark host_fsops as extern This is already defined elsewhere; mark this declaration extern to the fix the -fno-common build. r359416: systat: remove redundant definition of kd kd is already properly declared in extern.h and defined in main.c, rendering this definition useless. This fixes the -fno-common build. r359424: openssh: -fno-common fix from upstream f47d72ddad This is currently staged in vendor/ as part of the 8.0p1 import, which isn't quite ready to land. Given that this is a simple one-line fix, apply it now as the fallout will be pretty minimal. -fno-common will become the default in GCC10/LLVM11. r359425: locate: fix -fno-common build Just a single variable declaration to extern and define elsewhere here, myctype. -fno-common will become a default in GCC10/LLVM11. r359427: fsck_ffs/fsdb: fix -fno-common build This one is also a small list: - 3x duplicate definition (ufs2_zino, returntosingle, nflag) - 5x 'needs extern', 3/5 of which are referenced in fsdb -fno-common will become the default in GCC10/LLVM11. r359432: gdb: compile with -fcommon explicitly As described in the comment, gdb relies on some of the linker magic that happens with -fcommon. I suspect the life expectancy of gdb-in-base is low enough that this isn't worth spending much time addressing, especially given the vintage. Hit it with the -fcommon hammer so that it continues to just work. r359433: bmake: fix -fno-common build debug was declared extern, but debug_file was not; correct this and define debug_file in main.c (as debug is) to fix the -fno-common build. -fno-common will become the default with GCC10/LLVM11. r359443: MFV r359442: bmake: import -fno-common fix build back from upstream sjg@ committed the local patch previously committed upstream; pull it in to vendor/ to ease any potential stress of future imports. r359675: kqueue tests: fix -fno-common build vnode_fd and kqfd are both shared among multiple CU; define them exactly once. In the case of vnode_fd, it was simply the declaration that needed correction. -fno-common will become the default in GCC10/LLVM11. r359676: ntpd: fix build with -fno-common Only a small nit here: psl should be declared extern and defined exactly once. -fno-common will become the default in GCC10/LLVM11. r359677: yp*: fix -fno-common build This is mostly two problems spread out far and wide: - ypldap_process should be declared properly - debug is defined differently in many programs For the latter, just extern it and define it everywhere that actually needs it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the assignment at the beginning of main in favor of defining it properly. -fno-common will become the default in GCC10/LLVM11. r359678: indent: fix the -fno-common build Spread the globals far and wide, hopefully to the files that make the most sense. -fno-common will become the default in GCC10/LLVM11. Modified: stable/12/bin/sh/input.c stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h stable/12/contrib/bmake/main.c stable/12/contrib/bmake/make.h stable/12/contrib/ipfilter/ipf.h stable/12/contrib/ipfilter/tools/ipnat.c stable/12/contrib/ntp/include/ntp_config.h stable/12/contrib/ntp/ntpd/ntp_config.c stable/12/contrib/tcsh/tc.sig.c stable/12/contrib/telnet/telnetd/ext.h stable/12/contrib/telnet/telnetd/global.c stable/12/contrib/telnet/telnetd/sys_term.c stable/12/contrib/telnet/telnetd/telnetd.c stable/12/crypto/openssh/session.c stable/12/gnu/usr.bin/gdb/Makefile.inc stable/12/libexec/ypxfr/ypxfr_main.c stable/12/sbin/fsck_ffs/fsck.h stable/12/sbin/fsck_ffs/gjournal.c stable/12/sbin/fsck_ffs/globs.c stable/12/sbin/fsck_ffs/setup.c stable/12/sbin/fsdb/fsdb.c stable/12/sbin/iscontrol/iscontrol.c stable/12/sbin/iscontrol/iscontrol.h stable/12/stand/userboot/userboot/libuserboot.h stable/12/tests/sys/kqueue/libkqueue/common.h stable/12/tests/sys/kqueue/libkqueue/proc.c stable/12/tests/sys/kqueue/libkqueue/read.c stable/12/tests/sys/kqueue/libkqueue/signal.c stable/12/tests/sys/kqueue/libkqueue/timer.c stable/12/tests/sys/kqueue/libkqueue/user.c stable/12/tests/sys/kqueue/libkqueue/vnode.c stable/12/usr.bin/indent/indent.c stable/12/usr.bin/indent/indent_globs.h stable/12/usr.bin/indent/io.c stable/12/usr.bin/indent/parse.c stable/12/usr.bin/locate/locate/locate.c stable/12/usr.bin/locate/locate/locate.h stable/12/usr.bin/systat/swap.c stable/12/usr.sbin/config/config.h stable/12/usr.sbin/config/main.c stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_main.c stable/12/usr.sbin/rpc.ypupdated/ypupdated_main.c stable/12/usr.sbin/rpc.ypxfrd/ypxfrd_main.c stable/12/usr.sbin/ypldap/ypldap.c stable/12/usr.sbin/ypldap/ypldap.h stable/12/usr.sbin/ypserv/yp_access.c stable/12/usr.sbin/ypserv/yp_error.c stable/12/usr.sbin/ypserv/yp_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/sh/input.c ============================================================================== --- stable/12/bin/sh/input.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/bin/sh/input.c Thu Apr 9 20:35:35 2020 (r359753) @@ -102,8 +102,6 @@ static struct parsefile basepf = { /* top level input static struct parsefile *parsefile = &basepf; /* current input file */ int whichprompt; /* 1 == PS1, 2 == PS2 */ -EditLine *el; /* cookie for editline package */ - static void pushfile(void); static int preadfd(void); static void popstring(void); Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h Thu Apr 9 20:35:35 2020 (r359753) @@ -33,7 +33,7 @@ extern "C" { void * safe_malloc(size_t size); void nomem(void); -libzfs_handle_t *g_zfs; +extern libzfs_handle_t *g_zfs; #ifdef __cplusplus } Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -62,6 +62,8 @@ #include "statcommon.h" +libzfs_handle_t *g_zfs; + static int zpool_do_create(int, char **); static int zpool_do_destroy(int, char **); Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Apr 9 20:35:35 2020 (r359753) @@ -64,7 +64,7 @@ void pool_list_free(zpool_list_t *); int pool_list_count(zpool_list_t *); void pool_list_remove(zpool_list_t *, zpool_handle_t *); -libzfs_handle_t *g_zfs; +extern libzfs_handle_t *g_zfs; #ifdef __cplusplus } Modified: stable/12/contrib/bmake/main.c ============================================================================== --- stable/12/contrib/bmake/main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/bmake/main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $ */ +/* $NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -198,6 +198,8 @@ char *progname; /* the program name */ char *makeDependfile; pid_t myPid; int makelevel; + +FILE *debug_file; Boolean forceJobs = FALSE; Modified: stable/12/contrib/bmake/make.h ============================================================================== --- stable/12/contrib/bmake/make.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/bmake/make.h Thu Apr 9 20:35:35 2020 (r359753) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.104 2018/02/12 21:38:09 sjg Exp $ */ +/* $NetBSD: make.h,v 1.105 2020/03/30 02:41:06 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -464,7 +464,7 @@ extern pid_t myPid; * There is one bit per module. It is up to the module what debug * information to print. */ -FILE *debug_file; /* Output written here - default stdout */ +extern FILE *debug_file; /* Output written here - default stdout */ extern int debug; #define DEBUG_ARCH 0x00001 #define DEBUG_COND 0x00002 Modified: stable/12/contrib/ipfilter/ipf.h ============================================================================== --- stable/12/contrib/ipfilter/ipf.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/ipfilter/ipf.h Thu Apr 9 20:35:35 2020 (r359753) @@ -191,7 +191,7 @@ typedef int (* addfunc_t) __P((int, ioctlfunc_t, void typedef int (* copyfunc_t) __P((void *, void *, size_t)); -extern char thishost[]; +extern char thishost[MAXHOSTNAMELEN]; extern char flagset[]; extern u_char flags[]; extern struct ipopt_names ionames[]; Modified: stable/12/contrib/ipfilter/tools/ipnat.c ============================================================================== --- stable/12/contrib/ipfilter/tools/ipnat.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/ipfilter/tools/ipnat.c Thu Apr 9 20:35:35 2020 (r359753) @@ -60,7 +60,6 @@ static const char rcsid[] = "@(#)$Id$"; #define bzero(a,b) memset(a,0,b) #endif int use_inet6 = 0; -char thishost[MAXHOSTNAMELEN]; extern char *optarg; Modified: stable/12/contrib/ntp/include/ntp_config.h ============================================================================== --- stable/12/contrib/ntp/include/ntp_config.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/ntp/include/ntp_config.h Thu Apr 9 20:35:35 2020 (r359753) @@ -280,7 +280,7 @@ typedef struct settrap_parms_tag { * Poll Skew List */ -psl_item psl[17-3+1]; /* values for polls 3-17 */ +extern psl_item psl[17-3+1]; /* values for polls 3-17 */ /* To simplify the runtime code we */ /* don't want to have to special-case */ /* dealing with a default */ Modified: stable/12/contrib/ntp/ntpd/ntp_config.c ============================================================================== --- stable/12/contrib/ntp/ntpd/ntp_config.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/ntp/ntpd/ntp_config.c Thu Apr 9 20:35:35 2020 (r359753) @@ -202,6 +202,8 @@ int cryptosw; /* crypto command called */ extern char *stats_drift_file; /* name of the driftfile */ +psl_item psl[17-3+1]; + #ifdef BC_LIST_FRAMEWORK_NOT_YET_USED /* * backwards compatibility flags Modified: stable/12/contrib/tcsh/tc.sig.c ============================================================================== --- stable/12/contrib/tcsh/tc.sig.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/tcsh/tc.sig.c Thu Apr 9 20:35:35 2020 (r359753) @@ -56,7 +56,6 @@ int alrmcatch_disabled; /* = 0; */ int phup_disabled; /* = 0; */ int pchild_disabled; /* = 0; */ int pintr_disabled; /* = 0; */ -int handle_interrupt; /* = 0; */ int handle_pending_signals(void) Modified: stable/12/contrib/telnet/telnetd/ext.h ============================================================================== --- stable/12/contrib/telnet/telnetd/ext.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/telnet/telnetd/ext.h Thu Apr 9 20:35:35 2020 (r359753) @@ -30,53 +30,57 @@ * $FreeBSD$ */ +#ifndef EXTERN +#define EXTERN extern +#endif + /* * Telnet server variable declarations */ -extern char options[256]; -extern char do_dont_resp[256]; -extern char will_wont_resp[256]; -extern int linemode; /* linemode on/off */ +EXTERN char options[256]; +EXTERN char do_dont_resp[256]; +EXTERN char will_wont_resp[256]; +EXTERN int linemode; /* linemode on/off */ #ifdef LINEMODE -extern int uselinemode; /* what linemode to use (on/off) */ -extern int editmode; /* edit modes in use */ -extern int useeditmode; /* edit modes to use */ -extern int alwayslinemode; /* command line option */ -extern int lmodetype; /* Client support for linemode */ +EXTERN int uselinemode; /* what linemode to use (on/off) */ +EXTERN int editmode; /* edit modes in use */ +EXTERN int useeditmode; /* edit modes to use */ +EXTERN int alwayslinemode; /* command line option */ +EXTERN int lmodetype; /* Client support for linemode */ #endif /* LINEMODE */ -extern int flowmode; /* current flow control state */ -extern int restartany; /* restart output on any character state */ +EXTERN int flowmode; /* current flow control state */ +EXTERN int restartany; /* restart output on any character state */ #ifdef DIAGNOSTICS -extern int diagnostic; /* telnet diagnostic capabilities */ +EXTERN int diagnostic; /* telnet diagnostic capabilities */ #endif /* DIAGNOSTICS */ #ifdef BFTPDAEMON -extern int bftpd; /* behave as bftp daemon */ +EXTERN int bftpd; /* behave as bftp daemon */ #endif /* BFTPDAEMON */ #ifdef AUTHENTICATION -extern int auth_level; +EXTERN int auth_level; #endif -extern slcfun slctab[NSLC + 1]; /* slc mapping table */ +EXTERN slcfun slctab[NSLC + 1]; /* slc mapping table */ -char *terminaltype; +EXTERN char *terminaltype; /* * I/O data buffers, pointers, and counters. */ -extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; +EXTERN char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; -extern char netibuf[BUFSIZ], *netip; +EXTERN char netibuf[BUFSIZ], *netip; -extern char netobuf[BUFSIZ], *nfrontp, *nbackp; -extern char *neturg; /* one past last bye of urgent data */ +EXTERN char netobuf[BUFSIZ], *nfrontp, *nbackp; +EXTERN char *neturg; /* one past last bye of urgent data */ -extern int pcc, ncc; +EXTERN int pcc, ncc; -extern int pty, net; -extern char line[32]; -extern int SYNCHing; /* we are in TELNET SYNCH mode */ +EXTERN int pty, net; +EXTERN char line[32]; +EXTERN int SYNCHing; /* we are in TELNET SYNCH mode */ -extern void +EXTERN void _termstat(void), add_slc(char, char, cc_t), check_slc(void), @@ -133,7 +137,7 @@ extern void tty_binaryin(int), tty_binaryout(int); -extern int +EXTERN int end_slc(unsigned char **), getnpty(void), #ifndef convex @@ -158,7 +162,7 @@ extern int tty_istrapsig(void), tty_linemode(void); -extern void +EXTERN void tty_rspeed(int), tty_setecho(int), tty_setedit(int), @@ -177,7 +181,7 @@ void startslave(char *, int, char *); #ifdef ENCRYPTION extern void (*encrypt_output)(unsigned char *, int); extern int (*decrypt_input)(int); -extern char *nclearto; +EXTERN char *nclearto; #endif /* ENCRYPTION */ @@ -186,7 +190,7 @@ extern char *nclearto; * the relationship between various variables. */ -extern struct { +EXTERN struct { int system, /* what the current time is */ echotoggle, /* last time user entered echo character */ Modified: stable/12/contrib/telnet/telnetd/global.c ============================================================================== --- stable/12/contrib/telnet/telnetd/global.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/telnet/telnetd/global.c Thu Apr 9 20:35:35 2020 (r359753) @@ -44,5 +44,5 @@ __FBSDID("$FreeBSD$"); */ #include "defs.h" -#define extern +#define EXTERN #include "ext.h" Modified: stable/12/contrib/telnet/telnetd/sys_term.c ============================================================================== --- stable/12/contrib/telnet/telnetd/sys_term.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/telnet/telnetd/sys_term.c Thu Apr 9 20:35:35 2020 (r359753) @@ -376,8 +376,6 @@ spcset(int func, cc_t *valp, cc_t **valpp) * * Returns the file descriptor of the opened pty. */ -char line[32]; - int getpty(int *ptynum __unused) { Modified: stable/12/contrib/telnet/telnetd/telnetd.c ============================================================================== --- stable/12/contrib/telnet/telnetd/telnetd.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/contrib/telnet/telnetd/telnetd.c Thu Apr 9 20:35:35 2020 (r359753) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #ifdef AUTHENTICATION #include -int auth_level = 0; #endif #ifdef ENCRYPTION #include Modified: stable/12/crypto/openssh/session.c ============================================================================== --- stable/12/crypto/openssh/session.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/crypto/openssh/session.c Thu Apr 9 20:35:35 2020 (r359753) @@ -143,7 +143,7 @@ extern int startup_pipe; extern void destroy_sensitive_data(void); extern struct sshbuf *loginmsg; extern struct sshauthopt *auth_opts; -char *tun_fwd_ifnames; /* serverloop.c */ +extern char *tun_fwd_ifnames; /* serverloop.c */ /* original command from peer. */ const char *original_command = NULL; Modified: stable/12/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- stable/12/gnu/usr.bin/gdb/Makefile.inc Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/gnu/usr.bin/gdb/Makefile.inc Thu Apr 9 20:35:35 2020 (r359753) @@ -47,6 +47,11 @@ CFLAGS+= -I${CNTRB_GDB}/include CFLAGS+= -I${CNTRB_BU}/bfd CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit +# Some bits here currently rely on some of the linker-merging magic that happens +# with -fcommon. While this is the default right now, explicitly set -fcommon +# so that it continues to build when the default flips. +CFLAGS+= -fcommon + GENSRCS+= nm.h tm.h .if defined(GDB_CROSS_DEBUGGER) Modified: stable/12/libexec/ypxfr/ypxfr_main.c ============================================================================== --- stable/12/libexec/ypxfr/ypxfr_main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/libexec/ypxfr/ypxfr_main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include "ypxfr_extern.h" +int debug = 1; + char *progname = "ypxfr"; char *yp_dir = _PATH_YP; int _rpcpmstart = 0; @@ -175,8 +177,6 @@ main(int argc, char *argv[]) int remoteport; int interdom = 0; int secure = 0; - - debug = 1; if (!isatty(fileno(stderr))) { openlog("ypxfr", LOG_PID, LOG_DAEMON); Modified: stable/12/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/12/sbin/fsck_ffs/fsck.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/fsck_ffs/fsck.h Thu Apr 9 20:35:35 2020 (r359753) @@ -127,7 +127,7 @@ struct inostat { * Inode state information is contained on per cylinder group lists * which are described by the following structure. */ -struct inostatlist { +extern struct inostatlist { long il_numalloced; /* number of inodes allocated in this cg */ struct inostat *il_stat;/* inostat info for this cylinder group */ } *inostathead; @@ -271,13 +271,13 @@ struct dups { struct dups *next; ufs2_daddr_t dup; }; -struct dups *duplist; /* head of dup list */ -struct dups *muldup; /* end of unique duplicate dup block numbers */ +extern struct dups *duplist; /* head of dup list */ +extern struct dups *muldup; /* end of unique duplicate dup block numbers */ /* * Inode cache data structures. */ -struct inoinfo { +extern struct inoinfo { struct inoinfo *i_nexthash; /* next entry in hash chain */ ino_t i_number; /* inode number of this entry */ ino_t i_parent; /* inode number of parent */ Modified: stable/12/sbin/fsck_ffs/gjournal.c ============================================================================== --- stable/12/sbin/fsck_ffs/gjournal.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/fsck_ffs/gjournal.c Thu Apr 9 20:35:35 2020 (r359753) @@ -93,7 +93,6 @@ static LIST_HEAD(, cgchain) cglist = LIST_HEAD_INITIAL static const char *devnam; static struct uufsd *diskp = NULL; static struct fs *fs = NULL; -struct ufs2_dinode ufs2_zino; static void putcgs(void); Modified: stable/12/sbin/fsck_ffs/globs.c ============================================================================== --- stable/12/sbin/fsck_ffs/globs.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/fsck_ffs/globs.c Thu Apr 9 20:35:35 2020 (r359753) @@ -117,6 +117,10 @@ volatile sig_atomic_t got_sigalarm; /* received a SIGA struct ufs1_dinode ufs1_zino; struct ufs2_dinode ufs2_zino; +struct dups *duplist; +struct dups *muldup; +struct inostatlist *inostathead; + void fsckinit(void) { Modified: stable/12/sbin/fsck_ffs/setup.c ============================================================================== --- stable/12/sbin/fsck_ffs/setup.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/fsck_ffs/setup.c Thu Apr 9 20:35:35 2020 (r359753) @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" +struct inoinfo **inphead, **inpsort; + struct uufsd disk; struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) Modified: stable/12/sbin/fsdb/fsdb.c ============================================================================== --- stable/12/sbin/fsdb/fsdb.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/fsdb/fsdb.c Thu Apr 9 20:35:35 2020 (r359753) @@ -70,9 +70,6 @@ usage(void) exit(1); } -int returntosingle; -char nflag; - /* * We suck in lots of fsck code, and just pick & choose the stuff we want. * Modified: stable/12/sbin/iscontrol/iscontrol.c ============================================================================== --- stable/12/sbin/iscontrol/iscontrol.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/iscontrol/iscontrol.c Thu Apr 9 20:35:35 2020 (r359753) @@ -82,6 +82,9 @@ token_t DigestMethods[] = { {0, 0} }; +int vflag; +char *iscsidev; + u_char isid[6 + 6]; /* | Default values Modified: stable/12/sbin/iscontrol/iscontrol.h ============================================================================== --- stable/12/sbin/iscontrol/iscontrol.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/sbin/iscontrol/iscontrol.h Thu Apr 9 20:35:35 2020 (r359753) @@ -149,8 +149,8 @@ int recvpdu(isess_t *sess, pdu_t *pp); int lookup(token_t *tbl, char *m); -int vflag; -char *iscsidev; +extern int vflag; +extern char *iscsidev; void parseArgs(int nargs, char **args, isc_opt_t *op); void parseConfig(FILE *fd, char *key, isc_opt_t *op); Modified: stable/12/stand/userboot/userboot/libuserboot.h ============================================================================== --- stable/12/stand/userboot/userboot/libuserboot.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/stand/userboot/userboot/libuserboot.h Thu Apr 9 20:35:35 2020 (r359753) @@ -44,7 +44,7 @@ extern int userboot_disk_maxunit; extern struct devsw host_dev; /* access to host filesystem */ -struct fs_ops host_fsops; +extern struct fs_ops host_fsops; struct bootinfo; struct preloaded_file; Modified: stable/12/tests/sys/kqueue/libkqueue/common.h ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/common.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/common.h Thu Apr 9 20:35:35 2020 (r359753) @@ -41,7 +41,8 @@ #include extern char *cur_test_id; -int vnode_fd; +extern int vnode_fd; +extern int kqfd; extern char * kevent_to_str(struct kevent *); struct kevent * kevent_get(int); Modified: stable/12/tests/sys/kqueue/libkqueue/proc.c ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/proc.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/proc.c Thu Apr 9 20:35:35 2020 (r359753) @@ -25,7 +25,6 @@ static int sigusr1_caught = 0; -int kqfd; static void sig_handler(int signum) Modified: stable/12/tests/sys/kqueue/libkqueue/read.c ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/read.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/read.c Thu Apr 9 20:35:35 2020 (r359753) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; int sockfd[2]; static void Modified: stable/12/tests/sys/kqueue/libkqueue/signal.c ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/signal.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/signal.c Thu Apr 9 20:35:35 2020 (r359753) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; void test_kevent_signal_add(void) Modified: stable/12/tests/sys/kqueue/libkqueue/timer.c ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/timer.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/timer.c Thu Apr 9 20:35:35 2020 (r359753) @@ -26,7 +26,6 @@ #define MS_TO_US(t) ((t) * THOUSAND) /* Convert milliseconds to microseconds. */ #define US_TO_NS(t) ((t) * THOUSAND) /* Convert microseconds to nanoseconds. */ -int kqfd; /* Get the current time with microsecond precision. Used for * sub-second timing to make some timer tests run faster. Modified: stable/12/tests/sys/kqueue/libkqueue/user.c ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/user.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/user.c Thu Apr 9 20:35:35 2020 (r359753) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; static void add_and_delete(void) Modified: stable/12/tests/sys/kqueue/libkqueue/vnode.c ============================================================================== --- stable/12/tests/sys/kqueue/libkqueue/vnode.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/tests/sys/kqueue/libkqueue/vnode.c Thu Apr 9 20:35:35 2020 (r359753) @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; int vnode_fd; void Modified: stable/12/usr.bin/indent/indent.c ============================================================================== --- stable/12/usr.bin/indent/indent.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/indent/indent.c Thu Apr 9 20:35:35 2020 (r359753) @@ -59,6 +59,30 @@ __FBSDID("$FreeBSD$"); #include "indent_codes.h" #include "indent.h" +/* Globals */ +FILE *input, *output; +char *labbuf, *s_lab, *e_lab, *l_lab; +char *codebuf, *s_code, *e_code, *l_code; +char *combuf, *s_com, *e_com, *l_com; +char *tokenbuf, *s_token, *e_token, *l_token; +char *in_buffer, *in_buffer_limit; +char *buf_ptr, *buf_end; + +char sc_buf[sc_size]; + +char *save_com, *sc_end; +char *bp_save; +char *be_save; + +struct options opt; +int line_no; + +struct parser_state ps; +int ifdef_level; +struct parser_state state_stack[5]; +struct parser_state match_state[5]; + + static void bakcopy(void); static void indent_declaration(int, int); Modified: stable/12/usr.bin/indent/indent_globs.h ============================================================================== --- stable/12/usr.bin/indent/indent_globs.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/indent/indent_globs.h Thu Apr 9 20:35:35 2020 (r359753) @@ -49,8 +49,8 @@ #define true 1 -FILE *input; /* the fid for the input file */ -FILE *output; /* the output file */ +extern FILE *input; /* the fid for the input file */ +extern FILE *output; /* the output file */ #define CHECK_SIZE_CODE(desired_size) \ if (e_code + (desired_size) >= l_code) { \ @@ -104,41 +104,43 @@ FILE *output; /* the output file */ s_token = tokenbuf + 1; \ } -char *labbuf; /* buffer for label */ -char *s_lab; /* start ... */ -char *e_lab; /* .. and end of stored label */ -char *l_lab; /* limit of label buffer */ +extern char *labbuf; /* buffer for label */ +extern char *s_lab; /* start ... */ +extern char *e_lab; /* .. and end of stored label */ +extern char *l_lab; /* limit of label buffer */ -char *codebuf; /* buffer for code section */ -char *s_code; /* start ... */ -char *e_code; /* .. and end of stored code */ -char *l_code; /* limit of code section */ +extern char *codebuf; /* buffer for code section */ +extern char *s_code; /* start ... */ +extern char *e_code; /* .. and end of stored code */ +extern char *l_code; /* limit of code section */ -char *combuf; /* buffer for comments */ -char *s_com; /* start ... */ -char *e_com; /* ... and end of stored comments */ -char *l_com; /* limit of comment buffer */ +extern char *combuf; /* buffer for comments */ +extern char *s_com; /* start ... */ +extern char *e_com; /* ... and end of stored comments */ +extern char *l_com; /* limit of comment buffer */ #define token s_token -char *tokenbuf; /* the last token scanned */ -char *s_token; -char *e_token; -char *l_token; +extern char *tokenbuf; /* the last token scanned */ +extern char *s_token; +extern char *e_token; +extern char *l_token; -char *in_buffer; /* input buffer */ -char *in_buffer_limit; /* the end of the input buffer */ -char *buf_ptr; /* ptr to next character to be taken from - * in_buffer */ -char *buf_end; /* ptr to first after last char in in_buffer */ +extern char *in_buffer; /* input buffer */ +extern char *in_buffer_limit; /* the end of the input buffer */ +extern char *buf_ptr; /* ptr to next character to be taken + * from in_buffer */ +extern char *buf_end; /* ptr to first after last char in + * in_buffer */ -char sc_buf[sc_size]; /* input text is saved here when looking for - * the brace after an if, while, etc */ -char *save_com; /* start of the comment stored in sc_buf */ -char *sc_end; /* pointer into save_com buffer */ +extern char sc_buf[sc_size]; /* input text is saved here when looking + * for the brace after an if, while, etc */ +extern char *save_com; /* start of the comment stored in + * sc_buf */ +extern char *sc_end; /* pointer into save_com buffer */ -char *bp_save; /* saved value of buf_ptr when taking input - * from save_com */ -char *be_save; /* similarly saved value of buf_end */ +extern char *bp_save; /* saved value of buf_ptr when taking + * input from save_com */ +extern char *be_save; /* similarly saved value of buf_end */ struct options { @@ -217,21 +219,22 @@ struct options { * uses all spaces */ int verbose; /* when true, non-essential error messages * are printed */ -} opt; +}; +extern struct options opt; -int found_err; -int n_real_blanklines; -int prefix_blankline_requested; -int postfix_blankline_requested; -int break_comma; /* when true and not in parens, break after a +extern int found_err; +extern int n_real_blanklines; +extern int prefix_blankline_requested; +extern int postfix_blankline_requested; +extern int break_comma; /* when true and not in parens, break after a * comma */ -float case_ind; /* indentation level to be used for a "case +extern float case_ind; /* indentation level to be used for a "case * n:" */ -int code_lines; /* count of lines with code */ -int had_eof; /* set to true when input is exhausted */ -int line_no; /* the current line number. */ -int inhibit_formatting; /* true if INDENT OFF is in effect */ -int suppress_blanklines;/* set iff following blanklines should be +extern int code_lines; /* count of lines with code */ +extern int had_eof; /* set to true when input is exhausted */ +extern int line_no; /* the current line number. */ +extern int inhibit_formatting; /* true if INDENT OFF is in effect */ +extern int suppress_blanklines;/* set iff following blanklines should be * suppressed */ #define STACKSIZE 256 @@ -312,8 +315,10 @@ struct parser_state { int tos; /* pointer to top of stack */ char procname[100]; /* The name of the current procedure */ int just_saw_decl; -} ps; +}; -int ifdef_level; -struct parser_state state_stack[5]; -struct parser_state match_state[5]; +extern struct parser_state ps; + +extern int ifdef_level; +extern struct parser_state state_stack[5]; +extern struct parser_state match_state[5]; Modified: stable/12/usr.bin/indent/io.c ============================================================================== --- stable/12/usr.bin/indent/io.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/indent/io.c Thu Apr 9 20:35:35 2020 (r359753) @@ -52,6 +52,15 @@ __FBSDID("$FreeBSD$"); #include "indent_globs.h" #include "indent.h" +/* Globals */ +int found_err; +int n_real_blanklines; +int prefix_blankline_requested, postfix_blankline_requested; +int code_lines; +int had_eof; +int inhibit_formatting; +int suppress_blanklines; + int comment_open; static int paren_target; static int pad_output(int current, int target); Modified: stable/12/usr.bin/indent/parse.c ============================================================================== --- stable/12/usr.bin/indent/parse.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/indent/parse.c Thu Apr 9 20:35:35 2020 (r359753) @@ -50,6 +50,10 @@ __FBSDID("$FreeBSD$"); #include "indent_codes.h" #include "indent.h" +/* Globals */ +int break_comma; +float case_ind; + static void reduce(void); void Modified: stable/12/usr.bin/locate/locate/locate.c ============================================================================== --- stable/12/usr.bin/locate/locate/locate.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/locate/locate/locate.c Thu Apr 9 20:35:35 2020 (r359753) @@ -116,6 +116,7 @@ int f_limit; /* limit number of output line u_int counter; /* counter for matches [-c] */ char separator='\n'; /* line separator */ +u_char myctype[UCHAR_MAX + 1]; void usage(void); void statistic(FILE *, char *); Modified: stable/12/usr.bin/locate/locate/locate.h ============================================================================== --- stable/12/usr.bin/locate/locate/locate.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/locate/locate/locate.h Thu Apr 9 20:35:35 2020 (r359753) @@ -65,7 +65,7 @@ define TOLOWER(ch) tolower(ch) #else -u_char myctype[UCHAR_MAX + 1]; +extern u_char myctype[UCHAR_MAX + 1]; #define TOLOWER(ch) (myctype[ch]) #endif Modified: stable/12/usr.bin/systat/swap.c ============================================================================== --- stable/12/usr.bin/systat/swap.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.bin/systat/swap.c Thu Apr 9 20:35:35 2020 (r359753) @@ -56,8 +56,6 @@ static const char sccsid[] = "@(#)swap.c 8.3 (Berkeley #include "systat.h" #include "extern.h" -kvm_t *kd; - static char *header; static long blocksize; static int dlen, odlen; Modified: stable/12/usr.sbin/config/config.h ============================================================================== --- stable/12/usr.sbin/config/config.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/config/config.h Thu Apr 9 20:35:35 2020 (r359753) @@ -45,7 +45,7 @@ struct cfgfile { STAILQ_ENTRY(cfgfile) cfg_next; char *cfg_path; }; -STAILQ_HEAD(, cfgfile) cfgfiles; +extern STAILQ_HEAD(cfgfile_head, cfgfile) cfgfiles; struct file_list { STAILQ_ENTRY(file_list) f_next; @@ -103,8 +103,8 @@ struct config { * in the makerules, etc. machinearch is the global notion of the * MACHINE_ARCH for this MACHINE. */ -char *machinename; -char *machinearch; +extern char *machinename; +extern char *machinearch; /* * For each machine, a set of CPU's may be specified as supported. @@ -115,7 +115,7 @@ struct cputype { SLIST_ENTRY(cputype) cpu_next; }; -SLIST_HEAD(, cputype) cputype; +extern SLIST_HEAD(cputype_head, cputype) cputype; /* * A set of options may also be specified which are like CPU types, @@ -131,7 +131,7 @@ struct opt { SLIST_ENTRY(opt) op_append; }; -SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; +extern SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; struct opt_list { char *o_name; @@ -141,7 +141,7 @@ struct opt_list { SLIST_ENTRY(opt_list) o_next; }; -SLIST_HEAD(, opt_list) otab; +extern SLIST_HEAD(opt_list_head, opt_list) otab; struct envvar { char *env_str; @@ -149,21 +149,21 @@ struct envvar { STAILQ_ENTRY(envvar) envvar_next; }; -STAILQ_HEAD(envvar_head, envvar) envvars; +extern STAILQ_HEAD(envvar_head, envvar) envvars; struct hint { char *hint_name; STAILQ_ENTRY(hint) hint_next; }; -STAILQ_HEAD(hint_head, hint) hints; +extern STAILQ_HEAD(hint_head, hint) hints; struct includepath { char *path; SLIST_ENTRY(includepath) path_next; }; -SLIST_HEAD(, includepath) includepath; +extern SLIST_HEAD(includepath_head, includepath) includepath; /* * Tag present in the kernconf.tmpl template file. It's mandatory for those Modified: stable/12/usr.sbin/config/main.c ============================================================================== --- stable/12/usr.sbin/config/main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/config/main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -72,6 +72,17 @@ static const char rcsid[] = #define CDIR "../compile/" +char *machinename; +char *machinearch; + +struct cfgfile_head cfgfiles; +struct cputype_head cputype; +struct opt_head opt, mkopt, rmopts; +struct opt_list_head otab; +struct envvar_head envvars; +struct hint_head hints; +struct includepath_head includepath; + char * PREFIX; char destdir[MAXPATHLEN]; char srcdir[MAXPATHLEN]; Modified: stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_main.c ============================================================================== --- stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -83,6 +83,7 @@ static int _rpcfdtype; #define _IDLE 0 #define _SERVED 1 #define _SERVING 2 +int debug; static char _localhost[] = "localhost"; static char _passwd_byname[] = "passwd.byname"; @@ -172,8 +173,6 @@ main(int argc, char *argv[]) char *mastername; char myname[MAXHOSTNAMELEN + 2]; int maxrec = RPC_MAXDATASIZE; - - extern int debug; debug = 1; Modified: stable/12/usr.sbin/rpc.ypupdated/ypupdated_main.c ============================================================================== --- stable/12/usr.sbin/rpc.ypupdated/ypupdated_main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/rpc.ypupdated/ypupdated_main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -76,6 +76,8 @@ static int _rpcfdtype; extern int _rpcsvcstate; /* Set when a request is serviced */ +int debug; + char *progname = "rpc.ypupdated"; char *yp_dir = "/var/yp/"; Modified: stable/12/usr.sbin/rpc.ypxfrd/ypxfrd_main.c ============================================================================== --- stable/12/usr.sbin/rpc.ypxfrd/ypxfrd_main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/rpc.ypxfrd/ypxfrd_main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -78,6 +78,8 @@ static int _rpcfdtype; extern int _rpcsvcstate; /* Set when a request is serviced */ +int debug; + char *progname = "rpc.ypxfrd"; char *yp_dir = "/var/yp/"; Modified: stable/12/usr.sbin/ypldap/ypldap.c ============================================================================== --- stable/12/usr.sbin/ypldap/ypldap.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/ypldap/ypldap.c Thu Apr 9 20:35:35 2020 (r359753) @@ -40,6 +40,8 @@ #include "ypldap.h" +enum ypldap_process_type ypldap_process; + __dead2 void usage(void); int check_child(pid_t, const char *); void main_sig_handler(int, short, void *); Modified: stable/12/usr.sbin/ypldap/ypldap.h ============================================================================== --- stable/12/usr.sbin/ypldap/ypldap.h Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/ypldap/ypldap.h Thu Apr 9 20:35:35 2020 (r359753) @@ -47,10 +47,11 @@ struct ypldap_addr { }; TAILQ_HEAD(ypldap_addr_list, ypldap_addr); -enum { +enum ypldap_process_type { PROC_MAIN, PROC_CLIENT -} ypldap_process; +}; +extern enum ypldap_process_type ypldap_process; struct userent { RB_ENTRY(userent) ue_name_node; Modified: stable/12/usr.sbin/ypserv/yp_access.c ============================================================================== --- stable/12/usr.sbin/ypserv/yp_access.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/ypserv/yp_access.c Thu Apr 9 20:35:35 2020 (r359753) @@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$"); #include "tcpd.h" #endif -extern int debug; - static const char *yp_procs[] = { /* NIS v1 */ "ypoldproc_null", Modified: stable/12/usr.sbin/ypserv/yp_error.c ============================================================================== --- stable/12/usr.sbin/ypserv/yp_error.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/ypserv/yp_error.c Thu Apr 9 20:35:35 2020 (r359753) @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include "yp_extern.h" -int debug; - extern int _rpcpmstart; extern char *progname; static void __verr(const char *fmt, va_list ap) __printflike(1, 0); Modified: stable/12/usr.sbin/ypserv/yp_main.c ============================================================================== --- stable/12/usr.sbin/ypserv/yp_main.c Thu Apr 9 18:38:00 2020 (r359752) +++ stable/12/usr.sbin/ypserv/yp_main.c Thu Apr 9 20:35:35 2020 (r359753) @@ -89,7 +89,7 @@ extern int _rpc_dtablesize(void); extern int _rpcsvcstate; /* Set when a request is serviced */ char *progname = "ypserv"; char *yp_dir = _PATH_YP; -/*int debug = 0;*/ +int debug; int do_dns = 0; int resfd; From owner-svn-src-stable-12@freebsd.org Thu Apr 9 20:49:02 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 654BB27EB77; Thu, 9 Apr 2020 20:49:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48ytXt25BYz4GGx; Thu, 9 Apr 2020 20:49:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42F611AD02; Thu, 9 Apr 2020 20:49:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 039Kn28i078357; Thu, 9 Apr 2020 20:49:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 039Kn2qX078356; Thu, 9 Apr 2020 20:49:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004092049.039Kn2qX078356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 9 Apr 2020 20:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359755 - in stable: 11/contrib/binutils/gas 12/contrib/binutils/gas X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/contrib/binutils/gas 12/contrib/binutils/gas X-SVN-Commit-Revision: 359755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2020 20:49:02 -0000 Author: kevans Date: Thu Apr 9 20:49:01 2020 New Revision: 359755 URL: https://svnweb.freebsd.org/changeset/base/359755 Log: gas: mark dwarf2_loc_mark_labels as extern Compiling with -fno-common complains as this header's included in multiple compilation units. In fact, the proper definition of dwarf2_loc_mark_labels already exists in dwarf2dbg.c, so simply mark this declaration with extern. Modified: stable/12/contrib/binutils/gas/dwarf2dbg.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/binutils/gas/dwarf2dbg.h Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/binutils/gas/dwarf2dbg.h ============================================================================== --- stable/12/contrib/binutils/gas/dwarf2dbg.h Thu Apr 9 20:38:36 2020 (r359754) +++ stable/12/contrib/binutils/gas/dwarf2dbg.h Thu Apr 9 20:49:01 2020 (r359755) @@ -78,7 +78,7 @@ extern void dwarf2_emit_label (symbolS *); /* True when we're supposed to set the basic block mark whenever a label is seen. Unless the target is doing Something Weird, just call dwarf2_emit_label. */ -bfd_boolean dwarf2_loc_mark_labels; +extern bfd_boolean dwarf2_loc_mark_labels; extern void dwarf2_finish (void); From owner-svn-src-stable-12@freebsd.org Fri Apr 10 00:23:36 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F8B32AB81B; Fri, 10 Apr 2020 00:23:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yzJS2BpYz4V0y; Fri, 10 Apr 2020 00:23:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4698F1D70C; Fri, 10 Apr 2020 00:23:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A0NaCC012393; Fri, 10 Apr 2020 00:23:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A0NZ3F012391; Fri, 10 Apr 2020 00:23:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004100023.03A0NZ3F012391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 10 Apr 2020 00:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359761 - in stable: 11/stand/mips/beri/loader 11/stand/powerpc/ofw 11/stand/uboot/lib 12/stand/mips/beri/loader 12/stand/powerpc/ofw 12/stand/uboot/lib X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/mips/beri/loader 11/stand/powerpc/ofw 11/stand/uboot/lib 12/stand/mips/beri/loader 12/stand/powerpc/ofw 12/stand/uboot/lib X-SVN-Commit-Revision: 359761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 00:23:36 -0000 Author: kevans Date: Fri Apr 10 00:23:34 2020 New Revision: 359761 URL: https://svnweb.freebsd.org/changeset/base/359761 Log: MFC r359688: stand: -fno-common fixes for !x86 loaders - beriloader: archsw is declared extern and defined elsewhere - ofwloader: ofw_elf{,64} are defined in elf_freebsd.c and ppc64_elf_freebsd.c respectively - ubldr: syscall_ptr is defined in start.S for whichever ubldr platform is building -fno-common will become the default in GCC10/LLVM11. Modified: stable/12/stand/mips/beri/loader/main.c stable/12/stand/powerpc/ofw/conf.c stable/12/stand/uboot/lib/glue.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/mips/beri/loader/main.c stable/11/stand/powerpc/ofw/conf.c stable/11/stand/uboot/lib/glue.h Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/mips/beri/loader/main.c ============================================================================== --- stable/12/stand/mips/beri/loader/main.c Thu Apr 9 23:51:18 2020 (r359760) +++ stable/12/stand/mips/beri/loader/main.c Fri Apr 10 00:23:34 2020 (r359761) @@ -59,8 +59,6 @@ struct devsw *devsw[] = { NULL }; -struct arch_switch archsw; - struct file_format *file_formats[] = { &beri_elf, NULL Modified: stable/12/stand/powerpc/ofw/conf.c ============================================================================== --- stable/12/stand/powerpc/ofw/conf.c Thu Apr 9 23:51:18 2020 (r359760) +++ stable/12/stand/powerpc/ofw/conf.c Fri Apr 10 00:23:34 2020 (r359761) @@ -97,8 +97,8 @@ struct netif_driver *netif_drivers[] = { * rather than reading the file go first. */ -struct file_format ofw_elf; -struct file_format ofw_elf64; +extern struct file_format ofw_elf; +extern struct file_format ofw_elf64; struct file_format *file_formats[] = { &ofw_elf, Modified: stable/12/stand/uboot/lib/glue.h ============================================================================== --- stable/12/stand/uboot/lib/glue.h Thu Apr 9 23:51:18 2020 (r359760) +++ stable/12/stand/uboot/lib/glue.h Fri Apr 10 00:23:34 2020 (r359761) @@ -56,7 +56,7 @@ #endif int syscall(int, int *, ...); -void *syscall_ptr; +extern void *syscall_ptr; int api_parse_cmdline_sig(int argc, char **argv, struct api_signature **sig); int api_search_sig(struct api_signature **sig); From owner-svn-src-stable-12@freebsd.org Fri Apr 10 00:25:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DB1F2AB933; Fri, 10 Apr 2020 00:25:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yzLM6dW4z4VFy; Fri, 10 Apr 2020 00:25:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4C891D711; Fri, 10 Apr 2020 00:25:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A0PFNM012589; Fri, 10 Apr 2020 00:25:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A0PF2A012588; Fri, 10 Apr 2020 00:25:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004100025.03A0PF2A012588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 10 Apr 2020 00:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359762 - in stable: 11/usr.sbin/config 12/usr.sbin/config X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.sbin/config 12/usr.sbin/config X-SVN-Commit-Revision: 359762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 00:25:16 -0000 Author: kevans Date: Fri Apr 10 00:25:14 2020 New Revision: 359762 URL: https://svnweb.freebsd.org/changeset/base/359762 Log: MFC r359689: config(8): "fix" a couple of buffer overflows Recently added/changed lines in various kernel configs have caused some buffer overflows that went undetected. These were detected with a config built using -fno-common as these line buffers smashed one of our arrays, then further triaged with ASAN. Double the sizes; this is really not a great fix, but addresses the immediate need until someone rewrites config. While here, add some bounds checking so that we don't need to detect this by random bus errors or other weird failures. Modified: stable/12/usr.sbin/config/main.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/config/main.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/config/main.c ============================================================================== --- stable/12/usr.sbin/config/main.c Fri Apr 10 00:23:34 2020 (r359761) +++ stable/12/usr.sbin/config/main.c Fri Apr 10 00:25:14 2020 (r359762) @@ -313,7 +313,7 @@ usage(void) char * get_word(FILE *fp) { - static char line[80]; + static char line[160]; int ch; char *cp; int escaped_nl = 0; @@ -343,11 +343,17 @@ begin: *cp = 0; return (line); } - while ((ch = getc(fp)) != EOF) { + while ((ch = getc(fp)) != EOF && cp < line + sizeof(line)) { if (isspace(ch)) break; *cp++ = ch; } + if (cp >= line + sizeof(line)) { + line[sizeof(line) - 1] = '\0'; + fprintf(stderr, "config: attempted overflow, partial line: `%s'", + line); + exit(2); + } *cp = 0; if (ch == EOF) return ((char *)EOF); @@ -363,7 +369,7 @@ begin: char * get_quoted_word(FILE *fp) { - static char line[256]; + static char line[512]; int ch; char *cp; int escaped_nl = 0; @@ -406,15 +412,29 @@ begin: } if (ch != quote && escaped_nl) *cp++ = '\\'; + if (cp >= line + sizeof(line)) { + line[sizeof(line) - 1] = '\0'; + printf( + "config: line buffer overflow reading partial line `%s'\n", + line); + exit(2); + } *cp++ = ch; escaped_nl = 0; } } else { *cp++ = ch; - while ((ch = getc(fp)) != EOF) { + while ((ch = getc(fp)) != EOF && cp < line + sizeof(line)) { if (isspace(ch)) break; *cp++ = ch; + } + if (cp >= line + sizeof(line)) { + line[sizeof(line) - 1] = '\0'; + printf( + "config: line buffer overflow reading partial line `%s'\n", + line); + exit(2); } if (ch != EOF) (void) ungetc(ch, fp); From owner-svn-src-stable-12@freebsd.org Fri Apr 10 00:27:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAE5D2ABA57; Fri, 10 Apr 2020 00:27:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48yzNp4Gftz4VWf; Fri, 10 Apr 2020 00:27:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B3371D717; Fri, 10 Apr 2020 00:27:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A0RMKf012798; Fri, 10 Apr 2020 00:27:22 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A0RLxe012791; Fri, 10 Apr 2020 00:27:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004100027.03A0RLxe012791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 10 Apr 2020 00:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359763 - in stable: 11/usr.bin/gprof 11/usr.bin/mail 11/usr.bin/tip/tip 12/usr.bin/gprof 12/usr.bin/mail 12/usr.bin/tip/tip X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.bin/gprof 11/usr.bin/mail 11/usr.bin/tip/tip 12/usr.bin/gprof 12/usr.bin/mail 12/usr.bin/tip/tip X-SVN-Commit-Revision: 359763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 00:27:22 -0000 Author: kevans Date: Fri Apr 10 00:27:19 2020 New Revision: 359763 URL: https://svnweb.freebsd.org/changeset/base/359763 Log: MFC r359680: mail/gprof/tip: tap with the ugly stick The ugly stick here is this bit in the respective headers: #ifndef EXTERN #define EXTERN extern #endif with a follow-up #define EXTERN in a single .c file to push all of their definitions into one spot. A pass should be made over these three later to push these definitions into the correct files instead, but this will suffice for now and at a more leisurely pace. Modified: stable/12/usr.bin/gprof/gprof.c stable/12/usr.bin/gprof/gprof.h stable/12/usr.bin/mail/glob.h stable/12/usr.bin/mail/main.c stable/12/usr.bin/mail/strings.c stable/12/usr.bin/tip/tip/tip.c stable/12/usr.bin/tip/tip/tip.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/gprof/gprof.c stable/11/usr.bin/gprof/gprof.h stable/11/usr.bin/mail/glob.h stable/11/usr.bin/mail/main.c stable/11/usr.bin/mail/strings.c stable/11/usr.bin/tip/tip/tip.c stable/11/usr.bin/tip/tip/tip.h Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.bin/gprof/gprof.c ============================================================================== --- stable/12/usr.bin/gprof/gprof.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/gprof/gprof.c Fri Apr 10 00:27:19 2020 (r359763) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#define EXTERN #include "gprof.h" static int valcmp(const void *, const void *); Modified: stable/12/usr.bin/gprof/gprof.h ============================================================================== --- stable/12/usr.bin/gprof/gprof.h Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/gprof/gprof.h Fri Apr 10 00:27:19 2020 (r359763) @@ -72,18 +72,22 @@ typedef int bool; */ #define HISTORICAL_SCALE_2 2 +#ifndef EXTERN +#define EXTERN extern +#endif + /* * ticks per second */ -long hz; +EXTERN long hz; -size_t histcounter_size; -int histcounter_type; +EXTERN size_t histcounter_size; +EXTERN int histcounter_type; -char *a_outname; +EXTERN char *a_outname; #define A_OUTNAME "a.out" -char *gmonname; +EXTERN char *gmonname; #define GMONSUM "gmon.sum" /* @@ -143,9 +147,9 @@ struct nl { }; typedef struct nl nltype; -nltype *nl; /* the whole namelist */ -nltype *npe; /* the virtual end of the namelist */ -int nname; /* the number of function names */ +EXTERN nltype *nl; /* the whole namelist */ +EXTERN nltype *npe; /* the virtual end of the namelist */ +EXTERN int nname; /* the number of function names */ #define HASCYCLEXIT 0x08 /* node has arc exiting from cycle */ #define CYCLEHEAD 0x10 /* node marked as head of a cycle */ @@ -164,9 +168,9 @@ struct cl { }; typedef struct cl cltype; -arctype *archead; /* the head of arcs in current cycle list */ -cltype *cyclehead; /* the head of the list */ -int cyclecnt; /* the number of cycles found */ +EXTERN arctype *archead; /* the head of arcs in current cycle list */ +EXTERN cltype *cyclehead; /* the head of the list */ +EXTERN int cyclecnt; /* the number of cycles found */ #define CYCLEMAX 100 /* maximum cycles before cutting one of them */ /* @@ -180,8 +184,8 @@ int cyclecnt; /* the number of cycles found */ * namelist entries for cycle headers. * the number of discovered cycles. */ -nltype *cyclenl; /* cycle header namelist */ -int ncycle; /* number of cycles discovered */ +EXTERN nltype *cyclenl; /* cycle header namelist */ +EXTERN int ncycle; /* number of cycles discovered */ /* * The header on the gmon.out file. @@ -197,43 +201,46 @@ struct ophdr { int ncnt; }; -int debug; +EXTERN int debug; /* * Each discretized pc sample has * a count of the number of samples in its range */ -double *samples; +EXTERN double *samples; -unsigned long s_lowpc; /* lowpc from the profile file */ -unsigned long s_highpc; /* highpc from the profile file */ -unsigned long lowpc, highpc; /* range profiled, in historical units */ -unsigned sampbytes; /* number of bytes of samples */ -int nsamples; /* number of samples */ -double actime; /* accumulated time thus far for putprofline */ -double totime; /* total time for all routines */ -double printtime; /* total of time being printed */ -double scale; /* scale factor converting samples to pc +EXTERN unsigned long s_lowpc; /* lowpc from the profile file */ +EXTERN unsigned long s_highpc; /* highpc from the profile file */ +/* range profiled, in historical units */ +EXTERN unsigned long lowpc, highpc; +EXTERN unsigned sampbytes; /* number of bytes of samples */ +EXTERN int nsamples; /* number of samples */ +/* accumulated time thus far for putprofline */ +EXTERN double actime; +EXTERN double totime; /* total time for all routines */ +EXTERN double printtime; /* total of time being printed */ +EXTERN double scale; /* scale factor converting samples to pc values: each sample covers scale bytes */ -unsigned char *textspace; /* text space of a.out in core */ -int cyclethreshold; /* with -C, minimum cycle size to ignore */ +EXTERN unsigned char *textspace; /* text space of a.out in core */ +/* with -C, minimum cycle size to ignore */ +EXTERN int cyclethreshold; /* * option flags, from a to z. */ -bool aflag; /* suppress static functions */ -bool bflag; /* blurbs, too */ -bool Cflag; /* find cut-set to eliminate cycles */ -bool dflag; /* debugging options */ -bool eflag; /* specific functions excluded */ -bool Eflag; /* functions excluded with time */ -bool fflag; /* specific functions requested */ -bool Fflag; /* functions requested with time */ -bool kflag; /* arcs to be deleted */ -bool Kflag; /* use the running kernel for symbols */ -bool sflag; /* sum multiple gmon.out files */ -bool uflag; /* suppress symbols hidden from C */ -bool zflag; /* zero time/called functions, too */ +EXTERN bool aflag; /* suppress static functions */ +EXTERN bool bflag; /* blurbs, too */ +EXTERN bool Cflag; /* find cut-set to eliminate cycles */ +EXTERN bool dflag; /* debugging options */ +EXTERN bool eflag; /* specific functions excluded */ +EXTERN bool Eflag; /* functions excluded with time */ +EXTERN bool fflag; /* specific functions requested */ +EXTERN bool Fflag; /* functions requested with time */ +EXTERN bool kflag; /* arcs to be deleted */ +EXTERN bool Kflag; /* use the running kernel for symbols */ +EXTERN bool sflag; /* sum multiple gmon.out files */ +EXTERN bool uflag; /* suppress symbols hidden from C */ +EXTERN bool zflag; /* zero time/called functions, too */ /* * structure for various string lists @@ -242,12 +249,12 @@ struct stringlist { struct stringlist *next; char *string; }; -struct stringlist *elist; -struct stringlist *Elist; -struct stringlist *flist; -struct stringlist *Flist; -struct stringlist *kfromlist; -struct stringlist *ktolist; +extern struct stringlist *elist; +extern struct stringlist *Elist; +extern struct stringlist *flist; +extern struct stringlist *Flist; +extern struct stringlist *kfromlist; +extern struct stringlist *ktolist; /* * function declarations Modified: stable/12/usr.bin/mail/glob.h ============================================================================== --- stable/12/usr.bin/mail/glob.h Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/mail/glob.h Fri Apr 10 00:27:19 2020 (r359763) @@ -38,51 +38,51 @@ * def.h must be included first. */ -int msgCount; /* Count of messages read in */ -int rcvmode; /* True if receiving mail */ -int sawcom; /* Set after first command */ -char *Tflag; /* -T temp file for netnews */ -int senderr; /* An error while checking */ -int edit; /* Indicates editing a file */ -int readonly; /* Will be unable to rewrite file */ -int noreset; /* String resets suspended */ -int sourcing; /* Currently reading variant file */ -int loading; /* Loading user definitions */ -int cond; /* Current state of conditional exc. */ -FILE *itf; /* Input temp file buffer */ -FILE *otf; /* Output temp file buffer */ -int image; /* File descriptor for image of msg */ -FILE *input; /* Current command input file */ -char mailname[PATHSIZE]; /* Name of current file */ -char prevfile[PATHSIZE]; /* Name of previous file */ -char *homedir; /* Path name of home directory */ -char *myname; /* My login name */ -off_t mailsize; /* Size of system mailbox */ -int lexnumber; /* Number of TNUMBER from scan() */ -char lexstring[STRINGLEN]; /* String from TSTRING, scan() */ -int regretp; /* Pointer to TOS of regret tokens */ -int regretstack[REGDEP]; /* Stack of regretted tokens */ -char *string_stack[REGDEP]; /* Stack of regretted strings */ -int numberstack[REGDEP]; /* Stack of regretted numbers */ -struct message *dot; /* Pointer to current message */ -struct message *message; /* The actual message structure */ -struct var *variables[HSHSIZE]; /* Pointer to active var list */ -struct grouphead *groups[HSHSIZE];/* Pointer to active groups */ -struct ignoretab ignore[2]; /* ignored and retained fields +extern int msgCount; /* Count of messages read in */ +extern int rcvmode; /* True if receiving mail */ +extern int sawcom; /* Set after first command */ +extern char *Tflag; /* -T temp file for netnews */ +extern int senderr; /* An error while checking */ +extern int edit; /* Indicates editing a file */ +extern int readonly; /* Will be unable to rewrite file */ +extern int noreset; /* String resets suspended */ +extern int sourcing; /* Currently reading variant file */ +extern int loading; /* Loading user definitions */ +extern int cond; /* Current state of conditional exc. */ +extern FILE *itf; /* Input temp file buffer */ +extern FILE *otf; /* Output temp file buffer */ +extern int image; /* File descriptor for image of msg */ +extern FILE *input; /* Current command input file */ +extern char mailname[PATHSIZE]; /* Name of current file */ +extern char prevfile[PATHSIZE]; /* Name of previous file */ +extern char *homedir; /* Path name of home directory */ +extern char *myname; /* My login name */ +extern off_t mailsize; /* Size of system mailbox */ +extern int lexnumber; /* Number of TNUMBER from scan() */ +extern char lexstring[STRINGLEN]; /* String from TSTRING, scan() */ +extern int regretp; /* Pointer to TOS of regret tokens */ +extern int regretstack[REGDEP]; /* Stack of regretted tokens */ +extern char *string_stack[REGDEP]; /* Stack of regretted strings */ +extern int numberstack[REGDEP]; /* Stack of regretted numbers */ +extern struct message *dot; /* Pointer to current message */ +extern struct message *message; /* The actual message structure */ +extern struct var *variables[HSHSIZE]; /* Pointer to active var list */ +extern struct grouphead *groups[HSHSIZE];/* Pointer to active groups */ +extern struct ignoretab ignore[2]; /* ignored and retained fields 0 is ignore, 1 is retain */ -struct ignoretab saveignore[2]; /* ignored and retained fields +extern struct ignoretab saveignore[2]; /* ignored and retained fields on save to folder */ -struct ignoretab ignoreall[2]; /* special, ignore all headers */ -char **altnames; /* List of alternate names for user */ -int debug; /* Debug flag set */ -int screenwidth; /* Screen width, or best guess */ -int screenheight; /* Screen height, or best guess, +extern struct ignoretab ignoreall[2]; /* special, ignore all headers */ +extern char **altnames; /* List of alternate names for user */ +extern int debug; /* Debug flag set */ +extern int screenwidth; /* Screen width, or best guess */ +extern int screenheight; /* Screen height, or best guess, for "header" command */ -int realscreenheight; /* the real screen height */ +extern int realscreenheight; /* the real screen height */ #include -jmp_buf srbuf; +extern jmp_buf srbuf; /* @@ -93,7 +93,7 @@ jmp_buf srbuf; */ #define NSPACE 25 /* Total number of string spaces */ -struct strings { +extern struct strings { char *s_topFree; /* Beginning of this area */ char *s_nextFree; /* Next alloctable place here */ unsigned s_nleft; /* Number of bytes left here */ Modified: stable/12/usr.bin/mail/main.c ============================================================================== --- stable/12/usr.bin/mail/main.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/mail/main.c Fri Apr 10 00:27:19 2020 (r359763) @@ -52,6 +52,49 @@ __FBSDID("$FreeBSD$"); * * Startup -- interface with user. */ +int msgCount; +int rcvmode; +int sawcom; +char *Tflag; +int senderr; +int edit; +int readonly; +int noreset; +int sourcing; +int loading; +int cond; +FILE *itf; +FILE *otf; +int image; +FILE *input; +char mailname[PATHSIZE]; +char prevfile[PATHSIZE]; +char *homedir; +char *myname; +off_t mailsize; +int lexnumber; +char lexstring[STRINGLEN]; +int regretp; +int regretstack[REGDEP]; +char *string_stack[REGDEP]; +int numberstack[REGDEP]; +struct message *dot; +struct message *message; +struct var *variables[HSHSIZE]; +struct grouphead *groups[HSHSIZE]; +struct ignoretab ignore[2]; + +struct ignoretab saveignore[2]; + +struct ignoretab ignoreall[2]; +char **altnames; +int debug; +int screenwidth; +int screenheight; + +int realscreenheight; + +jmp_buf srbuf; static jmp_buf hdrjmp; Modified: stable/12/usr.bin/mail/strings.c ============================================================================== --- stable/12/usr.bin/mail/strings.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/mail/strings.c Fri Apr 10 00:27:19 2020 (r359763) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include "rcv.h" #include "extern.h" +struct strings stringdope[NSPACE]; + /* * Allocate size more bytes of space and return the address of the * first byte to the caller. An even number of bytes are always Modified: stable/12/usr.bin/tip/tip/tip.c ============================================================================== --- stable/12/usr.bin/tip/tip/tip.c Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/tip/tip/tip.c Fri Apr 10 00:27:19 2020 (r359763) @@ -54,6 +54,7 @@ static const char rcsid[] = "$OpenBSD: tip.c,v 1.30 20 * or * cu phone-number [-s speed] [-l line] [-a acu] */ +#define EXTERN #include "tip.h" #include "pathnames.h" Modified: stable/12/usr.bin/tip/tip/tip.h ============================================================================== --- stable/12/usr.bin/tip/tip/tip.h Fri Apr 10 00:25:14 2020 (r359762) +++ stable/12/usr.bin/tip/tip/tip.h Fri Apr 10 00:27:19 2020 (r359763) @@ -58,40 +58,44 @@ #include #include +#ifndef EXTERN +#define EXTERN extern +#endif + /* * Remote host attributes */ -char *DV; /* UNIX device(s) to open */ -char *EL; /* chars marking an EOL */ -char *CM; /* initial connection message */ -char *IE; /* EOT to expect on input */ -char *OE; /* EOT to send to complete FT */ -char *CU; /* call unit if making a phone call */ -char *AT; /* acu type */ -char *PN; /* phone number(s) */ -char *DI; /* disconnect string */ -char *PA; /* parity to be generated */ +EXTERN char *DV; /* UNIX device(s) to open */ +EXTERN char *EL; /* chars marking an EOL */ +EXTERN char *CM; /* initial connection message */ +EXTERN char *IE; /* EOT to expect on input */ +EXTERN char *OE; /* EOT to send to complete FT */ +EXTERN char *CU; /* call unit if making a phone call */ +EXTERN char *AT; /* acu type */ +EXTERN char *PN; /* phone number(s) */ +EXTERN char *DI; /* disconnect string */ +EXTERN char *PA; /* parity to be generated */ -char *PH; /* phone number file */ -char *RM; /* remote file name */ -char *HO; /* host name */ +EXTERN char *PH; /* phone number file */ +EXTERN char *RM; /* remote file name */ +EXTERN char *HO; /* host name */ -long BR; /* line speed for conversation */ -long FS; /* frame size for transfers */ +EXTERN long BR; /* line speed for conversation */ +EXTERN long FS; /* frame size for transfers */ -short DU; /* this host is dialed up */ -short HW; /* this device is hardwired, see hunt.c */ -char *ES; /* escape character */ -char *EX; /* exceptions */ -char *FO; /* force (literal next) char*/ -char *RC; /* raise character */ -char *RE; /* script record file */ -char *PR; /* remote prompt */ -long DL; /* line delay for file transfers to remote */ -long CL; /* char delay for file transfers to remote */ -long ET; /* echocheck timeout */ -long LD; /* line disc */ -short HD; /* this host is half duplex - do local echo */ +EXTERN short DU; /* this host is dialed up */ +EXTERN short HW; /* this device is hardwired, see hunt.c */ +EXTERN char *ES; /* escape character */ +EXTERN char *EX; /* exceptions */ +EXTERN char *FO; /* force (literal next) char*/ +EXTERN char *RC; /* raise character */ +EXTERN char *RE; /* script record file */ +EXTERN char *PR; /* remote prompt */ +EXTERN long DL; /* line delay for file transfers to remote */ +EXTERN long CL; /* char delay for file transfers to remote */ +EXTERN long ET; /* echocheck timeout */ +EXTERN long LD; /* line disc */ +EXTERN short HD; /* this host is half duplex - do local echo */ /* * String value table @@ -237,39 +241,39 @@ extern value_t vtable[]; /* variable table */ #define NOFILE ((FILE *)NULL) #define NOPWD ((struct passwd *)0) -struct termios term; /* current mode of terminal */ -struct termios defterm; /* initial mode of terminal */ -struct termios defchars; /* current mode with initial chars */ -int gotdefterm; +EXTERN struct termios term; /* current mode of terminal */ +EXTERN struct termios defterm; /* initial mode of terminal */ +EXTERN struct termios defchars; /* current mode with initial chars */ +EXTERN int gotdefterm; -FILE *fscript; /* FILE for scripting */ +EXTERN FILE *fscript; /* FILE for scripting */ -int fildes[2]; /* file transfer synchronization channel */ -int repdes[2]; /* read process sychronization channel */ -int FD; /* open file descriptor to remote host */ -int AC; /* open file descriptor to dialer (v831 only) */ -int vflag; /* print .tiprc initialization sequence */ -int noesc; /* no `~' escape char */ -int sfd; /* for ~< operation */ -pid_t tipin_pid; /* pid of tipin */ -pid_t tipout_pid; /* pid of tipout */ -uid_t uid, euid; /* real and effective user id's */ -gid_t gid, egid; /* real and effective group id's */ -int stop; /* stop transfer session flag */ -int quit; /* same; but on other end */ -int intflag; /* recognized interrupt */ -int stoprompt; /* for interrupting a prompt session */ -int timedout; /* ~> transfer timedout */ -int cumode; /* simulating the "cu" program */ -int bits8; /* terminal is 8-bit mode */ +EXTERN int fildes[2]; /* file transfer synchronization channel */ +EXTERN int repdes[2]; /* read process sychronization channel */ +EXTERN int FD; /* open file descriptor to remote host */ +EXTERN int AC; /* open file descriptor to dialer (v831 only) */ +EXTERN int vflag; /* print .tiprc initialization sequence */ +EXTERN int noesc; /* no `~' escape char */ +EXTERN int sfd; /* for ~< operation */ +EXTERN pid_t tipin_pid; /* pid of tipin */ +EXTERN pid_t tipout_pid; /* pid of tipout */ +EXTERN uid_t uid, euid; /* real and effective user id's */ +EXTERN gid_t gid, egid; /* real and effective group id's */ +EXTERN int stop; /* stop transfer session flag */ +EXTERN int quit; /* same; but on other end */ +EXTERN int intflag; /* recognized interrupt */ +EXTERN int stoprompt; /* for interrupting a prompt session */ +EXTERN int timedout; /* ~> transfer timedout */ +EXTERN int cumode; /* simulating the "cu" program */ +EXTERN int bits8; /* terminal is 8-bit mode */ #define STRIP_PAR (bits8 ? 0377 : 0177) -char fname[PATH_MAX]; /* file name buffer for ~< */ -char copyname[PATH_MAX]; /* file name buffer for ~> */ -char ccc; /* synchronization character */ -char *uucplock; /* name of lock file for uucp's */ +EXTERN char fname[PATH_MAX]; /* file name buffer for ~< */ +EXTERN char copyname[PATH_MAX]; /* file name buffer for ~> */ +EXTERN char ccc; /* synchronization character */ +EXTERN char *uucplock; /* name of lock file for uucp's */ -int odisc; /* initial tty line discipline */ +EXTERN int odisc; /* initial tty line discipline */ extern int disc; /* current tty discpline */ extern char *__progname; /* program name */ From owner-svn-src-stable-12@freebsd.org Fri Apr 10 01:23:07 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EB742AD064; Fri, 10 Apr 2020 01:23:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48z0d66f8Hz4YmY; Fri, 10 Apr 2020 01:23:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF3401E26C; Fri, 10 Apr 2020 01:23:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A1N6qR049655; Fri, 10 Apr 2020 01:23:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A1N6qL049654; Fri, 10 Apr 2020 01:23:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004100123.03A1N6qL049654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 10 Apr 2020 01:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359765 - stable/12/sys/geom/journal X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/geom/journal X-SVN-Commit-Revision: 359765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 01:23:07 -0000 Author: markj Date: Fri Apr 10 01:23:06 2020 New Revision: 359765 URL: https://svnweb.freebsd.org/changeset/base/359765 Log: MFC r359595: geom_journal: Only stop the switcher process if one was started. PR: 243196 Modified: stable/12/sys/geom/journal/g_journal.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/journal/g_journal.c ============================================================================== --- stable/12/sys/geom/journal/g_journal.c Fri Apr 10 00:31:52 2020 (r359764) +++ stable/12/sys/geom/journal/g_journal.c Fri Apr 10 01:23:06 2020 (r359765) @@ -2749,7 +2749,8 @@ g_journal_fini(struct g_class *mp) } if (g_journal_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, g_journal_event_lowmem); - g_journal_stop_switcher(); + if (g_journal_switcher_proc != NULL) + g_journal_stop_switcher(); } DECLARE_GEOM_CLASS(g_journal_class, g_journal); From owner-svn-src-stable-12@freebsd.org Fri Apr 10 01:37:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D6052AD67E; Fri, 10 Apr 2020 01:37:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48z0x86fZWz4Zsm; Fri, 10 Apr 2020 01:37:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFA081E47B; Fri, 10 Apr 2020 01:37:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A1b0q9056496; Fri, 10 Apr 2020 01:37:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A1b0oG056495; Fri, 10 Apr 2020 01:37:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004100137.03A1b0oG056495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 10 Apr 2020 01:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359768 - stable/12/usr.bin/xargs X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/xargs X-SVN-Commit-Revision: 359768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 01:37:01 -0000 Author: markj Date: Fri Apr 10 01:37:00 2020 New Revision: 359768 URL: https://svnweb.freebsd.org/changeset/base/359768 Log: MFC r359596: xargs: Fix exit status expression when a child process fails to exec. PR: 244327 Modified: stable/12/usr.bin/xargs/xargs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/xargs/xargs.c ============================================================================== --- stable/12/usr.bin/xargs/xargs.c Fri Apr 10 01:28:47 2020 (r359767) +++ stable/12/usr.bin/xargs/xargs.c Fri Apr 10 01:37:00 2020 (r359768) @@ -650,7 +650,7 @@ waitchildren(const char *name, int waitall) if (childerr != 0 && cause_exit == 0) { errno = childerr; waitall = 1; - cause_exit = ENOENT ? 127 : 126; + cause_exit = errno == ENOENT ? 127 : 126; warn("%s", name); } else if (WIFSIGNALED(status)) { waitall = cause_exit = 1; From owner-svn-src-stable-12@freebsd.org Fri Apr 10 05:13:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7052C2B25D9; Fri, 10 Apr 2020 05:13:16 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48z5kh2MLdz4nYj; Fri, 10 Apr 2020 05:13:16 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BD2B20F13; Fri, 10 Apr 2020 05:13:16 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A5DG8L090745; Fri, 10 Apr 2020 05:13:16 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A5DGt9090744; Fri, 10 Apr 2020 05:13:16 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202004100513.03A5DGt9090744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 10 Apr 2020 05:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359769 - stable/12/stand/liblua X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/stand/liblua X-SVN-Commit-Revision: 359769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 05:13:16 -0000 Author: sjg Date: Fri Apr 10 05:13:15 2020 New Revision: 359769 URL: https://svnweb.freebsd.org/changeset/base/359769 Log: veloader use vectx API for kernel and modules The vectx API, computes the hash for verifying a file as it is read. This avoids the overhead of reading files twice - once to verify, then again to load. For doing an install via loader, avoiding the need to rewind large files is critical. This API is only used for modules, kernel and mdimage as these are the biggest files read by the loader. The reduction in boot time depends on how expensive the I/O is on any given platform. On a fast VM we see 6% improvement. For install via loader the first file to be verified is likely to be the kernel, so some of the prep work (finding manifest etc) done by verify_file() needs to be factored so it can be reused for vectx_open(). For missing or unrecognized fingerprint entries, we fail in vectx_open() unless verifying is disabled. Otherwise fingerprint check happens in vectx_close() and since this API is only used for files which must be verified (VE_MUST) we panic if we get an incorrect hash. MFC of r358811 Reviewed by: imp,tsoome Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D23827 Modified: stable/12/stand/liblua/lstd.c Modified: stable/12/stand/liblua/lstd.c ============================================================================== --- stable/12/stand/liblua/lstd.c Fri Apr 10 01:37:00 2020 (r359768) +++ stable/12/stand/liblua/lstd.c Fri Apr 10 05:13:15 2020 (r359769) @@ -83,7 +83,7 @@ fopen(const char *filename, const char *mode) #ifdef LOADER_VERIEXEC /* only regular files and only reading makes sense */ if (S_ISREG(st.st_mode) && !(m & O_WRONLY)) { - if (verify_file(fd, filename, 0, VE_GUESS) < 0) { + if (verify_file(fd, filename, 0, VE_GUESS, __func__) < 0) { free(f); close(fd); return (NULL); From owner-svn-src-stable-12@freebsd.org Fri Apr 10 22:18:14 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8264827B825; Fri, 10 Apr 2020 22:18:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zXTL2wtQz4dRX; Fri, 10 Apr 2020 22:18:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B76B583A; Fri, 10 Apr 2020 22:18:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03AMIEhw018403; Fri, 10 Apr 2020 22:18:14 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03AMIDLJ018399; Fri, 10 Apr 2020 22:18:13 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202004102218.03AMIDLJ018399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 10 Apr 2020 22:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359782 - in stable/12/usr.bin/calendar: . calendars tests X-SVN-Group: stable-12 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/12/usr.bin/calendar: . calendars tests X-SVN-Commit-Revision: 359782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 22:18:14 -0000 Author: gonzo Date: Fri Apr 10 22:18:13 2020 New Revision: 359782 URL: https://svnweb.freebsd.org/changeset/base/359782 Log: MFC r359585, r359587 r359585: Fix calculation of the recurring weekdays Both the result of the first_dayofweek_of_year and the target weekday are zero-based (0 fo sunday) while the target month-day or year-day is 1-based. Adjust logic accordingly. Also add testcase for this PR to the kyua test suite PR: 201062 Submitted by: Richard Narron r359587: Remove hardcoded US Election Day from calendar.usholiday calendar(1) syntax is not capable of representing the rules for the US Election Day. The hardcoded date was set in r15066 in 1996 and hasn't changed since then. PR: 173389 Reported by: Steve Ames Added: stable/12/usr.bin/calendar/tests/regress.s5.out - copied unchanged from r359585, head/usr.bin/calendar/tests/regress.s5.out Modified: stable/12/usr.bin/calendar/calendars/calendar.usholiday stable/12/usr.bin/calendar/parsedata.c stable/12/usr.bin/calendar/tests/calendar.calibrate stable/12/usr.bin/calendar/tests/regress.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/calendar/calendars/calendar.usholiday ============================================================================== --- stable/12/usr.bin/calendar/calendars/calendar.usholiday Fri Apr 10 21:27:49 2020 (r359781) +++ stable/12/usr.bin/calendar/calendars/calendar.usholiday Fri Apr 10 22:18:13 2020 (r359782) @@ -30,7 +30,6 @@ 09/22* Autumnal Equinox 10/MonSecond Columbus Day in USA (2nd Monday of October) 10/31 All Hallows Eve (Halloween) -11/05* Election Day in USA (1st Tuesday after 1st Monday for even years) 11/SunFirst Daylight Savings Time ends in USA; clocks move back (1st Sunday of November) 11/11 Veterans' Day 11/ThuFourth Thanksgiving Day (4th Thursday in November) Modified: stable/12/usr.bin/calendar/parsedata.c ============================================================================== --- stable/12/usr.bin/calendar/parsedata.c Fri Apr 10 21:27:49 2020 (r359781) +++ stable/12/usr.bin/calendar/parsedata.c Fri Apr 10 22:18:13 2020 (r359782) @@ -578,7 +578,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int /* Every dayofweek of the year */ if (lflags == (F_DAYOFWEEK | F_VARIABLE)) { dow = first_dayofweek_of_year(year); - d = (idayofweek - dow + 8) % 7; + if (dow < 0) + continue; + d = (idayofweek - dow + 7) % 7 + 1; while (d <= 366) { if (remember_yd(year, d, &rm, &rd)) remember(&remindex, @@ -616,7 +618,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { offset = indextooffset(modifierindex); dow = first_dayofweek_of_month(year, imonth); - d = (idayofweek - dow + 8) % 7; + if (dow < 0) + continue; + d = (idayofweek - dow + 7) % 7 + 1; if (offset > 0) { while (d <= yearinfo->monthdays[imonth]) { @@ -650,7 +654,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int /* Every dayofweek of the month */ if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { dow = first_dayofweek_of_month(year, imonth); - d = (idayofweek - dow + 8) % 7; + if (dow < 0) + continue; + d = (idayofweek - dow + 7) % 7 + 1; while (d <= yearinfo->monthdays[imonth]) { if (remember_ymd(year, imonth, d)) remember(&remindex, Modified: stable/12/usr.bin/calendar/tests/calendar.calibrate ============================================================================== --- stable/12/usr.bin/calendar/tests/calendar.calibrate Fri Apr 10 21:27:49 2020 (r359781) +++ stable/12/usr.bin/calendar/tests/calendar.calibrate Fri Apr 10 22:18:13 2020 (r359782) @@ -188,6 +188,7 @@ LANG=C 06/28 jun 28 06/29 jun 29 06/30 jun 30 +06/SunThird sunthird 07/01 jul 1 07/02 jul 2 07/03 jul 3 Copied: stable/12/usr.bin/calendar/tests/regress.s5.out (from r359585, head/usr.bin/calendar/tests/regress.s5.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.bin/calendar/tests/regress.s5.out Fri Apr 10 22:18:13 2020 (r359782, copy of r359585, head/usr.bin/calendar/tests/regress.s5.out) @@ -0,0 +1,3 @@ +Jun 21* sunthird +Jun 21 jun 21 +Jun 22 jun 22 Modified: stable/12/usr.bin/calendar/tests/regress.sh ============================================================================== --- stable/12/usr.bin/calendar/tests/regress.sh Fri Apr 10 21:27:49 2020 (r359781) +++ stable/12/usr.bin/calendar/tests/regress.sh Fri Apr 10 22:18:13 2020 (r359782) @@ -7,12 +7,13 @@ CALENDAR="${CALENDAR_BIN} ${CALENDAR_FILE}" REGRESSION_START($1) -echo 1..28 +echo 1..29 REGRESSION_TEST(`s1',`$CALENDAR -t 29.12.2006') REGRESSION_TEST(`s2',`$CALENDAR -t 30.12.2006') REGRESSION_TEST(`s3',`$CALENDAR -t 31.12.2006') REGRESSION_TEST(`s4',`$CALENDAR -t 01.01.2007') +REGRESSION_TEST(`s5',`$CALENDAR -t 21.06.2015') REGRESSION_TEST(`a1',`$CALENDAR -A 3 -t 28.12.2006') REGRESSION_TEST(`a2',`$CALENDAR -A 3 -t 29.12.2006') From owner-svn-src-stable-12@freebsd.org Sat Apr 11 05:12:39 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 215B52AEDE3; Sat, 11 Apr 2020 05:12:39 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zjgV73xhz48gl; Sat, 11 Apr 2020 05:12:38 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDA73AC7F; Sat, 11 Apr 2020 05:12:38 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B5CcJJ081878; Sat, 11 Apr 2020 05:12:38 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B5Ccrm081877; Sat, 11 Apr 2020 05:12:38 GMT (envelope-from jah@FreeBSD.org) Message-Id: <202004110512.03B5Ccrm081877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Sat, 11 Apr 2020 05:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359794 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: jah X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 359794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 05:12:39 -0000 Author: jah Date: Sat Apr 11 05:12:38 2020 New Revision: 359794 URL: https://svnweb.freebsd.org/changeset/base/359794 Log: MFC r359501: deadlkres: include thread name in panic messages Modified: stable/12/sys/kern/kern_clock.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_clock.c ============================================================================== --- stable/12/sys/kern/kern_clock.c Sat Apr 11 00:17:55 2020 (r359793) +++ stable/12/sys/kern/kern_clock.c Sat Apr 11 05:12:38 2020 (r359794) @@ -204,8 +204,9 @@ deadlres_td_on_lock(struct proc *p, struct thread *td, * Accordingly with provided thresholds, this thread is stuck * for too long on a turnstile. */ - panic("%s: possible deadlock detected for %p, " - "blocked for %d ticks\n", __func__, td, tticks); + panic("%s: possible deadlock detected for %p (%s), " + "blocked for %d ticks\n", __func__, + td, sched_tdname(td), tticks); } static void @@ -238,8 +239,9 @@ deadlres_td_sleep_q(struct proc *p, struct thread *td, if (!strcmp(blessed[i], td->td_wmesg)) return; - panic("%s: possible deadlock detected for %p, " - "blocked for %d ticks\n", __func__, td, tticks); + panic("%s: possible deadlock detected for %p (%s), " + "blocked for %d ticks\n", __func__, + td, sched_tdname(td), tticks); } } From owner-svn-src-stable-12@freebsd.org Sat Apr 11 07:31:17 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 057AB2B1BC5; Sat, 11 Apr 2020 07:31:17 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zmlS6RTqz4H5M; Sat, 11 Apr 2020 07:31:16 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D85D7C727; Sat, 11 Apr 2020 07:31:16 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B7VGwh066159; Sat, 11 Apr 2020 07:31:16 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B7VGZq066158; Sat, 11 Apr 2020 07:31:16 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <202004110731.03B7VGZq066158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 11 Apr 2020 07:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359796 - stable/12/usr.bin/ruptime X-SVN-Group: stable-12 X-SVN-Commit-Author: nyan X-SVN-Commit-Paths: stable/12/usr.bin/ruptime X-SVN-Commit-Revision: 359796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 07:31:17 -0000 Author: nyan Date: Sat Apr 11 07:31:16 2020 New Revision: 359796 URL: https://svnweb.freebsd.org/changeset/base/359796 Log: MFC: r359631 Remove extra spaces for the load average of machines that are down. PR: 245296 Submitted by: martin _at_ lispworks.com Modified: stable/12/usr.bin/ruptime/ruptime.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/ruptime/ruptime.c ============================================================================== --- stable/12/usr.bin/ruptime/ruptime.c Sat Apr 11 07:24:57 2020 (r359795) +++ stable/12/usr.bin/ruptime/ruptime.c Sat Apr 11 07:31:16 2020 (r359796) @@ -234,18 +234,21 @@ ruptime(const char *host, int aflg, int (*cmp)(const v if (hostnamewidth < (int)strlen(wd->wd_hostname)) hostnamewidth = (int)strlen(wd->wd_hostname); - for (i = 0; i < 3; i++) { - w = iwidth(wd->wd_loadav[i] / 100) + 3; - if (loadavwidth[i] < w) - loadavwidth[i] = w; + + if (!ISDOWN(hsp)) { + for (i = 0; i < 3; i++) { + w = iwidth(wd->wd_loadav[i] / 100) + 3; + if (loadavwidth[i] < w) + loadavwidth[i] = w; + } + for (hsp->hs_nusers = 0, we = &wd->wd_we[0]; + (char *)(we + 1) <= (char *)wd + cc; we++) + if (aflg || we->we_idle < 3600) + ++hsp->hs_nusers; + if (userswidth < iwidth(hsp->hs_nusers)) + userswidth = iwidth(hsp->hs_nusers); } - for (hsp->hs_nusers = 0, we = &wd->wd_we[0]; - (char *)(we + 1) <= (char *)wd + cc; we++) - if (aflg || we->we_idle < 3600) - ++hsp->hs_nusers; - if (userswidth < iwidth(hsp->hs_nusers)) - userswidth = iwidth(hsp->hs_nusers); ++hsp; ++nhosts; } From owner-svn-src-stable-12@freebsd.org Sat Apr 11 09:35:49 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AE6C2B4CC8; Sat, 11 Apr 2020 09:35:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zqW91myGz4PQQ; Sat, 11 Apr 2020 09:35:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38279DF7B; Sat, 11 Apr 2020 09:35:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03B9ZnfA041164; Sat, 11 Apr 2020 09:35:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03B9Znlb041163; Sat, 11 Apr 2020 09:35:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202004110935.03B9Znlb041163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 11 Apr 2020 09:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359802 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 359802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 09:35:49 -0000 Author: ae Date: Sat Apr 11 09:35:48 2020 New Revision: 359802 URL: https://svnweb.freebsd.org/changeset/base/359802 Log: MFC r359498: Ignore ND6 neighbor advertisement received for static link-layer entries. Previously such NA could override manually created LLE. Reported by: Martin Beran Modified: stable/12/sys/netinet6/nd6_nbr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/12/sys/netinet6/nd6_nbr.c Sat Apr 11 08:16:35 2020 (r359801) +++ stable/12/sys/netinet6/nd6_nbr.c Sat Apr 11 09:35:48 2020 (r359802) @@ -753,6 +753,12 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) goto freeit; } + /* + * Do not try to override static entry. + */ + if (ln->la_flags & LLE_STATIC) + goto freeit; + if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { /* * If the link-layer has address, and no lladdr option came,