From owner-svn-src-stable-10@freebsd.org Mon Feb 27 08:27:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CDFACEF883; Mon, 27 Feb 2017 08:27:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 213488CF; Mon, 27 Feb 2017 08:27:41 +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 v1R8ReZd066415; Mon, 27 Feb 2017 08:27:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1R8Rcx0066394; Mon, 27 Feb 2017 08:27:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702270827.v1R8Rcx0066394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 08:27:38 +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: r314327 - in stable/10: lib/libcrypt lib/libmd sbin/gbde sbin/geom/class/eli sbin/md5 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/conf sys/crypto/sha2 sys/dev/random sys/geom/bde... X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 08:27:41 -0000 Author: avg Date: Mon Feb 27 08:27:38 2017 New Revision: 314327 URL: https://svnweb.freebsd.org/changeset/base/314327 Log: MFC r292782: Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c cperciva's libmd implementation is 5-30% faster The same was done for SHA256 previously in r263218 Approved by: secteam Added: stable/10/sys/crypto/sha2/sha384.h - copied unchanged from r292782, head/sys/crypto/sha2/sha384.h stable/10/sys/crypto/sha2/sha512.h - copied unchanged from r292782, head/sys/crypto/sha2/sha512.h stable/10/sys/crypto/sha2/sha512c.c - copied unchanged from r292782, head/sys/crypto/sha2/sha512c.c Deleted: stable/10/lib/libmd/sha512.h stable/10/lib/libmd/sha512c.c stable/10/sys/crypto/sha2/sha2.c stable/10/sys/crypto/sha2/sha2.h Modified: stable/10/lib/libcrypt/Makefile stable/10/lib/libmd/Makefile stable/10/lib/libmd/sha512.3 stable/10/lib/libmd/shadriver.c stable/10/sbin/gbde/Makefile stable/10/sbin/gbde/gbde.c stable/10/sbin/geom/class/eli/Makefile stable/10/sbin/md5/Makefile stable/10/sbin/md5/md5.1 stable/10/sbin/md5/md5.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c stable/10/sys/conf/files stable/10/sys/crypto/sha2/sha256.h stable/10/sys/dev/random/hash.c stable/10/sys/dev/random/yarrow.c stable/10/sys/geom/bde/g_bde.c stable/10/sys/geom/bde/g_bde_crypt.c stable/10/sys/geom/bde/g_bde_lock.c stable/10/sys/geom/bde/g_bde_work.c stable/10/sys/geom/eli/g_eli.h stable/10/sys/modules/crypto/Makefile stable/10/sys/modules/geom/geom_bde/Makefile stable/10/sys/modules/zfs/Makefile stable/10/sys/netinet/sctp_os_bsd.h stable/10/sys/opencrypto/xform.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libcrypt/Makefile ============================================================================== --- stable/10/lib/libcrypt/Makefile Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/lib/libcrypt/Makefile Mon Feb 27 08:27:38 2017 (r314327) @@ -29,6 +29,7 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BL .for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ SHA256_Init SHA256_Final SHA256_Update \ + SHA384_Init SHA384_Final SHA384_Update \ SHA512_Init SHA512_Final SHA512_Update CFLAGS+= -D${sym}=__${sym} .endfor Modified: stable/10/lib/libmd/Makefile ============================================================================== --- stable/10/lib/libmd/Makefile Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/lib/libmd/Makefile Mon Feb 27 08:27:38 2017 (r314327) @@ -7,8 +7,9 @@ SRCS= md4c.c md5c.c md4hl.c md5hl.c \ rmd160c.c rmd160hl.c \ sha0c.c sha0hl.c sha1c.c sha1hl.c \ sha256c.c sha256hl.c \ + sha384hl.c \ sha512c.c sha512hl.c -INCS= md4.h md5.h ripemd.h sha.h sha256.h sha512.h +INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h WARNS?= 0 @@ -33,6 +34,10 @@ MLINKS+=sha256.3 SHA256_Init.3 sha256.3 MLINKS+=sha256.3 SHA256_Final.3 sha256.3 SHA256_End.3 MLINKS+=sha256.3 SHA256_File.3 sha256.3 SHA256_FileChunk.3 MLINKS+=sha256.3 SHA256_Data.3 +MLINKS+=sha512.3 SHA384_Init.3 sha512.3 SHA384_Update.3 +MLINKS+=sha512.3 SHA384_Final.3 sha512.3 SHA384_End.3 +MLINKS+=sha512.3 SHA384_File.3 sha512.3 SHA384_FileChunk.3 +MLINKS+=sha512.3 SHA384_Data.3 sha512.3 sha384.3 MLINKS+=sha512.3 SHA512_Init.3 sha512.3 SHA512_Update.3 MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3 MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 @@ -40,7 +45,8 @@ MLINKS+=sha512.3 SHA512_Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ rmd160.ref rmd160hl.c rmddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ - sha256.ref sha256hl.c sha512.ref sha512hl.c + sha256.ref sha256hl.c sha384hl.c sha384.ref \ + sha512.ref sha512hl.c # Define WEAK_REFS to provide weak aliases for libmd symbols # @@ -87,6 +93,12 @@ sha256hl.c: mdXhl.c -e 's/SHA256__/SHA256_/g' \ ${.ALLSRC}) > ${.TARGET} +sha384hl.c: mdXhl.c + (echo '#define LENGTH 48'; \ + sed -e 's/mdX/sha384/g' -e 's/MDX/SHA384_/g' \ + -e 's/SHA384__/SHA384_/g' \ + ${.ALLSRC}) > ${.TARGET} + sha512hl.c: mdXhl.c (echo '#define LENGTH 64'; \ sed -e 's/mdX/sha512/g' -e 's/MDX/SHA512_/g' \ @@ -167,6 +179,21 @@ sha256.ref: @echo 'SHA-256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ 'f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e' >> ${.TARGET} +sha384.ref: + echo 'SHA-384 test suite:' > ${.TARGET} + @echo 'SHA-384 ("") =' \ + '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b' >> ${.TARGET} + @echo 'SHA-384 ("abc") =' \ + 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7' >> ${.TARGET} + @echo 'SHA-384 ("message digest") =' \ + '473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5' >> ${.TARGET} + @echo 'SHA-384 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4' >> ${.TARGET} + @echo 'SHA-384 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84' >> ${.TARGET} + @echo 'SHA-384 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026' >> ${.TARGET} + sha512.ref: echo 'SHA-512 test suite:' > ${.TARGET} @echo 'SHA-512 ("") =' \ @@ -195,7 +222,8 @@ rmd160.ref: @echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ '9b752e45573d4b39f4dbd3323cab82bf63326bfb' >> ${.TARGET} -test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha512.ref +test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha384.ref \ + sha512.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. ${CC} ${CFLAGS} ${LDFLAGS} -DMD=4 -o mddriver ${.CURDIR}/mddriver.c libmd.a @@ -218,6 +246,9 @@ test: md4.ref md5.ref sha0.ref rmd160.re ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha256.ref - @${ECHO} SHA-256 passed test + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=384 -o shadriver ${.CURDIR}/shadriver.c libmd.a + ./shadriver | cmp sha384.ref - + @${ECHO} SHA-384 passed test ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha512.ref - @${ECHO} SHA-512 passed test Modified: stable/10/lib/libmd/sha512.3 ============================================================================== --- stable/10/lib/libmd/sha512.3 Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/lib/libmd/sha512.3 Mon Feb 27 08:27:38 2017 (r314327) @@ -9,7 +9,7 @@ .\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp .\" $FreeBSD$ .\" -.Dd March 28, 2014 +.Dd October 17, 2015 .Dt SHA512 3 .Os .Sh NAME @@ -19,8 +19,15 @@ .Nm SHA512_End , .Nm SHA512_File , .Nm SHA512_FileChunk , -.Nm SHA512_Data -.Nd calculate the FIPS 180-2 ``SHA-512'' message digest +.Nm SHA512_Data , +.Nm SHA384_Init , +.Nm SHA384_Update , +.Nm SHA384_Final , +.Nm SHA384_End , +.Nm SHA384_File , +.Nm SHA384_FileChunk , +.Nm SHA384_Data +.Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests .Sh LIBRARY .Lb libmd .Sh SYNOPSIS @@ -40,6 +47,20 @@ .Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" .Ft "char *" .Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf" +.Ft void +.Fn SHA384_Init "SHA384_CTX *context" +.Ft void +.Fn SHA384_Update "SHA384_CTX *context" "const unsigned char *data" "size_t len" +.Ft void +.Fn SHA384_Final "unsigned char digest[48]" "SHA384_CTX *context" +.Ft "char *" +.Fn SHA384_End "SHA384_CTX *context" "char *buf" +.Ft "char *" +.Fn SHA384_File "const char *filename" "char *buf" +.Ft "char *" +.Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" +.Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf" .Sh DESCRIPTION The .Li SHA512_ @@ -119,6 +140,21 @@ after use. If the .Fa buf argument is non-null it must point to at least 65 characters of buffer space. +.Pp +The +.Li SHA384_ +functions are identical to the +.Li SHA512_ +functions except they use a different initial hash value and the output is +truncated to 384 bits. +.Pp +.Fn SHA384_End +is a wrapper for +.Fn SHA384_Final +which converts the return value to a 49-character +(including the terminating '\e0') +.Tn ASCII +string which represents the 384 bits in hexadecimal. .Sh SEE ALSO .Xr md4 3 , .Xr md5 3 , Modified: stable/10/lib/libmd/shadriver.c ============================================================================== --- stable/10/lib/libmd/shadriver.c Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/lib/libmd/shadriver.c Mon Feb 27 08:27:38 2017 (r314327) @@ -22,6 +22,7 @@ __FBSDID("$FreeBSD$"); #include "sha.h" #include "sha256.h" +#include "sha384.h" #include "sha512.h" /* The following makes SHA default to SHA-1 if it has not already been @@ -36,6 +37,9 @@ __FBSDID("$FreeBSD$"); #elif SHA == 256 #undef SHA_Data #define SHA_Data SHA256_Data +#elif SHA == 384 +#undef SHA_Data +#define SHA_Data SHA384_Data #elif SHA == 512 #undef SHA_Data #define SHA_Data SHA512_Data Modified: stable/10/sbin/gbde/Makefile ============================================================================== --- stable/10/sbin/gbde/Makefile Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sbin/gbde/Makefile Mon Feb 27 08:27:38 2017 (r314327) @@ -4,7 +4,7 @@ PROG= gbde SRCS= gbde.c template.c SRCS+= rijndael-alg-fst.c SRCS+= rijndael-api-fst.c -SRCS+= sha2.c +SRCS+= sha512c.c SRCS+= g_bde_lock.c # rijndael-fst.c does evil casting things which can results in warnings, Modified: stable/10/sbin/gbde/gbde.c ============================================================================== --- stable/10/sbin/gbde/gbde.c Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sbin/gbde/gbde.c Mon Feb 27 08:27:38 2017 (r314327) @@ -84,7 +84,7 @@ #include #include #include -#include +#include #include #include Modified: stable/10/sbin/geom/class/eli/Makefile ============================================================================== --- stable/10/sbin/geom/class/eli/Makefile Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sbin/geom/class/eli/Makefile Mon Feb 27 08:27:38 2017 (r314327) @@ -6,7 +6,8 @@ GEOM_CLASS= eli SRCS= g_eli_crypto.c SRCS+= g_eli_key.c SRCS+= pkcs5v2.c -SRCS+= sha2.c +SRCS+= sha256c.c +SRCS+= sha512c.c DPADD= ${LIBMD} ${LIBCRYPTO} LDADD= -lmd -lcrypto Modified: stable/10/sbin/md5/Makefile ============================================================================== --- stable/10/sbin/md5/Makefile Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sbin/md5/Makefile Mon Feb 27 08:27:38 2017 (r314327) @@ -6,11 +6,13 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha384 \ ${BINDIR}/md5 ${BINDIR}/sha512 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ md5.1 sha256.1 \ + md5.1 sha384.1 \ md5.1 sha512.1 DPADD= ${LIBMD} Modified: stable/10/sbin/md5/md5.1 ============================================================================== --- stable/10/sbin/md5/md5.1 Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sbin/md5/md5.1 Mon Feb 27 08:27:38 2017 (r314327) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd May 17, 2014 +.Dd October 17, 2015 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , sha512, rmd160 +.Nm md5 , sha1 , sha256 , sha384 , sha512, rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -21,6 +21,11 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm sha384 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Nm sha512 .Op Fl pqrtx .Op Fl c Ar string @@ -33,7 +38,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 , sha512 +.Nm md5 , sha1 , sha256 , sha384 , sha512 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -46,7 +51,7 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 , SHA-512 +.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512 and .Tn RIPEMD-160 algorithms are intended for digital signature applications, where a @@ -123,6 +128,7 @@ option. .Xr ripemd 3 , .Xr sha 3 , .Xr sha256 3 , +.Xr sha384 3 , .Xr sha512 3 .Rs .%A R. Rivest Modified: stable/10/sbin/md5/md5.c ============================================================================== --- stable/10/sbin/md5/md5.c Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sbin/md5/md5.c Mon Feb 27 08:27:38 2017 (r314327) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -55,6 +56,7 @@ typedef char *(DIGEST_End)(void *, char extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; +extern const char *SHA384_TestOutput[MDTESTCOUNT]; extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; @@ -80,6 +82,7 @@ typedef union { MD5_CTX md5; SHA1_CTX sha1; SHA256_CTX sha256; + SHA384_CTX sha384; SHA512_CTX sha512; RIPEMD160_CTX ripemd160; } DIGEST_CTX; @@ -101,6 +104,9 @@ static const struct Algorithm_t Algorith { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_File }, + { "sha384", "SHA384", &SHA384_TestOutput, (DIGEST_Init*)&SHA384_Init, + (DIGEST_Update*)&SHA384_Update, (DIGEST_End*)&SHA384_End, + &SHA384_Data, &SHA384_File }, { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, &SHA512_Data, &SHA512_File }, @@ -327,6 +333,17 @@ const char *SHA256_TestOutput[MDTESTCOUN "e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f" }; +const char *SHA384_TestOutput[MDTESTCOUNT] = { + "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b", + "54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31", + "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7", + "473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5", + "feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4", + "1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84", + "b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026", + "99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb" +}; + const char *SHA512_TestOutput[MDTESTCOUNT] = { "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c Mon Feb 27 08:27:38 2017 (r314327) @@ -28,7 +28,7 @@ #include #include #ifdef _KERNEL -#include +#include #else #include #endif Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sys/conf/files Mon Feb 27 08:27:38 2017 (r314327) @@ -543,10 +543,9 @@ crypto/rijndael/rijndael-api-fst.c optio crypto/rijndael/rijndael-api.c optional crypto | ipsec | wlan_ccmp crypto/sha1.c optional carp | crypto | ipsec | \ netgraph_mppc_encryption | sctp -crypto/sha2/sha2.c optional crypto | geom_bde | ipsec | random | \ - sctp | zfs crypto/sha2/sha256c.c optional crypto | geom_bde | ipsec | random | \ sctp | zfs +crypto/sha2/sha512c.c optional crypto | geom_bde | ipsec | zfs crypto/siphash/siphash.c optional inet | inet6 crypto/siphash/siphash_test.c optional inet | inet6 ddb/db_access.c optional ddb Modified: stable/10/sys/crypto/sha2/sha256.h ============================================================================== --- stable/10/sys/crypto/sha2/sha256.h Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sys/crypto/sha2/sha256.h Mon Feb 27 08:27:38 2017 (r314327) @@ -33,10 +33,14 @@ #include #endif +#define SHA256_BLOCK_LENGTH 64 +#define SHA256_DIGEST_LENGTH 32 +#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) + typedef struct SHA256Context { uint32_t state[8]; uint64_t count; - uint8_t buf[64]; + uint8_t buf[SHA256_BLOCK_LENGTH]; } SHA256_CTX; __BEGIN_DECLS @@ -74,10 +78,10 @@ __BEGIN_DECLS void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX *, const void *, size_t); -void SHA256_Final(unsigned char [32], SHA256_CTX *); +void SHA256_Final(unsigned char [SHA256_DIGEST_LENGTH], SHA256_CTX *); +#ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); -#ifndef _KERNEL char *SHA256_File(const char *, char *); char *SHA256_FileChunk(const char *, char *, off_t, off_t); #endif Copied: stable/10/sys/crypto/sha2/sha384.h (from r292782, head/sys/crypto/sha2/sha384.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/crypto/sha2/sha384.h Mon Feb 27 08:27:38 2017 (r314327, copy of r292782, head/sys/crypto/sha2/sha384.h) @@ -0,0 +1,87 @@ +/*- + * Copyright 2005 Colin Percival + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SHA384_H_ +#define _SHA384_H_ + +#ifndef _KERNEL +#include +#endif + +#define SHA384_BLOCK_LENGTH 128 +#define SHA384_DIGEST_LENGTH 48 +#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) + +typedef struct SHA384Context { + uint64_t state[8]; + uint64_t count[2]; + uint8_t buf[SHA384_BLOCK_LENGTH]; +} SHA384_CTX; + +__BEGIN_DECLS + +/* Ensure libmd symbols do not clash with libcrypto */ +#ifndef SHA384_Init +#define SHA384_Init _libmd_SHA384_Init +#endif +#ifndef SHA384_Update +#define SHA384_Update _libmd_SHA384_Update +#endif +#ifndef SHA384_Final +#define SHA384_Final _libmd_SHA384_Final +#endif +#ifndef SHA384_End +#define SHA384_End _libmd_SHA384_End +#endif +#ifndef SHA384_File +#define SHA384_File _libmd_SHA384_File +#endif +#ifndef SHA384_FileChunk +#define SHA384_FileChunk _libmd_SHA384_FileChunk +#endif +#ifndef SHA384_Data +#define SHA384_Data _libmd_SHA384_Data +#endif + +#ifndef SHA384_version +#define SHA384_version _libmd_SHA384_version +#endif + +void SHA384_Init(SHA384_CTX *); +void SHA384_Update(SHA384_CTX *, const void *, size_t); +void SHA384_Final(unsigned char [SHA384_DIGEST_LENGTH], SHA384_CTX *); +#ifndef _KERNEL +char *SHA384_End(SHA384_CTX *, char *); +char *SHA384_Data(const void *, unsigned int, char *); +char *SHA384_File(const char *, char *); +char *SHA384_FileChunk(const char *, char *, off_t, off_t); +#endif + +__END_DECLS + +#endif /* !_SHA384_H_ */ Copied: stable/10/sys/crypto/sha2/sha512.h (from r292782, head/sys/crypto/sha2/sha512.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/crypto/sha2/sha512.h Mon Feb 27 08:27:38 2017 (r314327, copy of r292782, head/sys/crypto/sha2/sha512.h) @@ -0,0 +1,90 @@ +/*- + * Copyright 2005 Colin Percival + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SHA512_H_ +#define _SHA512_H_ + +#ifndef _KERNEL +#include +#endif + +#define SHA512_BLOCK_LENGTH 128 +#define SHA512_DIGEST_LENGTH 64 +#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) + +typedef struct SHA512Context { + uint64_t state[8]; + uint64_t count[2]; + uint8_t buf[SHA512_BLOCK_LENGTH]; +} SHA512_CTX; + +__BEGIN_DECLS + +/* Ensure libmd symbols do not clash with libcrypto */ +#ifndef SHA512_Init +#define SHA512_Init _libmd_SHA512_Init +#endif +#ifndef SHA512_Update +#define SHA512_Update _libmd_SHA512_Update +#endif +#ifndef SHA512_Final +#define SHA512_Final _libmd_SHA512_Final +#endif +#ifndef SHA512_End +#define SHA512_End _libmd_SHA512_End +#endif +#ifndef SHA512_File +#define SHA512_File _libmd_SHA512_File +#endif +#ifndef SHA512_FileChunk +#define SHA512_FileChunk _libmd_SHA512_FileChunk +#endif +#ifndef SHA512_Data +#define SHA512_Data _libmd_SHA512_Data +#endif + +#ifndef SHA512_Transform +#define SHA512_Transform _libmd_SHA512_Transform +#endif +#ifndef SHA512_version +#define SHA512_version _libmd_SHA512_version +#endif + +void SHA512_Init(SHA512_CTX *); +void SHA512_Update(SHA512_CTX *, const void *, size_t); +void SHA512_Final(unsigned char [SHA512_DIGEST_LENGTH], SHA512_CTX *); +#ifndef _KERNEL +char *SHA512_End(SHA512_CTX *, char *); +char *SHA512_Data(const void *, unsigned int, char *); +char *SHA512_File(const char *, char *); +char *SHA512_FileChunk(const char *, char *, off_t, off_t); +#endif + +__END_DECLS + +#endif /* !_SHA512_H_ */ Copied: stable/10/sys/crypto/sha2/sha512c.c (from r292782, head/sys/crypto/sha2/sha512c.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/crypto/sha2/sha512c.c Mon Feb 27 08:27:38 2017 (r314327, copy of r292782, head/sys/crypto/sha2/sha512c.c) @@ -0,0 +1,397 @@ +/*- + * Copyright 2005 Colin Percival + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#ifdef _KERNEL +#include +#else +#include +#endif + +#include "sha512.h" +#include "sha384.h" + +#if BYTE_ORDER == BIG_ENDIAN + +/* Copy a vector of big-endian uint64_t into a vector of bytes */ +#define be64enc_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +/* Copy a vector of bytes into a vector of big-endian uint64_t */ +#define be64dec_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +#else /* BYTE_ORDER != BIG_ENDIAN */ + +/* + * Encode a length len/4 vector of (uint64_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 8. + */ +static void +be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 8; i++) + be64enc(dst + i * 8, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint64_t). Assumes len is a multiple of 8. + */ +static void +be64dec_vect(uint64_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 8; i++) + dst[i] = be64dec(src + i * 8); +} + +#endif /* BYTE_ORDER != BIG_ENDIAN */ + +/* Elementary functions used by SHA512 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define SHR(x, n) (x >> n) +#define ROTR(x, n) ((x >> n) | (x << (64 - n))) +#define S0(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39)) +#define S1(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41)) +#define s0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7)) +#define s1(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6)) + +/* SHA512 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, k) \ + RND(S[(80 - i) % 8], S[(81 - i) % 8], \ + S[(82 - i) % 8], S[(83 - i) % 8], \ + S[(84 - i) % 8], S[(85 - i) % 8], \ + S[(86 - i) % 8], S[(87 - i) % 8], \ + W[i] + k) + +/* + * SHA512 block compression function. The 512-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA512_Transform(uint64_t * state, const unsigned char block[SHA512_BLOCK_LENGTH]) +{ + uint64_t W[80]; + uint64_t S[8]; + uint64_t t0, t1; + int i; + + /* 1. Prepare message schedule W. */ + be64dec_vect(W, block, SHA512_BLOCK_LENGTH); + for (i = 16; i < 80; i++) + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + + /* 2. Initialize working variables. */ + memcpy(S, state, SHA512_DIGEST_LENGTH); + + /* 3. Mix. */ + RNDr(S, W, 0, 0x428a2f98d728ae22ULL); + RNDr(S, W, 1, 0x7137449123ef65cdULL); + RNDr(S, W, 2, 0xb5c0fbcfec4d3b2fULL); + RNDr(S, W, 3, 0xe9b5dba58189dbbcULL); + RNDr(S, W, 4, 0x3956c25bf348b538ULL); + RNDr(S, W, 5, 0x59f111f1b605d019ULL); + RNDr(S, W, 6, 0x923f82a4af194f9bULL); + RNDr(S, W, 7, 0xab1c5ed5da6d8118ULL); + RNDr(S, W, 8, 0xd807aa98a3030242ULL); + RNDr(S, W, 9, 0x12835b0145706fbeULL); + RNDr(S, W, 10, 0x243185be4ee4b28cULL); + RNDr(S, W, 11, 0x550c7dc3d5ffb4e2ULL); + RNDr(S, W, 12, 0x72be5d74f27b896fULL); + RNDr(S, W, 13, 0x80deb1fe3b1696b1ULL); + RNDr(S, W, 14, 0x9bdc06a725c71235ULL); + RNDr(S, W, 15, 0xc19bf174cf692694ULL); + RNDr(S, W, 16, 0xe49b69c19ef14ad2ULL); + RNDr(S, W, 17, 0xefbe4786384f25e3ULL); + RNDr(S, W, 18, 0x0fc19dc68b8cd5b5ULL); + RNDr(S, W, 19, 0x240ca1cc77ac9c65ULL); + RNDr(S, W, 20, 0x2de92c6f592b0275ULL); + RNDr(S, W, 21, 0x4a7484aa6ea6e483ULL); + RNDr(S, W, 22, 0x5cb0a9dcbd41fbd4ULL); + RNDr(S, W, 23, 0x76f988da831153b5ULL); + RNDr(S, W, 24, 0x983e5152ee66dfabULL); + RNDr(S, W, 25, 0xa831c66d2db43210ULL); + RNDr(S, W, 26, 0xb00327c898fb213fULL); + RNDr(S, W, 27, 0xbf597fc7beef0ee4ULL); + RNDr(S, W, 28, 0xc6e00bf33da88fc2ULL); + RNDr(S, W, 29, 0xd5a79147930aa725ULL); + RNDr(S, W, 30, 0x06ca6351e003826fULL); + RNDr(S, W, 31, 0x142929670a0e6e70ULL); + RNDr(S, W, 32, 0x27b70a8546d22ffcULL); + RNDr(S, W, 33, 0x2e1b21385c26c926ULL); + RNDr(S, W, 34, 0x4d2c6dfc5ac42aedULL); + RNDr(S, W, 35, 0x53380d139d95b3dfULL); + RNDr(S, W, 36, 0x650a73548baf63deULL); + RNDr(S, W, 37, 0x766a0abb3c77b2a8ULL); + RNDr(S, W, 38, 0x81c2c92e47edaee6ULL); + RNDr(S, W, 39, 0x92722c851482353bULL); + RNDr(S, W, 40, 0xa2bfe8a14cf10364ULL); + RNDr(S, W, 41, 0xa81a664bbc423001ULL); + RNDr(S, W, 42, 0xc24b8b70d0f89791ULL); + RNDr(S, W, 43, 0xc76c51a30654be30ULL); + RNDr(S, W, 44, 0xd192e819d6ef5218ULL); + RNDr(S, W, 45, 0xd69906245565a910ULL); + RNDr(S, W, 46, 0xf40e35855771202aULL); + RNDr(S, W, 47, 0x106aa07032bbd1b8ULL); + RNDr(S, W, 48, 0x19a4c116b8d2d0c8ULL); + RNDr(S, W, 49, 0x1e376c085141ab53ULL); + RNDr(S, W, 50, 0x2748774cdf8eeb99ULL); + RNDr(S, W, 51, 0x34b0bcb5e19b48a8ULL); + RNDr(S, W, 52, 0x391c0cb3c5c95a63ULL); + RNDr(S, W, 53, 0x4ed8aa4ae3418acbULL); + RNDr(S, W, 54, 0x5b9cca4f7763e373ULL); + RNDr(S, W, 55, 0x682e6ff3d6b2b8a3ULL); + RNDr(S, W, 56, 0x748f82ee5defb2fcULL); + RNDr(S, W, 57, 0x78a5636f43172f60ULL); + RNDr(S, W, 58, 0x84c87814a1f0ab72ULL); + RNDr(S, W, 59, 0x8cc702081a6439ecULL); + RNDr(S, W, 60, 0x90befffa23631e28ULL); + RNDr(S, W, 61, 0xa4506cebde82bde9ULL); + RNDr(S, W, 62, 0xbef9a3f7b2c67915ULL); + RNDr(S, W, 63, 0xc67178f2e372532bULL); + RNDr(S, W, 64, 0xca273eceea26619cULL); + RNDr(S, W, 65, 0xd186b8c721c0c207ULL); + RNDr(S, W, 66, 0xeada7dd6cde0eb1eULL); + RNDr(S, W, 67, 0xf57d4f7fee6ed178ULL); + RNDr(S, W, 68, 0x06f067aa72176fbaULL); + RNDr(S, W, 69, 0x0a637dc5a2c898a6ULL); + RNDr(S, W, 70, 0x113f9804bef90daeULL); + RNDr(S, W, 71, 0x1b710b35131c471bULL); + RNDr(S, W, 72, 0x28db77f523047d84ULL); + RNDr(S, W, 73, 0x32caab7b40c72493ULL); + RNDr(S, W, 74, 0x3c9ebe0a15c9bebcULL); + RNDr(S, W, 75, 0x431d67c49c100d4cULL); + RNDr(S, W, 76, 0x4cc5d4becb3e42b6ULL); + RNDr(S, W, 77, 0x597f299cfc657e2aULL); + RNDr(S, W, 78, 0x5fcb6fab3ad6faecULL); + RNDr(S, W, 79, 0x6c44198c4a475817ULL); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; +} + +static unsigned char PAD[SHA512_BLOCK_LENGTH] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA512_Pad(SHA512_CTX * ctx) +{ + unsigned char len[16]; + uint64_t r, plen; + + /* + * Convert length to a vector of bytes -- we do this now rather + * than later because the length will change after we pad. + */ + be64enc_vect(len, ctx->count, 16); + + /* Add 1--128 bytes so that the resulting length is 112 mod 128 */ + r = (ctx->count[1] >> 3) & 0x7f; + plen = (r < 112) ? (112 - r) : (240 - r); + SHA512_Update(ctx, PAD, (size_t)plen); + + /* Add the terminating bit-count */ + SHA512_Update(ctx, len, 16); +} + +/* SHA-512 initialization. Begins a SHA-512 operation. */ +void +SHA512_Init(SHA512_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6a09e667f3bcc908ULL; + ctx->state[1] = 0xbb67ae8584caa73bULL; + ctx->state[2] = 0x3c6ef372fe94f82bULL; + ctx->state[3] = 0xa54ff53a5f1d36f1ULL; + ctx->state[4] = 0x510e527fade682d1ULL; + ctx->state[5] = 0x9b05688c2b3e6c1fULL; + ctx->state[6] = 0x1f83d9abfb41bd6bULL; + ctx->state[7] = 0x5be0cd19137e2179ULL; +} + +/* Add bytes into the hash */ +void +SHA512_Update(SHA512_CTX * ctx, const void *in, size_t len) +{ + uint64_t bitlen[2]; + uint64_t r; + const unsigned char *src = in; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count[1] >> 3) & 0x7f; + + /* Convert the length into a number of bits */ + bitlen[1] = ((uint64_t)len) << 3; + bitlen[0] = ((uint64_t)len) >> 61; + + /* Update number of bits */ + if ((ctx->count[1] += bitlen[1]) < bitlen[1]) + ctx->count[0]++; + ctx->count[0] += bitlen[0]; + + /* Handle the case where we don't need to perform any transforms */ + if (len < SHA512_BLOCK_LENGTH - r) { + memcpy(&ctx->buf[r], src, len); + return; + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, SHA512_BLOCK_LENGTH - r); + SHA512_Transform(ctx->state, ctx->buf); + src += SHA512_BLOCK_LENGTH - r; + len -= SHA512_BLOCK_LENGTH - r; + + /* Perform complete blocks */ + while (len >= SHA512_BLOCK_LENGTH) { + SHA512_Transform(ctx->state, src); + src += SHA512_BLOCK_LENGTH; + len -= SHA512_BLOCK_LENGTH; + } + + /* Copy left over data into buffer */ + memcpy(ctx->buf, src, len); +} + +/* + * SHA-512 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +SHA512_Final(unsigned char digest[SHA512_DIGEST_LENGTH], SHA512_CTX * ctx) +{ + + /* Add padding */ + SHA512_Pad(ctx); + + /* Write the hash */ + be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH); + + /* Clear the context state */ + memset((void *)ctx, 0, sizeof(*ctx)); +} + +/*** SHA-384: *********************************************************/ +/* + * the SHA384 and SHA512 transforms are identical, so SHA384 is skipped + */ + +/* SHA-384 initialization. Begins a SHA-384 operation. */ +void +SHA384_Init(SHA384_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0xcbbb9d5dc1059ed8ULL; + ctx->state[1] = 0x629a292a367cd507ULL; + ctx->state[2] = 0x9159015a3070dd17ULL; + ctx->state[3] = 0x152fecd8f70e5939ULL; + ctx->state[4] = 0x67332667ffc00b31ULL; + ctx->state[5] = 0x8eb44a8768581511ULL; + ctx->state[6] = 0xdb0c2e0d64f98fa7ULL; + ctx->state[7] = 0x47b5481dbefa4fa4ULL; +} + +/* Add bytes into the SHA-384 hash */ +void +SHA384_Update(SHA384_CTX * ctx, const void *in, size_t len) +{ + + SHA512_Update((SHA512_CTX *)ctx, in, len); +} + +/* + * SHA-384 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +SHA384_Final(unsigned char digest[SHA384_DIGEST_LENGTH], SHA384_CTX * ctx) +{ + + /* Add padding */ + SHA512_Pad((SHA512_CTX *)ctx); + + /* Write the hash */ + be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH); + + /* Clear the context state */ + memset((void *)ctx, 0, sizeof(*ctx)); +} + +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ +#undef SHA512_Init +__weak_reference(_libmd_SHA512_Init, SHA512_Init); +#undef SHA512_Update +__weak_reference(_libmd_SHA512_Update, SHA512_Update); +#undef SHA512_Final +__weak_reference(_libmd_SHA512_Final, SHA512_Final); +#undef SHA512_Transform +__weak_reference(_libmd_SHA512_Transform, SHA512_Transform); + +#undef SHA384_Init +__weak_reference(_libmd_SHA384_Init, SHA384_Init); +#undef SHA384_Update +__weak_reference(_libmd_SHA384_Update, SHA384_Update); +#undef SHA384_Final +__weak_reference(_libmd_SHA384_Final, SHA384_Final); +#endif Modified: stable/10/sys/dev/random/hash.c ============================================================================== --- stable/10/sys/dev/random/hash.c Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sys/dev/random/hash.c Mon Feb 27 08:27:38 2017 (r314327) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include Modified: stable/10/sys/dev/random/yarrow.c ============================================================================== --- stable/10/sys/dev/random/yarrow.c Mon Feb 27 08:20:28 2017 (r314326) +++ stable/10/sys/dev/random/yarrow.c Mon Feb 27 08:27:38 2017 (r314327) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Mon Feb 27 10:10:46 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62D77CE9BFB; Mon, 27 Feb 2017 10:10:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id 324E2C57; Mon, 27 Feb 2017 10:10:46 +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 v1RAAjpq006318; Mon, 27 Feb 2017 10:10:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RAAjCV006317; Mon, 27 Feb 2017 10:10:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271010.v1RAAjCV006317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 10:10:45 +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: r314330 - stable/10/lib/libmd X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 10:10:46 -0000 Author: avg Date: Mon Feb 27 10:10:45 2017 New Revision: 314330 URL: https://svnweb.freebsd.org/changeset/base/314330 Log: MFC r285417: Add new include path for sha256.h Modified: stable/10/lib/libmd/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libmd/Makefile ============================================================================== --- stable/10/lib/libmd/Makefile Mon Feb 27 08:58:27 2017 (r314329) +++ stable/10/lib/libmd/Makefile Mon Feb 27 10:10:45 2017 (r314330) @@ -54,7 +54,8 @@ CLEANFILES+= md[245]hl.c md[245].ref md[ # in which case: # * macros are used to rename symbols to libcrypt internal names # * no weak aliases are generated -CFLAGS+= -I${.CURDIR} -DWEAK_REFS +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../sys/crypto/sha2 +CFLAGS+= -DWEAK_REFS .PATH: ${.CURDIR}/${MACHINE_ARCH} ${.CURDIR}/../../sys/crypto/sha2 .if exists(${MACHINE_ARCH}/sha.S) From owner-svn-src-stable-10@freebsd.org Mon Feb 27 10:22:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89394CEF1CA; Mon, 27 Feb 2017 10:22:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id 55E0881F; Mon, 27 Feb 2017 10:22:17 +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 v1RAMGC6013743; Mon, 27 Feb 2017 10:22:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RAMGaW013742; Mon, 27 Feb 2017 10:22:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271022.v1RAMGaW013742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 10:22: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: r314331 - stable/10/sys/modules/random X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 10:22:17 -0000 Author: avg Date: Mon Feb 27 10:22:16 2017 New Revision: 314331 URL: https://svnweb.freebsd.org/changeset/base/314331 Log: fix up r314327 (MFC of r292782): sha2 -> sha512 in sys/modules/random Modified: stable/10/sys/modules/random/Makefile Modified: stable/10/sys/modules/random/Makefile ============================================================================== --- stable/10/sys/modules/random/Makefile Mon Feb 27 10:10:45 2017 (r314330) +++ stable/10/sys/modules/random/Makefile Mon Feb 27 10:22:16 2017 (r314331) @@ -12,7 +12,7 @@ SRCS+= ivy.c .endif SRCS+= randomdev_soft.c yarrow.c hash.c SRCS+= random_harvestq.c live_entropy_sources.c rwfile.c -SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c sha256c.c +SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha256c.c sha512c.c SRCS+= bus_if.h device_if.h vnode_if.h opt_cpu.h opt_random.h CFLAGS+= -I${.CURDIR}/../.. From owner-svn-src-stable-10@freebsd.org Mon Feb 27 10:40:42 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 150EACEF91F; Mon, 27 Feb 2017 10:40:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id D18699E; Mon, 27 Feb 2017 10:40:41 +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 v1RAefLM018655; Mon, 27 Feb 2017 10:40:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RAeesS018645; Mon, 27 Feb 2017 10:40:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271040.v1RAeesS018645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 10:40:40 +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: r314332 - in stable/10: lib/libcrypt lib/libmd sbin/md5 sys/crypto/sha2 X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 10:40:42 -0000 Author: avg Date: Mon Feb 27 10:40:39 2017 New Revision: 314332 URL: https://svnweb.freebsd.org/changeset/base/314332 Log: MFC r300903: Implement SHA-512 truncated (224 and 256 bits) Added: stable/10/sys/crypto/sha2/sha512t.h - copied unchanged from r300903, head/sys/crypto/sha2/sha512t.h Modified: stable/10/lib/libcrypt/Makefile stable/10/lib/libmd/Makefile stable/10/lib/libmd/sha512.3 stable/10/lib/libmd/shadriver.c stable/10/sbin/md5/Makefile stable/10/sbin/md5/md5.1 stable/10/sbin/md5/md5.c stable/10/sys/crypto/sha2/sha512c.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libcrypt/Makefile ============================================================================== --- stable/10/lib/libcrypt/Makefile Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/lib/libcrypt/Makefile Mon Feb 27 10:40:39 2017 (r314332) @@ -29,6 +29,8 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BL .for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ SHA256_Init SHA256_Final SHA256_Update \ + SHA512_224_Init SHA512_224_Final SHA512_224_Update \ + SHA512_256_Init SHA512_256_Final SHA512_256_Update \ SHA384_Init SHA384_Final SHA384_Update \ SHA512_Init SHA512_Final SHA512_Update CFLAGS+= -D${sym}=__${sym} Modified: stable/10/lib/libmd/Makefile ============================================================================== --- stable/10/lib/libmd/Makefile Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/lib/libmd/Makefile Mon Feb 27 10:40:39 2017 (r314332) @@ -8,8 +8,8 @@ SRCS= md4c.c md5c.c md4hl.c md5hl.c \ sha0c.c sha0hl.c sha1c.c sha1hl.c \ sha256c.c sha256hl.c \ sha384hl.c \ - sha512c.c sha512hl.c -INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h + sha512c.c sha512hl.c sha512thl.c +INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h sha512t.h WARNS?= 0 @@ -42,11 +42,15 @@ MLINKS+=sha512.3 SHA512_Init.3 sha512.3 MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3 MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 MLINKS+=sha512.3 SHA512_Data.3 +MLINKS+=sha512.3 SHA512_256_Init.3 sha512.3 SHA512_256_Update.3 +MLINKS+=sha512.3 SHA512_256_Final.3 sha512.3 SHA512_256_End.3 +MLINKS+=sha512.3 SHA512_256_File.3 sha512.3 SHA512_256_FileChunk.3 +MLINKS+=sha512.3 SHA512_256_Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ rmd160.ref rmd160hl.c rmddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ sha256.ref sha256hl.c sha384hl.c sha384.ref \ - sha512.ref sha512hl.c + sha512.ref sha512hl.c sha512t256.ref sha512thl.c # Define WEAK_REFS to provide weak aliases for libmd symbols # @@ -106,6 +110,13 @@ sha512hl.c: mdXhl.c -e 's/SHA512__/SHA512_/g' \ ${.ALLSRC}) > ${.TARGET} +sha512thl.c: mdXhl.c + (echo '#define LENGTH 32'; \ + sed -e 's/mdX/sha512t/g' -e 's/MDX/SHA512_256_/g' \ + -e 's/SHA512_256__/SHA512_256_/g' \ + -e 's/SHA512_256_CTX/SHA512_CTX/g' \ + ${.ALLSRC}) > ${.TARGET} + rmd160hl.c: mdXhl.c (echo '#define LENGTH 20'; \ sed -e 's/mdX/ripemd/g' -e 's/MDX/RIPEMD160_/g' \ @@ -210,6 +221,21 @@ sha512.ref: @echo 'SHA-512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ '72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843' >> ${.TARGET} +sha512t256.ref: + echo 'SHA-512256 test suite:' > ${.TARGET} + @echo 'SHA-512256 ("") =' \ + 'c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a' >> ${.TARGET} + @echo 'SHA-512256 ("abc") =' \ + '53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23' >> ${.TARGET} + @echo 'SHA-512256 ("message digest") =' \ + '0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb' >> ${.TARGET} + @echo 'SHA-512256 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26' >> ${.TARGET} + @echo 'SHA-512256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + 'cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8' >> ${.TARGET} + @echo 'SHA-512256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148' >> ${.TARGET} + rmd160.ref: echo 'RIPEMD160 test suite:' > ${.TARGET} @echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31' >> ${.TARGET} @@ -224,7 +250,7 @@ rmd160.ref: '9b752e45573d4b39f4dbd3323cab82bf63326bfb' >> ${.TARGET} test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha384.ref \ - sha512.ref + sha512.ref sha512t256.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. ${CC} ${CFLAGS} ${LDFLAGS} -DMD=4 -o mddriver ${.CURDIR}/mddriver.c libmd.a @@ -253,6 +279,9 @@ test: md4.ref md5.ref sha0.ref rmd160.re ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha512.ref - @${ECHO} SHA-512 passed test + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512256 -o shadriver ${.CURDIR}/shadriver.c libmd.a + ./shadriver | cmp sha512t256.ref - + @${ECHO} SHA-512t256 passed test -rm -f shadriver .include Modified: stable/10/lib/libmd/sha512.3 ============================================================================== --- stable/10/lib/libmd/sha512.3 Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/lib/libmd/sha512.3 Mon Feb 27 10:40:39 2017 (r314332) @@ -9,7 +9,7 @@ .\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp .\" $FreeBSD$ .\" -.Dd October 17, 2015 +.Dd April 22, 2016 .Dt SHA512 3 .Os .Sh NAME @@ -26,7 +26,14 @@ .Nm SHA384_End , .Nm SHA384_File , .Nm SHA384_FileChunk , -.Nm SHA384_Data +.Nm SHA384_Data, +.Nm SHA512_256_Init , +.Nm SHA512_256_Update , +.Nm SHA512_256_Final , +.Nm SHA512_256_End , +.Nm SHA512_256_File , +.Nm SHA512_256_FileChunk , +.Nm SHA512_256_Data .Nd calculate the FIPS 180-4 ``SHA-512'' family of message digests .Sh LIBRARY .Lb libmd @@ -47,6 +54,7 @@ .Fn SHA512_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" .Ft "char *" .Fn SHA512_Data "const unsigned char *data" "unsigned int len" "char *buf" +.In sha384.h .Ft void .Fn SHA384_Init "SHA384_CTX *context" .Ft void @@ -61,6 +69,21 @@ .Fn SHA384_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" .Ft "char *" .Fn SHA384_Data "const unsigned char *data" "unsigned int len" "char *buf" +.In sha512t.h +.Ft void +.Fn SHA512_256_Init "SHA512_CTX *context" +.Ft void +.Fn SHA512_256_Update "SHA512_CTX *context" "const unsigned char *data" "size_t len" +.Ft void +.Fn SHA512_256_Final "unsigned char digest[32]" "SHA512_CTX *context" +.Ft "char *" +.Fn SHA512_256_End "SHA512_CTX *context" "char *buf" +.Ft "char *" +.Fn SHA512_256_File "const char *filename" "char *buf" +.Ft "char *" +.Fn SHA512_256_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" +.Fn SHA512_256_Data "const unsigned char *data" "unsigned int len" "char *buf" .Sh DESCRIPTION The .Li SHA512_ @@ -92,7 +115,7 @@ and finally extract the result using .Fn SHA512_End is a wrapper for .Fn SHA512_Final -which converts the return value to a 65-character +which converts the return value to a 129-character (including the terminating '\e0') .Tn ASCII string which represents the 512 bits in hexadecimal. @@ -139,22 +162,32 @@ and subsequently must be explicitly deal after use. If the .Fa buf -argument is non-null it must point to at least 65 characters of buffer space. +argument is non-null it must point to at least 129 characters of buffer space. .Pp The .Li SHA384_ +and +.Li SHA512_256_ functions are identical to the .Li SHA512_ functions except they use a different initial hash value and the output is -truncated to 384 bits. +truncated to 384 bits and 256 bits respectively. .Pp .Fn SHA384_End is a wrapper for .Fn SHA384_Final -which converts the return value to a 49-character +which converts the return value to a 97-character (including the terminating '\e0') .Tn ASCII string which represents the 384 bits in hexadecimal. +.Pp +.Fn SHA512_256_End +is a wrapper for +.Fn SHA512_Final +which converts the return value to a 65-character +(including the terminating '\e0') +.Tn ASCII +string which represents the 256 bits in hexadecimal. .Sh SEE ALSO .Xr md4 3 , .Xr md5 3 , Modified: stable/10/lib/libmd/shadriver.c ============================================================================== --- stable/10/lib/libmd/shadriver.c Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/lib/libmd/shadriver.c Mon Feb 27 10:40:39 2017 (r314332) @@ -24,6 +24,7 @@ __FBSDID("$FreeBSD$"); #include "sha256.h" #include "sha384.h" #include "sha512.h" +#include "sha512t.h" /* The following makes SHA default to SHA-1 if it has not already been * defined with C compiler flags. */ @@ -43,6 +44,9 @@ __FBSDID("$FreeBSD$"); #elif SHA == 512 #undef SHA_Data #define SHA_Data SHA512_Data +#elif SHA == 512256 +#undef SHA_Data +#define SHA_Data SHA512_256_Data #endif /* Digests a string and prints the result. */ Modified: stable/10/sbin/md5/Makefile ============================================================================== --- stable/10/sbin/md5/Makefile Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/sbin/md5/Makefile Mon Feb 27 10:40:39 2017 (r314332) @@ -7,13 +7,15 @@ LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ ${BINDIR}/md5 ${BINDIR}/sha256 \ ${BINDIR}/md5 ${BINDIR}/sha384 \ - ${BINDIR}/md5 ${BINDIR}/sha512 + ${BINDIR}/md5 ${BINDIR}/sha512 \ + ${BINDIR}/md5 ${BINDIR}/sha512t256 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ md5.1 sha256.1 \ md5.1 sha384.1 \ - md5.1 sha512.1 + md5.1 sha512.1 \ + md5.1 sha512t256.1 DPADD= ${LIBMD} LDADD= -lmd Modified: stable/10/sbin/md5/md5.1 ============================================================================== --- stable/10/sbin/md5/md5.1 Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/sbin/md5/md5.1 Mon Feb 27 10:40:39 2017 (r314332) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd October 17, 2015 +.Dd April 22, 2016 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , sha384 , sha512, rmd160 +.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256, rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -31,6 +31,11 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm sha512t256 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Nm rmd160 .Op Fl pqrtx .Op Fl c Ar string @@ -38,7 +43,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 , sha384 , sha512 +.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -78,8 +83,17 @@ found which is faster than a brute-force .Tn SHA-1 in doubt. .Pp -It is recommended that all new applications use +.Tn SHA-512t256 +is a version of +.Tn SHA-512 +truncated to only 256 bits. +On 64-bit hardware, this algorithm is approximately 50% faster than .Tn SHA-256 +but with the same level of security. +The hashes are not interchangeable. +.Pp +It is recommended that all new applications use +.Tn SHA-512 instead of one of the other hash functions. .Pp The following options may be used in any combination and must @@ -114,7 +128,7 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 , sha512 +.Nm md5 , sha1 , sha256 , sha512, sha512t256 and .Nm rmd160 utilities exit 0 on success, Modified: stable/10/sbin/md5/md5.c ============================================================================== --- stable/10/sbin/md5/md5.c Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/sbin/md5/md5.c Mon Feb 27 10:40:39 2017 (r314332) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ extern const char *SHA1_TestOutput[MDTES extern const char *SHA256_TestOutput[MDTESTCOUNT]; extern const char *SHA384_TestOutput[MDTESTCOUNT]; extern const char *SHA512_TestOutput[MDTESTCOUNT]; +extern const char *SHA512t256_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; typedef struct Algorithm_t { @@ -110,6 +112,9 @@ static const struct Algorithm_t Algorith { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, &SHA512_Data, &SHA512_File }, + { "sha512t256", "SHA512t256", &SHA512t256_TestOutput, (DIGEST_Init*)&SHA512_256_Init, + (DIGEST_Update*)&SHA512_256_Update, (DIGEST_End*)&SHA512_256_End, + &SHA512_256_Data, &SHA512_256_File }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } @@ -355,6 +360,17 @@ const char *SHA512_TestOutput[MDTESTCOUN "e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3" }; +const char *SHA512t256_TestOutput[MDTESTCOUNT] = { + "c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a", + "455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8", + "53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23", + "0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb", + "fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26", + "cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8", + "2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148", + "dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736" +}; + const char *RIPEMD160_TestOutput[MDTESTCOUNT] = { "9c1185a5c5e9fc54612808977ee8f548b2258d31", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", Modified: stable/10/sys/crypto/sha2/sha512c.c ============================================================================== --- stable/10/sys/crypto/sha2/sha512c.c Mon Feb 27 10:22:16 2017 (r314331) +++ stable/10/sys/crypto/sha2/sha512c.c Mon Feb 27 10:40:39 2017 (r314332) @@ -1,5 +1,6 @@ /*- * Copyright 2005 Colin Percival + * Copyright (c) 2015 Allan Jude * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +38,7 @@ __FBSDID("$FreeBSD$"); #endif #include "sha512.h" +#include "sha512t.h" #include "sha384.h" #if BYTE_ORDER == BIG_ENDIAN @@ -324,6 +326,88 @@ SHA512_Final(unsigned char digest[SHA512 memset((void *)ctx, 0, sizeof(*ctx)); } +/*** SHA-512t: *********************************************************/ +/* + * the SHA512t transforms are identical to SHA512 so reuse the existing function + */ +void +SHA512_224_Init(SHA512_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x8c3d37c819544da2ULL; + ctx->state[1] = 0x73e1996689dcd4d6ULL; + ctx->state[2] = 0x1dfab7ae32ff9c82ULL; + ctx->state[3] = 0x679dd514582f9fcfULL; + ctx->state[4] = 0x0f6d2b697bd44da8ULL; + ctx->state[5] = 0x77e36f7304c48942ULL; + ctx->state[6] = 0x3f9d85a86a1d36c8ULL; + ctx->state[7] = 0x1112e6ad91d692a1ULL; +} + +void +SHA512_224_Update(SHA512_CTX * ctx, const void *in, size_t len) +{ + + SHA512_Update(ctx, in, len); +} + +void +SHA512_224_Final(unsigned char digest[static SHA512_224_DIGEST_LENGTH], SHA512_CTX * ctx) +{ + + /* Add padding */ + SHA512_Pad(ctx); + + /* Write the hash */ + be64enc_vect(digest, ctx->state, SHA512_224_DIGEST_LENGTH); + + /* Clear the context state */ + memset(ctx, 0, sizeof(*ctx)); +} + +void +SHA512_256_Init(SHA512_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x22312194fc2bf72cULL; + ctx->state[1] = 0x9f555fa3c84c64c2ULL; + ctx->state[2] = 0x2393b86b6f53b151ULL; + ctx->state[3] = 0x963877195940eabdULL; + ctx->state[4] = 0x96283ee2a88effe3ULL; + ctx->state[5] = 0xbe5e1e2553863992ULL; + ctx->state[6] = 0x2b0199fc2c85b8aaULL; + ctx->state[7] = 0x0eb72ddc81c52ca2ULL; +} + +void +SHA512_256_Update(SHA512_CTX * ctx, const void *in, size_t len) +{ + + SHA512_Update(ctx, in, len); +} + +void +SHA512_256_Final(unsigned char digest[static SHA512_256_DIGEST_LENGTH], SHA512_CTX * ctx) +{ + + /* Add padding */ + SHA512_Pad(ctx); + + /* Write the hash */ + be64enc_vect(digest, ctx->state, SHA512_256_DIGEST_LENGTH); + + /* Clear the context state */ + memset(ctx, 0, sizeof(*ctx)); +} + /*** SHA-384: *********************************************************/ /* * the SHA384 and SHA512 transforms are identical, so SHA384 is skipped @@ -388,6 +472,20 @@ __weak_reference(_libmd_SHA512_Final, SH #undef SHA512_Transform __weak_reference(_libmd_SHA512_Transform, SHA512_Transform); +#undef SHA512_224_Init +__weak_reference(_libmd_SHA512_224_Init, SHA512_224_Init); +#undef SHA512_224_Update +__weak_reference(_libmd_SHA512_224_Update, SHA512_224_Update); +#undef SHA512_224_Final +__weak_reference(_libmd_SHA512_224_Final, SHA512_224_Final); + +#undef SHA512_256_Init +__weak_reference(_libmd_SHA512_256_Init, SHA512_256_Init); +#undef SHA512_256_Update +__weak_reference(_libmd_SHA512_256_Update, SHA512_256_Update); +#undef SHA512_256_Final +__weak_reference(_libmd_SHA512_256_Final, SHA512_256_Final); + #undef SHA384_Init __weak_reference(_libmd_SHA384_Init, SHA384_Init); #undef SHA384_Update Copied: stable/10/sys/crypto/sha2/sha512t.h (from r300903, head/sys/crypto/sha2/sha512t.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/crypto/sha2/sha512t.h Mon Feb 27 10:40:39 2017 (r314332, copy of r300903, head/sys/crypto/sha2/sha512t.h) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2015 Allan Jude + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SHA512T_H_ +#define _SHA512T_H_ + +#include "sha512.h" + +#ifndef _KERNEL +#include +#endif + +#define SHA512_224_DIGEST_LENGTH 28 +#define SHA512_224_DIGEST_STRING_LENGTH (SHA512_224_DIGEST_LENGTH * 2 + 1) +#define SHA512_256_DIGEST_LENGTH 32 +#define SHA512_256_DIGEST_STRING_LENGTH (SHA512_256_DIGEST_LENGTH * 2 + 1) + +__BEGIN_DECLS + +/* Ensure libmd symbols do not clash with libcrypto */ +#ifndef SHA512_224_Init +#define SHA512_224_Init _libmd_SHA512_224_Init +#endif +#ifndef SHA512_224_Update +#define SHA512_224_Update _libmd_SHA512_224_Update +#endif +#ifndef SHA512_224_Final +#define SHA512_224_Final _libmd_SHA512_224_Final +#endif +#ifndef SHA512_224_End +#define SHA512_224_End _libmd_SHA512_224_End +#endif +#ifndef SHA512_224_File +#define SHA512_224_File _libmd_SHA512_224_File +#endif +#ifndef SHA512_224_FileChunk +#define SHA512_224_FileChunk _libmd_SHA512_224_FileChunk +#endif +#ifndef SHA512_224_Data +#define SHA512_224_Data _libmd_SHA512_224_Data +#endif + +#ifndef SHA512_224_Transform +#define SHA512_224_Transform _libmd_SHA512_224_Transform +#endif +#ifndef SHA512_224_version +#define SHA512_224_version _libmd_SHA512_224_version +#endif + +#ifndef SHA512_256_Init +#define SHA512_256_Init _libmd_SHA512_256_Init +#endif +#ifndef SHA512_256_Update +#define SHA512_256_Update _libmd_SHA512_256_Update +#endif +#ifndef SHA512_256_Final +#define SHA512_256_Final _libmd_SHA512_256_Final +#endif +#ifndef SHA512_256_End +#define SHA512_256_End _libmd_SHA512_256_End +#endif +#ifndef SHA512_256_File +#define SHA512_256_File _libmd_SHA512_256_File +#endif +#ifndef SHA512_256_FileChunk +#define SHA512_256_FileChunk _libmd_SHA512_256_FileChunk +#endif +#ifndef SHA512_256_Data +#define SHA512_256_Data _libmd_SHA512_256_Data +#endif + +#ifndef SHA512_256_Transform +#define SHA512_256_Transform _libmd_SHA512_256_Transform +#endif +#ifndef SHA512_256_version +#define SHA512_256_version _libmd_SHA512_256_version +#endif + +void SHA512_224_Init(SHA512_CTX *); +void SHA512_224_Update(SHA512_CTX *, const void *, size_t); +void SHA512_224_Final(unsigned char [static SHA512_224_DIGEST_LENGTH], SHA512_CTX *); +#ifndef _KERNEL +char *SHA512_224_End(SHA512_CTX *, char *); +char *SHA512_224_Data(const void *, unsigned int, char *); +char *SHA512_224_File(const char *, char *); +char *SHA512_224_FileChunk(const char *, char *, off_t, off_t); +#endif +void SHA512_256_Init(SHA512_CTX *); +void SHA512_256_Update(SHA512_CTX *, const void *, size_t); +void SHA512_256_Final(unsigned char [static SHA512_256_DIGEST_LENGTH], SHA512_CTX *); +#ifndef _KERNEL +char *SHA512_256_End(SHA512_CTX *, char *); +char *SHA512_256_Data(const void *, unsigned int, char *); +char *SHA512_256_File(const char *, char *); +char *SHA512_256_FileChunk(const char *, char *, off_t, off_t); +#endif + +__END_DECLS + +#endif /* !_SHA512T_H_ */ From owner-svn-src-stable-10@freebsd.org Mon Feb 27 13:05:18 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DD4CCED0EA; Mon, 27 Feb 2017 13:05:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id 324AFD8F; Mon, 27 Feb 2017 13:05:18 +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 v1RD5Hoo077426; Mon, 27 Feb 2017 13:05:17 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RD5HOi077424; Mon, 27 Feb 2017 13:05:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271305.v1RD5HOi077424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 13:05:17 +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: r314335 - stable/10/sys/crypto/sha2 X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 13:05:18 -0000 Author: avg Date: Mon Feb 27 13:05:17 2017 New Revision: 314335 URL: https://svnweb.freebsd.org/changeset/base/314335 Log: MFC r300966: Retune SHA2 code for improved performance on CPUs with more ILP... Modified: stable/10/sys/crypto/sha2/sha256c.c stable/10/sys/crypto/sha2/sha512c.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/crypto/sha2/sha256c.c ============================================================================== --- stable/10/sys/crypto/sha2/sha256c.c Mon Feb 27 11:27:46 2017 (r314334) +++ stable/10/sys/crypto/sha2/sha256c.c Mon Feb 27 13:05:17 2017 (r314335) @@ -78,6 +78,26 @@ be32dec_vect(uint32_t *dst, const unsign #endif /* BYTE_ORDER != BIG_ENDIAN */ +/* SHA256 round constants. */ +static const uint32_t K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + /* Elementary functions used by SHA256 */ #define Ch(x, y, z) ((x & (y ^ z)) ^ z) #define Maj(x, y, z) ((x & (y | z)) | (y & z)) @@ -90,18 +110,21 @@ be32dec_vect(uint32_t *dst, const unsign /* SHA256 round function */ #define RND(a, b, c, d, e, f, g, h, k) \ - t0 = h + S1(e) + Ch(e, f, g) + k; \ - t1 = S0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; + h += S1(e) + Ch(e, f, g) + k; \ + d += h; \ + h += S0(a) + Maj(a, b, c); /* Adjusted round function for rotating state */ -#define RNDr(S, W, i, k) \ +#define RNDr(S, W, i, ii) \ RND(S[(64 - i) % 8], S[(65 - i) % 8], \ S[(66 - i) % 8], S[(67 - i) % 8], \ S[(68 - i) % 8], S[(69 - i) % 8], \ S[(70 - i) % 8], S[(71 - i) % 8], \ - W[i] + k) + W[i + ii] + K[i + ii]) + +/* Message schedule computation */ +#define MSCH(W, ii, i) \ + W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii] /* * SHA256 block compression function. The 256-bit state is transformed via @@ -112,82 +135,52 @@ SHA256_Transform(uint32_t * state, const { uint32_t W[64]; uint32_t S[8]; - uint32_t t0, t1; int i; - /* 1. Prepare message schedule W. */ + /* 1. Prepare the first part of the message schedule W. */ be32dec_vect(W, block, 64); - for (i = 16; i < 64; i++) - W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; /* 2. Initialize working variables. */ memcpy(S, state, 32); /* 3. Mix. */ - RNDr(S, W, 0, 0x428a2f98); - RNDr(S, W, 1, 0x71374491); - RNDr(S, W, 2, 0xb5c0fbcf); - RNDr(S, W, 3, 0xe9b5dba5); - RNDr(S, W, 4, 0x3956c25b); - RNDr(S, W, 5, 0x59f111f1); - RNDr(S, W, 6, 0x923f82a4); - RNDr(S, W, 7, 0xab1c5ed5); - RNDr(S, W, 8, 0xd807aa98); - RNDr(S, W, 9, 0x12835b01); - RNDr(S, W, 10, 0x243185be); - RNDr(S, W, 11, 0x550c7dc3); - RNDr(S, W, 12, 0x72be5d74); - RNDr(S, W, 13, 0x80deb1fe); - RNDr(S, W, 14, 0x9bdc06a7); - RNDr(S, W, 15, 0xc19bf174); - RNDr(S, W, 16, 0xe49b69c1); - RNDr(S, W, 17, 0xefbe4786); - RNDr(S, W, 18, 0x0fc19dc6); - RNDr(S, W, 19, 0x240ca1cc); - RNDr(S, W, 20, 0x2de92c6f); - RNDr(S, W, 21, 0x4a7484aa); - RNDr(S, W, 22, 0x5cb0a9dc); - RNDr(S, W, 23, 0x76f988da); - RNDr(S, W, 24, 0x983e5152); - RNDr(S, W, 25, 0xa831c66d); - RNDr(S, W, 26, 0xb00327c8); - RNDr(S, W, 27, 0xbf597fc7); - RNDr(S, W, 28, 0xc6e00bf3); - RNDr(S, W, 29, 0xd5a79147); - RNDr(S, W, 30, 0x06ca6351); - RNDr(S, W, 31, 0x14292967); - RNDr(S, W, 32, 0x27b70a85); - RNDr(S, W, 33, 0x2e1b2138); - RNDr(S, W, 34, 0x4d2c6dfc); - RNDr(S, W, 35, 0x53380d13); - RNDr(S, W, 36, 0x650a7354); - RNDr(S, W, 37, 0x766a0abb); - RNDr(S, W, 38, 0x81c2c92e); - RNDr(S, W, 39, 0x92722c85); - RNDr(S, W, 40, 0xa2bfe8a1); - RNDr(S, W, 41, 0xa81a664b); - RNDr(S, W, 42, 0xc24b8b70); - RNDr(S, W, 43, 0xc76c51a3); - RNDr(S, W, 44, 0xd192e819); - RNDr(S, W, 45, 0xd6990624); - RNDr(S, W, 46, 0xf40e3585); - RNDr(S, W, 47, 0x106aa070); - RNDr(S, W, 48, 0x19a4c116); - RNDr(S, W, 49, 0x1e376c08); - RNDr(S, W, 50, 0x2748774c); - RNDr(S, W, 51, 0x34b0bcb5); - RNDr(S, W, 52, 0x391c0cb3); - RNDr(S, W, 53, 0x4ed8aa4a); - RNDr(S, W, 54, 0x5b9cca4f); - RNDr(S, W, 55, 0x682e6ff3); - RNDr(S, W, 56, 0x748f82ee); - RNDr(S, W, 57, 0x78a5636f); - RNDr(S, W, 58, 0x84c87814); - RNDr(S, W, 59, 0x8cc70208); - RNDr(S, W, 60, 0x90befffa); - RNDr(S, W, 61, 0xa4506ceb); - RNDr(S, W, 62, 0xbef9a3f7); - RNDr(S, W, 63, 0xc67178f2); + for (i = 0; i < 64; i += 16) { + RNDr(S, W, 0, i); + RNDr(S, W, 1, i); + RNDr(S, W, 2, i); + RNDr(S, W, 3, i); + RNDr(S, W, 4, i); + RNDr(S, W, 5, i); + RNDr(S, W, 6, i); + RNDr(S, W, 7, i); + RNDr(S, W, 8, i); + RNDr(S, W, 9, i); + RNDr(S, W, 10, i); + RNDr(S, W, 11, i); + RNDr(S, W, 12, i); + RNDr(S, W, 13, i); + RNDr(S, W, 14, i); + RNDr(S, W, 15, i); + + if (i == 48) + break; + MSCH(W, 0, i); + MSCH(W, 1, i); + MSCH(W, 2, i); + MSCH(W, 3, i); + MSCH(W, 4, i); + MSCH(W, 5, i); + MSCH(W, 6, i); + MSCH(W, 7, i); + MSCH(W, 8, i); + MSCH(W, 9, i); + MSCH(W, 10, i); + MSCH(W, 11, i); + MSCH(W, 12, i); + MSCH(W, 13, i); + MSCH(W, 14, i); + MSCH(W, 15, i); + } /* 4. Mix local working variables into global state */ for (i = 0; i < 8; i++) @@ -205,22 +198,29 @@ static unsigned char PAD[64] = { static void SHA256_Pad(SHA256_CTX * ctx) { - unsigned char len[8]; - uint32_t r, plen; - - /* - * Convert length to a vector of bytes -- we do this now rather - * than later because the length will change after we pad. - */ - be64enc(len, ctx->count); + size_t r; - /* Add 1--64 bytes so that the resulting length is 56 mod 64 */ + /* Figure out how many bytes we have buffered. */ r = (ctx->count >> 3) & 0x3f; - plen = (r < 56) ? (56 - r) : (120 - r); - SHA256_Update(ctx, PAD, (size_t)plen); - /* Add the terminating bit-count */ - SHA256_Update(ctx, len, 8); + /* Pad to 56 mod 64, transforming if we finish a block en route. */ + if (r < 56) { + /* Pad to 56 mod 64. */ + memcpy(&ctx->buf[r], PAD, 56 - r); + } else { + /* Finish the current block and mix. */ + memcpy(&ctx->buf[r], PAD, 64 - r); + SHA256_Transform(ctx->state, ctx->buf); + + /* The start of the final block is all zeroes. */ + memset(&ctx->buf[0], 0, 56); + } + + /* Add the terminating bit-count. */ + be64enc(&ctx->buf[56], ctx->count); + + /* Mix in the final block. */ + SHA256_Transform(ctx->state, ctx->buf); } /* SHA-256 initialization. Begins a SHA-256 operation. */ Modified: stable/10/sys/crypto/sha2/sha512c.c ============================================================================== --- stable/10/sys/crypto/sha2/sha512c.c Mon Feb 27 11:27:46 2017 (r314334) +++ stable/10/sys/crypto/sha2/sha512c.c Mon Feb 27 13:05:17 2017 (r314335) @@ -81,6 +81,50 @@ be64dec_vect(uint64_t *dst, const unsign #endif /* BYTE_ORDER != BIG_ENDIAN */ +/* SHA512 round constants. */ +static const uint64_t K[80] = { + 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, + 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, + 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, + 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, + 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, + 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, + 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, + 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, + 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, + 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, + 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, + 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, + 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, + 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, + 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, + 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, + 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, + 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, + 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, + 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, + 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, + 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, + 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, + 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, + 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, + 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, + 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, + 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, + 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, + 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, + 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, + 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, + 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, + 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, + 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, + 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, + 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, + 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, + 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, + 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL +}; + /* Elementary functions used by SHA512 */ #define Ch(x, y, z) ((x & (y ^ z)) ^ z) #define Maj(x, y, z) ((x & (y | z)) | (y & z)) @@ -93,18 +137,21 @@ be64dec_vect(uint64_t *dst, const unsign /* SHA512 round function */ #define RND(a, b, c, d, e, f, g, h, k) \ - t0 = h + S1(e) + Ch(e, f, g) + k; \ - t1 = S0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; + h += S1(e) + Ch(e, f, g) + k; \ + d += h; \ + h += S0(a) + Maj(a, b, c); /* Adjusted round function for rotating state */ -#define RNDr(S, W, i, k) \ +#define RNDr(S, W, i, ii) \ RND(S[(80 - i) % 8], S[(81 - i) % 8], \ S[(82 - i) % 8], S[(83 - i) % 8], \ S[(84 - i) % 8], S[(85 - i) % 8], \ S[(86 - i) % 8], S[(87 - i) % 8], \ - W[i] + k) + W[i + ii] + K[i + ii]) + +/* Message schedule computation */ +#define MSCH(W, ii, i) \ + W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii] /* * SHA512 block compression function. The 512-bit state is transformed via @@ -115,98 +162,52 @@ SHA512_Transform(uint64_t * state, const { uint64_t W[80]; uint64_t S[8]; - uint64_t t0, t1; int i; - /* 1. Prepare message schedule W. */ + /* 1. Prepare the first part of the message schedule W. */ be64dec_vect(W, block, SHA512_BLOCK_LENGTH); - for (i = 16; i < 80; i++) - W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; /* 2. Initialize working variables. */ memcpy(S, state, SHA512_DIGEST_LENGTH); /* 3. Mix. */ - RNDr(S, W, 0, 0x428a2f98d728ae22ULL); - RNDr(S, W, 1, 0x7137449123ef65cdULL); - RNDr(S, W, 2, 0xb5c0fbcfec4d3b2fULL); - RNDr(S, W, 3, 0xe9b5dba58189dbbcULL); - RNDr(S, W, 4, 0x3956c25bf348b538ULL); - RNDr(S, W, 5, 0x59f111f1b605d019ULL); - RNDr(S, W, 6, 0x923f82a4af194f9bULL); - RNDr(S, W, 7, 0xab1c5ed5da6d8118ULL); - RNDr(S, W, 8, 0xd807aa98a3030242ULL); - RNDr(S, W, 9, 0x12835b0145706fbeULL); - RNDr(S, W, 10, 0x243185be4ee4b28cULL); - RNDr(S, W, 11, 0x550c7dc3d5ffb4e2ULL); - RNDr(S, W, 12, 0x72be5d74f27b896fULL); - RNDr(S, W, 13, 0x80deb1fe3b1696b1ULL); - RNDr(S, W, 14, 0x9bdc06a725c71235ULL); - RNDr(S, W, 15, 0xc19bf174cf692694ULL); - RNDr(S, W, 16, 0xe49b69c19ef14ad2ULL); - RNDr(S, W, 17, 0xefbe4786384f25e3ULL); - RNDr(S, W, 18, 0x0fc19dc68b8cd5b5ULL); - RNDr(S, W, 19, 0x240ca1cc77ac9c65ULL); - RNDr(S, W, 20, 0x2de92c6f592b0275ULL); - RNDr(S, W, 21, 0x4a7484aa6ea6e483ULL); - RNDr(S, W, 22, 0x5cb0a9dcbd41fbd4ULL); - RNDr(S, W, 23, 0x76f988da831153b5ULL); - RNDr(S, W, 24, 0x983e5152ee66dfabULL); - RNDr(S, W, 25, 0xa831c66d2db43210ULL); - RNDr(S, W, 26, 0xb00327c898fb213fULL); - RNDr(S, W, 27, 0xbf597fc7beef0ee4ULL); - RNDr(S, W, 28, 0xc6e00bf33da88fc2ULL); - RNDr(S, W, 29, 0xd5a79147930aa725ULL); - RNDr(S, W, 30, 0x06ca6351e003826fULL); - RNDr(S, W, 31, 0x142929670a0e6e70ULL); - RNDr(S, W, 32, 0x27b70a8546d22ffcULL); - RNDr(S, W, 33, 0x2e1b21385c26c926ULL); - RNDr(S, W, 34, 0x4d2c6dfc5ac42aedULL); - RNDr(S, W, 35, 0x53380d139d95b3dfULL); - RNDr(S, W, 36, 0x650a73548baf63deULL); - RNDr(S, W, 37, 0x766a0abb3c77b2a8ULL); - RNDr(S, W, 38, 0x81c2c92e47edaee6ULL); - RNDr(S, W, 39, 0x92722c851482353bULL); - RNDr(S, W, 40, 0xa2bfe8a14cf10364ULL); - RNDr(S, W, 41, 0xa81a664bbc423001ULL); - RNDr(S, W, 42, 0xc24b8b70d0f89791ULL); - RNDr(S, W, 43, 0xc76c51a30654be30ULL); - RNDr(S, W, 44, 0xd192e819d6ef5218ULL); - RNDr(S, W, 45, 0xd69906245565a910ULL); - RNDr(S, W, 46, 0xf40e35855771202aULL); - RNDr(S, W, 47, 0x106aa07032bbd1b8ULL); - RNDr(S, W, 48, 0x19a4c116b8d2d0c8ULL); - RNDr(S, W, 49, 0x1e376c085141ab53ULL); - RNDr(S, W, 50, 0x2748774cdf8eeb99ULL); - RNDr(S, W, 51, 0x34b0bcb5e19b48a8ULL); - RNDr(S, W, 52, 0x391c0cb3c5c95a63ULL); - RNDr(S, W, 53, 0x4ed8aa4ae3418acbULL); - RNDr(S, W, 54, 0x5b9cca4f7763e373ULL); - RNDr(S, W, 55, 0x682e6ff3d6b2b8a3ULL); - RNDr(S, W, 56, 0x748f82ee5defb2fcULL); - RNDr(S, W, 57, 0x78a5636f43172f60ULL); - RNDr(S, W, 58, 0x84c87814a1f0ab72ULL); - RNDr(S, W, 59, 0x8cc702081a6439ecULL); - RNDr(S, W, 60, 0x90befffa23631e28ULL); - RNDr(S, W, 61, 0xa4506cebde82bde9ULL); - RNDr(S, W, 62, 0xbef9a3f7b2c67915ULL); - RNDr(S, W, 63, 0xc67178f2e372532bULL); - RNDr(S, W, 64, 0xca273eceea26619cULL); - RNDr(S, W, 65, 0xd186b8c721c0c207ULL); - RNDr(S, W, 66, 0xeada7dd6cde0eb1eULL); - RNDr(S, W, 67, 0xf57d4f7fee6ed178ULL); - RNDr(S, W, 68, 0x06f067aa72176fbaULL); - RNDr(S, W, 69, 0x0a637dc5a2c898a6ULL); - RNDr(S, W, 70, 0x113f9804bef90daeULL); - RNDr(S, W, 71, 0x1b710b35131c471bULL); - RNDr(S, W, 72, 0x28db77f523047d84ULL); - RNDr(S, W, 73, 0x32caab7b40c72493ULL); - RNDr(S, W, 74, 0x3c9ebe0a15c9bebcULL); - RNDr(S, W, 75, 0x431d67c49c100d4cULL); - RNDr(S, W, 76, 0x4cc5d4becb3e42b6ULL); - RNDr(S, W, 77, 0x597f299cfc657e2aULL); - RNDr(S, W, 78, 0x5fcb6fab3ad6faecULL); - RNDr(S, W, 79, 0x6c44198c4a475817ULL); + for (i = 0; i < 80; i += 16) { + RNDr(S, W, 0, i); + RNDr(S, W, 1, i); + RNDr(S, W, 2, i); + RNDr(S, W, 3, i); + RNDr(S, W, 4, i); + RNDr(S, W, 5, i); + RNDr(S, W, 6, i); + RNDr(S, W, 7, i); + RNDr(S, W, 8, i); + RNDr(S, W, 9, i); + RNDr(S, W, 10, i); + RNDr(S, W, 11, i); + RNDr(S, W, 12, i); + RNDr(S, W, 13, i); + RNDr(S, W, 14, i); + RNDr(S, W, 15, i); + + if (i == 64) + break; + MSCH(W, 0, i); + MSCH(W, 1, i); + MSCH(W, 2, i); + MSCH(W, 3, i); + MSCH(W, 4, i); + MSCH(W, 5, i); + MSCH(W, 6, i); + MSCH(W, 7, i); + MSCH(W, 8, i); + MSCH(W, 9, i); + MSCH(W, 10, i); + MSCH(W, 11, i); + MSCH(W, 12, i); + MSCH(W, 13, i); + MSCH(W, 14, i); + MSCH(W, 15, i); + } /* 4. Mix local working variables into global state */ for (i = 0; i < 8; i++) @@ -228,22 +229,29 @@ static unsigned char PAD[SHA512_BLOCK_LE static void SHA512_Pad(SHA512_CTX * ctx) { - unsigned char len[16]; - uint64_t r, plen; - - /* - * Convert length to a vector of bytes -- we do this now rather - * than later because the length will change after we pad. - */ - be64enc_vect(len, ctx->count, 16); + size_t r; - /* Add 1--128 bytes so that the resulting length is 112 mod 128 */ + /* Figure out how many bytes we have buffered. */ r = (ctx->count[1] >> 3) & 0x7f; - plen = (r < 112) ? (112 - r) : (240 - r); - SHA512_Update(ctx, PAD, (size_t)plen); - /* Add the terminating bit-count */ - SHA512_Update(ctx, len, 16); + /* Pad to 112 mod 128, transforming if we finish a block en route. */ + if (r < 112) { + /* Pad to 112 mod 128. */ + memcpy(&ctx->buf[r], PAD, 112 - r); + } else { + /* Finish the current block and mix. */ + memcpy(&ctx->buf[r], PAD, 128 - r); + SHA512_Transform(ctx->state, ctx->buf); + + /* The start of the final block is all zeroes. */ + memset(&ctx->buf[0], 0, 112); + } + + /* Add the terminating bit-count. */ + be64enc_vect(&ctx->buf[112], ctx->count, 16); + + /* Mix in the final block. */ + SHA512_Transform(ctx->state, ctx->buf); } /* SHA-512 initialization. Begins a SHA-512 operation. */ From owner-svn-src-stable-10@freebsd.org Mon Feb 27 14:02:13 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 482E5CEF82C for ; Mon, 27 Feb 2017 14:02:13 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x230.google.com (mail-yw0-x230.google.com [IPv6:2607:f8b0:4002:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10CBE80B for ; Mon, 27 Feb 2017 14:02:12 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x230.google.com with SMTP id p77so36601272ywg.1 for ; Mon, 27 Feb 2017 06:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fHqYQNBv5NxBvRsb+L+5F86AOB4sEIjeRmTQtO02egc=; b=LQyEQwXOLkVC6QAW9CssBW+jLj1YxY/JwNX3fCBRZ01C2yQXP0YOQ0QjpBglVPgMTh kkCAV993oEs1pnLdLQkLxshyewtyxWKPoRY/jPxL4r9IZiCyB+e11Rx4aPrP01lnSQrq DTueFRp11vzlYnOBamXF/RQwGqWvfY+5l7S8EGJJ2aEhUWGlbuP4vGZ4k9xa/8dN2V5E BqEj3vYpivqXEajEM+jk7BpWM5awv7FgXlz3SpkkRzg4/sR6TzSh82jLZEk2x5F6MOKl 5/GZXSPJydMSL/zEp6uc0qdaOxDQJmtD2q7hWvgFuItyCAWBH+9MPZbKeCM7e5yzQK9y fDKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fHqYQNBv5NxBvRsb+L+5F86AOB4sEIjeRmTQtO02egc=; b=M1xycmVDH1rDbjVmwNUk3J6L4FM36VwSKdlbs3WTd+x3Ehey9FeMmVqKEwoWFebIpK 3uP96lq8fbV2BpLCTaK5OTnLxDRQNl0jGWRh4sxRljPAbQFyvlgtOA1z8gGlxW/4xya1 g0rae02jUMKH7w4EOPfgX3FLvly++iZHggqJNPwDTXc1oZF0kUGg7WnZSv0NoHDnbxeZ Uz6n+IMGvsmntCiC5vYCqhBYTpC+xdlupw2+nAY4KZYJzDTBaELkdCWexA26V/FBlvEj Jo6g4SBNAAPBmcoymMGNVsfPe9reG66JTYPWWGtOTRqJCxiL3DRb5ztoQPkJ3QZtpIxq 67Og== X-Gm-Message-State: AMke39krHsb0taS4W5iY5XTT+xC0phh8ENlqgTxC4zmE/1DNQZyBpGEoH82wtOz30koR/7tnRp72zv62owfDPA== X-Received: by 10.13.220.65 with SMTP id f62mr12184736ywe.6.1488204131878; Mon, 27 Feb 2017 06:02:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.51.198 with HTTP; Mon, 27 Feb 2017 06:01:41 -0800 (PST) In-Reply-To: <201702271305.v1RD5HOi077424@repo.freebsd.org> References: <201702271305.v1RD5HOi077424@repo.freebsd.org> From: Ed Schouten Date: Mon, 27 Feb 2017 15:01:41 +0100 Message-ID: Subject: Re: svn commit: r314335 - stable/10/sys/crypto/sha2 To: Andriy Gapon Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 27 Feb 2017 14:02:13 -0000 Hi Andriy, 2017-02-27 14:05 GMT+01:00 Andriy Gapon : > +/* Message schedule computation */ > +#define MSCH(W, ii, i) \ > + W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii] [snip] > uint32_t W[64]; [snip] > + for (i = 0; i < 64; i += 16) { > + RNDr(S, W, 1, i); > + RNDr(S, W, 2, i); > + RNDr(S, W, 3, i); > + RNDr(S, W, 4, i); > + RNDr(S, W, 5, i); > + RNDr(S, W, 6, i); > + RNDr(S, W, 7, i); > + RNDr(S, W, 8, i); > + RNDr(S, W, 9, i); > + RNDr(S, W, 10, i); > + RNDr(S, W, 11, i); > + RNDr(S, W, 12, i); > + RNDr(S, W, 13, i); > + RNDr(S, W, 14, i); > + RNDr(S, W, 15, i); > + > + if (i == 48) > + break; > + MSCH(W, 0, i); > + MSCH(W, 1, i); > + MSCH(W, 2, i); > + MSCH(W, 3, i); > + MSCH(W, 4, i); > + MSCH(W, 5, i); > + MSCH(W, 6, i); > + MSCH(W, 7, i); > + MSCH(W, 8, i); > + MSCH(W, 9, i); > + MSCH(W, 10, i); > + MSCH(W, 11, i); > + MSCH(W, 12, i); > + MSCH(W, 13, i); > + MSCH(W, 14, i); > + MSCH(W, 15, i); > + } Something interesting that I noticed some time ago when comparing the various SHA-{256,512} implementations: there is no need to store the entire extended message in W. During every iteration of this loop, RNDr() and MSCH() never go more than 16 elements back. Say, if you were to modify MSCH() to something like this: > +#define MSCH(W, ii) \ > + W[ii] += s1(W[(ii + 14) % 16]) + W[(ii + 9) % 16] + s0(W[(ii + 1)) % 16]) Then it will compute the next chunk of the extended message in-place. RNDr() must then be adjusted to use W[i] instead of W[i + ii], of course. W then only needs to hold 16 elements instead of 64 or 80. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-stable-10@freebsd.org Mon Feb 27 15:15:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 282C5CF035D; Mon, 27 Feb 2017 15:15:17 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AD0794E; Mon, 27 Feb 2017 15:15:16 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from [10.145.2.129] (unknown [209.171.88.129]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 98CB613480; Mon, 27 Feb 2017 15:15:12 +0000 (UTC) Date: Mon, 27 Feb 2017 07:15:07 -0800 User-Agent: K-9 Mail for Android In-Reply-To: References: <201702271305.v1RD5HOi077424@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: svn commit: r314335 - stable/10/sys/crypto/sha2 To: Ed Schouten , Andriy Gapon , cperciva@freebsd.org CC: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Allan Jude Message-ID: X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 27 Feb 2017 15:15:17 -0000 On February 27, 2017 6:01:41 AM PST, Ed Schouten wrote: >Hi Andriy, > >2017-02-27 14:05 GMT+01:00 Andriy Gapon : >> +/* Message schedule computation */ >> +#define MSCH(W, ii, i) \ >> + W[i + ii + 16] =3D s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i >+ ii + 1]) + W[i + ii] > >[snip] > >> uint32_t W[64]; > >[snip] > >> + for (i =3D 0; i < 64; i +=3D 16) { >> + RNDr(S, W, 1, i); >> + RNDr(S, W, 2, i); >> + RNDr(S, W, 3, i); >> + RNDr(S, W, 4, i); >> + RNDr(S, W, 5, i); >> + RNDr(S, W, 6, i); >> + RNDr(S, W, 7, i); >> + RNDr(S, W, 8, i); >> + RNDr(S, W, 9, i); >> + RNDr(S, W, 10, i); >> + RNDr(S, W, 11, i); >> + RNDr(S, W, 12, i); >> + RNDr(S, W, 13, i); >> + RNDr(S, W, 14, i); >> + RNDr(S, W, 15, i); >> + >> + if (i =3D=3D 48) >> + break; >> + MSCH(W, 0, i); >> + MSCH(W, 1, i); >> + MSCH(W, 2, i); >> + MSCH(W, 3, i); >> + MSCH(W, 4, i); >> + MSCH(W, 5, i); >> + MSCH(W, 6, i); >> + MSCH(W, 7, i); >> + MSCH(W, 8, i); >> + MSCH(W, 9, i); >> + MSCH(W, 10, i); >> + MSCH(W, 11, i); >> + MSCH(W, 12, i); >> + MSCH(W, 13, i); >> + MSCH(W, 14, i); >> + MSCH(W, 15, i); >> + } > >Something interesting that I noticed some time ago when comparing the >various SHA-{256,512} implementations: there is no need to store the >entire extended message in W=2E During every iteration of this loop, >RNDr() and MSCH() never go more than 16 elements back=2E > >Say, if you were to modify MSCH() to something like this: > >> +#define MSCH(W, ii) \ >> + W[ii] +=3D s1(W[(ii + 14) % 16]) + W[(ii + 9) % 16] + s0(W[(ii >+ 1)) % 16]) > >Then it will compute the next chunk of the extended message in-place=2E >RNDr() must then be adjusted to use W[i] instead of W[i + ii], of >course=2E W then only needs to hold 16 elements instead of 64 or 80=2E Add Colin, author of the original code --=20 Allan Jude From owner-svn-src-stable-10@freebsd.org Mon Feb 27 17:18:09 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34852CF0930; Mon, 27 Feb 2017 17:18:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id D9D8A7A3; Mon, 27 Feb 2017 17:18:08 +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 v1RHI7hC079936; Mon, 27 Feb 2017 17:18:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RHI7Dx079934; Mon, 27 Feb 2017 17:18:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271718.v1RHI7Dx079934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 17:18:07 +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: r314348 - in stable/10/sys: kern vm X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 17:18:09 -0000 Author: avg Date: Mon Feb 27 17:18:07 2017 New Revision: 314348 URL: https://svnweb.freebsd.org/changeset/base/314348 Log: MFC r313730: try to fix RACCT_RSS accounting Modified: stable/10/sys/kern/kern_racct.c stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_racct.c ============================================================================== --- stable/10/sys/kern/kern_racct.c Mon Feb 27 17:18:05 2017 (r314347) +++ stable/10/sys/kern/kern_racct.c Mon Feb 27 17:18:07 2017 (r314348) @@ -1008,10 +1008,13 @@ racct_proc_exit(struct proc *p) racct_set_locked(p, RACCT_CPU, runtime); racct_add_cred_locked(p->p_ucred, RACCT_PCTCPU, pct); + KASSERT(p->p_racct->r_resources[RACCT_RSS] == 0, + ("process reaped with %ju allocated for RSS\n", + p->p_racct->r_resources[RACCT_RSS])); for (i = 0; i <= RACCT_MAX; i++) { if (p->p_racct->r_resources[i] == 0) continue; - if (!RACCT_IS_RECLAIMABLE(i)) + if (!RACCT_IS_RECLAIMABLE(i)) continue; racct_set_locked(p, i, 0); } Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Mon Feb 27 17:18:05 2017 (r314347) +++ stable/10/sys/vm/vm_pageout.c Mon Feb 27 17:18:07 2017 (r314348) @@ -1981,12 +1981,14 @@ again: if (size >= limit) { vm_pageout_map_deactivate_pages( &vm->vm_map, limit); + size = vmspace_resident_count(vm); } #ifdef RACCT if (racct_enable) { rsize = IDX_TO_OFF(size); PROC_LOCK(p); - racct_set(p, RACCT_RSS, rsize); + if (p->p_state == PRS_NORMAL) + racct_set(p, RACCT_RSS, rsize); ravailable = racct_get_available(p, RACCT_RSS); PROC_UNLOCK(p); if (rsize > ravailable) { @@ -2012,7 +2014,8 @@ again: size = vmspace_resident_count(vm); rsize = IDX_TO_OFF(size); PROC_LOCK(p); - racct_set(p, RACCT_RSS, rsize); + if (p->p_state == PRS_NORMAL) + racct_set(p, RACCT_RSS, rsize); PROC_UNLOCK(p); if (rsize > ravailable) tryagain = 1; From owner-svn-src-stable-10@freebsd.org Mon Feb 27 17:20:51 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BC61CF0A90; Mon, 27 Feb 2017 17:20:51 +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 mx1.freebsd.org (Postfix) with ESMTPS id EF72AB7C; Mon, 27 Feb 2017 17:20:50 +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 v1RHKojc080160; Mon, 27 Feb 2017 17:20:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RHKofs080159; Mon, 27 Feb 2017 17:20:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271720.v1RHKofs080159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 17:20:50 +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: r314350 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 17:20:51 -0000 Author: avg Date: Mon Feb 27 17:20:49 2017 New Revision: 314350 URL: https://svnweb.freebsd.org/changeset/base/314350 Log: MFC r313752,r314035: mca: use time_uptime instead of ticks for CMCI throttling Modified: stable/10/sys/x86/x86/mca.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/mca.c ============================================================================== --- stable/10/sys/x86/x86/mca.c Mon Feb 27 17:20:44 2017 (r314349) +++ stable/10/sys/x86/x86/mca.c Mon Feb 27 17:20:49 2017 (r314350) @@ -73,7 +73,7 @@ enum scan_mode { */ struct cmc_state { int max_threshold; - int last_intr; + time_t last_intr; }; #endif @@ -535,7 +535,7 @@ cmci_update(enum scan_mode mode, int ban cc = &cmc_state[PCPU_GET(cpuid)][bank]; ctl = rdmsr(MSR_MC_CTL2(bank)); count = (rec->mr_status & MC_STATUS_COR_COUNT) >> 38; - delta = (u_int)(ticks - cc->last_intr); + delta = (u_int)(time_uptime - cc->last_intr); /* * If an interrupt was received less than cmc_throttle seconds @@ -552,7 +552,7 @@ cmci_update(enum scan_mode mode, int ban ctl |= limit; wrmsr(MSR_MC_CTL2(bank), limit); } - cc->last_intr = ticks; + cc->last_intr = time_uptime; return; } @@ -852,7 +852,7 @@ cmci_resume(int i) return; cc = &cmc_state[PCPU_GET(cpuid)][i]; - cc->last_intr = -ticks; + cc->last_intr = 0; ctl = rdmsr(MSR_MC_CTL2(i)); ctl &= ~MC_CTL2_THRESHOLD; ctl |= MC_CTL2_CMCI_EN | 1; From owner-svn-src-stable-10@freebsd.org Mon Feb 27 17:23:43 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8877DCF0C4B; Mon, 27 Feb 2017 17:23:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4E2FDFFA; Mon, 27 Feb 2017 17:23:43 +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 v1RHNg7F083772; Mon, 27 Feb 2017 17:23:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RHNgba083771; Mon, 27 Feb 2017 17:23:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271723.v1RHNgba083771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 17:23:42 +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: r314351 - stable/10/sys/dev/jedec_ts X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 17:23:43 -0000 Author: avg Date: Mon Feb 27 17:23:42 2017 New Revision: 314351 URL: https://svnweb.freebsd.org/changeset/base/314351 Log: MFC r314037: jedec_ts: fix slave address check Modified: stable/10/sys/dev/jedec_ts/jedec_ts.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/jedec_ts/jedec_ts.c ============================================================================== --- stable/10/sys/dev/jedec_ts/jedec_ts.c Mon Feb 27 17:20:49 2017 (r314350) +++ stable/10/sys/dev/jedec_ts/jedec_ts.c Mon Feb 27 17:23:42 2017 (r314351) @@ -104,7 +104,7 @@ ts_attach(device_t dev) uint8_t addr; addr = smbus_get_addr(dev); - if ((addr & 0x30) != 0x30) { + if ((addr & 0xf0) != 0x30) { /* Up to 8 slave devices starting at 0x30. */ return (ENXIO); } From owner-svn-src-stable-10@freebsd.org Mon Feb 27 17:25:58 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 372BBCF0DBC; Mon, 27 Feb 2017 17:25:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0689C787; Mon, 27 Feb 2017 17:25:57 +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 v1RHPvWW084633; Mon, 27 Feb 2017 17:25:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RHPvc7084632; Mon, 27 Feb 2017 17:25:57 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271725.v1RHPvc7084632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 17:25: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: r314354 - stable/10/share/man/man4 X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 17:25:58 -0000 Author: avg Date: Mon Feb 27 17:25:56 2017 New Revision: 314354 URL: https://svnweb.freebsd.org/changeset/base/314354 Log: MFC r314183: add jedec_ts.4 to the list of manual pages Modified: stable/10/share/man/man4/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Mon Feb 27 17:25:52 2017 (r314353) +++ stable/10/share/man/man4/Makefile Mon Feb 27 17:25:56 2017 (r314354) @@ -222,6 +222,7 @@ MAN= aac.4 \ ixgbe.4 \ ixl.4 \ ixlv.4 \ + jedec_ts.4 \ jme.4 \ joy.4 \ kbdmux.4 \ From owner-svn-src-stable-10@freebsd.org Mon Feb 27 17:27:43 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78E42CF0EED; Mon, 27 Feb 2017 17:27:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4756AB76; Mon, 27 Feb 2017 17:27:43 +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 v1RHRgYA084843; Mon, 27 Feb 2017 17:27:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RHRg4Q084842; Mon, 27 Feb 2017 17:27:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702271727.v1RHRg4Q084842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 27 Feb 2017 17:27:42 +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: r314356 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 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.23 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, 27 Feb 2017 17:27:43 -0000 Author: avg Date: Mon Feb 27 17:27:42 2017 New Revision: 314356 URL: https://svnweb.freebsd.org/changeset/base/314356 Log: MFC r314059: zfs: move zio_taskq_basedc under SYSDC Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Feb 27 17:27:23 2017 (r314355) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Feb 27 17:27:42 2017 (r314356) @@ -168,8 +168,8 @@ id_t zio_taskq_psrset_bind = PS_NONE; #endif #ifdef SYSDC boolean_t zio_taskq_sysdc = B_TRUE; /* use SDC scheduling class */ -#endif uint_t zio_taskq_basedc = 80; /* base duty cycle */ +#endif boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */ extern int zfs_sync_pass_deferred_free; From owner-svn-src-stable-10@freebsd.org Mon Feb 27 21:07:45 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D751ACEE326 for ; Mon, 27 Feb 2017 21:07:45 +0000 (UTC) (envelope-from 0100015a81666bf4-789e4f43-cbef-44e4-8a05-2fda5817223d-000000@amazonses.com) Received: from a8-56.smtp-out.amazonses.com (a8-56.smtp-out.amazonses.com [54.240.8.56]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C767BC9 for ; Mon, 27 Feb 2017 21:07:45 +0000 (UTC) (envelope-from 0100015a81666bf4-789e4f43-cbef-44e4-8a05-2fda5817223d-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn; d=tarsnap.com; t=1488229657; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=ug+jEsYIPhvDxpcreueQRI3XLnOiMpxh6gd4lc+iB7w=; b=er5G2w/t+gLUWGQU5PGkc7F/LVj9rLvxliwQUrguOtdaIzOK/uhqdqc1KsAIeT5T H/SAv4N8HHTTEtvMdml6EDu7d0TTBCgPdMrSK/TjmYeuqfonngsD8BXbABrGklttL9P XwJHT8R17oFAKVbBBbZk6UVx+Ec2Ebuu4QjXoHVc= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1488229657; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=ug+jEsYIPhvDxpcreueQRI3XLnOiMpxh6gd4lc+iB7w=; b=gejwxLlCI+4BIU0wMfUDx5PIAsKasZQZ2novUer4CbkusgTn3/BOpWdGgdbIVwwH pe1g5kUuaUzgjwtjXbPsvmPol1f2N3DBVB6OnK3zMq0KyVVOI71mtK+/cwVFc8XmS0U LBl9ake43QfiRm6k9wKa6WUR/FFAVax9Z5huWslk= Subject: Re: svn commit: r314335 - stable/10/sys/crypto/sha2 To: Ed Schouten , Andriy Gapon References: <201702271305.v1RD5HOi077424@repo.freebsd.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Colin Percival Message-ID: <0100015a81666bf4-789e4f43-cbef-44e4-8a05-2fda5817223d-000000@email.amazonses.com> Date: Mon, 27 Feb 2017 21:07:37 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2017.02.27-54.240.8.56 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 27 Feb 2017 21:07:45 -0000 On 02/27/17 06:01, Ed Schouten wrote: > Something interesting that I noticed some time ago when comparing the > various SHA-{256,512} implementations: there is no need to store the > entire extended message in W. During every iteration of this loop, > RNDr() and MSCH() never go more than 16 elements back. > > Say, if you were to modify MSCH() to something like this: > >> +#define MSCH(W, ii) \ >> + W[ii] += s1(W[(ii + 14) % 16]) + W[(ii + 9) % 16] + s0(W[(ii + 1)) % 16]) > > Then it will compute the next chunk of the extended message in-place. > RNDr() must then be adjusted to use W[i] instead of W[i + ii], of > course. W then only needs to hold 16 elements instead of 64 or 80. I tried this, and it was slower. The larger array avoids write-after-read accesses and results in better code being emitted due to more flexible instruction scheduling. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-stable-10@freebsd.org Mon Feb 27 21:15:10 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7FD1CEE72E for ; Mon, 27 Feb 2017 21:15:10 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x235.google.com (mail-yw0-x235.google.com [IPv6:2607:f8b0:4002:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E86E213 for ; Mon, 27 Feb 2017 21:15:10 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x235.google.com with SMTP id p77so45788378ywg.1 for ; Mon, 27 Feb 2017 13:15:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UxA5OUe1MEE6lGaUZt5gLA4lUYkidGHazz68m0zWuq4=; b=YWUk5VkMvTTlk/izGK9u0ZxbVumgQgiEpdi6+sL1HmRzm+7jz3OXokbb0ixKLT3zpw /rK0R6M7iHiaqlgEUnjwLWQaxPRqDd+WNniBxEj1PmzKMc4qc8m4dZ0LKbVtNv+FubhN qsIJN0cu9AmubEnqv+Vz0fJyZcWuu2oJFxScm9kgJhFlxFDQjueUuB/duaM/DRAZzUfk 4bJXai2nMeMOLp+1dvnjIut/aRXJKHTmCESVC99Oldbjh87Is6JGz0bMXf//XSyrGReL wS8a2EASIZX4eexsbT8yPeyXP4Upw3qHL6pUYd2hSubKrLHQXwbdLJcravIWv2edgQZk 3Gbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UxA5OUe1MEE6lGaUZt5gLA4lUYkidGHazz68m0zWuq4=; b=aIBnFV4zzAvz/CTUu6A2X+kW+QPozQgsbpUOqqPvcjmxhF9mGCc7wSydVNvHYJcRj4 k6mglyj9nQuVXaGT8sYdcIE7akeo6LrjlR4+g01U0x0RBPYmyTq2w9bUmbnZMf4gJh2K rd6b89Jrk1erdybHLU+HLo70m5TzA4Z/XFw9b1ley/Cm0Koy80Z3i4iMlljQ2SdNLz4u MzHzVt6nKhlxH/A1q/RXRdTg9GAzTkd2djuiLKcHFFC0Ih0KzN7swpqwpmY6G+li2l2V MNefKKeqUYfDrDqqnOd6A3szJSt2kzVS4JJU1ZEJbBncijqzt5K0VAAsUeaHpxyKP6bB 2TQQ== X-Gm-Message-State: AMke39l9yMW7JITXHnkO3d3ZdeBJXET5TxR0HUD6FTAKSm5n8d399h8u/3aZuZByxKxXJ1eScciYo9FhMLhvCA== X-Received: by 10.13.225.142 with SMTP id k136mr12978092ywe.178.1488230109224; Mon, 27 Feb 2017 13:15:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.51.198 with HTTP; Mon, 27 Feb 2017 13:14:38 -0800 (PST) In-Reply-To: <0100015a8166843e-66ad72c4-7cc0-4fc5-95eb-47b5ea66b36f-000000@email.amazonses.com> References: <201702271305.v1RD5HOi077424@repo.freebsd.org> <0100015a8166843e-66ad72c4-7cc0-4fc5-95eb-47b5ea66b36f-000000@email.amazonses.com> From: Ed Schouten Date: Mon, 27 Feb 2017 22:14:38 +0100 Message-ID: Subject: Re: svn commit: r314335 - stable/10/sys/crypto/sha2 To: Colin Percival Cc: Andriy Gapon , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 27 Feb 2017 21:15:11 -0000 2017-02-27 22:07 GMT+01:00 Colin Percival : > I tried this, and it was slower. The larger array avoids write-after-read > accesses and results in better code being emitted due to more flexible > instruction scheduling. Ah, makes sense. Thanks for testing this regardless! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-stable-10@freebsd.org Tue Feb 28 00:56:35 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DE70CEFC1D; Tue, 28 Feb 2017 00:56:35 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id 296CE62A; Tue, 28 Feb 2017 00:56:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1S0uYck060287; Tue, 28 Feb 2017 00:56:34 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1S0uX8t060278; Tue, 28 Feb 2017 00:56:33 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702280056.v1S0uX8t060278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 28 Feb 2017 00:56: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: r314366 - in stable/10/lib/libnetbsd: . sys X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 00:56:35 -0000 Author: ngie Date: Tue Feb 28 00:56:33 2017 New Revision: 314366 URL: https://svnweb.freebsd.org/changeset/base/314366 Log: Note: this change reintroduces r314020 after r314327, r314330, and r314332 MFC r313404: Improve libnetbsd compatibility with NetBSD This change is being made to diff reduce/reduce duplication in contrib/netbsd-tests and to facilitate further porting of software from NetBSD Add the following headers: - sys/event.h: -- sys/types.h is required for kqueue on FreeBSD, but not NetBSD. - sys/types.h: -- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD. Pull in sys/param.h to have parity with NetBSD. - sys/wait.h: -- Define wrusage as __wrusage for parity with NetBSD typedef. - glob.h -- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef. - pthread.h: -- Pull in pthread_np.h for _np functions defined separately on FreeBSD. Improve compatibility with NetBSD in the following headers: - sha1.h: -- define SHA1_CTX as SHA_CTX -- define SHA1Final as SHA1_Final - sha2.h: -- #include sha384 to pick up all of the SHA 384 bit macros and definitions. - util.h: -- Add sys/types.h to util.h to pollute the header for types used in flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them for the functions. Added: stable/10/lib/libnetbsd/glob.h - copied unchanged from r313404, head/lib/libnetbsd/glob.h stable/10/lib/libnetbsd/pthread.h - copied unchanged from r313404, head/lib/libnetbsd/pthread.h stable/10/lib/libnetbsd/sys/event.h - copied unchanged from r313404, head/lib/libnetbsd/sys/event.h stable/10/lib/libnetbsd/sys/types.h - copied unchanged from r313404, head/lib/libnetbsd/sys/types.h stable/10/lib/libnetbsd/sys/wait.h - copied unchanged from r313404, head/lib/libnetbsd/sys/wait.h Modified: stable/10/lib/libnetbsd/sha1.h stable/10/lib/libnetbsd/sha2.h stable/10/lib/libnetbsd/util.h Directory Properties: stable/10/ (props changed) Copied: stable/10/lib/libnetbsd/glob.h (from r313404, head/lib/libnetbsd/glob.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libnetbsd/glob.h Tue Feb 28 00:56:33 2017 (r314366, copy of r313404, head/lib/libnetbsd/glob.h) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2017 Dell, Inc. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LIBNETBSD_GLOB_H_ +#define _LIBNETBSD_GLOB_H_ + +#include_next + +#ifndef __gl_stat_t +#define __gl_stat_t struct stat +#endif + +#endif Copied: stable/10/lib/libnetbsd/pthread.h (from r313404, head/lib/libnetbsd/pthread.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libnetbsd/pthread.h Tue Feb 28 00:56:33 2017 (r314366, copy of r313404, head/lib/libnetbsd/pthread.h) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2017 Dell, Inc. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LIBNETBSD_PTHREAD_H_ +#define _LIBNETBSD_PTHREAD_H_ + +#include_next +#include + +#endif Modified: stable/10/lib/libnetbsd/sha1.h ============================================================================== --- stable/10/lib/libnetbsd/sha1.h Mon Feb 27 23:38:51 2017 (r314365) +++ stable/10/lib/libnetbsd/sha1.h Tue Feb 28 00:56:33 2017 (r314366) @@ -35,8 +35,11 @@ #include +#define SHA1_CTX SHA_CTX + #define SHA1End SHA1_End #define SHA1File SHA1_File +#define SHA1Final SHA1_Final #define SHA1Init SHA1_Init #define SHA1Update SHA1_Update Modified: stable/10/lib/libnetbsd/sha2.h ============================================================================== --- stable/10/lib/libnetbsd/sha2.h Mon Feb 27 23:38:51 2017 (r314365) +++ stable/10/lib/libnetbsd/sha2.h Tue Feb 28 00:56:33 2017 (r314366) @@ -34,6 +34,7 @@ #define _SHA2_H_ #include +#include #include #endif /* _SHA2_H_ */ Copied: stable/10/lib/libnetbsd/sys/event.h (from r313404, head/lib/libnetbsd/sys/event.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libnetbsd/sys/event.h Tue Feb 28 00:56:33 2017 (r314366, copy of r313404, head/lib/libnetbsd/sys/event.h) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Dell, Inc. + * 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ * + */ + +#ifndef _LIBNETBSD_SYS_EVENT_H_ +#define _LIBNETBSD_SYS_EVENT_H_ + +/* + * kqueue on FreeBSD requires sys/event.h, which in turn uses uintptr_t + * (defined in sys/types.h), so in order to accomodate their requirements, + * pull in sys/types.h as part of event.h. + */ +#include + +#include_next + +#endif Copied: stable/10/lib/libnetbsd/sys/types.h (from r313404, head/lib/libnetbsd/sys/types.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libnetbsd/sys/types.h Tue Feb 28 00:56:33 2017 (r314366, copy of r313404, head/lib/libnetbsd/sys/types.h) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2017 Dell, Inc. + * 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ * + */ + +#ifndef _LIBNETBSD_SYS_TYPES_H_ +#define _LIBNETBSD_SYS_TYPES_H_ + +#include_next + +#include /* For NBBY */ + +#endif Copied: stable/10/lib/libnetbsd/sys/wait.h (from r313404, head/lib/libnetbsd/sys/wait.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libnetbsd/sys/wait.h Tue Feb 28 00:56:33 2017 (r314366, copy of r313404, head/lib/libnetbsd/sys/wait.h) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2017 Dell, Inc. + * 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ * + */ + +#ifndef _LIBNETBSD_SYS_WAIT_H_ +#define _LIBNETBSD_SYS_WAIT_H_ + +#include_next + +#define wrusage __wrusage + +#endif Modified: stable/10/lib/libnetbsd/util.h ============================================================================== --- stable/10/lib/libnetbsd/util.h Mon Feb 27 23:38:51 2017 (r314365) +++ stable/10/lib/libnetbsd/util.h Tue Feb 28 00:56:33 2017 (r314366) @@ -30,12 +30,13 @@ * SUCH DAMAGE. */ -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef _LIBNETBSD_UTIL_H_ +#define _LIBNETBSD_UTIL_H_ +#include #include char *flags_to_string(u_long flags, const char *def); int string_to_flags(char **stringp, u_long *setp, u_long *clrp); -#endif /* _UTIL_H_ */ +#endif From owner-svn-src-stable-10@freebsd.org Tue Feb 28 00:58:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCC22CEFD56; Tue, 28 Feb 2017 00:58:17 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id 85D9D948; Tue, 28 Feb 2017 00:58:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1S0wGEq060454; Tue, 28 Feb 2017 00:58:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1S0wGQN060453; Tue, 28 Feb 2017 00:58:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702280058.v1S0wGQN060453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 28 Feb 2017 00:58: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: r314368 - stable/10/tools/build/mk X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 00:58:17 -0000 Author: ngie Date: Tue Feb 28 00:58:16 2017 New Revision: 314368 URL: https://svnweb.freebsd.org/changeset/base/314368 Log: MFC r314244: Remove MK_OBJC block It is no longer represented via src.conf(5) Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/10/tools/build/mk/OptionalObsoleteFiles.inc Tue Feb 28 00:57:45 2017 (r314367) +++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc Tue Feb 28 00:58:16 2017 (r314368) @@ -4043,10 +4043,6 @@ OLD_FILES+=usr/share/man/man8/ntpq.8.gz OLD_FILES+=usr/share/man/man8/ntptime.8.gz .endif -#.if ${MK_OBJC} == no -# to be filled in -#.endif - .if ${MK_OPENSSH} == no OLD_FILES+=usr/bin/sftp OLD_FILES+=usr/bin/ssh From owner-svn-src-stable-10@freebsd.org Tue Feb 28 06:32:02 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF064CF1400; Tue, 28 Feb 2017 06:32:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86DD4C0D; Tue, 28 Feb 2017 06:32:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1S6W1UQ092390; Tue, 28 Feb 2017 06:32:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1S6W1Oc092389; Tue, 28 Feb 2017 06:32:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702280632.v1S6W1Oc092389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 28 Feb 2017 06:32: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: r314380 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 06:32:03 -0000 Author: mav Date: Tue Feb 28 06:32:01 2017 New Revision: 314380 URL: https://svnweb.freebsd.org/changeset/base/314380 Log: MFC r313744: No need to erase sense_data when sense_len is set to zero. Modified: stable/10/sys/cam/ctl/ctl_error.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_error.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_error.c Tue Feb 28 06:31:34 2017 (r314379) +++ stable/10/sys/cam/ctl/ctl_error.c Tue Feb 28 06:32:01 2017 (r314380) @@ -920,10 +920,7 @@ ctl_set_data_phase_error(struct ctl_scsi void ctl_set_reservation_conflict(struct ctl_scsiio *ctsio) { - struct scsi_sense_data *sense; - sense = &ctsio->sense_data; - memset(sense, 0, sizeof(*sense)); ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; ctsio->sense_len = 0; ctsio->io_hdr.status = CTL_SCSI_ERROR; @@ -932,10 +929,7 @@ ctl_set_reservation_conflict(struct ctl_ void ctl_set_queue_full(struct ctl_scsiio *ctsio) { - struct scsi_sense_data *sense; - sense = &ctsio->sense_data; - memset(sense, 0, sizeof(*sense)); ctsio->scsi_status = SCSI_STATUS_QUEUE_FULL; ctsio->sense_len = 0; ctsio->io_hdr.status = CTL_SCSI_ERROR; @@ -944,10 +938,7 @@ ctl_set_queue_full(struct ctl_scsiio *ct void ctl_set_busy(struct ctl_scsiio *ctsio) { - struct scsi_sense_data *sense; - sense = &ctsio->sense_data; - memset(sense, 0, sizeof(*sense)); ctsio->scsi_status = SCSI_STATUS_BUSY; ctsio->sense_len = 0; ctsio->io_hdr.status = CTL_SCSI_ERROR; @@ -956,10 +947,7 @@ ctl_set_busy(struct ctl_scsiio *ctsio) void ctl_set_task_aborted(struct ctl_scsiio *ctsio) { - struct scsi_sense_data *sense; - sense = &ctsio->sense_data; - memset(sense, 0, sizeof(*sense)); ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED; ctsio->sense_len = 0; ctsio->io_hdr.status = CTL_CMD_ABORTED; @@ -992,10 +980,7 @@ ctl_set_space_alloc_fail(struct ctl_scsi void ctl_set_success(struct ctl_scsiio *ctsio) { - struct scsi_sense_data *sense; - sense = &ctsio->sense_data; - memset(sense, 0, sizeof(*sense)); ctsio->scsi_status = SCSI_STATUS_OK; ctsio->sense_len = 0; ctsio->io_hdr.status = CTL_SUCCESS; From owner-svn-src-stable-10@freebsd.org Tue Feb 28 11:42:06 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2154FCF1C8C; Tue, 28 Feb 2017 11:42:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id E4F98E08; Tue, 28 Feb 2017 11:42:05 +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 v1SBg5Po016685; Tue, 28 Feb 2017 11:42:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1SBg5BZ016684; Tue, 28 Feb 2017 11:42:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702281142.v1SBg5BZ016684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 28 Feb 2017 11:42: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: r314386 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 11:42:06 -0000 Author: avg Date: Tue Feb 28 11:42:04 2017 New Revision: 314386 URL: https://svnweb.freebsd.org/changeset/base/314386 Log: MFC r313751: mca: fix writes to MSR_MC_CTL2 in cmci_update Modified: stable/10/sys/x86/x86/mca.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/mca.c ============================================================================== --- stable/10/sys/x86/x86/mca.c Tue Feb 28 11:41:57 2017 (r314385) +++ stable/10/sys/x86/x86/mca.c Tue Feb 28 11:42:04 2017 (r314386) @@ -550,7 +550,7 @@ cmci_update(enum scan_mode mode, int ban limit = min(limit << 1, cc->max_threshold); ctl &= ~MC_CTL2_THRESHOLD; ctl |= limit; - wrmsr(MSR_MC_CTL2(bank), limit); + wrmsr(MSR_MC_CTL2(bank), ctl); } cc->last_intr = time_uptime; return; @@ -583,7 +583,7 @@ cmci_update(enum scan_mode mode, int ban if ((ctl & MC_CTL2_THRESHOLD) != limit) { ctl &= ~MC_CTL2_THRESHOLD; ctl |= limit; - wrmsr(MSR_MC_CTL2(bank), limit); + wrmsr(MSR_MC_CTL2(bank), ctl); } } #endif From owner-svn-src-stable-10@freebsd.org Tue Feb 28 15:03:35 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CB6BCF04CA; Tue, 28 Feb 2017 15:03:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B93EE82; Tue, 28 Feb 2017 15:03:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1SF3Y27097546; Tue, 28 Feb 2017 15:03:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1SF3YX4097545; Tue, 28 Feb 2017 15:03:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702281503.v1SF3YX4097545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Feb 2017 15:03:34 +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: r314392 - stable/10/sys/sys X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 15:03:35 -0000 Author: kib Date: Tue Feb 28 15:03:34 2017 New Revision: 314392 URL: https://svnweb.freebsd.org/changeset/base/314392 Log: MFC r313734: Add RLIM_SAVED_MAX and RLIM_SAVED_CUR symbols. Modified: stable/10/sys/sys/resource.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/resource.h ============================================================================== --- stable/10/sys/sys/resource.h Tue Feb 28 14:48:52 2017 (r314391) +++ stable/10/sys/sys/resource.h Tue Feb 28 15:03:34 2017 (r314392) @@ -107,8 +107,8 @@ struct __wrusage { #define RLIM_NLIMITS 13 /* number of resource limits */ #define RLIM_INFINITY ((rlim_t)(((uint64_t)1 << 63) - 1)) -/* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */ - +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY /* * Resource limit string identifiers From owner-svn-src-stable-10@freebsd.org Tue Feb 28 22:18:07 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2387CCF16E6; Tue, 28 Feb 2017 22:18:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id E2B2CC94; Tue, 28 Feb 2017 22:18:06 +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 v1SMI5Vl068130; Tue, 28 Feb 2017 22:18:05 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1SMI5Is068122; Tue, 28 Feb 2017 22:18:05 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201702282218.v1SMI5Is068122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Feb 2017 22:18: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: r314425 - in stable/10: etc/mtree sbin/devd usr.bin/cmp usr.bin/cmp/tests usr.bin/tail usr.bin/tail/tests usr.sbin/route6d X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 22:18:07 -0000 Author: asomers Date: Tue Feb 28 22:18:05 2017 New Revision: 314425 URL: https://svnweb.freebsd.org/changeset/base/314425 Log: MFC r311572, r311895, r311928, r311985, r312395, r312417 r311572: Fix file descriptor leaks in cmp(1) Also, add a few test cases Reported by: Coverity CID: 271624 275338 Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9074 r311895: Fix memory leaks during "tail -r" of an irregular file * Rewrite r_buf to use standard tail queues instead of a hand-rolled circular linked list. Free dynamic allocations when done. * Remove an optimization for the case where the file is a multiple of 128KB in size and there is a scarcity of memory. * Add ATF tests for "tail -r" and its variants. Reported by: Valgrind Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9067 r311928: Fix build of usr.bin/tail with GCC Submitted by: pluknet Reported by: pluknet MFC after: 27 days X-MFC-with: 311895 Sponsored by: Spectra Logic Corp r311985: Fix uninitialized variable CIDs in route6d The variables in question are actually return arguments, but it's still good form to initialize them. Reported by: Coverity CID: 979679 979680 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r312395: Fix several Coverity CIDs in devd CID 1362055, 1362054: File descriptor leaks during shutdown CID 1362013: Potential null-termination fail with long network device names CID 1362097: Uncaught exception during memory pressure CID 1362017, 1362016: Unchecked errors, possibly resulting in weird behavior if two devd instances start at the same time. CID 1362015: Unchecked error that will probably never fail Reported by: Coverity CID: 1362055 1362054 1362013 1362097 1362017 1362016 1362015 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r312417: Fix build of devd with GCC 4.2 Reported by: olivier Pointy-hat-to: asomers MFC after: 27 days X-MFC-with: 312395 Sponsored by: Spectra Logic Corp Added: stable/10/usr.bin/cmp/tests/cmp_test2.sh - copied unchanged from r311572, head/usr.bin/cmp/tests/cmp_test2.sh stable/10/usr.bin/tail/tests/ - copied from r311895, head/usr.bin/tail/tests/ Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/sbin/devd/devd.cc stable/10/usr.bin/cmp/special.c stable/10/usr.bin/cmp/tests/Makefile stable/10/usr.bin/tail/Makefile stable/10/usr.bin/tail/reverse.c stable/10/usr.sbin/route6d/route6d.c Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/etc/mtree/BSD.tests.dist Tue Feb 28 22:18:05 2017 (r314425) @@ -608,6 +608,8 @@ regress.multitest.out .. .. + tail + .. tar .. timeout Modified: stable/10/sbin/devd/devd.cc ============================================================================== --- stable/10/sbin/devd/devd.cc Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/sbin/devd/devd.cc Tue Feb 28 22:18:05 2017 (r314425) @@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "devd.h" /* C compatible definitions */ @@ -372,7 +373,7 @@ media::do_match(config &c) s = socket(PF_INET, SOCK_DGRAM, 0); if (s >= 0) { memset(&ifmr, 0, sizeof(ifmr)); - strncpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name)); + strlcpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name)); if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0 && ifmr.ifm_status & IFM_AVALID) { @@ -856,8 +857,10 @@ create_socket(const char *name, int sock if (::bind(fd, (struct sockaddr *) & sun, slen) < 0) err(1, "bind"); listen(fd, 4); - chown(name, 0, 0); /* XXX - root.wheel */ - chmod(name, 0666); + if (chown(name, 0, 0)) /* XXX - root.wheel */ + err(1, "chown"); + if (chmod(name, 0666)) + err(1, "chmod"); return (fd); } @@ -1043,7 +1046,13 @@ event_loop(void) buffer[rv] = '\0'; while (buffer[--rv] == '\n') buffer[rv] = '\0'; - process_event(buffer); + try { + process_event(buffer); + } + catch (std::length_error e) { + devdlog(LOG_ERR, "Dropping event %s " + "due to low memory", buffer); + } } else if (rv < 0) { if (errno != EINTR) break; @@ -1061,6 +1070,8 @@ event_loop(void) if (FD_ISSET(seqpacket_fd, &fds)) new_client(seqpacket_fd, SOCK_SEQPACKET); } + close(seqpacket_fd); + close(stream_fd); close(fd); } @@ -1203,7 +1214,8 @@ check_devd_enabled() if (val == 0) { warnx("Setting " SYSCTL " to 1000"); val = 1000; - sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val)); + if (sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val))) + err(1, "sysctlbyname"); } } Modified: stable/10/usr.bin/cmp/special.c ============================================================================== --- stable/10/usr.bin/cmp/special.c Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/usr.bin/cmp/special.c Tue Feb 28 22:18:05 2017 (r314425) @@ -99,6 +99,8 @@ eof: if (ferror(fp1)) } else if (feof(fp2)) eofmsg(file2); + fclose(fp2); + fclose(fp1); if (dfound) exit(DIFF_EXIT); } Modified: stable/10/usr.bin/cmp/tests/Makefile ============================================================================== --- stable/10/usr.bin/cmp/tests/Makefile Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/usr.bin/cmp/tests/Makefile Tue Feb 28 22:18:05 2017 (r314425) @@ -2,6 +2,7 @@ .include +ATF_TESTS_SH+= cmp_test2 NETBSD_ATF_TESTS_SH= cmp_test .include Copied: stable/10/usr.bin/cmp/tests/cmp_test2.sh (from r311572, head/usr.bin/cmp/tests/cmp_test2.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.bin/cmp/tests/cmp_test2.sh Tue Feb 28 22:18:05 2017 (r314425, copy of r311572, head/usr.bin/cmp/tests/cmp_test2.sh) @@ -0,0 +1,67 @@ +# Copyright (c) 2017 Alan Somers +# 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +atf_test_case special +special_head() { + atf_set "descr" "Test cmp(1)'s handling of non-regular files" +} +special_body() { + echo 0123456789abcdef > a + echo 0123456789abcdeg > b + cat a | atf_check -s exit:0 cmp a - + cat a | atf_check -s exit:0 cmp - a + cat b | atf_check -s not-exit:0 cmp a - + cat b | atf_check -s not-exit:0 cmp - a + true +} + +atf_test_case symlink +symlink_head() { + atf_set "descr" "Test cmp(1)'s handling of symlinks" +} +symlink_body() { + echo 0123456789abcdef > a + echo 0123456789abcdeg > b + ln -s a a.lnk + ln -s b b.lnk + ln -s a a2.lnk + cp a adup + ln -s adup adup.lnk + atf_check -s exit:0 cmp a a.lnk + atf_check -s exit:0 cmp a.lnk a + atf_check -s not-exit:0 -o ignore cmp a b.lnk + atf_check -s not-exit:0 -o ignore cmp b.lnk a + atf_check -s not-exit:0 -o ignore -e ignore cmp -h a a.lnk + atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk a + atf_check -s exit:0 cmp -h a.lnk a2.lnk + atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk adup.lnk +} + +atf_init_test_cases() +{ + atf_add_test_case special + atf_add_test_case symlink +} Modified: stable/10/usr.bin/tail/Makefile ============================================================================== --- stable/10/usr.bin/tail/Makefile Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/usr.bin/tail/Makefile Tue Feb 28 22:18:05 2017 (r314425) @@ -1,7 +1,13 @@ # $FreeBSD$ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +.include + PROG= tail SRCS= forward.c misc.c read.c reverse.c tail.c +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Modified: stable/10/usr.bin/tail/reverse.c ============================================================================== --- stable/10/usr.bin/tail/reverse.c Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/usr.bin/tail/reverse.c Tue Feb 28 22:18:05 2017 (r314425) @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)reverse.c 8. __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -169,12 +170,12 @@ r_reg(FILE *fp, const char *fn, enum STY ierr(fn); } -typedef struct bf { - struct bf *next; - struct bf *prev; - int len; - char *l; -} BF; +#define BSZ (128 * 1024) +typedef struct bfelem { + TAILQ_ENTRY(bfelem) entries; + size_t len; + char l[BSZ]; +} bfelem_t; /* * r_buf -- display a non-regular file in reverse order by line. @@ -189,64 +190,44 @@ typedef struct bf { static void r_buf(FILE *fp, const char *fn) { - BF *mark, *tl, *tr; - int ch, len, llen; + struct bfelem *tl, *first = NULL; + size_t llen; char *p; - off_t enomem; + off_t enomem = 0; + TAILQ_HEAD(bfhead, bfelem) head; + + TAILQ_INIT(&head); + + while (!feof(fp)) { + size_t len; - tl = NULL; -#define BSZ (128 * 1024) - for (mark = NULL, enomem = 0;;) { /* * Allocate a new block and link it into place in a doubly * linked list. If out of memory, toss the LRU block and * keep going. */ - if (enomem || (tl = malloc(sizeof(BF))) == NULL || - (tl->l = malloc(BSZ)) == NULL) { - if (!mark) + while ((tl = malloc(sizeof(bfelem_t))) == NULL) { + first = TAILQ_FIRST(&head); + if (TAILQ_EMPTY(&head)) err(1, "malloc"); - if (enomem) - tl = tl->next; - else { - if (tl) - free(tl); - tl = mark; - } - enomem += tl->len; - } else if (mark) { - tl->next = mark; - tl->prev = mark->prev; - mark->prev->next = tl; - mark->prev = tl; - } else { - mark = tl; - mark->next = mark->prev = mark; + enomem += first->len; + TAILQ_REMOVE(&head, first, entries); + free(first); } + TAILQ_INSERT_TAIL(&head, tl, entries); /* Fill the block with input data. */ - for (p = tl->l, len = 0; - len < BSZ && (ch = getc(fp)) != EOF; ++len) - *p++ = ch; - - if (ferror(fp)) { - ierr(fn); - return; - } - - /* - * If no input data for this block and we tossed some data, - * recover it. - */ - if (!len && enomem) { - enomem -= tl->len; - tl = tl->prev; - break; + len = 0; + while ((!feof(fp)) && len < BSZ) { + p = tl->l + len; + len += fread(p, 1, BSZ - len, fp); + if (ferror(fp)) { + ierr(fn); + return; + } } tl->len = len; - if (ch == EOF) - break; } if (enomem) { @@ -255,37 +236,46 @@ r_buf(FILE *fp, const char *fn) } /* - * Step through the blocks in the reverse order read. The last char - * is special, ignore whether newline or not. + * Now print the lines in reverse order + * Outline: + * Scan backward for "\n", + * print forward to the end of the buffers + * free any buffers that start after the "\n" just found + * Loop */ - for (mark = tl;;) { - for (p = tl->l + (len = tl->len) - 1, llen = 0; len--; - --p, ++llen) - if (*p == '\n') { - if (llen) { + tl = TAILQ_LAST(&head, bfhead); + first = TAILQ_FIRST(&head); + while (tl != NULL) { + struct bfelem *temp; + + for (p = tl->l + tl->len - 1, llen = 0; p >= tl->l; + --p, ++llen) { + int start = (tl == first && p == tl->l); + + if ((*p == '\n') || start) { + struct bfelem *tr; + + if (start && llen) + WR(p, llen + 1); + else if (llen) WR(p + 1, llen); - llen = 0; - } - if (tl == mark) - continue; - for (tr = tl->next; tr->len; tr = tr->next) { - WR(tr->l, tr->len); - tr->len = 0; - if (tr == mark) - break; + tr = TAILQ_NEXT(tl, entries); + llen = 0; + if (tr != NULL) { + TAILQ_FOREACH_FROM_SAFE(tr, &head, + entries, temp) { + if (tr->len) + WR(&tr->l, tr->len); + TAILQ_REMOVE(&head, tr, + entries); + free(tr); + } } } + } tl->len = llen; - if ((tl = tl->prev) == mark) - break; - } - tl = tl->next; - if (tl->len) { - WR(tl->l, tl->len); - tl->len = 0; - } - while ((tl = tl->next)->len) { - WR(tl->l, tl->len); - tl->len = 0; + tl = TAILQ_PREV(tl, bfhead, entries); } + TAILQ_REMOVE(&head, first, entries); + free(first); } Modified: stable/10/usr.sbin/route6d/route6d.c ============================================================================== --- stable/10/usr.sbin/route6d/route6d.c Tue Feb 28 21:47:00 2017 (r314424) +++ stable/10/usr.sbin/route6d/route6d.c Tue Feb 28 22:18:05 2017 (r314425) @@ -1063,6 +1063,7 @@ sendpacket(struct sockaddr_in6 *sin6, in iov[0].iov_len = len; m.msg_iov = iov; m.msg_iovlen = 1; + m.msg_flags = 0; if (!idx) { m.msg_control = NULL; m.msg_controllen = 0; @@ -1127,6 +1128,7 @@ riprecv(void) cm = (struct cmsghdr *)cmsgbuf; m.msg_control = (caddr_t)cm; m.msg_controllen = sizeof(cmsgbuf); + m.msg_flags = 0; if ((len = recvmsg(ripsock, &m, 0)) < 0) { fatal("recvmsg"); /*NOTREACHED*/ From owner-svn-src-stable-10@freebsd.org Tue Feb 28 23:56:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC2F6CF2B90; Tue, 28 Feb 2017 23:56:15 +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 mx1.freebsd.org (Postfix) with ESMTPS id 89FF99B0; Tue, 28 Feb 2017 23:56:15 +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 v1SNuEpG011339; Tue, 28 Feb 2017 23:56:14 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1SNuEcC011338; Tue, 28 Feb 2017 23:56:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201702282356.v1SNuEcC011338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Feb 2017 23:56: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: r314438 - stable/10/usr.sbin/camdd X-SVN-Group: stable-10 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.23 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, 28 Feb 2017 23:56:15 -0000 Author: asomers Date: Tue Feb 28 23:56:14 2017 New Revision: 314438 URL: https://svnweb.freebsd.org/changeset/base/314438 Log: MFC r312559: Fix misc Coverity defects in camdd(8) CID 1341620 Fix a small memory leak CID 1341630 Though this is technically a false positive, rearrange the code for clarity. CID 1341635 Eliminate dead code CID 1368663 Fix a double mutex unlock in the error path Also: * Use sig_atomic_t for variables accessed from signal handlers * Don't conditionalize free(3) on its argument being non-null Reported by: Coverity CID: 1341620 1341630 1341635 1368663 Reviewed by: ken MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9237 Modified: stable/10/usr.sbin/camdd/camdd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/camdd/camdd.c ============================================================================== --- stable/10/usr.sbin/camdd/camdd.c Tue Feb 28 23:55:03 2017 (r314437) +++ stable/10/usr.sbin/camdd/camdd.c Tue Feb 28 23:56:14 2017 (r314438) @@ -420,9 +420,9 @@ struct camdd_dev { }; static sem_t camdd_sem; -static int need_exit = 0; -static int error_exit = 0; -static int need_status = 0; +static sig_atomic_t need_exit = 0; +static sig_atomic_t error_exit = 0; +static sig_atomic_t need_status = 0; #ifndef min #define min(a, b) (a < b) ? a : b @@ -712,11 +712,7 @@ camdd_alloc_buf(struct camdd_dev *dev, c return (buf); bailout_error: - if (data_ptr != NULL) - free(data_ptr); - - if (buf != NULL) - free(buf); + free(data_ptr); return (NULL); } @@ -2261,6 +2257,7 @@ camdd_file_run(struct camdd_dev *dev) if (file_dev->tmp_buf == NULL) { buf->status = CAMDD_STATUS_ERROR; error_count++; + pthread_mutex_lock(&dev->mutex); goto bailout; } for (i = 0, cur_offset = 0; i < data->sg_count; i++) { @@ -2983,7 +2980,6 @@ int camdd_rw(struct camdd_io_opts *io_opts, int num_io_opts, uint64_t max_io, int retry_count, int timeout) { - char *device = NULL; struct cam_device *new_cam_dev = NULL; struct camdd_dev *devs[2]; struct timespec start_time; @@ -3003,12 +2999,11 @@ camdd_rw(struct camdd_io_opts *io_opts, for (i = 0; i < num_io_opts; i++) { switch (io_opts[i].dev_type) { case CAMDD_DEV_PASS: { - camdd_argmask new_arglist = CAMDD_ARG_NONE; - int bus = 0, target = 0, lun = 0; - char name[30]; - int rv; - if (isdigit(io_opts[i].dev_name[0])) { + camdd_argmask new_arglist = CAMDD_ARG_NONE; + int bus = 0, target = 0, lun = 0; + int rv; + /* device specified as bus:target[:lun] */ rv = parse_btl(io_opts[i].dev_name, &bus, &target, &lun, &new_arglist); @@ -3024,23 +3019,21 @@ camdd_rw(struct camdd_io_opts *io_opts, lun = 0; new_arglist |= CAMDD_ARG_LUN; } + new_cam_dev = cam_open_btl(bus, target, lun, + O_RDWR, NULL); } else { + char name[30]; + if (cam_get_device(io_opts[i].dev_name, name, sizeof name, &unit) == -1) { warnx("%s", cam_errbuf); error = 1; goto bailout; } - device = strdup(name); - new_arglist |= CAMDD_ARG_DEVICE |CAMDD_ARG_UNIT; + new_cam_dev = cam_open_spec_device(name, unit, + O_RDWR, NULL); } - if (new_arglist & (CAMDD_ARG_BUS | CAMDD_ARG_TARGET)) - new_cam_dev = cam_open_btl(bus, target, lun, - O_RDWR, NULL); - else - new_cam_dev = cam_open_spec_device(device, unit, - O_RDWR, NULL); if (new_cam_dev == NULL) { warnx("%s", cam_errbuf); error = 1; From owner-svn-src-stable-10@freebsd.org Wed Mar 1 00:13:59 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2D85CF1315; Wed, 1 Mar 2017 00:13:59 +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 mx1.freebsd.org (Postfix) with ESMTPS id 949BD34A; Wed, 1 Mar 2017 00:13:59 +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 v210DwDe019109; Wed, 1 Mar 2017 00:13:58 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v210Dwxu019108; Wed, 1 Mar 2017 00:13:58 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201703010013.v210Dwxu019108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 1 Mar 2017 00:13: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: r314440 - stable/10/sys/dev/mpr X-SVN-Group: stable-10 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.23 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, 01 Mar 2017 00:13:59 -0000 Author: asomers Date: Wed Mar 1 00:13:58 2017 New Revision: 314440 URL: https://svnweb.freebsd.org/changeset/base/314440 Log: MFC r312995: Initialize a stack variable in mprsas_get_sas_address_for_sata_disk Thought it's difficult to reproduce, I think this variable was responsible for a use-after-free panic when a SATA disk timed out responding to a SATA identify command during boot. Submitted by: slm Reviewed by: slm MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9364 Modified: stable/10/sys/dev/mpr/mpr_sas_lsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_sas_lsi.c Tue Feb 28 23:56:24 2017 (r314439) +++ stable/10/sys/dev/mpr/mpr_sas_lsi.c Wed Mar 1 00:13:58 2017 (r314440) @@ -893,6 +893,7 @@ mprsas_get_sas_address_for_sata_disk(str u8 sas_status; memset(&ata_identify, 0, sizeof(ata_identify)); + memset(&mpi_reply, 0, sizeof(mpi_reply)); try_count = 0; do { rc = mprsas_get_sata_identify(sc, handle, &mpi_reply, From owner-svn-src-stable-10@freebsd.org Wed Mar 1 01:19:42 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A08A3CF2863; Wed, 1 Mar 2017 01:19:42 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 6FE11C0C; Wed, 1 Mar 2017 01:19:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v211JfSX043388; Wed, 1 Mar 2017 01:19:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v211JfIM043387; Wed, 1 Mar 2017 01:19:41 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201703010119.v211JfIM043387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 1 Mar 2017 01:19: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: r314445 - stable/10/usr.bin/dc X-SVN-Group: stable-10 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.23 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, 01 Mar 2017 01:19:42 -0000 Author: pfg Date: Wed Mar 1 01:19:41 2017 New Revision: 314445 URL: https://svnweb.freebsd.org/changeset/base/314445 Log: MFC r314316: dc(1): Catch up with OpenBSD tag. OpenBSD rev 1.12 corresponds to our SVN r275162. Update the tag to make easier future updates. No functional change. Modified: stable/10/usr.bin/dc/stack.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/dc/stack.c ============================================================================== --- stable/10/usr.bin/dc/stack.c Wed Mar 1 01:17:51 2017 (r314444) +++ stable/10/usr.bin/dc/stack.c Wed Mar 1 01:19:41 2017 (r314445) @@ -1,4 +1,4 @@ -/* $OpenBSD: stack.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $ */ +/* $OpenBSD: stack.c,v 1.12 2014/11/26 15:05:51 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek From owner-svn-src-stable-10@freebsd.org Wed Mar 1 01:44:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2D30CF2E71; Wed, 1 Mar 2017 01:44:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4A7E5A32; Wed, 1 Mar 2017 01:44:41 +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 v211ieIX054785; Wed, 1 Mar 2017 01:44:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v211ieAf054784; Wed, 1 Mar 2017 01:44:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201703010144.v211ieAf054784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 1 Mar 2017 01:44:40 +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: r314446 - stable/10/contrib/tzcode/stdtime X-SVN-Group: stable-10 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.23 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, 01 Mar 2017 01:44:41 -0000 Author: emaste Date: Wed Mar 1 01:44:40 2017 New Revision: 314446 URL: https://svnweb.freebsd.org/changeset/base/314446 Log: MFC r313774: localtime: return NULL if time_t out of range of struct tm Previously we would truncate tm.tm_year for any time_t corresponding to a year that does not fit in int. This issue was discovered because it caused the bash-static build to fail when linking with LLD. As reported by Rafael Espíndola: Configure has AC_FUNC_MKTIME which expands to a test of mktime that fails with the freebsd implementation. Given that, bash compiles a mktime.o file that defines just mktime and uses localtime. That goes in a .a file that is before libc. The freebsd libc defines mktime in localtime.o, which also defines localtime among other functions. When lld sees an undefined reference to mktime from libc, it uses the bash provided one and then tries to find a definition of localtime. It is found on libc's localtime.o, but now we have a duplicated error. The reason it works with bfd is that bash doesn't use mktime directly and the undefined reference from libc is resolved to the libc implementation. It would also fail to link if bash itself directly used mktime. The bash-static configure test verifies that, for many values of t, either localtime(t) returns NULL or mktime(localtime(t)) == t. This test failed when localtime returned a truncated tm_year. This was fixed in tzcode in 2004 but has persisted in our tree since rS2708. Sponsored by: The FreeBSD Foundation Modified: stable/10/contrib/tzcode/stdtime/localtime.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tzcode/stdtime/localtime.c ============================================================================== --- stable/10/contrib/tzcode/stdtime/localtime.c Wed Mar 1 01:19:41 2017 (r314445) +++ stable/10/contrib/tzcode/stdtime/localtime.c Wed Mar 1 01:44:40 2017 (r314446) @@ -1460,14 +1460,13 @@ const time_t * const timep; } _RWLOCK_RDLOCK(&lcl_rwlock); tzset_basic(1); - localsub(timep, 0L, p_tm); + p_tm = localsub(timep, 0L, p_tm); _RWLOCK_UNLOCK(&lcl_rwlock); - return(p_tm); } else { tzset_basic(0); - localsub(timep, 0L, &tm); - return(&tm); + p_tm = localsub(timep, 0L, &tm); } + return(p_tm); } /* @@ -1481,7 +1480,7 @@ struct tm * tmp; { _RWLOCK_RDLOCK(&lcl_rwlock); tzset_basic(1); - localsub(timep, 0L, tmp); + tmp = localsub(timep, 0L, tmp); _RWLOCK_UNLOCK(&lcl_rwlock); return tmp; } From owner-svn-src-stable-10@freebsd.org Wed Mar 1 13:45:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32146CF3F19; Wed, 1 Mar 2017 13:45:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id F3343A78; Wed, 1 Mar 2017 13:45:51 +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 v21DjpN6038181; Wed, 1 Mar 2017 13:45:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v21DjpM9038180; Wed, 1 Mar 2017 13:45:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703011345.v21DjpM9038180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 1 Mar 2017 13:45: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: r314492 - stable/10/sys/sys X-SVN-Group: stable-10 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.23 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, 01 Mar 2017 13:45:52 -0000 Author: avg Date: Wed Mar 1 13:45:50 2017 New Revision: 314492 URL: https://svnweb.freebsd.org/changeset/base/314492 Log: MFC r314100: fix a typo in __STDC_VERSION__ in __min_size requirements Modified: stable/10/sys/sys/cdefs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/cdefs.h ============================================================================== --- stable/10/sys/sys/cdefs.h Wed Mar 1 13:45:40 2017 (r314491) +++ stable/10/sys/sys/cdefs.h Wed Mar 1 13:45:50 2017 (r314492) @@ -340,7 +340,7 @@ * void bar(int myArray[__min_size(10)]); */ #if !defined(__cplusplus) && \ - (!defined(__STDC_VERSION) || (__STDC_VERSION__ >= 199901)) + (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901)) #define __min_size(x) static (x) #else #define __min_size(x) (x) From owner-svn-src-stable-10@freebsd.org Wed Mar 1 13:47:38 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52A30CEE073; Wed, 1 Mar 2017 13:47:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1FA32D1E; Wed, 1 Mar 2017 13:47:38 +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 v21DlbNd038347; Wed, 1 Mar 2017 13:47:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v21DlbYi038346; Wed, 1 Mar 2017 13:47:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703011347.v21DlbYi038346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 1 Mar 2017 13:47:37 +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: r314494 - stable/10/sys/sys X-SVN-Group: stable-10 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.23 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, 01 Mar 2017 13:47:38 -0000 Author: avg Date: Wed Mar 1 13:47:36 2017 New Revision: 314494 URL: https://svnweb.freebsd.org/changeset/base/314494 Log: MFC r314101: don't use C99 static array indices with older GCC versions Sponsored by: Panzura Modified: stable/10/sys/sys/cdefs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/cdefs.h ============================================================================== --- stable/10/sys/sys/cdefs.h Wed Mar 1 13:47:28 2017 (r314493) +++ stable/10/sys/sys/cdefs.h Wed Mar 1 13:47:36 2017 (r314494) @@ -340,6 +340,7 @@ * void bar(int myArray[__min_size(10)]); */ #if !defined(__cplusplus) && \ + (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \ (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901)) #define __min_size(x) static (x) #else From owner-svn-src-stable-10@freebsd.org Thu Mar 2 09:10:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FAC1CF56E8; Thu, 2 Mar 2017 09:10:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2089C27A; Thu, 2 Mar 2017 09:10:41 +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 v229AeAa097217; Thu, 2 Mar 2017 09:10:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v229Aewu097214; Thu, 2 Mar 2017 09:10:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703020910.v229Aewu097214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 2 Mar 2017 09:10:40 +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: r314550 - stable/10/sys/crypto/sha2 X-SVN-Group: stable-10 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.23 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, 02 Mar 2017 09:10:41 -0000 Author: avg Date: Thu Mar 2 09:10:39 2017 New Revision: 314550 URL: https://svnweb.freebsd.org/changeset/base/314550 Log: Fix r314332 (MFC of r300903): do not use C99 Static array indices The proper conditional support for that feature has not been MFC-ed yet and GCC is quirky about it. See r314101. This is a direct commit. Reported by: gjb Modified: stable/10/sys/crypto/sha2/sha512c.c stable/10/sys/crypto/sha2/sha512t.h Modified: stable/10/sys/crypto/sha2/sha512c.c ============================================================================== --- stable/10/sys/crypto/sha2/sha512c.c Thu Mar 2 07:55:47 2017 (r314549) +++ stable/10/sys/crypto/sha2/sha512c.c Thu Mar 2 09:10:39 2017 (r314550) @@ -364,7 +364,7 @@ SHA512_224_Update(SHA512_CTX * ctx, cons } void -SHA512_224_Final(unsigned char digest[static SHA512_224_DIGEST_LENGTH], SHA512_CTX * ctx) +SHA512_224_Final(unsigned char digest[SHA512_224_DIGEST_LENGTH], SHA512_CTX * ctx) { /* Add padding */ @@ -403,7 +403,7 @@ SHA512_256_Update(SHA512_CTX * ctx, cons } void -SHA512_256_Final(unsigned char digest[static SHA512_256_DIGEST_LENGTH], SHA512_CTX * ctx) +SHA512_256_Final(unsigned char digest[SHA512_256_DIGEST_LENGTH], SHA512_CTX * ctx) { /* Add padding */ Modified: stable/10/sys/crypto/sha2/sha512t.h ============================================================================== --- stable/10/sys/crypto/sha2/sha512t.h Thu Mar 2 07:55:47 2017 (r314549) +++ stable/10/sys/crypto/sha2/sha512t.h Thu Mar 2 09:10:39 2017 (r314550) @@ -103,7 +103,7 @@ __BEGIN_DECLS void SHA512_224_Init(SHA512_CTX *); void SHA512_224_Update(SHA512_CTX *, const void *, size_t); -void SHA512_224_Final(unsigned char [static SHA512_224_DIGEST_LENGTH], SHA512_CTX *); +void SHA512_224_Final(unsigned char [SHA512_224_DIGEST_LENGTH], SHA512_CTX *); #ifndef _KERNEL char *SHA512_224_End(SHA512_CTX *, char *); char *SHA512_224_Data(const void *, unsigned int, char *); @@ -112,7 +112,7 @@ char *SHA512_224_FileChunk(const char #endif void SHA512_256_Init(SHA512_CTX *); void SHA512_256_Update(SHA512_CTX *, const void *, size_t); -void SHA512_256_Final(unsigned char [static SHA512_256_DIGEST_LENGTH], SHA512_CTX *); +void SHA512_256_Final(unsigned char [SHA512_256_DIGEST_LENGTH], SHA512_CTX *); #ifndef _KERNEL char *SHA512_256_End(SHA512_CTX *, char *); char *SHA512_256_Data(const void *, unsigned int, char *); From owner-svn-src-stable-10@freebsd.org Thu Mar 2 17:17:07 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE506CF5FB0; Thu, 2 Mar 2017 17:17:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7AF13809; Thu, 2 Mar 2017 17:17:07 +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 v22HH6PO092019; Thu, 2 Mar 2017 17:17:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v22HH6Nv092018; Thu, 2 Mar 2017 17:17:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201703021717.v22HH6Nv092018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 2 Mar 2017 17:17:06 +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: r314560 - stable/10/contrib/tcpdump X-SVN-Group: stable-10 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.23 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, 02 Mar 2017 17:17:07 -0000 Author: emaste Date: Thu Mar 2 17:17:06 2017 New Revision: 314560 URL: https://svnweb.freebsd.org/changeset/base/314560 Log: MFC r309649 (oshogbo): tcpdump: allow to use BIOCROTZBUF in capability mode The libpcap library can use a BIOCROTZBUF ioctl when net.bpf.zerocopy_enable sysctl is set. PR: 217490 Modified: stable/10/contrib/tcpdump/tcpdump.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tcpdump/tcpdump.c ============================================================================== --- stable/10/contrib/tcpdump/tcpdump.c Thu Mar 2 17:09:14 2017 (r314559) +++ stable/10/contrib/tcpdump/tcpdump.c Thu Mar 2 17:17:06 2017 (r314560) @@ -1554,7 +1554,7 @@ main(int argc, char **argv) error("%s", pcap_geterr(pd)); #ifdef __FreeBSD__ if (RFileName == NULL && VFileName == NULL) { - static const unsigned long cmds[] = { BIOCGSTATS }; + static const unsigned long cmds[] = { BIOCGSTATS, BIOCROTZBUF }; /* * The various libpcap devices use a combination of From owner-svn-src-stable-10@freebsd.org Fri Mar 3 06:03:02 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E12ACF6F73; Fri, 3 Mar 2017 06:03:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AD3417E1; Fri, 3 Mar 2017 06:03:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v23631xW005971; Fri, 3 Mar 2017 06:03:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23631Vq005970; Fri, 3 Mar 2017 06:03:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703030603.v23631Vq005970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 3 Mar 2017 06:03: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: r314581 - stable/10/sys/dev/iscsi X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 06:03:02 -0000 Author: mav Date: Fri Mar 3 06:03:01 2017 New Revision: 314581 URL: https://svnweb.freebsd.org/changeset/base/314581 Log: MFC r313851: Fix tight loop spinning on postponed requests. Modified: stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Fri Mar 3 06:02:27 2017 (r314580) +++ stable/10/sys/dev/iscsi/iscsi.c Fri Mar 3 06:03:01 2017 (r314581) @@ -470,15 +470,14 @@ iscsi_maintenance_thread_terminate(struc static void iscsi_maintenance_thread(void *arg) { - struct iscsi_session *is; - - is = arg; + struct iscsi_session *is = arg; + ISCSI_SESSION_LOCK(is); for (;;) { - ISCSI_SESSION_LOCK(is); if (is->is_reconnecting == false && is->is_terminating == false && - STAILQ_EMPTY(&is->is_postponed)) + (STAILQ_EMPTY(&is->is_postponed) || + ISCSI_SNGT(is->is_cmdsn, is->is_maxcmdsn))) cv_wait(&is->is_maintenance_cv, &is->is_lock); /* Terminate supersedes reconnect. */ @@ -492,12 +491,13 @@ iscsi_maintenance_thread(void *arg) if (is->is_reconnecting) { ISCSI_SESSION_UNLOCK(is); iscsi_maintenance_thread_reconnect(is); + ISCSI_SESSION_LOCK(is); continue; } iscsi_session_send_postponed(is); - ISCSI_SESSION_UNLOCK(is); } + ISCSI_SESSION_UNLOCK(is); } static void From owner-svn-src-stable-10@freebsd.org Fri Mar 3 06:04:43 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C51ACF406A; Fri, 3 Mar 2017 06:04:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E8641A99; Fri, 3 Mar 2017 06:04:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2364g49006137; Fri, 3 Mar 2017 06:04:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2364gXp006136; Fri, 3 Mar 2017 06:04:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703030604.v2364gXp006136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 3 Mar 2017 06:04:42 +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: r314583 - stable/10/sys/dev/iscsi X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 06:04:43 -0000 Author: mav Date: Fri Mar 3 06:04:42 2017 New Revision: 314583 URL: https://svnweb.freebsd.org/changeset/base/314583 Log: MFC r313852: Freeze CAM SIM when request is postponed due to MaxCmdSN. This allows to avoid resource allocation (especially offload) for requests that can not be executed at this time any way. Modified: stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Fri Mar 3 06:04:03 2017 (r314582) +++ stable/10/sys/dev/iscsi/iscsi.c Fri Mar 3 06:04:42 2017 (r314583) @@ -233,14 +233,16 @@ iscsi_session_send_postponed(struct iscs ISCSI_SESSION_LOCK_ASSERT(is); - while (!STAILQ_EMPTY(&is->is_postponed)) { - request = STAILQ_FIRST(&is->is_postponed); + if (STAILQ_EMPTY(&is->is_postponed)) + return; + while ((request = STAILQ_FIRST(&is->is_postponed)) != NULL) { postpone = iscsi_pdu_prepare(request); if (postpone) - break; + return; STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next); icl_pdu_queue(request); } + xpt_release_simq(is->is_sim, 1); } static void @@ -254,6 +256,8 @@ iscsi_pdu_queue_locked(struct icl_pdu *r iscsi_session_send_postponed(is); postpone = iscsi_pdu_prepare(request); if (postpone) { + if (STAILQ_EMPTY(&is->is_postponed)) + xpt_freeze_simq(is->is_sim, 1); STAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next); return; } @@ -339,8 +343,9 @@ iscsi_session_cleanup(struct iscsi_sessi /* * Remove postponed PDUs. */ - while (!STAILQ_EMPTY(&is->is_postponed)) { - pdu = STAILQ_FIRST(&is->is_postponed); + if (!STAILQ_EMPTY(&is->is_postponed)) + xpt_release_simq(is->is_sim, 1); + while ((pdu = STAILQ_FIRST(&is->is_postponed)) != NULL) { STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next); icl_pdu_free(pdu); } From owner-svn-src-stable-10@freebsd.org Fri Mar 3 10:17:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CC57CF6103; Fri, 3 Mar 2017 10:17:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 651FD17AB; Fri, 3 Mar 2017 10:17:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v23AHGnw009505; Fri, 3 Mar 2017 10:17:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23AHGn2009504; Fri, 3 Mar 2017 10:17:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201703031017.v23AHGn2009504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 3 Mar 2017 10:17: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: r314590 - stable/10/sys/vm X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 10:17:17 -0000 Author: kib Date: Fri Mar 3 10:17:16 2017 New Revision: 314590 URL: https://svnweb.freebsd.org/changeset/base/314590 Log: MFC r314195: Properly handle possible underflow in vm_fault_prefault(). Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Fri Mar 3 10:02:56 2017 (r314589) +++ stable/10/sys/vm/vm_fault.c Fri Mar 3 10:17:16 2017 (r314590) @@ -1140,11 +1140,12 @@ vm_fault_prefault(const struct faultstat } entry = fs->entry; - starta = addra - backward * PAGE_SIZE; - if (starta < entry->start) { + if (addra < backward * PAGE_SIZE) { starta = entry->start; - } else if (starta > addra) { - starta = 0; + } else { + starta = addra - backward * PAGE_SIZE; + if (starta < entry->start) + starta = entry->start; } /* From owner-svn-src-stable-10@freebsd.org Fri Mar 3 12:03:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77430CF7BC8; Fri, 3 Mar 2017 12:03:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id 29F6E1141; Fri, 3 Mar 2017 12:03:52 +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 v23C3pn0055826; Fri, 3 Mar 2017 12:03:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23C3pYD055824; Fri, 3 Mar 2017 12:03:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703031203.v23C3pYD055824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 3 Mar 2017 12:03: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: r314593 - in stable/10/sys/dev/drm2: . radeon X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 12:03:52 -0000 Author: avg Date: Fri Mar 3 12:03:50 2017 New Revision: 314593 URL: https://svnweb.freebsd.org/changeset/base/314593 Log: MFC r288112,r302571: remove unused and redundant declarations and code r288112 Hide an unused in FreeBSD function behind #ifdef linux to get rid of the compile time warning. r302571 Remove redundant declaration for radeon_pm_acpi_event_handler(..) to fix -Wredundant-decls warning This allows the code to be compiled with the base gcc. Modified: stable/10/sys/dev/drm2/drm_lock.c stable/10/sys/dev/drm2/radeon/radeon_acpi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/drm_lock.c ============================================================================== --- stable/10/sys/dev/drm2/drm_lock.c Fri Mar 3 11:21:13 2017 (r314592) +++ stable/10/sys/dev/drm2/drm_lock.c Fri Mar 3 12:03:50 2017 (r314593) @@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$"); #include +#if defined(__linux__) static int drm_notifier(void *priv); +#endif static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context); @@ -284,6 +286,7 @@ int drm_lock_free(struct drm_lock_data * return 0; } +#if defined(__linux__) /** * If we get here, it means that the process has called DRM_IOCTL_LOCK * without calling DRM_IOCTL_UNLOCK. @@ -314,6 +317,7 @@ static int drm_notifier(void *priv) } while (prev != old); return 0; } +#endif /** * This function returns immediately and takes the hw lock Modified: stable/10/sys/dev/drm2/radeon/radeon_acpi.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_acpi.c Fri Mar 3 11:21:13 2017 (r314592) +++ stable/10/sys/dev/drm2/radeon/radeon_acpi.c Fri Mar 3 12:03:50 2017 (r314593) @@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$"); #define ACPI_AC_CLASS "ac_adapter" -extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev); - struct atif_verify_interface { u16 size; /* structure size in bytes (includes size field) */ u16 version; /* version */ From owner-svn-src-stable-10@freebsd.org Fri Mar 3 12:06:34 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9308CCF7CC6; Fri, 3 Mar 2017 12:06:34 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5F98A12E8; Fri, 3 Mar 2017 12:06:34 +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 v23C6XkS055973; Fri, 3 Mar 2017 12:06:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23C6XTF055972; Fri, 3 Mar 2017 12:06:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703031206.v23C6XTF055972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 3 Mar 2017 12:06: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: r314594 - stable/10/sys/modules/mlx5 X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 12:06:34 -0000 Author: avg Date: Fri Mar 3 12:06:33 2017 New Revision: 314594 URL: https://svnweb.freebsd.org/changeset/base/314594 Log: mlx5 module: remove include path that doesn't exist in this branch This is a direct commit. It allows the module to be compiled with the base gcc. Modified: stable/10/sys/modules/mlx5/Makefile Modified: stable/10/sys/modules/mlx5/Makefile ============================================================================== --- stable/10/sys/modules/mlx5/Makefile Fri Mar 3 12:03:50 2017 (r314593) +++ stable/10/sys/modules/mlx5/Makefile Fri Mar 3 12:06:33 2017 (r314594) @@ -30,7 +30,6 @@ device_if.h bus_if.h vnode_if.h pci_if.h SRCS+= linux_compat.c linux_radix.c linux_idr.c CFLAGS+= -I${.CURDIR}/../../ofed/include -CFLAGS+= -I${.CURDIR}/../../compat/linuxkpi/common/include .include From owner-svn-src-stable-10@freebsd.org Fri Mar 3 13:32:02 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB443CF6186; Fri, 3 Mar 2017 13:32:02 +0000 (UTC) (envelope-from des@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 mx1.freebsd.org (Postfix) with ESMTPS id 5D39816D5; Fri, 3 Mar 2017 13:32:02 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v23DW1qw089930; Fri, 3 Mar 2017 13:32:01 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23DW1ii089929; Fri, 3 Mar 2017 13:32:01 GMT (envelope-from des@FreeBSD.org) Message-Id: <201703031332.v23DW1ii089929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 3 Mar 2017 13:32: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: r314597 - stable/10/tools/build/mk X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 13:32:02 -0000 Author: des Date: Fri Mar 3 13:32:01 2017 New Revision: 314597 URL: https://svnweb.freebsd.org/changeset/base/314597 Log: MFH (r278120): add missing ssh-related files PR: 193980 Submitted by: mcdouga9@egr.msu.edu Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/10/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 3 12:51:16 2017 (r314596) +++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 3 13:32:01 2017 (r314597) @@ -4044,18 +4044,28 @@ OLD_FILES+=usr/share/man/man8/ntptime.8. .endif .if ${MK_OPENSSH} == no +OLD_FILES+=etc/rc.d/sshd +OLD_FILES+=etc/ssh/moduli +OLD_FILES+=etc/ssh/ssh_config +OLD_FILES+=etc/ssh/sshd_config +OLD_FILES+=usr/bin/scp OLD_FILES+=usr/bin/sftp +OLD_FILES+=usr/bin/slogin OLD_FILES+=usr/bin/ssh OLD_FILES+=usr/bin/ssh-add OLD_FILES+=usr/bin/ssh-agent OLD_FILES+=usr/bin/ssh-copy-id OLD_FILES+=usr/bin/ssh-keygen OLD_FILES+=usr/bin/ssh-keyscan +OLD_FILES+=usr/lib/pam_ssh.so +OLD_LIBS+=usr/lib/pam_ssh.so.5 OLD_FILES+=usr/lib/private/libssh.a OLD_FILES+=usr/lib/private/libssh.so OLD_LIBS+=usr/lib/private/libssh.so.5 OLD_FILES+=usr/lib/private/libssh_p.a .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" +OLD_FILES+=usr/lib32/pam_ssh.so +OLD_LIBS+=usr/lib32/pam_ssh.so.5 OLD_FILES+=usr/lib32/private/libssh.a OLD_FILES+=usr/lib32/private/libssh.so OLD_LIBS+=usr/lib32/private/libssh.so.5 @@ -4065,6 +4075,22 @@ OLD_FILES+=usr/libexec/sftp-server OLD_FILES+=usr/libexec/ssh-keysign OLD_FILES+=usr/libexec/ssh-pkcs11-helper OLD_FILES+=usr/sbin/sshd +OLD_FILES+=usr/share/man/man1/scp.1.gz +OLD_FILES+=usr/share/man/man1/sftp.1.gz +OLD_FILES+=usr/share/man/man1/slogin.1.gz +OLD_FILES+=usr/share/man/man1/ssh-add.1.gz +OLD_FILES+=usr/share/man/man1/ssh-agent.1.gz +OLD_FILES+=usr/share/man/man1/ssh-copy-id.1.gz +OLD_FILES+=usr/share/man/man1/ssh-keygen.1.gz +OLD_FILES+=usr/share/man/man1/ssh-keyscan.1.gz +OLD_FILES+=usr/share/man/man1/ssh.1.gz +OLD_FILES+=usr/share/man/man5/ssh_config.5.gz +OLD_FILES+=usr/share/man/man5/sshd_config.5.gz +OLD_FILES+=usr/share/man/man8/pam_ssh.8.gz +OLD_FILES+=usr/share/man/man8/sftp-server.8.gz +OLD_FILES+=usr/share/man/man8/ssh-keysign.8.gz +OLD_FILES+=usr/share/man/man8/ssh-pkcs11-helper.8.gz +OLD_FILES+=usr/share/man/man8/sshd.8.gz .endif .if ${MK_OPENSSL} == no From owner-svn-src-stable-10@freebsd.org Fri Mar 3 14:19:13 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A33E7CF535B; Fri, 3 Mar 2017 14:19:13 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F07E1646; Fri, 3 Mar 2017 14:19:13 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0785D1FE025; Fri, 3 Mar 2017 15:18:45 +0100 (CET) Subject: Re: svn commit: r314594 - stable/10/sys/modules/mlx5 To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201703031206.v23C6XTF055972@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Fri, 3 Mar 2017 15:18:24 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <201703031206.v23C6XTF055972@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 03 Mar 2017 14:19:13 -0000 On 03/03/17 13:06, Andriy Gapon wrote: > Author: avg > Date: Fri Mar 3 12:06:33 2017 > New Revision: 314594 > URL: https://svnweb.freebsd.org/changeset/base/314594 > > Log: > mlx5 module: remove include path that doesn't exist in this branch > > This is a direct commit. > It allows the module to be compiled with the base gcc. > > Modified: > stable/10/sys/modules/mlx5/Makefile > > Modified: stable/10/sys/modules/mlx5/Makefile > ============================================================================== > --- stable/10/sys/modules/mlx5/Makefile Fri Mar 3 12:03:50 2017 (r314593) > +++ stable/10/sys/modules/mlx5/Makefile Fri Mar 3 12:06:33 2017 (r314594) > @@ -30,7 +30,6 @@ device_if.h bus_if.h vnode_if.h pci_if.h > SRCS+= linux_compat.c linux_radix.c linux_idr.c > > CFLAGS+= -I${.CURDIR}/../../ofed/include > -CFLAGS+= -I${.CURDIR}/../../compat/linuxkpi/common/include > > .include > Hi, Which version of GCC is this? Do you want me to check for this kind of errors before committing or are you fine cleaning up every now and then? Currently the mlx4/mlx5 code is only tested with the in-base compiler. --HPS From owner-svn-src-stable-10@freebsd.org Fri Mar 3 14:35:21 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BA3FCF5A4C; Fri, 3 Mar 2017 14:35:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id EB54C12B5; Fri, 3 Mar 2017 14:35:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA26957; Fri, 03 Mar 2017 16:35:18 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cjoIf-0009rN-RL; Fri, 03 Mar 2017 16:35:17 +0200 Subject: Re: svn commit: r314594 - stable/10/sys/modules/mlx5 To: Hans Petter Selasky , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org References: <201703031206.v23C6XTF055972@repo.freebsd.org> From: Andriy Gapon Message-ID: <915cdd8f-0f12-0bb1-9c8d-e4813e275141@FreeBSD.org> Date: Fri, 3 Mar 2017 16:34:22 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 03 Mar 2017 14:35:21 -0000 On 03/03/2017 16:18, Hans Petter Selasky wrote: > On 03/03/17 13:06, Andriy Gapon wrote: >> Author: avg >> Date: Fri Mar 3 12:06:33 2017 >> New Revision: 314594 >> URL: https://svnweb.freebsd.org/changeset/base/314594 >> >> Log: >> mlx5 module: remove include path that doesn't exist in this branch >> >> This is a direct commit. >> It allows the module to be compiled with the base gcc. >> >> Modified: >> stable/10/sys/modules/mlx5/Makefile >> >> Modified: stable/10/sys/modules/mlx5/Makefile >> ============================================================================== >> --- stable/10/sys/modules/mlx5/Makefile Fri Mar 3 12:03:50 2017 (r314593) >> +++ stable/10/sys/modules/mlx5/Makefile Fri Mar 3 12:06:33 2017 (r314594) >> @@ -30,7 +30,6 @@ device_if.h bus_if.h vnode_if.h pci_if.h >> SRCS+= linux_compat.c linux_radix.c linux_idr.c >> >> CFLAGS+= -I${.CURDIR}/../../ofed/include >> -CFLAGS+= -I${.CURDIR}/../../compat/linuxkpi/common/include >> >> .include >> > > Hi, > > Which version of GCC is this? gcc version 4.2.1 20070831 patched [FreeBSD] That is, the compiler that you get when clang is disabled. > Do you want me to check for this kind of errors before committing or are you > fine cleaning up every now and then? Currently the mlx4/mlx5 code is only tested > with the in-base compiler. Checking with a non-default compiler is probably too much a burden for anyone who doesn't use it regularly. -- Andriy Gapon From owner-svn-src-stable-10@freebsd.org Fri Mar 3 17:57:19 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36971CF685A; Fri, 3 Mar 2017 17:57:19 +0000 (UTC) (envelope-from np@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 mx1.freebsd.org (Postfix) with ESMTPS id F33D21BE9; Fri, 3 Mar 2017 17:57:18 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v23HvI4e001318; Fri, 3 Mar 2017 17:57:18 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23HvHWf001313; Fri, 3 Mar 2017 17:57:17 GMT (envelope-from np@FreeBSD.org) Message-Id: <201703031757.v23HvHWf001313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 3 Mar 2017 17:57:17 +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: r314606 - in stable/10/sys: dev/cxgbe/iw_cxgbe ofed/drivers/infiniband/core X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 17:57:19 -0000 Author: np Date: Fri Mar 3 17:57:17 2017 New Revision: 314606 URL: https://svnweb.freebsd.org/changeset/base/314606 Log: MFC r314400: cxgbe/iw_cxgbe: fix various double-close panics with iWARP sockets. Sockets representing the TCP endpoints for iWARP connections are allocated by the ibcore module. Before this revision they were closed either by the ibcore module or the iw_cxgbe hardware driver depending on the state transitions during connection teardown. This is error prone and there were cases where both iw_cxgbe and ibcore closed the socket leading to double-free panics. The fix is to let ibcore close the sockets it creates and never do it in the driver. - Use sodisconnect instead of soclose (preceded by solinger = 0) in the driver to tear down an RDMA connection abruptly. This does what's intended without releasing the socket's fd reference. - Close the socket in ibcore when the iWARP iw_cm_id is destroyed. This works for all kinds of sockets: clients that initiate connections, listeners, and sockets accepted off of listeners. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h stable/10/sys/ofed/drivers/infiniband/core/cma.c stable/10/sys/ofed/drivers/infiniband/core/iwcm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Mar 3 17:53:22 2017 (r314605) +++ stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Mar 3 17:57:17 2017 (r314606) @@ -90,9 +90,7 @@ static void *alloc_ep(int size, gfp_t fl void __free_ep(struct c4iw_ep_common *epc); static struct rtentry * find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port, __be16 peer_port, u8 tos); -static int close_socket(struct c4iw_ep_common *epc, int close); -static int shutdown_socket(struct c4iw_ep_common *epc); -static void abort_socket(struct c4iw_ep *ep); +static void close_socket(struct socket *so); static int send_mpa_req(struct c4iw_ep *ep); static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen); static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen); @@ -109,7 +107,8 @@ static void process_peer_close(struct c4 static void process_conn_error(struct c4iw_ep *ep); static void process_close_complete(struct c4iw_ep *ep); static void ep_timeout(unsigned long arg); -static void init_sock(struct c4iw_ep_common *epc); +static void init_iwarp_socket(struct socket *so, void *arg); +static void uninit_iwarp_socket(struct socket *so); static void process_data(struct c4iw_ep *ep); static void process_connected(struct c4iw_ep *ep); static int c4iw_so_upcall(struct socket *so, void *arg, int waitflag); @@ -319,87 +318,12 @@ find_route(__be32 local_ip, __be32 peer_ return iproute.ro_rt; } -static int -close_socket(struct c4iw_ep_common *epc, int close) -{ - struct socket *so = epc->so; - int rc; - - CTR5(KTR_IW_CXGBE, "%s:csoB so %p, ep %p, state %s, tid %d", __func__, - so, epc, states[epc->state], - ((struct c4iw_ep *)epc)->hwtid); - mutex_lock(&epc->so_mutex); - if ((so == NULL) || (so->so_count == 0)) { - mutex_unlock(&epc->so_mutex); - CTR5(KTR_IW_CXGBE, "%s:cso1 so %p, ep %p, state %s, tid %d", - __func__, so, epc, states[epc->state], - ((struct c4iw_ep *)epc)->hwtid); - return -EINVAL; - } - - SOCK_LOCK(so); - soupcall_clear(so, SO_RCV); - SOCK_UNLOCK(so); - - if (close) - rc = soclose(so); - else - rc = soshutdown(so, SHUT_WR | SHUT_RD); - epc->so = NULL; - - mutex_unlock(&epc->so_mutex); - return (rc); -} - -static int -shutdown_socket(struct c4iw_ep_common *epc) -{ - - struct socket *so = epc->so; - int rc; - - CTR5(KTR_IW_CXGBE, "%s:ssoB so %p, ep %p, state %s, tid %d", __func__, - epc->so, epc, states[epc->state], - ((struct c4iw_ep *)epc)->hwtid); - mutex_lock(&epc->so_mutex); - if ((so == NULL) || (so->so_count == 0)) { - mutex_unlock(&epc->so_mutex); - CTR5(KTR_IW_CXGBE, "%s:sso1 so %p, ep %p, state %s, tid %d", - __func__, epc->so, epc, states[epc->state], - ((struct c4iw_ep *)epc)->hwtid); - return -EINVAL; - } - rc = soshutdown(so, SHUT_WR); - mutex_unlock(&epc->so_mutex); - return rc; -} - static void -abort_socket(struct c4iw_ep *ep) +close_socket(struct socket *so) { - struct sockopt sopt; - int rc; - struct linger l; - - CTR5(KTR_IW_CXGBE, "%s ep %p so %p state %s tid %d", __func__, ep, - ep->com.so, states[ep->com.state], ep->hwtid); - mutex_lock(&ep->com.so_mutex); - l.l_onoff = 1; - l.l_linger = 0; - /* linger_time of 0 forces RST to be sent */ - sopt.sopt_dir = SOPT_SET; - sopt.sopt_level = SOL_SOCKET; - sopt.sopt_name = SO_LINGER; - sopt.sopt_val = (caddr_t)&l; - sopt.sopt_valsize = sizeof l; - sopt.sopt_td = NULL; - rc = sosetopt(ep->com.so, &sopt); - if (rc) { - log(LOG_ERR, "%s: can't set linger to 0, no RST! err %d\n", - __func__, rc); - } - mutex_unlock(&ep->com.so_mutex); + uninit_iwarp_socket(so); + sodisconnect(so); } static void @@ -429,7 +353,7 @@ process_peer_close(struct c4iw_ep *ep) disconnect = 0; STOP_EP_TIMER(ep); - close_socket(&ep->com, 0); + close_socket(ep->com.so); deref_cm_id(&ep->com); release = 1; break; @@ -486,7 +410,7 @@ process_peer_close(struct c4iw_ep *ep) c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); } - close_socket(&ep->com, 0); + close_socket(ep->com.so); close_complete_upcall(ep, 0); __state_set(&ep->com, DEAD); release = 1; @@ -595,14 +519,7 @@ process_conn_error(struct c4iw_ep *ep) } if (state != ABORTING) { - if (ep->parent_ep) { - CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep); - close_socket(&ep->com, 1); - } else { - CTR2(KTR_IW_CXGBE, "%s:pce2 %p", __func__, ep); - close_socket(&ep->com, 0); - } - + close_socket(ep->com.so); __state_set(&ep->com, DEAD); c4iw_put_ep(&ep->com); } @@ -648,16 +565,7 @@ process_close_complete(struct c4iw_ep *e &attrs, 1); } - if (ep->parent_ep) { - - CTR2(KTR_IW_CXGBE, "%s:pcc3 %p", __func__, ep); - close_socket(&ep->com, 1); - } - else { - - CTR2(KTR_IW_CXGBE, "%s:pcc4 %p", __func__, ep); - close_socket(&ep->com, 0); - } + close_socket(ep->com.so); close_complete_upcall(ep, 0); __state_set(&ep->com, DEAD); release = 1; @@ -688,23 +596,15 @@ process_close_complete(struct c4iw_ep *e } static void -init_sock(struct c4iw_ep_common *epc) +init_iwarp_socket(struct socket *so, void *arg) { int rc; struct sockopt sopt; - struct socket *so = epc->so; int on = 1; - mutex_lock(&epc->so_mutex); - if ((so == NULL) || (so->so_count == 0)) { - mutex_unlock(&epc->so_mutex); - CTR5(KTR_IW_CXGBE, "%s:iso1 so %p, ep %p, state %s, tid %d", - __func__, so, epc, states[epc->state], - ((struct c4iw_ep *)epc)->hwtid); - return; - } + /* Note that SOCK_LOCK(so) is same as SOCKBUF_LOCK(&so->so_rcv) */ SOCK_LOCK(so); - soupcall_set(so, SO_RCV, c4iw_so_upcall, epc); + soupcall_set(so, SO_RCV, c4iw_so_upcall, arg); so->so_state |= SS_NBIO; SOCK_UNLOCK(so); sopt.sopt_dir = SOPT_SET; @@ -718,7 +618,15 @@ init_sock(struct c4iw_ep_common *epc) log(LOG_ERR, "%s: can't set TCP_NODELAY on so %p (%d)\n", __func__, so, rc); } - mutex_unlock(&epc->so_mutex); +} + +static void +uninit_iwarp_socket(struct socket *so) +{ + + SOCKBUF_LOCK(&so->so_rcv); + soupcall_clear(so, SO_RCV); + SOCKBUF_UNLOCK(&so->so_rcv); } static void @@ -759,18 +667,18 @@ process_data(struct c4iw_ep *ep) static void process_connected(struct c4iw_ep *ep) { + struct socket *so = ep->com.so; - if ((ep->com.so->so_state & SS_ISCONNECTED) && !ep->com.so->so_error) { + if ((so->so_state & SS_ISCONNECTED) && !so->so_error) { if (send_mpa_req(ep)) goto err; - } - else { - connect_reply_upcall(ep, -ep->com.so->so_error); + } else { + connect_reply_upcall(ep, -so->so_error); goto err; } return; err: - close_socket(&ep->com, 0); + close_socket(so); state_set(&ep->com, DEAD); c4iw_put_ep(&ep->com); return; @@ -785,23 +693,9 @@ process_newconn(struct iw_cm_id *parent_ struct c4iw_ep *parent_ep = parent_cm_id->provider_data; int ret = 0; - if (!child_so) { - CTR4(KTR_IW_CXGBE, - "%s: parent so %p, parent ep %p, child so %p, invalid so", - __func__, parent_ep->com.so, parent_ep, child_so); - log(LOG_ERR, "%s: invalid child socket\n", __func__); - return; - } - child_ep = alloc_ep(sizeof(*child_ep), M_NOWAIT); - if (!child_ep) { - CTR3(KTR_IW_CXGBE, "%s: parent so %p, parent ep %p, ENOMEM", - __func__, parent_ep->com.so, parent_ep); - log(LOG_ERR, "%s: failed to allocate ep entry\n", __func__); - return; - } - SOCKBUF_LOCK(&child_so->so_rcv); - soupcall_set(child_so, SO_RCV, c4iw_so_upcall, child_ep); - SOCKBUF_UNLOCK(&child_so->so_rcv); + MPASS(child_so != NULL); + + child_ep = alloc_ep(sizeof(*child_ep), M_WAITOK); CTR5(KTR_IW_CXGBE, "%s: parent so %p, parent ep %p, child so %p, child ep %p", @@ -821,6 +715,7 @@ process_newconn(struct iw_cm_id *parent_ free(local, M_SONAME); free(remote, M_SONAME); + init_iwarp_socket(child_so, &child_ep->com); c4iw_get_ep(&parent_ep->com); init_timer(&child_ep->timer); state_set(&child_ep->com, MPA_REQ_WAIT); @@ -1052,7 +947,6 @@ alloc_ep(int size, gfp_t gfp) kref_init(&epc->kref); mutex_init(&epc->mutex); - mutex_init(&epc->so_mutex); c4iw_init_wr_wait(&epc->wr_wait); return (epc); @@ -1373,30 +1267,47 @@ static void close_complete_upcall(struct CTR2(KTR_IW_CXGBE, "%s:ccuE %p", __func__, ep); } -static int send_abort(struct c4iw_ep *ep) +static int +send_abort(struct c4iw_ep *ep) { - int err; + struct socket *so = ep->com.so; + struct sockopt sopt; + int rc; + struct linger l; - CTR2(KTR_IW_CXGBE, "%s:abB %p", __func__, ep); - abort_socket(ep); + CTR5(KTR_IW_CXGBE, "%s ep %p so %p state %s tid %d", __func__, ep, so, + states[ep->com.state], ep->hwtid); - /* - * Since socket options were set as l_onoff=1 and l_linger=0 in in - * abort_socket, invoking soclose here sends a RST (reset) to the peer. - */ - err = close_socket(&ep->com, 1); + l.l_onoff = 1; + l.l_linger = 0; + + /* linger_time of 0 forces RST to be sent */ + sopt.sopt_dir = SOPT_SET; + sopt.sopt_level = SOL_SOCKET; + sopt.sopt_name = SO_LINGER; + sopt.sopt_val = (caddr_t)&l; + sopt.sopt_valsize = sizeof l; + sopt.sopt_td = NULL; + rc = sosetopt(so, &sopt); + if (rc != 0) { + log(LOG_ERR, "%s: sosetopt(%p, linger = 0) failed with %d.\n", + __func__, so, rc); + } + + uninit_iwarp_socket(so); + sodisconnect(so); set_bit(ABORT_CONN, &ep->com.history); - CTR2(KTR_IW_CXGBE, "%s:abE %p", __func__, ep); /* - * TBD: iw_cgbe driver should receive ABORT reply for every ABORT + * TBD: iw_cxgbe driver should receive ABORT reply for every ABORT * request it has sent. But the current TOE driver is not propagating * this ABORT reply event (via do_abort_rpl) to iw_cxgbe. So as a work- * around de-refer 'ep' (which was refered before sending ABORT request) * here instead of doing it in abort_rpl() handler of iw_cxgbe driver. */ c4iw_put_ep(&ep->com); - return err; + + return (0); } static void peer_close_upcall(struct c4iw_ep *ep) @@ -2227,7 +2138,6 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct c4iw_dev *dev = to_c4iw_dev(cm_id->device); struct c4iw_ep *ep = NULL; struct rtentry *rt; - struct toedev *tdev; CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id); @@ -2280,8 +2190,6 @@ int c4iw_connect(struct iw_cm_id *cm_id, ep->com.thread = curthread; ep->com.so = cm_id->so; - init_sock(&ep->com); - /* find a route */ rt = find_route( cm_id->local_addr.sin_addr.s_addr, @@ -2297,22 +2205,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, goto fail2; } - if (!(rt->rt_ifp->if_capenable & IFCAP_TOE)) { - - CTR2(KTR_IW_CXGBE, "%s:cc8 %p", __func__, ep); - printf("%s - interface not TOE capable.\n", __func__); - close_socket(&ep->com, 0); + if (!(rt->rt_ifp->if_capenable & IFCAP_TOE) || + TOEDEV(rt->rt_ifp) == NULL) { err = -ENOPROTOOPT; goto fail3; } - tdev = TOEDEV(rt->rt_ifp); - - if (tdev == NULL) { - - CTR2(KTR_IW_CXGBE, "%s:cc9 %p", __func__, ep); - printf("%s - No toedev for interface.\n", __func__); - goto fail3; - } RTFREE(rt); state_set(&ep->com, CONNECTING); @@ -2323,19 +2220,18 @@ int c4iw_connect(struct iw_cm_id *cm_id, ep->com.thread); if (!err) { - CTR2(KTR_IW_CXGBE, "%s:cca %p", __func__, ep); + init_iwarp_socket(cm_id->so, &ep->com); goto out; } else { - close_socket(&ep->com, 0); goto fail2; } fail3: - CTR2(KTR_IW_CXGBE, "%s:ccb %p", __func__, ep); RTFREE(rt); fail2: deref_cm_id(&ep->com); c4iw_put_ep(&ep->com); + ep = NULL; /* CTR shouldn't display already-freed ep. */ out: CTR2(KTR_IW_CXGBE, "%s:ccE %p", __func__, ep); return err; @@ -2479,7 +2375,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *e if (!ep->parent_ep) __state_set(&ep->com, MORIBUND); - ret = shutdown_socket(&ep->com); + ret = sodisconnect(ep->com.so); } if (ret) { Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri Mar 3 17:53:22 2017 (r314605) +++ stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri Mar 3 17:57:17 2017 (r314606) @@ -754,7 +754,6 @@ struct c4iw_ep_common { int rpl_done; struct thread *thread; struct socket *so; - struct mutex so_mutex; }; struct c4iw_listen_ep { Modified: stable/10/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/cma.c Fri Mar 3 17:53:22 2017 (r314605) +++ stable/10/sys/ofed/drivers/infiniband/core/cma.c Fri Mar 3 17:57:17 2017 (r314606) @@ -962,8 +962,6 @@ static void cma_release_port(struct rdma kfree(bind_list); } mutex_unlock(&lock); - if (id_priv->sock) - sock_release(id_priv->sock); } static void cma_leave_mc_groups(struct rdma_id_private *id_priv) Modified: stable/10/sys/ofed/drivers/infiniband/core/iwcm.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/iwcm.c Fri Mar 3 17:53:22 2017 (r314605) +++ stable/10/sys/ofed/drivers/infiniband/core/iwcm.c Fri Mar 3 17:57:17 2017 (r314606) @@ -525,24 +525,15 @@ iw_init_sock(struct iw_cm_id *cm_id) } static int -iw_close_socket(struct iw_cm_id *cm_id, int close) +iw_uninit_socket(struct iw_cm_id *cm_id) { struct socket *so = cm_id->so; - int rc; - SOCK_LOCK(so); soupcall_clear(so, SO_RCV); SOCK_UNLOCK(so); - if (close) - rc = soclose(so); - else - rc = soshutdown(so, SHUT_WR | SHUT_RD); - - cm_id->so = NULL; - - return rc; + return (0); } static int @@ -551,18 +542,17 @@ iw_create_listen(struct iw_cm_id *cm_id, int rc; iw_init_sock(cm_id); - rc = solisten(cm_id->so, backlog, curthread); + rc = -solisten(cm_id->so, backlog, curthread); if (rc != 0) - iw_close_socket(cm_id, 0); - return rc; + iw_uninit_socket(cm_id); + return (rc); } static int iw_destroy_listen(struct iw_cm_id *cm_id) { - int rc; - rc = iw_close_socket(cm_id, 0); - return rc; + + return (iw_uninit_socket(cm_id)); } @@ -660,6 +650,9 @@ void iw_destroy_cm_id(struct iw_cm_id *c wait_for_completion(&cm_id_priv->destroy_comp); + if (cm_id->so) + sock_release(cm_id->so); + free_cm_id(cm_id_priv); } EXPORT_SYMBOL(iw_destroy_cm_id); From owner-svn-src-stable-10@freebsd.org Fri Mar 3 21:41:19 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 117B9CF7CAE; Fri, 3 Mar 2017 21:41:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id D08E6105C; Fri, 3 Mar 2017 21:41:18 +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 v23LfH0b093639; Fri, 3 Mar 2017 21:41:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23LfHij093638; Fri, 3 Mar 2017 21:41:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201703032141.v23LfHij093638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 3 Mar 2017 21:41:17 +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: r314632 - stable/10/usr.bin/timeout X-SVN-Group: stable-10 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.23 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, 03 Mar 2017 21:41:19 -0000 Author: bdrewery Date: Fri Mar 3 21:41:17 2017 New Revision: 314632 URL: https://svnweb.freebsd.org/changeset/base/314632 Log: MFC r313867,r313869,r313870,r314001: r313867: Add history and Authors section in the manpage r313869: Also add vsevolod@ in the authors r313870: Use full name for the month r314001: Make it more clear that -k sends SIGKILL, not the -s signal. Modified: stable/10/usr.bin/timeout/timeout.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/timeout/timeout.1 ============================================================================== --- stable/10/usr.bin/timeout/timeout.1 Fri Mar 3 21:39:36 2017 (r314631) +++ stable/10/usr.bin/timeout/timeout.1 Fri Mar 3 21:41:17 2017 (r314632) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 28, 2014 +.Dd February 20, 2017 .Dt TIMEOUT 1 .Os .Sh NAME @@ -68,7 +68,9 @@ By default, .Ar SIGTERM . is sent. .It Fl k Ar time , Fl -kill-after Ar time -Send a second kill signal if +Send a +.Ar SIGKILL +signal if .Ar command is still running after .Ar time @@ -127,3 +129,12 @@ the exit status return is 125. .Sh SEE ALSO .Xr kill 1 , .Xr signal 3 +.Sh HISTORY +The +.Nm +command first appeared in +.Fx 10.3 . +.Sh AUTHORS +.An Baptiste Daroussin Aq Mt bapt@FreeBSD.org +and +.An Vsevolod Stakhov Aq Mt vsevolod@FreeBSD.org From owner-svn-src-stable-10@freebsd.org Sat Mar 4 12:04:26 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77E0CCF7FCB; Sat, 4 Mar 2017 12:04:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id 40B931A51; Sat, 4 Mar 2017 12:04:26 +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 v24C4Pbp047591; Sat, 4 Mar 2017 12:04:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v24C4PPk047590; Sat, 4 Mar 2017 12:04:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703041204.v24C4PPk047590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 4 Mar 2017 12:04: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: r314662 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 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.23 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, 04 Mar 2017 12:04:26 -0000 Author: avg Date: Sat Mar 4 12:04:24 2017 New Revision: 314662 URL: https://svnweb.freebsd.org/changeset/base/314662 Log: MFC r314357: edge-triggered interrupt mode is set by clearing APIC_LVT_TM Modified: stable/10/sys/x86/x86/local_apic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/local_apic.c ============================================================================== --- stable/10/sys/x86/x86/local_apic.c Sat Mar 4 12:04:19 2017 (r314661) +++ stable/10/sys/x86/x86/local_apic.c Sat Mar 4 12:04:24 2017 (r314662) @@ -206,7 +206,7 @@ lvt_mode(struct lapic *la, u_int pin, ui if (!lvt->lvt_edgetrigger) { printf("lapic%u: Forcing LINT%u to edge trigger\n", la->la_id, pin); - value |= APIC_LVT_TM; + value &= ~APIC_LVT_TM; } /* Use a vector of 0. */ break; From owner-svn-src-stable-10@freebsd.org Sat Mar 4 12:05:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B940CF8115; Sat, 4 Mar 2017 12:05:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id BF9BE1CF0; Sat, 4 Mar 2017 12:05:51 +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 v24C5owc047777; Sat, 4 Mar 2017 12:05:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v24C5oqx047773; Sat, 4 Mar 2017 12:05:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703041205.v24C5oqx047773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 4 Mar 2017 12:05:50 +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: r314664 - stable/10/sys/vm X-SVN-Group: stable-10 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.23 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, 04 Mar 2017 12:05:52 -0000 Author: avg Date: Sat Mar 4 12:05:50 2017 New Revision: 314664 URL: https://svnweb.freebsd.org/changeset/base/314664 Log: MFC r314272: call vm_lowmem hook in uma_reclaim_worker Modified: stable/10/sys/vm/uma_core.c stable/10/sys/vm/vm_kern.c stable/10/sys/vm/vm_pageout.c stable/10/sys/vm/vm_pageout.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/uma_core.c ============================================================================== --- stable/10/sys/vm/uma_core.c Sat Mar 4 12:05:46 2017 (r314663) +++ stable/10/sys/vm/uma_core.c Sat Mar 4 12:05:50 2017 (r314664) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -3244,6 +3245,9 @@ uma_reclaim_worker(void *arg __unused) "umarcl", 0); if (uma_reclaim_needed) { uma_reclaim_needed = 0; + sx_xunlock(&uma_drain_lock); + EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM); + sx_xlock(&uma_drain_lock); uma_reclaim_locked(true); } } Modified: stable/10/sys/vm/vm_kern.c ============================================================================== --- stable/10/sys/vm/vm_kern.c Sat Mar 4 12:05:46 2017 (r314663) +++ stable/10/sys/vm/vm_kern.c Sat Mar 4 12:05:50 2017 (r314664) @@ -542,11 +542,13 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &i, 0, req); if (error) return (error); - if (i) - EVENTHANDLER_INVOKE(vm_lowmem, 0); + if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0) + return (EINVAL); + if (i != 0) + EVENTHANDLER_INVOKE(vm_lowmem, i); return (0); } SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0, - debug_vm_lowmem, "I", "set to trigger vm_lowmem event"); + debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); #endif Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Sat Mar 4 12:05:46 2017 (r314663) +++ stable/10/sys/vm/vm_pageout.c Sat Mar 4 12:05:50 2017 (r314664) @@ -962,7 +962,7 @@ vm_pageout_scan(struct vm_domain *vmd, i * Decrease registered cache sizes. */ SDT_PROBE0(vm, , , vm__lowmem_scan); - EVENTHANDLER_INVOKE(vm_lowmem, 0); + EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES); /* * We do this explicitly after the caches have been * drained above. Modified: stable/10/sys/vm/vm_pageout.h ============================================================================== --- stable/10/sys/vm/vm_pageout.h Sat Mar 4 12:05:46 2017 (r314663) +++ stable/10/sys/vm/vm_pageout.h Sat Mar 4 12:05:50 2017 (r314664) @@ -87,6 +87,12 @@ extern int vm_pageout_page_count; #define VM_OOM_SWAPZ 2 /* + * vm_lowmem flags. + */ +#define VM_LOW_KMEM 0x01 +#define VM_LOW_PAGES 0x02 + +/* * Exported routines. */ From owner-svn-src-stable-10@freebsd.org Sat Mar 4 13:03:40 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 362AFCF959D; Sat, 4 Mar 2017 13:03:40 +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 mx1.freebsd.org (Postfix) with ESMTPS id C7F831D6F; Sat, 4 Mar 2017 13:03:39 +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 v24D3c3S072801; Sat, 4 Mar 2017 13:03:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v24D3Vfi072728; Sat, 4 Mar 2017 13:03:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703041303.v24D3Vfi072728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 4 Mar 2017 13:03:31 +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: r314667 - in stable/10/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/fs/zfs cddl/dev/profile compat/ndis contrib/ipfilter/netinet dev/a... X-SVN-Group: stable-10 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.23 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, 04 Mar 2017 13:03:40 -0000 Author: avg Date: Sat Mar 4 13:03:31 2017 New Revision: 314667 URL: https://svnweb.freebsd.org/changeset/base/314667 Log: MFC r283291: don't use CALLOUT_MPSAFE with callout_init() The main purpose of this MFC is to reduce conflicts for other merges. Parts of the original change have already "trickled down" via individual MFCs. Modified: stable/10/sys/amd64/amd64/mp_watchdog.c stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/10/sys/cddl/dev/profile/profile.c stable/10/sys/compat/ndis/subr_ntoskrnl.c stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/10/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c stable/10/sys/dev/ath/if_ath.c stable/10/sys/dev/ce/if_ce.c stable/10/sys/dev/cp/if_cp.c stable/10/sys/dev/ctau/if_ct.c stable/10/sys/dev/cx/if_cx.c stable/10/sys/dev/cxgb/cxgb_main.c stable/10/sys/dev/cxgb/cxgb_sge.c stable/10/sys/dev/dcons/dcons_os.c stable/10/sys/dev/drm2/drm_irq.c stable/10/sys/dev/drm2/i915/intel_display.c stable/10/sys/dev/glxsb/glxsb.c stable/10/sys/dev/gxemul/cons/gxemul_cons.c stable/10/sys/dev/hifn/hifn7751.c stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/if_ndis/if_ndis.c stable/10/sys/dev/isci/isci_io_request.c stable/10/sys/dev/mfi/mfi.c stable/10/sys/dev/mwl/if_mwl.c stable/10/sys/dev/nand/nandsim_chip.c stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c stable/10/sys/dev/nxge/if_nxge.c stable/10/sys/dev/oce/oce_if.c stable/10/sys/dev/patm/if_patm_attach.c stable/10/sys/dev/rndtest/rndtest.c stable/10/sys/dev/safe/safe.c stable/10/sys/dev/sound/midi/mpu401.c stable/10/sys/dev/sound/pci/atiixp.c stable/10/sys/dev/sound/pci/es137x.c stable/10/sys/dev/sound/pci/hda/hdaa.c stable/10/sys/dev/sound/pci/hda/hdac.c stable/10/sys/dev/sound/pci/via8233.c stable/10/sys/dev/twa/tw_osl_freebsd.c stable/10/sys/dev/tws/tws.c stable/10/sys/dev/ubsec/ubsec.c stable/10/sys/dev/virtio/random/virtio_random.c stable/10/sys/dev/xen/netfront/netfront.c stable/10/sys/fs/nfs/nfs_commonport.c stable/10/sys/gdb/gdb_cons.c stable/10/sys/geom/gate/g_gate.c stable/10/sys/geom/journal/g_journal.c stable/10/sys/geom/mirror/g_mirror.c stable/10/sys/geom/raid3/g_raid3.c stable/10/sys/geom/sched/gs_rr.c stable/10/sys/i386/i386/mp_watchdog.c stable/10/sys/kern/init_main.c stable/10/sys/kern/kern_synch.c stable/10/sys/kern/kern_thread.c stable/10/sys/kern/subr_vmem.c stable/10/sys/kern/uipc_domain.c stable/10/sys/mips/cavium/octe/ethernet.c stable/10/sys/mips/cavium/octeon_rnd.c stable/10/sys/mips/nlm/dev/net/xlpge.c stable/10/sys/mips/rmi/dev/xlr/rge.c stable/10/sys/net/if_spppsubr.c stable/10/sys/net80211/ieee80211_ht.c stable/10/sys/net80211/ieee80211_hwmp.c stable/10/sys/net80211/ieee80211_mesh.c stable/10/sys/net80211/ieee80211_node.c stable/10/sys/net80211/ieee80211_proto.c stable/10/sys/netgraph/netflow/ng_netflow.c stable/10/sys/netgraph/netgraph.h stable/10/sys/netinet/in_pcb.c stable/10/sys/netinet/ip_mroute.c stable/10/sys/netinet/tcp_hostcache.c stable/10/sys/netinet/tcp_subr.c stable/10/sys/netinet6/in6_rmx.c stable/10/sys/netpfil/ipfw/ip_dummynet.c stable/10/sys/netpfil/ipfw/ip_fw_dynamic.c stable/10/sys/netpfil/pf/if_pfsync.c stable/10/sys/ofed/include/linux/timer.h stable/10/sys/ofed/include/linux/workqueue.h stable/10/sys/powerpc/mambo/mambo_console.c stable/10/sys/powerpc/pseries/phyp_console.c stable/10/sys/sys/callout.h stable/10/sys/vm/uma_core.c stable/10/sys/x86/x86/mca.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/mp_watchdog.c ============================================================================== --- stable/10/sys/amd64/amd64/mp_watchdog.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/amd64/amd64/mp_watchdog.c Sat Mar 4 13:03:31 2017 (r314667) @@ -86,7 +86,7 @@ static void watchdog_init(void *arg) { - callout_init(&watchdog_callout, CALLOUT_MPSAFE); + callout_init(&watchdog_callout, 1); if (watchdog_cpu != -1) watchdog_change(watchdog_cpu); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Mar 4 13:03:31 2017 (r314667) @@ -14284,8 +14284,8 @@ dtrace_state_create(struct cdev *dev) state->dts_cleaner = CYCLIC_NONE; state->dts_deadman = CYCLIC_NONE; #else - callout_init(&state->dts_cleaner, CALLOUT_MPSAFE); - callout_init(&state->dts_deadman, CALLOUT_MPSAFE); + callout_init(&state->dts_cleaner, 1); + callout_init(&state->dts_deadman, 1); #endif state->dts_vstate.dtvs_state = state; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Mar 4 13:03:31 2017 (r314667) @@ -698,7 +698,7 @@ spa_add(const char *name, nvlist_t *conf mutex_exit(&cpu_lock); #else /* !illumos */ #ifdef _KERNEL - callout_init(&spa->spa_deadman_cycid, CALLOUT_MPSAFE); + callout_init(&spa->spa_deadman_cycid, 1); #endif #endif refcount_create(&spa->spa_refcount); Modified: stable/10/sys/cddl/dev/profile/profile.c ============================================================================== --- stable/10/sys/cddl/dev/profile/profile.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/cddl/dev/profile/profile.c Sat Mar 4 13:03:31 2017 (r314667) @@ -330,7 +330,7 @@ profile_create(hrtime_t interval, char * prof->prof_cyclic = CYCLIC_NONE; #else prof->prof_interval = nsec_to_sbt(interval); - callout_init(&prof->prof_cyclic, CALLOUT_MPSAFE); + callout_init(&prof->prof_cyclic, 1); #endif prof->prof_kind = kind; prof->prof_id = dtrace_probe_create(profile_id, @@ -578,7 +578,7 @@ profile_enable_omni(profile_probe_t *pro pcpu->profc_probe = prof; pcpu->profc_expected = sbinuptime() + prof->prof_interval; pcpu->profc_interval = prof->prof_interval; - callout_init(&pcpu->profc_cyclic, CALLOUT_MPSAFE); + callout_init(&pcpu->profc_cyclic, 1); callout_reset_sbt_on(&pcpu->profc_cyclic, pcpu->profc_expected, 0, profile_fire, pcpu, cpu, C_DIRECT_EXEC | C_ABSOLUTE); Modified: stable/10/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- stable/10/sys/compat/ndis/subr_ntoskrnl.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/compat/ndis/subr_ntoskrnl.c Sat Mar 4 13:03:31 2017 (r314667) @@ -3746,7 +3746,7 @@ ntoskrnl_insert_timer(timer, ticks) timer->k_callout = c; - callout_init(c, CALLOUT_MPSAFE); + callout_init(c, 1); callout_reset(c, ticks, ntoskrnl_timercall, timer); } Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Mar 4 13:03:31 2017 (r314667) @@ -190,7 +190,7 @@ ipf_timer_func(arg) #if 0 softc->ipf_slow_ch = timeout(ipf_timer_func, softc, hz/2); #endif - callout_init(&softc->ipf_slow_ch, CALLOUT_MPSAFE); + callout_init(&softc->ipf_slow_ch, 1); callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT, ipf_timer_func, softc); @@ -238,7 +238,7 @@ ipfattach(softc) softc->ipf_slow_ch = timeout(ipf_timer_func, softc, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT); #endif - callout_init(&softc->ipf_slow_ch, CALLOUT_MPSAFE); + callout_init(&softc->ipf_slow_ch, 1); callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT, ipf_timer_func, softc); return 0; Modified: stable/10/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c ============================================================================== --- stable/10/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c Sat Mar 4 13:03:31 2017 (r314667) @@ -454,11 +454,11 @@ altera_jtag_uart_attach(struct altera_jt aju_intr_readable_enable(sc); AJU_UNLOCK(sc); } else { - callout_init(&sc->ajus_io_callout, CALLOUT_MPSAFE); + callout_init(&sc->ajus_io_callout, 1); callout_reset(&sc->ajus_io_callout, AJU_IO_POLLINTERVAL, aju_io_callout, sc); } - callout_init(&sc->ajus_ac_callout, CALLOUT_MPSAFE); + callout_init(&sc->ajus_ac_callout, 1); callout_reset(&sc->ajus_ac_callout, AJU_AC_POLLINTERVAL, aju_ac_callout, sc); return (0); Modified: stable/10/sys/dev/ath/if_ath.c ============================================================================== --- stable/10/sys/dev/ath/if_ath.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/ath/if_ath.c Sat Mar 4 13:03:31 2017 (r314667) @@ -547,7 +547,7 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_ledstate = 1; sc->sc_ledon = 0; /* low true */ sc->sc_ledidle = (2700*hz)/1000; /* 2.7sec */ - callout_init(&sc->sc_ledtimer, CALLOUT_MPSAFE); + callout_init(&sc->sc_ledtimer, 1); /* * Don't setup hardware-based blinking. Modified: stable/10/sys/dev/ce/if_ce.c ============================================================================== --- stable/10/sys/dev/ce/if_ce.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/ce/if_ce.c Sat Mar 4 13:03:31 2017 (r314667) @@ -103,10 +103,6 @@ __FBSDID("$FreeBSD$"); #define CE_DEBUG2(d,s) ({if (d->chan->debug>1) {\ printf ("%s: ", d->name); printf s;}}) -#ifndef CALLOUT_MPSAFE -#define CALLOUT_MPSAFE 0 -#endif - #ifndef IF_DRAIN #define IF_DRAIN(ifq) do { \ struct mbuf *m; \ @@ -625,7 +621,7 @@ static int ce_attach (device_t dev) return (ENXIO); } #if __FreeBSD_version >= 500000 - callout_init (&led_timo[unit], CALLOUT_MPSAFE); + callout_init (&led_timo[unit], 1); #else callout_init (&led_timo[unit]); #endif @@ -677,7 +673,7 @@ static int ce_attach (device_t dev) continue; d = c->sys; - callout_init (&d->timeout_handle, CALLOUT_MPSAFE); + callout_init (&d->timeout_handle, 1); #ifdef NETGRAPH if (ng_make_node_common (&typestruct, &d->node) != 0) { printf ("%s: cannot make common node\n", d->name); @@ -2580,7 +2576,7 @@ static int ce_modevent (module_t mod, in cdevsw_add (&ce_cdevsw); #endif #if __FreeBSD_version >= 500000 - callout_init (&timeout_handle, CALLOUT_MPSAFE); + callout_init (&timeout_handle, 1); #else callout_init (&timeout_handle); #endif Modified: stable/10/sys/dev/cp/if_cp.c ============================================================================== --- stable/10/sys/dev/cp/if_cp.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/cp/if_cp.c Sat Mar 4 13:03:31 2017 (r314667) @@ -461,7 +461,7 @@ static int cp_attach (device_t dev) splx (s); return (ENXIO); } - callout_init (&led_timo[unit], CALLOUT_MPSAFE); + callout_init (&led_timo[unit], 1); error = bus_setup_intr (dev, bd->cp_irq, INTR_TYPE_NET|INTR_MPSAFE, NULL, cp_intr, bd, &bd->cp_intrhand); @@ -490,7 +490,7 @@ static int cp_attach (device_t dev) d->board = b; d->chan = c; c->sys = d; - callout_init (&d->timeout_handle, CALLOUT_MPSAFE); + callout_init (&d->timeout_handle, 1); #ifdef NETGRAPH if (ng_make_node_common (&typestruct, &d->node) != 0) { printf ("%s: cannot make common node\n", d->name); @@ -2240,7 +2240,7 @@ static int cp_modevent (module_t mod, in printf ("Failed to register ng_cp\n"); #endif ++load_count; - callout_init (&timeout_handle, CALLOUT_MPSAFE); + callout_init (&timeout_handle, 1); callout_reset (&timeout_handle, hz*5, cp_timeout, 0); break; case MOD_UNLOAD: Modified: stable/10/sys/dev/ctau/if_ct.c ============================================================================== --- stable/10/sys/dev/ctau/if_ct.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/ctau/if_ct.c Sat Mar 4 13:03:31 2017 (r314667) @@ -663,7 +663,7 @@ static int ct_attach (device_t dev) return ENXIO; } - callout_init (&led_timo[unit], CALLOUT_MPSAFE); + callout_init (&led_timo[unit], 1); s = splimp (); if (bus_setup_intr (dev, bd->irq_res, INTR_TYPE_NET|INTR_MPSAFE, @@ -702,7 +702,7 @@ static int ct_attach (device_t dev) c->sys = d; channel [b->num*NCHAN + c->num] = d; sprintf (d->name, "ct%d.%d", b->num, c->num); - callout_init (&d->timeout_handle, CALLOUT_MPSAFE); + callout_init (&d->timeout_handle, 1); #ifdef NETGRAPH if (ng_make_node_common (&typestruct, &d->node) != 0) { @@ -2180,7 +2180,7 @@ static int ct_modevent (module_t mod, in printf ("Failed to register ng_ct\n"); #endif ++load_count; - callout_init (&timeout_handle, CALLOUT_MPSAFE); + callout_init (&timeout_handle, 1); callout_reset (&timeout_handle, hz*5, ct_timeout, 0); break; case MOD_UNLOAD: Modified: stable/10/sys/dev/cx/if_cx.c ============================================================================== --- stable/10/sys/dev/cx/if_cx.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/cx/if_cx.c Sat Mar 4 13:03:31 2017 (r314667) @@ -762,7 +762,7 @@ static int cx_attach (device_t dev) return ENXIO; } b->sys = bd; - callout_init (&led_timo[b->num], CALLOUT_MPSAFE); + callout_init (&led_timo[b->num], 1); s = splhigh (); if (bus_setup_intr (dev, bd->irq_res, INTR_TYPE_NET|INTR_MPSAFE, @@ -812,7 +812,7 @@ static int cx_attach (device_t dev) case T_UNIV_RS232: case T_UNIV_RS449: case T_UNIV_V35: - callout_init (&d->timeout_handle, CALLOUT_MPSAFE); + callout_init (&d->timeout_handle, 1); #ifdef NETGRAPH if (ng_make_node_common (&typestruct, &d->node) != 0) { printf ("%s: cannot make common node\n", d->name); @@ -883,7 +883,7 @@ static int cx_attach (device_t dev) ttycreate(d->tty, TS_CALLOUT, "x%r%r", b->num, c->num); d->devt = make_dev (&cx_cdevsw, b->num*NCHAN + c->num + 64, UID_ROOT, GID_WHEEL, 0600, "cx%d", b->num*NCHAN + c->num); d->devt->si_drv1 = d; - callout_init (&d->dcd_timeout_handle, CALLOUT_MPSAFE); + callout_init (&d->dcd_timeout_handle, 1); } splx (s); @@ -2514,7 +2514,7 @@ static int cx_modevent (module_t mod, in #endif ++load_count; - callout_init (&timeout_handle, CALLOUT_MPSAFE); + callout_init (&timeout_handle, 1); callout_reset (&timeout_handle, hz*5, cx_timeout, 0); /* Software interrupt. */ swi_add(&tty_intr_event, "cx", cx_softintr, NULL, SWI_TTY, Modified: stable/10/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/10/sys/dev/cxgb/cxgb_main.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/cxgb/cxgb_main.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1009,7 +1009,7 @@ cxgb_port_attach(device_t dev) device_get_unit(device_get_parent(dev)), p->port_id); PORT_LOCK_INIT(p, p->lockbuf); - callout_init(&p->link_check_ch, CALLOUT_MPSAFE); + callout_init(&p->link_check_ch, 1); TASK_INIT(&p->link_check_task, 0, check_link_status, p); /* Allocate an ifnet object and set it up */ Modified: stable/10/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/10/sys/dev/cxgb/cxgb_sge.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/cxgb/cxgb_sge.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1013,7 +1013,7 @@ sge_timer_cb(void *arg) int t3_sge_init_adapter(adapter_t *sc) { - callout_init(&sc->sge_timer_ch, CALLOUT_MPSAFE); + callout_init(&sc->sge_timer_ch, 1); callout_reset(&sc->sge_timer_ch, TX_RECLAIM_PERIOD, sge_timer_cb, sc); TASK_INIT(&sc->slow_intr_task, 0, sge_slow_intr_handler, sc); return (0); Modified: stable/10/sys/dev/dcons/dcons_os.c ============================================================================== --- stable/10/sys/dev/dcons/dcons_os.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/dcons/dcons_os.c Sat Mar 4 13:03:31 2017 (r314667) @@ -374,7 +374,7 @@ dcons_attach(void) dcons_attach_port(DCONS_CON, "dcons", 0); dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB); - callout_init(&dcons_callout, CALLOUT_MPSAFE); + callout_init(&dcons_callout, 1); polltime = hz / poll_hz; callout_reset(&dcons_callout, polltime, dcons_timeout, NULL); return(0); Modified: stable/10/sys/dev/drm2/drm_irq.c ============================================================================== --- stable/10/sys/dev/drm2/drm_irq.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/drm2/drm_irq.c Sat Mar 4 13:03:31 2017 (r314667) @@ -210,7 +210,7 @@ int drm_vblank_init(struct drm_device *d { int i, ret = -ENOMEM; - callout_init(&dev->vblank_disable_callout, CALLOUT_MPSAFE); + callout_init(&dev->vblank_disable_callout, 1); mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); mtx_init(&dev->vblank_time_lock, "drmvtl", NULL, MTX_DEF); Modified: stable/10/sys/dev/drm2/i915/intel_display.c ============================================================================== --- stable/10/sys/dev/drm2/i915/intel_display.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/drm2/i915/intel_display.c Sat Mar 4 13:03:31 2017 (r314667) @@ -6449,7 +6449,7 @@ static void intel_crtc_init(struct drm_d intel_crtc->busy = false; - callout_init(&intel_crtc->idle_callout, CALLOUT_MPSAFE); + callout_init(&intel_crtc->idle_callout, 1); } int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, @@ -7038,7 +7038,7 @@ void intel_modeset_init(struct drm_devic intel_setup_outputs(dev); TASK_INIT(&dev_priv->idle_task, 0, intel_idle_update, dev_priv); - callout_init(&dev_priv->idle_callout, CALLOUT_MPSAFE); + callout_init(&dev_priv->idle_callout, 1); } void intel_modeset_gem_init(struct drm_device *dev) Modified: stable/10/sys/dev/glxsb/glxsb.c ============================================================================== --- stable/10/sys/dev/glxsb/glxsb.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/glxsb/glxsb.c Sat Mar 4 13:03:31 2017 (r314667) @@ -331,7 +331,7 @@ glxsb_attach(device_t dev) sc->sc_rnghz = hz / 100; else sc->sc_rnghz = 1; - callout_init(&sc->sc_rngco, CALLOUT_MPSAFE); + callout_init(&sc->sc_rngco, 1); glxsb_rnd(sc); return (0); Modified: stable/10/sys/dev/gxemul/cons/gxemul_cons.c ============================================================================== --- stable/10/sys/dev/gxemul/cons/gxemul_cons.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/gxemul/cons/gxemul_cons.c Sat Mar 4 13:03:31 2017 (r314667) @@ -279,7 +279,7 @@ gxemul_cons_ttyinit(void *unused) tp = tty_alloc(&gxemul_cons_ttydevsw, NULL); tty_init_console(tp, 0); tty_makedev(tp, NULL, "%s", "ttyu0"); - callout_init(&gxemul_cons_callout, CALLOUT_MPSAFE); + callout_init(&gxemul_cons_callout, 1); callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, gxemul_cons_timeout, tp); Modified: stable/10/sys/dev/hifn/hifn7751.c ============================================================================== --- stable/10/sys/dev/hifn/hifn7751.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/hifn/hifn7751.c Sat Mar 4 13:03:31 2017 (r314667) @@ -590,7 +590,7 @@ hifn_attach(device_t dev) if (sc->sc_flags & (HIFN_HAS_PUBLIC | HIFN_HAS_RNG)) hifn_init_pubrng(sc); - callout_init(&sc->sc_tickto, CALLOUT_MPSAFE); + callout_init(&sc->sc_tickto, 1); callout_reset(&sc->sc_tickto, hz, hifn_tick, sc); return (0); @@ -768,7 +768,7 @@ hifn_init_pubrng(struct hifn_softc *sc) sc->sc_rnghz = hz / 100; else sc->sc_rnghz = 1; - callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); + callout_init(&sc->sc_rngto, 1); callout_reset(&sc->sc_rngto, sc->sc_rnghz, hifn_rng, sc); } Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1553,7 +1553,7 @@ storvsc_action(struct cam_sim *sim, unio #ifdef notyet if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) { - callout_init(&reqp->callout, CALLOUT_MPSAFE); + callout_init(&reqp->callout, 1); callout_reset_sbt(&reqp->callout, SBT_1MS * ccb->ccb_h.timeout, 0, storvsc_timeout, reqp, 0); Modified: stable/10/sys/dev/if_ndis/if_ndis.c ============================================================================== --- stable/10/sys/dev/if_ndis/if_ndis.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/if_ndis/if_ndis.c Sat Mar 4 13:03:31 2017 (r314667) @@ -557,7 +557,7 @@ ndis_attach(dev) InitializeListHead(&sc->ndis_shlist); InitializeListHead(&sc->ndisusb_tasklist); InitializeListHead(&sc->ndisusb_xferdonelist); - callout_init(&sc->ndis_stat_callout, CALLOUT_MPSAFE); + callout_init(&sc->ndis_stat_callout, 1); if (sc->ndis_iftype == PCMCIABus) { error = ndis_alloc_amem(sc); @@ -733,7 +733,7 @@ ndis_attach(dev) uint32_t arg; int r; - callout_init(&sc->ndis_scan_callout, CALLOUT_MPSAFE); + callout_init(&sc->ndis_scan_callout, 1); ifp->if_ioctl = ndis_ioctl_80211; ic->ic_ifp = ifp; Modified: stable/10/sys/dev/isci/isci_io_request.c ============================================================================== --- stable/10/sys/dev/isci/isci_io_request.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/isci/isci_io_request.c Sat Mar 4 13:03:31 2017 (r314667) @@ -680,7 +680,7 @@ isci_request_construct(struct ISCI_REQUE request->dma_tag = io_buffer_dma_tag; request->physical_address = physical_address; bus_dmamap_create(request->dma_tag, 0, &request->dma_map); - callout_init(&request->timer, CALLOUT_MPSAFE); + callout_init(&request->timer, 1); } static void Modified: stable/10/sys/dev/mfi/mfi.c ============================================================================== --- stable/10/sys/dev/mfi/mfi.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/mfi/mfi.c Sat Mar 4 13:03:31 2017 (r314667) @@ -788,7 +788,7 @@ mfi_attach(struct mfi_softc *sc) bus_generic_attach(sc->mfi_dev); /* Start the timeout watchdog */ - callout_init(&sc->mfi_watchdog_callout, CALLOUT_MPSAFE); + callout_init(&sc->mfi_watchdog_callout, 1); callout_reset(&sc->mfi_watchdog_callout, mfi_cmd_timeout * hz, mfi_timeout, sc); Modified: stable/10/sys/dev/mwl/if_mwl.c ============================================================================== --- stable/10/sys/dev/mwl/if_mwl.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/mwl/if_mwl.c Sat Mar 4 13:03:31 2017 (r314667) @@ -368,7 +368,7 @@ mwl_attach(uint16_t devid, struct mwl_so if (error != 0) /* NB: mwl_setupdma prints msg */ goto bad1; - callout_init(&sc->sc_timer, CALLOUT_MPSAFE); + callout_init(&sc->sc_timer, 1); callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); sc->sc_tq = taskqueue_create("mwl_taskq", M_NOWAIT, Modified: stable/10/sys/dev/nand/nandsim_chip.c ============================================================================== --- stable/10/sys/dev/nand/nandsim_chip.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/nand/nandsim_chip.c Sat Mar 4 13:03:31 2017 (r314667) @@ -94,7 +94,7 @@ nandsim_chip_init(struct nandsim_softc* return (NULL); mtx_init(&chip->ns_lock, "nandsim lock", NULL, MTX_DEF); - callout_init(&chip->ns_callout, CALLOUT_MPSAFE); + callout_init(&chip->ns_callout, 1); STAILQ_INIT(&chip->nandsim_events); chip->chip_num = chip_num; Modified: stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/ntb/ntb_hw/ntb_hw.c Sat Mar 4 13:03:31 2017 (r314667) @@ -662,8 +662,8 @@ intel_ntb_attach(device_t device) ntb->msix_mw_idx = B2B_MW_DISABLED; /* Heartbeat timer for NTB_ATOM since there is no link interrupt */ - callout_init(&ntb->heartbeat_timer, CALLOUT_MPSAFE); - callout_init(&ntb->lr_timer, CALLOUT_MPSAFE); + callout_init(&ntb->heartbeat_timer, 1); + callout_init(&ntb->lr_timer, 1); callout_init(&ntb->peer_msix_work, 1); mtx_init(&ntb->db_mask_lock, "ntb hw bits", NULL, MTX_SPIN); Modified: stable/10/sys/dev/nxge/if_nxge.c ============================================================================== --- stable/10/sys/dev/nxge/if_nxge.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/nxge/if_nxge.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1743,7 +1743,7 @@ xge_device_init(xge_lldev_t *lldev, xge_ return; /* Initializing timer */ - callout_init(&lldev->timer, CALLOUT_MPSAFE); + callout_init(&lldev->timer, 1); xge_trace(XGE_TRACE, "Set MTU size"); status = xge_hal_device_mtu_set(hldev, ifnetp->if_mtu); Modified: stable/10/sys/dev/oce/oce_if.c ============================================================================== --- stable/10/sys/dev/oce/oce_if.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/oce/oce_if.c Sat Mar 4 13:03:31 2017 (r314667) @@ -341,7 +341,7 @@ oce_attach(device_t dev) oce_add_sysctls(sc); - callout_init(&sc->timer, CALLOUT_MPSAFE); + callout_init(&sc->timer, 1); rc = callout_reset(&sc->timer, 2 * hz, oce_local_timer, sc); if (rc) goto stats_free; Modified: stable/10/sys/dev/patm/if_patm_attach.c ============================================================================== --- stable/10/sys/dev/patm/if_patm_attach.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/patm/if_patm_attach.c Sat Mar 4 13:03:31 2017 (r314667) @@ -207,7 +207,7 @@ patm_attach(device_t dev) mtx_init(&sc->tst_lock, "tst lock", NULL, MTX_DEF); cv_init(&sc->vcc_cv, "vcc_close"); - callout_init(&sc->tst_callout, CALLOUT_MPSAFE); + callout_init(&sc->tst_callout, 1); sysctl_ctx_init(&sc->sysctl_ctx); Modified: stable/10/sys/dev/rndtest/rndtest.c ============================================================================== --- stable/10/sys/dev/rndtest/rndtest.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/rndtest/rndtest.c Sat Mar 4 13:03:31 2017 (r314667) @@ -98,7 +98,7 @@ rndtest_attach(device_t dev) #if __FreeBSD_version < 500000 callout_init(&rsp->rs_to); #else - callout_init(&rsp->rs_to, CALLOUT_MPSAFE); + callout_init(&rsp->rs_to, 1); #endif } else device_printf(dev, "rndtest_init: no memory for state block\n"); Modified: stable/10/sys/dev/safe/safe.c ============================================================================== --- stable/10/sys/dev/safe/safe.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/safe/safe.c Sat Mar 4 13:03:31 2017 (r314667) @@ -425,7 +425,7 @@ safe_attach(device_t dev) #endif safe_rng_init(sc); - callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); + callout_init(&sc->sc_rngto, 1); callout_reset(&sc->sc_rngto, hz*safe_rnginterval, safe_rng, sc); } #endif /* SAFE_NO_RNG */ Modified: stable/10/sys/dev/sound/midi/mpu401.c ============================================================================== --- stable/10/sys/dev/sound/midi/mpu401.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/sound/midi/mpu401.c Sat Mar 4 13:03:31 2017 (r314667) @@ -185,7 +185,7 @@ mpu401_init(kobj_class_t cls, void *cook kobj_init((kobj_t)m, cls); - callout_init(&m->timer, CALLOUT_MPSAFE); + callout_init(&m->timer, 1); m->si = softintr; m->cookie = cookie; Modified: stable/10/sys/dev/sound/pci/atiixp.c ============================================================================== --- stable/10/sys/dev/sound/pci/atiixp.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/sound/pci/atiixp.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1193,7 +1193,7 @@ atiixp_pci_attach(device_t dev) sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_atiixp softc"); sc->dev = dev; - callout_init(&sc->poll_timer, CALLOUT_MPSAFE); + callout_init(&sc->poll_timer, 1); sc->poll_ticks = 1; if (resource_int_value(device_get_name(sc->dev), Modified: stable/10/sys/dev/sound/pci/es137x.c ============================================================================== --- stable/10/sys/dev/sound/pci/es137x.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/sound/pci/es137x.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1741,7 +1741,7 @@ es_pci_attach(device_t dev) es->st = rman_get_bustag(es->reg); es->sh = rman_get_bushandle(es->reg); - callout_init(&es->poll_timer, CALLOUT_MPSAFE); + callout_init(&es->poll_timer, 1); es->poll_ticks = 1; if (resource_int_value(device_get_name(dev), Modified: stable/10/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- stable/10/sys/dev/sound/pci/hda/hdaa.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/sound/pci/hda/hdaa.c Sat Mar 4 13:03:31 2017 (r314667) @@ -6592,7 +6592,7 @@ hdaa_attach(device_t dev) devinfo->newquirks = -1; devinfo->newgpio = -1; devinfo->newgpo = -1; - callout_init(&devinfo->poll_jack, CALLOUT_MPSAFE); + callout_init(&devinfo->poll_jack, 1); devinfo->poll_ival = hz; hdaa_lock(devinfo); Modified: stable/10/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/10/sys/dev/sound/pci/hda/hdac.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/sound/pci/hda/hdac.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1116,7 +1116,7 @@ hdac_attach(device_t dev) sc->lock = snd_mtxcreate(device_get_nameunit(dev), "HDA driver mutex"); sc->dev = dev; TASK_INIT(&sc->unsolq_task, 0, hdac_unsolq_task, sc); - callout_init(&sc->poll_callout, CALLOUT_MPSAFE); + callout_init(&sc->poll_callout, 1); for (i = 0; i < HDAC_CODEC_MAX; i++) sc->codecs[i].dev = NULL; if (devid >= 0) { Modified: stable/10/sys/dev/sound/pci/via8233.c ============================================================================== --- stable/10/sys/dev/sound/pci/via8233.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/sound/pci/via8233.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1175,7 +1175,7 @@ via_attach(device_t dev) "snd_via8233 softc"); via->dev = dev; - callout_init(&via->poll_timer, CALLOUT_MPSAFE); + callout_init(&via->poll_timer, 1); via->poll_ticks = 1; if (resource_int_value(device_get_name(dev), Modified: stable/10/sys/dev/twa/tw_osl_freebsd.c ============================================================================== --- stable/10/sys/dev/twa/tw_osl_freebsd.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/twa/tw_osl_freebsd.c Sat Mar 4 13:03:31 2017 (r314667) @@ -423,8 +423,8 @@ twa_attach(device_t dev) } sc->watchdog_index = 0; - callout_init(&(sc->watchdog_callout[0]), CALLOUT_MPSAFE); - callout_init(&(sc->watchdog_callout[1]), CALLOUT_MPSAFE); + callout_init(&(sc->watchdog_callout[0]), 1); + callout_init(&(sc->watchdog_callout[1]), 1); callout_reset(&(sc->watchdog_callout[0]), 5*hz, twa_watchdog, &sc->ctlr_handle); return(0); Modified: stable/10/sys/dev/tws/tws.c ============================================================================== --- stable/10/sys/dev/tws/tws.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/tws/tws.c Sat Mar 4 13:03:31 2017 (r314667) @@ -198,7 +198,7 @@ tws_attach(device_t dev) mtx_init( &sc->sim_lock, "tws_sim_lock", NULL, MTX_DEF); mtx_init( &sc->gen_lock, "tws_gen_lock", NULL, MTX_DEF); mtx_init( &sc->io_lock, "tws_io_lock", NULL, MTX_DEF | MTX_RECURSE); - callout_init(&sc->stats_timer, CALLOUT_MPSAFE); + callout_init(&sc->stats_timer, 1); if ( tws_init_trace_q(sc) == FAILURE ) printf("trace init failure\n"); @@ -706,7 +706,7 @@ tws_init_reqs(struct tws_softc *sc, u_in sc->reqs[i].cmd_pkt->hdr.header_desc.size_header = 128; - callout_init(&sc->reqs[i].timeout, CALLOUT_MPSAFE); + callout_init(&sc->reqs[i].timeout, 1); sc->reqs[i].state = TWS_REQ_STATE_FREE; if ( i >= TWS_RESERVED_REQS ) tws_q_insert_tail(sc, &sc->reqs[i], TWS_FREE_Q); Modified: stable/10/sys/dev/ubsec/ubsec.c ============================================================================== --- stable/10/sys/dev/ubsec/ubsec.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/ubsec/ubsec.c Sat Mar 4 13:03:31 2017 (r314667) @@ -456,7 +456,7 @@ ubsec_attach(device_t dev) sc->sc_rnghz = hz / 100; else sc->sc_rnghz = 1; - callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); + callout_init(&sc->sc_rngto, 1); callout_reset(&sc->sc_rngto, sc->sc_rnghz, ubsec_rng, sc); skip_rng: ; Modified: stable/10/sys/dev/virtio/random/virtio_random.c ============================================================================== --- stable/10/sys/dev/virtio/random/virtio_random.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/virtio/random/virtio_random.c Sat Mar 4 13:03:31 2017 (r314667) @@ -129,7 +129,7 @@ vtrnd_attach(device_t dev) sc = device_get_softc(dev); sc->vtrnd_dev = dev; - callout_init(&sc->vtrnd_callout, CALLOUT_MPSAFE); + callout_init(&sc->vtrnd_callout, 1); virtio_set_feature_desc(dev, vtrnd_feature_desc); vtrnd_negotiate_features(sc); Modified: stable/10/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/10/sys/dev/xen/netfront/netfront.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/dev/xen/netfront/netfront.c Sat Mar 4 13:03:31 2017 (r314667) @@ -2132,7 +2132,7 @@ create_netdev(device_t dev) ifp->if_hw_tsomaxsegsize = PAGE_SIZE; ether_ifattach(ifp, np->mac); - callout_init(&np->xn_stat_ch, CALLOUT_MPSAFE); + callout_init(&np->xn_stat_ch, 1); netfront_carrier_off(np); return (0); Modified: stable/10/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonport.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/fs/nfs/nfs_commonport.c Sat Mar 4 13:03:31 2017 (r314667) @@ -609,7 +609,7 @@ nfscommon_modevent(module_t mod, int typ mtx_init(&nfs_req_mutex, "nfs_req_mutex", NULL, MTX_DEF); mtx_init(&nfsrv_nfsuserdsock.nr_mtx, "nfsuserd", NULL, MTX_DEF); - callout_init(&newnfsd_callout, CALLOUT_MPSAFE); + callout_init(&newnfsd_callout, 1); newnfs_init(); nfsd_call_nfscommon = nfssvc_nfscommon; loaded = 1; Modified: stable/10/sys/gdb/gdb_cons.c ============================================================================== --- stable/10/sys/gdb/gdb_cons.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/gdb/gdb_cons.c Sat Mar 4 13:03:31 2017 (r314667) @@ -77,7 +77,7 @@ gdb_cninit(struct consdev *cp) /* setup tx buffer and callout */ if (c->npending == -1) { c->npending = 0; - callout_init(&c->flush, CALLOUT_MPSAFE); + callout_init(&c->flush, 1); cp->cn_arg = c; } } Modified: stable/10/sys/geom/gate/g_gate.c ============================================================================== --- stable/10/sys/geom/gate/g_gate.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/geom/gate/g_gate.c Sat Mar 4 13:03:31 2017 (r314667) @@ -487,7 +487,7 @@ g_gate_create(struct g_gate_ctl_create * if (sc->sc_queue_size > G_GATE_MAX_QUEUE_SIZE) sc->sc_queue_size = G_GATE_MAX_QUEUE_SIZE; sc->sc_timeout = ggio->gctl_timeout; - callout_init(&sc->sc_callout, CALLOUT_MPSAFE); + callout_init(&sc->sc_callout, 1); mtx_lock(&g_gate_units_lock); sc->sc_unit = g_gate_getunit(ggio->gctl_unit, &error); Modified: stable/10/sys/geom/journal/g_journal.c ============================================================================== --- stable/10/sys/geom/journal/g_journal.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/geom/journal/g_journal.c Sat Mar 4 13:03:31 2017 (r314667) @@ -2317,7 +2317,7 @@ g_journal_create(struct g_class *mp, str sc->sc_rootmount = root_mount_hold("GJOURNAL"); GJ_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); - callout_init(&sc->sc_callout, CALLOUT_MPSAFE); + callout_init(&sc->sc_callout, 1); if (md->md_type != GJ_TYPE_COMPLETE) { /* * Journal and data are on separate providers. Modified: stable/10/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/geom/mirror/g_mirror.c Sat Mar 4 13:03:31 2017 (r314667) @@ -2966,7 +2966,7 @@ g_mirror_create(struct g_class *mp, cons LIST_INIT(&sc->sc_disks); TAILQ_INIT(&sc->sc_events); mtx_init(&sc->sc_events_mtx, "gmirror:events", NULL, MTX_DEF); - callout_init(&sc->sc_callout, CALLOUT_MPSAFE); + callout_init(&sc->sc_callout, 1); mtx_init(&sc->sc_done_mtx, "gmirror:done", NULL, MTX_DEF); sc->sc_state = G_MIRROR_DEVICE_STATE_STARTING; gp->softc = sc; Modified: stable/10/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/10/sys/geom/raid3/g_raid3.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/geom/raid3/g_raid3.c Sat Mar 4 13:03:31 2017 (r314667) @@ -3165,7 +3165,7 @@ g_raid3_create(struct g_class *mp, const bioq_init(&sc->sc_sync_delayed); TAILQ_INIT(&sc->sc_events); mtx_init(&sc->sc_events_mtx, "graid3:events", NULL, MTX_DEF); - callout_init(&sc->sc_callout, CALLOUT_MPSAFE); + callout_init(&sc->sc_callout, 1); sc->sc_state = G_RAID3_DEVICE_STATE_STARTING; gp->softc = sc; sc->sc_geom = gp; Modified: stable/10/sys/geom/sched/gs_rr.c ============================================================================== --- stable/10/sys/geom/sched/gs_rr.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/geom/sched/gs_rr.c Sat Mar 4 13:03:31 2017 (r314667) @@ -602,7 +602,7 @@ g_rr_init(struct g_geom *geom) sc = malloc(sizeof *sc, M_GEOM_SCHED, M_NOWAIT | M_ZERO); sc->sc_geom = geom; TAILQ_INIT(&sc->sc_rr_tailq); - callout_init(&sc->sc_wait, CALLOUT_MPSAFE); + callout_init(&sc->sc_wait, 1); LIST_INSERT_HEAD(&me.sc_head, sc, sc_next); me.units++; Modified: stable/10/sys/i386/i386/mp_watchdog.c ============================================================================== --- stable/10/sys/i386/i386/mp_watchdog.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/i386/i386/mp_watchdog.c Sat Mar 4 13:03:31 2017 (r314667) @@ -86,7 +86,7 @@ static void watchdog_init(void *arg) { - callout_init(&watchdog_callout, CALLOUT_MPSAFE); + callout_init(&watchdog_callout, 1); if (watchdog_cpu != -1) watchdog_change(watchdog_cpu); } Modified: stable/10/sys/kern/init_main.c ============================================================================== --- stable/10/sys/kern/init_main.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/kern/init_main.c Sat Mar 4 13:03:31 2017 (r314667) @@ -511,7 +511,7 @@ proc0_init(void *dummy __unused) callout_init_mtx(&p->p_itcallout, &p->p_mtx, 0); callout_init_mtx(&p->p_limco, &p->p_mtx, 0); - callout_init(&td->td_slpcallout, CALLOUT_MPSAFE); + callout_init(&td->td_slpcallout, 1); /* Create credentials. */ newcred = crget(); Modified: stable/10/sys/kern/kern_synch.c ============================================================================== --- stable/10/sys/kern/kern_synch.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/kern/kern_synch.c Sat Mar 4 13:03:31 2017 (r314667) @@ -569,7 +569,7 @@ loadav(void *arg) static void synch_setup(void *dummy) { - callout_init(&loadav_callout, CALLOUT_MPSAFE); + callout_init(&loadav_callout, 1); /* Kick off timeout driven events by calling first time. */ loadav(NULL); Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/kern/kern_thread.c Sat Mar 4 13:03:31 2017 (r314667) @@ -551,7 +551,7 @@ thread_link(struct thread *td, struct pr LIST_INIT(&td->td_lprof[0]); LIST_INIT(&td->td_lprof[1]); sigqueue_init(&td->td_sigqueue, p); - callout_init(&td->td_slpcallout, CALLOUT_MPSAFE); + callout_init(&td->td_slpcallout, 1); TAILQ_INSERT_HEAD(&p->p_threads, td, td_plist); p->p_numthreads++; } Modified: stable/10/sys/kern/subr_vmem.c ============================================================================== --- stable/10/sys/kern/subr_vmem.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/kern/subr_vmem.c Sat Mar 4 13:03:31 2017 (r314667) @@ -766,7 +766,7 @@ vmem_start_callout(void *unused) TASK_INIT(&vmem_periodic_wk, 0, vmem_periodic, NULL); vmem_periodic_interval = hz * 10; - callout_init(&vmem_periodic_ch, CALLOUT_MPSAFE); + callout_init(&vmem_periodic_ch, 1); callout_reset(&vmem_periodic_ch, vmem_periodic_interval, vmem_periodic_kick, NULL); } Modified: stable/10/sys/kern/uipc_domain.c ============================================================================== --- stable/10/sys/kern/uipc_domain.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/kern/uipc_domain.c Sat Mar 4 13:03:31 2017 (r314667) @@ -247,8 +247,8 @@ domaininit(void *dummy) if (max_linkhdr < 16) /* XXX */ max_linkhdr = 16; - callout_init(&pffast_callout, CALLOUT_MPSAFE); - callout_init(&pfslow_callout, CALLOUT_MPSAFE); + callout_init(&pffast_callout, 1); + callout_init(&pfslow_callout, 1); mtx_lock(&dom_mtx); KASSERT(domain_init_status == 0, ("domaininit called too late!")); Modified: stable/10/sys/mips/cavium/octe/ethernet.c ============================================================================== --- stable/10/sys/mips/cavium/octe/ethernet.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/mips/cavium/octe/ethernet.c Sat Mar 4 13:03:31 2017 (r314667) @@ -454,7 +454,7 @@ int cvm_oct_init_module(device_t bus) cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 0x1001); } - callout_init(&cvm_oct_poll_timer, CALLOUT_MPSAFE); + callout_init(&cvm_oct_poll_timer, 1); callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, NULL); return 0; Modified: stable/10/sys/mips/cavium/octeon_rnd.c ============================================================================== --- stable/10/sys/mips/cavium/octeon_rnd.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/mips/cavium/octeon_rnd.c Sat Mar 4 13:03:31 2017 (r314667) @@ -95,7 +95,7 @@ octeon_rnd_attach(device_t dev) struct octeon_rnd_softc *sc; sc = device_get_softc(dev); - callout_init(&sc->sc_callout, CALLOUT_MPSAFE); + callout_init(&sc->sc_callout, 1); callout_reset(&sc->sc_callout, hz * 5, octeon_rnd_harvest, sc); cvmx_rng_enable(); Modified: stable/10/sys/mips/nlm/dev/net/xlpge.c ============================================================================== --- stable/10/sys/mips/nlm/dev/net/xlpge.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/mips/nlm/dev/net/xlpge.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1240,7 +1240,7 @@ nlm_xlpge_attach(device_t dev) sc->prepad_en = sc->network_sc->prepad_en; sc->prepad_size = sc->network_sc->prepad_size; - callout_init(&sc->xlpge_callout, CALLOUT_MPSAFE); + callout_init(&sc->xlpge_callout, 1); XLPGE_LOCK_INIT(sc, device_get_nameunit(dev)); Modified: stable/10/sys/mips/rmi/dev/xlr/rge.c ============================================================================== --- stable/10/sys/mips/rmi/dev/xlr/rge.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/mips/rmi/dev/xlr/rge.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1894,9 +1894,9 @@ rge_attach(device_t dev) if (!gmac_common_init_done) { mac_common_init(); gmac_common_init_done = 1; - callout_init(&xlr_tx_stop_bkp, CALLOUT_MPSAFE); + callout_init(&xlr_tx_stop_bkp, 1); callout_reset(&xlr_tx_stop_bkp, hz, xlr_tx_q_wakeup, NULL); - callout_init(&rge_dbg_count, CALLOUT_MPSAFE); + callout_init(&rge_dbg_count, 1); //callout_reset(&rge_dbg_count, hz, xlr_debug_count, NULL); } if ((ret = rmi_xlr_mac_open(sc)) == -1) { Modified: stable/10/sys/net/if_spppsubr.c ============================================================================== --- stable/10/sys/net/if_spppsubr.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/net/if_spppsubr.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1030,7 +1030,7 @@ sppp_attach(struct ifnet *ifp) mtx_init(&sp->mtx, "sppp", MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); /* Initialize keepalive handler. */ - callout_init(&sp->keepalive_callout, CALLOUT_MPSAFE); + callout_init(&sp->keepalive_callout, 1); callout_reset(&sp->keepalive_callout, hz * 10, sppp_keepalive, (void *)sp); @@ -1062,7 +1062,7 @@ sppp_attach(struct ifnet *ifp) #ifdef INET6 sp->confflags |= CONF_ENABLE_IPV6; #endif - callout_init(&sp->ifstart_callout, CALLOUT_MPSAFE); + callout_init(&sp->ifstart_callout, 1); sp->if_start = ifp->if_start; ifp->if_start = sppp_ifstart; sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, M_WAITOK); @@ -2170,7 +2170,7 @@ sppp_lcp_init(struct sppp *sp) sp->lcp.max_terminate = 2; sp->lcp.max_configure = 10; sp->lcp.max_failure = 10; - callout_init(&sp->ch[IDX_LCP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_LCP], 1); } static void @@ -2861,7 +2861,7 @@ sppp_ipcp_init(struct sppp *sp) sp->fail_counter[IDX_IPCP] = 0; sp->pp_seq[IDX_IPCP] = 0; sp->pp_rseq[IDX_IPCP] = 0; - callout_init(&sp->ch[IDX_IPCP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_IPCP], 1); } static void @@ -3420,7 +3420,7 @@ sppp_ipv6cp_init(struct sppp *sp) sp->fail_counter[IDX_IPV6CP] = 0; sp->pp_seq[IDX_IPV6CP] = 0; sp->pp_rseq[IDX_IPV6CP] = 0; - callout_init(&sp->ch[IDX_IPV6CP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_IPV6CP], 1); } static void @@ -4225,7 +4225,7 @@ sppp_chap_init(struct sppp *sp) sp->fail_counter[IDX_CHAP] = 0; sp->pp_seq[IDX_CHAP] = 0; sp->pp_rseq[IDX_CHAP] = 0; - callout_init(&sp->ch[IDX_CHAP], CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_CHAP], 1); } static void @@ -4547,8 +4547,8 @@ sppp_pap_init(struct sppp *sp) sp->fail_counter[IDX_PAP] = 0; sp->pp_seq[IDX_PAP] = 0; sp->pp_rseq[IDX_PAP] = 0; - callout_init(&sp->ch[IDX_PAP], CALLOUT_MPSAFE); - callout_init(&sp->pap_my_to_ch, CALLOUT_MPSAFE); + callout_init(&sp->ch[IDX_PAP], 1); + callout_init(&sp->pap_my_to_ch, 1); } static void Modified: stable/10/sys/net80211/ieee80211_ht.c ============================================================================== --- stable/10/sys/net80211/ieee80211_ht.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/net80211/ieee80211_ht.c Sat Mar 4 13:03:31 2017 (r314667) @@ -1688,7 +1688,7 @@ ieee80211_setup_basic_htrates(struct iee static void ampdu_tx_setup(struct ieee80211_tx_ampdu *tap) { - callout_init(&tap->txa_timer, CALLOUT_MPSAFE); + callout_init(&tap->txa_timer, 1); tap->txa_flags |= IEEE80211_AGGR_SETUP; } Modified: stable/10/sys/net80211/ieee80211_hwmp.c ============================================================================== --- stable/10/sys/net80211/ieee80211_hwmp.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/net80211/ieee80211_hwmp.c Sat Mar 4 13:03:31 2017 (r314667) @@ -275,7 +275,7 @@ hwmp_vattach(struct ieee80211vap *vap) return; } hs->hs_maxhops = IEEE80211_HWMP_DEFAULT_MAXHOPS; - callout_init(&hs->hs_roottimer, CALLOUT_MPSAFE); + callout_init(&hs->hs_roottimer, 1); vap->iv_hwmp = hs; } Modified: stable/10/sys/net80211/ieee80211_mesh.c ============================================================================== --- stable/10/sys/net80211/ieee80211_mesh.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/net80211/ieee80211_mesh.c Sat Mar 4 13:03:31 2017 (r314667) @@ -216,7 +216,7 @@ mesh_rt_add_locked(struct ieee80211vap * IEEE80211_ADDR_COPY(rt->rt_dest, dest); rt->rt_priv = (void *)ALIGN(&rt[1]); mtx_init(&rt->rt_lock, "MBSS_RT", "802.11s route entry", MTX_DEF); - callout_init(&rt->rt_discovery, CALLOUT_MPSAFE); + callout_init(&rt->rt_discovery, 1); rt->rt_updtime = ticks; /* create time */ TAILQ_INSERT_TAIL(&ms->ms_routes, rt, rt_next); } @@ -678,8 +678,8 @@ mesh_vattach(struct ieee80211vap *vap) TAILQ_INIT(&ms->ms_known_gates); TAILQ_INIT(&ms->ms_routes); mtx_init(&ms->ms_rt_lock, "MBSS", "802.11s routing table", MTX_DEF); - callout_init(&ms->ms_cleantimer, CALLOUT_MPSAFE); - callout_init(&ms->ms_gatetimer, CALLOUT_MPSAFE); + callout_init(&ms->ms_cleantimer, 1); + callout_init(&ms->ms_gatetimer, 1); ms->ms_gateseq = 0; mesh_select_proto_metric(vap, "AIRTIME"); KASSERT(ms->ms_pmetric, ("ms_pmetric == NULL")); @@ -3382,8 +3382,8 @@ void ieee80211_mesh_node_init(struct ieee80211vap *vap, struct ieee80211_node *ni) { ni->ni_flags |= IEEE80211_NODE_QOS; - callout_init(&ni->ni_mltimer, CALLOUT_MPSAFE); - callout_init(&ni->ni_mlhtimer, CALLOUT_MPSAFE); + callout_init(&ni->ni_mltimer, 1); + callout_init(&ni->ni_mlhtimer, 1); } /* Modified: stable/10/sys/net80211/ieee80211_node.c ============================================================================== --- stable/10/sys/net80211/ieee80211_node.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/net80211/ieee80211_node.c Sat Mar 4 13:03:31 2017 (r314667) @@ -111,7 +111,7 @@ ieee80211_node_attach(struct ieee80211co "802.11 staging q"); ieee80211_node_table_init(ic, &ic->ic_sta, "station", IEEE80211_INACT_INIT, ic->ic_max_keyix); - callout_init(&ic->ic_inact, CALLOUT_MPSAFE); + callout_init(&ic->ic_inact, 1); callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, ieee80211_node_timeout, ic); Modified: stable/10/sys/net80211/ieee80211_proto.c ============================================================================== --- stable/10/sys/net80211/ieee80211_proto.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/net80211/ieee80211_proto.c Sat Mar 4 13:03:31 2017 (r314667) @@ -194,7 +194,7 @@ ieee80211_proto_vattach(struct ieee80211 vap->iv_fragthreshold = IEEE80211_FRAG_DEFAULT; vap->iv_bmiss_max = IEEE80211_BMISS_MAX; callout_init_mtx(&vap->iv_swbmiss, IEEE80211_LOCK_OBJ(ic), 0); - callout_init(&vap->iv_mgtsend, CALLOUT_MPSAFE); + callout_init(&vap->iv_mgtsend, 1); TASK_INIT(&vap->iv_nstate_task, 0, ieee80211_newstate_cb, vap); TASK_INIT(&vap->iv_swbmiss_task, 0, beacon_swmiss, vap); /* Modified: stable/10/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- stable/10/sys/netgraph/netflow/ng_netflow.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/netgraph/netflow/ng_netflow.c Sat Mar 4 13:03:31 2017 (r314667) @@ -258,7 +258,7 @@ ng_netflow_constructor(node_p node) priv->ifaces[i].info.conf = NG_NETFLOW_CONF_INGRESS; /* Initialize callout handle */ - callout_init(&priv->exp_callout, CALLOUT_MPSAFE); + callout_init(&priv->exp_callout, 1); /* Allocate memory and set up flow cache */ ng_netflow_cache_init(priv); Modified: stable/10/sys/netgraph/netgraph.h ============================================================================== --- stable/10/sys/netgraph/netgraph.h Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/netgraph/netgraph.h Sat Mar 4 13:03:31 2017 (r314667) @@ -1161,7 +1161,7 @@ int ng_send_fn2(node_p node, hook_p hoo int ng_uncallout(struct callout *c, node_p node); int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks, ng_item_fn *fn, void * arg1, int arg2); -#define ng_callout_init(c) callout_init(c, CALLOUT_MPSAFE) +#define ng_callout_init(c) callout_init(c, 1) /* Flags for netgraph functions. */ #define NG_NOFLAGS 0x00000000 /* no special options */ Modified: stable/10/sys/netinet/in_pcb.c ============================================================================== --- stable/10/sys/netinet/in_pcb.c Sat Mar 4 12:51:57 2017 (r314666) +++ stable/10/sys/netinet/in_pcb.c Sat Mar 4 13:03:31 2017 (r314667) @@ -2139,7 +2139,7 @@ ipport_tick_init(const void *unused __un { /* Start ipport_tick. */ - callout_init(&ipport_tick_callout, CALLOUT_MPSAFE); + callout_init(&ipport_tick_callout, 1); callout_reset(&ipport_tick_callout, 1, ipport_tick, NULL); EVENTHANDLER_REGISTER(shutdown_pre_sync, ip_fini, NULL, SHUTDOWN_PRI_DEFAULT); Modified: stable/10/sys/netinet/ip_mroute.c ============================================================================== --- stable/10/sys/netinet/ip_mroute.c Sat Mar 4 12:51:57 2017 (r314666) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Sat Mar 4 13:05:05 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4A10CF9672; Sat, 4 Mar 2017 13:05:05 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9CB071F60; Sat, 4 Mar 2017 13:05:05 +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 v24D54RY072931; Sat, 4 Mar 2017 13:05:04 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v24D54CP072928; Sat, 4 Mar 2017 13:05:04 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201703041305.v24D54CP072928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 4 Mar 2017 13:05: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: r314668 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 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.23 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, 04 Mar 2017 13:05:05 -0000 Author: avg Date: Sat Mar 4 13:05:04 2017 New Revision: 314668 URL: https://svnweb.freebsd.org/changeset/base/314668 Log: MFC r314273: zfs: call spa_deadman on a taskqueue thread Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Mar 4 13:03:31 2017 (r314667) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Mar 4 13:05:04 2017 (r314668) @@ -174,10 +174,6 @@ uint_t zio_taskq_basedc = 80; /* base boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */ extern int zfs_sync_pass_deferred_free; -#ifndef illumos -extern void spa_deadman(void *arg); -#endif - /* * This (illegal) pool name is used when temporarily importing a spa_t in order * to get the vdev stats associated with the imported devices. @@ -6685,8 +6681,8 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_sync_starttime + spa->spa_deadman_synctime)); #else /* !illumos */ #ifdef _KERNEL - callout_reset(&spa->spa_deadman_cycid, - hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa); + callout_schedule(&spa->spa_deadman_cycid, + hz * spa->spa_deadman_synctime / NANOSEC); #endif #endif /* illumos */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Mar 4 13:03:31 2017 (r314667) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Mar 4 13:05:04 2017 (r314668) @@ -597,8 +597,8 @@ spa_lookup(const char *name) * If the zfs_deadman_enabled flag is set then it inspects all vdev queues * looking for potentially hung I/Os. */ -void -spa_deadman(void *arg) +static void +spa_deadman(void *arg, int pending) { spa_t *spa = arg; @@ -627,6 +627,16 @@ spa_deadman(void *arg) #endif } +#if defined(__FreeBSD__) && defined(_KERNEL) +static void +spa_deadman_timeout(void *arg) +{ + spa_t *spa = arg; + + taskqueue_enqueue(taskqueue_thread, &spa->spa_deadman_task); +} +#endif + /* * Create an uninitialized spa_t with the given name. Requires * spa_namespace_lock. The caller must ensure that the spa_t doesn't already @@ -698,7 +708,23 @@ spa_add(const char *name, nvlist_t *conf mutex_exit(&cpu_lock); #else /* !illumos */ #ifdef _KERNEL + /* + * callout(9) does not provide a way to initialize a callout with + * a function and an argument, so we use callout_reset() to schedule + * the callout in the very distant future. Even if that event ever + * fires, it should be okayas we won't have any active zio-s. + * But normally spa_sync() will reschedule the callout with a proper + * timeout. + * callout(9) does not allow the callback function to sleep but + * vdev_deadman() needs to acquire vq_lock and illumos mutexes are + * emulated using sx(9). For this reason spa_deadman_timeout() + * will schedule spa_deadman() as task on a taskqueue that allows + * sleeping. + */ + TASK_INIT(&spa->spa_deadman_task, 0, spa_deadman, spa); callout_init(&spa->spa_deadman_cycid, 1); + callout_reset_sbt(&spa->spa_deadman_cycid, SBT_MAX, 0, + spa_deadman_timeout, spa, 0); #endif #endif refcount_create(&spa->spa_refcount); @@ -811,6 +837,7 @@ spa_remove(spa_t *spa) #else /* !illumos */ #ifdef _KERNEL callout_drain(&spa->spa_deadman_cycid); + taskqueue_drain(taskqueue_thread, &spa->spa_deadman_task); #endif #endif Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Sat Mar 4 13:03:31 2017 (r314667) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Sat Mar 4 13:05:04 2017 (r314668) @@ -261,6 +261,7 @@ struct spa { #else /* !illumos */ #ifdef _KERNEL struct callout spa_deadman_cycid; /* callout id */ + struct task spa_deadman_task; #endif #endif /* illumos */ uint64_t spa_deadman_calls; /* number of deadman calls */ From owner-svn-src-stable-10@freebsd.org Sat Mar 4 15:30:45 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73EEECF284E; Sat, 4 Mar 2017 15:30:45 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 504101F51; Sat, 4 Mar 2017 15:30:45 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (106-68-109-205.dyn.iinet.net.au [106.68.109.205]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id v24FUSeX037697 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 4 Mar 2017 07:30:38 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r314667 - in stable/10/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/fs/zfs cddl/dev/profile compat/ndis contrib/ipfilter/netinet dev/a... To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201703041303.v24D3Vfi072728@repo.freebsd.org> From: Julian Elischer Message-ID: <1292f504-21e4-1bee-3dd6-6205252bfd26@freebsd.org> Date: Sat, 4 Mar 2017 23:30:22 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <201703041303.v24D3Vfi072728@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 04 Mar 2017 15:30:45 -0000 On 4/3/17 9:03 pm, Andriy Gapon wrote: > Author: avg > Date: Sat Mar 4 13:03:31 2017 > New Revision: 314667 > URL: https://svnweb.freebsd.org/changeset/base/314667 > > Log: > MFC r283291: don't use CALLOUT_MPSAFE with callout_init() > > The main purpose of this MFC is to reduce conflicts for other merges. > Parts of the original change have already "trickled down" via individual MFCs. is there a better name than ''1" when you replace " CALLOUT_MPSAFE"? > - callout_init(&watchdog_callout, CALLOUT_MPSAFE); > + callout_init(&watchdog_callout, 1); > if (watchdog_cpu != -1) > watchdog_change(watchdog_cpu); From owner-svn-src-stable-10@freebsd.org Sat Mar 4 16:03:07 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 449FECF34F3; Sat, 4 Mar 2017 16:03:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id BA3451873; Sat, 4 Mar 2017 16:03:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA01372; Sat, 04 Mar 2017 18:03:03 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1ckC99-000C1J-Kg; Sat, 04 Mar 2017 18:03:03 +0200 Subject: Re: svn commit: r314667 - in stable/10/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/fs/zfs cddl/dev/profile compat/ndis contrib/ipfilter/netinet dev/a... To: Julian Elischer , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org References: <201703041303.v24D3Vfi072728@repo.freebsd.org> <1292f504-21e4-1bee-3dd6-6205252bfd26@freebsd.org> From: Andriy Gapon Message-ID: <47d091e5-6efe-5992-f09c-8c231f2da349@FreeBSD.org> Date: Sat, 4 Mar 2017 18:02:02 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1292f504-21e4-1bee-3dd6-6205252bfd26@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 04 Mar 2017 16:03:07 -0000 On 04/03/2017 17:30, Julian Elischer wrote: > On 4/3/17 9:03 pm, Andriy Gapon wrote: >> Author: avg >> Date: Sat Mar 4 13:03:31 2017 >> New Revision: 314667 >> URL: https://svnweb.freebsd.org/changeset/base/314667 >> >> Log: >> MFC r283291: don't use CALLOUT_MPSAFE with callout_init() >> The main purpose of this MFC is to reduce conflicts for other merges. >> Parts of the original change have already "trickled down" via individual MFCs. > > is there a better name than ''1" when you replace " CALLOUT_MPSAFE"? Maybe 'true'. The argument has type int and it is documented this way: If the mpsafe argument is zero, the callout structure is not considered to be “multi-processor safe”; and the Giant lock will be acquired before calling the callout function and released when the callout function returns. >> - callout_init(&watchdog_callout, CALLOUT_MPSAFE); >> + callout_init(&watchdog_callout, 1); >> if (watchdog_cpu != -1) >> watchdog_change(watchdog_cpu); > -- Andriy Gapon From owner-svn-src-stable-10@freebsd.org Sat Mar 4 16:11:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F1EACF3767; Sat, 4 Mar 2017 16:11:15 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ED20A1CF2; Sat, 4 Mar 2017 16:11:14 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (106-68-109-205.dyn.iinet.net.au [106.68.109.205]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id v24GAx5d037861 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 4 Mar 2017 08:11:06 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r314667 - in stable/10/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/fs/zfs cddl/dev/profile compat/ndis contrib/ipfilter/netinet dev/a... To: Andriy Gapon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org References: <201703041303.v24D3Vfi072728@repo.freebsd.org> <1292f504-21e4-1bee-3dd6-6205252bfd26@freebsd.org> <47d091e5-6efe-5992-f09c-8c231f2da349@FreeBSD.org> From: Julian Elischer Message-ID: <0c863f1d-4039-3698-e1f7-e9aea5d190ee@freebsd.org> Date: Sun, 5 Mar 2017 00:10:52 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <47d091e5-6efe-5992-f09c-8c231f2da349@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 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, 04 Mar 2017 16:11:15 -0000 On 5/3/17 12:02 am, Andriy Gapon wrote: > On 04/03/2017 17:30, Julian Elischer wrote: >> On 4/3/17 9:03 pm, Andriy Gapon wrote: >>> Author: avg >>> Date: Sat Mar 4 13:03:31 2017 >>> New Revision: 314667 >>> URL: https://svnweb.freebsd.org/changeset/base/314667 >>> >>> Log: >>> MFC r283291: don't use CALLOUT_MPSAFE with callout_init() >>> The main purpose of this MFC is to reduce conflicts for other merges. >>> Parts of the original change have already "trickled down" via individual MFCs. >> is there a better name than ''1" when you replace " CALLOUT_MPSAFE"? > Maybe 'true'. The argument has type int and it is documented this way: > > If the mpsafe argument is zero, the callout structure > is not considered to be “multi-processor safe”; and the Giant lock will > be acquired before calling the callout function and released when the > callout function returns. then I disagree with the change. I think CALLOUT_MPSAFE is a better value than '1'. or CALLOUT_IS_MPSAFE. I'm sort of confused by why 283291 made that change. It seems a regression to me. MFC-ing it is a different question and 'diff reduction' is a valid reason but the original change in head seems suspect. >>> - callout_init(&watchdog_callout, CALLOUT_MPSAFE); >>> + callout_init(&watchdog_callout, 1); >>> if (watchdog_cpu != -1) >>> watchdog_change(watchdog_cpu); > > From owner-svn-src-stable-10@freebsd.org Sat Mar 4 18:12:00 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A191CF9FCD; Sat, 4 Mar 2017 18:12:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id 23A0912D8; Sat, 4 Mar 2017 18:12:00 +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 v24IBx75001181; Sat, 4 Mar 2017 18:11:59 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v24IBxwd001179; Sat, 4 Mar 2017 18:11:59 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201703041811.v24IBxwd001179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 4 Mar 2017 18:11:59 +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: r314674 - stable/10/sys/kern X-SVN-Group: stable-10 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.23 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, 04 Mar 2017 18:12:00 -0000 Author: bdrewery Date: Sat Mar 4 18:11:59 2017 New Revision: 314674 URL: https://svnweb.freebsd.org/changeset/base/314674 Log: MFC r313909: Fix panic with unlocked vnode to vrecycle(). Modified: stable/10/sys/kern/uipc_mqueue.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/uipc_mqueue.c ============================================================================== --- stable/10/sys/kern/uipc_mqueue.c Sat Mar 4 18:07:30 2017 (r314673) +++ stable/10/sys/kern/uipc_mqueue.c Sat Mar 4 18:11:59 2017 (r314674) @@ -703,7 +703,9 @@ do_recycle(void *context, int pending __ { struct vnode *vp = (struct vnode *)context; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vrecycle(vp); + VOP_UNLOCK(vp, 0); vdrop(vp); }