From owner-svn-src-stable-10@freebsd.org Sun Mar 4 23:31:26 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81AA2F3E3FC; Sun, 4 Mar 2018 23:31:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3031E76330; Sun, 4 Mar 2018 23:31:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AF0D1C03C; Sun, 4 Mar 2018 23:31:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w24NVPTO045224; Sun, 4 Mar 2018 23:31:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w24NVPcr045222; Sun, 4 Mar 2018 23:31:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201803042331.w24NVPcr045222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 4 Mar 2018 23:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330422 - in stable/10: contrib/netbsd-tests/lib/libc/sys sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in stable/10: contrib/netbsd-tests/lib/libc/sys sys/kern X-SVN-Commit-Revision: 330422 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2018 23:31:26 -0000 Author: bdrewery Date: Sun Mar 4 23:31:25 2018 New Revision: 330422 URL: https://svnweb.freebsd.org/changeset/base/330422 Log: MFC r329271: nanosleep(2): Fix bogus incrementing of rmtp by tc_tick_sbt on [EINTR]. Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c stable/10/sys/kern/kern_time.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c Sun Mar 4 23:28:42 2018 (r330421) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c Sun Mar 4 23:31:25 2018 (r330422) @@ -50,6 +50,15 @@ handler(int signo __unused) /* Nothing. */ } +static int got_info; +static void +info_handler(int signo __unused) +{ + + got_info = 1; +} + + ATF_TC(nanosleep_basic); ATF_TC_HEAD(nanosleep_basic, tc) { @@ -176,12 +185,84 @@ ATF_TC_BODY(nanosleep_sig, tc) atf_tc_fail("signal did not interrupt nanosleep(2)"); } +ATF_TC(nanosleep_eintr); +ATF_TC_HEAD(nanosleep_eintr, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test [EINTR] for nanosleep(2)"); + atf_tc_set_md_var(tc, "timeout", "7"); +} + +ATF_TC_BODY(nanosleep_eintr, tc) +{ + struct sigaction act; + struct timespec tso, ts; + pid_t pid; + int sta; + + /* + * Test that [EINTR] properly handles rmtp for nanosleep(2). + */ + pid = fork(); + + ATF_REQUIRE(pid >= 0); + + got_info = 0; + + if (pid == 0) { + act.sa_handler = info_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; /* Don't allow restart. */ + ATF_REQUIRE(sigaction(SIGINFO, &act, NULL) == 0); + + tso.tv_sec = 5; + tso.tv_nsec = 0; + + ts.tv_sec = tso.tv_sec; + ts.tv_nsec = tso.tv_nsec; + + errno = 0; + while (nanosleep(&ts, &ts) != 0) { + ATF_REQUIRE_MSG(timespeccmp(&ts, &tso, <=), + "errno=%d ts=%0.9f should be <= last tso=%0.9f\n", + errno, + ts.tv_sec + ts.tv_nsec / 1e9, + tso.tv_sec + tso.tv_nsec / 1e9); + if (errno == EINTR && got_info == 1) { + got_info = 0; + errno = 0; + tso.tv_sec = ts.tv_sec; + tso.tv_nsec = ts.tv_nsec; + continue; + } + _exit(EXIT_FAILURE); + } + + if (errno != 0) + _exit(EXIT_FAILURE); + + _exit(EXIT_SUCCESS); + } + + /* Flood the process with SIGINFO until it exits. */ + do { + for (int i = 0; i < 10; i++) + ATF_REQUIRE(kill(pid, SIGINFO) == 0); + ATF_REQUIRE(usleep(10000) == 0); + } while (waitpid(pid, &sta, WNOHANG) == 0); + + ATF_REQUIRE(WIFEXITED(sta) == 1); + + if (WEXITSTATUS(sta) != EXIT_SUCCESS) + atf_tc_fail("nanosleep(2) handled rtmp incorrectly"); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, nanosleep_basic); ATF_TP_ADD_TC(tp, nanosleep_err); ATF_TP_ADD_TC(tp, nanosleep_sig); + ATF_TP_ADD_TC(tp, nanosleep_eintr); return atf_no_error(); } Modified: stable/10/sys/kern/kern_time.c ============================================================================== --- stable/10/sys/kern/kern_time.c Sun Mar 4 23:28:42 2018 (r330421) +++ stable/10/sys/kern/kern_time.c Sun Mar 4 23:31:25 2018 (r330422) @@ -510,7 +510,8 @@ kern_nanosleep(struct thread *td, struct timespec *rqt if (error != EWOULDBLOCK) { if (error == ERESTART) error = EINTR; - TIMESEL(&sbtt, tmp); + if (TIMESEL(&sbtt, tmp)) + sbtt += tc_tick_sbt; if (rmt != NULL) { ts = sbttots(sbt - sbtt); ts.tv_sec += over; From owner-svn-src-stable-10@freebsd.org Sun Mar 4 23:34:05 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73665F3E8DE; Sun, 4 Mar 2018 23:34:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 264267673C; Sun, 4 Mar 2018 23:34:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EF9A1C186; Sun, 4 Mar 2018 23:34:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w24NY5E8050195; Sun, 4 Mar 2018 23:34:05 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w24NY4YH050194; Sun, 4 Mar 2018 23:34:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201803042334.w24NY4YH050194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 4 Mar 2018 23:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330425 - stable/10/share/mk X-SVN-Group: stable-10 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/10/share/mk X-SVN-Commit-Revision: 330425 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2018 23:34:05 -0000 Author: bdrewery Date: Sun Mar 4 23:34:04 2018 New Revision: 330425 URL: https://svnweb.freebsd.org/changeset/base/330425 Log: MFC r330127: Allow overriding .MAKE.MAKEFILE_PREFERENCE. Modified: stable/10/share/mk/sys.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/sys.mk ============================================================================== --- stable/10/share/mk/sys.mk Sun Mar 4 23:34:02 2018 (r330424) +++ stable/10/share/mk/sys.mk Sun Mar 4 23:34:04 2018 (r330425) @@ -356,7 +356,8 @@ SHELL= ${__MAKE_SHELL} .MAKE.EXPAND_VARIABLES= yes # Tell bmake the makefile preference -.MAKE.MAKEFILE_PREFERENCE= BSDmakefile makefile Makefile +MAKEFILE_PREFERENCE?= BSDmakefile makefile Makefile +.MAKE.MAKEFILE_PREFERENCE= ${MAKEFILE_PREFERENCE} # By default bmake does *not* use set -e # when running target scripts, this is a problem for many makefiles here. From owner-svn-src-stable-10@freebsd.org Sun Mar 4 23:36:59 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10CEAF3EDE6; Sun, 4 Mar 2018 23:36:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7C1D76C8E; Sun, 4 Mar 2018 23:36:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B21531C18B; Sun, 4 Mar 2018 23:36:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w24NawgU050508; Sun, 4 Mar 2018 23:36:58 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w24NawfL050507; Sun, 4 Mar 2018 23:36:58 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201803042336.w24NawfL050507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 4 Mar 2018 23:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330428 - stable/10/sys/conf X-SVN-Group: stable-10 X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: stable/10/sys/conf X-SVN-Commit-Revision: 330428 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2018 23:36:59 -0000 Author: bdrewery Date: Sun Mar 4 23:36:58 2018 New Revision: 330428 URL: https://svnweb.freebsd.org/changeset/base/330428 Log: MFC r325776: Rework r325568 so all 'make LINT' targets work. Modified: stable/10/sys/conf/makeLINT.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/makeLINT.mk ============================================================================== --- stable/10/sys/conf/makeLINT.mk Sun Mar 4 23:36:49 2018 (r330427) +++ stable/10/sys/conf/makeLINT.mk Sun Mar 4 23:36:58 2018 (r330428) @@ -1,5 +1,8 @@ # $FreeBSD$ +# The LINT files need to end up in the kernel source directory. +.OBJDIR: ${.CURDIR} + all: @echo "make LINT only" @@ -9,9 +12,10 @@ clean: rm -f LINT-VIMAGE LINT-NOINET LINT-NOINET6 LINT-NOIP .endif -NOTES= ../../conf/NOTES NOTES -LINT: ${NOTES} ../../conf/makeLINT.sed - cat ${NOTES} | sed -E -n -f ../../conf/makeLINT.sed > ${.TARGET} +NOTES= ${.CURDIR}/../../conf/NOTES ${.CURDIR}/NOTES +MAKELINT_SED= ${.CURDIR}/../../conf/makeLINT.sed +LINT: ${NOTES} ${MAKELINT_SED} + cat ${NOTES} | sed -E -n -f ${MAKELINT_SED} > ${.TARGET} .if ${TARGET} == "amd64" || ${TARGET} == "i386" echo "include ${.TARGET}" > ${.TARGET}-VIMAGE echo "ident ${.TARGET}-VIMAGE" >> ${.TARGET}-VIMAGE From owner-svn-src-stable-10@freebsd.org Mon Mar 5 12:06:42 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69DB1F27AF2; Mon, 5 Mar 2018 12:06:42 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13F9A75EF5; Mon, 5 Mar 2018 12:06:42 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AB66239BD; Mon, 5 Mar 2018 12:06:42 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25C6fYq029744; Mon, 5 Mar 2018 12:06:41 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25C6fW4029743; Mon, 5 Mar 2018 12:06:41 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201803051206.w25C6fW4029743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 5 Mar 2018 12:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330498 - stable/10/sbin/route X-SVN-Group: stable-10 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/10/sbin/route X-SVN-Commit-Revision: 330498 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 12:06:42 -0000 Author: eugen Date: Mon Mar 5 12:06:41 2018 New Revision: 330498 URL: https://svnweb.freebsd.org/changeset/base/330498 Log: MFC r329930: route(8): make it possible to manually delete pinned route Reported by: Andreas Longwitz Approved by: avg (mentor) Modified: stable/10/sbin/route/route.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/route/route.c ============================================================================== --- stable/10/sbin/route/route.c Mon Mar 5 12:04:43 2018 (r330497) +++ stable/10/sbin/route/route.c Mon Mar 5 12:06:41 2018 (r330498) @@ -1535,8 +1535,10 @@ rtmsg(int cmd, int flags, int fib) so[RTAX_IFP].ss_len = sizeof(struct sockaddr_dl); rtm_addrs |= RTA_IFP; } - } else + } else { cmd = RTM_DELETE; + flags |= RTF_PINNED; + } #define rtm m_rtmsg.m_rtm rtm.rtm_type = cmd; rtm.rtm_flags = flags; From owner-svn-src-stable-10@freebsd.org Mon Mar 5 12:21:37 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3889FF2A076; Mon, 5 Mar 2018 12:21:37 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8B7A76C66; Mon, 5 Mar 2018 12:21:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3BC423CA6; Mon, 5 Mar 2018 12:21:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25CLaKv035763; Mon, 5 Mar 2018 12:21:36 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25CLafg035744; Mon, 5 Mar 2018 12:21:36 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201803051221.w25CLafg035744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 5 Mar 2018 12:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330500 - stable/10/sys/security/mac_portacl X-SVN-Group: stable-10 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/10/sys/security/mac_portacl X-SVN-Commit-Revision: 330500 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 12:21:37 -0000 Author: eugen Date: Mon Mar 5 12:21:36 2018 New Revision: 330500 URL: https://svnweb.freebsd.org/changeset/base/330500 Log: MFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko when kernel already has options MAC_PORTACL. PR: 183817 Approved by: avg (mentor) Modified: stable/10/sys/security/mac_portacl/mac_portacl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/security/mac_portacl/mac_portacl.c ============================================================================== --- stable/10/sys/security/mac_portacl/mac_portacl.c Mon Mar 5 12:16:37 2018 (r330499) +++ stable/10/sys/security/mac_portacl/mac_portacl.c Mon Mar 5 12:21:36 2018 (r330500) @@ -493,3 +493,4 @@ static struct mac_policy_ops portacl_ops = MAC_POLICY_SET(&portacl_ops, mac_portacl, "TrustedBSD MAC/portacl", MPC_LOADTIME_FLAG_UNLOADOK, NULL); +MODULE_VERSION(mac_portacl, 1); From owner-svn-src-stable-10@freebsd.org Mon Mar 5 16:00:06 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B3E5F3AA0F; Mon, 5 Mar 2018 16:00:06 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3230F7FCE0; Mon, 5 Mar 2018 16:00:06 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E3F925E38; Mon, 5 Mar 2018 16:00:06 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25G05QA044280; Mon, 5 Mar 2018 16:00:05 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25G05E8044279; Mon, 5 Mar 2018 16:00:05 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803051600.w25G05E8044279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Mon, 5 Mar 2018 16:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330512 - stable/10/sys/libkern X-SVN-Group: stable-10 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/10/sys/libkern X-SVN-Commit-Revision: 330512 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 16:00:06 -0000 Author: dab Date: Mon Mar 5 16:00:05 2018 New Revision: 330512 URL: https://svnweb.freebsd.org/changeset/base/330512 Log: MFC r330027 iconv uses strlen directly on user supplied memory `iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the size of user strings, such that several out of bounds reads could have been possible. static int iconv_sysctl_add(SYSCTL_HANDLER_ARGS) { struct iconv_converter_class *dcp; struct iconv_cspair *csp; struct iconv_add_in din; struct iconv_add_out dout; int error; error = SYSCTL_IN(req, &din, sizeof(din)); if (error) return error; if (din.ia_version != ICONV_ADD_VER) return EINVAL; if (din.ia_datalen > ICONV_CSMAXDATALEN) return EINVAL; if (strlen(din.ia_from) >= ICONV_CSNMAXLEN) return EINVAL; if (strlen(din.ia_to) >= ICONV_CSNMAXLEN) return EINVAL; if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN) return EINVAL; ... Since the `din` struct is directly copied from userland, there is no guarantee that the strings supplied will be NULL terminated. The `strlen` calls could continue reading past the designated buffer sizes. Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`: struct iconv_add_in { int ia_version; char ia_converter[ICONV_CNVNMAXLEN]; char ia_to[ICONV_CSNMAXLEN]; char ia_from[ICONV_CSNMAXLEN]; int ia_datalen; const void *ia_data; }; Our strings are followed by the `ia_datalen` member, which is checked before the `strlen` calls: if (din.ia_datalen > ICONV_CSMAXDATALEN) Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`), this ensures that `din.ia_datalen` contains at least 1 byte of 0, so it is not possible to trigger a read out of bounds of the `struct` however, this code is fragile and could introduce subtle bugs in the future if the `struct` is ever modified. PR: 207302 Submitted by: CTurt Reported by: CTurt Sponsored by: Dell EMC Modified: stable/10/sys/libkern/iconv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/libkern/iconv.c ============================================================================== --- stable/10/sys/libkern/iconv.c Mon Mar 5 15:12:35 2018 (r330511) +++ stable/10/sys/libkern/iconv.c Mon Mar 5 16:00:05 2018 (r330512) @@ -411,11 +411,11 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS) return EINVAL; if (din.ia_datalen > ICONV_CSMAXDATALEN) return EINVAL; - if (strlen(din.ia_from) >= ICONV_CSNMAXLEN) + if (strnlen(din.ia_from, sizeof(din.ia_from)) >= ICONV_CSNMAXLEN) return EINVAL; - if (strlen(din.ia_to) >= ICONV_CSNMAXLEN) + if (strnlen(din.ia_to, sizeof(din.ia_to)) >= ICONV_CSNMAXLEN) return EINVAL; - if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN) + if (strnlen(din.ia_converter, sizeof(din.ia_converter)) >= ICONV_CNVNMAXLEN) return EINVAL; if (iconv_lookupconv(din.ia_converter, &dcp) != 0) return EINVAL; From owner-svn-src-stable-10@freebsd.org Mon Mar 5 19:02:32 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C04CEF4794D; Mon, 5 Mar 2018 19:02:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 705EC690F7; Mon, 5 Mar 2018 19:02:32 +0000 (UTC) (envelope-from asomers@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 6B60627DA2; Mon, 5 Mar 2018 19:02:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25J2Wxm039882; Mon, 5 Mar 2018 19:02:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25J2W0R039881; Mon, 5 Mar 2018 19:02:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803051902.w25J2W0R039881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 5 Mar 2018 19:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330520 - stable/10/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/contrib/netbsd-tests/lib/libc/stdio X-SVN-Commit-Revision: 330520 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 19:02:32 -0000 Author: asomers Date: Mon Mar 5 19:02:32 2018 New Revision: 330520 URL: https://svnweb.freebsd.org/changeset/base/330520 Log: MFC r320726, r320727 r320726: Expect :snprintf_float to segfault This issue started occurring within the past month or so. PR: 220502 Reported by: Jenkins (amd64-head job) r320727: :snprintf_float: don't blindly set RLIMIT_DATA and RLIMIT_AS to 1 MB -- raise the limit to 32MB instead. Require user=root and memory=64MB+ first so one can be reasonably sure that the test will function appropriately. MFC with: r320726 PR: 220502 Modified: stable/10/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/stdio/t_printf.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Mon Mar 5 18:37:05 2018 (r330519) +++ stable/10/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Mon Mar 5 19:02:32 2018 (r330520) @@ -137,6 +137,10 @@ ATF_TC_HEAD(snprintf_float, tc) atf_tc_set_md_var(tc, "descr", "test that floating conversions don't" " leak memory"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.memory", "64m"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(snprintf_float, tc) @@ -150,10 +154,17 @@ ATF_TC_BODY(snprintf_float, tc) char buf[1000]; struct rlimit rl; +#ifdef __FreeBSD__ + rl.rlim_cur = rl.rlim_max = 32 * 1024 * 1024; + ATF_CHECK(setrlimit(RLIMIT_AS, &rl) != -1); + rl.rlim_cur = rl.rlim_max = 32 * 1024 * 1024; + ATF_CHECK(setrlimit(RLIMIT_DATA, &rl) != -1); +#else rl.rlim_cur = rl.rlim_max = 1 * 1024 * 1024; ATF_CHECK(setrlimit(RLIMIT_AS, &rl) != -1); rl.rlim_cur = rl.rlim_max = 1 * 1024 * 1024; ATF_CHECK(setrlimit(RLIMIT_DATA, &rl) != -1); +#endif time(&now); srand(now); From owner-svn-src-stable-10@freebsd.org Mon Mar 5 20:28:50 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3180AF25836; Mon, 5 Mar 2018 20:28:50 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC54D6C201; Mon, 5 Mar 2018 20:28:49 +0000 (UTC) (envelope-from asomers@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 C2A70AF5; Mon, 5 Mar 2018 20:28:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25KSn2k079619; Mon, 5 Mar 2018 20:28:49 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25KSn1g079618; Mon, 5 Mar 2018 20:28:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803052028.w25KSn1g079618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 5 Mar 2018 20:28:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330522 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 330522 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 20:28:50 -0000 Author: asomers Date: Mon Mar 5 20:28:49 2018 New Revision: 330522 URL: https://svnweb.freebsd.org/changeset/base/330522 Log: MFC r326401: Fix assertion when ZFS fails to open certain devices "panic: vdev_geom_close_locked: cp->private is NULL" This panic will result if ZFS fails to open a device due to either of the following reasons: 1) The device's sector size is greater than 8KB. 2) ZFS wants to open the device RW, but it can't be opened for writing. The solution is to change the initialization order to ensure that the assertion will be satisfied. PR: 221066 Reported by: David NewHamlet Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13278 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Mar 5 20:03:45 2018 (r330521) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Mar 5 20:28:49 2018 (r330522) @@ -851,35 +851,10 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * if (cp == NULL) { ZFS_LOG(1, "Vdev %s not found.", vd->vdev_path); error = ENOENT; - } else if (cp->provider->sectorsize > VDEV_PAD_SIZE || - !ISP2(cp->provider->sectorsize)) { - ZFS_LOG(1, "Provider %s has unsupported sectorsize.", - cp->provider->name); - - vdev_geom_close_locked(vd); - error = EINVAL; - cp = NULL; - } else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) { - int i; - - for (i = 0; i < 5; i++) { - error = g_access(cp, 0, 1, 0); - if (error == 0) - break; - g_topology_unlock(); - tsleep(vd, 0, "vdev", hz / 2); - g_topology_lock(); - } - if (error != 0) { - printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", - cp->provider->name, error); - vdev_geom_close_locked(vd); - cp = NULL; - } - } - if (cp != NULL) { + } else { struct consumer_priv_t *priv; struct consumer_vdev_elem *elem; + int spamode; priv = (struct consumer_priv_t*)&cp->private; if (cp->private == NULL) @@ -887,6 +862,34 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * elem = g_malloc(sizeof(*elem), M_WAITOK|M_ZERO); elem->vd = vd; SLIST_INSERT_HEAD(priv, elem, elems); + + spamode = spa_mode(vd->vdev_spa); + if (cp->provider->sectorsize > VDEV_PAD_SIZE || + !ISP2(cp->provider->sectorsize)) { + ZFS_LOG(1, "Provider %s has unsupported sectorsize.", + cp->provider->name); + + vdev_geom_close_locked(vd); + error = EINVAL; + cp = NULL; + } else if (cp->acw == 0 && (spamode & FWRITE) != 0) { + int i; + + for (i = 0; i < 5; i++) { + error = g_access(cp, 0, 1, 0); + if (error == 0) + break; + g_topology_unlock(); + tsleep(vd, 0, "vdev", hz / 2); + g_topology_lock(); + } + if (error != 0) { + printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", + cp->provider->name, error); + vdev_geom_close_locked(vd); + cp = NULL; + } + } } /* Fetch initial physical path information for this device. */ From owner-svn-src-stable-10@freebsd.org Mon Mar 5 20:43:44 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DE4FF2712A; Mon, 5 Mar 2018 20:43:44 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFAB26D140; Mon, 5 Mar 2018 20:43:43 +0000 (UTC) (envelope-from asomers@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 CA8A9E12; Mon, 5 Mar 2018 20:43:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w25KhhFl089475; Mon, 5 Mar 2018 20:43:43 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w25Khh9v089474; Mon, 5 Mar 2018 20:43:43 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803052043.w25Khh9v089474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 5 Mar 2018 20:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330524 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 330524 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 20:43:44 -0000 Author: asomers Date: Mon Mar 5 20:43:43 2018 New Revision: 330524 URL: https://svnweb.freebsd.org/changeset/base/330524 Log: MFC r324940: Fix the error message when creating a zpool on a too-small device Don't check for SPA_MINDEVSIZE in vdev_geom_attach when opening by path. It's redundant with the check in vdev_open, and failing to attach here results in the wrong error message being printed. However, still check for it in some other situations: * When opening by guids, so we don't get bogged down reading from slow devices like floppy drives. * In vdev_geom_read_pool_label for the same reason, because we iterate over all providers. * If the caller requests that we verify the guid, because then we'll have to read from the device before vdev_open verifies the size. PR: 222227 Reported by: Marie Helene Kvello-Aune Reviewed by: avg, mav Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12531 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Mar 5 20:37:54 2018 (r330523) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Mar 5 20:43:43 2018 (r330524) @@ -195,7 +195,7 @@ vdev_geom_orphan(struct g_consumer *cp) } static struct g_consumer * -vdev_geom_attach(struct g_provider *pp, vdev_t *vd) +vdev_geom_attach(struct g_provider *pp, vdev_t *vd, boolean_t sanity) { struct g_geom *gp; struct g_consumer *cp; @@ -205,14 +205,18 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd) ZFS_LOG(1, "Attaching to %s.", pp->name); - if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) { - ZFS_LOG(1, "Failing attach of %s. Incompatible sectorsize %d\n", - pp->name, pp->sectorsize); - return (NULL); - } else if (pp->mediasize < SPA_MINDEVSIZE) { - ZFS_LOG(1, "Failing attach of %s. Incompatible mediasize %ju\n", - pp->name, pp->mediasize); - return (NULL); + if (sanity) { + if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) { + ZFS_LOG(1, "Failing attach of %s. " + "Incompatible sectorsize %d\n", + pp->name, pp->sectorsize); + return (NULL); + } else if (pp->mediasize < SPA_MINDEVSIZE) { + ZFS_LOG(1, "Failing attach of %s. " + "Incompatible mediasize %ju\n", + pp->name, pp->mediasize); + return (NULL); + } } /* Do we have geom already? No? Create one. */ @@ -589,7 +593,7 @@ vdev_geom_read_pool_label(const char *name, LIST_FOREACH(pp, &gp->provider, provider) { if (pp->flags & G_PF_WITHER) continue; - zcp = vdev_geom_attach(pp, NULL); + zcp = vdev_geom_attach(pp, NULL, B_TRUE); if (zcp == NULL) continue; g_topology_unlock(); @@ -629,7 +633,7 @@ vdev_attach_ok(vdev_t *vd, struct g_provider *pp) struct g_consumer *cp; int nlabels; - cp = vdev_geom_attach(pp, NULL); + cp = vdev_geom_attach(pp, NULL, B_TRUE); if (cp == NULL) { ZFS_LOG(1, "Unable to attach tasting instance to %s.", pp->name); @@ -637,14 +641,12 @@ vdev_attach_ok(vdev_t *vd, struct g_provider *pp) } g_topology_unlock(); nlabels = vdev_geom_read_config(cp, &config); + g_topology_lock(); + vdev_geom_detach(cp, B_TRUE); if (nlabels == 0) { - g_topology_lock(); - vdev_geom_detach(cp, B_TRUE); ZFS_LOG(1, "Unable to read config from %s.", pp->name); return (NO_MATCH); } - g_topology_lock(); - vdev_geom_detach(cp, B_TRUE); pool_guid = 0; (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid); @@ -716,7 +718,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) out: if (best_pp) { - cp = vdev_geom_attach(best_pp, vd); + cp = vdev_geom_attach(best_pp, vd, B_TRUE); if (cp == NULL) { printf("ZFS WARNING: Unable to attach to %s.\n", best_pp->name); @@ -770,7 +772,7 @@ vdev_geom_open_by_path(vdev_t *vd, int check_guid) if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH) - cp = vdev_geom_attach(pp, vd); + cp = vdev_geom_attach(pp, vd, B_FALSE); } return (cp); From owner-svn-src-stable-10@freebsd.org Tue Mar 6 23:17:57 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88700F38AD7; Tue, 6 Mar 2018 23:17:57 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A58670C93; Tue, 6 Mar 2018 23:17:57 +0000 (UTC) (envelope-from davidcs@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 1675E1966D; Tue, 6 Mar 2018 23:17:57 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w26NHv1E088880; Tue, 6 Mar 2018 23:17:57 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w26NHuOT088871; Tue, 6 Mar 2018 23:17:56 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201803062317.w26NHuOT088871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 6 Mar 2018 23:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330556 - stable/10/sys/dev/qlxgbe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/10/sys/dev/qlxgbe X-SVN-Commit-Revision: 330556 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2018 23:17:57 -0000 Author: davidcs Date: Tue Mar 6 23:17:56 2018 New Revision: 330556 URL: https://svnweb.freebsd.org/changeset/base/330556 Log: MFC r329855 1. Added support to offline a port if is error recovery on successful. 2. Sysctls to enable/disable driver_state_dump and error_recovery. 3. Sysctl to control the delay between hw/fw reinitialization and restarting the fastpath. 4. Stop periodic stats retrieval if interface has IFF_DRV_RUNNING flag off. 5. Print contents of PEG_HALT_STATUS1 and PEG_HALT_STATUS2 on heartbeat failure. 6. Speed up slowpath shutdown during error recovery. 7. link_state update using atomic_store. 8. Added timestamp information on driver state and minidump captures. 9. Added support for Slowpath event logging 10.Added additional failure injection types to simulate failures. Modified: stable/10/sys/dev/qlxgbe/ql_dbg.h stable/10/sys/dev/qlxgbe/ql_def.h stable/10/sys/dev/qlxgbe/ql_glbl.h stable/10/sys/dev/qlxgbe/ql_hw.c stable/10/sys/dev/qlxgbe/ql_hw.h stable/10/sys/dev/qlxgbe/ql_inline.h stable/10/sys/dev/qlxgbe/ql_ioctl.c stable/10/sys/dev/qlxgbe/ql_ioctl.h stable/10/sys/dev/qlxgbe/ql_isr.c stable/10/sys/dev/qlxgbe/ql_misc.c stable/10/sys/dev/qlxgbe/ql_os.c stable/10/sys/dev/qlxgbe/ql_os.h stable/10/sys/dev/qlxgbe/ql_ver.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlxgbe/ql_dbg.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_dbg.h Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_dbg.h Tue Mar 6 23:17:56 2018 (r330556) @@ -42,17 +42,21 @@ extern void ql_dump_buf16(qla_host_t *ha, const char * extern void ql_dump_buf32(qla_host_t *ha, const char *str, void *dbuf, uint32_t len32); -#define INJCT_RX_RXB_INVAL 0x00001 -#define INJCT_RX_MP_NULL 0x00002 -#define INJCT_LRO_RXB_INVAL 0x00003 -#define INJCT_LRO_MP_NULL 0x00004 -#define INJCT_NUM_HNDLE_INVALID 0x00005 -#define INJCT_RDWR_INDREG_FAILURE 0x00006 -#define INJCT_RDWR_OFFCHIPMEM_FAILURE 0x00007 -#define INJCT_MBX_CMD_FAILURE 0x00008 -#define INJCT_HEARTBEAT_FAILURE 0x00009 -#define INJCT_TEMPERATURE_FAILURE 0x0000A -#define INJCT_M_GETCL_M_GETJCL_FAILURE 0x0000B +#define INJCT_RX_RXB_INVAL 0x00001 +#define INJCT_RX_MP_NULL 0x00002 +#define INJCT_LRO_RXB_INVAL 0x00003 +#define INJCT_LRO_MP_NULL 0x00004 +#define INJCT_NUM_HNDLE_INVALID 0x00005 +#define INJCT_RDWR_INDREG_FAILURE 0x00006 +#define INJCT_RDWR_OFFCHIPMEM_FAILURE 0x00007 +#define INJCT_MBX_CMD_FAILURE 0x00008 +#define INJCT_HEARTBEAT_FAILURE 0x00009 +#define INJCT_TEMPERATURE_FAILURE 0x0000A +#define INJCT_M_GETCL_M_GETJCL_FAILURE 0x0000B +#define INJCT_INV_CONT_OPCODE 0x0000C +#define INJCT_SGL_RCV_INV_DESC_COUNT 0x0000D +#define INJCT_SGL_LRO_INV_DESC_COUNT 0x0000E +#define INJCT_PEER_PORT_FAILURE_ERR_RECOVERY 0x0000F #ifdef QL_DBG Modified: stable/10/sys/dev/qlxgbe/ql_def.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_def.h Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_def.h Tue Mar 6 23:17:56 2018 (r330556) @@ -144,12 +144,12 @@ struct qla_host { volatile uint32_t qla_watchdog_paused; volatile uint32_t qla_initiate_recovery; volatile uint32_t qla_detach_active; + volatile uint32_t offline; device_t pci_dev; - uint16_t watchdog_ticks; + volatile uint16_t watchdog_ticks; uint8_t pci_func; - uint8_t resvd; /* ioctl related */ struct cdev *ioctl_dev; @@ -182,6 +182,7 @@ struct qla_host { /* hardware access lock */ + struct mtx sp_log_lock; struct mtx hw_lock; volatile uint32_t hw_lock_held; uint64_t hw_lock_failed; @@ -239,6 +240,9 @@ struct qla_host { volatile const char *qla_unlock; uint32_t dbg_level; uint32_t enable_minidump; + uint32_t enable_driverstate_dump; + uint32_t enable_error_recovery; + uint32_t ms_delay_after_init; uint8_t fw_ver_str[32]; @@ -272,5 +276,7 @@ typedef struct qla_host qla_host_t; #define QL_MAC_CMP(mac1, mac2) \ ((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \ (*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1) + +#define QL_INITIATE_RECOVERY(ha) qla_set_error_recovery(ha) #endif /* #ifndef _QL_DEF_H_ */ Modified: stable/10/sys/dev/qlxgbe/ql_glbl.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_glbl.h Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_glbl.h Tue Mar 6 23:17:56 2018 (r330556) @@ -47,6 +47,7 @@ extern uint32_t ql_rcv_isr(qla_host_t *ha, uint32_t sd extern int ql_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf); extern void ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf); extern int ql_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp); +extern void qla_set_error_recovery(qla_host_t *ha); /* * from ql_hw.c @@ -115,5 +116,11 @@ extern unsigned int ql83xx_minidump_len; extern void ql_alloc_drvr_state_buffer(qla_host_t *ha); extern void ql_free_drvr_state_buffer(qla_host_t *ha); extern void ql_capture_drvr_state(qla_host_t *ha); +extern void ql_sp_log(qla_host_t *ha, uint16_t fmtstr_idx, uint16_t num_params, + uint32_t param0, uint32_t param1, uint32_t param2, + uint32_t param3, uint32_t param4); +extern void ql_alloc_sp_log_buffer(qla_host_t *ha); +extern void ql_free_sp_log_buffer(qla_host_t *ha); + #endif /* #ifndef_QL_GLBL_H_ */ Modified: stable/10/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.c Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_hw.c Tue Mar 6 23:17:56 2018 (r330556) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); static void qla_del_rcv_cntxt(qla_host_t *ha); static int qla_init_rcv_cntxt(qla_host_t *ha); -static void qla_del_xmt_cntxt(qla_host_t *ha); +static int qla_del_xmt_cntxt(qla_host_t *ha); static int qla_init_xmt_cntxt(qla_host_t *ha); static int qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t n_hmbox, uint32_t *fw_mbox, uint32_t n_fwmbox, uint32_t no_pause); @@ -647,11 +647,118 @@ qlnx_add_hw_xmt_stats_sysctls(qla_host_t *ha) } static void +qlnx_add_hw_mbx_cmpl_stats_sysctls(qla_host_t *ha) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *node_children; + + ctx = device_get_sysctl_ctx(ha->pci_dev); + node_children = SYSCTL_CHILDREN(device_get_sysctl_tree(ha->pci_dev)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_lt_200ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[0], + "mbx_completion_time_lt_200ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_200ms_400ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[1], + "mbx_completion_time_200ms_400ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_400ms_600ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[2], + "mbx_completion_time_400ms_600ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_600ms_800ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[3], + "mbx_completion_time_600ms_800ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_800ms_1000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[4], + "mbx_completion_time_800ms_1000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1000ms_1200ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[5], + "mbx_completion_time_1000ms_1200ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1200ms_1400ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[6], + "mbx_completion_time_1200ms_1400ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1400ms_1600ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[7], + "mbx_completion_time_1400ms_1600ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1600ms_1800ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[8], + "mbx_completion_time_1600ms_1800ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_1800ms_2000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[9], + "mbx_completion_time_1800ms_2000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2000ms_2200ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[10], + "mbx_completion_time_2000ms_2200ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2200ms_2400ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[11], + "mbx_completion_time_2200ms_2400ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2400ms_2600ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[12], + "mbx_completion_time_2400ms_2600ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2600ms_2800ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[13], + "mbx_completion_time_2600ms_2800ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_2800ms_3000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[14], + "mbx_completion_time_2800ms_3000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_3000ms_4000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[15], + "mbx_completion_time_3000ms_4000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_time_4000ms_5000ms", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[16], + "mbx_completion_time_4000ms_5000ms"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_host_mbx_cntrl_timeout", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[17], + "mbx_completion_host_mbx_cntrl_timeout"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "mbx_completion_fw_mbx_cntrl_timeout", + CTLFLAG_RD, &ha->hw.mbx_comp_msecs[18], + "mbx_completion_fw_mbx_cntrl_timeout"); + return; +} + +static void qlnx_add_hw_stats_sysctls(qla_host_t *ha) { qlnx_add_hw_mac_stats_sysctls(ha); qlnx_add_hw_rcv_stats_sysctls(ha); qlnx_add_hw_xmt_stats_sysctls(ha); + qlnx_add_hw_mbx_cmpl_stats_sysctls(ha); return; } @@ -918,6 +1025,30 @@ ql_hw_add_sysctls(qla_host_t *ha) "\t Any change requires ifconfig down/up to take effect\n" "\t Note that LRO may be turned off/on via ifconfig\n"); + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "sp_log_index", CTLFLAG_RW, &ha->hw.sp_log_index, + ha->hw.sp_log_index, "sp_log_index"); + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "sp_log_stop", CTLFLAG_RW, &ha->hw.sp_log_stop, + ha->hw.sp_log_stop, "sp_log_stop"); + + ha->hw.sp_log_stop_events = 0; + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "sp_log_stop_events", CTLFLAG_RW, + &ha->hw.sp_log_stop_events, + ha->hw.sp_log_stop_events, "Slow path event log is stopped" + " when OR of the following events occur \n" + "\t 0x01 : Heart beat Failure\n" + "\t 0x02 : Temperature Failure\n" + "\t 0x04 : HW Initialization Failure\n" + "\t 0x08 : Interface Initialization Failure\n" + "\t 0x10 : Error Recovery Failure\n"); + ha->hw.mdump_active = 0; SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -998,13 +1129,13 @@ ql_hw_link_status(qla_host_t *ha) device_printf(ha->pci_dev, "link Down\n"); } - if (ha->hw.flags.fduplex) { + if (ha->hw.fduplex) { device_printf(ha->pci_dev, "Full Duplex\n"); } else { device_printf(ha->pci_dev, "Half Duplex\n"); } - if (ha->hw.flags.autoneg) { + if (ha->hw.autoneg) { device_printf(ha->pci_dev, "Auto Negotiation Enabled\n"); } else { device_printf(ha->pci_dev, "Auto Negotiation Disabled\n"); @@ -1255,19 +1386,39 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t uint32_t i; uint32_t data; int ret = 0; + uint64_t start_usecs; + uint64_t end_usecs; + uint64_t msecs_200; - if (QL_ERR_INJECT(ha, INJCT_MBX_CMD_FAILURE)) { + ql_sp_log(ha, 0, 5, no_pause, h_mbox[0], h_mbox[1], h_mbox[2], h_mbox[3]); + + if (ha->offline || ha->qla_initiate_recovery) { + ql_sp_log(ha, 1, 2, ha->offline, ha->qla_initiate_recovery, 0, 0, 0); + goto exit_qla_mbx_cmd; + } + + if (((ha->err_inject & 0xFFFF) == INJCT_MBX_CMD_FAILURE) && + (((ha->err_inject & ~0xFFFF) == ((h_mbox[0] & 0xFFFF) << 16))|| + !(ha->err_inject & ~0xFFFF))) { ret = -3; - ha->qla_initiate_recovery = 1; + QL_INITIATE_RECOVERY(ha); goto exit_qla_mbx_cmd; } + start_usecs = qla_get_usec_timestamp(); + if (no_pause) i = 1000; else i = Q8_MBX_MSEC_DELAY; while (i) { + + if (ha->qla_initiate_recovery) { + ql_sp_log(ha, 2, 1, ha->qla_initiate_recovery, 0, 0, 0, 0); + return (-1); + } + data = READ_REG32(ha, Q8_HOST_MBOX_CNTRL); if (data == 0) break; @@ -1282,8 +1433,10 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t if (i == 0) { device_printf(ha->pci_dev, "%s: host_mbx_cntrl 0x%08x\n", __func__, data); + ql_sp_log(ha, 3, 1, data, 0, 0, 0, 0); ret = -1; - ha->qla_initiate_recovery = 1; + ha->hw.mbx_comp_msecs[(Q8_MBX_COMP_MSECS - 2)]++; + QL_INITIATE_RECOVERY(ha); goto exit_qla_mbx_cmd; } @@ -1297,6 +1450,12 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t i = Q8_MBX_MSEC_DELAY; while (i) { + + if (ha->qla_initiate_recovery) { + ql_sp_log(ha, 4, 1, ha->qla_initiate_recovery, 0, 0, 0, 0); + return (-1); + } + data = READ_REG32(ha, Q8_FW_MBOX_CNTRL); if ((data & 0x3) == 1) { @@ -1314,18 +1473,44 @@ qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t if (i == 0) { device_printf(ha->pci_dev, "%s: fw_mbx_cntrl 0x%08x\n", __func__, data); + ql_sp_log(ha, 5, 1, data, 0, 0, 0, 0); ret = -2; - ha->qla_initiate_recovery = 1; + ha->hw.mbx_comp_msecs[(Q8_MBX_COMP_MSECS - 1)]++; + QL_INITIATE_RECOVERY(ha); goto exit_qla_mbx_cmd; } for (i = 0; i < n_fwmbox; i++) { + + if (ha->qla_initiate_recovery) { + ql_sp_log(ha, 6, 1, ha->qla_initiate_recovery, 0, 0, 0, 0); + return (-1); + } + *fw_mbox++ = READ_REG32(ha, (Q8_FW_MBOX0 + (i << 2))); } WRITE_REG32(ha, Q8_FW_MBOX_CNTRL, 0x0); WRITE_REG32(ha, ha->hw.mbx_intr_mask_offset, 0x0); + end_usecs = qla_get_usec_timestamp(); + + if (end_usecs > start_usecs) { + msecs_200 = (end_usecs - start_usecs)/(1000 * 200); + + if (msecs_200 < 15) + ha->hw.mbx_comp_msecs[msecs_200]++; + else if (msecs_200 < 20) + ha->hw.mbx_comp_msecs[15]++; + else { + device_printf(ha->pci_dev, "%s: [%ld, %ld] %ld\n", __func__, + start_usecs, end_usecs, msecs_200); + ha->hw.mbx_comp_msecs[16]++; + } + } + ql_sp_log(ha, 7, 5, fw_mbox[0], fw_mbox[1], fw_mbox[2], fw_mbox[3], fw_mbox[4]); + + exit_qla_mbx_cmd: return (ret); } @@ -1401,7 +1586,8 @@ qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_i if (qla_mbx_cmd(ha, (uint32_t *)c_intr, (sizeof (q80_config_intr_t) >> 2), ha->hw.mbox, (sizeof (q80_config_intr_rsp_t) >> 2), 0)) { - device_printf(dev, "%s: failed0\n", __func__); + device_printf(dev, "%s: %s failed0\n", __func__, + (create ? "create" : "delete")); return (-1); } @@ -1410,8 +1596,8 @@ qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_i err = Q8_MBX_RSP_STATUS(c_intr_rsp->regcnt_status); if (err) { - device_printf(dev, "%s: failed1 [0x%08x, %d]\n", __func__, err, - c_intr_rsp->nentries); + device_printf(dev, "%s: %s failed1 [0x%08x, %d]\n", __func__, + (create ? "create" : "delete"), err, c_intr_rsp->nentries); for (i = 0; i < c_intr_rsp->nentries; i++) { device_printf(dev, "%s: [%d]:[0x%x 0x%x 0x%x]\n", @@ -2015,7 +2201,8 @@ ql_get_stats(qla_host_t *ha) cmd |= ((ha->pci_func & 0x1) << 16); - if (ha->qla_watchdog_pause) + if (ha->qla_watchdog_pause || (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) goto ql_get_stats_exit; if (qla_get_hw_stats(ha, cmd, sizeof (q80_get_stats_rsp_t)) == 0) { @@ -2032,7 +2219,8 @@ ql_get_stats(qla_host_t *ha) // cmd |= Q8_GET_STATS_CMD_CLEAR; cmd |= (ha->hw.rcv_cntxt_id << 16); - if (ha->qla_watchdog_pause) + if (ha->qla_watchdog_pause || (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) goto ql_get_stats_exit; if (qla_get_hw_stats(ha, cmd, sizeof (q80_get_stats_rsp_t)) == 0) { @@ -2043,13 +2231,18 @@ ql_get_stats(qla_host_t *ha) __func__, ha->hw.mbox[0]); } - if (ha->qla_watchdog_pause) + if (ha->qla_watchdog_pause || (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) goto ql_get_stats_exit; /* * Get XMT Statistics */ - for (i = 0 ; ((i < ha->hw.num_tx_rings) && (!ha->qla_watchdog_pause)); - i++) { + for (i = 0 ; (i < ha->hw.num_tx_rings); i++) { + if (ha->qla_watchdog_pause || + (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || + ha->offline) + goto ql_get_stats_exit; + cmd = Q8_GET_STATS_CMD_XMT | Q8_GET_STATS_CMD_TYPE_CNTXT; // cmd |= Q8_GET_STATS_CMD_CLEAR; cmd |= (ha->hw.tx_cntxt[i].tx_cntxt_id << 16); @@ -2679,7 +2872,8 @@ ql_del_hw_if(qla_host_t *ha) qla_del_rcv_cntxt(ha); - qla_del_xmt_cntxt(ha); + if(qla_del_xmt_cntxt(ha)) + goto ql_del_hw_if_exit; if (ha->hw.flags.init_intr_cnxt) { for (i = 0; i < ha->hw.num_sds_rings; ) { @@ -2688,14 +2882,17 @@ ql_del_hw_if(qla_host_t *ha) num_msix = Q8_MAX_INTR_VECTORS; else num_msix = ha->hw.num_sds_rings - i; - qla_config_intr_cntxt(ha, i, num_msix, 0); + if (qla_config_intr_cntxt(ha, i, num_msix, 0)) + break; + i += num_msix; } ha->hw.flags.init_intr_cnxt = 0; } +ql_del_hw_if_exit: if (ha->hw.enable_soft_lro) { qla_drain_soft_lro(ha); qla_free_soft_lro(ha); @@ -3328,19 +3525,22 @@ qla_del_xmt_cntxt_i(qla_host_t *ha, uint32_t txr_idx) return (0); } -static void +static int qla_del_xmt_cntxt(qla_host_t *ha) { uint32_t i; + int ret = 0; if (!ha->hw.flags.init_tx_cnxt) - return; + return (ret); for (i = 0; i < ha->hw.num_tx_rings; i++) { - if (qla_del_xmt_cntxt_i(ha, i)) + if ((ret = qla_del_xmt_cntxt_i(ha, i)) != 0) break; } ha->hw.flags.init_tx_cnxt = 0; + + return (ret); } static int @@ -3350,8 +3550,10 @@ qla_init_xmt_cntxt(qla_host_t *ha) for (i = 0; i < ha->hw.num_tx_rings; i++) { if (qla_init_xmt_cntxt_i(ha, i) != 0) { - for (j = 0; j < i; j++) - qla_del_xmt_cntxt_i(ha, j); + for (j = 0; j < i; j++) { + if (qla_del_xmt_cntxt_i(ha, j)) + break; + } return (-1); } } @@ -3627,22 +3829,23 @@ ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) void ql_update_link_state(qla_host_t *ha) { - uint32_t link_state; + uint32_t link_state = 0; uint32_t prev_link_state; - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ha->hw.link_up = 0; - return; - } - link_state = READ_REG32(ha, Q8_LINK_STATE); - prev_link_state = ha->hw.link_up; - if (ha->pci_func == 0) - ha->hw.link_up = (((link_state & 0xF) == 1)? 1 : 0); - else - ha->hw.link_up = ((((link_state >> 4)& 0xF) == 1)? 1 : 0); + if (ha->ifp->if_drv_flags & IFF_DRV_RUNNING) { + link_state = READ_REG32(ha, Q8_LINK_STATE); + if (ha->pci_func == 0) { + link_state = (((link_state & 0xF) == 1)? 1 : 0); + } else { + link_state = ((((link_state >> 4)& 0xF) == 1)? 1 : 0); + } + } + + atomic_store_rel_8(&ha->hw.link_up, (uint8_t)link_state); + if (prev_link_state != ha->hw.link_up) { if (ha->hw.link_up) { if_link_state_change(ha->ifp, LINK_STATE_UP); @@ -3669,8 +3872,14 @@ ql_hw_check_health(qla_host_t *ha) if (((val & 0xFFFF) == 2) || ((val & 0xFFFF) == 3) || (QL_ERR_INJECT(ha, INJCT_TEMPERATURE_FAILURE))) { - device_printf(ha->pci_dev, "%s: Temperature Alert [0x%08x]\n", - __func__, val); + device_printf(ha->pci_dev, "%s: Temperature Alert" + " at ts_usecs %ld ts_reg = 0x%08x\n", + __func__, qla_get_usec_timestamp(), val); + + if (ha->hw.sp_log_stop_events & Q8_SP_LOG_STOP_TEMP_FAILURE) + ha->hw.sp_log_stop = -1; + + QL_INITIATE_RECOVERY(ha); return -1; } @@ -3691,10 +3900,26 @@ ql_hw_check_health(qla_host_t *ha) __func__, val); if (ha->hw.hbeat_failure < 2) /* we ignore the first failure */ return 0; - else - device_printf(ha->pci_dev, "%s: Heartbeat Failue [0x%08x]\n", - __func__, val); + else { + uint32_t peg_halt_status1; + uint32_t peg_halt_status2; + peg_halt_status1 = READ_REG32(ha, Q8_PEG_HALT_STATUS1); + peg_halt_status2 = READ_REG32(ha, Q8_PEG_HALT_STATUS2); + + device_printf(ha->pci_dev, + "%s: Heartbeat Failue at ts_usecs = %ld " + "fw_heart_beat = 0x%08x " + "peg_halt_status1 = 0x%08x " + "peg_halt_status2 = 0x%08x\n", + __func__, qla_get_usec_timestamp(), val, + peg_halt_status1, peg_halt_status2); + + if (ha->hw.sp_log_stop_events & Q8_SP_LOG_STOP_HBEAT_FAILURE) + ha->hw.sp_log_stop = -1; + } + QL_INITIATE_RECOVERY(ha); + return -1; } @@ -4429,8 +4654,8 @@ ql_minidump(qla_host_t *ha) if (ha->hw.mdump_done) return; - - ha->hw.mdump_start_seq_index = ql_stop_sequence(ha); + ha->hw.mdump_usec_ts = qla_get_usec_timestamp(); + ha->hw.mdump_start_seq_index = ql_stop_sequence(ha); bzero(ha->hw.mdump_buffer, ha->hw.mdump_buffer_size); bzero(ha->hw.mdump_template, ha->hw.mdump_template_size); Modified: stable/10/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.h Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_hw.h Tue Mar 6 23:17:56 2018 (r330556) @@ -1600,26 +1600,26 @@ typedef struct _qla_hw { uint32_t unicast_mac :1, bcast_mac :1, - loopback_mode :2, init_tx_cnxt :1, init_rx_cnxt :1, init_intr_cnxt :1, - fduplex :1, - autoneg :1, fdt_valid :1; } flags; - uint16_t link_speed; - uint16_t cable_length; - uint32_t cable_oui; - uint8_t link_up; - uint8_t module_type; - uint8_t link_faults; + volatile uint16_t link_speed; + volatile uint16_t cable_length; + volatile uint32_t cable_oui; + volatile uint8_t link_up; + volatile uint8_t module_type; + volatile uint8_t link_faults; + volatile uint8_t loopback_mode; + volatile uint8_t fduplex; + volatile uint8_t autoneg; - uint8_t mac_rcv_mode; + volatile uint8_t mac_rcv_mode; - uint32_t max_mtu; + volatile uint32_t max_mtu; uint8_t mac_addr[ETHER_ADDR_LEN]; @@ -1703,9 +1703,25 @@ typedef struct _qla_hw { uint32_t mdump_buffer_size; void *mdump_template; uint32_t mdump_template_size; + uint64_t mdump_usec_ts; +#define Q8_MBX_COMP_MSECS (19) + uint64_t mbx_comp_msecs[Q8_MBX_COMP_MSECS]; /* driver state related */ void *drvr_state; + + /* slow path trace */ + uint32_t sp_log_stop_events; +#define Q8_SP_LOG_STOP_HBEAT_FAILURE 0x001 +#define Q8_SP_LOG_STOP_TEMP_FAILURE 0x002 +#define Q8_SP_LOG_STOP_HW_INIT_FAILURE 0x004 +#define Q8_SP_LOG_STOP_IF_START_FAILURE 0x008 +#define Q8_SP_LOG_STOP_ERR_RECOVERY_FAILURE 0x010 + + uint32_t sp_log_stop; + uint32_t sp_log_index; + uint32_t sp_log_num_entries; + void *sp_log; } qla_hw_t; #define QL_UPDATE_RDS_PRODUCER_INDEX(ha, prod_reg, val) \ Modified: stable/10/sys/dev/qlxgbe/ql_inline.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_inline.h Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_inline.h Tue Mar 6 23:17:56 2018 (r330556) @@ -166,7 +166,7 @@ qla_lock(qla_host_t *ha, const char *str, uint32_t tim while (1) { mtx_lock(&ha->hw_lock); - if (ha->qla_detach_active) { + if (ha->qla_detach_active || ha->offline) { mtx_unlock(&ha->hw_lock); break; } @@ -191,7 +191,10 @@ qla_lock(qla_host_t *ha, const char *str, uint32_t tim } } - //device_printf(ha->pci_dev, "%s: %s ret = %d\n", __func__, str,ret); +// if (!ha->enable_error_recovery) +// device_printf(ha->pci_dev, "%s: %s ret = %d\n", __func__, +// str,ret); + return (ret); } @@ -202,7 +205,9 @@ qla_unlock(qla_host_t *ha, const char *str) ha->hw_lock_held = 0; ha->qla_unlock = str; mtx_unlock(&ha->hw_lock); - //device_printf(ha->pci_dev, "%s: %s\n", __func__, str); + +// if (!ha->enable_error_recovery) +// device_printf(ha->pci_dev, "%s: %s\n", __func__, str); return; } Modified: stable/10/sys/dev/qlxgbe/ql_ioctl.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_ioctl.c Tue Mar 6 23:12:32 2018 (r330555) +++ stable/10/sys/dev/qlxgbe/ql_ioctl.c Tue Mar 6 23:17:56 2018 (r330556) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "ql_ver.h" #include "ql_dbg.h" +static int ql_slowpath_log(qla_host_t *ha, qla_sp_log_t *log); static int ql_drvr_state(qla_host_t *ha, qla_driver_state_t *drvr_state); static uint32_t ql_drvr_state_size(qla_host_t *ha); static int ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, @@ -224,6 +225,7 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, case QLA_RD_FW_DUMP: if (ha->hw.mdump_init == 0) { + device_printf(pci_dev, "%s: minidump not initialized\n", __func__); rval = EINVAL; break; } @@ -233,45 +235,85 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, if ((fw_dump->minidump == NULL) || (fw_dump->minidump_size != (ha->hw.mdump_buffer_size + ha->hw.mdump_template_size))) { + device_printf(pci_dev, + "%s: minidump buffer [%p] size = [%d, %d] invalid\n", __func__, + fw_dump->minidump, fw_dump->minidump_size, + (ha->hw.mdump_buffer_size + ha->hw.mdump_template_size)); rval = EINVAL; break; } - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { - if (!ha->hw.mdump_done) - ha->qla_initiate_recovery = 1; - QLA_UNLOCK(ha, __func__); - } else { + if ((ha->pci_func & 0x1)) { + device_printf(pci_dev, "%s: mindump allowed only on Port0\n", __func__); rval = ENXIO; break; } + + fw_dump->saved = 1; + + if (ha->offline) { + + if (ha->enable_minidump) + ql_minidump(ha); + + fw_dump->saved = 0; + fw_dump->usec_ts = ha->hw.mdump_usec_ts; + + if (!ha->hw.mdump_done) { + device_printf(pci_dev, + "%s: port offline minidump failed\n", __func__); + rval = ENXIO; + break; + } + } else { + + if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { + if (!ha->hw.mdump_done) { + fw_dump->saved = 0; + QL_INITIATE_RECOVERY(ha); + device_printf(pci_dev, "%s: recovery initiated " + " to trigger minidump\n", + __func__); + } + QLA_UNLOCK(ha, __func__); + } else { + device_printf(pci_dev, "%s: QLA_LOCK() failed0\n", __func__); + rval = ENXIO; + break; + } #define QLNX_DUMP_WAIT_SECS 30 - count = QLNX_DUMP_WAIT_SECS * 1000; + count = QLNX_DUMP_WAIT_SECS * 1000; - while (count) { - if (ha->hw.mdump_done) - break; - qla_mdelay(__func__, 100); - count -= 100; - } + while (count) { + if (ha->hw.mdump_done) + break; + qla_mdelay(__func__, 100); + count -= 100; + } - if (!ha->hw.mdump_done) { - rval = ENXIO; - break; - } + if (!ha->hw.mdump_done) { + device_printf(pci_dev, + "%s: port not offline minidump failed\n", __func__); + rval = ENXIO; + break; + } + fw_dump->usec_ts = ha->hw.mdump_usec_ts; - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { - ha->hw.mdump_done = 0; - QLA_UNLOCK(ha, __func__); - } else { - rval = ENXIO; - break; + if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { + ha->hw.mdump_done = 0; + QLA_UNLOCK(ha, __func__); + } else { + device_printf(pci_dev, "%s: QLA_LOCK() failed1\n", __func__); + rval = ENXIO; + break; + } } if ((rval = copyout(ha->hw.mdump_template, fw_dump->minidump, ha->hw.mdump_template_size))) { + device_printf(pci_dev, "%s: template copyout failed\n", __func__); rval = ENXIO; break; } @@ -279,14 +321,20 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, if ((rval = copyout(ha->hw.mdump_buffer, ((uint8_t *)fw_dump->minidump + ha->hw.mdump_template_size), - ha->hw.mdump_buffer_size))) + ha->hw.mdump_buffer_size))) { + device_printf(pci_dev, "%s: minidump copyout failed\n", __func__); rval = ENXIO; + } break; case QLA_RD_DRVR_STATE: rval = ql_drvr_state(ha, (qla_driver_state_t *)data); break; + case QLA_RD_SLOWPATH_LOG: + rval = ql_slowpath_log(ha, (qla_sp_log_t *)data); + break; + case QLA_RD_PCI_IDS: pci_ids = (qla_rd_pci_ids_t *)data; pci_ids->ven_id = pci_get_vendor(pci_dev); @@ -304,12 +352,12 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, } + static int ql_drvr_state(qla_host_t *ha, qla_driver_state_t *state) { int rval = 0; uint32_t drvr_state_size; - qla_drvr_state_hdr_t *hdr; drvr_state_size = ql_drvr_state_size(ha); @@ -324,11 +372,8 @@ ql_drvr_state(qla_host_t *ha, qla_driver_state_t *stat if (ha->hw.drvr_state == NULL) return (ENOMEM); - hdr = ha->hw.drvr_state; + ql_capture_drvr_state(ha); - if (!hdr->drvr_version_major) - ql_capture_drvr_state(ha); - rval = copyout(ha->hw.drvr_state, state->buffer, drvr_state_size); bzero(ha->hw.drvr_state, drvr_state_size); @@ -416,22 +461,26 @@ ql_capture_drvr_state(qla_host_t *ha) { uint8_t *state_buffer; uint8_t *ptr; - uint32_t drvr_state_size; qla_drvr_state_hdr_t *hdr; uint32_t size; int i; - drvr_state_size = ql_drvr_state_size(ha); - state_buffer = ha->hw.drvr_state; if (state_buffer == NULL) return; - - bzero(state_buffer, drvr_state_size); hdr = (qla_drvr_state_hdr_t *)state_buffer; + + hdr->saved = 0; + if (hdr->drvr_version_major) { + hdr->saved = 1; + return; + } + + hdr->usec_ts = qla_get_usec_timestamp(); + hdr->drvr_version_major = QLA_VERSION_MAJOR; hdr->drvr_version_minor = QLA_VERSION_MINOR; hdr->drvr_version_build = QLA_VERSION_BUILD; @@ -512,6 +561,9 @@ ql_alloc_drvr_state_buffer(qla_host_t *ha) ha->hw.drvr_state = malloc(drvr_state_size, M_QLA83XXBUF, M_NOWAIT); + if (ha->hw.drvr_state != NULL) + bzero(ha->hw.drvr_state, drvr_state_size); + return; } @@ -521,5 +573,95 @@ ql_free_drvr_state_buffer(qla_host_t *ha) if (ha->hw.drvr_state != NULL) free(ha->hw.drvr_state, M_QLA83XXBUF); return; +} + +void +ql_sp_log(qla_host_t *ha, uint16_t fmtstr_idx, uint16_t num_params, + uint32_t param0, uint32_t param1, uint32_t param2, uint32_t param3, + uint32_t param4) +{ + qla_sp_log_entry_t *sp_e, *sp_log; + + if (((sp_log = ha->hw.sp_log) == NULL) || ha->hw.sp_log_stop) + return; + + mtx_lock(&ha->sp_log_lock); + + sp_e = &sp_log[ha->hw.sp_log_index]; + + bzero(sp_e, sizeof (qla_sp_log_entry_t)); + + sp_e->fmtstr_idx = fmtstr_idx; + sp_e->num_params = num_params; + + sp_e->usec_ts = qla_get_usec_timestamp(); + + sp_e->params[0] = param0; + sp_e->params[1] = param1; + sp_e->params[2] = param2; + sp_e->params[3] = param3; + sp_e->params[4] = param4; + + ha->hw.sp_log_index = (ha->hw.sp_log_index + 1) & (NUM_LOG_ENTRIES - 1); + + if (ha->hw.sp_log_num_entries < NUM_LOG_ENTRIES) + ha->hw.sp_log_num_entries++; + + mtx_unlock(&ha->sp_log_lock); + + return; +} + +void +ql_alloc_sp_log_buffer(qla_host_t *ha) +{ + uint32_t size; + + size = (sizeof(qla_sp_log_entry_t)) * NUM_LOG_ENTRIES; + + ha->hw.sp_log = malloc(size, M_QLA83XXBUF, M_NOWAIT); + + if (ha->hw.sp_log != NULL) + bzero(ha->hw.sp_log, size); + + ha->hw.sp_log_index = 0; + ha->hw.sp_log_num_entries = 0; + + return; +} + +void +ql_free_sp_log_buffer(qla_host_t *ha) +{ + if (ha->hw.sp_log != NULL) + free(ha->hw.sp_log, M_QLA83XXBUF); + return; +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Wed Mar 7 05:47:49 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98D7FF2E5F0; Wed, 7 Mar 2018 05:47:49 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 328857EFB5; Wed, 7 Mar 2018 05:47:49 +0000 (UTC) (envelope-from gordon@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 278701D5A9; Wed, 7 Mar 2018 05:47:49 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w275lmjK083355; Wed, 7 Mar 2018 05:47:48 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w275lm2e083354; Wed, 7 Mar 2018 05:47:48 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201803070547.w275lm2e083354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Wed, 7 Mar 2018 05:47:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330565 - stable/10/sys/netipsec X-SVN-Group: stable-10 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/10/sys/netipsec X-SVN-Commit-Revision: 330565 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 05:47:49 -0000 Author: gordon Date: Wed Mar 7 05:47:48 2018 New Revision: 330565 URL: https://svnweb.freebsd.org/changeset/base/330565 Log: Port r329561 to stable/10. There were structural changes preventing MFC. Check packet length to not make an out of bounds access. Also, save ah_nxt value to use later, since the ah pointer can become invalid. Reviewed by: ae@ Approved by: so Security: CVE-2018-6916 Security: FreeBSD-SA-18:01.ipsec Modified: stable/10/sys/netipsec/xform_ah.c Modified: stable/10/sys/netipsec/xform_ah.c ============================================================================== --- stable/10/sys/netipsec/xform_ah.c Wed Mar 7 04:11:14 2018 (r330564) +++ stable/10/sys/netipsec/xform_ah.c Wed Mar 7 05:47:48 2018 (r330565) @@ -599,6 +599,16 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski m_freem(m); return EACCES; } + if (skip + authsize + rplen > m->m_pkthdr.len) { + DPRINTF(("%s: bad mbuf length %u (expecting %lu)" + " for packet in SA %s/%08lx\n", __func__, + m->m_pkthdr.len, (u_long) (skip + authsize + rplen), + ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)), + (u_long) ntohl(sav->spi))); + AHSTAT_INC(ahs_badauthl); + error = EACCES; + goto bad; + } AHSTAT_ADD(ahs_ibytes, m->m_pkthdr.len - skip - hl); /* Get crypto descriptors. */ @@ -664,6 +674,9 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* Zeroize the authenticator on the packet. */ m_copyback(m, skip + rplen, authsize, ipseczeroes); + /* Save ah_nxt, since ah pointer can become invalid after "massage" */ + hl = ah->ah_nxt; + /* "Massage" the packet headers for crypto processing. */ error = ah_massage_headers(&m, sav->sah->saidx.dst.sa.sa_family, skip, ahx->type, 0); @@ -688,7 +701,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski tc->tc_spi = sav->spi; tc->tc_dst = sav->sah->saidx.dst; tc->tc_proto = sav->sah->saidx.proto; - tc->tc_nxt = ah->ah_nxt; + tc->tc_nxt = hl; tc->tc_protoff = protoff; tc->tc_skip = skip; tc->tc_ptr = (caddr_t) mtag; /* Save the mtag we've identified. */ From owner-svn-src-stable-10@freebsd.org Wed Mar 7 06:39:02 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B1ADF30C1D; Wed, 7 Mar 2018 06:39:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3247E8108F; Wed, 7 Mar 2018 06:39:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E5061DDBD; Wed, 7 Mar 2018 06:39:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w276d2p8008070; Wed, 7 Mar 2018 06:39:02 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w276d14P008060; Wed, 7 Mar 2018 06:39:01 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201803070639.w276d14P008060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 7 Mar 2018 06:39:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330571 - in stable/10: contrib/less usr.bin/less X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/10: contrib/less usr.bin/less X-SVN-Commit-Revision: 330571 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 06:39:03 -0000 Author: delphij Date: Wed Mar 7 06:39:00 2018 New Revision: 330571 URL: https://svnweb.freebsd.org/changeset/base/330571 Log: MFC r316339,317396,317829,326010,329554: less v530. Relnotes: yes Added: stable/10/contrib/less/fmt.uni - copied unchanged from r326010, head/contrib/less/fmt.uni Deleted: stable/10/contrib/less/mkhelp.c Modified: stable/10/contrib/less/LICENSE stable/10/contrib/less/NEWS stable/10/contrib/less/README stable/10/contrib/less/brac.c stable/10/contrib/less/ch.c stable/10/contrib/less/charset.c stable/10/contrib/less/charset.h stable/10/contrib/less/cmd.h stable/10/contrib/less/cmdbuf.c stable/10/contrib/less/command.c stable/10/contrib/less/compose.uni stable/10/contrib/less/cvt.c stable/10/contrib/less/decode.c stable/10/contrib/less/edit.c stable/10/contrib/less/filename.c stable/10/contrib/less/forwback.c stable/10/contrib/less/funcs.h stable/10/contrib/less/help.c stable/10/contrib/less/ifile.c stable/10/contrib/less/input.c stable/10/contrib/less/jump.c stable/10/contrib/less/less.h stable/10/contrib/less/less.hlp stable/10/contrib/less/less.nro stable/10/contrib/less/lessecho.c stable/10/contrib/less/lessecho.nro stable/10/contrib/less/lesskey.c stable/10/contrib/less/lesskey.h stable/10/contrib/less/lesskey.nro stable/10/contrib/less/lglob.h stable/10/contrib/less/line.c stable/10/contrib/less/linenum.c stable/10/contrib/less/lsystem.c stable/10/contrib/less/main.c stable/10/contrib/less/mark.c stable/10/contrib/less/mkutable stable/10/contrib/less/optfunc.c stable/10/contrib/less/option.c stable/10/contrib/less/option.h stable/10/contrib/less/opttbl.c stable/10/contrib/less/os.c stable/10/contrib/less/output.c stable/10/contrib/less/pattern.c stable/10/contrib/less/pattern.h stable/10/contrib/less/pckeys.h stable/10/contrib/less/position.c stable/10/contrib/less/position.h stable/10/contrib/less/prompt.c stable/10/contrib/less/screen.c stable/10/contrib/less/scrsize.c stable/10/contrib/less/search.c stable/10/contrib/less/signal.c stable/10/contrib/less/tags.c stable/10/contrib/less/ttyin.c stable/10/contrib/less/ubin.uni stable/10/contrib/less/version.c stable/10/contrib/less/wide.uni stable/10/usr.bin/less/defines.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/less/LICENSE ============================================================================== --- stable/10/contrib/less/LICENSE Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/LICENSE Wed Mar 7 06:39:00 2018 (r330571) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: stable/10/contrib/less/NEWS ============================================================================== --- stable/10/contrib/less/NEWS Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/NEWS Wed Mar 7 06:39:00 2018 (r330571) @@ -11,6 +11,82 @@ ====================================================================== + Major changes between "less" versions 487 and 530 + +* Don't output terminal init sequence if using -F and file fits on one screen. + +* When using -S, mark truncated lines with a special character. + The character can be changed or disabled via the new --rscroll option. + +* New command M marks the last line displayed on the screen. + +* New command ESC-m removes a line mark. + +* Status column (enabled via -J) now shows mark letters. + +* Status column shows search matches even if highlighting is disabled via -G. + +* A second ESC-u command will clear search match markers in the status column. + +* Do same ANSI escape code filtering for tag matching that we do for + searching, to help when viewing syntax-highlighted code. + +* Catch SIGTERM and clean up before exiting. + +* Fix bug initializing default charset on Windows. + +* Handle keypad ENTER key correctly if it sends something other than newline. + +* Fix buffering bug when using stdin with a LESSOPEN pipe. + +* On Windows, allow 'u' in -D option to enable underlining. + +* On Windows, use underline in sgr mode. + +* On Windows, convert UTF-8 to multibyte if console is not UTF-8. + +* Update Unicode tables to 2017-03-08. + +* Pass-thru Unicode formating chars (Cf type) instead of treating them + as binary chars. But treat them as binary if -U is set. + +* Fix erroneous binary file warning when UTF-8 file contains ANSI SGR sequences. + +* Fix bugs when using LESSOPEN and switching between stdin and other files. + +* Fix some bugs handling filenames containing shell metacharacters. + +* Fix some memory leaks. + +* Allow some debugging environment variables to be set in lesskey file. + +* Code improvements: + . Use ANSI prototypes in funcs.h declarations. + . Fix some const mismatches. + . Remove archaic "register" in variable declarations. + +====================================================================== + + Major changes between "less" versions 481 and 487 + +* New commands ESC-{ and ESC-} to shift to start/end of displayed lines. + +* Make search highlights work correctly when changing caselessness with -i. + +* New option -Da in Windows version to enable SGR mode. + +* Fix "nothing to search" error when top or bottom line on screen is empty. + +* Fix bug when terminal has no "cm" termcap entry. + +* Fix incorrect display when entering double-width chars in search string. + +* Fix bug in Unicode handling that missed some double width characters. + +* Update Unicode database to 9.0.0. + +====================================================================== + Major changes between "less" versions 458 and 481 * Don't overwrite history file; just append to it. Modified: stable/10/contrib/less/README ============================================================================== --- stable/10/contrib/less/README Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/README Wed Mar 7 06:39:00 2018 (r330571) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 481 + Less, version 530 - This is the distribution of less, version 481, released 31 Aug 2015. + This is the distribution of less, version 530, released 05 Dec 2017. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -23,6 +23,7 @@ Please report any problems to bug-less@gnu.org. See http://www.greenwoodsoftware.com/less for the latest info. + Source repository is at https://github.com/gwsw/less.git. ========================================================================= Modified: stable/10/contrib/less/brac.c ============================================================================== --- stable/10/contrib/less/brac.c Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/brac.c Wed Mar 7 06:39:00 2018 (r330571) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -25,13 +25,13 @@ */ public void match_brac(obrac, cbrac, forwdir, n) - register int obrac; - register int cbrac; + int obrac; + int cbrac; int forwdir; int n; { - register int c; - register int nest; + int c; + int nest; POSITION pos; int (*chget)(); Modified: stable/10/contrib/less/ch.c ============================================================================== --- stable/10/contrib/less/ch.c Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/ch.c Wed Mar 7 06:39:00 2018 (r330571) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -146,11 +146,11 @@ static int ch_addbuf(); int ch_get() { - register struct buf *bp; - register struct bufnode *bn; - register int n; - register int slept; - register int h; + struct buf *bp; + struct bufnode *bn; + int n; + int slept; + int h; POSITION pos; POSITION len; @@ -419,8 +419,8 @@ end_logfile() public void sync_logfile() { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -457,9 +457,9 @@ sync_logfile() buffered(block) BLOCKNUM block; { - register struct buf *bp; - register struct bufnode *bn; - register int h; + struct buf *bp; + struct bufnode *bn; + int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -477,7 +477,7 @@ buffered(block) */ public int ch_seek(pos) - register POSITION pos; + POSITION pos; { BLOCKNUM new_block; POSITION len; @@ -544,8 +544,8 @@ ch_end_seek() public int ch_end_buffer_seek() { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -572,8 +572,8 @@ ch_end_buffer_seek() public int ch_beg_seek() { - register struct bufnode *bn; - register struct bufnode *firstbn; + struct bufnode *bn; + struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -632,7 +632,7 @@ ch_tell() public int ch_forw_get() { - register int c; + int c; if (thisfile == NULL) return (EOI); @@ -695,7 +695,7 @@ ch_setbufspace(bufspace) public void ch_flush() { - register struct bufnode *bn; + struct bufnode *bn; if (thisfile == NULL) return; @@ -762,8 +762,8 @@ ch_flush() static int ch_addbuf() { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -787,7 +787,7 @@ ch_addbuf() static void init_hashtbl() { - register int h; + int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -802,7 +802,7 @@ init_hashtbl() static void ch_delbufs() { - register struct bufnode *bn; + struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { @@ -867,13 +867,12 @@ ch_init(f, flags) calloc(1, sizeof(struct filestate)); thisfile->buflist.next = thisfile->buflist.prev = END_OF_CHAIN; thisfile->nbufs = 0; - thisfile->flags = 0; + thisfile->flags = flags; thisfile->fpos = 0; thisfile->block = 0; thisfile->offset = 0; thisfile->file = -1; thisfile->fsize = NULL_POSITION; - ch_flags = flags; init_hashtbl(); /* * Try to seek; set CH_CANSEEK if it works. @@ -898,7 +897,7 @@ ch_close() if (thisfile == NULL) return; - if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) + if ((ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) && !(ch_flags & CH_KEEPOPEN)) { /* * We can seek or re-open, so we don't need to keep buffers. Modified: stable/10/contrib/less/charset.c ============================================================================== --- stable/10/contrib/less/charset.c Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/charset.c Wed Mar 7 06:39:00 2018 (r330571) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,13 @@ #include "charset.h" +#if MSDOS_COMPILER==WIN32C +#define WIN32_LEAN_AND_MEAN +#include +#endif + +extern int bs_mode; + public int utf_mode = 0; /* @@ -64,6 +71,8 @@ struct cs_alias { char *oname; } cs_aliases[] = { { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, { "ANSI_X3.4-1968", "ascii" }, { "US-ASCII", "ascii" }, { "latin1", "iso8859" }, @@ -133,9 +142,9 @@ public int binattr = AT_STANDOUT; ichardef(s) char *s; { - register char *cp; - register int n; - register char v; + char *cp; + int n; + char v; n = 0; v = 0; @@ -188,11 +197,11 @@ ichardef(s) */ static int icharset(name, no_error) - register char *name; + char *name; int no_error; { - register struct charset *p; - register struct cs_alias *a; + struct charset *p; + struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -213,7 +222,13 @@ icharset(name, no_error) { ichardef(p->desc); if (p->p_flag != NULL) + { +#if MSDOS_COMPILER==WIN32C + *(p->p_flag) = 1 + (GetConsoleOutputCP() != CP_UTF8); +#else *(p->p_flag) = 1; +#endif + } return (1); } } @@ -232,7 +247,7 @@ icharset(name, no_error) static void ilocale() { - register int c; + int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -249,16 +264,17 @@ ilocale() /* * Define the printing format for control (or binary utf) chars. */ - static void -setbinfmt(s, fmtvarptr, default_fmt) + public void +setfmt(s, fmtvarptr, attrptr, default_fmt) char *s; char **fmtvarptr; + int *attrptr; char *default_fmt; { if (s && utf_mode) { /* It would be too hard to account for width otherwise. */ - char *t = s; + char constant *t = s; while (*t) { if (*t < ' ' || *t > '~') @@ -280,15 +296,15 @@ setbinfmt(s, fmtvarptr, default_fmt) * Select the attributes if it starts with "*". */ attr: - if (*s == '*') + if (*s == '*' && s[1] != '\0') { switch (s[1]) { - case 'd': binattr = AT_BOLD; break; - case 'k': binattr = AT_BLINK; break; - case 's': binattr = AT_STANDOUT; break; - case 'u': binattr = AT_UNDERLINE; break; - default: binattr = AT_NORMAL; break; + case 'd': *attrptr = AT_BOLD; break; + case 'k': *attrptr = AT_BLINK; break; + case 's': *attrptr = AT_STANDOUT; break; + case 'u': *attrptr = AT_UNDERLINE; break; + default: *attrptr = AT_NORMAL; break; } s += 2; } @@ -303,7 +319,15 @@ set_charset() { char *s; +#if MSDOS_COMPILER==WIN32C /* + * If the Windows console is using UTF-8, we'll use it too. + */ + if (GetConsoleOutputCP() == CP_UTF8) + if (icharset("utf-8", 1)) + return; +#endif + /* * See if environment variable LESSCHARSET is defined. */ s = lgetenv("LESSCHARSET"); @@ -352,6 +376,7 @@ set_charset() * rather than from predefined charset entry. */ ilocale(); +#else #if MSDOS_COMPILER /* * Default to "dos". @@ -381,10 +406,10 @@ init_charset() set_charset(); s = lgetenv("LESSBINFMT"); - setbinfmt(s, &binfmt, "*s<%02X>"); + setfmt(s, &binfmt, &binattr, "*s<%02X>"); s = lgetenv("LESSUTFBINFMT"); - setbinfmt(s, &utfbinfmt, ""); + setfmt(s, &utfbinfmt, &binattr, ""); } /* @@ -484,7 +509,7 @@ prutfchar(ch) */ public int utf_len(ch) - char ch; + unsigned char ch; { if ((ch & 0x80) == 0) return 1; @@ -506,17 +531,18 @@ utf_len(ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(s, slen) - unsigned char *s; +is_utf8_well_formed(ss, slen) + char *ss; int slen; { int i; int len; + unsigned char *s = (unsigned char *) ss; if (IS_UTF8_INVALID(s[0])) return (0); - len = utf_len((char) s[0]); + len = utf_len(s[0]); if (len > slen) return (0); if (len == 1) @@ -540,40 +566,25 @@ is_utf8_well_formed(s, slen) } /* - * Return number of invalid UTF-8 sequences found in a buffer. + * Skip bytes until a UTF-8 lead byte (11xxxxxx) or ASCII byte (0xxxxxxx) is found. */ - public int -utf_bin_count(data, len) - unsigned char *data; - int len; + public void +utf_skip_to_lead(pp, limit) + char **pp; + char *limit; { - int bin_count = 0; - while (len > 0) - { - if (is_utf8_well_formed(data, len)) - { - int clen = utf_len(*data); - data += clen; - len -= clen; - } else - { - /* Skip to next lead byte. */ - bin_count++; - do { - ++data; - --len; - } while (len > 0 && !IS_UTF8_LEAD(*data)); - } - } - return (bin_count); + do { + ++(*pp); + } while (*pp < limit && !IS_UTF8_LEAD((*pp)[0] & 0377) && !IS_ASCII_OCTET((*pp)[0])); } + /* * Get the value of a UTF-8 character. */ public LWCHAR get_wchar(p) - char *p; + constant char *p; { switch (utf_len(p[0])) { @@ -677,7 +688,7 @@ put_wchar(pp, ch) step_char(pp, dir, limit) char **pp; signed int dir; - char *limit; + constant char *limit; { LWCHAR ch; int len; @@ -687,16 +698,16 @@ step_char(pp, dir, limit) { /* It's easy if chars are one byte. */ if (dir > 0) - ch = (LWCHAR) ((p < limit) ? *p++ : 0); + ch = (LWCHAR) (unsigned char) ((p < limit) ? *p++ : 0); else - ch = (LWCHAR) ((p > limit) ? *--p : 0); + ch = (LWCHAR) (unsigned char) ((p > limit) ? *--p : 0); } else if (dir > 0) { len = utf_len(*p); if (p + len > limit) { ch = 0; - p = limit; + p = (char *) limit; } else { ch = get_wchar(p); @@ -737,6 +748,10 @@ DECLARE_RANGE_TABLE_START(wide) #include "wide.uni" DECLARE_RANGE_TABLE_END(wide) +DECLARE_RANGE_TABLE_START(fmt) +#include "fmt.uni" +DECLARE_RANGE_TABLE_END(fmt) + /* comb_table is special pairs, not ranges. */ static struct wchar_range comb_table[] = { {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, @@ -777,7 +792,8 @@ is_in_table(ch, table) is_composing_char(ch) LWCHAR ch; { - return is_in_table(ch, &compose_table); + return is_in_table(ch, &compose_table) || + (bs_mode != BS_CONTROL && is_in_table(ch, &fmt_table)); } /* @@ -787,7 +803,21 @@ is_composing_char(ch) is_ubin_char(ch) LWCHAR ch; { - return is_in_table(ch, &ubin_table); + int ubin = is_in_table(ch, &ubin_table) || + (bs_mode == BS_CONTROL && is_in_table(ch, &fmt_table)); +#if MSDOS_COMPILER==WIN32C + if (!ubin && utf_mode == 2 && ch < 0x10000) + { + /* + * Consider it binary if it can't be converted. + */ + BOOL used_default = TRUE; + WideCharToMultiByte(GetConsoleOutputCP(), WC_NO_BEST_FIT_CHARS, (LPCWSTR) &ch, 1, NULL, 0, NULL, &used_default); + if (used_default) + ubin = 1; + } +#endif + return ubin; } /* Modified: stable/10/contrib/less/charset.h ============================================================================== --- stable/10/contrib/less/charset.h Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/charset.h Wed Mar 7 06:39:00 2018 (r330571) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/10/contrib/less/cmd.h ============================================================================== --- stable/10/contrib/less/cmd.h Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/cmd.h Wed Mar 7 06:39:00 2018 (r330571) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -8,127 +8,131 @@ */ -#define MAX_USERCMD 1000 -#define MAX_CMDLEN 16 +#define MAX_USERCMD 1000 +#define MAX_CMDLEN 16 -#define A_B_LINE 2 -#define A_B_SCREEN 3 -#define A_B_SCROLL 4 -#define A_B_SEARCH 5 -#define A_DIGIT 6 -#define A_DISP_OPTION 7 -#define A_DEBUG 8 -#define A_EXAMINE 9 -#define A_FIRSTCMD 10 -#define A_FREPAINT 11 -#define A_F_LINE 12 -#define A_F_SCREEN 13 -#define A_F_SCROLL 14 -#define A_F_SEARCH 15 -#define A_GOEND 16 -#define A_GOLINE 17 -#define A_GOMARK 18 -#define A_HELP 19 -#define A_NEXT_FILE 20 -#define A_PERCENT 21 -#define A_PREFIX 22 -#define A_PREV_FILE 23 -#define A_QUIT 24 -#define A_REPAINT 25 -#define A_SETMARK 26 -#define A_SHELL 27 -#define A_STAT 28 -#define A_FF_LINE 29 -#define A_BF_LINE 30 -#define A_VERSION 31 -#define A_VISUAL 32 -#define A_F_WINDOW 33 -#define A_B_WINDOW 34 -#define A_F_BRACKET 35 -#define A_B_BRACKET 36 -#define A_PIPE 37 -#define A_INDEX_FILE 38 -#define A_UNDO_SEARCH 39 -#define A_FF_SCREEN 40 -#define A_LSHIFT 41 -#define A_RSHIFT 42 -#define A_AGAIN_SEARCH 43 -#define A_T_AGAIN_SEARCH 44 -#define A_REVERSE_SEARCH 45 -#define A_T_REVERSE_SEARCH 46 -#define A_OPT_TOGGLE 47 -#define A_OPT_SET 48 -#define A_OPT_UNSET 49 -#define A_F_FOREVER 50 -#define A_GOPOS 51 -#define A_REMOVE_FILE 52 -#define A_NEXT_TAG 53 -#define A_PREV_TAG 54 -#define A_FILTER 55 -#define A_F_UNTIL_HILITE 56 -#define A_GOEND_BUF 57 +#define A_B_LINE 2 +#define A_B_SCREEN 3 +#define A_B_SCROLL 4 +#define A_B_SEARCH 5 +#define A_DIGIT 6 +#define A_DISP_OPTION 7 +#define A_DEBUG 8 +#define A_EXAMINE 9 +#define A_FIRSTCMD 10 +#define A_FREPAINT 11 +#define A_F_LINE 12 +#define A_F_SCREEN 13 +#define A_F_SCROLL 14 +#define A_F_SEARCH 15 +#define A_GOEND 16 +#define A_GOLINE 17 +#define A_GOMARK 18 +#define A_HELP 19 +#define A_NEXT_FILE 20 +#define A_PERCENT 21 +#define A_PREFIX 22 +#define A_PREV_FILE 23 +#define A_QUIT 24 +#define A_REPAINT 25 +#define A_SETMARK 26 +#define A_SHELL 27 +#define A_STAT 28 +#define A_FF_LINE 29 +#define A_BF_LINE 30 +#define A_VERSION 31 +#define A_VISUAL 32 +#define A_F_WINDOW 33 +#define A_B_WINDOW 34 +#define A_F_BRACKET 35 +#define A_B_BRACKET 36 +#define A_PIPE 37 +#define A_INDEX_FILE 38 +#define A_UNDO_SEARCH 39 +#define A_FF_SCREEN 40 +#define A_LSHIFT 41 +#define A_RSHIFT 42 +#define A_AGAIN_SEARCH 43 +#define A_T_AGAIN_SEARCH 44 +#define A_REVERSE_SEARCH 45 +#define A_T_REVERSE_SEARCH 46 +#define A_OPT_TOGGLE 47 +#define A_OPT_SET 48 +#define A_OPT_UNSET 49 +#define A_F_FOREVER 50 +#define A_GOPOS 51 +#define A_REMOVE_FILE 52 +#define A_NEXT_TAG 53 +#define A_PREV_TAG 54 +#define A_FILTER 55 +#define A_F_UNTIL_HILITE 56 +#define A_GOEND_BUF 57 +#define A_LLSHIFT 58 +#define A_RRSHIFT 59 +#define A_CLRMARK 62 +#define A_SETMARKBOT 63 -#define A_INVALID 100 -#define A_NOACTION 101 -#define A_UINVALID 102 -#define A_END_LIST 103 -#define A_SPECIAL_KEY 104 +#define A_INVALID 100 +#define A_NOACTION 101 +#define A_UINVALID 102 +#define A_END_LIST 103 +#define A_SPECIAL_KEY 104 -#define A_SKIP 127 +#define A_SKIP 127 -#define A_EXTRA 0200 +#define A_EXTRA 0200 /* Line editing characters */ -#define EC_BACKSPACE 1 -#define EC_LINEKILL 2 -#define EC_RIGHT 3 -#define EC_LEFT 4 -#define EC_W_LEFT 5 -#define EC_W_RIGHT 6 -#define EC_INSERT 7 -#define EC_DELETE 8 -#define EC_HOME 9 -#define EC_END 10 -#define EC_W_BACKSPACE 11 -#define EC_W_DELETE 12 -#define EC_UP 13 -#define EC_DOWN 14 -#define EC_EXPAND 15 -#define EC_F_COMPLETE 17 -#define EC_B_COMPLETE 18 -#define EC_LITERAL 19 -#define EC_ABORT 20 +#define EC_BACKSPACE 1 +#define EC_LINEKILL 2 +#define EC_RIGHT 3 +#define EC_LEFT 4 +#define EC_W_LEFT 5 +#define EC_W_RIGHT 6 +#define EC_INSERT 7 +#define EC_DELETE 8 +#define EC_HOME 9 +#define EC_END 10 +#define EC_W_BACKSPACE 11 +#define EC_W_DELETE 12 +#define EC_UP 13 +#define EC_DOWN 14 +#define EC_EXPAND 15 +#define EC_F_COMPLETE 17 +#define EC_B_COMPLETE 18 +#define EC_LITERAL 19 +#define EC_ABORT 20 -#define EC_NOACTION 101 -#define EC_UINVALID 102 +#define EC_NOACTION 101 +#define EC_UINVALID 102 /* Flags for editchar() */ -#define EC_PEEK 01 -#define EC_NOHISTORY 02 -#define EC_NOCOMPLETE 04 -#define EC_NORIGHTLEFT 010 +#define EC_PEEK 01 +#define EC_NOHISTORY 02 +#define EC_NOCOMPLETE 04 +#define EC_NORIGHTLEFT 010 /* Environment variable stuff */ -#define EV_OK 01 +#define EV_OK 01 /* Special keys (keys which output different strings on different terminals) */ -#define SK_SPECIAL_KEY CONTROL('K') -#define SK_RIGHT_ARROW 1 -#define SK_LEFT_ARROW 2 -#define SK_UP_ARROW 3 -#define SK_DOWN_ARROW 4 -#define SK_PAGE_UP 5 -#define SK_PAGE_DOWN 6 -#define SK_HOME 7 -#define SK_END 8 -#define SK_DELETE 9 -#define SK_INSERT 10 -#define SK_CTL_LEFT_ARROW 11 -#define SK_CTL_RIGHT_ARROW 12 -#define SK_CTL_DELETE 13 -#define SK_F1 14 -#define SK_BACKTAB 15 -#define SK_CTL_BACKSPACE 16 -#define SK_CONTROL_K 40 +#define SK_SPECIAL_KEY CONTROL('K') +#define SK_RIGHT_ARROW 1 +#define SK_LEFT_ARROW 2 +#define SK_UP_ARROW 3 +#define SK_DOWN_ARROW 4 +#define SK_PAGE_UP 5 +#define SK_PAGE_DOWN 6 +#define SK_HOME 7 +#define SK_END 8 +#define SK_DELETE 9 +#define SK_INSERT 10 +#define SK_CTL_LEFT_ARROW 11 +#define SK_CTL_RIGHT_ARROW 12 +#define SK_CTL_DELETE 13 +#define SK_F1 14 +#define SK_BACKTAB 15 +#define SK_CTL_BACKSPACE 16 +#define SK_CONTROL_K 40 Modified: stable/10/contrib/less/cmdbuf.c ============================================================================== --- stable/10/contrib/less/cmdbuf.c Wed Mar 7 06:13:47 2018 (r330570) +++ stable/10/contrib/less/cmdbuf.c Wed Mar 7 06:39:00 2018 (r330571) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -40,7 +40,7 @@ static int in_completion = 0; static char *tk_text; static char *tk_original; static char *tk_ipoint; -static char *tk_trial; +static char *tk_trial = NULL; static struct textlist tk_tlist; #endif @@ -76,25 +76,25 @@ struct mlist */ struct mlist mlist_search = { &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; -public void * constant ml_search = (void *) &mlist_search; +public void *ml_search = (void *) &mlist_search; struct mlist mlist_examine = { &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; -public void * constant ml_examine = (void *) &mlist_examine; +public void *ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; -public void * constant ml_shell = (void *) &mlist_shell; +public void *ml_shell = (void *) &mlist_shell; #endif #else /* CMD_HISTORY */ /* If CMD_HISTORY is off, these are just flags. */ -public void * constant ml_search = (void *)1; -public void * constant ml_examine = (void *)2; +public void *ml_search = (void *)1; +public void *ml_examine = (void *)2; #if SHELL_ESCAPE || PIPEC -public void * constant ml_shell = (void *)3; +public void *ml_shell = (void *)3; #endif #endif /* CMD_HISTORY */ @@ -141,28 +141,26 @@ clear_cmd() */ public void cmd_putstr(s) - char *s; + constant char *s; { LWCHAR prev_ch = 0; LWCHAR ch; - char *endline = s + strlen(s); + constant char *endline = s + strlen(s); while (*s != '\0') { - char *ns = s; + char *ns = (char *) s; + int width; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); if (!utf_mode) - { - cmd_col++; - prompt_col++; - } else if (!is_composing_char(ch) && - !is_combining_char(prev_ch, ch)) - { - int width = is_wide_char(ch) ? 2 : 1; - cmd_col += width; - prompt_col += width; - } + width = 1; + else if (is_composing_char(ch) || is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; + cmd_col += width; + prompt_col += width; prev_ch = ch; } } @@ -187,6 +185,8 @@ len_cmdbuf() /* * Common part of cmd_step_right() and cmd_step_left(). + * {{ Returning pwidth and bswidth separately is a historical artifact + * since they're always the same. Maybe clean this up someday. }} */ static char * cmd_step_common(p, ch, len, pwidth, bswidth) @@ -197,58 +197,32 @@ cmd_step_common(p, ch, len, pwidth, bswidth) int *bswidth; { char *pr; + int width; if (len == 1) { pr = prchar((int) ch); - if (pwidth != NULL || bswidth != NULL) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } + width = (int) strlen(pr); } else { pr = prutfchar(ch); - if (pwidth != NULL || bswidth != NULL) + if (is_composing_char(ch)) + width = 0; + else if (is_ubin_char(ch)) + width = (int) strlen(pr); + else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Wed Mar 7 13:40:16 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B5A2F2D059; Wed, 7 Mar 2018 13:40:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F01C973DC2; Wed, 7 Mar 2018 13:40:15 +0000 (UTC) (envelope-from avg@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 E995122076; Wed, 7 Mar 2018 13:40:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w27DeFjA018079; Wed, 7 Mar 2018 13:40:15 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w27DeFZ8018078; Wed, 7 Mar 2018 13:40:15 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803071340.w27DeFZ8018078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 7 Mar 2018 13:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330589 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 330589 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 13:40:16 -0000 Author: avg Date: Wed Mar 7 13:40:15 2018 New Revision: 330589 URL: https://svnweb.freebsd.org/changeset/base/330589 Log: MFC r329714: MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Wed Mar 7 13:39:10 2018 (r330588) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c Wed Mar 7 13:40:15 2018 (r330589) @@ -360,8 +360,8 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **d typedef struct zfs_ecksum_info { /* histograms of set and cleared bits by bit number in a 64-bit word */ - uint16_t zei_histogram_set[sizeof (uint64_t) * NBBY]; - uint16_t zei_histogram_cleared[sizeof (uint64_t) * NBBY]; + uint32_t zei_histogram_set[sizeof (uint64_t) * NBBY]; + uint32_t zei_histogram_cleared[sizeof (uint64_t) * NBBY]; /* inline arrays of bits set and cleared. */ uint64_t zei_bits_set[ZFM_MAX_INLINE]; @@ -386,7 +386,7 @@ typedef struct zfs_ecksum_info { } zfs_ecksum_info_t; static void -update_histogram(uint64_t value_arg, uint16_t *hist, uint32_t *count) +update_histogram(uint64_t value_arg, uint32_t *hist, uint32_t *count) { size_t i; size_t bits = 0; @@ -552,7 +552,7 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *in if (badbuf == NULL || goodbuf == NULL) return (eip); - ASSERT3U(nui64s, <=, UINT16_MAX); + ASSERT3U(nui64s, <=, UINT32_MAX); ASSERT3U(size, ==, nui64s * sizeof (uint64_t)); ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); ASSERT3U(size, <=, UINT32_MAX); @@ -654,10 +654,10 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *in } else { fm_payload_set(ereport, FM_EREPORT_PAYLOAD_ZFS_BAD_SET_HISTOGRAM, - DATA_TYPE_UINT16_ARRAY, + DATA_TYPE_UINT32_ARRAY, NBBY * sizeof (uint64_t), eip->zei_histogram_set, FM_EREPORT_PAYLOAD_ZFS_BAD_CLEARED_HISTOGRAM, - DATA_TYPE_UINT16_ARRAY, + DATA_TYPE_UINT32_ARRAY, NBBY * sizeof (uint64_t), eip->zei_histogram_cleared, NULL); } From owner-svn-src-stable-10@freebsd.org Wed Mar 7 15:02:14 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2F98F34571; Wed, 7 Mar 2018 15:02:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64FDA78FEC; Wed, 7 Mar 2018 15:02:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FDD722F0C; Wed, 7 Mar 2018 15:02:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w27F2EOg063632; Wed, 7 Mar 2018 15:02:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w27F2E96063630; Wed, 7 Mar 2018 15:02:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803071502.w27F2E96063630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 7 Mar 2018 15:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330605 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Commit-Revision: 330605 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 15:02:14 -0000 Author: gjb Date: Wed Mar 7 15:02:13 2018 New Revision: 330605 URL: https://svnweb.freebsd.org/changeset/base/330605 Log: Document EN-18:01, EN-18:02, SA-18:01, SA-18:02. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/errata.xml stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/errata.xml ============================================================================== --- stable/10/release/doc/share/xml/errata.xml Wed Mar 7 14:51:50 2018 (r330604) +++ stable/10/release/doc/share/xml/errata.xml Wed Mar 7 15:02:13 2018 (r330605) @@ -25,6 +25,21 @@ Timezone database information update + + + FreeBSD-EN-18:01.tzdata + 07 March 2018 + Timezone database information + update + + + + FreeBSD-EN-18:02.file + 07 March 2018 + Stack-based buffer overflow + Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Wed Mar 7 14:51:50 2018 (r330604) +++ stable/10/release/doc/share/xml/security.xml Wed Mar 7 15:02:13 2018 (r330605) @@ -68,6 +68,21 @@ 09 December 2017 Multiple vulnerabilities + + + FreeBSD-SA-18:01.ipsec + 07 March 2018 + Fix IPSEC validation and + use-after-free + + + + FreeBSD-SA-18:02.ntp + 07 March 2018 + Multiple vulnerabilities + From owner-svn-src-stable-10@freebsd.org Wed Mar 7 16:55:16 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453EDF3F174; Wed, 7 Mar 2018 16:55:16 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECE49806EF; Wed, 7 Mar 2018 16:55:15 +0000 (UTC) (envelope-from gordon@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 E7EFB2476E; Wed, 7 Mar 2018 16:55:15 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w27GtFju020441; Wed, 7 Mar 2018 16:55:15 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w27GtFQJ020440; Wed, 7 Mar 2018 16:55:15 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201803071655.w27GtFQJ020440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Wed, 7 Mar 2018 16:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330609 - stable/10/sys/netipsec X-SVN-Group: stable-10 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/10/sys/netipsec X-SVN-Commit-Revision: 330609 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 16:55:16 -0000 Author: gordon Date: Wed Mar 7 16:55:15 2018 New Revision: 330609 URL: https://svnweb.freebsd.org/changeset/base/330609 Log: Fixup the AH patch to properly compile. Modified: stable/10/sys/netipsec/xform_ah.c Modified: stable/10/sys/netipsec/xform_ah.c ============================================================================== --- stable/10/sys/netipsec/xform_ah.c Wed Mar 7 15:23:07 2018 (r330608) +++ stable/10/sys/netipsec/xform_ah.c Wed Mar 7 16:55:15 2018 (r330609) @@ -603,11 +603,11 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski DPRINTF(("%s: bad mbuf length %u (expecting %lu)" " for packet in SA %s/%08lx\n", __func__, m->m_pkthdr.len, (u_long) (skip + authsize + rplen), - ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)), + ipsec_address(&sav->sah->saidx.dst), (u_long) ntohl(sav->spi))); AHSTAT_INC(ahs_badauthl); - error = EACCES; - goto bad; + m_freem(m); + return EACCES; } AHSTAT_ADD(ahs_ibytes, m->m_pkthdr.len - skip - hl); From owner-svn-src-stable-10@freebsd.org Thu Mar 8 17:14:16 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFB71F44F2A; Thu, 8 Mar 2018 17:14:16 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 607D586624; Thu, 8 Mar 2018 17:14:16 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B4DA13C03; Thu, 8 Mar 2018 17:14:16 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w28HEG0c057136; Thu, 8 Mar 2018 17:14:16 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w28HEGXS057135; Thu, 8 Mar 2018 17:14:16 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803081714.w28HEGXS057135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Thu, 8 Mar 2018 17:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330664 - stable/10/usr.sbin/syslogd X-SVN-Group: stable-10 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/10/usr.sbin/syslogd X-SVN-Commit-Revision: 330664 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 17:14:16 -0000 Author: dab Date: Thu Mar 8 17:14:16 2018 New Revision: 330664 URL: https://svnweb.freebsd.org/changeset/base/330664 Log: MFC r330034 Fix a memory leak in syslogd A memory leak in syslogd for processing of forward actions was reported. This modification adapts the patch submitted with that bug to fix the leak. PR: 198385 Submitted by: Sreeram Reported by: Sreeram Sponsored by: Dell EMC Modified: stable/10/usr.sbin/syslogd/syslogd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/10/usr.sbin/syslogd/syslogd.c Thu Mar 8 17:04:36 2018 (r330663) +++ stable/10/usr.sbin/syslogd/syslogd.c Thu Mar 8 17:14:16 2018 (r330664) @@ -161,7 +161,7 @@ STAILQ_HEAD(, funix) funixes = { &funix_default, * This structure represents the files that will have log * copies printed. * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY - * or if f_type if F_PIPE and f_pid > 0. + * or if f_type is F_PIPE and f_pid > 0. */ struct filed { @@ -353,10 +353,16 @@ close_filed(struct filed *f) return; switch (f->f_type) { + case F_FORW: + if (f->f_un.f_forw.f_addr) { + freeaddrinfo(f->f_un.f_forw.f_addr); + f->f_un.f_forw.f_addr = NULL; + } + /*FALLTHROUGH*/ + case F_FILE: case F_TTY: case F_CONSOLE: - case F_FORW: f->f_type = F_UNUSED; break; case F_PIPE: From owner-svn-src-stable-10@freebsd.org Fri Mar 9 01:21:23 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CC28F4425A; Fri, 9 Mar 2018 01:21:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 434497B5DC; Fri, 9 Mar 2018 01:21:23 +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 3E38B188F9; Fri, 9 Mar 2018 01:21:23 +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 w291LNPo016021; Fri, 9 Mar 2018 01:21:23 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w291LNPo016020; Fri, 9 Mar 2018 01:21:23 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201803090121.w291LNPo016020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 9 Mar 2018 01:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330678 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 330678 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 01:21:23 -0000 Author: brooks Date: Fri Mar 9 01:21:22 2018 New Revision: 330678 URL: https://svnweb.freebsd.org/changeset/base/330678 Log: MFC r330527: Use umtx_copyin_umtx_time32() in __umtx_op_lock_umutex_compat32(). Non-NULL timeouts where copied in improperly and could produce failures due to incompatible data structures. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14587 Modified: stable/10/sys/kern/kern_umtx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_umtx.c ============================================================================== --- stable/10/sys/kern/kern_umtx.c Fri Mar 9 01:17:03 2018 (r330677) +++ stable/10/sys/kern/kern_umtx.c Fri Mar 9 01:21:22 2018 (r330678) @@ -3865,7 +3865,7 @@ __umtx_op_lock_umutex_compat32(struct thread *td, stru if (uap->uaddr2 == NULL) tm_p = NULL; else { - error = umtx_copyin_umtx_time(uap->uaddr2, + error = umtx_copyin_umtx_time32(uap->uaddr2, (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); From owner-svn-src-stable-10@freebsd.org Fri Mar 9 02:55:31 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BA37F4A200; Fri, 9 Mar 2018 02:55:31 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71BCE7E6F0; Fri, 9 Mar 2018 02:55:30 +0000 (UTC) (envelope-from rpokala@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 0293B1982F; Fri, 9 Mar 2018 02:55:28 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w292tSAs062104; Fri, 9 Mar 2018 02:55:28 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w292tS4K062097; Fri, 9 Mar 2018 02:55:28 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201803090255.w292tS4K062097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 9 Mar 2018 02:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330680 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/imcsmb sys/i386/conf sys/modules/i2c/controllers sys/modules/i2c/controllers/imcsmb X-SVN-Group: stable-10 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/imcsmb sys/i386/conf sys/modules/i2c/controllers sys/modules/i2c/controllers/imcsmb X-SVN-Commit-Revision: 330680 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 02:55:31 -0000 Author: rpokala Date: Fri Mar 9 02:55:27 2018 New Revision: 330680 URL: https://svnweb.freebsd.org/changeset/base/330680 Log: MFC r330304: imcsmb(4): Intel integrated Memory Controller (iMC) SMBus controller driver imcsmb(4) provides smbus(4) support for the SMBus controller functionality in the integrated Memory Controllers (iMCs) embedded in Intel Sandybridge- Xeon, Ivybridge-Xeon, Haswell-Xeon, and Broadwell-Xeon CPUs. Each CPU implements one or more iMCs, depending on the number of cores; each iMC implements two SMBus controllers (iMC-SMBs). *** IMPORTANT NOTE *** Because motherboard firmware or the BMC might try to use the iMC-SMBs for monitoring DIMM temperatures and/or managing an NVDIMM, the driver might need to temporarily disable those functions, or take a hardware interlock, before using the iMC-SMBs. Details on how to do this may vary from board to board, and the procedure may be proprietary. It is strongly suggested that anyone wishing to use this driver contact their motherboard vendor, and modify the driver as described in the manual page and in the driver itself. (For what it's worth, the driver as-is has been tested on various SuperMicro motherboards.) Added: stable/10/share/man/man4/imcsmb.4 - copied unchanged from r330304, head/share/man/man4/imcsmb.4 stable/10/sys/dev/imcsmb/ - copied from r330304, head/sys/dev/imcsmb/ stable/10/sys/modules/i2c/controllers/imcsmb/ - copied from r330304, head/sys/modules/i2c/controllers/imcsmb/ Modified: stable/10/share/man/man4/Makefile stable/10/sys/amd64/conf/NOTES stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/i386/conf/NOTES stable/10/sys/modules/i2c/controllers/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Fri Mar 9 02:55:22 2018 (r330679) +++ stable/10/share/man/man4/Makefile Fri Mar 9 02:55:27 2018 (r330680) @@ -195,6 +195,7 @@ MAN= aac.4 \ iicbus.4 \ iicsmb.4 \ iir.4 \ + ${_imcsmb.4} \ inet.4 \ inet6.4 \ intpm.4 \ @@ -786,6 +787,7 @@ _if_vmx.4= if_vmx.4 _if_vtnet.4= if_vtnet.4 _if_vxge.4= if_vxge.4 _if_wpi.4= if_wpi.4 +_imcsmb.4= imcsmb.4 _ipmi.4= ipmi.4 _io.4= io.4 _lindev.4= lindev.4 Copied: stable/10/share/man/man4/imcsmb.4 (from r330304, head/share/man/man4/imcsmb.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/imcsmb.4 Fri Mar 9 02:55:27 2018 (r330680, copy of r330304, head/share/man/man4/imcsmb.4) @@ -0,0 +1,133 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2018 Panasas +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 2, 2018 +.Dt IMCSMB 4 +.Os +.Sh NAME +.Nm imcsmb +.Nd Intel integrated Memory Controller (iMC) SMBus controller driver +.Sh SYNOPSIS +.Cd device pci +.Cd device smbus +.Cd device imcsmb +.Pp +Alternatively, to load the driver as a module at boot time, place the following +line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +imcsmb_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr smbus 4 +support for the SMBus controller functionality in the integrated Memory +Controllers (iMCs) embedded in Intel Sandybridge-Xeon, Ivybridge-Xeon, +Haswell-Xeon, and Broadwell-Xeon CPUs. +Each CPU implements one or more iMCs, depending on the number of cores; +each iMC implements two SMBus controllers (iMC-SMBs). +The iMC-SMBs are used by the iMCs to read configuration information from the +DIMMs during POST. +They may also be used, by motherboard firmware or a BMC, to monitor the +temperature of the DIMMs. +.Pp +The iMC-SMBs are +.Sy not +general-purpose SMBus controllers. +By their nature, they are only ever attached to DIMMs, so they implement only +the SMBus operations need for communicating with DIMMs. +Specifically: +.Pp +.Bl -dash -offset indent -compact +.It +READB +.It +READW +.It +WRITEB +.It +WRITEW +.El +.Pp +A more detailed discussion of the hardware and driver architecture can be found +at the top of +.Pa sys/dev/imcsmb/imcsmb_pci.c . +.Sh WARNINGS +As mentioned above, firmware might use the iMC-SMBs to read DIMM temperatures. +The public iMC documentation does not describe any sort of coordination +mechanism to prevent requests from different sources -- such as the motherboard +firmware, a BMC, or the operating system -- from interfering with each other. +.Pp +.Bf Sy +Therefore, it is highly recommended that developers contact the motherboard +vendor for any board-specific instructions on how to disable and re-enable DIMM +temperature monitoring. +.Ef +.Pp +DIMM temperature monitoring should be disabled before returning from +.Fn imcsmb_pci_request_bus , +and re-enabled before returning from +.Fn imcsmb_pci_release_bus . +The driver includes comments to that effect at the appropriate locations. +The driver has been tested and shown to work, with only that type of +modification, on certain motherboards from Intel. +.Po +Unfortunately, those modifications were based on material covered under a +non-disclosure agreement, and therefore are not included in this driver. +.Pc +The driver has also been tested and shown to work as-is on various motherboards +from SuperMicro. +.Pp +The +.Xr smb 4 +driver will connect to the +.Xr smbus 4 +instances created by +.Nm . +However, since the IMC-SMBs are not general-purpose SMBus controllers, using +.Xr smbmsg 8 +with those +.Xr smb 4 +devices is not supported. +.Sh SEE ALSO +.Xr jedec_dimm 4 , +.Xr smbus 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was originally written for Panasas by +.An Joe Kloss . +It was substantially refactored, and this manual page was written, by +.An Ravi Pokala Aq Mt rpokala@freebsd.org Modified: stable/10/sys/amd64/conf/NOTES ============================================================================== --- stable/10/sys/amd64/conf/NOTES Fri Mar 9 02:55:22 2018 (r330679) +++ stable/10/sys/amd64/conf/NOTES Fri Mar 9 02:55:27 2018 (r330680) @@ -444,6 +444,11 @@ device hptiop device ips # +# Intel integrated Memory Controller (iMC) SMBus controller +# Sandybridge-Xeon, Ivybridge-Xeon, Haswell-Xeon, Broadwell-Xeon +device imcsmb + +# # Intel C600 (Patsburg) integrated SAS controller device isci options ISCI_LOGGING # enable debugging in isci HAL Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Fri Mar 9 02:55:22 2018 (r330679) +++ stable/10/sys/conf/files.amd64 Fri Mar 9 02:55:27 2018 (r330680) @@ -202,6 +202,8 @@ dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb +dev/imcsmb/imcsmb.c optional imcsmb +dev/imcsmb/imcsmb_pci.c optional imcsmb pci dev/io/iodev.c optional io dev/ioat/ioat.c optional ioat pci dev/ioat/ioat_test.c optional ioat pci Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Fri Mar 9 02:55:22 2018 (r330679) +++ stable/10/sys/conf/files.i386 Fri Mar 9 02:55:27 2018 (r330680) @@ -265,6 +265,8 @@ dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb +dev/imcsmb/imcsmb.c optional imcsmb +dev/imcsmb/imcsmb_pci.c optional imcsmb pci dev/io/iodev.c optional io dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_acpi.c optional ipmi acpi Modified: stable/10/sys/i386/conf/NOTES ============================================================================== --- stable/10/sys/i386/conf/NOTES Fri Mar 9 02:55:22 2018 (r330679) +++ stable/10/sys/i386/conf/NOTES Fri Mar 9 02:55:27 2018 (r330680) @@ -752,6 +752,11 @@ device hptrr device hptiop # +# Intel integrated Memory Controller (iMC) SMBus controller +# Sandybridge-Xeon, Ivybridge-Xeon, Haswell-Xeon, Broadwell-Xeon +device imcsmb + +# # IBM (now Adaptec) ServeRAID controllers device ips Modified: stable/10/sys/modules/i2c/controllers/Makefile ============================================================================== --- stable/10/sys/modules/i2c/controllers/Makefile Fri Mar 9 02:55:22 2018 (r330679) +++ stable/10/sys/modules/i2c/controllers/Makefile Fri Mar 9 02:55:27 2018 (r330680) @@ -6,4 +6,8 @@ SUBDIR = lpbb SUBDIR = alpm amdpm amdsmb ichsmb intpm ismt nfsmb viapm lpbb pcf .endif +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +SUBDIR += imcsmb +.endif + .include From owner-svn-src-stable-10@freebsd.org Fri Mar 9 14:39:29 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 590D2F2DA1C; Fri, 9 Mar 2018 14:39:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07CCB79E37; Fri, 9 Mar 2018 14:39:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02B2820625; Fri, 9 Mar 2018 14:39:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w29EdSLe015419; Fri, 9 Mar 2018 14:39:28 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w29EdS3F015418; Fri, 9 Mar 2018 14:39:28 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803091439.w29EdS3F015418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Fri, 9 Mar 2018 14:39:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330693 - stable/10/sbin/dhclient X-SVN-Group: stable-10 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/10/sbin/dhclient X-SVN-Commit-Revision: 330693 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 14:39:29 -0000 Author: dab Date: Fri Mar 9 14:39:28 2018 New Revision: 330693 URL: https://svnweb.freebsd.org/changeset/base/330693 Log: MFC r330085: dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP When dhclient first starts, if an old IP address exists in the dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s) in an attempt to re-obtain the old IP address again. These messages contain the old IP as a requested-IP-address option in the message body (correct) but also use the old IP address as the packet's source IP (incorrect). RFC2131 sec 4.1 states: DHCP messages broadcast by a client prior to that client obtaining its IP address must have the source address field in the IP header set to 0. The use of the old IP as the packet's source address is incorrect if (a) the computer is now on a different network or (b) it is on the same network, but the old IP has been reallocated to another host. Fix dhclient to use 0.0.0.0 as the source IP in this circumstance without removing any existing functionality. Any previously-used old IP is still requested in the body of an early DHCPREQUEST message. PR: 199378 Submitted by: J.R. Oldroyd Reported by: J.R. Oldroyd Sponsored by: Dell EMC Modified: stable/10/sbin/dhclient/dhclient.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/dhclient/dhclient.c ============================================================================== --- stable/10/sbin/dhclient/dhclient.c Fri Mar 9 14:38:46 2018 (r330692) +++ stable/10/sbin/dhclient/dhclient.c Fri Mar 9 14:39:28 2018 (r330693) @@ -1460,7 +1460,8 @@ cancel: memcpy(&to.s_addr, ip->client->destination.iabuf, sizeof(to.s_addr)); - if (ip->client->state != S_REQUESTING) + if (ip->client->state != S_REQUESTING && + ip->client->state != S_REBOOTING) memcpy(&from, ip->client->active->address.iabuf, sizeof(from)); else From owner-svn-src-stable-10@freebsd.org Fri Mar 9 14:45:48 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5221EF2E265; Fri, 9 Mar 2018 14:45:48 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07B357A68C; Fri, 9 Mar 2018 14:45:48 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0287C207C8; Fri, 9 Mar 2018 14:45:48 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w29Ejl96021196; Fri, 9 Mar 2018 14:45:47 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w29Ejluq021194; Fri, 9 Mar 2018 14:45:47 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803091445.w29Ejluq021194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Fri, 9 Mar 2018 14:45:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330695 - in stable/10/usr.sbin/pw: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: in stable/10/usr.sbin/pw: . tests X-SVN-Commit-Revision: 330695 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 14:45:48 -0000 Author: dab Date: Fri Mar 9 14:45:47 2018 New Revision: 330695 URL: https://svnweb.freebsd.org/changeset/base/330695 Log: MFC r330245: Allow the "@" and "!" characters in passwd file GECOS fields. Two PRs (152084 & 210187) request allowing the "@" and/or "!" characters in the passwd file GECOS field. The man page for pw does not mention that those characters are disallowed, Linux supports those characters in this field, and the "@" character in particular would be useful for storing email addresses in that field. PR: 152084, 210187 Submitted by: jschauma@netmeister.org, Dave Cottlehuber Reported by: jschauma@netmeister.org, Dave Cottlehuber Sponsored by: Dell EMC Modified: stable/10/usr.sbin/pw/pw_user.c stable/10/usr.sbin/pw/tests/pw_useradd_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Fri Mar 9 14:45:17 2018 (r330694) +++ stable/10/usr.sbin/pw/pw_user.c Fri Mar 9 14:45:47 2018 (r330695) @@ -632,7 +632,7 @@ pw_checkname(char *name, int gecos) reject = 0; if (gecos) { /* See if the name is valid as a gecos (comment) field. */ - badchars = ":!@"; + badchars = ":"; showtype = "gecos field"; } else { /* See if the name is valid as a userid or group. */ Modified: stable/10/usr.sbin/pw/tests/pw_useradd_test.sh ============================================================================== --- stable/10/usr.sbin/pw/tests/pw_useradd_test.sh Fri Mar 9 14:45:17 2018 (r330694) +++ stable/10/usr.sbin/pw/tests/pw_useradd_test.sh Fri Mar 9 14:45:47 2018 (r330695) @@ -27,9 +27,9 @@ atf_test_case user_add_comments user_add_comments_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456" - atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ - grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd + atf_check -s exit:0 ${PW} useradd test -c 'Test User,work!,123,user@example.com' + atf_check -s exit:0 -o match:'^test:.*:Test User,work!,123,user@example.com:' \ + grep '^test:.*:Test User,work!,123,user@example.com:' $HOME/master.passwd } # Test add user with comments and option -N From owner-svn-src-stable-10@freebsd.org Fri Mar 9 17:59:23 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01AF6F3E55C; Fri, 9 Mar 2018 17:59:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 977E684228; Fri, 9 Mar 2018 17:59:22 +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 92604225EA; Fri, 9 Mar 2018 17:59:22 +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 w29HxM15018214; Fri, 9 Mar 2018 17:59:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w29HxM9K018213; Fri, 9 Mar 2018 17:59:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803091759.w29HxM9K018213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 9 Mar 2018 17:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330700 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/fs/tmpfs X-SVN-Commit-Revision: 330700 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 17:59:23 -0000 Author: emaste Date: Fri Mar 9 17:59:22 2018 New Revision: 330700 URL: https://svnweb.freebsd.org/changeset/base/330700 Log: MFC r285885 by brueffer: In tmpfs_chtimes(), remove checks on the nanosecond level when determining whether a node changed. Other filesystems, e.g., UFS, only check on seconds, when determining whether something changed. This also corrects the birthtime case, where we checked tv_nsec twice, instead of tv_sec and tv_nsec (PR). PR: 201284 Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Fri Mar 9 17:54:14 2018 (r330699) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Fri Mar 9 17:59:22 2018 (r330700) @@ -1740,20 +1740,18 @@ tmpfs_chtimes(struct vnode *vp, struct vattr *vap, if (error != 0) return (error); - if (vap->va_atime.tv_sec != VNOVAL && vap->va_atime.tv_nsec != VNOVAL) + if (vap->va_atime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_ACCESSED; - if (vap->va_mtime.tv_sec != VNOVAL && vap->va_mtime.tv_nsec != VNOVAL) + if (vap->va_mtime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_MODIFIED; - if (vap->va_birthtime.tv_nsec != VNOVAL && - vap->va_birthtime.tv_nsec != VNOVAL) + if (vap->va_birthtime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_MODIFIED; tmpfs_itimes(vp, &vap->va_atime, &vap->va_mtime); - if (vap->va_birthtime.tv_nsec != VNOVAL && - vap->va_birthtime.tv_nsec != VNOVAL) + if (vap->va_birthtime.tv_sec != VNOVAL) node->tn_birthtime = vap->va_birthtime; ASSERT_VOP_ELOCKED(vp, "chtimes2"); From owner-svn-src-stable-10@freebsd.org Sat Mar 10 00:44:34 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85BE9F35D2D; Sat, 10 Mar 2018 00:44:34 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39A40764BF; Sat, 10 Mar 2018 00:44:34 +0000 (UTC) (envelope-from tychon@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 2FE9426657; Sat, 10 Mar 2018 00:44:34 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2A0iYR8028385; Sat, 10 Mar 2018 00:44:34 GMT (envelope-from tychon@FreeBSD.org) Received: (from tychon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2A0iX9F028381; Sat, 10 Mar 2018 00:44:33 GMT (envelope-from tychon@FreeBSD.org) Message-Id: <201803100044.w2A0iX9F028381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tychon set sender to tychon@FreeBSD.org using -f From: Tycho Nightingale Date: Sat, 10 Mar 2018 00:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330713 - in stable/10/sys/amd64/vmm: amd intel X-SVN-Group: stable-10 X-SVN-Commit-Author: tychon X-SVN-Commit-Paths: in stable/10/sys/amd64/vmm: amd intel X-SVN-Commit-Revision: 330713 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2018 00:44:34 -0000 Author: tychon Date: Sat Mar 10 00:44:33 2018 New Revision: 330713 URL: https://svnweb.freebsd.org/changeset/base/330713 Log: MFC r328011,329162 r328011: Provide some mitigation against CVE-2017-5715 by clearing registers upon returning from the guest which aren't immediately clobbered by the host. This eradicates any remaining guest contents limiting their usefulness in an exploit gadget. r329162: Provide further mitigation against CVE-2017-5715 by flushing the return stack buffer (RSB) upon returning from the guest. Modified: stable/10/sys/amd64/vmm/amd/svm_support.S stable/10/sys/amd64/vmm/intel/vmcs.c stable/10/sys/amd64/vmm/intel/vmx.h stable/10/sys/amd64/vmm/intel/vmx_support.S Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/vmm/amd/svm_support.S ============================================================================== --- stable/10/sys/amd64/vmm/amd/svm_support.S Sat Mar 10 00:10:47 2018 (r330712) +++ stable/10/sys/amd64/vmm/amd/svm_support.S Sat Mar 10 00:44:33 2018 (r330713) @@ -113,6 +113,23 @@ ENTRY(svm_launch) movq %rdi, SCTX_RDI(%rax) movq %rsi, SCTX_RSI(%rax) + /* + * To prevent malicious branch target predictions from + * affecting the host, overwrite all entries in the RSB upon + * exiting a guest. + */ + mov $16, %ecx /* 16 iterations, two calls per loop */ + mov %rsp, %rax +0: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: sub $1, %ecx + jnz 0b + mov %rax, %rsp + /* Restore host state */ pop %r15 pop %r14 @@ -124,8 +141,20 @@ ENTRY(svm_launch) pop %rdx mov %edx, %eax shr $32, %rdx - mov $MSR_GSBASE, %ecx + mov $MSR_GSBASE, %rcx wrmsr + + /* + * Clobber the remaining registers with guest contents so they + * can't be misused. + */ + xor %rbp, %rbp + xor %rdi, %rdi + xor %rsi, %rsi + xor %r8, %r8 + xor %r9, %r9 + xor %r10, %r10 + xor %r11, %r11 VLEAVE ret Modified: stable/10/sys/amd64/vmm/intel/vmcs.c ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmcs.c Sat Mar 10 00:10:47 2018 (r330712) +++ stable/10/sys/amd64/vmm/intel/vmcs.c Sat Mar 10 00:44:33 2018 (r330713) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -50,6 +51,12 @@ __FBSDID("$FreeBSD$"); #include #endif +SYSCTL_DECL(_hw_vmm_vmx); + +static int no_flush_rsb; +SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, no_flush_rsb, CTLFLAG_RW, + &no_flush_rsb, 0, "Do not flush RSB upon vmexit"); + static uint64_t vmcs_fix_regval(uint32_t encoding, uint64_t val) { @@ -401,8 +408,15 @@ vmcs_init(struct vmcs *vmcs) goto done; /* instruction pointer */ - if ((error = vmwrite(VMCS_HOST_RIP, (u_long)vmx_exit_guest)) != 0) - goto done; + if (no_flush_rsb) { + if ((error = vmwrite(VMCS_HOST_RIP, + (u_long)vmx_exit_guest)) != 0) + goto done; + } else { + if ((error = vmwrite(VMCS_HOST_RIP, + (u_long)vmx_exit_guest_flush_rsb)) != 0) + goto done; + } /* link pointer */ if ((error = vmwrite(VMCS_LINK_POINTER, ~0)) != 0) Modified: stable/10/sys/amd64/vmm/intel/vmx.h ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx.h Sat Mar 10 00:10:47 2018 (r330712) +++ stable/10/sys/amd64/vmm/intel/vmx.h Sat Mar 10 00:44:33 2018 (r330713) @@ -138,5 +138,6 @@ u_long vmx_fix_cr4(u_long cr4); int vmx_set_tsc_offset(struct vmx *vmx, int vcpu, uint64_t offset); extern char vmx_exit_guest[]; +extern char vmx_exit_guest_flush_rsb[]; #endif Modified: stable/10/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- stable/10/sys/amd64/vmm/intel/vmx_support.S Sat Mar 10 00:10:47 2018 (r330712) +++ stable/10/sys/amd64/vmm/intel/vmx_support.S Sat Mar 10 00:44:33 2018 (r330713) @@ -42,6 +42,29 @@ #define VLEAVE pop %rbp /* + * Save the guest context. + */ +#define VMX_GUEST_SAVE \ + movq %rdi,VMXCTX_GUEST_RDI(%rsp); \ + movq %rsi,VMXCTX_GUEST_RSI(%rsp); \ + movq %rdx,VMXCTX_GUEST_RDX(%rsp); \ + movq %rcx,VMXCTX_GUEST_RCX(%rsp); \ + movq %r8,VMXCTX_GUEST_R8(%rsp); \ + movq %r9,VMXCTX_GUEST_R9(%rsp); \ + movq %rax,VMXCTX_GUEST_RAX(%rsp); \ + movq %rbx,VMXCTX_GUEST_RBX(%rsp); \ + movq %rbp,VMXCTX_GUEST_RBP(%rsp); \ + movq %r10,VMXCTX_GUEST_R10(%rsp); \ + movq %r11,VMXCTX_GUEST_R11(%rsp); \ + movq %r12,VMXCTX_GUEST_R12(%rsp); \ + movq %r13,VMXCTX_GUEST_R13(%rsp); \ + movq %r14,VMXCTX_GUEST_R14(%rsp); \ + movq %r15,VMXCTX_GUEST_R15(%rsp); \ + movq %cr2,%rdi; \ + movq %rdi,VMXCTX_GUEST_CR2(%rsp); \ + movq %rsp,%rdi; + +/* * Assumes that %rdi holds a pointer to the 'vmxctx'. * * On "return" all registers are updated to reflect guest state. The two @@ -72,6 +95,20 @@ movq VMXCTX_GUEST_RDI(%rdi),%rdi; /* restore rdi the last */ /* + * Clobber the remaining registers with guest contents so they can't + * be misused. + */ +#define VMX_GUEST_CLOBBER \ + xor %rax, %rax; \ + xor %rcx, %rcx; \ + xor %rdx, %rdx; \ + xor %rsi, %rsi; \ + xor %r8, %r8; \ + xor %r9, %r9; \ + xor %r10, %r10; \ + xor %r11, %r11; + +/* * Save and restore the host context. * * Assumes that %rdi holds a pointer to the 'vmxctx'. @@ -197,33 +234,57 @@ inst_error: * The VMCS-restored %rsp points to the struct vmxctx */ ALIGN_TEXT - .globl vmx_exit_guest -vmx_exit_guest: + .globl vmx_exit_guest_flush_rsb +vmx_exit_guest_flush_rsb: /* * Save guest state that is not automatically saved in the vmcs. */ - movq %rdi,VMXCTX_GUEST_RDI(%rsp) - movq %rsi,VMXCTX_GUEST_RSI(%rsp) - movq %rdx,VMXCTX_GUEST_RDX(%rsp) - movq %rcx,VMXCTX_GUEST_RCX(%rsp) - movq %r8,VMXCTX_GUEST_R8(%rsp) - movq %r9,VMXCTX_GUEST_R9(%rsp) - movq %rax,VMXCTX_GUEST_RAX(%rsp) - movq %rbx,VMXCTX_GUEST_RBX(%rsp) - movq %rbp,VMXCTX_GUEST_RBP(%rsp) - movq %r10,VMXCTX_GUEST_R10(%rsp) - movq %r11,VMXCTX_GUEST_R11(%rsp) - movq %r12,VMXCTX_GUEST_R12(%rsp) - movq %r13,VMXCTX_GUEST_R13(%rsp) - movq %r14,VMXCTX_GUEST_R14(%rsp) - movq %r15,VMXCTX_GUEST_R15(%rsp) + VMX_GUEST_SAVE - movq %cr2,%rdi - movq %rdi,VMXCTX_GUEST_CR2(%rsp) + /* + * Deactivate guest pmap from this cpu. + */ + movq VMXCTX_PMAP(%rdi), %r11 + movl PCPU(CPUID), %r10d + LK btrl %r10d, PM_ACTIVE(%r11) - movq %rsp,%rdi + VMX_HOST_RESTORE + VMX_GUEST_CLOBBER + /* + * To prevent malicious branch target predictions from + * affecting the host, overwrite all entries in the RSB upon + * exiting a guest. + */ + mov $16, %ecx /* 16 iterations, two calls per loop */ + mov %rsp, %rax +0: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: call 2f /* create an RSB entry. */ +1: pause + call 1b /* capture rogue speculation. */ +2: sub $1, %ecx + jnz 0b + mov %rax, %rsp + + /* + * This will return to the caller of 'vmx_enter_guest()' with a return + * value of VMX_GUEST_VMEXIT. + */ + movl $VMX_GUEST_VMEXIT, %eax + VLEAVE + ret + + .globl vmx_exit_guest +vmx_exit_guest: + /* + * Save guest state that is not automatically saved in the vmcs. + */ + VMX_GUEST_SAVE + + /* * Deactivate guest pmap from this cpu. */ movq VMXCTX_PMAP(%rdi), %r11 @@ -231,6 +292,8 @@ vmx_exit_guest: LK btrl %r10d, PM_ACTIVE(%r11) VMX_HOST_RESTORE + + VMX_GUEST_CLOBBER /* * This will return to the caller of 'vmx_enter_guest()' with a return From owner-svn-src-stable-10@freebsd.org Sat Mar 10 04:02:52 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7E47F47889; Sat, 10 Mar 2018 04:02:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97BC080E79; Sat, 10 Mar 2018 04:02:51 +0000 (UTC) (envelope-from asomers@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 929EA8FF; Sat, 10 Mar 2018 04:02:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2A42p88029893; Sat, 10 Mar 2018 04:02:51 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2A42pVA029892; Sat, 10 Mar 2018 04:02:51 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803100402.w2A42pVA029892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 10 Mar 2018 04:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330735 - stable/10/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 330735 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2018 04:02:52 -0000 Author: asomers Date: Sat Mar 10 04:02:51 2018 New Revision: 330735 URL: https://svnweb.freebsd.org/changeset/base/330735 Log: MFC r329067: Fix "zpool add" crash when a replacing vdev has a spare child Fix an assertion in zpool that causes a crash when running any "zpool add" command on a spare that contains a replacing vdev with a spare child. This likely affects Illumos, too. PR: 225546 Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14138 Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Sat Mar 10 03:39:49 2018 (r330734) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Sat Mar 10 04:02:51 2018 (r330735) @@ -684,6 +684,21 @@ get_replication(nvlist_t *nvroot, boolean_t fatal) verify(nvlist_lookup_string(cnv, ZPOOL_CONFIG_TYPE, &childtype) == 0); + if (strcmp(childtype, + VDEV_TYPE_SPARE) == 0) { + /* We have a replacing vdev with + * a spare child. Get the first + * real child of the spare + */ + verify( + nvlist_lookup_nvlist_array( + cnv, + ZPOOL_CONFIG_CHILDREN, + &rchild, + &rchildren) == 0); + assert(rchildren >= 2); + cnv = rchild[0]; + } } verify(nvlist_lookup_string(cnv, From owner-svn-src-stable-10@freebsd.org Sat Mar 10 04:10:58 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8AFEF483E0; Sat, 10 Mar 2018 04:10:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D7A48128E; Sat, 10 Mar 2018 04:10:57 +0000 (UTC) (envelope-from asomers@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 885BD93E; Sat, 10 Mar 2018 04:10:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2A4AvZG032409; Sat, 10 Mar 2018 04:10:57 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2A4AvTc032408; Sat, 10 Mar 2018 04:10:57 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803100410.w2A4AvTc032408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 10 Mar 2018 04:10:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330736 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 330736 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2018 04:10:58 -0000 Author: asomers Date: Sat Mar 10 04:10:57 2018 New Revision: 330736 URL: https://svnweb.freebsd.org/changeset/base/330736 Log: MFC r329265, r329384 r329265: Implement .vop_pathconf and .vop_getacl for the .zfs ctldir zfsctl_common_pathconf will report all the same variables that regular ZFS volumes report. zfsctl_common_getacl will report an ACL equivalent to 555, except that you can't read xattrs or edit attributes. Fixes a bug where "ls .zfs" will occasionally print something like: ls: .zfs/.: Operation not supported PR: 225793 Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14365 r329384: Handle generic pathconf attributes in the .zfs ctldir MFC instructions: change the value of _PC_LINK_MAX to INT_MAX Reported by: jhb X-MFC-With: 329265 Sponsored by: Spectra Logic Corp Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Mar 10 04:02:51 2018 (r330735) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Mar 10 04:10:57 2018 (r330736) @@ -80,6 +80,10 @@ #include "zfs_namecheck.h" +/* Common access mode for all virtual directories under the ctldir */ +const u_short zfsctl_ctldir_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | + S_IROTH | S_IXOTH; + /* * "Synthetic" filesystem implementation. */ @@ -496,8 +500,7 @@ zfsctl_common_getattr(vnode_t *vp, vattr_t *vap) vap->va_nblocks = 0; vap->va_seq = 0; vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; - vap->va_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | - S_IROTH | S_IXOTH; + vap->va_mode = zfsctl_ctldir_mode; vap->va_type = VDIR; /* * We live in the now (for atime). @@ -724,6 +727,91 @@ zfsctl_root_vptocnp(struct vop_vptocnp_args *ap) return (0); } +static int +zfsctl_common_pathconf(ap) + struct vop_pathconf_args /* { + struct vnode *a_vp; + int a_name; + int *a_retval; + } */ *ap; +{ + /* + * We care about ACL variables so that user land utilities like ls + * can display them correctly. Since the ctldir's st_dev is set to be + * the same as the parent dataset, we must support all variables that + * it supports. + */ + switch (ap->a_name) { + case _PC_LINK_MAX: + *ap->a_retval = INT_MAX; + return (0); + + case _PC_FILESIZEBITS: + *ap->a_retval = 64; + return (0); + + case _PC_MIN_HOLE_SIZE: + *ap->a_retval = (int)SPA_MINBLOCKSIZE; + return (0); + + case _PC_ACL_EXTENDED: + *ap->a_retval = 0; + return (0); + + case _PC_ACL_NFS4: + *ap->a_retval = 1; + return (0); + + case _PC_ACL_PATH_MAX: + *ap->a_retval = ACL_MAX_ENTRIES; + return (0); + + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + + default: + return (vop_stdpathconf(ap)); + } +} + +/** + * Returns a trivial ACL + */ +int +zfsctl_common_getacl(ap) + struct vop_getacl_args /* { + struct vnode *vp; + acl_type_t a_type; + struct acl *a_aclp; + struct ucred *cred; + struct thread *td; + } */ *ap; +{ + int i; + + if (ap->a_type != ACL_TYPE_NFS4) + return (EINVAL); + + acl_nfs4_sync_acl_from_mode(ap->a_aclp, zfsctl_ctldir_mode, 0); + /* + * acl_nfs4_sync_acl_from_mode assumes that the owner can always modify + * attributes. That is not the case for the ctldir, so we must clear + * those bits. We also must clear ACL_READ_NAMED_ATTRS, because xattrs + * aren't supported by the ctldir. + */ + for (i = 0; i < ap->a_aclp->acl_cnt; i++) { + struct acl_entry *entry; + entry = &(ap->a_aclp->acl_entry[i]); + uint32_t old_perm = entry->ae_perm; + entry->ae_perm &= ~(ACL_WRITE_ACL | ACL_WRITE_OWNER | + ACL_WRITE_ATTRIBUTES | ACL_WRITE_NAMED_ATTRS | + ACL_READ_NAMED_ATTRS ); + } + + return (0); +} + static struct vop_vector zfsctl_ops_root = { .vop_default = &default_vnodeops, .vop_open = zfsctl_common_open, @@ -738,6 +826,8 @@ static struct vop_vector zfsctl_ops_root = { .vop_fid = zfsctl_common_fid, .vop_print = zfsctl_common_print, .vop_vptocnp = zfsctl_root_vptocnp, + .vop_pathconf = zfsctl_common_pathconf, + .vop_getacl = zfsctl_common_getacl, }; static int @@ -1059,6 +1149,8 @@ static struct vop_vector zfsctl_ops_snapdir = { .vop_reclaim = zfsctl_common_reclaim, .vop_fid = zfsctl_common_fid, .vop_print = zfsctl_common_print, + .vop_pathconf = zfsctl_common_pathconf, + .vop_getacl = zfsctl_common_getacl, }; static int From owner-svn-src-stable-10@freebsd.org Sat Mar 10 04:17:03 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF238F48AF5; Sat, 10 Mar 2018 04:17:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EF2081B05; Sat, 10 Mar 2018 04:17:02 +0000 (UTC) (envelope-from asomers@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 89687B43; Sat, 10 Mar 2018 04:17:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2A4H2Du035819; Sat, 10 Mar 2018 04:17:02 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2A4H1np035807; Sat, 10 Mar 2018 04:17:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201803100417.w2A4H1np035807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 10 Mar 2018 04:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330737 - in stable/10: sbin/geom/class/cache sbin/geom/class/concat sbin/geom/class/journal sbin/geom/class/label sbin/geom/class/mirror sbin/geom/class/raid3 sbin/geom/class/shsec sbi... X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: sbin/geom/class/cache sbin/geom/class/concat sbin/geom/class/journal sbin/geom/class/label sbin/geom/class/mirror sbin/geom/class/raid3 sbin/geom/class/shsec sbin/geom/class/stripe sbin/... X-SVN-Commit-Revision: 330737 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2018 04:17:03 -0000 Author: asomers Date: Sat Mar 10 04:17:01 2018 New Revision: 330737 URL: https://svnweb.freebsd.org/changeset/base/330737 Log: MFC r323314, r323338, r328849 r323314: Audit userspace geom code for leaking memory to disk Any geom class using g_metadata_store, as well as geom_virstor which duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes of userspace memory following the metadata block stored. This is most or all geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath, graid3, gshsec, gstripe, and geom_virstor). PR: 222077 (comment #3) Reported by: Maxim Khitrov Reviewed by: des Security: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12269 r323338: Fix information leak in geli(8) integrity mode In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several physical sectors (e.g., 512 bytes) on the backing device. Due to hash overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors. This means that only 288 bytes (256 data + 32 hash) of the last 512 byte sector are used. The memory allocation used to store the encrypted data to be written to the physical sectors comes from malloc(9) and does not use M_ZERO. Previously, nothing initialized the final physical sector backing each logical sector, aside from the hash + encrypted data portion. So 224 bytes of kernel heap memory was leaked to every block :-(. This patch addresses the issue by initializing the trailing portion of the physical sector in every logical sector to zeros before use. A much simpler but higher overhead fix would be to tag the entire allocation M_ZERO. PR: 222077 Reported by: Maxim Khitrov Reviewed by: emaste Security: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12272 r328849: geom: don't write stack garbage in disk labels Most consumers of g_metadata_store were passing in partially unallocated memory, resulting in stack garbage being written to disk labels. Fix them by zeroing the memory first. gvirstor repeated the same mistake, but in the kernel. Also, glabel's label contained a fixed-size string that wasn't initialized to zero. PR: 222077 Reported by: Maxim Khitrov Reviewed by: cem X-MFC-With: 323314 X-MFC-With: 323338 Differential Revision: https://reviews.freebsd.org/D14164 Modified: stable/10/sbin/geom/class/cache/geom_cache.c stable/10/sbin/geom/class/concat/geom_concat.c stable/10/sbin/geom/class/journal/geom_journal.c stable/10/sbin/geom/class/label/geom_label.c stable/10/sbin/geom/class/mirror/geom_mirror.c stable/10/sbin/geom/class/raid3/geom_raid3.c stable/10/sbin/geom/class/shsec/geom_shsec.c stable/10/sbin/geom/class/stripe/geom_stripe.c stable/10/sbin/geom/class/virstor/geom_virstor.c stable/10/sbin/geom/misc/subr.c stable/10/sys/geom/eli/g_eli_integrity.c stable/10/sys/geom/virstor/g_virstor.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/cache/geom_cache.c ============================================================================== --- stable/10/sbin/geom/class/cache/geom_cache.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/cache/geom_cache.c Sat Mar 10 04:17:01 2018 (r330737) @@ -135,6 +135,7 @@ cache_label(struct gctl_req *req) int error, nargs; intmax_t val; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs != 2) { gctl_error(req, "Invalid number of arguments."); Modified: stable/10/sbin/geom/class/concat/geom_concat.c ============================================================================== --- stable/10/sbin/geom/class/concat/geom_concat.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/concat/geom_concat.c Sat Mar 10 04:17:01 2018 (r330737) @@ -117,6 +117,7 @@ concat_label(struct gctl_req *req) const char *name; int error, i, hardcode, nargs; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs < 2) { gctl_error(req, "Too few arguments."); Modified: stable/10/sbin/geom/class/journal/geom_journal.c ============================================================================== --- stable/10/sbin/geom/class/journal/geom_journal.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/journal/geom_journal.c Sat Mar 10 04:17:01 2018 (r330737) @@ -142,6 +142,7 @@ journal_label(struct gctl_req *req) intmax_t jsize, msize, ssize; int error, force, i, nargs, checksum, hardcode; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); str = NULL; /* gcc */ Modified: stable/10/sbin/geom/class/label/geom_label.c ============================================================================== --- stable/10/sbin/geom/class/label/geom_label.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/label/geom_label.c Sat Mar 10 04:17:01 2018 (r330737) @@ -117,6 +117,7 @@ label_label(struct gctl_req *req) u_char sector[512]; int error, nargs; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs != 2) { gctl_error(req, "Invalid number of arguments."); @@ -137,6 +138,7 @@ label_label(struct gctl_req *req) strlcpy(md.md_magic, G_LABEL_MAGIC, sizeof(md.md_magic)); md.md_version = G_LABEL_VERSION; label = gctl_get_ascii(req, "arg0"); + bzero(md.md_label, sizeof(md.md_label)); strlcpy(md.md_label, label, sizeof(md.md_label)); md.md_provsize = g_get_mediasize(name); if (md.md_provsize == 0) { Modified: stable/10/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- stable/10/sbin/geom/class/mirror/geom_mirror.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/mirror/geom_mirror.c Sat Mar 10 04:17:01 2018 (r330737) @@ -176,6 +176,7 @@ mirror_label(struct gctl_req *req) intmax_t val; int error, i, nargs, bal, hardcode; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs < 2) { gctl_error(req, "Too few arguments."); Modified: stable/10/sbin/geom/class/raid3/geom_raid3.c ============================================================================== --- stable/10/sbin/geom/class/raid3/geom_raid3.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/raid3/geom_raid3.c Sat Mar 10 04:17:01 2018 (r330737) @@ -149,6 +149,7 @@ raid3_label(struct gctl_req *req) int hardcode, round_robin, verify; int error, i, nargs; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs < 4) { gctl_error(req, "Too few arguments."); Modified: stable/10/sbin/geom/class/shsec/geom_shsec.c ============================================================================== --- stable/10/sbin/geom/class/shsec/geom_shsec.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/shsec/geom_shsec.c Sat Mar 10 04:17:01 2018 (r330737) @@ -110,6 +110,7 @@ shsec_label(struct gctl_req *req) const char *name; int error, i, nargs, hardcode; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs <= 2) { gctl_error(req, "Too few arguments."); Modified: stable/10/sbin/geom/class/stripe/geom_stripe.c ============================================================================== --- stable/10/sbin/geom/class/stripe/geom_stripe.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/stripe/geom_stripe.c Sat Mar 10 04:17:01 2018 (r330737) @@ -128,6 +128,7 @@ stripe_label(struct gctl_req *req) const char *name; int error, i, nargs, hardcode; + bzero(sector, sizeof(sector)); nargs = gctl_get_int(req, "nargs"); if (nargs < 3) { gctl_error(req, "Too few arguments."); Modified: stable/10/sbin/geom/class/virstor/geom_virstor.c ============================================================================== --- stable/10/sbin/geom/class/virstor/geom_virstor.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/class/virstor/geom_virstor.c Sat Mar 10 04:17:01 2018 (r330737) @@ -183,6 +183,7 @@ my_g_metadata_store(const char *name, u_char *md, size goto out; } bcopy(md, sector, size); + bzero(sector + size, sectorsize - size); if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) != (ssize_t)sectorsize) { error = errno; Modified: stable/10/sbin/geom/misc/subr.c ============================================================================== --- stable/10/sbin/geom/misc/subr.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sbin/geom/misc/subr.c Sat Mar 10 04:17:01 2018 (r330737) @@ -271,6 +271,13 @@ out: return (error); } +/* + * Actually write the GEOM label to the provider + * + * @param name GEOM provider's name (ie "ada0") + * @param md Pointer to the label data to write + * @param size Size of the data pointed to by md + */ int g_metadata_store(const char *name, const unsigned char *md, size_t size) { @@ -302,6 +309,7 @@ g_metadata_store(const char *name, const unsigned char goto out; } bcopy(md, sector, size); + bzero(sector + size, sectorsize - size); if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) != sectorsize) { error = errno; Modified: stable/10/sys/geom/eli/g_eli_integrity.c ============================================================================== --- stable/10/sys/geom/eli/g_eli_integrity.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sys/geom/eli/g_eli_integrity.c Sat Mar 10 04:17:01 2018 (r330737) @@ -468,8 +468,16 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp iov = (struct iovec *)p; p += sizeof(*iov); data_secsize = sc->sc_data_per_sector; - if ((i % lsec) == 0) + if ((i % lsec) == 0) { data_secsize = decr_secsize % data_secsize; + /* + * Last encrypted sector of each decrypted sector is + * only partially filled. + */ + if (bp->bio_cmd == BIO_WRITE) + memset(data + sc->sc_alen + data_secsize, 0, + encr_secsize - sc->sc_alen - data_secsize); + } if (bp->bio_cmd == BIO_READ) { /* Remember read HMAC. */ Modified: stable/10/sys/geom/virstor/g_virstor.c ============================================================================== --- stable/10/sys/geom/virstor/g_virstor.c Sat Mar 10 04:10:57 2018 (r330736) +++ stable/10/sys/geom/virstor/g_virstor.c Sat Mar 10 04:17:01 2018 (r330737) @@ -1044,6 +1044,7 @@ write_metadata(struct g_consumer *cp, struct g_virstor pp = cp->provider; buf = malloc(pp->sectorsize, M_GVIRSTOR, M_WAITOK); + bzero(buf, pp->sectorsize); virstor_metadata_encode(md, buf); g_topology_unlock(); error = g_write_data(cp, pp->mediasize - pp->sectorsize, buf,