From owner-svn-src-stable@freebsd.org Sun Jul 9 00:24:54 2017 Return-Path: Delivered-To: svn-src-stable@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 06D73DA5BD4; Sun, 9 Jul 2017 00:24:54 +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 C43A070C3D; Sun, 9 Jul 2017 00:24:53 +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 v690Oqoj084257; Sun, 9 Jul 2017 00:24:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v690Oqlq084256; Sun, 9 Jul 2017 00:24:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707090024.v690Oqlq084256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 9 Jul 2017 00:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320821 - stable/11/sys/compat/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/compat/linux X-SVN-Commit-Revision: 320821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 00:24:54 -0000 Author: emaste Date: Sun Jul 9 00:24:52 2017 New Revision: 320821 URL: https://svnweb.freebsd.org/changeset/base/320821 Log: MFC r320069: Add ZFS to Linux statfs ftype PR: 220086 Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/compat/linux/linux_stats.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_stats.c ============================================================================== --- stable/11/sys/compat/linux/linux_stats.c Sat Jul 8 21:15:46 2017 (r320820) +++ stable/11/sys/compat/linux/linux_stats.c Sun Jul 9 00:24:52 2017 (r320821) @@ -318,6 +318,7 @@ struct l_statfs { #define LINUX_NTFS_SUPER_MAGIC 0x5346544EL #define LINUX_PROC_SUPER_MAGIC 0x9fa0L #define LINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */ +#define LINUX_ZFS_SUPER_MAGIC 0x2FC12FC1 #define LINUX_DEVFS_SUPER_MAGIC 0x1373L #define LINUX_SHMFS_MAGIC 0x01021994 @@ -327,6 +328,7 @@ bsd_to_linux_ftype(const char *fstypename) int i; static struct {const char *bsd_name; long linux_type;} b2l_tbl[] = { {"ufs", LINUX_UFS_SUPER_MAGIC}, + {"zfs", LINUX_ZFS_SUPER_MAGIC}, {"cd9660", LINUX_ISOFS_SUPER_MAGIC}, {"nfs", LINUX_NFS_SUPER_MAGIC}, {"ext2fs", LINUX_EXT2_SUPER_MAGIC}, From owner-svn-src-stable@freebsd.org Sun Jul 9 03:54:11 2017 Return-Path: Delivered-To: svn-src-stable@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 A684EDAA700; Sun, 9 Jul 2017 03:54:11 +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 623ED7691C; Sun, 9 Jul 2017 03:54:11 +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 v693sAqj071463; Sun, 9 Jul 2017 03:54:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v693sAIg071462; Sun, 9 Jul 2017 03:54:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707090354.v693sAIg071462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 9 Jul 2017 03:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320822 - stable/11/lib/libc/gen X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/gen X-SVN-Commit-Revision: 320822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 03:54:11 -0000 Author: kib Date: Sun Jul 9 03:54:10 2017 New Revision: 320822 URL: https://svnweb.freebsd.org/changeset/base/320822 Log: MFC r320570: Correct signatures of several pthreads stubs. Modified: stable/11/lib/libc/gen/_pthread_stubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/11/lib/libc/gen/_pthread_stubs.c Sun Jul 9 00:24:52 2017 (r320821) +++ stable/11/lib/libc/gen/_pthread_stubs.c Sun Jul 9 03:54:10 2017 (r320822) @@ -279,10 +279,11 @@ STUB_FUNC2(pthread_kill, PJT_KILL, int, void *, int) STUB_FUNC2(pthread_setcancelstate, PJT_SETCANCELSTATE, int, int, void *) STUB_FUNC2(pthread_setcanceltype, PJT_SETCANCELTYPE, int, int, void *) STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void) -STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, int, int) -STUB_FUNC2(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void*, void *); -STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, int, int) -STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, int, int) +STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, void, int) +STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void *, + void *, void *); +STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int) +STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int) static int stub_zero(void) From owner-svn-src-stable@freebsd.org Sun Jul 9 03:57:26 2017 Return-Path: Delivered-To: svn-src-stable@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 41173DAA7A9; Sun, 9 Jul 2017 03:57:26 +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 0500076A6A; Sun, 9 Jul 2017 03:57:25 +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 v693vPdf071638; Sun, 9 Jul 2017 03:57:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v693vPJP071637; Sun, 9 Jul 2017 03:57:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707090357.v693vPJP071637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 9 Jul 2017 03:57: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: r320823 - stable/10/lib/libc/gen X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/lib/libc/gen X-SVN-Commit-Revision: 320823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 03:57:26 -0000 Author: kib Date: Sun Jul 9 03:57:24 2017 New Revision: 320823 URL: https://svnweb.freebsd.org/changeset/base/320823 Log: MFC r320570: Correct signatures of several pthreads stubs. Modified: stable/10/lib/libc/gen/_pthread_stubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/10/lib/libc/gen/_pthread_stubs.c Sun Jul 9 03:54:10 2017 (r320822) +++ stable/10/lib/libc/gen/_pthread_stubs.c Sun Jul 9 03:57:24 2017 (r320823) @@ -271,10 +271,11 @@ STUB_FUNC2(pthread_kill, PJT_KILL, int, void *, int) STUB_FUNC2(pthread_setcancelstate, PJT_SETCANCELSTATE, int, int, void *) STUB_FUNC2(pthread_setcanceltype, PJT_SETCANCELTYPE, int, int, void *) STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void) -STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, int, int) -STUB_FUNC2(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void*, void *); -STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, int, int) -STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, int, int) +STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, void, int) +STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void *, + void *, void *); +STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int) +STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int) static int stub_zero(void) From owner-svn-src-stable@freebsd.org Sun Jul 9 04:13:35 2017 Return-Path: Delivered-To: svn-src-stable@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 7BFC4DAAB24; Sun, 9 Jul 2017 04:13:35 +0000 (UTC) (envelope-from jhb@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 310B5770D4; Sun, 9 Jul 2017 04:13:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v694DYUa079397; Sun, 9 Jul 2017 04:13:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v694DYZt079395; Sun, 9 Jul 2017 04:13:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707090413.v694DYZt079395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sun, 9 Jul 2017 04:13: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: r320824 - in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb X-SVN-Commit-Revision: 320824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 04:13:35 -0000 Author: jhb Date: Sun Jul 9 04:13:33 2017 New Revision: 320824 URL: https://svnweb.freebsd.org/changeset/base/320824 Log: MFC 320675: Add deprecation notices for gdb and kgdb. Even though gdb and kgdb may not be removed for 12.0 on some architectures, the notice is unconditional as these tools will likely be removed at some point in the future when adequate replacements are available (gdb in ports or lldb in base). Modified: stable/10/gnu/usr.bin/gdb/gdb/gdb.1 stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/gnu/usr.bin/gdb/gdb/gdb.1 stable/11/gnu/usr.bin/gdb/kgdb/kgdb.1 Directory Properties: stable/11/ (props changed) Modified: stable/10/gnu/usr.bin/gdb/gdb/gdb.1 ============================================================================== --- stable/10/gnu/usr.bin/gdb/gdb/gdb.1 Sun Jul 9 03:57:24 2017 (r320823) +++ stable/10/gnu/usr.bin/gdb/gdb/gdb.1 Sun Jul 9 04:13:33 2017 (r320824) @@ -44,6 +44,11 @@ gdb \- The GNU Debugger .IR core \||\| procID\c \&\|]\&\|] .ad b +.SH DEPRECATION NOTICE +This version of gdb is deprecated and will be removed from future versions +of the FreeBSD base system. +A newer version of gdb is available from ports or packages +(devel/gdb). .SH DESCRIPTION The purpose of a debugger such as GDB is to allow you to see what is going on ``inside'' another program while it executes\(em\&or what another Modified: stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 ============================================================================== --- stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 Sun Jul 9 03:57:24 2017 (r320823) +++ stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 Sun Jul 9 04:13:33 2017 (r320824) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 11, 2006 +.Dd July 5, 2017 .Dt KGDB 1 .Os .Sh NAME @@ -40,6 +40,16 @@ .Op Fl d Ar crashdir .Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device .Op Ar kernel Op Ar core +.Sh DEPRECATION NOTICE +This version of +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +A newer version of +.Nm +is available from ports or packages +(devel/gdb). .Sh DESCRIPTION The .Nm From owner-svn-src-stable@freebsd.org Sun Jul 9 04:13:35 2017 Return-Path: Delivered-To: svn-src-stable@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 BD2B8DAAB2A; Sun, 9 Jul 2017 04:13:35 +0000 (UTC) (envelope-from jhb@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 6CF71770D5; Sun, 9 Jul 2017 04:13:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v694DYL0079404; Sun, 9 Jul 2017 04:13:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v694DYsC079402; Sun, 9 Jul 2017 04:13:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707090413.v694DYsC079402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sun, 9 Jul 2017 04:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320824 - in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb X-SVN-Commit-Revision: 320824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 04:13:35 -0000 Author: jhb Date: Sun Jul 9 04:13:33 2017 New Revision: 320824 URL: https://svnweb.freebsd.org/changeset/base/320824 Log: MFC 320675: Add deprecation notices for gdb and kgdb. Even though gdb and kgdb may not be removed for 12.0 on some architectures, the notice is unconditional as these tools will likely be removed at some point in the future when adequate replacements are available (gdb in ports or lldb in base). Modified: stable/11/gnu/usr.bin/gdb/gdb/gdb.1 stable/11/gnu/usr.bin/gdb/kgdb/kgdb.1 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/gnu/usr.bin/gdb/gdb/gdb.1 stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 Directory Properties: stable/10/ (props changed) Modified: stable/11/gnu/usr.bin/gdb/gdb/gdb.1 ============================================================================== --- stable/11/gnu/usr.bin/gdb/gdb/gdb.1 Sun Jul 9 03:57:24 2017 (r320823) +++ stable/11/gnu/usr.bin/gdb/gdb/gdb.1 Sun Jul 9 04:13:33 2017 (r320824) @@ -44,6 +44,11 @@ gdb \- The GNU Debugger .IR core \||\| procID\c \&\|]\&\|] .ad b +.SH DEPRECATION NOTICE +This version of gdb is deprecated and will be removed from future versions +of the FreeBSD base system. +A newer version of gdb is available from ports or packages +(devel/gdb). .SH DESCRIPTION The purpose of a debugger such as GDB is to allow you to see what is going on ``inside'' another program while it executes\(em\&or what another Modified: stable/11/gnu/usr.bin/gdb/kgdb/kgdb.1 ============================================================================== --- stable/11/gnu/usr.bin/gdb/kgdb/kgdb.1 Sun Jul 9 03:57:24 2017 (r320823) +++ stable/11/gnu/usr.bin/gdb/kgdb/kgdb.1 Sun Jul 9 04:13:33 2017 (r320824) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 11, 2006 +.Dd July 5, 2017 .Dt KGDB 1 .Os .Sh NAME @@ -40,6 +40,16 @@ .Op Fl d Ar crashdir .Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device .Op Ar kernel Op Ar core +.Sh DEPRECATION NOTICE +This version of +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +A newer version of +.Nm +is available from ports or packages +(devel/gdb). .Sh DESCRIPTION The .Nm From owner-svn-src-stable@freebsd.org Sun Jul 9 04:28:48 2017 Return-Path: Delivered-To: svn-src-stable@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 D58EDDAAEFC; Sun, 9 Jul 2017 04:28:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2EA777638; Sun, 9 Jul 2017 04:28:47 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v694Shiw070145; Sat, 8 Jul 2017 21:28:43 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v694Shij070144; Sat, 8 Jul 2017 21:28:43 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201707090428.v694Shij070144@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r320824 - in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb In-Reply-To: <201707090413.v694DYZt079395@repo.freebsd.org> To: John Baldwin Date: Sat, 8 Jul 2017 21:28:43 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 04:28:49 -0000 > Author: jhb > Date: Sun Jul 9 04:13:33 2017 > New Revision: 320824 > URL: https://svnweb.freebsd.org/changeset/base/320824 > > Log: > MFC 320675: Add deprecation notices for gdb and kgdb. > > Even though gdb and kgdb may not be removed for 12.0 on some architectures, > the notice is unconditional as these tools will likely be removed at some > point in the future when adequate replacements are available (gdb in ports > or lldb in base). Thanks for doing this, but we are still falling slightly short of 17.4 on deprecation on the aspect of "Use of the deprecated feature generates a warning". > Modified: > stable/10/gnu/usr.bin/gdb/gdb/gdb.1 > stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 > Directory Properties: > stable/10/ (props changed) > > Changes in other areas also in this revision: > Modified: > stable/11/gnu/usr.bin/gdb/gdb/gdb.1 > stable/11/gnu/usr.bin/gdb/kgdb/kgdb.1 > Directory Properties: > stable/11/ (props changed) > > Modified: stable/10/gnu/usr.bin/gdb/gdb/gdb.1 > ============================================================================== > --- stable/10/gnu/usr.bin/gdb/gdb/gdb.1 Sun Jul 9 03:57:24 2017 (r320823) > +++ stable/10/gnu/usr.bin/gdb/gdb/gdb.1 Sun Jul 9 04:13:33 2017 (r320824) > @@ -44,6 +44,11 @@ gdb \- The GNU Debugger > .IR core \||\| procID\c > \&\|]\&\|] > .ad b > +.SH DEPRECATION NOTICE > +This version of gdb is deprecated and will be removed from future versions > +of the FreeBSD base system. > +A newer version of gdb is available from ports or packages > +(devel/gdb). > .SH DESCRIPTION > The purpose of a debugger such as GDB is to allow you to see what is > going on ``inside'' another program while it executes\(em\&or what another > > Modified: stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 > ============================================================================== > --- stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 Sun Jul 9 03:57:24 2017 (r320823) > +++ stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 Sun Jul 9 04:13:33 2017 (r320824) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 11, 2006 > +.Dd July 5, 2017 > .Dt KGDB 1 > .Os > .Sh NAME > @@ -40,6 +40,16 @@ > .Op Fl d Ar crashdir > .Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device > .Op Ar kernel Op Ar core > +.Sh DEPRECATION NOTICE > +This version of > +.Nm > +is deprecated and will be removed from future versions of the > +.Fx > +base system. > +A newer version of > +.Nm > +is available from ports or packages > +(devel/gdb). > .Sh DESCRIPTION > The > .Nm > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Sun Jul 9 15:03:42 2017 Return-Path: Delivered-To: svn-src-stable@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 75467D87C58; Sun, 9 Jul 2017 15:03: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 36B51260D; Sun, 9 Jul 2017 15:03: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 v69F3fxt050481; Sun, 9 Jul 2017 15:03:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69F3fSN050480; Sun, 9 Jul 2017 15:03:41 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707091503.v69F3fSN050480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Jul 2017 15:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320838 - stable/11/sys/fs/ext2fs X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/fs/ext2fs X-SVN-Commit-Revision: 320838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 15:03:42 -0000 Author: pfg Date: Sun Jul 9 15:03:41 2017 New Revision: 320838 URL: https://svnweb.freebsd.org/changeset/base/320838 Log: MFC r320079: ext2fs: Enable RO huge_file feature support. We have support for reading ext4 "huge" files but we can't write (anything) on ext4. and some filesystem. Formally enable the feature so that we can mount such filesystems. Submitted by: Fedor Uporov Modified: stable/11/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/11/sys/fs/ext2fs/ext2fs.h Sun Jul 9 14:18:22 2017 (r320837) +++ stable/11/sys/fs/ext2fs/ext2fs.h Sun Jul 9 15:03:41 2017 (r320838) @@ -258,6 +258,7 @@ struct csum { #define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ EXT2F_ROCOMPAT_LARGEFILE | \ + EXT2F_ROCOMPAT_HUGE_FILE | \ EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE #define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \ From owner-svn-src-stable@freebsd.org Sun Jul 9 15:09:16 2017 Return-Path: Delivered-To: svn-src-stable@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 A2E47D87D03; Sun, 9 Jul 2017 15:09:16 +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 61A03279D; Sun, 9 Jul 2017 15:09:16 +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 v69F9FTD051212; Sun, 9 Jul 2017 15:09:15 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69F9Fdv051211; Sun, 9 Jul 2017 15:09:15 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707091509.v69F9Fdv051211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Jul 2017 15:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320839 - stable/10/sys/fs/ext2fs X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/sys/fs/ext2fs X-SVN-Commit-Revision: 320839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 15:09:16 -0000 Author: pfg Date: Sun Jul 9 15:09:15 2017 New Revision: 320839 URL: https://svnweb.freebsd.org/changeset/base/320839 Log: MFC r320079: ext2fs: Enable RO huge_file feature support. We have support for reading ext4 "huge" files but we can't write (anything) on ext4. and some filesystem. Formally enable the feature so that we can mount such filesystems. Submitted by: Fedor Uporov Modified: stable/10/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/10/sys/fs/ext2fs/ext2fs.h Sun Jul 9 15:03:41 2017 (r320838) +++ stable/10/sys/fs/ext2fs/ext2fs.h Sun Jul 9 15:09:15 2017 (r320839) @@ -258,6 +258,7 @@ struct csum { #define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ EXT2F_ROCOMPAT_LARGEFILE | \ + EXT2F_ROCOMPAT_HUGE_FILE | \ EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE #define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \ From owner-svn-src-stable@freebsd.org Sun Jul 9 15:13:41 2017 Return-Path: Delivered-To: svn-src-stable@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 C4701D87EE9; Sun, 9 Jul 2017 15:13:41 +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 83B7C2B4A; Sun, 9 Jul 2017 15:13:41 +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 v69FDen4055474; Sun, 9 Jul 2017 15:13:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69FDeK6055473; Sun, 9 Jul 2017 15:13:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707091513.v69FDeK6055473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Jul 2017 15:13:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320840 - stable/11/sys/fs/ext2fs X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/fs/ext2fs X-SVN-Commit-Revision: 320840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 15:13:41 -0000 Author: pfg Date: Sun Jul 9 15:13:40 2017 New Revision: 320840 URL: https://svnweb.freebsd.org/changeset/base/320840 Log: MFC r320408: ext2fs: Support e2di_uid_high and e2di_gid_high. The fields exist on all versions of the filesystem and using them is a mount option on linux. For FreeBSD, the corresponding i_uid and i_gid are always long enough so use them by default. Reviewed by: Fedor Uporov Modified: stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jul 9 15:09:15 2017 (r320839) +++ stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jul 9 15:13:40 2017 (r320840) @@ -122,6 +122,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_gen = ei->e2di_gen; ip->i_uid = ei->e2di_uid; ip->i_gid = ei->e2di_gid; + ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16; + ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16; /* XXX use memcpy */ for (i = 0; i < NDADDR; i++) ip->i_db[i] = ei->e2di_blocks[i]; @@ -166,8 +168,10 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_nblock = ip->i_blocks & 0xffffffff; ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; ei->e2di_gen = ip->i_gen; - ei->e2di_uid = ip->i_uid; - ei->e2di_gid = ip->i_gid; + ei->e2di_uid = ip->i_uid & 0xffff; + ei->e2di_uid_high = ip->i_uid >> 16 & 0xffff; + ei->e2di_gid = ip->i_gid & 0xffff; + ei->e2di_gid_high = ip->i_gid >> 16 & 0xffff; /* XXX use memcpy */ for (i = 0; i < NDADDR; i++) ei->e2di_blocks[i] = ip->i_db[i]; From owner-svn-src-stable@freebsd.org Sun Jul 9 15:14:23 2017 Return-Path: Delivered-To: svn-src-stable@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 56CF6D87F62; Sun, 9 Jul 2017 15:14:23 +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 22AE92C7B; Sun, 9 Jul 2017 15:14:23 +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 v69FEMp2055612; Sun, 9 Jul 2017 15:14:22 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v69FEMIR055611; Sun, 9 Jul 2017 15:14:22 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201707091514.v69FEMIR055611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 9 Jul 2017 15:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320841 - stable/10/sys/fs/ext2fs X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/sys/fs/ext2fs X-SVN-Commit-Revision: 320841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jul 2017 15:14:23 -0000 Author: pfg Date: Sun Jul 9 15:14:22 2017 New Revision: 320841 URL: https://svnweb.freebsd.org/changeset/base/320841 Log: MFC r320408: ext2fs: Support e2di_uid_high and e2di_gid_high. The fields exist on all versions of the filesystem and using them is a mount option on linux. For FreeBSD, the corresponding i_uid and i_gid are always long enough so use them by default. Reviewed by: Fedor Uporov Modified: stable/10/sys/fs/ext2fs/ext2_inode_cnv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jul 9 15:13:40 2017 (r320840) +++ stable/10/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jul 9 15:14:22 2017 (r320841) @@ -122,6 +122,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_gen = ei->e2di_gen; ip->i_uid = ei->e2di_uid; ip->i_gid = ei->e2di_gid; + ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16; + ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16; /* XXX use memcpy */ for (i = 0; i < NDADDR; i++) ip->i_db[i] = ei->e2di_blocks[i]; @@ -166,8 +168,10 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_nblock = ip->i_blocks & 0xffffffff; ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; ei->e2di_gen = ip->i_gen; - ei->e2di_uid = ip->i_uid; - ei->e2di_gid = ip->i_gid; + ei->e2di_uid = ip->i_uid & 0xffff; + ei->e2di_uid_high = ip->i_uid >> 16 & 0xffff; + ei->e2di_gid = ip->i_gid & 0xffff; + ei->e2di_gid_high = ip->i_gid >> 16 & 0xffff; /* XXX use memcpy */ for (i = 0; i < NDADDR; i++) ei->e2di_blocks[i] = ip->i_db[i]; From owner-svn-src-stable@freebsd.org Mon Jul 10 03:11:49 2017 Return-Path: Delivered-To: svn-src-stable@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 EB1D1D9BEDB; Mon, 10 Jul 2017 03:11:49 +0000 (UTC) (envelope-from grehan@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 B1CB6790E5; Mon, 10 Jul 2017 03:11:49 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A3BmEe048989; Mon, 10 Jul 2017 03:11:48 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A3BmgL048988; Mon, 10 Jul 2017 03:11:48 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201707100311.v6A3BmgL048988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 10 Jul 2017 03:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320855 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 320855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 03:11:50 -0000 Author: grehan Date: Mon Jul 10 03:11:48 2017 New Revision: 320855 URL: https://svnweb.freebsd.org/changeset/base/320855 Log: MFC r311699 ps2 mouse fixes, found by plan9/9front. Reminded by: sevan Modified: stable/11/usr.sbin/bhyve/ps2mouse.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/ps2mouse.c ============================================================================== --- stable/11/usr.sbin/bhyve/ps2mouse.c Sun Jul 9 23:14:51 2017 (r320854) +++ stable/11/usr.sbin/bhyve/ps2mouse.c Mon Jul 10 03:11:48 2017 (r320855) @@ -62,6 +62,16 @@ __FBSDID("$FreeBSD$"); /* mouse device id */ #define PS2MOUSE_DEV_ID 0x0 +/* mouse data bits */ +#define PS2M_DATA_Y_OFLOW 0x80 +#define PS2M_DATA_X_OFLOW 0x40 +#define PS2M_DATA_Y_SIGN 0x20 +#define PS2M_DATA_X_SIGN 0x10 +#define PS2M_DATA_AONE 0x08 +#define PS2M_DATA_MID_BUTTON 0x04 +#define PS2M_DATA_RIGHT_BUTTON 0x02 +#define PS2M_DATA_LEFT_BUTTON 0x01 + /* mouse status bits */ #define PS2M_STS_REMOTE_MODE 0x40 #define PS2M_STS_ENABLE_DEV 0x20 @@ -169,19 +179,20 @@ movement_get(struct ps2mouse_softc *sc) assert(pthread_mutex_isowned_np(&sc->mtx)); - val0 = sc->status & (PS2M_STS_LEFT_BUTTON | - PS2M_STS_RIGHT_BUTTON | PS2M_STS_MID_BUTTON); + val0 = PS2M_DATA_AONE; + val0 |= sc->status & (PS2M_DATA_LEFT_BUTTON | + PS2M_DATA_RIGHT_BUTTON | PS2M_DATA_MID_BUTTON); if (sc->delta_x >= 0) { if (sc->delta_x > 255) { - val0 |= (1 << 6); + val0 |= PS2M_DATA_X_OFLOW; val1 = 255; } else val1 = sc->delta_x; } else { - val0 |= (1 << 4); + val0 |= PS2M_DATA_X_SIGN; if (sc->delta_x < -255) { - val0 |= (1 << 6); + val0 |= PS2M_DATA_X_OFLOW; val1 = 255; } else val1 = sc->delta_x; @@ -190,14 +201,14 @@ movement_get(struct ps2mouse_softc *sc) if (sc->delta_y >= 0) { if (sc->delta_y > 255) { - val0 |= (1 << 7); + val0 |= PS2M_DATA_Y_OFLOW; val2 = 255; } else val2 = sc->delta_y; } else { - val0 |= (1 << 5); + val0 |= PS2M_DATA_Y_SIGN; if (sc->delta_y < -255) { - val0 |= (1 << 7); + val0 |= PS2M_DATA_Y_OFLOW; val2 = 255; } else val2 = sc->delta_y; From owner-svn-src-stable@freebsd.org Mon Jul 10 05:34:38 2017 Return-Path: Delivered-To: svn-src-stable@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 94022D9DFB3; Mon, 10 Jul 2017 05:34:38 +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 6D9A67C598; Mon, 10 Jul 2017 05:34:38 +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 v6A5Yb22008988; Mon, 10 Jul 2017 05:34:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A5Yb6h008986; Mon, 10 Jul 2017 05:34:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707100534.v6A5Yb6h008986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 10 Jul 2017 05:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320862 - stable/11/tests/sys/opencrypto X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/tests/sys/opencrypto X-SVN-Commit-Revision: 320862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 05:34:38 -0000 Author: ngie Date: Mon Jul 10 05:34:37 2017 New Revision: 320862 URL: https://svnweb.freebsd.org/changeset/base/320862 Log: MFC r319455,r319456: r319455: Fix up `TEST_METADATA` - `TEST_METADATA.foo` should be `TEST_METADATA.run_tests`: this will unbreak trying to run the tests on a system without python installed in $PATH. - The tests require root because they load aesni(4) and/or cryptodev(4) if not already loaded. r319456: tests/sys/opencrypto/runtests: apply minor polish to test script - Refactor kld loading/unloading logic: -- Use a loop instead of an unrolled one. -- Check for the module being loaded before trying to load it, to reduce noise when loading modules that are already loaded. -- Don't mute stderr from kldload -- it could be potentially useful to the tester. -- In the event that the test script was terminated early, it would leave the modules still attached to the system (which is undesirable). Always unload the modules at test end with EXIT/SIGINT/SIGTERM so the system is returned to its former operating state as best possible. Unload the modules in reverse order, in part for consistency and/or dependency reasons. Modified: stable/11/tests/sys/opencrypto/Makefile stable/11/tests/sys/opencrypto/runtests.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/opencrypto/Makefile ============================================================================== --- stable/11/tests/sys/opencrypto/Makefile Mon Jul 10 05:16:07 2017 (r320861) +++ stable/11/tests/sys/opencrypto/Makefile Mon Jul 10 05:34:37 2017 (r320862) @@ -7,7 +7,9 @@ BINDIR= ${TESTSDIR} PLAIN_TESTS_SH= runtests -TEST_METADATA.foo+=required_programs="python" +TEST_METADATA.runtests+= required_programs="python" +TEST_METADATA.runtests+= required_user="root" + PYMODULES= cryptodev.py cryptodevh.py cryptotest.py dpkt.py ${PACKAGE}FILES+= ${PYMODULES} Modified: stable/11/tests/sys/opencrypto/runtests.sh ============================================================================== --- stable/11/tests/sys/opencrypto/runtests.sh Mon Jul 10 05:16:07 2017 (r320861) +++ stable/11/tests/sys/opencrypto/runtests.sh Mon Jul 10 05:34:37 2017 (r320862) @@ -29,21 +29,34 @@ # $FreeBSD$ # -set -e +set -ex if [ ! -d /usr/local/share/nist-kat ]; then echo 'Skipping, nist-kat package not installed for test vectors.' exit 0 fi -if kldload aesni 2>/dev/null; then - unloadaesni=1 -fi +loaded_modules= +cleanup_tests() +{ + trap - EXIT INT TERM -if kldload cryptodev 2>/dev/null; then - unloadcdev=1 -fi + set +e + # Unload modules in reverse order + for loaded_module in $(echo $loaded_modules | tr ' ' '\n' | sort -r); do + kldunload $loaded_module + done +} +trap cleanup_tests EXIT INT TERM + +for required_module in aesni cryptodev; do + if ! kldstat -q -m $required_module; then + kldload $required_module + loaded_modules="$loaded_modules $required_module" + fi +done + # Run software crypto test oldcdas=$(sysctl -e kern.cryptodevallowsoft) sysctl kern.cryptodevallowsoft=1 @@ -51,10 +64,3 @@ sysctl kern.cryptodevallowsoft=1 python $(dirname $0)/cryptotest.py sysctl "$oldcdas" - -if [ x"$unloadcdev" = x"1" ]; then - kldunload cryptodev -fi -if [ x"$unloadaesni" = x"1" ]; then - kldunload aesni -fi From owner-svn-src-stable@freebsd.org Mon Jul 10 05:59:07 2017 Return-Path: Delivered-To: svn-src-stable@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 941C1D9E909; Mon, 10 Jul 2017 05:59:07 +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 5E1027D068; Mon, 10 Jul 2017 05:59:07 +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 v6A5x6CG017270; Mon, 10 Jul 2017 05:59:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A5x61t017269; Mon, 10 Jul 2017 05:59:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707100559.v6A5x61t017269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Jul 2017 05:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320863 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 320863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 05:59:07 -0000 Author: kib Date: Mon Jul 10 05:59:06 2017 New Revision: 320863 URL: https://svnweb.freebsd.org/changeset/base/320863 Log: MFC r320619: Resolve confusion between different error code spaces. Modified: stable/11/sys/kern/kern_exec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_exec.c ============================================================================== --- stable/11/sys/kern/kern_exec.c Mon Jul 10 05:34:37 2017 (r320862) +++ stable/11/sys/kern/kern_exec.c Mon Jul 10 05:59:06 2017 (r320863) @@ -1057,9 +1057,9 @@ exec_unmap_first_page(imgp) } /* - * Destroy old address space, and allocate a new stack - * The new stack is only SGROWSIZ large because it is grown - * automatically in trap.c. + * Destroy old address space, and allocate a new stack. + * The new stack is only sgrowsiz large because it is grown + * automatically on a page fault. */ int exec_new_vmspace(imgp, sv) @@ -1113,9 +1113,9 @@ exec_new_vmspace(imgp, sv) VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_READ | VM_PROT_EXECUTE, MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); - if (error) { + if (error != KERN_SUCCESS) { vm_object_deallocate(obj); - return (error); + return (vm_mmap_to_errno(error)); } } @@ -1139,10 +1139,9 @@ exec_new_vmspace(imgp, sv) stack_addr = sv->sv_usrstack - ssiz; error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz, obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : - sv->sv_stackprot, - VM_PROT_ALL, MAP_STACK_GROWS_DOWN); - if (error) - return (error); + sv->sv_stackprot, VM_PROT_ALL, MAP_STACK_GROWS_DOWN); + if (error != KERN_SUCCESS) + return (vm_mmap_to_errno(error)); /* * vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but they From owner-svn-src-stable@freebsd.org Mon Jul 10 06:08:45 2017 Return-Path: Delivered-To: svn-src-stable@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 E6D9FD9EBC5; Mon, 10 Jul 2017 06:08:45 +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 B54797D458; Mon, 10 Jul 2017 06:08:45 +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 v6A68iMM021527; Mon, 10 Jul 2017 06:08:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A68i8L021526; Mon, 10 Jul 2017 06:08:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707100608.v6A68i8L021526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Jul 2017 06:08:44 +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: r320864 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 320864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 06:08:46 -0000 Author: kib Date: Mon Jul 10 06:08:44 2017 New Revision: 320864 URL: https://svnweb.freebsd.org/changeset/base/320864 Log: MFC r320619: Resolve confusion between different error code spaces. Modified: stable/10/sys/kern/kern_exec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_exec.c ============================================================================== --- stable/10/sys/kern/kern_exec.c Mon Jul 10 05:59:06 2017 (r320863) +++ stable/10/sys/kern/kern_exec.c Mon Jul 10 06:08:44 2017 (r320864) @@ -1043,9 +1043,9 @@ exec_unmap_first_page(imgp) } /* - * Destroy old address space, and allocate a new stack - * The new stack is only SGROWSIZ large because it is grown - * automatically in trap.c. + * Destroy old address space, and allocate a new stack. + * The new stack is only sgrowsiz large because it is grown + * automatically on a page fault. */ int exec_new_vmspace(imgp, sv) @@ -1099,9 +1099,9 @@ exec_new_vmspace(imgp, sv) VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_READ | VM_PROT_EXECUTE, MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); - if (error) { + if (error != KERN_SUCCESS) { vm_object_deallocate(obj); - return (error); + return (vm_mmap_to_errno(error)); } } @@ -1125,10 +1125,9 @@ exec_new_vmspace(imgp, sv) stack_addr = sv->sv_usrstack - ssiz; error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz, obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot : - sv->sv_stackprot, - VM_PROT_ALL, MAP_STACK_GROWS_DOWN); - if (error) - return (error); + sv->sv_stackprot, VM_PROT_ALL, MAP_STACK_GROWS_DOWN); + if (error != KERN_SUCCESS) + return (vm_mmap_to_errno(error)); #ifdef __ia64__ /* Allocate a new register stack */ From owner-svn-src-stable@freebsd.org Mon Jul 10 06:28:52 2017 Return-Path: Delivered-To: svn-src-stable@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 DC39BD9F07A; Mon, 10 Jul 2017 06:28:52 +0000 (UTC) (envelope-from grehan@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 9D4487DC8B; Mon, 10 Jul 2017 06:28:52 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6A6Sp9P029724; Mon, 10 Jul 2017 06:28:51 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6A6So8e029710; Mon, 10 Jul 2017 06:28:50 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201707100628.v6A6So8e029710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 10 Jul 2017 06:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320866 - in stable/11: lib/libvmmapi usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: in stable/11: lib/libvmmapi usr.sbin/bhyve X-SVN-Commit-Revision: 320866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 06:28:53 -0000 Author: grehan Date: Mon Jul 10 06:28:50 2017 New Revision: 320866 URL: https://svnweb.freebsd.org/changeset/base/320866 Log: MFC 313727, 317483 In addition, replace the missing caph routines with small helper functions (bhyverun.c) or an open-coded replacement (uart_emul.c) 313727 Capsicumize bhyve 317483 Allow CAP_MMAP_RW on memfd for PCI passthru Modified: stable/11/lib/libvmmapi/vmmapi.c stable/11/lib/libvmmapi/vmmapi.h stable/11/usr.sbin/bhyve/bhyverun.c stable/11/usr.sbin/bhyve/block_if.c stable/11/usr.sbin/bhyve/consport.c stable/11/usr.sbin/bhyve/dbgport.c stable/11/usr.sbin/bhyve/mevent.c stable/11/usr.sbin/bhyve/pci_e82545.c stable/11/usr.sbin/bhyve/pci_passthru.c stable/11/usr.sbin/bhyve/pci_virtio_net.c stable/11/usr.sbin/bhyve/pci_virtio_rnd.c stable/11/usr.sbin/bhyve/rfb.c stable/11/usr.sbin/bhyve/uart_emul.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/11/lib/libvmmapi/vmmapi.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/lib/libvmmapi/vmmapi.c Mon Jul 10 06:28:50 2017 (r320866) @@ -1416,3 +1416,45 @@ vm_restart_instruction(void *arg, int vcpu) return (ioctl(ctx->fd, VM_RESTART_INSTRUCTION, &vcpu)); } + +int +vm_get_device_fd(struct vmctx *ctx) +{ + + return (ctx->fd); +} + +const cap_ioctl_t * +vm_get_ioctls(size_t *len) +{ + cap_ioctl_t *cmds; + /* keep in sync with machine/vmm_dev.h */ + static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT, + VM_ALLOC_MEMSEG, VM_GET_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_MEMSEG, + VM_MMAP_GETNEXT, VM_SET_REGISTER, VM_GET_REGISTER, + VM_SET_SEGMENT_DESCRIPTOR, VM_GET_SEGMENT_DESCRIPTOR, + VM_INJECT_EXCEPTION, VM_LAPIC_IRQ, VM_LAPIC_LOCAL_IRQ, + VM_LAPIC_MSI, VM_IOAPIC_ASSERT_IRQ, VM_IOAPIC_DEASSERT_IRQ, + VM_IOAPIC_PULSE_IRQ, VM_IOAPIC_PINCOUNT, VM_ISA_ASSERT_IRQ, + VM_ISA_DEASSERT_IRQ, VM_ISA_PULSE_IRQ, VM_ISA_SET_IRQ_TRIGGER, + VM_SET_CAPABILITY, VM_GET_CAPABILITY, VM_BIND_PPTDEV, + VM_UNBIND_PPTDEV, VM_MAP_PPTDEV_MMIO, VM_PPTDEV_MSI, + VM_PPTDEV_MSIX, VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, + VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, + VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, + VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SET_INTINFO, VM_GET_INTINFO, + VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, + VM_RESTART_INSTRUCTION }; + + if (len == NULL) { + cmds = malloc(sizeof(vm_ioctl_cmds)); + if (cmds == NULL) + return (NULL); + bcopy(vm_ioctl_cmds, cmds, sizeof(vm_ioctl_cmds)); + return (cmds); + } + + *len = nitems(vm_ioctl_cmds); + return (NULL); +} + Modified: stable/11/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/11/lib/libvmmapi/vmmapi.h Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/lib/libvmmapi/vmmapi.h Mon Jul 10 06:28:50 2017 (r320866) @@ -36,7 +36,7 @@ * API version for out-of-tree consumers like grub-bhyve for making compile * time decisions. */ -#define VMMAPI_VERSION 0102 /* 2 digit major followed by 2 digit minor */ +#define VMMAPI_VERSION 0103 /* 2 digit major followed by 2 digit minor */ struct iovec; struct vmctx; @@ -102,6 +102,7 @@ int vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, vm_ooffset_t segoff, size_t len, int prot); int vm_create(const char *name); +int vm_get_device_fd(struct vmctx *ctx); struct vmctx *vm_open(const char *name); void vm_destroy(struct vmctx *ctx); int vm_parse_memsize(const char *optarg, size_t *memsize); @@ -161,6 +162,8 @@ int vm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *i1, uint64_t *i2); int vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t exit_intinfo); + +const cap_ioctl_t *vm_get_ioctls(size_t *len); /* * Return a pointer to the statistics buffer. Note that this is not MT-safe. Modified: stable/11/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/11/usr.sbin/bhyve/bhyverun.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/bhyverun.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include @@ -40,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -48,8 +52,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifndef WITHOUT_CAPSICUM +#include +#include +#endif #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include "bhyverun.h" @@ -152,7 +163,44 @@ usage(int code) exit(code); } +#ifndef WITHOUT_CAPSICUM +/* + * 11-stable capsicum helpers + */ +static void +bhyve_caph_cache_catpages(void) +{ + + (void)catopen("libc", NL_CAT_LOCALE); +} + static int +bhyve_caph_limit_stdoe(void) +{ + cap_rights_t rights; + unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ }; + int i, fds[] = { STDOUT_FILENO, STDERR_FILENO }; + + cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL); + cap_rights_set(&rights, CAP_WRITE); + + for (i = 0; i < nitems(fds); i++) { + if (cap_rights_limit(fds[i], &rights) < 0 && errno != ENOSYS) + return (-1); + + if (cap_ioctls_limit(fds[i], cmds, nitems(cmds)) < 0 && errno != ENOSYS) + return (-1); + + if (cap_fcntls_limit(fds[i], CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) + return (-1); + } + + return (0); +} + +#endif + +static int pincpu_parse(const char *opt) { int vcpu, pcpu; @@ -706,6 +754,11 @@ do_open(const char *vmname) struct vmctx *ctx; int error; bool reinit, romboot; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + const cap_ioctl_t *cmds; + size_t ncmds; +#endif reinit = romboot = false; @@ -744,6 +797,21 @@ do_open(const char *vmname) exit(1); } +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_IOCTL, CAP_MMAP_RW); + if (cap_rights_limit(vm_get_device_fd(ctx), &rights) == -1 && + errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + vm_get_ioctls(&ncmds); + cmds = vm_get_ioctls(NULL); + if (cmds == NULL) + errx(EX_OSERR, "out of memory"); + if (cap_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1 && + errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + free((cap_ioctl_t *)cmds); +#endif + if (reinit) { error = vm_reinit(ctx); if (error) { @@ -951,6 +1019,16 @@ main(int argc, char *argv[]) if (lpc_bootrom()) fwctl_init(); + +#ifndef WITHOUT_CAPSICUM + + + if (bhyve_caph_limit_stdoe() == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + + if (cap_enter() == -1 && errno != ENOSYS) + errx(EX_OSERR, "cap_enter() failed"); +#endif /* * Change the proc title to include the VM name. Modified: stable/11/usr.sbin/bhyve/block_if.c ============================================================================== --- stable/11/usr.sbin/bhyve/block_if.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/block_if.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -45,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -400,6 +404,10 @@ blockif_open(const char *optstr, const char *ident) off_t size, psectsz, psectoff; int extra, fd, i, sectsz; int nocache, sync, ro, candelete, geom, ssopt, pssopt; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t cmds[] = { DIOCGFLUSH, DIOCGDELETE }; +#endif pthread_once(&blockif_once, blockif_init); @@ -457,6 +465,16 @@ blockif_open(const char *optstr, const char *ident) goto err; } +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_FSYNC, CAP_IOCTL, CAP_READ, CAP_SEEK, + CAP_WRITE); + if (ro) + cap_rights_clear(&rights, CAP_FSYNC, CAP_WRITE); + + if (cap_rights_limit(fd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + /* * Deal with raw devices */ @@ -482,6 +500,11 @@ blockif_open(const char *optstr, const char *ident) geom = 1; } else psectsz = sbuf.st_blksize; + +#ifndef WITHOUT_CAPSICUM + if (cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif if (ssopt != 0) { if (!powerof2(ssopt) || !powerof2(pssopt) || ssopt < 512 || Modified: stable/11/usr.sbin/bhyve/consport.c ============================================================================== --- stable/11/usr.sbin/bhyve/consport.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/consport.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,13 +30,19 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include +#include +#include #include #include #include #include #include +#include #include "inout.h" #include "pci_lpc.h" @@ -104,6 +110,10 @@ console_handler(struct vmctx *ctx, int vcpu, int in, i uint32_t *eax, void *arg) { static int opened; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t cmds[] = { TIOCGETA, TIOCSETA, TIOCGWINSZ }; +#endif if (bytes == 2 && in) { *eax = BVM_CONS_SIG; @@ -123,6 +133,13 @@ console_handler(struct vmctx *ctx, int vcpu, int in, i return (-1); if (!opened) { +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); + if (cap_rights_limit(STDIN_FILENO, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif ttyopen(); opened = 1; } Modified: stable/11/usr.sbin/bhyve/dbgport.c ============================================================================== --- stable/11/usr.sbin/bhyve/dbgport.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/dbgport.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,13 +30,18 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include #include +#include #include #include +#include #include #include #include @@ -125,6 +130,9 @@ void init_dbgport(int sport) { int reuse; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif conn_fd = -1; @@ -154,6 +162,12 @@ init_dbgport(int sport) perror("listen"); exit(1); } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_ACCEPT, CAP_READ, CAP_WRITE); + if (cap_rights_limit(listen_fd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif register_inout(&dbgport); } Modified: stable/11/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/11/usr.sbin/bhyve/mevent.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/mevent.c Mon Jul 10 06:28:50 2017 (r320866) @@ -35,13 +35,18 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include +#include #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include @@ -401,6 +406,9 @@ mevent_dispatch(void) int mfd; int numev; int ret; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif mevent_tid = pthread_self(); mevent_set_name(); @@ -408,6 +416,12 @@ mevent_dispatch(void) mfd = kqueue(); assert(mfd > 0); +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_KQUEUE); + if (cap_rights_limit(mfd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + /* * Open the pipe that will be used for other threads to force * the blocking kqueue call to exit by writing to it. Set the @@ -418,6 +432,14 @@ mevent_dispatch(void) perror("pipe"); exit(0); } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); + if (cap_rights_limit(mevent_pipefd[0], &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_rights_limit(mevent_pipefd[1], &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif /* * Add internal event handler for the pipe write fd Modified: stable/11/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_e82545.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/pci_e82545.c Mon Jul 10 06:28:50 2017 (r320866) @@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -38,12 +41,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -2202,6 +2207,9 @@ static void e82545_open_tap(struct e82545_softc *sc, char *opts) { char tbuf[80]; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif if (opts == NULL) { sc->esc_tapfd = -1; @@ -2228,6 +2236,12 @@ e82545_open_tap(struct e82545_softc *sc, char *opts) sc->esc_tapfd = -1; } +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); + if (cap_rights_limit(sc->esc_tapfd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + sc->esc_mevp = mevent_add(sc->esc_tapfd, EVF_READ, e82545_tap_callback, Modified: stable/11/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_passthru.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/pci_passthru.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -44,7 +47,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -639,10 +644,19 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p { int bus, slot, func, error, memflags; struct passthru_softc *sc; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t pci_ioctls[] = { PCIOCREAD, PCIOCWRITE, PCIOCGETBAR }; + cap_ioctl_t io_ioctls[] = { IODEV_PIO }; +#endif sc = NULL; error = 1; +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_WRITE); +#endif + memflags = vm_get_memflags(ctx); if (!(memflags & VM_MEM_F_WIRED)) { warnx("passthru requires guest memory to be wired"); @@ -657,6 +671,13 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p } } +#ifndef WITHOUT_CAPSICUM + if (cap_rights_limit(pcifd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_ioctls_limit(pcifd, pci_ioctls, nitems(pci_ioctls)) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + if (iofd < 0) { iofd = open(_PATH_DEVIO, O_RDWR, 0); if (iofd < 0) { @@ -665,6 +686,13 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p } } +#ifndef WITHOUT_CAPSICUM + if (cap_rights_limit(iofd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_ioctls_limit(iofd, io_ioctls, nitems(io_ioctls)) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + if (memfd < 0) { memfd = open(_PATH_MEM, O_RDWR, 0); if (memfd < 0) { @@ -672,6 +700,13 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p goto done; } } + +#ifndef WITHOUT_CAPSICUM + cap_rights_clear(&rights, CAP_IOCTL); + cap_rights_set(&rights, CAP_MMAP_RW); + if (cap_rights_limit(memfd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif if (opts == NULL || sscanf(opts, "%d/%d/%d", &bus, &slot, &func) != 3) { Modified: stable/11/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_virtio_net.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/pci_virtio_net.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -41,6 +44,7 @@ __FBSDID("$FreeBSD$"); #endif #include +#include #include #include #include @@ -53,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "bhyverun.h" #include "pci_emul.h" @@ -743,6 +748,9 @@ static void pci_vtnet_tap_setup(struct pci_vtnet_softc *sc, char *devname) { char tbuf[80]; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif strcpy(tbuf, "/dev/"); strlcat(tbuf, devname, sizeof(tbuf)); @@ -766,6 +774,12 @@ pci_vtnet_tap_setup(struct pci_vtnet_softc *sc, char * close(sc->vsc_tapfd); sc->vsc_tapfd = -1; } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); + if (cap_rights_limit(sc->vsc_tapfd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif sc->vsc_mevp = mevent_add(sc->vsc_tapfd, EVF_READ, Modified: stable/11/usr.sbin/bhyve/pci_virtio_rnd.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_virtio_rnd.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/pci_virtio_rnd.c Mon Jul 10 06:28:50 2017 (r320866) @@ -35,9 +35,13 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include +#include #include #include #include @@ -46,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "bhyverun.h" #include "pci_emul.h" @@ -138,6 +143,9 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst * int fd; int len; uint8_t v; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif /* * Should always be able to open /dev/random. @@ -145,6 +153,12 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst * fd = open("/dev/random", O_RDONLY | O_NONBLOCK); assert(fd >= 0); + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_READ); + if (cap_rights_limit(fd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif /* * Check that device is seeded and non-blocking. Modified: stable/11/usr.sbin/bhyve/rfb.c ============================================================================== --- stable/11/usr.sbin/bhyve/rfb.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/rfb.c Mon Jul 10 06:28:50 2017 (r320866) @@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -39,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -46,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -972,6 +978,9 @@ rfb_init(char *hostname, int port, int wait, char *pas struct rfb_softc *rc; struct sockaddr_in sin; int on = 1; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif rc = calloc(1, sizeof(struct rfb_softc)); @@ -1009,6 +1018,12 @@ rfb_init(char *hostname, int port, int wait, char *pas perror("listen"); return (-1); } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_ACCEPT, CAP_EVENT, CAP_READ, CAP_WRITE); + if (cap_rights_limit(rc->sfd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif rc->hw_crc = sse42_supported(); Modified: stable/11/usr.sbin/bhyve/uart_emul.c ============================================================================== --- stable/11/usr.sbin/bhyve/uart_emul.c Mon Jul 10 06:25:30 2017 (r320865) +++ stable/11/usr.sbin/bhyve/uart_emul.c Mon Jul 10 06:28:50 2017 (r320866) @@ -32,16 +32,22 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include +#include +#include #include #include #include #include #include #include +#include #include "mevent.h" #include "uart_emul.h" @@ -638,7 +644,7 @@ uart_tty_backend(struct uart_softc *sc, const char *op sc->tty.opened = true; retval = 0; } - + return (retval); } @@ -646,6 +652,11 @@ int uart_set_backend(struct uart_softc *sc, const char *opts) { int retval; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t cmds[] = { TIOCGETA, TIOCSETA, TIOCGWINSZ }; + cap_ioctl_t sicmds[] = { TIOCGETA, TIOCGWINSZ }; +#endif retval = -1; @@ -666,6 +677,23 @@ uart_set_backend(struct uart_softc *sc, const char *op /* Make the backend file descriptor non-blocking */ if (retval == 0) retval = fcntl(sc->tty.fd, F_SETFL, O_NONBLOCK); + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); + if (cap_rights_limit(sc->tty.fd, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_ioctls_limit(sc->tty.fd, cmds, nitems(cmds)) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (!uart_stdio) { + cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_READ); + if (cap_rights_limit(STDIN_FILENO, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_ioctls_limit(STDIN_FILENO, sicmds, nitems(sicmds)) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (cap_fcntls_limit(STDIN_FILENO, CAP_FCNTL_GETFL) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + } +#endif if (retval == 0) uart_opentty(sc); From owner-svn-src-stable@freebsd.org Mon Jul 10 12:24:57 2017 Return-Path: Delivered-To: svn-src-stable@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 6855FDA6C7D; Mon, 10 Jul 2017 12:24:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3238B29FA; Mon, 10 Jul 2017 12:24:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ACOudC077694; Mon, 10 Jul 2017 12:24:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ACOuBQ077693; Mon, 10 Jul 2017 12:24:56 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707101224.v6ACOuBQ077693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 10 Jul 2017 12:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320870 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 320870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 12:24:57 -0000 Author: gjb Date: Mon Jul 10 12:24:56 2017 New Revision: 320870 URL: https://svnweb.freebsd.org/changeset/base/320870 Log: MFC r320785: Connect ena(4) to the build. Sponsored by: The FreeBSD Foundation Modified: stable/11/share/man/man4/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Mon Jul 10 09:00:35 2017 (r320869) +++ stable/11/share/man/man4/Makefile Mon Jul 10 12:24:56 2017 (r320870) @@ -146,6 +146,7 @@ MAN= aac.4 \ ehci.4 \ em.4 \ en.4 \ + ena.4 \ enc.4 \ epair.4 \ esp.4 \ From owner-svn-src-stable@freebsd.org Mon Jul 10 17:55:45 2017 Return-Path: Delivered-To: svn-src-stable@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 3E8E8DAD724; Mon, 10 Jul 2017 17:55:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ADF8717C2; Mon, 10 Jul 2017 17:55:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B293410AF18; Mon, 10 Jul 2017 13:55:43 -0400 (EDT) From: John Baldwin To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r320824 - in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb Date: Mon, 10 Jul 2017 10:01:45 -0700 Message-ID: <7608713.faVMYlhHnq@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201707090428.v694Shij070144@pdx.rh.CN85.dnsmgr.net> References: <201707090428.v694Shij070144@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 10 Jul 2017 13:55:43 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 17:55:45 -0000 On Saturday, July 08, 2017 09:28:43 PM Rodney W. Grimes wrote: > > Author: jhb > > Date: Sun Jul 9 04:13:33 2017 > > New Revision: 320824 > > URL: https://svnweb.freebsd.org/changeset/base/320824 > > > > Log: > > MFC 320675: Add deprecation notices for gdb and kgdb. > > > > Even though gdb and kgdb may not be removed for 12.0 on some architectures, > > the notice is unconditional as these tools will likely be removed at some > > point in the future when adequate replacements are available (gdb in ports > > or lldb in base). > > Thanks for doing this, but we are still falling slightly short of 17.4 on > deprecation on the aspect of "Use of the deprecated feature generates a warning". Hmm. There may be times when generating a warning is problematic (e.g. could be a POLA violation that breaks scripting if you alter the output of utilities). Other cases like device drivers are easier to reason about (just add a new device_printf during attach), but gdb/kgdb might be more problematic due to POLA. -- John Baldwin From owner-svn-src-stable@freebsd.org Mon Jul 10 18:06:55 2017 Return-Path: Delivered-To: svn-src-stable@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 2832FDADB13; Mon, 10 Jul 2017 18:06:55 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0486A72000; Mon, 10 Jul 2017 18:06:54 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v6AI6rjc076963; Mon, 10 Jul 2017 11:06:53 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v6AI6rXg076962; Mon, 10 Jul 2017 11:06:53 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201707101806.v6AI6rXg076962@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r320824 - in stable: 10/gnu/usr.bin/gdb/gdb 10/gnu/usr.bin/gdb/kgdb 11/gnu/usr.bin/gdb/gdb 11/gnu/usr.bin/gdb/kgdb In-Reply-To: <7608713.faVMYlhHnq@ralph.baldwin.cx> To: John Baldwin Date: Mon, 10 Jul 2017 11:06:53 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jul 2017 18:06:55 -0000 > On Saturday, July 08, 2017 09:28:43 PM Rodney W. Grimes wrote: > > > Author: jhb > > > Date: Sun Jul 9 04:13:33 2017 > > > New Revision: 320824 > > > URL: https://svnweb.freebsd.org/changeset/base/320824 > > > > > > Log: > > > MFC 320675: Add deprecation notices for gdb and kgdb. > > > > > > Even though gdb and kgdb may not be removed for 12.0 on some architectures, > > > the notice is unconditional as these tools will likely be removed at some > > > point in the future when adequate replacements are available (gdb in ports > > > or lldb in base). > > > > Thanks for doing this, but we are still falling slightly short of 17.4 on > > deprecation on the aspect of "Use of the deprecated feature generates a warning". > > Hmm. There may be times when generating a warning is problematic (e.g. could > be a POLA violation that breaks scripting if you alter the output of utilities). The message should be go to stderr, I would hope the scripts are not parsing stderr. It is a bigger POLA when the utility goes away in 12.0 and the user wasnt informed that it was going away. (Yea, it is in the man page and the release notes but we all know that no one reads that.) It might even be good to break there scripts with a POLA violation, making it very clear they have future action to take. > Other cases like device drivers are easier to reason about (just add a new device_printf > during attach), but gdb/kgdb might be more problematic due to POLA. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Tue Jul 11 03:45:49 2017 Return-Path: Delivered-To: svn-src-stable@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 1EAA9D934E5; Tue, 11 Jul 2017 03:45:49 +0000 (UTC) (envelope-from mjg@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 DFF64837F1; Tue, 11 Jul 2017 03:45:48 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6B3jmFa054655; Tue, 11 Jul 2017 03:45:48 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B3jmkt054654; Tue, 11 Jul 2017 03:45:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201707110345.v6B3jmkt054654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 11 Jul 2017 03:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320885 - stable/10/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/10/sys/sys X-SVN-Commit-Revision: 320885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 03:45:49 -0000 Author: mjg Date: Tue Jul 11 03:45:47 2017 New Revision: 320885 URL: https://svnweb.freebsd.org/changeset/base/320885 Log: Remove waiters check from the inline rw wunlock routine. This is a direct commit to stable/10. r310979 is a merge of depessimisation of locking primitives. The important part was getting rid of an attempt to grab the lock in the slow path immediately after the fast path failed. In addition to that temporary checks were added before all atomic ops. They have no impact on semantic nor correctness, they only avoid an atomic operation which is likely to fail. After the addition of atomic_fcmpset and further changes said checks became pessimal and got removed. This may get merged to stable/10. Reports started showing up about a crash in all branches having extra checks. The codepath is: .. -> vm_map_delete -> __rw_wunlock_hard -> turnstile_broadcast The kernel crashed trying to wake up nonexistent waiters. The lock value as found in the vmcore matches the panicking thread, so in particular there was no waiters bit set. The bit can only be cleared by the current owner. A debug patch was provided, which reportedly had a side effect of getting rid of the issue. Also one of the reporters said that reverting the patch which adds the extra checks makes the crash go away. It was also reported that head with the fcmpset changes (explicit checks removed) also stops crashing. Finally, one user tested crashing stable/10 variant with just the rw wunlock check removed. The common case in all but one reports was an Intel Atom cpu. Claiming a cpu bug at this point is bold and I'm going to refrain from it, but right now apart from cpu-specific optimisation made by the compiler on custom kernel compiles I don't see how this can be a software bug. This will have to be investigated more. Meanwhile, restore rw wunlock to pre-r310979 state. PR: 213903 Modified: stable/10/sys/sys/rwlock.h Modified: stable/10/sys/sys/rwlock.h ============================================================================== --- stable/10/sys/sys/rwlock.h Tue Jul 11 00:32:48 2017 (r320884) +++ stable/10/sys/sys/rwlock.h Tue Jul 11 03:45:47 2017 (r320885) @@ -109,7 +109,7 @@ \ if ((rw)->rw_recurse) \ (rw)->rw_recurse--; \ - else if ((rw)->rw_lock != _tid || !_rw_write_unlock((rw), _tid))\ + else if (!_rw_write_unlock((rw), _tid)) \ _rw_wunlock_hard((rw), _tid, (file), (line)); \ } while (0) From owner-svn-src-stable@freebsd.org Tue Jul 11 05:31:38 2017 Return-Path: Delivered-To: svn-src-stable@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 A1415D95BA8; Tue, 11 Jul 2017 05:31:38 +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 696F818EA; Tue, 11 Jul 2017 05:31:38 +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 v6B5VbFW096188; Tue, 11 Jul 2017 05:31:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B5Vb3D096187; Tue, 11 Jul 2017 05:31:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707110531.v6B5Vb3D096187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Jul 2017 05:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320886 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/libexec/rtld-elf X-SVN-Commit-Revision: 320886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 05:31:38 -0000 Author: kib Date: Tue Jul 11 05:31:37 2017 New Revision: 320886 URL: https://svnweb.freebsd.org/changeset/base/320886 Log: MFC r320658: When reporting undefined symbol, note the version, if specified. Modified: stable/11/libexec/rtld-elf/rtld.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Tue Jul 11 03:45:47 2017 (r320885) +++ stable/11/libexec/rtld-elf/rtld.c Tue Jul 11 05:31:37 2017 (r320886) @@ -1658,6 +1658,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref const Elf_Sym *ref; const Elf_Sym *def; const Obj_Entry *defobj; + const Ver_Entry *ve; SymLook req; const char *name; int res; @@ -1677,6 +1678,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref name = refobj->strtab + ref->st_name; def = NULL; defobj = NULL; + ve = NULL; /* * We don't have to do a full scale lookup if the symbol is local. @@ -1693,7 +1695,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref } symlook_init(&req, name); req.flags = flags; - req.ventry = fetch_ventry(refobj, symnum); + ve = req.ventry = fetch_ventry(refobj, symnum); req.lockstate = lockstate; res = symlook_default(&req, refobj); if (res == 0) { @@ -1723,7 +1725,8 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref } } else { if (refobj != &obj_rtld) - _rtld_error("%s: Undefined symbol \"%s\"", refobj->path, name); + _rtld_error("%s: Undefined symbol \"%s%s%s\"", refobj->path, name, + ve != NULL ? "@" : "", ve != NULL ? ve->name : ""); } return def; } @@ -3488,7 +3491,8 @@ do_dlsym(void *handle, const char *name, void *retaddr return (sym); } - _rtld_error("Undefined symbol \"%s\"", name); + _rtld_error("Undefined symbol \"%s%s%s\"", name, ve != NULL ? "@" : "", + ve != NULL ? ve->name : ""); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); return NULL; From owner-svn-src-stable@freebsd.org Tue Jul 11 05:33:09 2017 Return-Path: Delivered-To: svn-src-stable@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 42C8AD95DEB; Tue, 11 Jul 2017 05:33:09 +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 08E661B61; Tue, 11 Jul 2017 05:33:08 +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 v6B5X7B5099301; Tue, 11 Jul 2017 05:33:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B5X7YS099300; Tue, 11 Jul 2017 05:33:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707110533.v6B5X7YS099300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Jul 2017 05:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320887 - stable/11/lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/sys X-SVN-Commit-Revision: 320887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 05:33:09 -0000 Author: kib Date: Tue Jul 11 05:33:07 2017 New Revision: 320887 URL: https://svnweb.freebsd.org/changeset/base/320887 Log: MFC r320801: Simplify language. Modified: stable/11/lib/libc/sys/mmap.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/mmap.2 ============================================================================== --- stable/11/lib/libc/sys/mmap.2 Tue Jul 11 05:31:37 2017 (r320886) +++ stable/11/lib/libc/sys/mmap.2 Tue Jul 11 05:33:07 2017 (r320887) @@ -329,10 +329,12 @@ stack top is the starting address returned by the call bytes. The bottom of the stack at maximum growth is the starting address returned by the call. -The system uses guards to prevent the inadvertent use of -regions into which stacks created with +.Pp +Stacks created with .Dv MAP_STACK -will automatically grow, without mapping the whole stack in advance. +automatically grow. +Guards prevent inadvertent use of the regions into which those +stacks can grow without requiring mapping the whole stack in advance. .El .Pp The From owner-svn-src-stable@freebsd.org Tue Jul 11 05:36:03 2017 Return-Path: Delivered-To: svn-src-stable@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 95E4CD95F51; Tue, 11 Jul 2017 05:36:03 +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 619661D5E; Tue, 11 Jul 2017 05:36:03 +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 v6B5a2n9099470; Tue, 11 Jul 2017 05:36:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B5a2iL099469; Tue, 11 Jul 2017 05:36:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707110536.v6B5a2iL099469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Jul 2017 05:36:02 +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: r320888 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/libexec/rtld-elf X-SVN-Commit-Revision: 320888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 05:36:03 -0000 Author: kib Date: Tue Jul 11 05:36:02 2017 New Revision: 320888 URL: https://svnweb.freebsd.org/changeset/base/320888 Log: MFC r320658: When reporting undefined symbol, note the version, if specified. Modified: stable/10/libexec/rtld-elf/rtld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Tue Jul 11 05:33:07 2017 (r320887) +++ stable/10/libexec/rtld-elf/rtld.c Tue Jul 11 05:36:02 2017 (r320888) @@ -1547,6 +1547,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref const Elf_Sym *ref; const Elf_Sym *def; const Obj_Entry *defobj; + const Ver_Entry *ve; SymLook req; const char *name; int res; @@ -1566,6 +1567,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref name = refobj->strtab + ref->st_name; def = NULL; defobj = NULL; + ve = NULL; /* * We don't have to do a full scale lookup if the symbol is local. @@ -1582,7 +1584,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref } symlook_init(&req, name); req.flags = flags; - req.ventry = fetch_ventry(refobj, symnum); + ve = req.ventry = fetch_ventry(refobj, symnum); req.lockstate = lockstate; res = symlook_default(&req, refobj); if (res == 0) { @@ -1612,7 +1614,8 @@ find_symdef(unsigned long symnum, const Obj_Entry *ref } } else { if (refobj != &obj_rtld) - _rtld_error("%s: Undefined symbol \"%s\"", refobj->path, name); + _rtld_error("%s: Undefined symbol \"%s%s%s\"", refobj->path, name, + ve != NULL ? "@" : "", ve != NULL ? ve->name : ""); } return def; } @@ -3283,7 +3286,8 @@ do_dlsym(void *handle, const char *name, void *retaddr return (sym); } - _rtld_error("Undefined symbol \"%s\"", name); + _rtld_error("Undefined symbol \"%s%s%s\"", name, ve != NULL ? "@" : "", + ve != NULL ? ve->name : ""); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); return NULL; From owner-svn-src-stable@freebsd.org Tue Jul 11 05:46:56 2017 Return-Path: Delivered-To: svn-src-stable@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 A750CD962CD; Tue, 11 Jul 2017 05:46:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65C2A24DA; Tue, 11 Jul 2017 05:46:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6B5ktnX003891; Tue, 11 Jul 2017 05:46:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B5ktCG003890; Tue, 11 Jul 2017 05:46:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707110546.v6B5ktCG003890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 11 Jul 2017 05:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320889 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 320889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 05:46:56 -0000 Author: kib Date: Tue Jul 11 05:46:55 2017 New Revision: 320889 URL: https://svnweb.freebsd.org/changeset/base/320889 Log: Restore layout of struct vm_map_entry, to restore layout of struct vm_map which embeds vm_map_entries. This is a direct commit to stable/11. Diagnosed by: markj Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/vm/vm_map.h Modified: stable/11/sys/vm/vm_map.h ============================================================================== --- stable/11/sys/vm/vm_map.h Tue Jul 11 05:36:02 2017 (r320888) +++ stable/11/sys/vm/vm_map.h Tue Jul 11 05:46:55 2017 (r320889) @@ -103,6 +103,7 @@ struct vm_map_entry { struct vm_map_entry *right; /* right child in binary search tree */ vm_offset_t start; /* start address */ vm_offset_t end; /* end address */ + vm_offset_t pad0; vm_offset_t next_read; /* vaddr of the next sequential read */ vm_size_t adj_free; /* amount of adjacent free space */ vm_size_t max_free; /* max free space in subtree */ From owner-svn-src-stable@freebsd.org Tue Jul 11 06:39:13 2017 Return-Path: Delivered-To: svn-src-stable@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 C900DD9731C; Tue, 11 Jul 2017 06:39:13 +0000 (UTC) (envelope-from grehan@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 95BFE3BAC; Tue, 11 Jul 2017 06:39:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6B6dCtm023921; Tue, 11 Jul 2017 06:39:12 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6B6dCdR023918; Tue, 11 Jul 2017 06:39:12 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201707110639.v6B6dCdR023918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Tue, 11 Jul 2017 06:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320891 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 320891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 06:39:13 -0000 Author: grehan Date: Tue Jul 11 06:39:12 2017 New Revision: 320891 URL: https://svnweb.freebsd.org/changeset/base/320891 Log: MFC r317542, r317543, r317543 317542 comment fix 317543 set rfb default port 317543 listen on localhost by default for rfb Modified: stable/11/usr.sbin/bhyve/pci_fbuf.c stable/11/usr.sbin/bhyve/pci_xhci.c stable/11/usr.sbin/bhyve/rfb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_fbuf.c Tue Jul 11 05:49:42 2017 (r320890) +++ stable/11/usr.sbin/bhyve/pci_fbuf.c Tue Jul 11 06:39:12 2017 (r320891) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); * BAR0 points to the current mode information. * BAR1 is the 32-bit framebuffer address. * - * -s ,fbuf,wait,tcp=:port,w=width,h=height + * -s ,fbuf,wait,vga=on|io|off,rfb=:port,w=width,h=height */ static int fbuf_debug = 1; Modified: stable/11/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_xhci.c Tue Jul 11 05:49:42 2017 (r320890) +++ stable/11/usr.sbin/bhyve/pci_xhci.c Tue Jul 11 06:39:12 2017 (r320891) @@ -28,7 +28,7 @@ -s ,xhci,{devices} devices: - ums USB tablet mouse + tablet USB tablet mouse */ #include __FBSDID("$FreeBSD$"); Modified: stable/11/usr.sbin/bhyve/rfb.c ============================================================================== --- stable/11/usr.sbin/bhyve/rfb.c Tue Jul 11 05:49:42 2017 (r320890) +++ stable/11/usr.sbin/bhyve/rfb.c Tue Jul 11 06:39:12 2017 (r320891) @@ -1003,11 +1003,11 @@ rfb_init(char *hostname, int port, int wait, char *pas sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; - sin.sin_port = htons(port); + sin.sin_port = port ? htons(port) : htons(5900); if (hostname && strlen(hostname) > 0) inet_pton(AF_INET, hostname, &(sin.sin_addr)); else - sin.sin_addr.s_addr = htonl(INADDR_ANY); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); if (bind(rc->sfd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("bind"); From owner-svn-src-stable@freebsd.org Tue Jul 11 21:25:08 2017 Return-Path: Delivered-To: svn-src-stable@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 DF630DAC4E7; Tue, 11 Jul 2017 21:25:08 +0000 (UTC) (envelope-from erj@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 94904685CF; Tue, 11 Jul 2017 21:25:08 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BLP7Ub093953; Tue, 11 Jul 2017 21:25:07 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BLP7Pg093948; Tue, 11 Jul 2017 21:25:07 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201707112125.v6BLP7Pg093948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 11 Jul 2017 21:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv X-SVN-Commit-Revision: 320897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 21:25:09 -0000 Author: erj Date: Tue Jul 11 21:25:07 2017 New Revision: 320897 URL: https://svnweb.freebsd.org/changeset/base/320897 Log: MFC r316541, r316544, and r320688 from HEAD to stable/11. r316541: Fix a double free in ixgbe_rxeof() r316544: Don't overwrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf() r320688: ixgbe(4): Update HEAD (p3) to 3.2.12-k Includes: - Support for X550EM devices. - Support for Bypass adapters. - Flow Director code moved to separate files - SR-IOV code moved to separate files - Netmap code moved to separate files Sponsored by: Intel Corporation Added: stable/11/sys/dev/ixgbe/if_bypass.c - copied unchanged from r320688, head/sys/dev/ixgbe/if_bypass.c stable/11/sys/dev/ixgbe/if_fdir.c - copied unchanged from r320688, head/sys/dev/ixgbe/if_fdir.c stable/11/sys/dev/ixgbe/if_sriov.c - copied unchanged from r320688, head/sys/dev/ixgbe/if_sriov.c stable/11/sys/dev/ixgbe/ixgbe_bypass.h - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_bypass.h stable/11/sys/dev/ixgbe/ixgbe_fdir.h - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_fdir.h stable/11/sys/dev/ixgbe/ixgbe_features.h - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_features.h stable/11/sys/dev/ixgbe/ixgbe_netmap.c - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_netmap.c stable/11/sys/dev/ixgbe/ixgbe_netmap.h - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_netmap.h stable/11/sys/dev/ixgbe/ixgbe_rss.h - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_rss.h stable/11/sys/dev/ixgbe/ixgbe_sriov.h - copied unchanged from r320688, head/sys/dev/ixgbe/ixgbe_sriov.h Modified: stable/11/sys/conf/files stable/11/sys/dev/ixgbe/if_ix.c stable/11/sys/dev/ixgbe/if_ixv.c stable/11/sys/dev/ixgbe/ix_txrx.c stable/11/sys/dev/ixgbe/ixgbe.h stable/11/sys/dev/ixgbe/ixgbe_82598.c stable/11/sys/dev/ixgbe/ixgbe_82598.h stable/11/sys/dev/ixgbe/ixgbe_82599.c stable/11/sys/dev/ixgbe/ixgbe_82599.h stable/11/sys/dev/ixgbe/ixgbe_api.c stable/11/sys/dev/ixgbe/ixgbe_api.h stable/11/sys/dev/ixgbe/ixgbe_common.c stable/11/sys/dev/ixgbe/ixgbe_common.h stable/11/sys/dev/ixgbe/ixgbe_dcb.c stable/11/sys/dev/ixgbe/ixgbe_dcb.h stable/11/sys/dev/ixgbe/ixgbe_dcb_82598.c stable/11/sys/dev/ixgbe/ixgbe_dcb_82598.h stable/11/sys/dev/ixgbe/ixgbe_dcb_82599.c stable/11/sys/dev/ixgbe/ixgbe_dcb_82599.h stable/11/sys/dev/ixgbe/ixgbe_mbx.c stable/11/sys/dev/ixgbe/ixgbe_mbx.h stable/11/sys/dev/ixgbe/ixgbe_osdep.c stable/11/sys/dev/ixgbe/ixgbe_osdep.h stable/11/sys/dev/ixgbe/ixgbe_phy.c stable/11/sys/dev/ixgbe/ixgbe_phy.h stable/11/sys/dev/ixgbe/ixgbe_type.h stable/11/sys/dev/ixgbe/ixgbe_vf.c stable/11/sys/dev/ixgbe/ixgbe_vf.h stable/11/sys/dev/ixgbe/ixgbe_x540.c stable/11/sys/dev/ixgbe/ixgbe_x540.h stable/11/sys/dev/ixgbe/ixgbe_x550.c stable/11/sys/dev/ixgbe/ixgbe_x550.h stable/11/sys/modules/ix/Makefile stable/11/sys/modules/ixv/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Tue Jul 11 18:24:05 2017 (r320896) +++ stable/11/sys/conf/files Tue Jul 11 21:25:07 2017 (r320897) @@ -2076,6 +2076,14 @@ dev/ixgbe/if_ix.c optional ix inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP" dev/ixgbe/if_ixv.c optional ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP" +dev/ixgbe/if_bypass.c optional ix inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/ixgbe_netmap.c optional ix inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/if_fdir.c optional ix inet | ixv inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/if_sriov.c optional ix inet | ixv inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ix_txrx.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_osdep.c optional ix inet | ixv inet \ Copied: stable/11/sys/dev/ixgbe/if_bypass.c (from r320688, head/sys/dev/ixgbe/if_bypass.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/ixgbe/if_bypass.c Tue Jul 11 21:25:07 2017 (r320897, copy of r320688, head/sys/dev/ixgbe/if_bypass.c) @@ -0,0 +1,808 @@ +/****************************************************************************** + + Copyright (c) 2001-2017, Intel Corporation + 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. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + 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 OWNER 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$*/ + + +#include "ixgbe.h" + +/************************************************************************ + * ixgbe_bypass_mutex_enter + * + * Mutex support for the bypass feature. Using a dual lock + * to facilitate a privileged access to the watchdog update + * over other threads. + ************************************************************************/ +static void +ixgbe_bypass_mutex_enter(struct adapter *adapter) +{ + while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0) + usec_delay(3000); + while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + usec_delay(3000); + return; +} /* ixgbe_bypass_mutex_enter */ + +/************************************************************************ + * ixgbe_bypass_mutex_clear + ************************************************************************/ +static void +ixgbe_bypass_mutex_clear(struct adapter *adapter) +{ + while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + usec_delay(6000); + while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0) + usec_delay(6000); + return; +} /* ixgbe_bypass_mutex_clear */ + +/************************************************************************ + * ixgbe_bypass_wd_mutex_enter + * + * Watchdog entry is allowed to simply grab the high priority + ************************************************************************/ +static void +ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) +{ + while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + usec_delay(3000); + return; +} /* ixgbe_bypass_wd_mutex_enter */ + +/************************************************************************ + * ixgbe_bypass_wd_mutex_clear + ************************************************************************/ +static void +ixgbe_bypass_wd_mutex_clear(struct adapter *adapter) +{ + while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + usec_delay(6000); + return; +} /* ixgbe_bypass_wd_mutex_clear */ + +/************************************************************************ + * ixgbe_get_bypass_time + ************************************************************************/ +static void +ixgbe_get_bypass_time(u32 *year, u32 *sec) +{ + struct timespec current; + + *year = 1970; /* time starts at 01/01/1970 */ + nanotime(¤t); + *sec = current.tv_sec; + + while(*sec > SEC_THIS_YEAR(*year)) { + *sec -= SEC_THIS_YEAR(*year); + (*year)++; + } +} /* ixgbe_get_bypass_time */ + +/************************************************************************ + * ixgbe_bp_version + * + * Display the feature version + ************************************************************************/ +static int +ixgbe_bp_version(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int version = 0; + u32 cmd; + + ixgbe_bypass_mutex_enter(adapter); + cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; + cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) & + BYPASS_CTL2_OFFSET_M; + if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0)) + goto err; + msec_delay(100); + cmd &= ~BYPASS_WE; + if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0)) + goto err; + ixgbe_bypass_mutex_clear(adapter); + version &= BYPASS_CTL2_DATA_M; + error = sysctl_handle_int(oidp, &version, 0, req); + return (error); +err: + ixgbe_bypass_mutex_clear(adapter); + return (error); + +} /* ixgbe_bp_version */ + +/************************************************************************ + * ixgbe_bp_set_state + * + * Show/Set the Bypass State: + * 1 = NORMAL + * 2 = BYPASS + * 3 = ISOLATE + * + * With no argument the state is displayed, + * passing a value will set it. + ************************************************************************/ +static int +ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int state = 0; + + /* Get the current state */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, + BYPASS_PAGE_CTL0, &state); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3; + + error = sysctl_handle_int(oidp, &state, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Sanity check new state */ + switch (state) { + case BYPASS_NORM: + case BYPASS_BYPASS: + case BYPASS_ISOLATE: + break; + default: + return (EINVAL); + } + ixgbe_bypass_mutex_enter(adapter); + if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_MODE_OFF_M, state) != 0)) + goto out; + /* Set AUTO back on so FW can receive events */ + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_MODE_OFF_M, BYPASS_AUTO); +out: + ixgbe_bypass_mutex_clear(adapter); + usec_delay(6000); + return (error); +} /* ixgbe_bp_set_state */ + +/************************************************************************ + * The following routines control the operational + * "rules" of the feature, what behavior will occur + * when particular events occur. + * Values are: + * 0 - no change for the event (NOP) + * 1 - go to Normal operation + * 2 - go to Bypass operation + * 3 - go to Isolate operation + * Calling the entry with no argument just displays + * the current rule setting. + ************************************************************************/ + +/************************************************************************ + * ixgbe_bp_timeout + * + * This is to set the Rule for the watchdog, + * not the actual watchdog timeout value. + ************************************************************************/ +static int +ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int timeout = 0; + + /* Get the current value */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3; + + error = sysctl_handle_int(oidp, &timeout, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Sanity check on the setting */ + switch (timeout) { + case BYPASS_NOP: + case BYPASS_NORM: + case BYPASS_BYPASS: + case BYPASS_ISOLATE: + break; + default: + return (EINVAL); + } + + /* Set the new state */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT); + ixgbe_bypass_mutex_clear(adapter); + usec_delay(6000); + return (error); +} /* ixgbe_bp_timeout */ + +/************************************************************************ + * ixgbe_bp_main_on + ************************************************************************/ +static int +ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int main_on = 0; + + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on); + main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3; + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + + error = sysctl_handle_int(oidp, &main_on, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Sanity check on the setting */ + switch (main_on) { + case BYPASS_NOP: + case BYPASS_NORM: + case BYPASS_BYPASS: + case BYPASS_ISOLATE: + break; + default: + return (EINVAL); + } + + /* Set the new state */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT); + ixgbe_bypass_mutex_clear(adapter); + usec_delay(6000); + return (error); +} /* ixgbe_bp_main_on */ + +/************************************************************************ + * ixgbe_bp_main_off + ************************************************************************/ +static int +ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int main_off = 0; + + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3; + + error = sysctl_handle_int(oidp, &main_off, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Sanity check on the setting */ + switch (main_off) { + case BYPASS_NOP: + case BYPASS_NORM: + case BYPASS_BYPASS: + case BYPASS_ISOLATE: + break; + default: + return (EINVAL); + } + + /* Set the new state */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT); + ixgbe_bypass_mutex_clear(adapter); + usec_delay(6000); + return (error); +} /* ixgbe_bp_main_off */ + +/************************************************************************ + * ixgbe_bp_aux_on + ************************************************************************/ +static int +ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int aux_on = 0; + + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3; + + error = sysctl_handle_int(oidp, &aux_on, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Sanity check on the setting */ + switch (aux_on) { + case BYPASS_NOP: + case BYPASS_NORM: + case BYPASS_BYPASS: + case BYPASS_ISOLATE: + break; + default: + return (EINVAL); + } + + /* Set the new state */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT); + ixgbe_bypass_mutex_clear(adapter); + usec_delay(6000); + return (error); +} /* ixgbe_bp_aux_on */ + +/************************************************************************ + * ixgbe_bp_aux_off + ************************************************************************/ +static int +ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error = 0; + static int aux_off = 0; + + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3; + + error = sysctl_handle_int(oidp, &aux_off, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Sanity check on the setting */ + switch (aux_off) { + case BYPASS_NOP: + case BYPASS_NORM: + case BYPASS_BYPASS: + case BYPASS_ISOLATE: + break; + default: + return (EINVAL); + } + + /* Set the new state */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, + BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT); + ixgbe_bypass_mutex_clear(adapter); + usec_delay(6000); + return (error); +} /* ixgbe_bp_aux_off */ + +/************************************************************************ + * ixgbe_bp_wd_set - Set the Watchdog timer value + * + * Valid settings are: + * - 0 will disable the watchdog + * - 1, 2, 3, 4, 8, 16, 32 + * - anything else is invalid and will be ignored + ************************************************************************/ +static int +ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + int error, tmp; + static int timeout = 0; + u32 mask, arg = BYPASS_PAGE_CTL0; + + /* Get the current hardware value */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (error); + /* + * If armed keep the displayed value, + * else change the display to zero. + */ + if ((tmp & (0x1 << BYPASS_WDT_ENABLE_SHIFT)) == 0) + timeout = 0; + + error = sysctl_handle_int(oidp, &timeout, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + mask = BYPASS_WDT_ENABLE_M; + switch (timeout) { + case 0: /* disables the timer */ + break; + case 1: + arg = BYPASS_WDT_1_5 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + case 2: + arg = BYPASS_WDT_2 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + case 3: + arg = BYPASS_WDT_3 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + case 4: + arg = BYPASS_WDT_4 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + case 8: + arg = BYPASS_WDT_8 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + case 16: + arg = BYPASS_WDT_16 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + case 32: + arg = BYPASS_WDT_32 << BYPASS_WDT_TIME_SHIFT; + arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask |= BYPASS_WDT_VALUE_M; + break; + default: + return (EINVAL); + } + /* Set the new watchdog */ + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg); + ixgbe_bypass_mutex_clear(adapter); + + return (error); +} /* ixgbe_bp_wd_set */ + +/************************************************************************ + * ixgbe_bp_wd_reset - Reset the Watchdog timer + * + * To activate this it must be called with any argument. + ************************************************************************/ +static int +ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + u32 sec, year; + int cmd, count = 0, error = 0; + int reset_wd = 0; + + error = sysctl_handle_int(oidp, &reset_wd, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + cmd = BYPASS_PAGE_CTL1 | BYPASS_WE | BYPASS_CTL1_WDT_PET; + + /* Resync the FW time while writing to CTL1 anyway */ + ixgbe_get_bypass_time(&year, &sec); + + cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID; + cmd |= BYPASS_CTL1_OFFTRST; + + ixgbe_bypass_wd_mutex_enter(adapter); + error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd); + + /* Read until it matches what we wrote, or we time out */ + do { + if (count++ > 10) { + error = IXGBE_BYPASS_FW_WRITE_FAILURE; + break; + } + if (hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL1, &reset_wd)) { + error = IXGBE_ERR_INVALID_ARGUMENT; + break; + } + } while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd)); + + reset_wd = 0; + ixgbe_bypass_wd_mutex_clear(adapter); + return (error); +} /* ixgbe_bp_wd_reset */ + +/************************************************************************ + * ixgbe_bp_log - Display the bypass log + * + * You must pass a non-zero arg to sysctl + ************************************************************************/ +static int +ixgbe_bp_log(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter = (struct adapter *) arg1; + struct ixgbe_hw *hw = &adapter->hw; + u32 cmd, base, head; + u32 log_off, count = 0; + static int status = 0; + u8 data; + struct ixgbe_bypass_eeprom eeprom[BYPASS_MAX_LOGS]; + int i, error = 0; + + error = sysctl_handle_int(oidp, &status, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + /* Keep the log display single-threaded */ + while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0) + usec_delay(3000); + + ixgbe_bypass_mutex_enter(adapter); + + /* Find Current head of the log eeprom offset */ + cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; + cmd |= (0x1 << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; + error = hw->mac.ops.bypass_rw(hw, cmd, &status); + if (error) + goto unlock_err; + + /* wait for the write to stick */ + msec_delay(100); + + /* Now read the results */ + cmd &= ~BYPASS_WE; + error = hw->mac.ops.bypass_rw(hw, cmd, &status); + if (error) + goto unlock_err; + + ixgbe_bypass_mutex_clear(adapter); + + base = status & BYPASS_CTL2_DATA_M; + head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT; + + /* address of the first log */ + log_off = base + (head * 5); + + /* extract all the log entries */ + while (count < BYPASS_MAX_LOGS) { + eeprom[count].logs = 0; + eeprom[count].actions = 0; + + /* Log 5 bytes store in on u32 and a u8 */ + for (i = 0; i < 4; i++) { + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, + &data); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (-EINVAL); + eeprom[count].logs += data << (8 * i); + } + + ixgbe_bypass_mutex_enter(adapter); + error = hw->mac.ops.bypass_rd_eep(hw, + log_off + i, &eeprom[count].actions); + ixgbe_bypass_mutex_clear(adapter); + if (error) + return (-EINVAL); + + /* Quit if not a unread log */ + if (!(eeprom[count].logs & BYPASS_LOG_CLEAR_M)) + break; + /* + * Log looks good so store the address where it's + * Unread Log bit is so we can clear it after safely + * pulling out all of the log data. + */ + eeprom[count].clear_off = log_off; + + count++; + head = head ? head - 1 : BYPASS_MAX_LOGS; + log_off = base + (head * 5); + } + + /* reverse order (oldest first) for output */ + while (count--) { + int year; + u32 mon, days, hours, min, sec; + u32 time = eeprom[count].logs & BYPASS_LOG_TIME_M; + u32 event = (eeprom[count].logs & BYPASS_LOG_EVENT_M) >> + BYPASS_LOG_EVENT_SHIFT; + u8 action = eeprom[count].actions & BYPASS_LOG_ACTION_M; + u16 day_mon[2][13] = { + {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, + {0, 31, 59, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} + }; + char *event_str[] = {"unknown", "main on", "aux on", + "main off", "aux off", "WDT", "user" }; + char *action_str[] = {"ignore", "normal", "bypass", "isolate",}; + + /* verify vaild data 1 - 6 */ + if (event < BYPASS_EVENT_MAIN_ON || event > BYPASS_EVENT_USR) + event = 0; + + /* + * time is in sec's this year, so convert to something + * printable. + */ + ixgbe_get_bypass_time(&year, &sec); + days = time / SEC_PER_DAY; + for (i = 11; days < day_mon[LEAP_YR(year)][i]; i--) + continue; + mon = i + 1; /* display month as 1-12 */ + time -= (day_mon[LEAP_YR(year)][i] * SEC_PER_DAY); + days = (time / SEC_PER_DAY) + 1; /* first day is 1 */ + time %= SEC_PER_DAY; + hours = time / (60 * 60); + time %= (60 * 60); + min = time / 60; + sec = time % 60; + device_printf(adapter->dev, + "UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n", + mon, days, hours, min, sec, event_str[event], + action_str[action]); + cmd = BYPASS_PAGE_CTL2 | BYPASS_WE | BYPASS_CTL2_RW; + cmd |= ((eeprom[count].clear_off + 3) + << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; + cmd |= ((eeprom[count].logs & ~BYPASS_LOG_CLEAR_M) >> 24); + + ixgbe_bypass_mutex_enter(adapter); + + error = hw->mac.ops.bypass_rw(hw, cmd, &status); + + /* wait for the write to stick */ + msec_delay(100); + + ixgbe_bypass_mutex_clear(adapter); + + if (error) + return (-EINVAL); + } + + status = 0; /* reset */ + /* Another log command can now run */ + while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + usec_delay(3000); + return(error); + +unlock_err: + ixgbe_bypass_mutex_clear(adapter); + status = 0; /* reset */ + while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + usec_delay(3000); + return (-EINVAL); +} /* ixgbe_bp_log */ + +/************************************************************************ + * ixgbe_bypass_init - Set up infrastructure for the bypass feature + * + * Do time and sysctl initialization here. This feature is + * only enabled for the first port of a bypass adapter. + ************************************************************************/ +void +ixgbe_bypass_init(struct adapter *adapter) +{ + struct ixgbe_hw *hw = &adapter->hw; + device_t dev = adapter->dev; + struct sysctl_oid *bp_node; + struct sysctl_oid_list *bp_list; + u32 mask, value, sec, year; + + if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS)) + return; + + /* First set up time for the hardware */ + ixgbe_get_bypass_time(&year, &sec); + + mask = BYPASS_CTL1_TIME_M + | BYPASS_CTL1_VALID_M + | BYPASS_CTL1_OFFTRST_M; + + value = (sec & BYPASS_CTL1_TIME_M) + | BYPASS_CTL1_VALID + | BYPASS_CTL1_OFFTRST; + + ixgbe_bypass_mutex_enter(adapter); + hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value); + ixgbe_bypass_mutex_clear(adapter); + + /* Now set up the SYSCTL infrastructure */ + + /* + * The log routine is kept separate from the other + * children so a general display command like: + * `sysctl dev.ix.0.bypass` will not show the log. + */ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "bypass_log", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_log, "I", "Bypass Log"); + + /* All other setting are hung from the 'bypass' node */ + bp_node = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "bypass", CTLFLAG_RD, NULL, "Bypass"); + + bp_list = SYSCTL_CHILDREN(bp_node); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "version", CTLTYPE_INT | CTLFLAG_RD, + adapter, 0, ixgbe_bp_version, "I", "Bypass Version"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_set_state, "I", "Bypass State"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "timeout", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "main_on", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "main_off", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "aux_on", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "aux_off", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "wd_set", CTLTYPE_INT | CTLFLAG_RW, + adapter, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, + OID_AUTO, "wd_reset", CTLTYPE_INT | CTLFLAG_WR, + adapter, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); + + adapter->feat_en |= IXGBE_FEATURE_BYPASS; + + return; +} /* ixgbe_bypass_init */ + Copied: stable/11/sys/dev/ixgbe/if_fdir.c (from r320688, head/sys/dev/ixgbe/if_fdir.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/ixgbe/if_fdir.c Tue Jul 11 21:25:07 2017 (r320897, copy of r320688, head/sys/dev/ixgbe/if_fdir.c) @@ -0,0 +1,160 @@ +/****************************************************************************** + + Copyright (c) 2001-2017, Intel Corporation + 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. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + 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 OWNER 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$*/ + +#include "ixgbe.h" + +#ifdef IXGBE_FDIR + +void +ixgbe_init_fdir(struct adapter *adapter) +{ + u32 hdrm = 32 << fdir_pballoc; + + if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + return; + + adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm, + PBA_STRATEGY_EQUAL); + ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc); +} /* ixgbe_init_fdir */ + +void +ixgbe_reinit_fdir(void *context, int pending) +{ + struct adapter *adapter = context; + struct ifnet *ifp = adapter->ifp; + + if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + return; + if (adapter->fdir_reinit != 1) /* Shouldn't happen */ + return; + ixgbe_reinit_fdir_tables_82599(&adapter->hw); + adapter->fdir_reinit = 0; + /* re-enable flow director interrupts */ + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); + /* Restart the interface */ + ifp->if_drv_flags |= IFF_DRV_RUNNING; +} /* ixgbe_reinit_fdir */ + +/************************************************************************ + * ixgbe_atr + * + * Parse packet headers so that Flow Director can make + * a hashed filter table entry allowing traffic flows + * to be identified and kept on the same cpu. This + * would be a performance hit, but we only do it at + * IXGBE_FDIR_RATE of packets. + ************************************************************************/ +void +ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) +{ + struct adapter *adapter = txr->adapter; + struct ix_queue *que; + struct ip *ip; + struct tcphdr *th; + struct udphdr *uh; + struct ether_vlan_header *eh; + union ixgbe_atr_hash_dword input = {.dword = 0}; + union ixgbe_atr_hash_dword common = {.dword = 0}; + int ehdrlen, ip_hlen; + u16 etype; + + eh = mtod(mp, struct ether_vlan_header *); + if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + etype = eh->evl_proto; + } else { + ehdrlen = ETHER_HDR_LEN; + etype = eh->evl_encap_proto; + } + + /* Only handling IPv4 */ + if (etype != htons(ETHERTYPE_IP)) + return; + + ip = (struct ip *)(mp->m_data + ehdrlen); + ip_hlen = ip->ip_hl << 2; + + /* check if we're UDP or TCP */ + switch (ip->ip_p) { + case IPPROTO_TCP: + th = (struct tcphdr *)((caddr_t)ip + ip_hlen); + /* src and dst are inverted */ + common.port.dst ^= th->th_sport; + common.port.src ^= th->th_dport; + input.formatted.flow_type ^= IXGBE_ATR_FLOW_TYPE_TCPV4; + break; + case IPPROTO_UDP: + uh = (struct udphdr *)((caddr_t)ip + ip_hlen); + /* src and dst are inverted */ + common.port.dst ^= uh->uh_sport; + common.port.src ^= uh->uh_dport; + input.formatted.flow_type ^= IXGBE_ATR_FLOW_TYPE_UDPV4; + break; + default: + return; + } + + input.formatted.vlan_id = htobe16(mp->m_pkthdr.ether_vtag); + if (mp->m_pkthdr.ether_vtag) + common.flex_bytes ^= htons(ETHERTYPE_VLAN); + else + common.flex_bytes ^= etype; + common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr; + + que = &adapter->queues[txr->me]; + /* + * This assumes the Rx queue and Tx + * queue are bound to the same CPU + */ + ixgbe_fdir_add_signature_filter_82599(&adapter->hw, + input, common, que->msix); +} /* ixgbe_atr */ + +#else + +/* TASK_INIT needs this function defined regardless if it's enabled */ +void +ixgbe_reinit_fdir(void *context, int pending) +{ + UNREFERENCED_2PARAMETER(context, pending); +} /* ixgbe_reinit_fdir */ + +void +ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) +{ + UNREFERENCED_2PARAMETER(txr, mp); +} /* ixgbe_atr */ + +#endif Modified: stable/11/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ix.c Tue Jul 11 18:24:05 2017 (r320896) +++ stable/11/sys/dev/ixgbe/if_ix.c Tue Jul 11 21:25:07 2017 (r320897) @@ -1,31 +1,31 @@ /****************************************************************************** - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2017, Intel Corporation All rights reserved. - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Jul 11 21:51:44 2017 Return-Path: Delivered-To: svn-src-stable@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 5F5ECDACCA7; Tue, 11 Jul 2017 21:51:44 +0000 (UTC) (envelope-from marius@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 1E8AF6A455; Tue, 11 Jul 2017 21:51:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BLphKD006384; Tue, 11 Jul 2017 21:51:43 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BLphMS006383; Tue, 11 Jul 2017 21:51:43 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707112151.v6BLphMS006383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 11 Jul 2017 21:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320898 - stable/11/sys/dev/sdhci X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/sdhci X-SVN-Commit-Revision: 320898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 21:51:44 -0000 Author: marius Date: Tue Jul 11 21:51:43 2017 New Revision: 320898 URL: https://svnweb.freebsd.org/changeset/base/320898 Log: MFC: r320577, r320620 Retry up to 2 ms to enable bus power as at least with some Intel SDHCI/eMMC controllers the first attempt after a D3 to D0 transition, i. e. when the firmware has put the devices into D3 state before, can fail. Modified: stable/11/sys/dev/sdhci/sdhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/11/sys/dev/sdhci/sdhci.c Tue Jul 11 21:25:07 2017 (r320897) +++ stable/11/sys/dev/sdhci/sdhci.c Tue Jul 11 21:51:43 2017 (r320898) @@ -366,6 +366,7 @@ sdhci_set_clock(struct sdhci_slot *slot, uint32_t cloc static void sdhci_set_power(struct sdhci_slot *slot, u_char power) { + int i; uint8_t pwr; if (slot->power == power) @@ -394,9 +395,20 @@ sdhci_set_power(struct sdhci_slot *slot, u_char power) break; } WR1(slot, SDHCI_POWER_CONTROL, pwr); - /* Turn on the power. */ + /* + * Turn on VDD1 power. Note that at least some Intel controllers can + * fail to enable bus power on the first try after transiting from D3 + * to D0, so we give them up to 2 ms. + */ pwr |= SDHCI_POWER_ON; - WR1(slot, SDHCI_POWER_CONTROL, pwr); + for (i = 0; i < 20; i++) { + WR1(slot, SDHCI_POWER_CONTROL, pwr); + if (RD1(slot, SDHCI_POWER_CONTROL) & SDHCI_POWER_ON) + break; + DELAY(100); + } + if (!(RD1(slot, SDHCI_POWER_CONTROL) & SDHCI_POWER_ON)) + slot_printf(slot, "Bus power failed to enable"); if (slot->quirks & SDHCI_QUIRK_INTEL_POWER_UP_RESET) { WR1(slot, SDHCI_POWER_CONTROL, pwr | 0x10); From owner-svn-src-stable@freebsd.org Tue Jul 11 21:52:12 2017 Return-Path: Delivered-To: svn-src-stable@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 C104EDACCFF; Tue, 11 Jul 2017 21:52:12 +0000 (UTC) (envelope-from marius@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 8A5A96A5C8; Tue, 11 Jul 2017 21:52:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6BLqB9b006446; Tue, 11 Jul 2017 21:52:11 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6BLqBu7006445; Tue, 11 Jul 2017 21:52:11 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707112152.v6BLqBu7006445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 11 Jul 2017 21:52:11 +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: r320899 - stable/10/sys/dev/sdhci X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/sdhci X-SVN-Commit-Revision: 320899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2017 21:52:12 -0000 Author: marius Date: Tue Jul 11 21:52:11 2017 New Revision: 320899 URL: https://svnweb.freebsd.org/changeset/base/320899 Log: MFC: r320577, r320620 Retry up to 2 ms to enable bus power as at least with some Intel SDHCI/eMMC controllers the first attempt after a D3 to D0 transition, i. e. when the firmware has put the devices into D3 state before, can fail. Modified: stable/10/sys/dev/sdhci/sdhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/10/sys/dev/sdhci/sdhci.c Tue Jul 11 21:51:43 2017 (r320898) +++ stable/10/sys/dev/sdhci/sdhci.c Tue Jul 11 21:52:11 2017 (r320899) @@ -367,6 +367,7 @@ sdhci_set_clock(struct sdhci_slot *slot, uint32_t cloc static void sdhci_set_power(struct sdhci_slot *slot, u_char power) { + int i; uint8_t pwr; if (slot->power == power) @@ -395,9 +396,20 @@ sdhci_set_power(struct sdhci_slot *slot, u_char power) break; } WR1(slot, SDHCI_POWER_CONTROL, pwr); - /* Turn on the power. */ + /* + * Turn on VDD1 power. Note that at least some Intel controllers can + * fail to enable bus power on the first try after transiting from D3 + * to D0, so we give them up to 20 ms. + */ pwr |= SDHCI_POWER_ON; - WR1(slot, SDHCI_POWER_CONTROL, pwr); + for (i = 0; i < 20; i++) { + WR1(slot, SDHCI_POWER_CONTROL, pwr); + if (RD1(slot, SDHCI_POWER_CONTROL) & SDHCI_POWER_ON) + break; + DELAY(100); + } + if (!(RD1(slot, SDHCI_POWER_CONTROL) & SDHCI_POWER_ON)) + slot_printf(slot, "Bus power failed to enable"); if (slot->quirks & SDHCI_QUIRK_INTEL_POWER_UP_RESET) { WR1(slot, SDHCI_POWER_CONTROL, pwr | 0x10); From owner-svn-src-stable@freebsd.org Wed Jul 12 06:49:33 2017 Return-Path: Delivered-To: svn-src-stable@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 BAA1EDB44C3; Wed, 12 Jul 2017 06:49:33 +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 7AFDE7B948; Wed, 12 Jul 2017 06:49:33 +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 v6C6nWUa024932; Wed, 12 Jul 2017 06:49:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C6nW3P024931; Wed, 12 Jul 2017 06:49:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707120649.v6C6nW3P024931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 12 Jul 2017 06:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320903 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 320903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 06:49:33 -0000 Author: kib Date: Wed Jul 12 06:49:32 2017 New Revision: 320903 URL: https://svnweb.freebsd.org/changeset/base/320903 Log: MFC r320843: Fix loop termination in vm_map_find_min(). Modified: stable/11/sys/vm/vm_map.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Wed Jul 12 02:53:54 2017 (r320902) +++ stable/11/sys/vm/vm_map.c Wed Jul 12 06:49:32 2017 (r320903) @@ -1571,7 +1571,7 @@ vm_map_find_min(vm_map_t map, vm_object_t object, vm_o find_space, prot, max, cow); if (rv == KERN_SUCCESS || min_addr >= hint) return (rv); - *addr = min_addr; + *addr = hint = min_addr; } } From owner-svn-src-stable@freebsd.org Wed Jul 12 07:26:09 2017 Return-Path: Delivered-To: svn-src-stable@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 62273DB4C68; Wed, 12 Jul 2017 07:26:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D8E47CAEF; Wed, 12 Jul 2017 07:26:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6C7Q8dq041106; Wed, 12 Jul 2017 07:26:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C7Q78c041105; Wed, 12 Jul 2017 07:26:07 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707120726.v6C7Q78c041105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 12 Jul 2017 07:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320907 - in stable: 10/crypto/heimdal/lib/krb5 11/crypto/heimdal/lib/krb5 X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable: 10/crypto/heimdal/lib/krb5 11/crypto/heimdal/lib/krb5 X-SVN-Commit-Revision: 320907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 07:26:09 -0000 Author: delphij Date: Wed Jul 12 07:26:07 2017 New Revision: 320907 URL: https://svnweb.freebsd.org/changeset/base/320907 Log: MFC r320906: MFV r320905: Import upstream fix for CVE-2017-11103. In _krb5_extract_ticket() the KDC-REP service name must be obtained from encrypted version stored in 'enc_part' instead of the unencrypted version stored in 'ticket'. Use of the unecrypted version provides an opportunity for successful server impersonation and other attacks. Submitted by: hrs Obtained from: Heimdal Security: FreeBSD-SA-17:05.heimdal Security: CVE-2017-11103 Modified: stable/11/crypto/heimdal/lib/krb5/ticket.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/crypto/heimdal/lib/krb5/ticket.c Directory Properties: stable/10/ (props changed) Modified: stable/11/crypto/heimdal/lib/krb5/ticket.c ============================================================================== --- stable/11/crypto/heimdal/lib/krb5/ticket.c Wed Jul 12 07:19:06 2017 (r320906) +++ stable/11/crypto/heimdal/lib/krb5/ticket.c Wed Jul 12 07:26:07 2017 (r320907) @@ -713,8 +713,8 @@ _krb5_extract_ticket(krb5_context context, /* check server referral and save principal */ ret = _krb5_principalname2krb5_principal (context, &tmp_principal, - rep->kdc_rep.ticket.sname, - rep->kdc_rep.ticket.realm); + rep->enc_part.sname, + rep->enc_part.srealm); if (ret) goto out; if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){ From owner-svn-src-stable@freebsd.org Wed Jul 12 07:26:09 2017 Return-Path: Delivered-To: svn-src-stable@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 61632DB4C67; Wed, 12 Jul 2017 07:26:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F20C7CAEE; Wed, 12 Jul 2017 07:26:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6C7Q8D8041112; Wed, 12 Jul 2017 07:26:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6C7Q8ho041111; Wed, 12 Jul 2017 07:26:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707120726.v6C7Q8ho041111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 12 Jul 2017 07:26:08 +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: r320907 - in stable: 10/crypto/heimdal/lib/krb5 11/crypto/heimdal/lib/krb5 X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable: 10/crypto/heimdal/lib/krb5 11/crypto/heimdal/lib/krb5 X-SVN-Commit-Revision: 320907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 07:26:09 -0000 Author: delphij Date: Wed Jul 12 07:26:07 2017 New Revision: 320907 URL: https://svnweb.freebsd.org/changeset/base/320907 Log: MFC r320906: MFV r320905: Import upstream fix for CVE-2017-11103. In _krb5_extract_ticket() the KDC-REP service name must be obtained from encrypted version stored in 'enc_part' instead of the unencrypted version stored in 'ticket'. Use of the unecrypted version provides an opportunity for successful server impersonation and other attacks. Submitted by: hrs Obtained from: Heimdal Security: FreeBSD-SA-17:05.heimdal Security: CVE-2017-11103 Modified: stable/10/crypto/heimdal/lib/krb5/ticket.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/crypto/heimdal/lib/krb5/ticket.c Directory Properties: stable/11/ (props changed) Modified: stable/10/crypto/heimdal/lib/krb5/ticket.c ============================================================================== --- stable/10/crypto/heimdal/lib/krb5/ticket.c Wed Jul 12 07:19:06 2017 (r320906) +++ stable/10/crypto/heimdal/lib/krb5/ticket.c Wed Jul 12 07:26:07 2017 (r320907) @@ -713,8 +713,8 @@ _krb5_extract_ticket(krb5_context context, /* check server referral and save principal */ ret = _krb5_principalname2krb5_principal (context, &tmp_principal, - rep->kdc_rep.ticket.sname, - rep->kdc_rep.ticket.realm); + rep->enc_part.sname, + rep->enc_part.srealm); if (ret) goto out; if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){ From owner-svn-src-stable@freebsd.org Wed Jul 12 11:40:11 2017 Return-Path: Delivered-To: svn-src-stable@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 F1624D9521D; Wed, 12 Jul 2017 11:40:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCE9684501; Wed, 12 Jul 2017 11:40:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CBe9HL045210; Wed, 12 Jul 2017 11:40:09 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CBe9ox045209; Wed, 12 Jul 2017 11:40:09 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707121140.v6CBe9ox045209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 12 Jul 2017 11:40:09 +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: r320913 - stable/10/release X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release X-SVN-Commit-Revision: 320913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 11:40:11 -0000 Author: gjb Date: Wed Jul 12 11:40:09 2017 New Revision: 320913 URL: https://svnweb.freebsd.org/changeset/base/320913 Log: MFC r300761, r300762: r300761: Disconnect the AZURE target from the CLOUDWARE list. Microsoft has graciously overtaken publication of FreeBSD on Azure since 10.3-RELEASE. Many thanks to Microsoft for their support of FreeBSD on Azure. r300762: Disconnect the OPENSTACK target from the CLOUDWARE list. This was reported to not work as expected, and feedback following the report was never received. In addition, we do not publish these anywhere publicly. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile.vm Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile.vm ============================================================================== --- stable/10/release/Makefile.vm Wed Jul 12 08:07:55 2017 (r320912) +++ stable/10/release/Makefile.vm Wed Jul 12 11:40:09 2017 (r320913) @@ -16,10 +16,8 @@ VMDK_DESC= VMWare, VirtualBox disk image QCOW2_DESC= Qemu, KVM disk image RAW_DESC= Unformatted raw disk image -CLOUDWARE?= AZURE \ - EC2 \ +CLOUDWARE?= EC2 \ GCE \ - OPENSTACK \ VAGRANT-VIRTUALBOX \ VAGRANT-VMWARE AZURE_FORMAT= vhdf From owner-svn-src-stable@freebsd.org Wed Jul 12 12:43:50 2017 Return-Path: Delivered-To: svn-src-stable@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 38D97D96E1B for ; Wed, 12 Jul 2017 12:43:50 +0000 (UTC) (envelope-from olivier@freebsd.org) Received: from smtp.smtpout.orange.fr (smtp13.smtpout.orange.fr [80.12.242.135]) by mx1.freebsd.org (Postfix) with ESMTP id 9A299181F for ; Wed, 12 Jul 2017 12:43:48 +0000 (UTC) (envelope-from olivier@freebsd.org) Received: from mail-yb0-f181.google.com ([209.85.213.181]) by mwinf5d71 with ME id joc71v00G3vPQnD03oc7yj; Wed, 12 Jul 2017 14:36:09 +0200 X-ME-Helo: mail-yb0-f181.google.com X-ME-Auth: Y29jaGFyZC1sYWJiZS5vbGl2aWVyQG9yYW5nZS5mcg== X-ME-Date: Wed, 12 Jul 2017 14:36:09 +0200 X-ME-IP: 209.85.213.181 Received: by mail-yb0-f181.google.com with SMTP id f194so6439594yba.3; Wed, 12 Jul 2017 05:36:07 -0700 (PDT) X-Gm-Message-State: AIVw113f5JO6BwjYhYecen14wUlEiTyb/THbt/LVGX7ChY6IxCrz3kZY 0z8jVHyl5PzejvpCYVn8kTKZR4RClw== X-Received: by 10.37.170.13 with SMTP id s13mr544275ybi.239.1499862966596; Wed, 12 Jul 2017 05:36:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.4.195 with HTTP; Wed, 12 Jul 2017 05:35:46 -0700 (PDT) In-Reply-To: <201707112125.v6BLP7Pg093948@repo.freebsd.org> References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> From: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= Date: Wed, 12 Jul 2017 14:35:46 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: Eric Joyner Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 12:43:50 -0000 On Tue, Jul 11, 2017 at 11:25 PM, Eric Joyner wrote: > Author: erj > Date: Tue Jul 11 21:25:07 2017 > New Revision: 320897 > URL: https://svnweb.freebsd.org/changeset/base/320897 > > Log: > MFC r316541, r316544, and r320688 from HEAD to stable/11. > > =E2=80=8BHi Eric, I've got a regression with this commit: My Intel 82599ES is no more detected. Before this commit: =E2=80=8B[root@R1]~# uname -a FreeBSD R1 11.1-PRERELEASE FreeBSD 11.1-PRERELEASE r320896M amd64 [root@R1]~# pciconf -lv ix0@pci0:21:0:0: class=3D0x020000 card=3D0x00038086 chip=3D0x10fb808= 6 rev=3D0x01 hdr=3D0x00 vendor =3D 'Intel Corporation' device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' class =3D network subclass =3D ethernet ix1@pci0:21:0:1: class=3D0x020000 card=3D0x00038086 chip=3D0x10fb808= 6 rev=3D0x01 hdr=3D0x00 vendor =3D 'Intel Corporation' device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' class =3D network subclass =3D ethernet =E2=80=8B =E2=80=8BAfter this commit:=E2=80=8B =E2=80=8B[root@R1]~# uname -a FreeBSD R1 11.1-PRERELEASE FreeBSD 11.1-PRERELEASE r320897M amd64 [root@R1]~# pciconf -lv none17@pci0:21:0:0: class=3D0x020000 card=3D0x00038086 chip=3D0x10fb808= 6 rev=3D0x01 hdr=3D0x00 vendor =3D 'Intel Corporation' device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' class =3D network subclass =3D ethernet none18@pci0:21:0:1: class=3D0x020000 card=3D0x00038086 chip=3D0x10fb808= 6 rev=3D0x01 hdr=3D0x00 vendor =3D 'Intel Corporation' device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' class =3D network subclass =3D ethernet From owner-svn-src-stable@freebsd.org Wed Jul 12 14:34:09 2017 Return-Path: Delivered-To: svn-src-stable@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 5F1F2D98E09; Wed, 12 Jul 2017 14:34:09 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (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 2E3FE6490A; Wed, 12 Jul 2017 14:34:08 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (75-173-114-235.albq.qwest.net [75.173.114.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 975471928AB; Wed, 12 Jul 2017 14:34:05 +0000 (UTC) Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: =?UTF-8?Q?Olivier_Cochard-Labb=c3=a9?= , Eric Joyner Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> From: Sean Bruno Message-ID: Date: Wed, 12 Jul 2017 08:34:01 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="d74dnrfV52f4tWqMGT3SDuS3hN84fKfev" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 14:34:09 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --d74dnrfV52f4tWqMGT3SDuS3hN84fKfev Content-Type: multipart/mixed; boundary="Iaq062jUuMa1c8cEtFvQ3SckMAnnH8rXB"; protected-headers="v1" From: Sean Bruno To: =?UTF-8?Q?Olivier_Cochard-Labb=c3=a9?= , Eric Joyner Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Message-ID: Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> In-Reply-To: --Iaq062jUuMa1c8cEtFvQ3SckMAnnH8rXB Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 07/12/17 06:35, Olivier Cochard-Labb=C3=A9 wrote: > On Tue, Jul 11, 2017 at 11:25 PM, Eric Joyner > wrote: >=20 > Author: erj > Date: Tue Jul 11 21:25:07 2017 > New Revision: 320897 > URL: https://svnweb.freebsd.org/changeset/base/320897 > >=20 > Log: > MFC r316541, r316544, and r320688 from HEAD to stable/11. >=20 >=20 > =E2=80=8BHi Eric, >=20 > I've got a regression with this commit: My Intel 82599ES is no more > detected. >=20 > Before this commit: >=20 > =E2=80=8B[root@R1]~# uname -a > FreeBSD R1 11.1-PRERELEASE FreeBSD 11.1-PRERELEASE r320896M amd64 > [root@R1]~# pciconf -lv > ix0@pci0:21:0:0: class=3D0x020000 card=3D0x00038086 chip=3D0x10f= b8086 > rev=3D0x01 hdr=3D0x00 > vendor =3D 'Intel Corporation' > device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' > class =3D network > subclass =3D ethernet > ix1@pci0:21:0:1: class=3D0x020000 card=3D0x00038086 chip=3D0x10f= b8086 > rev=3D0x01 hdr=3D0x00 > vendor =3D 'Intel Corporation' > device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' > class =3D network > subclass =3D ethernet > =E2=80=8B > =E2=80=8BAfter this commit:=E2=80=8B > =E2=80=8B[root@R1]~# uname -a > FreeBSD R1 11.1-PRERELEASE FreeBSD 11.1-PRERELEASE r320897M amd64 > [root@R1]~# pciconf -lv > none17@pci0:21:0:0: class=3D0x020000 card=3D0x00038086 chip=3D0x10f= b8086 > rev=3D0x01 hdr=3D0x00 > vendor =3D 'Intel Corporation' > device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' > class =3D network > subclass =3D ethernet > none18@pci0:21:0:1: class=3D0x020000 card=3D0x00038086 chip=3D0x10f= b8086 > rev=3D0x01 hdr=3D0x00 > vendor =3D 'Intel Corporation' > device =3D '82599ES 10-Gigabit SFI/SFP+ Network Connection' > class =3D network > subclass =3D ethernet Huh ... is there anything in your console boot messages that would seem to indicate an error on attach? sean --Iaq062jUuMa1c8cEtFvQ3SckMAnnH8rXB-- --d74dnrfV52f4tWqMGT3SDuS3hN84fKfev Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAllmM1lfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LZAPAf/fUYXXUsc/YhPoyAeMHj0jPe3cgB1mlZKGnViDDwFydw3tl5WRi8lZTa6 aXYpz+4qc7ln7IV/eUObFULQh52GnRW4iRIn0PfOZyneAInNa7oEhlJ80WvmC27b rJmpzCKNYjPtwKaY3uRnCwUe8szdRez3CdhttwJ7EG2wR9W74iu84leeW5I8w6tr d2ggf7Jo5B7Up1hcOeO7RdiNd/8BJhWAgVam6I/D+oP9CrIIwXLljz39x0BK05x/ zDgQ+qRNolU6Or4sTHkN4UTVnl0hXaiAzW52n/svRixOLZyUBlKCT+FxAP1Mjm3l rvF8xnwssH5WcSUieBDfxGcXbUv7OQ== =q0x2 -----END PGP SIGNATURE----- --d74dnrfV52f4tWqMGT3SDuS3hN84fKfev-- From owner-svn-src-stable@freebsd.org Wed Jul 12 14:58:28 2017 Return-Path: Delivered-To: svn-src-stable@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 789ECD99956 for ; Wed, 12 Jul 2017 14:58:28 +0000 (UTC) (envelope-from olivier@freebsd.org) Received: from smtp.smtpout.orange.fr (smtp09.smtpout.orange.fr [80.12.242.131]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client CN "Bizanga Labs SMTP Client Certificate", Issuer "Bizanga Labs CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C1852656C7 for ; Wed, 12 Jul 2017 14:58:27 +0000 (UTC) (envelope-from olivier@freebsd.org) Received: from mail-yw0-f172.google.com ([209.85.161.172]) by mwinf5d69 with ME id jqyF1v00S3jUb6x03qyGvS; Wed, 12 Jul 2017 16:58:17 +0200 X-ME-Helo: mail-yw0-f172.google.com X-ME-Auth: Y29jaGFyZC1sYWJiZS5vbGl2aWVyQG9yYW5nZS5mcg== X-ME-Date: Wed, 12 Jul 2017 16:58:17 +0200 X-ME-IP: 209.85.161.172 Received: by mail-yw0-f172.google.com with SMTP id x125so11711903ywa.0; Wed, 12 Jul 2017 07:58:16 -0700 (PDT) X-Gm-Message-State: AIVw1130vTAqlQ2dnV97XytdRtp/lPD+9KWjw6UJc/9z8liJNddArG7y 3TAIAIoY96bzbTfb13HRcGAmpVYKOQ== X-Received: by 10.129.172.103 with SMTP id z39mr2701476ywj.338.1499871495308; Wed, 12 Jul 2017 07:58:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.4.195 with HTTP; Wed, 12 Jul 2017 07:57:54 -0700 (PDT) In-Reply-To: References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> From: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= Date: Wed, 12 Jul 2017 16:57:54 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: Sean Bruno Cc: Eric Joyner , src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 14:58:28 -0000 On Wed, Jul 12, 2017 at 4:34 PM, Sean Bruno wrote: > Huh ... is there anything in your console boot messages that would seem > to indicate an error on attach? > > =E2=80=8BGood catch, I didn't notice it before: "device_attach: ix0 attach = returned 5". dmeg before this commit: ix0: port 0x2020-0x203f mem 0xfbe80000-0xfbefffff,0xfbf04000-0xfbf07fff irq 24 at device 0.0 on pci3 ix0: Using MSIX interrupts with 5 vectors WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using untested modules. ix0: Ethernet address: 90:e2:ba:84:20:38 WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using untested modules. ix0: PCI Express Bus: Speed 5.0GT/s Width x8 ix0: netmap queues/slots: TX 4/2048, RX 4/2048 ix1: port 0x2000-0x201f mem 0xfbe00000-0xfbe7ffff,0xfbf00000-0xfbf03fff irq 34 at device 0.1 on pci3 ix1: Using MSIX interrupts with 5 vectors WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using untested modules. ix1: Ethernet address: 90:e2:ba:84:20:39 WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using untested modules. ix1: PCI Express Bus: Speed 5.0GT/s Width x8 ix1: netmap queues/slots: TX 4/2048, RX 4/2048 dmesg after this commit: =E2=80=8Bix0: port 0x2020-0x203f mem 0xfbe80000-0xfbefffff,0xfbf04000-0xfbf07fff irq 24 at device 0.0 on pci3 ix0: Using MSI-X interrupts with 5 vectors ix0: Unsupported SFP+ module detected! device_attach: ix0 attach returned 5 ix0: port 0x2000-0x201f mem 0xfbe00000-0xfbe7ffff,0xfbf00000-0xfbf03fff irq 34 at device 0.1 on pci3 ix0: Using MSI-X interrupts with 5 vectors ix0: Unsupported SFP+ module detected! device_attach: ix0 attach returned 5 Is it a regression regarding hw.ix.unsupported_sfp=3D"1" value ? From owner-svn-src-stable@freebsd.org Wed Jul 12 15:44:49 2017 Return-Path: Delivered-To: svn-src-stable@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 E64B5D9B5F0; Wed, 12 Jul 2017 15:44:49 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-yb0-f174.google.com (mail-yb0-f174.google.com [209.85.213.174]) (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 A8EA867AEF; Wed, 12 Jul 2017 15:44:49 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-yb0-f174.google.com with SMTP id f194so8326860yba.3; Wed, 12 Jul 2017 08:44:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MWBwLMIP0V+/K6pTtnE/fT+nq3orB1bRd8OcWsjGyfw=; b=aj01s9DUQDRTt1bHnLiy3t+OINh4yLe0xWcFqeGb22wgp8zdOt0V0JuAd3082wTLGs Zke1gFxazFsQUiCnGqW6nMFmwEQamxVrFSLIMPvx7oJIcCar+R9H4hNTGflevvUN/VjJ HVORV/dicTVR2eaT0n2jcSWuB5uIcZBeJXe1fmcFujisS38yZM/oSrrrdX9fUJ1VZcHT Ft90F0qvbI9wGluxCmJ7B7YBaLe866CnCC48hab45UAuUuIlj9bImpgp9XQsphgUH9CE aNCzbpN50prKCxqNRodxvA54AsYkoGsgPOcAICkJBFr/mx7YhIZxabO2/9naVgFe873g 945w== X-Gm-Message-State: AIVw112v2PYLP61fP2hL3SbjTfh1leXL0i5w+ybOx1kn4m+8A6vKPxG3 zcZo2MZ8zr6F4nxM9MsHYA== X-Received: by 10.37.175.211 with SMTP id d19mr1314724ybj.78.1499873966976; Wed, 12 Jul 2017 08:39:26 -0700 (PDT) Received: from mail-yb0-f179.google.com (mail-yb0-f179.google.com. [209.85.213.179]) by smtp.gmail.com with ESMTPSA id b126sm962139ywc.38.2017.07.12.08.39.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 08:39:26 -0700 (PDT) Received: by mail-yb0-f179.google.com with SMTP id n200so2986812ybg.2; Wed, 12 Jul 2017 08:39:26 -0700 (PDT) X-Received: by 10.37.38.5 with SMTP id m5mr1260114ybm.66.1499873965946; Wed, 12 Jul 2017 08:39:25 -0700 (PDT) MIME-Version: 1.0 References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Wed, 12 Jul 2017 15:39:15 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= , Sean Bruno Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 15:44:50 -0000 I think it may have been silently renamed to "allow_unsupported_sfp" instead of "unsupported_sfp". Could you try changing the name of that tunable in your config? On Wed, Jul 12, 2017 at 7:58 AM Olivier Cochard-Labb=C3=A9 wrote: > On Wed, Jul 12, 2017 at 4:34 PM, Sean Bruno wrote: > >> Huh ... is there anything in your console boot messages that would seem >> to indicate an error on attach? >> >> > =E2=80=8BGood catch, I didn't notice it before: "device_attach: ix0 attac= h > returned 5". > > dmeg before this commit: > > ix0: > port 0x2020-0x203f mem 0xfbe80000-0xfbefffff,0xfbf04000-0xfbf07fff irq 24 > at device 0.0 on pci3 > ix0: Using MSIX interrupts with 5 vectors > WARNING: Intel (R) Network Connections are quality tested using Intel (R) > Ethernet Optics. Using untested modules is not supported and may cause > unstable operation or damage to the module or the adapter. Intel > Corporation is not responsible for any harm caused by using untested > modules. > ix0: Ethernet address: 90:e2:ba:84:20:38 > WARNING: Intel (R) Network Connections are quality tested using Intel (R) > Ethernet Optics. Using untested modules is not supported and may cause > unstable operation or damage to the module or the adapter. Intel > Corporation is not responsible for any harm caused by using untested > modules. > ix0: PCI Express Bus: Speed 5.0GT/s Width x8 > ix0: netmap queues/slots: TX 4/2048, RX 4/2048 > ix1: > port 0x2000-0x201f mem 0xfbe00000-0xfbe7ffff,0xfbf00000-0xfbf03fff irq 34 > at device 0.1 on pci3 > ix1: Using MSIX interrupts with 5 vectors > WARNING: Intel (R) Network Connections are quality tested using Intel (R) > Ethernet Optics. Using untested modules is not supported and may cause > unstable operation or damage to the module or the adapter. Intel > Corporation is not responsible for any harm caused by using untested > modules. > ix1: Ethernet address: 90:e2:ba:84:20:39 > WARNING: Intel (R) Network Connections are quality tested using Intel (R) > Ethernet Optics. Using untested modules is not supported and may cause > unstable operation or damage to the module or the adapter. Intel > Corporation is not responsible for any harm caused by using untested > modules. > ix1: PCI Express Bus: Speed 5.0GT/s Width x8 > ix1: netmap queues/slots: TX 4/2048, RX 4/2048 > > dmesg after this commit: > > =E2=80=8Bix0: > port 0x2020-0x203f mem 0xfbe80000-0xfbefffff,0xfbf04000-0xfbf07fff irq 24 > at device 0.0 on pci3 > ix0: Using MSI-X interrupts with 5 vectors > ix0: Unsupported SFP+ module detected! > device_attach: ix0 attach returned 5 > ix0: > port 0x2000-0x201f mem 0xfbe00000-0xfbe7ffff,0xfbf00000-0xfbf03fff irq 34 > at device 0.1 on pci3 > ix0: Using MSI-X interrupts with 5 vectors > ix0: Unsupported SFP+ module detected! > device_attach: ix0 attach returned 5 > > Is it a regression regarding hw.ix.unsupported_sfp=3D"1" value ? > From owner-svn-src-stable@freebsd.org Wed Jul 12 16:27:15 2017 Return-Path: Delivered-To: svn-src-stable@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 30F72D9C9A1 for ; Wed, 12 Jul 2017 16:27:15 +0000 (UTC) (envelope-from olivier@freebsd.org) Received: from smtp.smtpout.orange.fr (smtp09.smtpout.orange.fr [80.12.242.131]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client CN "Bizanga Labs SMTP Client Certificate", Issuer "Bizanga Labs CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BDB036A495 for ; Wed, 12 Jul 2017 16:27:12 +0000 (UTC) (envelope-from olivier@freebsd.org) Received: from mail-yb0-f175.google.com ([209.85.213.175]) by mwinf5d17 with ME id jsT81v00B3ndNld03sT8Z6; Wed, 12 Jul 2017 18:27:10 +0200 X-ME-Helo: mail-yb0-f175.google.com X-ME-Auth: Y29jaGFyZC1sYWJiZS5vbGl2aWVyQG9yYW5nZS5mcg== X-ME-Date: Wed, 12 Jul 2017 18:27:10 +0200 X-ME-IP: 209.85.213.175 Received: by mail-yb0-f175.google.com with SMTP id n205so6499810yba.1; Wed, 12 Jul 2017 09:27:08 -0700 (PDT) X-Gm-Message-State: AIVw110vMoogTfk787ENHUvVeQ/RM+wF7OGK2J8tD1KRtX2WVgZCb5i0 qSoAfywYTOUfyjyo1W7sHD1Mm9nv5w== X-Received: by 10.129.172.103 with SMTP id z39mr3007344ywj.338.1499876827869; Wed, 12 Jul 2017 09:27:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.4.195 with HTTP; Wed, 12 Jul 2017 09:26:47 -0700 (PDT) In-Reply-To: References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> From: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= Date: Wed, 12 Jul 2017 18:26:47 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: Eric Joyner Cc: Sean Bruno , src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 16:27:15 -0000 On Wed, Jul 12, 2017 at 5:39 PM, Eric Joyner wrote: > I think it may have been silently renamed to "allow_unsupported_sfp" > instead of "unsupported_sfp". Could you try changing the name of that > tunable in your config? > > =E2=80=8BThanks Eric! Replacing this previous line into my /boot/loader.conf hw.ix.unsupported_sfp=3D"1" by this new one: hw.ix.allow_unsupported_sfp=3D"1"=E2=80=8B =E2=80=8Bsolved the problem: -) but this broke POLA :-( And the default behavior is not very sysadmin friendly: How, with the message "device_attach: ix0 attach returned 5" and no more ix interface detected, can I know it just came from using unsupported SFP ? From owner-svn-src-stable@freebsd.org Wed Jul 12 17:00:59 2017 Return-Path: Delivered-To: svn-src-stable@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 9E250D9D729; Wed, 12 Jul 2017 17:00:59 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-yb0-f177.google.com (mail-yb0-f177.google.com [209.85.213.177]) (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 5FF296E51C; Wed, 12 Jul 2017 17:00:59 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-yb0-f177.google.com with SMTP id 84so9526918ybe.0; Wed, 12 Jul 2017 10:00:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O3FmflRm7X6rFzRUDlI2Ze6FsOLFObtlOIEig67LmB0=; b=P6mCdKPD07prxRVmRN2JzNJSUx+z/G+3jqq7O+/6osLHoeBxAPHmWub7cveQ8yoN80 lICOLJIG/Uu5lNEvRCdj1KLZxX00s5APgN0MWQzcjqZzVJbrPmcVyEa9wL129RiTmqpL OES/TdPl2/tP0Fa1WCMPgU7IC2r5f0rdhMfrcJUHl468KCBt8J29HJjFIMV90Ho9LMpc TGgR3DXo4QIlmTNA++LRCResJro2t3p3mSdsg3iMD28YNtRvC/ooQzuBgXClAfnUlAf8 3J71N4cpabpSK57T/oz2WekoLjGIa6CKJWzcF9mDV9YMA0wYnhTV05El6PktFZaR1urt xhSQ== X-Gm-Message-State: AIVw113Yj8DOd9mGGyPFpBrQZ5wh6EO+PkniBDcfglGdmu2a2rIvwshN 6o9tHp7HNRgovxHHP0f9Vw== X-Received: by 10.13.212.206 with SMTP id w197mr2998426ywd.63.1499877312215; Wed, 12 Jul 2017 09:35:12 -0700 (PDT) Received: from mail-yb0-f172.google.com (mail-yb0-f172.google.com. [209.85.213.172]) by smtp.gmail.com with ESMTPSA id b126sm1007849ywc.38.2017.07.12.09.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 09:35:11 -0700 (PDT) Received: by mail-yb0-f172.google.com with SMTP id 84so9010706ybe.0; Wed, 12 Jul 2017 09:35:11 -0700 (PDT) X-Received: by 10.13.219.140 with SMTP id d134mr2638419ywe.220.1499877311545; Wed, 12 Jul 2017 09:35:11 -0700 (PDT) MIME-Version: 1.0 References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Wed, 12 Jul 2017 16:35:00 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= Cc: Sean Bruno , src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 17:00:59 -0000 Olivier, There is a message about it in dmesg, right? For the error code, there's not much we can do there aside from adding a new unsupported SFP+ code to errno.h, which doesn't seem appropriate. On Wed, Jul 12, 2017 at 9:27 AM Olivier Cochard-Labb=C3=A9 wrote: > On Wed, Jul 12, 2017 at 5:39 PM, Eric Joyner wrote: > >> I think it may have been silently renamed to "allow_unsupported_sfp" >> instead of "unsupported_sfp". Could you try changing the name of that >> tunable in your config? >> >> > =E2=80=8BThanks Eric! > > Replacing this previous line into my /boot/loader.conf > hw.ix.unsupported_sfp=3D"1" > by this new one: > hw.ix.allow_unsupported_sfp=3D"1"=E2=80=8B > > > =E2=80=8Bsolved the problem: -) but this broke POLA :-( > > And the default behavior is not very sysadmin friendly: > How, with the message "device_attach: ix0 attach returned 5" and no more > ix interface detected, can I know it just came from using unsupported SFP= ? > > From owner-svn-src-stable@freebsd.org Wed Jul 12 17:16:21 2017 Return-Path: Delivered-To: svn-src-stable@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 9B543D9E46B; Wed, 12 Jul 2017 17:16:21 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost2.sentex.ca (smarthost2.sentex.ca [205.211.164.50]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "smarthost.sentex.ca", Issuer "smarthost.sentex.ca" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D73A6F664; Wed, 12 Jul 2017 17:16:21 +0000 (UTC) (envelope-from mike@sentex.net) Received: from lava.sentex.ca (lava.sentex.ca [IPv6:2607:f3e0:0:5::11]) by smarthost2.sentex.ca (8.15.2/8.15.2) with ESMTPS id v6CHG9fQ058321 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 12 Jul 2017 13:16:09 -0400 (EDT) (envelope-from mike@sentex.net) Received: from [192.168.43.26] (saphire3.sentex.net [192.168.43.26]) by lava.sentex.ca (8.15.2/8.15.2) with ESMTP id v6CHG79t068819; Wed, 12 Jul 2017 13:16:07 -0400 (EDT) (envelope-from mike@sentex.net) Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: Eric Joyner , =?UTF-8?Q?Olivier_Cochard-Labb=c3=a9?= Cc: svn-src-stable@freebsd.org, Sean Bruno , src-committers , svn-src-all , svn-src-stable-11@freebsd.org References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> From: Mike Tancsa Organization: Sentex Communications Message-ID: Date: Wed, 12 Jul 2017 13:16:07 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 17:16:21 -0000 Hi Eric, For stable users, can the loader.conf variable not be the original one ? Especially for servers that are physically remote, a sysadmin might expect (wrongly or not) for the name not the change in a stable branch. If the box is remote, they would not be able to see the new dmesg error. Rather than change the name, perhaps a deprecation warning saying "In FreeBSD 12, this will be hw.ix.allow_unsupported_sfp" ? ---Mike On 7/12/2017 12:35 PM, Eric Joyner wrote: > Olivier, > > There is a message about it in dmesg, right? For the error code, there's > not much we can do there aside from adding a new unsupported SFP+ code to > errno.h, which doesn't seem appropriate. > > On Wed, Jul 12, 2017 at 9:27 AM Olivier Cochard-Labbé > wrote: > >> On Wed, Jul 12, 2017 at 5:39 PM, Eric Joyner wrote: >> >>> I think it may have been silently renamed to "allow_unsupported_sfp" >>> instead of "unsupported_sfp". Could you try changing the name of that >>> tunable in your config? >>> >>> >> ​Thanks Eric! >> >> Replacing this previous line into my /boot/loader.conf >> hw.ix.unsupported_sfp="1" >> by this new one: >> hw.ix.allow_unsupported_sfp="1"​ >> >> >> ​solved the problem: -) but this broke POLA :-( >> >> And the default behavior is not very sysadmin friendly: >> How, with the message "device_attach: ix0 attach returned 5" and no more >> ix interface detected, can I know it just came from using unsupported SFP ? >> >> > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" > > -- ------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada http://www.tancsa.com/ From owner-svn-src-stable@freebsd.org Wed Jul 12 17:30:35 2017 Return-Path: Delivered-To: svn-src-stable@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 D4747D9EB7D; Wed, 12 Jul 2017 17:30:35 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (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 A5C146FF49; Wed, 12 Jul 2017 17:30:35 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (75-173-114-235.albq.qwest.net [75.173.114.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 1268E1928AB; Wed, 12 Jul 2017 17:30:32 +0000 (UTC) Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv To: Mike Tancsa , Eric Joyner , =?UTF-8?Q?Olivier_Cochard-Labb=c3=a9?= Cc: svn-src-stable@freebsd.org, src-committers , svn-src-all , svn-src-stable-11@freebsd.org References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> From: Sean Bruno Message-ID: <4e74f325-5fbf-d53c-49df-dd2321f0bbf3@freebsd.org> Date: Wed, 12 Jul 2017 11:30:28 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RB08XEWuRsTNe1x9MiJ8AD3MiHwD6S0Oq" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 17:30:35 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --RB08XEWuRsTNe1x9MiJ8AD3MiHwD6S0Oq Content-Type: multipart/mixed; boundary="mqcVd27kTUk20I933pSCJUFKKGm4EVuFO"; protected-headers="v1" From: Sean Bruno To: Mike Tancsa , Eric Joyner , =?UTF-8?Q?Olivier_Cochard-Labb=c3=a9?= Cc: svn-src-stable@freebsd.org, src-committers , svn-src-all , svn-src-stable-11@freebsd.org Message-ID: <4e74f325-5fbf-d53c-49df-dd2321f0bbf3@freebsd.org> Subject: Re: svn commit: r320897 - in stable/11/sys: conf dev/ixgbe modules/ix modules/ixv References: <201707112125.v6BLP7Pg093948@repo.freebsd.org> In-Reply-To: --mqcVd27kTUk20I933pSCJUFKKGm4EVuFO Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Just so that its clear, this will be changed back to the original string shortly. sean On 07/12/17 11:16, Mike Tancsa wrote: > Hi Eric, > For stable users, can the loader.conf variable not be the original one= > ? Especially for servers that are physically remote, a sysadmin might > expect (wrongly or not) for the name not the change in a stable branch.= > If the box is remote, they would not be able to see the new dmesg error= =2E > Rather than change the name, perhaps a deprecation warning saying "In > FreeBSD 12, this will be hw.ix.allow_unsupported_sfp" ? >=20 > ---Mike >=20 >=20 > On 7/12/2017 12:35 PM, Eric Joyner wrote: >> Olivier, >> >> There is a message about it in dmesg, right? For the error code, there= 's >> not much we can do there aside from adding a new unsupported SFP+ code= to >> errno.h, which doesn't seem appropriate. >> >> On Wed, Jul 12, 2017 at 9:27 AM Olivier Cochard-Labb=C3=A9 >> wrote: >> >>> On Wed, Jul 12, 2017 at 5:39 PM, Eric Joyner wrote:= >>> >>>> I think it may have been silently renamed to "allow_unsupported_sfp"= >>>> instead of "unsupported_sfp". Could you try changing the name of tha= t >>>> tunable in your config? >>>> >>>> >>> =E2=80=8BThanks Eric! >>> >>> Replacing this previous line into my /boot/loader.conf >>> hw.ix.unsupported_sfp=3D"1" >>> by this new one: >>> hw.ix.allow_unsupported_sfp=3D"1"=E2=80=8B >>> >>> >>> =E2=80=8Bsolved the problem: -) but this broke POLA :-( >>> >>> And the default behavior is not very sysadmin friendly: >>> How, with the message "device_attach: ix0 attach returned 5" and no m= ore >>> ix interface detected, can I know it just came from using unsupported= SFP ? >>> >>> >> _______________________________________________ >> svn-src-stable-11@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 >> To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebs= d.org" >> >> >=20 >=20 --mqcVd27kTUk20I933pSCJUFKKGm4EVuFO-- --RB08XEWuRsTNe1x9MiJ8AD3MiHwD6S0Oq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAllmXLRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /Lb84wgAju1N6jasSQsDrn41ED0wnzP8YPnul9T1DIun1PWQNvKuGn40akXnE/oE DT3hgeUe4J7IAYPrytwKXIB7N+7deKt6ec6UZ1JbA8/TGqS22leoqxlruuzLJkMj JsE8pIhDQ9p+Zxiq/gAfqouKh7HHPqNis5xh2yXSUof1kD2bLlrpO75mkm3GF8Wh 0B67lILQsnMF7V4Sk+j3KbLvuPqsw/cDtJUxpzRHX6W8Pp9MHC7aeF6YdPhDY+H7 lnFWA+onagdqlFsGwpQsADHxBrIdg/L+kgebUH9pT2aEfUsUBvUAk6j1ihfSS3jJ zj/0VBoj/T4M747dPGRyj+LvIA5Lbg== =Tqs3 -----END PGP SIGNATURE----- --RB08XEWuRsTNe1x9MiJ8AD3MiHwD6S0Oq-- From owner-svn-src-stable@freebsd.org Wed Jul 12 17:51:02 2017 Return-Path: Delivered-To: svn-src-stable@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 0F8FCD9F158; Wed, 12 Jul 2017 17:51:02 +0000 (UTC) (envelope-from sbruno@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 CD69F708F1; Wed, 12 Jul 2017 17:51:01 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CHp00g096298; Wed, 12 Jul 2017 17:51:00 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CHp0tJ096297; Wed, 12 Jul 2017 17:51:00 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201707121751.v6CHp0tJ096297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 12 Jul 2017 17:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320917 - stable/11/sys/dev/ixgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: stable/11/sys/dev/ixgbe X-SVN-Commit-Revision: 320917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 17:51:02 -0000 Author: sbruno Date: Wed Jul 12 17:51:00 2017 New Revision: 320917 URL: https://svnweb.freebsd.org/changeset/base/320917 Log: MFC r320916 Reset unsupported SFP tuneable back to original entry name. Reported by: olivier@ Modified: stable/11/sys/dev/ixgbe/if_ix.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ix.c Wed Jul 12 17:35:32 2017 (r320916) +++ stable/11/sys/dev/ixgbe/if_ix.c Wed Jul 12 17:51:00 2017 (r320917) @@ -333,7 +333,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgb * doing so you are on your own :) */ static int allow_unsupported_sfp = FALSE; -SYSCTL_INT(_hw_ix, OID_AUTO, allow_unsupported_sfp, CTLFLAG_RDTUN, +SYSCTL_INT(_hw_ix, OID_AUTO, unsupported_sfp, CTLFLAG_RDTUN, &allow_unsupported_sfp, 0, "Allow unsupported SFP modules...use at your own risk"); From owner-svn-src-stable@freebsd.org Wed Jul 12 20:10:56 2017 Return-Path: Delivered-To: svn-src-stable@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 156FCDA2831; Wed, 12 Jul 2017 20:10:56 +0000 (UTC) (envelope-from jhb@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 E52F0760CB; Wed, 12 Jul 2017 20:10:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CKAtlo055719; Wed, 12 Jul 2017 20:10:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CKAr6F055703; Wed, 12 Jul 2017 20:10:53 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707122010.v6CKAr6F055703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 12 Jul 2017 20:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320921 - in stable/11: share/man/man4 share/man/man4/man4.i386 sys/dev/digi sys/dev/ie sys/dev/mcd sys/dev/scd sys/dev/si sys/dev/wl sys/i386/isa usr.sbin/sicontrol usr.sbin/wlconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11: share/man/man4 share/man/man4/man4.i386 sys/dev/digi sys/dev/ie sys/dev/mcd sys/dev/scd sys/dev/si sys/dev/wl sys/i386/isa usr.sbin/sicontrol usr.sbin/wlconfig X-SVN-Commit-Revision: 320921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 20:10:56 -0000 Author: jhb Date: Wed Jul 12 20:10:53 2017 New Revision: 320921 URL: https://svnweb.freebsd.org/changeset/base/320921 Log: Add deprecation notices for various device drivers removed in 12.0. This is a direct commit to stable/11 since these files have already been removed in head. Reviewed by: sbruno, gjb Differential Revision: https://reviews.freebsd.org/D11542 Modified: stable/11/share/man/man4/digi.4 stable/11/share/man/man4/man4.i386/ie.4 stable/11/share/man/man4/man4.i386/wl.4 stable/11/share/man/man4/mcd.4 stable/11/share/man/man4/scd.4 stable/11/share/man/man4/si.4 stable/11/share/man/man4/spic.4 stable/11/sys/dev/digi/digi.c stable/11/sys/dev/ie/if_ie.c stable/11/sys/dev/mcd/mcd.c stable/11/sys/dev/scd/scd.c stable/11/sys/dev/si/si.c stable/11/sys/dev/wl/if_wl.c stable/11/sys/i386/isa/spic.c stable/11/usr.sbin/sicontrol/sicontrol.8 stable/11/usr.sbin/wlconfig/wlconfig.8 Modified: stable/11/share/man/man4/digi.4 ============================================================================== --- stable/11/share/man/man4/digi.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/digi.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -33,7 +33,7 @@ .\" from: sio.4,v 1.15 1994/12/06 20:14:30 bde Exp .\" $FreeBSD$ .\" -.Dd December 7, 2003 +.Dd July 8, 2017 .Dt DIGI 4 .Os .Sh NAME @@ -80,6 +80,11 @@ Device numbering: \fBI\fPnitial \fBPPPPP\fPort number .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/man4.i386/ie.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/ie.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/man4.i386/ie.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd July 8, 2017 .Dt IE 4 i386 .Os .Sh NAME @@ -52,6 +52,11 @@ In .Cd hint.ie.0.port="0x300" .Cd hint.ie.0.irq="5" .Cd hint.ie.0.maddr="0xd0000" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh HARDWARE The .Nm Modified: stable/11/share/man/man4/man4.i386/wl.4 ============================================================================== --- stable/11/share/man/man4/man4.i386/wl.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/man4.i386/wl.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -29,7 +29,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 29, 2006 +.Dd July 8, 2017 .Dt WL 4 i386 .Os .Sh NAME @@ -37,6 +37,11 @@ .Nd T1 speed ISA/radio lan card .Sh SYNOPSIS .Cd "device wl0 at isa? port 0x300 irq 5" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/mcd.4 ============================================================================== --- stable/11/share/man/man4/mcd.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/mcd.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 8, 1994 +.Dd July 8, 2017 .Dt MCD 4 .Os .Sh NAME @@ -40,6 +40,11 @@ In .Cd hint.mcd.0.at="isa" .Cd hint.mcd.0.port="0x300" .Cd hint.mcd.0.irq="10" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/scd.4 ============================================================================== --- stable/11/share/man/man4/scd.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/scd.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 17, 2008 +.Dd July 8, 2017 .Dt SCD 4 .Os .Sh NAME @@ -39,6 +39,11 @@ In .Pa /boot/device.hints : .Cd hint.scd.0.at="isa" .Cd hint.scd.0.port="0x230" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/si.4 ============================================================================== --- stable/11/share/man/man4/si.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/si.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd September 16, 1995 +.Dd July 8, 2017 .Dt SI 4 .Os .Sh NAME @@ -13,6 +13,11 @@ For ISA host cards put the following lines in .Cd hint.si.0.at="isa" .Cd hint.si.0.maddr="0xd0000" .Cd hint.si.0.irq="12" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The Specialix SI/XIO and SX hardware makes up an 8 to 32 port RS-232 serial multiplexor. Modified: stable/11/share/man/man4/spic.4 ============================================================================== --- stable/11/share/man/man4/spic.4 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/share/man/man4/spic.4 Wed Jul 12 20:10:53 2017 (r320921) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2002 +.Dd July 8, 2017 .Dt SPIC 4 .Os .Sh NAME @@ -33,6 +33,11 @@ .Nd Sony Programmable I/O Controller device driver .Sh SYNOPSIS .Cd "device spic" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/11/sys/dev/digi/digi.c ============================================================================== --- stable/11/sys/dev/digi/digi.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/dev/digi/digi.c Wed Jul 12 20:10:53 2017 (r320921) @@ -1458,6 +1458,8 @@ digi_attach(struct digi_softc *sc) digi_loadmoduledata(sc); digi_init(sc); digi_freemoduledata(sc); + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/11/sys/dev/ie/if_ie.c ============================================================================== --- stable/11/sys/dev/ie/if_ie.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/dev/ie/if_ie.c Wed Jul 12 20:10:53 2017 (r320921) @@ -327,6 +327,8 @@ ie_attach(device_t dev) mtx_destroy(&sc->lock); return (error); } + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/11/sys/dev/mcd/mcd.c ============================================================================== --- stable/11/sys/dev/mcd/mcd.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/dev/mcd/mcd.c Wed Jul 12 20:10:53 2017 (r320921) @@ -209,6 +209,8 @@ mcd_attach(struct mcd_softc *sc) sc->mcd_dev_t->si_drv1 = (void *)sc; callout_init_mtx(&sc->timer, &sc->mtx, 0); + device_printf(sc->dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/11/sys/dev/scd/scd.c ============================================================================== --- stable/11/sys/dev/scd/scd.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/dev/scd/scd.c Wed Jul 12 20:10:53 2017 (r320921) @@ -174,6 +174,8 @@ scd_attach(struct scd_softc *sc) sc->scd_dev_t = make_dev(&scd_cdevsw, 8 * unit, UID_ROOT, GID_OPERATOR, 0640, "scd%d", unit); sc->scd_dev_t->si_drv1 = (void *)sc; + device_printf(sc->dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/11/sys/dev/si/si.c ============================================================================== --- stable/11/sys/dev/si/si.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/dev/si/si.c Wed Jul 12 20:10:53 2017 (r320921) @@ -604,6 +604,8 @@ try_next2: if (unit == 0) make_dev(&si_Scdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "si_control"); + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/11/sys/dev/wl/if_wl.c ============================================================================== --- stable/11/sys/dev/wl/if_wl.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/dev/wl/if_wl.c Wed Jul 12 20:10:53 2017 (r320921) @@ -564,6 +564,8 @@ wlattach(device_t device) if (bootverbose) wldump(sc); + device_printf(device, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/11/sys/i386/isa/spic.c ============================================================================== --- stable/11/sys/i386/isa/spic.c Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/sys/i386/isa/spic.c Wed Jul 12 20:10:53 2017 (r320921) @@ -350,6 +350,8 @@ spic_attach(device_t dev) /* There can be only one */ sc->sc_cdev = make_dev(&spic_cdevsw, 0, 0, 0, 0600, "jogdial"); sc->sc_cdev->si_drv1 = sc; + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return 0; } Modified: stable/11/usr.sbin/sicontrol/sicontrol.8 ============================================================================== --- stable/11/usr.sbin/sicontrol/sicontrol.8 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/usr.sbin/sicontrol/sicontrol.8 Wed Jul 12 20:10:53 2017 (r320921) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd September 26, 1995 +.Dd July 8, 2017 .Dt SICONTROL 8 .Os .Sh NAME @@ -10,6 +10,11 @@ .Nm device .Ar command Op Ar param ... +.Sh DEPRECATION NOTICE +The +.Nm +utility will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/11/usr.sbin/wlconfig/wlconfig.8 ============================================================================== --- stable/11/usr.sbin/wlconfig/wlconfig.8 Wed Jul 12 19:13:58 2017 (r320920) +++ stable/11/usr.sbin/wlconfig/wlconfig.8 Wed Jul 12 20:10:53 2017 (r320921) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd December 26, 1996 +.Dd July 8, 2017 .Dt WLCONFIG 8 i386 .Os .Sh NAME @@ -10,6 +10,11 @@ .Nm .Ar ifname .Op Ar param value ... +.Sh DEPRECATION NOTICE +The +.Nm +utility will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm From owner-svn-src-stable@freebsd.org Wed Jul 12 22:16:57 2017 Return-Path: Delivered-To: svn-src-stable@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 3B000DA6424; Wed, 12 Jul 2017 22:16:57 +0000 (UTC) (envelope-from jhb@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 08F6B79CEB; Wed, 12 Jul 2017 22:16:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6CMGuxf008200; Wed, 12 Jul 2017 22:16:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6CMGs2t008184; Wed, 12 Jul 2017 22:16:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201707122216.v6CMGs2t008184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 12 Jul 2017 22:16:54 +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: r320923 - in stable/10: share/man/man4 share/man/man4/man4.i386 sys/dev/digi sys/dev/ie sys/dev/mcd sys/dev/scd sys/dev/si sys/dev/wl sys/i386/isa usr.sbin/sicontrol usr.sbin/wlconfig X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/10: share/man/man4 share/man/man4/man4.i386 sys/dev/digi sys/dev/ie sys/dev/mcd sys/dev/scd sys/dev/si sys/dev/wl sys/i386/isa usr.sbin/sicontrol usr.sbin/wlconfig X-SVN-Commit-Revision: 320923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jul 2017 22:16:57 -0000 Author: jhb Date: Wed Jul 12 22:16:54 2017 New Revision: 320923 URL: https://svnweb.freebsd.org/changeset/base/320923 Log: Add deprecation notices for various device drivers removed in 12.0. This is a direct commit to stable/10 since these files have already been removed in head. Modified: stable/10/share/man/man4/digi.4 stable/10/share/man/man4/man4.i386/ie.4 stable/10/share/man/man4/man4.i386/wl.4 stable/10/share/man/man4/mcd.4 stable/10/share/man/man4/scd.4 stable/10/share/man/man4/si.4 stable/10/share/man/man4/spic.4 stable/10/sys/dev/digi/digi.c stable/10/sys/dev/ie/if_ie.c stable/10/sys/dev/mcd/mcd.c stable/10/sys/dev/scd/scd.c stable/10/sys/dev/si/si.c stable/10/sys/dev/wl/if_wl.c stable/10/sys/i386/isa/spic.c stable/10/usr.sbin/sicontrol/sicontrol.8 stable/10/usr.sbin/wlconfig/wlconfig.8 Modified: stable/10/share/man/man4/digi.4 ============================================================================== --- stable/10/share/man/man4/digi.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/digi.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -37,7 +37,7 @@ .\" from: sio.4,v 1.15 1994/12/06 20:14:30 bde Exp .\" $FreeBSD$ .\" -.Dd December 7, 2003 +.Dd July 8, 2017 .Dt DIGI 4 .Os .Sh NAME @@ -84,6 +84,11 @@ Device numbering: \fBI\fPnitial \fBPPPPP\fPort number .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/10/share/man/man4/man4.i386/ie.4 ============================================================================== --- stable/10/share/man/man4/man4.i386/ie.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/man4.i386/ie.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd July 8, 2017 .Dt IE 4 i386 .Os .Sh NAME @@ -52,6 +52,11 @@ In .Cd hint.ie.0.port="0x300" .Cd hint.ie.0.irq="5" .Cd hint.ie.0.maddr="0xd0000" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh HARDWARE The .Nm Modified: stable/10/share/man/man4/man4.i386/wl.4 ============================================================================== --- stable/10/share/man/man4/man4.i386/wl.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/man4.i386/wl.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -29,7 +29,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 29, 2006 +.Dd July 8, 2017 .Dt WL 4 i386 .Os .Sh NAME @@ -37,6 +37,11 @@ .Nd T1 speed ISA/radio lan card .Sh SYNOPSIS .Cd "device wl0 at isa? port 0x300 irq 5" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/10/share/man/man4/mcd.4 ============================================================================== --- stable/10/share/man/man4/mcd.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/mcd.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 8, 1994 +.Dd July 8, 2017 .Dt MCD 4 .Os .Sh NAME @@ -40,6 +40,11 @@ In .Cd hint.mcd.0.at="isa" .Cd hint.mcd.0.port="0x300" .Cd hint.mcd.0.irq="10" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/10/share/man/man4/scd.4 ============================================================================== --- stable/10/share/man/man4/scd.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/scd.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 17, 2008 +.Dd July 8, 2017 .Dt SCD 4 .Os .Sh NAME @@ -39,6 +39,11 @@ In .Pa /boot/device.hints : .Cd hint.scd.0.at="isa" .Cd hint.scd.0.port="0x230" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/10/share/man/man4/si.4 ============================================================================== --- stable/10/share/man/man4/si.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/si.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd September 16, 1995 +.Dd July 8, 2017 .Dt SI 4 .Os .Sh NAME @@ -13,6 +13,11 @@ For ISA host cards put the following lines in .Cd hint.si.0.at="isa" .Cd hint.si.0.maddr="0xd0000" .Cd hint.si.0.irq="12" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The Specialix SI/XIO and SX hardware makes up an 8 to 32 port RS-232 serial multiplexor. Modified: stable/10/share/man/man4/spic.4 ============================================================================== --- stable/10/share/man/man4/spic.4 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/share/man/man4/spic.4 Wed Jul 12 22:16:54 2017 (r320923) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2002 +.Dd July 8, 2017 .Dt SPIC 4 .Os .Sh NAME @@ -33,6 +33,11 @@ .Nd Sony Programmable I/O Controller device driver .Sh SYNOPSIS .Cd "device spic" +.Sh DEPRECATION NOTICE +The +.Nm +driver will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/10/sys/dev/digi/digi.c ============================================================================== --- stable/10/sys/dev/digi/digi.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/dev/digi/digi.c Wed Jul 12 22:16:54 2017 (r320923) @@ -1458,6 +1458,8 @@ digi_attach(struct digi_softc *sc) digi_loadmoduledata(sc); digi_init(sc); digi_freemoduledata(sc); + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/10/sys/dev/ie/if_ie.c ============================================================================== --- stable/10/sys/dev/ie/if_ie.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/dev/ie/if_ie.c Wed Jul 12 22:16:54 2017 (r320923) @@ -326,6 +326,8 @@ ie_attach(device_t dev) mtx_destroy(&sc->lock); return (error); } + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/10/sys/dev/mcd/mcd.c ============================================================================== --- stable/10/sys/dev/mcd/mcd.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/dev/mcd/mcd.c Wed Jul 12 22:16:54 2017 (r320923) @@ -206,6 +206,8 @@ mcd_attach(struct mcd_softc *sc) UID_ROOT, GID_OPERATOR, 0640, "mcd%d", unit); sc->mcd_dev_t->si_drv1 = (void *)sc; + device_printf(sc->dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/10/sys/dev/scd/scd.c ============================================================================== --- stable/10/sys/dev/scd/scd.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/dev/scd/scd.c Wed Jul 12 22:16:54 2017 (r320923) @@ -172,6 +172,8 @@ scd_attach(struct scd_softc *sc) sc->scd_dev_t = make_dev(&scd_cdevsw, 8 * unit, UID_ROOT, GID_OPERATOR, 0640, "scd%d", unit); sc->scd_dev_t->si_drv1 = (void *)sc; + device_printf(sc->dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/10/sys/dev/si/si.c ============================================================================== --- stable/10/sys/dev/si/si.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/dev/si/si.c Wed Jul 12 22:16:54 2017 (r320923) @@ -605,6 +605,8 @@ try_next2: if (unit == 0) make_dev(&si_Scdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "si_control"); + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/10/sys/dev/wl/if_wl.c ============================================================================== --- stable/10/sys/dev/wl/if_wl.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/dev/wl/if_wl.c Wed Jul 12 22:16:54 2017 (r320923) @@ -575,6 +575,8 @@ wlattach(device_t device) if (bootverbose) wldump(sc); + device_printf(device, + "WARNING: This driver is deprecated and will be removed.\n"); return (0); } Modified: stable/10/sys/i386/isa/spic.c ============================================================================== --- stable/10/sys/i386/isa/spic.c Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/sys/i386/isa/spic.c Wed Jul 12 22:16:54 2017 (r320923) @@ -346,6 +346,8 @@ spic_attach(device_t dev) /* There can be only one */ make_dev(&spic_cdevsw, 0, 0, 0, 0600, "jogdial"); + device_printf(dev, + "WARNING: This driver is deprecated and will be removed.\n"); return 0; } Modified: stable/10/usr.sbin/sicontrol/sicontrol.8 ============================================================================== --- stable/10/usr.sbin/sicontrol/sicontrol.8 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/usr.sbin/sicontrol/sicontrol.8 Wed Jul 12 22:16:54 2017 (r320923) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd September 26, 1995 +.Dd July 8, 2017 .Dt SICONTROL 8 .Os .Sh NAME @@ -10,6 +10,11 @@ .Nm device .Ar command Op Ar param ... +.Sh DEPRECATION NOTICE +The +.Nm +utility will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm Modified: stable/10/usr.sbin/wlconfig/wlconfig.8 ============================================================================== --- stable/10/usr.sbin/wlconfig/wlconfig.8 Wed Jul 12 21:46:16 2017 (r320922) +++ stable/10/usr.sbin/wlconfig/wlconfig.8 Wed Jul 12 22:16:54 2017 (r320923) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd December 26, 1996 +.Dd July 8, 2017 .Dt WLCONFIG 8 i386 .Os .Sh NAME @@ -10,6 +10,11 @@ .Nm .Ar ifname .Op Ar param value ... +.Sh DEPRECATION NOTICE +The +.Nm +utility will be removed in +.Fx 12.0 . .Sh DESCRIPTION The .Nm From owner-svn-src-stable@freebsd.org Thu Jul 13 08:29:02 2017 Return-Path: Delivered-To: svn-src-stable@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 A5607D9B922; Thu, 13 Jul 2017 08:29:02 +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 735606EBFE; Thu, 13 Jul 2017 08:29:02 +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 v6D8T1nm059786; Thu, 13 Jul 2017 08:29:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D8T1Hh059784; Thu, 13 Jul 2017 08:29:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707130829.v6D8T1Hh059784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 13 Jul 2017 08:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320939 - in stable/11: share/man/man9 sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: share/man/man9 sys/sys X-SVN-Commit-Revision: 320939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 08:29:02 -0000 Author: kib Date: Thu Jul 13 08:29:01 2017 New Revision: 320939 URL: https://svnweb.freebsd.org/changeset/base/320939 Log: MFC r320755,r320762,r320893: BIT_FLS(9). Modified: stable/11/share/man/man9/bitset.9 stable/11/sys/sys/bitset.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/bitset.9 ============================================================================== --- stable/11/share/man/man9/bitset.9 Thu Jul 13 08:23:37 2017 (r320938) +++ stable/11/share/man/man9/bitset.9 Thu Jul 13 08:29:01 2017 (r320939) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2017 +.Dd July 7, 2017 .Dt BITSET 9 .Os .Sh NAME @@ -43,6 +43,7 @@ .Nm BIT_EMPTY , .Nm BIT_ISFULLSET , .Nm BIT_FFS , +.Nm BIT_FLS , .Nm BIT_COUNT , .Nm BIT_SUBSET , .Nm BIT_OVERLAP , @@ -85,6 +86,8 @@ .Ft int .Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset" .Ft int +.Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset" +.Ft int .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" .\" .Ft bool @@ -282,6 +285,23 @@ index parameter to any other macro, you must subtract one from the result. .Pp The +.Fn BIT_FLS +macro returns the 1-index of the last (highest) set bit in +.Fa bitset , +or zero if +.Fa bitset +is empty. +Like with +.Xr fls 3 , +to use the non-zero result of +.Fn BIT_FLS +as a +.Fa bit +index parameter to any other +.Nm +macro, you must subtract one from the result. +.Pp +The .Fn BIT_COUNT macro returns the total number of set bits in .Fa bitset . @@ -499,4 +519,6 @@ argument to all of these macros must match the value g .Pp Unlike every other reference to individual set members, which are zero-indexed, .Fn BIT_FFS -returns a one-indexed result (or zero if the set is empty). +and +.Fn BIT_FLS +return a one-indexed result (or zero if the set is empty). Modified: stable/11/sys/sys/bitset.h ============================================================================== --- stable/11/sys/sys/bitset.h Thu Jul 13 08:23:37 2017 (r320938) +++ stable/11/sys/sys/bitset.h Thu Jul 13 08:29:01 2017 (r320939) @@ -213,6 +213,21 @@ __bit; \ }) +#define BIT_FLS(_s, p) __extension__ ({ \ + __size_t __i; \ + int __bit; \ + \ + __bit = 0; \ + for (__i = __bitset_words((_s)); __i > 0; __i--) { \ + if ((p)->__bits[__i - 1] != 0) { \ + __bit = flsl((p)->__bits[__i - 1]); \ + __bit += (__i - 1) * _BITSET_BITS; \ + break; \ + } \ + } \ + __bit; \ +}) + #define BIT_COUNT(_s, p) __extension__ ({ \ __size_t __i; \ int __count; \ From owner-svn-src-stable@freebsd.org Thu Jul 13 08:33:04 2017 Return-Path: Delivered-To: svn-src-stable@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 15A82D9BB24; Thu, 13 Jul 2017 08:33:04 +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 D720C6EF96; Thu, 13 Jul 2017 08:33:03 +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 v6D8X2jn063555; Thu, 13 Jul 2017 08:33:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D8X2F2063554; Thu, 13 Jul 2017 08:33:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707130833.v6D8X2F2063554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 13 Jul 2017 08:33:02 +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: r320940 - stable/10/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/sys X-SVN-Commit-Revision: 320940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 08:33:04 -0000 Author: kib Date: Thu Jul 13 08:33:02 2017 New Revision: 320940 URL: https://svnweb.freebsd.org/changeset/base/320940 Log: MFC r320755,r320762,r320893: BIT_FLS(9). Modified: stable/10/sys/sys/bitset.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/bitset.h ============================================================================== --- stable/10/sys/sys/bitset.h Thu Jul 13 08:29:01 2017 (r320939) +++ stable/10/sys/sys/bitset.h Thu Jul 13 08:33:02 2017 (r320940) @@ -206,6 +206,21 @@ __bit; \ }) +#define BIT_FLS(_s, p) __extension__ ({ \ + __size_t __i; \ + int __bit; \ + \ + __bit = 0; \ + for (__i = __bitset_words((_s)); __i > 0; __i--) { \ + if ((p)->__bits[__i - 1] != 0) { \ + __bit = flsl((p)->__bits[__i - 1]); \ + __bit += (__i - 1) * _BITSET_BITS; \ + break; \ + } \ + } \ + __bit; \ +}) + #define BIT_COUNT(_s, p) __extension__ ({ \ __size_t __i; \ int __count; \ From owner-svn-src-stable@freebsd.org Thu Jul 13 09:27:16 2017 Return-Path: Delivered-To: svn-src-stable@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 54DC9D9CF93; Thu, 13 Jul 2017 09:27:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FC8870B87; Thu, 13 Jul 2017 09:27:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6D9RFr1084703; Thu, 13 Jul 2017 09:27:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6D9RB96084663; Thu, 13 Jul 2017 09:27:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707130927.v6D9RB96084663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 13 Jul 2017 09:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320942 - in stable/11/lib/libc: include stdio X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/lib/libc: include stdio X-SVN-Commit-Revision: 320942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 09:27:16 -0000 Author: kib Date: Thu Jul 13 09:27:11 2017 New Revision: 320942 URL: https://svnweb.freebsd.org/changeset/base/320942 Log: MFC r320472,r320508,r320509: Make stdio deferred cancel-safe. Modified: stable/11/lib/libc/include/libc_private.h stable/11/lib/libc/stdio/fclose.c stable/11/lib/libc/stdio/fflush.c stable/11/lib/libc/stdio/fgetc.c stable/11/lib/libc/stdio/fgetln.c stable/11/lib/libc/stdio/fgets.c stable/11/lib/libc/stdio/fgetwc.c stable/11/lib/libc/stdio/fgetwln.c stable/11/lib/libc/stdio/fgetws.c stable/11/lib/libc/stdio/fputc.c stable/11/lib/libc/stdio/fputs.c stable/11/lib/libc/stdio/fputwc.c stable/11/lib/libc/stdio/fputws.c stable/11/lib/libc/stdio/fread.c stable/11/lib/libc/stdio/freopen.c stable/11/lib/libc/stdio/fscanf.c stable/11/lib/libc/stdio/fseek.c stable/11/lib/libc/stdio/fwrite.c stable/11/lib/libc/stdio/getc.c stable/11/lib/libc/stdio/getchar.c stable/11/lib/libc/stdio/getdelim.c stable/11/lib/libc/stdio/gets.c stable/11/lib/libc/stdio/local.h stable/11/lib/libc/stdio/perror.c stable/11/lib/libc/stdio/putc.c stable/11/lib/libc/stdio/putchar.c stable/11/lib/libc/stdio/puts.c stable/11/lib/libc/stdio/putw.c stable/11/lib/libc/stdio/refill.c stable/11/lib/libc/stdio/scanf.c stable/11/lib/libc/stdio/setvbuf.c stable/11/lib/libc/stdio/stdio.c stable/11/lib/libc/stdio/ungetc.c stable/11/lib/libc/stdio/ungetwc.c stable/11/lib/libc/stdio/vfprintf.c stable/11/lib/libc/stdio/vfscanf.c stable/11/lib/libc/stdio/vfwprintf.c stable/11/lib/libc/stdio/vfwscanf.c stable/11/lib/libc/stdio/vscanf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/include/libc_private.h ============================================================================== --- stable/11/lib/libc/include/libc_private.h Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/include/libc_private.h Thu Jul 13 09:27:11 2017 (r320942) @@ -407,6 +407,11 @@ void __libc_map_stacks_exec(void); void _pthread_cancel_enter(int); void _pthread_cancel_leave(int); +struct _pthread_cleanup_info; +void ___pthread_cleanup_push_imp(void (*)(void *), void *, + struct _pthread_cleanup_info *); +void ___pthread_cleanup_pop_imp(int); + void __throw_constraint_handler_s(const char * restrict msg, int error); #endif /* _LIBC_PRIVATE_H_ */ Modified: stable/11/lib/libc/stdio/fclose.c ============================================================================== --- stable/11/lib/libc/stdio/fclose.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fclose.c Thu Jul 13 09:27:11 2017 (r320942) @@ -97,7 +97,7 @@ fdclose(FILE *fp, int *fdp) return (EOF); } - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); r = 0; if (fp->_close != __sclose) { r = EOF; @@ -115,7 +115,7 @@ fdclose(FILE *fp, int *fdp) *fdp = fp->_file; r = cleanfile(fp, false); } - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (r); } @@ -130,9 +130,9 @@ fclose(FILE *fp) return (EOF); } - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); r = cleanfile(fp, true); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (r); } Modified: stable/11/lib/libc/stdio/fflush.c ============================================================================== --- stable/11/lib/libc/stdio/fflush.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fflush.c Thu Jul 13 09:27:11 2017 (r320942) @@ -56,7 +56,7 @@ fflush(FILE *fp) if (fp == NULL) return (_fwalk(sflush_locked)); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* * There is disagreement about the correct behaviour of fflush() @@ -76,7 +76,7 @@ fflush(FILE *fp) retval = 0; else retval = __sflush(fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } @@ -143,8 +143,8 @@ sflush_locked(FILE *fp) { int ret; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __sflush(fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } Modified: stable/11/lib/libc/stdio/fgetc.c ============================================================================== --- stable/11/lib/libc/stdio/fgetc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fgetc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -46,10 +46,10 @@ int fgetc(FILE *fp) { int retval; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* Orientation set by __sgetc() when buffer is empty. */ /* ORIENT(fp, -1); */ retval = __sgetc(fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/fgetln.c ============================================================================== --- stable/11/lib/libc/stdio/fgetln.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fgetln.c Thu Jul 13 09:27:11 2017 (r320942) @@ -85,22 +85,21 @@ char * fgetln(FILE *fp, size_t *lenp) { unsigned char *p; + char *ret; size_t len; size_t off; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); /* make sure there is input */ if (fp->_r <= 0 && __srefill(fp)) { *lenp = 0; - FUNLOCKFILE(fp); - return (NULL); + ret = NULL; + goto end; } /* look for a newline in the input */ if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) != NULL) { - char *ret; - /* * Found one. Flag buffer as modified to keep fseek from * `optimising' a backward seek, in case the user stomps on @@ -112,8 +111,7 @@ fgetln(FILE *fp, size_t *lenp) fp->_flags |= __SMOD; fp->_r -= len; fp->_p = p; - FUNLOCKFILE(fp); - return (ret); + goto end; } /* @@ -163,12 +161,14 @@ fgetln(FILE *fp, size_t *lenp) #ifdef notdef fp->_lb._base[len] = '\0'; #endif - FUNLOCKFILE(fp); - return ((char *)fp->_lb._base); + ret = (char *)fp->_lb._base; +end: + FUNLOCKFILE_CANCELSAFE(); + return (ret); error: *lenp = 0; /* ??? */ fp->_flags |= __SERR; - FUNLOCKFILE(fp); - return (NULL); /* ??? */ + ret = NULL; + goto end; } Modified: stable/11/lib/libc/stdio/fgets.c ============================================================================== --- stable/11/lib/libc/stdio/fgets.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fgets.c Thu Jul 13 09:27:11 2017 (r320942) @@ -53,17 +53,17 @@ char * fgets(char * __restrict buf, int n, FILE * __restrict fp) { size_t len; - char *s; + char *s, *ret; unsigned char *p, *t; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); if (n <= 0) { /* sanity check */ fp->_flags |= __SERR; errno = EINVAL; - FUNLOCKFILE(fp); - return (NULL); + ret = NULL; + goto end; } s = buf; @@ -76,8 +76,8 @@ fgets(char * __restrict buf, int n, FILE * __restrict if (__srefill(fp)) { /* EOF/error: stop with partial or no line */ if (!__sfeof(fp) || s == buf) { - FUNLOCKFILE(fp); - return (NULL); + ret = NULL; + goto end; } break; } @@ -100,8 +100,8 @@ fgets(char * __restrict buf, int n, FILE * __restrict fp->_p = t; (void)memcpy((void *)s, (void *)p, len); s[len] = 0; - FUNLOCKFILE(fp); - return (buf); + ret = buf; + goto end; } fp->_r -= len; fp->_p += len; @@ -110,6 +110,8 @@ fgets(char * __restrict buf, int n, FILE * __restrict n -= len; } *s = 0; - FUNLOCKFILE(fp); - return (buf); + ret = buf; +end: + FUNLOCKFILE_CANCELSAFE(); + return (ret); } Modified: stable/11/lib/libc/stdio/fgetwc.c ============================================================================== --- stable/11/lib/libc/stdio/fgetwc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fgetwc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -52,10 +52,10 @@ fgetwc_l(FILE *fp, locale_t locale) wint_t r; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); r = __fgetwc(fp, locale); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (r); } Modified: stable/11/lib/libc/stdio/fgetwln.c ============================================================================== --- stable/11/lib/libc/stdio/fgetwln.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fgetwln.c Thu Jul 13 09:27:11 2017 (r320942) @@ -45,13 +45,14 @@ wchar_t *fgetwln_l(FILE * __restrict, size_t *, locale wchar_t * fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t locale) { + wchar_t *ret; wint_t wc; size_t len; int savserr; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); savserr = fp->_flags & __SERR; @@ -77,14 +78,16 @@ fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t if (len == 0) goto error; - FUNLOCKFILE(fp); *lenp = len; - return ((wchar_t *)fp->_lb._base); + ret = (wchar_t *)fp->_lb._base; +end: + FUNLOCKFILE_CANCELSAFE(); + return (ret); error: - FUNLOCKFILE(fp); *lenp = 0; - return (NULL); + ret = NULL; + goto end; } wchar_t * Modified: stable/11/lib/libc/stdio/fgetws.c ============================================================================== --- stable/11/lib/libc/stdio/fgetws.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fgetws.c Thu Jul 13 09:27:11 2017 (r320942) @@ -46,14 +46,14 @@ wchar_t * fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t locale) { int sret; - wchar_t *wsp; + wchar_t *wsp, *ret; size_t nconv; const char *src; unsigned char *nl; FIX_LOCALE(locale); struct xlocale_ctype *l = XLOCALE_CTYPE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); if (n <= 0) { @@ -113,12 +113,14 @@ fgetws_l(wchar_t * __restrict ws, int n, FILE * __rest goto error; ok: *wsp = L'\0'; - FUNLOCKFILE(fp); - return (ws); + ret = ws; +end: + FUNLOCKFILE_CANCELSAFE(); + return (ret); error: - FUNLOCKFILE(fp); - return (NULL); + ret = NULL; + goto end; } wchar_t * Modified: stable/11/lib/libc/stdio/fputc.c ============================================================================== --- stable/11/lib/libc/stdio/fputc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fputc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -46,10 +46,10 @@ int fputc(int c, FILE *fp) { int retval; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* Orientation set by __sputc() when buffer is full. */ /* ORIENT(fp, -1); */ retval = __sputc(c, fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/fputs.c ============================================================================== --- stable/11/lib/libc/stdio/fputs.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fputs.c Thu Jul 13 09:27:11 2017 (r320942) @@ -59,10 +59,10 @@ fputs(const char * __restrict s, FILE * __restrict fp) uio.uio_resid = iov.iov_len = strlen(s); uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); retval = __sfvwrite(fp, &uio); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); if (retval == 0) return (iov.iov_len > INT_MAX ? INT_MAX : iov.iov_len); return (retval); Modified: stable/11/lib/libc/stdio/fputwc.c ============================================================================== --- stable/11/lib/libc/stdio/fputwc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fputwc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -74,10 +74,10 @@ fputwc_l(wchar_t wc, FILE *fp, locale_t locale) wint_t r; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); r = __fputwc(wc, fp, locale); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (r); } Modified: stable/11/lib/libc/stdio/fputws.c ============================================================================== --- stable/11/lib/libc/stdio/fputws.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fputws.c Thu Jul 13 09:27:11 2017 (r320942) @@ -53,11 +53,13 @@ fputws_l(const wchar_t * __restrict ws, FILE * __restr const wchar_t *wsp; FIX_LOCALE(locale); struct xlocale_ctype *l = XLOCALE_CTYPE(locale); + int ret; - FLOCKFILE(fp); + ret = -1; + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); if (prepwrite(fp) != 0) - goto error; + goto end; uio.uio_iov = &iov; uio.uio_iovcnt = 1; iov.iov_base = buf; @@ -66,17 +68,15 @@ fputws_l(const wchar_t * __restrict ws, FILE * __restr nbytes = l->__wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf), &fp->_mbstate); if (nbytes == (size_t)-1) - goto error; + goto end; uio.uio_resid = iov.iov_len = nbytes; if (__sfvwrite(fp, &uio) != 0) - goto error; + goto end; } while (wsp != NULL); - FUNLOCKFILE(fp); - return (0); - -error: - FUNLOCKFILE(fp); - return (-1); + ret = 0; +end: + FUNLOCKFILE_CANCELSAFE(); + return (ret); } int Modified: stable/11/lib/libc/stdio/fread.c ============================================================================== --- stable/11/lib/libc/stdio/fread.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fread.c Thu Jul 13 09:27:11 2017 (r320942) @@ -54,9 +54,9 @@ fread(void * __restrict buf, size_t size, size_t count { size_t ret; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __fread(buf, size, count, fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } Modified: stable/11/lib/libc/stdio/freopen.c ============================================================================== --- stable/11/lib/libc/stdio/freopen.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/freopen.c Thu Jul 13 09:27:11 2017 (r320942) @@ -68,7 +68,7 @@ freopen(const char * __restrict file, const char * __r return (NULL); } - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); if (!__sdidinit) __sinit(); @@ -81,24 +81,24 @@ freopen(const char * __restrict file, const char * __r if (file == NULL) { /* See comment below regarding freopen() of closed files. */ if (fp->_flags == 0) { - FUNLOCKFILE(fp); errno = EINVAL; - return (NULL); + fp = NULL; + goto end; } if ((dflags = _fcntl(fp->_file, F_GETFL)) < 0) { sverrno = errno; fclose(fp); - FUNLOCKFILE(fp); errno = sverrno; - return (NULL); + fp = NULL; + goto end; } /* Work around incorrect O_ACCMODE. */ if ((dflags & O_ACCMODE) != O_RDWR && (dflags & (O_ACCMODE | O_EXEC)) != (oflags & O_ACCMODE)) { fclose(fp); - FUNLOCKFILE(fp); errno = EBADF; - return (NULL); + fp = NULL; + goto end; } if (fp->_flags & __SWR) (void) __sflush(fp); @@ -108,9 +108,9 @@ freopen(const char * __restrict file, const char * __r if (_fcntl(fp->_file, F_SETFL, dflags) < 0) { sverrno = errno; fclose(fp); - FUNLOCKFILE(fp); errno = sverrno; - return (NULL); + fp = NULL; + goto end; } } if (oflags & O_TRUNC) @@ -193,9 +193,9 @@ finish: if (isopen) (void) (*fp->_close)(fp->_cookie); fp->_flags = 0; /* set it free */ - FUNLOCKFILE(fp); errno = sverrno; /* restore in case _close clobbered */ - return (NULL); + fp = NULL; + goto end; } /* @@ -221,9 +221,9 @@ finish: */ if (f > SHRT_MAX) { fp->_flags = 0; /* set it free */ - FUNLOCKFILE(fp); errno = EMFILE; - return (NULL); + fp = NULL; + goto end; } fp->_flags = flags; @@ -245,6 +245,7 @@ finish: fp->_flags2 |= __S2OAP; (void) _sseek(fp, (fpos_t)0, SEEK_END); } - FUNLOCKFILE(fp); +end: + FUNLOCKFILE_CANCELSAFE(); return (fp); } Modified: stable/11/lib/libc/stdio/fscanf.c ============================================================================== --- stable/11/lib/libc/stdio/fscanf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fscanf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -56,10 +56,10 @@ fscanf(FILE * __restrict fp, char const * __restrict f va_list ap; va_start(ap, fmt); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __svfscanf(fp, __get_locale(), fmt, ap); va_end(ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } int @@ -70,9 +70,9 @@ fscanf_l(FILE * __restrict fp, locale_t locale, char c FIX_LOCALE(locale); va_start(ap, fmt); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __svfscanf(fp, locale, fmt, ap); va_end(ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } Modified: stable/11/lib/libc/stdio/fseek.c ============================================================================== --- stable/11/lib/libc/stdio/fseek.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fseek.c Thu Jul 13 09:27:11 2017 (r320942) @@ -60,9 +60,9 @@ fseek(FILE *fp, long offset, int whence) if (!__sdidinit) __sinit(); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = _fseeko(fp, (off_t)offset, whence, 1); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); if (ret == 0) errno = serrno; return (ret); @@ -78,9 +78,9 @@ fseeko(FILE *fp, off_t offset, int whence) if (!__sdidinit) __sinit(); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = _fseeko(fp, offset, whence, 0); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); if (ret == 0) errno = serrno; return (ret); Modified: stable/11/lib/libc/stdio/fwrite.c ============================================================================== --- stable/11/lib/libc/stdio/fwrite.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/fwrite.c Thu Jul 13 09:27:11 2017 (r320942) @@ -82,7 +82,7 @@ fwrite(const void * __restrict buf, size_t size, size_ uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); /* * The usual case is success (__sfvwrite returns 0); @@ -91,6 +91,6 @@ fwrite(const void * __restrict buf, size_t size, size_ */ if (__sfvwrite(fp, &uio) != 0) count = (n - uio.uio_resid) / size; - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (count); } Modified: stable/11/lib/libc/stdio/getc.c ============================================================================== --- stable/11/lib/libc/stdio/getc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/getc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -49,11 +49,11 @@ int getc(FILE *fp) { int retval; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* Orientation set by __sgetc() when buffer is empty. */ /* ORIENT(fp, -1); */ retval = __sgetc(fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/getchar.c ============================================================================== --- stable/11/lib/libc/stdio/getchar.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/getchar.c Thu Jul 13 09:27:11 2017 (r320942) @@ -52,11 +52,11 @@ int getchar(void) { int retval; - FLOCKFILE(stdin); + FLOCKFILE_CANCELSAFE(stdin); /* Orientation set by __sgetc() when buffer is empty. */ /* ORIENT(stdin, -1); */ retval = __sgetc(stdin); - FUNLOCKFILE(stdin); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/getdelim.c ============================================================================== --- stable/11/lib/libc/stdio/getdelim.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/getdelim.c Thu Jul 13 09:27:11 2017 (r320942) @@ -112,7 +112,7 @@ getdelim(char ** __restrict linep, size_t * __restrict u_char *endp; size_t linelen; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); if (linep == NULL || linecapp == NULL) { @@ -127,9 +127,9 @@ getdelim(char ** __restrict linep, size_t * __restrict /* If fp is at EOF already, we just need space for the NUL. */ if (!__sfeof(fp) || expandtofit(linep, 1, linecapp)) goto error; - FUNLOCKFILE(fp); (*linep)[0] = '\0'; - return (-1); + linelen = -1; + goto end; } linelen = 0; @@ -150,11 +150,12 @@ getdelim(char ** __restrict linep, size_t * __restrict done: /* Invariant: *linep has space for at least linelen+1 bytes. */ (*linep)[linelen] = '\0'; - FUNLOCKFILE(fp); +end: + FUNLOCKFILE_CANCELSAFE(); return (linelen); error: fp->_flags |= __SERR; - FUNLOCKFILE(fp); - return (-1); + linelen = -1; + goto end; } Modified: stable/11/lib/libc/stdio/gets.c ============================================================================== --- stable/11/lib/libc/stdio/gets.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/gets.c Thu Jul 13 09:27:11 2017 (r320942) @@ -50,27 +50,30 @@ char * gets(char *buf) { int c; - char *s; + char *s, *ret; static int warned; static const char w[] = "warning: this program uses gets(), which is unsafe.\n"; - FLOCKFILE(stdin); + FLOCKFILE_CANCELSAFE(stdin); ORIENT(stdin, -1); if (!warned) { (void) _write(STDERR_FILENO, w, sizeof(w) - 1); warned = 1; } - for (s = buf; (c = __sgetc(stdin)) != '\n';) + for (s = buf; (c = __sgetc(stdin)) != '\n'; ) { if (c == EOF) if (s == buf) { - FUNLOCKFILE(stdin); - return (NULL); + ret = NULL; + goto end; } else break; else *s++ = c; + } *s = 0; - FUNLOCKFILE(stdin); - return (buf); + ret = buf; +end: + FUNLOCKFILE_CANCELSAFE(); + return (ret); } Modified: stable/11/lib/libc/stdio/local.h ============================================================================== --- stable/11/lib/libc/stdio/local.h Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/local.h Thu Jul 13 09:27:11 2017 (r320942) @@ -38,6 +38,9 @@ * $FreeBSD$ */ +#ifndef _STDIO_LOCAL_H +#define _STDIO_LOCAL_H + #include /* for off_t */ #include #include @@ -138,3 +141,26 @@ __fgetwc(FILE *fp, locale_t locale) if ((fp)->_orientation == 0) \ (fp)->_orientation = (o); \ } while (0) + +void __stdio_cancel_cleanup(void *); +#define FLOCKFILE_CANCELSAFE(fp) \ + { \ + struct _pthread_cleanup_info __cleanup_info__; \ + if (__isthreaded) { \ + _FLOCKFILE(fp); \ + ___pthread_cleanup_push_imp( \ + __stdio_cancel_cleanup, (fp), \ + &__cleanup_info__); \ + } else { \ + ___pthread_cleanup_push_imp( \ + __stdio_cancel_cleanup, NULL, \ + &__cleanup_info__); \ + } \ + { +#define FUNLOCKFILE_CANCELSAFE() \ + (void)0; \ + } \ + ___pthread_cleanup_pop_imp(1); \ + } + +#endif /* _STDIO_LOCAL_H */ Modified: stable/11/lib/libc/stdio/perror.c ============================================================================== --- stable/11/lib/libc/stdio/perror.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/perror.c Thu Jul 13 09:27:11 2017 (r320942) @@ -67,9 +67,9 @@ perror(const char *s) v++; v->iov_base = "\n"; v->iov_len = 1; - FLOCKFILE(stderr); + FLOCKFILE_CANCELSAFE(stderr); __sflush(stderr); (void)_writev(stderr->_file, iov, (v - iov) + 1); stderr->_flags &= ~__SOFF; - FUNLOCKFILE(stderr); + FUNLOCKFILE_CANCELSAFE(); } Modified: stable/11/lib/libc/stdio/putc.c ============================================================================== --- stable/11/lib/libc/stdio/putc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/putc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -49,11 +49,11 @@ int putc(int c, FILE *fp) { int retval; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* Orientation set by __sputc() when buffer is full. */ /* ORIENT(fp, -1); */ retval = __sputc(c, fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/putchar.c ============================================================================== --- stable/11/lib/libc/stdio/putchar.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/putchar.c Thu Jul 13 09:27:11 2017 (r320942) @@ -54,11 +54,11 @@ putchar(int c) int retval; FILE *so = stdout; - FLOCKFILE(so); + FLOCKFILE_CANCELSAFE(so); /* Orientation set by __sputc() when buffer is full. */ /* ORIENT(so, -1); */ retval = __sputc(c, so); - FUNLOCKFILE(so); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/puts.c ============================================================================== --- stable/11/lib/libc/stdio/puts.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/puts.c Thu Jul 13 09:27:11 2017 (r320942) @@ -62,9 +62,9 @@ puts(char const *s) uio.uio_resid = c + 1; uio.uio_iov = &iov[0]; uio.uio_iovcnt = 2; - FLOCKFILE(stdout); + FLOCKFILE_CANCELSAFE(stdout); ORIENT(stdout, -1); retval = __sfvwrite(stdout, &uio) ? EOF : '\n'; - FUNLOCKFILE(stdout); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/putw.c ============================================================================== --- stable/11/lib/libc/stdio/putw.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/putw.c Thu Jul 13 09:27:11 2017 (r320942) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "fvwrite.h" #include "libc_private.h" +#include "local.h" int putw(int w, FILE *fp) @@ -53,8 +54,8 @@ putw(int w, FILE *fp) uio.uio_resid = iov.iov_len = sizeof(w); uio.uio_iov = &iov; uio.uio_iovcnt = 1; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); retval = __sfvwrite(fp, &uio); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (retval); } Modified: stable/11/lib/libc/stdio/refill.c ============================================================================== --- stable/11/lib/libc/stdio/refill.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/refill.c Thu Jul 13 09:27:11 2017 (r320942) @@ -53,9 +53,9 @@ lflush(FILE *fp) int ret = 0; if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR)) { - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __sflush(fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); } return (ret); } Modified: stable/11/lib/libc/stdio/scanf.c ============================================================================== --- stable/11/lib/libc/stdio/scanf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/scanf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -56,9 +56,9 @@ scanf(char const * __restrict fmt, ...) va_list ap; va_start(ap, fmt); - FLOCKFILE(stdin); + FLOCKFILE_CANCELSAFE(stdin); ret = __svfscanf(stdin, __get_locale(), fmt, ap); - FUNLOCKFILE(stdin); + FUNLOCKFILE_CANCELSAFE(); va_end(ap); return (ret); } @@ -70,9 +70,9 @@ scanf_l(locale_t locale, char const * __restrict fmt, FIX_LOCALE(locale); va_start(ap, fmt); - FLOCKFILE(stdin); + FLOCKFILE_CANCELSAFE(stdin); ret = __svfscanf(stdin, locale, fmt, ap); - FUNLOCKFILE(stdin); + FUNLOCKFILE_CANCELSAFE(); va_end(ap); return (ret); } Modified: stable/11/lib/libc/stdio/setvbuf.c ============================================================================== --- stable/11/lib/libc/stdio/setvbuf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/setvbuf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -63,7 +63,7 @@ setvbuf(FILE * __restrict fp, char * __restrict buf, i if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0) return (EOF); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* * Write current buffer, if any. Discard unread input (including * ungetc data), cancel line buffering, and free old buffer if @@ -115,8 +115,7 @@ nbf: fp->_w = 0; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; - FUNLOCKFILE(fp); - return (ret); + goto end; } flags |= __SMBF; } @@ -156,6 +155,7 @@ nbf: } __cleanup = _cleanup; - FUNLOCKFILE(fp); +end: + FUNLOCKFILE_CANCELSAFE(); return (ret); } Modified: stable/11/lib/libc/stdio/stdio.c ============================================================================== --- stable/11/lib/libc/stdio/stdio.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/stdio.c Thu Jul 13 09:27:11 2017 (r320942) @@ -166,3 +166,11 @@ _sseek(FILE *fp, fpos_t offset, int whence) } return (ret); } + +void +__stdio_cancel_cleanup(void * arg) +{ + + if (arg != NULL) + _funlockfile((FILE *)arg); +} Modified: stable/11/lib/libc/stdio/ungetc.c ============================================================================== --- stable/11/lib/libc/stdio/ungetc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/ungetc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -94,10 +94,10 @@ ungetc(int c, FILE *fp) if (!__sdidinit) __sinit(); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, -1); ret = __ungetc(c, fp); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } Modified: stable/11/lib/libc/stdio/ungetwc.c ============================================================================== --- stable/11/lib/libc/stdio/ungetwc.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/ungetwc.c Thu Jul 13 09:27:11 2017 (r320942) @@ -76,10 +76,10 @@ ungetwc_l(wint_t wc, FILE *fp, locale_t locale) wint_t r; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); r = __ungetwc(wc, fp, locale); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (r); } Modified: stable/11/lib/libc/stdio/vfprintf.c ============================================================================== --- stable/11/lib/libc/stdio/vfprintf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/vfprintf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -274,14 +274,14 @@ vfprintf_l(FILE * __restrict fp, locale_t locale, cons int ret; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* optimise fprintf(stderr) (and other unbuffered Unix files) */ if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && fp->_file >= 0) ret = __sbprintf(fp, locale, fmt0, ap); else ret = __vfprintf(fp, locale, fmt0, ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } int Modified: stable/11/lib/libc/stdio/vfscanf.c ============================================================================== --- stable/11/lib/libc/stdio/vfscanf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/vfscanf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -443,9 +443,9 @@ __vfscanf(FILE *fp, char const *fmt0, va_list ap) { int ret; - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __svfscanf(fp, __get_locale(), fmt0, ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } int @@ -454,9 +454,9 @@ vfscanf_l(FILE *fp, locale_t locale, char const *fmt0, int ret; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ret = __svfscanf(fp, locale, fmt0, ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } Modified: stable/11/lib/libc/stdio/vfwprintf.c ============================================================================== --- stable/11/lib/libc/stdio/vfwprintf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/vfwprintf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -356,14 +356,14 @@ vfwprintf_l(FILE * __restrict fp, locale_t locale, { int ret; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); /* optimise fprintf(stderr) (and other unbuffered Unix files) */ if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && fp->_file >= 0) ret = __sbprintf(fp, locale, fmt0, ap); else ret = __vfwprintf(fp, locale, fmt0, ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } int Modified: stable/11/lib/libc/stdio/vfwscanf.c ============================================================================== --- stable/11/lib/libc/stdio/vfwscanf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/vfwscanf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -428,10 +428,10 @@ vfwscanf_l(FILE * __restrict fp, locale_t locale, int ret; FIX_LOCALE(locale); - FLOCKFILE(fp); + FLOCKFILE_CANCELSAFE(fp); ORIENT(fp, 1); ret = __vfwscanf(fp, locale, fmt, ap); - FUNLOCKFILE(fp); + FUNLOCKFILE_CANCELSAFE(); return (ret); } int Modified: stable/11/lib/libc/stdio/vscanf.c ============================================================================== --- stable/11/lib/libc/stdio/vscanf.c Thu Jul 13 09:01:22 2017 (r320941) +++ stable/11/lib/libc/stdio/vscanf.c Thu Jul 13 09:27:11 2017 (r320942) @@ -54,9 +54,9 @@ vscanf_l(locale_t locale, const char * __restrict fmt, int retval; FIX_LOCALE(locale); - FLOCKFILE(stdin); + FLOCKFILE_CANCELSAFE(stdin); retval = __svfscanf(stdin, locale, fmt, ap); - FUNLOCKFILE(stdin); + FUNLOCKFILE_CANCELSAFE(); return (retval); } int From owner-svn-src-stable@freebsd.org Thu Jul 13 15:10:03 2017 Return-Path: Delivered-To: svn-src-stable@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 A4DD4DA4D8D; Thu, 13 Jul 2017 15:10:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70B927B2C7; Thu, 13 Jul 2017 15:10:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DFA2rw023489; Thu, 13 Jul 2017 15:10:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DFA2EE023488; Thu, 13 Jul 2017 15:10:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201707131510.v6DFA2EE023488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 13 Jul 2017 15:10:02 +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: r320945 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 320945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 15:10:03 -0000 Author: hselasky Date: Thu Jul 13 15:10:02 2017 New Revision: 320945 URL: https://svnweb.freebsd.org/changeset/base/320945 Log: MFC r320876: Make sure the mlx4en RX DMA ring gets stamped with software ownership in order to prevent the flow of QP to error in the firmware once UPDATE_QP is called. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Jul 13 13:40:18 2017 (r320944) +++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Jul 13 15:10:02 2017 (r320945) @@ -394,8 +394,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *pri ring->rx_mb_size = priv->rx_mb_size; ring->stride = stride; - if (ring->stride <= TXBB_SIZE) + if (ring->stride <= TXBB_SIZE) { + /* Stamp first unused send wqe */ + __be32 *ptr = (__be32 *)ring->buf; + __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT); + *ptr = stamp; + /* Move pointer to start of rx section */ ring->buf += TXBB_SIZE; + } ring->log_stride = ffs(ring->stride) - 1; ring->buf_size = ring->size * ring->stride; From owner-svn-src-stable@freebsd.org Thu Jul 13 15:12:02 2017 Return-Path: Delivered-To: svn-src-stable@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 4517CDA4F7C; Thu, 13 Jul 2017 15:12:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 135777B607; Thu, 13 Jul 2017 15:12:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DFC1Ox025928; Thu, 13 Jul 2017 15:12:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DFC13c025927; Thu, 13 Jul 2017 15:12:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201707131512.v6DFC13c025927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 13 Jul 2017 15:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r320946 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 320946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 15:12:02 -0000 Author: hselasky Date: Thu Jul 13 15:12:01 2017 New Revision: 320946 URL: https://svnweb.freebsd.org/changeset/base/320946 Log: MFC r320876: Make sure the mlx4en RX DMA ring gets stamped with software ownership in order to prevent the flow of QP to error in the firmware once UPDATE_QP is called. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Thu Jul 13 15:10:02 2017 (r320945) +++ stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Thu Jul 13 15:12:01 2017 (r320946) @@ -394,8 +394,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *pri ring->rx_mb_size = priv->rx_mb_size; ring->stride = stride; - if (ring->stride <= TXBB_SIZE) + if (ring->stride <= TXBB_SIZE) { + /* Stamp first unused send wqe */ + __be32 *ptr = (__be32 *)ring->buf; + __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT); + *ptr = stamp; + /* Move pointer to start of rx section */ ring->buf += TXBB_SIZE; + } ring->log_stride = ffs(ring->stride) - 1; ring->buf_size = ring->size * ring->stride; From owner-svn-src-stable@freebsd.org Thu Jul 13 15:16:47 2017 Return-Path: Delivered-To: svn-src-stable@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 3F316DA61E2; Thu, 13 Jul 2017 15:16:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08FF07B957; Thu, 13 Jul 2017 15:16:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DFGkKb027526; Thu, 13 Jul 2017 15:16:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DFGkBE027525; Thu, 13 Jul 2017 15:16:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201707131516.v6DFGkBE027525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 13 Jul 2017 15:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320947 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Commit-Revision: 320947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 15:16:47 -0000 Author: hselasky Date: Thu Jul 13 15:16:45 2017 New Revision: 320947 URL: https://svnweb.freebsd.org/changeset/base/320947 Log: MFC r320876: Make sure the mlx4en RX DMA ring gets stamped with software ownership in order to prevent the flow of QP to error in the firmware once UPDATE_QP is called. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_rx.c Thu Jul 13 15:12:01 2017 (r320946) +++ stable/11/sys/ofed/drivers/net/mlx4/en_rx.c Thu Jul 13 15:16:45 2017 (r320947) @@ -394,8 +394,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *pri ring->rx_mb_size = priv->rx_mb_size; ring->stride = stride; - if (ring->stride <= TXBB_SIZE) + if (ring->stride <= TXBB_SIZE) { + /* Stamp first unused send wqe */ + __be32 *ptr = (__be32 *)ring->buf; + __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT); + *ptr = stamp; + /* Move pointer to start of rx section */ ring->buf += TXBB_SIZE; + } ring->log_stride = ffs(ring->stride) - 1; ring->buf_size = ring->size * ring->stride; From owner-svn-src-stable@freebsd.org Thu Jul 13 16:18:47 2017 Return-Path: Delivered-To: svn-src-stable@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 E21CADA7B7C; Thu, 13 Jul 2017 16:18:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6D957E110; Thu, 13 Jul 2017 16:18:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DGIkcW053015; Thu, 13 Jul 2017 16:18:46 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DGIkgh053014; Thu, 13 Jul 2017 16:18:46 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707131618.v6DGIkgh053014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 13 Jul 2017 16:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320950 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Commit-Revision: 320950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 16:18:48 -0000 Author: gjb Date: Thu Jul 13 16:18:46 2017 New Revision: 320950 URL: https://svnweb.freebsd.org/changeset/base/320950 Log: Document SA-17:05.heimdal, EN-17:06.hyperv Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/errata.xml stable/10/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Thu Jul 13 15:54:26 2017 (r320949) +++ stable/11/release/doc/share/xml/security.xml Thu Jul 13 16:18:46 2017 (r320950) @@ -90,6 +90,14 @@ 27 April 2017 Fix fragment handling panic + + + FreeBSD-SA-17:05.heimdal + 12 July 2017 + Fix KDC-REP service name validation + vulnerability + From owner-svn-src-stable@freebsd.org Thu Jul 13 16:18:47 2017 Return-Path: Delivered-To: svn-src-stable@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 B19B1DA7B76; Thu, 13 Jul 2017 16:18:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CB2E7E10F; Thu, 13 Jul 2017 16:18:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6DGIkAg053009; Thu, 13 Jul 2017 16:18:46 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6DGIkqA053007; Thu, 13 Jul 2017 16:18:46 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707131618.v6DGIkqA053007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 13 Jul 2017 16:18:46 +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: r320950 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Commit-Revision: 320950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 16:18:47 -0000 Author: gjb Date: Thu Jul 13 16:18:46 2017 New Revision: 320950 URL: https://svnweb.freebsd.org/changeset/base/320950 Log: Document SA-17:05.heimdal, EN-17:06.hyperv Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/errata.xml stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/11/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/errata.xml ============================================================================== --- stable/10/release/doc/share/xml/errata.xml Thu Jul 13 15:54:26 2017 (r320949) +++ stable/10/release/doc/share/xml/errata.xml Thu Jul 13 16:18:46 2017 (r320950) @@ -134,6 +134,14 @@ 23 February 2017 Xen migration enhancements + + + FreeBSD-EN-17:06.hyperv + 12 July 2017 + Boot compatibility improvements with + Azure virtual machines + Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Thu Jul 13 15:54:26 2017 (r320949) +++ stable/10/release/doc/share/xml/security.xml Thu Jul 13 16:18:46 2017 (r320950) @@ -206,6 +206,14 @@ 27 April 2017 Fix fragment handling panic + + + FreeBSD-SA-17:05.heimdal + 12 July 2017 + Fix KDC-REP service name validation + vulnerability + From owner-svn-src-stable@freebsd.org Fri Jul 14 01:22:28 2017 Return-Path: Delivered-To: svn-src-stable@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 7A740DB2695; Fri, 14 Jul 2017 01:22:28 +0000 (UTC) (envelope-from jhibbits@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 40381701F4; Fri, 14 Jul 2017 01:22:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6E1MRaL085093; Fri, 14 Jul 2017 01:22:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6E1MRLq085092; Fri, 14 Jul 2017 01:22:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201707140122.v6E1MRLq085092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 14 Jul 2017 01:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320978 - stable/11/sys/powerpc/booke X-SVN-Group: stable-11 X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: stable/11/sys/powerpc/booke X-SVN-Commit-Revision: 320978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 01:22:28 -0000 Author: jhibbits Date: Fri Jul 14 01:22:27 2017 New Revision: 320978 URL: https://svnweb.freebsd.org/changeset/base/320978 Log: MFC r320392: Disable interrupts when updating the TLB Modified: stable/11/sys/powerpc/booke/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/booke/pmap.c ============================================================================== --- stable/11/sys/powerpc/booke/pmap.c Fri Jul 14 00:10:51 2017 (r320977) +++ stable/11/sys/powerpc/booke/pmap.c Fri Jul 14 01:22:27 2017 (r320978) @@ -3150,10 +3150,14 @@ tlb0_print_tlbentries(void) void tlb1_read_entry(tlb_entry_t *entry, unsigned int slot) { + register_t msr; uint32_t mas0; KASSERT((entry != NULL), ("%s(): Entry is NULL!", __func__)); + msr = mfmsr(); + mtmsr(msr & ~PSL_EE); + mas0 = MAS0_TLBSEL(1) | MAS0_ESEL(slot); mtspr(SPR_MAS0, mas0); __asm __volatile("isync; tlbre"); @@ -3172,6 +3176,7 @@ tlb1_read_entry(tlb_entry_t *entry, unsigned int slot) entry->mas7 = 0; break; } + mtmsr(msr); entry->virt = entry->mas2 & MAS2_EPN_MASK; entry->phys = ((vm_paddr_t)(entry->mas7 & MAS7_RPN) << 32) | @@ -3187,6 +3192,7 @@ tlb1_read_entry(tlb_entry_t *entry, unsigned int slot) static void tlb1_write_entry(tlb_entry_t *e, unsigned int idx) { + register_t msr; uint32_t mas0; //debugf("tlb1_write_entry: s\n"); @@ -3195,6 +3201,9 @@ tlb1_write_entry(tlb_entry_t *e, unsigned int idx) mas0 = MAS0_TLBSEL(1) | MAS0_ESEL(idx); //debugf("tlb1_write_entry: mas0 = 0x%08x\n", mas0); + msr = mfmsr(); + mtmsr(msr & ~PSL_EE); + mtspr(SPR_MAS0, mas0); __asm __volatile("isync"); mtspr(SPR_MAS1, e->mas1); @@ -3218,6 +3227,7 @@ tlb1_write_entry(tlb_entry_t *e, unsigned int idx) } __asm __volatile("tlbwe; isync; msync"); + mtmsr(msr); //debugf("tlb1_write_entry: e\n"); } From owner-svn-src-stable@freebsd.org Fri Jul 14 01:45:45 2017 Return-Path: Delivered-To: svn-src-stable@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 32DA8DB2A07; Fri, 14 Jul 2017 01:45:45 +0000 (UTC) (envelope-from jhibbits@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 F20C17093A; Fri, 14 Jul 2017 01:45:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6E1jiam093158; Fri, 14 Jul 2017 01:45:44 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6E1ji3K093157; Fri, 14 Jul 2017 01:45:44 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201707140145.v6E1ji3K093157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 14 Jul 2017 01:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320979 - stable/11/sys/powerpc/booke X-SVN-Group: stable-11 X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: stable/11/sys/powerpc/booke X-SVN-Commit-Revision: 320979 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 01:45:45 -0000 Author: jhibbits Date: Fri Jul 14 01:45:43 2017 New Revision: 320979 URL: https://svnweb.freebsd.org/changeset/base/320979 Log: MFC r320489: Use the more common Book-E idiom for disabling interrupts. Modified: stable/11/sys/powerpc/booke/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/booke/pmap.c ============================================================================== --- stable/11/sys/powerpc/booke/pmap.c Fri Jul 14 01:22:27 2017 (r320978) +++ stable/11/sys/powerpc/booke/pmap.c Fri Jul 14 01:45:43 2017 (r320979) @@ -3156,7 +3156,7 @@ tlb1_read_entry(tlb_entry_t *entry, unsigned int slot) KASSERT((entry != NULL), ("%s(): Entry is NULL!", __func__)); msr = mfmsr(); - mtmsr(msr & ~PSL_EE); + __asm __volatile("wrteei 0"); mas0 = MAS0_TLBSEL(1) | MAS0_ESEL(slot); mtspr(SPR_MAS0, mas0); @@ -3202,7 +3202,7 @@ tlb1_write_entry(tlb_entry_t *e, unsigned int idx) //debugf("tlb1_write_entry: mas0 = 0x%08x\n", mas0); msr = mfmsr(); - mtmsr(msr & ~PSL_EE); + __asm __volatile("wrteei 0"); mtspr(SPR_MAS0, mas0); __asm __volatile("isync"); From owner-svn-src-stable@freebsd.org Fri Jul 14 07:42:58 2017 Return-Path: Delivered-To: svn-src-stable@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 EA878D9991D; Fri, 14 Jul 2017 07:42:58 +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 B62FD8039B; Fri, 14 Jul 2017 07:42:58 +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 v6E7gvUC040851; Fri, 14 Jul 2017 07:42:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6E7gvOP040850; Fri, 14 Jul 2017 07:42:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707140742.v6E7gvOP040850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 14 Jul 2017 07:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320981 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 320981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 07:42:59 -0000 Author: kib Date: Fri Jul 14 07:42:57 2017 New Revision: 320981 URL: https://svnweb.freebsd.org/changeset/base/320981 Log: MFC r320501: Correct fences for sys/refcount.h. Modified: stable/11/sys/sys/refcount.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/refcount.h ============================================================================== --- stable/11/sys/sys/refcount.h Fri Jul 14 02:15:48 2017 (r320980) +++ stable/11/sys/sys/refcount.h Fri Jul 14 07:42:57 2017 (r320981) @@ -50,7 +50,7 @@ refcount_acquire(volatile u_int *count) { KASSERT(*count < UINT_MAX, ("refcount %p overflowed", count)); - atomic_add_acq_int(count, 1); + atomic_add_int(count, 1); } static __inline int @@ -58,10 +58,20 @@ refcount_release(volatile u_int *count) { u_int old; - /* XXX: Should this have a rel membar? */ + atomic_thread_fence_rel(); old = atomic_fetchadd_int(count, -1); KASSERT(old > 0, ("negative refcount %p", count)); - return (old == 1); + if (old > 1) + return (0); + + /* + * Last reference. Signal the user to call the destructor. + * + * Ensure that the destructor sees all updates. The fence_rel + * at the start of the function synchronized with this fence. + */ + atomic_thread_fence_acq(); + return (1); } #endif /* ! __SYS_REFCOUNT_H__ */ From owner-svn-src-stable@freebsd.org Fri Jul 14 20:47:43 2017 Return-Path: Delivered-To: svn-src-stable@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 A7FDBDAC08E; Fri, 14 Jul 2017 20:47:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D010762B1; Fri, 14 Jul 2017 20:47:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6EKlgwv070976; Fri, 14 Jul 2017 20:47:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6EKlgWq070971; Fri, 14 Jul 2017 20:47:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707142047.v6EKlgWq070971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 14 Jul 2017 20:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320998 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/11/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 320998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 20:47:43 -0000 Author: rmacklem Date: Fri Jul 14 20:47:41 2017 New Revision: 320998 URL: https://svnweb.freebsd.org/changeset/base/320998 Log: MFC: r320322 Add two new compound RPCs to the NFSv4.1/pNFS client. When the NFSv4.1 client is doing pNFS, it needs to get an Open and a Layout for every file it will be doing I/O on. The current code does two separate RPCs to get these. This patch adds two new compounds that do the both the Open and LayoutGet in the same RPC, reducing the RPC count. It also factors out the code that sets up and parses the LayoutGet operation into separate functions, so that the code doesn't get duplicated for these new RPCs. This patch is fairly large, but should only affect the NFSv4.1 client when the "pnfs" option is specified. Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c stable/11/sys/fs/nfs/nfsport.h stable/11/sys/fs/nfs/nfsproto.h stable/11/sys/fs/nfsclient/nfs_clcomsubs.c stable/11/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Fri Jul 14 18:36:15 2017 (r320997) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Fri Jul 14 20:47:41 2017 (r320998) @@ -175,7 +175,7 @@ static struct nfsrv_lughash *nfsgroupnamehash; */ int nfs_bigreply[NFSV41_NPROCS] = { 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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, 1, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }; /* local functions */ static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep); Modified: stable/11/sys/fs/nfs/nfsport.h ============================================================================== --- stable/11/sys/fs/nfs/nfsport.h Fri Jul 14 18:36:15 2017 (r320997) +++ stable/11/sys/fs/nfs/nfsport.h Fri Jul 14 20:47:41 2017 (r320998) @@ -357,11 +357,13 @@ #define NFSPROC_WRITEDS 51 #define NFSPROC_READDS 52 #define NFSPROC_COMMITDS 53 +#define NFSPROC_OPENLAYGET 54 +#define NFSPROC_CREATELAYGET 55 /* * Must be defined as one higher than the last NFSv4.1 Proc# above. */ -#define NFSV41_NPROCS 54 +#define NFSV41_NPROCS 56 #endif /* NFS_V3NPROCS */ @@ -390,7 +392,7 @@ struct nfsstatsv1 { uint64_t readlink_bios; uint64_t biocache_readdirs; uint64_t readdir_bios; - uint64_t rpccnt[NFSV41_NPROCS + 15]; + uint64_t rpccnt[NFSV41_NPROCS + 13]; uint64_t rpcretries; uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS]; uint64_t srvrpc_errs; Modified: stable/11/sys/fs/nfs/nfsproto.h ============================================================================== --- stable/11/sys/fs/nfs/nfsproto.h Fri Jul 14 18:36:15 2017 (r320997) +++ stable/11/sys/fs/nfs/nfsproto.h Fri Jul 14 20:47:41 2017 (r320998) @@ -342,11 +342,13 @@ #define NFSPROC_WRITEDS 51 #define NFSPROC_READDS 52 #define NFSPROC_COMMITDS 53 +#define NFSPROC_OPENLAYGET 54 +#define NFSPROC_CREATELAYGET 55 /* * Must be defined as one higher than the last NFSv4.1 Proc# above. */ -#define NFSV41_NPROCS 54 +#define NFSV41_NPROCS 56 #endif /* NFS_V3NPROCS */ Modified: stable/11/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clcomsubs.c Fri Jul 14 18:36:15 2017 (r320997) +++ stable/11/sys/fs/nfsclient/nfs_clcomsubs.c Fri Jul 14 20:47:41 2017 (r320998) @@ -112,6 +112,8 @@ static struct { { NFSV4OP_WRITE, 1, "WriteDS", 7, }, { NFSV4OP_READ, 1, "ReadDS", 6, }, { NFSV4OP_COMMIT, 1, "CommitDS", 8, }, + { NFSV4OP_OPEN, 3, "OpenLayoutGet", 13, }, + { NFSV4OP_OPEN, 8, "CreateLayGet", 12, }, }; /* @@ -120,7 +122,7 @@ static struct { static int nfs_bigrequest[NFSV41_NPROCS] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 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, 1, 0, 0 + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }; /* Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Fri Jul 14 18:36:15 2017 (r320997) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Fri Jul 14 20:47:41 2017 (r320998) @@ -127,6 +127,29 @@ static enum nfsclds_state nfscl_getsameserver(struct n static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *, struct nfsfh *, struct ucred *, NFSPROC_T *, void *); #endif +static void nfsrv_setuplayoutget(struct nfsrv_descript *, int, uint64_t, + uint64_t, uint64_t, nfsv4stateid_t *, int, int); +static int nfsrv_parselayoutget(struct nfsrv_descript *, nfsv4stateid_t *, + int *, struct nfsclflayouthead *); +static int nfsrpc_getopenlayout(struct nfsmount *, vnode_t, u_int8_t *, + int, uint8_t *, int, uint32_t, struct nfsclopen *, uint8_t *, int, + struct nfscldeleg **, struct ucred *, NFSPROC_T *); +static int nfsrpc_getcreatelayout(vnode_t, char *, int, struct vattr *, + nfsquad_t, int, struct nfsclowner *, struct nfscldeleg **, + struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *, + struct nfsfh **, int *, int *, void *, int *); +static int nfsrpc_openlayoutrpc(struct nfsmount *, vnode_t, u_int8_t *, + int, uint8_t *, int, uint32_t, struct nfsclopen *, uint8_t *, int, + struct nfscldeleg **, nfsv4stateid_t *, int, int, int *, + struct nfsclflayouthead *, int *, struct ucred *, NFSPROC_T *); +static int nfsrpc_createlayout(vnode_t, char *, int, struct vattr *, + nfsquad_t, int, struct nfsclowner *, struct nfscldeleg **, + struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *, + struct nfsfh **, int *, int *, void *, int *, nfsv4stateid_t *, + int, int, int *, struct nfsclflayouthead *, int *); +static int nfsrpc_layoutgetres(struct nfsmount *, vnode_t, uint8_t *, + int, nfsv4stateid_t *, int, uint32_t *, struct nfscllayout **, + struct nfsclflayouthead *, int, int *, struct ucred *, NFSPROC_T *); /* * nfs null call from vfs. @@ -301,11 +324,27 @@ else printf(" fhl=0\n"); clidrev = 0; if (ret == NFSCLOPEN_DOOPEN) { if (np->n_v4 != NULL) { - error = nfsrpc_openrpc(nmp, vp, np->n_v4->n4_data, - np->n_v4->n4_fhlen, np->n_fhp->nfh_fh, - np->n_fhp->nfh_len, mode, op, - NFS4NODENAME(np->n_v4), np->n_v4->n4_namelen, &dp, - 0, 0x0, cred, p, 0, 0); + /* + * For the first attempt, try and get a layout, if + * pNFS is enabled for the mount. + */ + if (!NFSHASPNFS(nmp) || nfscl_enablecallb == 0 || + nfs_numnfscbd == 0 || + (np->n_flag & NNOLAYOUT) != 0 || retrycnt > 0) + error = nfsrpc_openrpc(nmp, vp, + np->n_v4->n4_data, + np->n_v4->n4_fhlen, np->n_fhp->nfh_fh, + np->n_fhp->nfh_len, mode, op, + NFS4NODENAME(np->n_v4), + np->n_v4->n4_namelen, + &dp, 0, 0x0, cred, p, 0, 0); + else + error = nfsrpc_getopenlayout(nmp, vp, + np->n_v4->n4_data, + np->n_v4->n4_fhlen, np->n_fhp->nfh_fh, + np->n_fhp->nfh_len, mode, op, + NFS4NODENAME(np->n_v4), + np->n_v4->n4_namelen, &dp, cred, p); if (dp != NULL) { #ifdef APPLE OSBitAndAtomic((int32_t)~NDELEGMOD, (UInt32 *)&np->n_flag); @@ -1894,9 +1933,15 @@ nfsrpc_create(vnode_t dvp, char *name, int namelen, st clidrev = nmp->nm_clp->nfsc_clientidrev; else clidrev = 0; - error = nfsrpc_createv4(dvp, name, namelen, vap, cverf, fmode, - owp, &dp, cred, p, dnap, nnap, nfhpp, attrflagp, dattrflagp, - dstuff, &unlocked); + if (!NFSHASPNFS(nmp) || nfscl_enablecallb == 0 || + nfs_numnfscbd == 0 || retrycnt > 0) + error = nfsrpc_createv4(dvp, name, namelen, vap, cverf, + fmode, owp, &dp, cred, p, dnap, nnap, nfhpp, + attrflagp, dattrflagp, dstuff, &unlocked); + else + error = nfsrpc_getcreatelayout(dvp, name, namelen, vap, + cverf, fmode, owp, &dp, cred, p, dnap, nnap, nfhpp, + attrflagp, dattrflagp, dstuff, &unlocked); /* * There is no need to invalidate cached attributes here, * since new post-delegation issue attributes are always @@ -4785,149 +4830,22 @@ nfsrpc_layoutget(struct nfsmount *nmp, uint8_t *fhp, i nfsv4stateid_t *stateidp, int *retonclosep, struct nfsclflayouthead *flhp, struct ucred *cred, NFSPROC_T *p, void *stuff) { - uint32_t *tl; struct nfsrv_descript nfsd, *nd = &nfsd; - struct nfsfh *nfhp; - struct nfsclflayout *flp, *prevflp, *tflp; - int cnt, error, gotiomode, fhcnt, nfhlen, i, j; - uint8_t *cp; - uint64_t retlen; + int error; - flp = NULL; - gotiomode = -1; nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL); - NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER + - NFSX_STATEID); - *tl++ = newnfs_false; /* Don't signal availability. */ - *tl++ = txdr_unsigned(NFSLAYOUT_NFSV4_1_FILES); - *tl++ = txdr_unsigned(iomode); - txdr_hyper(offset, tl); - tl += 2; - txdr_hyper(len, tl); - tl += 2; - txdr_hyper(minlen, tl); - tl += 2; - *tl++ = txdr_unsigned(stateidp->seqid); - NFSCL_DEBUG(4, "layget seq=%d\n", (int)stateidp->seqid); - *tl++ = stateidp->other[0]; - *tl++ = stateidp->other[1]; - *tl++ = stateidp->other[2]; - *tl = txdr_unsigned(layoutlen); + nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp, + layoutlen, 0); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + NFSCL_DEBUG(4, "layget err=%d st=%d\n", error, nd->nd_repstat); if (error != 0) return (error); - if (nd->nd_repstat == 0) { - NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED + NFSX_STATEID); - if (*tl++ != 0) - *retonclosep = 1; - else - *retonclosep = 0; - stateidp->seqid = fxdr_unsigned(uint32_t, *tl++); - NFSCL_DEBUG(4, "retoncls=%d stseq=%d\n", *retonclosep, - (int)stateidp->seqid); - stateidp->other[0] = *tl++; - stateidp->other[1] = *tl++; - stateidp->other[2] = *tl++; - cnt = fxdr_unsigned(int, *tl); - NFSCL_DEBUG(4, "layg cnt=%d\n", cnt); - if (cnt <= 0 || cnt > 10000) { - /* Don't accept more than 10000 layouts in reply. */ - error = NFSERR_BADXDR; - goto nfsmout; - } - for (i = 0; i < cnt; i++) { - /* Dissect all the way to the file handle cnt. */ - NFSM_DISSECT(tl, uint32_t *, 3 * NFSX_HYPER + - 6 * NFSX_UNSIGNED + NFSX_V4DEVICEID); - fhcnt = fxdr_unsigned(int, *(tl + 11 + - NFSX_V4DEVICEID / NFSX_UNSIGNED)); - NFSCL_DEBUG(4, "fhcnt=%d\n", fhcnt); - if (fhcnt < 0 || fhcnt > 100) { - /* Don't accept more than 100 file handles. */ - error = NFSERR_BADXDR; - goto nfsmout; - } - if (fhcnt > 1) - flp = malloc(sizeof(*flp) + (fhcnt - 1) * - sizeof(struct nfsfh *), - M_NFSFLAYOUT, M_WAITOK); - else - flp = malloc(sizeof(*flp), - M_NFSFLAYOUT, M_WAITOK); - flp->nfsfl_flags = 0; - flp->nfsfl_fhcnt = 0; - flp->nfsfl_devp = NULL; - flp->nfsfl_off = fxdr_hyper(tl); tl += 2; - retlen = fxdr_hyper(tl); tl += 2; - if (flp->nfsfl_off + retlen < flp->nfsfl_off) - flp->nfsfl_end = UINT64_MAX - flp->nfsfl_off; - else - flp->nfsfl_end = flp->nfsfl_off + retlen; - flp->nfsfl_iomode = fxdr_unsigned(int, *tl++); - if (gotiomode == -1) - gotiomode = flp->nfsfl_iomode; - NFSCL_DEBUG(4, "layg reqiom=%d retiom=%d\n", iomode, - (int)flp->nfsfl_iomode); - if (fxdr_unsigned(int, *tl++) != - NFSLAYOUT_NFSV4_1_FILES) { - printf("NFSv4.1: got non-files layout\n"); - error = NFSERR_BADXDR; - goto nfsmout; - } - NFSBCOPY(++tl, flp->nfsfl_dev, NFSX_V4DEVICEID); - tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); - flp->nfsfl_util = fxdr_unsigned(uint32_t, *tl++); - NFSCL_DEBUG(4, "flutil=0x%x\n", flp->nfsfl_util); - flp->nfsfl_stripe1 = fxdr_unsigned(uint32_t, *tl++); - flp->nfsfl_patoff = fxdr_hyper(tl); tl += 2; - if (fxdr_unsigned(int, *tl) != fhcnt) { - printf("EEK! bad fhcnt\n"); - error = NFSERR_BADXDR; - goto nfsmout; - } - for (j = 0; j < fhcnt; j++) { - NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); - nfhlen = fxdr_unsigned(int, *tl); - if (nfhlen <= 0 || nfhlen > NFSX_V4FHMAX) { - error = NFSERR_BADXDR; - goto nfsmout; - } - nfhp = malloc(sizeof(*nfhp) + nfhlen - 1, - M_NFSFH, M_WAITOK); - flp->nfsfl_fh[j] = nfhp; - flp->nfsfl_fhcnt++; - nfhp->nfh_len = nfhlen; - NFSM_DISSECT(cp, uint8_t *, NFSM_RNDUP(nfhlen)); - NFSBCOPY(cp, nfhp->nfh_fh, nfhlen); - } - if (flp->nfsfl_iomode == gotiomode) { - /* Keep the list in increasing offset order. */ - tflp = LIST_FIRST(flhp); - prevflp = NULL; - while (tflp != NULL && - tflp->nfsfl_off < flp->nfsfl_off) { - prevflp = tflp; - tflp = LIST_NEXT(tflp, nfsfl_list); - } - if (prevflp == NULL) - LIST_INSERT_HEAD(flhp, flp, nfsfl_list); - else - LIST_INSERT_AFTER(prevflp, flp, - nfsfl_list); - } else { - printf("nfscl_layoutget(): got wrong iomode\n"); - nfscl_freeflayout(flp); - } - flp = NULL; - } - } - if (nd->nd_repstat != 0 && error == 0) + if (nd->nd_repstat == 0) + error = nfsrv_parselayoutget(nd, stateidp, retonclosep, flhp); + if (error == 0 && nd->nd_repstat != 0) error = nd->nd_repstat; -nfsmout: - if (error != 0 && flp != NULL) - nfscl_freeflayout(flp); mbuf_freem(nd->nd_mrep); return (error); } @@ -5228,8 +5146,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, str struct nfscllayout **lypp, struct ucred *cred, NFSPROC_T *p) { struct nfscllayout *lyp; - struct nfsclflayout *flp, *tflp; - struct nfscldevinfo *dip; + struct nfsclflayout *flp; struct nfsclflayouthead flh; int error = 0, islocked, layoutlen, recalled, retonclose; nfsv4stateid_t stateid; @@ -5271,35 +5188,13 @@ nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, str (uint64_t)0, layoutlen, &stateid, &retonclose, &flh, cred, p, NULL); } + error = nfsrpc_layoutgetres(nmp, vp, nfhp->nfh_fh, + nfhp->nfh_len, &stateid, retonclose, notifybitsp, &lyp, + &flh, error, NULL, cred, p); if (error == 0) - LIST_FOREACH(tflp, &flh, nfsfl_list) { - error = nfscl_adddevinfo(nmp, NULL, tflp); - if (error != 0) { - error = nfsrpc_getdeviceinfo(nmp, - tflp->nfsfl_dev, - NFSLAYOUT_NFSV4_1_FILES, - notifybitsp, &dip, cred, p); - if (error != 0) - break; - error = nfscl_adddevinfo(nmp, dip, - tflp); - if (error != 0) - printf( - "getlayout: cannot add\n"); - } - } - if (error == 0) { - /* - * nfscl_layout() always returns with the nfsly_lock - * set to a refcnt (shared lock). - */ - error = nfscl_layout(nmp, vp, nfhp->nfh_fh, - nfhp->nfh_len, &stateid, retonclose, &flh, &lyp, - cred, p); - if (error == 0) - *lypp = lyp; - } else if (islocked != 0) - nfsv4_unlock(&lyp->nfsly_lock, 0); + *lypp = lyp; + else if (islocked != 0) + nfscl_rellayout(lyp, 1); } else *lypp = lyp; return (error); @@ -6021,4 +5916,756 @@ nfsmout: return (error); } #endif + +/* + * Set up the XDR arguments for the LayoutGet operation. + */ +static void +nfsrv_setuplayoutget(struct nfsrv_descript *nd, int iomode, uint64_t offset, + uint64_t len, uint64_t minlen, nfsv4stateid_t *stateidp, int layoutlen, + int usecurstateid) +{ + uint32_t *tl; + + NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER + + NFSX_STATEID); + *tl++ = newnfs_false; /* Don't signal availability. */ + *tl++ = txdr_unsigned(NFSLAYOUT_NFSV4_1_FILES); + *tl++ = txdr_unsigned(iomode); + txdr_hyper(offset, tl); + tl += 2; + txdr_hyper(len, tl); + tl += 2; + txdr_hyper(minlen, tl); + tl += 2; + if (usecurstateid != 0) { + /* Special stateid for Current stateid. */ + *tl++ = txdr_unsigned(1); + *tl++ = 0; + *tl++ = 0; + *tl++ = 0; + } else { + *tl++ = txdr_unsigned(stateidp->seqid); + NFSCL_DEBUG(4, "layget seq=%d\n", (int)stateidp->seqid); + *tl++ = stateidp->other[0]; + *tl++ = stateidp->other[1]; + *tl++ = stateidp->other[2]; + } + *tl = txdr_unsigned(layoutlen); +} + +/* + * Parse the reply for a successful LayoutGet operation. + */ +static int +nfsrv_parselayoutget(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp, + int *retonclosep, struct nfsclflayouthead *flhp) +{ + uint32_t *tl; + struct nfsclflayout *flp, *prevflp, *tflp; + int cnt, error, gotiomode, fhcnt, nfhlen, i, j; + uint64_t retlen; + struct nfsfh *nfhp; + uint8_t *cp; + + error = 0; + flp = NULL; + gotiomode = -1; + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED + NFSX_STATEID); + if (*tl++ != 0) + *retonclosep = 1; + else + *retonclosep = 0; + stateidp->seqid = fxdr_unsigned(uint32_t, *tl++); + NFSCL_DEBUG(4, "retoncls=%d stseq=%d\n", *retonclosep, + (int)stateidp->seqid); + stateidp->other[0] = *tl++; + stateidp->other[1] = *tl++; + stateidp->other[2] = *tl++; + cnt = fxdr_unsigned(int, *tl); + NFSCL_DEBUG(4, "layg cnt=%d\n", cnt); + if (cnt <= 0 || cnt > 10000) { + /* Don't accept more than 10000 layouts in reply. */ + error = NFSERR_BADXDR; + goto nfsmout; + } + for (i = 0; i < cnt; i++) { + /* Dissect all the way to the file handle cnt. */ + NFSM_DISSECT(tl, uint32_t *, 3 * NFSX_HYPER + + 6 * NFSX_UNSIGNED + NFSX_V4DEVICEID); + fhcnt = fxdr_unsigned(int, *(tl + 11 + + NFSX_V4DEVICEID / NFSX_UNSIGNED)); + NFSCL_DEBUG(4, "fhcnt=%d\n", fhcnt); + if (fhcnt < 0 || fhcnt > 100) { + /* Don't accept more than 100 file handles. */ + error = NFSERR_BADXDR; + goto nfsmout; + } + if (fhcnt > 1) + flp = malloc(sizeof(*flp) + (fhcnt - 1) * + sizeof(struct nfsfh *), M_NFSFLAYOUT, M_WAITOK); + else + flp = malloc(sizeof(*flp), M_NFSFLAYOUT, M_WAITOK); + flp->nfsfl_flags = 0; + flp->nfsfl_fhcnt = 0; + flp->nfsfl_devp = NULL; + flp->nfsfl_off = fxdr_hyper(tl); tl += 2; + retlen = fxdr_hyper(tl); tl += 2; + if (flp->nfsfl_off + retlen < flp->nfsfl_off) + flp->nfsfl_end = UINT64_MAX - flp->nfsfl_off; + else + flp->nfsfl_end = flp->nfsfl_off + retlen; + flp->nfsfl_iomode = fxdr_unsigned(int, *tl++); + if (gotiomode == -1) + gotiomode = flp->nfsfl_iomode; + if (fxdr_unsigned(int, *tl++) != NFSLAYOUT_NFSV4_1_FILES) { + printf("NFSv4.1: got non-files layout\n"); + error = NFSERR_BADXDR; + goto nfsmout; + } + NFSBCOPY(++tl, flp->nfsfl_dev, NFSX_V4DEVICEID); + tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); + flp->nfsfl_util = fxdr_unsigned(uint32_t, *tl++); + NFSCL_DEBUG(4, "flutil=0x%x\n", flp->nfsfl_util); + flp->nfsfl_stripe1 = fxdr_unsigned(uint32_t, *tl++); + flp->nfsfl_patoff = fxdr_hyper(tl); tl += 2; + if (fxdr_unsigned(int, *tl) != fhcnt) { + printf("EEK! bad fhcnt\n"); + error = NFSERR_BADXDR; + goto nfsmout; + } + for (j = 0; j < fhcnt; j++) { + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + nfhlen = fxdr_unsigned(int, *tl); + if (nfhlen <= 0 || nfhlen > NFSX_V4FHMAX) { + error = NFSERR_BADXDR; + goto nfsmout; + } + nfhp = malloc(sizeof(*nfhp) + nfhlen - 1, M_NFSFH, + M_WAITOK); + flp->nfsfl_fh[j] = nfhp; + flp->nfsfl_fhcnt++; + nfhp->nfh_len = nfhlen; + NFSM_DISSECT(cp, uint8_t *, NFSM_RNDUP(nfhlen)); + NFSBCOPY(cp, nfhp->nfh_fh, nfhlen); + } + if (flp->nfsfl_iomode == gotiomode) { + /* Keep the list in increasing offset order. */ + tflp = LIST_FIRST(flhp); + prevflp = NULL; + while (tflp != NULL && + tflp->nfsfl_off < flp->nfsfl_off) { + prevflp = tflp; + tflp = LIST_NEXT(tflp, nfsfl_list); + } + if (prevflp == NULL) + LIST_INSERT_HEAD(flhp, flp, nfsfl_list); + else + LIST_INSERT_AFTER(prevflp, flp, + nfsfl_list); + } else { + printf("nfscl_layoutget(): got wrong iomode\n"); + nfscl_freeflayout(flp); + } + flp = NULL; + } +nfsmout: + if (error != 0 && flp != NULL) + nfscl_freeflayout(flp); + return (error); +} + +/* + * Similar to nfsrpc_getlayout(), except that it uses nfsrpc_openlayget(), + * so that it does both an Open and a Layoutget. + */ +static int +nfsrpc_getopenlayout(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, + int fhlen, uint8_t *newfhp, int newfhlen, uint32_t mode, + struct nfsclopen *op, uint8_t *name, int namelen, struct nfscldeleg **dpp, + struct ucred *cred, NFSPROC_T *p) +{ + struct nfscllayout *lyp; + struct nfsclflayout *flp; + struct nfsclflayouthead flh; + int error, islocked, layoutlen, recalled, retonclose, usecurstateid; + int laystat; + nfsv4stateid_t stateid; + struct nfsclsession *tsep; + + error = 0; + /* + * If lyp is returned non-NULL, there will be a refcnt (shared lock) + * on it, iff flp != NULL or a lock (exclusive lock) on it iff + * flp == NULL. + */ + lyp = nfscl_getlayout(nmp->nm_clp, newfhp, newfhlen, 0, &flp, + &recalled); + NFSCL_DEBUG(4, "nfsrpc_getopenlayout nfscl_getlayout lyp=%p\n", lyp); + if (lyp == NULL) + islocked = 0; + else if (flp != NULL) + islocked = 1; + else + islocked = 2; + if ((lyp == NULL || flp == NULL) && recalled == 0) { + LIST_INIT(&flh); + tsep = nfsmnt_mdssession(nmp); + layoutlen = tsep->nfsess_maxcache - (NFSX_STATEID + + 3 * NFSX_UNSIGNED); + if (lyp == NULL) + usecurstateid = 1; + else { + usecurstateid = 0; + stateid.seqid = lyp->nfsly_stateid.seqid; + stateid.other[0] = lyp->nfsly_stateid.other[0]; + stateid.other[1] = lyp->nfsly_stateid.other[1]; + stateid.other[2] = lyp->nfsly_stateid.other[2]; + } + error = nfsrpc_openlayoutrpc(nmp, vp, nfhp, fhlen, + newfhp, newfhlen, mode, op, name, namelen, + dpp, &stateid, usecurstateid, layoutlen, + &retonclose, &flh, &laystat, cred, p); + NFSCL_DEBUG(4, "aft nfsrpc_openlayoutrpc laystat=%d err=%d\n", + laystat, error); + laystat = nfsrpc_layoutgetres(nmp, vp, newfhp, newfhlen, + &stateid, retonclose, NULL, &lyp, &flh, laystat, &islocked, + cred, p); + } else + error = nfsrpc_openrpc(nmp, vp, nfhp, fhlen, newfhp, newfhlen, + mode, op, name, namelen, dpp, 0, 0, cred, p, 0, 0); + if (islocked == 2) + nfscl_rellayout(lyp, 1); + else if (islocked == 1) + nfscl_rellayout(lyp, 0); + return (error); +} + +/* + * This function does an Open+LayoutGet for an NFSv4.1 mount with pNFS + * enabled, only for the CLAIM_NULL case. All other NFSv4 Opens are + * handled by nfsrpc_openrpc(). + * For the case where op == NULL, dvp is the directory. When op != NULL, it + * can be NULL. + */ +static int +nfsrpc_openlayoutrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, + int fhlen, uint8_t *newfhp, int newfhlen, uint32_t mode, + struct nfsclopen *op, uint8_t *name, int namelen, struct nfscldeleg **dpp, + nfsv4stateid_t *stateidp, int usecurstateid, + int layoutlen, int *retonclosep, struct nfsclflayouthead *flhp, + int *laystatp, struct ucred *cred, NFSPROC_T *p) +{ + uint32_t *tl; + struct nfsrv_descript nfsd, *nd = &nfsd; + struct nfscldeleg *ndp = NULL; + struct nfsvattr nfsva; + struct nfsclsession *tsep; + uint32_t rflags, deleg; + nfsattrbit_t attrbits; + int error, ret, acesize, limitby, iomode; + + *dpp = NULL; + *laystatp = ENXIO; + nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL); + NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); + *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); + *tl++ = txdr_unsigned((mode >> NFSLCK_SHIFT) & NFSV4OPEN_DENYBOTH); + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; + nfsm_strtom(nd, op->nfso_own->nfsow_owner, NFSV4CL_LOCKNAMELEN); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(NFSV4OPEN_NOCREATE); + *tl = txdr_unsigned(NFSV4OPEN_CLAIMNULL); + nfsm_strtom(nd, name, namelen); + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + NFSZERO_ATTRBIT(&attrbits); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + nfsrv_putattrbit(nd, &attrbits); + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_LAYOUTGET); + if ((mode & NFSV4OPEN_ACCESSWRITE) != 0) + iomode = NFSLAYOUTIOMODE_RW; + else + iomode = NFSLAYOUTIOMODE_READ; + nfsrv_setuplayoutget(nd, iomode, 0, UINT64_MAX, 0, stateidp, + layoutlen, usecurstateid); + error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, vp, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + if (error != 0) + return (error); + NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd); + if (nd->nd_repstat != 0) + *laystatp = nd->nd_repstat; + if ((nd->nd_flag & ND_NOMOREDATA) == 0) { + /* ND_NOMOREDATA will be set if the Open operation failed. */ + NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + + 6 * NFSX_UNSIGNED); + op->nfso_stateid.seqid = *tl++; + op->nfso_stateid.other[0] = *tl++; + op->nfso_stateid.other[1] = *tl++; + op->nfso_stateid.other[2] = *tl; + rflags = fxdr_unsigned(u_int32_t, *(tl + 6)); + error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); + if (error != 0) + goto nfsmout; + NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); + deleg = fxdr_unsigned(u_int32_t, *tl); + if (deleg == NFSV4OPEN_DELEGATEREAD || + deleg == NFSV4OPEN_DELEGATEWRITE) { + if (!(op->nfso_own->nfsow_clp->nfsc_flags & + NFSCLFLAGS_FIRSTDELEG)) + op->nfso_own->nfsow_clp->nfsc_flags |= + (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG); + ndp = malloc(sizeof(struct nfscldeleg) + newfhlen, + M_NFSCLDELEG, M_WAITOK); + LIST_INIT(&ndp->nfsdl_owner); + LIST_INIT(&ndp->nfsdl_lock); + ndp->nfsdl_clp = op->nfso_own->nfsow_clp; + ndp->nfsdl_fhlen = newfhlen; + NFSBCOPY(newfhp, ndp->nfsdl_fh, newfhlen); + newnfs_copyincred(cred, &ndp->nfsdl_cred); + nfscl_lockinit(&ndp->nfsdl_rwlock); + NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + + NFSX_UNSIGNED); + ndp->nfsdl_stateid.seqid = *tl++; + ndp->nfsdl_stateid.other[0] = *tl++; + ndp->nfsdl_stateid.other[1] = *tl++; + ndp->nfsdl_stateid.other[2] = *tl++; + ret = fxdr_unsigned(int, *tl); + if (deleg == NFSV4OPEN_DELEGATEWRITE) { + ndp->nfsdl_flags = NFSCLDL_WRITE; + /* + * Indicates how much the file can grow. + */ + NFSM_DISSECT(tl, u_int32_t *, + 3 * NFSX_UNSIGNED); + limitby = fxdr_unsigned(int, *tl++); + switch (limitby) { + case NFSV4OPEN_LIMITSIZE: + ndp->nfsdl_sizelimit = fxdr_hyper(tl); + break; + case NFSV4OPEN_LIMITBLOCKS: + ndp->nfsdl_sizelimit = + fxdr_unsigned(u_int64_t, *tl++); + ndp->nfsdl_sizelimit *= + fxdr_unsigned(u_int64_t, *tl); + break; + default: + error = NFSERR_BADXDR; + goto nfsmout; + }; + } else + ndp->nfsdl_flags = NFSCLDL_READ; + if (ret != 0) + ndp->nfsdl_flags |= NFSCLDL_RECALL; + error = nfsrv_dissectace(nd, &ndp->nfsdl_ace, &ret, + &acesize, p); + if (error != 0) + goto nfsmout; + } else if (deleg != NFSV4OPEN_DELEGATENONE) { + error = NFSERR_BADXDR; + goto nfsmout; + } + if ((rflags & NFSV4OPEN_LOCKTYPEPOSIX) != 0 || + nfscl_assumeposixlocks) + op->nfso_posixlock = 1; + else + op->nfso_posixlock = 0; + NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + /* If the 2nd element == NFS_OK, the Getattr succeeded. */ + if (*++tl == 0) { + error = nfsv4_loadattr(nd, NULL, &nfsva, NULL, + NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, + NULL, NULL, NULL, p, cred); + if (error != 0) + goto nfsmout; + if (ndp != NULL) { + ndp->nfsdl_change = nfsva.na_filerev; + ndp->nfsdl_modtime = nfsva.na_mtime; + ndp->nfsdl_flags |= NFSCLDL_MODTIMESET; + *dpp = ndp; + ndp = NULL; + } + /* + * At this point, the Open has succeeded, so set + * nd_repstat = NFS_OK. If the Layoutget failed, + * this function just won't return a layout. + */ + if (nd->nd_repstat == 0) { + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *laystatp = fxdr_unsigned(int, *++tl); + if (*laystatp == 0) { + error = nfsrv_parselayoutget(nd, + stateidp, retonclosep, flhp); + if (error != 0) + *laystatp = error; + } + } else + nd->nd_repstat = 0; /* Return 0 for Open. */ + } + } + if (nd->nd_repstat != 0 && error == 0) + error = nd->nd_repstat; +nfsmout: + free(ndp, M_NFSCLDELEG); + mbuf_freem(nd->nd_mrep); + return (error); +} + +/* + * Similar nfsrpc_createv4(), but also does the LayoutGet operation. + * Used only for mounts with pNFS enabled. + */ +static int +nfsrpc_createlayout(vnode_t dvp, char *name, int namelen, struct vattr *vap, + nfsquad_t cverf, int fmode, struct nfsclowner *owp, struct nfscldeleg **dpp, + struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap, + struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp, + int *dattrflagp, void *dstuff, int *unlockedp, nfsv4stateid_t *stateidp, + int usecurstateid, int layoutlen, int *retonclosep, + struct nfsclflayouthead *flhp, int *laystatp) +{ + uint32_t *tl; + int error = 0, deleg, newone, ret, acesize, limitby; + struct nfsrv_descript nfsd, *nd = &nfsd; + struct nfsclopen *op; + struct nfscldeleg *dp = NULL; + struct nfsnode *np; + struct nfsfh *nfhp; + struct nfsclsession *tsep; + nfsattrbit_t attrbits; + nfsv4stateid_t stateid; + uint32_t rflags; + struct nfsmount *nmp; + + nmp = VFSTONFS(dvp->v_mount); + np = VTONFS(dvp); + *laystatp = ENXIO; + *unlockedp = 0; + *nfhpp = NULL; + *dpp = NULL; + *attrflagp = 0; + *dattrflagp = 0; + if (namelen > NFS_MAXNAMLEN) + return (ENAMETOOLONG); + NFSCL_REQSTART(nd, NFSPROC_CREATELAYGET, dvp); + /* + * For V4, this is actually an Open op. + */ + NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(owp->nfsow_seqid); + *tl++ = txdr_unsigned(NFSV4OPEN_ACCESSWRITE | + NFSV4OPEN_ACCESSREAD); + *tl++ = txdr_unsigned(NFSV4OPEN_DENYNONE); + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; + nfsm_strtom(nd, owp->nfsow_owner, NFSV4CL_LOCKNAMELEN); + NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(NFSV4OPEN_CREATE); + if ((fmode & O_EXCL) != 0) { + if (NFSHASSESSPERSIST(nmp)) { + /* Use GUARDED for persistent sessions. */ + *tl = txdr_unsigned(NFSCREATE_GUARDED); + nfscl_fillsattr(nd, vap, dvp, 0, 0); + } else { + /* Otherwise, use EXCLUSIVE4_1. */ + *tl = txdr_unsigned(NFSCREATE_EXCLUSIVE41); + NFSM_BUILD(tl, u_int32_t *, NFSX_VERF); + *tl++ = cverf.lval[0]; + *tl = cverf.lval[1]; + nfscl_fillsattr(nd, vap, dvp, 0, 0); + } + } else { + *tl = txdr_unsigned(NFSCREATE_UNCHECKED); + nfscl_fillsattr(nd, vap, dvp, 0, 0); + } + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OPEN_CLAIMNULL); + nfsm_strtom(nd, name, namelen); + /* Get the new file's handle and attributes, plus save the FH. */ + NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(NFSV4OP_SAVEFH); + *tl++ = txdr_unsigned(NFSV4OP_GETFH); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + NFSGETATTR_ATTRBIT(&attrbits); + nfsrv_putattrbit(nd, &attrbits); + /* Get the directory's post-op attributes. */ + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_PUTFH); + nfsm_fhtom(nd, np->n_fhp->nfh_fh, np->n_fhp->nfh_len, 0); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + nfsrv_putattrbit(nd, &attrbits); + NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(NFSV4OP_RESTOREFH); + *tl = txdr_unsigned(NFSV4OP_LAYOUTGET); + nfsrv_setuplayoutget(nd, NFSLAYOUTIOMODE_RW, 0, UINT64_MAX, 0, stateidp, + layoutlen, usecurstateid); + error = nfscl_request(nd, dvp, p, cred, dstuff); + if (error != 0) + return (error); + NFSCL_DEBUG(4, "nfsrpc_createlayout stat=%d err=%d\n", nd->nd_repstat, + error); + if (nd->nd_repstat != 0) + *laystatp = nd->nd_repstat; + NFSCL_INCRSEQID(owp->nfsow_seqid, nd); + if ((nd->nd_flag & ND_NOMOREDATA) == 0) { + NFSCL_DEBUG(4, "nfsrpc_createlayout open succeeded\n"); + NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + + 6 * NFSX_UNSIGNED); + stateid.seqid = *tl++; + stateid.other[0] = *tl++; + stateid.other[1] = *tl++; + stateid.other[2] = *tl; + rflags = fxdr_unsigned(u_int32_t, *(tl + 6)); + nfsrv_getattrbits(nd, &attrbits, NULL, NULL); + NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); + deleg = fxdr_unsigned(int, *tl); + if (deleg == NFSV4OPEN_DELEGATEREAD || + deleg == NFSV4OPEN_DELEGATEWRITE) { + if (!(owp->nfsow_clp->nfsc_flags & + NFSCLFLAGS_FIRSTDELEG)) + owp->nfsow_clp->nfsc_flags |= + (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG); + dp = malloc(sizeof(struct nfscldeleg) + NFSX_V4FHMAX, + M_NFSCLDELEG, M_WAITOK); + LIST_INIT(&dp->nfsdl_owner); + LIST_INIT(&dp->nfsdl_lock); + dp->nfsdl_clp = owp->nfsow_clp; + newnfs_copyincred(cred, &dp->nfsdl_cred); + nfscl_lockinit(&dp->nfsdl_rwlock); + NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + + NFSX_UNSIGNED); + dp->nfsdl_stateid.seqid = *tl++; + dp->nfsdl_stateid.other[0] = *tl++; + dp->nfsdl_stateid.other[1] = *tl++; + dp->nfsdl_stateid.other[2] = *tl++; + ret = fxdr_unsigned(int, *tl); + if (deleg == NFSV4OPEN_DELEGATEWRITE) { + dp->nfsdl_flags = NFSCLDL_WRITE; + /* + * Indicates how much the file can grow. + */ + NFSM_DISSECT(tl, u_int32_t *, + 3 * NFSX_UNSIGNED); + limitby = fxdr_unsigned(int, *tl++); + switch (limitby) { + case NFSV4OPEN_LIMITSIZE: + dp->nfsdl_sizelimit = fxdr_hyper(tl); + break; + case NFSV4OPEN_LIMITBLOCKS: + dp->nfsdl_sizelimit = + fxdr_unsigned(u_int64_t, *tl++); + dp->nfsdl_sizelimit *= + fxdr_unsigned(u_int64_t, *tl); + break; + default: + error = NFSERR_BADXDR; + goto nfsmout; + }; + } else { + dp->nfsdl_flags = NFSCLDL_READ; + } + if (ret != 0) + dp->nfsdl_flags |= NFSCLDL_RECALL; + error = nfsrv_dissectace(nd, &dp->nfsdl_ace, &ret, + &acesize, p); + if (error != 0) + goto nfsmout; + } else if (deleg != NFSV4OPEN_DELEGATENONE) { + error = NFSERR_BADXDR; + goto nfsmout; + } + + /* Now, we should have the status for the SaveFH. */ + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + if (*++tl == 0) { + NFSCL_DEBUG(4, "nfsrpc_createlayout SaveFH ok\n"); + /* + * Now, process the GetFH and Getattr for the newly + * created file. nfscl_mtofh() will set + * ND_NOMOREDATA if these weren't successful. + */ + error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp); + NFSCL_DEBUG(4, "aft nfscl_mtofh err=%d\n", error); + if (error != 0) + goto nfsmout; + } else + nd->nd_flag |= ND_NOMOREDATA; + /* Now we have the PutFH and Getattr for the directory. */ + if ((nd->nd_flag & ND_NOMOREDATA) == 0) { + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + if (*++tl != 0) + nd->nd_flag |= ND_NOMOREDATA; + else { + NFSM_DISSECT(tl, uint32_t *, 2 * + NFSX_UNSIGNED); + if (*++tl != 0) + nd->nd_flag |= ND_NOMOREDATA; + } + } + if ((nd->nd_flag & ND_NOMOREDATA) == 0) { + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + NFSCL_DEBUG(4, "aft nfsm_loadattr err=%d\n", error); + if (error != 0) + goto nfsmout; + *dattrflagp = 1; + if (dp != NULL && *attrflagp != 0) { + dp->nfsdl_change = nnap->na_filerev; + dp->nfsdl_modtime = nnap->na_mtime; + dp->nfsdl_flags |= NFSCLDL_MODTIMESET; + } + /* + * We can now complete the Open state. + */ + nfhp = *nfhpp; + if (dp != NULL) { + dp->nfsdl_fhlen = nfhp->nfh_len; + NFSBCOPY(nfhp->nfh_fh, dp->nfsdl_fh, + nfhp->nfh_len); + } + /* + * Get an Open structure that will be + * attached to the OpenOwner, acquired already. + */ + error = nfscl_open(dvp, nfhp->nfh_fh, nfhp->nfh_len, + (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), 0, + cred, p, NULL, &op, &newone, NULL, 0); + if (error != 0) + goto nfsmout; + op->nfso_stateid = stateid; + newnfs_copyincred(cred, &op->nfso_cred); + + nfscl_openrelease(nmp, op, error, newone); + *unlockedp = 1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Jul 14 21:43:58 2017 Return-Path: Delivered-To: svn-src-stable@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 82A4DDAD022; Fri, 14 Jul 2017 21:43:58 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F7AC779F2; Fri, 14 Jul 2017 21:43:58 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6ELhvtP095053; Fri, 14 Jul 2017 21:43:57 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6ELhv6p095052; Fri, 14 Jul 2017 21:43:57 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707142143.v6ELhv6p095052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 14 Jul 2017 21:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321000 - stable/11/usr.bin/nfsstat X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/usr.bin/nfsstat X-SVN-Commit-Revision: 321000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 21:43:58 -0000 Author: rmacklem Date: Fri Jul 14 21:43:57 2017 New Revision: 321000 URL: https://svnweb.freebsd.org/changeset/base/321000 Log: MFC: r320323 Add RPC count reporting for the two new RPCs added by r320322. Modified: stable/11/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/nfsstat/nfsstat.c ============================================================================== --- stable/11/usr.bin/nfsstat/nfsstat.c Fri Jul 14 21:13:05 2017 (r320999) +++ stable/11/usr.bin/nfsstat/nfsstat.c Fri Jul 14 21:43:57 2017 (r321000) @@ -926,6 +926,13 @@ exp41_intpr(int clientOnly, int serverOnly) (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_COMMITDS]); if (printtitle) printf( + "%12.12s %12.12s\n", + "OpenLayout", "CreateLayout"); + printf("%12ju %12ju\n", + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_OPENLAYGET], + (uintmax_t)ext_nfsstats.rpccnt[NFSPROC_CREATELAYGET]); + if (printtitle) + printf( "%12.12s %12.12s %12.12s %12.12s %12.12s %12.12s\n", "OpenOwner", "Opens", "LockOwner", "Locks", "Delegs", "LocalOwn"); From owner-svn-src-stable@freebsd.org Sat Jul 15 06:33:41 2017 Return-Path: Delivered-To: svn-src-stable@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 5B4BDDB7989; Sat, 15 Jul 2017 06:33:41 +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 2905B65F82; Sat, 15 Jul 2017 06:33:41 +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 v6F6XecP013034; Sat, 15 Jul 2017 06:33:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F6XeB0013033; Sat, 15 Jul 2017 06:33:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707150633.v6F6XeB0013033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 15 Jul 2017 06:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321004 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/i386/i386 X-SVN-Commit-Revision: 321004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 06:33:41 -0000 Author: kib Date: Sat Jul 15 06:33:39 2017 New Revision: 321004 URL: https://svnweb.freebsd.org/changeset/base/321004 Log: MFC r320804: Fix handling of one more possible exception on return to usermode. Modified: stable/11/sys/i386/i386/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Sat Jul 15 01:49:54 2017 (r321003) +++ stable/11/sys/i386/i386/trap.c Sat Jul 15 06:33:39 2017 (r321004) @@ -550,11 +550,7 @@ user_trctrap_out: vm86_trap((struct vm86frame *)frame); goto out; } - if (type == T_STKFLT) - break; - /* FALL THROUGH */ - case T_SEGNPFLT: /* segment not present fault */ if (curpcb->pcb_flags & PCB_VM86CALL) break; @@ -595,6 +591,9 @@ user_trctrap_out: frame->tf_eip = (int)doreti_iret_fault; goto out; } + if (type == T_STKFLT) + break; + if (frame->tf_eip == (int)doreti_popl_ds) { frame->tf_eip = (int)doreti_popl_ds_fault; goto out; From owner-svn-src-stable@freebsd.org Sat Jul 15 06:38:02 2017 Return-Path: Delivered-To: svn-src-stable@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 E52C6DB7AC9; Sat, 15 Jul 2017 06:38:02 +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 ADEF566108; Sat, 15 Jul 2017 06:38:02 +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 v6F6c1iW013234; Sat, 15 Jul 2017 06:38:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F6c1EA013233; Sat, 15 Jul 2017 06:38:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707150638.v6F6c1EA013233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 15 Jul 2017 06:38: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: r321005 - stable/10/sys/i386/i386 X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/i386/i386 X-SVN-Commit-Revision: 321005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 06:38:03 -0000 Author: kib Date: Sat Jul 15 06:38:01 2017 New Revision: 321005 URL: https://svnweb.freebsd.org/changeset/base/321005 Log: MFC r320804: Fix handling of one more possible exception on return to usermode. Modified: stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Sat Jul 15 06:33:39 2017 (r321004) +++ stable/10/sys/i386/i386/trap.c Sat Jul 15 06:38:01 2017 (r321005) @@ -567,11 +567,7 @@ trap(struct trapframe *frame) vm86_trap((struct vm86frame *)frame); goto out; } - if (type == T_STKFLT) - break; - /* FALL THROUGH */ - case T_SEGNPFLT: /* segment not present fault */ if (curpcb->pcb_flags & PCB_VM86CALL) break; @@ -612,6 +608,9 @@ trap(struct trapframe *frame) frame->tf_eip = (int)doreti_iret_fault; goto out; } + if (type == T_STKFLT) + break; + if (frame->tf_eip == (int)doreti_popl_ds) { frame->tf_eip = (int)doreti_popl_ds_fault; goto out; From owner-svn-src-stable@freebsd.org Sat Jul 15 08:24:31 2017 Return-Path: Delivered-To: svn-src-stable@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 4CB87DBD38F; Sat, 15 Jul 2017 08:24:31 +0000 (UTC) (envelope-from dchagin@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 1985768B89; Sat, 15 Jul 2017 08:24:31 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6F8OUG6028423; Sat, 15 Jul 2017 08:24:30 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F8OUXq028422; Sat, 15 Jul 2017 08:24:30 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707150824.v6F8OUXq028422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 08:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321006 - stable/11/sys/amd64/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/amd64/linux X-SVN-Commit-Revision: 321006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 08:24:31 -0000 Author: dchagin Date: Sat Jul 15 08:24:29 2017 New Revision: 321006 URL: https://svnweb.freebsd.org/changeset/base/321006 Log: MFC r319057: In r246085 some bits that are MI movied out into headers in compat/linux, but I missed that when I commited x86_64 Linuxulator. So remove the duplicates. Modified: stable/11/sys/amd64/linux/linux.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux.h ============================================================================== --- stable/11/sys/amd64/linux/linux.h Sat Jul 15 06:38:01 2017 (r321005) +++ stable/11/sys/amd64/linux/linux.h Sat Jul 15 08:24:29 2017 (r321006) @@ -101,9 +101,6 @@ typedef struct { /* * Miscellaneous */ -#define LINUX_NAME_MAX 255 -#define LINUX_CTL_MAXNAME 10 - #define LINUX_AT_COUNT 19 /* Count of used aux entry types. */ struct l___sysctl_args @@ -117,11 +114,6 @@ struct l___sysctl_args l_ulong __spare[4]; }; -/* Scheduling policies */ -#define LINUX_SCHED_OTHER 0 -#define LINUX_SCHED_FIFO 1 -#define LINUX_SCHED_RR 2 - /* Resource limits */ #define LINUX_RLIMIT_CPU 0 #define LINUX_RLIMIT_FSIZE 1 @@ -455,20 +447,6 @@ struct l_pollfd { l_short events; l_short revents; }; - - -#define LINUX_CLONE_VM 0x00000100 -#define LINUX_CLONE_FS 0x00000200 -#define LINUX_CLONE_FILES 0x00000400 -#define LINUX_CLONE_SIGHAND 0x00000800 -#define LINUX_CLONE_PID 0x00001000 /* No longer exist in Linux */ -#define LINUX_CLONE_VFORK 0x00004000 -#define LINUX_CLONE_PARENT 0x00008000 -#define LINUX_CLONE_THREAD 0x00010000 -#define LINUX_CLONE_SETTLS 0x00080000 -#define LINUX_CLONE_PARENT_SETTID 0x00100000 -#define LINUX_CLONE_CHILD_CLEARTID 0x00200000 -#define LINUX_CLONE_CHILD_SETTID 0x01000000 #define LINUX_ARCH_SET_GS 0x1001 #define LINUX_ARCH_SET_FS 0x1002 From owner-svn-src-stable@freebsd.org Sat Jul 15 08:27:24 2017 Return-Path: Delivered-To: svn-src-stable@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 A1F9FDBD43E; Sat, 15 Jul 2017 08:27:24 +0000 (UTC) (envelope-from dchagin@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 7D47C68CE6; Sat, 15 Jul 2017 08:27:24 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6F8RN9v028578; Sat, 15 Jul 2017 08:27:23 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6F8RN0M028575; Sat, 15 Jul 2017 08:27:23 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707150827.v6F8RN0M028575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 08:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321007 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/11/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 321007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 08:27:24 -0000 Author: dchagin Date: Sat Jul 15 08:27:23 2017 New Revision: 321007 URL: https://svnweb.freebsd.org/changeset/base/321007 Log: MFC r320595: Add support for musl consumers to the Linuxulator. PR: 213809 Submitted by: Yonas Yanfa (for amd64) Reported by: Yonas Yanfa Relnotes: yes Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux/linux_sysvec.c Sat Jul 15 08:24:29 2017 (r321006) +++ stable/11/sys/amd64/linux/linux_sysvec.c Sat Jul 15 08:27:23 2017 (r321007) @@ -921,9 +921,22 @@ static Elf64_Brandinfo linux_glibc2brandshort = { .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; +static Elf64_Brandinfo linux_muslbrand = { + .brand = ELFOSABI_LINUX, + .machine = EM_X86_64, + .compat_3_brand = "Linux", + .emul_path = "/compat/linux", + .interp_path = "/lib/ld-musl-x86_64.so.1", + .sysvec = &elf_linux_sysvec, + .interp_newpath = NULL, + .brand_note = &linux64_brandnote, + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE +}; + Elf64_Brandinfo *linux_brandlist[] = { &linux_glibc2brand, &linux_glibc2brandshort, + &linux_muslbrand, NULL }; Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_sysvec.c Sat Jul 15 08:24:29 2017 (r321006) +++ stable/11/sys/amd64/linux32/linux32_sysvec.c Sat Jul 15 08:27:23 2017 (r321007) @@ -1139,9 +1139,22 @@ static Elf32_Brandinfo linux_glibc2brand = { .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; +static Elf32_Brandinfo linux_muslbrand = { + .brand = ELFOSABI_LINUX, + .machine = EM_386, + .compat_3_brand = "Linux", + .emul_path = "/compat/linux", + .interp_path = "/lib/ld-musl-i386.so.1", + .sysvec = &elf_linux_sysvec, + .interp_newpath = NULL, + .brand_note = &linux32_brandnote, + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE +}; + Elf32_Brandinfo *linux_brandlist[] = { &linux_brand, &linux_glibc2brand, + &linux_muslbrand, NULL }; Modified: stable/11/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/i386/linux/linux_sysvec.c Sat Jul 15 08:24:29 2017 (r321006) +++ stable/11/sys/i386/linux/linux_sysvec.c Sat Jul 15 08:27:23 2017 (r321007) @@ -1118,9 +1118,22 @@ static Elf32_Brandinfo linux_glibc2brand = { .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; +static Elf32_Brandinfo linux_muslbrand = { + .brand = ELFOSABI_LINUX, + .machine = EM_386, + .compat_3_brand = "Linux", + .emul_path = "/compat/linux", + .interp_path = "/lib/ld-musl-i386.so.1", + .sysvec = &elf_linux_sysvec, + .interp_newpath = NULL, + .brand_note = &linux_brandnote, + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE +}; + Elf32_Brandinfo *linux_brandlist[] = { &linux_brand, &linux_glibc2brand, + &linux_muslbrand, NULL }; From owner-svn-src-stable@freebsd.org Sat Jul 15 14:48:33 2017 Return-Path: Delivered-To: svn-src-stable@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 05626AFBBC5; Sat, 15 Jul 2017 14:48:33 +0000 (UTC) (envelope-from dchagin@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 D248E72608; Sat, 15 Jul 2017 14:48:32 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FEmWn6096245; Sat, 15 Jul 2017 14:48:32 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FEmV7I096241; Sat, 15 Jul 2017 14:48:31 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151448.v6FEmV7I096241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 14:48: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: r321009 - in stable/10/sys: compat/linux kern sys X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: compat/linux kern sys X-SVN-Commit-Revision: 321009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 14:48:33 -0000 Author: dchagin Date: Sat Jul 15 14:48:31 2017 New Revision: 321009 URL: https://svnweb.freebsd.org/changeset/base/321009 Log: MFC r281829 (by trasz@): Modify kern___getcwd() to take max pathlen limit as an additional argument. This will be used for the Linux emulation layer - for Linux, PATH_MAX is 4096 and not 1024. Modified: stable/10/sys/compat/linux/linux_getcwd.c stable/10/sys/compat/linux/linux_misc.h stable/10/sys/kern/vfs_cache.c stable/10/sys/sys/syscallsubr.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_getcwd.c ============================================================================== --- stable/10/sys/compat/linux/linux_getcwd.c Sat Jul 15 09:04:23 2017 (r321008) +++ stable/10/sys/compat/linux/linux_getcwd.c Sat Jul 15 14:48:31 2017 (r321009) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#include #include #include @@ -423,14 +424,14 @@ linux_getcwd(struct thread *td, struct linux_getcwd_ar len = args->bufsize; - if (len > MAXPATHLEN*4) - len = MAXPATHLEN*4; + if (len > LINUX_PATH_MAX) + len = LINUX_PATH_MAX; else if (len < 2) return ERANGE; path = malloc(len, M_TEMP, M_WAITOK); - error = kern___getcwd(td, path, UIO_SYSSPACE, len); + error = kern___getcwd(td, path, UIO_SYSSPACE, len, LINUX_PATH_MAX); if (!error) { lenused = strlen(path) + 1; if (lenused <= args->bufsize) { Modified: stable/10/sys/compat/linux/linux_misc.h ============================================================================== --- stable/10/sys/compat/linux/linux_misc.h Sat Jul 15 09:04:23 2017 (r321008) +++ stable/10/sys/compat/linux/linux_misc.h Sat Jul 15 14:48:31 2017 (r321009) @@ -60,6 +60,8 @@ #define LINUX_MREMAP_MAYMOVE 1 #define LINUX_MREMAP_FIXED 2 +#define LINUX_PATH_MAX 4096 + extern const char *linux_kplatform; /* Modified: stable/10/sys/kern/vfs_cache.c ============================================================================== --- stable/10/sys/kern/vfs_cache.c Sat Jul 15 09:04:23 2017 (r321008) +++ stable/10/sys/kern/vfs_cache.c Sat Jul 15 14:48:31 2017 (r321009) @@ -1073,11 +1073,13 @@ int sys___getcwd(struct thread *td, struct __getcwd_args *uap) { - return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen)); + return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen, + MAXPATHLEN)); } int -kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen) +kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen, + u_int path_max) { char *bp, *tmpbuf; struct filedesc *fdp; @@ -1088,8 +1090,8 @@ kern___getcwd(struct thread *td, char *buf, enum uio_s return (ENODEV); if (buflen < 2) return (EINVAL); - if (buflen > MAXPATHLEN) - buflen = MAXPATHLEN; + if (buflen > path_max) + buflen = path_max; tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); fdp = td->td_proc->p_fd; Modified: stable/10/sys/sys/syscallsubr.h ============================================================================== --- stable/10/sys/sys/syscallsubr.h Sat Jul 15 09:04:23 2017 (r321008) +++ stable/10/sys/sys/syscallsubr.h Sat Jul 15 14:48:31 2017 (r321009) @@ -59,7 +59,7 @@ struct sched_param; struct __wrusage; int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, - u_int buflen); + u_int buflen, u_int path_max); int kern_accept(struct thread *td, int s, struct sockaddr **name, socklen_t *namelen, struct file **fp); int kern_accept4(struct thread *td, int s, struct sockaddr **name, From owner-svn-src-stable@freebsd.org Sat Jul 15 14:57:26 2017 Return-Path: Delivered-To: svn-src-stable@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 2BE4BAFBED9; Sat, 15 Jul 2017 14:57:26 +0000 (UTC) (envelope-from dchagin@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 E15F772B4B; Sat, 15 Jul 2017 14:57:25 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FEvP6J000283; Sat, 15 Jul 2017 14:57:25 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FEvPUk000282; Sat, 15 Jul 2017 14:57:25 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151457.v6FEvPUk000282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 14:57: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: r321010 - stable/10/sys/compat/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/compat/linux X-SVN-Commit-Revision: 321010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 14:57:26 -0000 Author: dchagin Date: Sat Jul 15 14:57:24 2017 New Revision: 321010 URL: https://svnweb.freebsd.org/changeset/base/321010 Log: MFC r281882(by trasz@): Simplify linux_getcwd(), removing code that was longer used. Modified: stable/10/sys/compat/linux/linux_getcwd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_getcwd.c ============================================================================== --- stable/10/sys/compat/linux/linux_getcwd.c Sat Jul 15 14:48:31 2017 (r321009) +++ stable/10/sys/compat/linux/linux_getcwd.c Sat Jul 15 14:57:24 2017 (r321010) @@ -2,11 +2,15 @@ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. + * Copyright (c) 2015 The FreeBSD Foundation * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Bill Sommerfeld. * + * Portions of this software were developed by Edward Tomasz Napierala + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -36,19 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include #include -#include -#include #include -#include #include -#include -#include /* XXX only for DIRBLKSIZ */ #ifdef COMPAT_LINUX32 #include @@ -60,408 +54,37 @@ __FBSDID("$FreeBSD$"); #include #include -#include - -static int -linux_getcwd_scandir(struct vnode **, struct vnode **, - char **, char *, struct thread *); -static int -linux_getcwd_common(struct vnode *, struct vnode *, - char **, char *, int, int, struct thread *); - -#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4) - /* - * Vnode variable naming conventions in this file: - * - * rvp: the current root we're aiming towards. - * lvp, *lvpp: the "lower" vnode - * uvp, *uvpp: the "upper" vnode. - * - * Since all the vnodes we're dealing with are directories, and the - * lookups are going *up* in the filesystem rather than *down*, the - * usual "pvp" (parent) or "dvp" (directory) naming conventions are - * too confusing. - */ - -/* - * XXX Will infinite loop in certain cases if a directory read reliably - * returns EINVAL on last block. - * XXX is EINVAL the right thing to return if a directory is malformed? - */ - -/* - * XXX Untested vs. mount -o union; probably does the wrong thing. - */ - -/* - * Find parent vnode of *lvpp, return in *uvpp - * - * If we care about the name, scan it looking for name of directory - * entry pointing at lvp. - * - * Place the name in the buffer which starts at bufp, immediately - * before *bpp, and move bpp backwards to point at the start of it. - * - * On entry, *lvpp is a locked vnode reference; on exit, it is vput and NULL'ed - * On exit, *uvpp is either NULL or is a locked vnode reference. - */ -static int -linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td) - struct vnode **lvpp; - struct vnode **uvpp; - char **bpp; - char *bufp; - struct thread *td; -{ - int error = 0; - int eofflag; - off_t off; - int tries; - struct uio uio; - struct iovec iov; - char *dirbuf = NULL; - int dirbuflen; - ino_t fileno; - struct vattr va; - struct vnode *uvp = NULL; - struct vnode *lvp = *lvpp; - struct componentname cn; - int len, reclen; - tries = 0; - - /* - * If we want the filename, get some info we need while the - * current directory is still locked. - */ - if (bufp != NULL) { - error = VOP_GETATTR(lvp, &va, td->td_ucred); - if (error) { - vput(lvp); - *lvpp = NULL; - *uvpp = NULL; - return error; - } - } - - /* - * Ok, we have to do it the hard way.. - * Next, get parent vnode using lookup of .. - */ - cn.cn_nameiop = LOOKUP; - cn.cn_flags = ISLASTCN | ISDOTDOT | RDONLY; - cn.cn_thread = td; - cn.cn_cred = td->td_ucred; - cn.cn_pnbuf = NULL; - cn.cn_nameptr = ".."; - cn.cn_namelen = 2; - cn.cn_consume = 0; - cn.cn_lkflags = LK_SHARED; - - /* - * At this point, lvp is locked and will be unlocked by the lookup. - * On successful return, *uvpp will be locked - */ -#ifdef MAC - error = mac_vnode_check_lookup(td->td_ucred, lvp, &cn); - if (error == 0) -#endif - error = VOP_LOOKUP(lvp, uvpp, &cn); - if (error) { - vput(lvp); - *lvpp = NULL; - *uvpp = NULL; - return error; - } - uvp = *uvpp; - - /* If we don't care about the pathname, we're done */ - if (bufp == NULL) { - vput(lvp); - *lvpp = NULL; - return 0; - } - - fileno = va.va_fileid; - - dirbuflen = DIRBLKSIZ; - if (dirbuflen < va.va_blocksize) - dirbuflen = va.va_blocksize; - dirbuf = malloc(dirbuflen, M_LINUX, M_WAITOK); - -#if 0 -unionread: -#endif - off = 0; - do { - /* call VOP_READDIR of parent */ - iov.iov_base = dirbuf; - iov.iov_len = dirbuflen; - - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = off; - uio.uio_resid = dirbuflen; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_READ; - uio.uio_td = td; - - eofflag = 0; - -#ifdef MAC - error = mac_vnode_check_readdir(td->td_ucred, uvp); - if (error == 0) -#endif /* MAC */ - error = VOP_READDIR(uvp, &uio, td->td_ucred, &eofflag, - 0, 0); - - off = uio.uio_offset; - - /* - * Try again if NFS tosses its cookies. - * XXX this can still loop forever if the directory is busted - * such that the second or subsequent page of it always - * returns EINVAL - */ - if ((error == EINVAL) && (tries < 3)) { - off = 0; - tries++; - continue; /* once more, with feeling */ - } - - if (!error) { - char *cpos; - struct dirent *dp; - - cpos = dirbuf; - tries = 0; - - /* scan directory page looking for matching vnode */ - for (len = (dirbuflen - uio.uio_resid); len > 0; len -= reclen) { - dp = (struct dirent *) cpos; - reclen = dp->d_reclen; - - /* check for malformed directory.. */ - if (reclen < DIRENT_MINSIZE) { - error = EINVAL; - goto out; - } - /* - * XXX should perhaps do VOP_LOOKUP to - * check that we got back to the right place, - * but getting the locking games for that - * right would be heinous. - */ - if ((dp->d_type != DT_WHT) && - (dp->d_fileno == fileno)) { - char *bp = *bpp; - bp -= dp->d_namlen; - - if (bp <= bufp) { - error = ERANGE; - goto out; - } - bcopy(dp->d_name, bp, dp->d_namlen); - error = 0; - *bpp = bp; - goto out; - } - cpos += reclen; - } - } - } while (!eofflag); - error = ENOENT; - -out: - vput(lvp); - *lvpp = NULL; - free(dirbuf, M_LINUX); - return error; -} - - -/* - * common routine shared by sys___getcwd() and linux_vn_isunder() - */ - -#define GETCWD_CHECK_ACCESS 0x0001 - -static int -linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, td) - struct vnode *lvp; - struct vnode *rvp; - char **bpp; - char *bufp; - int limit; - int flags; - struct thread *td; -{ - struct filedesc *fdp = td->td_proc->p_fd; - struct vnode *uvp = NULL; - char *bp = NULL; - int error; - accmode_t accmode = VEXEC; - - if (rvp == NULL) { - rvp = fdp->fd_rdir; - if (rvp == NULL) - rvp = rootvnode; - } - - VREF(rvp); - VREF(lvp); - - /* - * Error handling invariant: - * Before a `goto out': - * lvp is either NULL, or locked and held. - * uvp is either NULL, or locked and held. - */ - - error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY); - if (error != 0) - panic("vn_lock LK_RETRY returned error %d", error); - if (bufp) - bp = *bpp; - /* - * this loop will terminate when one of the following happens: - * - we hit the root - * - getdirentries or lookup fails - * - we run out of space in the buffer. - */ - if (lvp == rvp) { - if (bp) - *(--bp) = '/'; - goto out; - } - do { - if (lvp->v_type != VDIR) { - error = ENOTDIR; - goto out; - } - - /* - * access check here is optional, depending on - * whether or not caller cares. - */ - if (flags & GETCWD_CHECK_ACCESS) { - error = VOP_ACCESS(lvp, accmode, td->td_ucred, td); - if (error) - goto out; - accmode = VEXEC|VREAD; - } - - /* - * step up if we're a covered vnode.. - */ - while (lvp->v_vflag & VV_ROOT) { - struct vnode *tvp; - - if (lvp == rvp) - goto out; - - tvp = lvp; - lvp = lvp->v_mount->mnt_vnodecovered; - vput(tvp); - /* - * hodie natus est radici frater - */ - if (lvp == NULL) { - error = ENOENT; - goto out; - } - VREF(lvp); - error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY); - if (error != 0) - panic("vn_lock LK_RETRY returned %d", error); - } - error = linux_getcwd_scandir(&lvp, &uvp, &bp, bufp, td); - if (error) - goto out; -#ifdef DIAGNOSTIC - if (lvp != NULL) - panic("getcwd: oops, forgot to null lvp"); - if (bufp && (bp <= bufp)) { - panic("getcwd: oops, went back too far"); - } -#endif - if (bp) - *(--bp) = '/'; - lvp = uvp; - uvp = NULL; - limit--; - } while ((lvp != rvp) && (limit > 0)); - -out: - if (bpp) - *bpp = bp; - if (uvp) - vput(uvp); - if (lvp) - vput(lvp); - vrele(rvp); - return error; -} - - -/* * Find pathname of process's current directory. - * - * Use vfs vnode-to-name reverse cache; if that fails, fall back - * to reading directory contents. */ - int linux_getcwd(struct thread *td, struct linux_getcwd_args *args) { - char *bp, *bend, *path; - int error, len, lenused; + char *path; + int error, lenused; #ifdef DEBUG if (ldebug(getcwd)) printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize); #endif - len = args->bufsize; + /* + * Linux returns ERANGE instead of EINVAL. + */ + if (args->bufsize < 2) + return (ERANGE); - if (len > LINUX_PATH_MAX) - len = LINUX_PATH_MAX; - else if (len < 2) - return ERANGE; + path = malloc(LINUX_PATH_MAX, M_TEMP, M_WAITOK); - path = malloc(len, M_TEMP, M_WAITOK); - - error = kern___getcwd(td, path, UIO_SYSSPACE, len, LINUX_PATH_MAX); - if (!error) { + error = kern___getcwd(td, path, UIO_SYSSPACE, args->bufsize, + LINUX_PATH_MAX); + if (error == 0) { lenused = strlen(path) + 1; - if (lenused <= args->bufsize) { + error = copyout(path, args->buf, lenused); + if (error == 0) td->td_retval[0] = lenused; - error = copyout(path, args->buf, lenused); - } - else - error = ERANGE; - } else { - bp = &path[len]; - bend = bp; - *(--bp) = '\0'; - - /* - * 5th argument here is "max number of vnodes to traverse". - * Since each entry takes up at least 2 bytes in the output buffer, - * limit it to N/2 vnodes for an N byte buffer. - */ - - error = linux_getcwd_common (td->td_proc->p_fd->fd_cdir, NULL, - &bp, path, len/2, GETCWD_CHECK_ACCESS, td); - if (error) - goto out; - lenused = bend - bp; - td->td_retval[0] = lenused; - /* put the result into user buffer */ - error = copyout(bp, args->buf, lenused); } -out: + free(path, M_TEMP); return (error); } - From owner-svn-src-stable@freebsd.org Sat Jul 15 15:08:19 2017 Return-Path: Delivered-To: svn-src-stable@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 A9E56AFC1C9; Sat, 15 Jul 2017 15:08:19 +0000 (UTC) (envelope-from dchagin@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 664E9730E6; Sat, 15 Jul 2017 15:08:19 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FF8IMj004445; Sat, 15 Jul 2017 15:08:18 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FF8IbP004444; Sat, 15 Jul 2017 15:08:18 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151508.v6FF8IbP004444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 15:08:18 +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: r321012 - stable/10/sys/compat/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/compat/linux X-SVN-Commit-Revision: 321012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 15:08:19 -0000 Author: dchagin Date: Sat Jul 15 15:08:18 2017 New Revision: 321012 URL: https://svnweb.freebsd.org/changeset/base/321012 Log: MFC r292744: Return EINVAL in case of incorrect sigev_signo value specified instead of panicing. Modified: stable/10/sys/compat/linux/linux_timer.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_timer.c ============================================================================== --- stable/10/sys/compat/linux/linux_timer.c Sat Jul 15 15:00:13 2017 (r321011) +++ stable/10/sys/compat/linux/linux_timer.c Sat Jul 15 15:08:18 2017 (r321012) @@ -57,6 +57,8 @@ linux_convert_l_sigevent(struct l_sigevent *l_sig, str CP(*l_sig, *sig, sigev_notify); switch (l_sig->sigev_notify) { case L_SIGEV_SIGNAL: + if (!LINUX_SIG_VALID(l_sig->sigev_signo)) + return (EINVAL); sig->sigev_notify = SIGEV_SIGNAL; sig->sigev_signo = linux_to_bsd_signal(l_sig->sigev_signo); PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr); @@ -73,6 +75,8 @@ linux_convert_l_sigevent(struct l_sigevent *l_sig, str return (EINVAL); #endif case L_SIGEV_THREAD_ID: + if (!LINUX_SIG_VALID(l_sig->sigev_signo)) + return (EINVAL); sig->sigev_notify = SIGEV_THREAD_ID; CP2(*l_sig, *sig, _l_sigev_un._tid, sigev_notify_thread_id); sig->sigev_signo = linux_to_bsd_signal(l_sig->sigev_signo); From owner-svn-src-stable@freebsd.org Sat Jul 15 15:21:44 2017 Return-Path: Delivered-To: svn-src-stable@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 83F3EAFC4E1; Sat, 15 Jul 2017 15:21:44 +0000 (UTC) (envelope-from dchagin@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 501A173858; Sat, 15 Jul 2017 15:21:44 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FFLhTv011500; Sat, 15 Jul 2017 15:21:43 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FFLhva011499; Sat, 15 Jul 2017 15:21:43 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151521.v6FFLhva011499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 15:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321013 - stable/10/sys/amd64/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/amd64/linux X-SVN-Commit-Revision: 321013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 15:21:44 -0000 Author: dchagin Date: Sat Jul 15 15:21:43 2017 New Revision: 321013 URL: https://svnweb.freebsd.org/changeset/base/321013 Log: MFC r293907 (glebius@) partially: Change linux get_robust_list system call to match actual linux one. This is the forgotten part of r293897. Modified: stable/10/sys/amd64/linux/syscalls.master Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/syscalls.master ============================================================================== --- stable/10/sys/amd64/linux/syscalls.master Sat Jul 15 15:08:18 2017 (r321012) +++ stable/10/sys/amd64/linux/syscalls.master Sat Jul 15 15:21:43 2017 (r321013) @@ -461,8 +461,8 @@ 272 AUE_NULL STD { int linux_unshare(void); } 273 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \ l_size_t len); } -274 AUE_NULL STD { int linux_get_robust_list(l_int pid, struct linux_robust_list_head *head, \ - l_size_t *len); } +274 AUE_NULL STD { int linux_get_robust_list(l_int pid, \ + struct linux_robust_list_head **head, l_size_t *len); } 275 AUE_NULL STD { int linux_splice(void); } 276 AUE_NULL STD { int linux_tee(void); } 277 AUE_NULL STD { int linux_sync_file_range(void); } From owner-svn-src-stable@freebsd.org Sat Jul 15 15:26:39 2017 Return-Path: Delivered-To: svn-src-stable@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 EA291AFC6F5; Sat, 15 Jul 2017 15:26:39 +0000 (UTC) (envelope-from dchagin@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 B8DBE73A56; Sat, 15 Jul 2017 15:26:39 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FFQcvR012362; Sat, 15 Jul 2017 15:26:38 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FFQcSr012360; Sat, 15 Jul 2017 15:26:38 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151526.v6FFQcSr012360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 15:26: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: r321014 - stable/10/sys/amd64/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/amd64/linux X-SVN-Commit-Revision: 321014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 15:26:40 -0000 Author: dchagin Date: Sat Jul 15 15:26:38 2017 New Revision: 321014 URL: https://svnweb.freebsd.org/changeset/base/321014 Log: MFC r293908: Regen after get_robust_list fix. Modified: stable/10/sys/amd64/linux/linux_proto.h stable/10/sys/amd64/linux/linux_systrace_args.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_proto.h ============================================================================== --- stable/10/sys/amd64/linux/linux_proto.h Sat Jul 15 15:21:43 2017 (r321013) +++ stable/10/sys/amd64/linux/linux_proto.h Sat Jul 15 15:26:38 2017 (r321014) @@ -965,7 +965,7 @@ struct linux_set_robust_list_args { }; struct linux_get_robust_list_args { char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)]; - char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)]; + char head_l_[PADL_(struct linux_robust_list_head **)]; struct linux_robust_list_head ** head; char head_r_[PADR_(struct linux_robust_list_head **)]; char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)]; }; struct linux_splice_args { Modified: stable/10/sys/amd64/linux/linux_systrace_args.c ============================================================================== --- stable/10/sys/amd64/linux/linux_systrace_args.c Sat Jul 15 15:21:43 2017 (r321013) +++ stable/10/sys/amd64/linux/linux_systrace_args.c Sat Jul 15 15:26:38 2017 (r321014) @@ -2020,7 +2020,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg case 274: { struct linux_get_robust_list_args *p = params; iarg[0] = p->pid; /* l_int */ - uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head * */ + uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head ** */ uarg[2] = (intptr_t) p->len; /* l_size_t * */ *n_args = 3; break; @@ -5347,7 +5347,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d p = "l_int"; break; case 1: - p = "struct linux_robust_list_head *"; + p = "struct linux_robust_list_head **"; break; case 2: p = "l_size_t *"; From owner-svn-src-stable@freebsd.org Sat Jul 15 16:52:41 2017 Return-Path: Delivered-To: svn-src-stable@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 79461AFD8C2; Sat, 15 Jul 2017 16:52:41 +0000 (UTC) (envelope-from dchagin@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 181C17580A; Sat, 15 Jul 2017 16:52:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FGqe7x048047; Sat, 15 Jul 2017 16:52:40 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FGqe5W048046; Sat, 15 Jul 2017 16:52:40 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151652.v6FGqe5W048046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 16:52: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: r321016 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 321016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 16:52:41 -0000 Author: dchagin Date: Sat Jul 15 16:52:40 2017 New Revision: 321016 URL: https://svnweb.freebsd.org/changeset/base/321016 Log: Temporarily r284696: MFC r284613. When using KTRACE, set a variable to the appropriate value and don't leave it initialized at NULL. Will MFC it after proper MFC of r272823. Modified: stable/10/sys/kern/uipc_syscalls.c Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 16:42:55 2017 (r321015) +++ stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 16:52:40 2017 (r321016) @@ -2746,10 +2746,6 @@ sys_sctp_generic_sendmsg (td, uap) auio.uio_td = td; auio.uio_offset = 0; /* XXX */ auio.uio_resid = 0; -#ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) - ktruio = cloneuio(&auio); -#endif /* KTRACE */ len = auio.uio_resid = uap->mlen; CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, @@ -2873,10 +2869,6 @@ sys_sctp_generic_sendmsg_iov(td, uap) goto sctp_bad; } } -#ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) - ktruio = cloneuio(&auio); -#endif /* KTRACE */ len = auio.uio_resid; CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, From owner-svn-src-stable@freebsd.org Sat Jul 15 16:55:03 2017 Return-Path: Delivered-To: svn-src-stable@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 96506AFD944; Sat, 15 Jul 2017 16:55:03 +0000 (UTC) (envelope-from dchagin@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 642B075969; Sat, 15 Jul 2017 16:55:03 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FGt21A048206; Sat, 15 Jul 2017 16:55:02 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FGt2B7048200; Sat, 15 Jul 2017 16:55:02 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151655.v6FGt2B7048200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 16:55:02 +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: r321017 - in stable/10/sys: compat/freebsd32 conf kern netinet sys X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: compat/freebsd32 conf kern netinet sys X-SVN-Commit-Revision: 321017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 16:55:03 -0000 Author: dchagin Date: Sat Jul 15 16:55:02 2017 New Revision: 321017 URL: https://svnweb.freebsd.org/changeset/base/321017 Log: MFC r272823: Move the SCTP syscalls to netinet with the rest of the SCTP code. The syscalls themselves are tightly coupled with the network stack and therefore should not be in the generic socket code. The following four syscalls have been marked as NOSTD so they can be dynamically registered in sctp_syscalls_init() function: sys_sctp_peeloff sys_sctp_generic_sendmsg sys_sctp_generic_sendmsg_iov sys_sctp_generic_recvmsg The syscalls are also set up to be dynamically registered when COMPAT32 option is configured. As a side effect of moving the SCTP syscalls, getsock_cap needs to be made available outside of the uipc_syscalls.c source file. A proper prototype has been added to the sys/socketvar.h header file. API tests from the SCTP reference implementation have been run to ensure compatibility. (http://code.google.com/p/sctp-refimpl/source/checkout) Added: stable/10/sys/netinet/sctp_syscalls.c - copied unchanged from r272823, head/sys/netinet/sctp_syscalls.c Modified: stable/10/sys/compat/freebsd32/syscalls.master stable/10/sys/conf/files stable/10/sys/kern/syscalls.master stable/10/sys/kern/uipc_syscalls.c stable/10/sys/sys/socketvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/10/sys/compat/freebsd32/syscalls.master Sat Jul 15 16:52:40 2017 (r321016) +++ stable/10/sys/compat/freebsd32/syscalls.master Sat Jul 15 16:55:02 2017 (r321017) @@ -845,14 +845,14 @@ 468 AUE_NULL UNIMPL nosys 469 AUE_NULL UNIMPL __getpath_fromfd 470 AUE_NULL UNIMPL __getpath_fromaddr -471 AUE_NULL NOPROTO { int sctp_peeloff(int sd, uint32_t name); } -472 AUE_NULL NOPROTO { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ +471 AUE_NULL NOPROTO|NOSTD { int sctp_peeloff(int sd, uint32_t name); } +472 AUE_NULL NOPROTO|NOSTD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -473 AUE_NULL NOPROTO { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ +473 AUE_NULL NOPROTO|NOSTD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -474 AUE_NULL NOPROTO { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ +474 AUE_NULL NOPROTO|NOSTD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ struct sctp_sndrcvinfo *sinfo, int *msg_flags); } #ifdef PAD64_REQUIRED Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Sat Jul 15 16:52:40 2017 (r321016) +++ stable/10/sys/conf/files Sat Jul 15 16:55:02 2017 (r321017) @@ -3570,6 +3570,7 @@ netinet/sctp_output.c optional inet sctp | inet6 sctp netinet/sctp_pcb.c optional inet sctp | inet6 sctp netinet/sctp_peeloff.c optional inet sctp | inet6 sctp netinet/sctp_ss_functions.c optional inet sctp | inet6 sctp +netinet/sctp_syscalls.c optional inet sctp | inet6 sctp netinet/sctp_sysctl.c optional inet sctp | inet6 sctp netinet/sctp_timer.c optional inet sctp | inet6 sctp netinet/sctp_usrreq.c optional inet sctp | inet6 sctp Modified: stable/10/sys/kern/syscalls.master ============================================================================== --- stable/10/sys/kern/syscalls.master Sat Jul 15 16:52:40 2017 (r321016) +++ stable/10/sys/kern/syscalls.master Sat Jul 15 16:55:02 2017 (r321017) @@ -837,14 +837,14 @@ 468 AUE_NULL UNIMPL nosys 469 AUE_NULL UNIMPL __getpath_fromfd 470 AUE_NULL UNIMPL __getpath_fromaddr -471 AUE_NULL STD { int sctp_peeloff(int sd, uint32_t name); } -472 AUE_NULL STD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ +471 AUE_NULL NOSTD { int sctp_peeloff(int sd, uint32_t name); } +472 AUE_NULL NOSTD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -473 AUE_NULL STD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ +473 AUE_NULL NOSTD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -474 AUE_NULL STD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ +474 AUE_NULL NOSTD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ struct sctp_sndrcvinfo *sinfo, int *msg_flags); } 475 AUE_PREAD STD { ssize_t pread(int fd, void *buf, \ Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 16:52:40 2017 (r321016) +++ stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 16:55:02 2017 (r321017) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_sctp.h" #include "opt_compat.h" #include "opt_ktrace.h" @@ -92,13 +91,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(INET) || defined(INET6) -#ifdef SCTP -#include -#include -#endif /* SCTP */ -#endif /* INET || INET6 */ - /* * Flags for accept1() and kern_accept4(), in addition to SOCK_CLOEXEC * and SOCK_NONBLOCK. @@ -157,7 +149,7 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQU * capability rights are present. * A reference on the file entry is held upon returning. */ -static int +int getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp, struct file **fpp, u_int *fflagp) { @@ -2573,485 +2565,4 @@ out: error = EINTR; return (error); -} - -/* - * SCTP syscalls. - * Functionality only compiled in if SCTP is defined in the kernel Makefile, - * otherwise all return EOPNOTSUPP. - * XXX: We should make this loadable one day. - */ -int -sys_sctp_peeloff(td, uap) - struct thread *td; - struct sctp_peeloff_args /* { - int sd; - caddr_t name; - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - struct file *nfp = NULL; - struct socket *head, *so; - cap_rights_t rights; - u_int fflag; - int error, fd; - - AUDIT_ARG_FD(uap->sd); - error = fgetsock(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), - &head, &fflag); - if (error != 0) - goto done2; - if (head->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto done; - } - error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); - if (error != 0) - goto done; - /* - * At this point we know we do have a assoc to pull - * we proceed to get the fd setup. This may block - * but that is ok. - */ - - error = falloc(td, &nfp, &fd, 0); - if (error != 0) - goto done; - td->td_retval[0] = fd; - - CURVNET_SET(head->so_vnet); - so = sonewconn(head, SS_ISCONNECTED); - if (so == NULL) { - error = ENOMEM; - goto noconnection; - } - /* - * Before changing the flags on the socket, we have to bump the - * reference count. Otherwise, if the protocol calls sofree(), - * the socket will be released due to a zero refcount. - */ - SOCK_LOCK(so); - soref(so); /* file descriptor reference */ - SOCK_UNLOCK(so); - - ACCEPT_LOCK(); - - TAILQ_REMOVE(&head->so_comp, so, so_list); - head->so_qlen--; - so->so_state |= (head->so_state & SS_NBIO); - so->so_state &= ~SS_NOFDREF; - so->so_qstate &= ~SQ_COMP; - so->so_head = NULL; - ACCEPT_UNLOCK(); - finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); - error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); - if (error != 0) - goto noconnection; - if (head->so_sigio != NULL) - fsetown(fgetown(&head->so_sigio), &so->so_sigio); - -noconnection: - /* - * close the new descriptor, assuming someone hasn't ripped it - * out from under us. - */ - if (error != 0) - fdclose(td->td_proc->p_fd, nfp, fd, td); - - /* - * Release explicitly held references before returning. - */ - CURVNET_RESTORE(); -done: - if (nfp != NULL) - fdrop(nfp, td); - fputsock(head); -done2: - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} - -int -sys_sctp_generic_sendmsg (td, uap) - struct thread *td; - struct sctp_generic_sendmsg_args /* { - int sd, - caddr_t msg, - int mlen, - caddr_t to, - __socklen_t tolen, - struct sctp_sndrcvinfo *sinfo, - int flags - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; - struct socket *so; - struct file *fp = NULL; - struct sockaddr *to = NULL; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif - struct uio auio; - struct iovec iov[1]; - cap_rights_t rights; - int error = 0, len; - - if (uap->sinfo != NULL) { - error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); - if (error != 0) - return (error); - u_sinfo = &sinfo; - } - - cap_rights_init(&rights, CAP_SEND); - if (uap->tolen != 0) { - error = getsockaddr(&to, uap->to, uap->tolen); - if (error != 0) { - to = NULL; - goto sctp_bad2; - } - cap_rights_set(&rights, CAP_CONNECT); - } - - AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); - if (error != 0) - goto sctp_bad; -#ifdef KTRACE - if (to && (KTRPOINT(td, KTR_STRUCT))) - ktrsockaddr(to); -#endif - - iov[0].iov_base = uap->msg; - iov[0].iov_len = uap->mlen; - - so = (struct socket *)fp->f_data; - if (so->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto sctp_bad; - } -#ifdef MAC - error = mac_socket_check_send(td->td_ucred, so); - if (error != 0) - goto sctp_bad; -#endif /* MAC */ - - auio.uio_iov = iov; - auio.uio_iovcnt = 1; - auio.uio_segflg = UIO_USERSPACE; - auio.uio_rw = UIO_WRITE; - auio.uio_td = td; - auio.uio_offset = 0; /* XXX */ - auio.uio_resid = 0; - len = auio.uio_resid = uap->mlen; - CURVNET_SET(so->so_vnet); - error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, - (struct mbuf *)NULL, uap->flags, u_sinfo, td); - CURVNET_RESTORE(); - if (error != 0) { - if (auio.uio_resid != len && (error == ERESTART || - error == EINTR || error == EWOULDBLOCK)) - error = 0; - /* Generation of SIGPIPE can be controlled per socket. */ - if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) && - !(uap->flags & MSG_NOSIGNAL)) { - PROC_LOCK(td->td_proc); - tdsignal(td, SIGPIPE); - PROC_UNLOCK(td->td_proc); - } - } - if (error == 0) - td->td_retval[0] = len - auio.uio_resid; -#ifdef KTRACE - if (ktruio != NULL) { - ktruio->uio_resid = td->td_retval[0]; - ktrgenio(uap->sd, UIO_WRITE, ktruio, error); - } -#endif /* KTRACE */ -sctp_bad: - if (fp != NULL) - fdrop(fp, td); -sctp_bad2: - free(to, M_SONAME); - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} - -int -sys_sctp_generic_sendmsg_iov(td, uap) - struct thread *td; - struct sctp_generic_sendmsg_iov_args /* { - int sd, - struct iovec *iov, - int iovlen, - caddr_t to, - __socklen_t tolen, - struct sctp_sndrcvinfo *sinfo, - int flags - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; - struct socket *so; - struct file *fp = NULL; - struct sockaddr *to = NULL; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif - struct uio auio; - struct iovec *iov, *tiov; - cap_rights_t rights; - ssize_t len; - int error, i; - - if (uap->sinfo != NULL) { - error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); - if (error != 0) - return (error); - u_sinfo = &sinfo; - } - cap_rights_init(&rights, CAP_SEND); - if (uap->tolen != 0) { - error = getsockaddr(&to, uap->to, uap->tolen); - if (error != 0) { - to = NULL; - goto sctp_bad2; - } - cap_rights_set(&rights, CAP_CONNECT); - } - - AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); - if (error != 0) - goto sctp_bad1; - -#ifdef COMPAT_FREEBSD32 - if (SV_CURPROC_FLAG(SV_ILP32)) - error = freebsd32_copyiniov((struct iovec32 *)uap->iov, - uap->iovlen, &iov, EMSGSIZE); - else -#endif - error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); - if (error != 0) - goto sctp_bad1; -#ifdef KTRACE - if (to && (KTRPOINT(td, KTR_STRUCT))) - ktrsockaddr(to); -#endif - - so = (struct socket *)fp->f_data; - if (so->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto sctp_bad; - } -#ifdef MAC - error = mac_socket_check_send(td->td_ucred, so); - if (error != 0) - goto sctp_bad; -#endif /* MAC */ - - auio.uio_iov = iov; - auio.uio_iovcnt = uap->iovlen; - auio.uio_segflg = UIO_USERSPACE; - auio.uio_rw = UIO_WRITE; - auio.uio_td = td; - auio.uio_offset = 0; /* XXX */ - auio.uio_resid = 0; - tiov = iov; - for (i = 0; i iovlen; i++, tiov++) { - if ((auio.uio_resid += tiov->iov_len) < 0) { - error = EINVAL; - goto sctp_bad; - } - } - len = auio.uio_resid; - CURVNET_SET(so->so_vnet); - error = sctp_lower_sosend(so, to, &auio, - (struct mbuf *)NULL, (struct mbuf *)NULL, - uap->flags, u_sinfo, td); - CURVNET_RESTORE(); - if (error != 0) { - if (auio.uio_resid != len && (error == ERESTART || - error == EINTR || error == EWOULDBLOCK)) - error = 0; - /* Generation of SIGPIPE can be controlled per socket */ - if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) && - !(uap->flags & MSG_NOSIGNAL)) { - PROC_LOCK(td->td_proc); - tdsignal(td, SIGPIPE); - PROC_UNLOCK(td->td_proc); - } - } - if (error == 0) - td->td_retval[0] = len - auio.uio_resid; -#ifdef KTRACE - if (ktruio != NULL) { - ktruio->uio_resid = td->td_retval[0]; - ktrgenio(uap->sd, UIO_WRITE, ktruio, error); - } -#endif /* KTRACE */ -sctp_bad: - free(iov, M_IOV); -sctp_bad1: - if (fp != NULL) - fdrop(fp, td); -sctp_bad2: - free(to, M_SONAME); - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} - -int -sys_sctp_generic_recvmsg(td, uap) - struct thread *td; - struct sctp_generic_recvmsg_args /* { - int sd, - struct iovec *iov, - int iovlen, - struct sockaddr *from, - __socklen_t *fromlenaddr, - struct sctp_sndrcvinfo *sinfo, - int *msg_flags - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - uint8_t sockbufstore[256]; - struct uio auio; - struct iovec *iov, *tiov; - struct sctp_sndrcvinfo sinfo; - struct socket *so; - struct file *fp = NULL; - struct sockaddr *fromsa; - cap_rights_t rights; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif - ssize_t len; - int error, fromlen, i, msg_flags; - - AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, - cap_rights_init(&rights, CAP_RECV), &fp, NULL); - if (error != 0) - return (error); -#ifdef COMPAT_FREEBSD32 - if (SV_CURPROC_FLAG(SV_ILP32)) - error = freebsd32_copyiniov((struct iovec32 *)uap->iov, - uap->iovlen, &iov, EMSGSIZE); - else -#endif - error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); - if (error != 0) - goto out1; - - so = fp->f_data; - if (so->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto out; - } -#ifdef MAC - error = mac_socket_check_receive(td->td_ucred, so); - if (error != 0) - goto out; -#endif /* MAC */ - - if (uap->fromlenaddr != NULL) { - error = copyin(uap->fromlenaddr, &fromlen, sizeof (fromlen)); - if (error != 0) - goto out; - } else { - fromlen = 0; - } - if (uap->msg_flags) { - error = copyin(uap->msg_flags, &msg_flags, sizeof (int)); - if (error != 0) - goto out; - } else { - msg_flags = 0; - } - auio.uio_iov = iov; - auio.uio_iovcnt = uap->iovlen; - auio.uio_segflg = UIO_USERSPACE; - auio.uio_rw = UIO_READ; - auio.uio_td = td; - auio.uio_offset = 0; /* XXX */ - auio.uio_resid = 0; - tiov = iov; - for (i = 0; i iovlen; i++, tiov++) { - if ((auio.uio_resid += tiov->iov_len) < 0) { - error = EINVAL; - goto out; - } - } - len = auio.uio_resid; - fromsa = (struct sockaddr *)sockbufstore; - -#ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) - ktruio = cloneuio(&auio); -#endif /* KTRACE */ - memset(&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); - CURVNET_SET(so->so_vnet); - error = sctp_sorecvmsg(so, &auio, (struct mbuf **)NULL, - fromsa, fromlen, &msg_flags, - (struct sctp_sndrcvinfo *)&sinfo, 1); - CURVNET_RESTORE(); - if (error != 0) { - if (auio.uio_resid != len && (error == ERESTART || - error == EINTR || error == EWOULDBLOCK)) - error = 0; - } else { - if (uap->sinfo) - error = copyout(&sinfo, uap->sinfo, sizeof (sinfo)); - } -#ifdef KTRACE - if (ktruio != NULL) { - ktruio->uio_resid = len - auio.uio_resid; - ktrgenio(uap->sd, UIO_READ, ktruio, error); - } -#endif /* KTRACE */ - if (error != 0) - goto out; - td->td_retval[0] = len - auio.uio_resid; - - if (fromlen && uap->from) { - len = fromlen; - if (len <= 0 || fromsa == 0) - len = 0; - else { - len = MIN(len, fromsa->sa_len); - error = copyout(fromsa, uap->from, (size_t)len); - if (error != 0) - goto out; - } - error = copyout(&len, uap->fromlenaddr, sizeof (socklen_t)); - if (error != 0) - goto out; - } -#ifdef KTRACE - if (KTRPOINT(td, KTR_STRUCT)) - ktrsockaddr(fromsa); -#endif - if (uap->msg_flags) { - error = copyout(&msg_flags, uap->msg_flags, sizeof (int)); - if (error != 0) - goto out; - } -out: - free(iov, M_IOV); -out1: - if (fp != NULL) - fdrop(fp, td); - - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ } Copied: stable/10/sys/netinet/sctp_syscalls.c (from r272823, head/sys/netinet/sctp_syscalls.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 16:55:02 2017 (r321017, copy of r272823, head/sys/netinet/sctp_syscalls.c) @@ -0,0 +1,588 @@ +/*- + * Copyright (c) 1982, 1986, 1989, 1990, 1993 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_capsicum.h" +#include "opt_inet.h" +#include "opt_inet6.h" +#include "opt_sctp.h" +#include "opt_compat.h" +#include "opt_ktrace.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef KTRACE +#include +#endif +#ifdef COMPAT_FREEBSD32 +#include +#endif + +#include + +#include +#include + +#include +#include + +static struct syscall_helper_data sctp_syscalls[] = { + SYSCALL_INIT_HELPER(sctp_peeloff), + SYSCALL_INIT_HELPER(sctp_generic_sendmsg), + SYSCALL_INIT_HELPER(sctp_generic_sendmsg_iov), + SYSCALL_INIT_HELPER(sctp_generic_recvmsg), + SYSCALL_INIT_LAST +}; + +static void +sctp_syscalls_init(void *unused __unused) +{ + int error; + + error = syscall_helper_register(sctp_syscalls); + KASSERT((error == 0), + ("%s: syscall_helper_register failed for sctp syscalls", __func__)); +#ifdef COMPAT_FREEBSD32 + error = syscall32_helper_register(sctp_syscalls); + KASSERT((error == 0), + ("%s: syscall32_helper_register failed for sctp syscalls", + __func__)); +#endif +} +SYSINIT(sctp_syscalls, SI_SUB_SYSCALLS, SI_ORDER_ANY, sctp_syscalls_init, NULL); + +/* + * SCTP syscalls. + * Functionality only compiled in if SCTP is defined in the kernel Makefile, + * otherwise all return EOPNOTSUPP. + * XXX: We should make this loadable one day. + */ +int +sys_sctp_peeloff(td, uap) + struct thread *td; + struct sctp_peeloff_args /* { + int sd; + caddr_t name; + } */ *uap; +{ +#if (defined(INET) || defined(INET6)) && defined(SCTP) + struct file *nfp = NULL; + struct socket *head, *so; + cap_rights_t rights; + u_int fflag; + int error, fd; + + AUDIT_ARG_FD(uap->sd); + error = fgetsock(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), + &head, &fflag); + if (error != 0) + goto done2; + if (head->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto done; + } + error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); + if (error != 0) + goto done; + /* + * At this point we know we do have a assoc to pull + * we proceed to get the fd setup. This may block + * but that is ok. + */ + + error = falloc(td, &nfp, &fd, 0); + if (error != 0) + goto done; + td->td_retval[0] = fd; + + CURVNET_SET(head->so_vnet); + so = sonewconn(head, SS_ISCONNECTED); + if (so == NULL) { + error = ENOMEM; + goto noconnection; + } + /* + * Before changing the flags on the socket, we have to bump the + * reference count. Otherwise, if the protocol calls sofree(), + * the socket will be released due to a zero refcount. + */ + SOCK_LOCK(so); + soref(so); /* file descriptor reference */ + SOCK_UNLOCK(so); + + ACCEPT_LOCK(); + + TAILQ_REMOVE(&head->so_comp, so, so_list); + head->so_qlen--; + so->so_state |= (head->so_state & SS_NBIO); + so->so_state &= ~SS_NOFDREF; + so->so_qstate &= ~SQ_COMP; + so->so_head = NULL; + ACCEPT_UNLOCK(); + finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); + error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); + if (error != 0) + goto noconnection; + if (head->so_sigio != NULL) + fsetown(fgetown(&head->so_sigio), &so->so_sigio); + +noconnection: + /* + * close the new descriptor, assuming someone hasn't ripped it + * out from under us. + */ + if (error != 0) + fdclose(td->td_proc->p_fd, nfp, fd, td); + + /* + * Release explicitly held references before returning. + */ + CURVNET_RESTORE(); +done: + if (nfp != NULL) + fdrop(nfp, td); + fputsock(head); +done2: + return (error); +#else /* SCTP */ + return (EOPNOTSUPP); +#endif /* SCTP */ +} + +int +sys_sctp_generic_sendmsg (td, uap) + struct thread *td; + struct sctp_generic_sendmsg_args /* { + int sd, + caddr_t msg, + int mlen, + caddr_t to, + __socklen_t tolen, + struct sctp_sndrcvinfo *sinfo, + int flags + } */ *uap; +{ +#if (defined(INET) || defined(INET6)) && defined(SCTP) + struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; + struct socket *so; + struct file *fp = NULL; + struct sockaddr *to = NULL; +#ifdef KTRACE + struct uio *ktruio = NULL; +#endif + struct uio auio; + struct iovec iov[1]; + cap_rights_t rights; + int error = 0, len; + + if (uap->sinfo != NULL) { + error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); + if (error != 0) + return (error); + u_sinfo = &sinfo; + } + + cap_rights_init(&rights, CAP_SEND); + if (uap->tolen != 0) { + error = getsockaddr(&to, uap->to, uap->tolen); + if (error != 0) { + to = NULL; + goto sctp_bad2; + } + cap_rights_set(&rights, CAP_CONNECT); + } + + AUDIT_ARG_FD(uap->sd); + error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); + if (error != 0) + goto sctp_bad; +#ifdef KTRACE + if (to && (KTRPOINT(td, KTR_STRUCT))) + ktrsockaddr(to); +#endif + + iov[0].iov_base = uap->msg; + iov[0].iov_len = uap->mlen; + + so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } +#ifdef MAC + error = mac_socket_check_send(td->td_ucred, so); + if (error != 0) + goto sctp_bad; +#endif /* MAC */ + + auio.uio_iov = iov; + auio.uio_iovcnt = 1; + auio.uio_segflg = UIO_USERSPACE; + auio.uio_rw = UIO_WRITE; + auio.uio_td = td; + auio.uio_offset = 0; /* XXX */ + auio.uio_resid = 0; + len = auio.uio_resid = uap->mlen; + CURVNET_SET(so->so_vnet); + error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, + (struct mbuf *)NULL, uap->flags, u_sinfo, td); + CURVNET_RESTORE(); + if (error != 0) { + if (auio.uio_resid != len && (error == ERESTART || + error == EINTR || error == EWOULDBLOCK)) + error = 0; + /* Generation of SIGPIPE can be controlled per socket. */ + if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) && + !(uap->flags & MSG_NOSIGNAL)) { + PROC_LOCK(td->td_proc); + tdsignal(td, SIGPIPE); + PROC_UNLOCK(td->td_proc); + } + } + if (error == 0) + td->td_retval[0] = len - auio.uio_resid; +#ifdef KTRACE + if (ktruio != NULL) { + ktruio->uio_resid = td->td_retval[0]; + ktrgenio(uap->sd, UIO_WRITE, ktruio, error); + } +#endif /* KTRACE */ +sctp_bad: + if (fp != NULL) + fdrop(fp, td); +sctp_bad2: + free(to, M_SONAME); + return (error); +#else /* SCTP */ + return (EOPNOTSUPP); +#endif /* SCTP */ +} + +int +sys_sctp_generic_sendmsg_iov(td, uap) + struct thread *td; + struct sctp_generic_sendmsg_iov_args /* { + int sd, + struct iovec *iov, + int iovlen, + caddr_t to, + __socklen_t tolen, + struct sctp_sndrcvinfo *sinfo, + int flags + } */ *uap; +{ +#if (defined(INET) || defined(INET6)) && defined(SCTP) + struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; + struct socket *so; + struct file *fp = NULL; + struct sockaddr *to = NULL; +#ifdef KTRACE + struct uio *ktruio = NULL; +#endif + struct uio auio; + struct iovec *iov, *tiov; + cap_rights_t rights; + ssize_t len; + int error, i; + + if (uap->sinfo != NULL) { + error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); + if (error != 0) + return (error); + u_sinfo = &sinfo; + } + cap_rights_init(&rights, CAP_SEND); + if (uap->tolen != 0) { + error = getsockaddr(&to, uap->to, uap->tolen); + if (error != 0) { + to = NULL; + goto sctp_bad2; + } + cap_rights_set(&rights, CAP_CONNECT); + } + + AUDIT_ARG_FD(uap->sd); + error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); + if (error != 0) + goto sctp_bad1; + +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) + error = freebsd32_copyiniov((struct iovec32 *)uap->iov, + uap->iovlen, &iov, EMSGSIZE); + else +#endif + error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); + if (error != 0) + goto sctp_bad1; +#ifdef KTRACE + if (to && (KTRPOINT(td, KTR_STRUCT))) + ktrsockaddr(to); +#endif + + so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } +#ifdef MAC + error = mac_socket_check_send(td->td_ucred, so); + if (error != 0) + goto sctp_bad; +#endif /* MAC */ + + auio.uio_iov = iov; + auio.uio_iovcnt = uap->iovlen; + auio.uio_segflg = UIO_USERSPACE; + auio.uio_rw = UIO_WRITE; + auio.uio_td = td; + auio.uio_offset = 0; /* XXX */ + auio.uio_resid = 0; + tiov = iov; + for (i = 0; i iovlen; i++, tiov++) { + if ((auio.uio_resid += tiov->iov_len) < 0) { + error = EINVAL; + goto sctp_bad; + } + } + len = auio.uio_resid; + CURVNET_SET(so->so_vnet); + error = sctp_lower_sosend(so, to, &auio, + (struct mbuf *)NULL, (struct mbuf *)NULL, + uap->flags, u_sinfo, td); + CURVNET_RESTORE(); + if (error != 0) { + if (auio.uio_resid != len && (error == ERESTART || + error == EINTR || error == EWOULDBLOCK)) + error = 0; + /* Generation of SIGPIPE can be controlled per socket */ + if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) && + !(uap->flags & MSG_NOSIGNAL)) { + PROC_LOCK(td->td_proc); + tdsignal(td, SIGPIPE); + PROC_UNLOCK(td->td_proc); + } + } + if (error == 0) + td->td_retval[0] = len - auio.uio_resid; +#ifdef KTRACE + if (ktruio != NULL) { + ktruio->uio_resid = td->td_retval[0]; + ktrgenio(uap->sd, UIO_WRITE, ktruio, error); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Jul 15 17:00:44 2017 Return-Path: Delivered-To: svn-src-stable@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 DDC0DAFDC25; Sat, 15 Jul 2017 17:00:44 +0000 (UTC) (envelope-from dchagin@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 BA23F75B47; Sat, 15 Jul 2017 17:00:44 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FH0hs8051264; Sat, 15 Jul 2017 17:00:43 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FH0hUK051262; Sat, 15 Jul 2017 17:00:43 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151700.v6FH0hUK051262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 17:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321018 - in stable/10/sys: compat/freebsd32 kern X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 321018 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:00:45 -0000 Author: dchagin Date: Sat Jul 15 17:00:43 2017 New Revision: 321018 URL: https://svnweb.freebsd.org/changeset/base/321018 Log: Regen after r321017. Move the SCTP syscalls to netinet with the rest of the SCTP code. Modified: stable/10/sys/compat/freebsd32/freebsd32_sysent.c stable/10/sys/kern/init_sysent.c Modified: stable/10/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/10/sys/compat/freebsd32/freebsd32_sysent.c Sat Jul 15 16:55:02 2017 (r321017) +++ stable/10/sys/compat/freebsd32/freebsd32_sysent.c Sat Jul 15 17:00:43 2017 (r321018) @@ -517,10 +517,10 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 468 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 469 = __getpath_fromfd */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 470 = __getpath_fromaddr */ - { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 471 = sctp_peeloff */ - { AS(sctp_generic_sendmsg_args), (sy_call_t *)sys_sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 472 = sctp_generic_sendmsg */ - { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sys_sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 473 = sctp_generic_sendmsg_iov */ - { AS(sctp_generic_recvmsg_args), (sy_call_t *)sys_sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 474 = sctp_generic_recvmsg */ + { AS(sctp_peeloff_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 471 = sctp_peeloff */ + { AS(sctp_generic_sendmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 472 = sctp_generic_sendmsg */ + { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 473 = sctp_generic_sendmsg_iov */ + { AS(sctp_generic_recvmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 474 = sctp_generic_recvmsg */ #ifdef PAD64_REQUIRED { AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC }, /* 475 = freebsd32_pread */ { AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 476 = freebsd32_pwrite */ Modified: stable/10/sys/kern/init_sysent.c ============================================================================== --- stable/10/sys/kern/init_sysent.c Sat Jul 15 16:55:02 2017 (r321017) +++ stable/10/sys/kern/init_sysent.c Sat Jul 15 17:00:43 2017 (r321018) @@ -504,10 +504,10 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 468 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 469 = __getpath_fromfd */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 470 = __getpath_fromaddr */ - { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 471 = sctp_peeloff */ - { AS(sctp_generic_sendmsg_args), (sy_call_t *)sys_sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 472 = sctp_generic_sendmsg */ - { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sys_sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 473 = sctp_generic_sendmsg_iov */ - { AS(sctp_generic_recvmsg_args), (sy_call_t *)sys_sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 474 = sctp_generic_recvmsg */ + { AS(sctp_peeloff_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 471 = sctp_peeloff */ + { AS(sctp_generic_sendmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 472 = sctp_generic_sendmsg */ + { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 473 = sctp_generic_sendmsg_iov */ + { AS(sctp_generic_recvmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 474 = sctp_generic_recvmsg */ { AS(pread_args), (sy_call_t *)sys_pread, AUE_PREAD, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 475 = pread */ { AS(pwrite_args), (sy_call_t *)sys_pwrite, AUE_PWRITE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 476 = pwrite */ { AS(mmap_args), (sy_call_t *)sys_mmap, AUE_MMAP, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 477 = mmap */ From owner-svn-src-stable@freebsd.org Sat Jul 15 17:03:37 2017 Return-Path: Delivered-To: svn-src-stable@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 08115AFDCB2; Sat, 15 Jul 2017 17:03:37 +0000 (UTC) (envelope-from dchagin@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 CB03175EA2; Sat, 15 Jul 2017 17:03:36 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FH3a0i052142; Sat, 15 Jul 2017 17:03:36 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FH3aWE052141; Sat, 15 Jul 2017 17:03:36 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151703.v6FH3aWE052141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 17:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321019 - stable/10/sys/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/netinet X-SVN-Commit-Revision: 321019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:03:37 -0000 Author: dchagin Date: Sat Jul 15 17:03:35 2017 New Revision: 321019 URL: https://svnweb.freebsd.org/changeset/base/321019 Log: MFC r284613 (by tuexen@): When using KTRACE, set a variable to the appropriate value and don't leave it initialized at NULL. Modified: stable/10/sys/netinet/sctp_syscalls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_syscalls.c ============================================================================== --- stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:00:43 2017 (r321018) +++ stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:03:35 2017 (r321019) @@ -277,6 +277,10 @@ sys_sctp_generic_sendmsg (td, uap) auio.uio_td = td; auio.uio_offset = 0; /* XXX */ auio.uio_resid = 0; +#ifdef KTRACE + if (KTRPOINT(td, KTR_GENIO)) + ktruio = cloneuio(&auio); +#endif /* KTRACE */ len = auio.uio_resid = uap->mlen; CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, @@ -400,6 +404,10 @@ sys_sctp_generic_sendmsg_iov(td, uap) goto sctp_bad; } } +#ifdef KTRACE + if (KTRPOINT(td, KTR_GENIO)) + ktruio = cloneuio(&auio); +#endif /* KTRACE */ len = auio.uio_resid; CURVNET_SET(so->so_vnet); error = sctp_lower_sosend(so, to, &auio, From owner-svn-src-stable@freebsd.org Sat Jul 15 17:25:42 2017 Return-Path: Delivered-To: svn-src-stable@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 AF7D3AFE8CF; Sat, 15 Jul 2017 17:25:42 +0000 (UTC) (envelope-from dchagin@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 8A0E877C2A; Sat, 15 Jul 2017 17:25:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FHPfKd065313; Sat, 15 Jul 2017 17:25:41 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FHPeF5065300; Sat, 15 Jul 2017 17:25:40 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151725.v6FHPeF5065300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 17:25: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: r321020 - in stable/10/sys: compat/svr4 dev/streams kern netinet ofed/include/linux sys X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: compat/svr4 dev/streams kern netinet ofed/include/linux sys X-SVN-Commit-Revision: 321020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:25:42 -0000 Author: dchagin Date: Sat Jul 15 17:25:40 2017 New Revision: 321020 URL: https://svnweb.freebsd.org/changeset/base/321020 Log: MFC r281436 (by mjg@): fd: remove filedesc argument from fdclose Just accept a thread instead. This makes it consistent with fdalloc. No functional changes. Modified: stable/10/sys/compat/svr4/svr4_stream.c stable/10/sys/dev/streams/streams.c stable/10/sys/kern/kern_descrip.c stable/10/sys/kern/kern_fork.c stable/10/sys/kern/sys_pipe.c stable/10/sys/kern/tty_pts.c stable/10/sys/kern/uipc_mqueue.c stable/10/sys/kern/uipc_sem.c stable/10/sys/kern/uipc_shm.c stable/10/sys/kern/uipc_syscalls.c stable/10/sys/netinet/sctp_syscalls.c stable/10/sys/ofed/include/linux/file.h stable/10/sys/sys/filedesc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/svr4/svr4_stream.c ============================================================================== --- stable/10/sys/compat/svr4/svr4_stream.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/compat/svr4/svr4_stream.c Sat Jul 15 17:25:40 2017 (r321020) @@ -1828,7 +1828,7 @@ svr4_do_getmsg(td, uap, fp) break; default: - fdclose(td->td_proc->p_fd, afp, st->s_afd, td); + fdclose(td, afp, st->s_afd); fdrop(afp, td); st->s_afd = -1; mtx_unlock(&Giant); @@ -1966,7 +1966,7 @@ svr4_do_getmsg(td, uap, fp) if (error) { if (afp) { - fdclose(td->td_proc->p_fd, afp, st->s_afd, td); + fdclose(td, afp, st->s_afd); fdrop(afp, td); st->s_afd = -1; } Modified: stable/10/sys/dev/streams/streams.c ============================================================================== --- stable/10/sys/dev/streams/streams.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/dev/streams/streams.c Sat Jul 15 17:25:40 2017 (r321020) @@ -188,7 +188,6 @@ MODULE_DEPEND(streams, svr4elf, 1, 1, 1); static int streamsopen(struct cdev *dev, int oflags, int devtype, struct thread *td) { - struct filedesc *fdp; struct svr4_strm *st; struct socket *so; struct file *fp; @@ -244,14 +243,13 @@ streamsopen(struct cdev *dev, int oflags, int devtype, return EOPNOTSUPP; } - fdp = td->td_proc->p_fd; if ((error = falloc(td, &fp, &fd, 0)) != 0) return error; /* An extra reference on `fp' has been held for us by falloc(). */ error = socreate(family, &so, type, protocol, td->td_ucred, td); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return error; } Modified: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/kern_descrip.c Sat Jul 15 17:25:40 2017 (r321020) @@ -2184,8 +2184,9 @@ setugidsafety(struct thread *td) * file descriptor out from under the thread creating the file object. */ void -fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td) +fdclose(struct thread *td, struct file *fp, int idx) { + struct filedesc *fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); if (fdp->fd_ofiles[idx].fde_file == fp) { Modified: stable/10/sys/kern/kern_fork.c ============================================================================== --- stable/10/sys/kern/kern_fork.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/kern_fork.c Sat Jul 15 17:25:40 2017 (r321020) @@ -983,7 +983,7 @@ fail2: uma_zfree(proc_zone, newproc); #ifdef PROCDESC if ((flags & RFPROCDESC) != 0 && fp_procdesc != NULL) { - fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td); + fdclose(td, fp_procdesc, *procdescp); fdrop(fp_procdesc, td); } #endif Modified: stable/10/sys/kern/sys_pipe.c ============================================================================== --- stable/10/sys/kern/sys_pipe.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/sys_pipe.c Sat Jul 15 17:25:40 2017 (r321020) @@ -403,13 +403,11 @@ kern_pipe(struct thread *td, int fildes[2]) int kern_pipe2(struct thread *td, int fildes[2], int flags) { - struct filedesc *fdp; struct file *rf, *wf; struct pipe *rpipe, *wpipe; struct pipepair *pp; int fd, fflags, error; - fdp = td->td_proc->p_fd; pipe_paircreate(td, &pp); rpipe = &pp->pp_rpipe; wpipe = &pp->pp_wpipe; @@ -435,7 +433,7 @@ kern_pipe2(struct thread *td, int fildes[2], int flags finit(rf, fflags, DTYPE_PIPE, rpipe, &pipeops); error = falloc(td, &wf, &fd, flags); if (error) { - fdclose(fdp, rf, fildes[0], td); + fdclose(td, rf, fildes[0]); fdrop(rf, td); /* rpipe has been closed by fdrop(). */ pipeclose(wpipe); Modified: stable/10/sys/kern/tty_pts.c ============================================================================== --- stable/10/sys/kern/tty_pts.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/tty_pts.c Sat Jul 15 17:25:40 2017 (r321020) @@ -839,7 +839,7 @@ sys_posix_openpt(struct thread *td, struct posix_openp /* Allocate the actual pseudo-TTY. */ error = pts_alloc(FFLAGS(uap->flags & O_ACCMODE), td, fp); if (error != 0) { - fdclose(td->td_proc->p_fd, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: stable/10/sys/kern/uipc_mqueue.c ============================================================================== --- stable/10/sys/kern/uipc_mqueue.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_mqueue.c Sat Jul 15 17:25:40 2017 (r321020) @@ -2023,7 +2023,7 @@ kern_kmq_open(struct thread *td, const char *upath, in if (error) { sx_xunlock(&mqfs_data.mi_lock); - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: stable/10/sys/kern/uipc_sem.c ============================================================================== --- stable/10/sys/kern/uipc_sem.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_sem.c Sat Jul 15 17:25:40 2017 (r321020) @@ -515,7 +515,7 @@ ksem_create(struct thread *td, const char *name, semid */ error = ksem_create_copyout_semid(td, semidp, fd, compat32); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } @@ -535,7 +535,7 @@ ksem_create(struct thread *td, const char *name, semid if (error == 0 && path[0] != '/') error = EINVAL; if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); free(path, M_KSEM); return (error); @@ -586,7 +586,7 @@ ksem_create(struct thread *td, const char *name, semid if (error) { KASSERT(ks == NULL, ("ksem_create error with a ksem")); - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: stable/10/sys/kern/uipc_shm.c ============================================================================== --- stable/10/sys/kern/uipc_shm.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_shm.c Sat Jul 15 17:25:40 2017 (r321020) @@ -741,7 +741,7 @@ sys_shm_open(struct thread *td, struct shm_open_args * if (uap->path == SHM_ANON) { /* A read-only anonymous object is pointless. */ if ((uap->flags & O_ACCMODE) == O_RDONLY) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (EINVAL); } @@ -757,7 +757,7 @@ sys_shm_open(struct thread *td, struct shm_open_args * if (error == 0 && path[0] != '/') error = EINVAL; if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); free(path, M_SHMFD); return (error); @@ -823,7 +823,7 @@ sys_shm_open(struct thread *td, struct shm_open_args * sx_xunlock(&shm_dict_lock); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td, fp, fd); fdrop(fp, td); return (error); } Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 17:25:40 2017 (r321020) @@ -216,7 +216,7 @@ sys_socket(td, uap) error = socreate(uap->domain, &so, type, uap->protocol, td->td_ucred, td); if (error != 0) { - fdclose(td->td_proc->p_fd, fp, fd, td); + fdclose(td, fp, fd); } else { finit(fp, FREAD | FWRITE | fflag, DTYPE_SOCKET, so, &socketops); if ((fflag & FNONBLOCK) != 0) @@ -386,7 +386,7 @@ accept1(td, s, uname, anamelen, flags) error = copyout(&namelen, anamelen, sizeof(namelen)); if (error != 0) - fdclose(td->td_proc->p_fd, fp, td->td_retval[0], td); + fdclose(td, fp, td->td_retval[0]); fdrop(fp, td); free(name, M_SONAME); return (error); @@ -540,7 +540,7 @@ noconnection: * out from under us. */ if (error != 0) - fdclose(fdp, nfp, fd, td); + fdclose(td, nfp, fd); /* * Release explicitly held references before returning. We return @@ -710,7 +710,6 @@ int kern_socketpair(struct thread *td, int domain, int type, int protocol, int *rsv) { - struct filedesc *fdp = td->td_proc->p_fd; struct file *fp1, *fp2; struct socket *so1, *so2; int fd, error, oflag, fflag; @@ -774,10 +773,10 @@ kern_socketpair(struct thread *td, int domain, int typ fdrop(fp2, td); return (0); free4: - fdclose(fdp, fp2, rsv[1], td); + fdclose(td, fp2, rsv[1]); fdrop(fp2, td); free3: - fdclose(fdp, fp1, rsv[0], td); + fdclose(td, fp1, rsv[0]); fdrop(fp1, td); free2: if (so2 != NULL) Modified: stable/10/sys/netinet/sctp_syscalls.c ============================================================================== --- stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:25:40 2017 (r321020) @@ -187,7 +187,7 @@ noconnection: * out from under us. */ if (error != 0) - fdclose(td->td_proc->p_fd, nfp, fd, td); + fdclose(td, nfp, fd); /* * Release explicitly held references before returning. Modified: stable/10/sys/ofed/include/linux/file.h ============================================================================== --- stable/10/sys/ofed/include/linux/file.h Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/ofed/include/linux/file.h Sat Jul 15 17:25:40 2017 (r321020) @@ -82,7 +82,7 @@ put_unused_fd(unsigned int fd) * installed, so no need to free the associated Linux file * structure. */ - fdclose(curthread->td_proc->p_fd, file, fd, curthread); + fdclose(curthread, file, fd); /* drop extra reference */ fdrop(file, curthread); Modified: stable/10/sys/sys/filedesc.h ============================================================================== --- stable/10/sys/sys/filedesc.h Sat Jul 15 17:03:35 2017 (r321019) +++ stable/10/sys/sys/filedesc.h Sat Jul 15 17:25:40 2017 (r321020) @@ -154,7 +154,7 @@ int fdalloc(struct thread *td, int minfd, int *result) int fdallocn(struct thread *td, int minfd, int *fds, int n); int fdavail(struct thread *td, int n); int fdcheckstd(struct thread *td); -void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); +void fdclose(struct thread *td, struct file *fp, int idx); void fdcloseexec(struct thread *td); struct filedesc *fdcopy(struct filedesc *fdp); void fdunshare(struct thread *td); From owner-svn-src-stable@freebsd.org Sat Jul 15 17:28:04 2017 Return-Path: Delivered-To: svn-src-stable@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 A3CBEAFE953; Sat, 15 Jul 2017 17:28:04 +0000 (UTC) (envelope-from dchagin@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 78CF37C8AE; Sat, 15 Jul 2017 17:28:04 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FHS37r065454; Sat, 15 Jul 2017 17:28:03 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FHS3nc065451; Sat, 15 Jul 2017 17:28:03 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151728.v6FHS3nc065451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 17:28:03 +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: r321021 - in stable/10/sys: kern netinet sys X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: kern netinet sys X-SVN-Commit-Revision: 321021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:28:04 -0000 Author: dchagin Date: Sat Jul 15 17:28:03 2017 New Revision: 321021 URL: https://svnweb.freebsd.org/changeset/base/321021 Log: MFC r281437 (by mjg@): Replace struct filedesc argument in getsock_cap with struct thread This is is a step towards removal of spurious arguments. Modified: stable/10/sys/kern/uipc_syscalls.c stable/10/sys/netinet/sctp_syscalls.c stable/10/sys/sys/socketvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 17:25:40 2017 (r321020) +++ stable/10/sys/kern/uipc_syscalls.c Sat Jul 15 17:28:03 2017 (r321021) @@ -150,17 +150,17 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQU * A reference on the file entry is held upon returning. */ int -getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp, +getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp, u_int *fflagp) { struct file *fp; int error; - error = fget_unlocked(fdp, fd, rightsp, 0, &fp, NULL); + error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, 0, &fp, NULL); if (error != 0) return (error); if (fp->f_type != DTYPE_SOCKET) { - fdrop(fp, curthread); + fdrop(fp, td); return (ENOTSOCK); } if (fflagp != NULL) @@ -258,8 +258,8 @@ kern_bindat(struct thread *td, int dirfd, int fd, stru AUDIT_ARG_FD(fd); AUDIT_ARG_SOCKADDR(td, dirfd, sa); - error = getsock_cap(td->td_proc->p_fd, fd, - cap_rights_init(&rights, CAP_BIND), &fp, NULL); + error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_BIND), + &fp, NULL); if (error != 0) return (error); so = fp->f_data; @@ -326,8 +326,8 @@ sys_listen(td, uap) int error; AUDIT_ARG_FD(uap->s); - error = getsock_cap(td->td_proc->p_fd, uap->s, - cap_rights_init(&rights, CAP_LISTEN), &fp, NULL); + error = getsock_cap(td, uap->s, cap_rights_init(&rights, CAP_LISTEN), + &fp, NULL); if (error == 0) { so = fp->f_data; #ifdef MAC @@ -403,7 +403,6 @@ int kern_accept4(struct thread *td, int s, struct sockaddr **name, socklen_t *namelen, int flags, struct file **fp) { - struct filedesc *fdp; struct file *headfp, *nfp = NULL; struct sockaddr *sa = NULL; struct socket *head, *so; @@ -416,8 +415,7 @@ kern_accept4(struct thread *td, int s, struct sockaddr *name = NULL; AUDIT_ARG_FD(s); - fdp = td->td_proc->p_fd; - error = getsock_cap(fdp, s, cap_rights_init(&rights, CAP_ACCEPT), + error = getsock_cap(td, s, cap_rights_init(&rights, CAP_ACCEPT), &headfp, &fflag); if (error != 0) return (error); @@ -624,8 +622,8 @@ kern_connectat(struct thread *td, int dirfd, int fd, s AUDIT_ARG_FD(fd); AUDIT_ARG_SOCKADDR(td, dirfd, sa); - error = getsock_cap(td->td_proc->p_fd, fd, - cap_rights_init(&rights, CAP_CONNECT), &fp, NULL); + error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_CONNECT), + &fp, NULL); if (error != 0) return (error); so = fp->f_data; @@ -892,7 +890,7 @@ kern_sendit(td, s, mp, flags, control, segflg) AUDIT_ARG_SOCKADDR(td, AT_FDCWD, mp->msg_name); cap_rights_set(&rights, CAP_CONNECT); } - error = getsock_cap(td->td_proc->p_fd, s, &rights, &fp, NULL); + error = getsock_cap(td, s, &rights, &fp, NULL); if (error != 0) return (error); so = (struct socket *)fp->f_data; @@ -1092,8 +1090,8 @@ kern_recvit(td, s, mp, fromseg, controlp) *controlp = NULL; AUDIT_ARG_FD(s); - error = getsock_cap(td->td_proc->p_fd, s, - cap_rights_init(&rights, CAP_RECV), &fp, NULL); + error = getsock_cap(td, s, cap_rights_init(&rights, CAP_RECV), + &fp, NULL); if (error != 0) return (error); so = fp->f_data; @@ -1407,8 +1405,8 @@ sys_shutdown(td, uap) int error; AUDIT_ARG_FD(uap->s); - error = getsock_cap(td->td_proc->p_fd, uap->s, - cap_rights_init(&rights, CAP_SHUTDOWN), &fp, NULL); + error = getsock_cap(td, uap->s, cap_rights_init(&rights, CAP_SHUTDOWN), + &fp, NULL); if (error == 0) { so = fp->f_data; error = soshutdown(so, uap->how); @@ -1472,8 +1470,8 @@ kern_setsockopt(td, s, level, name, val, valseg, valsi } AUDIT_ARG_FD(s); - error = getsock_cap(td->td_proc->p_fd, s, - cap_rights_init(&rights, CAP_SETSOCKOPT), &fp, NULL); + error = getsock_cap(td, s, cap_rights_init(&rights, CAP_SETSOCKOPT), + &fp, NULL); if (error == 0) { so = fp->f_data; error = sosetopt(so, &sopt); @@ -1553,8 +1551,8 @@ kern_getsockopt(td, s, level, name, val, valseg, valsi } AUDIT_ARG_FD(s); - error = getsock_cap(td->td_proc->p_fd, s, - cap_rights_init(&rights, CAP_GETSOCKOPT), &fp, NULL); + error = getsock_cap(td, s, cap_rights_init(&rights, CAP_GETSOCKOPT), + &fp, NULL); if (error == 0) { so = fp->f_data; error = sogetopt(so, &sopt); @@ -1614,8 +1612,8 @@ kern_getsockname(struct thread *td, int fd, struct soc int error; AUDIT_ARG_FD(fd); - error = getsock_cap(td->td_proc->p_fd, fd, - cap_rights_init(&rights, CAP_GETSOCKNAME), &fp, NULL); + error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_GETSOCKNAME), + &fp, NULL); if (error != 0) return (error); so = fp->f_data; @@ -1713,8 +1711,8 @@ kern_getpeername(struct thread *td, int fd, struct soc int error; AUDIT_ARG_FD(fd); - error = getsock_cap(td->td_proc->p_fd, fd, - cap_rights_init(&rights, CAP_GETPEERNAME), &fp, NULL); + error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_GETPEERNAME), + &fp, NULL); if (error != 0) return (error); so = fp->f_data; @@ -2154,8 +2152,8 @@ kern_sendfile_getsock(struct thread *td, int s, struct /* * The socket must be a stream socket and connected. */ - error = getsock_cap(td->td_proc->p_fd, s, cap_rights_init(&rights, - CAP_SEND), sock_fp, NULL); + error = getsock_cap(td, s, cap_rights_init(&rights, CAP_SEND), + sock_fp, NULL); if (error != 0) return (error); *so = (*sock_fp)->f_data; Modified: stable/10/sys/netinet/sctp_syscalls.c ============================================================================== --- stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:25:40 2017 (r321020) +++ stable/10/sys/netinet/sctp_syscalls.c Sat Jul 15 17:28:03 2017 (r321021) @@ -248,7 +248,7 @@ sys_sctp_generic_sendmsg (td, uap) } AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); + error = getsock_cap(td, uap->sd, &rights, &fp, NULL); if (error != 0) goto sctp_bad; #ifdef KTRACE @@ -361,7 +361,7 @@ sys_sctp_generic_sendmsg_iov(td, uap) } AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); + error = getsock_cap(td, uap->sd, &rights, &fp, NULL); if (error != 0) goto sctp_bad1; @@ -476,8 +476,8 @@ sys_sctp_generic_recvmsg(td, uap) int error, fromlen, i, msg_flags; AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, - cap_rights_init(&rights, CAP_RECV), &fp, NULL); + error = getsock_cap(td, uap->sd, cap_rights_init(&rights, CAP_RECV), + &fp, NULL); if (error != 0) return (error); #ifdef COMPAT_FREEBSD32 Modified: stable/10/sys/sys/socketvar.h ============================================================================== --- stable/10/sys/sys/socketvar.h Sat Jul 15 17:25:40 2017 (r321020) +++ stable/10/sys/sys/socketvar.h Sat Jul 15 17:28:03 2017 (r321021) @@ -317,7 +317,7 @@ struct uio; */ int sockargs(struct mbuf **mp, caddr_t buf, int buflen, int type); int getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len); -int getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp, +int getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp, u_int *fflagp); void soabort(struct socket *so); int soaccept(struct socket *so, struct sockaddr **nam); From owner-svn-src-stable@freebsd.org Sat Jul 15 17:44:30 2017 Return-Path: Delivered-To: svn-src-stable@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 D8ADCAFED58; Sat, 15 Jul 2017 17:44:30 +0000 (UTC) (envelope-from dchagin@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 A55187D452; Sat, 15 Jul 2017 17:44:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FHiT6U073497; Sat, 15 Jul 2017 17:44:29 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FHiTI9073496; Sat, 15 Jul 2017 17:44:29 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151744.v6FHiTI9073496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 17:44:29 +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: r321022 - stable/10/sys/compat/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/compat/linux X-SVN-Commit-Revision: 321022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 17:44:31 -0000 Author: dchagin Date: Sat Jul 15 17:44:29 2017 New Revision: 321022 URL: https://svnweb.freebsd.org/changeset/base/321022 Log: MFC r296503: Linux accept() system call return EOPNOTSUPP errno instead of EINVAL for UDP sockets. MFC r296504: Does not leak fp. While here remove bogus cast of fp->f_data. MFC r313913: Initialize cap_rights before use. Modified: stable/10/sys/compat/linux/linux_socket.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_socket.c ============================================================================== --- stable/10/sys/compat/linux/linux_socket.c Sat Jul 15 17:28:03 2017 (r321021) +++ stable/10/sys/compat/linux/linux_socket.c Sat Jul 15 17:44:29 2017 (r321022) @@ -836,7 +836,10 @@ linux_accept_common(struct thread *td, int s, l_uintpt socklen_t * __restrict anamelen; int flags; } */ bsd_args; - int error; + cap_rights_t rights; + struct socket *so; + struct file *fp; + int error, error1; bsd_args.s = s; /* XXX: */ @@ -851,6 +854,18 @@ linux_accept_common(struct thread *td, int s, l_uintpt if (error) { if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) return (EINVAL); + if (error == EINVAL) { + error1 = getsock_cap(td, s, + cap_rights_init(&rights, CAP_ACCEPT), &fp, NULL); + if (error1 != 0) + return (error1); + so = fp->f_data; + if (so->so_type == SOCK_DGRAM) { + fdrop(fp, td); + return (EOPNOTSUPP); + } + fdrop(fp, td); + } return (error); } if (addr) From owner-svn-src-stable@freebsd.org Sat Jul 15 18:05:29 2017 Return-Path: Delivered-To: svn-src-stable@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 C2F5BAFF1AB; Sat, 15 Jul 2017 18:05:29 +0000 (UTC) (envelope-from dchagin@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 8B4167DCDB; Sat, 15 Jul 2017 18:05:29 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FI5SMM081526; Sat, 15 Jul 2017 18:05:28 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FI5SgC081522; Sat, 15 Jul 2017 18:05:28 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151805.v6FI5SgC081522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 18:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321024 - in stable/10/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 321024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 18:05:29 -0000 Author: dchagin Date: Sat Jul 15 18:05:28 2017 New Revision: 321024 URL: https://svnweb.freebsd.org/changeset/base/321024 Log: MFC r297597 (by bapt@): Add kern.features flags for linux and linux64 modules kern.features.linux: 1 meaning linux 32 bits binaries are supported kern.features.linux64: 1 meaning linux 64 bits binaries are supported The goal here is to help 3rd party applications (including ports) to determine if the host do support linux emulation Relnotes: yes Modified: stable/10/sys/amd64/linux/linux_sysvec.c stable/10/sys/amd64/linux32/linux32_sysvec.c stable/10/sys/i386/linux/linux_sysvec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux/linux_sysvec.c Sat Jul 15 17:59:28 2017 (r321023) +++ stable/10/sys/amd64/linux/linux_sysvec.c Sat Jul 15 18:05:28 2017 (r321024) @@ -990,3 +990,4 @@ static moduledata_t linux64_elf_mod = { DECLARE_MODULE_TIED(linux64elf, linux64_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(linux64elf, linux_common, 1, 1, 1); +FEATURE(linux64, "Linux 64bit support"); Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux32/linux32_sysvec.c Sat Jul 15 17:59:28 2017 (r321023) +++ stable/10/sys/amd64/linux32/linux32_sysvec.c Sat Jul 15 18:05:28 2017 (r321024) @@ -1208,3 +1208,4 @@ static moduledata_t linux_elf_mod = { DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(linuxelf, linux_common, 1, 1, 1); +FEATURE(linux, "Linux 32bit support"); Modified: stable/10/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/i386/linux/linux_sysvec.c Sat Jul 15 17:59:28 2017 (r321023) +++ stable/10/sys/i386/linux/linux_sysvec.c Sat Jul 15 18:05:28 2017 (r321024) @@ -1203,3 +1203,4 @@ static moduledata_t linux_elf_mod = { }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +FEATURE(linux, "Linux 32bit support"); From owner-svn-src-stable@freebsd.org Sat Jul 15 18:08:21 2017 Return-Path: Delivered-To: svn-src-stable@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 89548AFF25A; Sat, 15 Jul 2017 18:08:21 +0000 (UTC) (envelope-from dchagin@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 507D77DE4B; Sat, 15 Jul 2017 18:08:21 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FI8K5O081758; Sat, 15 Jul 2017 18:08:20 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FI8KcS081757; Sat, 15 Jul 2017 18:08:20 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151808.v6FI8KcS081757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 18:08:20 +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: r321025 - stable/10/sys/compat/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/10/sys/compat/linux X-SVN-Commit-Revision: 321025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 18:08:21 -0000 Author: dchagin Date: Sat Jul 15 18:08:20 2017 New Revision: 321025 URL: https://svnweb.freebsd.org/changeset/base/321025 Log: MFC r298071 (by pfg@): compat/linux: for pointers replace 0 with NULL. plvc is a pointer, no functional change. Found with devel/coccinelle. Modified: stable/10/sys/compat/linux/linux_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/10/sys/compat/linux/linux_ioctl.c Sat Jul 15 18:05:28 2017 (r321024) +++ stable/10/sys/compat/linux/linux_ioctl.c Sat Jul 15 18:08:20 2017 (r321025) @@ -2912,7 +2912,7 @@ linux_v4l_cliplist_copy(struct l_video_window *lvw, st vw->clips = NULL; ppvc = &(vw->clips); while (clipcount-- > 0) { - if (plvc == 0) { + if (plvc == NULL) { error = EFAULT; break; } else { From owner-svn-src-stable@freebsd.org Sat Jul 15 18:26:01 2017 Return-Path: Delivered-To: svn-src-stable@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 324E1AFF9A7; Sat, 15 Jul 2017 18:26:01 +0000 (UTC) (envelope-from dchagin@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 F2B897E6EC; Sat, 15 Jul 2017 18:26:00 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FIQ0rv089507; Sat, 15 Jul 2017 18:26:00 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FIQ088089501; Sat, 15 Jul 2017 18:26:00 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707151826.v6FIQ088089501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 15 Jul 2017 18:25: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: r321026 - in stable/10/sys: amd64/linux compat/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/10/sys: amd64/linux compat/linux X-SVN-Commit-Revision: 321026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 18:26:01 -0000 Author: dchagin Date: Sat Jul 15 18:25:59 2017 New Revision: 321026 URL: https://svnweb.freebsd.org/changeset/base/321026 Log: MFC r305994 (by emaste@): Catch up to sys/capability.h rename to sys/capsicum.h in r263232 Modified: stable/10/sys/amd64/linux/linux_machdep.c stable/10/sys/compat/linux/linux_event.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_machdep.c ============================================================================== --- stable/10/sys/amd64/linux/linux_machdep.c Sat Jul 15 18:08:20 2017 (r321025) +++ stable/10/sys/amd64/linux/linux_machdep.c Sat Jul 15 18:25:59 2017 (r321026) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: stable/10/sys/compat/linux/linux_event.c ============================================================================== --- stable/10/sys/compat/linux/linux_event.c Sat Jul 15 18:08:20 2017 (r321025) +++ stable/10/sys/compat/linux/linux_event.c Sat Jul 15 18:25:59 2017 (r321026) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include From owner-svn-src-stable@freebsd.org Sat Jul 15 19:18:39 2017 Return-Path: Delivered-To: svn-src-stable@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 15649B79F2C; Sat, 15 Jul 2017 19:18:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E310E819A8; Sat, 15 Jul 2017 19:18:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FJIcXL014492; Sat, 15 Jul 2017 19:18:38 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FJIb9p014487; Sat, 15 Jul 2017 19:18:37 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707151918.v6FJIb9p014487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 15 Jul 2017 19:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321029 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/11/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 321029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 19:18:39 -0000 Author: rmacklem Date: Sat Jul 15 19:18:37 2017 New Revision: 321029 URL: https://svnweb.freebsd.org/changeset/base/321029 Log: MFC: r320345 Add support to the NFSv4.1/pNFS client for commits through the DS. A NFSv4.1/pNFS server using File Layout can specify that Commit operations are to be done against the DS instead of MDS. Since no extant pNFS server did this, the code was untested and "#ifdef notyet". The FreeBSD pNFS server I am developing does specify that Commits be done through the DS, so the code has been enabled/tested. This patch should only affect the case of a pNFS server that specfies Commits through the DS. Relnotes: yes Modified: stable/11/sys/fs/nfs/nfs_var.h stable/11/sys/fs/nfsclient/nfs_clnode.c stable/11/sys/fs/nfsclient/nfs_clrpcops.c stable/11/sys/fs/nfsclient/nfs_clvnops.c stable/11/sys/fs/nfsclient/nfsnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/11/sys/fs/nfs/nfs_var.h Sat Jul 15 18:44:03 2017 (r321028) +++ stable/11/sys/fs/nfs/nfs_var.h Sat Jul 15 19:18:37 2017 (r321029) @@ -490,7 +490,7 @@ int nfsrpc_layoutreturn(struct nfsmount *, uint8_t *, int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *, NFSPROC_T *, void *); int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *); -int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, +int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int, struct ucred *, NFSPROC_T *); int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t, struct nfsclflayout **); Modified: stable/11/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clnode.c Sat Jul 15 18:44:03 2017 (r321028) +++ stable/11/sys/fs/nfsclient/nfs_clnode.c Sat Jul 15 19:18:37 2017 (r321029) @@ -259,10 +259,12 @@ ncl_inactive(struct vop_inactive_args *ap) /* * NMODIFIED means that there might be dirty/stale buffers - * associated with the NFS vnode. None of the other flags are - * meaningful after the vnode is unused. + * associated with the NFS vnode. + * NDSCOMMIT means that the file is on a pNFS server and commits + * should be done to the DS. + * None of the other flags are meaningful after the vnode is unused. */ - np->n_flag &= NMODIFIED; + np->n_flag &= (NMODIFIED | NDSCOMMIT); mtx_unlock(&np->n_mtx); return (0); } Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 15 18:44:03 2017 (r321028) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 15 19:18:37 2017 (r321029) @@ -114,7 +114,8 @@ static int nfsrpc_fillsa(struct nfsmount *, struct soc static void nfscl_initsessionslots(struct nfsclsession *); static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *, nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *, - struct nfsclflayout *, uint64_t, uint64_t, struct ucred *, NFSPROC_T *); + struct nfsclflayout *, uint64_t, uint64_t, int, struct ucred *, + NFSPROC_T *); static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *, struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *, NFSPROC_T *); @@ -123,10 +124,8 @@ static int nfsrpc_writeds(vnode_t, struct uio *, int * struct nfsfh *, int, struct ucred *, NFSPROC_T *); static enum nfsclds_state nfscl_getsameserver(struct nfsmount *, struct nfsclds *, struct nfsclds **); -#ifdef notyet static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *, - struct nfsfh *, struct ucred *, NFSPROC_T *, void *); -#endif + struct nfsfh *, struct ucred *, NFSPROC_T *); static void nfsrv_setuplayoutget(struct nfsrv_descript *, int, uint64_t, uint64_t, uint64_t, nfsv4stateid_t *, int, int); static int nfsrv_parselayoutget(struct nfsrv_descript *, nfsv4stateid_t *, @@ -5429,7 +5428,7 @@ nfscl_initsessionslots(struct nfsclsession *sep) */ int nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, - uint32_t rwaccess, struct ucred *cred, NFSPROC_T *p) + uint32_t rwaccess, int docommit, struct ucred *cred, NFSPROC_T *p) { struct nfsnode *np = VTONFS(vp); struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); @@ -5513,7 +5512,8 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode if (dip != NULL) { error = nfscl_doflayoutio(vp, uiop, iomode, must_commit, &eof, &stateid, rwaccess, dip, - layp, rflp, off, xfer, newcred, p); + layp, rflp, off, xfer, docommit, newcred, + p); nfscl_reldevinfo(dip); lastbyte = off + xfer - 1; if (error == 0) { @@ -5589,10 +5589,10 @@ static int nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, int *eofp, nfsv4stateid_t *stateidp, int rwflag, struct nfscldevinfo *dp, struct nfscllayout *lyp, struct nfsclflayout *flp, uint64_t off, - uint64_t len, struct ucred *cred, NFSPROC_T *p) + uint64_t len, int docommit, struct ucred *cred, NFSPROC_T *p) { uint64_t io_off, rel_off, stripe_unit_size, transfer, xfer; - int commit_thru_mds, error = 0, stripe_index, stripe_pos; + int commit_thru_mds, error, stripe_index, stripe_pos; struct nfsnode *np; struct nfsfh *fhp; struct nfsclds **dspp; @@ -5603,12 +5603,13 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) % dp->nfsdi_stripecnt; transfer = stripe_unit_size - (rel_off % stripe_unit_size); + error = 0; /* Loop around, doing I/O for each stripe unit. */ while (len > 0 && error == 0) { stripe_index = nfsfldi_stripeindex(dp, stripe_pos); dspp = nfsfldi_addr(dp, stripe_index); - if (len > transfer) + if (len > transfer && docommit == 0) xfer = transfer; else xfer = len; @@ -5632,11 +5633,33 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i fhp = np->n_fhp; io_off = off; } - if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) + if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) { commit_thru_mds = 1; - else + if (docommit != 0) + error = EIO; + } else { commit_thru_mds = 0; - if (rwflag == FREAD) + mtx_lock(&np->n_mtx); + np->n_flag |= NDSCOMMIT; + mtx_unlock(&np->n_mtx); + } + if (docommit != 0) { + if (error == 0) + error = nfsrpc_commitds(vp, io_off, xfer, + *dspp, fhp, cred, p); + if (error == 0) { + /* + * Set both eof and uio_resid = 0 to end any + * loops. + */ + *eofp = 1; + uiop->uio_resid = 0; + } else { + mtx_lock(&np->n_mtx); + np->n_flag &= ~NDSCOMMIT; + mtx_unlock(&np->n_mtx); + } + } else if (rwflag == FREAD) error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp, io_off, xfer, fhp, cred, p); else { @@ -5872,13 +5895,12 @@ nfscl_getsameserver(struct nfsmount *nmp, struct nfscl return (NFSDSP_NOTFOUND); } -#ifdef notyet /* - * NFS commit rpc to a DS. + * NFS commit rpc to a NFSv4.1 DS. */ static int nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, - struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p, void *stuff) + struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p) { uint32_t *tl; struct nfsrv_descript nfsd, *nd = &nfsd; @@ -5886,6 +5908,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfssockreq *nrp; int error; + nd->nd_mrep = NULL; nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); @@ -5898,7 +5921,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, nrp = &nmp->nm_sockreq; error = newnfs_request(nd, nmp, NULL, nrp, vp, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); - if (error) + if (error != 0) return (error); if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF); @@ -5915,7 +5938,6 @@ nfsmout: mbuf_freem(nd->nd_mrep); return (error); } -#endif /* * Set up the XDR arguments for the LayoutGet operation. Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 15 18:44:03 2017 (r321028) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 15 19:18:37 2017 (r321029) @@ -1369,7 +1369,7 @@ ncl_readrpc(struct vnode *vp, struct uio *uiop, struct attrflag = 0; if (NFSHASPNFS(nmp)) error = nfscl_doiods(vp, uiop, NULL, NULL, - NFSV4OPEN_ACCESSREAD, cred, uiop->uio_td); + NFSV4OPEN_ACCESSREAD, 0, cred, uiop->uio_td); NFSCL_DEBUG(4, "readrpc: aft doiods=%d\n", error); if (error != 0) error = nfsrpc_read(vp, uiop, cred, uiop->uio_td, &nfsva, @@ -1400,7 +1400,7 @@ ncl_writerpc(struct vnode *vp, struct uio *uiop, struc attrflag = 0; if (NFSHASPNFS(nmp)) error = nfscl_doiods(vp, uiop, iomode, must_commit, - NFSV4OPEN_ACCESSWRITE, cred, uiop->uio_td); + NFSV4OPEN_ACCESSWRITE, 0, cred, uiop->uio_td); NFSCL_DEBUG(4, "writerpc: aft doiods=%d\n", error); if (error != 0) error = nfsrpc_write(vp, uiop, iomode, must_commit, cred, @@ -2557,16 +2557,34 @@ ncl_commit(struct vnode *vp, u_quad_t offset, int cnt, { struct nfsvattr nfsva; struct nfsmount *nmp = VFSTONFS(vp->v_mount); + struct nfsnode *np; + struct uio uio; int error, attrflag; - mtx_lock(&nmp->nm_mtx); - if ((nmp->nm_state & NFSSTA_HASWRITEVERF) == 0) { + np = VTONFS(vp); + error = EIO; + attrflag = 0; + if (NFSHASPNFS(nmp) && (np->n_flag & NDSCOMMIT) != 0) { + uio.uio_offset = offset; + uio.uio_resid = cnt; + error = nfscl_doiods(vp, &uio, NULL, NULL, + NFSV4OPEN_ACCESSWRITE, 1, cred, td); + if (error != 0) { + mtx_lock(&np->n_mtx); + np->n_flag &= ~NDSCOMMIT; + mtx_unlock(&np->n_mtx); + } + } + if (error != 0) { + mtx_lock(&nmp->nm_mtx); + if ((nmp->nm_state & NFSSTA_HASWRITEVERF) == 0) { + mtx_unlock(&nmp->nm_mtx); + return (0); + } mtx_unlock(&nmp->nm_mtx); - return (0); + error = nfsrpc_commit(vp, offset, cnt, cred, td, &nfsva, + &attrflag, NULL); } - mtx_unlock(&nmp->nm_mtx); - error = nfsrpc_commit(vp, offset, cnt, cred, td, &nfsva, - &attrflag, NULL); if (attrflag != 0) (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); Modified: stable/11/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/11/sys/fs/nfsclient/nfsnode.h Sat Jul 15 18:44:03 2017 (r321028) +++ stable/11/sys/fs/nfsclient/nfsnode.h Sat Jul 15 19:18:37 2017 (r321029) @@ -158,6 +158,7 @@ struct nfsnode { #define NNOLAYOUT 0x00020000 /* Can't get a layout for this file */ #define NWRITEOPENED 0x00040000 /* Has been opened for writing */ #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ +#define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ /* * Convert between nfsnode pointers and vnode pointers From owner-svn-src-stable@freebsd.org Sat Jul 15 19:24:56 2017 Return-Path: Delivered-To: svn-src-stable@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 288AFB7A42E; Sat, 15 Jul 2017 19:24:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF5D882015; Sat, 15 Jul 2017 19:24:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FJOsoq018612; Sat, 15 Jul 2017 19:24:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FJOsAM018607; Sat, 15 Jul 2017 19:24:54 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707151924.v6FJOsAM018607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 15 Jul 2017 19:24:54 +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: r321031 - in stable/10/sys/fs: nfs nfsclient X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/10/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 321031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 19:24:56 -0000 Author: rmacklem Date: Sat Jul 15 19:24:54 2017 New Revision: 321031 URL: https://svnweb.freebsd.org/changeset/base/321031 Log: MFC: r320345 Add support to the NFSv4.1/pNFS client for commits through the DS. A NFSv4.1/pNFS server using File Layout can specify that Commit operations are to be done against the DS instead of MDS. Since no extant pNFS server did this, the code was untested and "#ifdef notyet". The FreeBSD pNFS server I am developing does specify that Commits be done through the DS, so the code has been enabled/tested. This patch should only affect the case of a pNFS server that specfies Commits through the DS. Relnotes: yes Modified: stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfsclient/nfs_clnode.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c stable/10/sys/fs/nfsclient/nfs_clvnops.c stable/10/sys/fs/nfsclient/nfsnode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/10/sys/fs/nfs/nfs_var.h Sat Jul 15 19:22:01 2017 (r321030) +++ stable/10/sys/fs/nfs/nfs_var.h Sat Jul 15 19:24:54 2017 (r321031) @@ -490,7 +490,7 @@ int nfsrpc_layoutreturn(struct nfsmount *, uint8_t *, int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *, NFSPROC_T *, void *); int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *); -int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, +int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int, struct ucred *, NFSPROC_T *); int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t, struct nfsclflayout **); Modified: stable/10/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clnode.c Sat Jul 15 19:22:01 2017 (r321030) +++ stable/10/sys/fs/nfsclient/nfs_clnode.c Sat Jul 15 19:24:54 2017 (r321031) @@ -261,10 +261,12 @@ ncl_inactive(struct vop_inactive_args *ap) /* * NMODIFIED means that there might be dirty/stale buffers - * associated with the NFS vnode. None of the other flags are - * meaningful after the vnode is unused. + * associated with the NFS vnode. + * NDSCOMMIT means that the file is on a pNFS server and commits + * should be done to the DS. + * None of the other flags are meaningful after the vnode is unused. */ - np->n_flag &= NMODIFIED; + np->n_flag &= (NMODIFIED | NDSCOMMIT); mtx_unlock(&np->n_mtx); return (0); } Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 15 19:22:01 2017 (r321030) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 15 19:24:54 2017 (r321031) @@ -114,7 +114,8 @@ static int nfsrpc_fillsa(struct nfsmount *, struct soc static void nfscl_initsessionslots(struct nfsclsession *); static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *, nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *, - struct nfsclflayout *, uint64_t, uint64_t, struct ucred *, NFSPROC_T *); + struct nfsclflayout *, uint64_t, uint64_t, int, struct ucred *, + NFSPROC_T *); static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *, struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *, NFSPROC_T *); @@ -123,10 +124,8 @@ static int nfsrpc_writeds(vnode_t, struct uio *, int * struct nfsfh *, int, struct ucred *, NFSPROC_T *); static enum nfsclds_state nfscl_getsameserver(struct nfsmount *, struct nfsclds *, struct nfsclds **); -#ifdef notyet static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *, - struct nfsfh *, struct ucred *, NFSPROC_T *, void *); -#endif + struct nfsfh *, struct ucred *, NFSPROC_T *); /* * nfs null call from vfs. @@ -5531,7 +5530,7 @@ nfscl_initsessionslots(struct nfsclsession *sep) */ int nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, - uint32_t rwaccess, struct ucred *cred, NFSPROC_T *p) + uint32_t rwaccess, int docommit, struct ucred *cred, NFSPROC_T *p) { struct nfsnode *np = VTONFS(vp); struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); @@ -5615,7 +5614,8 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode if (dip != NULL) { error = nfscl_doflayoutio(vp, uiop, iomode, must_commit, &eof, &stateid, rwaccess, dip, - layp, rflp, off, xfer, newcred, p); + layp, rflp, off, xfer, docommit, newcred, + p); nfscl_reldevinfo(dip); lastbyte = off + xfer - 1; if (error == 0) { @@ -5691,10 +5691,10 @@ static int nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, int *eofp, nfsv4stateid_t *stateidp, int rwflag, struct nfscldevinfo *dp, struct nfscllayout *lyp, struct nfsclflayout *flp, uint64_t off, - uint64_t len, struct ucred *cred, NFSPROC_T *p) + uint64_t len, int docommit, struct ucred *cred, NFSPROC_T *p) { uint64_t io_off, rel_off, stripe_unit_size, transfer, xfer; - int commit_thru_mds, error = 0, stripe_index, stripe_pos; + int commit_thru_mds, error, stripe_index, stripe_pos; struct nfsnode *np; struct nfsfh *fhp; struct nfsclds **dspp; @@ -5705,12 +5705,13 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) % dp->nfsdi_stripecnt; transfer = stripe_unit_size - (rel_off % stripe_unit_size); + error = 0; /* Loop around, doing I/O for each stripe unit. */ while (len > 0 && error == 0) { stripe_index = nfsfldi_stripeindex(dp, stripe_pos); dspp = nfsfldi_addr(dp, stripe_index); - if (len > transfer) + if (len > transfer && docommit == 0) xfer = transfer; else xfer = len; @@ -5734,11 +5735,33 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i fhp = np->n_fhp; io_off = off; } - if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) + if ((flp->nfsfl_util & NFSFLAYUTIL_COMMIT_THRU_MDS) != 0) { commit_thru_mds = 1; - else + if (docommit != 0) + error = EIO; + } else { commit_thru_mds = 0; - if (rwflag == FREAD) + mtx_lock(&np->n_mtx); + np->n_flag |= NDSCOMMIT; + mtx_unlock(&np->n_mtx); + } + if (docommit != 0) { + if (error == 0) + error = nfsrpc_commitds(vp, io_off, xfer, + *dspp, fhp, cred, p); + if (error == 0) { + /* + * Set both eof and uio_resid = 0 to end any + * loops. + */ + *eofp = 1; + uiop->uio_resid = 0; + } else { + mtx_lock(&np->n_mtx); + np->n_flag &= ~NDSCOMMIT; + mtx_unlock(&np->n_mtx); + } + } else if (rwflag == FREAD) error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp, io_off, xfer, fhp, cred, p); else { @@ -5974,13 +5997,12 @@ nfscl_getsameserver(struct nfsmount *nmp, struct nfscl return (NFSDSP_NOTFOUND); } -#ifdef notyet /* - * NFS commit rpc to a DS. + * NFS commit rpc to a NFSv4.1 DS. */ static int nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, - struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p, void *stuff) + struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p) { uint32_t *tl; struct nfsrv_descript nfsd, *nd = &nfsd; @@ -5988,6 +6010,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfssockreq *nrp; int error; + nd->nd_mrep = NULL; nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); @@ -6000,7 +6023,7 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, nrp = &nmp->nm_sockreq; error = newnfs_request(nd, nmp, NULL, nrp, vp, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); - if (error) + if (error != 0) return (error); if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF); @@ -6017,5 +6040,4 @@ nfsmout: mbuf_freem(nd->nd_mrep); return (error); } -#endif Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 15 19:22:01 2017 (r321030) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 15 19:24:54 2017 (r321031) @@ -1376,7 +1376,7 @@ ncl_readrpc(struct vnode *vp, struct uio *uiop, struct attrflag = 0; if (NFSHASPNFS(nmp)) error = nfscl_doiods(vp, uiop, NULL, NULL, - NFSV4OPEN_ACCESSREAD, cred, uiop->uio_td); + NFSV4OPEN_ACCESSREAD, 0, cred, uiop->uio_td); NFSCL_DEBUG(4, "readrpc: aft doiods=%d\n", error); if (error != 0) error = nfsrpc_read(vp, uiop, cred, uiop->uio_td, &nfsva, @@ -1407,7 +1407,7 @@ ncl_writerpc(struct vnode *vp, struct uio *uiop, struc attrflag = 0; if (NFSHASPNFS(nmp)) error = nfscl_doiods(vp, uiop, iomode, must_commit, - NFSV4OPEN_ACCESSWRITE, cred, uiop->uio_td); + NFSV4OPEN_ACCESSWRITE, 0, cred, uiop->uio_td); NFSCL_DEBUG(4, "writerpc: aft doiods=%d\n", error); if (error != 0) error = nfsrpc_write(vp, uiop, iomode, must_commit, cred, @@ -2562,16 +2562,34 @@ ncl_commit(struct vnode *vp, u_quad_t offset, int cnt, { struct nfsvattr nfsva; struct nfsmount *nmp = VFSTONFS(vp->v_mount); + struct nfsnode *np; + struct uio uio; int error, attrflag; - mtx_lock(&nmp->nm_mtx); - if ((nmp->nm_state & NFSSTA_HASWRITEVERF) == 0) { + np = VTONFS(vp); + error = EIO; + attrflag = 0; + if (NFSHASPNFS(nmp) && (np->n_flag & NDSCOMMIT) != 0) { + uio.uio_offset = offset; + uio.uio_resid = cnt; + error = nfscl_doiods(vp, &uio, NULL, NULL, + NFSV4OPEN_ACCESSWRITE, 1, cred, td); + if (error != 0) { + mtx_lock(&np->n_mtx); + np->n_flag &= ~NDSCOMMIT; + mtx_unlock(&np->n_mtx); + } + } + if (error != 0) { + mtx_lock(&nmp->nm_mtx); + if ((nmp->nm_state & NFSSTA_HASWRITEVERF) == 0) { + mtx_unlock(&nmp->nm_mtx); + return (0); + } mtx_unlock(&nmp->nm_mtx); - return (0); + error = nfsrpc_commit(vp, offset, cnt, cred, td, &nfsva, + &attrflag, NULL); } - mtx_unlock(&nmp->nm_mtx); - error = nfsrpc_commit(vp, offset, cnt, cred, td, &nfsva, - &attrflag, NULL); if (attrflag != 0) (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1); Modified: stable/10/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/10/sys/fs/nfsclient/nfsnode.h Sat Jul 15 19:22:01 2017 (r321030) +++ stable/10/sys/fs/nfsclient/nfsnode.h Sat Jul 15 19:24:54 2017 (r321031) @@ -158,6 +158,7 @@ struct nfsnode { #define NNOLAYOUT 0x00020000 /* Can't get a layout for this file */ #define NWRITEOPENED 0x00040000 /* Has been opened for writing */ #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ +#define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ /* * Convert between nfsnode pointers and vnode pointers From owner-svn-src-stable@freebsd.org Sat Jul 15 19:43:03 2017 Return-Path: Delivered-To: svn-src-stable@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 DE2C7B7AB12; Sat, 15 Jul 2017 19:43:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F503828BA; Sat, 15 Jul 2017 19:43:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6FJh2mh026736; Sat, 15 Jul 2017 19:43:02 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6FJh2nH026735; Sat, 15 Jul 2017 19:43:02 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201707151943.v6FJh2nH026735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 15 Jul 2017 19:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321032 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sys/fs/nfsclient X-SVN-Commit-Revision: 321032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2017 19:43:04 -0000 Author: rmacklem Date: Sat Jul 15 19:43:02 2017 New Revision: 321032 URL: https://svnweb.freebsd.org/changeset/base/321032 Log: MFC: r320458 Fix an NFSv3 client case that probably never happens. If an NFSv3 server were to reply with weak cache consistency attributes, but not post operation attributes, the client would use garbage attributes from memory. This was spotted during work on the code for the NFSv4.1 client. I have never seen evidence that this happens and it wouldn't make sense for an NFSv3 server to do this, so this patch is basically "theoretical", but does fix the problem if a server were to do the above. Modified: stable/11/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Sat Jul 15 19:24:54 2017 (r321031) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Sat Jul 15 19:43:02 2017 (r321032) @@ -743,6 +743,8 @@ nfscl_wcc_data(struct nfsrv_descript *nd, struct vnode } } error = nfscl_postop_attr(nd, nap, flagp, stuff); + if (wccflagp != NULL && *flagp == 0) + *wccflagp = 0; } else if ((nd->nd_flag & (ND_NOMOREDATA | ND_NFSV4 | ND_V4WCCATTR)) == (ND_NFSV4 | ND_V4WCCATTR)) { error = nfsv4_loadattr(nd, NULL, &nfsva, NULL,