From owner-svn-src-stable-11@freebsd.org Sun Nov 10 17:33:11 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEF521B9C54; Sun, 10 Nov 2019 17:33:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47B1Lb65JRz4Bst; Sun, 10 Nov 2019 17:33:11 +0000 (UTC) (envelope-from dim@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 B473A2626; Sun, 10 Nov 2019 17:33:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAAHXBOT050652; Sun, 10 Nov 2019 17:33:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAHXBEO050649; Sun, 10 Nov 2019 17:33:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911101733.xAAHXBEO050649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 10 Nov 2019 17:33:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354596 - in stable: 10/lib/libc/gen 10/lib/msun/src 11/lib/libc/gen 11/lib/msun/src 12/lib/libc/gen 12/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/libc/gen 10/lib/msun/src 11/lib/libc/gen 11/lib/msun/src 12/lib/libc/gen 12/lib/msun/src X-SVN-Commit-Revision: 354596 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 17:33:12 -0000 Author: dim Date: Sun Nov 10 17:33:10 2019 New Revision: 354596 URL: https://svnweb.freebsd.org/changeset/base/354596 Log: MFC r354255: Add __isnan()/__isnanf() aliases for compatibility with glibc and CUDA Even though clang comes with a number of internal CUDA wrapper headers, compiling sample CUDA programs will result in errors similar to: In file included from :1: In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204: /usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan' if (__isnan(a)) { ^~~~~~~ /usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to __device__ function from __host__ function __DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); } ^ CUDA expects __isnan() and __isnanf() declarations to be available, which are glibc specific extensions, equivalent to the regular isnan() and isnanf(). To provide these, define __isnan() and __isnanf() as aliases of the already existing static inline functions __inline_isnan() and __inline_isnanf() from math.h. Reported by: arrowd PR: 241550 Modified: stable/11/lib/libc/gen/isnan.c stable/11/lib/msun/src/math.h stable/11/lib/msun/src/s_isnan.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/gen/isnan.c stable/10/lib/msun/src/math.h stable/10/lib/msun/src/s_isnan.c stable/12/lib/libc/gen/isnan.c stable/12/lib/msun/src/math.h stable/12/lib/msun/src/s_isnan.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/lib/libc/gen/isnan.c ============================================================================== --- stable/11/lib/libc/gen/isnan.c Sun Nov 10 17:00:23 2019 (r354595) +++ stable/11/lib/libc/gen/isnan.c Sun Nov 10 17:33:10 2019 (r354596) @@ -41,6 +41,13 @@ */ #ifdef PIC +/* + * Because math.h defines __isnan and __isnanf as aliases for compatibility with + * glibc and CUDA, we have to undefine them here to avoid redefinition errors. + */ +#undef __isnan +#undef __isnanf + __weak_reference(__isnan, isnan); __weak_reference(__isnanf, isnanf); Modified: stable/11/lib/msun/src/math.h ============================================================================== --- stable/11/lib/msun/src/math.h Sun Nov 10 17:00:23 2019 (r354595) +++ stable/11/lib/msun/src/math.h Sun Nov 10 17:33:10 2019 (r354596) @@ -215,6 +215,12 @@ __inline_isnanl(__const long double __x) } /* + * Define the following aliases, for compatibility with glibc and CUDA. + */ +#define __isnan __inline_isnan +#define __isnanf __inline_isnanf + +/* * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and * isinf() as functions taking double. C99, and the subsequent POSIX revisions * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating Modified: stable/11/lib/msun/src/s_isnan.c ============================================================================== --- stable/11/lib/msun/src/s_isnan.c Sun Nov 10 17:00:23 2019 (r354595) +++ stable/11/lib/msun/src/s_isnan.c Sun Nov 10 17:33:10 2019 (r354596) @@ -43,6 +43,12 @@ isnan(double d) } #endif /* !PIC */ +/* + * Because math.h defines __isnanf as an alias for compatibility with glibc and + * CUDA, we have to undefine it here to avoid redefinition errors. + */ +#undef __isnanf + int __isnanf(float f) { From owner-svn-src-stable-11@freebsd.org Sun Nov 10 18:41:15 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 693321BB771; Sun, 10 Nov 2019 18:41:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47B2s726M8z4G6x; Sun, 10 Nov 2019 18:41:15 +0000 (UTC) (envelope-from dim@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 2C9343225; Sun, 10 Nov 2019 18:41:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAAIfFVY088999; Sun, 10 Nov 2019 18:41:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAAIfEXV088995; Sun, 10 Nov 2019 18:41:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911101841.xAAIfEXV088995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 10 Nov 2019 18:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354598 - in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys X-SVN-Commit-Revision: 354598 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 18:41:15 -0000 Author: dim Date: Sun Nov 10 18:41:13 2019 New Revision: 354598 URL: https://svnweb.freebsd.org/changeset/base/354598 Log: MFC r354460: Merge commit e8316372b from llvm git (by Louis Dionne): [libc++] Add `__truncating_cast` for safely casting float types to integers This is needed anytime we need to clamp an arbitrary floating point value to an integer type. Thanks to Eric Fiselier for the patch. Differential Revision: https://reviews.llvm.org/D66836 llvm-svn: 370891 Merge commit b92deded8 from llvm git (by Louis Dionne): [libc++] Move __clamp_to_integral to , and harden against min()/max() macros llvm-svn: 370900 Merge commit 0ec6a4882 from llvm git (by Louis Dionne): [libc++] Fix potential OOB in poisson_distribution See details in the original Chromium bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=994957 Together, these fix a security issue in libc++'s implementation of std::poisson_distribution, which can be exploited to read data which is out of bounds. Note there are no programs in the FreeBSD base system that use std::poisson_distribution, so this is only a possible issue for ports and external programs which have been built against libc++. Therefore, I am bumping __FreeBSD_version for the benefit of our port maintainers. Requested by: emaste Security: potential OOB read Modified: stable/11/contrib/libc++/include/cmath stable/11/contrib/libc++/include/random stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libc++/include/cmath stable/12/contrib/libc++/include/random stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/libc++/include/cmath ============================================================================== --- stable/11/contrib/libc++/include/cmath Sun Nov 10 18:07:02 2019 (r354597) +++ stable/11/contrib/libc++/include/cmath Sun Nov 10 18:41:13 2019 (r354598) @@ -304,11 +304,15 @@ long double truncl(long double x); #include <__config> #include #include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD using ::signbit; @@ -607,6 +611,38 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT return isfinite(__lcpp_x); } +template ::digits > numeric_limits<_IntT>::digits), + int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> +_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT { + static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); + static_assert(is_integral<_IntT>::value, "must be an integral type"); + static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); + static_assert(is_same<_FloatT, float>::value || is_same<_FloatT, double>::value + || is_same<_FloatT,long double>::value, "unsupported floating point type"); + return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); +} + +// Convert a floating point number to the specified integral type after +// clamping to the integral types representable range. +// +// The behavior is undefined if `__r` is NaN. +template +_LIBCPP_INLINE_VISIBILITY +_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { + using _Lim = std::numeric_limits<_IntT>; + const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>(); + if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { + return _Lim::max(); + } else if (__r <= _Lim::lowest()) { + return _Lim::min(); + } + return static_cast<_IntT>(__r); +} + _LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS #endif // _LIBCPP_CMATH Modified: stable/11/contrib/libc++/include/random ============================================================================== --- stable/11/contrib/libc++/include/random Sun Nov 10 18:07:02 2019 (r354597) +++ stable/11/contrib/libc++/include/random Sun Nov 10 18:41:13 2019 (r354598) @@ -4593,7 +4593,10 @@ class _LIBCPP_TEMPLATE_VIS poisson_distribution (publi template poisson_distribution<_IntType>::param_type::param_type(double __mean) - : __mean_(__mean) + // According to the standard `inf` is a valid input, but it causes the + // distribution to hang, so we replace it with the maximum representable + // mean. + : __mean_(isinf(__mean) ? numeric_limits::max() : __mean) { if (__mean_ < 10) { @@ -4611,7 +4614,7 @@ poisson_distribution<_IntType>::param_type::param_type { __s_ = _VSTD::sqrt(__mean_); __d_ = 6 * __mean_ * __mean_; - __l_ = static_cast(__mean_ - 1.1484); + __l_ = std::trunc(__mean_ - 1.1484); __omega_ = .3989423 / __s_; double __b1_ = .4166667E-1 / __mean_; double __b2_ = .3 * __b1_ * __b1_; @@ -4628,12 +4631,12 @@ template _IntType poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) { - result_type __x; + double __tx; uniform_real_distribution __urd; if (__pr.__mean_ < 10) { - __x = 0; - for (double __p = __urd(__urng); __p > __pr.__l_; ++__x) + __tx = 0; + for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx) __p *= __urd(__urng); } else @@ -4643,19 +4646,19 @@ poisson_distribution<_IntType>::operator()(_URNG& __ur double __u; if (__g > 0) { - __x = static_cast(__g); - if (__x >= __pr.__l_) - return __x; - __difmuk = __pr.__mean_ - __x; + __tx = std::trunc(__g); + if (__tx >= __pr.__l_) + return std::__clamp_to_integral(__tx); + __difmuk = __pr.__mean_ - __tx; __u = __urd(__urng); if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk) - return __x; + return std::__clamp_to_integral(__tx); } exponential_distribution __edist; for (bool __using_exp_dist = false; true; __using_exp_dist = true) { double __e; - if (__using_exp_dist || __g < 0) + if (__using_exp_dist || __g <= 0) { double __t; do @@ -4665,31 +4668,31 @@ poisson_distribution<_IntType>::operator()(_URNG& __ur __u += __u - 1; __t = 1.8 + (__u < 0 ? -__e : __e); } while (__t <= -.6744); - __x = __pr.__mean_ + __pr.__s_ * __t; - __difmuk = __pr.__mean_ - __x; + __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t); + __difmuk = __pr.__mean_ - __tx; __using_exp_dist = true; } double __px; double __py; - if (__x < 10) + if (__tx < 10 && __tx >= 0) { const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; __px = -__pr.__mean_; - __py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x]; + __py = _VSTD::pow(__pr.__mean_, (double)__tx) / __fac[static_cast(__tx)]; } else { - double __del = .8333333E-1 / __x; + double __del = .8333333E-1 / __tx; __del -= 4.8 * __del * __del * __del; - double __v = __difmuk / __x; + double __v = __difmuk / __tx; if (_VSTD::abs(__v) > 0.25) - __px = __x * _VSTD::log(1 + __v) - __difmuk - __del; + __px = __tx * _VSTD::log(1 + __v) - __difmuk - __del; else - __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) * + __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) * __v + .1421878) * __v + -.1661269) * __v + .2000118) * __v + -.2500068) * __v + .3333333) * __v + -.5) - __del; - __py = .3989423 / _VSTD::sqrt(__x); + __py = .3989423 / _VSTD::sqrt(__tx); } double __r = (0.5 - __difmuk) / __pr.__s_; double __r2 = __r * __r; @@ -4709,7 +4712,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __ur } } } - return __x; + return std::__clamp_to_integral(__tx); } template Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Sun Nov 10 18:07:02 2019 (r354597) +++ stable/11/sys/sys/param.h Sun Nov 10 18:41:13 2019 (r354598) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1103500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1103501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Mon Nov 11 08:03:50 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B34591AEA3A; Mon, 11 Nov 2019 08:03:50 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BNg73x4Nz3PBQ; Mon, 11 Nov 2019 08:03:47 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qv1-f67.google.com with SMTP id c9so4499694qvz.9; Mon, 11 Nov 2019 00:03:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=02SEFZZ6/rJoM1txdfQFf+2fmMYuAGF/4DYlI3R3+fI=; b=gzRBZmCEPyUTvl7/4ZpYTE6Vm/wGHr51IObF+obMwDlbUSogPunGH1EBHbSyARzhgp SilDOok1bxj1qmct2hmzjlXWCselLim6uARGVAJH+VULZGw1dM2urzIsGailgBpCPLM9 t7K4IDPGpXwxslSgYrlrjIc5QRdRidY2Hl4FA20VD14y00mjp26RmWg9G1A5MtH3mswj K1uMOElLkEVPmau8uODyzaEI9sIkKJnVX1RZoAiTco+AUKV8xNpZKi+wpSMrqD0CsXez 3NwtWwf5N7hAqAA1uguiR3nI1MFzedwSsC6f1RIo4I3Y8Zj0NtGKhXeRWHeWTx08H5er KzVQ== X-Gm-Message-State: APjAAAXcdzsHNAHJgGuJoCkzdCN/FF3f9RKbCq+tZo/cyXgXu+6NPk/3 ugkS+sHqvie/bb9thRKGXMlLAo1C+V8qFvTVCEPi6dkc X-Google-Smtp-Source: APXvYqwM5j6uiuoOTwqlNZUYxunUiYE8EKd9Q1nT+NZj6kAJwzNRrXPurowCvre9KbeGSWQ8f5DvQTwfJVzhpMj4g6k= X-Received: by 2002:a0c:facf:: with SMTP id p15mr1265583qvo.212.1573459420618; Mon, 11 Nov 2019 00:03:40 -0800 (PST) MIME-Version: 1.0 References: <201911101841.xAAIfEXV088995@repo.freebsd.org> In-Reply-To: <201911101841.xAAIfEXV088995@repo.freebsd.org> From: Antoine Brodin Date: Mon, 11 Nov 2019 09:03:28 +0100 Message-ID: Subject: Re: svn commit: r354598 - in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47BNg73x4Nz3PBQ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 08:03:50 -0000 On Sun, Nov 10, 2019 at 7:41 PM Dimitry Andric wrote: > > Author: dim > Date: Sun Nov 10 18:41:13 2019 > New Revision: 354598 > URL: https://svnweb.freebsd.org/changeset/base/354598 > > Log: > MFC r354460: > > Merge commit e8316372b from llvm git (by Louis Dionne): > > [libc++] Add `__truncating_cast` for safely casting float types to > integers > > This is needed anytime we need to clamp an arbitrary floating point > value to an integer type. > > Thanks to Eric Fiselier for the patch. > > Differential Revision: https://reviews.llvm.org/D66836 > > llvm-svn: 370891 > > Merge commit b92deded8 from llvm git (by Louis Dionne): > > [libc++] Move __clamp_to_integral to , and harden against > min()/max() macros > > llvm-svn: 370900 > > Merge commit 0ec6a4882 from llvm git (by Louis Dionne): > > [libc++] Fix potential OOB in poisson_distribution > > See details in the original Chromium bug report: > https://bugs.chromium.org/p/chromium/issues/detail?id=994957 > > Together, these fix a security issue in libc++'s implementation of > std::poisson_distribution, which can be exploited to read data which is > out of bounds. > > Note there are no programs in the FreeBSD base system that use > std::poisson_distribution, so this is only a possible issue for ports > and external programs which have been built against libc++. Therefore, > I am bumping __FreeBSD_version for the benefit of our port maintainers. > > Requested by: emaste > Security: potential OOB read > > Modified: > stable/11/contrib/libc++/include/cmath > stable/11/contrib/libc++/include/random > stable/11/sys/sys/param.h > Directory Properties: > stable/11/ (props changed) > > Changes in other areas also in this revision: > Modified: > stable/12/contrib/libc++/include/cmath > stable/12/contrib/libc++/include/random > stable/12/sys/sys/param.h > Directory Properties: > stable/12/ (props changed) Hi, It seems that some recent changes to stable/11 are broken, lots of ports now fail to build on stable/11. Antoine (with hat: portmgr) From owner-svn-src-stable-11@freebsd.org Mon Nov 11 09:29:29 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6CF11B072F; Mon, 11 Nov 2019 09:29:29 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BQZ06MYrz3xyK; Mon, 11 Nov 2019 09:29:28 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f194.google.com with SMTP id r20so888133qtp.13; Mon, 11 Nov 2019 01:29:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6Umj3DYIUrQePS0aA10Xg7RaNEUwtLfhL4xLeOWVpkM=; b=uf/xSViDWPpesM2vE33VO+chymzgH9YBZKheP2GJV8NHuihuSIX0MZMNOWeWeso4vC aQFYsH9s41wf2NKaDs7Ujy/JwOTtFTLODCN+zyBemjR8iiGbNeIyOojAD+dGEaDwl1Lq JRJHKizerX4QT9kFMV1pjvhH/6zGnBnkvToUuGbd+SMqEBjAR/aiLw+4B8MPCCNS1AjK OPdNChKWBIqeUuFXFghFwcBOVQPrG39nSea9Zlc0ChUjWN9qy8jls3M3ZmHUph6awpHJ e+LEqwjl58JYkyLayamTAHLcZTcRbyOgYRhClxxmfBUHUxIJzskJGqZtuY4xbO/NaMiY gM6w== X-Gm-Message-State: APjAAAWr/I+pYoLMfS0xcBtgHT1dfoiR3zRyFgPWk61mQCUpR+xTyRT6 ocYYtyi/JCqAB2l4FCglzqc0dx4uh2sYywu6v32zOg== X-Google-Smtp-Source: APXvYqwJPDDr+gYd7yXVniZarYwSkmRIOEZ/uLZzhj0BZragQ5tL24JlFLGZ6E9B+MFPsNEixjOGdWm6YtSqgVIcmVA= X-Received: by 2002:ac8:6944:: with SMTP id n4mr25405815qtr.360.1573464567103; Mon, 11 Nov 2019 01:29:27 -0800 (PST) MIME-Version: 1.0 References: <201911101841.xAAIfEXV088995@repo.freebsd.org> In-Reply-To: From: Antoine Brodin Date: Mon, 11 Nov 2019 10:29:15 +0100 Message-ID: Subject: Re: svn commit: r354598 - in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47BQZ06MYrz3xyK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.160.194 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-4.04 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[194.160.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.04)[ip: (-4.96), ipnet: 209.85.128.0/17(-3.19), asn: 15169(-2.00), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[194.160.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 09:29:29 -0000 On Mon, Nov 11, 2019 at 9:03 AM Antoine Brodin wrote: > > On Sun, Nov 10, 2019 at 7:41 PM Dimitry Andric wrote: > > > > Author: dim > > Date: Sun Nov 10 18:41:13 2019 > > New Revision: 354598 > > URL: https://svnweb.freebsd.org/changeset/base/354598 > > > > Log: > > MFC r354460: > > > > Merge commit e8316372b from llvm git (by Louis Dionne): > > > > [libc++] Add `__truncating_cast` for safely casting float types to > > integers > > > > This is needed anytime we need to clamp an arbitrary floating point > > value to an integer type. > > > > Thanks to Eric Fiselier for the patch. > > > > Differential Revision: https://reviews.llvm.org/D66836 > > > > llvm-svn: 370891 > > > > Merge commit b92deded8 from llvm git (by Louis Dionne): > > > > [libc++] Move __clamp_to_integral to , and harden against > > min()/max() macros > > > > llvm-svn: 370900 > > > > Merge commit 0ec6a4882 from llvm git (by Louis Dionne): > > > > [libc++] Fix potential OOB in poisson_distribution > > > > See details in the original Chromium bug report: > > https://bugs.chromium.org/p/chromium/issues/detail?id=994957 > > > > Together, these fix a security issue in libc++'s implementation of > > std::poisson_distribution, which can be exploited to read data which is > > out of bounds. > > > > Note there are no programs in the FreeBSD base system that use > > std::poisson_distribution, so this is only a possible issue for ports > > and external programs which have been built against libc++. Therefore, > > I am bumping __FreeBSD_version for the benefit of our port maintainers. > > > > Requested by: emaste > > Security: potential OOB read > > > > Modified: > > stable/11/contrib/libc++/include/cmath > > stable/11/contrib/libc++/include/random > > stable/11/sys/sys/param.h > > Directory Properties: > > stable/11/ (props changed) > > > > Changes in other areas also in this revision: > > Modified: > > stable/12/contrib/libc++/include/cmath > > stable/12/contrib/libc++/include/random > > stable/12/sys/sys/param.h > > Directory Properties: > > stable/12/ (props changed) > > Hi, > > It seems that some recent changes to stable/11 are broken, lots of > ports now fail to build on stable/11. This affects stable/12 too. It seems that the cmath header can't be compiled. Antoine From owner-svn-src-stable-11@freebsd.org Mon Nov 11 10:10:04 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16E421B144F; Mon, 11 Nov 2019 10:10:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BRSq6wyhz40lM; Mon, 11 Nov 2019 10:10:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id BA3751D064; Mon, 11 Nov 2019 10:10:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [192.168.1.58] (92-111-45-100.static.v4.ziggozakelijk.nl [92.111.45.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 280B92C1E3; Mon, 11 Nov 2019 11:10:02 +0100 (CET) From: Dimitry Andric Message-Id: <4FEA5BCC-A9E7-4FDB-8392-04027239D9B0@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_B7FA7644-3FA1-4324-BA00-4497784FC089"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r354598 - in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys Date: Mon, 11 Nov 2019 11:09:57 +0100 In-Reply-To: Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org To: Antoine Brodin References: <201911101841.xAAIfEXV088995@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 10:10:04 -0000 --Apple-Mail=_B7FA7644-3FA1-4324-BA00-4497784FC089 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 11 Nov 2019, at 10:29, Antoine Brodin wrote: > > On Mon, Nov 11, 2019 at 9:03 AM Antoine Brodin wrote: >> >> On Sun, Nov 10, 2019 at 7:41 PM Dimitry Andric wrote: >>> >>> Author: dim >>> Date: Sun Nov 10 18:41:13 2019 >>> New Revision: 354598 >>> URL: https://svnweb.freebsd.org/changeset/base/354598 >>> >>> Log: >>> MFC r354460: >>> >>> Merge commit e8316372b from llvm git (by Louis Dionne): >>> >>> [libc++] Add `__truncating_cast` for safely casting float types to >>> integers >>> >>> This is needed anytime we need to clamp an arbitrary floating point >>> value to an integer type. >>> >>> Thanks to Eric Fiselier for the patch. >>> >>> Differential Revision: https://reviews.llvm.org/D66836 >>> >>> llvm-svn: 370891 >>> >>> Merge commit b92deded8 from llvm git (by Louis Dionne): >>> >>> [libc++] Move __clamp_to_integral to , and harden against >>> min()/max() macros >>> >>> llvm-svn: 370900 >>> >>> Merge commit 0ec6a4882 from llvm git (by Louis Dionne): >>> >>> [libc++] Fix potential OOB in poisson_distribution >>> >>> See details in the original Chromium bug report: >>> https://bugs.chromium.org/p/chromium/issues/detail?id=994957 >>> >>> Together, these fix a security issue in libc++'s implementation of >>> std::poisson_distribution, which can be exploited to read data which is >>> out of bounds. >>> >>> Note there are no programs in the FreeBSD base system that use >>> std::poisson_distribution, so this is only a possible issue for ports >>> and external programs which have been built against libc++. Therefore, >>> I am bumping __FreeBSD_version for the benefit of our port maintainers. >>> >>> Requested by: emaste >>> Security: potential OOB read >>> >>> Modified: >>> stable/11/contrib/libc++/include/cmath >>> stable/11/contrib/libc++/include/random >>> stable/11/sys/sys/param.h >>> Directory Properties: >>> stable/11/ (props changed) >>> >>> Changes in other areas also in this revision: >>> Modified: >>> stable/12/contrib/libc++/include/cmath >>> stable/12/contrib/libc++/include/random >>> stable/12/sys/sys/param.h >>> Directory Properties: >>> stable/12/ (props changed) >> >> Hi, >> >> It seems that some recent changes to stable/11 are broken, lots of >> ports now fail to build on stable/11. > > This affects stable/12 too. > It seems that the cmath header can't be compiled. Interesting, it works fine here on e.g. stable/12: $ cat test-cmath.cpp #include $ c++ -c test-cmath.cpp Are there any build logs available showing errors? -Dimitry --Apple-Mail=_B7FA7644-3FA1-4324-BA00-4497784FC089 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXckzdQAKCRCwXqMKLiCW o4y3AJ9GvaN7RcZPoaiwVm7G4oQaH+ly3ACeLF7IErSgpIbwNqNn6argKKIdGpE= =MZkc -----END PGP SIGNATURE----- --Apple-Mail=_B7FA7644-3FA1-4324-BA00-4497784FC089-- From owner-svn-src-stable-11@freebsd.org Mon Nov 11 10:30:41 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23E291B1AD3; Mon, 11 Nov 2019 10:30:41 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47BRwd0BGcz41lQ; Mon, 11 Nov 2019 10:30:40 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qk1-f194.google.com with SMTP id z16so10703948qkg.7; Mon, 11 Nov 2019 02:30:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LDMDsW8RtfaSJGK6YnL4Hi3cA6dnJOeSpggXlzX+u1c=; b=IAfYJ1NVxmBgIEfP5Bk2ukm/WELiheW7I0eIo2T+KNHLKc07sAOM0eOy3acR1cl459 /zV8eStJVKrMVstI7i+fSk5Kc25FpIEnpN7J5cF5r6oup517KcVWNUx2eup32c16HbPX 9QhMC+9jTu4t2hIOSNWJ3VKjOb+kv18VMc2ABwBBWp95zLMgNVjruPxUQR6CXyD0msEr n1KFhQpnjcW9IKetB4qz9w4cnoGvVC0X9vUw4xLUDT5/4DIJdxmOfsAk36RS3b71XK34 QBEQAUzqjVe9W4aQ8qpL9dillTuEOZRTE1mrBmuRr+Fj1yuKIj36yiJyY1g4Pcez9/mx IE4g== X-Gm-Message-State: APjAAAUHMS+Ji/TRluI/3B0wWIKmU5iC1tFXfL9jmfUUm4/217pqTFVN LOBsozT4yIB28+YXpZ3nmr/Wfx9ZzhIbraani1ux5vd3 X-Google-Smtp-Source: APXvYqxrP1GUuqyb06DyOCexcVc8gogUvm3RdkdmVwNR+NsMHqk0Q/4BSrxMkQbocsFk9lCjc50Lk9qy6oyRQqk/J38= X-Received: by 2002:a37:b885:: with SMTP id i127mr5286075qkf.485.1573468239376; Mon, 11 Nov 2019 02:30:39 -0800 (PST) MIME-Version: 1.0 References: <201911101841.xAAIfEXV088995@repo.freebsd.org> <4FEA5BCC-A9E7-4FDB-8392-04027239D9B0@FreeBSD.org> In-Reply-To: <4FEA5BCC-A9E7-4FDB-8392-04027239D9B0@FreeBSD.org> From: Antoine Brodin Date: Mon, 11 Nov 2019 11:30:27 +0100 Message-ID: Subject: Re: svn commit: r354598 - in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys To: Dimitry Andric Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47BRwd0BGcz41lQ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 10:30:41 -0000 On Mon, Nov 11, 2019 at 11:10 AM Dimitry Andric wrote: > > On 11 Nov 2019, at 10:29, Antoine Brodin wrote: > > > > On Mon, Nov 11, 2019 at 9:03 AM Antoine Brodin wrote: > >> > >> On Sun, Nov 10, 2019 at 7:41 PM Dimitry Andric wrote: > >>> > >>> Author: dim > >>> Date: Sun Nov 10 18:41:13 2019 > >>> New Revision: 354598 > >>> URL: https://svnweb.freebsd.org/changeset/base/354598 > >>> > >>> Log: > >>> MFC r354460: > >>> > >>> Merge commit e8316372b from llvm git (by Louis Dionne): > >>> > >>> [libc++] Add `__truncating_cast` for safely casting float types to > >>> integers > >>> > >>> This is needed anytime we need to clamp an arbitrary floating point > >>> value to an integer type. > >>> > >>> Thanks to Eric Fiselier for the patch. > >>> > >>> Differential Revision: https://reviews.llvm.org/D66836 > >>> > >>> llvm-svn: 370891 > >>> > >>> Merge commit b92deded8 from llvm git (by Louis Dionne): > >>> > >>> [libc++] Move __clamp_to_integral to , and harden against > >>> min()/max() macros > >>> > >>> llvm-svn: 370900 > >>> > >>> Merge commit 0ec6a4882 from llvm git (by Louis Dionne): > >>> > >>> [libc++] Fix potential OOB in poisson_distribution > >>> > >>> See details in the original Chromium bug report: > >>> https://bugs.chromium.org/p/chromium/issues/detail?id=994957 > >>> > >>> Together, these fix a security issue in libc++'s implementation of > >>> std::poisson_distribution, which can be exploited to read data which is > >>> out of bounds. > >>> > >>> Note there are no programs in the FreeBSD base system that use > >>> std::poisson_distribution, so this is only a possible issue for ports > >>> and external programs which have been built against libc++. Therefore, > >>> I am bumping __FreeBSD_version for the benefit of our port maintainers. > >>> > >>> Requested by: emaste > >>> Security: potential OOB read > >>> > >>> Modified: > >>> stable/11/contrib/libc++/include/cmath > >>> stable/11/contrib/libc++/include/random > >>> stable/11/sys/sys/param.h > >>> Directory Properties: > >>> stable/11/ (props changed) > >>> > >>> Changes in other areas also in this revision: > >>> Modified: > >>> stable/12/contrib/libc++/include/cmath > >>> stable/12/contrib/libc++/include/random > >>> stable/12/sys/sys/param.h > >>> Directory Properties: > >>> stable/12/ (props changed) > >> > >> Hi, > >> > >> It seems that some recent changes to stable/11 are broken, lots of > >> ports now fail to build on stable/11. > > > > This affects stable/12 too. > > It seems that the cmath header can't be compiled. > > Interesting, it works fine here on e.g. stable/12: > > $ cat test-cmath.cpp > #include > > $ c++ -c test-cmath.cpp > > Are there any build logs available showing errors? For instance these logs: http://gohan01.nyi.freebsd.org/data/12stable-i386-quarterly-baseline/517228/logs/errors/x265-3.1.2_2.log http://gohan01.nyi.freebsd.org/data/12stable-i386-quarterly-baseline/517228/logs/errors/exiv2-0.27.1_2,1.log /usr/include/c++/v1/cmath:622:68: error: too many arguments provided to function-like macro invocation static_assert(is_same<_FloatT, float>::value || is_same<_FloatT, double>::value ^ /usr/include/c++/v1/__config:873:13: note: macro 'static_assert' defined here # define static_assert(__b, __m) _Static_assert(__b, __m) ^ Antoine From owner-svn-src-stable-11@freebsd.org Mon Nov 11 14:49:46 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D4C41B72D6; Mon, 11 Nov 2019 14:49:46 +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 47BYgZ2NWzz4Ft1; Mon, 11 Nov 2019 14:49:46 +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 30E0318E25; Mon, 11 Nov 2019 14:49:46 +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 xABEnkxK098456; Mon, 11 Nov 2019 14:49:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABEnkhi098455; Mon, 11 Nov 2019 14:49:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911111449.xABEnkhi098455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 11 Nov 2019 14:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354610 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 354610 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 14:49:46 -0000 Author: hselasky Date: Mon Nov 11 14:49:45 2019 New Revision: 354610 URL: https://svnweb.freebsd.org/changeset/base/354610 Log: MFC r353275: Compile time assert a valid subsystem for all VNET init and uninit functions. Using VNET init and uninit functions outside the given range has undefined behaviour. Sponsored by: Mellanox Technologies Modified: stable/11/sys/net/vnet.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/vnet.h ============================================================================== --- stable/11/sys/net/vnet.h Mon Nov 11 14:41:05 2019 (r354609) +++ stable/11/sys/net/vnet.h Mon Nov 11 14:49:45 2019 (r354610) @@ -308,6 +308,8 @@ struct vnet_sysinit { }; #define VNET_SYSINIT(ident, subsystem, order, func, arg) \ + CTASSERT((subsystem) > SI_SUB_VNET && \ + (subsystem) <= SI_SUB_VNET_DONE); \ static struct vnet_sysinit ident ## _vnet_init = { \ subsystem, \ order, \ @@ -320,6 +322,8 @@ struct vnet_sysinit { vnet_deregister_sysinit, &ident ## _vnet_init) #define VNET_SYSUNINIT(ident, subsystem, order, func, arg) \ + CTASSERT((subsystem) > SI_SUB_VNET && \ + (subsystem) <= SI_SUB_VNET_DONE); \ static struct vnet_sysinit ident ## _vnet_uninit = { \ subsystem, \ order, \ From owner-svn-src-stable-11@freebsd.org Mon Nov 11 14:51:56 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFCAE1B751B; Mon, 11 Nov 2019 14:51:56 +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 47BYk45jH0z4GL4; Mon, 11 Nov 2019 14:51:56 +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 A72BA18F9E; Mon, 11 Nov 2019 14:51:56 +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 xABEpuPF003716; Mon, 11 Nov 2019 14:51:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABEpuno003715; Mon, 11 Nov 2019 14:51:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911111451.xABEpuno003715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 11 Nov 2019 14:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354612 - stable/11/sys/dev/usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/controller X-SVN-Commit-Revision: 354612 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 14:51:56 -0000 Author: hselasky Date: Mon Nov 11 14:51:56 2019 New Revision: 354612 URL: https://svnweb.freebsd.org/changeset/base/354612 Log: MFC r353273: Make control endpoint quirk for xhci(4) configurable. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/controller/xhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci.c Mon Nov 11 14:51:08 2019 (r354611) +++ stable/11/sys/dev/usb/controller/xhci.c Mon Nov 11 14:51:56 2019 (r354612) @@ -93,6 +93,10 @@ static int xhcistreams; SYSCTL_INT(_hw_usb_xhci, OID_AUTO, streams, CTLFLAG_RWTUN, &xhcistreams, 0, "Set to enable streams mode support"); +static int xhcictlquirk = 1; +SYSCTL_INT(_hw_usb_xhci, OID_AUTO, ctlquirk, CTLFLAG_RWTUN, + &xhcictlquirk, 0, "Set to enable control endpoint quirk"); + #ifdef USB_DEBUG static int xhcidebug; static int xhciroute; @@ -600,7 +604,7 @@ xhci_init(struct xhci_softc *sc, device_t self, uint8_ sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); /* enable 64Kbyte control endpoint quirk */ - sc->sc_bus.control_ep_quirk = 1; + sc->sc_bus.control_ep_quirk = (xhcictlquirk ? 1 : 0); temp = XREAD4(sc, capa, XHCI_HCSPARAMS1); From owner-svn-src-stable-11@freebsd.org Mon Nov 11 15:23:59 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 412D51B7C23; Mon, 11 Nov 2019 15:23:59 +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 47BZR30wdMz4Hk6; Mon, 11 Nov 2019 15:23:59 +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 0425019557; Mon, 11 Nov 2019 15:23:59 +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 xABFNwT1022193; Mon, 11 Nov 2019 15:23:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABFNwMK022191; Mon, 11 Nov 2019 15:23:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911111523.xABFNwMK022191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 11 Nov 2019 15:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354614 - in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 354614 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 15:23:59 -0000 Author: hselasky Date: Mon Nov 11 15:23:58 2019 New Revision: 354614 URL: https://svnweb.freebsd.org/changeset/base/354614 Log: MFC r351701: LinuxKPI: Add sysfs create/remove functions that handles multiple files in one call. Differential Revision: D21475 Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 11 14:56:22 2019 (r354613) +++ stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 11 15:23:58 2019 (r354614) @@ -152,6 +152,29 @@ sysfs_remove_file(struct kobject *kobj, const struct a sysctl_remove_name(kobj->oidp, attr->name, 1, 1); } +static inline int +sysfs_create_files(struct kobject *kobj, const struct attribute * const *attrs) +{ + int error = 0; + int i; + + for (i = 0; attrs[i] && !error; i++) + error = sysfs_create_file(kobj, attrs[i]); + while (error && --i >= 0) + sysfs_remove_file(kobj, attrs[i]); + + return (error); +} + +static inline void +sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attrs) +{ + int i; + + for (i = 0; attrs[i]; i++) + sysfs_remove_file(kobj, attrs[i]); +} + static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Nov 11 14:56:22 2019 (r354613) +++ stable/11/sys/sys/param.h Mon Nov 11 15:23:58 2019 (r354614) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1103501 /* Master, propagated to newvers */ +#define __FreeBSD_version 1103502 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Mon Nov 11 15:26:06 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E30501B7CA9; Mon, 11 Nov 2019 15:26:06 +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 47BZTV5ckQz4Hs4; Mon, 11 Nov 2019 15:26:06 +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 A411019559; Mon, 11 Nov 2019 15:26:06 +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 xABFQ6JG022360; Mon, 11 Nov 2019 15:26:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABFQ6dC022358; Mon, 11 Nov 2019 15:26:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911111526.xABFQ6dC022358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 11 Nov 2019 15:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354615 - in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 354615 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 15:26:07 -0000 Author: hselasky Date: Mon Nov 11 15:26:05 2019 New Revision: 354615 URL: https://svnweb.freebsd.org/changeset/base/354615 Log: MFC r351937: LinuxKPI: Improve sysfs support. - Add functions for creating and merging sysfs groups. - Add sysfs_streq function to compare strings ignoring newline from the sysctl userland call. - Add a call to sysfs_create_groups in device_add. - Remove duplicate header include. - Bump __FreeBSD_version. Differential Revision: D21542 Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Nov 11 15:23:58 2019 (r354614) +++ stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Nov 11 15:26:05 2019 (r354615) @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -315,6 +314,10 @@ device_add(struct device *dev) dev->devt = makedev(0, device_get_unit(dev->bsddev)); } kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); + + if (dev->groups) + return (sysfs_create_groups(&dev->kobj, dev->groups)); + return (0); } Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 11 15:23:58 2019 (r354614) +++ stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 11 15:26:05 2019 (r354615) @@ -175,6 +175,27 @@ sysfs_remove_files(struct kobject *kobj, const struct sysfs_remove_file(kobj, attrs[i]); } +static inline int +sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) +{ + struct attribute **attr; + struct sysctl_oid *oidp; + + /* Don't create the group node if grp->name is undefined. */ + if (grp->name) + oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->oidp), + OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, grp->name); + else + oidp = kobj->oidp; + for (attr = grp->attrs; *attr != NULL; attr++) { + SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO, + (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, + kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", ""); + } + + return (0); +} + static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { @@ -184,20 +205,40 @@ sysfs_remove_group(struct kobject *kobj, const struct } static inline int -sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) +sysfs_create_groups(struct kobject *kobj, const struct attribute_group **grps) { + int error = 0; + int i; + + for (i = 0; grps[i] && !error; i++) + error = sysfs_create_group(kobj, grps[i]); + while (error && --i >= 0) + sysfs_remove_group(kobj, grps[i]); + + return (error); +} + +static inline int +sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp) +{ + + /* Really expected behavior is to return failure if group exists. */ + return (sysfs_create_group(kobj, grp)); +} + +static inline void +sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp) +{ struct attribute **attr; struct sysctl_oid *oidp; - oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->oidp), - OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, grp->name); - for (attr = grp->attrs; *attr != NULL; attr++) { - SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO, - (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, - kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", ""); + SLIST_FOREACH(oidp, SYSCTL_CHILDREN(kobj->oidp), oid_link) { + if (strcmp(oidp->oid_name, grp->name) != 0) + continue; + for (attr = grp->attrs; *attr != NULL; attr++) { + sysctl_remove_name(oidp, (*attr)->name, 1, 1); + } } - - return (0); } static inline int @@ -222,6 +263,22 @@ sysfs_remove_dir(struct kobject *kobj) if (kobj->oidp == NULL) return; sysctl_remove_oid(kobj->oidp, 1, 1); +} + +static inline bool +sysfs_streq(const char *s1, const char *s2) +{ + int l1, l2; + + l1 = strlen(s1); + l2 = strlen(s2); + + if (l1 != 0 && s1[l1-1] == '\n') + l1--; + if (l2 != 0 && s2[l2-1] == '\n') + l2--; + + return (l1 == l2 && strncmp(s1, s2, l1) == 0); } #define sysfs_attr_init(attr) do {} while(0) Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Nov 11 15:23:58 2019 (r354614) +++ stable/11/sys/sys/param.h Mon Nov 11 15:26:05 2019 (r354615) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1103502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1103503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Mon Nov 11 15:28:29 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26D351B7D3E; Mon, 11 Nov 2019 15:28:29 +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 47BZXD75bkz4J1N; Mon, 11 Nov 2019 15:28:28 +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 D6ED31955B; Mon, 11 Nov 2019 15:28:28 +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 xABFSS5N022519; Mon, 11 Nov 2019 15:28:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABFSSmL022516; Mon, 11 Nov 2019 15:28:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911111528.xABFSSmL022516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 11 Nov 2019 15:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354616 - in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 354616 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 15:28:29 -0000 Author: hselasky Date: Mon Nov 11 15:28:27 2019 New Revision: 354616 URL: https://svnweb.freebsd.org/changeset/base/354616 Log: MFC r354335: Enable device class group attributes in the LinuxKPI. Bump the __FreeBSD_version to force recompilation of external kernel modules due to structure change. Differential Revision: https://reviews.freebsd.org/D21564 Submitted by: Greg V Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Nov 11 15:26:05 2019 (r354615) +++ stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Nov 11 15:28:27 2019 (r354616) @@ -54,6 +54,7 @@ struct class { struct kobject kobj; devclass_t bsdclass; const struct dev_pm_ops *pm; + const struct attribute_group **dev_groups; void (*class_release)(struct class *class); void (*dev_release)(struct device *dev); char * (*devnode)(struct device *dev, umode_t *mode); @@ -423,6 +424,8 @@ done: kobject_init(&dev->kobj, &linux_dev_ktype); kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); + sysfs_create_groups(&dev->kobj, dev->class->dev_groups); + return (0); } @@ -430,6 +433,8 @@ static inline void device_unregister(struct device *dev) { device_t bsddev; + + sysfs_remove_groups(&dev->kobj, dev->class->dev_groups); bsddev = dev->bsddev; dev->bsddev = NULL; Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 11 15:26:05 2019 (r354615) +++ stable/11/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 11 15:28:27 2019 (r354616) @@ -62,12 +62,13 @@ struct attribute_group { #define ATTRIBUTE_GROUPS(_name) \ static struct attribute_group _name##_group = { \ + .name = __stringify(_name), \ .attrs = _name##_attrs, \ }; \ - static struct attribute_group *_name##_groups[] = { \ + static const struct attribute_group *_name##_groups[] = { \ &_name##_group, \ NULL, \ - }; + } /* * Handle our generic '\0' terminated 'C' string. @@ -210,12 +211,25 @@ sysfs_create_groups(struct kobject *kobj, const struct int error = 0; int i; + if (grps == NULL) + goto done; for (i = 0; grps[i] && !error; i++) error = sysfs_create_group(kobj, grps[i]); while (error && --i >= 0) sysfs_remove_group(kobj, grps[i]); - +done: return (error); +} + +static inline void +sysfs_remove_groups(struct kobject *kobj, const struct attribute_group **grps) +{ + int i; + + if (grps == NULL) + return; + for (i = 0; grps[i]; i++) + sysfs_remove_group(kobj, grps[i]); } static inline int Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Nov 11 15:26:05 2019 (r354615) +++ stable/11/sys/sys/param.h Mon Nov 11 15:28:27 2019 (r354616) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1103503 /* Master, propagated to newvers */ +#define __FreeBSD_version 1103504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Mon Nov 11 17:45:07 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43F091BA89C; Mon, 11 Nov 2019 17:45:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47BdYv14ZLz4Rlt; Mon, 11 Nov 2019 17:45:07 +0000 (UTC) (envelope-from dim@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 03F991AEDB; Mon, 11 Nov 2019 17:45:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xABHj6mB005328; Mon, 11 Nov 2019 17:45:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABHj6cR005327; Mon, 11 Nov 2019 17:45:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911111745.xABHj6cR005327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 11 Nov 2019 17:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354626 - in stable: 11/contrib/libc++/include 12/contrib/libc++/include X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libc++/include 12/contrib/libc++/include X-SVN-Commit-Revision: 354626 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:45:07 -0000 Author: dim Date: Mon Nov 11 17:45:06 2019 New Revision: 354626 URL: https://svnweb.freebsd.org/changeset/base/354626 Log: MFC r354625: Merge commit 371ea70bb from llvm git (by Louis Dionne): [libc++] Harden usage of static_assert against C++03 In C++03, we emulate static_assert with a macro, and we must parenthesize multiple arguments. llvm-svn: 373328 This is a follow-up to r354460, which causes errors for pre-C++11 programs using , similar to: /usr/include/c++/v1/cmath:622:68: error: too many arguments provided to function-like macro invocation Reported by: antoine Modified: stable/11/contrib/libc++/include/cmath Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libc++/include/cmath Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/libc++/include/cmath ============================================================================== --- stable/11/contrib/libc++/include/cmath Mon Nov 11 17:41:56 2019 (r354625) +++ stable/11/contrib/libc++/include/cmath Mon Nov 11 17:45:06 2019 (r354626) @@ -619,8 +619,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_fl static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); static_assert(is_integral<_IntT>::value, "must be an integral type"); static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); - static_assert(is_same<_FloatT, float>::value || is_same<_FloatT, double>::value - || is_same<_FloatT,long double>::value, "unsupported floating point type"); + static_assert((is_same<_FloatT, float>::value || is_same<_FloatT, double>::value + || is_same<_FloatT,long double>::value), "unsupported floating point type"); return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); } From owner-svn-src-stable-11@freebsd.org Mon Nov 11 17:48:22 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 755701BA9DB; Mon, 11 Nov 2019 17:48:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Bddf2Rqvz4S7Y; Mon, 11 Nov 2019 17:48:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 1F24A892; Mon, 11 Nov 2019 17:48:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::4967:b668:de9c:4138] (unknown [IPv6:2001:470:7a58:0:4967:b668:de9c:4138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 7FD1E2C217; Mon, 11 Nov 2019 18:48:20 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_97F0F766-BFC7-4F1A-89B6-1DE2A586CECE"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r354598 - in stable: 11/contrib/libc++/include 11/sys/sys 12/contrib/libc++/include 12/sys/sys Date: Mon, 11 Nov 2019 18:48:13 +0100 In-Reply-To: Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org To: Antoine Brodin References: <201911101841.xAAIfEXV088995@repo.freebsd.org> <4FEA5BCC-A9E7-4FDB-8392-04027239D9B0@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 17:48:22 -0000 --Apple-Mail=_97F0F766-BFC7-4F1A-89B6-1DE2A586CECE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 11 Nov 2019, at 11:30, Antoine Brodin wrote: >=20 > On Mon, Nov 11, 2019 at 11:10 AM Dimitry Andric = wrote: >>=20 >> On 11 Nov 2019, at 10:29, Antoine Brodin wrote: >>>=20 >>> On Mon, Nov 11, 2019 at 9:03 AM Antoine Brodin = wrote: >>>>=20 >>>> On Sun, Nov 10, 2019 at 7:41 PM Dimitry Andric = wrote: >>>>>=20 >>>>> Author: dim >>>>> Date: Sun Nov 10 18:41:13 2019 >>>>> New Revision: 354598 >>>>> URL: https://svnweb.freebsd.org/changeset/base/354598 ... >> Are there any build logs available showing errors? >=20 > For instance these logs: > = http://gohan01.nyi.freebsd.org/data/12stable-i386-quarterly-baseline/51722= 8/logs/errors/x265-3.1.2_2.log > = http://gohan01.nyi.freebsd.org/data/12stable-i386-quarterly-baseline/51722= 8/logs/errors/exiv2-0.27.1_2,1.log >=20 > /usr/include/c++/v1/cmath:622:68: error: too many arguments provided > to function-like macro invocation > static_assert(is_same<_FloatT, float>::value || is_same<_FloatT, > double>::value > ^ > /usr/include/c++/v1/__config:873:13: note: macro 'static_assert' = defined here > # define static_assert(__b, __m) _Static_assert(__b, __m) > ^ This should now be fixed by r354626, which is an insta-MFC of r354625. -Dimitry --Apple-Mail=_97F0F766-BFC7-4F1A-89B6-1DE2A586CECE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXcme3QAKCRCwXqMKLiCW o6J9AJ94jucqH7Hjex1WpA4VSdtHz97jQACg5gOJ9dBtgjdgQRC8NcO6Z67fU54= =aWA/ -----END PGP SIGNATURE----- --Apple-Mail=_97F0F766-BFC7-4F1A-89B6-1DE2A586CECE-- From owner-svn-src-stable-11@freebsd.org Mon Nov 11 19:54:10 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 338611BD113; Mon, 11 Nov 2019 19:54:10 +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 47BhQp15r4z4b7G; Mon, 11 Nov 2019 19:54:10 +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 09D381C6CF; Mon, 11 Nov 2019 19:54:10 +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 xABJsAUJ083342; Mon, 11 Nov 2019 19:54:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xABJs87W083335; Mon, 11 Nov 2019 19:54:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911111954.xABJs87W083335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 11 Nov 2019 19:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354628 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Commit-Revision: 354628 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2019 19:54:10 -0000 Author: kevans Date: Mon Nov 11 19:54:08 2019 New Revision: 354628 URL: https://svnweb.freebsd.org/changeset/base/354628 Log: MFC bsdgrep(1) fixes: r320414, r328559, r332805-r332806, r332809, r332832, r332850-r332852, r332856, r332858, r332876, r333351, r334803, r334806-r334809, r334821, r334837, r334889, r335188, r351769, r352691 r320414: Expect :mmap_eof_not_eol to fail It relies on a jemalloc feature (opt.redzone) no longer available after r319971. r328559: Remove t_grep:mmap_eof_not_eol test The test was marked as an expected failure in r320414 after r319971's import of a newer jemalloc removed an essential feature (opt.redzone) for reproducing the behavior it was testing. Since then, no way has been found or demonstrated to reliably test the behavior, so remove the test. r332805: bsdgrep: Split match processing out of procfile procfile is getting kind of hairy, and it's not going to get better as we correct some more bits that assume we process one line at a time. r332806: bsdgrep: Clean up procmatches a little bit r332809: bsdgrep: Add some TODOs for future work on operating on chunks r332832: bsdgrep: Break procmatches down a little bit more Split the matching and non-matching cases out into their own functions to reduce future complexity. As the name implies, procmatches will eventually process more than one match itself in the future. r332850: bsdgrep: Some light cleanup There's no point checking for a bunch of file modes if we're not a practicing believer of DIR_SKIP or DEV_SKIP. This also reduces some style violations that were particularly ugly looking when browsing through. r332851: bsdgrep: More trivial cleanup/style cleanup We can avoid branching for these easily reduced patterns r332852: bsdgrep: if chain => switch This makes some of this a little easier to follow (in my opinion). r332856: bsdgrep: Fix --include/--exclude ordering issues Prior to r332851: * --exclude always win out over --include * --exclude-dir always wins out over --include-dir r332851 broke that behavior, resulting in: * First of --exclude, --include wins * First of --exclude-dir, --include-dir wins As it turns out, both behaviors are wrong by modern grep standards- the latest rule wins. e.g.: `grep --exclude foo --include foo 'thing' foo` foo is included `grep --include foo --exclude foo 'thing' foo` foo is excluded As tested with GNU grep 3.1. This commit makes bsdgrep follow this behavior. r332858: bsdgrep: Use grep_strdup instead of grep_malloc+strcpy r332876: bsdgrep: Fix build failure WITHOUT_LZMA (incorrect bracket placement) r333351: bsdgrep: Allow "-" to be passed to -f to mean "standard input" A version of this patch was originally sent to me by se@, matching behavior from newer versions of GNU grep. While there have been some differences of opinion on whether stdin should be closed or not after depleting it in process of -f, I've opted to leave stdin open and just let the later matching stuff fail and result in a no-match. I'm not married to the current behavior- it was generally chosen since we are adopting this in particular from GNU grep, and I would like to stay consistent without a strong argument to the contrary. The current behavior isn't technically wrong, it's just fairly unfriendly to the developer-user of grep that may not realize their usage is trivially invalid. r334803: netbsd-tests: grep(1): Add test for -c flag Someone might be inclined to accidentally break this. someone might have written said test because they broke it locally. r334806: bsdgrep(1): Do some less dirty things with return types Neither procfile nor grep_tree return anything meaningful to their callers. None of the callers actually care about how many lines were matched in all of the files they processed; it's all about "did anything match?" This is generally just a light refactoring to remind me of what actually matters as I'm rewriting these bits to care less about 'stuff'. r334807: bsdgrep(1): whoops, garbage collect the now write-only variable r334808: bsdgrep(1): Don't initialize fts_flags twice Admittedly, this is a clang-scan complaint... but it wasn't wrong. fts_flags is initialized by all cases in the switch(), which should be fairly obvious. Annotate this anyways. r334809: netbsd-tests: bsdgrep(1): Add a test for -m, too r334821: bsdgrep(1): Slooowly peel away the chunky onion (or peel off the band-aid, whatever floats your boat) This addresses two separate issues: 1.) Nothing within bsdgrep actually knew whether it cared about line numbers or not. 2.) The file layer knew nothing about the context in which it was being called. #1 is only important when we're *not* processing line-by-line. #2 is debatably a good idea; the parsing context is only handy because that's where we store current offset information and, as of this commit, whether or not it needs to be line-aware. r334837: bsdgrep(1): Evict character sequence that moved in r334889: bsdgrep(1): Some more int -> bool conversions and name changes Again motivated by upcoming work to rewrite a bunch of this- single-letter variable names and slightly misleading variable names ("lastmatches" to indicate that the last matched) are not helpful. r335188: bsdgrep(1): Remove redundant initialization; unconditionally assigned later r351769: bsdgrep(1): add some basic tests for some GNU Extension support These will be expanded later as I come up with good test cases; for now, these seem to be enough to trigger bugs in base gnugrep and expose missing features in bsdgrep. r352691: bsdgrep(1): various fixes of empty pattern/exit code/-c behavior When an empty pattern is encountered in the pattern list, I had previously broken bsdgrep to count that as a "match all" and ignore any other patterns in the list. This commit rectifies that mistake, among others: - The -v flag semantics were not quite right; lines matched should have been counted differently based on whether the -v flag was set or not. procline now definitively returns whether it's matched or not, and interpreting that result has been kicked up a level. - Empty patterns with the -x flag was broken similarly to empty patterns with the -w flag. The former is a whole-line match and should be more strict, only matching blank lines. No -x and no -w will will match the empty string at the beginning of each line. - The exit code with -L was broken, w.r.t. modern grep. Modern grap will exit(0) if any file that didn't match was output, so our interpretation was simply backwards. The new interpretation makes sense to me. Tests updated and added to try and catch some of this. This misbehavior was found by autoconf while fixing ports found in PR 229925 expecting either a more sane or a more GNU-like sed. Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/file.c stable/11/usr.bin/grep/grep.1 stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/tests/grep_freebsd_test.sh stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Mon Nov 11 19:54:08 2019 (r354628) @@ -413,6 +413,60 @@ wflag_emptypat_body() atf_check -o file:test4 grep -w -e "" test4 } +atf_test_case xflag_emptypat +xflag_emptypat_body() +{ + printf "" > test1 + printf "\n" > test2 + printf "qaz" > test3 + printf " qaz\n" > test4 + + # -x is whole-line, more strict than -w. + atf_check -s exit:1 -o empty grep -x -e "" test1 + + atf_check -o file:test2 grep -x -e "" test2 + + atf_check -s exit:1 -o empty grep -x -e "" test3 + + atf_check -s exit:1 -o empty grep -x -e "" test4 + + total=$(wc -l /COPYRIGHT | sed 's/[^0-9]//g') + + # Simple checks that grep -x with an empty pattern isn't matching every + # line. The exact counts aren't important, as long as they don't + # match the total line count and as long as they don't match each other. + atf_check -o save:xpositive.count grep -Fxc '' /COPYRIGHT + atf_check -o save:xnegative.count grep -Fvxc '' /COPYRIGHT + + atf_check -o not-inline:"${total}" cat xpositive.count + atf_check -o not-inline:"${total}" cat xnegative.count + + atf_check -o not-file:xnegative.count cat xpositive.count +} + +atf_test_case xflag_emptypat_plus +xflag_emptypat_plus_body() +{ + printf "foo\n\nbar\n\nbaz\n" > target + printf "foo\n \nbar\n \nbaz\n" > target_spacelines + printf "foo\nbar\nbaz\n" > matches + printf " \n \n" > spacelines + + printf "foo\n\nbar\n\nbaz\n" > patlist1 + printf "foo\n\nba\n\nbaz\n" > patlist2 + + sed -e '/bar/d' target > matches_not2 + + # Normal handling first + atf_check -o file:target grep -Fxf patlist1 target + atf_check -o file:matches grep -Fxf patlist1 target_spacelines + atf_check -o file:matches_not2 grep -Fxf patlist2 target + + # -v handling + atf_check -s exit:1 -o empty grep -Fvxf patlist1 target + atf_check -o file:spacelines grep -Fxvf patlist1 target_spacelines +} + atf_test_case excessive_matches excessive_matches_head() { @@ -551,6 +605,12 @@ grep_nomatch_flags_head() grep_nomatch_flags_body() { + grep_type + + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test does not pass with GNU grep in base" + fi + printf "A\nB\nC\n" > test1 atf_check -o inline:"1\n" grep -c -C 1 -e "B" test1 @@ -563,7 +623,7 @@ grep_nomatch_flags_body() atf_check -o inline:"test1\n" grep -l -A 1 -e "B" test1 atf_check -o inline:"test1\n" grep -l -C 1 -e "B" test1 - atf_check -s exit:1 -o inline:"test1\n" grep -L -e "D" test1 + atf_check -o inline:"test1\n" grep -L -e "D" test1 atf_check -o empty grep -q -e "B" test1 atf_check -o empty grep -q -B 1 -e "B" test1 @@ -646,28 +706,6 @@ mmap_body() atf_check -s exit:1 grep --mmap -e "Z" test1 } -atf_test_case mmap_eof_not_eol -mmap_eof_not_eol_head() -{ - atf_set "descr" "Check --mmap flag handling of encountering EOF without EOL (PR 165471, 219402)" -} -mmap_eof_not_eol_body() -{ - grep_type - if [ $? -eq $GREP_TYPE_GNU ]; then - atf_expect_fail "gnu grep from ports has no --mmap option" - fi - - printf "ABC" > test1 - jot -b " " -s "" 4096 >> test2 - - atf_check -s exit:0 -o inline:"B\n" grep --mmap -oe "B" test1 - # Dependency on jemalloc(3) to detect buffer overflow, otherwise this - # unreliably produces a SIGSEGV or SIGBUS - atf_check -s exit:0 -o not-empty \ - env MALLOC_CONF="redzone:true" grep --mmap -e " " test2 -} - atf_test_case matchall matchall_head() { @@ -738,6 +776,38 @@ fgrep_oflag_body() atf_check -s exit:1 grep -Fo "ghix" test1 atf_check -s exit:1 grep -Fo "abcdefghiklmnopqrstuvwxyz" test1 } + +atf_test_case cflag +cflag_head() +{ + atf_set "descr" "Check proper handling of -c" +} +cflag_body() +{ + printf "a\nb\nc\n" > test1 + + atf_check -o inline:"1\n" grep -Ec "a" test1 + atf_check -o inline:"2\n" grep -Ec "a|b" test1 + atf_check -o inline:"3\n" grep -Ec "a|b|c" test1 + + atf_check -o inline:"test1:2\n" grep -EHc "a|b" test1 +} + +atf_test_case mflag +mflag_head() +{ + atf_set "descr" "Check proper handling of -m" +} +mflag_body() +{ + printf "a\nb\nc\nd\ne\nf\n" > test1 + + atf_check -o inline:"1\n" grep -m 1 -Ec "a" test1 + atf_check -o inline:"2\n" grep -m 2 -Ec "a|b" test1 + atf_check -o inline:"3\n" grep -m 3 -Ec "a|b|c|f" test1 + + atf_check -o inline:"test1:2\n" grep -m 2 -EHc "a|b|e|f" test1 +} # End FreeBSD atf_init_test_cases() @@ -767,6 +837,8 @@ atf_init_test_cases() atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen atf_add_test_case wflag_emptypat + atf_add_test_case xflag_emptypat + atf_add_test_case xflag_emptypat_plus atf_add_test_case excessive_matches atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity @@ -777,10 +849,11 @@ atf_init_test_cases() atf_add_test_case binary_flags atf_add_test_case badcontext atf_add_test_case mmap - atf_add_test_case mmap_eof_not_eol atf_add_test_case matchall atf_add_test_case fgrep_multipattern atf_add_test_case fgrep_icase atf_add_test_case fgrep_oflag + atf_add_test_case cflag + atf_add_test_case mflag # End FreeBSD } Modified: stable/11/usr.bin/grep/file.c ============================================================================== --- stable/11/usr.bin/grep/file.c Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/usr.bin/grep/file.c Mon Nov 11 19:54:08 2019 (r354628) @@ -86,6 +86,9 @@ static inline int grep_refill(struct file *f) { ssize_t nr; +#ifndef WITHOUT_LZMA + lzma_ret lzmaret; +#endif if (filebehave == FILE_MMAP) return (0); @@ -93,41 +96,52 @@ grep_refill(struct file *f) bufpos = buffer; bufrem = 0; - if (filebehave == FILE_GZIP) { + switch (filebehave) { + case FILE_GZIP: nr = gzread(gzbufdesc, buffer, MAXBUFSIZ); + break; #ifndef WITHOUT_BZIP2 - } else if (filebehave == FILE_BZIP && bzbufdesc != NULL) { - int bzerr; + case FILE_BZIP: + if (bzbufdesc != NULL) { + int bzerr; - nr = BZ2_bzRead(&bzerr, bzbufdesc, buffer, MAXBUFSIZ); - switch (bzerr) { - case BZ_OK: - case BZ_STREAM_END: - /* No problem, nr will be okay */ - break; - case BZ_DATA_ERROR_MAGIC: + nr = BZ2_bzRead(&bzerr, bzbufdesc, buffer, MAXBUFSIZ); + switch (bzerr) { + case BZ_OK: + case BZ_STREAM_END: + /* No problem, nr will be okay */ + break; + case BZ_DATA_ERROR_MAGIC: + /* + * As opposed to gzread(), which simply returns the + * plain file data, if it is not in the correct + * compressed format, BZ2_bzRead() instead aborts. + * + * So, just restart at the beginning of the file again, + * and use plain reads from now on. + */ + BZ2_bzReadClose(&bzerr, bzbufdesc); + bzbufdesc = NULL; + if (lseek(f->fd, 0, SEEK_SET) == -1) + return (-1); + nr = read(f->fd, buffer, MAXBUFSIZ); + break; + default: + /* Make sure we exit with an error */ + nr = -1; + } + } else /* - * As opposed to gzread(), which simply returns the - * plain file data, if it is not in the correct - * compressed format, BZ2_bzRead() instead aborts. - * - * So, just restart at the beginning of the file again, - * and use plain reads from now on. + * Also an error case; we should never have a scenario + * where we have an open file but no bzip descriptor + * at this point. See: grep_open */ - BZ2_bzReadClose(&bzerr, bzbufdesc); - bzbufdesc = NULL; - if (lseek(f->fd, 0, SEEK_SET) == -1) - return (-1); - nr = read(f->fd, buffer, MAXBUFSIZ); - break; - default: - /* Make sure we exit with an error */ nr = -1; - } + break; #endif #ifndef WITHOUT_LZMA - } else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) { - lzma_ret ret; + case FILE_XZ: + case FILE_LZMA: lstrm.next_out = buffer; do { @@ -143,23 +157,23 @@ grep_refill(struct file *f) lstrm.avail_in = nr; } - ret = lzma_code(&lstrm, laction); + lzmaret = lzma_code(&lstrm, laction); - if (ret != LZMA_OK && ret != LZMA_STREAM_END) + if (lzmaret != LZMA_OK && lzmaret != LZMA_STREAM_END) return (-1); - if (lstrm.avail_out == 0 || ret == LZMA_STREAM_END) { + if (lstrm.avail_out == 0 || lzmaret == LZMA_STREAM_END) { bufrem = MAXBUFSIZ - lstrm.avail_out; lstrm.next_out = buffer; lstrm.avail_out = MAXBUFSIZ; } - } while (bufrem == 0 && ret != LZMA_STREAM_END); + } while (bufrem == 0 && lzmaret != LZMA_STREAM_END); return (0); -#endif /* WIHTOUT_LZMA */ - } else +#endif /* WITHOUT_LZMA */ + default: nr = read(f->fd, buffer, MAXBUFSIZ); - + } if (nr < 0) return (-1); @@ -180,7 +194,7 @@ grep_lnbufgrow(size_t newlen) } char * -grep_fgetln(struct file *f, size_t *lenp) +grep_fgetln(struct file *f, struct parsec *pc) { unsigned char *p; char *ret; @@ -194,7 +208,7 @@ grep_fgetln(struct file *f, size_t *lenp) if (bufrem == 0) { /* Return zero length to indicate EOF */ - *lenp = 0; + pc->ln.len= 0; return (bufpos); } @@ -205,7 +219,7 @@ grep_fgetln(struct file *f, size_t *lenp) len = p - bufpos; bufrem -= len; bufpos = p; - *lenp = len; + pc->ln.len = len; return (ret); } @@ -240,11 +254,11 @@ grep_fgetln(struct file *f, size_t *lenp) bufpos = p; break; } - *lenp = len; + pc->ln.len = len; return (lnbuf); error: - *lenp = 0; + pc->ln.len = 0; return (NULL); } @@ -255,6 +269,9 @@ struct file * grep_open(const char *path) { struct file *f; +#ifndef WITHOUT_LZMA + lzma_ret lzmaret; +#endif f = grep_malloc(sizeof *f); memset(f, 0, sizeof *f); @@ -292,32 +309,36 @@ grep_open(const char *path) if ((buffer == NULL) || (buffer == MAP_FAILED)) buffer = grep_malloc(MAXBUFSIZ); - if (filebehave == FILE_GZIP && - (gzbufdesc = gzdopen(f->fd, "r")) == NULL) - goto error2; - + switch (filebehave) { + case FILE_GZIP: + if ((gzbufdesc = gzdopen(f->fd, "r")) == NULL) + goto error2; + break; #ifndef WITHOUT_BZIP2 - if (filebehave == FILE_BZIP && - (bzbufdesc = BZ2_bzdopen(f->fd, "r")) == NULL) - goto error2; + case FILE_BZIP: + if ((bzbufdesc = BZ2_bzdopen(f->fd, "r")) == NULL) + goto error2; + break; #endif #ifndef WITHOUT_LZMA - else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) { - lzma_ret ret; + case FILE_XZ: + case FILE_LZMA: - ret = (filebehave == FILE_XZ) ? - lzma_stream_decoder(&lstrm, UINT64_MAX, - LZMA_CONCATENATED) : - lzma_alone_decoder(&lstrm, UINT64_MAX); + if (filebehave == FILE_XZ) + lzmaret = lzma_stream_decoder(&lstrm, UINT64_MAX, + LZMA_CONCATENATED); + else + lzmaret = lzma_alone_decoder(&lstrm, UINT64_MAX); - if (ret != LZMA_OK) + if (lzmaret != LZMA_OK) goto error2; lstrm.avail_in = 0; lstrm.avail_out = MAXBUFSIZ; laction = LZMA_RUN; - } + break; #endif + } /* Fill read buffer, also catches errors early */ if (bufrem == 0 && grep_refill(f) != 0) @@ -326,7 +347,7 @@ grep_open(const char *path) /* Check for binary stuff, if necessary */ if (binbehave != BINFILE_TEXT && fileeol != '\0' && memchr(bufpos, '\0', bufrem) != NULL) - f->binary = true; + f->binary = true; return (f); Modified: stable/11/usr.bin/grep/grep.1 ============================================================================== --- stable/11/usr.bin/grep/grep.1 Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/usr.bin/grep/grep.1 Mon Nov 11 19:54:08 2019 (r354628) @@ -30,7 +30,7 @@ .\" .\" @(#)grep.1 8.3 (Berkeley) 4/18/94 .\" -.Dd April 17, 2017 +.Dd May 7, 2018 .Dt GREP 1 .Os .Sh NAME @@ -410,6 +410,13 @@ and block buffered otherwise. .El .Pp If no file arguments are specified, the standard input is used. +Additionally, +.Dq - +may be used in place of a file name, anywhere that a file name is accepted, to +read from standard input. +This includes both +.Fl f +and file arguments. .Sh EXIT STATUS The .Nm grep Modified: stable/11/usr.bin/grep/grep.c ============================================================================== --- stable/11/usr.bin/grep/grep.c Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/usr.bin/grep/grep.c Mon Nov 11 19:54:08 2019 (r354628) @@ -239,20 +239,9 @@ static void add_pattern(char *pat, size_t len) { - /* Do not add further pattern is we already match everything */ - if (matchall) - return; - /* Check if we can do a shortcut */ if (len == 0) { matchall = true; - for (unsigned int i = 0; i < patterns; i++) { - free(pattern[i].pat); - } - pattern = grep_realloc(pattern, sizeof(struct pat)); - pattern[0].pat = NULL; - pattern[0].len = 0; - patterns = 1; return; } /* Increase size if necessary */ @@ -319,7 +308,9 @@ read_patterns(const char *fn) size_t len; ssize_t rlen; - if ((f = fopen(fn, "r")) == NULL) + if (strcmp(fn, "-") == 0) + f = stdin; + else if ((f = fopen(fn, "r")) == NULL) err(2, "%s", fn); if ((fstat(fileno(f), &st) == -1) || (S_ISDIR(st.st_mode))) { fclose(f); @@ -336,7 +327,8 @@ read_patterns(const char *fn) free(line); if (ferror(f)) err(2, "%s", fn); - fclose(f); + if (strcmp(fn, "-") != 0) + fclose(f); } static inline const char * @@ -357,6 +349,7 @@ main(int argc, char *argv[]) long long l; unsigned int aargc, eargc, i; int c, lastc, needpattern, newarg, prevoptind; + bool matched; setlocale(LC_ALL, ""); @@ -701,7 +694,7 @@ main(int argc, char *argv[]) aargv += optind; /* Empty pattern file matches nothing */ - if (!needpattern && (patterns == 0)) + if (!needpattern && (patterns == 0) && !matchall) exit(1); /* Fail if we don't have any pattern */ @@ -751,11 +744,10 @@ main(int argc, char *argv[]) #endif r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); - /* Don't process any patterns if we have a blank one */ #ifdef WITH_INTERNAL_NOSPEC - if (!matchall && grepbehave != GREP_FIXED) { + if (grepbehave != GREP_FIXED) { #else - if (!matchall) { + { #endif /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { @@ -787,12 +779,13 @@ main(int argc, char *argv[]) exit(!procfile("-")); if (dirbehave == DIR_RECURSE) - c = grep_tree(aargv); + matched = grep_tree(aargv); else - for (c = 0; aargc--; ++aargv) { + for (matched = false; aargc--; ++aargv) { if ((finclude || fexclude) && !file_matching(*aargv)) continue; - c+= procfile(*aargv); + if (procfile(*aargv)) + matched = true; } #ifndef WITHOUT_NLS @@ -801,5 +794,8 @@ main(int argc, char *argv[]) /* Find out the correct return value according to the results and the command line option. */ - exit(c ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1)); + if (Lflag) + matched = !matched; + + exit(matched ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1)); } Modified: stable/11/usr.bin/grep/grep.h ============================================================================== --- stable/11/usr.bin/grep/grep.h Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/usr.bin/grep/grep.h Mon Nov 11 19:54:08 2019 (r354628) @@ -114,6 +114,21 @@ struct epat { int mode; }; +/* + * Parsing context; used to hold things like matches made and + * other useful bits + */ +struct parsec { + regmatch_t matches[MAX_MATCHES]; /* Matches made */ + /* XXX TODO: This should be a chunk, not a line */ + struct str ln; /* Current line */ + size_t lnstart; /* Position in line */ + size_t matchidx; /* Latest match index */ + int printed; /* Metadata printed? */ + bool binary; /* Binary file? */ + bool cntlines; /* Count lines? */ +}; + /* Flags passed to regcomp() and regexec() */ extern int cflags, eflags; @@ -145,8 +160,8 @@ extern char re_error[RE_ERROR_BUF + 1]; /* Seems big /* util.c */ bool file_matching(const char *fname); -int procfile(const char *fn); -int grep_tree(char **argv); +bool procfile(const char *fn); +bool grep_tree(char **argv); void *grep_malloc(size_t size); void *grep_calloc(size_t nmemb, size_t size); void *grep_realloc(void *ptr, size_t size); @@ -161,4 +176,4 @@ void clearqueue(void); /* file.c */ void grep_close(struct file *f); struct file *grep_open(const char *path); -char *grep_fgetln(struct file *f, size_t *len); +char *grep_fgetln(struct file *f, struct parsec *pc); Modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh ============================================================================== --- stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Mon Nov 11 19:54:08 2019 (r354628) @@ -81,8 +81,34 @@ rgrep_body() atf_check -o file:d_grep_r_implied.out rgrep --exclude="*.out" -e "test" "$(atf_get_srcdir)" } +atf_test_case gnuext +gnuext_body() +{ + grep_type + _type=$? + if [ $_type -eq $GREP_TYPE_BSD ]; then + atf_expect_fail "this test requires GNU extensions in regex(3)" + elif [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "\\s and \\S are known to be buggy in base gnugrep" + fi + + atf_check -o save:grep_alnum.out grep -o '[[:alnum:]]' /COPYRIGHT + atf_check -o file:grep_alnum.out grep -o '\w' /COPYRIGHT + + atf_check -o save:grep_nalnum.out grep -o '[^[:alnum:]]' /COPYRIGHT + atf_check -o file:grep_nalnum.out grep -o '\W' /COPYRIGHT + + atf_check -o save:grep_space.out grep -o '[[:space:]]' /COPYRIGHT + atf_check -o file:grep_space.out grep -o '\s' /COPYRIGHT + + atf_check -o save:grep_nspace.out grep -o '[^[:space:]]' /COPYRIGHT + atf_check -o file:grep_nspace.out grep -o '\S' /COPYRIGHT + +} + atf_init_test_cases() { atf_add_test_case grep_r_implied atf_add_test_case rgrep + atf_add_test_case gnuext } Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Mon Nov 11 19:06:04 2019 (r354627) +++ stable/11/usr.bin/grep/util.c Mon Nov 11 19:54:08 2019 (r354628) @@ -60,23 +60,24 @@ __FBSDID("$FreeBSD$"); static bool first_match = true; /* - * Parsing context; used to hold things like matches made and - * other useful bits + * Match printing context */ -struct parsec { - regmatch_t matches[MAX_MATCHES]; /* Matches made */ - struct str ln; /* Current line */ - size_t lnstart; /* Position in line */ - size_t matchidx; /* Latest match index */ - int printed; /* Metadata printed? */ - bool binary; /* Binary file? */ +struct mprintc { + long long tail; /* Number of trailing lines to record */ + int last_outed; /* Number of lines since last output */ + bool doctx; /* Printing context? */ + bool printmatch; /* Printing matches? */ + bool same_file; /* Same file as previously printed? */ }; +static void procmatch_match(struct mprintc *mc, struct parsec *pc); +static void procmatch_nomatch(struct mprintc *mc, struct parsec *pc); +static bool procmatches(struct mprintc *mc, struct parsec *pc, bool matched); #ifdef WITH_INTERNAL_NOSPEC static int litexec(const struct pat *pat, const char *string, size_t nmatch, regmatch_t pmatch[]); #endif -static int procline(struct parsec *pc); +static bool procline(struct parsec *pc); static void printline(struct parsec *pc, int sep); static void printline_metadata(struct str *line, int sep); @@ -94,13 +95,12 @@ file_matching(const char *fname) for (unsigned int i = 0; i < fpatterns; ++i) { if (fnmatch(fpattern[i].pat, fname, 0) == 0 || - fnmatch(fpattern[i].pat, fname_base, 0) == 0) { - if (fpattern[i].mode == EXCL_PAT) { - ret = false; - break; - } else - ret = true; - } + fnmatch(fpattern[i].pat, fname_base, 0) == 0) + /* + * The last pattern matched wins exclusion/inclusion + * rights, so we can't reasonably bail out early here. + */ + ret = (fpattern[i].mode != EXCL_PAT); } free(fname_buf); return (ret); @@ -114,13 +114,12 @@ dir_matching(const char *dname) ret = dinclude ? false : true; for (unsigned int i = 0; i < dpatterns; ++i) { - if (dname != NULL && - fnmatch(dpattern[i].pat, dname, 0) == 0) { - if (dpattern[i].mode == EXCL_PAT) - return (false); - else - ret = true; - } + if (dname != NULL && fnmatch(dpattern[i].pat, dname, 0) == 0) + /* + * The last pattern matched wins exclusion/inclusion + * rights, so we can't reasonably bail out early here. + */ + ret = (dpattern[i].mode != EXCL_PAT); } return (ret); } @@ -129,17 +128,18 @@ dir_matching(const char *dname) * Processes a directory when a recursive search is performed with * the -R option. Each appropriate file is passed to procfile(). */ -int +bool grep_tree(char **argv) { FTS *fts; FTSENT *p; - int c, fts_flags; - bool ok; + int fts_flags; + bool matched, ok; const char *wd[] = { ".", NULL }; - c = fts_flags = 0; + matched = false; + /* This switch effectively initializes 'fts_flags' */ switch(linkbehave) { case LINK_EXPLICIT: fts_flags = FTS_COMFOLLOW; @@ -149,7 +149,6 @@ grep_tree(char **argv) break; default: fts_flags = FTS_LOGICAL; - } fts_flags |= FTS_NOSTAT | FTS_NOCHDIR; @@ -178,7 +177,7 @@ grep_tree(char **argv) case FTS_DC: /* Print a warning for recursive directory loop */ warnx("warning: %s: recursive directory loop", - p->fts_path); + p->fts_path); break; default: /* Check for file exclusion/inclusion */ @@ -186,44 +185,122 @@ grep_tree(char **argv) if (fexclude || finclude) ok &= file_matching(p->fts_path); - if (ok) - c += procfile(p->fts_path); + if (ok && procfile(p->fts_path)) + matched = true; break; } } fts_close(fts); - return (c); + return (matched); } +static void +procmatch_match(struct mprintc *mc, struct parsec *pc) +{ + + if (mc->doctx) { + if (!first_match && (!mc->same_file || mc->last_outed > 0)) + printf("--\n"); + if (Bflag > 0) + printqueue(); + mc->tail = Aflag; + } + + /* Print the matching line, but only if not quiet/binary */ + if (mc->printmatch) { + printline(pc, ':'); + while (pc->matchidx >= MAX_MATCHES) { + /* Reset matchidx and try again */ + pc->matchidx = 0; + if (procline(pc) == !vflag) + printline(pc, ':'); + else + break; + } + first_match = false; + mc->same_file = true; + mc->last_outed = 0; + } +} + +static void +procmatch_nomatch(struct mprintc *mc, struct parsec *pc) +{ + + /* Deal with any -A context as needed */ + if (mc->tail > 0) { + grep_printline(&pc->ln, '-'); + mc->tail--; + if (Bflag > 0) + clearqueue(); + } else if (Bflag == 0 || (Bflag > 0 && enqueue(&pc->ln))) + /* + * Enqueue non-matching lines for -B context. If we're not + * actually doing -B context or if the enqueue resulted in a + * line being rotated out, then go ahead and increment + * last_outed to signify a gap between context/match. + */ + ++mc->last_outed; +} + /* + * Process any matches in the current parsing context, return a boolean + * indicating whether we should halt any further processing or not. 'true' to + * continue processing, 'false' to halt. + */ +static bool +procmatches(struct mprintc *mc, struct parsec *pc, bool matched) +{ + + /* + * XXX TODO: This should loop over pc->matches and handle things on a + * line-by-line basis, setting up a `struct str` as needed. + */ + /* Deal with any -B context or context separators */ + if (matched) { + procmatch_match(mc, pc); + + /* Count the matches if we have a match limit */ + if (mflag) { + /* XXX TODO: Decrement by number of matched lines */ + mcount -= 1; + if (mcount <= 0) + return (false); + } + } else if (mc->doctx) + procmatch_nomatch(mc, pc); + + return (true); +} + +/* * Opens a file and processes it. Each file is processed line-by-line * passing the lines to procline(). */ -int +bool procfile(const char *fn) { struct parsec pc; - long long tail; + struct mprintc mc; struct file *f; struct stat sb; - struct str *ln; mode_t s; - int c, last_outed, t; - bool doctx, printmatch, same_file; + int lines; + bool line_matched; if (strcmp(fn, "-") == 0) { fn = label != NULL ? label : getstr(1); f = grep_open(NULL); } else { - if (!stat(fn, &sb)) { + if (stat(fn, &sb) == 0) { /* Check if we need to process the file */ s = sb.st_mode & S_IFMT; - if (s == S_IFDIR && dirbehave == DIR_SKIP) - return (0); - if ((s == S_IFIFO || s == S_IFCHR || s == S_IFBLK - || s == S_IFSOCK) && devbehave == DEV_SKIP) - return (0); + if (dirbehave == DIR_SKIP && s == S_IFDIR) + return (false); + if (devbehave == DEV_SKIP && (s == S_IFIFO || + s == S_IFCHR || s == S_IFBLK || s == S_IFSOCK)) + return (false); } f = grep_open(fn); } @@ -231,39 +308,41 @@ procfile(const char *fn) file_err = true; if (!sflag) warn("%s", fn); - return (0); + return (false); } - /* Convenience */ - ln = &pc.ln; - pc.ln.file = grep_malloc(strlen(fn) + 1); - strcpy(pc.ln.file, fn); + pc.ln.file = grep_strdup(fn); pc.ln.line_no = 0; pc.ln.len = 0; pc.ln.boff = 0; pc.ln.off = -1; pc.binary = f->binary; - pc.printed = 0; - tail = 0; - last_outed = 0; - same_file = false; - doctx = false; - printmatch = true; + pc.cntlines = false; + memset(&mc, 0, sizeof(mc)); + mc.printmatch = true; if ((pc.binary && binbehave == BINFILE_BIN) || cflag || qflag || lflag || Lflag) - printmatch = false; - if (printmatch && (Aflag != 0 || Bflag != 0)) - doctx = true; + mc.printmatch = false; + if (mc.printmatch && (Aflag != 0 || Bflag != 0)) + mc.doctx = true; + if (mc.printmatch && (Aflag != 0 || Bflag != 0 || mflag || nflag)) + pc.cntlines = true; mcount = mlimit; - for (c = 0; c == 0 || !(lflag || qflag); ) { + for (lines = 0; lines == 0 || !(lflag || qflag); ) { + /* + * XXX TODO: We need to revisit this in a chunking world. We're + * not going to be doing per-line statistics because of the + * overhead involved. procmatches can figure that stuff out as + * needed. */ /* Reset per-line statistics */ pc.printed = 0; pc.matchidx = 0; pc.lnstart = 0; pc.ln.boff = 0; pc.ln.off += pc.ln.len + 1; - if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || + /* XXX TODO: Grab a chunk */ + if ((pc.ln.dat = grep_fgetln(f, &pc)) == NULL || pc.ln.len == 0) break; @@ -279,59 +358,13 @@ procfile(const char *fn) return (0); } - if ((t = procline(&pc)) == 0) - ++c; + line_matched = procline(&pc) == !vflag; + if (line_matched) + ++lines; - /* Deal with any -B context or context separators */ - if (t == 0 && doctx) { - if (!first_match && (!same_file || last_outed > 0)) - printf("--\n"); - if (Bflag > 0) - printqueue(); - tail = Aflag; - } - /* Print the matching line, but only if not quiet/binary */ - if (t == 0 && printmatch) { - printline(&pc, ':'); - while (pc.matchidx >= MAX_MATCHES) { - /* Reset matchidx and try again */ - pc.matchidx = 0; - if (procline(&pc) == 0) - printline(&pc, ':'); - else - break; - } - first_match = false; - same_file = true; - last_outed = 0; - } - if (t != 0 && doctx) { - /* Deal with any -A context */ - if (tail > 0) { - grep_printline(&pc.ln, '-'); - tail--; - if (Bflag > 0) - clearqueue(); - } else { - /* - * Enqueue non-matching lines for -B context. - * If we're not actually doing -B context or if - * the enqueue resulted in a line being rotated - * out, then go ahead and increment last_outed - * to signify a gap between context/match. - */ - if (Bflag == 0 || (Bflag > 0 && enqueue(ln))) - ++last_outed; - } - } - - /* Count the matches if we have a match limit */ - if (t == 0 && mflag) { - --mcount; - if (mflag && mcount <= 0) - break; - } - + /* Halt processing if we hit our match limit */ + if (!procmatches(&mc, &pc, line_matched)) + break; } if (Bflag > 0) clearqueue(); @@ -340,19 +373,19 @@ procfile(const char *fn) if (cflag) { if (!hflag) printf("%s:", pc.ln.file); - printf("%u\n", c); + printf("%u\n", lines); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Nov 12 15:34:20 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0819F1B0EFC; Tue, 12 Nov 2019 15:34:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47CBcW6SnGz3CKb; Tue, 12 Nov 2019 15:34:19 +0000 (UTC) (envelope-from mav@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 C11D61CCB; Tue, 12 Nov 2019 15:34:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACFYJsE097764; Tue, 12 Nov 2019 15:34:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACFYJJ6097763; Tue, 12 Nov 2019 15:34:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911121534.xACFYJJ6097763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 12 Nov 2019 15:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354642 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354642 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 15:34:20 -0000 Author: mav Date: Tue Nov 12 15:34:19 2019 New Revision: 354642 URL: https://svnweb.freebsd.org/changeset/base/354642 Log: MFC r354360: Add vfs.zfs.zio.taskq_batch_pct tunable. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Nov 12 15:32:16 2019 (r354641) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Nov 12 15:34:19 2019 (r354642) @@ -241,6 +241,10 @@ uint64_t zfs_max_missing_tvds_cachefile = SPA_DVAS_PER uint64_t zfs_max_missing_tvds_scan = 0; +SYSCTL_DECL(_vfs_zfs_zio); +SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, taskq_batch_pct, CTLFLAG_RDTUN, + &zio_taskq_batch_pct, 0, + "Percentage of CPUs to run an IO worker thread"); SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_print_vdev_tree, CTLFLAG_RWTUN, &spa_load_print_vdev_tree, 0, "print out vdev tree during pool import"); From owner-svn-src-stable-11@freebsd.org Tue Nov 12 18:04:29 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D49BE1B4167; Tue, 12 Nov 2019 18:04:29 +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 47CFxn5Gn2z3MFg; Tue, 12 Nov 2019 18:04:29 +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 9855B39EB; Tue, 12 Nov 2019 18:04:29 +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 xACI4T6b086630; Tue, 12 Nov 2019 18:04:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACI4Sw0086627; Tue, 12 Nov 2019 18:04:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911121804.xACI4Sw0086627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Nov 2019 18:04:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354651 - in stable/11/sys: amd64/amd64 amd64/include dev/cpuctl x86/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/include dev/cpuctl x86/include X-SVN-Commit-Revision: 354651 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 18:04:29 -0000 Author: kib Date: Tue Nov 12 18:04:28 2019 New Revision: 354651 URL: https://svnweb.freebsd.org/changeset/base/354651 Log: MFC r354649: Workaround for Intel SKL002/SKL012S errata. Security: CVE-2018-12207 Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/amd64/include/pmap.h stable/11/sys/dev/cpuctl/cpuctl.c stable/11/sys/x86/include/specialreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Tue Nov 12 18:03:26 2019 (r354650) +++ stable/11/sys/amd64/amd64/pmap.c Tue Nov 12 18:04:28 2019 (r354651) @@ -1226,6 +1226,51 @@ pmap_page_init(vm_page_t m) m->md.pat_mode = PAT_WRITE_BACK; } +static int pmap_allow_2m_x_ept; +SYSCTL_INT(_vm_pmap, OID_AUTO, allow_2m_x_ept, CTLFLAG_RWTUN | CTLFLAG_NOFETCH, + &pmap_allow_2m_x_ept, 0, + "Allow executable superpage mappings in EPT"); + +void +pmap_allow_2m_x_ept_recalculate(void) +{ + /* + * SKL002, SKL012S. Since the EPT format is only used by + * Intel CPUs, the vendor check is merely a formality. + */ + if (!(cpu_vendor_id != CPU_VENDOR_INTEL || + (cpu_ia32_arch_caps & IA32_ARCH_CAP_IF_PSCHANGE_MC_NO) != 0 || + (CPUID_TO_FAMILY(cpu_id) == 0x6 && + (CPUID_TO_MODEL(cpu_id) == 0x26 || /* Atoms */ + CPUID_TO_MODEL(cpu_id) == 0x27 || + CPUID_TO_MODEL(cpu_id) == 0x35 || + CPUID_TO_MODEL(cpu_id) == 0x36 || + CPUID_TO_MODEL(cpu_id) == 0x37 || + CPUID_TO_MODEL(cpu_id) == 0x86 || + CPUID_TO_MODEL(cpu_id) == 0x1c || + CPUID_TO_MODEL(cpu_id) == 0x4a || + CPUID_TO_MODEL(cpu_id) == 0x4c || + CPUID_TO_MODEL(cpu_id) == 0x4d || + CPUID_TO_MODEL(cpu_id) == 0x5a || + CPUID_TO_MODEL(cpu_id) == 0x5c || + CPUID_TO_MODEL(cpu_id) == 0x5d || + CPUID_TO_MODEL(cpu_id) == 0x5f || + CPUID_TO_MODEL(cpu_id) == 0x6e || + CPUID_TO_MODEL(cpu_id) == 0x7a || + CPUID_TO_MODEL(cpu_id) == 0x57 || /* Knights */ + CPUID_TO_MODEL(cpu_id) == 0x85)))) + pmap_allow_2m_x_ept = 1; + TUNABLE_INT_FETCH("hw.allow_2m_x_ept", &pmap_allow_2m_x_ept); +} + +static bool +pmap_allow_2m_x_page(pmap_t pmap, bool executable) +{ + + return (pmap->pm_type != PT_EPT || !executable || + !pmap_allow_2m_x_ept); +} + /* * Initialize the pmap module. * Called by vm_init, to initialize any structures that the pmap @@ -1270,6 +1315,9 @@ pmap_init(void) } } + /* IFU */ + pmap_allow_2m_x_ept_recalculate(); + /* * Initialize the vm page array entries for the kernel pmap's * page table pages. @@ -4550,6 +4598,15 @@ retry: } #if VM_NRESERVLEVEL > 0 +static bool +pmap_pde_ept_executable(pmap_t pmap, pd_entry_t pde) +{ + + if (pmap->pm_type != PT_EPT) + return (false); + return ((pde & EPT_PG_EXECUTE) != 0); +} + /* * Tries to promote the 512, contiguous 4KB page mappings that are within a * single page table page (PTP) to a single 2MB page mapping. For promotion @@ -4584,7 +4641,9 @@ pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offs firstpte = (pt_entry_t *)PHYS_TO_DMAP(*pde & PG_FRAME); setpde: newpde = *firstpte; - if ((newpde & ((PG_FRAME & PDRMASK) | PG_A | PG_V)) != (PG_A | PG_V)) { + if ((newpde & ((PG_FRAME & PDRMASK) | PG_A | PG_V)) != (PG_A | PG_V) || + !pmap_allow_2m_x_page(pmap, pmap_pde_ept_executable(pmap, + newpde))) { atomic_add_long(&pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx" " in pmap %p", va, pmap); @@ -5010,6 +5069,12 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t PG_V = pmap_valid_bit(pmap); PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (!pmap_allow_2m_x_page(pmap, pmap_pde_ept_executable(pmap, + newpde))) { + CTR2(KTR_PMAP, "pmap_enter_pde: 2m x blocked for va %#lx" + " in pmap %p", va, pmap); + return (KERN_FAILURE); + } if ((pdpg = pmap_allocpde(pmap, va, (flags & PMAP_ENTER_NOSLEEP) != 0 ? NULL : lockp)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" @@ -5139,6 +5204,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_o va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && m->psind == 1 && pmap_ps_enabled(pmap) && + pmap_allow_2m_x_page(pmap, (prot & VM_PROT_EXECUTE) != 0) && pmap_enter_2mpage(pmap, va, m, prot, &lock)) m = &m[NBPDR / PAGE_SIZE - 1]; else Modified: stable/11/sys/amd64/include/pmap.h ============================================================================== --- stable/11/sys/amd64/include/pmap.h Tue Nov 12 18:03:26 2019 (r354650) +++ stable/11/sys/amd64/include/pmap.h Tue Nov 12 18:04:28 2019 (r354651) @@ -407,6 +407,7 @@ struct thread; void pmap_activate_boot(pmap_t pmap); void pmap_activate_sw(struct thread *); +void pmap_allow_2m_x_ept_recalculate(void); void pmap_bootstrap(vm_paddr_t *); int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Tue Nov 12 18:03:26 2019 (r354650) +++ stable/11/sys/dev/cpuctl/cpuctl.c Tue Nov 12 18:04:28 2019 (r354651) @@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -535,6 +539,9 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td hw_ibrs_recalculate(); restore_cpu(oldcpu, is_bound, td); hw_ssb_recalculate(true); +#ifdef __amd64__ + pmap_allow_2m_x_ept_recalculate(); +#endif hw_mds_recalculate(); printcpuinfo(); return (0); Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Tue Nov 12 18:03:26 2019 (r354650) +++ stable/11/sys/x86/include/specialreg.h Tue Nov 12 18:04:28 2019 (r354651) @@ -406,6 +406,7 @@ #define IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY 0x00000008 #define IA32_ARCH_CAP_SSB_NO 0x00000010 #define IA32_ARCH_CAP_MDS_NO 0x00000020 +#define IA32_ARCH_CAP_IF_PSCHANGE_MC_NO 0x00000040 /* * CPUID manufacturers identifiers From owner-svn-src-stable-11@freebsd.org Tue Nov 12 19:19:28 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A43B1B7C60; Tue, 12 Nov 2019 19:19:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47CHcJ18rPz40Nx; Tue, 12 Nov 2019 19:19:28 +0000 (UTC) (envelope-from gjb@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 0B28E4737; Tue, 12 Nov 2019 19:19:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACJJRdR028871; Tue, 12 Nov 2019 19:19:27 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACJJRld028869; Tue, 12 Nov 2019 19:19:27 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201911121919.xACJJRld028869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 12 Nov 2019 19:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354656 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 354656 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 19:19:28 -0000 Author: gjb Date: Tue Nov 12 19:19:27 2019 New Revision: 354656 URL: https://svnweb.freebsd.org/changeset/base/354656 Log: Document EN-19:18, EN-19:19, SA-19:25, SA-19:26. Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/errata.xml ============================================================================== --- stable/11/release/doc/share/xml/errata.xml Tue Nov 12 19:15:16 2019 (r354655) +++ stable/11/release/doc/share/xml/errata.xml Tue Nov 12 19:19:27 2019 (r354656) @@ -46,6 +46,14 @@ 20 August 2019 "jail" keyword fix + + + FreeBSD-EN-19:18.tzdata + 23 October 2019 + Timezone database information + update + Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Tue Nov 12 19:15:16 2019 (r354655) +++ stable/11/release/doc/share/xml/security.xml Tue Nov 12 19:19:27 2019 (r354656) @@ -110,6 +110,21 @@ 20 August 2019 Reference count overflow + + + FreeBSD-SA-19:25.mcepce + 12 November 2019 + Machine Check Exception on Page Size + Change + + + + FreeBSD-SA-19:26.mcu + 12 November 2019 + Intel CPU Microcode Update + From owner-svn-src-stable-11@freebsd.org Tue Nov 12 19:35:47 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD1D31B8C96; Tue, 12 Nov 2019 19:35:47 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47CHz7567Fz41lB; Tue, 12 Nov 2019 19:35:47 +0000 (UTC) (envelope-from scottl@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 7432A4ABF; Tue, 12 Nov 2019 19:35:47 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xACJZl7m040950; Tue, 12 Nov 2019 19:35:47 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xACJZkfE040948; Tue, 12 Nov 2019 19:35:46 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911121935.xACJZkfE040948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 12 Nov 2019 19:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354658 - in stable/11/sys/x86: include x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in stable/11/sys/x86: include x86 X-SVN-Commit-Revision: 354658 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2019 19:35:47 -0000 Author: scottl Date: Tue Nov 12 19:35:46 2019 New Revision: 354658 URL: https://svnweb.freebsd.org/changeset/base/354658 Log: MFC: Add new bit definitions for TSX, related to the TAA issue. The actual mitigation will follow in a future commit. Obtained from: Intel Modified: stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Tue Nov 12 19:29:32 2019 (r354657) +++ stable/11/sys/x86/include/specialreg.h Tue Nov 12 19:35:46 2019 (r354658) @@ -407,7 +407,13 @@ #define IA32_ARCH_CAP_SSB_NO 0x00000010 #define IA32_ARCH_CAP_MDS_NO 0x00000020 #define IA32_ARCH_CAP_IF_PSCHANGE_MC_NO 0x00000040 +#define IA32_ARCH_CAP_TSX_CTRL 0x00000080 +#define IA32_ARCH_CAP_TAA_NO 0x00000100 +/* MSR IA32_TSX_CTRL bits */ +#define IA32_TSX_CTRL_RTM_DISABLE 0x00000001 +#define IA32_TSX_CTRL_TSX_CPUID_CLEAR 0x00000002 + /* * CPUID manufacturers identifiers */ @@ -459,6 +465,7 @@ #define MSR_BBL_CR_TRIG 0x11a #define MSR_BBL_CR_BUSY 0x11b #define MSR_BBL_CR_CTL3 0x11e +#define MSR_IA32_TSX_CTRL 0x122 #define MSR_SYSENTER_CS_MSR 0x174 #define MSR_SYSENTER_ESP_MSR 0x175 #define MSR_SYSENTER_EIP_MSR 0x176 Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Tue Nov 12 19:29:32 2019 (r354657) +++ stable/11/sys/x86/x86/identcpu.c Tue Nov 12 19:35:46 2019 (r354658) @@ -1024,6 +1024,9 @@ printcpuinfo(void) "\003RSBA" "\004SKIP_L1DFL_VME" "\005SSB_NO" + "\006MDS_NO" + "\010TSX_CTRL" + "\011TAA_NO" ); } From owner-svn-src-stable-11@freebsd.org Thu Nov 14 12:14:56 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DB5417EA83; Thu, 14 Nov 2019 12:14:56 +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 47DL5X0B0nz43ST; Thu, 14 Nov 2019 12:14:55 +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 A403114E; Thu, 14 Nov 2019 12:14:55 +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 xAECEt0n000157; Thu, 14 Nov 2019 12:14:55 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAECEtqX000156; Thu, 14 Nov 2019 12:14:55 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201911141214.xAECEtqX000156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 14 Nov 2019 12:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354706 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 354706 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2019 12:14:56 -0000 Author: ae Date: Thu Nov 14 12:14:55 2019 New Revision: 354706 URL: https://svnweb.freebsd.org/changeset/base/354706 Log: MFC r354443: Enqueue lladdr_task to update link level address of vlan, when its parent interface has changed. During vlan reconfiguration without destroying interface, it is possible, that parent interface will be changed. This usually means, that link layer address of vlan will be different. Therefore we need to update all associated with vlan's addresses permanent llentries - NDP for IPv6 addresses, and ARP for IPv4 addresses. This is done via lladdr_task execution. To avoid extra work, before execution do the check, that L2 address is different. Modified: stable/11/sys/net/if_vlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_vlan.c ============================================================================== --- stable/11/sys/net/if_vlan.c Thu Nov 14 12:07:49 2019 (r354705) +++ stable/11/sys/net/if_vlan.c Thu Nov 14 12:14:55 2019 (r354706) @@ -1424,17 +1424,25 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 * Set up our interface address to reflect the underlying * physical interface's. */ - bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen); + TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv); ((struct sockaddr_dl *)ifp->if_addr->ifa_addr)->sdl_alen = p->if_addrlen; /* + * Do not schedule link address update if it was the same + * as previous parent's. This helps avoid updating for each + * associated llentry. + */ + if (memcmp(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen) != 0) { + bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen); + taskqueue_enqueue(taskqueue_thread, &ifv->lladdr_task); + } + + /* * Configure multicast addresses that may already be * joined on the vlan device. */ (void)vlan_setmulti(ifp); - - TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv); /* We are ready for operation now. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; From owner-svn-src-stable-11@freebsd.org Fri Nov 15 16:40:55 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE4431AA773; Fri, 15 Nov 2019 16:40:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47F3xz4q0Zz4F0r; Fri, 15 Nov 2019 16:40:55 +0000 (UTC) (envelope-from emaste@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 7F7CC1BAA2; Fri, 15 Nov 2019 16:40:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAFGetHc019141; Fri, 15 Nov 2019 16:40:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAFGetj3019140; Fri, 15 Nov 2019 16:40:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911151640.xAFGetj3019140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 15 Nov 2019 16:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354735 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 354735 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 16:40:55 -0000 Author: emaste Date: Fri Nov 15 16:40:55 2019 New Revision: 354735 URL: https://svnweb.freebsd.org/changeset/base/354735 Log: MFC r354228: avoid kernel stack data leak in core dump thrmisc note bzero the entire thrmisc struct, not just the padding. Other core dump notes are already done this way. Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Fri Nov 15 16:40:10 2019 (r354734) +++ stable/11/sys/kern/imgact_elf.c Fri Nov 15 16:40:55 2019 (r354735) @@ -2008,7 +2008,7 @@ __elfN(note_thrmisc)(void *arg, struct sbuf *sb, size_ td = (struct thread *)arg; if (sb != NULL) { KASSERT(*sizep == sizeof(thrmisc), ("invalid size")); - bzero(&thrmisc._pad, sizeof(thrmisc._pad)); + bzero(&thrmisc, sizeof(thrmisc)); strcpy(thrmisc.pr_tname, td->td_name); sbuf_bcat(sb, &thrmisc, sizeof(thrmisc)); } From owner-svn-src-stable-11@freebsd.org Sat Nov 16 00:33:03 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F2E11B4FE5; Sat, 16 Nov 2019 00:33:03 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47FGQl3Rwvz4KFh; Sat, 16 Nov 2019 00:33:03 +0000 (UTC) (envelope-from scottl@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 4C4D92129B; Sat, 16 Nov 2019 00:33:03 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAG0X30R002974; Sat, 16 Nov 2019 00:33:03 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG0X3ji002973; Sat, 16 Nov 2019 00:33:03 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911160033.xAG0X3ji002973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 16 Nov 2019 00:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354762 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 354762 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 00:33:03 -0000 Author: scottl Date: Sat Nov 16 00:33:02 2019 New Revision: 354762 URL: https://svnweb.freebsd.org/changeset/base/354762 Log: MFC r354756: Create a new sysctl tree, machdep.mitigations Sponsored by: Intel Modified: stable/11/sys/kern/kern_mib.c stable/11/sys/sys/sysctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mib.c ============================================================================== --- stable/11/sys/kern/kern_mib.c Sat Nov 16 00:31:57 2019 (r354761) +++ stable/11/sys/kern/kern_mib.c Sat Nov 16 00:33:02 2019 (r354762) @@ -76,6 +76,8 @@ SYSCTL_ROOT_NODE(CTL_HW, hw, CTLFLAG_RW, 0, "hardware"); SYSCTL_ROOT_NODE(CTL_MACHDEP, machdep, CTLFLAG_RW, 0, "machine dependent"); +SYSCTL_NODE(_machdep, OID_AUTO, mitigations, CTLFLAG_RW, 0, + "Machine dependent platform mitigations."); SYSCTL_ROOT_NODE(CTL_USER, user, CTLFLAG_RW, 0, "user-level"); SYSCTL_ROOT_NODE(CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, Modified: stable/11/sys/sys/sysctl.h ============================================================================== --- stable/11/sys/sys/sysctl.h Sat Nov 16 00:31:57 2019 (r354761) +++ stable/11/sys/sys/sysctl.h Sat Nov 16 00:33:02 2019 (r354762) @@ -1018,6 +1018,7 @@ SYSCTL_DECL(_hw_bus); SYSCTL_DECL(_hw_bus_devices); SYSCTL_DECL(_hw_bus_info); SYSCTL_DECL(_machdep); +SYSCTL_DECL(_machdep_mitigations); SYSCTL_DECL(_user); SYSCTL_DECL(_compat); SYSCTL_DECL(_regression); From owner-svn-src-stable-11@freebsd.org Sat Nov 16 00:52:06 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2ADB91B5546; Sat, 16 Nov 2019 00:52:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 47FGrj5qgjz3Mw8; Sat, 16 Nov 2019 00:52:05 +0000 (UTC) (envelope-from scottl@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 9C91521612; Sat, 16 Nov 2019 00:52:05 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAG0q5IO014803; Sat, 16 Nov 2019 00:52:05 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAG0q4ET014800; Sat, 16 Nov 2019 00:52:04 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911160052.xAG0q4ET014800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 16 Nov 2019 00:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354764 - in stable/11/sys: amd64/amd64 dev/cpuctl x86/include x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 dev/cpuctl x86/include x86/x86 X-SVN-Commit-Revision: 354764 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 00:52:06 -0000 Author: scottl Date: Sat Nov 16 00:52:04 2019 New Revision: 354764 URL: https://svnweb.freebsd.org/changeset/base/354764 Log: MFC r354759: TSX Asynchronous Abort mitigation for Intel CVE-2019-11135. This CVE has already been announced in FreeBSD SA-19:26.mcu. Mitigation for TAA involves either turning off TSX or turning on the VERW mitigation used for MDS. Some CPUs will also be self-mitigating for TAA and require no software workaround. Control knobs are: machdep.mitigations.taa.enable: 0 - no software mitigation is enabled 1 - attempt to disable TSX 2 - use the VERW mitigation 3 - automatically select the mitigation based on processor features. machdep.mitigations.taa.state: inactive - no mitigation is active/enabled TSX disable - TSX is disabled in the bare metal CPU as well as - any virtualized CPUs VERW - VERW instruction clears CPU buffers not vulnerable - The CPU has identified itself as not being vulnerable Nothing in the base FreeBSD system uses TSX. However, the instructions are straight-forward to add to custom applications and require no kernel support, so the mitigation is provided for users with untrusted applications and tenants. Reviewed by: emaste, imp, kib, scottph Sponsored by: Intel Differential Revision: 22374 Modified: stable/11/sys/amd64/amd64/machdep.c stable/11/sys/dev/cpuctl/cpuctl.c stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/cpu_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Sat Nov 16 00:36:42 2019 (r354763) +++ stable/11/sys/amd64/amd64/machdep.c Sat Nov 16 00:52:04 2019 (r354764) @@ -1722,6 +1722,11 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) != NULL) vty_set_preferred(VTY_VT); + TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); + TUNABLE_INT_FETCH("hw.spec_store_bypass_disable", &hw_ssb_disable); + TUNABLE_INT_FETCH("hw.mds_disable", &hw_mds_disable); + TUNABLE_INT_FETCH("machdep.mitigations.taa.enable", &x86_taa_enable); + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Sat Nov 16 00:36:42 2019 (r354763) +++ stable/11/sys/dev/cpuctl/cpuctl.c Sat Nov 16 00:52:04 2019 (r354764) @@ -543,6 +543,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td pmap_allow_2m_x_ept_recalculate(); #endif hw_mds_recalculate(); + x86_taa_recalculate(); printcpuinfo(); return (0); } Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Sat Nov 16 00:36:42 2019 (r354763) +++ stable/11/sys/x86/include/x86_var.h Sat Nov 16 00:52:04 2019 (r354764) @@ -85,6 +85,7 @@ extern int pti; extern int hw_ibrs_active; extern int hw_mds_disable; extern int hw_ssb_active; +extern int x86_taa_enable; struct pcb; struct thread; @@ -137,6 +138,7 @@ void handle_ibrs_exit(void); void hw_ibrs_recalculate(void); void hw_mds_recalculate(void); void hw_ssb_recalculate(bool all_cpus); +void x86_taa_recalculate(void); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); void nmi_handle_intr(u_int type, struct trapframe *frame); Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Sat Nov 16 00:36:42 2019 (r354763) +++ stable/11/sys/x86/x86/cpu_machdep.c Sat Nov 16 00:52:04 2019 (r354764) @@ -1148,3 +1148,199 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | "Microarchitectural Data Sampling Mitigation " "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + +/* + * Intel Transactional Memory Asynchronous Abort Mitigation + * CVE-2019-11135 + */ +int x86_taa_enable; +int x86_taa_state; +enum { + TAA_NONE = 0, + TAA_TSX_DISABLE = 1, + TAA_VERW = 2, + TAA_AUTO = 3, + TAA_TAA_NO = 4 +}; + +static void +taa_set_one(bool enable) +{ + uint64_t v; + + v = rdmsr(MSR_IA32_TSX_CTRL); + if (enable) + v |= (uint64_t)(IA32_TSX_CTRL_RTM_DISABLE | + IA32_TSX_CTRL_TSX_CPUID_CLEAR); + else + v &= ~(uint64_t)(IA32_TSX_CTRL_RTM_DISABLE | + IA32_TSX_CTRL_TSX_CPUID_CLEAR); + + wrmsr(MSR_IA32_TSX_CTRL, v); +} + +static void +taa_set(bool enable, bool all) +{ + struct thread *td; + int bound_cpu, i, is_bound; + + if (all) { + td = curthread; + thread_lock(td); + is_bound = sched_is_bound(td); + bound_cpu = td->td_oncpu; + CPU_FOREACH(i) { + sched_bind(td, i); + taa_set_one(enable); + } + if (is_bound) + sched_bind(td, bound_cpu); + else + sched_unbind(td); + thread_unlock(td); + } else + taa_set_one(enable); +} + +void +x86_taa_recalculate(void) +{ + static int taa_saved_mds_disable = 0; + int taa_need = 0, taa_state = 0; + int mds_disable = 0, need_mds_recalc = 0; + + /* Check CPUID.07h.EBX.HLE and RTM for the presence of TSX */ + if ((cpu_stdext_feature & CPUID_STDEXT_HLE) == 0 || + (cpu_stdext_feature & CPUID_STDEXT_RTM) == 0) { + /* TSX is not present */ + x86_taa_state = 0; + return; + } + + /* Check to see what mitigation options the CPU gives us */ + if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TAA_NO) { + /* CPU is not suseptible to TAA */ + taa_need = TAA_NONE; + taa_state = TAA_TAA_NO; + } else if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TSX_CTRL) { + /* + * CPU can turn off TSX. This is the next best option + * if TAA_NO hardware mitigation isn't present + */ + taa_need = TAA_TSX_DISABLE; + } else { + /* No TSX/TAA specific remedies are available. */ + if (x86_taa_enable == TAA_TSX_DISABLE) { + if (bootverbose) + printf("TSX control not available\n"); + return; + } else + taa_need = TAA_VERW; + } + + /* Can we automatically take action, or are we being forced? */ + if (x86_taa_enable == TAA_AUTO) + taa_state = taa_need; + else + taa_state = x86_taa_enable; + + /* No state change, nothing to do */ + if (taa_state == x86_taa_state) { + if (bootverbose) + printf("No TSX change made\n"); + return; + } + + /* Does the MSR need to be turned on or off? */ + if (taa_state == TAA_TSX_DISABLE) + taa_set(true, true); + else if (x86_taa_state == TAA_TSX_DISABLE) + taa_set(false, true); + + /* Does MDS need to be set to turn on VERW? */ + if (taa_state == TAA_VERW) { + taa_saved_mds_disable = hw_mds_disable; + mds_disable = hw_mds_disable = 1; + need_mds_recalc = 1; + } else if (x86_taa_state == TAA_VERW) { + mds_disable = hw_mds_disable = taa_saved_mds_disable; + need_mds_recalc = 1; + } + if (need_mds_recalc) { + hw_mds_recalculate(); + if (mds_disable != hw_mds_disable) { + if (bootverbose) + printf("Cannot change MDS state for TAA\n"); + /* Don't update our state */ + return; + } + } + + x86_taa_state = taa_state; + return; +} + +static void +taa_recalculate_boot(void * arg __unused) +{ + + x86_taa_recalculate(); +} +SYSINIT(taa_recalc, SI_SUB_SMP, SI_ORDER_ANY, taa_recalculate_boot, NULL); + +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, taa, CTLFLAG_RW, 0, + "TSX Asynchronous Abort Mitigation"); + +static int +sysctl_taa_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = x86_taa_enable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (val < TAA_NONE || val > TAA_AUTO) + return (EINVAL); + x86_taa_enable = val; + x86_taa_recalculate(); + return (0); +} + +SYSCTL_PROC(_machdep_mitigations_taa, OID_AUTO, enable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_taa_handler, "I", + "TAA Mitigation enablement control " + "(0 - off, 1 - disable TSX, 2 - VERW, 3 - on AUTO"); + +static int +sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) +{ + const char *state; + + switch (x86_taa_state) { + case TAA_NONE: + state = "inactive"; + break; + case TAA_TSX_DISABLE: + state = "TSX disabled"; + break; + case TAA_VERW: + state = "VERW"; + break; + case TAA_TAA_NO: + state = "Not vulnerable"; + break; + default: + state = "unknown"; + } + + return (SYSCTL_OUT(req, state, strlen(state))); +} + +SYSCTL_PROC(_machdep_mitigations_taa, OID_AUTO, state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_taa_state_handler, "A", + "TAA Mitigation state"); + From owner-svn-src-stable-11@freebsd.org Sat Nov 16 11:00:23 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28B291C2255; Sat, 16 Nov 2019 11:00:23 +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 47FXLb0Kbsz4cFn; Sat, 16 Nov 2019 11:00:23 +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 E3B50596; Sat, 16 Nov 2019 11:00:22 +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 xAGB0M52071131; Sat, 16 Nov 2019 11:00:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGB0M8i071130; Sat, 16 Nov 2019 11:00:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911161100.xAGB0M8i071130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 16 Nov 2019 11:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354769 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 354769 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 11:00:23 -0000 Author: kib Date: Sat Nov 16 11:00:22 2019 New Revision: 354769 URL: https://svnweb.freebsd.org/changeset/base/354769 Log: MFC r354696: amd64: only set PCB_FULL_IRET pcb flag when #gp or similar exception comes from usermode. Modified: stable/11/sys/amd64/amd64/exception.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/exception.S ============================================================================== --- stable/11/sys/amd64/amd64/exception.S Sat Nov 16 10:50:10 2019 (r354768) +++ stable/11/sys/amd64/amd64/exception.S Sat Nov 16 11:00:22 2019 (r354769) @@ -492,8 +492,8 @@ prot_addrf: 3: cmpw $KUG32SEL,TF_GS(%rsp) jne 4f movq %rdx,PCB_GSBASE(%rdi) + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* full iret from user #gp */ 4: call handle_ibrs_entry - orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) From owner-svn-src-stable-11@freebsd.org Sat Nov 16 11:01:57 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AC311C2360; Sat, 16 Nov 2019 11:01:57 +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 47FXNP3f7Vz4dFd; Sat, 16 Nov 2019 11:01:57 +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 61D9A616; Sat, 16 Nov 2019 11:01:57 +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 xAGB1vEx075867; Sat, 16 Nov 2019 11:01:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAGB1vxJ075865; Sat, 16 Nov 2019 11:01:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911161101.xAGB1vxJ075865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 16 Nov 2019 11:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354770 - stable/11/usr.sbin/cpucontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/usr.sbin/cpucontrol X-SVN-Commit-Revision: 354770 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2019 11:01:57 -0000 Author: kib Date: Sat Nov 16 11:01:56 2019 New Revision: 354770 URL: https://svnweb.freebsd.org/changeset/base/354770 Log: MFC r354697: cpucontrol: print more useful information when MSR access fails. Modified: stable/11/usr.sbin/cpucontrol/cpucontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- stable/11/usr.sbin/cpucontrol/cpucontrol.c Sat Nov 16 11:00:22 2019 (r354769) +++ stable/11/usr.sbin/cpucontrol/cpucontrol.c Sat Nov 16 11:01:56 2019 (r354770) @@ -330,7 +330,7 @@ do_msr(const char *cmdarg, const char *dev) } error = ioctl(fd, command, &args); if (error < 0) { - WARN(0, "ioctl(%s, CPUCTL_%s (%lu))", dev, command_name, command); + WARN(0, "ioctl(%s, CPUCTL_%s (%#x))", dev, command_name, msr); close(fd); return (1); }