From owner-svn-src-stable@freebsd.org Mon Jul 29 06:13:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6546BE7D6; Mon, 29 Jul 2019 06:13:24 +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 9158F68171; Mon, 29 Jul 2019 06:13:24 +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 584C423EF5; Mon, 29 Jul 2019 06:13:24 +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 x6T6DO7p088292; Mon, 29 Jul 2019 06:13:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T6DN3k088289; Mon, 29 Jul 2019 06:13:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907290613.x6T6DN3k088289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jul 2019 06:13:23 +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: r350400 - in stable: 11/contrib/libcxxrt 11/lib/libcxxrt 12/contrib/libcxxrt 12/lib/libcxxrt X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libcxxrt 11/lib/libcxxrt 12/contrib/libcxxrt 12/lib/libcxxrt X-SVN-Commit-Revision: 350400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9158F68171 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 06:13:24 -0000 Author: dim Date: Mon Jul 29 06:13:22 2019 New Revision: 350400 URL: https://svnweb.freebsd.org/changeset/base/350400 Log: MFC r350360: Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d. Interesting fixes: f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0 6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265) db54f53 Added C++14-specific operator delete (#47) PR: 239265 Modified: stable/11/contrib/libcxxrt/exception.cc (contents, props changed) stable/11/contrib/libcxxrt/memory.cc (contents, props changed) stable/11/lib/libcxxrt/Makefile stable/11/lib/libcxxrt/Version.map Directory Properties: stable/11/ (props changed) stable/11/contrib/libcxxrt/abi_namespace.h (props changed) stable/11/contrib/libcxxrt/auxhelper.cc (props changed) stable/11/contrib/libcxxrt/cxxabi.h (props changed) stable/11/contrib/libcxxrt/dwarf_eh.h (props changed) stable/11/contrib/libcxxrt/dynamic_cast.cc (props changed) stable/11/contrib/libcxxrt/guard.cc (props changed) stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c (props changed) stable/11/contrib/libcxxrt/stdexcept.cc (props changed) stable/11/contrib/libcxxrt/stdexcept.h (props changed) stable/11/contrib/libcxxrt/terminate.cc (props changed) stable/11/contrib/libcxxrt/typeinfo.cc (props changed) stable/11/contrib/libcxxrt/typeinfo.h (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/libcxxrt/exception.cc (contents, props changed) stable/12/contrib/libcxxrt/memory.cc (contents, props changed) stable/12/lib/libcxxrt/Makefile stable/12/lib/libcxxrt/Version.map Directory Properties: stable/12/ (props changed) stable/12/contrib/libcxxrt/abi_namespace.h (props changed) stable/12/contrib/libcxxrt/auxhelper.cc (props changed) stable/12/contrib/libcxxrt/cxxabi.h (props changed) stable/12/contrib/libcxxrt/dwarf_eh.h (props changed) stable/12/contrib/libcxxrt/dynamic_cast.cc (props changed) stable/12/contrib/libcxxrt/guard.cc (props changed) stable/12/contrib/libcxxrt/libelftc_dem_gnu3.c (props changed) stable/12/contrib/libcxxrt/stdexcept.cc (props changed) stable/12/contrib/libcxxrt/stdexcept.h (props changed) stable/12/contrib/libcxxrt/terminate.cc (props changed) stable/12/contrib/libcxxrt/typeinfo.cc (props changed) stable/12/contrib/libcxxrt/typeinfo.h (props changed) Modified: stable/11/contrib/libcxxrt/exception.cc ============================================================================== --- stable/11/contrib/libcxxrt/exception.cc Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/contrib/libcxxrt/exception.cc Mon Jul 29 06:13:22 2019 (r350400) @@ -879,6 +879,13 @@ extern "C" void __cxa_rethrow() assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!"); + // `globals->uncaughtExceptions` was decremented by `__cxa_begin_catch`. + // It's normally incremented by `throw_exception`, but this path invokes + // `_Unwind_Resume_or_Rethrow` directly to rethrow the exception. + // This path is only reachable if we're rethrowing a C++ exception - + // foreign exceptions don't adjust any of this state. + globals->uncaughtExceptions++; + // ex->handlerCount will be decremented in __cxa_end_catch in enclosing // catch block @@ -1224,11 +1231,13 @@ extern "C" void *__cxa_begin_catch(void *e) // we see is a foreign exception then we won't have called it yet. __cxa_thread_info *ti = thread_info(); __cxa_eh_globals *globals = &ti->globals; - globals->uncaughtExceptions--; _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(e); if (isCXXException(exceptionObject->exception_class)) { + // Only exceptions thrown with a C++ exception throwing function will + // increment this, so don't decrement it here. + globals->uncaughtExceptions--; __cxa_exception *ex = exceptionFromPointer(exceptionObject); if (ex->handlerCount == 0) @@ -1365,6 +1374,14 @@ extern "C" std::type_info *__cxa_current_exception_typ } /** + * Cleanup, ensures that `__cxa_end_catch` is called to balance an explicit + * `__cxa_begin_catch` call. + */ +static void end_catch(char *) +{ + __cxa_end_catch(); +} +/** * ABI function, called when an exception specification is violated. * * This function does not return. @@ -1372,6 +1389,12 @@ extern "C" std::type_info *__cxa_current_exception_typ extern "C" void __cxa_call_unexpected(void*exception) { _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(exception); + // Wrap the call to the unexpected handler in calls to `__cxa_begin_catch` + // and `__cxa_end_catch` so that we correctly update exception counts if + // the unexpected handler throws an exception. + __cxa_begin_catch(exceptionObject); + __attribute__((cleanup(end_catch))) + char unused; if (exceptionObject->exception_class == exception_class) { __cxa_exception *ex = exceptionFromPointer(exceptionObject); Modified: stable/11/contrib/libcxxrt/memory.cc ============================================================================== --- stable/11/contrib/libcxxrt/memory.cc Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/contrib/libcxxrt/memory.cc Mon Jul 29 06:13:22 2019 (r350400) @@ -151,4 +151,21 @@ void operator delete[](void * ptr) NOEXCEPT ::operator delete(ptr); } +// C++14 additional delete operators +#if __cplusplus >= 201402L + +__attribute__((weak)) +void operator delete(void * ptr, size_t) NOEXCEPT +{ + ::operator delete(ptr); +} + + +__attribute__((weak)) +void operator delete[](void * ptr, size_t) NOEXCEPT +{ + ::operator delete(ptr); +} + +#endif Modified: stable/11/lib/libcxxrt/Makefile ============================================================================== --- stable/11/lib/libcxxrt/Makefile Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/lib/libcxxrt/Makefile Mon Jul 29 06:13:22 2019 (r350400) @@ -23,7 +23,7 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ .if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 +CXXFLAGS+= -std=c++14 .endif VERSION_MAP= ${.CURDIR}/Version.map Modified: stable/11/lib/libcxxrt/Version.map ============================================================================== --- stable/11/lib/libcxxrt/Version.map Mon Jul 29 03:28:46 2019 (r350399) +++ stable/11/lib/libcxxrt/Version.map Mon Jul 29 06:13:22 2019 (r350400) @@ -277,6 +277,10 @@ CXXABI_1.3.9 { "typeinfo name for unsigned __int128 const*"; "typeinfo name for unsigned __int128"; "typeinfo name for unsigned __int128*"; + "operator delete[](void*, unsigned int)"; + "operator delete(void*, unsigned int)"; + "operator delete[](void*, unsigned long)"; + "operator delete(void*, unsigned long)"; }; } CXXABI_1.3.6; From owner-svn-src-stable@freebsd.org Mon Jul 29 06:13:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4BDEBE7D0; Mon, 29 Jul 2019 06:13:23 +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 7CB7868170; Mon, 29 Jul 2019 06:13:23 +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 60F7523EF4; Mon, 29 Jul 2019 06:13:23 +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 x6T6DNqF088283; Mon, 29 Jul 2019 06:13:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T6DMn9088279; Mon, 29 Jul 2019 06:13:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907290613.x6T6DMn9088279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jul 2019 06:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350400 - in stable: 11/contrib/libcxxrt 11/lib/libcxxrt 12/contrib/libcxxrt 12/lib/libcxxrt X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/libcxxrt 11/lib/libcxxrt 12/contrib/libcxxrt 12/lib/libcxxrt X-SVN-Commit-Revision: 350400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7CB7868170 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 06:13:23 -0000 Author: dim Date: Mon Jul 29 06:13:22 2019 New Revision: 350400 URL: https://svnweb.freebsd.org/changeset/base/350400 Log: MFC r350360: Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d. Interesting fixes: f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0 6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265) db54f53 Added C++14-specific operator delete (#47) PR: 239265 Modified: stable/12/contrib/libcxxrt/exception.cc (contents, props changed) stable/12/contrib/libcxxrt/memory.cc (contents, props changed) stable/12/lib/libcxxrt/Makefile stable/12/lib/libcxxrt/Version.map Directory Properties: stable/12/ (props changed) stable/12/contrib/libcxxrt/abi_namespace.h (props changed) stable/12/contrib/libcxxrt/auxhelper.cc (props changed) stable/12/contrib/libcxxrt/cxxabi.h (props changed) stable/12/contrib/libcxxrt/dwarf_eh.h (props changed) stable/12/contrib/libcxxrt/dynamic_cast.cc (props changed) stable/12/contrib/libcxxrt/guard.cc (props changed) stable/12/contrib/libcxxrt/libelftc_dem_gnu3.c (props changed) stable/12/contrib/libcxxrt/stdexcept.cc (props changed) stable/12/contrib/libcxxrt/stdexcept.h (props changed) stable/12/contrib/libcxxrt/terminate.cc (props changed) stable/12/contrib/libcxxrt/typeinfo.cc (props changed) stable/12/contrib/libcxxrt/typeinfo.h (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/libcxxrt/exception.cc (contents, props changed) stable/11/contrib/libcxxrt/memory.cc (contents, props changed) stable/11/lib/libcxxrt/Makefile stable/11/lib/libcxxrt/Version.map Directory Properties: stable/11/ (props changed) stable/11/contrib/libcxxrt/abi_namespace.h (props changed) stable/11/contrib/libcxxrt/auxhelper.cc (props changed) stable/11/contrib/libcxxrt/cxxabi.h (props changed) stable/11/contrib/libcxxrt/dwarf_eh.h (props changed) stable/11/contrib/libcxxrt/dynamic_cast.cc (props changed) stable/11/contrib/libcxxrt/guard.cc (props changed) stable/11/contrib/libcxxrt/libelftc_dem_gnu3.c (props changed) stable/11/contrib/libcxxrt/stdexcept.cc (props changed) stable/11/contrib/libcxxrt/stdexcept.h (props changed) stable/11/contrib/libcxxrt/terminate.cc (props changed) stable/11/contrib/libcxxrt/typeinfo.cc (props changed) stable/11/contrib/libcxxrt/typeinfo.h (props changed) Modified: stable/12/contrib/libcxxrt/exception.cc ============================================================================== --- stable/12/contrib/libcxxrt/exception.cc Mon Jul 29 03:28:46 2019 (r350399) +++ stable/12/contrib/libcxxrt/exception.cc Mon Jul 29 06:13:22 2019 (r350400) @@ -879,6 +879,13 @@ extern "C" void __cxa_rethrow() assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!"); + // `globals->uncaughtExceptions` was decremented by `__cxa_begin_catch`. + // It's normally incremented by `throw_exception`, but this path invokes + // `_Unwind_Resume_or_Rethrow` directly to rethrow the exception. + // This path is only reachable if we're rethrowing a C++ exception - + // foreign exceptions don't adjust any of this state. + globals->uncaughtExceptions++; + // ex->handlerCount will be decremented in __cxa_end_catch in enclosing // catch block @@ -1224,11 +1231,13 @@ extern "C" void *__cxa_begin_catch(void *e) // we see is a foreign exception then we won't have called it yet. __cxa_thread_info *ti = thread_info(); __cxa_eh_globals *globals = &ti->globals; - globals->uncaughtExceptions--; _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(e); if (isCXXException(exceptionObject->exception_class)) { + // Only exceptions thrown with a C++ exception throwing function will + // increment this, so don't decrement it here. + globals->uncaughtExceptions--; __cxa_exception *ex = exceptionFromPointer(exceptionObject); if (ex->handlerCount == 0) @@ -1365,6 +1374,14 @@ extern "C" std::type_info *__cxa_current_exception_typ } /** + * Cleanup, ensures that `__cxa_end_catch` is called to balance an explicit + * `__cxa_begin_catch` call. + */ +static void end_catch(char *) +{ + __cxa_end_catch(); +} +/** * ABI function, called when an exception specification is violated. * * This function does not return. @@ -1372,6 +1389,12 @@ extern "C" std::type_info *__cxa_current_exception_typ extern "C" void __cxa_call_unexpected(void*exception) { _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(exception); + // Wrap the call to the unexpected handler in calls to `__cxa_begin_catch` + // and `__cxa_end_catch` so that we correctly update exception counts if + // the unexpected handler throws an exception. + __cxa_begin_catch(exceptionObject); + __attribute__((cleanup(end_catch))) + char unused; if (exceptionObject->exception_class == exception_class) { __cxa_exception *ex = exceptionFromPointer(exceptionObject); Modified: stable/12/contrib/libcxxrt/memory.cc ============================================================================== --- stable/12/contrib/libcxxrt/memory.cc Mon Jul 29 03:28:46 2019 (r350399) +++ stable/12/contrib/libcxxrt/memory.cc Mon Jul 29 06:13:22 2019 (r350400) @@ -151,4 +151,21 @@ void operator delete[](void * ptr) NOEXCEPT ::operator delete(ptr); } +// C++14 additional delete operators +#if __cplusplus >= 201402L + +__attribute__((weak)) +void operator delete(void * ptr, size_t) NOEXCEPT +{ + ::operator delete(ptr); +} + + +__attribute__((weak)) +void operator delete[](void * ptr, size_t) NOEXCEPT +{ + ::operator delete(ptr); +} + +#endif Modified: stable/12/lib/libcxxrt/Makefile ============================================================================== --- stable/12/lib/libcxxrt/Makefile Mon Jul 29 03:28:46 2019 (r350399) +++ stable/12/lib/libcxxrt/Makefile Mon Jul 29 06:13:22 2019 (r350400) @@ -22,7 +22,7 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ -CXXSTD?= c++11 +CXXSTD?= c++14 VERSION_MAP= ${.CURDIR}/Version.map .include Modified: stable/12/lib/libcxxrt/Version.map ============================================================================== --- stable/12/lib/libcxxrt/Version.map Mon Jul 29 03:28:46 2019 (r350399) +++ stable/12/lib/libcxxrt/Version.map Mon Jul 29 06:13:22 2019 (r350400) @@ -277,6 +277,10 @@ CXXABI_1.3.9 { "typeinfo name for unsigned __int128 const*"; "typeinfo name for unsigned __int128"; "typeinfo name for unsigned __int128*"; + "operator delete[](void*, unsigned int)"; + "operator delete(void*, unsigned int)"; + "operator delete[](void*, unsigned long)"; + "operator delete(void*, unsigned long)"; }; } CXXABI_1.3.6; From owner-svn-src-stable@freebsd.org Mon Jul 29 08:14:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 914AFA1F45; Mon, 29 Jul 2019 08:14:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 7334A6D34B; Mon, 29 Jul 2019 08:14:36 +0000 (UTC) (envelope-from bapt@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 63F73254A4; Mon, 29 Jul 2019 08:14:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T8Ea2U059183; Mon, 29 Jul 2019 08:14:36 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T8Ea9a059182; Mon, 29 Jul 2019 08:14:36 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201907290814.x6T8Ea9a059182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 29 Jul 2019 08:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350401 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 350401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7334A6D34B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 08:14:36 -0000 Author: bapt Date: Mon Jul 29 08:14:35 2019 New Revision: 350401 URL: https://svnweb.freebsd.org/changeset/base/350401 Log: MFC r350358: Fix a bug introduced with parallel mounting of zfs Incorporate a fix from zol: https://github.com/zfsonlinux/zfs/commit/ab5036df1ccbe1b18c1ce6160b5829e8039d94ce commit log from upstream: Fix race in parallel mount's thread dispatching algorithm Strategy of parallel mount is as follows. 1) Initial thread dispatching is to select sets of mount points that don't have dependencies on other sets, hence threads can/should run lock-less and shouldn't race with other threads for other sets. Each thread dispatched corresponds to top level directory which may or may not have datasets to be mounted on sub directories. 2) Subsequent recursive thread dispatching for each thread from 1) is to mount datasets for each set of mount points. The mount points within each set have dependencies (i.e. child directories), so child directories are processed only after parent directory completes. The problem is that the initial thread dispatching in zfs_foreach_mountpoint() can be multi-threaded when it needs to be single-threaded, and this puts threads under race condition. This race appeared as mount/unmount issues on ZoL for ZoL having different timing regarding mount(2) execution due to fork(2)/exec(2) of mount(8). `zfs unmount -a` which expects proper mount order can't unmount if the mounts were reordered by the race condition. There are currently two known patterns of input list `handles` in `zfs_foreach_mountpoint(..,handles,..)` which cause the race condition. 1) #8833 case where input is `/a /a /a/b` after sorting. The problem is that libzfs_path_contains() can't correctly handle an input list with two same top level directories. There is a race between two POSIX threads A and B, * ThreadA for "/a" for test1 and "/a/b" * ThreadB for "/a" for test0/a and in case of #8833, ThreadA won the race. Two threads were created because "/a" wasn't considered as `"/a" contains "/a"`. 2) #8450 case where input is `/ /var/data /var/data/test` after sorting. The problem is that libzfs_path_contains() can't correctly handle an input list containing "/". There is a race between two POSIX threads A and B, * ThreadA for "/" and "/var/data/test" * ThreadB for "/var/data" and in case of #8450, ThreadA won the race. Two threads were created because "/var/data" wasn't considered as `"/" contains "/var/data"`. In other words, if there is (at least one) "/" in the input list, the initial thread dispatching must be single-threaded since every directory is a child of "/", meaning they all directly or indirectly depend on "/". In both cases, the first non_descendant_idx() call fails to correctly determine "path1-contains-path2", and as a result the initial thread dispatching creates another thread when it needs to be single-threaded. Fix a conditional in libzfs_path_contains() to consider above two. Reviewed-by: Brian Behlendorf Reviewed by: Sebastien Roy Signed-off-by: Tomohiro Kusumi PR: 237517, 237397, 239243 Submitted by: Matthew D. Fuller (by email) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Jul 29 06:13:22 2019 (r350400) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Jul 29 08:14:35 2019 (r350401) @@ -1281,12 +1281,14 @@ mountpoint_cmp(const void *arga, const void *argb) } /* - * Reutrn true if path2 is a child of path1 + * Return true if path2 is a child of path1 or path2 equals path1 or + * path1 is "/" (path2 is always a child of "/"). */ static boolean_t libzfs_path_contains(const char *path1, const char *path2) { - return (strstr(path2, path1) == path2 && path2[strlen(path1)] == '/'); + return (strcmp(path1, path2) == 0 || strcmp(path1, "/") == 0 || + (strstr(path2, path1) == path2 && path2[strlen(path1)] == '/')); } From owner-svn-src-stable@freebsd.org Mon Jul 29 08:23:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E797EA245C; Mon, 29 Jul 2019 08:23:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 CA5006DADF; Mon, 29 Jul 2019 08:23:15 +0000 (UTC) (envelope-from bapt@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 A4EF425691; Mon, 29 Jul 2019 08:23:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T8NFnt064977; Mon, 29 Jul 2019 08:23:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T8NFAu064976; Mon, 29 Jul 2019 08:23:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201907290823.x6T8NFAu064976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 29 Jul 2019 08:23:15 +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: r350402 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 350402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CA5006DADF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 08:23:16 -0000 Author: bapt Date: Mon Jul 29 08:23:15 2019 New Revision: 350402 URL: https://svnweb.freebsd.org/changeset/base/350402 Log: MFC r350358: Fix a bug introduced with parallel mounting of zfs Incorporate a fix from zol: https://github.com/zfsonlinux/zfs/commit/ab5036df1ccbe1b18c1ce6160b5829e8039d94ce commit log from upstream: Fix race in parallel mount's thread dispatching algorithm Strategy of parallel mount is as follows. 1) Initial thread dispatching is to select sets of mount points that don't have dependencies on other sets, hence threads can/should run lock-less and shouldn't race with other threads for other sets. Each thread dispatched corresponds to top level directory which may or may not have datasets to be mounted on sub directories. 2) Subsequent recursive thread dispatching for each thread from 1) is to mount datasets for each set of mount points. The mount points within each set have dependencies (i.e. child directories), so child directories are processed only after parent directory completes. The problem is that the initial thread dispatching in zfs_foreach_mountpoint() can be multi-threaded when it needs to be single-threaded, and this puts threads under race condition. This race appeared as mount/unmount issues on ZoL for ZoL having different timing regarding mount(2) execution due to fork(2)/exec(2) of mount(8). `zfs unmount -a` which expects proper mount order can't unmount if the mounts were reordered by the race condition. There are currently two known patterns of input list `handles` in `zfs_foreach_mountpoint(..,handles,..)` which cause the race condition. 1) #8833 case where input is `/a /a /a/b` after sorting. The problem is that libzfs_path_contains() can't correctly handle an input list with two same top level directories. There is a race between two POSIX threads A and B, * ThreadA for "/a" for test1 and "/a/b" * ThreadB for "/a" for test0/a and in case of #8833, ThreadA won the race. Two threads were created because "/a" wasn't considered as `"/a" contains "/a"`. 2) #8450 case where input is `/ /var/data /var/data/test` after sorting. The problem is that libzfs_path_contains() can't correctly handle an input list containing "/". There is a race between two POSIX threads A and B, * ThreadA for "/" and "/var/data/test" * ThreadB for "/var/data" and in case of #8450, ThreadA won the race. Two threads were created because "/var/data" wasn't considered as `"/" contains "/var/data"`. In other words, if there is (at least one) "/" in the input list, the initial thread dispatching must be single-threaded since every directory is a child of "/", meaning they all directly or indirectly depend on "/". In both cases, the first non_descendant_idx() call fails to correctly determine "path1-contains-path2", and as a result the initial thread dispatching creates another thread when it needs to be single-threaded. Fix a conditional in libzfs_path_contains() to consider above two. Reviewed-by: Brian Behlendorf Reviewed by: Sebastien Roy Signed-off-by: Tomohiro Kusumi PR: 237517, 237397, 239243 Submitted by: Matthew D. Fuller (by email) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Jul 29 08:14:35 2019 (r350401) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Jul 29 08:23:15 2019 (r350402) @@ -1281,12 +1281,14 @@ mountpoint_cmp(const void *arga, const void *argb) } /* - * Reutrn true if path2 is a child of path1 + * Return true if path2 is a child of path1 or path2 equals path1 or + * path1 is "/" (path2 is always a child of "/"). */ static boolean_t libzfs_path_contains(const char *path1, const char *path2) { - return (strstr(path2, path1) == path2 && path2[strlen(path1)] == '/'); + return (strcmp(path1, path2) == 0 || strcmp(path1, "/") == 0 || + (strstr(path2, path1) == path2 && path2[strlen(path1)] == '/')); } From owner-svn-src-stable@freebsd.org Mon Jul 29 09:25:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86F46A3DC1; Mon, 29 Jul 2019 09:25:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 66067700E2; Mon, 29 Jul 2019 09:25:18 +0000 (UTC) (envelope-from arybchik@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 3A7B526198; Mon, 29 Jul 2019 09:25:18 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T9PIMJ000653; Mon, 29 Jul 2019 09:25:18 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T9PHQJ000644; Mon, 29 Jul 2019 09:25:17 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201907290925.x6T9PHQJ000644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 29 Jul 2019 09:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350405 - in stable/12/sys/dev/sfxge: . common X-SVN-Group: stable-12 X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: in stable/12/sys/dev/sfxge: . common X-SVN-Commit-Revision: 350405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 66067700E2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 09:25:18 -0000 Author: arybchik Date: Mon Jul 29 09:25:16 2019 New Revision: 350405 URL: https://svnweb.freebsd.org/changeset/base/350405 Log: MFC r350369 sfxge(4): fix power of 2 round up when align has smaller type Substitute driver-defined P2ROUNDUP() h with EFX_P2ROUNDUP() defined in libefx. Cast value and alignment to one specified type to guarantee result correctness. Reported by: Andrea Valsania Sponsored by: Solarflare Communications, Inc. Modified: stable/12/sys/dev/sfxge/common/ef10_nvram.c stable/12/sys/dev/sfxge/common/efsys.h stable/12/sys/dev/sfxge/common/efx.h stable/12/sys/dev/sfxge/common/efx_mcdi.h stable/12/sys/dev/sfxge/common/efx_tx.c stable/12/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- stable/12/sys/dev/sfxge/common/ef10_nvram.c Mon Jul 29 09:19:48 2019 (r350404) +++ stable/12/sys/dev/sfxge/common/ef10_nvram.c Mon Jul 29 09:25:16 2019 (r350405) @@ -394,7 +394,8 @@ tlv_write( if (len > 0) { ptr[(len - 1) / sizeof (uint32_t)] = 0; memcpy(ptr, data, len); - ptr += P2ROUNDUP(len, sizeof (uint32_t)) / sizeof (*ptr); + ptr += EFX_P2ROUNDUP(uint32_t, len, + sizeof (uint32_t)) / sizeof (*ptr); } return (ptr); Modified: stable/12/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efsys.h Mon Jul 29 09:19:48 2019 (r350404) +++ stable/12/sys/dev/sfxge/common/efsys.h Mon Jul 29 09:25:16 2019 (r350405) @@ -93,10 +93,6 @@ extern "C" { #define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) #endif -#ifndef P2ROUNDUP -#define P2ROUNDUP(x, align) (-(-(x) & -(align))) -#endif - #ifndef P2ALIGN #define P2ALIGN(_x, _a) ((_x) & -(_a)) #endif Modified: stable/12/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efx.h Mon Jul 29 09:19:48 2019 (r350404) +++ stable/12/sys/dev/sfxge/common/efx.h Mon Jul 29 09:25:16 2019 (r350405) @@ -52,6 +52,10 @@ extern "C" { #define EFX_FIELD_OFFSET(_type, _field) \ ((size_t) &(((_type *)0)->_field)) +/* Round value up to the nearest power of two. */ +#define EFX_P2ROUNDUP(_type, _value, _align) \ + (-(-(_type)(_value) & -(_type)(_align))) + /* Return codes */ typedef __success(return == 0) int efx_rc_t; @@ -451,10 +455,10 @@ typedef enum efx_link_mode_e { + /* bug16011 */ 16) \ #define EFX_MAC_PDU(_sdu) \ - P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8) + EFX_P2ROUNDUP(size_t, (_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8) /* - * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give + * Due to the EFX_P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give * the SDU rounded up slightly. */ #define EFX_MAC_SDU_FROM_PDU(_pdu) ((_pdu) - EFX_MAC_PDU_ADJUSTMENT) @@ -540,8 +544,9 @@ efx_mac_stat_name( #define EFX_MAC_STATS_MASK_BITS_PER_PAGE (8 * sizeof (uint32_t)) -#define EFX_MAC_STATS_MASK_NPAGES \ - (P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \ +#define EFX_MAC_STATS_MASK_NPAGES \ + (EFX_P2ROUNDUP(uint32_t, EFX_MAC_NSTATS, \ + EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \ EFX_MAC_STATS_MASK_BITS_PER_PAGE) /* Modified: stable/12/sys/dev/sfxge/common/efx_mcdi.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efx_mcdi.h Mon Jul 29 09:19:48 2019 (r350404) +++ stable/12/sys/dev/sfxge/common/efx_mcdi.h Mon Jul 29 09:25:16 2019 (r350405) @@ -395,6 +395,11 @@ efx_mcdi_phy_module_get_info( (((mask) & (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) == \ (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) +#define EFX_MCDI_BUF_SIZE(_in_len, _out_len) \ + EFX_P2ROUNDUP(size_t, \ + MAX(MAX(_in_len, _out_len), (2 * sizeof (efx_dword_t))),\ + sizeof (efx_dword_t)) + /* * The buffer size must be a multiple of dword to ensure that MCDI works * properly with Siena based boards (which use on-chip buffer). Also, it @@ -402,9 +407,7 @@ efx_mcdi_phy_module_get_info( * error responses if the request/response buffer sizes are smaller. */ #define EFX_MCDI_DECLARE_BUF(_name, _in_len, _out_len) \ - uint8_t _name[P2ROUNDUP(MAX(MAX(_in_len, _out_len), \ - (2 * sizeof (efx_dword_t))), \ - sizeof (efx_dword_t))] = {0} + uint8_t _name[EFX_MCDI_BUF_SIZE(_in_len, _out_len)] = {0} typedef enum efx_mcdi_feature_id_e { EFX_MCDI_FEATURE_FW_UPDATE = 0, Modified: stable/12/sys/dev/sfxge/common/efx_tx.c ============================================================================== --- stable/12/sys/dev/sfxge/common/efx_tx.c Mon Jul 29 09:19:48 2019 (r350404) +++ stable/12/sys/dev/sfxge/common/efx_tx.c Mon Jul 29 09:25:16 2019 (r350405) @@ -772,7 +772,7 @@ siena_tx_qpost( * Fragments must not span 4k boundaries. * Here it is a stricter requirement than the maximum length. */ - EFSYS_ASSERT(P2ROUNDUP(start + 1, + EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, start + 1, etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= end); EFX_TX_DESC(etp, start, size, ebp->eb_eop, added); @@ -1046,7 +1046,7 @@ siena_tx_qdesc_dma_create( * Fragments must not span 4k boundaries. * Here it is a stricter requirement than the maximum length. */ - EFSYS_ASSERT(P2ROUNDUP(addr + 1, + EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, addr + 1, etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= addr + size); EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index, Modified: stable/12/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/12/sys/dev/sfxge/sfxge_rx.c Mon Jul 29 09:19:48 2019 (r350404) +++ stable/12/sys/dev/sfxge/sfxge_rx.c Mon Jul 29 09:25:16 2019 (r350405) @@ -273,7 +273,8 @@ sfxge_rx_qfill(struct sfxge_rxq *rxq, unsigned int tar /* m_len specifies length of area to be mapped for DMA */ m->m_len = mblksize; - m->m_data = (caddr_t)P2ROUNDUP((uintptr_t)m->m_data, CACHE_LINE_SIZE); + m->m_data = (caddr_t)EFX_P2ROUNDUP(uintptr_t, m->m_data, + CACHE_LINE_SIZE); m->m_data += sc->rx_buffer_align; sfxge_map_mbuf_fast(rxq->mem.esm_tag, rxq->mem.esm_map, m, &seg); @@ -1103,14 +1104,14 @@ sfxge_rx_start(struct sfxge_softc *sc) /* Ensure IP headers are 32bit aligned */ hdrlen = sc->rx_prefix_size + sizeof (struct ether_header); - sc->rx_buffer_align = P2ROUNDUP(hdrlen, 4) - hdrlen; + sc->rx_buffer_align = EFX_P2ROUNDUP(size_t, hdrlen, 4) - hdrlen; sc->rx_buffer_size += sc->rx_buffer_align; /* Align end of packet buffer for RX DMA end padding */ align = MAX(1, encp->enc_rx_buf_align_end); EFSYS_ASSERT(ISP2(align)); - sc->rx_buffer_size = P2ROUNDUP(sc->rx_buffer_size, align); + sc->rx_buffer_size = EFX_P2ROUNDUP(size_t, sc->rx_buffer_size, align); /* * Standard mbuf zones only guarantee pointer-size alignment; From owner-svn-src-stable@freebsd.org Mon Jul 29 09:26:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 126CDA3E63; Mon, 29 Jul 2019 09:26:57 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 E6D2170263; Mon, 29 Jul 2019 09:26:56 +0000 (UTC) (envelope-from arybchik@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 B26B02619A; Mon, 29 Jul 2019 09:26:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T9Qu56000785; Mon, 29 Jul 2019 09:26:56 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T9Quod000782; Mon, 29 Jul 2019 09:26:56 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201907290926.x6T9Quod000782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 29 Jul 2019 09:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350406 - stable/12/sys/dev/sfxge/common X-SVN-Group: stable-12 X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: stable/12/sys/dev/sfxge/common X-SVN-Commit-Revision: 350406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6D2170263 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 09:26:57 -0000 Author: arybchik Date: Mon Jul 29 09:26:55 2019 New Revision: 350406 URL: https://svnweb.freebsd.org/changeset/base/350406 Log: MFC r350370 sfxge(4): fix align to power of 2 when align has smaller type Substitute driver-defined P2ALIGN() with EFX_P2ALIGN() defined in libefx. Cast value and alignment to one specified type to guarantee result correctness. Reported by: Andrea Valsania Sponsored by: Solarflare Communications, Inc. Modified: stable/12/sys/dev/sfxge/common/ef10_rx.c stable/12/sys/dev/sfxge/common/efsys.h stable/12/sys/dev/sfxge/common/efx.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sfxge/common/ef10_rx.c ============================================================================== --- stable/12/sys/dev/sfxge/common/ef10_rx.c Mon Jul 29 09:25:16 2019 (r350405) +++ stable/12/sys/dev/sfxge/common/ef10_rx.c Mon Jul 29 09:26:55 2019 (r350406) @@ -689,7 +689,7 @@ ef10_rx_qpush( efx_dword_t dword; /* Hardware has alignment restriction for WPTR */ - wptr = P2ALIGN(added, EF10_RX_WPTR_ALIGN); + wptr = EFX_P2ALIGN(unsigned int, added, EF10_RX_WPTR_ALIGN); if (pushed == wptr) return; Modified: stable/12/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efsys.h Mon Jul 29 09:25:16 2019 (r350405) +++ stable/12/sys/dev/sfxge/common/efsys.h Mon Jul 29 09:26:55 2019 (r350406) @@ -93,10 +93,6 @@ extern "C" { #define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) #endif -#ifndef P2ALIGN -#define P2ALIGN(_x, _a) ((_x) & -(_a)) -#endif - #ifndef IS2P #define ISP2(x) (((x) & ((x) - 1)) == 0) #endif Modified: stable/12/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efx.h Mon Jul 29 09:25:16 2019 (r350405) +++ stable/12/sys/dev/sfxge/common/efx.h Mon Jul 29 09:26:55 2019 (r350406) @@ -56,6 +56,10 @@ extern "C" { #define EFX_P2ROUNDUP(_type, _value, _align) \ (-(-(_type)(_value) & -(_type)(_align))) +/* Align value down to the nearest power of two. */ +#define EFX_P2ALIGN(_type, _value, _align) \ + ((_type)(_value) & -(_type)(_align)) + /* Return codes */ typedef __success(return == 0) int efx_rc_t; From owner-svn-src-stable@freebsd.org Mon Jul 29 09:34:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 278E8A424A; Mon, 29 Jul 2019 09:34:48 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 08AD57089D; Mon, 29 Jul 2019 09:34:48 +0000 (UTC) (envelope-from arybchik@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 C693A2638C; Mon, 29 Jul 2019 09:34:47 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T9YleM006325; Mon, 29 Jul 2019 09:34:47 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T9Yl0m006324; Mon, 29 Jul 2019 09:34:47 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201907290934.x6T9Yl0m006324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 29 Jul 2019 09:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350407 - stable/12/sys/dev/sfxge/common X-SVN-Group: stable-12 X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: stable/12/sys/dev/sfxge/common X-SVN-Commit-Revision: 350407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 08AD57089D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 09:34:48 -0000 Author: arybchik Date: Mon Jul 29 09:34:47 2019 New Revision: 350407 URL: https://svnweb.freebsd.org/changeset/base/350407 Log: MFC r350371 sfxge(4): unify power of 2 alignment check macro Substitute driver-defined IS_P2ALIGNED() with EFX_IS_P2ALIGNED() defined in libefx. Add type argument and cast value and alignment to one specified type. Reported by: Andrea Valsania Sponsored by: Solarflare Communications, Inc. Modified: stable/12/sys/dev/sfxge/common/efsys.h stable/12/sys/dev/sfxge/common/efx.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efsys.h Mon Jul 29 09:26:55 2019 (r350406) +++ stable/12/sys/dev/sfxge/common/efsys.h Mon Jul 29 09:34:47 2019 (r350407) @@ -89,10 +89,6 @@ extern "C" { #define B_TRUE TRUE #endif -#ifndef IS_P2ALIGNED -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) -#endif - #ifndef IS2P #define ISP2(x) (((x) & ((x) - 1)) == 0) #endif @@ -394,7 +390,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -413,7 +410,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -432,7 +430,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -454,7 +453,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -476,7 +476,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -501,7 +502,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE2(mem_writed, unsigned int, (_offset), \ @@ -520,7 +522,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE3(mem_writeq, unsigned int, (_offset), \ @@ -540,7 +543,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE3(mem_writeq, unsigned int, (_offset), \ @@ -562,7 +566,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE5(mem_writeo, unsigned int, (_offset), \ @@ -584,7 +589,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE5(mem_writeo, unsigned int, (_offset), \ @@ -642,7 +648,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READD(_esbp, _offset, _edp, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -666,7 +673,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -686,7 +694,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -716,7 +725,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -739,7 +749,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -775,7 +786,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITED(_esbp, _offset, _edp, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -807,7 +819,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -835,7 +848,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -879,7 +893,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WC_WRITEQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ (void) (_esbp); \ @@ -894,7 +909,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -940,7 +956,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ Modified: stable/12/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/12/sys/dev/sfxge/common/efx.h Mon Jul 29 09:26:55 2019 (r350406) +++ stable/12/sys/dev/sfxge/common/efx.h Mon Jul 29 09:34:47 2019 (r350407) @@ -60,6 +60,10 @@ extern "C" { #define EFX_P2ALIGN(_type, _value, _align) \ ((_type)(_value) & -(_type)(_align)) +/* Test if value is power of 2 aligned. */ +#define EFX_IS_P2ALIGNED(_type, _value, _align) \ + ((((_type)(_value)) & ((_type)(_align) - 1)) == 0) + /* Return codes */ typedef __success(return == 0) int efx_rc_t; From owner-svn-src-stable@freebsd.org Mon Jul 29 10:41:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B233A5882; Mon, 29 Jul 2019 10:41:23 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 5408576C1C; Mon, 29 Jul 2019 10:41:23 +0000 (UTC) (envelope-from arybchik@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 22E6A26E97; Mon, 29 Jul 2019 10:41:23 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TAfNZC043563; Mon, 29 Jul 2019 10:41:23 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TAfLwk043557; Mon, 29 Jul 2019 10:41:21 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201907291041.x6TAfLwk043557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 29 Jul 2019 10:41:21 +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: r350409 - in stable/11/sys/dev/sfxge: . common X-SVN-Group: stable-11 X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: in stable/11/sys/dev/sfxge: . common X-SVN-Commit-Revision: 350409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5408576C1C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 10:41:23 -0000 Author: arybchik Date: Mon Jul 29 10:41:21 2019 New Revision: 350409 URL: https://svnweb.freebsd.org/changeset/base/350409 Log: MFC r350369 sfxge(4): fix power of 2 round up when align has smaller type Substitute driver-defined P2ROUNDUP() h with EFX_P2ROUNDUP() defined in libefx. Cast value and alignment to one specified type to guarantee result correctness. Reported by: Andrea Valsania Sponsored by: Solarflare Communications, Inc. Modified: stable/11/sys/dev/sfxge/common/ef10_nvram.c stable/11/sys/dev/sfxge/common/efsys.h stable/11/sys/dev/sfxge/common/efx.h stable/11/sys/dev/sfxge/common/efx_mcdi.h stable/11/sys/dev/sfxge/common/efx_tx.c stable/11/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sfxge/common/ef10_nvram.c ============================================================================== --- stable/11/sys/dev/sfxge/common/ef10_nvram.c Mon Jul 29 10:40:51 2019 (r350408) +++ stable/11/sys/dev/sfxge/common/ef10_nvram.c Mon Jul 29 10:41:21 2019 (r350409) @@ -394,7 +394,8 @@ tlv_write( if (len > 0) { ptr[(len - 1) / sizeof (uint32_t)] = 0; memcpy(ptr, data, len); - ptr += P2ROUNDUP(len, sizeof (uint32_t)) / sizeof (*ptr); + ptr += EFX_P2ROUNDUP(uint32_t, len, + sizeof (uint32_t)) / sizeof (*ptr); } return (ptr); Modified: stable/11/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efsys.h Mon Jul 29 10:40:51 2019 (r350408) +++ stable/11/sys/dev/sfxge/common/efsys.h Mon Jul 29 10:41:21 2019 (r350409) @@ -91,10 +91,6 @@ extern "C" { #define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) #endif -#ifndef P2ROUNDUP -#define P2ROUNDUP(x, align) (-(-(x) & -(align))) -#endif - #ifndef P2ALIGN #define P2ALIGN(_x, _a) ((_x) & -(_a)) #endif Modified: stable/11/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efx.h Mon Jul 29 10:40:51 2019 (r350408) +++ stable/11/sys/dev/sfxge/common/efx.h Mon Jul 29 10:41:21 2019 (r350409) @@ -50,6 +50,10 @@ extern "C" { #define EFX_FIELD_OFFSET(_type, _field) \ ((size_t) &(((_type *)0)->_field)) +/* Round value up to the nearest power of two. */ +#define EFX_P2ROUNDUP(_type, _value, _align) \ + (-(-(_type)(_value) & -(_type)(_align))) + /* Return codes */ typedef __success(return == 0) int efx_rc_t; @@ -449,10 +453,10 @@ typedef enum efx_link_mode_e { + /* bug16011 */ 16) \ #define EFX_MAC_PDU(_sdu) \ - P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8) + EFX_P2ROUNDUP(size_t, (_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8) /* - * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give + * Due to the EFX_P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give * the SDU rounded up slightly. */ #define EFX_MAC_SDU_FROM_PDU(_pdu) ((_pdu) - EFX_MAC_PDU_ADJUSTMENT) @@ -538,8 +542,9 @@ efx_mac_stat_name( #define EFX_MAC_STATS_MASK_BITS_PER_PAGE (8 * sizeof (uint32_t)) -#define EFX_MAC_STATS_MASK_NPAGES \ - (P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \ +#define EFX_MAC_STATS_MASK_NPAGES \ + (EFX_P2ROUNDUP(uint32_t, EFX_MAC_NSTATS, \ + EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \ EFX_MAC_STATS_MASK_BITS_PER_PAGE) /* Modified: stable/11/sys/dev/sfxge/common/efx_mcdi.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efx_mcdi.h Mon Jul 29 10:40:51 2019 (r350408) +++ stable/11/sys/dev/sfxge/common/efx_mcdi.h Mon Jul 29 10:41:21 2019 (r350409) @@ -393,6 +393,11 @@ efx_mcdi_phy_module_get_info( (((mask) & (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) == \ (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) +#define EFX_MCDI_BUF_SIZE(_in_len, _out_len) \ + EFX_P2ROUNDUP(size_t, \ + MAX(MAX(_in_len, _out_len), (2 * sizeof (efx_dword_t))),\ + sizeof (efx_dword_t)) + /* * The buffer size must be a multiple of dword to ensure that MCDI works * properly with Siena based boards (which use on-chip buffer). Also, it @@ -400,9 +405,7 @@ efx_mcdi_phy_module_get_info( * error responses if the request/response buffer sizes are smaller. */ #define EFX_MCDI_DECLARE_BUF(_name, _in_len, _out_len) \ - uint8_t _name[P2ROUNDUP(MAX(MAX(_in_len, _out_len), \ - (2 * sizeof (efx_dword_t))), \ - sizeof (efx_dword_t))] = {0} + uint8_t _name[EFX_MCDI_BUF_SIZE(_in_len, _out_len)] = {0} typedef enum efx_mcdi_feature_id_e { EFX_MCDI_FEATURE_FW_UPDATE = 0, Modified: stable/11/sys/dev/sfxge/common/efx_tx.c ============================================================================== --- stable/11/sys/dev/sfxge/common/efx_tx.c Mon Jul 29 10:40:51 2019 (r350408) +++ stable/11/sys/dev/sfxge/common/efx_tx.c Mon Jul 29 10:41:21 2019 (r350409) @@ -770,7 +770,7 @@ siena_tx_qpost( * Fragments must not span 4k boundaries. * Here it is a stricter requirement than the maximum length. */ - EFSYS_ASSERT(P2ROUNDUP(start + 1, + EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, start + 1, etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= end); EFX_TX_DESC(etp, start, size, ebp->eb_eop, added); @@ -1044,7 +1044,7 @@ siena_tx_qdesc_dma_create( * Fragments must not span 4k boundaries. * Here it is a stricter requirement than the maximum length. */ - EFSYS_ASSERT(P2ROUNDUP(addr + 1, + EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, addr + 1, etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= addr + size); EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index, Modified: stable/11/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/11/sys/dev/sfxge/sfxge_rx.c Mon Jul 29 10:40:51 2019 (r350408) +++ stable/11/sys/dev/sfxge/sfxge_rx.c Mon Jul 29 10:41:21 2019 (r350409) @@ -271,7 +271,8 @@ sfxge_rx_qfill(struct sfxge_rxq *rxq, unsigned int tar /* m_len specifies length of area to be mapped for DMA */ m->m_len = mblksize; - m->m_data = (caddr_t)P2ROUNDUP((uintptr_t)m->m_data, CACHE_LINE_SIZE); + m->m_data = (caddr_t)EFX_P2ROUNDUP(uintptr_t, m->m_data, + CACHE_LINE_SIZE); m->m_data += sc->rx_buffer_align; sfxge_map_mbuf_fast(rxq->mem.esm_tag, rxq->mem.esm_map, m, &seg); @@ -1101,14 +1102,14 @@ sfxge_rx_start(struct sfxge_softc *sc) /* Ensure IP headers are 32bit aligned */ hdrlen = sc->rx_prefix_size + sizeof (struct ether_header); - sc->rx_buffer_align = P2ROUNDUP(hdrlen, 4) - hdrlen; + sc->rx_buffer_align = EFX_P2ROUNDUP(size_t, hdrlen, 4) - hdrlen; sc->rx_buffer_size += sc->rx_buffer_align; /* Align end of packet buffer for RX DMA end padding */ align = MAX(1, encp->enc_rx_buf_align_end); EFSYS_ASSERT(ISP2(align)); - sc->rx_buffer_size = P2ROUNDUP(sc->rx_buffer_size, align); + sc->rx_buffer_size = EFX_P2ROUNDUP(size_t, sc->rx_buffer_size, align); /* * Standard mbuf zones only guarantee pointer-size alignment; From owner-svn-src-stable@freebsd.org Mon Jul 29 10:42:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8112BA5977; Mon, 29 Jul 2019 10:42:23 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 48BDA76FAC; Mon, 29 Jul 2019 10:42:23 +0000 (UTC) (envelope-from arybchik@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 4B43D26FE4; Mon, 29 Jul 2019 10:42:22 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TAgMh1047523; Mon, 29 Jul 2019 10:42:22 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TAgLIv047521; Mon, 29 Jul 2019 10:42:21 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201907291042.x6TAgLIv047521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 29 Jul 2019 10:42:21 +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: r350411 - stable/11/sys/dev/sfxge/common X-SVN-Group: stable-11 X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: stable/11/sys/dev/sfxge/common X-SVN-Commit-Revision: 350411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 48BDA76FAC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 10:42:23 -0000 Author: arybchik Date: Mon Jul 29 10:42:21 2019 New Revision: 350411 URL: https://svnweb.freebsd.org/changeset/base/350411 Log: MFC r350370 sfxge(4): fix align to power of 2 when align has smaller type Substitute driver-defined P2ALIGN() with EFX_P2ALIGN() defined in libefx. Cast value and alignment to one specified type to guarantee result correctness. Reported by: Andrea Valsania Sponsored by: Solarflare Communications, Inc. Modified: stable/11/sys/dev/sfxge/common/ef10_rx.c stable/11/sys/dev/sfxge/common/efsys.h stable/11/sys/dev/sfxge/common/efx.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sfxge/common/ef10_rx.c ============================================================================== --- stable/11/sys/dev/sfxge/common/ef10_rx.c Mon Jul 29 10:42:15 2019 (r350410) +++ stable/11/sys/dev/sfxge/common/ef10_rx.c Mon Jul 29 10:42:21 2019 (r350411) @@ -689,7 +689,7 @@ ef10_rx_qpush( efx_dword_t dword; /* Hardware has alignment restriction for WPTR */ - wptr = P2ALIGN(added, EF10_RX_WPTR_ALIGN); + wptr = EFX_P2ALIGN(unsigned int, added, EF10_RX_WPTR_ALIGN); if (pushed == wptr) return; Modified: stable/11/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efsys.h Mon Jul 29 10:42:15 2019 (r350410) +++ stable/11/sys/dev/sfxge/common/efsys.h Mon Jul 29 10:42:21 2019 (r350411) @@ -91,10 +91,6 @@ extern "C" { #define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) #endif -#ifndef P2ALIGN -#define P2ALIGN(_x, _a) ((_x) & -(_a)) -#endif - #ifndef IS2P #define ISP2(x) (((x) & ((x) - 1)) == 0) #endif Modified: stable/11/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efx.h Mon Jul 29 10:42:15 2019 (r350410) +++ stable/11/sys/dev/sfxge/common/efx.h Mon Jul 29 10:42:21 2019 (r350411) @@ -54,6 +54,10 @@ extern "C" { #define EFX_P2ROUNDUP(_type, _value, _align) \ (-(-(_type)(_value) & -(_type)(_align))) +/* Align value down to the nearest power of two. */ +#define EFX_P2ALIGN(_type, _value, _align) \ + ((_type)(_value) & -(_type)(_align)) + /* Return codes */ typedef __success(return == 0) int efx_rc_t; From owner-svn-src-stable@freebsd.org Mon Jul 29 10:44:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0A40A5B0F; Mon, 29 Jul 2019 10:44:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 9FD7577266; Mon, 29 Jul 2019 10:44:05 +0000 (UTC) (envelope-from arybchik@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 699A92702E; Mon, 29 Jul 2019 10:44:05 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6TAi5x9047682; Mon, 29 Jul 2019 10:44:05 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TAi4Yn047680; Mon, 29 Jul 2019 10:44:04 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201907291044.x6TAi4Yn047680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 29 Jul 2019 10:44: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: r350412 - stable/11/sys/dev/sfxge/common X-SVN-Group: stable-11 X-SVN-Commit-Author: arybchik X-SVN-Commit-Paths: stable/11/sys/dev/sfxge/common X-SVN-Commit-Revision: 350412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9FD7577266 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 10:44:05 -0000 Author: arybchik Date: Mon Jul 29 10:44:04 2019 New Revision: 350412 URL: https://svnweb.freebsd.org/changeset/base/350412 Log: MFC r350371 sfxge(4): unify power of 2 alignment check macro Substitute driver-defined IS_P2ALIGNED() with EFX_IS_P2ALIGNED() defined in libefx. Add type argument and cast value and alignment to one specified type. Reported by: Andrea Valsania Sponsored by: Solarflare Communications, Inc. Modified: stable/11/sys/dev/sfxge/common/efsys.h stable/11/sys/dev/sfxge/common/efx.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efsys.h Mon Jul 29 10:42:21 2019 (r350411) +++ stable/11/sys/dev/sfxge/common/efsys.h Mon Jul 29 10:44:04 2019 (r350412) @@ -87,10 +87,6 @@ extern "C" { #define B_TRUE TRUE #endif -#ifndef IS_P2ALIGNED -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) -#endif - #ifndef IS2P #define ISP2(x) (((x) & ((x) - 1)) == 0) #endif @@ -392,7 +388,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -411,7 +408,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -430,7 +428,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -452,7 +451,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -474,7 +474,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ addr = (void *)((_esmp)->esm_base + (_offset)); \ @@ -499,7 +500,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE2(mem_writed, unsigned int, (_offset), \ @@ -518,7 +520,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE3(mem_writeq, unsigned int, (_offset), \ @@ -538,7 +541,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE3(mem_writeq, unsigned int, (_offset), \ @@ -560,7 +564,8 @@ typedef struct efsys_mem_s { uint64_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE5(mem_writeo, unsigned int, (_offset), \ @@ -582,7 +587,8 @@ typedef struct efsys_mem_s { uint32_t *addr; \ \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ EFSYS_PROBE5(mem_writeo, unsigned int, (_offset), \ @@ -640,7 +646,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READD(_esbp, _offset, _edp, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -664,7 +671,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -684,7 +692,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -714,7 +723,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -737,7 +747,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_READO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -773,7 +784,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITED(_esbp, _offset, _edp, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_dword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_dword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -805,7 +817,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -833,7 +846,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ SFXGE_BAR_LOCK(_esbp); \ @@ -877,7 +891,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WC_WRITEQ(_esbp, _offset, _eqp) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_qword_t)), \ ("not power of 2 aligned")); \ \ (void) (_esbp); \ @@ -892,7 +907,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ @@ -938,7 +954,8 @@ typedef struct efsys_bar_s { #define EFSYS_BAR_WRITEO(_esbp, _offset, _eop, _lock) \ do { \ _NOTE(CONSTANTCONDITION) \ - KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)), \ + KASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof (efx_oword_t)), \ ("not power of 2 aligned")); \ \ _NOTE(CONSTANTCONDITION) \ Modified: stable/11/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/11/sys/dev/sfxge/common/efx.h Mon Jul 29 10:42:21 2019 (r350411) +++ stable/11/sys/dev/sfxge/common/efx.h Mon Jul 29 10:44:04 2019 (r350412) @@ -58,6 +58,10 @@ extern "C" { #define EFX_P2ALIGN(_type, _value, _align) \ ((_type)(_value) & -(_type)(_align)) +/* Test if value is power of 2 aligned. */ +#define EFX_IS_P2ALIGNED(_type, _value, _align) \ + ((((_type)(_value)) & ((_type)(_align) - 1)) == 0) + /* Return codes */ typedef __success(return == 0) int efx_rc_t; From owner-svn-src-stable@freebsd.org Mon Jul 29 18:02:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B60FCB12F0; Mon, 29 Jul 2019 18:02:49 +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 9817D8D600; Mon, 29 Jul 2019 18:02:49 +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 6F06443AC; Mon, 29 Jul 2019 18:02:49 +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 x6TI2n6R006216; Mon, 29 Jul 2019 18:02:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TI2n3l006215; Mon, 29 Jul 2019 18:02:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907291802.x6TI2n3l006215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jul 2019 18:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350419 - in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Commit-Revision: 350419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9817D8D600 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 18:02:49 -0000 Author: dim Date: Mon Jul 29 18:02:48 2019 New Revision: 350419 URL: https://svnweb.freebsd.org/changeset/base/350419 Log: MFC r350362: Pull in r366369 from upstream llvm trunk (by Francis Visoiu Mistrih): [CodeGen][NFC] Simplify checks for stack protector index checking Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex() >= 0`. Pull in r366371 from upstream llvm trunk (by Francis Visoiu Mistrih): [PEI] Don't re-allocate a pre-allocated stack protector slot The LocalStackSlotPass pre-allocates a stack protector and makes sure that it comes before the local variables on the stack. We need to make sure that later during PEI we don't re-allocate a new stack protector slot. If that happens, the new stack protector slot will end up being **after** the local variables that it should be protecting. Therefore, we would have two slots assigned for two different stack protectors, one at the top of the stack, and one at the bottom. Since PEI will overwrite the assigned slot for the stack protector, the load that is used to compare the value of the stack protector will use the slot assigned by PEI, which is wrong. For this, we need to check if the object is pre-allocated, and re-use that pre-allocated slot. Differential Revision: https://reviews.llvm.org/D64757 Pull in r367068 from upstream llvm trunk (by Francis Visoiu Mistrih): [CodeGen] Don't resolve the stack protector frame accesses until PEI Currently, stack protector loads and stores are resolved during LocalStackSlotAllocation (if the pass needs to run). When this is the case, the base register assigned to the frame access is going to be one of the vregs created during LocalStackSlotAllocation. This means that we are keeping a pointer to the stack protector slot, and we're using this pointer to load and store to it. In case register pressure goes up, we may end up spilling this pointer to the stack, which can be a security concern. Instead, leave it to PEI to resolve the frame accesses. In order to do that, we make all stack protector accesses go through frame index operands, then PEI will resolve this using an offset from sp/fp/bp. Differential Revision: https://reviews.llvm.org/D64759 Together, these fix a issue where the stack protection feature in LLVM's ARM backend can be rendered ineffective when the stack protector slot is re-allocated so that it appears after the local variables that it is meant to protect, leaving the function potentially vulnerable to a stack-based buffer overflow. Reported by: andrew Security: https://kb.cert.org/vuls/id/129209/ Modified: stable/12/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp stable/12/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp stable/11/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp ============================================================================== --- stable/12/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp Mon Jul 29 16:32:23 2019 (r350418) +++ stable/12/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp Mon Jul 29 18:02:48 2019 (r350419) @@ -200,19 +200,27 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(M // Make sure that the stack protector comes before the local variables on the // stack. SmallSet ProtectedObjs; - if (MFI.getStackProtectorIndex() >= 0) { + if (MFI.hasStackProtectorIndex()) { + int StackProtectorFI = MFI.getStackProtectorIndex(); + + // We need to make sure we didn't pre-allocate the stack protector when + // doing this. + // If we already have a stack protector, this will re-assign it to a slot + // that is **not** covering the protected objects. + assert(!MFI.isObjectPreAllocated(StackProtectorFI) && + "Stack protector pre-allocated in LocalStackSlotAllocation"); + StackObjSet LargeArrayObjs; StackObjSet SmallArrayObjs; StackObjSet AddrOfObjs; - AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), Offset, - StackGrowsDown, MaxAlign); + AdjustStackOffset(MFI, StackProtectorFI, Offset, StackGrowsDown, MaxAlign); // Assign large stack objects first. for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) { if (MFI.isDeadObjectIndex(i)) continue; - if (MFI.getStackProtectorIndex() == (int)i) + if (StackProtectorFI == (int)i) continue; switch (MFI.getObjectSSPLayout(i)) { @@ -343,6 +351,14 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters int FrameIdx = FR.getFrameIndex(); assert(MFI.isObjectPreAllocated(FrameIdx) && "Only pre-allocated locals expected!"); + + // We need to keep the references to the stack protector slot through frame + // index operands so that it gets resolved by PEI rather than this pass. + // This avoids accesses to the stack protector though virtual base + // registers, and forces PEI to address it using fp/sp/bp. + if (MFI.hasStackProtectorIndex() && + FrameIdx == MFI.getStackProtectorIndex()) + continue; LLVM_DEBUG(dbgs() << "Considering: " << MI); Modified: stable/12/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp ============================================================================== --- stable/12/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Mon Jul 29 16:32:23 2019 (r350418) +++ stable/12/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Mon Jul 29 18:02:48 2019 (r350419) @@ -845,18 +845,26 @@ void PEI::calculateFrameObjectOffsets(MachineFunction // Make sure that the stack protector comes before the local variables on the // stack. SmallSet ProtectedObjs; - if (MFI.getStackProtectorIndex() >= 0) { + if (MFI.hasStackProtectorIndex()) { + int StackProtectorFI = MFI.getStackProtectorIndex(); StackObjSet LargeArrayObjs; StackObjSet SmallArrayObjs; StackObjSet AddrOfObjs; - AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), StackGrowsDown, - Offset, MaxAlign, Skew); + // If we need a stack protector, we need to make sure that + // LocalStackSlotPass didn't already allocate a slot for it. + // If we are told to use the LocalStackAllocationBlock, the stack protector + // is expected to be already pre-allocated. + if (!MFI.getUseLocalStackAllocationBlock()) + AdjustStackOffset(MFI, StackProtectorFI, StackGrowsDown, Offset, MaxAlign, + Skew); + else if (!MFI.isObjectPreAllocated(MFI.getStackProtectorIndex())) + llvm_unreachable( + "Stack protector not pre-allocated by LocalStackSlotPass."); // Assign large stack objects first. for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) { - if (MFI.isObjectPreAllocated(i) && - MFI.getUseLocalStackAllocationBlock()) + if (MFI.isObjectPreAllocated(i) && MFI.getUseLocalStackAllocationBlock()) continue; if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex) continue; @@ -864,8 +872,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction continue; if (MFI.isDeadObjectIndex(i)) continue; - if (MFI.getStackProtectorIndex() == (int)i || - EHRegNodeFrameIndex == (int)i) + if (StackProtectorFI == (int)i || EHRegNodeFrameIndex == (int)i) continue; switch (MFI.getObjectSSPLayout(i)) { @@ -884,6 +891,15 @@ void PEI::calculateFrameObjectOffsets(MachineFunction llvm_unreachable("Unexpected SSPLayoutKind."); } + // We expect **all** the protected stack objects to be pre-allocated by + // LocalStackSlotPass. If it turns out that PEI still has to allocate some + // of them, we may end up messing up the expected order of the objects. + if (MFI.getUseLocalStackAllocationBlock() && + !(LargeArrayObjs.empty() && SmallArrayObjs.empty() && + AddrOfObjs.empty())) + llvm_unreachable("Found protected stack objects not pre-allocated by " + "LocalStackSlotPass."); + AssignProtectedObjSet(LargeArrayObjs, ProtectedObjs, MFI, StackGrowsDown, Offset, MaxAlign, Skew); AssignProtectedObjSet(SmallArrayObjs, ProtectedObjs, MFI, StackGrowsDown, @@ -905,8 +921,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction continue; if (MFI.isDeadObjectIndex(i)) continue; - if (MFI.getStackProtectorIndex() == (int)i || - EHRegNodeFrameIndex == (int)i) + if (MFI.getStackProtectorIndex() == (int)i || EHRegNodeFrameIndex == (int)i) continue; if (ProtectedObjs.count(i)) continue; From owner-svn-src-stable@freebsd.org Mon Jul 29 18:02:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45F84B12F5; Mon, 29 Jul 2019 18:02:50 +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 0FDA68D601; Mon, 29 Jul 2019 18:02:50 +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 DCC9943AD; Mon, 29 Jul 2019 18:02:49 +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 x6TI2n6e006223; Mon, 29 Jul 2019 18:02:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6TI2nJP006221; Mon, 29 Jul 2019 18:02:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907291802.x6TI2nJP006221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 29 Jul 2019 18:02:49 +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: r350419 - in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Commit-Revision: 350419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0FDA68D601 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2019 18:02:50 -0000 Author: dim Date: Mon Jul 29 18:02:48 2019 New Revision: 350419 URL: https://svnweb.freebsd.org/changeset/base/350419 Log: MFC r350362: Pull in r366369 from upstream llvm trunk (by Francis Visoiu Mistrih): [CodeGen][NFC] Simplify checks for stack protector index checking Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex() >= 0`. Pull in r366371 from upstream llvm trunk (by Francis Visoiu Mistrih): [PEI] Don't re-allocate a pre-allocated stack protector slot The LocalStackSlotPass pre-allocates a stack protector and makes sure that it comes before the local variables on the stack. We need to make sure that later during PEI we don't re-allocate a new stack protector slot. If that happens, the new stack protector slot will end up being **after** the local variables that it should be protecting. Therefore, we would have two slots assigned for two different stack protectors, one at the top of the stack, and one at the bottom. Since PEI will overwrite the assigned slot for the stack protector, the load that is used to compare the value of the stack protector will use the slot assigned by PEI, which is wrong. For this, we need to check if the object is pre-allocated, and re-use that pre-allocated slot. Differential Revision: https://reviews.llvm.org/D64757 Pull in r367068 from upstream llvm trunk (by Francis Visoiu Mistrih): [CodeGen] Don't resolve the stack protector frame accesses until PEI Currently, stack protector loads and stores are resolved during LocalStackSlotAllocation (if the pass needs to run). When this is the case, the base register assigned to the frame access is going to be one of the vregs created during LocalStackSlotAllocation. This means that we are keeping a pointer to the stack protector slot, and we're using this pointer to load and store to it. In case register pressure goes up, we may end up spilling this pointer to the stack, which can be a security concern. Instead, leave it to PEI to resolve the frame accesses. In order to do that, we make all stack protector accesses go through frame index operands, then PEI will resolve this using an offset from sp/fp/bp. Differential Revision: https://reviews.llvm.org/D64759 Together, these fix a issue where the stack protection feature in LLVM's ARM backend can be rendered ineffective when the stack protector slot is re-allocated so that it appears after the local variables that it is meant to protect, leaving the function potentially vulnerable to a stack-based buffer overflow. Reported by: andrew Security: https://kb.cert.org/vuls/id/129209/ Modified: stable/11/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp stable/11/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp stable/12/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp Mon Jul 29 16:32:23 2019 (r350418) +++ stable/11/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp Mon Jul 29 18:02:48 2019 (r350419) @@ -200,19 +200,27 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(M // Make sure that the stack protector comes before the local variables on the // stack. SmallSet ProtectedObjs; - if (MFI.getStackProtectorIndex() >= 0) { + if (MFI.hasStackProtectorIndex()) { + int StackProtectorFI = MFI.getStackProtectorIndex(); + + // We need to make sure we didn't pre-allocate the stack protector when + // doing this. + // If we already have a stack protector, this will re-assign it to a slot + // that is **not** covering the protected objects. + assert(!MFI.isObjectPreAllocated(StackProtectorFI) && + "Stack protector pre-allocated in LocalStackSlotAllocation"); + StackObjSet LargeArrayObjs; StackObjSet SmallArrayObjs; StackObjSet AddrOfObjs; - AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), Offset, - StackGrowsDown, MaxAlign); + AdjustStackOffset(MFI, StackProtectorFI, Offset, StackGrowsDown, MaxAlign); // Assign large stack objects first. for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) { if (MFI.isDeadObjectIndex(i)) continue; - if (MFI.getStackProtectorIndex() == (int)i) + if (StackProtectorFI == (int)i) continue; switch (MFI.getObjectSSPLayout(i)) { @@ -343,6 +351,14 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters int FrameIdx = FR.getFrameIndex(); assert(MFI.isObjectPreAllocated(FrameIdx) && "Only pre-allocated locals expected!"); + + // We need to keep the references to the stack protector slot through frame + // index operands so that it gets resolved by PEI rather than this pass. + // This avoids accesses to the stack protector though virtual base + // registers, and forces PEI to address it using fp/sp/bp. + if (MFI.hasStackProtectorIndex() && + FrameIdx == MFI.getStackProtectorIndex()) + continue; LLVM_DEBUG(dbgs() << "Considering: " << MI); Modified: stable/11/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Mon Jul 29 16:32:23 2019 (r350418) +++ stable/11/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp Mon Jul 29 18:02:48 2019 (r350419) @@ -845,18 +845,26 @@ void PEI::calculateFrameObjectOffsets(MachineFunction // Make sure that the stack protector comes before the local variables on the // stack. SmallSet ProtectedObjs; - if (MFI.getStackProtectorIndex() >= 0) { + if (MFI.hasStackProtectorIndex()) { + int StackProtectorFI = MFI.getStackProtectorIndex(); StackObjSet LargeArrayObjs; StackObjSet SmallArrayObjs; StackObjSet AddrOfObjs; - AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), StackGrowsDown, - Offset, MaxAlign, Skew); + // If we need a stack protector, we need to make sure that + // LocalStackSlotPass didn't already allocate a slot for it. + // If we are told to use the LocalStackAllocationBlock, the stack protector + // is expected to be already pre-allocated. + if (!MFI.getUseLocalStackAllocationBlock()) + AdjustStackOffset(MFI, StackProtectorFI, StackGrowsDown, Offset, MaxAlign, + Skew); + else if (!MFI.isObjectPreAllocated(MFI.getStackProtectorIndex())) + llvm_unreachable( + "Stack protector not pre-allocated by LocalStackSlotPass."); // Assign large stack objects first. for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) { - if (MFI.isObjectPreAllocated(i) && - MFI.getUseLocalStackAllocationBlock()) + if (MFI.isObjectPreAllocated(i) && MFI.getUseLocalStackAllocationBlock()) continue; if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex) continue; @@ -864,8 +872,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction continue; if (MFI.isDeadObjectIndex(i)) continue; - if (MFI.getStackProtectorIndex() == (int)i || - EHRegNodeFrameIndex == (int)i) + if (StackProtectorFI == (int)i || EHRegNodeFrameIndex == (int)i) continue; switch (MFI.getObjectSSPLayout(i)) { @@ -884,6 +891,15 @@ void PEI::calculateFrameObjectOffsets(MachineFunction llvm_unreachable("Unexpected SSPLayoutKind."); } + // We expect **all** the protected stack objects to be pre-allocated by + // LocalStackSlotPass. If it turns out that PEI still has to allocate some + // of them, we may end up messing up the expected order of the objects. + if (MFI.getUseLocalStackAllocationBlock() && + !(LargeArrayObjs.empty() && SmallArrayObjs.empty() && + AddrOfObjs.empty())) + llvm_unreachable("Found protected stack objects not pre-allocated by " + "LocalStackSlotPass."); + AssignProtectedObjSet(LargeArrayObjs, ProtectedObjs, MFI, StackGrowsDown, Offset, MaxAlign, Skew); AssignProtectedObjSet(SmallArrayObjs, ProtectedObjs, MFI, StackGrowsDown, @@ -905,8 +921,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction continue; if (MFI.isDeadObjectIndex(i)) continue; - if (MFI.getStackProtectorIndex() == (int)i || - EHRegNodeFrameIndex == (int)i) + if (MFI.getStackProtectorIndex() == (int)i || EHRegNodeFrameIndex == (int)i) continue; if (ProtectedObjs.count(i)) continue; From owner-svn-src-stable@freebsd.org Tue Jul 30 03:32:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FF1EBF7ED; Tue, 30 Jul 2019 03:32:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 41F6C89457; Tue, 30 Jul 2019 03:32:40 +0000 (UTC) (envelope-from cy@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 1E1A0ADD9; Tue, 30 Jul 2019 03:32:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6U3Wdln045317; Tue, 30 Jul 2019 03:32:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6U3Wd5B045316; Tue, 30 Jul 2019 03:32:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907300332.x6U3Wd5B045316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 30 Jul 2019 03:32:39 +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: r350434 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 350434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 41F6C89457 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jul 2019 03:32:40 -0000 Author: cy Date: Tue Jul 30 03:32:39 2019 New Revision: 350434 URL: https://svnweb.freebsd.org/changeset/base/350434 Log: MFC r350064: As of upstream fil.c CVS r1.53 (March 1, 2009), prior to the import of ipfilter 5.1.2 into FreeBSD-10, the fix for, 2580062 from/to targets should be able to use any interface name, moved frentry.fr_cksum to prior to frentry.fr_func thereby making this code redundant. After investigating whether this fix to move fr_cksum was correct and if it broke anything, it has been determined that the fix is correct and this code is redundant. We remove it here. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Tue Jul 30 02:01:49 2019 (r350433) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Tue Jul 30 03:32:39 2019 (r350434) @@ -4922,9 +4922,6 @@ frrequest(softc, unit, req, data, set, makecopy) * the constant part of the filter rule to make comparisons quicker * (this meaning no pointers are included). */ - for (fp->fr_cksum = 0, p = (u_int *)&fp->fr_func, pp = &fp->fr_cksum; - p < pp; p++) - fp->fr_cksum += *p; pp = (u_int *)(fp->fr_caddr + fp->fr_dsize); for (p = (u_int *)fp->fr_data; p < pp; p++) fp->fr_cksum += *p; From owner-svn-src-stable@freebsd.org Tue Jul 30 03:32:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99E42BF7F1; Tue, 30 Jul 2019 03:32:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 7BB0989458; Tue, 30 Jul 2019 03:32:40 +0000 (UTC) (envelope-from cy@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 57EB9ADDA; Tue, 30 Jul 2019 03:32:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6U3WeT4045323; Tue, 30 Jul 2019 03:32:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6U3Ween045322; Tue, 30 Jul 2019 03:32:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907300332.x6U3Ween045322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 30 Jul 2019 03:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350434 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 350434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7BB0989458 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jul 2019 03:32:40 -0000 Author: cy Date: Tue Jul 30 03:32:39 2019 New Revision: 350434 URL: https://svnweb.freebsd.org/changeset/base/350434 Log: MFC r350064: As of upstream fil.c CVS r1.53 (March 1, 2009), prior to the import of ipfilter 5.1.2 into FreeBSD-10, the fix for, 2580062 from/to targets should be able to use any interface name, moved frentry.fr_cksum to prior to frentry.fr_func thereby making this code redundant. After investigating whether this fix to move fr_cksum was correct and if it broke anything, it has been determined that the fix is correct and this code is redundant. We remove it here. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Tue Jul 30 02:01:49 2019 (r350433) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Tue Jul 30 03:32:39 2019 (r350434) @@ -4922,9 +4922,6 @@ frrequest(softc, unit, req, data, set, makecopy) * the constant part of the filter rule to make comparisons quicker * (this meaning no pointers are included). */ - for (fp->fr_cksum = 0, p = (u_int *)&fp->fr_func, pp = &fp->fr_cksum; - p < pp; p++) - fp->fr_cksum += *p; pp = (u_int *)(fp->fr_caddr + fp->fr_dsize); for (p = (u_int *)fp->fr_data; p < pp; p++) fp->fr_cksum += *p; From owner-svn-src-stable@freebsd.org Tue Jul 30 12:17:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C212A1961; Tue, 30 Jul 2019 12:17:12 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 7DEB197003; Tue, 30 Jul 2019 12:17:12 +0000 (UTC) (envelope-from ganbold@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 4767818DA4; Tue, 30 Jul 2019 12:17:12 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UCHCYC050401; Tue, 30 Jul 2019 12:17:12 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UCHCmU050400; Tue, 30 Jul 2019 12:17:12 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201907301217.x6UCHCmU050400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Tue, 30 Jul 2019 12:17:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350439 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: ganbold X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 350439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DEB197003 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jul 2019 12:17:12 -0000 Author: ganbold Date: Tue Jul 30 12:17:11 2019 New Revision: 350439 URL: https://svnweb.freebsd.org/changeset/base/350439 Log: MFC r346993 Add a hw.model sysctl oid for arm64 which reports the CPU model similar to armv6/7. Modified: stable/12/sys/arm64/arm64/identcpu.c Modified: stable/12/sys/arm64/arm64/identcpu.c ============================================================================== --- stable/12/sys/arm64/arm64/identcpu.c Tue Jul 30 08:53:03 2019 (r350438) +++ stable/12/sys/arm64/arm64/identcpu.c Tue Jul 30 12:17:11 2019 (r350439) @@ -52,6 +52,10 @@ char machine[] = "arm64"; SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "Machine class"); +static char cpu_model[64]; +SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, + cpu_model, sizeof(cpu_model), "Machine model"); + /* * Per-CPU affinity as provided in MPIDR_EL1 * Indexed by CPU number in logical order selected by the system. @@ -1292,6 +1296,10 @@ identify_cpu(void) cpu_desc[cpu].cpu_revision = CPU_REV(midr); cpu_desc[cpu].cpu_variant = CPU_VAR(midr); + + snprintf(cpu_model, sizeof(cpu_model), "%s %s r%dp%d", + cpu_desc[cpu].cpu_impl_name, cpu_desc[cpu].cpu_part_name, + cpu_desc[cpu].cpu_variant, cpu_desc[cpu].cpu_revision); /* Save affinity for current CPU */ cpu_desc[cpu].mpidr = get_mpidr(); From owner-svn-src-stable@freebsd.org Tue Jul 30 14:18:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8BCBA49D6; Tue, 30 Jul 2019 14:18:05 +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 CC0B29B773; Tue, 30 Jul 2019 14:18:05 +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 A466A1A38A; Tue, 30 Jul 2019 14:18:05 +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 x6UEI5wj022036; Tue, 30 Jul 2019 14:18:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UEI5W0022035; Tue, 30 Jul 2019 14:18:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201907301418.x6UEI5W0022035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jul 2019 14:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350441 - stable/12/usr.sbin/mptutil X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.sbin/mptutil X-SVN-Commit-Revision: 350441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CC0B29B773 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jul 2019 14:18:06 -0000 Author: emaste Date: Tue Jul 30 14:18:05 2019 New Revision: 350441 URL: https://svnweb.freebsd.org/changeset/base/350441 Log: MFC r350215: mptutil: emit a warning on big-endian architectures It is known to be broken. PR: 162513 Sponsored by: The FreeBSD Foundation Modified: stable/12/usr.sbin/mptutil/mptutil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mptutil/mptutil.c ============================================================================== --- stable/12/usr.sbin/mptutil/mptutil.c Tue Jul 30 12:51:14 2019 (r350440) +++ stable/12/usr.sbin/mptutil/mptutil.c Tue Jul 30 14:18:05 2019 (r350441) @@ -114,6 +114,10 @@ main(int ac, char **av) if (ac == 0) usage(); +#if BYTE_ORDER == BIG_ENDIAN + warnx("mptutil is known to be broken on big-endian architectures"); +#endif + SET_FOREACH(cmd, MPT_DATASET(top)) { if (strcmp((*cmd)->name, av[0]) == 0) { if ((*cmd)->handler(ac, av)) From owner-svn-src-stable@freebsd.org Tue Jul 30 14:19:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6FC1A4A86; Tue, 30 Jul 2019 14:19:19 +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 88F079B8E4; Tue, 30 Jul 2019 14:19:19 +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 5FA371A38E; Tue, 30 Jul 2019 14:19:19 +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 x6UEJJdt022153; Tue, 30 Jul 2019 14:19:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UEJJt8022152; Tue, 30 Jul 2019 14:19:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201907301419.x6UEJJt8022152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 30 Jul 2019 14:19: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: r350442 - stable/11/usr.sbin/mptutil X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/mptutil X-SVN-Commit-Revision: 350442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 88F079B8E4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jul 2019 14:19:19 -0000 Author: emaste Date: Tue Jul 30 14:19:18 2019 New Revision: 350442 URL: https://svnweb.freebsd.org/changeset/base/350442 Log: MFC r350215: mptutil: emit a warning on big-endian architectures It is known to be broken. PR: 162513 Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/mptutil/mptutil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mptutil/mptutil.c ============================================================================== --- stable/11/usr.sbin/mptutil/mptutil.c Tue Jul 30 14:18:05 2019 (r350441) +++ stable/11/usr.sbin/mptutil/mptutil.c Tue Jul 30 14:19:18 2019 (r350442) @@ -112,6 +112,10 @@ main(int ac, char **av) if (ac == 0) usage(); +#if BYTE_ORDER == BIG_ENDIAN + warnx("mptutil is known to be broken on big-endian architectures"); +#endif + SET_FOREACH(cmd, MPT_DATASET(top)) { if (strcmp((*cmd)->name, av[0]) == 0) { if ((*cmd)->handler(ac, av)) From owner-svn-src-stable@freebsd.org Tue Jul 30 23:50:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3201EB0362; Tue, 30 Jul 2019 23:50:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13FF58652C; Tue, 30 Jul 2019 23:50:50 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0A7220C78; Tue, 30 Jul 2019 23:50:49 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6UNonPm061212; Tue, 30 Jul 2019 23:50:49 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6UNon1f061211; Tue, 30 Jul 2019 23:50:49 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201907302350.x6UNon1f061211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 30 Jul 2019 23:50:49 +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: r350459 - stable/11/sbin/dump X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sbin/dump X-SVN-Commit-Revision: 350459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 13FF58652C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jul 2019 23:50:50 -0000 Author: mckusick Date: Tue Jul 30 23:50:49 2019 New Revision: 350459 URL: https://svnweb.freebsd.org/changeset/base/350459 Log: MFC of 349032 Clarify -r and -R only usable for level 0 dumps. Modified: stable/11/sbin/dump/dump.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/dump/dump.8 ============================================================================== --- stable/11/sbin/dump/dump.8 Tue Jul 30 22:41:25 2019 (r350458) +++ stable/11/sbin/dump/dump.8 Tue Jul 30 23:50:49 2019 (r350459) @@ -29,7 +29,7 @@ .\" @(#)dump.8 8.3 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd October 3, 2016 +.Dd June 13, 2019 .Dt DUMP 8 .Os .Sh NAME @@ -266,6 +266,12 @@ used to update a remote copy of a level 0 dump, since the date changes for each dump. This option sets both dates to the epoch, permitting rsync to be much more efficient when transferring a dump file. +The +.Fl r +option can be used only to create level 0 dumps. +A dump using the +.Fl r +option cannot be used as the basis for a later incremental dump. .It Fl R Be even more rsync-friendly. This option disables the storage of the actual inode access time @@ -277,6 +283,12 @@ The .Fl R option also sets .Fl r . +The +.Fl R +option can be used only to create level 0 dumps. +A dump using the +.Fl R +option cannot be used as the basis for a later incremental dump. .It Fl S Display an estimate of the backup size and the number of tapes required, and exit without actually performing the dump. From owner-svn-src-stable@freebsd.org Wed Jul 31 00:16:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F09D8B0E68; Wed, 31 Jul 2019 00:16:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE1BF87121; Wed, 31 Jul 2019 00:16:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFA5C211B8; Wed, 31 Jul 2019 00:16:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6V0GFqi077068; Wed, 31 Jul 2019 00:16:15 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6V0GD7T077056; Wed, 31 Jul 2019 00:16:13 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201907310016.x6V0GD7T077056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 31 Jul 2019 00:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350460 - in stable/12: sbin/fsck_ffs sbin/mount sys/sys sys/ufs/ffs sys/ufs/ufs X-SVN-Group: stable-12 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in stable/12: sbin/fsck_ffs sbin/mount sys/sys sys/ufs/ffs sys/ufs/ufs X-SVN-Commit-Revision: 350460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE1BF87121 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 00:16:16 -0000 Author: mckusick Date: Wed Jul 31 00:16:12 2019 New Revision: 350460 URL: https://svnweb.freebsd.org/changeset/base/350460 Log: MFC of 349589, 350070, 350071, 350096, and 350187 Make filesystem-full messages limited per filesystem rather than systemwide Add "untrusted" option to mount command FS-14-UFS-3: when untrusted, valididate block pointers In fsck_ffs, treat any inode with bad content as unknown Modified: stable/12/sbin/fsck_ffs/pass1.c stable/12/sbin/mount/mntopts.h stable/12/sbin/mount/mount.8 stable/12/sbin/mount/mount.c stable/12/sys/sys/mount.h stable/12/sys/ufs/ffs/ffs_alloc.c stable/12/sys/ufs/ffs/ffs_balloc.c stable/12/sys/ufs/ffs/ffs_extern.h stable/12/sys/ufs/ffs/ffs_softdep.c stable/12/sys/ufs/ffs/ffs_subr.c stable/12/sys/ufs/ffs/ffs_vfsops.c stable/12/sys/ufs/ufs/ufs_bmap.c stable/12/sys/ufs/ufs/ufsmount.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/fsck_ffs/pass1.c ============================================================================== --- stable/12/sbin/fsck_ffs/pass1.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sbin/fsck_ffs/pass1.c Wed Jul 31 00:16:12 2019 (r350460) @@ -251,7 +251,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r int j, ret, offset; if ((dp = getnextinode(inumber, rebuildcg)) == NULL) - return (0); + goto unknown; mode = DIP(dp, di_mode) & IFMT; if (mode == 0) { if ((sblock.fs_magic == FS_UFS1_MAGIC && Modified: stable/12/sbin/mount/mntopts.h ============================================================================== --- stable/12/sbin/mount/mntopts.h Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sbin/mount/mntopts.h Wed Jul 31 00:16:12 2019 (r350460) @@ -58,6 +58,7 @@ struct mntopt { #define MOPT_ACLS { "acls", 0, MNT_ACLS, 0 } #define MOPT_NFS4ACLS { "nfsv4acls", 0, MNT_NFS4ACLS, 0 } #define MOPT_AUTOMOUNTED { "automounted",0, MNT_AUTOMOUNTED, 0 } +#define MOPT_UNTRUSTED { "untrusted", 0, MNT_UNTRUSTED, 0 } /* Control flags. */ #define MOPT_FORCE { "force", 0, MNT_FORCE, 0 } @@ -93,7 +94,8 @@ struct mntopt { MOPT_MULTILABEL, \ MOPT_ACLS, \ MOPT_NFS4ACLS, \ - MOPT_AUTOMOUNTED + MOPT_AUTOMOUNTED, \ + MOPT_UNTRUSTED void getmntopts(const char *, const struct mntopt *, int *, int *); void rmslashes(char *, char *); Modified: stable/12/sbin/mount/mount.8 ============================================================================== --- stable/12/sbin/mount/mount.8 Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sbin/mount/mount.8 Wed Jul 31 00:16:12 2019 (r350460) @@ -355,6 +355,12 @@ Lookups will be done in the mounted file system first. If those operations fail due to a non-existent file the underlying directory is then accessed. All creates are done in the mounted file system. +.It Cm untrusted +The file system is untrusted and the kernel should use more +extensive checks on the file-system's metadata before using it. +This option is intended to be used when mounting file systems +from untrusted media such as USB memory sticks or other +externally-provided media. .El .Pp Any additional options specific to a file system type that is not Modified: stable/12/sbin/mount/mount.c ============================================================================== --- stable/12/sbin/mount/mount.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sbin/mount/mount.c Wed Jul 31 00:16:12 2019 (r350460) @@ -118,6 +118,7 @@ static struct opt { { MNT_GJOURNAL, "gjournal" }, { MNT_AUTOMOUNTED, "automounted" }, { MNT_VERIFIED, "verified" }, + { MNT_UNTRUSTED, "untrusted" }, { 0, NULL } }; @@ -972,6 +973,7 @@ flags2opts(int flags) if (flags & MNT_MULTILABEL) res = catopt(res, "multilabel"); if (flags & MNT_ACLS) res = catopt(res, "acls"); if (flags & MNT_NFS4ACLS) res = catopt(res, "nfsv4acls"); + if (flags & MNT_UNTRUSTED) res = catopt(res, "untrusted"); return (res); } Modified: stable/12/sys/sys/mount.h ============================================================================== --- stable/12/sys/sys/mount.h Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/sys/mount.h Wed Jul 31 00:16:12 2019 (r350460) @@ -296,6 +296,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */ #define MNT_SUJ 0x0000000100000000ULL /* using journaled soft updates */ #define MNT_AUTOMOUNTED 0x0000000200000000ULL /* mounted by automountd(8) */ +#define MNT_UNTRUSTED 0x0000000800000000ULL /* filesys metadata untrusted */ /* * NFS export related mount flags. @@ -333,7 +334,8 @@ void __mnt_vnode_markerfree_active(struct vno MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP | \ MNT_IGNORE | MNT_EXPUBLIC | MNT_NOSYMFOLLOW | \ MNT_GJOURNAL | MNT_MULTILABEL | MNT_ACLS | \ - MNT_NFS4ACLS | MNT_AUTOMOUNTED | MNT_VERIFIED) + MNT_NFS4ACLS | MNT_AUTOMOUNTED | MNT_VERIFIED | \ + MNT_UNTRUSTED) /* Mask of flags that can be updated. */ #define MNT_UPDATEMASK (MNT_NOSUID | MNT_NOEXEC | \ @@ -342,7 +344,7 @@ void __mnt_vnode_markerfree_active(struct vno MNT_NOSYMFOLLOW | MNT_IGNORE | \ MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR | \ MNT_ACLS | MNT_USER | MNT_NFS4ACLS | \ - MNT_AUTOMOUNTED) + MNT_AUTOMOUNTED | MNT_UNTRUSTED) /* * External filesystem command modifier flags. Modified: stable/12/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_alloc.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ffs/ffs_alloc.c Wed Jul 31 00:16:12 2019 (r350460) @@ -157,8 +157,6 @@ ffs_alloc(ip, lbn, bpref, size, flags, cred, bnp) struct ufsmount *ump; ufs2_daddr_t bno; u_int cg, reclaimed; - static struct timeval lastfail; - static int curfail; int64_t delta; #ifdef QUOTA int error; @@ -223,11 +221,14 @@ nospace: softdep_request_cleanup(fs, ITOV(ip), cred, FLUSH_BLOCKS_WAIT); goto retry; } - UFS_UNLOCK(ump); - if (reclaimed > 0 && ppsratecheck(&lastfail, &curfail, 1)) { + if (reclaimed > 0 && + ppsratecheck(&ump->um_last_fullmsg, &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, ip->i_number, "filesystem full"); uprintf("\n%s: write failed, filesystem is full\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } return (ENOSPC); } @@ -257,8 +258,6 @@ ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, u_int cg, request, reclaimed; int error, gbflags; ufs2_daddr_t bno; - static struct timeval lastfail; - static int curfail; int64_t delta; vp = ITOV(ip); @@ -448,14 +447,17 @@ nospace: softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); goto retry; } - UFS_UNLOCK(ump); - if (bp) - brelse(bp); - if (reclaimed > 0 && ppsratecheck(&lastfail, &curfail, 1)) { + if (reclaimed > 0 && + ppsratecheck(&ump->um_last_fullmsg, &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, ip->i_number, "filesystem full"); uprintf("\n%s: write failed, filesystem is full\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } + if (bp) + brelse(bp); return (ENOSPC); } @@ -1098,8 +1100,6 @@ ffs_valloc(pvp, mode, cred, vpp) ino_t ino, ipref; u_int cg; int error, error1, reclaimed; - static struct timeval lastfail; - static int curfail; *vpp = NULL; pip = VTOI(pvp); @@ -1190,11 +1190,13 @@ noinodes: softdep_request_cleanup(fs, pvp, cred, FLUSH_INODES_WAIT); goto retry; } - UFS_UNLOCK(ump); - if (ppsratecheck(&lastfail, &curfail, 1)) { + if (ppsratecheck(&ump->um_last_fullmsg, &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, pip->i_number, "out of inodes"); uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } return (ENOSPC); } @@ -1369,7 +1371,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) struct fs *fs; u_int cg, inocg; u_int avgbfree, startcg; - ufs2_daddr_t pref; + ufs2_daddr_t pref, prevbn; KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap")); mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED); @@ -1419,7 +1421,15 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) * have a block allocated immediately preceding us, then we need * to decide where to start allocating new blocks. */ - if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { + if (indx == 0) { + prevbn = 0; + } else { + prevbn = bap[indx - 1]; + if (UFS_CHECK_BLKNO(ITOVFS(ip), ip->i_number, prevbn, + fs->fs_bsize) != 0) + prevbn = 0; + } + if (indx % fs->fs_maxbpg == 0 || prevbn == 0) { /* * If we are allocating a directory data block, we want * to place it in the metadata area. @@ -1437,10 +1447,10 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) * Find a cylinder with greater than average number of * unused data blocks. */ - if (indx == 0 || bap[indx - 1] == 0) + if (indx == 0 || prevbn == 0) startcg = inocg + lbn / fs->fs_maxbpg; else - startcg = dtog(fs, bap[indx - 1]) + 1; + startcg = dtog(fs, prevbn) + 1; startcg %= fs->fs_ncg; avgbfree = fs->fs_cstotal.cs_nbfree / fs->fs_ncg; for (cg = startcg; cg < fs->fs_ncg; cg++) @@ -1458,7 +1468,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) /* * Otherwise, we just always try to lay things out contiguously. */ - return (bap[indx - 1] + fs->fs_frag); + return (prevbn + fs->fs_frag); } /* @@ -1474,7 +1484,7 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) struct fs *fs; u_int cg, inocg; u_int avgbfree, startcg; - ufs2_daddr_t pref; + ufs2_daddr_t pref, prevbn; KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap")); mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED); @@ -1524,7 +1534,15 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) * have a block allocated immediately preceding us, then we need * to decide where to start allocating new blocks. */ - if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { + if (indx == 0) { + prevbn = 0; + } else { + prevbn = bap[indx - 1]; + if (UFS_CHECK_BLKNO(ITOVFS(ip), ip->i_number, prevbn, + fs->fs_bsize) != 0) + prevbn = 0; + } + if (indx % fs->fs_maxbpg == 0 || prevbn == 0) { /* * If we are allocating a directory data block, we want * to place it in the metadata area. @@ -1542,10 +1560,10 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) * Find a cylinder with greater than average number of * unused data blocks. */ - if (indx == 0 || bap[indx - 1] == 0) + if (indx == 0 || prevbn == 0) startcg = inocg + lbn / fs->fs_maxbpg; else - startcg = dtog(fs, bap[indx - 1]) + 1; + startcg = dtog(fs, prevbn) + 1; startcg %= fs->fs_ncg; avgbfree = fs->fs_cstotal.cs_nbfree / fs->fs_ncg; for (cg = startcg; cg < fs->fs_ncg; cg++) @@ -1563,7 +1581,7 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) /* * Otherwise, we just always try to lay things out contiguously. */ - return (bap[indx - 1] + fs->fs_frag); + return (prevbn + fs->fs_frag); } /* Modified: stable/12/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_balloc.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ffs/ffs_balloc.c Wed Jul 31 00:16:12 2019 (r350460) @@ -99,6 +99,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, i struct fs *fs; ufs1_daddr_t nb; struct buf *bp, *nbp; + struct mount *mp; struct ufsmount *ump; struct indir indirs[UFS_NIADDR + 2]; int deallocated, osize, nsize, num, i, error; @@ -108,13 +109,12 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, i ufs2_daddr_t *lbns_remfree, lbns[UFS_NIADDR + 1]; int unwindidx = -1; int saved_inbdflush; - static struct timeval lastfail; - static int curfail; int gbflags, reclaimed; ip = VTOI(vp); dp = ip->i_din1; fs = ITOFS(ip); + mp = ITOVFS(ip); ump = ITOUMP(ip); lbn = lblkno(fs, startoffset); size = blkoff(fs, startoffset) + size; @@ -297,6 +297,11 @@ retry: } bap = (ufs1_daddr_t *)bp->b_data; nb = bap[indirs[i].in_off]; + if ((error = UFS_CHECK_BLKNO(mp, ip->i_number, nb, + fs->fs_bsize)) != 0) { + brelse(bp); + goto fail; + } if (i == num) break; i += 1; @@ -315,17 +320,21 @@ retry: if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); + UFS_LOCK(ump); if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { - UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); UFS_UNLOCK(ump); goto retry; } - if (ppsratecheck(&lastfail, &curfail, 1)) { + if (ppsratecheck(&ump->um_last_fullmsg, + &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, ip->i_number, "filesystem full"); uprintf("\n%s: write failed, filesystem " "is full\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } goto fail; } @@ -394,17 +403,21 @@ retry: flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); + UFS_LOCK(ump); if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { - UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); UFS_UNLOCK(ump); goto retry; } - if (ppsratecheck(&lastfail, &curfail, 1)) { + if (ppsratecheck(&ump->um_last_fullmsg, + &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, ip->i_number, "filesystem full"); uprintf("\n%s: write failed, filesystem " "is full\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } goto fail; } @@ -574,6 +587,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i ufs_lbn_t lbn, lastlbn; struct fs *fs; struct buf *bp, *nbp; + struct mount *mp; struct ufsmount *ump; struct indir indirs[UFS_NIADDR + 2]; ufs2_daddr_t nb, newb, *bap, pref; @@ -582,13 +596,12 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i int deallocated, osize, nsize, num, i, error; int unwindidx = -1; int saved_inbdflush; - static struct timeval lastfail; - static int curfail; int gbflags, reclaimed; ip = VTOI(vp); dp = ip->i_din2; fs = ITOFS(ip); + mp = ITOVFS(ip); ump = ITOUMP(ip); lbn = lblkno(fs, startoffset); size = blkoff(fs, startoffset) + size; @@ -884,6 +897,11 @@ retry: } bap = (ufs2_daddr_t *)bp->b_data; nb = bap[indirs[i].in_off]; + if ((error = UFS_CHECK_BLKNO(mp, ip->i_number, nb, + fs->fs_bsize)) != 0) { + brelse(bp); + goto fail; + } if (i == num) break; i += 1; @@ -902,17 +920,21 @@ retry: if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); + UFS_LOCK(ump); if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { - UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); UFS_UNLOCK(ump); goto retry; } - if (ppsratecheck(&lastfail, &curfail, 1)) { + if (ppsratecheck(&ump->um_last_fullmsg, + &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, ip->i_number, "filesystem full"); uprintf("\n%s: write failed, filesystem " "is full\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } goto fail; } @@ -982,17 +1004,21 @@ retry: flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); + UFS_LOCK(ump); if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { - UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); UFS_UNLOCK(ump); goto retry; } - if (ppsratecheck(&lastfail, &curfail, 1)) { + if (ppsratecheck(&ump->um_last_fullmsg, + &ump->um_secs_fullmsg, 1)) { + UFS_UNLOCK(ump); ffs_fserr(fs, ip->i_number, "filesystem full"); uprintf("\n%s: write failed, filesystem " "is full\n", fs->fs_fsmnt); + } else { + UFS_UNLOCK(ump); } goto fail; } Modified: stable/12/sys/ufs/ffs/ffs_extern.h ============================================================================== --- stable/12/sys/ufs/ffs/ffs_extern.h Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ffs/ffs_extern.h Wed Jul 31 00:16:12 2019 (r350460) @@ -68,6 +68,7 @@ ufs2_daddr_t ffs_blkpref_ufs1(struct inode *, ufs_lbn_ ufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *); void ffs_blkrelease_finish(struct ufsmount *, u_long); u_long ffs_blkrelease_start(struct ufsmount *, struct vnode *, ino_t); +int ffs_check_blkno(struct mount *, ino_t, ufs2_daddr_t, int); int ffs_checkfreefile(struct fs *, struct vnode *, ino_t); void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t); void ffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int); Modified: stable/12/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_softdep.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ffs/ffs_softdep.c Wed Jul 31 00:16:12 2019 (r350460) @@ -8109,6 +8109,7 @@ indir_trunc(freework, dbn, lbn) struct buf *bp; struct fs *fs; struct indirdep *indirdep; + struct mount *mp; struct ufsmount *ump; ufs1_daddr_t *bap1; ufs2_daddr_t nb, nnb, *bap2; @@ -8118,7 +8119,8 @@ indir_trunc(freework, dbn, lbn) int goingaway, freedeps, needj, level, cnt, i; freeblks = freework->fw_freeblks; - ump = VFSTOUFS(freeblks->fb_list.wk_mp); + mp = freeblks->fb_list.wk_mp; + ump = VFSTOUFS(mp); fs = ump->um_fs; /* * Get buffer of block pointers to be freed. There are three cases: @@ -8211,6 +8213,9 @@ indir_trunc(freework, dbn, lbn) */ key = ffs_blkrelease_start(ump, freeblks->fb_devvp, freeblks->fb_inum); for (i = freework->fw_off; i < NINDIR(fs); i++, nb = nnb) { + if (UFS_CHECK_BLKNO(mp, freeblks->fb_inum, nb, + fs->fs_bsize) != 0) + nb = 0; if (i != NINDIR(fs) - 1) { if (ufs1fmt) nnb = bap1[i+1]; Modified: stable/12/sys/ufs/ffs/ffs_subr.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_subr.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ffs/ffs_subr.c Wed Jul 31 00:16:12 2019 (r350460) @@ -133,7 +133,56 @@ ffs_load_inode(struct buf *bp, struct inode *ip, struc ip->i_gid = ip->i_din2->di_gid; } } -#endif /* KERNEL */ + +/* + * Verify that a filesystem block number is a valid data block. + * This routine is only called on untrusted filesystems. + */ +int +ffs_check_blkno(struct mount *mp, ino_t inum, ufs2_daddr_t daddr, int blksize) +{ + struct fs *fs; + struct ufsmount *ump; + ufs2_daddr_t end_daddr; + int cg, havemtx; + + KASSERT((mp->mnt_flag & MNT_UNTRUSTED) != 0, + ("ffs_check_blkno called on a trusted file system")); + ump = VFSTOUFS(mp); + fs = ump->um_fs; + cg = dtog(fs, daddr); + end_daddr = daddr + numfrags(fs, blksize); + /* + * Verify that the block number is a valid data block. Also check + * that it does not point to an inode block or a superblock. Accept + * blocks that are unalloacted (0) or part of snapshot metadata + * (BLK_NOCOPY or BLK_SNAP). + * + * Thus, the block must be in a valid range for the filesystem and + * either in the space before a backup superblock (except the first + * cylinder group where that space is used by the bootstrap code) or + * after the inode blocks and before the end of the cylinder group. + */ + if ((uint64_t)daddr <= BLK_SNAP || + ((uint64_t)end_daddr <= fs->fs_size && + ((cg > 0 && end_daddr <= cgsblock(fs, cg)) || + (daddr >= cgdmin(fs, cg) && + end_daddr <= cgbase(fs, cg) + fs->fs_fpg)))) + return (0); + if ((havemtx = mtx_owned(UFS_MTX(ump))) == 0) + UFS_LOCK(ump); + if (ppsratecheck(&ump->um_last_integritymsg, + &ump->um_secs_integritymsg, 1)) { + UFS_UNLOCK(ump); + uprintf("\n%s: inode %jd, out-of-range indirect block " + "number %jd\n", mp->mnt_stat.f_mntonname, inum, daddr); + if (havemtx) + UFS_LOCK(ump); + } else if (!havemtx) + UFS_UNLOCK(ump); + return (EIO); +} +#endif /* _KERNEL */ /* * These are the low-level functions that actually read and write Modified: stable/12/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_vfsops.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ffs/ffs_vfsops.c Wed Jul 31 00:16:12 2019 (r350460) @@ -143,7 +143,7 @@ static struct buf_ops ffs_ops = { static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr", "noclusterw", "noexec", "export", "force", "from", "groupquota", "multilabel", "nfsv4acls", "fsckpid", "snapshot", "nosuid", "suiddir", - "nosymfollow", "sync", "union", "userquota", NULL }; + "nosymfollow", "sync", "union", "userquota", "untrusted", NULL }; static int ffs_mount(struct mount *mp) @@ -182,6 +182,9 @@ ffs_mount(struct mount *mp) return (error); mntorflags = 0; + if (vfs_getopt(mp->mnt_optnew, "untrusted", NULL, NULL) == 0) + mntorflags |= MNT_UNTRUSTED; + if (vfs_getopt(mp->mnt_optnew, "acls", NULL, NULL) == 0) mntorflags |= MNT_ACLS; @@ -911,6 +914,10 @@ ffs_mountfs(devvp, mp, td) ump->um_ifree = ffs_ifree; ump->um_rdonly = ffs_rdonly; ump->um_snapgone = ffs_snapgone; + if ((mp->mnt_flag & MNT_UNTRUSTED) != 0) + ump->um_check_blkno = ffs_check_blkno; + else + ump->um_check_blkno = NULL; mtx_init(UFS_MTX(ump), "FFS", "FFS Lock", MTX_DEF); ffs_oldfscompat_read(fs, ump, fs->fs_sblockloc); fs->fs_ronly = ronly; Modified: stable/12/sys/ufs/ufs/ufs_bmap.c ============================================================================== --- stable/12/sys/ufs/ufs/ufs_bmap.c Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ufs/ufs_bmap.c Wed Jul 31 00:16:12 2019 (r350460) @@ -264,8 +264,16 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) if (error != 0) return (error); - if (I_IS_UFS1(ip)) { + if (I_IS_UFS1(ip)) daddr = ((ufs1_daddr_t *)bp->b_data)[ap->in_off]; + else + daddr = ((ufs2_daddr_t *)bp->b_data)[ap->in_off]; + if ((error = UFS_CHECK_BLKNO(mp, ip->i_number, daddr, + mp->mnt_stat.f_iosize)) != 0) { + bqrelse(bp); + return (error); + } + if (I_IS_UFS1(ip)) { if (num == 1 && daddr && runp) { for (bn = ap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && @@ -284,7 +292,6 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) } continue; } - daddr = ((ufs2_daddr_t *)bp->b_data)[ap->in_off]; if (num == 1 && daddr && runp) { for (bn = ap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && Modified: stable/12/sys/ufs/ufs/ufsmount.h ============================================================================== --- stable/12/sys/ufs/ufs/ufsmount.h Tue Jul 30 23:50:49 2019 (r350459) +++ stable/12/sys/ufs/ufs/ufsmount.h Wed Jul 31 00:16:12 2019 (r350460) @@ -100,6 +100,10 @@ struct ufsmount { char um_qflags[MAXQUOTAS]; /* (i) quota specific flags */ int64_t um_savedmaxfilesize; /* (c) track maxfilesize */ u_int um_flags; /* (i) filesystem flags */ + struct timeval um_last_fullmsg; /* (i) last full msg time */ + int um_secs_fullmsg; /* (i) seconds since full msg */ + struct timeval um_last_integritymsg; /* (i) last integrity msg */ + int um_secs_integritymsg; /* (i) secs since integ msg */ u_int um_trim_inflight; /* (i) outstanding trim count */ u_int um_trim_inflight_blks; /* (i) outstanding trim blks */ u_long um_trim_total; /* (i) total trim count */ @@ -119,6 +123,7 @@ struct ufsmount { void (*um_ifree)(struct ufsmount *, struct inode *); int (*um_rdonly)(struct inode *); void (*um_snapgone)(struct inode *); + int (*um_check_blkno)(struct mount *, ino_t, daddr_t, int); }; /* @@ -130,15 +135,22 @@ struct ufsmount { /* * function prototypes */ -#define UFS_BALLOC(aa, bb, cc, dd, ee, ff) VFSTOUFS((aa)->v_mount)->um_balloc(aa, bb, cc, dd, ee, ff) -#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) -#define UFS_TRUNCATE(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd) +#define UFS_BALLOC(aa, bb, cc, dd, ee, ff) \ + VFSTOUFS((aa)->v_mount)->um_balloc(aa, bb, cc, dd, ee, ff) +#define UFS_BLKATOFF(aa, bb, cc, dd) \ + VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) +#define UFS_TRUNCATE(aa, bb, cc, dd) \ + VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd) #define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb) -#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd) +#define UFS_VALLOC(aa, bb, cc, dd) \ + VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd) #define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc) #define UFS_IFREE(aa, bb) ((aa)->um_ifree(aa, bb)) #define UFS_RDONLY(aa) (ITOUMP(aa)->um_rdonly(aa)) #define UFS_SNAPGONE(aa) (ITOUMP(aa)->um_snapgone(aa)) +#define UFS_CHECK_BLKNO(aa, bb, cc, dd) \ + (VFSTOUFS(aa)->um_check_blkno == NULL ? 0 : \ + VFSTOUFS(aa)->um_check_blkno(aa, bb, cc, dd)) #define UFS_LOCK(aa) mtx_lock(&(aa)->um_lock) #define UFS_UNLOCK(aa) mtx_unlock(&(aa)->um_lock) From owner-svn-src-stable@freebsd.org Wed Jul 31 15:56:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2738DA2468; Wed, 31 Jul 2019 15:56:41 +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 45zJ2J74jvz40JS; Wed, 31 Jul 2019 15:56:40 +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 D4C313F8E; Wed, 31 Jul 2019 15:56:40 +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 x6VFuexJ029648; Wed, 31 Jul 2019 15:56:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VFueup029647; Wed, 31 Jul 2019 15:56:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201907311556.x6VFueup029647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 31 Jul 2019 15:56:40 +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: r350465 - in stable: 11/sys/net 12/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/net 12/sys/net X-SVN-Commit-Revision: 350465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zJ2J74jvz40JS X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.29 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.29)[0.292,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 15:56:41 -0000 Author: kevans Date: Wed Jul 31 15:56:40 2019 New Revision: 350465 URL: https://svnweb.freebsd.org/changeset/base/350465 Log: MFC r350336: if_tun(4): Add TUNGIFNAME This is effectively a direct commit to stable branches as tun/tap have been merged in head. The code here is identical, just in a slightly different context. Modified: stable/11/sys/net/if_tun.c stable/11/sys/net/if_tun.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/net/if_tun.c stable/12/sys/net/if_tun.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/net/if_tun.c ============================================================================== --- stable/11/sys/net/if_tun.c Wed Jul 31 15:16:51 2019 (r350464) +++ stable/11/sys/net/if_tun.c Wed Jul 31 15:56:40 2019 (r350465) @@ -735,12 +735,16 @@ static int tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { - struct ifreq ifr; + struct ifreq ifr, *ifrp; struct tun_softc *tp = dev->si_drv1; struct tuninfo *tunp; int error; switch (cmd) { + case TUNGIFNAME: + ifrp = (struct ifreq *)data; + strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ); + break; case TUNSIFINFO: tunp = (struct tuninfo *)data; if (TUN2IFP(tp)->if_type != tunp->type) Modified: stable/11/sys/net/if_tun.h ============================================================================== --- stable/11/sys/net/if_tun.h Wed Jul 31 15:16:51 2019 (r350464) +++ stable/11/sys/net/if_tun.h Wed Jul 31 15:56:40 2019 (r350465) @@ -40,6 +40,7 @@ struct tuninfo { #define TUNSIFINFO _IOW('t', 91, struct tuninfo) #define TUNGIFINFO _IOR('t', 92, struct tuninfo) #define TUNSLMODE _IOW('t', 93, int) +#define TUNGIFNAME _IOR('t', 93, struct ifreq) #define TUNSIFMODE _IOW('t', 94, int) #define TUNSIFPID _IO('t', 95) #define TUNSIFHEAD _IOW('t', 96, int) From owner-svn-src-stable@freebsd.org Wed Jul 31 15:56:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BAF9A2482; Wed, 31 Jul 2019 15:56:41 +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 45zJ2K3Xzvz40JT; Wed, 31 Jul 2019 15:56:41 +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 5B3753F8F; Wed, 31 Jul 2019 15:56:41 +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 x6VFufXk029655; Wed, 31 Jul 2019 15:56:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VFufHZ029653; Wed, 31 Jul 2019 15:56:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201907311556.x6VFufHZ029653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 31 Jul 2019 15:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350465 - in stable: 11/sys/net 12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/net 12/sys/net X-SVN-Commit-Revision: 350465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zJ2K3Xzvz40JT X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.29 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.29)[0.292,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 15:56:41 -0000 Author: kevans Date: Wed Jul 31 15:56:40 2019 New Revision: 350465 URL: https://svnweb.freebsd.org/changeset/base/350465 Log: MFC r350336: if_tun(4): Add TUNGIFNAME This is effectively a direct commit to stable branches as tun/tap have been merged in head. The code here is identical, just in a slightly different context. Modified: stable/12/sys/net/if_tun.c stable/12/sys/net/if_tun.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/net/if_tun.c stable/11/sys/net/if_tun.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/net/if_tun.c ============================================================================== --- stable/12/sys/net/if_tun.c Wed Jul 31 15:16:51 2019 (r350464) +++ stable/12/sys/net/if_tun.c Wed Jul 31 15:56:40 2019 (r350465) @@ -735,12 +735,16 @@ static int tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { - struct ifreq ifr; + struct ifreq ifr, *ifrp; struct tun_softc *tp = dev->si_drv1; struct tuninfo *tunp; int error; switch (cmd) { + case TUNGIFNAME: + ifrp = (struct ifreq *)data; + strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ); + break; case TUNSIFINFO: tunp = (struct tuninfo *)data; if (TUN2IFP(tp)->if_type != tunp->type) Modified: stable/12/sys/net/if_tun.h ============================================================================== --- stable/12/sys/net/if_tun.h Wed Jul 31 15:16:51 2019 (r350464) +++ stable/12/sys/net/if_tun.h Wed Jul 31 15:56:40 2019 (r350465) @@ -40,6 +40,7 @@ struct tuninfo { #define TUNSIFINFO _IOW('t', 91, struct tuninfo) #define TUNGIFINFO _IOR('t', 92, struct tuninfo) #define TUNSLMODE _IOW('t', 93, int) +#define TUNGIFNAME _IOR('t', 93, struct ifreq) #define TUNSIFMODE _IOW('t', 94, int) #define TUNSIFPID _IO('t', 95) #define TUNSIFHEAD _IOW('t', 96, int) From owner-svn-src-stable@freebsd.org Wed Jul 31 17:01:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08FB2A3CEB; Wed, 31 Jul 2019 17:01:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zKT065Fqz44KX; Wed, 31 Jul 2019 17:01:24 +0000 (UTC) (envelope-from brooks@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 B284F4C0E; Wed, 31 Jul 2019 17:01:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VH1Ow4068757; Wed, 31 Jul 2019 17:01:24 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VH1OOl068755; Wed, 31 Jul 2019 17:01:24 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201907311701.x6VH1OOl068755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 31 Jul 2019 17:01:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350469 - in stable/12/libexec/bootpd: . tools X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/libexec/bootpd: . tools X-SVN-Commit-Revision: 350469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zKT065Fqz44KX X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-0.25 / 15.00]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.25)[-0.245,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 17:01:25 -0000 Author: brooks Date: Wed Jul 31 17:01:23 2019 New Revision: 350469 URL: https://svnweb.freebsd.org/changeset/base/350469 Log: MFC r350143, r350148 r350143: Chain Makefile.inc's so default are inherited as expected. Remove unneeded or duplicate variables. No functional change. r350148: Restore WARNS?=1 here. I missed that libexec/bootpd/bootpgw existed. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/12/libexec/bootpd/Makefile.inc stable/12/libexec/bootpd/tools/Makefile.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/bootpd/Makefile.inc ============================================================================== --- stable/12/libexec/bootpd/Makefile.inc Wed Jul 31 16:58:09 2019 (r350468) +++ stable/12/libexec/bootpd/Makefile.inc Wed Jul 31 17:01:23 2019 (r350469) @@ -1,5 +1,5 @@ # $FreeBSD$ -BINDIR?= /usr/libexec - WARNS?= 1 + +.include "../Makefile.inc" Modified: stable/12/libexec/bootpd/tools/Makefile.inc ============================================================================== --- stable/12/libexec/bootpd/tools/Makefile.inc Wed Jul 31 16:58:09 2019 (r350468) +++ stable/12/libexec/bootpd/tools/Makefile.inc Wed Jul 31 17:01:23 2019 (r350469) @@ -4,3 +4,5 @@ BINDIR= /usr/sbin WARNS?= 1 + +.include "../Makefile.inc" From owner-svn-src-stable@freebsd.org Wed Jul 31 17:29:15 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7AC8A4455; Wed, 31 Jul 2019 17:29:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zL574dv8z45vy; Wed, 31 Jul 2019 17:29:15 +0000 (UTC) (envelope-from brooks@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 7D7935040; Wed, 31 Jul 2019 17:29:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VHTFPg086135; Wed, 31 Jul 2019 17:29:15 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VHTFiJ086134; Wed, 31 Jul 2019 17:29:15 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201907311729.x6VHTFiJ086134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 31 Jul 2019 17:29:15 +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: r350470 - in stable/11/libexec/bootpd: . tools X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11/libexec/bootpd: . tools X-SVN-Commit-Revision: 350470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zL574dv8z45vy X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-0.19 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.19)[-0.186,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 17:29:15 -0000 Author: brooks Date: Wed Jul 31 17:29:14 2019 New Revision: 350470 URL: https://svnweb.freebsd.org/changeset/base/350470 Log: MFC r350143, r350148 r350143: Chain Makefile.inc's so default are inherited as expected. Remove unneeded or duplicate variables. No functional change. r350148: Restore WARNS?=1 here. I missed that libexec/bootpd/bootpgw existed. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/11/libexec/bootpd/Makefile.inc stable/11/libexec/bootpd/tools/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/bootpd/Makefile.inc ============================================================================== --- stable/11/libexec/bootpd/Makefile.inc Wed Jul 31 17:01:23 2019 (r350469) +++ stable/11/libexec/bootpd/Makefile.inc Wed Jul 31 17:29:14 2019 (r350470) @@ -1,5 +1,5 @@ # $FreeBSD$ -BINDIR?= /usr/libexec - WARNS?= 1 + +.include "../Makefile.inc" Modified: stable/11/libexec/bootpd/tools/Makefile.inc ============================================================================== --- stable/11/libexec/bootpd/tools/Makefile.inc Wed Jul 31 17:01:23 2019 (r350469) +++ stable/11/libexec/bootpd/tools/Makefile.inc Wed Jul 31 17:29:14 2019 (r350470) @@ -4,3 +4,5 @@ BINDIR= /usr/sbin WARNS?= 1 + +.include "../Makefile.inc" From owner-svn-src-stable@freebsd.org Wed Jul 31 17:56:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B2C4A4D3B; Wed, 31 Jul 2019 17:56:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zLh83Td1z47k4; Wed, 31 Jul 2019 17:56:08 +0000 (UTC) (envelope-from brooks@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 57B7A55CA; Wed, 31 Jul 2019 17:56:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VHu8J5004006; Wed, 31 Jul 2019 17:56:08 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VHu8YK004004; Wed, 31 Jul 2019 17:56:08 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201907311756.x6VHu8YK004004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 31 Jul 2019 17:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350473 - stable/12/lib/libgssapi X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/lib/libgssapi X-SVN-Commit-Revision: 350473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zLh83Td1z47k4 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-0.21 / 15.00]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.21)[-0.208,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 17:56:08 -0000 Author: brooks Date: Wed Jul 31 17:56:07 2019 New Revision: 350473 URL: https://svnweb.freebsd.org/changeset/base/350473 Log: MFC r350157: Use the __DECONST macro rather than hand rolling it. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/12/lib/libgssapi/gss_accept_sec_context.c stable/12/lib/libgssapi/gss_names.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libgssapi/gss_accept_sec_context.c ============================================================================== --- stable/12/lib/libgssapi/gss_accept_sec_context.c Wed Jul 31 17:51:06 2019 (r350472) +++ stable/12/lib/libgssapi/gss_accept_sec_context.c Wed Jul 31 17:56:07 2019 (r350473) @@ -100,11 +100,11 @@ parse_header(const gss_buffer_t input_token, gss_OID m } static gss_OID_desc krb5_mechanism = -{9, (void *)(uintptr_t) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"}; +{9, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02")}; static gss_OID_desc ntlm_mechanism = -{10, (void *)(uintptr_t) "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a"}; +{10, __DECONST(void *, "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a")}; static gss_OID_desc spnego_mechanism = -{6, (void *)(uintptr_t) "\x2b\x06\x01\x05\x05\x02"}; +{6, __DECONST(void *, "\x2b\x06\x01\x05\x05\x02")}; static OM_uint32 choose_mech(const gss_buffer_t input, gss_OID mech_oid) Modified: stable/12/lib/libgssapi/gss_names.c ============================================================================== --- stable/12/lib/libgssapi/gss_names.c Wed Jul 31 17:51:06 2019 (r350472) +++ stable/12/lib/libgssapi/gss_names.c Wed Jul 31 17:56:07 2019 (r350473) @@ -49,7 +49,7 @@ * to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_USER_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01")}; gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_storage; /* @@ -64,7 +64,7 @@ gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_stora * initialized to point to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_MACHINE_UID_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02")}; gss_OID GSS_C_NT_MACHINE_UID_NAME = &GSS_C_NT_MACHINE_UID_NAME_storage; /* @@ -79,7 +79,7 @@ gss_OID GSS_C_NT_MACHINE_UID_NAME = &GSS_C_NT_MACHINE_ * initialized to point to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_STRING_UID_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03")}; gss_OID GSS_C_NT_STRING_UID_NAME = &GSS_C_NT_STRING_UID_NAME_storage; /* @@ -100,7 +100,7 @@ gss_OID GSS_C_NT_STRING_UID_NAME = &GSS_C_NT_STRING_UI * implementations */ static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_X_storage = - {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x02"}; + {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x02")}; gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &GSS_C_NT_HOSTBASED_SERVICE_X_storage; /* @@ -115,7 +115,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &GSS_C_NT_HOSTB * to point to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")}; gss_OID GSS_C_NT_HOSTBASED_SERVICE = &GSS_C_NT_HOSTBASED_SERVICE_storage; /* @@ -129,7 +129,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE = &GSS_C_NT_HOSTBAS * to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_ANONYMOUS_storage = - {6, (void *)(uintptr_t)"\x2b\x06\01\x05\x06\x03"}; + {6, __DECONST(void *, "\x2b\x06\01\x05\x06\x03")}; gss_OID GSS_C_NT_ANONYMOUS = &GSS_C_NT_ANONYMOUS_storage; /* @@ -143,7 +143,7 @@ gss_OID GSS_C_NT_ANONYMOUS = &GSS_C_NT_ANONYMOUS_stora * to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_EXPORT_NAME_storage = - {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x04"}; + {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x04")}; gss_OID GSS_C_NT_EXPORT_NAME = &GSS_C_NT_EXPORT_NAME_storage; /* @@ -153,7 +153,7 @@ gss_OID GSS_C_NT_EXPORT_NAME = &GSS_C_NT_EXPORT_NAME_s * is "GSS_KRB5_NT_PRINCIPAL_NAME". */ static gss_OID_desc GSS_KRB5_NT_PRINCIPAL_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01")}; gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = &GSS_KRB5_NT_PRINCIPAL_NAME_storage; /* From owner-svn-src-stable@freebsd.org Wed Jul 31 18:10:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDBBFA52AF; Wed, 31 Jul 2019 18:10:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zM165dfPz48SH; Wed, 31 Jul 2019 18:10:50 +0000 (UTC) (envelope-from brooks@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 A34C757D4; Wed, 31 Jul 2019 18:10:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VIAoHn010709; Wed, 31 Jul 2019 18:10:50 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VIAols010707; Wed, 31 Jul 2019 18:10:50 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201907311810.x6VIAols010707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 31 Jul 2019 18:10:50 +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: r350474 - stable/11/lib/libgssapi X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/lib/libgssapi X-SVN-Commit-Revision: 350474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zM165dfPz48SH X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.26 / 15.00]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.26)[0.264,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 18:10:50 -0000 Author: brooks Date: Wed Jul 31 18:10:50 2019 New Revision: 350474 URL: https://svnweb.freebsd.org/changeset/base/350474 Log: MFC r350157: Use the __DECONST macro rather than hand rolling it. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/11/lib/libgssapi/gss_accept_sec_context.c stable/11/lib/libgssapi/gss_names.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libgssapi/gss_accept_sec_context.c ============================================================================== --- stable/11/lib/libgssapi/gss_accept_sec_context.c Wed Jul 31 17:56:07 2019 (r350473) +++ stable/11/lib/libgssapi/gss_accept_sec_context.c Wed Jul 31 18:10:50 2019 (r350474) @@ -98,11 +98,11 @@ parse_header(const gss_buffer_t input_token, gss_OID m } static gss_OID_desc krb5_mechanism = -{9, (void *)(uintptr_t) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"}; +{9, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02")}; static gss_OID_desc ntlm_mechanism = -{10, (void *)(uintptr_t) "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a"}; +{10, __DECONST(void *, "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a")}; static gss_OID_desc spnego_mechanism = -{6, (void *)(uintptr_t) "\x2b\x06\x01\x05\x05\x02"}; +{6, __DECONST(void *, "\x2b\x06\x01\x05\x05\x02")}; static OM_uint32 choose_mech(const gss_buffer_t input, gss_OID mech_oid) Modified: stable/11/lib/libgssapi/gss_names.c ============================================================================== --- stable/11/lib/libgssapi/gss_names.c Wed Jul 31 17:56:07 2019 (r350473) +++ stable/11/lib/libgssapi/gss_names.c Wed Jul 31 18:10:50 2019 (r350474) @@ -47,7 +47,7 @@ * to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_USER_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01")}; gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_storage; /* @@ -62,7 +62,7 @@ gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_stora * initialized to point to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_MACHINE_UID_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02")}; gss_OID GSS_C_NT_MACHINE_UID_NAME = &GSS_C_NT_MACHINE_UID_NAME_storage; /* @@ -77,7 +77,7 @@ gss_OID GSS_C_NT_MACHINE_UID_NAME = &GSS_C_NT_MACHINE_ * initialized to point to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_STRING_UID_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03")}; gss_OID GSS_C_NT_STRING_UID_NAME = &GSS_C_NT_STRING_UID_NAME_storage; /* @@ -98,7 +98,7 @@ gss_OID GSS_C_NT_STRING_UID_NAME = &GSS_C_NT_STRING_UI * implementations */ static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_X_storage = - {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x02"}; + {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x02")}; gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &GSS_C_NT_HOSTBASED_SERVICE_X_storage; /* @@ -113,7 +113,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &GSS_C_NT_HOSTB * to point to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")}; gss_OID GSS_C_NT_HOSTBASED_SERVICE = &GSS_C_NT_HOSTBASED_SERVICE_storage; /* @@ -127,7 +127,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE = &GSS_C_NT_HOSTBAS * to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_ANONYMOUS_storage = - {6, (void *)(uintptr_t)"\x2b\x06\01\x05\x06\x03"}; + {6, __DECONST(void *, "\x2b\x06\01\x05\x06\x03")}; gss_OID GSS_C_NT_ANONYMOUS = &GSS_C_NT_ANONYMOUS_storage; /* @@ -141,7 +141,7 @@ gss_OID GSS_C_NT_ANONYMOUS = &GSS_C_NT_ANONYMOUS_stora * to that gss_OID_desc. */ static gss_OID_desc GSS_C_NT_EXPORT_NAME_storage = - {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x04"}; + {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x04")}; gss_OID GSS_C_NT_EXPORT_NAME = &GSS_C_NT_EXPORT_NAME_storage; /* @@ -151,7 +151,7 @@ gss_OID GSS_C_NT_EXPORT_NAME = &GSS_C_NT_EXPORT_NAME_s * is "GSS_KRB5_NT_PRINCIPAL_NAME". */ static gss_OID_desc GSS_KRB5_NT_PRINCIPAL_NAME_storage = - {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"}; + {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01")}; gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = &GSS_KRB5_NT_PRINCIPAL_NAME_storage; /* From owner-svn-src-stable@freebsd.org Wed Jul 31 18:25:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E0F4A5756; Wed, 31 Jul 2019 18:25:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zMLT1NQTz49Tk; Wed, 31 Jul 2019 18:25:53 +0000 (UTC) (envelope-from brooks@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 0D3965B5C; Wed, 31 Jul 2019 18:25:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VIPqsx022181; Wed, 31 Jul 2019 18:25:52 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VIPqVX022180; Wed, 31 Jul 2019 18:25:52 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201907311825.x6VIPqVX022180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 31 Jul 2019 18:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350475 - stable/12/lib/libproc X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/lib/libproc X-SVN-Commit-Revision: 350475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zMLT1NQTz49Tk X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-0.32 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.32)[-0.322,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 18:25:53 -0000 Author: brooks Date: Wed Jul 31 18:25:52 2019 New Revision: 350475 URL: https://svnweb.freebsd.org/changeset/base/350475 Log: MFC r350158: Remove an unneeded temporary variable in two functions. There is no need to convert an intptr_t to a long just to cast it to a (void *). Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/12/lib/libproc/proc_bkpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libproc/proc_bkpt.c ============================================================================== --- stable/12/lib/libproc/proc_bkpt.c Wed Jul 31 18:10:50 2019 (r350474) +++ stable/12/lib/libproc/proc_bkpt.c Wed Jul 31 18:25:52 2019 (r350475) @@ -102,7 +102,6 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t addre unsigned long *saved) { struct ptrace_io_desc piod; - unsigned long caddr; int ret = 0, stopped; instr_t instr; @@ -125,10 +124,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t addre /* * Read the original instruction. */ - caddr = address; instr = 0; piod.piod_op = PIOD_READ_I; - piod.piod_offs = (void *)caddr; + piod.piod_offs = (void *)address; piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { @@ -141,10 +139,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t addre /* * Write a breakpoint instruction to that address. */ - caddr = address; instr = BREAKPOINT_INSTR; piod.piod_op = PIOD_WRITE_I; - piod.piod_offs = (void *)caddr; + piod.piod_offs = (void *)address; piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { @@ -167,7 +164,6 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t addre unsigned long saved) { struct ptrace_io_desc piod; - unsigned long caddr; int ret = 0, stopped; instr_t instr; @@ -189,10 +185,9 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t addre /* * Overwrite the breakpoint instruction that we setup previously. */ - caddr = address; instr = saved; piod.piod_op = PIOD_WRITE_I; - piod.piod_offs = (void *)caddr; + piod.piod_offs = (void *)address; piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { From owner-svn-src-stable@freebsd.org Wed Jul 31 18:40:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CDF2A59FF; Wed, 31 Jul 2019 18:40:44 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zMgb6RZQz4B6J; Wed, 31 Jul 2019 18:40:43 +0000 (UTC) (envelope-from brooks@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 BF4E95DBF; Wed, 31 Jul 2019 18:40:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6VIehFP028302; Wed, 31 Jul 2019 18:40:43 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6VIehED028301; Wed, 31 Jul 2019 18:40:43 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201907311840.x6VIehED028301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 31 Jul 2019 18:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350476 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 350476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zMgb6RZQz4B6J X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.27 / 15.00]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_SHORT(0.27)[0.274,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 18:40:44 -0000 Author: brooks Date: Wed Jul 31 18:40:43 2019 New Revision: 350476 URL: https://svnweb.freebsd.org/changeset/base/350476 Log: MFC r350159: Make setting mips endian and ABI less verbose. Allow ABI to be over ridden to allow (with other changes) programs to be built targeting ABIs other than the default. This is used in CheriBSD. Reviewed by: imp Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21001 Modified: stable/12/share/mk/bsd.cpu.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/bsd.cpu.mk ============================================================================== --- stable/12/share/mk/bsd.cpu.mk Wed Jul 31 18:25:52 2019 (r350475) +++ stable/12/share/mk/bsd.cpu.mk Wed Jul 31 18:40:43 2019 (r350476) @@ -312,27 +312,20 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3 .if ${MACHINE_CPUARCH} == "mips" CFLAGS += -G0 +AFLAGS+= -${MIPS_ENDIAN} -mabi=${MIPS_ABI} +CFLAGS+= -${MIPS_ENDIAN} -mabi=${MIPS_ABI} +LDFLAGS+= -${MIPS_ENDIAN} -mabi=${MIPS_ABI} . if ${MACHINE_ARCH:Mmips*el*} != "" -AFLAGS += -EL -CFLAGS += -EL -LDFLAGS += -EL +MIPS_ENDIAN= EL . else -AFLAGS += -EB -CFLAGS += -EB -LDFLAGS += -EB +MIPS_ENDIAN= EB . endif . if ${MACHINE_ARCH:Mmips64*} != "" -AFLAGS+= -mabi=64 -CFLAGS+= -mabi=64 -LDFLAGS+= -mabi=64 +MIPS_ABI?= 64 . elif ${MACHINE_ARCH:Mmipsn32*} != "" -AFLAGS+= -mabi=n32 -CFLAGS+= -mabi=n32 -LDFLAGS+= -mabi=n32 +MIPS_ABI?= n32 . else -AFLAGS+= -mabi=32 -CFLAGS+= -mabi=32 -LDFLAGS+= -mabi=32 +MIPS_ABI?= 32 . endif . if ${MACHINE_ARCH:Mmips*hf} CFLAGS += -mhard-float From owner-svn-src-stable@freebsd.org Thu Aug 1 05:30:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 564C3B1203; Thu, 1 Aug 2019 05:30:32 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 45zf5N1M6kz48J9; Thu, 1 Aug 2019 05:30:32 +0000 (UTC) (envelope-from dougm@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 0FE01D763; Thu, 1 Aug 2019 05:30:32 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x715UV5q016450; Thu, 1 Aug 2019 05:30:31 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x715UVEs016449; Thu, 1 Aug 2019 05:30:31 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201908010530.x715UVEs016449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Thu, 1 Aug 2019 05:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350495 - stable/12/sbin/swapon X-SVN-Group: stable-12 X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: stable/12/sbin/swapon X-SVN-Commit-Revision: 350495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45zf5N1M6kz48J9 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.52 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.80)[-0.797,0]; NEURAL_HAM_SHORT(-0.73)[-0.728,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2019 05:30:32 -0000 Author: dougm Date: Thu Aug 1 05:30:31 2019 New Revision: 350495 URL: https://svnweb.freebsd.org/changeset/base/350495 Log: MFC r350183, r350359 In trimming on startup, define swapon_trim() to invoke swapon before closing the fd used for trimming so that a geli device isn't detached before swapon is invoked. Add comments to explain the reason for the ordering of events. Reviewed by: alc Approved by: markj (mentor, implicit) Modified: stable/12/sbin/swapon/swapon.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/swapon/swapon.c ============================================================================== --- stable/12/sbin/swapon/swapon.c Thu Aug 1 03:59:25 2019 (r350494) +++ stable/12/sbin/swapon/swapon.c Thu Aug 1 05:30:31 2019 (r350495) @@ -739,16 +739,18 @@ run_cmd(int *ofd, const char *cmdline, ...) return (WEXITSTATUS(status)); } -static void -swap_trim(const char *name) +static int +swapon_trim(const char *name) { struct stat sb; off_t ioarg[2], sz; - int fd; + int error, fd; + /* Open a descriptor to create a consumer of the device. */ fd = open(name, O_WRONLY); if (fd < 0) errx(1, "Cannot open %s", name); + /* Find the device size. */ if (fstat(fd, &sb) < 0) errx(1, "Cannot stat %s", name); if (S_ISREG(sb.st_mode)) @@ -758,11 +760,24 @@ swap_trim(const char *name) err(1, "ioctl(DIOCGMEDIASIZE)"); } else errx(1, "%s has an invalid file type", name); + /* Trim the device. */ ioarg[0] = 0; ioarg[1] = sz; if (ioctl(fd, DIOCGDELETE, ioarg) != 0) warn("ioctl(DIOCGDELETE)"); + + /* Start using the device for swapping, creating a second consumer. */ + error = swapon(name); + + /* + * Do not close the device until the swap pager has attempted to create + * another consumer. For GELI devices created with the 'detach -l' + * option, removing the last consumer causes the device to be detached + * - that is, to disappear. This ordering ensures that the device will + * not be detached until swapoff is called. + */ close(fd); + return (error); } static const char * @@ -770,11 +785,9 @@ swap_on_off_sfile(const char *name, int doingall) { int error; - if (which_prog == SWAPON) { - if (Eflag) - swap_trim(name); - error = swapon(name); - } else /* SWAPOFF */ + if (which_prog == SWAPON) + error = Eflag ? swapon_trim(name) : swapon(name); + else /* SWAPOFF */ error = swapoff(name); if (error == -1) { From owner-svn-src-stable@freebsd.org Thu Aug 1 23:28:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B201FA443E; Thu, 1 Aug 2019 23:28:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46061f4BKCz4NYY; Thu, 1 Aug 2019 23:28:54 +0000 (UTC) (envelope-from brooks@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 7134F21B4A; Thu, 1 Aug 2019 23:28:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x71NSsEK061970; Thu, 1 Aug 2019 23:28:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x71NSsXg061969; Thu, 1 Aug 2019 23:28:54 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908012328.x71NSsXg061969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 1 Aug 2019 23:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350526 - stable/12/lib/libc/tests/string X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/lib/libc/tests/string X-SVN-Commit-Revision: 350526 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2019 23:28:54 -0000 Author: brooks Date: Thu Aug 1 23:28:54 2019 New Revision: 350526 URL: https://svnweb.freebsd.org/changeset/base/350526 Log: MFC r350160: Avoid copying too much from the input string. This avoids reading past the end of the static strings. On a system with bounds checking these tests fault. Reviewed by: asomers Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21004 Modified: stable/12/lib/libc/tests/string/wcsnlen_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/tests/string/wcsnlen_test.c ============================================================================== --- stable/12/lib/libc/tests/string/wcsnlen_test.c Thu Aug 1 22:48:06 2019 (r350525) +++ stable/12/lib/libc/tests/string/wcsnlen_test.c Thu Aug 1 23:28:54 2019 (r350526) @@ -65,7 +65,7 @@ test_wcsnlen(const wchar_t *s) for (i = 0; i <= 1; i++) { for (bufsize = 0; bufsize <= size + 10; bufsize++) { s1 = makebuf(bufsize * sizeof(wchar_t), i); - wmemcpy(s1, s, bufsize); + wmemcpy(s1, s, bufsize <= size ? bufsize : size); len = (size > bufsize) ? bufsize : size - 1; ATF_CHECK(wcsnlen(s1, bufsize) == len); } From owner-svn-src-stable@freebsd.org Fri Aug 2 00:13:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73F83A5387; Fri, 2 Aug 2019 00:13:12 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46070m2Vbpz4QZc; Fri, 2 Aug 2019 00:13:12 +0000 (UTC) (envelope-from gallatin@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 377932243A; Fri, 2 Aug 2019 00:13:12 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x720DCNR090979; Fri, 2 Aug 2019 00:13:12 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x720DC8f090978; Fri, 2 Aug 2019 00:13:12 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201908020013.x720DC8f090978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Fri, 2 Aug 2019 00:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350527 - stable/12/usr.sbin/pciconf X-SVN-Group: stable-12 X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: stable/12/usr.sbin/pciconf X-SVN-Commit-Revision: 350527 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2019 00:13:12 -0000 Author: gallatin Date: Fri Aug 2 00:13:11 2019 New Revision: 350527 URL: https://svnweb.freebsd.org/changeset/base/350527 Log: MFC r350245 pciconf: report PCI Gen4 speeds PCIe gen4 runs at 16GT/s. Report this as the speed of Gen4 links. Reviewed by: imp Sponsored by: Netflix Modified: stable/12/usr.sbin/pciconf/cap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/pciconf/cap.c ============================================================================== --- stable/12/usr.sbin/pciconf/cap.c Thu Aug 1 23:28:54 2019 (r350526) +++ stable/12/usr.sbin/pciconf/cap.c Fri Aug 2 00:13:11 2019 (r350527) @@ -389,6 +389,8 @@ link_speed_string(uint8_t speed) return ("5.0"); case 3: return ("8.0"); + case 4: + return ("16.0"); default: return ("undef"); } From owner-svn-src-stable@freebsd.org Fri Aug 2 01:59:59 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A90B9A69D0; Fri, 2 Aug 2019 01:59:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 4609Mz3l4Zz4Tbg; Fri, 2 Aug 2019 01:59:59 +0000 (UTC) (envelope-from rmacklem@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 5DAFD235D4; Fri, 2 Aug 2019 01:59:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x721xx6W050169; Fri, 2 Aug 2019 01:59:59 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x721xxVu050168; Fri, 2 Aug 2019 01:59:59 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908020159.x721xxVu050168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 2 Aug 2019 01:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350528 - stable/12/sys/ufs/ufs X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/12/sys/ufs/ufs X-SVN-Commit-Revision: 350528 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2019 01:59:59 -0000 Author: rmacklem Date: Fri Aug 2 01:59:58 2019 New Revision: 350528 URL: https://svnweb.freebsd.org/changeset/base/350528 Log: MFC: r350367 Lock the vnode before calling ufs_bmap_seekdata(). r346932 replaced a call to vn_bmap_seekhole() with a call to ufs_bmap_seekdata(). Although vn_bmap_seekhole() locks the vnode, ufs_bmap_seekdata() assumes it is already locked. This patch adds locking of the vnode before the ufs_bmap_seekdata() call. If the vn_lock() call fails, it returns EBADF since that is the normal error returned when a file system is forced dismounted and is already listed as an error return in the lseek(2) man page. Thanks go to Harry Schmalzbauer (freebsd@omnilan.de) for noting that this MFC was required. Modified: stable/12/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/12/sys/ufs/ufs/ufs_vnops.c Fri Aug 2 00:13:11 2019 (r350527) +++ stable/12/sys/ufs/ufs/ufs_vnops.c Fri Aug 2 01:59:58 2019 (r350528) @@ -2695,11 +2695,18 @@ static int ufs_ioctl(struct vop_ioctl_args *ap) { struct vnode *vp; + int error; vp = ap->a_vp; switch (ap->a_command) { case FIOSEEKDATA: - return (ufs_bmap_seekdata(vp, (off_t *)ap->a_data)); + error = vn_lock(vp, LK_SHARED); + if (error == 0) { + error = ufs_bmap_seekdata(vp, (off_t *)ap->a_data); + VOP_UNLOCK(vp, 0); + } else + error = EBADF; + return (error); case FIOSEEKHOLE: return (vn_bmap_seekhole(vp, ap->a_command, (off_t *)ap->a_data, ap->a_cred)); From owner-svn-src-stable@freebsd.org Fri Aug 2 16:05:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F127FB63BC; Fri, 2 Aug 2019 16:05:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 460X7h5zyVz4D7g; Fri, 2 Aug 2019 16:05:36 +0000 (UTC) (envelope-from brooks@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 B096351F6; Fri, 2 Aug 2019 16:05:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72G5a2a056085; Fri, 2 Aug 2019 16:05:36 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72G5aAi056084; Fri, 2 Aug 2019 16:05:36 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908021605.x72G5aAi056084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 2 Aug 2019 16:05:36 +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: r350539 - stable/11/lib/libc/tests/string X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/lib/libc/tests/string X-SVN-Commit-Revision: 350539 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2019 16:05:37 -0000 Author: brooks Date: Fri Aug 2 16:05:36 2019 New Revision: 350539 URL: https://svnweb.freebsd.org/changeset/base/350539 Log: MFC r350160: Avoid copying too much from the input string. This avoids reading past the end of the static strings. On a system with bounds checking these tests fault. Reviewed by: asomers Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21004 Modified: stable/11/lib/libc/tests/string/wcsnlen_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/string/wcsnlen_test.c ============================================================================== --- stable/11/lib/libc/tests/string/wcsnlen_test.c Fri Aug 2 15:19:11 2019 (r350538) +++ stable/11/lib/libc/tests/string/wcsnlen_test.c Fri Aug 2 16:05:36 2019 (r350539) @@ -65,7 +65,7 @@ test_wcsnlen(const wchar_t *s) for (i = 0; i <= 1; i++) { for (bufsize = 0; bufsize <= size + 10; bufsize++) { s1 = makebuf(bufsize * sizeof(wchar_t), i); - wmemcpy(s1, s, bufsize); + wmemcpy(s1, s, bufsize <= size ? bufsize : size); len = (size > bufsize) ? bufsize : size - 1; ATF_CHECK(wcsnlen(s1, bufsize) == len); } From owner-svn-src-stable@freebsd.org Fri Aug 2 20:24:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD5B2BA9EE; Fri, 2 Aug 2019 20:24:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 460dsw490yz4SXM; Fri, 2 Aug 2019 20:24:04 +0000 (UTC) (envelope-from brooks@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 71CF1803D; Fri, 2 Aug 2019 20:24:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72KO4SZ011578; Fri, 2 Aug 2019 20:24:04 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72KO42P011577; Fri, 2 Aug 2019 20:24:04 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908022024.x72KO42P011577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 2 Aug 2019 20:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350542 - stable/12/lib/libproc X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/lib/libproc X-SVN-Commit-Revision: 350542 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2019 20:24:04 -0000 Author: brooks Date: Fri Aug 2 20:24:04 2019 New Revision: 350542 URL: https://svnweb.freebsd.org/changeset/base/350542 Log: MFC r350218: Be consistent about temporary variable use in adjacent loops. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/12/lib/libproc/proc_sym.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libproc/proc_sym.c ============================================================================== --- stable/12/lib/libproc/proc_sym.c Fri Aug 2 20:16:21 2019 (r350541) +++ stable/12/lib/libproc/proc_sym.c Fri Aug 2 20:24:04 2019 (r350542) @@ -559,10 +559,11 @@ _proc_name2map(struct proc_handle *p, const char *name } /* If we didn't find a match, try matching prefixes of the basename. */ for (i = 0; i < p->nmappings; i++) { - strlcpy(path, p->mappings[i].map.pr_mapname, sizeof(path)); + mapping = &p->mappings[i]; + strlcpy(path, mapping->map.pr_mapname, sizeof(path)); base = basename(path); if (strncmp(base, name, len) == 0) - return (&p->mappings[i]); + return (mapping); } if (strcmp(name, "a.out") == 0) return (_proc_addr2map(p, From owner-svn-src-stable@freebsd.org Fri Aug 2 20:31:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83410BAE5C; Fri, 2 Aug 2019 20:31:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 460f1z2pvBz4T1D; Fri, 2 Aug 2019 20:31:03 +0000 (UTC) (envelope-from brooks@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 43B668069; Fri, 2 Aug 2019 20:31:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72KV3C2013550; Fri, 2 Aug 2019 20:31:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72KV3ZA013549; Fri, 2 Aug 2019 20:31:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908022031.x72KV3ZA013549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 2 Aug 2019 20:31:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350543 - stable/12/sys/cam/ata X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/cam/ata X-SVN-Commit-Revision: 350543 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2019 20:31:03 -0000 Author: brooks Date: Fri Aug 2 20:31:02 2019 New Revision: 350543 URL: https://svnweb.freebsd.org/changeset/base/350543 Log: MFC r350228: ata_xpt: Use the correct union member when accessing valid. In principle this should not matter as it's a union and they point to the same memory location but based on the code above we should be accessing .sata and not .ata. Submitted by: arichardson Reviewed by: scottl, imp Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21002 Modified: stable/12/sys/cam/ata/ata_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/12/sys/cam/ata/ata_xpt.c Fri Aug 2 20:24:04 2019 (r350542) +++ stable/12/sys/cam/ata/ata_xpt.c Fri Aug 2 20:31:02 2019 (r350543) @@ -452,7 +452,7 @@ negotiate: if (cts.xport_specific.ata.valid & CTS_ATA_VALID_MODE) mode = cts.xport_specific.ata.mode; } else { - if (cts.xport_specific.ata.valid & CTS_SATA_VALID_MODE) + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE) mode = cts.xport_specific.sata.mode; } /* If SIM disagree - renegotiate. */ From owner-svn-src-stable@freebsd.org Fri Aug 2 22:33:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F00D9BD8FC; Fri, 2 Aug 2019 22:33:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 460hlW5KqNz4b1M; Fri, 2 Aug 2019 22:33:43 +0000 (UTC) (envelope-from brooks@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 9A27C9747; Fri, 2 Aug 2019 22:33:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x72MXh71088570; Fri, 2 Aug 2019 22:33:43 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x72MXh0t088569; Fri, 2 Aug 2019 22:33:43 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201908022233.x72MXh0t088569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 2 Aug 2019 22:33:43 +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: r350545 - stable/11/sys/cam/ata X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/cam/ata X-SVN-Commit-Revision: 350545 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@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Aug 2019 22:33:44 -0000 Author: brooks Date: Fri Aug 2 22:33:43 2019 New Revision: 350545 URL: https://svnweb.freebsd.org/changeset/base/350545 Log: MFC r350228: ata_xpt: Use the correct union member when accessing valid. In principle this should not matter as it's a union and they point to the same memory location but based on the code above we should be accessing .sata and not .ata. Submitted by: arichardson Reviewed by: scottl, imp Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21002 Modified: stable/11/sys/cam/ata/ata_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/11/sys/cam/ata/ata_xpt.c Fri Aug 2 22:09:56 2019 (r350544) +++ stable/11/sys/cam/ata/ata_xpt.c Fri Aug 2 22:33:43 2019 (r350545) @@ -440,7 +440,7 @@ negotiate: if (cts.xport_specific.ata.valid & CTS_ATA_VALID_MODE) mode = cts.xport_specific.ata.mode; } else { - if (cts.xport_specific.ata.valid & CTS_SATA_VALID_MODE) + if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE) mode = cts.xport_specific.sata.mode; } /* If SIM disagree - renegotiate. */